From d5dc0bc3af8b12ae62cac5fbe975df10ba0a48be Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 11 Aug 2025 16:39:59 -0500 Subject: [PATCH] fixed bug related to moderator position status in discussion guide --- .DS_Store | Bin 14340 -> 14340 bytes backend/app/routes/focus_group_ai.py | 11 +-- backend/prompts/focus-group-response.md | 5 +- .../{index-C2iKqYFP.js => index-C4rrBVCh.js} | 84 +++++++++--------- dist/index.html | 2 +- src/pages/FocusGroupSession.tsx | 23 ++++- 6 files changed, 70 insertions(+), 55 deletions(-) rename dist/assets/{index-C2iKqYFP.js => index-C4rrBVCh.js} (94%) diff --git a/.DS_Store b/.DS_Store index 8fed3ab4c49db59a48b83ee1c5febaac6d2f3261..3e7c32a606b92f62cf230ca5a6f120f1dcf87e83 100644 GIT binary patch delta 65 zcmZoEXerp>D8RULa)m@8w`6s-uA!xlf~lF|C@|Sjv6Rg~N5Ra@X!1S*naL*{throw TypeError(t)};var tS=(t,e,n)=>e.has(t)||ck("Cannot "+n);var ve=(t,e,n)=>(tS(t,e,"read from private field"),n?n.call(t):e.get(t)),hn=(t,e,n)=>e.has(t)?ck("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Gt=(t,e,n,r)=>(tS(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),qr=(t,e,n)=>(tS(t,e,"access private method"),n);var Fg=(t,e,n,r)=>({set _(i){Gt(t,e,i,n)},get _(){return ve(t,e,r)}});function HW(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Bg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function un(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Y$={exports:{}},Vb={},Q$={exports:{}},Qt={};/** +var ck=t=>{throw TypeError(t)};var tS=(t,e,n)=>e.has(t)||ck("Cannot "+n);var ve=(t,e,n)=>(tS(t,e,"read from private field"),n?n.call(t):e.get(t)),pn=(t,e,n)=>e.has(t)?ck("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Vt=(t,e,n,r)=>(tS(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),qr=(t,e,n)=>(tS(t,e,"access private method"),n);var Fg=(t,e,n,r)=>({set _(i){Vt(t,e,i,n)},get _(){return ve(t,e,r)}});function HW(t,e){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Bg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function dn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Y$={exports:{}},Vb={},Q$={exports:{}},Qt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var ck=t=>{throw TypeError(t)};var tS=(t,e,n)=>e.has(t)||ck("Cannot "+n);var ve= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ag=Symbol.for("react.element"),zW=Symbol.for("react.portal"),GW=Symbol.for("react.fragment"),VW=Symbol.for("react.strict_mode"),KW=Symbol.for("react.profiler"),WW=Symbol.for("react.provider"),qW=Symbol.for("react.context"),YW=Symbol.for("react.forward_ref"),QW=Symbol.for("react.suspense"),XW=Symbol.for("react.memo"),JW=Symbol.for("react.lazy"),lk=Symbol.iterator;function ZW(t){return t===null||typeof t!="object"?null:(t=lk&&t[lk]||t["@@iterator"],typeof t=="function"?t:null)}var X$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},J$=Object.assign,Z$={};function Pf(t,e,n){this.props=t,this.context=e,this.refs=Z$,this.updater=n||X$}Pf.prototype.isReactComponent={};Pf.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Pf.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function eL(){}eL.prototype=Pf.prototype;function vj(t,e,n){this.props=t,this.context=e,this.refs=Z$,this.updater=n||X$}var yj=vj.prototype=new eL;yj.constructor=vj;J$(yj,Pf.prototype);yj.isPureReactComponent=!0;var uk=Array.isArray,tL=Object.prototype.hasOwnProperty,xj={current:null},nL={key:!0,ref:!0,__self:!0,__source:!0};function rL(t,e,n){var r,i={},o=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)tL.call(e,r)&&!nL.hasOwnProperty(r)&&(i[r]=e[r]);var c=arguments.length-2;if(c===1)i.children=n;else if(1{throw TypeError(t)};var tS=(t,e,n)=>e.has(t)||ck("Cannot "+n);var ve= * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var dq=v,no=uq;function Ce(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),RC=Object.prototype.hasOwnProperty,fq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fk={},hk={};function hq(t){return RC.call(hk,t)?!0:RC.call(fk,t)?!1:fq.test(t)?hk[t]=!0:(fk[t]=!0,!1)}function pq(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function mq(t,e,n,r){if(e===null||typeof e>"u"||pq(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function wi(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Vr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Vr[t]=new wi(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Vr[e]=new wi(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Vr[t]=new wi(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Vr[t]=new wi(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Vr[t]=new wi(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Vr[t]=new wi(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Vr[t]=new wi(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Vr[t]=new wi(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Vr[t]=new wi(t,5,!1,t.toLowerCase(),null,!1,!1)});var wj=/[\-:]([a-z])/g;function Sj(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Vr[t]=new wi(t,1,!1,t.toLowerCase(),null,!1,!1)});Vr.xlinkHref=new wi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Vr[t]=new wi(t,1,!1,t.toLowerCase(),null,!0,!0)});function Cj(t,e,n,r){var i=Vr.hasOwnProperty(e)?Vr[e]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),RC=Object.prototype.hasOwnProperty,fq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,fk={},hk={};function hq(t){return RC.call(hk,t)?!0:RC.call(fk,t)?!1:fq.test(t)?hk[t]=!0:(fk[t]=!0,!1)}function pq(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function mq(t,e,n,r){if(e===null||typeof e>"u"||pq(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function wi(t,e,n,r,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Vr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Vr[t]=new wi(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Vr[e]=new wi(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Vr[t]=new wi(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Vr[t]=new wi(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Vr[t]=new wi(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Vr[t]=new wi(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Vr[t]=new wi(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Vr[t]=new wi(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Vr[t]=new wi(t,5,!1,t.toLowerCase(),null,!1,!1)});var wj=/[\-:]([a-z])/g;function Sj(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(wj,Sj);Vr[e]=new wi(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Vr[t]=new wi(t,1,!1,t.toLowerCase(),null,!1,!1)});Vr.xlinkHref=new wi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Vr[t]=new wi(t,1,!1,t.toLowerCase(),null,!0,!0)});function Cj(t,e,n,r){var i=Vr.hasOwnProperty(e)?Vr[e]:null;(i!==null?i.type!==0:r||!(2c||i[s]!==o[c]){var l=` -`+i[s].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=s&&0<=c);break}}}finally{iS=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Fh(t):""}function gq(t){switch(t.tag){case 5:return Fh(t.type);case 16:return Fh("Lazy");case 13:return Fh("Suspense");case 19:return Fh("SuspenseList");case 0:case 2:case 15:return t=oS(t.type,!1),t;case 11:return t=oS(t.type.render,!1),t;case 1:return t=oS(t.type,!0),t;default:return""}}function LC(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Xu:return"Fragment";case Qu:return"Portal";case MC:return"Profiler";case _j:return"StrictMode";case DC:return"Suspense";case $C:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case fL:return(t.displayName||"Context")+".Consumer";case dL:return(t._context.displayName||"Context")+".Provider";case Aj:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case jj:return e=t.displayName||null,e!==null?e:LC(t.type)||"Memo";case rc:e=t._payload,t=t._init;try{return LC(t(e))}catch{}}return null}function vq(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return LC(e);case 8:return e===_j?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Vc(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function pL(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function yq(t){var e=pL(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function zg(t){t._valueTracker||(t._valueTracker=yq(t))}function mL(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=pL(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function py(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function FC(t,e){var n=e.checked;return Wn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function mk(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Vc(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function gL(t,e){e=e.checked,e!=null&&Cj(t,"checked",e,!1)}function BC(t,e){gL(t,e);var n=Vc(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?UC(t,e.type,n):e.hasOwnProperty("defaultValue")&&UC(t,e.type,Vc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function gk(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function UC(t,e,n){(e!=="number"||py(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Bh=Array.isArray;function hd(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Gg.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function _p(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Zh={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xq=["Webkit","ms","Moz","O"];Object.keys(Zh).forEach(function(t){xq.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Zh[e]=Zh[t]})});function bL(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Zh.hasOwnProperty(t)&&Zh[t]?(""+e).trim():e+"px"}function wL(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=bL(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var bq=Wn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function GC(t,e){if(e){if(bq[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ce(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ce(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ce(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ce(62))}}function VC(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var KC=null;function Ej(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var WC=null,pd=null,md=null;function xk(t){if(t=ug(t)){if(typeof WC!="function")throw Error(Ce(280));var e=t.stateNode;e&&(e=Qb(e),WC(t.stateNode,t.type,e))}}function SL(t){pd?md?md.push(t):md=[t]:pd=t}function CL(){if(pd){var t=pd,e=md;if(md=pd=null,xk(t),e)for(t=0;t>>=0,t===0?32:31-(kq(t)/Oq|0)|0}var Vg=64,Kg=4194304;function Uh(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function yy(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var c=s&~i;c!==0?r=Uh(c):(o&=s,o!==0&&(r=Uh(o)))}else s=n&~i,s!==0?r=Uh(s):o!==0&&(r=Uh(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function cg(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Yo(e),t[e]=n}function Dq(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=tp),Tk=" ",Nk=!1;function zL(t,e){switch(t){case"keyup":return u7.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GL(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ju=!1;function f7(t,e){switch(t){case"compositionend":return GL(e);case"keypress":return e.which!==32?null:(Nk=!0,Tk);case"textInput":return t=e.data,t===Tk&&Nk?null:t;default:return null}}function h7(t,e){if(Ju)return t==="compositionend"||!Mj&&zL(t,e)?(t=UL(),Fv=Oj=yc=null,Ju=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ik(n)}}function qL(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?qL(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function YL(){for(var t=window,e=py();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=py(t.document)}return e}function Dj(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function S7(t){var e=YL(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&qL(n.ownerDocument.documentElement,n)){if(r!==null&&Dj(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=Rk(n,o);var s=Rk(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Zu=null,ZC=null,rp=null,e_=!1;function Mk(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;e_||Zu==null||Zu!==py(r)||(r=Zu,"selectionStart"in r&&Dj(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),rp&&Pp(rp,r)||(rp=r,r=wy(ZC,"onSelect"),0nd||(t.current=s_[nd],s_[nd]=null,nd--)}function kn(t,e){nd++,s_[nd]=t.current,t.current=e}var Kc={},ii=sl(Kc),ki=sl(!1),tu=Kc;function zd(t,e){var n=t.type.contextTypes;if(!n)return Kc;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Oi(t){return t=t.childContextTypes,t!=null}function Cy(){Fn(ki),Fn(ii)}function Hk(t,e,n){if(ii.current!==Kc)throw Error(Ce(168));kn(ii,e),kn(ki,n)}function iF(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Ce(108,vq(t)||"Unknown",i));return Wn({},n,r)}function _y(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Kc,tu=ii.current,kn(ii,t),kn(ki,ki.current),!0}function zk(t,e,n){var r=t.stateNode;if(!r)throw Error(Ce(169));n?(t=iF(t,e,tu),r.__reactInternalMemoizedMergedChildContext=t,Fn(ki),Fn(ii),kn(ii,t)):Fn(ki),kn(ki,n)}var ha=null,Xb=!1,xS=!1;function oF(t){ha===null?ha=[t]:ha.push(t)}function R7(t){Xb=!0,oF(t)}function al(){if(!xS&&ha!==null){xS=!0;var t=0,e=yn;try{var n=ha;for(yn=1;t>=s,i-=s,ga=1<<32-Yo(e)+i|n<j?(P=A,A=null):P=A.sibling;var k=h(b,A,w[j],S);if(k===null){A===null&&(A=P);break}t&&A&&k.alternate===null&&e(b,A),x=o(k,x,j),_===null?C=k:_.sibling=k,_=k,A=P}if(j===w.length)return n(b,A),Hn&&wl(b,j),C;if(A===null){for(;jj?(P=A,A=null):P=A.sibling;var O=h(b,A,k.value,S);if(O===null){A===null&&(A=P);break}t&&A&&O.alternate===null&&e(b,A),x=o(O,x,j),_===null?C=O:_.sibling=O,_=O,A=P}if(k.done)return n(b,A),Hn&&wl(b,j),C;if(A===null){for(;!k.done;j++,k=w.next())k=f(b,k.value,S),k!==null&&(x=o(k,x,j),_===null?C=k:_.sibling=k,_=k);return Hn&&wl(b,j),C}for(A=r(b,A);!k.done;j++,k=w.next())k=p(A,b,j,k.value,S),k!==null&&(t&&k.alternate!==null&&A.delete(k.key===null?j:k.key),x=o(k,x,j),_===null?C=k:_.sibling=k,_=k);return t&&A.forEach(function(E){return e(b,E)}),Hn&&wl(b,j),C}function y(b,x,w,S){if(typeof w=="object"&&w!==null&&w.type===Xu&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Hg:e:{for(var C=w.key,_=x;_!==null;){if(_.key===C){if(C=w.type,C===Xu){if(_.tag===7){n(b,_.sibling),x=i(_,w.props.children),x.return=b,b=x;break e}}else if(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===rc&&Kk(C)===_.type){n(b,_.sibling),x=i(_,w.props),x.ref=xh(b,_,w),x.return=b,b=x;break e}n(b,_);break}else e(b,_);_=_.sibling}w.type===Xu?(x=Wl(w.props.children,b.mode,S,w.key),x.return=b,b=x):(S=Wv(w.type,w.key,w.props,null,b.mode,S),S.ref=xh(b,x,w),S.return=b,b=S)}return s(b);case Qu:e:{for(_=w.key;x!==null;){if(x.key===_)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=i(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else e(b,x);x=x.sibling}x=ES(w,b.mode,S),x.return=b,b=x}return s(b);case rc:return _=w._init,y(b,x,_(w._payload),S)}if(Bh(w))return g(b,x,w,S);if(ph(w))return m(b,x,w,S);Zg(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=i(x,w),x.return=b,b=x):(n(b,x),x=jS(w,b.mode,S),x.return=b,b=x),s(b)):n(b,x)}return y}var Vd=lF(!0),uF=lF(!1),Ey=sl(null),Ty=null,od=null,Bj=null;function Uj(){Bj=od=Ty=null}function Hj(t){var e=Ey.current;Fn(Ey),t._currentValue=e}function l_(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function vd(t,e){Ty=t,Bj=od=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ni=!0),t.firstContext=null)}function Eo(t){var e=t._currentValue;if(Bj!==t)if(t={context:t,memoizedValue:e,next:null},od===null){if(Ty===null)throw Error(Ce(308));od=t,Ty.dependencies={lanes:0,firstContext:t}}else od=od.next=t;return e}var Nl=null;function zj(t){Nl===null?Nl=[t]:Nl.push(t)}function dF(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,zj(e)):(n.next=i.next,i.next=n),e.interleaved=n,ka(t,r)}function ka(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var ic=!1;function Gj(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fF(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function _a(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Tc(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,on&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ka(t,n)}return i=r.interleaved,i===null?(e.next=e,zj(r)):(e.next=i.next,i.next=e),r.interleaved=e,ka(t,n)}function Uv(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Nj(t,n)}}function Wk(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Ny(t,e,n,r){var i=t.updateQueue;ic=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,c=i.shared.pending;if(c!==null){i.shared.pending=null;var l=c,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,c=d.lastBaseUpdate,c!==s&&(c===null?d.firstBaseUpdate=u:c.next=u,d.lastBaseUpdate=l))}if(o!==null){var f=i.baseState;s=0,d=u=l=null,c=o;do{var h=c.lane,p=c.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var g=t,m=c;switch(h=e,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=Wn({},f,h);break e;case 2:ic=!0}}c.callback!==null&&c.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[c]:h.push(c))}else p={eventTime:p,lane:h,tag:c.tag,payload:c.payload,callback:c.callback,next:null},d===null?(u=d=p,l=f):d=d.next=p,s|=h;if(c=c.next,c===null){if(c=i.shared.pending,c===null)break;h=c,c=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);iu|=s,t.lanes=s,t.memoizedState=f}}function qk(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=wS.transition;wS.transition={};try{t(!1),e()}finally{yn=n,wS.transition=r}}function NF(){return To().memoizedState}function L7(t,e,n){var r=Pc(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},PF(t))kF(e,n);else if(n=dF(t,e,n,r),n!==null){var i=yi();Qo(n,t,r,i),OF(n,e,r)}}function F7(t,e,n){var r=Pc(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(PF(t))kF(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,c=o(s,n);if(i.hasEagerState=!0,i.eagerState=c,is(c,s)){var l=e.interleaved;l===null?(i.next=i,zj(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=dF(t,e,i,r),n!==null&&(i=yi(),Qo(n,t,r,i),OF(n,e,r))}}function PF(t){var e=t.alternate;return t===Kn||e!==null&&e===Kn}function kF(t,e){ip=ky=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function OF(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Nj(t,n)}}var Oy={readContext:Eo,useCallback:Yr,useContext:Yr,useEffect:Yr,useImperativeHandle:Yr,useInsertionEffect:Yr,useLayoutEffect:Yr,useMemo:Yr,useReducer:Yr,useRef:Yr,useState:Yr,useDebugValue:Yr,useDeferredValue:Yr,useTransition:Yr,useMutableSource:Yr,useSyncExternalStore:Yr,useId:Yr,unstable_isNewReconciler:!1},B7={readContext:Eo,useCallback:function(t,e){return bs().memoizedState=[t,e===void 0?null:e],t},useContext:Eo,useEffect:Qk,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,zv(4194308,4,_F.bind(null,e,t),n)},useLayoutEffect:function(t,e){return zv(4194308,4,t,e)},useInsertionEffect:function(t,e){return zv(4,2,t,e)},useMemo:function(t,e){var n=bs();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=bs();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=L7.bind(null,Kn,t),[r.memoizedState,t]},useRef:function(t){var e=bs();return t={current:t},e.memoizedState=t},useState:Yk,useDebugValue:Jj,useDeferredValue:function(t){return bs().memoizedState=t},useTransition:function(){var t=Yk(!1),e=t[0];return t=$7.bind(null,t[1]),bs().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Kn,i=bs();if(Hn){if(n===void 0)throw Error(Ce(407));n=n()}else{if(n=e(),Mr===null)throw Error(Ce(349));ru&30||gF(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,Qk(yF.bind(null,r,o,t),[t]),r.flags|=2048,Lp(9,vF.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=bs(),e=Mr.identifierPrefix;if(Hn){var n=va,r=ga;n=(r&~(1<<32-Yo(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Dp++,0")&&(l=l.replace("",t.displayName)),l}while(1<=s&&0<=c);break}}}finally{iS=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Fh(t):""}function gq(t){switch(t.tag){case 5:return Fh(t.type);case 16:return Fh("Lazy");case 13:return Fh("Suspense");case 19:return Fh("SuspenseList");case 0:case 2:case 15:return t=oS(t.type,!1),t;case 11:return t=oS(t.type.render,!1),t;case 1:return t=oS(t.type,!0),t;default:return""}}function LC(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Xu:return"Fragment";case Qu:return"Portal";case MC:return"Profiler";case _j:return"StrictMode";case DC:return"Suspense";case $C:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case fL:return(t.displayName||"Context")+".Consumer";case dL:return(t._context.displayName||"Context")+".Provider";case Aj:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case jj:return e=t.displayName||null,e!==null?e:LC(t.type)||"Memo";case rc:e=t._payload,t=t._init;try{return LC(t(e))}catch{}}return null}function vq(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return LC(e);case 8:return e===_j?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Vc(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function pL(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function yq(t){var e=pL(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function zg(t){t._valueTracker||(t._valueTracker=yq(t))}function mL(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=pL(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function py(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function FC(t,e){var n=e.checked;return qn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function mk(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Vc(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function gL(t,e){e=e.checked,e!=null&&Cj(t,"checked",e,!1)}function BC(t,e){gL(t,e);var n=Vc(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?UC(t,e.type,n):e.hasOwnProperty("defaultValue")&&UC(t,e.type,Vc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function gk(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function UC(t,e,n){(e!=="number"||py(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Bh=Array.isArray;function hd(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Gg.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function _p(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Zh={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},xq=["Webkit","ms","Moz","O"];Object.keys(Zh).forEach(function(t){xq.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Zh[e]=Zh[t]})});function bL(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Zh.hasOwnProperty(t)&&Zh[t]?(""+e).trim():e+"px"}function wL(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=bL(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var bq=qn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function GC(t,e){if(e){if(bq[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Ce(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Ce(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Ce(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Ce(62))}}function VC(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var KC=null;function Ej(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var WC=null,pd=null,md=null;function xk(t){if(t=ug(t)){if(typeof WC!="function")throw Error(Ce(280));var e=t.stateNode;e&&(e=Qb(e),WC(t.stateNode,t.type,e))}}function SL(t){pd?md?md.push(t):md=[t]:pd=t}function CL(){if(pd){var t=pd,e=md;if(md=pd=null,xk(t),e)for(t=0;t>>=0,t===0?32:31-(kq(t)/Oq|0)|0}var Vg=64,Kg=4194304;function Uh(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function yy(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,i=t.suspendedLanes,o=t.pingedLanes,s=n&268435455;if(s!==0){var c=s&~i;c!==0?r=Uh(c):(o&=s,o!==0&&(r=Uh(o)))}else s=n&~i,s!==0?r=Uh(s):o!==0&&(r=Uh(o));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function cg(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Yo(e),t[e]=n}function Dq(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=tp),Tk=" ",Nk=!1;function zL(t,e){switch(t){case"keyup":return u7.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function GL(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ju=!1;function f7(t,e){switch(t){case"compositionend":return GL(e);case"keypress":return e.which!==32?null:(Nk=!0,Tk);case"textInput":return t=e.data,t===Tk&&Nk?null:t;default:return null}}function h7(t,e){if(Ju)return t==="compositionend"||!Mj&&zL(t,e)?(t=UL(),Fv=Oj=yc=null,Ju=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ik(n)}}function qL(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?qL(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function YL(){for(var t=window,e=py();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=py(t.document)}return e}function Dj(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function S7(t){var e=YL(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&qL(n.ownerDocument.documentElement,n)){if(r!==null&&Dj(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!t.extend&&o>r&&(i=r,r=o,o=i),i=Rk(n,o);var s=Rk(n,r);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Zu=null,ZC=null,rp=null,e_=!1;function Mk(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;e_||Zu==null||Zu!==py(r)||(r=Zu,"selectionStart"in r&&Dj(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),rp&&Pp(rp,r)||(rp=r,r=wy(ZC,"onSelect"),0nd||(t.current=s_[nd],s_[nd]=null,nd--)}function kn(t,e){nd++,s_[nd]=t.current,t.current=e}var Kc={},ii=sl(Kc),ki=sl(!1),tu=Kc;function zd(t,e){var n=t.type.contextTypes;if(!n)return Kc;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=e[o];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function Oi(t){return t=t.childContextTypes,t!=null}function Cy(){Bn(ki),Bn(ii)}function Hk(t,e,n){if(ii.current!==Kc)throw Error(Ce(168));kn(ii,e),kn(ki,n)}function iF(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(Ce(108,vq(t)||"Unknown",i));return qn({},n,r)}function _y(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Kc,tu=ii.current,kn(ii,t),kn(ki,ki.current),!0}function zk(t,e,n){var r=t.stateNode;if(!r)throw Error(Ce(169));n?(t=iF(t,e,tu),r.__reactInternalMemoizedMergedChildContext=t,Bn(ki),Bn(ii),kn(ii,t)):Bn(ki),kn(ki,n)}var ha=null,Xb=!1,xS=!1;function oF(t){ha===null?ha=[t]:ha.push(t)}function R7(t){Xb=!0,oF(t)}function al(){if(!xS&&ha!==null){xS=!0;var t=0,e=xn;try{var n=ha;for(xn=1;t>=s,i-=s,ga=1<<32-Yo(e)+i|n<j?(P=A,A=null):P=A.sibling;var k=h(b,A,w[j],S);if(k===null){A===null&&(A=P);break}t&&A&&k.alternate===null&&e(b,A),x=o(k,x,j),_===null?C=k:_.sibling=k,_=k,A=P}if(j===w.length)return n(b,A),zn&&wl(b,j),C;if(A===null){for(;jj?(P=A,A=null):P=A.sibling;var O=h(b,A,k.value,S);if(O===null){A===null&&(A=P);break}t&&A&&O.alternate===null&&e(b,A),x=o(O,x,j),_===null?C=O:_.sibling=O,_=O,A=P}if(k.done)return n(b,A),zn&&wl(b,j),C;if(A===null){for(;!k.done;j++,k=w.next())k=f(b,k.value,S),k!==null&&(x=o(k,x,j),_===null?C=k:_.sibling=k,_=k);return zn&&wl(b,j),C}for(A=r(b,A);!k.done;j++,k=w.next())k=p(A,b,j,k.value,S),k!==null&&(t&&k.alternate!==null&&A.delete(k.key===null?j:k.key),x=o(k,x,j),_===null?C=k:_.sibling=k,_=k);return t&&A.forEach(function(E){return e(b,E)}),zn&&wl(b,j),C}function y(b,x,w,S){if(typeof w=="object"&&w!==null&&w.type===Xu&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Hg:e:{for(var C=w.key,_=x;_!==null;){if(_.key===C){if(C=w.type,C===Xu){if(_.tag===7){n(b,_.sibling),x=i(_,w.props.children),x.return=b,b=x;break e}}else if(_.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===rc&&Kk(C)===_.type){n(b,_.sibling),x=i(_,w.props),x.ref=xh(b,_,w),x.return=b,b=x;break e}n(b,_);break}else e(b,_);_=_.sibling}w.type===Xu?(x=Wl(w.props.children,b.mode,S,w.key),x.return=b,b=x):(S=Wv(w.type,w.key,w.props,null,b.mode,S),S.ref=xh(b,x,w),S.return=b,b=S)}return s(b);case Qu:e:{for(_=w.key;x!==null;){if(x.key===_)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=i(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else e(b,x);x=x.sibling}x=ES(w,b.mode,S),x.return=b,b=x}return s(b);case rc:return _=w._init,y(b,x,_(w._payload),S)}if(Bh(w))return g(b,x,w,S);if(ph(w))return m(b,x,w,S);Zg(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=i(x,w),x.return=b,b=x):(n(b,x),x=jS(w,b.mode,S),x.return=b,b=x),s(b)):n(b,x)}return y}var Vd=lF(!0),uF=lF(!1),Ey=sl(null),Ty=null,od=null,Bj=null;function Uj(){Bj=od=Ty=null}function Hj(t){var e=Ey.current;Bn(Ey),t._currentValue=e}function l_(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function vd(t,e){Ty=t,Bj=od=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Ni=!0),t.firstContext=null)}function Eo(t){var e=t._currentValue;if(Bj!==t)if(t={context:t,memoizedValue:e,next:null},od===null){if(Ty===null)throw Error(Ce(308));od=t,Ty.dependencies={lanes:0,firstContext:t}}else od=od.next=t;return e}var Nl=null;function zj(t){Nl===null?Nl=[t]:Nl.push(t)}function dF(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,zj(e)):(n.next=i.next,i.next=n),e.interleaved=n,ka(t,r)}function ka(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var ic=!1;function Gj(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function fF(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function _a(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Tc(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,on&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ka(t,n)}return i=r.interleaved,i===null?(e.next=e,zj(r)):(e.next=i.next,i.next=e),r.interleaved=e,ka(t,n)}function Uv(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Nj(t,n)}}function Wk(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=s:o=o.next=s,n=n.next}while(n!==null);o===null?i=o=e:o=o.next=e}else i=o=e;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Ny(t,e,n,r){var i=t.updateQueue;ic=!1;var o=i.firstBaseUpdate,s=i.lastBaseUpdate,c=i.shared.pending;if(c!==null){i.shared.pending=null;var l=c,u=l.next;l.next=null,s===null?o=u:s.next=u,s=l;var d=t.alternate;d!==null&&(d=d.updateQueue,c=d.lastBaseUpdate,c!==s&&(c===null?d.firstBaseUpdate=u:c.next=u,d.lastBaseUpdate=l))}if(o!==null){var f=i.baseState;s=0,d=u=l=null,c=o;do{var h=c.lane,p=c.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var g=t,m=c;switch(h=e,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=qn({},f,h);break e;case 2:ic=!0}}c.callback!==null&&c.lane!==0&&(t.flags|=64,h=i.effects,h===null?i.effects=[c]:h.push(c))}else p={eventTime:p,lane:h,tag:c.tag,payload:c.payload,callback:c.callback,next:null},d===null?(u=d=p,l=f):d=d.next=p,s|=h;if(c=c.next,c===null){if(c=i.shared.pending,c===null)break;h=c,c=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);if(d===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=d,e=i.shared.interleaved,e!==null){i=e;do s|=i.lane,i=i.next;while(i!==e)}else o===null&&(i.shared.lanes=0);iu|=s,t.lanes=s,t.memoizedState=f}}function qk(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=wS.transition;wS.transition={};try{t(!1),e()}finally{xn=n,wS.transition=r}}function NF(){return To().memoizedState}function L7(t,e,n){var r=Pc(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},PF(t))kF(e,n);else if(n=dF(t,e,n,r),n!==null){var i=yi();Qo(n,t,r,i),OF(n,e,r)}}function F7(t,e,n){var r=Pc(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(PF(t))kF(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,c=o(s,n);if(i.hasEagerState=!0,i.eagerState=c,is(c,s)){var l=e.interleaved;l===null?(i.next=i,zj(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=dF(t,e,i,r),n!==null&&(i=yi(),Qo(n,t,r,i),OF(n,e,r))}}function PF(t){var e=t.alternate;return t===Wn||e!==null&&e===Wn}function kF(t,e){ip=ky=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function OF(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Nj(t,n)}}var Oy={readContext:Eo,useCallback:Yr,useContext:Yr,useEffect:Yr,useImperativeHandle:Yr,useInsertionEffect:Yr,useLayoutEffect:Yr,useMemo:Yr,useReducer:Yr,useRef:Yr,useState:Yr,useDebugValue:Yr,useDeferredValue:Yr,useTransition:Yr,useMutableSource:Yr,useSyncExternalStore:Yr,useId:Yr,unstable_isNewReconciler:!1},B7={readContext:Eo,useCallback:function(t,e){return bs().memoizedState=[t,e===void 0?null:e],t},useContext:Eo,useEffect:Qk,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,zv(4194308,4,_F.bind(null,e,t),n)},useLayoutEffect:function(t,e){return zv(4194308,4,t,e)},useInsertionEffect:function(t,e){return zv(4,2,t,e)},useMemo:function(t,e){var n=bs();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=bs();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=L7.bind(null,Wn,t),[r.memoizedState,t]},useRef:function(t){var e=bs();return t={current:t},e.memoizedState=t},useState:Yk,useDebugValue:Jj,useDeferredValue:function(t){return bs().memoizedState=t},useTransition:function(){var t=Yk(!1),e=t[0];return t=$7.bind(null,t[1]),bs().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Wn,i=bs();if(zn){if(n===void 0)throw Error(Ce(407));n=n()}else{if(n=e(),Mr===null)throw Error(Ce(349));ru&30||gF(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,Qk(yF.bind(null,r,o,t),[t]),r.flags|=2048,Lp(9,vF.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=bs(),e=Mr.identifierPrefix;if(zn){var n=va,r=ga;n=(r&~(1<<32-Yo(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Dp++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Es]=e,t[Ip]=r,HF(t,e,!1,!1),e.stateNode=t;e:{switch(s=VC(n,r),n){case"dialog":In("cancel",t),In("close",t),i=r;break;case"iframe":case"object":case"embed":In("load",t),i=r;break;case"video":case"audio":for(i=0;iqd&&(e.flags|=128,r=!0,bh(o,!1),e.lanes=4194304)}else{if(!r)if(t=Py(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),bh(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Hn)return Qr(e),null}else 2*rr()-o.renderingStartTime>qd&&n!==1073741824&&(e.flags|=128,r=!0,bh(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=rr(),e.sibling=null,n=Vn.current,kn(Vn,r?n&1|2:n&1),e):(Qr(e),null);case 22:case 23:return iE(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Vi&1073741824&&(Qr(e),e.subtreeFlags&6&&(e.flags|=8192)):Qr(e),null;case 24:return null;case 25:return null}throw Error(Ce(156,e.tag))}function q7(t,e){switch(Lj(e),e.tag){case 1:return Oi(e.type)&&Cy(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Kd(),Fn(ki),Fn(ii),Wj(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Kj(e),null;case 13:if(Fn(Vn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Ce(340));Gd()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Fn(Vn),null;case 4:return Kd(),null;case 10:return Hj(e.type._context),null;case 22:case 23:return iE(),null;case 24:return null;default:return null}}var tv=!1,ti=!1,Y7=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function sd(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qn(t,e,r)}else n.current=null}function y_(t,e,n){try{n()}catch(r){Qn(t,e,r)}}var aO=!1;function Q7(t,e){if(t_=xy,t=YL(),Dj(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,c=-1,l=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++u===i&&(c=s),h===o&&++d===r&&(l=s),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(n_={focusedElem:t,selectionRange:n},xy=!1,Xe=e;Xe!==null;)if(e=Xe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Xe=t;else for(;Xe!==null;){e=Xe;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,b=e.stateNode,x=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:$o(e.type,m),y);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ce(163))}}catch(S){Qn(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Xe=t;break}Xe=e.return}return g=aO,aO=!1,g}function op(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&y_(e,n,o)}i=i.next}while(i!==r)}}function e0(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function x_(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function VF(t){var e=t.alternate;e!==null&&(t.alternate=null,VF(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Es],delete e[Ip],delete e[o_],delete e[O7],delete e[I7])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function KF(t){return t.tag===5||t.tag===3||t.tag===4}function cO(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||KF(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function b_(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Sy));else if(r!==4&&(t=t.child,t!==null))for(b_(t,e,n),t=t.sibling;t!==null;)b_(t,e,n),t=t.sibling}function w_(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(w_(t,e,n),t=t.sibling;t!==null;)w_(t,e,n),t=t.sibling}var Br=null,Bo=!1;function Qa(t,e,n){for(n=n.child;n!==null;)WF(t,e,n),n=n.sibling}function WF(t,e,n){if(Rs&&typeof Rs.onCommitFiberUnmount=="function")try{Rs.onCommitFiberUnmount(Kb,n)}catch{}switch(n.tag){case 5:ti||sd(n,e);case 6:var r=Br,i=Bo;Br=null,Qa(t,e,n),Br=r,Bo=i,Br!==null&&(Bo?(t=Br,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Br.removeChild(n.stateNode));break;case 18:Br!==null&&(Bo?(t=Br,n=n.stateNode,t.nodeType===8?yS(t.parentNode,n):t.nodeType===1&&yS(t,n),Tp(t)):yS(Br,n.stateNode));break;case 4:r=Br,i=Bo,Br=n.stateNode.containerInfo,Bo=!0,Qa(t,e,n),Br=r,Bo=i;break;case 0:case 11:case 14:case 15:if(!ti&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&y_(n,e,s),i=i.next}while(i!==r)}Qa(t,e,n);break;case 1:if(!ti&&(sd(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){Qn(n,e,c)}Qa(t,e,n);break;case 21:Qa(t,e,n);break;case 22:n.mode&1?(ti=(r=ti)||n.memoizedState!==null,Qa(t,e,n),ti=r):Qa(t,e,n);break;default:Qa(t,e,n)}}function lO(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Y7),e.forEach(function(r){var i=o9.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Io(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=rr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*J7(r/1960))-r,10t?16:t,xc===null)var r=!1;else{if(t=xc,xc=null,My=0,on&6)throw Error(Ce(331));var i=on;for(on|=4,Xe=t.current;Xe!==null;){var o=Xe,s=o.child;if(Xe.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lrr()-nE?Kl(t,0):tE|=n),Ii(t,e)}function t4(t,e){e===0&&(t.mode&1?(e=Kg,Kg<<=1,!(Kg&130023424)&&(Kg=4194304)):e=1);var n=yi();t=ka(t,e),t!==null&&(cg(t,e,n),Ii(t,n))}function i9(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),t4(t,n)}function o9(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Ce(314))}r!==null&&r.delete(e),t4(t,n)}var n4;n4=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ki.current)Ni=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ni=!1,K7(t,e,n);Ni=!!(t.flags&131072)}else Ni=!1,Hn&&e.flags&1048576&&sF(e,jy,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Gv(t,e),t=e.pendingProps;var i=zd(e,ii.current);vd(e,n),i=Yj(null,e,r,t,i,n);var o=Qj();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Oi(r)?(o=!0,_y(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Gj(e),i.updater=Zb,e.stateNode=i,i._reactInternals=e,d_(e,r,t,n),e=p_(null,e,r,!0,o,n)):(e.tag=0,Hn&&o&&$j(e),ui(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Gv(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=a9(r),t=$o(r,t),i){case 0:e=h_(null,e,r,t,n);break e;case 1:e=iO(null,e,r,t,n);break e;case 11:e=nO(null,e,r,t,n);break e;case 14:e=rO(null,e,r,$o(r.type,t),n);break e}throw Error(Ce(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),h_(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),iO(t,e,r,i,n);case 3:e:{if(FF(e),t===null)throw Error(Ce(387));r=e.pendingProps,o=e.memoizedState,i=o.element,fF(t,e),Ny(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Wd(Error(Ce(423)),e),e=oO(t,e,r,n,i);break e}else if(r!==i){i=Wd(Error(Ce(424)),e),e=oO(t,e,r,n,i);break e}else for(Qi=Ec(e.stateNode.containerInfo.firstChild),Xi=e,Hn=!0,Go=null,n=uF(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gd(),r===i){e=Oa(t,e,n);break e}ui(t,e,r,n)}e=e.child}return e;case 5:return hF(e),t===null&&c_(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,r_(r,i)?s=null:o!==null&&r_(r,o)&&(e.flags|=32),LF(t,e),ui(t,e,s,n),e.child;case 6:return t===null&&c_(e),null;case 13:return BF(t,e,n);case 4:return Vj(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Vd(e,null,r,n):ui(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),nO(t,e,r,i,n);case 7:return ui(t,e,e.pendingProps,n),e.child;case 8:return ui(t,e,e.pendingProps.children,n),e.child;case 12:return ui(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,kn(Ey,r._currentValue),r._currentValue=s,o!==null)if(is(o.value,s)){if(o.children===i.children&&!ki.current){e=Oa(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=_a(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),l_(o.return,n,e),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(Ce(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),l_(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ui(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,vd(e,n),i=Eo(i),r=r(i),e.flags|=1,ui(t,e,r,n),e.child;case 14:return r=e.type,i=$o(r,e.pendingProps),i=$o(r.type,i),rO(t,e,r,i,n);case 15:return DF(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),Gv(t,e),e.tag=1,Oi(r)?(t=!0,_y(e)):t=!1,vd(e,n),IF(e,r,i),d_(e,r,i,n),p_(null,e,r,!0,t,n);case 19:return UF(t,e,n);case 22:return $F(t,e,n)}throw Error(Ce(156,e.tag))};function r4(t,e){return PL(t,e)}function s9(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function So(t,e,n,r){return new s9(t,e,n,r)}function sE(t){return t=t.prototype,!(!t||!t.isReactComponent)}function a9(t){if(typeof t=="function")return sE(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Aj)return 11;if(t===jj)return 14}return 2}function kc(t,e){var n=t.alternate;return n===null?(n=So(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Wv(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")sE(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Xu:return Wl(n.children,i,o,e);case _j:s=8,i|=8;break;case MC:return t=So(12,n,e,i|2),t.elementType=MC,t.lanes=o,t;case DC:return t=So(13,n,e,i),t.elementType=DC,t.lanes=o,t;case $C:return t=So(19,n,e,i),t.elementType=$C,t.lanes=o,t;case hL:return n0(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case dL:s=10;break e;case fL:s=9;break e;case Aj:s=11;break e;case jj:s=14;break e;case rc:s=16,r=null;break e}throw Error(Ce(130,t==null?t:typeof t,""))}return e=So(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Wl(t,e,n,r){return t=So(7,t,r,e),t.lanes=n,t}function n0(t,e,n,r){return t=So(22,t,r,e),t.elementType=hL,t.lanes=n,t.stateNode={isHidden:!1},t}function jS(t,e,n){return t=So(6,t,null,e),t.lanes=n,t}function ES(t,e,n){return e=So(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function c9(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=aS(0),this.expirationTimes=aS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=aS(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function aE(t,e,n,r,i,o,s,c,l){return t=new c9(t,e,n,c,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=So(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gj(o),t}function l9(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a4)}catch(t){console.error(t)}}a4(),aL.exports=ro;var If=aL.exports;const c4=un(If);var l4,vO=If;l4=vO.createRoot,vO.hydrateRoot;var yO=["light","dark"],p9="(prefers-color-scheme: dark)",m9=v.createContext(void 0),g9={setTheme:t=>{},themes:[]},v9=()=>{var t;return(t=v.useContext(m9))!=null?t:g9};v.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:o,value:s,attrs:c,nonce:l})=>{let u=o==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=i?yO.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,y=!0)=>{let b=s?s[g]:g,x=m?g+"|| ''":`'${b}'`,w="";return i&&y&&!m&&yO.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},p=t?`!function(){${d}${h(t)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${p9}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}${u?"":"else{"+h(o,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}else{${h(o,!1,!1)};}${f}}catch(t){}}();`;return v.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:p}})});var y9=t=>{switch(t){case"success":return w9;case"info":return C9;case"warning":return S9;case"error":return _9;default:return null}},x9=Array(12).fill(0),b9=({visible:t})=>N.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},N.createElement("div",{className:"sonner-spinner"},x9.map((e,n)=>N.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),w9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),S9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),C9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),_9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),A9=()=>{let[t,e]=N.useState(document.hidden);return N.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},j_=1,j9=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:j_++,o=this.toasts.find(c=>c.id===i),s=t.dismissible===void 0?!0:t.dismissible;return o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:n}),{...c,...t,id:i,dismissible:s,title:n}):c):this.addToast({title:n,...r,dismissible:s,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),i=n!==void 0;return r.then(async o=>{if(T9(o)&&!o.ok){i=!1;let s=typeof e.error=="function"?await e.error(`HTTP error! status: ${o.status}`):e.error,c=typeof e.description=="function"?await e.description(`HTTP error! status: ${o.status}`):e.description;this.create({id:n,type:"error",message:s,description:c})}else if(e.success!==void 0){i=!1;let s=typeof e.success=="function"?await e.success(o):e.success,c=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"success",message:s,description:c})}}).catch(async o=>{if(e.error!==void 0){i=!1;let s=typeof e.error=="function"?await e.error(o):e.error,c=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"error",message:s,description:c})}}).finally(()=>{var o;i&&(this.dismiss(n),n=void 0),(o=e.finally)==null||o.call(e)}),n},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||j_++;return this.create({jsx:t(n),id:n,...e}),n},this.subscribers=[],this.toasts=[]}},Gi=new j9,E9=(t,e)=>{let n=(e==null?void 0:e.id)||j_++;return Gi.addToast({title:t,...e,id:n}),n},T9=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",N9=E9,P9=()=>Gi.toasts,re=Object.assign(N9,{success:Gi.success,info:Gi.info,warning:Gi.warning,error:Gi.error,custom:Gi.custom,message:Gi.message,promise:Gi.promise,dismiss:Gi.dismiss,loading:Gi.loading},{getHistory:P9});function k9(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}k9(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function iv(t){return t.label!==void 0}var O9=3,I9="32px",R9=4e3,M9=356,D9=14,$9=20,L9=200;function F9(...t){return t.filter(Boolean).join(" ")}var B9=t=>{var e,n,r,i,o,s,c,l,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:y,heights:b,index:x,toasts:w,expanded:S,removeToast:C,defaultRichColors:_,closeButton:A,style:j,cancelButtonStyle:P,actionButtonStyle:k,className:O="",descriptionClassName:E="",duration:I,position:D,gap:z,loadingIcon:$,expandByDefault:G,classNames:R,icons:L,closeButtonAriaLabel:W="Close toast",pauseWhenPageIsHidden:Y,cn:te}=t,[me,F]=N.useState(!1),[se,ne]=N.useState(!1),[ae,De]=N.useState(!1),[de,ye]=N.useState(!1),[Ee,Z]=N.useState(0),[ct,Le]=N.useState(0),At=N.useRef(null),lt=N.useRef(null),Jt=x===0,T=x+1<=y,M=h.type,U=h.dismissible!==!1,V=h.className||"",Q=h.descriptionClassName||"",B=N.useMemo(()=>b.findIndex(wt=>wt.toastId===h.id)||0,[b,h.id]),X=N.useMemo(()=>{var wt;return(wt=h.closeButton)!=null?wt:A},[h.closeButton,A]),ge=N.useMemo(()=>h.duration||I||R9,[h.duration,I]),xe=N.useRef(0),Re=N.useRef(0),be=N.useRef(0),Ve=N.useRef(null),[st,kt]=D.split("-"),Ke=N.useMemo(()=>b.reduce((wt,Ze,ot)=>ot>=B?wt:wt+Ze.height,0),[b,B]),tt=A9(),Nt=h.invert||f,sn=M==="loading";Re.current=N.useMemo(()=>B*z+Ke,[B,Ke]),N.useEffect(()=>{F(!0)},[]),N.useLayoutEffect(()=>{if(!me)return;let wt=lt.current,Ze=wt.style.height;wt.style.height="auto";let ot=wt.getBoundingClientRect().height;wt.style.height=Ze,Le(ot),m(Xt=>Xt.find(bn=>bn.toastId===h.id)?Xt.map(bn=>bn.toastId===h.id?{...bn,height:ot}:bn):[{toastId:h.id,height:ot,position:h.position},...Xt])},[me,h.title,h.description,m,h.id]);let Nr=N.useCallback(()=>{ne(!0),Z(Re.current),m(wt=>wt.filter(Ze=>Ze.toastId!==h.id)),setTimeout(()=>{C(h)},L9)},[h,C,m,Re]);N.useEffect(()=>{if(h.promise&&M==="loading"||h.duration===1/0||h.type==="loading")return;let wt,Ze=ge;return S||g||Y&&tt?(()=>{if(be.current{var ot;(ot=h.onAutoClose)==null||ot.call(h,h),Nr()},Ze)),()=>clearTimeout(wt)},[S,g,G,h,ge,Nr,h.promise,M,Y,tt]),N.useEffect(()=>{let wt=lt.current;if(wt){let Ze=wt.getBoundingClientRect().height;return Le(Ze),m(ot=>[{toastId:h.id,height:Ze,position:h.position},...ot]),()=>m(ot=>ot.filter(Xt=>Xt.toastId!==h.id))}},[m,h.id]),N.useEffect(()=>{h.delete&&Nr()},[Nr,h.delete]);function dn(){return L!=null&&L.loading?N.createElement("div",{className:"sonner-loader","data-visible":M==="loading"},L.loading):$?N.createElement("div",{className:"sonner-loader","data-visible":M==="loading"},$):N.createElement(b9,{visible:M==="loading"})}return N.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:lt,className:te(O,V,R==null?void 0:R.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,R==null?void 0:R.default,R==null?void 0:R[M],(n=h==null?void 0:h.classNames)==null?void 0:n[M]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:_,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":me,"data-promise":!!h.promise,"data-removed":se,"data-visible":T,"data-y-position":st,"data-x-position":kt,"data-index":x,"data-front":Jt,"data-swiping":ae,"data-dismissible":U,"data-type":M,"data-invert":Nt,"data-swipe-out":de,"data-expanded":!!(S||G&&me),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${se?Ee:Re.current}px`,"--initial-height":G?"auto":`${ct}px`,...j,...h.style},onPointerDown:wt=>{sn||!U||(At.current=new Date,Z(Re.current),wt.target.setPointerCapture(wt.pointerId),wt.target.tagName!=="BUTTON"&&(De(!0),Ve.current={x:wt.clientX,y:wt.clientY}))},onPointerUp:()=>{var wt,Ze,ot,Xt;if(de||!U)return;Ve.current=null;let bn=Number(((wt=lt.current)==null?void 0:wt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),oo=new Date().getTime()-((Ze=At.current)==null?void 0:Ze.getTime()),ta=Math.abs(bn)/oo;if(Math.abs(bn)>=$9||ta>.11){Z(Re.current),(ot=h.onDismiss)==null||ot.call(h,h),Nr(),ye(!0);return}(Xt=lt.current)==null||Xt.style.setProperty("--swipe-amount","0px"),De(!1)},onPointerMove:wt=>{var Ze;if(!Ve.current||!U)return;let ot=wt.clientY-Ve.current.y,Xt=wt.clientX-Ve.current.x,bn=(st==="top"?Math.min:Math.max)(0,ot),oo=wt.pointerType==="touch"?10:2;Math.abs(bn)>oo?(Ze=lt.current)==null||Ze.style.setProperty("--swipe-amount",`${ot}px`):Math.abs(Xt)>oo&&(Ve.current=null)}},X&&!h.jsx?N.createElement("button",{"aria-label":W,"data-disabled":sn,"data-close-button":!0,onClick:sn||!U?()=>{}:()=>{var wt;Nr(),(wt=h.onDismiss)==null||wt.call(h,h)},className:te(R==null?void 0:R.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},N.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),N.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||N.isValidElement(h.title)?h.jsx||h.title:N.createElement(N.Fragment,null,M||h.icon||h.promise?N.createElement("div",{"data-icon":"",className:te(R==null?void 0:R.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||dn():null,h.type!=="loading"?h.icon||(L==null?void 0:L[M])||y9(M):null):null,N.createElement("div",{"data-content":"",className:te(R==null?void 0:R.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},N.createElement("div",{"data-title":"",className:te(R==null?void 0:R.title,(c=h==null?void 0:h.classNames)==null?void 0:c.title)},h.title),h.description?N.createElement("div",{"data-description":"",className:te(E,Q,R==null?void 0:R.description,(l=h==null?void 0:h.classNames)==null?void 0:l.description)},h.description):null),N.isValidElement(h.cancel)?h.cancel:h.cancel&&iv(h.cancel)?N.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||P,onClick:wt=>{var Ze,ot;iv(h.cancel)&&U&&((ot=(Ze=h.cancel).onClick)==null||ot.call(Ze,wt),Nr())},className:te(R==null?void 0:R.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,N.isValidElement(h.action)?h.action:h.action&&iv(h.action)?N.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||k,onClick:wt=>{var Ze,ot;iv(h.action)&&(wt.defaultPrevented||((ot=(Ze=h.action).onClick)==null||ot.call(Ze,wt),Nr()))},className:te(R==null?void 0:R.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function xO(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}var U9=t=>{let{invert:e,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:o,className:s,offset:c,theme:l="light",richColors:u,duration:d,style:f,visibleToasts:h=O9,toastOptions:p,dir:g=xO(),gap:m=D9,loadingIcon:y,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:w,cn:S=F9}=t,[C,_]=N.useState([]),A=N.useMemo(()=>Array.from(new Set([n].concat(C.filter(Y=>Y.position).map(Y=>Y.position)))),[C,n]),[j,P]=N.useState([]),[k,O]=N.useState(!1),[E,I]=N.useState(!1),[D,z]=N.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=N.useRef(null),G=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=N.useRef(null),L=N.useRef(!1),W=N.useCallback(Y=>{var te;(te=C.find(me=>me.id===Y.id))!=null&&te.delete||Gi.dismiss(Y.id),_(me=>me.filter(({id:F})=>F!==Y.id))},[C]);return N.useEffect(()=>Gi.subscribe(Y=>{if(Y.dismiss){_(te=>te.map(me=>me.id===Y.id?{...me,delete:!0}:me));return}setTimeout(()=>{c4.flushSync(()=>{_(te=>{let me=te.findIndex(F=>F.id===Y.id);return me!==-1?[...te.slice(0,me),{...te[me],...Y},...te.slice(me+1)]:[Y,...te]})})})}),[]),N.useEffect(()=>{if(l!=="system"){z(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:Y})=>{z(Y?"dark":"light")})},[l]),N.useEffect(()=>{C.length<=1&&O(!1)},[C]),N.useEffect(()=>{let Y=te=>{var me,F;r.every(se=>te[se]||te.code===se)&&(O(!0),(me=$.current)==null||me.focus()),te.code==="Escape"&&(document.activeElement===$.current||(F=$.current)!=null&&F.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[r]),N.useEffect(()=>{if($.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,L.current=!1)}},[$.current]),C.length?N.createElement("section",{"aria-label":`${x} ${G}`,tabIndex:-1},A.map((Y,te)=>{var me;let[F,se]=Y.split("-");return N.createElement("ol",{key:Y,dir:g==="auto"?xO():g,tabIndex:-1,ref:$,className:s,"data-sonner-toaster":!0,"data-theme":D,"data-y-position":F,"data-x-position":se,style:{"--front-toast-height":`${((me=j[0])==null?void 0:me.height)||0}px`,"--offset":typeof c=="number"?`${c}px`:c||I9,"--width":`${M9}px`,"--gap":`${m}px`,...f},onBlur:ne=>{L.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(L.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||L.current||(L.current=!0,R.current=ne.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{E||O(!1)},onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},C.filter(ne=>!ne.position&&te===0||ne.position===Y).map((ne,ae)=>{var De,de;return N.createElement(B9,{key:ne.id,icons:b,index:ae,toast:ne,defaultRichColors:u,duration:(De=p==null?void 0:p.duration)!=null?De:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:e,visibleToasts:h,closeButton:(de=p==null?void 0:p.closeButton)!=null?de:o,interacting:E,position:Y,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:W,toasts:C.filter(ye=>ye.position==ne.position),heights:j.filter(ye=>ye.position==ne.position),setHeights:P,expandByDefault:i,gap:m,loadingIcon:y,expanded:k,pauseWhenPageIsHidden:w,cn:S})}))})):null};const H9=({...t})=>{const{theme:e="system"}=v9();return a.jsx(U9,{theme:e,className:"toaster group",position:"bottom-right",visibleToasts:2,closeButton:!0,toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:pr-8",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:left-3 group-[.toast]:top-3 group-[.toast]:h-5 group-[.toast]:w-5 group-[.toast]:rounded-md group-[.toast]:p-1 group-[.toast]:text-foreground/70 group-[.toast]:opacity-100 group-[.toast]:transition-opacity hover:group-[.toast]:text-foreground hover:group-[.toast]:bg-muted/50 focus:group-[.toast]:opacity-100 focus:group-[.toast]:outline-none focus:group-[.toast]:ring-1 focus:group-[.toast]:ring-ring"}},...t})};function Te(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function z9(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function a0(...t){return e=>t.forEach(n=>z9(n,e))}function Pt(...t){return v.useCallback(a0(...t),t)}function G9(t,e){const n=v.createContext(e),r=o=>{const{children:s,...c}=o,l=v.useMemo(()=>c,Object.values(c));return a.jsx(n.Provider,{value:l,children:s})};r.displayName=t+"Provider";function i(o){const s=v.useContext(n);if(s)return s;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[r,i]}function Li(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[t])==null?void 0:b[l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})};u.displayName=o+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[t])==null?void 0:m[l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,V9(i,...e)]}function V9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var Hs=v.forwardRef((t,e)=>{const{children:n,...r}=t,i=v.Children.toArray(n),o=i.find(K9);if(o){const s=o.props.children,c=i.map(l=>l===o?v.Children.count(s)>1?v.Children.only(null):v.isValidElement(s)?s.props.children:null:l);return a.jsx(E_,{...r,ref:e,children:v.isValidElement(s)?v.cloneElement(s,void 0,c):null})}return a.jsx(E_,{...r,ref:e,children:n})});Hs.displayName="Slot";var E_=v.forwardRef((t,e)=>{const{children:n,...r}=t;if(v.isValidElement(n)){const i=q9(n);return v.cloneElement(n,{...W9(r,n.props),ref:e?a0(e,i):i})}return v.Children.count(n)>1?v.Children.only(null):null});E_.displayName="SlotClone";var dE=({children:t})=>a.jsx(a.Fragment,{children:t});function K9(t){return v.isValidElement(t)&&t.type===dE}function W9(t,e){const n={...e};for(const r in e){const i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{o(...c),i(...c)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function q9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Y9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],it=Y9.reduce((t,e)=>{const n=v.forwardRef((r,i)=>{const{asChild:o,...s}=r,c=o?Hs:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function u4(t,e){t&&If.flushSync(()=>t.dispatchEvent(e))}function Cr(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Q9(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var X9="DismissableLayer",T_="dismissableLayer.update",J9="dismissableLayer.pointerDownOutside",Z9="dismissableLayer.focusOutside",bO,d4=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fg=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=t,u=v.useContext(d4),[d,f]=v.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=Pt(e,A=>f(A)),m=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(y),x=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=b,C=nY(A=>{const j=A.target,P=[...u.branches].some(k=>k.contains(j));!S||P||(i==null||i(A),s==null||s(A),A.defaultPrevented||c==null||c())},h),_=rY(A=>{const j=A.target;[...u.branches].some(k=>k.contains(j))||(o==null||o(A),s==null||s(A),A.defaultPrevented||c==null||c())},h);return Q9(A=>{x===u.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&c&&(A.preventDefault(),c()))},h),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(bO=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),wO(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=bO)}},[d,h,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),wO())},[d,u]),v.useEffect(()=>{const A=()=>p({});return document.addEventListener(T_,A),()=>document.removeEventListener(T_,A)},[]),a.jsx(it.div,{...l,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Te(t.onFocusCapture,_.onFocusCapture),onBlurCapture:Te(t.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Te(t.onPointerDownCapture,C.onPointerDownCapture)})});fg.displayName=X9;var eY="DismissableLayerBranch",tY=v.forwardRef((t,e)=>{const n=v.useContext(d4),r=v.useRef(null),i=Pt(e,r);return v.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(it.div,{...t,ref:i})});tY.displayName=eY;function nY(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let l=function(){f4(J9,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function rY(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t),r=v.useRef(!1);return v.useEffect(()=>{const i=o=>{o.target&&!r.current&&f4(Z9,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function wO(){const t=new CustomEvent(T_);document.dispatchEvent(t)}function f4(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?u4(i,o):i.dispatchEvent(o)}var Kr=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},iY=oL.useId||(()=>{}),oY=0;function Xo(t){const[e,n]=v.useState(iY());return Kr(()=>{n(r=>r??String(oY++))},[t]),e?`radix-${e}`:""}const sY=["top","right","bottom","left"],Wc=Math.min,qi=Math.max,Ly=Math.round,ov=Math.floor,qc=t=>({x:t,y:t}),aY={left:"right",right:"left",bottom:"top",top:"bottom"},cY={start:"end",end:"start"};function N_(t,e,n){return qi(t,Wc(e,n))}function Ia(t,e){return typeof t=="function"?t(e):t}function Ra(t){return t.split("-")[0]}function Rf(t){return t.split("-")[1]}function fE(t){return t==="x"?"y":"x"}function hE(t){return t==="y"?"height":"width"}function Yc(t){return["top","bottom"].includes(Ra(t))?"y":"x"}function pE(t){return fE(Yc(t))}function lY(t,e,n){n===void 0&&(n=!1);const r=Rf(t),i=pE(t),o=hE(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Fy(s)),[s,Fy(s)]}function uY(t){const e=Fy(t);return[P_(t),e,P_(e)]}function P_(t){return t.replace(/start|end/g,e=>cY[e])}function dY(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function fY(t,e,n,r){const i=Rf(t);let o=dY(Ra(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(P_)))),o}function Fy(t){return t.replace(/left|right|bottom|top/g,e=>aY[e])}function hY(t){return{top:0,right:0,bottom:0,left:0,...t}}function h4(t){return typeof t!="number"?hY(t):{top:t,right:t,bottom:t,left:t}}function By(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function SO(t,e,n){let{reference:r,floating:i}=t;const o=Yc(e),s=pE(e),c=hE(s),l=Ra(e),u=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[c]/2-i[c]/2;let p;switch(l){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Rf(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const pY=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,c=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:f}=SO(u,r,l),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=Ia(t,e)||{};if(u==null)return{};const f=h4(d),h={x:n,y:r},p=pE(i),g=hE(p),m=await s.getDimensions(u),y=p==="y",b=y?"top":"left",x=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=o.reference[g]+o.reference[p]-h[p]-o.floating[g],C=h[p]-o.reference[p],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let A=_?_[w]:0;(!A||!await(s.isElement==null?void 0:s.isElement(_)))&&(A=c.floating[w]||o.floating[g]);const j=S/2-C/2,P=A/2-m[g]/2-1,k=Wc(f[b],P),O=Wc(f[x],P),E=k,I=A-m[g]-O,D=A/2-m[g]/2+j,z=N_(E,D,I),$=!l.arrow&&Rf(i)!=null&&D!==z&&o.reference[g]/2-(DD<=0)){var O,E;const D=(((O=o.flip)==null?void 0:O.index)||0)+1,z=A[D];if(z)return{data:{index:D,overflows:k},reset:{placement:z}};let $=(E=k.filter(G=>G.overflows[0]<=0).sort((G,R)=>G.overflows[1]-R.overflows[1])[0])==null?void 0:E.placement;if(!$)switch(p){case"bestFit":{var I;const G=(I=k.filter(R=>{if(_){const L=Yc(R.placement);return L===x||L==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(L=>L>0).reduce((L,W)=>L+W,0)]).sort((R,L)=>R[1]-L[1])[0])==null?void 0:I[0];G&&($=G);break}case"initialPlacement":$=c;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function CO(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function _O(t){return sY.some(e=>t[e]>=0)}const vY=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=Ia(t,e);switch(r){case"referenceHidden":{const o=await Bp(e,{...i,elementContext:"reference"}),s=CO(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:_O(s)}}}case"escaped":{const o=await Bp(e,{...i,altBoundary:!0}),s=CO(o,n.floating);return{data:{escapedOffsets:s,escaped:_O(s)}}}default:return{}}}}};async function yY(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Ra(n),c=Rf(n),l=Yc(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,f=Ia(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof g=="number"&&(p=c==="end"?g*-1:g),l?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const xY=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:c}=e,l=await yY(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},bY=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:y=>{let{x:b,y:x}=y;return{x:b,y:x}}},...l}=Ia(t,e),u={x:n,y:r},d=await Bp(e,l),f=Yc(Ra(i)),h=fE(f);let p=u[h],g=u[f];if(o){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=p+d[y],w=p-d[b];p=N_(x,p,w)}if(s){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=g+d[y],w=g-d[b];g=N_(x,g,w)}const m=c.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[f]:s}}}}}},wY=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=e,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Ia(t,e),d={x:n,y:r},f=Yc(i),h=fE(f);let p=d[h],g=d[f];const m=Ia(c,e),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=h==="y"?"height":"width",S=o.reference[h]-o.floating[w]+y.mainAxis,C=o.reference[h]+o.reference[w]-y.mainAxis;pC&&(p=C)}if(u){var b,x;const w=h==="y"?"width":"height",S=["top","left"].includes(Ra(i)),C=o.reference[f]-o.floating[w]+(S&&((b=s.offset)==null?void 0:b[f])||0)+(S?0:y.crossAxis),_=o.reference[f]+o.reference[w]+(S?0:((x=s.offset)==null?void 0:x[f])||0)-(S?y.crossAxis:0);g_&&(g=_)}return{[h]:p,[f]:g}}}},SY=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:c}=e,{apply:l=()=>{},...u}=Ia(t,e),d=await Bp(e,u),f=Ra(i),h=Rf(i),p=Yc(i)==="y",{width:g,height:m}=o.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=h===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(b=f,y=h==="end"?"top":"bottom");const x=m-d.top-d.bottom,w=g-d.left-d.right,S=Wc(m-d[y],x),C=Wc(g-d[b],w),_=!e.middlewareData.shift;let A=S,j=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(j=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(A=x),_&&!h){const k=qi(d.left,0),O=qi(d.right,0),E=qi(d.top,0),I=qi(d.bottom,0);p?j=g-2*(k!==0||O!==0?k+O:qi(d.left,d.right)):A=m-2*(E!==0||I!==0?E+I:qi(d.top,d.bottom))}await l({...e,availableWidth:j,availableHeight:A});const P=await s.getDimensions(c.floating);return g!==P.width||m!==P.height?{reset:{rects:!0}}:{}}}};function c0(){return typeof window<"u"}function Mf(t){return p4(t)?(t.nodeName||"").toLowerCase():"#document"}function Ji(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Qs(t){var e;return(e=(p4(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function p4(t){return c0()?t instanceof Node||t instanceof Ji(t).Node:!1}function os(t){return c0()?t instanceof Element||t instanceof Ji(t).Element:!1}function zs(t){return c0()?t instanceof HTMLElement||t instanceof Ji(t).HTMLElement:!1}function AO(t){return!c0()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ji(t).ShadowRoot}function hg(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ss(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function CY(t){return["table","td","th"].includes(Mf(t))}function l0(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function mE(t){const e=gE(),n=os(t)?ss(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function _Y(t){let e=Qc(t);for(;zs(e)&&!Yd(e);){if(mE(e))return e;if(l0(e))return null;e=Qc(e)}return null}function gE(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Yd(t){return["html","body","#document"].includes(Mf(t))}function ss(t){return Ji(t).getComputedStyle(t)}function u0(t){return os(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Qc(t){if(Mf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||AO(t)&&t.host||Qs(t);return AO(e)?e.host:e}function m4(t){const e=Qc(t);return Yd(e)?t.ownerDocument?t.ownerDocument.body:t.body:zs(e)&&hg(e)?e:m4(e)}function Up(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=m4(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Ji(i);if(o){const c=k_(s);return e.concat(s,s.visualViewport||[],hg(i)?i:[],c&&n?Up(c):[])}return e.concat(i,Up(i,[],n))}function k_(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function g4(t){const e=ss(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=zs(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,c=Ly(n)!==o||Ly(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function vE(t){return os(t)?t:t.contextElement}function xd(t){const e=vE(t);if(!zs(e))return qc(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=g4(e);let s=(o?Ly(n.width):n.width)/r,c=(o?Ly(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const AY=qc(0);function v4(t){const e=Ji(t);return!gE()||!e.visualViewport?AY:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function jY(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ji(t)?!1:e}function su(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=vE(t);let s=qc(1);e&&(r?os(r)&&(s=xd(r)):s=xd(t));const c=jY(o,n,r)?v4(o):qc(0);let l=(i.left+c.x)/s.x,u=(i.top+c.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const h=Ji(o),p=r&&os(r)?Ji(r):r;let g=h,m=k_(g);for(;m&&r&&p!==g;){const y=xd(m),b=m.getBoundingClientRect(),x=ss(m),w=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*y.x,S=b.top+(m.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,u*=y.y,d*=y.x,f*=y.y,l+=w,u+=S,g=Ji(m),m=k_(g)}}return By({width:d,height:f,x:l,y:u})}function EY(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Qs(r),c=e?l0(e.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=qc(1);const d=qc(0),f=zs(r);if((f||!f&&!o)&&((Mf(r)!=="body"||hg(s))&&(l=u0(r)),zs(r))){const h=su(r);u=xd(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function TY(t){return Array.from(t.getClientRects())}function O_(t,e){const n=u0(t).scrollLeft;return e?e.left+n:su(Qs(t)).left+n}function NY(t){const e=Qs(t),n=u0(t),r=t.ownerDocument.body,i=qi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=qi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+O_(t);const c=-n.scrollTop;return ss(r).direction==="rtl"&&(s+=qi(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:c}}function PY(t,e){const n=Ji(t),r=Qs(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,c=0,l=0;if(i){o=i.width,s=i.height;const u=gE();(!u||u&&e==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:c,y:l}}function kY(t,e){const n=su(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=zs(t)?xd(t):qc(1),s=t.clientWidth*o.x,c=t.clientHeight*o.y,l=i*o.x,u=r*o.y;return{width:s,height:c,x:l,y:u}}function jO(t,e,n){let r;if(e==="viewport")r=PY(t,n);else if(e==="document")r=NY(Qs(t));else if(os(e))r=kY(e,n);else{const i=v4(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return By(r)}function y4(t,e){const n=Qc(t);return n===e||!os(n)||Yd(n)?!1:ss(n).position==="fixed"||y4(n,e)}function OY(t,e){const n=e.get(t);if(n)return n;let r=Up(t,[],!1).filter(c=>os(c)&&Mf(c)!=="body"),i=null;const o=ss(t).position==="fixed";let s=o?Qc(t):t;for(;os(s)&&!Yd(s);){const c=ss(s),l=mE(s);!l&&c.position==="fixed"&&(i=null),(o?!l&&!i:!l&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||hg(s)&&!l&&y4(t,s))?r=r.filter(d=>d!==s):i=c,s=Qc(s)}return e.set(t,r),r}function IY(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?l0(e)?[]:OY(e,this._c):[].concat(n),r],c=s[0],l=s.reduce((u,d)=>{const f=jO(e,d,i);return u.top=qi(f.top,u.top),u.right=Wc(f.right,u.right),u.bottom=Wc(f.bottom,u.bottom),u.left=qi(f.left,u.left),u},jO(e,c,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function RY(t){const{width:e,height:n}=g4(t);return{width:e,height:n}}function MY(t,e,n){const r=zs(e),i=Qs(e),o=n==="fixed",s=su(t,!0,o,e);let c={scrollLeft:0,scrollTop:0};const l=qc(0);if(r||!r&&!o)if((Mf(e)!=="body"||hg(i))&&(c=u0(e)),r){const p=su(e,!0,o,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else i&&(l.x=O_(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+c.scrollTop,u=p.left+c.scrollLeft-O_(i,p)}const f=s.left+c.scrollLeft-l.x-u,h=s.top+c.scrollTop-l.y-d;return{x:f,y:h,width:s.width,height:s.height}}function TS(t){return ss(t).position==="static"}function EO(t,e){if(!zs(t)||ss(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Qs(t)===n&&(n=n.ownerDocument.body),n}function x4(t,e){const n=Ji(t);if(l0(t))return n;if(!zs(t)){let i=Qc(t);for(;i&&!Yd(i);){if(os(i)&&!TS(i))return i;i=Qc(i)}return n}let r=EO(t,e);for(;r&&CY(r)&&TS(r);)r=EO(r,e);return r&&Yd(r)&&TS(r)&&!mE(r)?n:r||_Y(t)||n}const DY=async function(t){const e=this.getOffsetParent||x4,n=this.getDimensions,r=await n(t.floating);return{reference:MY(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $Y(t){return ss(t).direction==="rtl"}const LY={convertOffsetParentRelativeRectToViewportRelativeRect:EY,getDocumentElement:Qs,getClippingRect:IY,getOffsetParent:x4,getElementRects:DY,getClientRects:TY,getDimensions:RY,getScale:xd,isElement:os,isRTL:$Y};function FY(t,e){let n=null,r;const i=Qs(t);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),o();const{left:u,top:d,width:f,height:h}=t.getBoundingClientRect();if(c||e(),!f||!h)return;const p=ov(d),g=ov(i.clientWidth-(u+f)),m=ov(i.clientHeight-(d+h)),y=ov(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-y+"px",threshold:qi(0,Wc(1,l))||1};let w=!0;function S(C){const _=C[0].intersectionRatio;if(_!==l){if(!w)return s();_?s(!1,_):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(S,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(t)}return s(!0),o}function BY(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=vE(t),d=i||o?[...u?Up(u):[],...Up(e)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const f=u&&c?FY(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),n()}),u&&!l&&p.observe(u),p.observe(e));let g,m=l?su(t):null;l&&y();function y(){const b=su(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(x=>{i&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const UY=xY,HY=bY,zY=gY,GY=SY,VY=vY,TO=mY,KY=wY,WY=(t,e,n)=>{const r=new Map,i={platform:LY,...n},o={...i.platform,_c:r};return pY(t,e,{...i,platform:o})};var qv=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Uy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Uy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!Uy(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function b4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function NO(t,e){const n=b4(t);return Math.round(e*n)/n}function NS(t){const e=v.useRef(t);return qv(()=>{e.current=t}),e}function qY(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=t,[d,f]=v.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=v.useState(r);Uy(h,r)||p(r);const[g,m]=v.useState(null),[y,b]=v.useState(null),x=v.useCallback(R=>{R!==_.current&&(_.current=R,m(R))},[]),w=v.useCallback(R=>{R!==A.current&&(A.current=R,b(R))},[]),S=o||g,C=s||y,_=v.useRef(null),A=v.useRef(null),j=v.useRef(d),P=l!=null,k=NS(l),O=NS(i),E=NS(u),I=v.useCallback(()=>{if(!_.current||!A.current)return;const R={placement:e,strategy:n,middleware:h};O.current&&(R.platform=O.current),WY(_.current,A.current,R).then(L=>{const W={...L,isPositioned:E.current!==!1};D.current&&!Uy(j.current,W)&&(j.current=W,If.flushSync(()=>{f(W)}))})},[h,e,n,O,E]);qv(()=>{u===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const D=v.useRef(!1);qv(()=>(D.current=!0,()=>{D.current=!1}),[]),qv(()=>{if(S&&(_.current=S),C&&(A.current=C),S&&C){if(k.current)return k.current(S,C,I);I()}},[S,C,I,k,P]);const z=v.useMemo(()=>({reference:_,floating:A,setReference:x,setFloating:w}),[x,w]),$=v.useMemo(()=>({reference:S,floating:C}),[S,C]),G=v.useMemo(()=>{const R={position:n,left:0,top:0};if(!$.floating)return R;const L=NO($.floating,d.x),W=NO($.floating,d.y);return c?{...R,transform:"translate("+L+"px, "+W+"px)",...b4($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:W}},[n,c,$.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:I,refs:z,elements:$,floatingStyles:G}),[d,I,z,$,G])}const YY=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?TO({element:r.current,padding:i}).fn(n):{}:r?TO({element:r,padding:i}).fn(n):{}}}},QY=(t,e)=>({...UY(t),options:[t,e]}),XY=(t,e)=>({...HY(t),options:[t,e]}),JY=(t,e)=>({...KY(t),options:[t,e]}),ZY=(t,e)=>({...zY(t),options:[t,e]}),eQ=(t,e)=>({...GY(t),options:[t,e]}),tQ=(t,e)=>({...VY(t),options:[t,e]}),nQ=(t,e)=>({...YY(t),options:[t,e]});var rQ="Arrow",w4=v.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...o}=t;return a.jsx(it.svg,{...o,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});w4.displayName=rQ;var iQ=w4;function oQ(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,sQ(i,...e)]}function sQ(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function pg(t){const[e,n]=v.useState(void 0);return Kr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,c;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,c=u.blockSize}else s=t.offsetWidth,c=t.offsetHeight;n({width:s,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var yE="Popper",[S4,Df]=oQ(yE),[aQ,C4]=S4(yE),_4=t=>{const{__scopePopper:e,children:n}=t,[r,i]=v.useState(null);return a.jsx(aQ,{scope:e,anchor:r,onAnchorChange:i,children:n})};_4.displayName=yE;var A4="PopperAnchor",j4=v.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=C4(A4,n),s=v.useRef(null),c=Pt(e,s);return v.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:a.jsx(it.div,{...i,ref:c})});j4.displayName=A4;var xE="PopperContent",[cQ,lQ]=S4(xE),E4=v.forwardRef((t,e)=>{var ae,De,de,ye,Ee,Z;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=t,y=C4(xE,n),[b,x]=v.useState(null),w=Pt(e,ct=>x(ct)),[S,C]=v.useState(null),_=pg(S),A=(_==null?void 0:_.width)??0,j=(_==null?void 0:_.height)??0,P=r+(o!=="center"?"-"+o:""),k=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],E=O.length>0,I={padding:k,boundary:O.filter(dQ),altBoundary:E},{refs:D,floatingStyles:z,placement:$,isPositioned:G,middlewareData:R}=qY({strategy:"fixed",placement:P,whileElementsMounted:(...ct)=>BY(...ct,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[QY({mainAxis:i+j,alignmentAxis:s}),l&&XY({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?JY():void 0,...I}),l&&ZY({...I}),eQ({...I,apply:({elements:ct,rects:Le,availableWidth:At,availableHeight:lt})=>{const{width:Jt,height:T}=Le.reference,M=ct.floating.style;M.setProperty("--radix-popper-available-width",`${At}px`),M.setProperty("--radix-popper-available-height",`${lt}px`),M.setProperty("--radix-popper-anchor-width",`${Jt}px`),M.setProperty("--radix-popper-anchor-height",`${T}px`)}}),S&&nQ({element:S,padding:c}),fQ({arrowWidth:A,arrowHeight:j}),h&&tQ({strategy:"referenceHidden",...I})]}),[L,W]=P4($),Y=Cr(g);Kr(()=>{G&&(Y==null||Y())},[G,Y]);const te=(ae=R.arrow)==null?void 0:ae.x,me=(De=R.arrow)==null?void 0:De.y,F=((de=R.arrow)==null?void 0:de.centerOffset)!==0,[se,ne]=v.useState();return Kr(()=>{b&&ne(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:G?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(ye=R.transformOrigin)==null?void 0:ye.x,(Ee=R.transformOrigin)==null?void 0:Ee.y].join(" "),...((Z=R.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(cQ,{scope:n,placedSide:L,onArrowChange:C,arrowX:te,arrowY:me,shouldHideArrow:F,children:a.jsx(it.div,{"data-side":L,"data-align":W,...m,ref:w,style:{...m.style,animation:G?void 0:"none"}})})})});E4.displayName=xE;var T4="PopperArrow",uQ={top:"bottom",right:"left",bottom:"top",left:"right"},N4=v.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=lQ(T4,r),s=uQ[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(iQ,{...i,ref:n,style:{...i.style,display:"block"}})})});N4.displayName=T4;function dQ(t){return t!==null}var fQ=t=>({name:"transformOrigin",options:t,fn(e){var y,b,x;const{placement:n,rects:r,middlewareData:i}=e,s=((y=i.arrow)==null?void 0:y.centerOffset)!==0,c=s?0:t.arrowWidth,l=s?0:t.arrowHeight,[u,d]=P4(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=i.arrow)==null?void 0:b.x)??0)+c/2,p=(((x=i.arrow)==null?void 0:x.y)??0)+l/2;let g="",m="";return u==="bottom"?(g=s?f:`${h}px`,m=`${-l}px`):u==="top"?(g=s?f:`${h}px`,m=`${r.floating.height+l}px`):u==="right"?(g=`${-l}px`,m=s?f:`${p}px`):u==="left"&&(g=`${r.floating.width+l}px`,m=s?f:`${p}px`),{data:{x:g,y:m}}}});function P4(t){const[e,n="center"]=t.split("-");return[e,n]}var k4=_4,bE=j4,wE=E4,SE=N4,hQ="Portal",d0=v.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,o]=v.useState(!1);Kr(()=>o(!0),[]);const s=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return s?c4.createPortal(a.jsx(it.div,{...r,ref:e}),s):null});d0.displayName=hQ;function pQ(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var Wr=t=>{const{present:e,children:n}=t,r=mQ(e),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=Pt(r.ref,gQ(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:o}):null};Wr.displayName="Presence";function mQ(t){const[e,n]=v.useState(),r=v.useRef({}),i=v.useRef(t),o=v.useRef("none"),s=t?"mounted":"unmounted",[c,l]=pQ(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=sv(r.current);o.current=c==="mounted"?u:"none"},[c]),Kr(()=>{const u=r.current,d=i.current;if(d!==t){const h=o.current,p=sv(u);t?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Kr(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=p=>{const m=sv(r.current).includes(p.animationName);if(p.target===e&&m&&(l("ANIMATION_END"),!i.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},h=p=>{p.target===e&&(o.current=sv(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function sv(t){return(t==null?void 0:t.animationName)||"none"}function gQ(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function as({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=vQ({defaultProp:e,onChange:n}),o=t!==void 0,s=o?t:r,c=Cr(n),l=v.useCallback(u=>{if(o){const f=typeof u=="function"?u(t):u;f!==t&&c(f)}else i(u)},[o,t,i,c]);return[s,l]}function vQ({defaultProp:t,onChange:e}){const n=v.useState(t),[r]=n,i=v.useRef(r),o=Cr(e);return v.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var yQ="VisuallyHidden",CE=v.forwardRef((t,e)=>a.jsx(it.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));CE.displayName=yQ;var xQ=CE,[f0,iFe]=Li("Tooltip",[Df]),_E=Df(),O4="TooltipProvider",bQ=700,PO="tooltip.open",[wQ,I4]=f0(O4),R4=t=>{const{__scopeTooltip:e,delayDuration:n=bQ,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,[s,c]=v.useState(!0),l=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(wQ,{scope:e,isOpenDelayed:s,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),c(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>c(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:v.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:o})};R4.displayName=O4;var M4="Tooltip",[oFe,h0]=f0(M4),I_="TooltipTrigger",SQ=v.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=h0(I_,n),o=I4(I_,n),s=_E(n),c=v.useRef(null),l=Pt(e,c,i.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(bE,{asChild:!0,...s,children:a.jsx(it.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Te(t.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Te(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Te(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Te(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:Te(t.onBlur,i.onClose),onClick:Te(t.onClick,i.onClose)})})});SQ.displayName=I_;var CQ="TooltipPortal",[sFe,_Q]=f0(CQ,{forceMount:void 0}),Qd="TooltipContent",D4=v.forwardRef((t,e)=>{const n=_Q(Qd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,s=h0(Qd,t.__scopeTooltip);return a.jsx(Wr,{present:r||s.open,children:s.disableHoverableContent?a.jsx($4,{side:i,...o,ref:e}):a.jsx(AQ,{side:i,...o,ref:e})})}),AQ=v.forwardRef((t,e)=>{const n=h0(Qd,t.__scopeTooltip),r=I4(Qd,t.__scopeTooltip),i=v.useRef(null),o=Pt(e,i),[s,c]=v.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{c(null),f(!1)},[f]),p=v.useCallback((g,m)=>{const y=g.currentTarget,b={x:g.clientX,y:g.clientY},x=NQ(b,y.getBoundingClientRect()),w=PQ(b,x),S=kQ(m.getBoundingClientRect()),C=IQ([...w,...S]);c(C),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(l&&d){const g=y=>p(y,d),m=y=>p(y,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[l,d,p,h]),v.useEffect(()=>{if(s){const g=m=>{const y=m.target,b={x:m.clientX,y:m.clientY},x=(l==null?void 0:l.contains(y))||(d==null?void 0:d.contains(y)),w=!OQ(b,s);x?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,s,u,h]),a.jsx($4,{...t,ref:o})}),[jQ,EQ]=f0(M4,{isInside:!1}),$4=v.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=t,l=h0(Qd,n),u=_E(n),{onClose:d}=l;return v.useEffect(()=>(document.addEventListener(PO,d),()=>document.removeEventListener(PO,d)),[d]),v.useEffect(()=>{if(l.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(wE,{"data-state":l.stateAttribute,...u,...c,ref:e,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(dE,{children:r}),a.jsx(jQ,{scope:n,isInside:!0,children:a.jsx(xQ,{id:l.contentId,role:"tooltip",children:i||r})})]})})});D4.displayName=Qd;var L4="TooltipArrow",TQ=v.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=_E(n);return EQ(L4,n).isInside?null:a.jsx(SE,{...i,...r,ref:e})});TQ.displayName=L4;function NQ(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function PQ(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function kQ(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function OQ(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function IQ(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),RQ(e)}function RQ(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const o=e[e.length-1],s=e[e.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var MQ=R4,F4=D4;function B4(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=LQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const c=s.split(AE);return c[0]===""&&c.length!==1&&c.shift(),U4(c,e)||$Q(s)},getConflictingClassGroupIds:(s,c)=>{const l=n[s]||[];return c&&r[s]?[...l,...r[s]]:l}}},U4=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?U4(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(AE);return(s=e.validators.find(({validator:c})=>c(o)))==null?void 0:s.classGroupId},kO=/^\[(.+)\]$/,$Q=t=>{if(kO.test(t)){const e=kO.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},LQ=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return BQ(Object.entries(t.classGroups),n).forEach(([o,s])=>{R_(s,r,o,e)}),r},R_=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:OO(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(FQ(i)){R_(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{R_(s,OO(e,o),n,r)})})},OO=(t,e)=>{let n=t;return e.split(AE).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},FQ=t=>t.isThemeGetter,BQ=(t,e)=>e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,c])=>[e+s,c])):o);return[n,i]}):t,UQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},H4="!",HQ=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],o=e.length,s=c=>{const l=[];let u=0,d=0,f;for(let y=0;yd?f-d:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?c=>n({className:c,parseClassName:s}):s},zQ=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},GQ=t=>({cache:UQ(t.cacheSize),parseClassName:HQ(t),...DQ(t)}),VQ=/\s+/,KQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=t.trim().split(VQ);let c="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){c=u+(c.length>0?" "+c:c);continue}if(m=r(h),!m){c=u+(c.length>0?" "+c:c);continue}g=!1}const y=zQ(d).join(":"),b=f?y+H4:y,x=b+m;if(o.includes(x))continue;o.push(x);const w=i(m,g);for(let S=0;S0?" "+c:c)}return c};function WQ(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=GQ(u),r=n.cache.get,i=n.cache.set,o=c,c(l)}function c(l){const u=r(l);if(u)return u;const d=KQ(l,n);return i(l,d),d}return function(){return o(WQ.apply(null,arguments))}}const On=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},G4=/^\[(?:([a-z-]+):)?(.+)\]$/i,YQ=/^\d+\/\d+$/,QQ=new Set(["px","full","screen"]),XQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JQ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ZQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,eX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ra=t=>bd(t)||QQ.has(t)||YQ.test(t),Xa=t=>$f(t,"length",lX),bd=t=>!!t&&!Number.isNaN(Number(t)),PS=t=>$f(t,"number",bd),Sh=t=>!!t&&Number.isInteger(Number(t)),nX=t=>t.endsWith("%")&&bd(t.slice(0,-1)),Ft=t=>G4.test(t),Ja=t=>XQ.test(t),rX=new Set(["length","size","percentage"]),iX=t=>$f(t,rX,V4),oX=t=>$f(t,"position",V4),sX=new Set(["image","url"]),aX=t=>$f(t,sX,dX),cX=t=>$f(t,"",uX),Ch=()=>!0,$f=(t,e,n)=>{const r=G4.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},lX=t=>JQ.test(t)&&!ZQ.test(t),V4=()=>!1,uX=t=>eX.test(t),dX=t=>tX.test(t),fX=()=>{const t=On("colors"),e=On("spacing"),n=On("blur"),r=On("brightness"),i=On("borderColor"),o=On("borderRadius"),s=On("borderSpacing"),c=On("borderWidth"),l=On("contrast"),u=On("grayscale"),d=On("hueRotate"),f=On("invert"),h=On("gap"),p=On("gradientColorStops"),g=On("gradientColorStopPositions"),m=On("inset"),y=On("margin"),b=On("opacity"),x=On("padding"),w=On("saturate"),S=On("scale"),C=On("sepia"),_=On("skew"),A=On("space"),j=On("translate"),P=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",Ft,e],E=()=>[Ft,e],I=()=>["",ra,Xa],D=()=>["auto",bd,Ft],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",Ft],W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Y=()=>[bd,Ft];return{cacheSize:500,separator:":",theme:{colors:[Ch],spacing:[ra,Xa],blur:["none","",Ja,Ft],brightness:Y(),borderColor:[t],borderRadius:["none","","full",Ja,Ft],borderSpacing:E(),borderWidth:I(),contrast:Y(),grayscale:L(),hueRotate:Y(),invert:L(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[nX,Xa],inset:O(),margin:O(),opacity:Y(),padding:E(),saturate:Y(),scale:Y(),sepia:L(),skew:Y(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",Ft]}],container:["container"],columns:[{columns:[Ja]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...z(),Ft]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Sh,Ft]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ft]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",Sh,Ft]}],"grid-cols":[{"grid-cols":[Ch]}],"col-start-end":[{col:["auto",{span:["full",Sh,Ft]},Ft]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Ch]}],"row-start-end":[{row:["auto",{span:[Sh,Ft]},Ft]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ft]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ft]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...R()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ft,e]}],"min-w":[{"min-w":[Ft,e,"min","max","fit"]}],"max-w":[{"max-w":[Ft,e,"none","full","min","max","fit","prose",{screen:[Ja]},Ja]}],h:[{h:[Ft,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ft,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ft,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ft,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ja,Xa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",PS]}],"font-family":[{font:[Ch]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ft]}],"line-clamp":[{"line-clamp":["none",bd,PS]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ra,Ft]}],"list-image":[{"list-image":["none",Ft]}],"list-style-type":[{list:["none","disc","decimal",Ft]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ra,Xa]}],"underline-offset":[{"underline-offset":["auto",ra,Ft]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ft]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ft]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),oX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",iX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},aX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:$()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[ra,Ft]}],"outline-w":[{outline:[ra,Xa]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ra,Xa]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ja,cX]}],"shadow-color":[{shadow:[Ch]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Ja,Ft]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ft]}],duration:[{duration:Y()}],ease:[{ease:["linear","in","out","in-out",Ft]}],delay:[{delay:Y()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ft]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Sh,Ft]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ft]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ft]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ft]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ra,Xa,PS]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},hX=qQ(fX);function Ne(...t){return hX(Mt(t))}const pX=MQ,mX=v.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(F4,{ref:r,sideOffset:e,className:Ne("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));mX.displayName=F4.displayName;var p0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},m0=typeof window>"u"||"Deno"in globalThis;function Lo(){}function gX(t,e){return typeof t=="function"?t(e):t}function vX(t){return typeof t=="number"&&t>=0&&t!==1/0}function yX(t,e){return Math.max(t+(e||0)-Date.now(),0)}function IO(t,e){return typeof t=="function"?t(e):t}function xX(t,e){return typeof t=="function"?t(e):t}function RO(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:c}=t;if(s){if(r){if(e.queryHash!==jE(s,e.options))return!1}else if(!zp(e.queryKey,s))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||o&&!o(e))}function MO(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(Hp(e.options.mutationKey)!==Hp(o))return!1}else if(!zp(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function jE(t,e){return((e==null?void 0:e.queryKeyHashFn)||Hp)(t)}function Hp(t){return JSON.stringify(t,(e,n)=>M_(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function zp(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!zp(t[n],e[n])):!1}function K4(t,e){if(t===e)return t;const n=DO(t)&&DO(e);if(n||M_(t)&&M_(e)){const r=n?t:Object.keys(t),i=r.length,o=n?e:Object.keys(e),s=o.length,c=n?[]:{};let l=0;for(let u=0;u{setTimeout(e,t)})}function wX(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?K4(t,e):e}function SX(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function CX(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var EE=Symbol();function W4(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===EE?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Hl,hc,Id,U$,_X=(U$=class extends p0{constructor(){super();hn(this,Hl);hn(this,hc);hn(this,Id);Gt(this,Id,e=>{if(!m0&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ve(this,hc)||this.setEventListener(ve(this,Id))}onUnsubscribe(){var e;this.hasListeners()||((e=ve(this,hc))==null||e.call(this),Gt(this,hc,void 0))}setEventListener(e){var n;Gt(this,Id,e),(n=ve(this,hc))==null||n.call(this),Gt(this,hc,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ve(this,Hl)!==e&&(Gt(this,Hl,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ve(this,Hl)=="boolean"?ve(this,Hl):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Hl=new WeakMap,hc=new WeakMap,Id=new WeakMap,U$),q4=new _X,Rd,pc,Md,H$,AX=(H$=class extends p0{constructor(){super();hn(this,Rd,!0);hn(this,pc);hn(this,Md);Gt(this,Md,e=>{if(!m0&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ve(this,pc)||this.setEventListener(ve(this,Md))}onUnsubscribe(){var e;this.hasListeners()||((e=ve(this,pc))==null||e.call(this),Gt(this,pc,void 0))}setEventListener(e){var n;Gt(this,Md,e),(n=ve(this,pc))==null||n.call(this),Gt(this,pc,e(this.setOnline.bind(this)))}setOnline(e){ve(this,Rd)!==e&&(Gt(this,Rd,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ve(this,Rd)}},Rd=new WeakMap,pc=new WeakMap,Md=new WeakMap,H$),Hy=new AX;function jX(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function EX(t){return Math.min(1e3*2**t,3e4)}function Y4(t){return(t??"online")==="online"?Hy.isOnline():!0}var Q4=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function kS(t){return t instanceof Q4}function X4(t){let e=!1,n=0,r=!1,i;const o=jX(),s=m=>{var y;r||(h(new Q4(m)),(y=t.abort)==null||y.call(t))},c=()=>{e=!0},l=()=>{e=!1},u=()=>q4.isFocused()&&(t.networkMode==="always"||Hy.isOnline())&&t.canRun(),d=()=>Y4(t.networkMode)&&t.canRun(),f=m=>{var y;r||(r=!0,(y=t.onSuccess)==null||y.call(t,m),i==null||i(),o.resolve(m))},h=m=>{var y;r||(r=!0,(y=t.onError)==null||y.call(t,m),i==null||i(),o.reject(m))},p=()=>new Promise(m=>{var y;i=b=>{(r||u())&&m(b)},(y=t.onPause)==null||y.call(t)}).then(()=>{var m;i=void 0,r||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(r)return;let m;const y=n===0?t.initialPromise:void 0;try{m=y??t.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var _;if(r)return;const x=t.retry??(m0?0:3),w=t.retryDelay??EX,S=typeof w=="function"?w(n,b):w,C=x===!0||typeof x=="number"&&nu()?void 0:p()).then(()=>{e?h(b):g()})})};return{promise:o,cancel:s,continue:()=>(i==null||i(),o),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?g():p().then(g),o)}}function TX(){let t=[],e=0,n=c=>{c()},r=c=>{c()},i=c=>setTimeout(c,0);const o=c=>{e?t.push(c):i(()=>{n(c)})},s=()=>{const c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(l=>{n(l)})})})};return{batch:c=>{let l;e++;try{l=c()}finally{e--,e||s()}return l},batchCalls:c=>(...l)=>{o(()=>{c(...l)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{i=c}}}var hi=TX(),zl,z$,J4=(z$=class{constructor(){hn(this,zl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vX(this.gcTime)&&Gt(this,zl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(m0?1/0:5*60*1e3))}clearGcTimeout(){ve(this,zl)&&(clearTimeout(ve(this,zl)),Gt(this,zl,void 0))}},zl=new WeakMap,z$),Dd,$d,uo,Xr,og,Gl,Fo,aa,G$,NX=(G$=class extends J4{constructor(e){super();hn(this,Fo);hn(this,Dd);hn(this,$d);hn(this,uo);hn(this,Xr);hn(this,og);hn(this,Gl);Gt(this,Gl,!1),Gt(this,og,e.defaultOptions),this.setOptions(e.options),this.observers=[],Gt(this,uo,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Gt(this,Dd,kX(this.options)),this.state=e.state??ve(this,Dd),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ve(this,Xr))==null?void 0:e.promise}setOptions(e){this.options={...ve(this,og),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ve(this,uo).remove(this)}setData(e,n){const r=wX(this.state.data,e,this.options);return qr(this,Fo,aa).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){qr(this,Fo,aa).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=ve(this,Xr))==null?void 0:r.promise;return(i=ve(this,Xr))==null||i.cancel(e),n?n.then(Lo).catch(Lo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ve(this,Dd))}isActive(){return this.observers.some(e=>xX(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===EE||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!yX(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ve(this,Xr))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ve(this,Xr))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ve(this,uo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ve(this,Xr)&&(ve(this,Gl)?ve(this,Xr).cancel({revert:!0}):ve(this,Xr).cancelRetry()),this.scheduleGc()),ve(this,uo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||qr(this,Fo,aa).call(this,{type:"invalidate"})}fetch(e,n){var l,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ve(this,Xr))return ve(this,Xr).continueRetry(),ve(this,Xr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Gt(this,Gl,!0),r.signal)})},o=()=>{const f=W4(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return i(h),Gt(this,Gl,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};i(s),(l=this.options.behavior)==null||l.onFetch(s,this),Gt(this,$d,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&qr(this,Fo,aa).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const c=f=>{var h,p,g,m;kS(f)&&f.silent||qr(this,Fo,aa).call(this,{type:"error",error:f}),kS(f)||((p=(h=ve(this,uo).config).onError)==null||p.call(h,f,this),(m=(g=ve(this,uo).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return Gt(this,Xr,X4({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,m;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(y){c(y);return}(p=(h=ve(this,uo).config).onSuccess)==null||p.call(h,f,this),(m=(g=ve(this,uo).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,h)=>{qr(this,Fo,aa).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{qr(this,Fo,aa).call(this,{type:"pause"})},onContinue:()=>{qr(this,Fo,aa).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),ve(this,Xr).start()}},Dd=new WeakMap,$d=new WeakMap,uo=new WeakMap,Xr=new WeakMap,og=new WeakMap,Gl=new WeakMap,Fo=new WeakSet,aa=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...PX(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return kS(i)&&i.revert&&ve(this,$d)?{...ve(this,$d),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),hi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ve(this,uo).notify({query:this,type:"updated",action:e})})},G$);function PX(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Y4(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function kX(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ss,V$,OX=(V$=class extends p0{constructor(e={}){super();hn(this,Ss);this.config=e,Gt(this,Ss,new Map)}build(e,n,r){const i=n.queryKey,o=n.queryHash??jE(i,n);let s=this.get(o);return s||(s=new NX({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){ve(this,Ss).has(e.queryHash)||(ve(this,Ss).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ve(this,Ss).get(e.queryHash);n&&(e.destroy(),n===e&&ve(this,Ss).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){hi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ve(this,Ss).get(e)}getAll(){return[...ve(this,Ss).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>RO(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>RO(e,r)):n}notify(e){hi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){hi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){hi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ss=new WeakMap,V$),Cs,ai,Vl,_s,Za,K$,IX=(K$=class extends J4{constructor(e){super();hn(this,_s);hn(this,Cs);hn(this,ai);hn(this,Vl);this.mutationId=e.mutationId,Gt(this,ai,e.mutationCache),Gt(this,Cs,[]),this.state=e.state||RX(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ve(this,Cs).includes(e)||(ve(this,Cs).push(e),this.clearGcTimeout(),ve(this,ai).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Gt(this,Cs,ve(this,Cs).filter(n=>n!==e)),this.scheduleGc(),ve(this,ai).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ve(this,Cs).length||(this.state.status==="pending"?this.scheduleGc():ve(this,ai).remove(this))}continue(){var e;return((e=ve(this,Vl))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,s,c,l,u,d,f,h,p,g,m,y,b,x,w,S,C,_,A;Gt(this,Vl,X4({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(j,P)=>{qr(this,_s,Za).call(this,{type:"failed",failureCount:j,error:P})},onPause:()=>{qr(this,_s,Za).call(this,{type:"pause"})},onContinue:()=>{qr(this,_s,Za).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ve(this,ai).canRun(this)}));const n=this.state.status==="pending",r=!ve(this,Vl).canStart();try{if(!n){qr(this,_s,Za).call(this,{type:"pending",variables:e,isPaused:r}),await((o=(i=ve(this,ai).config).onMutate)==null?void 0:o.call(i,e,this));const P=await((c=(s=this.options).onMutate)==null?void 0:c.call(s,e));P!==this.state.context&&qr(this,_s,Za).call(this,{type:"pending",context:P,variables:e,isPaused:r})}const j=await ve(this,Vl).start();return await((u=(l=ve(this,ai).config).onSuccess)==null?void 0:u.call(l,j,e,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,j,e,this.state.context)),await((p=(h=ve(this,ai).config).onSettled)==null?void 0:p.call(h,j,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,j,null,e,this.state.context)),qr(this,_s,Za).call(this,{type:"success",data:j}),j}catch(j){try{throw await((b=(y=ve(this,ai).config).onError)==null?void 0:b.call(y,j,e,this.state.context,this)),await((w=(x=this.options).onError)==null?void 0:w.call(x,j,e,this.state.context)),await((C=(S=ve(this,ai).config).onSettled)==null?void 0:C.call(S,void 0,j,this.state.variables,this.state.context,this)),await((A=(_=this.options).onSettled)==null?void 0:A.call(_,void 0,j,e,this.state.context)),j}finally{qr(this,_s,Za).call(this,{type:"error",error:j})}}finally{ve(this,ai).runNext(this)}}},Cs=new WeakMap,ai=new WeakMap,Vl=new WeakMap,_s=new WeakSet,Za=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),hi.batch(()=>{ve(this,Cs).forEach(r=>{r.onMutationUpdate(e)}),ve(this,ai).notify({mutation:this,type:"updated",action:e})})},K$);function RX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zi,sg,W$,MX=(W$=class extends p0{constructor(e={}){super();hn(this,zi);hn(this,sg);this.config=e,Gt(this,zi,new Map),Gt(this,sg,Date.now())}build(e,n,r){const i=new IX({mutationCache:this,mutationId:++Fg(this,sg)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){const n=av(e),r=ve(this,zi).get(n)??[];r.push(e),ve(this,zi).set(n,r),this.notify({type:"added",mutation:e})}remove(e){var r;const n=av(e);if(ve(this,zi).has(n)){const i=(r=ve(this,zi).get(n))==null?void 0:r.filter(o=>o!==e);i&&(i.length===0?ve(this,zi).delete(n):ve(this,zi).set(n,i))}this.notify({type:"removed",mutation:e})}canRun(e){var r;const n=(r=ve(this,zi).get(av(e)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===e}runNext(e){var r;const n=(r=ve(this,zi).get(av(e)))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){hi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...ve(this,zi).values()].flat()}find(e){const n={exact:!0,...e};return this.getAll().find(r=>MO(n,r))}findAll(e={}){return this.getAll().filter(n=>MO(e,n))}notify(e){hi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return hi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Lo))))}},zi=new WeakMap,sg=new WeakMap,W$);function av(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function LO(t){return{onFetch:(e,n)=>{var d,f,h,p,g;const r=e.options,i=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,o=((p=e.state.data)==null?void 0:p.pages)||[],s=((g=e.state.data)==null?void 0:g.pageParams)||[];let c={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const y=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},b=W4(e.options,e.fetchOptions),x=async(w,S,C)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const _={queryKey:e.queryKey,pageParam:S,direction:C?"backward":"forward",meta:e.options.meta};y(_);const A=await b(_),{maxPages:j}=e.options,P=C?CX:SX;return{pages:P(w.pages,A,j),pageParams:P(w.pageParams,S,j)}};if(i&&o.length){const w=i==="backward",S=w?DX:FO,C={pages:o,pageParams:s},_=S(r,C);c=await x(C,_,w)}else{const w=t??o.length;do{const S=l===0?s[0]??r.initialPageParam:FO(r,c);if(l>0&&S==null)break;c=await x(c,S),l++}while(l{var m,y;return(y=(m=e.options).persister)==null?void 0:y.call(m,u,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function FO(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function DX(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Yn,mc,gc,Ld,Fd,vc,Bd,Ud,q$,$X=(q$=class{constructor(t={}){hn(this,Yn);hn(this,mc);hn(this,gc);hn(this,Ld);hn(this,Fd);hn(this,vc);hn(this,Bd);hn(this,Ud);Gt(this,Yn,t.queryCache||new OX),Gt(this,mc,t.mutationCache||new MX),Gt(this,gc,t.defaultOptions||{}),Gt(this,Ld,new Map),Gt(this,Fd,new Map),Gt(this,vc,0)}mount(){Fg(this,vc)._++,ve(this,vc)===1&&(Gt(this,Bd,q4.subscribe(async t=>{t&&(await this.resumePausedMutations(),ve(this,Yn).onFocus())})),Gt(this,Ud,Hy.subscribe(async t=>{t&&(await this.resumePausedMutations(),ve(this,Yn).onOnline())})))}unmount(){var t,e;Fg(this,vc)._--,ve(this,vc)===0&&((t=ve(this,Bd))==null||t.call(this),Gt(this,Bd,void 0),(e=ve(this,Ud))==null||e.call(this),Gt(this,Ud,void 0))}isFetching(t){return ve(this,Yn).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ve(this,mc).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ve(this,Yn).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const n=this.defaultQueryOptions(t),r=ve(this,Yn).build(this,n);return t.revalidateIfStale&&r.isStaleByTime(IO(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(e)}}getQueriesData(t){return ve(this,Yn).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ve(this,Yn).get(r.queryHash),o=i==null?void 0:i.state.data,s=gX(e,o);if(s!==void 0)return ve(this,Yn).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return hi.batch(()=>ve(this,Yn).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ve(this,Yn).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ve(this,Yn);hi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ve(this,Yn),r={type:"active",...t};return hi.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const n={revert:!0,...e},r=hi.batch(()=>ve(this,Yn).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Lo).catch(Lo)}invalidateQueries(t={},e={}){return hi.batch(()=>{if(ve(this,Yn).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const n={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(n,e)})}refetchQueries(t={},e){const n={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=hi.batch(()=>ve(this,Yn).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Lo)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Lo)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ve(this,Yn).build(this,e);return n.isStaleByTime(IO(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Lo).catch(Lo)}fetchInfiniteQuery(t){return t.behavior=LO(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Lo).catch(Lo)}ensureInfiniteQueryData(t){return t.behavior=LO(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Hy.isOnline()?ve(this,mc).resumePausedMutations():Promise.resolve()}getQueryCache(){return ve(this,Yn)}getMutationCache(){return ve(this,mc)}getDefaultOptions(){return ve(this,gc)}setDefaultOptions(t){Gt(this,gc,t)}setQueryDefaults(t,e){ve(this,Ld).set(Hp(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ve(this,Ld).values()];let n={};return e.forEach(r=>{zp(t,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(t,e){ve(this,Fd).set(Hp(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ve(this,Fd).values()];let n={};return e.forEach(r=>{zp(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ve(this,gc).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=jE(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===EE&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ve(this,gc).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ve(this,Yn).clear(),ve(this,mc).clear()}},Yn=new WeakMap,mc=new WeakMap,gc=new WeakMap,Ld=new WeakMap,Fd=new WeakMap,vc=new WeakMap,Bd=new WeakMap,Ud=new WeakMap,q$),LX=v.createContext(void 0),FX=({client:t,children:e})=>(v.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(LX.Provider,{value:t,children:e}));/** +`+o.stack}return{value:t,source:e,stack:i,digest:null}}function _S(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function f_(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var z7=typeof WeakMap=="function"?WeakMap:Map;function RF(t,e,n){n=_a(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Ry||(Ry=!0,S_=r),f_(t,e)},n}function MF(t,e,n){n=_a(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;n.payload=function(){return r(i)},n.callback=function(){f_(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){f_(t,e),typeof r!="function"&&(Nc===null?Nc=new Set([this]):Nc.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function Zk(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new z7;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(n)||(i.add(n),t=r9.bind(null,t,e,n),e.then(t,t))}function eO(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function tO(t,e,n,r,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=_a(-1,1),e.tag=2,Tc(n,e,1))),n.lanes|=1),t)}var G7=za.ReactCurrentOwner,Ni=!1;function ui(t,e,n,r){e.child=t===null?uF(e,null,n,r):Vd(e,t.child,n,r)}function nO(t,e,n,r,i){n=n.render;var o=e.ref;return vd(e,i),r=Yj(t,e,n,r,o,i),n=Qj(),t!==null&&!Ni?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Oa(t,e,i)):(zn&&n&&$j(e),e.flags|=1,ui(t,e,r,i),e.child)}function rO(t,e,n,r,i){if(t===null){var o=n.type;return typeof o=="function"&&!sE(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=o,DF(t,e,o,r,i)):(t=Wv(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:Pp,n(s,r)&&t.ref===e.ref)return Oa(t,e,i)}return e.flags|=1,t=kc(o,r),t.ref=e.ref,t.return=e,e.child=t}function DF(t,e,n,r,i){if(t!==null){var o=t.memoizedProps;if(Pp(o,r)&&t.ref===e.ref)if(Ni=!1,e.pendingProps=r=o,(t.lanes&i)!==0)t.flags&131072&&(Ni=!0);else return e.lanes=t.lanes,Oa(t,e,i)}return h_(t,e,n,r,i)}function $F(t,e,n){var r=e.pendingProps,i=r.children,o=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},kn(ad,Vi),Vi|=n;else{if(!(n&1073741824))return t=o!==null?o.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,kn(ad,Vi),Vi|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,kn(ad,Vi),Vi|=r}else o!==null?(r=o.baseLanes|n,e.memoizedState=null):r=n,kn(ad,Vi),Vi|=r;return ui(t,e,i,n),e.child}function LF(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function h_(t,e,n,r,i){var o=Oi(n)?tu:ii.current;return o=zd(e,o),vd(e,i),n=Yj(t,e,n,r,o,i),r=Qj(),t!==null&&!Ni?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Oa(t,e,i)):(zn&&r&&$j(e),e.flags|=1,ui(t,e,n,i),e.child)}function iO(t,e,n,r,i){if(Oi(n)){var o=!0;_y(e)}else o=!1;if(vd(e,i),e.stateNode===null)Gv(t,e),IF(e,n,r),d_(e,n,r,i),r=!0;else if(t===null){var s=e.stateNode,c=e.memoizedProps;s.props=c;var l=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=Eo(u):(u=Oi(n)?tu:ii.current,u=zd(e,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(c!==r||l!==u)&&Jk(e,s,r,u),ic=!1;var h=e.memoizedState;s.state=h,Ny(e,r,s,i),l=e.memoizedState,c!==r||h!==l||ki.current||ic?(typeof d=="function"&&(u_(e,n,d,r),l=e.memoizedState),(c=ic||Xk(e,n,c,r,h,l,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),s.props=r,s.state=l,s.context=u,r=c):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,fF(t,e),c=e.memoizedProps,u=e.type===e.elementType?c:$o(e.type,c),s.props=u,f=e.pendingProps,h=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Eo(l):(l=Oi(n)?tu:ii.current,l=zd(e,l));var p=n.getDerivedStateFromProps;(d=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(c!==f||h!==l)&&Jk(e,s,r,l),ic=!1,h=e.memoizedState,s.state=h,Ny(e,r,s,i);var g=e.memoizedState;c!==f||h!==g||ki.current||ic?(typeof p=="function"&&(u_(e,n,p,r),g=e.memoizedState),(u=ic||Xk(e,n,u,r,h,g,l)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,g,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,g,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||c===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||c===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=g),s.props=r,s.state=g,s.context=l,r=u):(typeof s.componentDidUpdate!="function"||c===t.memoizedProps&&h===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||c===t.memoizedProps&&h===t.memoizedState||(e.flags|=1024),r=!1)}return p_(t,e,n,r,o,i)}function p_(t,e,n,r,i,o){LF(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return i&&zk(e,n,!1),Oa(t,e,o);r=e.stateNode,G7.current=e;var c=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=Vd(e,t.child,null,o),e.child=Vd(e,null,c,o)):ui(t,e,c,o),e.memoizedState=r.state,i&&zk(e,n,!0),e.child}function FF(t){var e=t.stateNode;e.pendingContext?Hk(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Hk(t,e.context,!1),Vj(t,e.containerInfo)}function oO(t,e,n,r,i){return Gd(),Fj(i),e.flags|=256,ui(t,e,n,r),e.child}var m_={dehydrated:null,treeContext:null,retryLane:0};function g_(t){return{baseLanes:t,cachePool:null,transitions:null}}function BF(t,e,n){var r=e.pendingProps,i=Kn.current,o=!1,s=(e.flags&128)!==0,c;if((c=s)||(c=t!==null&&t.memoizedState===null?!1:(i&2)!==0),c?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),kn(Kn,i&1),t===null)return c_(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,o?(r=e.mode,o=e.child,s={mode:"hidden",children:s},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=n0(s,r,0,null),t=Wl(t,r,n,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=g_(n),e.memoizedState=m_,t):Zj(e,s));if(i=t.memoizedState,i!==null&&(c=i.dehydrated,c!==null))return V7(t,e,s,r,c,i,n);if(o){o=r.fallback,s=e.mode,i=t.child,c=i.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=kc(i,l),r.subtreeFlags=i.subtreeFlags&14680064),c!==null?o=kc(c,o):(o=Wl(o,s,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,r=o,o=e.child,s=t.child.memoizedState,s=s===null?g_(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~n,e.memoizedState=m_,r}return o=t.child,t=o.sibling,r=kc(o,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Zj(t,e){return e=n0({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function ev(t,e,n,r){return r!==null&&Fj(r),Vd(e,t.child,null,n),t=Zj(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function V7(t,e,n,r,i,o,s){if(n)return e.flags&256?(e.flags&=-257,r=_S(Error(Ce(422))),ev(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=r.fallback,i=e.mode,r=n0({mode:"visible",children:r.children},i,0,null),o=Wl(o,i,s,null),o.flags|=2,r.return=e,o.return=e,r.sibling=o,e.child=r,e.mode&1&&Vd(e,t.child,null,s),e.child.memoizedState=g_(s),e.memoizedState=m_,o);if(!(e.mode&1))return ev(t,e,s,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var c=r.dgst;return r=c,o=Error(Ce(419)),r=_S(o,r,void 0),ev(t,e,s,r)}if(c=(s&t.childLanes)!==0,Ni||c){if(r=Mr,r!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,ka(t,i),Qo(r,t,i,-1))}return oE(),r=_S(Error(Ce(421))),ev(t,e,s,r)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=i9.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,Qi=Ec(i.nextSibling),Xi=e,zn=!0,Go=null,t!==null&&(go[vo++]=ga,go[vo++]=va,go[vo++]=nu,ga=t.id,va=t.overflow,nu=e),e=Zj(e,r.children),e.flags|=4096,e)}function sO(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),l_(t.return,e,n)}function AS(t,e,n,r,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i)}function UF(t,e,n){var r=e.pendingProps,i=r.revealOrder,o=r.tail;if(ui(t,e,r.children,n),r=Kn.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&sO(t,n,e);else if(t.tag===19)sO(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(kn(Kn,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(n=e.child,i=null;n!==null;)t=n.alternate,t!==null&&Py(t)===null&&(i=n),n=n.sibling;n=i,n===null?(i=e.child,e.child=null):(i=n.sibling,n.sibling=null),AS(e,!1,i,n,o);break;case"backwards":for(n=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&Py(t)===null){e.child=i;break}t=i.sibling,i.sibling=n,n=i,i=t}AS(e,!0,n,null,o);break;case"together":AS(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Gv(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Oa(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),iu|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(Ce(153));if(e.child!==null){for(t=e.child,n=kc(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=kc(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function K7(t,e,n){switch(e.tag){case 3:FF(e),Gd();break;case 5:hF(e);break;case 1:Oi(e.type)&&_y(e);break;case 4:Vj(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;kn(Ey,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(kn(Kn,Kn.current&1),e.flags|=128,null):n&e.child.childLanes?BF(t,e,n):(kn(Kn,Kn.current&1),t=Oa(t,e,n),t!==null?t.sibling:null);kn(Kn,Kn.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return UF(t,e,n);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),kn(Kn,Kn.current),r)break;return null;case 22:case 23:return e.lanes=0,$F(t,e,n)}return Oa(t,e,n)}var HF,v_,zF,GF;HF=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};v_=function(){};zF=function(t,e,n,r){var i=t.memoizedProps;if(i!==r){t=e.stateNode,Pl(Ms.current);var o=null;switch(n){case"input":i=FC(t,i),r=FC(t,r),o=[];break;case"select":i=qn({},i,{value:void 0}),r=qn({},r,{value:void 0}),o=[];break;case"textarea":i=HC(t,i),r=HC(t,r),o=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Sy)}GC(n,r);var s;n=null;for(u in i)if(!r.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var c=i[u];for(s in c)c.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Cp.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in r){var l=r[u];if(c=i!=null?i[u]:void 0,r.hasOwnProperty(u)&&l!==c&&(l!=null||c!=null))if(u==="style")if(c){for(s in c)!c.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&c[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(o||(o=[]),o.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,c=c?c.__html:void 0,l!=null&&c!==l&&(o=o||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(o=o||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Cp.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Rn("scroll",t),o||c===l||(o=[])):(o=o||[]).push(u,l))}n&&(o=o||[]).push("style",n);var u=o;(e.updateQueue=u)&&(e.flags|=4)}};GF=function(t,e,n,r){n!==r&&(e.flags|=4)};function bh(t,e){if(!zn)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Qr(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function W7(t,e,n){var r=e.pendingProps;switch(Lj(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qr(e),null;case 1:return Oi(e.type)&&Cy(),Qr(e),null;case 3:return r=e.stateNode,Kd(),Bn(ki),Bn(ii),Wj(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Jg(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Go!==null&&(A_(Go),Go=null))),v_(t,e),Qr(e),null;case 5:Kj(e);var i=Pl(Mp.current);if(n=e.type,t!==null&&e.stateNode!=null)zF(t,e,n,r,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Ce(166));return Qr(e),null}if(t=Pl(Ms.current),Jg(e)){r=e.stateNode,n=e.type;var o=e.memoizedProps;switch(r[Es]=e,r[Ip]=o,t=(e.mode&1)!==0,n){case"dialog":Rn("cancel",r),Rn("close",r);break;case"iframe":case"object":case"embed":Rn("load",r);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[Es]=e,t[Ip]=r,HF(t,e,!1,!1),e.stateNode=t;e:{switch(s=VC(n,r),n){case"dialog":Rn("cancel",t),Rn("close",t),i=r;break;case"iframe":case"object":case"embed":Rn("load",t),i=r;break;case"video":case"audio":for(i=0;iqd&&(e.flags|=128,r=!0,bh(o,!1),e.lanes=4194304)}else{if(!r)if(t=Py(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),bh(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!zn)return Qr(e),null}else 2*rr()-o.renderingStartTime>qd&&n!==1073741824&&(e.flags|=128,r=!0,bh(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(n=o.last,n!==null?n.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=rr(),e.sibling=null,n=Kn.current,kn(Kn,r?n&1|2:n&1),e):(Qr(e),null);case 22:case 23:return iE(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Vi&1073741824&&(Qr(e),e.subtreeFlags&6&&(e.flags|=8192)):Qr(e),null;case 24:return null;case 25:return null}throw Error(Ce(156,e.tag))}function q7(t,e){switch(Lj(e),e.tag){case 1:return Oi(e.type)&&Cy(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Kd(),Bn(ki),Bn(ii),Wj(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Kj(e),null;case 13:if(Bn(Kn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Ce(340));Gd()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Bn(Kn),null;case 4:return Kd(),null;case 10:return Hj(e.type._context),null;case 22:case 23:return iE(),null;case 24:return null;default:return null}}var tv=!1,ti=!1,Y7=typeof WeakSet=="function"?WeakSet:Set,Xe=null;function sd(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qn(t,e,r)}else n.current=null}function y_(t,e,n){try{n()}catch(r){Qn(t,e,r)}}var aO=!1;function Q7(t,e){if(t_=xy,t=YL(),Dj(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,c=-1,l=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==o||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===n&&++u===i&&(c=s),h===o&&++d===r&&(l=s),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(n_={focusedElem:t,selectionRange:n},xy=!1,Xe=e;Xe!==null;)if(e=Xe,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Xe=t;else for(;Xe!==null;){e=Xe;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,b=e.stateNode,x=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:$o(e.type,m),y);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ce(163))}}catch(S){Qn(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,Xe=t;break}Xe=e.return}return g=aO,aO=!1,g}function op(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&y_(e,n,o)}i=i.next}while(i!==r)}}function e0(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function x_(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function VF(t){var e=t.alternate;e!==null&&(t.alternate=null,VF(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Es],delete e[Ip],delete e[o_],delete e[O7],delete e[I7])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function KF(t){return t.tag===5||t.tag===3||t.tag===4}function cO(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||KF(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function b_(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Sy));else if(r!==4&&(t=t.child,t!==null))for(b_(t,e,n),t=t.sibling;t!==null;)b_(t,e,n),t=t.sibling}function w_(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(w_(t,e,n),t=t.sibling;t!==null;)w_(t,e,n),t=t.sibling}var Br=null,Bo=!1;function Qa(t,e,n){for(n=n.child;n!==null;)WF(t,e,n),n=n.sibling}function WF(t,e,n){if(Rs&&typeof Rs.onCommitFiberUnmount=="function")try{Rs.onCommitFiberUnmount(Kb,n)}catch{}switch(n.tag){case 5:ti||sd(n,e);case 6:var r=Br,i=Bo;Br=null,Qa(t,e,n),Br=r,Bo=i,Br!==null&&(Bo?(t=Br,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Br.removeChild(n.stateNode));break;case 18:Br!==null&&(Bo?(t=Br,n=n.stateNode,t.nodeType===8?yS(t.parentNode,n):t.nodeType===1&&yS(t,n),Tp(t)):yS(Br,n.stateNode));break;case 4:r=Br,i=Bo,Br=n.stateNode.containerInfo,Bo=!0,Qa(t,e,n),Br=r,Bo=i;break;case 0:case 11:case 14:case 15:if(!ti&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&y_(n,e,s),i=i.next}while(i!==r)}Qa(t,e,n);break;case 1:if(!ti&&(sd(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){Qn(n,e,c)}Qa(t,e,n);break;case 21:Qa(t,e,n);break;case 22:n.mode&1?(ti=(r=ti)||n.memoizedState!==null,Qa(t,e,n),ti=r):Qa(t,e,n);break;default:Qa(t,e,n)}}function lO(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new Y7),e.forEach(function(r){var i=o9.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Io(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=rr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*J7(r/1960))-r,10t?16:t,xc===null)var r=!1;else{if(t=xc,xc=null,My=0,on&6)throw Error(Ce(331));var i=on;for(on|=4,Xe=t.current;Xe!==null;){var o=Xe,s=o.child;if(Xe.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lrr()-nE?Kl(t,0):tE|=n),Ii(t,e)}function t4(t,e){e===0&&(t.mode&1?(e=Kg,Kg<<=1,!(Kg&130023424)&&(Kg=4194304)):e=1);var n=yi();t=ka(t,e),t!==null&&(cg(t,e,n),Ii(t,n))}function i9(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),t4(t,n)}function o9(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,i=t.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(Ce(314))}r!==null&&r.delete(e),t4(t,n)}var n4;n4=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||ki.current)Ni=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Ni=!1,K7(t,e,n);Ni=!!(t.flags&131072)}else Ni=!1,zn&&e.flags&1048576&&sF(e,jy,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Gv(t,e),t=e.pendingProps;var i=zd(e,ii.current);vd(e,n),i=Yj(null,e,r,t,i,n);var o=Qj();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Oi(r)?(o=!0,_y(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Gj(e),i.updater=Zb,e.stateNode=i,i._reactInternals=e,d_(e,r,t,n),e=p_(null,e,r,!0,o,n)):(e.tag=0,zn&&o&&$j(e),ui(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Gv(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=a9(r),t=$o(r,t),i){case 0:e=h_(null,e,r,t,n);break e;case 1:e=iO(null,e,r,t,n);break e;case 11:e=nO(null,e,r,t,n);break e;case 14:e=rO(null,e,r,$o(r.type,t),n);break e}throw Error(Ce(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),h_(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),iO(t,e,r,i,n);case 3:e:{if(FF(e),t===null)throw Error(Ce(387));r=e.pendingProps,o=e.memoizedState,i=o.element,fF(t,e),Ny(e,r,null,n);var s=e.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Wd(Error(Ce(423)),e),e=oO(t,e,r,n,i);break e}else if(r!==i){i=Wd(Error(Ce(424)),e),e=oO(t,e,r,n,i);break e}else for(Qi=Ec(e.stateNode.containerInfo.firstChild),Xi=e,zn=!0,Go=null,n=uF(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Gd(),r===i){e=Oa(t,e,n);break e}ui(t,e,r,n)}e=e.child}return e;case 5:return hF(e),t===null&&c_(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,r_(r,i)?s=null:o!==null&&r_(r,o)&&(e.flags|=32),LF(t,e),ui(t,e,s,n),e.child;case 6:return t===null&&c_(e),null;case 13:return BF(t,e,n);case 4:return Vj(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Vd(e,null,r,n):ui(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),nO(t,e,r,i,n);case 7:return ui(t,e,e.pendingProps,n),e.child;case 8:return ui(t,e,e.pendingProps.children,n),e.child;case 12:return ui(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,kn(Ey,r._currentValue),r._currentValue=s,o!==null)if(is(o.value,s)){if(o.children===i.children&&!ki.current){e=Oa(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=_a(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),l_(o.return,n,e),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(Ce(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),l_(s,n,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ui(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,vd(e,n),i=Eo(i),r=r(i),e.flags|=1,ui(t,e,r,n),e.child;case 14:return r=e.type,i=$o(r,e.pendingProps),i=$o(r.type,i),rO(t,e,r,i,n);case 15:return DF(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:$o(r,i),Gv(t,e),e.tag=1,Oi(r)?(t=!0,_y(e)):t=!1,vd(e,n),IF(e,r,i),d_(e,r,i,n),p_(null,e,r,!0,t,n);case 19:return UF(t,e,n);case 22:return $F(t,e,n)}throw Error(Ce(156,e.tag))};function r4(t,e){return PL(t,e)}function s9(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function So(t,e,n,r){return new s9(t,e,n,r)}function sE(t){return t=t.prototype,!(!t||!t.isReactComponent)}function a9(t){if(typeof t=="function")return sE(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Aj)return 11;if(t===jj)return 14}return 2}function kc(t,e){var n=t.alternate;return n===null?(n=So(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Wv(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")sE(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Xu:return Wl(n.children,i,o,e);case _j:s=8,i|=8;break;case MC:return t=So(12,n,e,i|2),t.elementType=MC,t.lanes=o,t;case DC:return t=So(13,n,e,i),t.elementType=DC,t.lanes=o,t;case $C:return t=So(19,n,e,i),t.elementType=$C,t.lanes=o,t;case hL:return n0(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case dL:s=10;break e;case fL:s=9;break e;case Aj:s=11;break e;case jj:s=14;break e;case rc:s=16,r=null;break e}throw Error(Ce(130,t==null?t:typeof t,""))}return e=So(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function Wl(t,e,n,r){return t=So(7,t,r,e),t.lanes=n,t}function n0(t,e,n,r){return t=So(22,t,r,e),t.elementType=hL,t.lanes=n,t.stateNode={isHidden:!1},t}function jS(t,e,n){return t=So(6,t,null,e),t.lanes=n,t}function ES(t,e,n){return e=So(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function c9(t,e,n,r,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=aS(0),this.expirationTimes=aS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=aS(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function aE(t,e,n,r,i,o,s,c,l){return t=new c9(t,e,n,c,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=So(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Gj(o),t}function l9(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a4)}catch(t){console.error(t)}}a4(),aL.exports=ro;var If=aL.exports;const c4=dn(If);var l4,vO=If;l4=vO.createRoot,vO.hydrateRoot;var yO=["light","dark"],p9="(prefers-color-scheme: dark)",m9=v.createContext(void 0),g9={setTheme:t=>{},themes:[]},v9=()=>{var t;return(t=v.useContext(m9))!=null?t:g9};v.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:o,value:s,attrs:c,nonce:l})=>{let u=o==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${c.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=i?yO.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,y=!0)=>{let b=s?s[g]:g,x=m?g+"|| ''":`'${b}'`,w="";return i&&y&&!m&&yO.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},p=t?`!function(){${d}${h(t)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${u})){var t='${p9}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}${u?"":"else{"+h(o,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${e}');if(e){${s?`var x=${JSON.stringify(s)};`:""}${h(s?"x[e]":"e",!0)}}else{${h(o,!1,!1)};}${f}}catch(t){}}();`;return v.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:p}})});var y9=t=>{switch(t){case"success":return w9;case"info":return C9;case"warning":return S9;case"error":return _9;default:return null}},x9=Array(12).fill(0),b9=({visible:t})=>N.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},N.createElement("div",{className:"sonner-spinner"},x9.map((e,n)=>N.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),w9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),S9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),C9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),_9=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),A9=()=>{let[t,e]=N.useState(document.hidden);return N.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},j_=1,j9=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,i=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:j_++,o=this.toasts.find(c=>c.id===i),s=t.dismissible===void 0?!0:t.dismissible;return o?this.toasts=this.toasts.map(c=>c.id===i?(this.publish({...c,...t,id:i,title:n}),{...c,...t,id:i,dismissible:s,title:n}):c):this.addToast({title:n,...r,dismissible:s,id:i}),i},this.dismiss=t=>(t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),i=n!==void 0;return r.then(async o=>{if(T9(o)&&!o.ok){i=!1;let s=typeof e.error=="function"?await e.error(`HTTP error! status: ${o.status}`):e.error,c=typeof e.description=="function"?await e.description(`HTTP error! status: ${o.status}`):e.description;this.create({id:n,type:"error",message:s,description:c})}else if(e.success!==void 0){i=!1;let s=typeof e.success=="function"?await e.success(o):e.success,c=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"success",message:s,description:c})}}).catch(async o=>{if(e.error!==void 0){i=!1;let s=typeof e.error=="function"?await e.error(o):e.error,c=typeof e.description=="function"?await e.description(o):e.description;this.create({id:n,type:"error",message:s,description:c})}}).finally(()=>{var o;i&&(this.dismiss(n),n=void 0),(o=e.finally)==null||o.call(e)}),n},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||j_++;return this.create({jsx:t(n),id:n,...e}),n},this.subscribers=[],this.toasts=[]}},Gi=new j9,E9=(t,e)=>{let n=(e==null?void 0:e.id)||j_++;return Gi.addToast({title:t,...e,id:n}),n},T9=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",N9=E9,P9=()=>Gi.toasts,re=Object.assign(N9,{success:Gi.success,info:Gi.info,warning:Gi.warning,error:Gi.error,custom:Gi.custom,message:Gi.message,promise:Gi.promise,dismiss:Gi.dismiss,loading:Gi.loading},{getHistory:P9});function k9(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}k9(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function iv(t){return t.label!==void 0}var O9=3,I9="32px",R9=4e3,M9=356,D9=14,$9=20,L9=200;function F9(...t){return t.filter(Boolean).join(" ")}var B9=t=>{var e,n,r,i,o,s,c,l,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:y,heights:b,index:x,toasts:w,expanded:S,removeToast:C,defaultRichColors:_,closeButton:A,style:j,cancelButtonStyle:P,actionButtonStyle:k,className:O="",descriptionClassName:E="",duration:I,position:D,gap:z,loadingIcon:$,expandByDefault:G,classNames:R,icons:L,closeButtonAriaLabel:W="Close toast",pauseWhenPageIsHidden:Y,cn:te}=t,[me,F]=N.useState(!1),[se,ne]=N.useState(!1),[ae,De]=N.useState(!1),[de,ye]=N.useState(!1),[Ee,Z]=N.useState(0),[ct,Le]=N.useState(0),At=N.useRef(null),lt=N.useRef(null),Jt=x===0,T=x+1<=y,M=h.type,U=h.dismissible!==!1,V=h.className||"",Q=h.descriptionClassName||"",B=N.useMemo(()=>b.findIndex(St=>St.toastId===h.id)||0,[b,h.id]),X=N.useMemo(()=>{var St;return(St=h.closeButton)!=null?St:A},[h.closeButton,A]),ge=N.useMemo(()=>h.duration||I||R9,[h.duration,I]),xe=N.useRef(0),Re=N.useRef(0),be=N.useRef(0),Ve=N.useRef(null),[st,kt]=D.split("-"),Ke=N.useMemo(()=>b.reduce((St,Ze,ot)=>ot>=B?St:St+Ze.height,0),[b,B]),tt=A9(),Nt=h.invert||f,sn=M==="loading";Re.current=N.useMemo(()=>B*z+Ke,[B,Ke]),N.useEffect(()=>{F(!0)},[]),N.useLayoutEffect(()=>{if(!me)return;let St=lt.current,Ze=St.style.height;St.style.height="auto";let ot=St.getBoundingClientRect().height;St.style.height=Ze,Le(ot),m(Xt=>Xt.find(wn=>wn.toastId===h.id)?Xt.map(wn=>wn.toastId===h.id?{...wn,height:ot}:wn):[{toastId:h.id,height:ot,position:h.position},...Xt])},[me,h.title,h.description,m,h.id]);let Nr=N.useCallback(()=>{ne(!0),Z(Re.current),m(St=>St.filter(Ze=>Ze.toastId!==h.id)),setTimeout(()=>{C(h)},L9)},[h,C,m,Re]);N.useEffect(()=>{if(h.promise&&M==="loading"||h.duration===1/0||h.type==="loading")return;let St,Ze=ge;return S||g||Y&&tt?(()=>{if(be.current{var ot;(ot=h.onAutoClose)==null||ot.call(h,h),Nr()},Ze)),()=>clearTimeout(St)},[S,g,G,h,ge,Nr,h.promise,M,Y,tt]),N.useEffect(()=>{let St=lt.current;if(St){let Ze=St.getBoundingClientRect().height;return Le(Ze),m(ot=>[{toastId:h.id,height:Ze,position:h.position},...ot]),()=>m(ot=>ot.filter(Xt=>Xt.toastId!==h.id))}},[m,h.id]),N.useEffect(()=>{h.delete&&Nr()},[Nr,h.delete]);function fn(){return L!=null&&L.loading?N.createElement("div",{className:"sonner-loader","data-visible":M==="loading"},L.loading):$?N.createElement("div",{className:"sonner-loader","data-visible":M==="loading"},$):N.createElement(b9,{visible:M==="loading"})}return N.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:lt,className:te(O,V,R==null?void 0:R.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,R==null?void 0:R.default,R==null?void 0:R[M],(n=h==null?void 0:h.classNames)==null?void 0:n[M]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:_,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":me,"data-promise":!!h.promise,"data-removed":se,"data-visible":T,"data-y-position":st,"data-x-position":kt,"data-index":x,"data-front":Jt,"data-swiping":ae,"data-dismissible":U,"data-type":M,"data-invert":Nt,"data-swipe-out":de,"data-expanded":!!(S||G&&me),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${se?Ee:Re.current}px`,"--initial-height":G?"auto":`${ct}px`,...j,...h.style},onPointerDown:St=>{sn||!U||(At.current=new Date,Z(Re.current),St.target.setPointerCapture(St.pointerId),St.target.tagName!=="BUTTON"&&(De(!0),Ve.current={x:St.clientX,y:St.clientY}))},onPointerUp:()=>{var St,Ze,ot,Xt;if(de||!U)return;Ve.current=null;let wn=Number(((St=lt.current)==null?void 0:St.style.getPropertyValue("--swipe-amount").replace("px",""))||0),oo=new Date().getTime()-((Ze=At.current)==null?void 0:Ze.getTime()),ta=Math.abs(wn)/oo;if(Math.abs(wn)>=$9||ta>.11){Z(Re.current),(ot=h.onDismiss)==null||ot.call(h,h),Nr(),ye(!0);return}(Xt=lt.current)==null||Xt.style.setProperty("--swipe-amount","0px"),De(!1)},onPointerMove:St=>{var Ze;if(!Ve.current||!U)return;let ot=St.clientY-Ve.current.y,Xt=St.clientX-Ve.current.x,wn=(st==="top"?Math.min:Math.max)(0,ot),oo=St.pointerType==="touch"?10:2;Math.abs(wn)>oo?(Ze=lt.current)==null||Ze.style.setProperty("--swipe-amount",`${ot}px`):Math.abs(Xt)>oo&&(Ve.current=null)}},X&&!h.jsx?N.createElement("button",{"aria-label":W,"data-disabled":sn,"data-close-button":!0,onClick:sn||!U?()=>{}:()=>{var St;Nr(),(St=h.onDismiss)==null||St.call(h,h)},className:te(R==null?void 0:R.closeButton,(i=h==null?void 0:h.classNames)==null?void 0:i.closeButton)},N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},N.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),N.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||N.isValidElement(h.title)?h.jsx||h.title:N.createElement(N.Fragment,null,M||h.icon||h.promise?N.createElement("div",{"data-icon":"",className:te(R==null?void 0:R.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||fn():null,h.type!=="loading"?h.icon||(L==null?void 0:L[M])||y9(M):null):null,N.createElement("div",{"data-content":"",className:te(R==null?void 0:R.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},N.createElement("div",{"data-title":"",className:te(R==null?void 0:R.title,(c=h==null?void 0:h.classNames)==null?void 0:c.title)},h.title),h.description?N.createElement("div",{"data-description":"",className:te(E,Q,R==null?void 0:R.description,(l=h==null?void 0:h.classNames)==null?void 0:l.description)},h.description):null),N.isValidElement(h.cancel)?h.cancel:h.cancel&&iv(h.cancel)?N.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||P,onClick:St=>{var Ze,ot;iv(h.cancel)&&U&&((ot=(Ze=h.cancel).onClick)==null||ot.call(Ze,St),Nr())},className:te(R==null?void 0:R.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,N.isValidElement(h.action)?h.action:h.action&&iv(h.action)?N.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||k,onClick:St=>{var Ze,ot;iv(h.action)&&(St.defaultPrevented||((ot=(Ze=h.action).onClick)==null||ot.call(Ze,St),Nr()))},className:te(R==null?void 0:R.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function xO(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}var U9=t=>{let{invert:e,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:i,closeButton:o,className:s,offset:c,theme:l="light",richColors:u,duration:d,style:f,visibleToasts:h=O9,toastOptions:p,dir:g=xO(),gap:m=D9,loadingIcon:y,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:w,cn:S=F9}=t,[C,_]=N.useState([]),A=N.useMemo(()=>Array.from(new Set([n].concat(C.filter(Y=>Y.position).map(Y=>Y.position)))),[C,n]),[j,P]=N.useState([]),[k,O]=N.useState(!1),[E,I]=N.useState(!1),[D,z]=N.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),$=N.useRef(null),G=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),R=N.useRef(null),L=N.useRef(!1),W=N.useCallback(Y=>{var te;(te=C.find(me=>me.id===Y.id))!=null&&te.delete||Gi.dismiss(Y.id),_(me=>me.filter(({id:F})=>F!==Y.id))},[C]);return N.useEffect(()=>Gi.subscribe(Y=>{if(Y.dismiss){_(te=>te.map(me=>me.id===Y.id?{...me,delete:!0}:me));return}setTimeout(()=>{c4.flushSync(()=>{_(te=>{let me=te.findIndex(F=>F.id===Y.id);return me!==-1?[...te.slice(0,me),{...te[me],...Y},...te.slice(me+1)]:[Y,...te]})})})}),[]),N.useEffect(()=>{if(l!=="system"){z(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:Y})=>{z(Y?"dark":"light")})},[l]),N.useEffect(()=>{C.length<=1&&O(!1)},[C]),N.useEffect(()=>{let Y=te=>{var me,F;r.every(se=>te[se]||te.code===se)&&(O(!0),(me=$.current)==null||me.focus()),te.code==="Escape"&&(document.activeElement===$.current||(F=$.current)!=null&&F.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[r]),N.useEffect(()=>{if($.current)return()=>{R.current&&(R.current.focus({preventScroll:!0}),R.current=null,L.current=!1)}},[$.current]),C.length?N.createElement("section",{"aria-label":`${x} ${G}`,tabIndex:-1},A.map((Y,te)=>{var me;let[F,se]=Y.split("-");return N.createElement("ol",{key:Y,dir:g==="auto"?xO():g,tabIndex:-1,ref:$,className:s,"data-sonner-toaster":!0,"data-theme":D,"data-y-position":F,"data-x-position":se,style:{"--front-toast-height":`${((me=j[0])==null?void 0:me.height)||0}px`,"--offset":typeof c=="number"?`${c}px`:c||I9,"--width":`${M9}px`,"--gap":`${m}px`,...f},onBlur:ne=>{L.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(L.current=!1,R.current&&(R.current.focus({preventScroll:!0}),R.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||L.current||(L.current=!0,R.current=ne.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{E||O(!1)},onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},C.filter(ne=>!ne.position&&te===0||ne.position===Y).map((ne,ae)=>{var De,de;return N.createElement(B9,{key:ne.id,icons:b,index:ae,toast:ne,defaultRichColors:u,duration:(De=p==null?void 0:p.duration)!=null?De:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:e,visibleToasts:h,closeButton:(de=p==null?void 0:p.closeButton)!=null?de:o,interacting:E,position:Y,style:p==null?void 0:p.style,unstyled:p==null?void 0:p.unstyled,classNames:p==null?void 0:p.classNames,cancelButtonStyle:p==null?void 0:p.cancelButtonStyle,actionButtonStyle:p==null?void 0:p.actionButtonStyle,removeToast:W,toasts:C.filter(ye=>ye.position==ne.position),heights:j.filter(ye=>ye.position==ne.position),setHeights:P,expandByDefault:i,gap:m,loadingIcon:y,expanded:k,pauseWhenPageIsHidden:w,cn:S})}))})):null};const H9=({...t})=>{const{theme:e="system"}=v9();return a.jsx(U9,{theme:e,className:"toaster group",position:"bottom-right",visibleToasts:2,closeButton:!0,toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg group-[.toaster]:pr-8",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",closeButton:"group-[.toast]:absolute group-[.toast]:left-3 group-[.toast]:top-3 group-[.toast]:h-5 group-[.toast]:w-5 group-[.toast]:rounded-md group-[.toast]:p-1 group-[.toast]:text-foreground/70 group-[.toast]:opacity-100 group-[.toast]:transition-opacity hover:group-[.toast]:text-foreground hover:group-[.toast]:bg-muted/50 focus:group-[.toast]:opacity-100 focus:group-[.toast]:outline-none focus:group-[.toast]:ring-1 focus:group-[.toast]:ring-ring"}},...t})};function Te(t,e,{checkForDefaultPrevented:n=!0}={}){return function(i){if(t==null||t(i),n===!1||!i.defaultPrevented)return e==null?void 0:e(i)}}function z9(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function a0(...t){return e=>t.forEach(n=>z9(n,e))}function Pt(...t){return v.useCallback(a0(...t),t)}function G9(t,e){const n=v.createContext(e),r=o=>{const{children:s,...c}=o,l=v.useMemo(()=>c,Object.values(c));return a.jsx(n.Provider,{value:l,children:s})};r.displayName=t+"Provider";function i(o){const s=v.useContext(n);if(s)return s;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[r,i]}function Li(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[t])==null?void 0:b[l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})};u.displayName=o+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[t])==null?void 0:m[l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,V9(i,...e)]}function V9(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var Hs=v.forwardRef((t,e)=>{const{children:n,...r}=t,i=v.Children.toArray(n),o=i.find(K9);if(o){const s=o.props.children,c=i.map(l=>l===o?v.Children.count(s)>1?v.Children.only(null):v.isValidElement(s)?s.props.children:null:l);return a.jsx(E_,{...r,ref:e,children:v.isValidElement(s)?v.cloneElement(s,void 0,c):null})}return a.jsx(E_,{...r,ref:e,children:n})});Hs.displayName="Slot";var E_=v.forwardRef((t,e)=>{const{children:n,...r}=t;if(v.isValidElement(n)){const i=q9(n);return v.cloneElement(n,{...W9(r,n.props),ref:e?a0(e,i):i})}return v.Children.count(n)>1?v.Children.only(null):null});E_.displayName="SlotClone";var dE=({children:t})=>a.jsx(a.Fragment,{children:t});function K9(t){return v.isValidElement(t)&&t.type===dE}function W9(t,e){const n={...e};for(const r in e){const i=t[r],o=e[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...c)=>{o(...c),i(...c)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...t,...n}}function q9(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Y9=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],it=Y9.reduce((t,e)=>{const n=v.forwardRef((r,i)=>{const{asChild:o,...s}=r,c=o?Hs:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${e}`,{...t,[e]:n}},{});function u4(t,e){t&&If.flushSync(()=>t.dispatchEvent(e))}function Cr(t){const e=v.useRef(t);return v.useEffect(()=>{e.current=t}),v.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function Q9(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t);v.useEffect(()=>{const r=i=>{i.key==="Escape"&&n(i)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var X9="DismissableLayer",T_="dismissableLayer.update",J9="dismissableLayer.pointerDownOutside",Z9="dismissableLayer.focusOutside",bO,d4=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fg=v.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=t,u=v.useContext(d4),[d,f]=v.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=Pt(e,A=>f(A)),m=Array.from(u.layers),[y]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(y),x=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,S=x>=b,C=nY(A=>{const j=A.target,P=[...u.branches].some(k=>k.contains(j));!S||P||(i==null||i(A),s==null||s(A),A.defaultPrevented||c==null||c())},h),_=rY(A=>{const j=A.target;[...u.branches].some(k=>k.contains(j))||(o==null||o(A),s==null||s(A),A.defaultPrevented||c==null||c())},h);return Q9(A=>{x===u.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&c&&(A.preventDefault(),c()))},h),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(bO=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),wO(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=bO)}},[d,h,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),wO())},[d,u]),v.useEffect(()=>{const A=()=>p({});return document.addEventListener(T_,A),()=>document.removeEventListener(T_,A)},[]),a.jsx(it.div,{...l,ref:g,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Te(t.onFocusCapture,_.onFocusCapture),onBlurCapture:Te(t.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Te(t.onPointerDownCapture,C.onPointerDownCapture)})});fg.displayName=X9;var eY="DismissableLayerBranch",tY=v.forwardRef((t,e)=>{const n=v.useContext(d4),r=v.useRef(null),i=Pt(e,r);return v.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(it.div,{...t,ref:i})});tY.displayName=eY;function nY(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t),r=v.useRef(!1),i=v.useRef(()=>{});return v.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let l=function(){f4(J9,n,u,{discrete:!0})};const u={originalEvent:c};c.pointerType==="touch"?(e.removeEventListener("click",i.current),i.current=l,e.addEventListener("click",i.current,{once:!0})):l()}else e.removeEventListener("click",i.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",o),e.removeEventListener("click",i.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function rY(t,e=globalThis==null?void 0:globalThis.document){const n=Cr(t),r=v.useRef(!1);return v.useEffect(()=>{const i=o=>{o.target&&!r.current&&f4(Z9,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",i),()=>e.removeEventListener("focusin",i)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function wO(){const t=new CustomEvent(T_);document.dispatchEvent(t)}function f4(t,e,n,{discrete:r}){const i=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&i.addEventListener(t,e,{once:!0}),r?u4(i,o):i.dispatchEvent(o)}var Kr=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},iY=oL.useId||(()=>{}),oY=0;function Xo(t){const[e,n]=v.useState(iY());return Kr(()=>{n(r=>r??String(oY++))},[t]),e?`radix-${e}`:""}const sY=["top","right","bottom","left"],Wc=Math.min,qi=Math.max,Ly=Math.round,ov=Math.floor,qc=t=>({x:t,y:t}),aY={left:"right",right:"left",bottom:"top",top:"bottom"},cY={start:"end",end:"start"};function N_(t,e,n){return qi(t,Wc(e,n))}function Ia(t,e){return typeof t=="function"?t(e):t}function Ra(t){return t.split("-")[0]}function Rf(t){return t.split("-")[1]}function fE(t){return t==="x"?"y":"x"}function hE(t){return t==="y"?"height":"width"}function Yc(t){return["top","bottom"].includes(Ra(t))?"y":"x"}function pE(t){return fE(Yc(t))}function lY(t,e,n){n===void 0&&(n=!1);const r=Rf(t),i=pE(t),o=hE(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Fy(s)),[s,Fy(s)]}function uY(t){const e=Fy(t);return[P_(t),e,P_(e)]}function P_(t){return t.replace(/start|end/g,e=>cY[e])}function dY(t,e,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?o:s;default:return[]}}function fY(t,e,n,r){const i=Rf(t);let o=dY(Ra(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(P_)))),o}function Fy(t){return t.replace(/left|right|bottom|top/g,e=>aY[e])}function hY(t){return{top:0,right:0,bottom:0,left:0,...t}}function h4(t){return typeof t!="number"?hY(t):{top:t,right:t,bottom:t,left:t}}function By(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function SO(t,e,n){let{reference:r,floating:i}=t;const o=Yc(e),s=pE(e),c=hE(s),l=Ra(e),u=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,h=r[c]/2-i[c]/2;let p;switch(l){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Rf(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const pY=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,c=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:d,y:f}=SO(u,r,l),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:o,platform:s,elements:c,middlewareData:l}=e,{element:u,padding:d=0}=Ia(t,e)||{};if(u==null)return{};const f=h4(d),h={x:n,y:r},p=pE(i),g=hE(p),m=await s.getDimensions(u),y=p==="y",b=y?"top":"left",x=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=o.reference[g]+o.reference[p]-h[p]-o.floating[g],C=h[p]-o.reference[p],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let A=_?_[w]:0;(!A||!await(s.isElement==null?void 0:s.isElement(_)))&&(A=c.floating[w]||o.floating[g]);const j=S/2-C/2,P=A/2-m[g]/2-1,k=Wc(f[b],P),O=Wc(f[x],P),E=k,I=A-m[g]-O,D=A/2-m[g]/2+j,z=N_(E,D,I),$=!l.arrow&&Rf(i)!=null&&D!==z&&o.reference[g]/2-(DD<=0)){var O,E;const D=(((O=o.flip)==null?void 0:O.index)||0)+1,z=A[D];if(z)return{data:{index:D,overflows:k},reset:{placement:z}};let $=(E=k.filter(G=>G.overflows[0]<=0).sort((G,R)=>G.overflows[1]-R.overflows[1])[0])==null?void 0:E.placement;if(!$)switch(p){case"bestFit":{var I;const G=(I=k.filter(R=>{if(_){const L=Yc(R.placement);return L===x||L==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(L=>L>0).reduce((L,W)=>L+W,0)]).sort((R,L)=>R[1]-L[1])[0])==null?void 0:I[0];G&&($=G);break}case"initialPlacement":$=c;break}if(i!==$)return{reset:{placement:$}}}return{}}}};function CO(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function _O(t){return sY.some(e=>t[e]>=0)}const vY=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=Ia(t,e);switch(r){case"referenceHidden":{const o=await Bp(e,{...i,elementContext:"reference"}),s=CO(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:_O(s)}}}case"escaped":{const o=await Bp(e,{...i,altBoundary:!0}),s=CO(o,n.floating);return{data:{escapedOffsets:s,escaped:_O(s)}}}default:return{}}}}};async function yY(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Ra(n),c=Rf(n),l=Yc(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,f=Ia(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof g=="number"&&(p=c==="end"?g*-1:g),l?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const xY=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:o,placement:s,middlewareData:c}=e,l=await yY(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},bY=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:y=>{let{x:b,y:x}=y;return{x:b,y:x}}},...l}=Ia(t,e),u={x:n,y:r},d=await Bp(e,l),f=Yc(Ra(i)),h=fE(f);let p=u[h],g=u[f];if(o){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=p+d[y],w=p-d[b];p=N_(x,p,w)}if(s){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=g+d[y],w=g-d[b];g=N_(x,g,w)}const m=c.fn({...e,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[f]:s}}}}}},wY=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:o,middlewareData:s}=e,{offset:c=0,mainAxis:l=!0,crossAxis:u=!0}=Ia(t,e),d={x:n,y:r},f=Yc(i),h=fE(f);let p=d[h],g=d[f];const m=Ia(c,e),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const w=h==="y"?"height":"width",S=o.reference[h]-o.floating[w]+y.mainAxis,C=o.reference[h]+o.reference[w]-y.mainAxis;pC&&(p=C)}if(u){var b,x;const w=h==="y"?"width":"height",S=["top","left"].includes(Ra(i)),C=o.reference[f]-o.floating[w]+(S&&((b=s.offset)==null?void 0:b[f])||0)+(S?0:y.crossAxis),_=o.reference[f]+o.reference[w]+(S?0:((x=s.offset)==null?void 0:x[f])||0)-(S?y.crossAxis:0);g_&&(g=_)}return{[h]:p,[f]:g}}}},SY=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:o,platform:s,elements:c}=e,{apply:l=()=>{},...u}=Ia(t,e),d=await Bp(e,u),f=Ra(i),h=Rf(i),p=Yc(i)==="y",{width:g,height:m}=o.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=h===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(b=f,y=h==="end"?"top":"bottom");const x=m-d.top-d.bottom,w=g-d.left-d.right,S=Wc(m-d[y],x),C=Wc(g-d[b],w),_=!e.middlewareData.shift;let A=S,j=C;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(j=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(A=x),_&&!h){const k=qi(d.left,0),O=qi(d.right,0),E=qi(d.top,0),I=qi(d.bottom,0);p?j=g-2*(k!==0||O!==0?k+O:qi(d.left,d.right)):A=m-2*(E!==0||I!==0?E+I:qi(d.top,d.bottom))}await l({...e,availableWidth:j,availableHeight:A});const P=await s.getDimensions(c.floating);return g!==P.width||m!==P.height?{reset:{rects:!0}}:{}}}};function c0(){return typeof window<"u"}function Mf(t){return p4(t)?(t.nodeName||"").toLowerCase():"#document"}function Ji(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Qs(t){var e;return(e=(p4(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function p4(t){return c0()?t instanceof Node||t instanceof Ji(t).Node:!1}function os(t){return c0()?t instanceof Element||t instanceof Ji(t).Element:!1}function zs(t){return c0()?t instanceof HTMLElement||t instanceof Ji(t).HTMLElement:!1}function AO(t){return!c0()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Ji(t).ShadowRoot}function hg(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ss(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function CY(t){return["table","td","th"].includes(Mf(t))}function l0(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function mE(t){const e=gE(),n=os(t)?ss(t):t;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function _Y(t){let e=Qc(t);for(;zs(e)&&!Yd(e);){if(mE(e))return e;if(l0(e))return null;e=Qc(e)}return null}function gE(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Yd(t){return["html","body","#document"].includes(Mf(t))}function ss(t){return Ji(t).getComputedStyle(t)}function u0(t){return os(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Qc(t){if(Mf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||AO(t)&&t.host||Qs(t);return AO(e)?e.host:e}function m4(t){const e=Qc(t);return Yd(e)?t.ownerDocument?t.ownerDocument.body:t.body:zs(e)&&hg(e)?e:m4(e)}function Up(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=m4(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=Ji(i);if(o){const c=k_(s);return e.concat(s,s.visualViewport||[],hg(i)?i:[],c&&n?Up(c):[])}return e.concat(i,Up(i,[],n))}function k_(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function g4(t){const e=ss(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=zs(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,c=Ly(n)!==o||Ly(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function vE(t){return os(t)?t:t.contextElement}function xd(t){const e=vE(t);if(!zs(e))return qc(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=g4(e);let s=(o?Ly(n.width):n.width)/r,c=(o?Ly(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const AY=qc(0);function v4(t){const e=Ji(t);return!gE()||!e.visualViewport?AY:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function jY(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Ji(t)?!1:e}function su(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=vE(t);let s=qc(1);e&&(r?os(r)&&(s=xd(r)):s=xd(t));const c=jY(o,n,r)?v4(o):qc(0);let l=(i.left+c.x)/s.x,u=(i.top+c.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const h=Ji(o),p=r&&os(r)?Ji(r):r;let g=h,m=k_(g);for(;m&&r&&p!==g;){const y=xd(m),b=m.getBoundingClientRect(),x=ss(m),w=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*y.x,S=b.top+(m.clientTop+parseFloat(x.paddingTop))*y.y;l*=y.x,u*=y.y,d*=y.x,f*=y.y,l+=w,u+=S,g=Ji(m),m=k_(g)}}return By({width:d,height:f,x:l,y:u})}function EY(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=Qs(r),c=e?l0(e.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=qc(1);const d=qc(0),f=zs(r);if((f||!f&&!o)&&((Mf(r)!=="body"||hg(s))&&(l=u0(r)),zs(r))){const h=su(r);u=xd(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function TY(t){return Array.from(t.getClientRects())}function O_(t,e){const n=u0(t).scrollLeft;return e?e.left+n:su(Qs(t)).left+n}function NY(t){const e=Qs(t),n=u0(t),r=t.ownerDocument.body,i=qi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=qi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+O_(t);const c=-n.scrollTop;return ss(r).direction==="rtl"&&(s+=qi(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:c}}function PY(t,e){const n=Ji(t),r=Qs(t),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,c=0,l=0;if(i){o=i.width,s=i.height;const u=gE();(!u||u&&e==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:c,y:l}}function kY(t,e){const n=su(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=zs(t)?xd(t):qc(1),s=t.clientWidth*o.x,c=t.clientHeight*o.y,l=i*o.x,u=r*o.y;return{width:s,height:c,x:l,y:u}}function jO(t,e,n){let r;if(e==="viewport")r=PY(t,n);else if(e==="document")r=NY(Qs(t));else if(os(e))r=kY(e,n);else{const i=v4(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return By(r)}function y4(t,e){const n=Qc(t);return n===e||!os(n)||Yd(n)?!1:ss(n).position==="fixed"||y4(n,e)}function OY(t,e){const n=e.get(t);if(n)return n;let r=Up(t,[],!1).filter(c=>os(c)&&Mf(c)!=="body"),i=null;const o=ss(t).position==="fixed";let s=o?Qc(t):t;for(;os(s)&&!Yd(s);){const c=ss(s),l=mE(s);!l&&c.position==="fixed"&&(i=null),(o?!l&&!i:!l&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||hg(s)&&!l&&y4(t,s))?r=r.filter(d=>d!==s):i=c,s=Qc(s)}return e.set(t,r),r}function IY(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?l0(e)?[]:OY(e,this._c):[].concat(n),r],c=s[0],l=s.reduce((u,d)=>{const f=jO(e,d,i);return u.top=qi(f.top,u.top),u.right=Wc(f.right,u.right),u.bottom=Wc(f.bottom,u.bottom),u.left=qi(f.left,u.left),u},jO(e,c,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function RY(t){const{width:e,height:n}=g4(t);return{width:e,height:n}}function MY(t,e,n){const r=zs(e),i=Qs(e),o=n==="fixed",s=su(t,!0,o,e);let c={scrollLeft:0,scrollTop:0};const l=qc(0);if(r||!r&&!o)if((Mf(e)!=="body"||hg(i))&&(c=u0(e)),r){const p=su(e,!0,o,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else i&&(l.x=O_(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+c.scrollTop,u=p.left+c.scrollLeft-O_(i,p)}const f=s.left+c.scrollLeft-l.x-u,h=s.top+c.scrollTop-l.y-d;return{x:f,y:h,width:s.width,height:s.height}}function TS(t){return ss(t).position==="static"}function EO(t,e){if(!zs(t)||ss(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Qs(t)===n&&(n=n.ownerDocument.body),n}function x4(t,e){const n=Ji(t);if(l0(t))return n;if(!zs(t)){let i=Qc(t);for(;i&&!Yd(i);){if(os(i)&&!TS(i))return i;i=Qc(i)}return n}let r=EO(t,e);for(;r&&CY(r)&&TS(r);)r=EO(r,e);return r&&Yd(r)&&TS(r)&&!mE(r)?n:r||_Y(t)||n}const DY=async function(t){const e=this.getOffsetParent||x4,n=this.getDimensions,r=await n(t.floating);return{reference:MY(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function $Y(t){return ss(t).direction==="rtl"}const LY={convertOffsetParentRelativeRectToViewportRelativeRect:EY,getDocumentElement:Qs,getClippingRect:IY,getOffsetParent:x4,getElementRects:DY,getClientRects:TY,getDimensions:RY,getScale:xd,isElement:os,isRTL:$Y};function FY(t,e){let n=null,r;const i=Qs(t);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),o();const{left:u,top:d,width:f,height:h}=t.getBoundingClientRect();if(c||e(),!f||!h)return;const p=ov(d),g=ov(i.clientWidth-(u+f)),m=ov(i.clientHeight-(d+h)),y=ov(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-y+"px",threshold:qi(0,Wc(1,l))||1};let w=!0;function S(C){const _=C[0].intersectionRatio;if(_!==l){if(!w)return s();_?s(!1,_):r=setTimeout(()=>{s(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(S,{...x,root:i.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(t)}return s(!0),o}function BY(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=vE(t),d=i||o?[...u?Up(u):[],...Up(e)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const f=u&&c?FY(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&p&&(p.unobserve(e),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(e)})),n()}),u&&!l&&p.observe(u),p.observe(e));let g,m=l?su(t):null;l&&y();function y(){const b=su(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(x=>{i&&x.removeEventListener("scroll",n),o&&x.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,l&&cancelAnimationFrame(g)}}const UY=xY,HY=bY,zY=gY,GY=SY,VY=vY,TO=mY,KY=wY,WY=(t,e,n)=>{const r=new Map,i={platform:LY,...n},o={...i.platform,_c:r};return pY(t,e,{...i,platform:o})};var qv=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Uy(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Uy(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const o=i[r];if(!(o==="_owner"&&t.$$typeof)&&!Uy(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function b4(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function NO(t,e){const n=b4(t);return Math.round(e*n)/n}function NS(t){const e=v.useRef(t);return qv(()=>{e.current=t}),e}function qY(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:s}={},transform:c=!0,whileElementsMounted:l,open:u}=t,[d,f]=v.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=v.useState(r);Uy(h,r)||p(r);const[g,m]=v.useState(null),[y,b]=v.useState(null),x=v.useCallback(R=>{R!==_.current&&(_.current=R,m(R))},[]),w=v.useCallback(R=>{R!==A.current&&(A.current=R,b(R))},[]),S=o||g,C=s||y,_=v.useRef(null),A=v.useRef(null),j=v.useRef(d),P=l!=null,k=NS(l),O=NS(i),E=NS(u),I=v.useCallback(()=>{if(!_.current||!A.current)return;const R={placement:e,strategy:n,middleware:h};O.current&&(R.platform=O.current),WY(_.current,A.current,R).then(L=>{const W={...L,isPositioned:E.current!==!1};D.current&&!Uy(j.current,W)&&(j.current=W,If.flushSync(()=>{f(W)}))})},[h,e,n,O,E]);qv(()=>{u===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const D=v.useRef(!1);qv(()=>(D.current=!0,()=>{D.current=!1}),[]),qv(()=>{if(S&&(_.current=S),C&&(A.current=C),S&&C){if(k.current)return k.current(S,C,I);I()}},[S,C,I,k,P]);const z=v.useMemo(()=>({reference:_,floating:A,setReference:x,setFloating:w}),[x,w]),$=v.useMemo(()=>({reference:S,floating:C}),[S,C]),G=v.useMemo(()=>{const R={position:n,left:0,top:0};if(!$.floating)return R;const L=NO($.floating,d.x),W=NO($.floating,d.y);return c?{...R,transform:"translate("+L+"px, "+W+"px)",...b4($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:W}},[n,c,$.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:I,refs:z,elements:$,floatingStyles:G}),[d,I,z,$,G])}const YY=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:i}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?TO({element:r.current,padding:i}).fn(n):{}:r?TO({element:r,padding:i}).fn(n):{}}}},QY=(t,e)=>({...UY(t),options:[t,e]}),XY=(t,e)=>({...HY(t),options:[t,e]}),JY=(t,e)=>({...KY(t),options:[t,e]}),ZY=(t,e)=>({...zY(t),options:[t,e]}),eQ=(t,e)=>({...GY(t),options:[t,e]}),tQ=(t,e)=>({...VY(t),options:[t,e]}),nQ=(t,e)=>({...YY(t),options:[t,e]});var rQ="Arrow",w4=v.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...o}=t;return a.jsx(it.svg,{...o,ref:e,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});w4.displayName=rQ;var iQ=w4;function oQ(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,sQ(i,...e)]}function sQ(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function pg(t){const[e,n]=v.useState(void 0);return Kr(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,c;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,c=u.blockSize}else s=t.offsetWidth,c=t.offsetHeight;n({width:s,height:c})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var yE="Popper",[S4,Df]=oQ(yE),[aQ,C4]=S4(yE),_4=t=>{const{__scopePopper:e,children:n}=t,[r,i]=v.useState(null);return a.jsx(aQ,{scope:e,anchor:r,onAnchorChange:i,children:n})};_4.displayName=yE;var A4="PopperAnchor",j4=v.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=C4(A4,n),s=v.useRef(null),c=Pt(e,s);return v.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:a.jsx(it.div,{...i,ref:c})});j4.displayName=A4;var xE="PopperContent",[cQ,lQ]=S4(xE),E4=v.forwardRef((t,e)=>{var ae,De,de,ye,Ee,Z;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:o="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=t,y=C4(xE,n),[b,x]=v.useState(null),w=Pt(e,ct=>x(ct)),[S,C]=v.useState(null),_=pg(S),A=(_==null?void 0:_.width)??0,j=(_==null?void 0:_.height)??0,P=r+(o!=="center"?"-"+o:""),k=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],E=O.length>0,I={padding:k,boundary:O.filter(dQ),altBoundary:E},{refs:D,floatingStyles:z,placement:$,isPositioned:G,middlewareData:R}=qY({strategy:"fixed",placement:P,whileElementsMounted:(...ct)=>BY(...ct,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[QY({mainAxis:i+j,alignmentAxis:s}),l&&XY({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?JY():void 0,...I}),l&&ZY({...I}),eQ({...I,apply:({elements:ct,rects:Le,availableWidth:At,availableHeight:lt})=>{const{width:Jt,height:T}=Le.reference,M=ct.floating.style;M.setProperty("--radix-popper-available-width",`${At}px`),M.setProperty("--radix-popper-available-height",`${lt}px`),M.setProperty("--radix-popper-anchor-width",`${Jt}px`),M.setProperty("--radix-popper-anchor-height",`${T}px`)}}),S&&nQ({element:S,padding:c}),fQ({arrowWidth:A,arrowHeight:j}),h&&tQ({strategy:"referenceHidden",...I})]}),[L,W]=P4($),Y=Cr(g);Kr(()=>{G&&(Y==null||Y())},[G,Y]);const te=(ae=R.arrow)==null?void 0:ae.x,me=(De=R.arrow)==null?void 0:De.y,F=((de=R.arrow)==null?void 0:de.centerOffset)!==0,[se,ne]=v.useState();return Kr(()=>{b&&ne(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:G?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:se,"--radix-popper-transform-origin":[(ye=R.transformOrigin)==null?void 0:ye.x,(Ee=R.transformOrigin)==null?void 0:Ee.y].join(" "),...((Z=R.hide)==null?void 0:Z.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(cQ,{scope:n,placedSide:L,onArrowChange:C,arrowX:te,arrowY:me,shouldHideArrow:F,children:a.jsx(it.div,{"data-side":L,"data-align":W,...m,ref:w,style:{...m.style,animation:G?void 0:"none"}})})})});E4.displayName=xE;var T4="PopperArrow",uQ={top:"bottom",right:"left",bottom:"top",left:"right"},N4=v.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=lQ(T4,r),s=uQ[o.placedSide];return a.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:a.jsx(iQ,{...i,ref:n,style:{...i.style,display:"block"}})})});N4.displayName=T4;function dQ(t){return t!==null}var fQ=t=>({name:"transformOrigin",options:t,fn(e){var y,b,x;const{placement:n,rects:r,middlewareData:i}=e,s=((y=i.arrow)==null?void 0:y.centerOffset)!==0,c=s?0:t.arrowWidth,l=s?0:t.arrowHeight,[u,d]=P4(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=i.arrow)==null?void 0:b.x)??0)+c/2,p=(((x=i.arrow)==null?void 0:x.y)??0)+l/2;let g="",m="";return u==="bottom"?(g=s?f:`${h}px`,m=`${-l}px`):u==="top"?(g=s?f:`${h}px`,m=`${r.floating.height+l}px`):u==="right"?(g=`${-l}px`,m=s?f:`${p}px`):u==="left"&&(g=`${r.floating.width+l}px`,m=s?f:`${p}px`),{data:{x:g,y:m}}}});function P4(t){const[e,n="center"]=t.split("-");return[e,n]}var k4=_4,bE=j4,wE=E4,SE=N4,hQ="Portal",d0=v.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,o]=v.useState(!1);Kr(()=>o(!0),[]);const s=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return s?c4.createPortal(a.jsx(it.div,{...r,ref:e}),s):null});d0.displayName=hQ;function pQ(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var Wr=t=>{const{present:e,children:n}=t,r=mQ(e),i=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),o=Pt(r.ref,gQ(i));return typeof n=="function"||r.isPresent?v.cloneElement(i,{ref:o}):null};Wr.displayName="Presence";function mQ(t){const[e,n]=v.useState(),r=v.useRef({}),i=v.useRef(t),o=v.useRef("none"),s=t?"mounted":"unmounted",[c,l]=pQ(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=sv(r.current);o.current=c==="mounted"?u:"none"},[c]),Kr(()=>{const u=r.current,d=i.current;if(d!==t){const h=o.current,p=sv(u);t?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=t}},[t,l]),Kr(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=p=>{const m=sv(r.current).includes(p.animationName);if(p.target===e&&m&&(l("ANIMATION_END"),!i.current)){const y=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=y)})}},h=p=>{p.target===e&&(o.current=sv(r.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function sv(t){return(t==null?void 0:t.animationName)||"none"}function gQ(t){var r,i;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(i=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:i.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function as({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=vQ({defaultProp:e,onChange:n}),o=t!==void 0,s=o?t:r,c=Cr(n),l=v.useCallback(u=>{if(o){const f=typeof u=="function"?u(t):u;f!==t&&c(f)}else i(u)},[o,t,i,c]);return[s,l]}function vQ({defaultProp:t,onChange:e}){const n=v.useState(t),[r]=n,i=v.useRef(r),o=Cr(e);return v.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var yQ="VisuallyHidden",CE=v.forwardRef((t,e)=>a.jsx(it.span,{...t,ref:e,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...t.style}}));CE.displayName=yQ;var xQ=CE,[f0,iFe]=Li("Tooltip",[Df]),_E=Df(),O4="TooltipProvider",bQ=700,PO="tooltip.open",[wQ,I4]=f0(O4),R4=t=>{const{__scopeTooltip:e,delayDuration:n=bQ,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,[s,c]=v.useState(!0),l=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(wQ,{scope:e,isOpenDelayed:s,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),c(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>c(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:v.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:o})};R4.displayName=O4;var M4="Tooltip",[oFe,h0]=f0(M4),I_="TooltipTrigger",SQ=v.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=h0(I_,n),o=I4(I_,n),s=_E(n),c=v.useRef(null),l=Pt(e,c,i.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(bE,{asChild:!0,...s,children:a.jsx(it.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Te(t.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Te(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Te(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Te(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:Te(t.onBlur,i.onClose),onClick:Te(t.onClick,i.onClose)})})});SQ.displayName=I_;var CQ="TooltipPortal",[sFe,_Q]=f0(CQ,{forceMount:void 0}),Qd="TooltipContent",D4=v.forwardRef((t,e)=>{const n=_Q(Qd,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,s=h0(Qd,t.__scopeTooltip);return a.jsx(Wr,{present:r||s.open,children:s.disableHoverableContent?a.jsx($4,{side:i,...o,ref:e}):a.jsx(AQ,{side:i,...o,ref:e})})}),AQ=v.forwardRef((t,e)=>{const n=h0(Qd,t.__scopeTooltip),r=I4(Qd,t.__scopeTooltip),i=v.useRef(null),o=Pt(e,i),[s,c]=v.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{c(null),f(!1)},[f]),p=v.useCallback((g,m)=>{const y=g.currentTarget,b={x:g.clientX,y:g.clientY},x=NQ(b,y.getBoundingClientRect()),w=PQ(b,x),S=kQ(m.getBoundingClientRect()),C=IQ([...w,...S]);c(C),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(l&&d){const g=y=>p(y,d),m=y=>p(y,l);return l.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[l,d,p,h]),v.useEffect(()=>{if(s){const g=m=>{const y=m.target,b={x:m.clientX,y:m.clientY},x=(l==null?void 0:l.contains(y))||(d==null?void 0:d.contains(y)),w=!OQ(b,s);x?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[l,d,s,u,h]),a.jsx($4,{...t,ref:o})}),[jQ,EQ]=f0(M4,{isInside:!1}),$4=v.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=t,l=h0(Qd,n),u=_E(n),{onClose:d}=l;return v.useEffect(()=>(document.addEventListener(PO,d),()=>document.removeEventListener(PO,d)),[d]),v.useEffect(()=>{if(l.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(l.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[l.trigger,d]),a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(wE,{"data-state":l.stateAttribute,...u,...c,ref:e,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(dE,{children:r}),a.jsx(jQ,{scope:n,isInside:!0,children:a.jsx(xQ,{id:l.contentId,role:"tooltip",children:i||r})})]})})});D4.displayName=Qd;var L4="TooltipArrow",TQ=v.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=_E(n);return EQ(L4,n).isInside?null:a.jsx(SE,{...i,...r,ref:e})});TQ.displayName=L4;function NQ(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),o=Math.abs(e.left-t.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function PQ(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function kQ(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function OQ(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function IQ(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),RQ(e)}function RQ(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const o=e[e.length-1],s=e[e.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const o=n[n.length-1],s=n[n.length-2];if((o.x-s.x)*(i.y-s.y)>=(o.y-s.y)*(i.x-s.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var MQ=R4,F4=D4;function B4(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var i=t.length;for(e=0;e{const e=LQ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const c=s.split(AE);return c[0]===""&&c.length!==1&&c.shift(),U4(c,e)||$Q(s)},getConflictingClassGroupIds:(s,c)=>{const l=n[s]||[];return c&&r[s]?[...l,...r[s]]:l}}},U4=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?U4(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(AE);return(s=e.validators.find(({validator:c})=>c(o)))==null?void 0:s.classGroupId},kO=/^\[(.+)\]$/,$Q=t=>{if(kO.test(t)){const e=kO.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},LQ=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return BQ(Object.entries(t.classGroups),n).forEach(([o,s])=>{R_(s,r,o,e)}),r},R_=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:OO(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(FQ(i)){R_(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{R_(s,OO(e,o),n,r)})})},OO=(t,e)=>{let n=t;return e.split(AE).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},FQ=t=>t.isThemeGetter,BQ=(t,e)=>e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,c])=>[e+s,c])):o);return[n,i]}):t,UQ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const i=(o,s)=>{n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}},H4="!",HQ=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,i=e[0],o=e.length,s=c=>{const l=[];let u=0,d=0,f;for(let y=0;yd?f-d:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?c=>n({className:c,parseClassName:s}):s},zQ=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},GQ=t=>({cache:UQ(t.cacheSize),parseClassName:HQ(t),...DQ(t)}),VQ=/\s+/,KQ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=t.trim().split(VQ);let c="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){c=u+(c.length>0?" "+c:c);continue}if(m=r(h),!m){c=u+(c.length>0?" "+c:c);continue}g=!1}const y=zQ(d).join(":"),b=f?y+H4:y,x=b+m;if(o.includes(x))continue;o.push(x);const w=i(m,g);for(let S=0;S0?" "+c:c)}return c};function WQ(){let t=0,e,n,r="";for(;t{if(typeof t=="string")return t;let e,n="";for(let r=0;rf(d),t());return n=GQ(u),r=n.cache.get,i=n.cache.set,o=c,c(l)}function c(l){const u=r(l);if(u)return u;const d=KQ(l,n);return i(l,d),d}return function(){return o(WQ.apply(null,arguments))}}const In=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},G4=/^\[(?:([a-z-]+):)?(.+)\]$/i,YQ=/^\d+\/\d+$/,QQ=new Set(["px","full","screen"]),XQ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JQ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ZQ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,eX=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tX=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ra=t=>bd(t)||QQ.has(t)||YQ.test(t),Xa=t=>$f(t,"length",lX),bd=t=>!!t&&!Number.isNaN(Number(t)),PS=t=>$f(t,"number",bd),Sh=t=>!!t&&Number.isInteger(Number(t)),nX=t=>t.endsWith("%")&&bd(t.slice(0,-1)),Ft=t=>G4.test(t),Ja=t=>XQ.test(t),rX=new Set(["length","size","percentage"]),iX=t=>$f(t,rX,V4),oX=t=>$f(t,"position",V4),sX=new Set(["image","url"]),aX=t=>$f(t,sX,dX),cX=t=>$f(t,"",uX),Ch=()=>!0,$f=(t,e,n)=>{const r=G4.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},lX=t=>JQ.test(t)&&!ZQ.test(t),V4=()=>!1,uX=t=>eX.test(t),dX=t=>tX.test(t),fX=()=>{const t=In("colors"),e=In("spacing"),n=In("blur"),r=In("brightness"),i=In("borderColor"),o=In("borderRadius"),s=In("borderSpacing"),c=In("borderWidth"),l=In("contrast"),u=In("grayscale"),d=In("hueRotate"),f=In("invert"),h=In("gap"),p=In("gradientColorStops"),g=In("gradientColorStopPositions"),m=In("inset"),y=In("margin"),b=In("opacity"),x=In("padding"),w=In("saturate"),S=In("scale"),C=In("sepia"),_=In("skew"),A=In("space"),j=In("translate"),P=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",Ft,e],E=()=>[Ft,e],I=()=>["",ra,Xa],D=()=>["auto",bd,Ft],z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],G=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],R=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",Ft],W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Y=()=>[bd,Ft];return{cacheSize:500,separator:":",theme:{colors:[Ch],spacing:[ra,Xa],blur:["none","",Ja,Ft],brightness:Y(),borderColor:[t],borderRadius:["none","","full",Ja,Ft],borderSpacing:E(),borderWidth:I(),contrast:Y(),grayscale:L(),hueRotate:Y(),invert:L(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[nX,Xa],inset:O(),margin:O(),opacity:Y(),padding:E(),saturate:Y(),scale:Y(),sepia:L(),skew:Y(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",Ft]}],container:["container"],columns:[{columns:[Ja]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...z(),Ft]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[m]}],"inset-x":[{"inset-x":[m]}],"inset-y":[{"inset-y":[m]}],start:[{start:[m]}],end:[{end:[m]}],top:[{top:[m]}],right:[{right:[m]}],bottom:[{bottom:[m]}],left:[{left:[m]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Sh,Ft]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Ft]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",Sh,Ft]}],"grid-cols":[{"grid-cols":[Ch]}],"col-start-end":[{col:["auto",{span:["full",Sh,Ft]},Ft]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Ch]}],"row-start-end":[{row:["auto",{span:[Sh,Ft]},Ft]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Ft]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ft]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...R()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...R(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...R(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Ft,e]}],"min-w":[{"min-w":[Ft,e,"min","max","fit"]}],"max-w":[{"max-w":[Ft,e,"none","full","min","max","fit","prose",{screen:[Ja]},Ja]}],h:[{h:[Ft,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ft,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ft,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ft,e,"auto","min","max","fit"]}],"font-size":[{text:["base",Ja,Xa]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",PS]}],"font-family":[{font:[Ch]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Ft]}],"line-clamp":[{"line-clamp":["none",bd,PS]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ra,Ft]}],"list-image":[{"list-image":["none",Ft]}],"list-style-type":[{list:["none","disc","decimal",Ft]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ra,Xa]}],"underline-offset":[{"underline-offset":["auto",ra,Ft]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ft]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ft]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...z(),oX]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",iX]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},aX]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:$()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...$()]}],"outline-offset":[{"outline-offset":[ra,Ft]}],"outline-w":[{outline:[ra,Xa]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:I()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ra,Xa]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Ja,cX]}],"shadow-color":[{shadow:[Ch]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...G(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":G()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",Ja,Ft]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Ft]}],duration:[{duration:Y()}],ease:[{ease:["linear","in","out","in-out",Ft]}],delay:[{delay:Y()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ft]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Sh,Ft]}],"translate-x":[{"translate-x":[j]}],"translate-y":[{"translate-y":[j]}],"skew-x":[{"skew-x":[_]}],"skew-y":[{"skew-y":[_]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Ft]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ft]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ft]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ra,Xa,PS]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},hX=qQ(fX);function Ne(...t){return hX(Mt(t))}const pX=MQ,mX=v.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(F4,{ref:r,sideOffset:e,className:Ne("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));mX.displayName=F4.displayName;var p0=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},m0=typeof window>"u"||"Deno"in globalThis;function Lo(){}function gX(t,e){return typeof t=="function"?t(e):t}function vX(t){return typeof t=="number"&&t>=0&&t!==1/0}function yX(t,e){return Math.max(t+(e||0)-Date.now(),0)}function IO(t,e){return typeof t=="function"?t(e):t}function xX(t,e){return typeof t=="function"?t(e):t}function RO(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:c}=t;if(s){if(r){if(e.queryHash!==jE(s,e.options))return!1}else if(!zp(e.queryKey,s))return!1}if(n!=="all"){const l=e.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||i&&i!==e.state.fetchStatus||o&&!o(e))}function MO(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(Hp(e.options.mutationKey)!==Hp(o))return!1}else if(!zp(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function jE(t,e){return((e==null?void 0:e.queryKeyHashFn)||Hp)(t)}function Hp(t){return JSON.stringify(t,(e,n)=>M_(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function zp(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!zp(t[n],e[n])):!1}function K4(t,e){if(t===e)return t;const n=DO(t)&&DO(e);if(n||M_(t)&&M_(e)){const r=n?t:Object.keys(t),i=r.length,o=n?e:Object.keys(e),s=o.length,c=n?[]:{};let l=0;for(let u=0;u{setTimeout(e,t)})}function wX(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?K4(t,e):e}function SX(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function CX(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var EE=Symbol();function W4(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===EE?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Hl,hc,Id,U$,_X=(U$=class extends p0{constructor(){super();pn(this,Hl);pn(this,hc);pn(this,Id);Vt(this,Id,e=>{if(!m0&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){ve(this,hc)||this.setEventListener(ve(this,Id))}onUnsubscribe(){var e;this.hasListeners()||((e=ve(this,hc))==null||e.call(this),Vt(this,hc,void 0))}setEventListener(e){var n;Vt(this,Id,e),(n=ve(this,hc))==null||n.call(this),Vt(this,hc,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){ve(this,Hl)!==e&&(Vt(this,Hl,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof ve(this,Hl)=="boolean"?ve(this,Hl):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Hl=new WeakMap,hc=new WeakMap,Id=new WeakMap,U$),q4=new _X,Rd,pc,Md,H$,AX=(H$=class extends p0{constructor(){super();pn(this,Rd,!0);pn(this,pc);pn(this,Md);Vt(this,Md,e=>{if(!m0&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){ve(this,pc)||this.setEventListener(ve(this,Md))}onUnsubscribe(){var e;this.hasListeners()||((e=ve(this,pc))==null||e.call(this),Vt(this,pc,void 0))}setEventListener(e){var n;Vt(this,Md,e),(n=ve(this,pc))==null||n.call(this),Vt(this,pc,e(this.setOnline.bind(this)))}setOnline(e){ve(this,Rd)!==e&&(Vt(this,Rd,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return ve(this,Rd)}},Rd=new WeakMap,pc=new WeakMap,Md=new WeakMap,H$),Hy=new AX;function jX(){let t,e;const n=new Promise((i,o)=>{t=i,e=o});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),t(i)},n.reject=i=>{r({status:"rejected",reason:i}),e(i)},n}function EX(t){return Math.min(1e3*2**t,3e4)}function Y4(t){return(t??"online")==="online"?Hy.isOnline():!0}var Q4=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function kS(t){return t instanceof Q4}function X4(t){let e=!1,n=0,r=!1,i;const o=jX(),s=m=>{var y;r||(h(new Q4(m)),(y=t.abort)==null||y.call(t))},c=()=>{e=!0},l=()=>{e=!1},u=()=>q4.isFocused()&&(t.networkMode==="always"||Hy.isOnline())&&t.canRun(),d=()=>Y4(t.networkMode)&&t.canRun(),f=m=>{var y;r||(r=!0,(y=t.onSuccess)==null||y.call(t,m),i==null||i(),o.resolve(m))},h=m=>{var y;r||(r=!0,(y=t.onError)==null||y.call(t,m),i==null||i(),o.reject(m))},p=()=>new Promise(m=>{var y;i=b=>{(r||u())&&m(b)},(y=t.onPause)==null||y.call(t)}).then(()=>{var m;i=void 0,r||(m=t.onContinue)==null||m.call(t)}),g=()=>{if(r)return;let m;const y=n===0?t.initialPromise:void 0;try{m=y??t.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var _;if(r)return;const x=t.retry??(m0?0:3),w=t.retryDelay??EX,S=typeof w=="function"?w(n,b):w,C=x===!0||typeof x=="number"&&nu()?void 0:p()).then(()=>{e?h(b):g()})})};return{promise:o,cancel:s,continue:()=>(i==null||i(),o),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?g():p().then(g),o)}}function TX(){let t=[],e=0,n=c=>{c()},r=c=>{c()},i=c=>setTimeout(c,0);const o=c=>{e?t.push(c):i(()=>{n(c)})},s=()=>{const c=t;t=[],c.length&&i(()=>{r(()=>{c.forEach(l=>{n(l)})})})};return{batch:c=>{let l;e++;try{l=c()}finally{e--,e||s()}return l},batchCalls:c=>(...l)=>{o(()=>{c(...l)})},schedule:o,setNotifyFunction:c=>{n=c},setBatchNotifyFunction:c=>{r=c},setScheduler:c=>{i=c}}}var hi=TX(),zl,z$,J4=(z$=class{constructor(){pn(this,zl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vX(this.gcTime)&&Vt(this,zl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(m0?1/0:5*60*1e3))}clearGcTimeout(){ve(this,zl)&&(clearTimeout(ve(this,zl)),Vt(this,zl,void 0))}},zl=new WeakMap,z$),Dd,$d,uo,Xr,og,Gl,Fo,aa,G$,NX=(G$=class extends J4{constructor(e){super();pn(this,Fo);pn(this,Dd);pn(this,$d);pn(this,uo);pn(this,Xr);pn(this,og);pn(this,Gl);Vt(this,Gl,!1),Vt(this,og,e.defaultOptions),this.setOptions(e.options),this.observers=[],Vt(this,uo,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Vt(this,Dd,kX(this.options)),this.state=e.state??ve(this,Dd),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=ve(this,Xr))==null?void 0:e.promise}setOptions(e){this.options={...ve(this,og),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&ve(this,uo).remove(this)}setData(e,n){const r=wX(this.state.data,e,this.options);return qr(this,Fo,aa).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){qr(this,Fo,aa).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=ve(this,Xr))==null?void 0:r.promise;return(i=ve(this,Xr))==null||i.cancel(e),n?n.then(Lo).catch(Lo):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(ve(this,Dd))}isActive(){return this.observers.some(e=>xX(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===EE||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!yX(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=ve(this,Xr))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=ve(this,Xr))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),ve(this,uo).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(ve(this,Xr)&&(ve(this,Gl)?ve(this,Xr).cancel({revert:!0}):ve(this,Xr).cancelRetry()),this.scheduleGc()),ve(this,uo).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||qr(this,Fo,aa).call(this,{type:"invalidate"})}fetch(e,n){var l,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(ve(this,Xr))return ve(this,Xr).continueRetry(),ve(this,Xr).promise}if(e&&this.setOptions(e),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,i=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Vt(this,Gl,!0),r.signal)})},o=()=>{const f=W4(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return i(h),Vt(this,Gl,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:o};i(s),(l=this.options.behavior)==null||l.onFetch(s,this),Vt(this,$d,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&qr(this,Fo,aa).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const c=f=>{var h,p,g,m;kS(f)&&f.silent||qr(this,Fo,aa).call(this,{type:"error",error:f}),kS(f)||((p=(h=ve(this,uo).config).onError)==null||p.call(h,f,this),(m=(g=ve(this,uo).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return Vt(this,Xr,X4({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,m;if(f===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(y){c(y);return}(p=(h=ve(this,uo).config).onSuccess)==null||p.call(h,f,this),(m=(g=ve(this,uo).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,h)=>{qr(this,Fo,aa).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{qr(this,Fo,aa).call(this,{type:"pause"})},onContinue:()=>{qr(this,Fo,aa).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),ve(this,Xr).start()}},Dd=new WeakMap,$d=new WeakMap,uo=new WeakMap,Xr=new WeakMap,og=new WeakMap,Gl=new WeakMap,Fo=new WeakSet,aa=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...PX(r.data,this.options),fetchMeta:e.meta??null};case"success":return{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const i=e.error;return kS(i)&&i.revert&&ve(this,$d)?{...ve(this,$d),fetchStatus:"idle"}:{...r,error:i,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:i,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),hi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),ve(this,uo).notify({query:this,type:"updated",action:e})})},G$);function PX(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Y4(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function kX(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Ss,V$,OX=(V$=class extends p0{constructor(e={}){super();pn(this,Ss);this.config=e,Vt(this,Ss,new Map)}build(e,n,r){const i=n.queryKey,o=n.queryHash??jE(i,n);let s=this.get(o);return s||(s=new NX({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){ve(this,Ss).has(e.queryHash)||(ve(this,Ss).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=ve(this,Ss).get(e.queryHash);n&&(e.destroy(),n===e&&ve(this,Ss).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){hi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return ve(this,Ss).get(e)}getAll(){return[...ve(this,Ss).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>RO(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>RO(e,r)):n}notify(e){hi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){hi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){hi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ss=new WeakMap,V$),Cs,ai,Vl,_s,Za,K$,IX=(K$=class extends J4{constructor(e){super();pn(this,_s);pn(this,Cs);pn(this,ai);pn(this,Vl);this.mutationId=e.mutationId,Vt(this,ai,e.mutationCache),Vt(this,Cs,[]),this.state=e.state||RX(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){ve(this,Cs).includes(e)||(ve(this,Cs).push(e),this.clearGcTimeout(),ve(this,ai).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Vt(this,Cs,ve(this,Cs).filter(n=>n!==e)),this.scheduleGc(),ve(this,ai).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){ve(this,Cs).length||(this.state.status==="pending"?this.scheduleGc():ve(this,ai).remove(this))}continue(){var e;return((e=ve(this,Vl))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,s,c,l,u,d,f,h,p,g,m,y,b,x,w,S,C,_,A;Vt(this,Vl,X4({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(j,P)=>{qr(this,_s,Za).call(this,{type:"failed",failureCount:j,error:P})},onPause:()=>{qr(this,_s,Za).call(this,{type:"pause"})},onContinue:()=>{qr(this,_s,Za).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>ve(this,ai).canRun(this)}));const n=this.state.status==="pending",r=!ve(this,Vl).canStart();try{if(!n){qr(this,_s,Za).call(this,{type:"pending",variables:e,isPaused:r}),await((o=(i=ve(this,ai).config).onMutate)==null?void 0:o.call(i,e,this));const P=await((c=(s=this.options).onMutate)==null?void 0:c.call(s,e));P!==this.state.context&&qr(this,_s,Za).call(this,{type:"pending",context:P,variables:e,isPaused:r})}const j=await ve(this,Vl).start();return await((u=(l=ve(this,ai).config).onSuccess)==null?void 0:u.call(l,j,e,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,j,e,this.state.context)),await((p=(h=ve(this,ai).config).onSettled)==null?void 0:p.call(h,j,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,j,null,e,this.state.context)),qr(this,_s,Za).call(this,{type:"success",data:j}),j}catch(j){try{throw await((b=(y=ve(this,ai).config).onError)==null?void 0:b.call(y,j,e,this.state.context,this)),await((w=(x=this.options).onError)==null?void 0:w.call(x,j,e,this.state.context)),await((C=(S=ve(this,ai).config).onSettled)==null?void 0:C.call(S,void 0,j,this.state.variables,this.state.context,this)),await((A=(_=this.options).onSettled)==null?void 0:A.call(_,void 0,j,e,this.state.context)),j}finally{qr(this,_s,Za).call(this,{type:"error",error:j})}}finally{ve(this,ai).runNext(this)}}},Cs=new WeakMap,ai=new WeakMap,Vl=new WeakMap,_s=new WeakSet,Za=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),hi.batch(()=>{ve(this,Cs).forEach(r=>{r.onMutationUpdate(e)}),ve(this,ai).notify({mutation:this,type:"updated",action:e})})},K$);function RX(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var zi,sg,W$,MX=(W$=class extends p0{constructor(e={}){super();pn(this,zi);pn(this,sg);this.config=e,Vt(this,zi,new Map),Vt(this,sg,Date.now())}build(e,n,r){const i=new IX({mutationCache:this,mutationId:++Fg(this,sg)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){const n=av(e),r=ve(this,zi).get(n)??[];r.push(e),ve(this,zi).set(n,r),this.notify({type:"added",mutation:e})}remove(e){var r;const n=av(e);if(ve(this,zi).has(n)){const i=(r=ve(this,zi).get(n))==null?void 0:r.filter(o=>o!==e);i&&(i.length===0?ve(this,zi).delete(n):ve(this,zi).set(n,i))}this.notify({type:"removed",mutation:e})}canRun(e){var r;const n=(r=ve(this,zi).get(av(e)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===e}runNext(e){var r;const n=(r=ve(this,zi).get(av(e)))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){hi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[...ve(this,zi).values()].flat()}find(e){const n={exact:!0,...e};return this.getAll().find(r=>MO(n,r))}findAll(e={}){return this.getAll().filter(n=>MO(e,n))}notify(e){hi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return hi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Lo))))}},zi=new WeakMap,sg=new WeakMap,W$);function av(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function LO(t){return{onFetch:(e,n)=>{var d,f,h,p,g;const r=e.options,i=(h=(f=(d=e.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,o=((p=e.state.data)==null?void 0:p.pages)||[],s=((g=e.state.data)==null?void 0:g.pageParams)||[];let c={pages:[],pageParams:[]},l=0;const u=async()=>{let m=!1;const y=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?m=!0:e.signal.addEventListener("abort",()=>{m=!0}),e.signal)})},b=W4(e.options,e.fetchOptions),x=async(w,S,C)=>{if(m)return Promise.reject();if(S==null&&w.pages.length)return Promise.resolve(w);const _={queryKey:e.queryKey,pageParam:S,direction:C?"backward":"forward",meta:e.options.meta};y(_);const A=await b(_),{maxPages:j}=e.options,P=C?CX:SX;return{pages:P(w.pages,A,j),pageParams:P(w.pageParams,S,j)}};if(i&&o.length){const w=i==="backward",S=w?DX:FO,C={pages:o,pageParams:s},_=S(r,C);c=await x(C,_,w)}else{const w=t??o.length;do{const S=l===0?s[0]??r.initialPageParam:FO(r,c);if(l>0&&S==null)break;c=await x(c,S),l++}while(l{var m,y;return(y=(m=e.options).persister)==null?void 0:y.call(m,u,{queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=u}}}function FO(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function DX(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}var Yn,mc,gc,Ld,Fd,vc,Bd,Ud,q$,$X=(q$=class{constructor(t={}){pn(this,Yn);pn(this,mc);pn(this,gc);pn(this,Ld);pn(this,Fd);pn(this,vc);pn(this,Bd);pn(this,Ud);Vt(this,Yn,t.queryCache||new OX),Vt(this,mc,t.mutationCache||new MX),Vt(this,gc,t.defaultOptions||{}),Vt(this,Ld,new Map),Vt(this,Fd,new Map),Vt(this,vc,0)}mount(){Fg(this,vc)._++,ve(this,vc)===1&&(Vt(this,Bd,q4.subscribe(async t=>{t&&(await this.resumePausedMutations(),ve(this,Yn).onFocus())})),Vt(this,Ud,Hy.subscribe(async t=>{t&&(await this.resumePausedMutations(),ve(this,Yn).onOnline())})))}unmount(){var t,e;Fg(this,vc)._--,ve(this,vc)===0&&((t=ve(this,Bd))==null||t.call(this),Vt(this,Bd,void 0),(e=ve(this,Ud))==null||e.call(this),Vt(this,Ud,void 0))}isFetching(t){return ve(this,Yn).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return ve(this,mc).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ve(this,Yn).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.getQueryData(t.queryKey);if(e===void 0)return this.fetchQuery(t);{const n=this.defaultQueryOptions(t),r=ve(this,Yn).build(this,n);return t.revalidateIfStale&&r.isStaleByTime(IO(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(e)}}getQueriesData(t){return ve(this,Yn).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),i=ve(this,Yn).get(r.queryHash),o=i==null?void 0:i.state.data,s=gX(e,o);if(s!==void 0)return ve(this,Yn).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return hi.batch(()=>ve(this,Yn).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=ve(this,Yn).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=ve(this,Yn);hi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=ve(this,Yn),r={type:"active",...t};return hi.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const n={revert:!0,...e},r=hi.batch(()=>ve(this,Yn).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Lo).catch(Lo)}invalidateQueries(t={},e={}){return hi.batch(()=>{if(ve(this,Yn).findAll(t).forEach(r=>{r.invalidate()}),t.refetchType==="none")return Promise.resolve();const n={...t,type:t.refetchType??t.type??"active"};return this.refetchQueries(n,e)})}refetchQueries(t={},e){const n={...e,cancelRefetch:(e==null?void 0:e.cancelRefetch)??!0},r=hi.batch(()=>ve(this,Yn).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Lo)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Lo)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=ve(this,Yn).build(this,e);return n.isStaleByTime(IO(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Lo).catch(Lo)}fetchInfiniteQuery(t){return t.behavior=LO(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Lo).catch(Lo)}ensureInfiniteQueryData(t){return t.behavior=LO(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Hy.isOnline()?ve(this,mc).resumePausedMutations():Promise.resolve()}getQueryCache(){return ve(this,Yn)}getMutationCache(){return ve(this,mc)}getDefaultOptions(){return ve(this,gc)}setDefaultOptions(t){Vt(this,gc,t)}setQueryDefaults(t,e){ve(this,Ld).set(Hp(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...ve(this,Ld).values()];let n={};return e.forEach(r=>{zp(t,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(t,e){ve(this,Fd).set(Hp(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...ve(this,Fd).values()];let n={};return e.forEach(r=>{zp(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...ve(this,gc).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=jE(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.enabled!==!0&&e.queryFn===EE&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...ve(this,gc).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){ve(this,Yn).clear(),ve(this,mc).clear()}},Yn=new WeakMap,mc=new WeakMap,gc=new WeakMap,Ld=new WeakMap,Fd=new WeakMap,vc=new WeakMap,Bd=new WeakMap,Ud=new WeakMap,q$),LX=v.createContext(void 0),FX=({client:t,children:e})=>(v.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(LX.Provider,{value:t,children:e}));/** * @remix-run/router v1.20.0 * * Copyright (c) Remix Software Inc. @@ -485,18 +485,18 @@ Error generating stack: `+o.message+` `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[oI]=this[oI]={accessors:{}}).accessors,i=this.prototype;function o(s){const c=_h(s);r[c]||(Cee(i,s),r[c]=!0)}return ie.isArray(e)?e.forEach(o):o(e),this}}Mi.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ie.reduceDescriptors(Mi.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});ie.freezeMethods(Mi);function MS(t,e){const n=this||gg,r=e||n,i=Mi.from(r.headers);let o=r.data;return ie.forEach(t,function(c){o=c.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function P5(t){return!!(t&&t.__CANCEL__)}function Uf(t,e,n){$t.call(this,t??"canceled",$t.ERR_CANCELED,e,n),this.name="CanceledError"}ie.inherits(Uf,$t,{__CANCEL__:!0});function k5(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new $t("Request failed with status code "+n.status,[$t.ERR_BAD_REQUEST,$t.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function _ee(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function Aee(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,o=0,s;return e=e!==void 0?e:1e3,function(l){const u=Date.now(),d=r[o];s||(s=u),n[i]=l,r[i]=u;let f=o,h=0;for(;f!==i;)h+=n[f++],f=f%t;if(i=(i+1)%t,i===o&&(o=(o+1)%t),u-s{n=d,i=null,o&&(clearTimeout(o),o=null),t.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?s(u,d):(i=u,o||(o=setTimeout(()=>{o=null,s(i)},r-f)))},()=>i&&s(i)]}const Wy=(t,e,n=3)=>{let r=0;const i=Aee(50,250);return jee(o=>{const s=o.loaded,c=o.lengthComputable?o.total:void 0,l=s-r,u=i(l),d=s<=c;r=s;const f={loaded:s,total:c,progress:c?s/c:void 0,bytes:l,rate:u||void 0,estimated:u&&c&&d?(c-s)/u:void 0,event:o,lengthComputable:c!=null,[e?"download":"upload"]:!0};t(f)},n)},sI=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},aI=t=>(...e)=>ie.asap(()=>t(...e)),Eee=ri.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ri.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ri.origin),ri.navigator&&/(msie|trident)/i.test(ri.navigator.userAgent)):()=>!0,Tee=ri.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];ie.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),ie.isString(r)&&s.push("path="+r),ie.isString(i)&&s.push("domain="+i),o===!0&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Nee(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function Pee(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function O5(t,e,n){let r=!Nee(e);return t&&(r||n==!1)?Pee(t,e):e}const cI=t=>t instanceof Mi?{...t}:t;function du(t,e){e=e||{};const n={};function r(u,d,f,h){return ie.isPlainObject(u)&&ie.isPlainObject(d)?ie.merge.call({caseless:h},u,d):ie.isPlainObject(d)?ie.merge({},d):ie.isArray(d)?d.slice():d}function i(u,d,f,h){if(ie.isUndefined(d)){if(!ie.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function o(u,d){if(!ie.isUndefined(d))return r(void 0,d)}function s(u,d){if(ie.isUndefined(d)){if(!ie.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function c(u,d,f){if(f in e)return r(u,d);if(f in t)return r(void 0,u)}const l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c,headers:(u,d,f)=>i(cI(u),cI(d),f,!0)};return ie.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=l[d]||i,h=f(t[d],e[d],d);ie.isUndefined(h)&&f!==c||(n[d]=h)}),n}const I5=t=>{const e=du({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:c}=e;e.headers=s=Mi.from(s),e.url=E5(O5(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),c&&s.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let l;if(ie.isFormData(n)){if(ri.hasStandardBrowserEnv||ri.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if((l=s.getContentType())!==!1){const[u,...d]=l?l.split(";").map(f=>f.trim()).filter(Boolean):[];s.setContentType([u||"multipart/form-data",...d].join("; "))}}if(ri.hasStandardBrowserEnv&&(r&&ie.isFunction(r)&&(r=r(e)),r||r!==!1&&Eee(e.url))){const u=i&&o&&Tee.read(o);u&&s.set(i,u)}return e},kee=typeof XMLHttpRequest<"u",Oee=kee&&function(t){return new Promise(function(n,r){const i=I5(t);let o=i.data;const s=Mi.from(i.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:u}=i,d,f,h,p,g;function m(){p&&p(),g&&g(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(i.method.toUpperCase(),i.url,!0),y.timeout=i.timeout;function b(){if(!y)return;const w=Mi.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),C={data:!c||c==="text"||c==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:w,config:t,request:y};k5(function(A){n(A),m()},function(A){r(A),m()},C),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},y.onabort=function(){y&&(r(new $t("Request aborted",$t.ECONNABORTED,t,y)),y=null)},y.onerror=function(){r(new $t("Network Error",$t.ERR_NETWORK,t,y)),y=null},y.ontimeout=function(){let S=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const C=i.transitional||T5;i.timeoutErrorMessage&&(S=i.timeoutErrorMessage),r(new $t(S,C.clarifyTimeoutError?$t.ETIMEDOUT:$t.ECONNABORTED,t,y)),y=null},o===void 0&&s.setContentType(null),"setRequestHeader"in y&&ie.forEach(s.toJSON(),function(S,C){y.setRequestHeader(C,S)}),ie.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),c&&c!=="json"&&(y.responseType=i.responseType),u&&([h,g]=Wy(u,!0),y.addEventListener("progress",h)),l&&y.upload&&([f,p]=Wy(l),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(d=w=>{y&&(r(!w||w.type?new Uf(null,t,y):w),y.abort(),y=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const x=_ee(i.url);if(x&&ri.protocols.indexOf(x)===-1){r(new $t("Unsupported protocol "+x+":",$t.ERR_BAD_REQUEST,t));return}y.send(o||null)})},Iee=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const o=function(u){if(!i){i=!0,c();const d=u instanceof Error?u:this.reason;r.abort(d instanceof $t?d:new Uf(d instanceof Error?d.message:d))}};let s=e&&setTimeout(()=>{s=null,o(new $t(`timeout ${e} of ms exceeded`,$t.ETIMEDOUT))},e);const c=()=>{t&&(s&&clearTimeout(s),s=null,t.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),t=null)};t.forEach(u=>u.addEventListener("abort",o));const{signal:l}=r;return l.unsubscribe=()=>ie.asap(c),l}},Ree=function*(t,e){let n=t.byteLength;if(n{const i=Mee(t,e);let o=0,s,c=l=>{s||(s=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:u,value:d}=await i.next();if(u){c(),l.close();return}let f=d.byteLength;if(n){let h=o+=f;n(h)}l.enqueue(new Uint8Array(d))}catch(u){throw c(u),u}},cancel(l){return c(l),i.return()}},{highWaterMark:2})},S0=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",R5=S0&&typeof ReadableStream=="function",$ee=S0&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),M5=(t,...e)=>{try{return!!t(...e)}catch{return!1}},Lee=R5&&M5(()=>{let t=!1;const e=new Request(ri.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),uI=64*1024,q_=R5&&M5(()=>ie.isReadableStream(new Response("").body)),qy={stream:q_&&(t=>t.body)};S0&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!qy[e]&&(qy[e]=ie.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new $t(`Response type '${e}' is not supported`,$t.ERR_NOT_SUPPORT,r)})})})(new Response);const Fee=async t=>{if(t==null)return 0;if(ie.isBlob(t))return t.size;if(ie.isSpecCompliantForm(t))return(await new Request(ri.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(ie.isArrayBufferView(t)||ie.isArrayBuffer(t))return t.byteLength;if(ie.isURLSearchParams(t)&&(t=t+""),ie.isString(t))return(await $ee(t)).byteLength},Bee=async(t,e)=>{const n=ie.toFiniteNumber(t.getContentLength());return n??Fee(e)},Uee=S0&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:o,timeout:s,onDownloadProgress:c,onUploadProgress:l,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=I5(t);u=u?(u+"").toLowerCase():"text";let p=Iee([i,o&&o.toAbortSignal()],s),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(l&&Lee&&n!=="get"&&n!=="head"&&(y=await Bee(d,r))!==0){let C=new Request(e,{method:"POST",body:r,duplex:"half"}),_;if(ie.isFormData(r)&&(_=C.headers.get("content-type"))&&d.setContentType(_),C.body){const[A,j]=sI(y,Wy(aI(l)));r=lI(C.body,uI,A,j)}}ie.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(e,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let x=await fetch(g);const w=q_&&(u==="stream"||u==="response");if(q_&&(c||w&&m)){const C={};["status","statusText","headers"].forEach(P=>{C[P]=x[P]});const _=ie.toFiniteNumber(x.headers.get("content-length")),[A,j]=c&&sI(_,Wy(aI(c),!0))||[];x=new Response(lI(x.body,uI,A,()=>{j&&j(),m&&m()}),C)}u=u||"text";let S=await qy[ie.findKey(qy,u)||"text"](x,t);return!w&&m&&m(),await new Promise((C,_)=>{k5(C,_,{data:S,headers:Mi.from(x.headers),status:x.status,statusText:x.statusText,config:t,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new $t("Network Error",$t.ERR_NETWORK,t,g),{cause:b.cause||b}):$t.from(b,b&&b.code,t,g)}}),Y_={http:nee,xhr:Oee,fetch:Uee};ie.forEach(Y_,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const dI=t=>`- ${t}`,Hee=t=>ie.isFunction(t)||t===null||t===!1,D5={getAdapter:t=>{t=ie.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let o=0;o`adapter ${c} `+(l===!1?"is not supported by the environment":"is not available in the build"));let s=e?o.length>1?`since : `+o.map(dI).join(` `):" "+dI(o[0]):"as no adapter specified";throw new $t("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:Y_};function DS(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Uf(null,t)}function fI(t){return DS(t),t.headers=Mi.from(t.headers),t.data=MS.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),D5.getAdapter(t.adapter||gg.adapter)(t).then(function(r){return DS(t),r.data=MS.call(t,t.transformResponse,r),r.headers=Mi.from(r.headers),r},function(r){return P5(r)||(DS(t),r&&r.response&&(r.response.data=MS.call(t,t.transformResponse,r.response),r.response.headers=Mi.from(r.response.headers))),Promise.reject(r)})}const $5="1.9.0",C0={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{C0[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const hI={};C0.transitional=function(e,n,r){function i(o,s){return"[Axios v"+$5+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,c)=>{if(e===!1)throw new $t(i(s," has been removed"+(n?" in "+n:"")),$t.ERR_DEPRECATED);return n&&!hI[s]&&(hI[s]=!0,console.warn(i(s," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(o,s,c):!0}};C0.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function zee(t,e,n){if(typeof t!="object")throw new $t("options must be an object",$t.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const o=r[i],s=e[o];if(s){const c=t[o],l=c===void 0||s(c,o,t);if(l!==!0)throw new $t("option "+o+" must be "+l,$t.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new $t("Unknown option "+o,$t.ERR_BAD_OPTION)}}const Zv={assertOptions:zee,validators:C0},ys=Zv.validators;class ql{constructor(e){this.defaults=e||{},this.interceptors={request:new iI,response:new iI}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=du(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Zv.assertOptions(r,{silentJSONParsing:ys.transitional(ys.boolean),forcedJSONParsing:ys.transitional(ys.boolean),clarifyTimeoutError:ys.transitional(ys.boolean)},!1),i!=null&&(ie.isFunction(i)?n.paramsSerializer={serialize:i}:Zv.assertOptions(i,{encode:ys.function,serialize:ys.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Zv.assertOptions(n,{baseUrl:ys.spelling("baseURL"),withXsrfToken:ys.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&ie.merge(o.common,o[n.method]);o&&ie.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Mi.concat(s,o);const c=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(l=l&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,h;if(!l){const g=[fI.bind(this),void 0];for(g.unshift.apply(g,c),g.push.apply(g,u),h=g.length,d=Promise.resolve(n);f{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(c=>{r.subscribe(c),o=c}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,c){r.reason||(r.reason=new Uf(o,s,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new HE(function(i){e=i}),cancel:e}}}function Gee(t){return function(n){return t.apply(null,n)}}function Vee(t){return ie.isObject(t)&&t.isAxiosError===!0}const Q_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Q_).forEach(([t,e])=>{Q_[e]=t});function L5(t){const e=new ql(t),n=m5(ql.prototype.request,e);return ie.extend(n,ql.prototype,e,{allOwnKeys:!0}),ie.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return L5(du(t,i))},n}const mr=L5(gg);mr.Axios=ql;mr.CanceledError=Uf;mr.CancelToken=HE;mr.isCancel=P5;mr.VERSION=$5;mr.toFormData=w0;mr.AxiosError=$t;mr.Cancel=mr.CanceledError;mr.all=function(e){return Promise.all(e)};mr.spread=Gee;mr.isAxiosError=Vee;mr.mergeConfig=du;mr.AxiosHeaders=Mi;mr.formToJSON=t=>N5(ie.isHTMLForm(t)?new FormData(t):t);mr.getAdapter=D5.getAdapter;mr.HttpStatusCode=Q_;mr.default=mr;const F5="https://ai-sandbox.oliver.solutions/semblance_back/api",$e=mr.create({baseURL:F5,headers:{"Content-Type":"application/json"},timeout:6e5});$e.interceptors.request.use(t=>{var n,r;const e=localStorage.getItem("auth_token");return e&&(t.headers.Authorization=`Bearer ${e}`),t.method==="put"&&((n=t.url)!=null&&n.includes("/focus-groups/"))&&console.log("🌐 API Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),(r=t.url)!=null&&r.includes("/folders/")&&console.log("🌐 API Folder Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),t},t=>Promise.reject(t));const X_="auth_error",Kee=t=>{t!=null&&t.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const e=new CustomEvent(X_,{detail:t||{}});window.dispatchEvent(e)};$e.interceptors.response.use(t=>t,t=>{var e,n,r,i,o,s;if(t.response&&t.response.status===401){const c=t.config&&(((e=t.config.url)==null?void 0:e.includes("/personas"))||((n=t.config.url)==null?void 0:n.includes("/personas/batch"))||t.config.method&&((r=t.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(i=t.config)==null?void 0:i.url,method:(o=t.config)==null?void 0:o.method,isPersonaRequest:c}),c?console.warn("Authentication error in persona request, letting component handle it"):Kee({source:(s=t.config)==null?void 0:s.url,isPersonaCreation:!1})}return Promise.reject(t)});const ey={login:(t,e)=>$e.post("/auth/login",{username:t,password:e}),loginWithMicrosoft:t=>$e.post("/auth/microsoft",{id_token:t}),register:(t,e,n)=>$e.post("/auth/register",{username:t,email:e,password:n}),getProfile:()=>$e.get("/auth/me")},zr={getAll:()=>$e.get("/personas/all"),getById:t=>$e.get(`/personas/${t}`),create:t=>$e.post("/personas",t),update:(t,e)=>t&&t.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",t),$e.post("/personas",e)):$e.put(`/personas/${t}`,e),delete:t=>{const e=typeof t=="object"&&t!==null&&t._id||t;return console.log(`Deleting persona with ID: ${e}`),$e.delete(`/personas/${e}`)},createBatch:t=>$e.post("/personas/batch",t)},ua={generate:t=>$e.post("/ai-personas/generate",t||{},{timeout:6e5}),generateAndSave:t=>$e.post("/ai-personas/generate-and-save",t||{},{timeout:6e5}),batchGenerate:t=>$e.post("/ai-personas/batch-generate",t,{timeout:6e5}),batchGenerateAndSave:t=>$e.post("/ai-personas/batch-generate-and-save",t,{timeout:6e5}),generateBasicProfiles:(t,e=5,n=.8)=>$e.post("/ai-personas/generate-basic-profiles",{audience_brief:t,count:e,temperature:n},{timeout:6e5}),completePersona:(t,e=.7)=>$e.post("/ai-personas/complete-persona",{basic_profile:t,temperature:e},{timeout:6e5}),completeAndSavePersona:(t,e=.7)=>$e.post("/ai-personas/complete-and-save-persona",{basic_profile:t,temperature:e},{timeout:6e5}),generatePersonaSummary:(t,e=.7)=>$e.post("/ai-personas/generate-persona-summary",{persona_data:t,temperature:e},{timeout:6e5}),batchGenerateWithStages:async(t,e,n=5,r=.7,i,o)=>{var s;try{console.log(`📡 API call to generate-basic-profiles with model: ${o||"gemini-2.5-pro"}`);const l=(await $e.post("/ai-personas/generate-basic-profiles",{audience_brief:t,research_objective:e,count:n,temperature:.7,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`📡 API call to complete-and-save-persona with model: ${o||"gemini-2.5-pro"}`);const h=l.map(g=>$e.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5}));if((await Promise.allSettled(h)).forEach((g,m)=>{if(g.status==="fulfilled")u.push(g.value.data.persona),d.push(g.value.data.persona_id);else{const y=l[m],b={index:m,name:y.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${y.name||"unnamed"}):`,g.reason)}}),u.length===0&&f.length>0)throw new Error(`Failed to generate any personas. ${f.length} profile(s) failed.`);return{data:{message:`Generated and saved ${u.length} personas${f.length>0?` (${f.length} failed)`:""}`,personas:u,persona_ids:d,errors:f.length>0?f:void 0,partial_success:f.length>0&&u.length>0}}}catch(c){throw((s=c.response)==null?void 0:s.status)===504||c.code==="ECONNABORTED"?new Error("Timeout error: The server took too long to generate personas. Please try with fewer personas or try again later."):c}},enhanceAudienceBrief:(t,e,n=.7)=>$e.post("/ai-personas/enhance-audience-brief",{audience_brief:t,research_objective:e,temperature:n},{timeout:6e5}),batchGenerateSummaries:(t,e=.7,n)=>(console.log(`📡 Frontend: API call to batch-generate-summaries with model: ${n||"gemini-2.5-pro"}`),$e.post("/ai-personas/batch-generate-summaries",{persona_ids:t,temperature:e,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:t=>{const e=new FormData;for(let n=0;n$e.delete(`/ai-personas/cleanup-customer-data/${t}`)},Ot={getAll:()=>$e.get("/focus-groups"),getById:t=>$e.get(`/focus-groups/${t}`),create:t=>$e.post("/focus-groups",t),update:(t,e)=>$e.put(`/focus-groups/${t}`,e),delete:t=>$e.delete(`/focus-groups/${t}`),addParticipant:(t,e)=>$e.post(`/focus-groups/${t}/participants`,{persona_id:e}),removeParticipant:(t,e)=>$e.delete(`/focus-groups/${t}/participants/${e}`),sendMessage:(t,e)=>$e.post(`/focus-groups/${t}/messages`,e),getMessages:t=>$e.get(`/focus-groups/${t}/messages`),updateMessageHighlight:(t,e,n)=>$e.patch(`/focus-groups/${t}/messages/${e}`,{highlighted:n}),describeAsset:(t,e)=>$e.post(`/focus-groups/${t}/describe-asset`,{asset_filename:e},{timeout:12e4}),generateDiscussionGuide:t=>$e.post("/focus-groups/generate-discussion-guide",t,{timeout:6e5}),generateDiscussionGuideForGroup:(t,e)=>$e.post(`/focus-groups/${t}/generate-discussion-guide`,e,{timeout:6e5}),downloadDiscussionGuide:async t=>{try{const e=await $e.get(`/focus-groups/${t}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=e.headers["content-disposition"];let r="discussion-guide.md";if(n){const c=n.match(/filename="([^"]+)"/);c&&(r=c[1])}const i=new Blob([e.data],{type:"text/markdown"}),o=URL.createObjectURL(i),s=document.createElement("a");return s.href=o,s.download=r,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o),{success:!0,filename:r}}catch(e){throw console.error("Error downloading discussion guide:",e),new Error("Failed to download discussion guide")}},createNote:(t,e)=>$e.post(`/focus-groups/${t}/notes`,e),getNotes:t=>$e.get(`/focus-groups/${t}/notes`),deleteNote:(t,e)=>$e.delete(`/focus-groups/${t}/notes/${e}`),uploadAssets:(t,e,n)=>(n===!0&&e.append("replace","true"),$e.post(`/focus-groups/${t}/assets`,e,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4})),getAssets:t=>$e.get(`/focus-groups/${t}/assets`),getAssetUrl:(t,e)=>`${F5}/focus-groups/${t}/assets/${e}`,deleteAsset:(t,e)=>$e.delete(`/focus-groups/${t}/assets/${e}`)},Xn={generateResponse:(t,e,n,r=.7)=>$e.post("/focus-group-ai/generate-response",{focus_group_id:t,persona_id:e,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(t,e=.7)=>$e.post("/focus-group-ai/generate-key-themes",{focus_group_id:t,temperature:e},{timeout:6e5}),getKeyThemes:t=>$e.get(`/focus-group-ai/key-themes/${t}`),deleteKeyTheme:(t,e)=>$e.delete(`/focus-group-ai/key-themes/${t}/${e}`),getModeratorStatus:t=>$e.get(`/focus-group-ai/moderator/status/${t}`),advanceModeratorDiscussion:t=>$e.post(`/focus-group-ai/moderator/advance/${t}`,{},{timeout:6e5}),setModeratorPosition:(t,e,n)=>$e.put(`/focus-group-ai/moderator/position/${t}`,{section_id:e,item_id:n}),startAutonomousConversation:(t,e)=>$e.post(`/focus-group-ai/autonomous/start/${t}`,{initial_prompt:e},{timeout:6e5}),stopAutonomousConversation:(t,e)=>$e.post(`/focus-group-ai/autonomous/stop/${t}`,{reason:e}),getAutonomousConversationStatus:t=>$e.get(`/focus-group-ai/autonomous/status/${t}`),getConversationState:t=>$e.get(`/focus-group-ai/conversation/state/${t}`),getConversationAnalytics:t=>$e.get(`/focus-group-ai/conversation/analytics/${t}`),makeConversationDecision:(t,e=.7,n="ai")=>$e.post(`/focus-group-ai/conversation/decision/${t}`,{temperature:e,mode:n},{timeout:6e5}),getConversationInsights:t=>$e.get(`/focus-group-ai/conversation/insights/${t}`,{timeout:6e5}),manualIntervention:(t,e,n,r)=>$e.post(`/focus-group-ai/conversation/intervene/${t}`,{action:e,message:n,participant_id:r}),getReasoningHistory:t=>$e.get(`/focus-group-ai/conversation/reasoning-history/${t}`),endSession:(t,e)=>$e.post(`/focus-group-ai/moderator/end-session/${t}`,{reason:e||"session_ended"})},js={getAll:()=>$e.get("/folders"),getById:t=>$e.get(`/folders/${t}`),create:t=>$e.post("/folders",t),update:(t,e)=>$e.put(`/folders/${t}`,e),delete:t=>$e.delete(`/folders/${t}`),addPersona:(t,e)=>$e.post(`/folders/${t}/personas`,{persona_id:e}),removePersona:(t,e)=>$e.delete(`/folders/${t}/personas/${e}`),addPersonasBatch:(t,e)=>$e.post(`/folders/${t}/personas/batch`,{persona_ids:e}),removePersonasBatch:(t,e)=>(console.log(`🌐 API removePersonasBatch: Sending POST to /folders/${t}/personas/remove-batch with persona_ids:`,e),$e.post(`/folders/${t}/personas/remove-batch`,{persona_ids:e})),addPersonaToMultipleFolders:(t,e)=>{const n=e.map(r=>$e.post(`/folders/${r}/personas`,{persona_id:t}));return Promise.all(n)},removePersonaFromAllFolders:t=>{throw new Error("Use removePersona for specific folders")}};/*! @azure/msal-common v15.10.0 2025-08-05 */const pe={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},wc={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,GONE:410,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},Ol={GET:"GET",POST:"POST"},vg=[pe.OPENID_SCOPE,pe.PROFILE_SCOPE,pe.OFFLINE_ACCESS_SCOPE],pI=[...vg,pe.EMAIL_SCOPE],di={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},mI={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},Ic={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},lv={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},pi={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},zE={CODE:"code",IDTOKEN_TOKEN:"id_token token",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},_0={QUERY:"query",FRAGMENT:"fragment"},Wee={QUERY:"query",FRAGMENT:"fragment",FORM_POST:"form_post"},B5={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},uv={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},Qp={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},Hr={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},GE="appmetadata",qee="client_info",Yy="1",Qy={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},Ui={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},Lr={SCHEMA_VERSION:5,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},vn={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},cp={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},gI={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},$u={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},$S={CONFIGURED_NO_AUTO_DETECTION:"2",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},Cl={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},Yee={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},U5=300;/*! @azure/msal-common v15.10.0 2025-08-05 */const Xy="unexpected_error",Qee="post_request_failed";/*! @azure/msal-common v15.10.0 2025-08-05 */const vI={[Xy]:"Unexpected error in authentication.",[Qee]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class _n extends Error{constructor(e,n,r){const i=n?`${e}: ${n}`:e;super(i),Object.setPrototypeOf(this,_n.prototype),this.errorCode=e||pe.EMPTY_STRING,this.errorMessage=n||pe.EMPTY_STRING,this.subError=r||pe.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function J_(t,e){return new _n(t,e?`${vI[t]} ${e}`:vI[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */const VE="client_info_decoding_error",H5="client_info_empty_error",KE="token_parsing_error",z5="null_or_empty_token",da="endpoints_resolution_error",G5="network_error",V5="openid_config_error",K5="hash_not_deserialized",Xd="invalid_state",W5="state_mismatch",Z_="state_not_found",q5="nonce_mismatch",WE="auth_time_not_found",Y5="max_age_transpired",Xee="multiple_matching_tokens",Jee="multiple_matching_accounts",Q5="multiple_matching_appMetadata",X5="request_cannot_be_made",J5="cannot_remove_empty_scope",Z5="cannot_append_scopeset",eA="empty_input_scopeset",Zee="device_code_polling_cancelled",ete="device_code_expired",tte="device_code_unknown_error",qE="no_account_in_silent_request",eB="invalid_cache_record",YE="invalid_cache_environment",tA="no_account_found",nA="no_crypto_object",nte="unexpected_credential_type",rte="invalid_assertion",ite="invalid_client_credential",Rc="token_refresh_required",ote="user_timeout_reached",tB="token_claims_cnf_required_for_signedjwt",nB="authorization_code_missing_from_server_response",rB="binding_key_not_removed",iB="end_session_endpoint_not_supported",QE="key_id_missing",ste="no_network_connectivity",ate="user_canceled",cte="missing_tenant_id_error",Vt="method_not_implemented",lte="nested_app_auth_bridge_disabled";/*! @azure/msal-common v15.10.0 2025-08-05 */const yI={[VE]:"The client info could not be parsed/decoded correctly",[H5]:"The client info was empty",[KE]:"Token cannot be parsed",[z5]:"The token is null or empty",[da]:"Endpoints cannot be resolved",[G5]:"Network request failed",[V5]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[K5]:"The hash parameters could not be deserialized",[Xd]:"State was not the expected format",[W5]:"State mismatch error",[Z_]:"State not found",[q5]:"Nonce mismatch error",[WE]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[Y5]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[Xee]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[Jee]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[Q5]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[X5]:"Token request cannot be made without authorization code or refresh token.",[J5]:"Cannot remove null or empty scope from ScopeSet",[Z5]:"Cannot append ScopeSet",[eA]:"Empty input ScopeSet cannot be processed",[Zee]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[ete]:"Device code is expired.",[tte]:"Device code stopped polling for unknown reasons.",[qE]:"Please pass an account object, silent flow is not supported without account information",[eB]:"Cache record object was null or undefined.",[YE]:"Invalid environment when attempting to create cache entry",[tA]:"No account found in cache for given key.",[nA]:"No crypto object detected.",[nte]:"Unexpected credential type.",[rte]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[ite]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[Rc]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[ote]:"User defined timeout for device code polling reached",[tB]:"Cannot generate a POP jwt if the token_claims are not populated",[nB]:"Server response does not contain an authorization code to proceed",[rB]:"Could not remove the credential's binding key from storage.",[iB]:"The provided authority does not support logout",[QE]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[ste]:"No network connectivity. Check your internet connection.",[ate]:"User cancelled the flow.",[cte]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Vt]:"This method has not been implemented",[lte]:"The nested app auth bridge is disabled"};class XE extends _n{constructor(e,n){super(e,n?`${yI[e]}: ${n}`:yI[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,XE.prototype)}}function we(t,e){return new XE(t,e)}/*! @azure/msal-common v15.10.0 2025-08-05 */const Jy={createNewGuid:()=>{throw we(Vt)},base64Decode:()=>{throw we(Vt)},base64Encode:()=>{throw we(Vt)},base64UrlEncode:()=>{throw we(Vt)},encodeKid:()=>{throw we(Vt)},async getPublicKeyThumbprint(){throw we(Vt)},async removeTokenBindingKey(){throw we(Vt)},async clearKeystore(){throw we(Vt)},async signJwt(){throw we(Vt)},async hashString(){throw we(Vt)}};/*! @azure/msal-common v15.10.0 2025-08-05 */var Mn;(function(t){t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=2]="Info",t[t.Verbose=3]="Verbose",t[t.Trace=4]="Trace"})(Mn||(Mn={}));class Da{constructor(e,n,r){this.level=Mn.Info;const i=()=>{},o=e||Da.createDefaultLoggerOptions();this.localCallback=o.loggerCallback||i,this.piiLoggingEnabled=o.piiLoggingEnabled||!1,this.level=typeof o.logLevel=="number"?o.logLevel:Mn.Info,this.correlationId=o.correlationId||pe.EMPTY_STRING,this.packageName=n||pe.EMPTY_STRING,this.packageVersion=r||pe.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:Mn.Info}}clone(e,n,r){return new Da({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,n)}logMessage(e,n){if(n.logLevel>this.level||!this.piiLoggingEnabled&&n.containsPii)return;const o=`${`[${new Date().toUTCString()}] : [${n.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${Mn[n.logLevel]} - ${e}`;this.executeCallback(n.logLevel,o,n.containsPii||!1)}executeCallback(e,n,r){this.localCallback&&this.localCallback(e,n,r)}error(e,n){this.logMessage(e,{logLevel:Mn.Error,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}errorPii(e,n){this.logMessage(e,{logLevel:Mn.Error,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}warning(e,n){this.logMessage(e,{logLevel:Mn.Warning,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}warningPii(e,n){this.logMessage(e,{logLevel:Mn.Warning,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}info(e,n){this.logMessage(e,{logLevel:Mn.Info,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}infoPii(e,n){this.logMessage(e,{logLevel:Mn.Info,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}verbose(e,n){this.logMessage(e,{logLevel:Mn.Verbose,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}verbosePii(e,n){this.logMessage(e,{logLevel:Mn.Verbose,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}trace(e,n){this.logMessage(e,{logLevel:Mn.Trace,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}tracePii(e,n){this.logMessage(e,{logLevel:Mn.Trace,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v15.10.0 2025-08-05 */const oB="@azure/msal-common",JE="15.10.0";/*! @azure/msal-common v15.10.0 2025-08-05 */const ZE={None:"none",AzurePublic:"https://login.microsoftonline.com",AzurePpe:"https://login.windows-ppe.net",AzureChina:"https://login.chinacloudapi.cn",AzureGermany:"https://login.microsoftonline.de",AzureUsGovernment:"https://login.microsoftonline.us"};/*! @azure/msal-common v15.10.0 2025-08-05 */const sB="redirect_uri_empty",ute="claims_request_parsing_error",aB="authority_uri_insecure",Gh="url_parse_error",cB="empty_url_error",lB="empty_input_scopes_error",eT="invalid_claims",uB="token_request_empty",dB="logout_request_empty",dte="invalid_code_challenge_method",tT="pkce_params_missing",nT="invalid_cloud_discovery_metadata",fB="invalid_authority_metadata",hB="untrusted_authority",A0="missing_ssh_jwk",pB="missing_ssh_kid",fte="missing_nonce_authentication_header",hte="invalid_authentication_header",mB="cannot_set_OIDCOptions",gB="cannot_allow_platform_broker",vB="authority_mismatch",yB="invalid_request_method_for_EAR",xB="invalid_authorize_post_body_parameters";/*! @azure/msal-common v15.10.0 2025-08-05 */const pte={[sB]:"A redirect URI is required for all calls, and none has been set.",[ute]:"Could not parse the given claims request object.",[aB]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[Gh]:"URL could not be parsed into appropriate segments.",[cB]:"URL was empty or null.",[lB]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[eT]:"Given claims parameter must be a stringified JSON object.",[uB]:"Token request was empty and not found in cache.",[dB]:"The logout request was null or undefined.",[dte]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[tT]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[nT]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[fB]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[hB]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[A0]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[pB]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[fte]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[hte]:"Invalid authentication header provided",[mB]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[gB]:"Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",[vB]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",[xB]:"Invalid authorize post body parameters provided. If you are using authorizePostBodyParameters, the request method must be POST. Please check the request method and parameters.",[yB]:"Invalid request method for EAR protocol mode. The request method cannot be GET when using EAR protocol mode. Please change the request method to POST."};class rT extends _n{constructor(e){super(e,pte[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,rT.prototype)}}function jn(t){return new rT(t)}/*! @azure/msal-common v15.10.0 2025-08-05 */class $s{static isEmptyObj(e){if(e)try{const n=JSON.parse(e);return Object.keys(n).length===0}catch{}return!0}static startsWith(e,n){return e.indexOf(n)===0}static endsWith(e,n){return e.length>=n.length&&e.lastIndexOf(n)===e.length-n.length}static queryStringToObject(e){const n={},r=e.split("&"),i=o=>decodeURIComponent(o.replace(/\+/g," "));return r.forEach(o=>{if(o.trim()){const[s,c]=o.split(/=(.+)/g,2);s&&c&&(n[i(s)]=i(c))}}),n}static trimArrayEntries(e){return e.map(n=>n.trim())}static removeEmptyStringsFromArray(e){return e.filter(n=>!!n)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,n){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ar{constructor(e){const n=e?$s.trimArrayEntries([...e]):[],r=n?$s.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw jn(lB);this.scopes=new Set,r.forEach(i=>this.scopes.add(i))}static fromString(e){const r=(e||pe.EMPTY_STRING).split(" ");return new Ar(r)}static createSearchScopes(e){const n=new Ar(e);return n.containsOnlyOIDCScopes()?n.removeScope(pe.OFFLINE_ACCESS_SCOPE):n.removeOIDCScopes(),n}containsScope(e){const n=this.printScopesLowerCase().split(" "),r=new Ar(n);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(n=>this.containsScope(n))}containsOnlyOIDCScopes(){let e=0;return pI.forEach(n=>{this.containsScope(n)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(n=>this.appendScope(n))}catch{throw we(Z5)}}removeScope(e){if(!e)throw we(J5);this.scopes.delete(e.trim())}removeOIDCScopes(){pI.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw we(eA);const n=new Set;return e.scopes.forEach(r=>n.add(r.toLowerCase())),this.scopes.forEach(r=>n.add(r.toLowerCase())),n}intersectingScopeSets(e){if(!e)throw we(eA);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const n=this.unionScopeSets(e),r=e.getScopeCount(),i=this.getScopeCount();return n.sizee.push(n)),e}printScopes(){return this.scopes?this.asArray().join(" "):pe.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v15.10.0 2025-08-05 */function xI(t,e){return!!t&&!!e&&t===e.split(".")[1]}function iT(t,e,n,r){if(r){const{oid:i,sub:o,tid:s,name:c,tfp:l,acr:u,preferred_username:d,upn:f,login_hint:h}=r,p=s||l||u||"";return{tenantId:p,localAccountId:i||o||"",name:c,username:d||f||"",loginHint:h,isHomeTenant:xI(p,t)}}else return{tenantId:n,localAccountId:e,username:"",isHomeTenant:xI(n,t)}}function oT(t,e,n,r){let i=t;if(e){const{isHomeTenant:o,...s}=e;i={...t,...s}}if(n){const{isHomeTenant:o,...s}=iT(t.homeAccountId,t.localAccountId,t.tenantId,n);return i={...i,...s,idTokenClaims:n,idToken:r},i}return i}/*! @azure/msal-common v15.10.0 2025-08-05 */function Hf(t,e){const n=mte(t);try{const r=e(n);return JSON.parse(r)}catch{throw we(KE)}}function mte(t){if(!t)throw we(z5);const n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);if(!n||n.length<4)throw we(KE);return n[2]}function bB(t,e){if(e===0||Date.now()-3e5>t+e)throw we(Y5)}/*! @azure/msal-common v15.10.0 2025-08-05 */function wB(t){return t.startsWith("#/")?t.substring(2):t.startsWith("#")||t.startsWith("?")?t.substring(1):t}function Zy(t){if(!t||t.indexOf("=")<0)return null;try{const e=wB(t),n=Object.fromEntries(new URLSearchParams(e));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw we(K5)}return null}function Xp(t,e=!0,n){const r=new Array;return t.forEach((i,o)=>{!e&&n&&o in n?r.push(`${o}=${i}`):r.push(`${o}=${encodeURIComponent(i)}`)}),r.join("&")}/*! @azure/msal-common v15.10.0 2025-08-05 */class en{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw jn(cB);e.includes("#")||(this._urlString=en.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let n=e.toLowerCase();return $s.endsWith(n,"?")?n=n.slice(0,-1):$s.endsWith(n,"?/")&&(n=n.slice(0,-2)),$s.endsWith(n,"/")||(n+="/"),n}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw jn(Gh)}if(!e.HostNameAndPort||!e.PathSegments)throw jn(Gh);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw jn(aB)}static appendQueryString(e,n){return n?e.indexOf("?")<0?`${e}?${n}`:`${e}&${n}`:e}static removeHashFromUrl(e){return en.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const n=this.getUrlComponents(),r=n.PathSegments;return e&&r.length!==0&&(r[0]===Ic.COMMON||r[0]===Ic.ORGANIZATIONS)&&(r[0]=e),en.constructAuthorityUriFromObject(n)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=this.urlString.match(e);if(!n)throw jn(Gh);const r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5],QueryString:n[7]};let i=r.AbsolutePath.split("/");return i=i.filter(o=>o&&o.length>0),r.PathSegments=i,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const n=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(n);if(!r)throw jn(Gh);return r[2]}static getAbsoluteUrl(e,n){if(e[0]===pe.FORWARD_SLASH){const i=new en(n).getUrlComponents();return i.Protocol+"//"+i.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new en(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Zy(e)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const SB={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},bI=SB.endpointMetadata,sT=SB.instanceDiscoveryMetadata,CB=new Set;sT.metadata.forEach(t=>{t.aliases.forEach(e=>{CB.add(e)})});function gte(t,e){var i;let n;const r=t.canonicalAuthority;if(r){const o=new en(r).getUrlComponents().HostNameAndPort;n=wI(o,(i=t.cloudDiscoveryMetadata)==null?void 0:i.metadata,Ui.CONFIG,e)||wI(o,sT.metadata,Ui.HARDCODED_VALUES,e)||t.knownAuthorities}return n||[]}function wI(t,e,n,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${n}`),t&&e){const i=ex(e,t);if(i)return r==null||r.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),i.aliases;r==null||r.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function vte(t){return ex(sT.metadata,t)}function ex(t,e){for(let n=0;n1?r.sort(o=>o.idTokenClaims?-1:1)[0]:r.length===1?r[0]:null}getBaseAccountInfo(e,n){const r=this.getAccountsFilteredBy(e,n);return r.length>0?r[0].getAccountInfo():null}buildTenantProfiles(e,n,r){return e.flatMap(i=>this.getTenantProfilesFromAccountEntity(i,n,r==null?void 0:r.tenantId,r))}getTenantedAccountInfoByFilter(e,n,r,i,o){let s=null,c;if(o&&!this.tenantProfileMatchesFilter(r,o))return null;const l=this.getIdToken(e,i,n,r.tenantId);return l&&(c=Hf(l.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(c,o))?null:(s=oT(e,r,c,l==null?void 0:l.secret),s)}getTenantProfilesFromAccountEntity(e,n,r,i){const o=e.getAccountInfo();let s=o.tenantProfiles||new Map;const c=this.getTokenKeys();if(r){const u=s.get(r);if(u)s=new Map([[r,u]]);else return[]}const l=[];return s.forEach(u=>{const d=this.getTenantedAccountInfoByFilter(o,c,u,n,i);d&&l.push(d)}),l}tenantProfileMatchesFilter(e,n){return!(n.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,n.localAccountId)||n.name&&e.name!==n.name||n.isHomeTenant!==void 0&&e.isHomeTenant!==n.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,n){return!(n&&(n.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,n.localAccountId)||n.loginHint&&!this.matchLoginHintFromTokenClaims(e,n.loginHint)||n.username&&!this.matchUsername(e.preferred_username,n.username)||n.name&&!this.matchName(e,n.name)||n.sid&&!this.matchSid(e,n.sid)))}async saveCacheRecord(e,n,r){var i;if(!e)throw we(eB);try{e.account&&await this.setAccount(e.account,n),e.idToken&&(r==null?void 0:r.idToken)!==!1&&await this.setIdTokenCredential(e.idToken,n),e.accessToken&&(r==null?void 0:r.accessToken)!==!1&&await this.saveAccessToken(e.accessToken,n),e.refreshToken&&(r==null?void 0:r.refreshToken)!==!1&&await this.setRefreshTokenCredential(e.refreshToken,n),e.appMetadata&&this.setAppMetadata(e.appMetadata,n)}catch(o){throw(i=this.commonLogger)==null||i.error("CacheManager.saveCacheRecord: failed"),o instanceof _n?o:rA(o)}}async saveAccessToken(e,n){const r={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},i=this.getTokenKeys(),o=Ar.fromString(e.target);i.accessToken.forEach(s=>{if(!this.accessTokenKeyMatchesFilter(s,r,!1))return;const c=this.getAccessTokenCredential(s,n);c&&this.credentialMatchesFilter(c,r)&&Ar.fromString(c.target).intersectingScopeSets(o)&&this.removeAccessToken(s,n)}),await this.setAccessTokenCredential(e,n)}getAccountsFilteredBy(e,n){const r=this.getAccountKeys(),i=[];return r.forEach(o=>{var u;const s=this.getAccount(o,n);if(!s||e.homeAccountId&&!this.matchHomeAccountId(s,e.homeAccountId)||e.username&&!this.matchUsername(s.username,e.username)||e.environment&&!this.matchEnvironment(s,e.environment)||e.realm&&!this.matchRealm(s,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(s,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(s,e.authorityType))return;const c={localAccountId:e==null?void 0:e.localAccountId,name:e==null?void 0:e.name},l=(u=s.tenantProfiles)==null?void 0:u.filter(d=>this.tenantProfileMatchesFilter(d,c));l&&l.length===0||i.push(s)}),i}credentialMatchesFilter(e,n){return!(n.clientId&&!this.matchClientId(e,n.clientId)||n.userAssertionHash&&!this.matchUserAssertionHash(e,n.userAssertionHash)||typeof n.homeAccountId=="string"&&!this.matchHomeAccountId(e,n.homeAccountId)||n.environment&&!this.matchEnvironment(e,n.environment)||n.realm&&!this.matchRealm(e,n.realm)||n.credentialType&&!this.matchCredentialType(e,n.credentialType)||n.familyId&&!this.matchFamilyId(e,n.familyId)||n.target&&!this.matchTarget(e,n.target)||(n.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==n.requestedClaimsHash||e.credentialType===Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(n.tokenType&&!this.matchTokenType(e,n.tokenType)||n.tokenType===vn.SSH&&n.keyId&&!this.matchKeyId(e,n.keyId)))}getAppMetadataFilteredBy(e){const n=this.getKeys(),r={};return n.forEach(i=>{if(!this.isAppMetadata(i))return;const o=this.getAppMetadata(i);o&&(e.environment&&!this.matchEnvironment(o,e.environment)||e.clientId&&!this.matchClientId(o,e.clientId)||(r[i]=o))}),r}getAuthorityMetadataByAlias(e){const n=this.getAuthorityMetadataKeys();let r=null;return n.forEach(i=>{if(!this.isAuthorityMetadata(i)||i.indexOf(this.clientId)===-1)return;const o=this.getAuthorityMetadata(i);o&&o.aliases.indexOf(e)!==-1&&(r=o)}),r}removeAllAccounts(e){this.getAllAccounts({},e).forEach(r=>{this.removeAccount(r,e)})}removeAccount(e,n){this.removeAccountContext(e,n);const r=this.getAccountKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.filter(i).forEach(o=>{this.removeItem(o,n),this.performanceClient.incrementFields({accountsRemoved:1},n)})}removeAccountContext(e,n){const r=this.getTokenKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.idToken.filter(i).forEach(o=>{this.removeIdToken(o,n)}),r.accessToken.filter(i).forEach(o=>{this.removeAccessToken(o,n)}),r.refreshToken.filter(i).forEach(o=>{this.removeRefreshToken(o,n)})}removeAccessToken(e,n){const r=this.getAccessTokenCredential(e,n);if(this.removeItem(e,n),this.performanceClient.incrementFields({accessTokensRemoved:1},n),!r||r.credentialType.toLowerCase()!==Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||r.tokenType!==vn.POP)return;const i=r.keyId;i&&this.cryptoImpl.removeTokenBindingKey(i).catch(()=>{var o;this.commonLogger.error(`Failed to remove token binding key ${i}`,n),(o=this.performanceClient)==null||o.incrementFields({removeTokenBindingKeyFailure:1},n)})}removeAppMetadata(e){return this.getKeys().forEach(r=>{this.isAppMetadata(r)&&this.removeItem(r,e)}),!0}getIdToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getIdToken called");const s={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Hr.ID_TOKEN,clientId:this.clientId,realm:i},c=this.getIdTokensByFilter(s,n,r),l=c.size;if(l<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(l>1){let u=c;if(!i){const d=new Map;c.forEach((h,p)=>{h.realm===e.tenantId&&d.set(p,h)});const f=d.size;if(f<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),c.values().next().value;if(f===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),d.values().next().value;u=d}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),u.forEach((d,f)=>{this.removeIdToken(f,n)}),o&&n&&o.addFields({multiMatchedID:c.size},n),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),c.values().next().value}getIdTokensByFilter(e,n,r){const i=r&&r.idToken||this.getTokenKeys().idToken,o=new Map;return i.forEach(s=>{if(!this.idTokenKeyMatchesFilter(s,{clientId:this.clientId,...e}))return;const c=this.getIdTokenCredential(s,n);c&&this.credentialMatchesFilter(c,e)&&o.set(s,c)}),o}idTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}removeIdToken(e,n){this.removeItem(e,n)}removeRefreshToken(e,n){this.removeItem(e,n)}getAccessToken(e,n,r,i){const o=n.correlationId;this.commonLogger.trace("CacheManager - getAccessToken called",o);const s=Ar.createSearchScopes(n.scopes),c=n.authenticationScheme||vn.BEARER,l=c&&c.toLowerCase()!==vn.BEARER.toLowerCase()?Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME:Hr.ACCESS_TOKEN,u={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:l,clientId:this.clientId,realm:i||e.tenantId,target:s,tokenType:c,keyId:n.sshKid,requestedClaimsHash:n.requestedClaimsHash},d=r&&r.accessToken||this.getTokenKeys().accessToken,f=[];d.forEach(p=>{if(this.accessTokenKeyMatchesFilter(p,u,!0)){const g=this.getAccessTokenCredential(p,o);g&&this.credentialMatchesFilter(g,u)&&f.push(g)}});const h=f.length;return h<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found",o),null):h>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them",o),f.forEach(p=>{this.removeAccessToken(this.generateCredentialKey(p),o)}),this.performanceClient.addFields({multiMatchedAT:f.length},o),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token",o),f[0])}accessTokenKeyMatchesFilter(e,n,r){const i=e.toLowerCase();if(n.clientId&&i.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&i.indexOf(n.homeAccountId.toLowerCase())===-1||n.realm&&i.indexOf(n.realm.toLowerCase())===-1||n.requestedClaimsHash&&i.indexOf(n.requestedClaimsHash.toLowerCase())===-1)return!1;if(n.target){const o=n.target.asArray();for(let s=0;s{if(!this.accessTokenKeyMatchesFilter(o,e,!0))return;const s=this.getAccessTokenCredential(o,n);s&&this.credentialMatchesFilter(s,e)&&i.push(s)}),i}getRefreshToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getRefreshToken called");const s=n?Yy:void 0,c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Hr.REFRESH_TOKEN,clientId:this.clientId,familyId:s},l=i&&i.refreshToken||this.getTokenKeys().refreshToken,u=[];l.forEach(f=>{if(this.refreshTokenKeyMatchesFilter(f,c)){const h=this.getRefreshTokenCredential(f,r);h&&this.credentialMatchesFilter(h,c)&&u.push(h)}});const d=u.length;return d<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(d>1&&o&&r&&o.addFields({multiMatchedRT:d},r),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),u[0])}refreshTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.familyId&&r.indexOf(n.familyId.toLowerCase())===-1||!n.familyId&&n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const n={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(n),i=Object.keys(r).map(s=>r[s]),o=i.length;if(o<1)return null;if(o>1)throw we(Q5);return i[0]}isAppMetadataFOCI(e){const n=this.readAppMetadataFromCache(e);return!!(n&&n.familyId===Yy)}matchHomeAccountId(e,n){return typeof e.homeAccountId=="string"&&n===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,n){const r=e.oid||e.sub;return n===r}matchLocalAccountIdFromTenantProfile(e,n){return e.localAccountId===n}matchName(e,n){var r;return n.toLowerCase()===((r=e.name)==null?void 0:r.toLowerCase())}matchUsername(e,n){return!!(e&&typeof e=="string"&&(n==null?void 0:n.toLowerCase())===e.toLowerCase())}matchUserAssertionHash(e,n){return!!(e.userAssertionHash&&n===e.userAssertionHash)}matchEnvironment(e,n){if(this.staticAuthorityOptions){const i=gte(this.staticAuthorityOptions,this.commonLogger);if(i.includes(n)&&i.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(n);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,n){return e.credentialType&&n.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,n){return!!(e.clientId&&n===e.clientId)}matchFamilyId(e,n){return!!(e.familyId&&n===e.familyId)}matchRealm(e,n){var r;return((r=e.realm)==null?void 0:r.toLowerCase())===n.toLowerCase()}matchNativeAccountId(e,n){return!!(e.nativeAccountId&&n===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,n){return e.login_hint===n||e.preferred_username===n||e.upn===n}matchSid(e,n){return e.sid===n}matchAuthorityType(e,n){return!!(e.authorityType&&n.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,n){return e.credentialType!==Hr.ACCESS_TOKEN&&e.credentialType!==Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:Ar.fromString(e.target).containsScopeSet(n)}matchTokenType(e,n){return!!(e.tokenType&&e.tokenType===n)}matchKeyId(e,n){return!!(e.keyId&&e.keyId===n)}isAppMetadata(e){return e.indexOf(GE)!==-1}isAuthorityMetadata(e){return e.indexOf(Qy.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${Qy.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,n){for(const r in n)e[r]=n[r];return e}}class yte extends iA{async setAccount(){throw we(Vt)}getAccount(){throw we(Vt)}async setIdTokenCredential(){throw we(Vt)}getIdTokenCredential(){throw we(Vt)}async setAccessTokenCredential(){throw we(Vt)}getAccessTokenCredential(){throw we(Vt)}async setRefreshTokenCredential(){throw we(Vt)}getRefreshTokenCredential(){throw we(Vt)}setAppMetadata(){throw we(Vt)}getAppMetadata(){throw we(Vt)}setServerTelemetry(){throw we(Vt)}getServerTelemetry(){throw we(Vt)}setAuthorityMetadata(){throw we(Vt)}getAuthorityMetadata(){throw we(Vt)}getAuthorityMetadataKeys(){throw we(Vt)}setThrottlingCache(){throw we(Vt)}getThrottlingCache(){throw we(Vt)}removeItem(){throw we(Vt)}getKeys(){throw we(Vt)}getAccountKeys(){throw we(Vt)}getTokenKeys(){throw we(Vt)}generateCredentialKey(){throw we(Vt)}generateAccountKey(){throw we(Vt)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Di={AAD:"AAD",OIDC:"OIDC",EAR:"EAR"};/*! @azure/msal-common v15.10.0 2025-08-05 */const K={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",InitializeCache:"initializeCache",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",GetAuthCodeUrl:"getAuthCodeUrl",GetStandardParams:"getStandardParams",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",HandleResponseEar:"handleResponseEar",HandleResponsePlatformBroker:"handleResponsePlatformBroker",HandleResponseCode:"handleResponseCode",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",ImportExistingCache:"importExistingCache",SetUserData:"setUserData",LocalStorageUpdated:"localStorageUpdated",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues",GenerateHKDF:"generateHKDF",GenerateBaseKey:"generateBaseKey",Base64Decode:"base64Decode",UrlEncodeArr:"urlEncodeArr",Encrypt:"encrypt",Decrypt:"decrypt",GenerateEarKey:"generateEarKey",DecryptEarResponse:"decryptEarResponse"},xte={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v15.10.0 2025-08-05 */class SI{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class _B{generateId(){return"callback-id"}startMeasurement(e,n){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:xte.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:n||""},measurement:new SI}}startPerformanceMeasurement(){return new SI}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-common v15.10.0 2025-08-05 */const AB={tokenRenewalOffsetSeconds:U5,preventCorsPreflight:!1},bte={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:Mn.Info,correlationId:pe.EMPTY_STRING},wte={claimsBasedCachingEnabled:!1},Ste={async sendGetRequestAsync(){throw we(Vt)},async sendPostRequestAsync(){throw we(Vt)}},Cte={sku:pe.SKU,version:JE,cpu:pe.EMPTY_STRING,os:pe.EMPTY_STRING},_te={clientSecret:pe.EMPTY_STRING,clientAssertion:void 0},Ate={azureCloudInstance:ZE.None,tenant:`${pe.DEFAULT_COMMON_TENANT}`},jte={application:{appName:"",appVersion:""}};function Ete({authOptions:t,systemOptions:e,loggerOptions:n,cacheOptions:r,storageInterface:i,networkInterface:o,cryptoInterface:s,clientCredentials:c,libraryInfo:l,telemetry:u,serverTelemetryManager:d,persistencePlugin:f,serializableCache:h}){const p={...bte,...n};return{authOptions:Tte(t),systemOptions:{...AB,...e},loggerOptions:p,cacheOptions:{...wte,...r},storageInterface:i||new yte(t.clientId,Jy,new Da(p),new _B),networkInterface:o||Ste,cryptoInterface:s||Jy,clientCredentials:c||_te,libraryInfo:{...Cte,...l},telemetry:{...jte,...u},serverTelemetryManager:d||null,persistencePlugin:f||null,serializableCache:h||null}}function Tte(t){return{clientCapabilities:[],azureCloudOptions:Ate,skipAuthorityMetadataCache:!1,instanceAware:!1,encodeExtraQueryParams:!1,...t}}function jB(t){return t.authOptions.authority.options.protocolMode===Di.OIDC}/*! @azure/msal-common v15.10.0 2025-08-05 */const Wo={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v15.10.0 2025-08-05 */function nx(t,e){if(!t)throw we(H5);try{const n=e(t);return JSON.parse(n)}catch{throw we(VE)}}function Cd(t){if(!t)throw we(VE);const e=t.split(Qp.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?pe.EMPTY_STRING:e[1]}}/*! @azure/msal-common v15.10.0 2025-08-05 */const fu="client_id",EB="redirect_uri",Nte="response_type",Pte="response_mode",kte="grant_type",Ote="claims",Ite="scope",Rte="refresh_token",Mte="state",Dte="nonce",$te="prompt",Lte="code",Fte="code_challenge",Bte="code_challenge_method",Ute="code_verifier",Hte="client-request-id",zte="x-client-SKU",Gte="x-client-VER",Vte="x-client-OS",Kte="x-client-CPU",Wte="x-client-current-telemetry",qte="x-client-last-telemetry",Yte="x-ms-lib-capability",Qte="x-app-name",Xte="x-app-ver",Jte="post_logout_redirect_uri",Zte="id_token_hint",ene="client_secret",tne="client_assertion",nne="client_assertion_type",TB="token_type",NB="req_cnf",CI="return_spa_code",rne="nativebroker",ine="logout_hint",one="sid",sne="login_hint",ane="domain_hint",cne="x-client-xtra-sku",rx="brk_client_id",ix="brk_redirect_uri",oA="instance_aware",lne="ear_jwk",une="ear_jwe_crypto";/*! @azure/msal-common v15.10.0 2025-08-05 */function j0(t,e,n){if(!e)return;const r=t.get(fu);r&&t.has(rx)&&(n==null||n.addFields({embeddedClientId:r,embeddedRedirectUri:t.get(EB)},e))}function cT(t,e){t.set(Nte,e)}function dne(t,e){t.set(Pte,e||Wee.QUERY)}function fne(t){t.set(rne,"1")}function lT(t,e,n=!0,r=vg){n&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const i=n?[...e||[],...r]:e||[],o=new Ar(i);t.set(Ite,o.printScopes())}function uT(t,e){t.set(fu,e)}function dT(t,e){t.set(EB,e)}function hne(t,e){t.set(Jte,e)}function pne(t,e){t.set(Zte,e)}function mne(t,e){t.set(ane,e)}function dv(t,e){t.set(sne,e)}function ox(t,e){t.set(di.CCS_HEADER,`UPN:${e}`)}function lp(t,e){t.set(di.CCS_HEADER,`Oid:${e.uid}@${e.utid}`)}function _I(t,e){t.set(one,e)}function fT(t,e,n){const r=wne(e,n);try{JSON.parse(r)}catch{throw jn(eT)}t.set(Ote,r)}function hT(t,e){t.set(Hte,e)}function pT(t,e){t.set(zte,e.sku),t.set(Gte,e.version),e.os&&t.set(Vte,e.os),e.cpu&&t.set(Kte,e.cpu)}function mT(t,e){e!=null&&e.appName&&t.set(Qte,e.appName),e!=null&&e.appVersion&&t.set(Xte,e.appVersion)}function gne(t,e){t.set($te,e)}function PB(t,e){e&&t.set(Mte,e)}function vne(t,e){t.set(Dte,e)}function kB(t,e,n){if(e&&n)t.set(Fte,e),t.set(Bte,n);else throw jn(tT)}function yne(t,e){t.set(Lte,e)}function xne(t,e){t.set(Rte,e)}function bne(t,e){t.set(Ute,e)}function OB(t,e){t.set(ene,e)}function IB(t,e){e&&t.set(tne,e)}function RB(t,e){e&&t.set(nne,e)}function MB(t,e){t.set(kte,e)}function gT(t){t.set(qee,"1")}function DB(t){t.has(oA)||t.set(oA,"true")}function Mc(t,e){Object.entries(e).forEach(([n,r])=>{!t.has(n)&&r&&t.set(n,r)})}function wne(t,e){let n;if(!t)n={};else try{n=JSON.parse(t)}catch{throw jn(eT)}return e&&e.length>0&&(n.hasOwnProperty(lv.ACCESS_TOKEN)||(n[lv.ACCESS_TOKEN]={}),n[lv.ACCESS_TOKEN][lv.XMS_CC]={values:e}),JSON.stringify(n)}function vT(t,e){e&&(t.set(TB,vn.POP),t.set(NB,e))}function $B(t,e){e&&(t.set(TB,vn.SSH),t.set(NB,e))}function LB(t,e){t.set(Wte,e.generateCurrentRequestHeaderValue()),t.set(qte,e.generateLastRequestHeaderValue())}function FB(t){t.set(Yte,cp.X_MS_LIB_CAPABILITY_VALUE)}function Sne(t,e){t.set(ine,e)}function E0(t,e,n){t.has(rx)||t.set(rx,e),t.has(ix)||t.set(ix,n)}function Cne(t,e){t.set(lne,encodeURIComponent(e)),t.set(une,"eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0")}function _ne(t,e){Object.entries(e).forEach(([n,r])=>{r&&t.set(n,r)})}/*! @azure/msal-common v15.10.0 2025-08-05 */const Uo={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v15.10.0 2025-08-05 */function Ane(t){return t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")}/*! @azure/msal-common v15.10.0 2025-08-05 */function jne(t){return t.hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata")}/*! @azure/msal-common v15.10.0 2025-08-05 */function Ene(t){return t.hasOwnProperty("error")&&t.hasOwnProperty("error_description")}/*! @azure/msal-common v15.10.0 2025-08-05 */const Zi=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const c=e+"CallCount";r==null||r.incrementFields({[c]:1},i)}try{const c=t(...o);return s==null||s.end({success:!0}),n.trace(`Returning result from ${e}`),c}catch(c){n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(c))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},c),c}},fe=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const c=e+"CallCount";r==null||r.incrementFields({[c]:1},i)}return r==null||r.setPreQueueTime(e,i),t(...o).then(c=>(n.trace(`Returning result from ${e}`),s==null||s.end({success:!0}),c)).catch(c=>{n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(c))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},c),c})};/*! @azure/msal-common v15.10.0 2025-08-05 */class T0{constructor(e,n,r,i){this.networkInterface=e,this.logger=n,this.performanceClient=r,this.correlationId=i}async detectRegion(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)n.region_source=$u.ENVIRONMENT_VARIABLE;else{const o=T0.IMDS_OPTIONS;try{const s=await fe(this.getRegionFromIMDS.bind(this),K.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(pe.IMDS_VERSION,o);if(s.status===wc.SUCCESS&&(r=s.body,n.region_source=$u.IMDS),s.status===wc.BAD_REQUEST){const c=await fe(this.getCurrentVersion.bind(this),K.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(o);if(!c)return n.region_source=$u.FAILED_AUTO_DETECTION,null;const l=await fe(this.getRegionFromIMDS.bind(this),K.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(c,o);l.status===wc.SUCCESS&&(r=l.body,n.region_source=$u.IMDS)}}catch{return n.region_source=$u.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=$u.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,n){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(K.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${pe.IMDS_ENDPOINT}?api-version=${e}&format=text`,n,pe.IMDS_TIMEOUT)}async getCurrentVersion(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(K.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${pe.IMDS_ENDPOINT}?format=json`,e);return r.status===wc.BAD_REQUEST&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}T0.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v15.10.0 2025-08-05 */function $i(){return Math.round(new Date().getTime()/1e3)}function AI(t){return t.getTime()/1e3}function _d(t){return t?new Date(Number(t)*1e3):new Date}function sx(t,e){const n=Number(t)||0;return $i()+e>n}function Tne(t,e){const n=Number(t)+e*24*60*60*1e3;return Date.now()>n}function Nne(t){return Number(t)>$i()}/*! @azure/msal-common v15.10.0 2025-08-05 */function N0(t,e,n,r,i){return{credentialType:Hr.ID_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function P0(t,e,n,r,i,o,s,c,l,u,d,f,h,p,g){var y,b;const m={homeAccountId:t,credentialType:Hr.ACCESS_TOKEN,secret:n,cachedAt:$i().toString(),expiresOn:s.toString(),extendedExpiresOn:c.toString(),environment:e,clientId:r,realm:i,target:o,tokenType:d||vn.BEARER,lastUpdatedAt:Date.now().toString()};if(f&&(m.userAssertionHash=f),u&&(m.refreshOn=u.toString()),p&&(m.requestedClaims=p,m.requestedClaimsHash=g),((y=m.tokenType)==null?void 0:y.toLowerCase())!==vn.BEARER.toLowerCase())switch(m.credentialType=Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case vn.POP:const x=Hf(n,l);if(!((b=x==null?void 0:x.cnf)!=null&&b.kid))throw we(tB);m.keyId=x.cnf.kid;break;case vn.SSH:m.keyId=h}return m}function BB(t,e,n,r,i,o,s){const c={credentialType:Hr.REFRESH_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,lastUpdatedAt:Date.now().toString()};return o&&(c.userAssertionHash=o),i&&(c.familyId=i),s&&(c.expiresOn=s.toString()),c}function yT(t){return t.hasOwnProperty("homeAccountId")&&t.hasOwnProperty("environment")&&t.hasOwnProperty("credentialType")&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("secret")}function jI(t){return t?yT(t)&&t.hasOwnProperty("realm")&&t.hasOwnProperty("target")&&(t.credentialType===Hr.ACCESS_TOKEN||t.credentialType===Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function Pne(t){return t?yT(t)&&t.hasOwnProperty("realm")&&t.credentialType===Hr.ID_TOKEN:!1}function EI(t){return t?yT(t)&&t.credentialType===Hr.REFRESH_TOKEN:!1}function kne(t,e){const n=t.indexOf(Lr.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),n&&r}function One(t,e){let n=!1;t&&(n=t.indexOf(cp.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),n&&r}function Ine({environment:t,clientId:e}){return[GE,t,e].join(Qp.CACHE_KEY_SEPARATOR).toLowerCase()}function Rne(t,e){return e?t.indexOf(GE)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function Mne(t,e){return e?t.indexOf(Qy.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function TI(){return $i()+Qy.REFRESH_TIME_SECONDS}function fv(t,e,n){t.authorization_endpoint=e.authorization_endpoint,t.token_endpoint=e.token_endpoint,t.end_session_endpoint=e.end_session_endpoint,t.issuer=e.issuer,t.endpointsFromNetwork=n,t.jwks_uri=e.jwks_uri}function FS(t,e,n){t.aliases=e.aliases,t.preferred_cache=e.preferred_cache,t.preferred_network=e.preferred_network,t.aliasesFromNetwork=n}function NI(t){return t.expiresAt<=$i()}/*! @azure/msal-common v15.10.0 2025-08-05 */class Zr{constructor(e,n,r,i,o,s,c,l){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=n,this.cacheManager=r,this.authorityOptions=i,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=o,this.performanceClient=c,this.correlationId=s,this.managedIdentity=l||!1,this.regionDiscovery=new T0(n,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(pe.CIAM_AUTH_URL))return Uo.Ciam;const n=e.PathSegments;if(n.length)switch(n[0].toLowerCase()){case pe.ADFS:return Uo.Adfs;case pe.DSTS:return Uo.Dsts}return Uo.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new en(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw we(da)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw we(da)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw we(da)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw we(iB);return this.replacePath(this.metadata.end_session_endpoint)}else throw we(da)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw we(da)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw we(da)}canReplaceTenant(e){return e.PathSegments.length===1&&!Zr.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===Uo.Default&&this.protocolMode!==Di.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let n=e;const i=new en(this.metadata.canonical_authority).getUrlComponents(),o=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((c,l)=>{let u=o[l];if(l===0&&this.canReplaceTenant(i)){const d=new en(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];u!==d&&(this.logger.verbose(`Replacing tenant domain name ${u} with id ${d}`),u=d)}c!==u&&(n=n.replace(`/${u}/`,`/${c}/`))}),this.replaceTenant(n)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===Uo.Adfs||this.protocolMode===Di.OIDC&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),n=await fe(this.updateCloudDiscoveryMetadata.bind(this),K.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await fe(this.updateEndpointMetadata.bind(this),K.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,n,{source:r}),(o=this.performanceClient)==null||o.addFields({cloudDiscoverySource:n,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:TI(),jwks_uri:""}),e}updateCachedMetadata(e,n,r){n!==Ui.CACHE&&(r==null?void 0:r.source)!==Ui.CACHE&&(e.expiresAt=TI(),e.canonical_authority=this.canonicalAuthority);const i=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(i,e),this.metadata=e}async updateEndpointMetadata(e){var i,o,s;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityUpdateEndpointMetadata,this.correlationId);const n=this.updateEndpointMetadataFromLocalSources(e);if(n){if(n.source===Ui.HARDCODED_VALUES&&(o=this.authorityOptions.azureRegionConfiguration)!=null&&o.azureRegion&&n.metadata){const c=await fe(this.updateMetadataWithRegionalInformation.bind(this),K.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(n.metadata);fv(e,c,!1),e.canonical_authority=this.canonicalAuthority}return n.source}let r=await fe(this.getEndpointMetadataFromNetwork.bind(this),K.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(s=this.authorityOptions.azureRegionConfiguration)!=null&&s.azureRegion&&(r=await fe(this.updateMetadataWithRegionalInformation.bind(this),K.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),fv(e,r,!0),Ui.NETWORK;throw we(V5,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const n=this.getEndpointMetadataFromConfig();if(n)return this.logger.verbose("Found endpoint metadata in authority configuration"),fv(e,n,!1),{source:Ui.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const i=this.getEndpointMetadataFromHardcodedValues();if(i)return fv(e,i,!1),{source:Ui.HARDCODED_VALUES,metadata:i};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=NI(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:Ui.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new en(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw jn(fB)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(K.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},n=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${n}`);try{const i=await this.networkInterface.sendGetRequestAsync(n,e);return Ane(i.body)?i.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(i){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${i}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in bI?bI[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(K.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const n=(i=this.authorityOptions.azureRegionConfiguration)==null?void 0:i.azureRegion;if(n){if(n!==pe.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=$S.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,Zr.replaceWithRegionalInformation(e,n);const s=await fe(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),K.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)((o=this.authorityOptions.azureRegionConfiguration)==null?void 0:o.environmentRegion,this.regionDiscoveryMetadata);if(s)return this.regionDiscoveryMetadata.region_outcome=$S.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=s,Zr.replaceWithRegionalInformation(e,s);this.regionDiscoveryMetadata.region_outcome=$S.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const n=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(n)return n;const r=await fe(this.getCloudDiscoveryMetadataFromNetwork.bind(this),K.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return FS(e,r,!0),Ui.NETWORK;throw jn(hB)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||pe.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||pe.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||pe.NOT_APPLICABLE}`);const n=this.getCloudDiscoveryMetadataFromConfig();if(n)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),FS(e,n,!1),Ui.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const i=vte(this.hostnameAndPort);if(i)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),FS(e,i,!1),Ui.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=NI(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),Ui.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===Uo.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),n=ex(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),n)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),n;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),jn(nT)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${pe.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,n={};let r=null;try{const o=await this.networkInterface.sendGetRequestAsync(e,n);let s,c;if(jne(o.body))s=o.body,c=s.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${s.tenant_discovery_endpoint}`);else if(Ene(o.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${o.status}`),s=o.body,s.error===pe.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${s.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${s.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),c=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=ex(c,this.hostnameAndPort)}catch(o){if(o instanceof _n)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata. +`+o):r.stack=o}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=du(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Zv.assertOptions(r,{silentJSONParsing:ys.transitional(ys.boolean),forcedJSONParsing:ys.transitional(ys.boolean),clarifyTimeoutError:ys.transitional(ys.boolean)},!1),i!=null&&(ie.isFunction(i)?n.paramsSerializer={serialize:i}:Zv.assertOptions(i,{encode:ys.function,serialize:ys.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Zv.assertOptions(n,{baseUrl:ys.spelling("baseURL"),withXsrfToken:ys.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&ie.merge(o.common,o[n.method]);o&&ie.forEach(["delete","get","head","post","put","patch","common"],g=>{delete o[g]}),n.headers=Mi.concat(s,o);const c=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(l=l&&m.synchronous,c.unshift(m.fulfilled,m.rejected))});const u=[];this.interceptors.response.forEach(function(m){u.push(m.fulfilled,m.rejected)});let d,f=0,h;if(!l){const g=[fI.bind(this),void 0];for(g.unshift.apply(g,c),g.push.apply(g,u),h=g.length,d=Promise.resolve(n);f{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const s=new Promise(c=>{r.subscribe(c),o=c}).then(i);return s.cancel=function(){r.unsubscribe(o)},s},e(function(o,s,c){r.reason||(r.reason=new Uf(o,s,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new HE(function(i){e=i}),cancel:e}}}function Gee(t){return function(n){return t.apply(null,n)}}function Vee(t){return ie.isObject(t)&&t.isAxiosError===!0}const Q_={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Q_).forEach(([t,e])=>{Q_[e]=t});function L5(t){const e=new ql(t),n=m5(ql.prototype.request,e);return ie.extend(n,ql.prototype,e,{allOwnKeys:!0}),ie.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return L5(du(t,i))},n}const mr=L5(gg);mr.Axios=ql;mr.CanceledError=Uf;mr.CancelToken=HE;mr.isCancel=P5;mr.VERSION=$5;mr.toFormData=w0;mr.AxiosError=$t;mr.Cancel=mr.CanceledError;mr.all=function(e){return Promise.all(e)};mr.spread=Gee;mr.isAxiosError=Vee;mr.mergeConfig=du;mr.AxiosHeaders=Mi;mr.formToJSON=t=>N5(ie.isHTMLForm(t)?new FormData(t):t);mr.getAdapter=D5.getAdapter;mr.HttpStatusCode=Q_;mr.default=mr;const F5="https://ai-sandbox.oliver.solutions/semblance_back/api",$e=mr.create({baseURL:F5,headers:{"Content-Type":"application/json"},timeout:6e5});$e.interceptors.request.use(t=>{var n,r;const e=localStorage.getItem("auth_token");return e&&(t.headers.Authorization=`Bearer ${e}`),t.method==="put"&&((n=t.url)!=null&&n.includes("/focus-groups/"))&&console.log("🌐 API Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),(r=t.url)!=null&&r.includes("/folders/")&&console.log("🌐 API Folder Request:",{method:t.method,url:t.url,baseURL:t.baseURL,fullURL:`${t.baseURL}${t.url}`,data:t.data}),t},t=>Promise.reject(t));const X_="auth_error",Kee=t=>{t!=null&&t.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const e=new CustomEvent(X_,{detail:t||{}});window.dispatchEvent(e)};$e.interceptors.response.use(t=>t,t=>{var e,n,r,i,o,s;if(t.response&&t.response.status===401){const c=t.config&&(((e=t.config.url)==null?void 0:e.includes("/personas"))||((n=t.config.url)==null?void 0:n.includes("/personas/batch"))||t.config.method&&((r=t.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(i=t.config)==null?void 0:i.url,method:(o=t.config)==null?void 0:o.method,isPersonaRequest:c}),c?console.warn("Authentication error in persona request, letting component handle it"):Kee({source:(s=t.config)==null?void 0:s.url,isPersonaCreation:!1})}return Promise.reject(t)});const ey={login:(t,e)=>$e.post("/auth/login",{username:t,password:e}),loginWithMicrosoft:t=>$e.post("/auth/microsoft",{id_token:t}),register:(t,e,n)=>$e.post("/auth/register",{username:t,email:e,password:n}),getProfile:()=>$e.get("/auth/me")},zr={getAll:()=>$e.get("/personas/all"),getById:t=>$e.get(`/personas/${t}`),create:t=>$e.post("/personas",t),update:(t,e)=>t&&t.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",t),$e.post("/personas",e)):$e.put(`/personas/${t}`,e),delete:t=>{const e=typeof t=="object"&&t!==null&&t._id||t;return console.log(`Deleting persona with ID: ${e}`),$e.delete(`/personas/${e}`)},createBatch:t=>$e.post("/personas/batch",t)},ua={generate:t=>$e.post("/ai-personas/generate",t||{},{timeout:6e5}),generateAndSave:t=>$e.post("/ai-personas/generate-and-save",t||{},{timeout:6e5}),batchGenerate:t=>$e.post("/ai-personas/batch-generate",t,{timeout:6e5}),batchGenerateAndSave:t=>$e.post("/ai-personas/batch-generate-and-save",t,{timeout:6e5}),generateBasicProfiles:(t,e=5,n=.8)=>$e.post("/ai-personas/generate-basic-profiles",{audience_brief:t,count:e,temperature:n},{timeout:6e5}),completePersona:(t,e=.7)=>$e.post("/ai-personas/complete-persona",{basic_profile:t,temperature:e},{timeout:6e5}),completeAndSavePersona:(t,e=.7)=>$e.post("/ai-personas/complete-and-save-persona",{basic_profile:t,temperature:e},{timeout:6e5}),generatePersonaSummary:(t,e=.7)=>$e.post("/ai-personas/generate-persona-summary",{persona_data:t,temperature:e},{timeout:6e5}),batchGenerateWithStages:async(t,e,n=5,r=.7,i,o)=>{var s;try{console.log(`📡 API call to generate-basic-profiles with model: ${o||"gemini-2.5-pro"}`);const l=(await $e.post("/ai-personas/generate-basic-profiles",{audience_brief:t,research_objective:e,count:n,temperature:.7,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`📡 API call to complete-and-save-persona with model: ${o||"gemini-2.5-pro"}`);const h=l.map(g=>$e.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5}));if((await Promise.allSettled(h)).forEach((g,m)=>{if(g.status==="fulfilled")u.push(g.value.data.persona),d.push(g.value.data.persona_id);else{const y=l[m],b={index:m,name:y.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${y.name||"unnamed"}):`,g.reason)}}),u.length===0&&f.length>0)throw new Error(`Failed to generate any personas. ${f.length} profile(s) failed.`);return{data:{message:`Generated and saved ${u.length} personas${f.length>0?` (${f.length} failed)`:""}`,personas:u,persona_ids:d,errors:f.length>0?f:void 0,partial_success:f.length>0&&u.length>0}}}catch(c){throw((s=c.response)==null?void 0:s.status)===504||c.code==="ECONNABORTED"?new Error("Timeout error: The server took too long to generate personas. Please try with fewer personas or try again later."):c}},enhanceAudienceBrief:(t,e,n=.7)=>$e.post("/ai-personas/enhance-audience-brief",{audience_brief:t,research_objective:e,temperature:n},{timeout:6e5}),batchGenerateSummaries:(t,e=.7,n)=>(console.log(`📡 Frontend: API call to batch-generate-summaries with model: ${n||"gemini-2.5-pro"}`),$e.post("/ai-personas/batch-generate-summaries",{persona_ids:t,temperature:e,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:t=>{const e=new FormData;for(let n=0;n$e.delete(`/ai-personas/cleanup-customer-data/${t}`)},Ot={getAll:()=>$e.get("/focus-groups"),getById:t=>$e.get(`/focus-groups/${t}`),create:t=>$e.post("/focus-groups",t),update:(t,e)=>$e.put(`/focus-groups/${t}`,e),delete:t=>$e.delete(`/focus-groups/${t}`),addParticipant:(t,e)=>$e.post(`/focus-groups/${t}/participants`,{persona_id:e}),removeParticipant:(t,e)=>$e.delete(`/focus-groups/${t}/participants/${e}`),sendMessage:(t,e)=>$e.post(`/focus-groups/${t}/messages`,e),getMessages:t=>$e.get(`/focus-groups/${t}/messages`),updateMessageHighlight:(t,e,n)=>$e.patch(`/focus-groups/${t}/messages/${e}`,{highlighted:n}),describeAsset:(t,e)=>$e.post(`/focus-groups/${t}/describe-asset`,{asset_filename:e},{timeout:12e4}),generateDiscussionGuide:t=>$e.post("/focus-groups/generate-discussion-guide",t,{timeout:6e5}),generateDiscussionGuideForGroup:(t,e)=>$e.post(`/focus-groups/${t}/generate-discussion-guide`,e,{timeout:6e5}),downloadDiscussionGuide:async t=>{try{const e=await $e.get(`/focus-groups/${t}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=e.headers["content-disposition"];let r="discussion-guide.md";if(n){const c=n.match(/filename="([^"]+)"/);c&&(r=c[1])}const i=new Blob([e.data],{type:"text/markdown"}),o=URL.createObjectURL(i),s=document.createElement("a");return s.href=o,s.download=r,s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o),{success:!0,filename:r}}catch(e){throw console.error("Error downloading discussion guide:",e),new Error("Failed to download discussion guide")}},createNote:(t,e)=>$e.post(`/focus-groups/${t}/notes`,e),getNotes:t=>$e.get(`/focus-groups/${t}/notes`),deleteNote:(t,e)=>$e.delete(`/focus-groups/${t}/notes/${e}`),uploadAssets:(t,e,n)=>(n===!0&&e.append("replace","true"),$e.post(`/focus-groups/${t}/assets`,e,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4})),getAssets:t=>$e.get(`/focus-groups/${t}/assets`),getAssetUrl:(t,e)=>`${F5}/focus-groups/${t}/assets/${e}`,deleteAsset:(t,e)=>$e.delete(`/focus-groups/${t}/assets/${e}`)},Xn={generateResponse:(t,e,n,r=.7)=>$e.post("/focus-group-ai/generate-response",{focus_group_id:t,persona_id:e,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(t,e=.7)=>$e.post("/focus-group-ai/generate-key-themes",{focus_group_id:t,temperature:e},{timeout:6e5}),getKeyThemes:t=>$e.get(`/focus-group-ai/key-themes/${t}`),deleteKeyTheme:(t,e)=>$e.delete(`/focus-group-ai/key-themes/${t}/${e}`),getModeratorStatus:t=>$e.get(`/focus-group-ai/moderator/status/${t}`),advanceModeratorDiscussion:t=>$e.post(`/focus-group-ai/moderator/advance/${t}`,{},{timeout:6e5}),setModeratorPosition:(t,e,n)=>$e.put(`/focus-group-ai/moderator/position/${t}`,{section_id:e,item_id:n}),startAutonomousConversation:(t,e)=>$e.post(`/focus-group-ai/autonomous/start/${t}`,{initial_prompt:e},{timeout:6e5}),stopAutonomousConversation:(t,e)=>$e.post(`/focus-group-ai/autonomous/stop/${t}`,{reason:e}),getAutonomousConversationStatus:t=>$e.get(`/focus-group-ai/autonomous/status/${t}`),getConversationState:t=>$e.get(`/focus-group-ai/conversation/state/${t}`),getConversationAnalytics:t=>$e.get(`/focus-group-ai/conversation/analytics/${t}`),makeConversationDecision:(t,e=.7,n="ai")=>$e.post(`/focus-group-ai/conversation/decision/${t}`,{temperature:e,mode:n},{timeout:6e5}),getConversationInsights:t=>$e.get(`/focus-group-ai/conversation/insights/${t}`,{timeout:6e5}),manualIntervention:(t,e,n,r)=>$e.post(`/focus-group-ai/conversation/intervene/${t}`,{action:e,message:n,participant_id:r}),getReasoningHistory:t=>$e.get(`/focus-group-ai/conversation/reasoning-history/${t}`),endSession:(t,e)=>$e.post(`/focus-group-ai/moderator/end-session/${t}`,{reason:e||"session_ended"})},js={getAll:()=>$e.get("/folders"),getById:t=>$e.get(`/folders/${t}`),create:t=>$e.post("/folders",t),update:(t,e)=>$e.put(`/folders/${t}`,e),delete:t=>$e.delete(`/folders/${t}`),addPersona:(t,e)=>$e.post(`/folders/${t}/personas`,{persona_id:e}),removePersona:(t,e)=>$e.delete(`/folders/${t}/personas/${e}`),addPersonasBatch:(t,e)=>$e.post(`/folders/${t}/personas/batch`,{persona_ids:e}),removePersonasBatch:(t,e)=>(console.log(`🌐 API removePersonasBatch: Sending POST to /folders/${t}/personas/remove-batch with persona_ids:`,e),$e.post(`/folders/${t}/personas/remove-batch`,{persona_ids:e})),addPersonaToMultipleFolders:(t,e)=>{const n=e.map(r=>$e.post(`/folders/${r}/personas`,{persona_id:t}));return Promise.all(n)},removePersonaFromAllFolders:t=>{throw new Error("Use removePersona for specific folders")}};/*! @azure/msal-common v15.10.0 2025-08-05 */const pe={LIBRARY_NAME:"MSAL.JS",SKU:"msal.js.common",DEFAULT_AUTHORITY:"https://login.microsoftonline.com/common/",DEFAULT_AUTHORITY_HOST:"login.microsoftonline.com",DEFAULT_COMMON_TENANT:"common",ADFS:"adfs",DSTS:"dstsv2",AAD_INSTANCE_DISCOVERY_ENDPT:"https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",CIAM_AUTH_URL:".ciamlogin.com",AAD_TENANT_DOMAIN_SUFFIX:".onmicrosoft.com",RESOURCE_DELIM:"|",NO_ACCOUNT:"NO_ACCOUNT",CLAIMS:"claims",CONSUMER_UTID:"9188040d-6c67-4c5b-b112-36a304b66dad",OPENID_SCOPE:"openid",PROFILE_SCOPE:"profile",OFFLINE_ACCESS_SCOPE:"offline_access",EMAIL_SCOPE:"email",CODE_GRANT_TYPE:"authorization_code",RT_GRANT_TYPE:"refresh_token",S256_CODE_CHALLENGE_METHOD:"S256",URL_FORM_CONTENT_TYPE:"application/x-www-form-urlencoded;charset=utf-8",AUTHORIZATION_PENDING:"authorization_pending",NOT_DEFINED:"not_defined",EMPTY_STRING:"",NOT_APPLICABLE:"N/A",NOT_AVAILABLE:"Not Available",FORWARD_SLASH:"/",IMDS_ENDPOINT:"http://169.254.169.254/metadata/instance/compute/location",IMDS_VERSION:"2020-06-01",IMDS_TIMEOUT:2e3,AZURE_REGION_AUTO_DISCOVER_FLAG:"TryAutoDetect",REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX:"login.microsoft.com",KNOWN_PUBLIC_CLOUDS:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"],SHR_NONCE_VALIDITY:240,INVALID_INSTANCE:"invalid_instance"},wc={SUCCESS:200,SUCCESS_RANGE_START:200,SUCCESS_RANGE_END:299,REDIRECT:302,CLIENT_ERROR:400,CLIENT_ERROR_RANGE_START:400,BAD_REQUEST:400,UNAUTHORIZED:401,NOT_FOUND:404,REQUEST_TIMEOUT:408,GONE:410,TOO_MANY_REQUESTS:429,CLIENT_ERROR_RANGE_END:499,SERVER_ERROR:500,SERVER_ERROR_RANGE_START:500,SERVICE_UNAVAILABLE:503,GATEWAY_TIMEOUT:504,SERVER_ERROR_RANGE_END:599,MULTI_SIDED_ERROR:600},Ol={GET:"GET",POST:"POST"},vg=[pe.OPENID_SCOPE,pe.PROFILE_SCOPE,pe.OFFLINE_ACCESS_SCOPE],pI=[...vg,pe.EMAIL_SCOPE],di={CONTENT_TYPE:"Content-Type",CONTENT_LENGTH:"Content-Length",RETRY_AFTER:"Retry-After",CCS_HEADER:"X-AnchorMailbox",WWWAuthenticate:"WWW-Authenticate",AuthenticationInfo:"Authentication-Info",X_MS_REQUEST_ID:"x-ms-request-id",X_MS_HTTP_VERSION:"x-ms-httpver"},mI={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},Ic={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},lv={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},pi={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},zE={CODE:"code",IDTOKEN_TOKEN:"id_token token",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},_0={QUERY:"query",FRAGMENT:"fragment"},Wee={QUERY:"query",FRAGMENT:"fragment",FORM_POST:"form_post"},B5={IMPLICIT_GRANT:"implicit",AUTHORIZATION_CODE_GRANT:"authorization_code",CLIENT_CREDENTIALS_GRANT:"client_credentials",RESOURCE_OWNER_PASSWORD_GRANT:"password",REFRESH_TOKEN_GRANT:"refresh_token",DEVICE_CODE_GRANT:"device_code",JWT_BEARER:"urn:ietf:params:oauth:grant-type:jwt-bearer"},uv={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},Qp={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},Hr={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},GE="appmetadata",qee="client_info",Yy="1",Qy={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},Ui={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},Lr={SCHEMA_VERSION:5,MAX_LAST_HEADER_BYTES:330,MAX_CACHED_ERRORS:50,CACHE_KEY:"server-telemetry",CATEGORY_SEPARATOR:"|",VALUE_SEPARATOR:",",OVERFLOW_TRUE:"1",OVERFLOW_FALSE:"0",UNKNOWN_ERROR:"unknown_error"},yn={BEARER:"Bearer",POP:"pop",SSH:"ssh-cert"},cp={DEFAULT_THROTTLE_TIME_SECONDS:60,DEFAULT_MAX_THROTTLE_TIME_SECONDS:3600,THROTTLING_PREFIX:"throttling",X_MS_LIB_CAPABILITY_VALUE:"retry-after, h429"},gI={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},$u={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},$S={CONFIGURED_NO_AUTO_DETECTION:"2",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},Cl={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},Yee={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},U5=300;/*! @azure/msal-common v15.10.0 2025-08-05 */const Xy="unexpected_error",Qee="post_request_failed";/*! @azure/msal-common v15.10.0 2025-08-05 */const vI={[Xy]:"Unexpected error in authentication.",[Qee]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class _n extends Error{constructor(e,n,r){const i=n?`${e}: ${n}`:e;super(i),Object.setPrototypeOf(this,_n.prototype),this.errorCode=e||pe.EMPTY_STRING,this.errorMessage=n||pe.EMPTY_STRING,this.subError=r||pe.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function J_(t,e){return new _n(t,e?`${vI[t]} ${e}`:vI[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */const VE="client_info_decoding_error",H5="client_info_empty_error",KE="token_parsing_error",z5="null_or_empty_token",da="endpoints_resolution_error",G5="network_error",V5="openid_config_error",K5="hash_not_deserialized",Xd="invalid_state",W5="state_mismatch",Z_="state_not_found",q5="nonce_mismatch",WE="auth_time_not_found",Y5="max_age_transpired",Xee="multiple_matching_tokens",Jee="multiple_matching_accounts",Q5="multiple_matching_appMetadata",X5="request_cannot_be_made",J5="cannot_remove_empty_scope",Z5="cannot_append_scopeset",eA="empty_input_scopeset",Zee="device_code_polling_cancelled",ete="device_code_expired",tte="device_code_unknown_error",qE="no_account_in_silent_request",eB="invalid_cache_record",YE="invalid_cache_environment",tA="no_account_found",nA="no_crypto_object",nte="unexpected_credential_type",rte="invalid_assertion",ite="invalid_client_credential",Rc="token_refresh_required",ote="user_timeout_reached",tB="token_claims_cnf_required_for_signedjwt",nB="authorization_code_missing_from_server_response",rB="binding_key_not_removed",iB="end_session_endpoint_not_supported",QE="key_id_missing",ste="no_network_connectivity",ate="user_canceled",cte="missing_tenant_id_error",Kt="method_not_implemented",lte="nested_app_auth_bridge_disabled";/*! @azure/msal-common v15.10.0 2025-08-05 */const yI={[VE]:"The client info could not be parsed/decoded correctly",[H5]:"The client info was empty",[KE]:"Token cannot be parsed",[z5]:"The token is null or empty",[da]:"Endpoints cannot be resolved",[G5]:"Network request failed",[V5]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[K5]:"The hash parameters could not be deserialized",[Xd]:"State was not the expected format",[W5]:"State mismatch error",[Z_]:"State not found",[q5]:"Nonce mismatch error",[WE]:"Max Age was requested and the ID token is missing the auth_time variable. auth_time is an optional claim and is not enabled by default - it must be enabled. See https://aka.ms/msaljs/optional-claims for more information.",[Y5]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[Xee]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[Jee]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[Q5]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[X5]:"Token request cannot be made without authorization code or refresh token.",[J5]:"Cannot remove null or empty scope from ScopeSet",[Z5]:"Cannot append ScopeSet",[eA]:"Empty input ScopeSet cannot be processed",[Zee]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[ete]:"Device code is expired.",[tte]:"Device code stopped polling for unknown reasons.",[qE]:"Please pass an account object, silent flow is not supported without account information",[eB]:"Cache record object was null or undefined.",[YE]:"Invalid environment when attempting to create cache entry",[tA]:"No account found in cache for given key.",[nA]:"No crypto object detected.",[nte]:"Unexpected credential type.",[rte]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[ite]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[Rc]:"Cannot return token from cache because it must be refreshed. This may be due to one of the following reasons: forceRefresh parameter is set to true, claims have been requested, there is no cached access token or it is expired.",[ote]:"User defined timeout for device code polling reached",[tB]:"Cannot generate a POP jwt if the token_claims are not populated",[nB]:"Server response does not contain an authorization code to proceed",[rB]:"Could not remove the credential's binding key from storage.",[iB]:"The provided authority does not support logout",[QE]:"A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key.",[ste]:"No network connectivity. Check your internet connection.",[ate]:"User cancelled the flow.",[cte]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Kt]:"This method has not been implemented",[lte]:"The nested app auth bridge is disabled"};class XE extends _n{constructor(e,n){super(e,n?`${yI[e]}: ${n}`:yI[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,XE.prototype)}}function we(t,e){return new XE(t,e)}/*! @azure/msal-common v15.10.0 2025-08-05 */const Jy={createNewGuid:()=>{throw we(Kt)},base64Decode:()=>{throw we(Kt)},base64Encode:()=>{throw we(Kt)},base64UrlEncode:()=>{throw we(Kt)},encodeKid:()=>{throw we(Kt)},async getPublicKeyThumbprint(){throw we(Kt)},async removeTokenBindingKey(){throw we(Kt)},async clearKeystore(){throw we(Kt)},async signJwt(){throw we(Kt)},async hashString(){throw we(Kt)}};/*! @azure/msal-common v15.10.0 2025-08-05 */var Dn;(function(t){t[t.Error=0]="Error",t[t.Warning=1]="Warning",t[t.Info=2]="Info",t[t.Verbose=3]="Verbose",t[t.Trace=4]="Trace"})(Dn||(Dn={}));class Da{constructor(e,n,r){this.level=Dn.Info;const i=()=>{},o=e||Da.createDefaultLoggerOptions();this.localCallback=o.loggerCallback||i,this.piiLoggingEnabled=o.piiLoggingEnabled||!1,this.level=typeof o.logLevel=="number"?o.logLevel:Dn.Info,this.correlationId=o.correlationId||pe.EMPTY_STRING,this.packageName=n||pe.EMPTY_STRING,this.packageVersion=r||pe.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:Dn.Info}}clone(e,n,r){return new Da({loggerCallback:this.localCallback,piiLoggingEnabled:this.piiLoggingEnabled,logLevel:this.level,correlationId:r||this.correlationId},e,n)}logMessage(e,n){if(n.logLevel>this.level||!this.piiLoggingEnabled&&n.containsPii)return;const o=`${`[${new Date().toUTCString()}] : [${n.correlationId||this.correlationId||""}]`} : ${this.packageName}@${this.packageVersion} : ${Dn[n.logLevel]} - ${e}`;this.executeCallback(n.logLevel,o,n.containsPii||!1)}executeCallback(e,n,r){this.localCallback&&this.localCallback(e,n,r)}error(e,n){this.logMessage(e,{logLevel:Dn.Error,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}errorPii(e,n){this.logMessage(e,{logLevel:Dn.Error,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}warning(e,n){this.logMessage(e,{logLevel:Dn.Warning,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}warningPii(e,n){this.logMessage(e,{logLevel:Dn.Warning,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}info(e,n){this.logMessage(e,{logLevel:Dn.Info,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}infoPii(e,n){this.logMessage(e,{logLevel:Dn.Info,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}verbose(e,n){this.logMessage(e,{logLevel:Dn.Verbose,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}verbosePii(e,n){this.logMessage(e,{logLevel:Dn.Verbose,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}trace(e,n){this.logMessage(e,{logLevel:Dn.Trace,containsPii:!1,correlationId:n||pe.EMPTY_STRING})}tracePii(e,n){this.logMessage(e,{logLevel:Dn.Trace,containsPii:!0,correlationId:n||pe.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v15.10.0 2025-08-05 */const oB="@azure/msal-common",JE="15.10.0";/*! @azure/msal-common v15.10.0 2025-08-05 */const ZE={None:"none",AzurePublic:"https://login.microsoftonline.com",AzurePpe:"https://login.windows-ppe.net",AzureChina:"https://login.chinacloudapi.cn",AzureGermany:"https://login.microsoftonline.de",AzureUsGovernment:"https://login.microsoftonline.us"};/*! @azure/msal-common v15.10.0 2025-08-05 */const sB="redirect_uri_empty",ute="claims_request_parsing_error",aB="authority_uri_insecure",Gh="url_parse_error",cB="empty_url_error",lB="empty_input_scopes_error",eT="invalid_claims",uB="token_request_empty",dB="logout_request_empty",dte="invalid_code_challenge_method",tT="pkce_params_missing",nT="invalid_cloud_discovery_metadata",fB="invalid_authority_metadata",hB="untrusted_authority",A0="missing_ssh_jwk",pB="missing_ssh_kid",fte="missing_nonce_authentication_header",hte="invalid_authentication_header",mB="cannot_set_OIDCOptions",gB="cannot_allow_platform_broker",vB="authority_mismatch",yB="invalid_request_method_for_EAR",xB="invalid_authorize_post_body_parameters";/*! @azure/msal-common v15.10.0 2025-08-05 */const pte={[sB]:"A redirect URI is required for all calls, and none has been set.",[ute]:"Could not parse the given claims request object.",[aB]:"Authority URIs must use https. Please see here for valid authority configuration options: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-js-initializing-client-applications#configuration-options",[Gh]:"URL could not be parsed into appropriate segments.",[cB]:"URL was empty or null.",[lB]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[eT]:"Given claims parameter must be a stringified JSON object.",[uB]:"Token request was empty and not found in cache.",[dB]:"The logout request was null or undefined.",[dte]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[tT]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[nT]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[fB]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[hB]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[A0]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[pB]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[fte]:"Unable to find an authentication header containing server nonce. Either the Authentication-Info or WWW-Authenticate headers must be present in order to obtain a server nonce.",[hte]:"Invalid authentication header provided",[mB]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[gB]:"Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",[vB]:"Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority.",[xB]:"Invalid authorize post body parameters provided. If you are using authorizePostBodyParameters, the request method must be POST. Please check the request method and parameters.",[yB]:"Invalid request method for EAR protocol mode. The request method cannot be GET when using EAR protocol mode. Please change the request method to POST."};class rT extends _n{constructor(e){super(e,pte[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,rT.prototype)}}function jn(t){return new rT(t)}/*! @azure/msal-common v15.10.0 2025-08-05 */class $s{static isEmptyObj(e){if(e)try{const n=JSON.parse(e);return Object.keys(n).length===0}catch{}return!0}static startsWith(e,n){return e.indexOf(n)===0}static endsWith(e,n){return e.length>=n.length&&e.lastIndexOf(n)===e.length-n.length}static queryStringToObject(e){const n={},r=e.split("&"),i=o=>decodeURIComponent(o.replace(/\+/g," "));return r.forEach(o=>{if(o.trim()){const[s,c]=o.split(/=(.+)/g,2);s&&c&&(n[i(s)]=i(c))}}),n}static trimArrayEntries(e){return e.map(n=>n.trim())}static removeEmptyStringsFromArray(e){return e.filter(n=>!!n)}static jsonParseHelper(e){try{return JSON.parse(e)}catch{return null}}static matchPattern(e,n){return new RegExp(e.replace(/\\/g,"\\\\").replace(/\*/g,"[^ ]*").replace(/\?/g,"\\?")).test(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ar{constructor(e){const n=e?$s.trimArrayEntries([...e]):[],r=n?$s.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw jn(lB);this.scopes=new Set,r.forEach(i=>this.scopes.add(i))}static fromString(e){const r=(e||pe.EMPTY_STRING).split(" ");return new Ar(r)}static createSearchScopes(e){const n=new Ar(e);return n.containsOnlyOIDCScopes()?n.removeScope(pe.OFFLINE_ACCESS_SCOPE):n.removeOIDCScopes(),n}containsScope(e){const n=this.printScopesLowerCase().split(" "),r=new Ar(n);return e?r.scopes.has(e.toLowerCase()):!1}containsScopeSet(e){return!e||e.scopes.size<=0?!1:this.scopes.size>=e.scopes.size&&e.asArray().every(n=>this.containsScope(n))}containsOnlyOIDCScopes(){let e=0;return pI.forEach(n=>{this.containsScope(n)&&(e+=1)}),this.scopes.size===e}appendScope(e){e&&this.scopes.add(e.trim())}appendScopes(e){try{e.forEach(n=>this.appendScope(n))}catch{throw we(Z5)}}removeScope(e){if(!e)throw we(J5);this.scopes.delete(e.trim())}removeOIDCScopes(){pI.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw we(eA);const n=new Set;return e.scopes.forEach(r=>n.add(r.toLowerCase())),this.scopes.forEach(r=>n.add(r.toLowerCase())),n}intersectingScopeSets(e){if(!e)throw we(eA);e.containsOnlyOIDCScopes()||e.removeOIDCScopes();const n=this.unionScopeSets(e),r=e.getScopeCount(),i=this.getScopeCount();return n.sizee.push(n)),e}printScopes(){return this.scopes?this.asArray().join(" "):pe.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v15.10.0 2025-08-05 */function xI(t,e){return!!t&&!!e&&t===e.split(".")[1]}function iT(t,e,n,r){if(r){const{oid:i,sub:o,tid:s,name:c,tfp:l,acr:u,preferred_username:d,upn:f,login_hint:h}=r,p=s||l||u||"";return{tenantId:p,localAccountId:i||o||"",name:c,username:d||f||"",loginHint:h,isHomeTenant:xI(p,t)}}else return{tenantId:n,localAccountId:e,username:"",isHomeTenant:xI(n,t)}}function oT(t,e,n,r){let i=t;if(e){const{isHomeTenant:o,...s}=e;i={...t,...s}}if(n){const{isHomeTenant:o,...s}=iT(t.homeAccountId,t.localAccountId,t.tenantId,n);return i={...i,...s,idTokenClaims:n,idToken:r},i}return i}/*! @azure/msal-common v15.10.0 2025-08-05 */function Hf(t,e){const n=mte(t);try{const r=e(n);return JSON.parse(r)}catch{throw we(KE)}}function mte(t){if(!t)throw we(z5);const n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);if(!n||n.length<4)throw we(KE);return n[2]}function bB(t,e){if(e===0||Date.now()-3e5>t+e)throw we(Y5)}/*! @azure/msal-common v15.10.0 2025-08-05 */function wB(t){return t.startsWith("#/")?t.substring(2):t.startsWith("#")||t.startsWith("?")?t.substring(1):t}function Zy(t){if(!t||t.indexOf("=")<0)return null;try{const e=wB(t),n=Object.fromEntries(new URLSearchParams(e));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw we(K5)}return null}function Xp(t,e=!0,n){const r=new Array;return t.forEach((i,o)=>{!e&&n&&o in n?r.push(`${o}=${i}`):r.push(`${o}=${encodeURIComponent(i)}`)}),r.join("&")}/*! @azure/msal-common v15.10.0 2025-08-05 */class tn{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw jn(cB);e.includes("#")||(this._urlString=tn.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let n=e.toLowerCase();return $s.endsWith(n,"?")?n=n.slice(0,-1):$s.endsWith(n,"?/")&&(n=n.slice(0,-2)),$s.endsWith(n,"/")||(n+="/"),n}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw jn(Gh)}if(!e.HostNameAndPort||!e.PathSegments)throw jn(Gh);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw jn(aB)}static appendQueryString(e,n){return n?e.indexOf("?")<0?`${e}?${n}`:`${e}&${n}`:e}static removeHashFromUrl(e){return tn.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const n=this.getUrlComponents(),r=n.PathSegments;return e&&r.length!==0&&(r[0]===Ic.COMMON||r[0]===Ic.ORGANIZATIONS)&&(r[0]=e),tn.constructAuthorityUriFromObject(n)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=this.urlString.match(e);if(!n)throw jn(Gh);const r={Protocol:n[1],HostNameAndPort:n[4],AbsolutePath:n[5],QueryString:n[7]};let i=r.AbsolutePath.split("/");return i=i.filter(o=>o&&o.length>0),r.PathSegments=i,r.QueryString&&r.QueryString.endsWith("/")&&(r.QueryString=r.QueryString.substring(0,r.QueryString.length-1)),r}static getDomainFromUrl(e){const n=RegExp("^([^:/?#]+://)?([^/?#]*)"),r=e.match(n);if(!r)throw jn(Gh);return r[2]}static getAbsoluteUrl(e,n){if(e[0]===pe.FORWARD_SLASH){const i=new tn(n).getUrlComponents();return i.Protocol+"//"+i.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new tn(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!Zy(e)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const SB={endpointMetadata:{"login.microsoftonline.com":{token_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.com/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout"},"login.chinacloudapi.cn":{token_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",issuer:"https://login.partner.microsoftonline.cn/{tenantid}/v2.0",authorization_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout"},"login.microsoftonline.us":{token_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",jwks_uri:"https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",issuer:"https://login.microsoftonline.us/{tenantid}/v2.0",authorization_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",end_session_endpoint:"https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout"}},instanceDiscoveryMetadata:{metadata:[{preferred_network:"login.microsoftonline.com",preferred_cache:"login.windows.net",aliases:["login.microsoftonline.com","login.windows.net","login.microsoft.com","sts.windows.net"]},{preferred_network:"login.partner.microsoftonline.cn",preferred_cache:"login.partner.microsoftonline.cn",aliases:["login.partner.microsoftonline.cn","login.chinacloudapi.cn"]},{preferred_network:"login.microsoftonline.de",preferred_cache:"login.microsoftonline.de",aliases:["login.microsoftonline.de"]},{preferred_network:"login.microsoftonline.us",preferred_cache:"login.microsoftonline.us",aliases:["login.microsoftonline.us","login.usgovcloudapi.net"]},{preferred_network:"login-us.microsoftonline.com",preferred_cache:"login-us.microsoftonline.com",aliases:["login-us.microsoftonline.com"]}]}},bI=SB.endpointMetadata,sT=SB.instanceDiscoveryMetadata,CB=new Set;sT.metadata.forEach(t=>{t.aliases.forEach(e=>{CB.add(e)})});function gte(t,e){var i;let n;const r=t.canonicalAuthority;if(r){const o=new tn(r).getUrlComponents().HostNameAndPort;n=wI(o,(i=t.cloudDiscoveryMetadata)==null?void 0:i.metadata,Ui.CONFIG,e)||wI(o,sT.metadata,Ui.HARDCODED_VALUES,e)||t.knownAuthorities}return n||[]}function wI(t,e,n,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${n}`),t&&e){const i=ex(e,t);if(i)return r==null||r.trace(`getAliasesFromMetadata: found cloud discovery metadata in ${n}, returning aliases`),i.aliases;r==null||r.trace(`getAliasesFromMetadata: did not find cloud discovery metadata in ${n}`)}return null}function vte(t){return ex(sT.metadata,t)}function ex(t,e){for(let n=0;n1?r.sort(o=>o.idTokenClaims?-1:1)[0]:r.length===1?r[0]:null}getBaseAccountInfo(e,n){const r=this.getAccountsFilteredBy(e,n);return r.length>0?r[0].getAccountInfo():null}buildTenantProfiles(e,n,r){return e.flatMap(i=>this.getTenantProfilesFromAccountEntity(i,n,r==null?void 0:r.tenantId,r))}getTenantedAccountInfoByFilter(e,n,r,i,o){let s=null,c;if(o&&!this.tenantProfileMatchesFilter(r,o))return null;const l=this.getIdToken(e,i,n,r.tenantId);return l&&(c=Hf(l.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(c,o))?null:(s=oT(e,r,c,l==null?void 0:l.secret),s)}getTenantProfilesFromAccountEntity(e,n,r,i){const o=e.getAccountInfo();let s=o.tenantProfiles||new Map;const c=this.getTokenKeys();if(r){const u=s.get(r);if(u)s=new Map([[r,u]]);else return[]}const l=[];return s.forEach(u=>{const d=this.getTenantedAccountInfoByFilter(o,c,u,n,i);d&&l.push(d)}),l}tenantProfileMatchesFilter(e,n){return!(n.localAccountId&&!this.matchLocalAccountIdFromTenantProfile(e,n.localAccountId)||n.name&&e.name!==n.name||n.isHomeTenant!==void 0&&e.isHomeTenant!==n.isHomeTenant)}idTokenClaimsMatchTenantProfileFilter(e,n){return!(n&&(n.localAccountId&&!this.matchLocalAccountIdFromTokenClaims(e,n.localAccountId)||n.loginHint&&!this.matchLoginHintFromTokenClaims(e,n.loginHint)||n.username&&!this.matchUsername(e.preferred_username,n.username)||n.name&&!this.matchName(e,n.name)||n.sid&&!this.matchSid(e,n.sid)))}async saveCacheRecord(e,n,r){var i;if(!e)throw we(eB);try{e.account&&await this.setAccount(e.account,n),e.idToken&&(r==null?void 0:r.idToken)!==!1&&await this.setIdTokenCredential(e.idToken,n),e.accessToken&&(r==null?void 0:r.accessToken)!==!1&&await this.saveAccessToken(e.accessToken,n),e.refreshToken&&(r==null?void 0:r.refreshToken)!==!1&&await this.setRefreshTokenCredential(e.refreshToken,n),e.appMetadata&&this.setAppMetadata(e.appMetadata,n)}catch(o){throw(i=this.commonLogger)==null||i.error("CacheManager.saveCacheRecord: failed"),o instanceof _n?o:rA(o)}}async saveAccessToken(e,n){const r={clientId:e.clientId,credentialType:e.credentialType,environment:e.environment,homeAccountId:e.homeAccountId,realm:e.realm,tokenType:e.tokenType,requestedClaimsHash:e.requestedClaimsHash},i=this.getTokenKeys(),o=Ar.fromString(e.target);i.accessToken.forEach(s=>{if(!this.accessTokenKeyMatchesFilter(s,r,!1))return;const c=this.getAccessTokenCredential(s,n);c&&this.credentialMatchesFilter(c,r)&&Ar.fromString(c.target).intersectingScopeSets(o)&&this.removeAccessToken(s,n)}),await this.setAccessTokenCredential(e,n)}getAccountsFilteredBy(e,n){const r=this.getAccountKeys(),i=[];return r.forEach(o=>{var u;const s=this.getAccount(o,n);if(!s||e.homeAccountId&&!this.matchHomeAccountId(s,e.homeAccountId)||e.username&&!this.matchUsername(s.username,e.username)||e.environment&&!this.matchEnvironment(s,e.environment)||e.realm&&!this.matchRealm(s,e.realm)||e.nativeAccountId&&!this.matchNativeAccountId(s,e.nativeAccountId)||e.authorityType&&!this.matchAuthorityType(s,e.authorityType))return;const c={localAccountId:e==null?void 0:e.localAccountId,name:e==null?void 0:e.name},l=(u=s.tenantProfiles)==null?void 0:u.filter(d=>this.tenantProfileMatchesFilter(d,c));l&&l.length===0||i.push(s)}),i}credentialMatchesFilter(e,n){return!(n.clientId&&!this.matchClientId(e,n.clientId)||n.userAssertionHash&&!this.matchUserAssertionHash(e,n.userAssertionHash)||typeof n.homeAccountId=="string"&&!this.matchHomeAccountId(e,n.homeAccountId)||n.environment&&!this.matchEnvironment(e,n.environment)||n.realm&&!this.matchRealm(e,n.realm)||n.credentialType&&!this.matchCredentialType(e,n.credentialType)||n.familyId&&!this.matchFamilyId(e,n.familyId)||n.target&&!this.matchTarget(e,n.target)||(n.requestedClaimsHash||e.requestedClaimsHash)&&e.requestedClaimsHash!==n.requestedClaimsHash||e.credentialType===Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(n.tokenType&&!this.matchTokenType(e,n.tokenType)||n.tokenType===yn.SSH&&n.keyId&&!this.matchKeyId(e,n.keyId)))}getAppMetadataFilteredBy(e){const n=this.getKeys(),r={};return n.forEach(i=>{if(!this.isAppMetadata(i))return;const o=this.getAppMetadata(i);o&&(e.environment&&!this.matchEnvironment(o,e.environment)||e.clientId&&!this.matchClientId(o,e.clientId)||(r[i]=o))}),r}getAuthorityMetadataByAlias(e){const n=this.getAuthorityMetadataKeys();let r=null;return n.forEach(i=>{if(!this.isAuthorityMetadata(i)||i.indexOf(this.clientId)===-1)return;const o=this.getAuthorityMetadata(i);o&&o.aliases.indexOf(e)!==-1&&(r=o)}),r}removeAllAccounts(e){this.getAllAccounts({},e).forEach(r=>{this.removeAccount(r,e)})}removeAccount(e,n){this.removeAccountContext(e,n);const r=this.getAccountKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.filter(i).forEach(o=>{this.removeItem(o,n),this.performanceClient.incrementFields({accountsRemoved:1},n)})}removeAccountContext(e,n){const r=this.getTokenKeys(),i=o=>o.includes(e.homeAccountId)&&o.includes(e.environment);r.idToken.filter(i).forEach(o=>{this.removeIdToken(o,n)}),r.accessToken.filter(i).forEach(o=>{this.removeAccessToken(o,n)}),r.refreshToken.filter(i).forEach(o=>{this.removeRefreshToken(o,n)})}removeAccessToken(e,n){const r=this.getAccessTokenCredential(e,n);if(this.removeItem(e,n),this.performanceClient.incrementFields({accessTokensRemoved:1},n),!r||r.credentialType.toLowerCase()!==Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||r.tokenType!==yn.POP)return;const i=r.keyId;i&&this.cryptoImpl.removeTokenBindingKey(i).catch(()=>{var o;this.commonLogger.error(`Failed to remove token binding key ${i}`,n),(o=this.performanceClient)==null||o.incrementFields({removeTokenBindingKeyFailure:1},n)})}removeAppMetadata(e){return this.getKeys().forEach(r=>{this.isAppMetadata(r)&&this.removeItem(r,e)}),!0}getIdToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getIdToken called");const s={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Hr.ID_TOKEN,clientId:this.clientId,realm:i},c=this.getIdTokensByFilter(s,n,r),l=c.size;if(l<1)return this.commonLogger.info("CacheManager:getIdToken - No token found"),null;if(l>1){let u=c;if(!i){const d=new Map;c.forEach((h,p)=>{h.realm===e.tenantId&&d.set(p,h)});const f=d.size;if(f<1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result"),c.values().next().value;if(f===1)return this.commonLogger.info("CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile"),d.values().next().value;u=d}return this.commonLogger.info("CacheManager:getIdToken - Multiple matching ID tokens found, clearing them"),u.forEach((d,f)=>{this.removeIdToken(f,n)}),o&&n&&o.addFields({multiMatchedID:c.size},n),null}return this.commonLogger.info("CacheManager:getIdToken - Returning ID token"),c.values().next().value}getIdTokensByFilter(e,n,r){const i=r&&r.idToken||this.getTokenKeys().idToken,o=new Map;return i.forEach(s=>{if(!this.idTokenKeyMatchesFilter(s,{clientId:this.clientId,...e}))return;const c=this.getIdTokenCredential(s,n);c&&this.credentialMatchesFilter(c,e)&&o.set(s,c)}),o}idTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}removeIdToken(e,n){this.removeItem(e,n)}removeRefreshToken(e,n){this.removeItem(e,n)}getAccessToken(e,n,r,i){const o=n.correlationId;this.commonLogger.trace("CacheManager - getAccessToken called",o);const s=Ar.createSearchScopes(n.scopes),c=n.authenticationScheme||yn.BEARER,l=c&&c.toLowerCase()!==yn.BEARER.toLowerCase()?Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME:Hr.ACCESS_TOKEN,u={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:l,clientId:this.clientId,realm:i||e.tenantId,target:s,tokenType:c,keyId:n.sshKid,requestedClaimsHash:n.requestedClaimsHash},d=r&&r.accessToken||this.getTokenKeys().accessToken,f=[];d.forEach(p=>{if(this.accessTokenKeyMatchesFilter(p,u,!0)){const g=this.getAccessTokenCredential(p,o);g&&this.credentialMatchesFilter(g,u)&&f.push(g)}});const h=f.length;return h<1?(this.commonLogger.info("CacheManager:getAccessToken - No token found",o),null):h>1?(this.commonLogger.info("CacheManager:getAccessToken - Multiple access tokens found, clearing them",o),f.forEach(p=>{this.removeAccessToken(this.generateCredentialKey(p),o)}),this.performanceClient.addFields({multiMatchedAT:f.length},o),null):(this.commonLogger.info("CacheManager:getAccessToken - Returning access token",o),f[0])}accessTokenKeyMatchesFilter(e,n,r){const i=e.toLowerCase();if(n.clientId&&i.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&i.indexOf(n.homeAccountId.toLowerCase())===-1||n.realm&&i.indexOf(n.realm.toLowerCase())===-1||n.requestedClaimsHash&&i.indexOf(n.requestedClaimsHash.toLowerCase())===-1)return!1;if(n.target){const o=n.target.asArray();for(let s=0;s{if(!this.accessTokenKeyMatchesFilter(o,e,!0))return;const s=this.getAccessTokenCredential(o,n);s&&this.credentialMatchesFilter(s,e)&&i.push(s)}),i}getRefreshToken(e,n,r,i,o){this.commonLogger.trace("CacheManager - getRefreshToken called");const s=n?Yy:void 0,c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Hr.REFRESH_TOKEN,clientId:this.clientId,familyId:s},l=i&&i.refreshToken||this.getTokenKeys().refreshToken,u=[];l.forEach(f=>{if(this.refreshTokenKeyMatchesFilter(f,c)){const h=this.getRefreshTokenCredential(f,r);h&&this.credentialMatchesFilter(h,c)&&u.push(h)}});const d=u.length;return d<1?(this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found."),null):(d>1&&o&&r&&o.addFields({multiMatchedRT:d},r),this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token"),u[0])}refreshTokenKeyMatchesFilter(e,n){const r=e.toLowerCase();return!(n.familyId&&r.indexOf(n.familyId.toLowerCase())===-1||!n.familyId&&n.clientId&&r.indexOf(n.clientId.toLowerCase())===-1||n.homeAccountId&&r.indexOf(n.homeAccountId.toLowerCase())===-1)}readAppMetadataFromCache(e){const n={environment:e,clientId:this.clientId},r=this.getAppMetadataFilteredBy(n),i=Object.keys(r).map(s=>r[s]),o=i.length;if(o<1)return null;if(o>1)throw we(Q5);return i[0]}isAppMetadataFOCI(e){const n=this.readAppMetadataFromCache(e);return!!(n&&n.familyId===Yy)}matchHomeAccountId(e,n){return typeof e.homeAccountId=="string"&&n===e.homeAccountId}matchLocalAccountIdFromTokenClaims(e,n){const r=e.oid||e.sub;return n===r}matchLocalAccountIdFromTenantProfile(e,n){return e.localAccountId===n}matchName(e,n){var r;return n.toLowerCase()===((r=e.name)==null?void 0:r.toLowerCase())}matchUsername(e,n){return!!(e&&typeof e=="string"&&(n==null?void 0:n.toLowerCase())===e.toLowerCase())}matchUserAssertionHash(e,n){return!!(e.userAssertionHash&&n===e.userAssertionHash)}matchEnvironment(e,n){if(this.staticAuthorityOptions){const i=gte(this.staticAuthorityOptions,this.commonLogger);if(i.includes(n)&&i.includes(e.environment))return!0}const r=this.getAuthorityMetadataByAlias(n);return!!(r&&r.aliases.indexOf(e.environment)>-1)}matchCredentialType(e,n){return e.credentialType&&n.toLowerCase()===e.credentialType.toLowerCase()}matchClientId(e,n){return!!(e.clientId&&n===e.clientId)}matchFamilyId(e,n){return!!(e.familyId&&n===e.familyId)}matchRealm(e,n){var r;return((r=e.realm)==null?void 0:r.toLowerCase())===n.toLowerCase()}matchNativeAccountId(e,n){return!!(e.nativeAccountId&&n===e.nativeAccountId)}matchLoginHintFromTokenClaims(e,n){return e.login_hint===n||e.preferred_username===n||e.upn===n}matchSid(e,n){return e.sid===n}matchAuthorityType(e,n){return!!(e.authorityType&&n.toLowerCase()===e.authorityType.toLowerCase())}matchTarget(e,n){return e.credentialType!==Hr.ACCESS_TOKEN&&e.credentialType!==Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:Ar.fromString(e.target).containsScopeSet(n)}matchTokenType(e,n){return!!(e.tokenType&&e.tokenType===n)}matchKeyId(e,n){return!!(e.keyId&&e.keyId===n)}isAppMetadata(e){return e.indexOf(GE)!==-1}isAuthorityMetadata(e){return e.indexOf(Qy.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${Qy.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,n){for(const r in n)e[r]=n[r];return e}}class yte extends iA{async setAccount(){throw we(Kt)}getAccount(){throw we(Kt)}async setIdTokenCredential(){throw we(Kt)}getIdTokenCredential(){throw we(Kt)}async setAccessTokenCredential(){throw we(Kt)}getAccessTokenCredential(){throw we(Kt)}async setRefreshTokenCredential(){throw we(Kt)}getRefreshTokenCredential(){throw we(Kt)}setAppMetadata(){throw we(Kt)}getAppMetadata(){throw we(Kt)}setServerTelemetry(){throw we(Kt)}getServerTelemetry(){throw we(Kt)}setAuthorityMetadata(){throw we(Kt)}getAuthorityMetadata(){throw we(Kt)}getAuthorityMetadataKeys(){throw we(Kt)}setThrottlingCache(){throw we(Kt)}getThrottlingCache(){throw we(Kt)}removeItem(){throw we(Kt)}getKeys(){throw we(Kt)}getAccountKeys(){throw we(Kt)}getTokenKeys(){throw we(Kt)}generateCredentialKey(){throw we(Kt)}generateAccountKey(){throw we(Kt)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Di={AAD:"AAD",OIDC:"OIDC",EAR:"EAR"};/*! @azure/msal-common v15.10.0 2025-08-05 */const K={AcquireTokenByCode:"acquireTokenByCode",AcquireTokenByRefreshToken:"acquireTokenByRefreshToken",AcquireTokenSilent:"acquireTokenSilent",AcquireTokenSilentAsync:"acquireTokenSilentAsync",AcquireTokenPopup:"acquireTokenPopup",AcquireTokenPreRedirect:"acquireTokenPreRedirect",AcquireTokenRedirect:"acquireTokenRedirect",CryptoOptsGetPublicKeyThumbprint:"cryptoOptsGetPublicKeyThumbprint",CryptoOptsSignJwt:"cryptoOptsSignJwt",SilentCacheClientAcquireToken:"silentCacheClientAcquireToken",SilentIframeClientAcquireToken:"silentIframeClientAcquireToken",AwaitConcurrentIframe:"awaitConcurrentIframe",SilentRefreshClientAcquireToken:"silentRefreshClientAcquireToken",SsoSilent:"ssoSilent",StandardInteractionClientGetDiscoveredAuthority:"standardInteractionClientGetDiscoveredAuthority",FetchAccountIdWithNativeBroker:"fetchAccountIdWithNativeBroker",NativeInteractionClientAcquireToken:"nativeInteractionClientAcquireToken",BaseClientCreateTokenRequestHeaders:"baseClientCreateTokenRequestHeaders",NetworkClientSendPostRequestAsync:"networkClientSendPostRequestAsync",RefreshTokenClientExecutePostToTokenEndpoint:"refreshTokenClientExecutePostToTokenEndpoint",AuthorizationCodeClientExecutePostToTokenEndpoint:"authorizationCodeClientExecutePostToTokenEndpoint",BrokerHandhshake:"brokerHandshake",AcquireTokenByRefreshTokenInBroker:"acquireTokenByRefreshTokenInBroker",AcquireTokenByBroker:"acquireTokenByBroker",RefreshTokenClientExecuteTokenRequest:"refreshTokenClientExecuteTokenRequest",RefreshTokenClientAcquireToken:"refreshTokenClientAcquireToken",RefreshTokenClientAcquireTokenWithCachedRefreshToken:"refreshTokenClientAcquireTokenWithCachedRefreshToken",RefreshTokenClientAcquireTokenByRefreshToken:"refreshTokenClientAcquireTokenByRefreshToken",RefreshTokenClientCreateTokenRequestBody:"refreshTokenClientCreateTokenRequestBody",AcquireTokenFromCache:"acquireTokenFromCache",SilentFlowClientAcquireCachedToken:"silentFlowClientAcquireCachedToken",SilentFlowClientGenerateResultFromCacheRecord:"silentFlowClientGenerateResultFromCacheRecord",AcquireTokenBySilentIframe:"acquireTokenBySilentIframe",InitializeBaseRequest:"initializeBaseRequest",InitializeSilentRequest:"initializeSilentRequest",InitializeClientApplication:"initializeClientApplication",InitializeCache:"initializeCache",SilentIframeClientTokenHelper:"silentIframeClientTokenHelper",SilentHandlerInitiateAuthRequest:"silentHandlerInitiateAuthRequest",SilentHandlerMonitorIframeForHash:"silentHandlerMonitorIframeForHash",SilentHandlerLoadFrame:"silentHandlerLoadFrame",SilentHandlerLoadFrameSync:"silentHandlerLoadFrameSync",StandardInteractionClientCreateAuthCodeClient:"standardInteractionClientCreateAuthCodeClient",StandardInteractionClientGetClientConfiguration:"standardInteractionClientGetClientConfiguration",StandardInteractionClientInitializeAuthorizationRequest:"standardInteractionClientInitializeAuthorizationRequest",GetAuthCodeUrl:"getAuthCodeUrl",GetStandardParams:"getStandardParams",HandleCodeResponseFromServer:"handleCodeResponseFromServer",HandleCodeResponse:"handleCodeResponse",HandleResponseEar:"handleResponseEar",HandleResponsePlatformBroker:"handleResponsePlatformBroker",HandleResponseCode:"handleResponseCode",UpdateTokenEndpointAuthority:"updateTokenEndpointAuthority",AuthClientAcquireToken:"authClientAcquireToken",AuthClientExecuteTokenRequest:"authClientExecuteTokenRequest",AuthClientCreateTokenRequestBody:"authClientCreateTokenRequestBody",PopTokenGenerateCnf:"popTokenGenerateCnf",PopTokenGenerateKid:"popTokenGenerateKid",HandleServerTokenResponse:"handleServerTokenResponse",DeserializeResponse:"deserializeResponse",AuthorityFactoryCreateDiscoveredInstance:"authorityFactoryCreateDiscoveredInstance",AuthorityResolveEndpointsAsync:"authorityResolveEndpointsAsync",AuthorityResolveEndpointsFromLocalSources:"authorityResolveEndpointsFromLocalSources",AuthorityGetCloudDiscoveryMetadataFromNetwork:"authorityGetCloudDiscoveryMetadataFromNetwork",AuthorityUpdateCloudDiscoveryMetadata:"authorityUpdateCloudDiscoveryMetadata",AuthorityGetEndpointMetadataFromNetwork:"authorityGetEndpointMetadataFromNetwork",AuthorityUpdateEndpointMetadata:"authorityUpdateEndpointMetadata",AuthorityUpdateMetadataWithRegionalInformation:"authorityUpdateMetadataWithRegionalInformation",RegionDiscoveryDetectRegion:"regionDiscoveryDetectRegion",RegionDiscoveryGetRegionFromIMDS:"regionDiscoveryGetRegionFromIMDS",RegionDiscoveryGetCurrentVersion:"regionDiscoveryGetCurrentVersion",AcquireTokenByCodeAsync:"acquireTokenByCodeAsync",GetEndpointMetadataFromNetwork:"getEndpointMetadataFromNetwork",GetCloudDiscoveryMetadataFromNetworkMeasurement:"getCloudDiscoveryMetadataFromNetworkMeasurement",HandleRedirectPromiseMeasurement:"handleRedirectPromise",HandleNativeRedirectPromiseMeasurement:"handleNativeRedirectPromise",UpdateCloudDiscoveryMetadataMeasurement:"updateCloudDiscoveryMetadataMeasurement",UsernamePasswordClientAcquireToken:"usernamePasswordClientAcquireToken",NativeMessageHandlerHandshake:"nativeMessageHandlerHandshake",NativeGenerateAuthResult:"nativeGenerateAuthResult",RemoveHiddenIframe:"removeHiddenIframe",ClearTokensAndKeysWithClaims:"clearTokensAndKeysWithClaims",CacheManagerGetRefreshToken:"cacheManagerGetRefreshToken",ImportExistingCache:"importExistingCache",SetUserData:"setUserData",LocalStorageUpdated:"localStorageUpdated",GeneratePkceCodes:"generatePkceCodes",GenerateCodeVerifier:"generateCodeVerifier",GenerateCodeChallengeFromVerifier:"generateCodeChallengeFromVerifier",Sha256Digest:"sha256Digest",GetRandomValues:"getRandomValues",GenerateHKDF:"generateHKDF",GenerateBaseKey:"generateBaseKey",Base64Decode:"base64Decode",UrlEncodeArr:"urlEncodeArr",Encrypt:"encrypt",Decrypt:"decrypt",GenerateEarKey:"generateEarKey",DecryptEarResponse:"decryptEarResponse"},xte={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v15.10.0 2025-08-05 */class SI{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class _B{generateId(){return"callback-id"}startMeasurement(e,n){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:xte.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:n||""},measurement:new SI}}startPerformanceMeasurement(){return new SI}calculateQueuedTime(){return 0}addQueueMeasurement(){}setPreQueueTime(){}endMeasurement(){return null}discardMeasurements(){}removePerformanceCallback(){return!0}addPerformanceCallback(){return""}emitEvents(){}addFields(){}incrementFields(){}cacheEventByCorrelationId(){}}/*! @azure/msal-common v15.10.0 2025-08-05 */const AB={tokenRenewalOffsetSeconds:U5,preventCorsPreflight:!1},bte={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:Dn.Info,correlationId:pe.EMPTY_STRING},wte={claimsBasedCachingEnabled:!1},Ste={async sendGetRequestAsync(){throw we(Kt)},async sendPostRequestAsync(){throw we(Kt)}},Cte={sku:pe.SKU,version:JE,cpu:pe.EMPTY_STRING,os:pe.EMPTY_STRING},_te={clientSecret:pe.EMPTY_STRING,clientAssertion:void 0},Ate={azureCloudInstance:ZE.None,tenant:`${pe.DEFAULT_COMMON_TENANT}`},jte={application:{appName:"",appVersion:""}};function Ete({authOptions:t,systemOptions:e,loggerOptions:n,cacheOptions:r,storageInterface:i,networkInterface:o,cryptoInterface:s,clientCredentials:c,libraryInfo:l,telemetry:u,serverTelemetryManager:d,persistencePlugin:f,serializableCache:h}){const p={...bte,...n};return{authOptions:Tte(t),systemOptions:{...AB,...e},loggerOptions:p,cacheOptions:{...wte,...r},storageInterface:i||new yte(t.clientId,Jy,new Da(p),new _B),networkInterface:o||Ste,cryptoInterface:s||Jy,clientCredentials:c||_te,libraryInfo:{...Cte,...l},telemetry:{...jte,...u},serverTelemetryManager:d||null,persistencePlugin:f||null,serializableCache:h||null}}function Tte(t){return{clientCapabilities:[],azureCloudOptions:Ate,skipAuthorityMetadataCache:!1,instanceAware:!1,encodeExtraQueryParams:!1,...t}}function jB(t){return t.authOptions.authority.options.protocolMode===Di.OIDC}/*! @azure/msal-common v15.10.0 2025-08-05 */const Wo={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v15.10.0 2025-08-05 */function nx(t,e){if(!t)throw we(H5);try{const n=e(t);return JSON.parse(n)}catch{throw we(VE)}}function Cd(t){if(!t)throw we(VE);const e=t.split(Qp.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?pe.EMPTY_STRING:e[1]}}/*! @azure/msal-common v15.10.0 2025-08-05 */const fu="client_id",EB="redirect_uri",Nte="response_type",Pte="response_mode",kte="grant_type",Ote="claims",Ite="scope",Rte="refresh_token",Mte="state",Dte="nonce",$te="prompt",Lte="code",Fte="code_challenge",Bte="code_challenge_method",Ute="code_verifier",Hte="client-request-id",zte="x-client-SKU",Gte="x-client-VER",Vte="x-client-OS",Kte="x-client-CPU",Wte="x-client-current-telemetry",qte="x-client-last-telemetry",Yte="x-ms-lib-capability",Qte="x-app-name",Xte="x-app-ver",Jte="post_logout_redirect_uri",Zte="id_token_hint",ene="client_secret",tne="client_assertion",nne="client_assertion_type",TB="token_type",NB="req_cnf",CI="return_spa_code",rne="nativebroker",ine="logout_hint",one="sid",sne="login_hint",ane="domain_hint",cne="x-client-xtra-sku",rx="brk_client_id",ix="brk_redirect_uri",oA="instance_aware",lne="ear_jwk",une="ear_jwe_crypto";/*! @azure/msal-common v15.10.0 2025-08-05 */function j0(t,e,n){if(!e)return;const r=t.get(fu);r&&t.has(rx)&&(n==null||n.addFields({embeddedClientId:r,embeddedRedirectUri:t.get(EB)},e))}function cT(t,e){t.set(Nte,e)}function dne(t,e){t.set(Pte,e||Wee.QUERY)}function fne(t){t.set(rne,"1")}function lT(t,e,n=!0,r=vg){n&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const i=n?[...e||[],...r]:e||[],o=new Ar(i);t.set(Ite,o.printScopes())}function uT(t,e){t.set(fu,e)}function dT(t,e){t.set(EB,e)}function hne(t,e){t.set(Jte,e)}function pne(t,e){t.set(Zte,e)}function mne(t,e){t.set(ane,e)}function dv(t,e){t.set(sne,e)}function ox(t,e){t.set(di.CCS_HEADER,`UPN:${e}`)}function lp(t,e){t.set(di.CCS_HEADER,`Oid:${e.uid}@${e.utid}`)}function _I(t,e){t.set(one,e)}function fT(t,e,n){const r=wne(e,n);try{JSON.parse(r)}catch{throw jn(eT)}t.set(Ote,r)}function hT(t,e){t.set(Hte,e)}function pT(t,e){t.set(zte,e.sku),t.set(Gte,e.version),e.os&&t.set(Vte,e.os),e.cpu&&t.set(Kte,e.cpu)}function mT(t,e){e!=null&&e.appName&&t.set(Qte,e.appName),e!=null&&e.appVersion&&t.set(Xte,e.appVersion)}function gne(t,e){t.set($te,e)}function PB(t,e){e&&t.set(Mte,e)}function vne(t,e){t.set(Dte,e)}function kB(t,e,n){if(e&&n)t.set(Fte,e),t.set(Bte,n);else throw jn(tT)}function yne(t,e){t.set(Lte,e)}function xne(t,e){t.set(Rte,e)}function bne(t,e){t.set(Ute,e)}function OB(t,e){t.set(ene,e)}function IB(t,e){e&&t.set(tne,e)}function RB(t,e){e&&t.set(nne,e)}function MB(t,e){t.set(kte,e)}function gT(t){t.set(qee,"1")}function DB(t){t.has(oA)||t.set(oA,"true")}function Mc(t,e){Object.entries(e).forEach(([n,r])=>{!t.has(n)&&r&&t.set(n,r)})}function wne(t,e){let n;if(!t)n={};else try{n=JSON.parse(t)}catch{throw jn(eT)}return e&&e.length>0&&(n.hasOwnProperty(lv.ACCESS_TOKEN)||(n[lv.ACCESS_TOKEN]={}),n[lv.ACCESS_TOKEN][lv.XMS_CC]={values:e}),JSON.stringify(n)}function vT(t,e){e&&(t.set(TB,yn.POP),t.set(NB,e))}function $B(t,e){e&&(t.set(TB,yn.SSH),t.set(NB,e))}function LB(t,e){t.set(Wte,e.generateCurrentRequestHeaderValue()),t.set(qte,e.generateLastRequestHeaderValue())}function FB(t){t.set(Yte,cp.X_MS_LIB_CAPABILITY_VALUE)}function Sne(t,e){t.set(ine,e)}function E0(t,e,n){t.has(rx)||t.set(rx,e),t.has(ix)||t.set(ix,n)}function Cne(t,e){t.set(lne,encodeURIComponent(e)),t.set(une,"eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0")}function _ne(t,e){Object.entries(e).forEach(([n,r])=>{r&&t.set(n,r)})}/*! @azure/msal-common v15.10.0 2025-08-05 */const Uo={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v15.10.0 2025-08-05 */function Ane(t){return t.hasOwnProperty("authorization_endpoint")&&t.hasOwnProperty("token_endpoint")&&t.hasOwnProperty("issuer")&&t.hasOwnProperty("jwks_uri")}/*! @azure/msal-common v15.10.0 2025-08-05 */function jne(t){return t.hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata")}/*! @azure/msal-common v15.10.0 2025-08-05 */function Ene(t){return t.hasOwnProperty("error")&&t.hasOwnProperty("error_description")}/*! @azure/msal-common v15.10.0 2025-08-05 */const Zi=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const c=e+"CallCount";r==null||r.incrementFields({[c]:1},i)}try{const c=t(...o);return s==null||s.end({success:!0}),n.trace(`Returning result from ${e}`),c}catch(c){n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(c))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},c),c}},fe=(t,e,n,r,i)=>(...o)=>{n.trace(`Executing function ${e}`);const s=r==null?void 0:r.startMeasurement(e,i);if(i){const c=e+"CallCount";r==null||r.incrementFields({[c]:1},i)}return r==null||r.setPreQueueTime(e,i),t(...o).then(c=>(n.trace(`Returning result from ${e}`),s==null||s.end({success:!0}),c)).catch(c=>{n.trace(`Error occurred in ${e}`);try{n.trace(JSON.stringify(c))}catch{n.trace("Unable to print error message.")}throw s==null||s.end({success:!1},c),c})};/*! @azure/msal-common v15.10.0 2025-08-05 */class T0{constructor(e,n,r,i){this.networkInterface=e,this.logger=n,this.performanceClient=r,this.correlationId=i}async detectRegion(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)n.region_source=$u.ENVIRONMENT_VARIABLE;else{const o=T0.IMDS_OPTIONS;try{const s=await fe(this.getRegionFromIMDS.bind(this),K.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(pe.IMDS_VERSION,o);if(s.status===wc.SUCCESS&&(r=s.body,n.region_source=$u.IMDS),s.status===wc.BAD_REQUEST){const c=await fe(this.getCurrentVersion.bind(this),K.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(o);if(!c)return n.region_source=$u.FAILED_AUTO_DETECTION,null;const l=await fe(this.getRegionFromIMDS.bind(this),K.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(c,o);l.status===wc.SUCCESS&&(r=l.body,n.region_source=$u.IMDS)}}catch{return n.region_source=$u.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=$u.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,n){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(K.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${pe.IMDS_ENDPOINT}?api-version=${e}&format=text`,n,pe.IMDS_TIMEOUT)}async getCurrentVersion(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(K.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${pe.IMDS_ENDPOINT}?format=json`,e);return r.status===wc.BAD_REQUEST&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}T0.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v15.10.0 2025-08-05 */function $i(){return Math.round(new Date().getTime()/1e3)}function AI(t){return t.getTime()/1e3}function _d(t){return t?new Date(Number(t)*1e3):new Date}function sx(t,e){const n=Number(t)||0;return $i()+e>n}function Tne(t,e){const n=Number(t)+e*24*60*60*1e3;return Date.now()>n}function Nne(t){return Number(t)>$i()}/*! @azure/msal-common v15.10.0 2025-08-05 */function N0(t,e,n,r,i){return{credentialType:Hr.ID_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function P0(t,e,n,r,i,o,s,c,l,u,d,f,h,p,g){var y,b;const m={homeAccountId:t,credentialType:Hr.ACCESS_TOKEN,secret:n,cachedAt:$i().toString(),expiresOn:s.toString(),extendedExpiresOn:c.toString(),environment:e,clientId:r,realm:i,target:o,tokenType:d||yn.BEARER,lastUpdatedAt:Date.now().toString()};if(f&&(m.userAssertionHash=f),u&&(m.refreshOn=u.toString()),p&&(m.requestedClaims=p,m.requestedClaimsHash=g),((y=m.tokenType)==null?void 0:y.toLowerCase())!==yn.BEARER.toLowerCase())switch(m.credentialType=Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case yn.POP:const x=Hf(n,l);if(!((b=x==null?void 0:x.cnf)!=null&&b.kid))throw we(tB);m.keyId=x.cnf.kid;break;case yn.SSH:m.keyId=h}return m}function BB(t,e,n,r,i,o,s){const c={credentialType:Hr.REFRESH_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,lastUpdatedAt:Date.now().toString()};return o&&(c.userAssertionHash=o),i&&(c.familyId=i),s&&(c.expiresOn=s.toString()),c}function yT(t){return t.hasOwnProperty("homeAccountId")&&t.hasOwnProperty("environment")&&t.hasOwnProperty("credentialType")&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("secret")}function jI(t){return t?yT(t)&&t.hasOwnProperty("realm")&&t.hasOwnProperty("target")&&(t.credentialType===Hr.ACCESS_TOKEN||t.credentialType===Hr.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function Pne(t){return t?yT(t)&&t.hasOwnProperty("realm")&&t.credentialType===Hr.ID_TOKEN:!1}function EI(t){return t?yT(t)&&t.credentialType===Hr.REFRESH_TOKEN:!1}function kne(t,e){const n=t.indexOf(Lr.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),n&&r}function One(t,e){let n=!1;t&&(n=t.indexOf(cp.THROTTLING_PREFIX)===0);let r=!0;return e&&(r=e.hasOwnProperty("throttleTime")),n&&r}function Ine({environment:t,clientId:e}){return[GE,t,e].join(Qp.CACHE_KEY_SEPARATOR).toLowerCase()}function Rne(t,e){return e?t.indexOf(GE)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function Mne(t,e){return e?t.indexOf(Qy.CACHE_KEY)===0&&e.hasOwnProperty("aliases")&&e.hasOwnProperty("preferred_cache")&&e.hasOwnProperty("preferred_network")&&e.hasOwnProperty("canonical_authority")&&e.hasOwnProperty("authorization_endpoint")&&e.hasOwnProperty("token_endpoint")&&e.hasOwnProperty("issuer")&&e.hasOwnProperty("aliasesFromNetwork")&&e.hasOwnProperty("endpointsFromNetwork")&&e.hasOwnProperty("expiresAt")&&e.hasOwnProperty("jwks_uri"):!1}function TI(){return $i()+Qy.REFRESH_TIME_SECONDS}function fv(t,e,n){t.authorization_endpoint=e.authorization_endpoint,t.token_endpoint=e.token_endpoint,t.end_session_endpoint=e.end_session_endpoint,t.issuer=e.issuer,t.endpointsFromNetwork=n,t.jwks_uri=e.jwks_uri}function FS(t,e,n){t.aliases=e.aliases,t.preferred_cache=e.preferred_cache,t.preferred_network=e.preferred_network,t.aliasesFromNetwork=n}function NI(t){return t.expiresAt<=$i()}/*! @azure/msal-common v15.10.0 2025-08-05 */class Zr{constructor(e,n,r,i,o,s,c,l){this.canonicalAuthority=e,this._canonicalAuthority.validateAsUri(),this.networkInterface=n,this.cacheManager=r,this.authorityOptions=i,this.regionDiscoveryMetadata={region_used:void 0,region_source:void 0,region_outcome:void 0},this.logger=o,this.performanceClient=c,this.correlationId=s,this.managedIdentity=l||!1,this.regionDiscovery=new T0(n,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(pe.CIAM_AUTH_URL))return Uo.Ciam;const n=e.PathSegments;if(n.length)switch(n[0].toLowerCase()){case pe.ADFS:return Uo.Adfs;case pe.DSTS:return Uo.Dsts}return Uo.Default}get authorityType(){return this.getAuthorityType(this.canonicalAuthorityUrlComponents)}get protocolMode(){return this.authorityOptions.protocolMode}get options(){return this.authorityOptions}get canonicalAuthority(){return this._canonicalAuthority.urlString}set canonicalAuthority(e){this._canonicalAuthority=new tn(e),this._canonicalAuthority.validateAsUri(),this._canonicalAuthorityUrlComponents=null}get canonicalAuthorityUrlComponents(){return this._canonicalAuthorityUrlComponents||(this._canonicalAuthorityUrlComponents=this._canonicalAuthority.getUrlComponents()),this._canonicalAuthorityUrlComponents}get hostnameAndPort(){return this.canonicalAuthorityUrlComponents.HostNameAndPort.toLowerCase()}get tenant(){return this.canonicalAuthorityUrlComponents.PathSegments[0]}get authorizationEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.authorization_endpoint);throw we(da)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw we(da)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw we(da)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw we(iB);return this.replacePath(this.metadata.end_session_endpoint)}else throw we(da)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw we(da)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw we(da)}canReplaceTenant(e){return e.PathSegments.length===1&&!Zr.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===Uo.Default&&this.protocolMode!==Di.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let n=e;const i=new tn(this.metadata.canonical_authority).getUrlComponents(),o=i.PathSegments;return this.canonicalAuthorityUrlComponents.PathSegments.forEach((c,l)=>{let u=o[l];if(l===0&&this.canReplaceTenant(i)){const d=new tn(this.metadata.authorization_endpoint).getUrlComponents().PathSegments[0];u!==d&&(this.logger.verbose(`Replacing tenant domain name ${u} with id ${d}`),u=d)}c!==u&&(n=n.replace(`/${u}/`,`/${c}/`))}),this.replaceTenant(n)}get defaultOpenIdConfigurationEndpoint(){const e=this.hostnameAndPort;return this.canonicalAuthority.endsWith("v2.0/")||this.authorityType===Uo.Adfs||this.protocolMode===Di.OIDC&&!this.isAliasOfKnownMicrosoftAuthority(e)?`${this.canonicalAuthority}.well-known/openid-configuration`:`${this.canonicalAuthority}v2.0/.well-known/openid-configuration`}discoveryComplete(){return!!this.metadata}async resolveEndpointsAsync(){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),n=await fe(this.updateCloudDiscoveryMetadata.bind(this),K.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await fe(this.updateEndpointMetadata.bind(this),K.AuthorityUpdateEndpointMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.updateCachedMetadata(e,n,{source:r}),(o=this.performanceClient)==null||o.addFields({cloudDiscoverySource:n,authorityEndpointSource:r},this.correlationId)}getCurrentMetadataEntity(){let e=this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);return e||(e={aliases:[],preferred_cache:this.hostnameAndPort,preferred_network:this.hostnameAndPort,canonical_authority:this.canonicalAuthority,authorization_endpoint:"",token_endpoint:"",end_session_endpoint:"",issuer:"",aliasesFromNetwork:!1,endpointsFromNetwork:!1,expiresAt:TI(),jwks_uri:""}),e}updateCachedMetadata(e,n,r){n!==Ui.CACHE&&(r==null?void 0:r.source)!==Ui.CACHE&&(e.expiresAt=TI(),e.canonical_authority=this.canonicalAuthority);const i=this.cacheManager.generateAuthorityMetadataCacheKey(e.preferred_cache);this.cacheManager.setAuthorityMetadata(i,e),this.metadata=e}async updateEndpointMetadata(e){var i,o,s;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityUpdateEndpointMetadata,this.correlationId);const n=this.updateEndpointMetadataFromLocalSources(e);if(n){if(n.source===Ui.HARDCODED_VALUES&&(o=this.authorityOptions.azureRegionConfiguration)!=null&&o.azureRegion&&n.metadata){const c=await fe(this.updateMetadataWithRegionalInformation.bind(this),K.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(n.metadata);fv(e,c,!1),e.canonical_authority=this.canonicalAuthority}return n.source}let r=await fe(this.getEndpointMetadataFromNetwork.bind(this),K.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(s=this.authorityOptions.azureRegionConfiguration)!=null&&s.azureRegion&&(r=await fe(this.updateMetadataWithRegionalInformation.bind(this),K.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),fv(e,r,!0),Ui.NETWORK;throw we(V5,this.defaultOpenIdConfigurationEndpoint)}updateEndpointMetadataFromLocalSources(e){this.logger.verbose("Attempting to get endpoint metadata from authority configuration");const n=this.getEndpointMetadataFromConfig();if(n)return this.logger.verbose("Found endpoint metadata in authority configuration"),fv(e,n,!1),{source:Ui.CONFIG};if(this.logger.verbose("Did not find endpoint metadata in the config... Attempting to get endpoint metadata from the hardcoded values."),this.authorityOptions.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get endpoint metadata from the network metadata cache.");else{const i=this.getEndpointMetadataFromHardcodedValues();if(i)return fv(e,i,!1),{source:Ui.HARDCODED_VALUES,metadata:i};this.logger.verbose("Did not find endpoint metadata in hardcoded values... Attempting to get endpoint metadata from the network metadata cache.")}const r=NI(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:Ui.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new tn(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw jn(fB)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(K.AuthorityGetEndpointMetadataFromNetwork,this.correlationId);const e={},n=this.defaultOpenIdConfigurationEndpoint;this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: attempting to retrieve OAuth endpoints from ${n}`);try{const i=await this.networkInterface.sendGetRequestAsync(n,e);return Ane(i.body)?i.body:(this.logger.verbose("Authority.getEndpointMetadataFromNetwork: could not parse response as OpenID configuration"),null)}catch(i){return this.logger.verbose(`Authority.getEndpointMetadataFromNetwork: ${i}`),null}}getEndpointMetadataFromHardcodedValues(){return this.hostnameAndPort in bI?bI[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(K.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const n=(i=this.authorityOptions.azureRegionConfiguration)==null?void 0:i.azureRegion;if(n){if(n!==pe.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=$S.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,Zr.replaceWithRegionalInformation(e,n);const s=await fe(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),K.RegionDiscoveryDetectRegion,this.logger,this.performanceClient,this.correlationId)((o=this.authorityOptions.azureRegionConfiguration)==null?void 0:o.environmentRegion,this.regionDiscoveryMetadata);if(s)return this.regionDiscoveryMetadata.region_outcome=$S.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=s,Zr.replaceWithRegionalInformation(e,s);this.regionDiscoveryMetadata.region_outcome=$S.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const n=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(n)return n;const r=await fe(this.getCloudDiscoveryMetadataFromNetwork.bind(this),K.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return FS(e,r,!0),Ui.NETWORK;throw jn(hB)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||pe.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||pe.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||pe.NOT_APPLICABLE}`);const n=this.getCloudDiscoveryMetadataFromConfig();if(n)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),FS(e,n,!1),Ui.CONFIG;if(this.logger.verbose("Did not find cloud discovery metadata in the config... Attempting to get cloud discovery metadata from the hardcoded values."),this.options.skipAuthorityMetadataCache)this.logger.verbose("Skipping hardcoded cloud discovery metadata cache since skipAuthorityMetadataCache is set to true. Attempting to get cloud discovery metadata from the network metadata cache.");else{const i=vte(this.hostnameAndPort);if(i)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),FS(e,i,!1),Ui.HARDCODED_VALUES;this.logger.verbose("Did not find cloud discovery metadata in hardcoded values... Attempting to get cloud discovery metadata from the network metadata cache.")}const r=NI(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),Ui.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===Uo.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);if(this.authorityOptions.cloudDiscoveryMetadata){this.logger.verbose("The cloud discovery metadata has been provided as a network response, in the config.");try{this.logger.verbose("Attempting to parse the cloud discovery metadata.");const e=JSON.parse(this.authorityOptions.cloudDiscoveryMetadata),n=ex(e.metadata,this.hostnameAndPort);if(this.logger.verbose("Parsed the cloud discovery metadata."),n)return this.logger.verbose("There is returnable metadata attached to the parsed cloud discovery metadata."),n;this.logger.verbose("There is no metadata attached to the parsed cloud discovery metadata.")}catch{throw this.logger.verbose("Unable to parse the cloud discovery metadata. Throwing Invalid Cloud Discovery Metadata Error."),jn(nT)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${pe.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`,n={};let r=null;try{const o=await this.networkInterface.sendGetRequestAsync(e,n);let s,c;if(jne(o.body))s=o.body,c=s.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${s.tenant_discovery_endpoint}`);else if(Ene(o.body)){if(this.logger.warning(`A CloudInstanceDiscoveryErrorResponse was returned. The cloud instance discovery network request's status code is: ${o.status}`),s=o.body,s.error===pe.INVALID_INSTANCE)return this.logger.error("The CloudInstanceDiscoveryErrorResponse error is invalid_instance."),null;this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error is ${s.error}`),this.logger.warning(`The CloudInstanceDiscoveryErrorResponse error description is ${s.error_description}`),this.logger.warning("Setting the value of the CloudInstanceDiscoveryMetadata (returned from the network) to []"),c=[]}else return this.logger.error("AAD did not return a CloudInstanceDiscoveryResponse or CloudInstanceDiscoveryErrorResponse"),null;this.logger.verbose("Attempting to find a match between the developer's authority and the CloudInstanceDiscoveryMetadata returned from the network request."),r=ex(c,this.hostnameAndPort)}catch(o){if(o instanceof _n)this.logger.error(`There was a network error while attempting to get the cloud discovery instance metadata. Error: ${o.errorCode} Error Description: ${o.errorMessage}`);else{const s=o;this.logger.error(`A non-MSALJS error was thrown while attempting to get the cloud instance discovery metadata. Error: ${s.name} -Error Description: ${s.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(n=>n&&en.getDomainFromUrl(n).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,n){let r;if(n&&n.azureCloudInstance!==ZE.None){const i=n.tenant?n.tenant:pe.DEFAULT_COMMON_TENANT;r=`${n.azureCloudInstance}/${i}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return pe.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw we(da)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return CB.has(e)}static isPublicCloudAuthority(e){return pe.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,n,r){const i=new en(e);i.validateAsUri();const o=i.getUrlComponents();let s=`${n}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(s=`${n}.${pe.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const c=en.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:s}).urlString;return r?`${c}?${r}`:c}static replaceWithRegionalInformation(e,n){const r={...e};return r.authorization_endpoint=Zr.buildRegionalAuthorityString(r.authorization_endpoint,n),r.token_endpoint=Zr.buildRegionalAuthorityString(r.token_endpoint,n),r.end_session_endpoint&&(r.end_session_endpoint=Zr.buildRegionalAuthorityString(r.end_session_endpoint,n)),r}static transformCIAMAuthority(e){let n=e;const i=new en(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(pe.CIAM_AUTH_URL)){const o=i.HostNameAndPort.split(".")[0];n=`${n}${o}${pe.AAD_TENANT_DOMAIN_SUFFIX}`}return n}}Zr.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Ic.COMMON,Ic.CONSUMERS,Ic.ORGANIZATIONS]);function Dne(t){var i;const r=(i=new en(t).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:i.toLowerCase();switch(r){case Ic.COMMON:case Ic.ORGANIZATIONS:case Ic.CONSUMERS:return;default:return r}}function UB(t){return t.endsWith(pe.FORWARD_SLASH)?t:`${t}${pe.FORWARD_SLASH}`}function $ne(t){const e=t.cloudDiscoveryMetadata;let n;if(e)try{n=JSON.parse(e)}catch{throw jn(nT)}return{canonicalAuthority:t.authority?UB(t.authority):void 0,knownAuthorities:t.knownAuthorities,cloudDiscoveryMetadata:n}}/*! @azure/msal-common v15.10.0 2025-08-05 */async function HB(t,e,n,r,i,o,s){s==null||s.addQueueMeasurement(K.AuthorityFactoryCreateDiscoveredInstance,o);const c=Zr.transformCIAMAuthority(UB(t)),l=new Zr(c,e,n,r,i,o,s);try{return await fe(l.resolveEndpointsAsync.bind(l),K.AuthorityResolveEndpointsAsync,i,s,o)(),l}catch{throw we(da)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Tu extends _n{constructor(e,n,r,i,o){super(e,n,r),this.name="ServerError",this.errorNo=i,this.status=o,Object.setPrototypeOf(this,Tu.prototype)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function k0(t,e,n){var r;return{clientId:t,authority:e.authority,scopes:e.scopes,homeAccountIdentifier:n,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,embeddedClientId:e.embeddedClientId||((r=e.tokenBodyParameters)==null?void 0:r.clientId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ts{static generateThrottlingStorageKey(e){return`${cp.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,n,r){var s;const i=Ts.generateThrottlingStorageKey(n),o=e.getThrottlingCache(i);if(o){if(o.throttleTime=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(di.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const n=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(n||cp.DEFAULT_THROTTLE_TIME_SECONDS),r+cp.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,n,r,i){const o=k0(n,r,i),s=this.generateThrottlingStorageKey(o);e.removeItem(s,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class O0 extends _n{constructor(e,n,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,O0.prototype),this.name="NetworkError",this.error=e,this.httpStatus=n,this.responseHeaders=r}}function Vh(t,e,n,r){return t.errorMessage=`${t.errorMessage}, additionalErrorInfo: error.name:${r==null?void 0:r.name}, error.message:${r==null?void 0:r.message}`,new O0(t,e,n)}/*! @azure/msal-common v15.10.0 2025-08-05 */class xT{constructor(e,n){this.config=Ete(e),this.logger=new Da(this.config.loggerOptions,oB,JE),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=n}createTokenRequestHeaders(e){const n={};if(n[di.CONTENT_TYPE]=pe.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Wo.HOME_ACCOUNT_ID:try{const r=Cd(e.credential);n[di.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Wo.UPN:n[di.CCS_HEADER]=`UPN: ${e.credential}`;break}return n}async executePostToTokenEndpoint(e,n,r,i,o,s){var l;s&&((l=this.performanceClient)==null||l.addQueueMeasurement(s,o));const c=await this.sendPostRequest(i,e,{body:n,headers:r},o);return this.config.serverTelemetryManager&&c.status<500&&c.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),c}async sendPostRequest(e,n,r,i){var s,c,l;Ts.preProcess(this.cacheManager,e,i);let o;try{o=await fe(this.networkClient.sendPostRequestAsync.bind(this.networkClient),K.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,i)(n,r);const u=o.headers||{};(c=this.performanceClient)==null||c.addFields({refreshTokenSize:((s=o.body.refresh_token)==null?void 0:s.length)||0,httpVerToken:u[di.X_MS_HTTP_VERSION]||"",requestId:u[di.X_MS_REQUEST_ID]||""},i)}catch(u){if(u instanceof O0){const d=u.responseHeaders;throw d&&((l=this.performanceClient)==null||l.addFields({httpVerToken:d[di.X_MS_HTTP_VERSION]||"",requestId:d[di.X_MS_REQUEST_ID]||"",contentTypeHeader:d[di.CONTENT_TYPE]||void 0,contentLengthHeader:d[di.CONTENT_LENGTH]||void 0,httpStatus:u.httpStatus},i)),u.error}throw u instanceof _n?u:we(G5)}return Ts.postProcess(this.cacheManager,e,o,i),o}async updateAuthority(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(K.UpdateTokenEndpointAuthority,n);const r=`https://${e}/${this.authority.tenant}/`,i=await HB(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,n,this.performanceClient);this.authority=i}createTokenQueryParameters(e){const n=new Map;return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenQueryParameters&&Mc(n,e.tokenQueryParameters),hT(n,e.correlationId),j0(n,e.correlationId,this.performanceClient),Xp(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function zB(t){return t&&(t.tid||t.tfp||t.acr)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */class cs{getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,loginHint:this.loginHint,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static createAccount(e,n,r){var u,d,f,h,p,g,m;const i=new cs;n.authorityType===Uo.Adfs?i.authorityType=uv.ADFS_ACCOUNT_TYPE:n.protocolMode===Di.OIDC?i.authorityType=uv.GENERIC_ACCOUNT_TYPE:i.authorityType=uv.MSSTS_ACCOUNT_TYPE;let o;e.clientInfo&&r&&(o=nx(e.clientInfo,r)),i.clientInfo=e.clientInfo,i.homeAccountId=e.homeAccountId,i.nativeAccountId=e.nativeAccountId;const s=e.environment||n&&n.getPreferredCache();if(!s)throw we(YE);i.environment=s,i.realm=(o==null?void 0:o.utid)||zB(e.idTokenClaims)||"",i.localAccountId=(o==null?void 0:o.uid)||((u=e.idTokenClaims)==null?void 0:u.oid)||((d=e.idTokenClaims)==null?void 0:d.sub)||"";const c=((f=e.idTokenClaims)==null?void 0:f.preferred_username)||((h=e.idTokenClaims)==null?void 0:h.upn),l=(p=e.idTokenClaims)!=null&&p.emails?e.idTokenClaims.emails[0]:null;if(i.username=c||l||"",i.loginHint=(g=e.idTokenClaims)==null?void 0:g.login_hint,i.name=((m=e.idTokenClaims)==null?void 0:m.name)||"",i.cloudGraphHostName=e.cloudGraphHostName,i.msGraphHost=e.msGraphHost,e.tenantProfiles)i.tenantProfiles=e.tenantProfiles;else{const y=iT(e.homeAccountId,i.localAccountId,i.realm,e.idTokenClaims);i.tenantProfiles=[y]}return i}static createFromAccountInfo(e,n,r){var o;const i=new cs;return i.authorityType=e.authorityType||uv.GENERIC_ACCOUNT_TYPE,i.homeAccountId=e.homeAccountId,i.localAccountId=e.localAccountId,i.nativeAccountId=e.nativeAccountId,i.realm=e.tenantId,i.environment=e.environment,i.username=e.username,i.name=e.name,i.loginHint=e.loginHint,i.cloudGraphHostName=n,i.msGraphHost=r,i.tenantProfiles=Array.from(((o=e.tenantProfiles)==null?void 0:o.values())||[]),i}static generateHomeAccountId(e,n,r,i,o){if(!(n===Uo.Adfs||n===Uo.Dsts)){if(e)try{const s=nx(e,i.base64Decode);if(s.uid&&s.utid)return`${s.uid}.${s.utid}`}catch{}r.warning("No client info in response")}return(o==null?void 0:o.sub)||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,n,r){if(!e||!n)return!1;let i=!0;if(r){const o=e.idTokenClaims||{},s=n.idTokenClaims||{};i=o.iat===s.iat&&o.nonce===s.nonce}return e.homeAccountId===n.homeAccountId&&e.localAccountId===n.localAccountId&&e.username===n.username&&e.tenantId===n.tenantId&&e.loginHint===n.loginHint&&e.environment===n.environment&&e.nativeAccountId===n.nativeAccountId&&i}}/*! @azure/msal-common v15.10.0 2025-08-05 */const ax="no_tokens_found",GB="native_account_unavailable",bT="refresh_token_expired",wT="ux_not_allowed",Lne="interaction_required",Fne="consent_required",Bne="login_required",I0="bad_token";/*! @azure/msal-common v15.10.0 2025-08-05 */const PI=[Lne,Fne,Bne,I0,wT],Une=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],Hne={[ax]:"No refresh token found in the cache. Please sign-in.",[GB]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[bT]:"Refresh token has expired.",[I0]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",[wT]:"`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve."};class ls extends _n{constructor(e,n,r,i,o,s,c,l){super(e,n,r),Object.setPrototypeOf(this,ls.prototype),this.timestamp=i||pe.EMPTY_STRING,this.traceId=o||pe.EMPTY_STRING,this.correlationId=s||pe.EMPTY_STRING,this.claims=c||pe.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=l}}function VB(t,e,n){const r=!!t&&PI.indexOf(t)>-1,i=!!n&&Une.indexOf(n)>-1,o=!!e&&PI.some(s=>e.indexOf(s)>-1);return r||o||i}function cx(t){return new ls(t,Hne[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */class zf{static setRequestState(e,n,r){const i=zf.generateLibraryState(e,r);return n?`${i}${pe.RESOURCE_DELIM}${n}`:i}static generateLibraryState(e,n){if(!e)throw we(nA);const r={id:e.createNewGuid()};n&&(r.meta=n);const i=JSON.stringify(r);return e.base64Encode(i)}static parseRequestState(e,n){if(!e)throw we(nA);if(!n)throw we(Xd);try{const r=n.split(pe.RESOURCE_DELIM),i=r[0],o=r.length>1?r.slice(1).join(pe.RESOURCE_DELIM):pe.EMPTY_STRING,s=e.base64Decode(i),c=JSON.parse(s);return{userRequestState:o||pe.EMPTY_STRING,libraryState:c}}catch{throw we(Xd)}}}/*! @azure/msal-common v15.10.0 2025-08-05 */const zne={SW:"sw"};class Jd{constructor(e,n){this.cryptoUtils=e,this.performanceClient=n}async generateCnf(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(K.PopTokenGenerateCnf,e.correlationId);const r=await fe(this.generateKid.bind(this),K.PopTokenGenerateCnf,n,this.performanceClient,e.correlationId)(e),i=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:i}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(K.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:zne.SW}}async signPopToken(e,n,r){return this.signPayload(e,n,r)}async signPayload(e,n,r,i){const{resourceRequestMethod:o,resourceRequestUri:s,shrClaims:c,shrNonce:l,shrOptions:u}=r,d=s?new en(s):void 0,f=d==null?void 0:d.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:$i(),m:o==null?void 0:o.toUpperCase(),u:f==null?void 0:f.HostNameAndPort,nonce:l||this.cryptoUtils.createNewGuid(),p:f==null?void 0:f.AbsolutePath,q:f!=null&&f.QueryString?[[],f.QueryString]:void 0,client_claims:c||void 0,...i},n,u,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Gne{constructor(e,n){this.cache=e,this.hasChanged=n}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v15.10.0 2025-08-05 */class hu{constructor(e,n,r,i,o,s,c){this.clientId=e,this.cacheStorage=n,this.cryptoObj=r,this.logger=i,this.serializableCache=o,this.persistencePlugin=s,this.performanceClient=c}validateTokenResponse(e,n){var r;if(e.error||e.error_description||e.suberror){const i=`Error(s): ${e.error_codes||pe.NOT_AVAILABLE} - Timestamp: ${e.timestamp||pe.NOT_AVAILABLE} - Description: ${e.error_description||pe.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||pe.NOT_AVAILABLE} - Trace ID: ${e.trace_id||pe.NOT_AVAILABLE}`,o=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,s=new Tu(e.error,i,e.suberror,o,e.status);if(n&&e.status&&e.status>=wc.SERVER_ERROR_RANGE_START&&e.status<=wc.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed. +Error Description: ${s.message}`)}return null}return r||(this.logger.warning("The developer's authority was not found within the CloudInstanceDiscoveryMetadata returned from the network request."),this.logger.verbose("Creating custom Authority for custom domain scenario."),r=Zr.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(n=>n&&tn.getDomainFromUrl(n).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,n){let r;if(n&&n.azureCloudInstance!==ZE.None){const i=n.tenant?n.tenant:pe.DEFAULT_COMMON_TENANT;r=`${n.azureCloudInstance}/${i}/`}return r||e}static createCloudDiscoveryMetadataFromHost(e){return{preferred_network:e,preferred_cache:e,aliases:[e]}}getPreferredCache(){if(this.managedIdentity)return pe.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw we(da)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return CB.has(e)}static isPublicCloudAuthority(e){return pe.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,n,r){const i=new tn(e);i.validateAsUri();const o=i.getUrlComponents();let s=`${n}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(s=`${n}.${pe.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const c=tn.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:s}).urlString;return r?`${c}?${r}`:c}static replaceWithRegionalInformation(e,n){const r={...e};return r.authorization_endpoint=Zr.buildRegionalAuthorityString(r.authorization_endpoint,n),r.token_endpoint=Zr.buildRegionalAuthorityString(r.token_endpoint,n),r.end_session_endpoint&&(r.end_session_endpoint=Zr.buildRegionalAuthorityString(r.end_session_endpoint,n)),r}static transformCIAMAuthority(e){let n=e;const i=new tn(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(pe.CIAM_AUTH_URL)){const o=i.HostNameAndPort.split(".")[0];n=`${n}${o}${pe.AAD_TENANT_DOMAIN_SUFFIX}`}return n}}Zr.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Ic.COMMON,Ic.CONSUMERS,Ic.ORGANIZATIONS]);function Dne(t){var i;const r=(i=new tn(t).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:i.toLowerCase();switch(r){case Ic.COMMON:case Ic.ORGANIZATIONS:case Ic.CONSUMERS:return;default:return r}}function UB(t){return t.endsWith(pe.FORWARD_SLASH)?t:`${t}${pe.FORWARD_SLASH}`}function $ne(t){const e=t.cloudDiscoveryMetadata;let n;if(e)try{n=JSON.parse(e)}catch{throw jn(nT)}return{canonicalAuthority:t.authority?UB(t.authority):void 0,knownAuthorities:t.knownAuthorities,cloudDiscoveryMetadata:n}}/*! @azure/msal-common v15.10.0 2025-08-05 */async function HB(t,e,n,r,i,o,s){s==null||s.addQueueMeasurement(K.AuthorityFactoryCreateDiscoveredInstance,o);const c=Zr.transformCIAMAuthority(UB(t)),l=new Zr(c,e,n,r,i,o,s);try{return await fe(l.resolveEndpointsAsync.bind(l),K.AuthorityResolveEndpointsAsync,i,s,o)(),l}catch{throw we(da)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Tu extends _n{constructor(e,n,r,i,o){super(e,n,r),this.name="ServerError",this.errorNo=i,this.status=o,Object.setPrototypeOf(this,Tu.prototype)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function k0(t,e,n){var r;return{clientId:t,authority:e.authority,scopes:e.scopes,homeAccountIdentifier:n,claims:e.claims,authenticationScheme:e.authenticationScheme,resourceRequestMethod:e.resourceRequestMethod,resourceRequestUri:e.resourceRequestUri,shrClaims:e.shrClaims,sshKid:e.sshKid,embeddedClientId:e.embeddedClientId||((r=e.tokenBodyParameters)==null?void 0:r.clientId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ts{static generateThrottlingStorageKey(e){return`${cp.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,n,r){var s;const i=Ts.generateThrottlingStorageKey(n),o=e.getThrottlingCache(i);if(o){if(o.throttleTime=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(di.RETRY_AFTER)&&(e.status<200||e.status>=300):!1}static calculateThrottleTime(e){const n=e<=0?0:e,r=Date.now()/1e3;return Math.floor(Math.min(r+(n||cp.DEFAULT_THROTTLE_TIME_SECONDS),r+cp.DEFAULT_MAX_THROTTLE_TIME_SECONDS)*1e3)}static removeThrottle(e,n,r,i){const o=k0(n,r,i),s=this.generateThrottlingStorageKey(o);e.removeItem(s,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class O0 extends _n{constructor(e,n,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,O0.prototype),this.name="NetworkError",this.error=e,this.httpStatus=n,this.responseHeaders=r}}function Vh(t,e,n,r){return t.errorMessage=`${t.errorMessage}, additionalErrorInfo: error.name:${r==null?void 0:r.name}, error.message:${r==null?void 0:r.message}`,new O0(t,e,n)}/*! @azure/msal-common v15.10.0 2025-08-05 */class xT{constructor(e,n){this.config=Ete(e),this.logger=new Da(this.config.loggerOptions,oB,JE),this.cryptoUtils=this.config.cryptoInterface,this.cacheManager=this.config.storageInterface,this.networkClient=this.config.networkInterface,this.serverTelemetryManager=this.config.serverTelemetryManager,this.authority=this.config.authOptions.authority,this.performanceClient=n}createTokenRequestHeaders(e){const n={};if(n[di.CONTENT_TYPE]=pe.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case Wo.HOME_ACCOUNT_ID:try{const r=Cd(e.credential);n[di.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case Wo.UPN:n[di.CCS_HEADER]=`UPN: ${e.credential}`;break}return n}async executePostToTokenEndpoint(e,n,r,i,o,s){var l;s&&((l=this.performanceClient)==null||l.addQueueMeasurement(s,o));const c=await this.sendPostRequest(i,e,{body:n,headers:r},o);return this.config.serverTelemetryManager&&c.status<500&&c.status!==429&&this.config.serverTelemetryManager.clearTelemetryCache(),c}async sendPostRequest(e,n,r,i){var s,c,l;Ts.preProcess(this.cacheManager,e,i);let o;try{o=await fe(this.networkClient.sendPostRequestAsync.bind(this.networkClient),K.NetworkClientSendPostRequestAsync,this.logger,this.performanceClient,i)(n,r);const u=o.headers||{};(c=this.performanceClient)==null||c.addFields({refreshTokenSize:((s=o.body.refresh_token)==null?void 0:s.length)||0,httpVerToken:u[di.X_MS_HTTP_VERSION]||"",requestId:u[di.X_MS_REQUEST_ID]||""},i)}catch(u){if(u instanceof O0){const d=u.responseHeaders;throw d&&((l=this.performanceClient)==null||l.addFields({httpVerToken:d[di.X_MS_HTTP_VERSION]||"",requestId:d[di.X_MS_REQUEST_ID]||"",contentTypeHeader:d[di.CONTENT_TYPE]||void 0,contentLengthHeader:d[di.CONTENT_LENGTH]||void 0,httpStatus:u.httpStatus},i)),u.error}throw u instanceof _n?u:we(G5)}return Ts.postProcess(this.cacheManager,e,o,i),o}async updateAuthority(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(K.UpdateTokenEndpointAuthority,n);const r=`https://${e}/${this.authority.tenant}/`,i=await HB(r,this.networkClient,this.cacheManager,this.authority.options,this.logger,n,this.performanceClient);this.authority=i}createTokenQueryParameters(e){const n=new Map;return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenQueryParameters&&Mc(n,e.tokenQueryParameters),hT(n,e.correlationId),j0(n,e.correlationId,this.performanceClient),Xp(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function zB(t){return t&&(t.tid||t.tfp||t.acr)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */class cs{getAccountInfo(){return{homeAccountId:this.homeAccountId,environment:this.environment,tenantId:this.realm,username:this.username,localAccountId:this.localAccountId,loginHint:this.loginHint,name:this.name,nativeAccountId:this.nativeAccountId,authorityType:this.authorityType,tenantProfiles:new Map((this.tenantProfiles||[]).map(e=>[e.tenantId,e]))}}isSingleTenant(){return!this.tenantProfiles}static createAccount(e,n,r){var u,d,f,h,p,g,m;const i=new cs;n.authorityType===Uo.Adfs?i.authorityType=uv.ADFS_ACCOUNT_TYPE:n.protocolMode===Di.OIDC?i.authorityType=uv.GENERIC_ACCOUNT_TYPE:i.authorityType=uv.MSSTS_ACCOUNT_TYPE;let o;e.clientInfo&&r&&(o=nx(e.clientInfo,r)),i.clientInfo=e.clientInfo,i.homeAccountId=e.homeAccountId,i.nativeAccountId=e.nativeAccountId;const s=e.environment||n&&n.getPreferredCache();if(!s)throw we(YE);i.environment=s,i.realm=(o==null?void 0:o.utid)||zB(e.idTokenClaims)||"",i.localAccountId=(o==null?void 0:o.uid)||((u=e.idTokenClaims)==null?void 0:u.oid)||((d=e.idTokenClaims)==null?void 0:d.sub)||"";const c=((f=e.idTokenClaims)==null?void 0:f.preferred_username)||((h=e.idTokenClaims)==null?void 0:h.upn),l=(p=e.idTokenClaims)!=null&&p.emails?e.idTokenClaims.emails[0]:null;if(i.username=c||l||"",i.loginHint=(g=e.idTokenClaims)==null?void 0:g.login_hint,i.name=((m=e.idTokenClaims)==null?void 0:m.name)||"",i.cloudGraphHostName=e.cloudGraphHostName,i.msGraphHost=e.msGraphHost,e.tenantProfiles)i.tenantProfiles=e.tenantProfiles;else{const y=iT(e.homeAccountId,i.localAccountId,i.realm,e.idTokenClaims);i.tenantProfiles=[y]}return i}static createFromAccountInfo(e,n,r){var o;const i=new cs;return i.authorityType=e.authorityType||uv.GENERIC_ACCOUNT_TYPE,i.homeAccountId=e.homeAccountId,i.localAccountId=e.localAccountId,i.nativeAccountId=e.nativeAccountId,i.realm=e.tenantId,i.environment=e.environment,i.username=e.username,i.name=e.name,i.loginHint=e.loginHint,i.cloudGraphHostName=n,i.msGraphHost=r,i.tenantProfiles=Array.from(((o=e.tenantProfiles)==null?void 0:o.values())||[]),i}static generateHomeAccountId(e,n,r,i,o){if(!(n===Uo.Adfs||n===Uo.Dsts)){if(e)try{const s=nx(e,i.base64Decode);if(s.uid&&s.utid)return`${s.uid}.${s.utid}`}catch{}r.warning("No client info in response")}return(o==null?void 0:o.sub)||""}static isAccountEntity(e){return e?e.hasOwnProperty("homeAccountId")&&e.hasOwnProperty("environment")&&e.hasOwnProperty("realm")&&e.hasOwnProperty("localAccountId")&&e.hasOwnProperty("username")&&e.hasOwnProperty("authorityType"):!1}static accountInfoIsEqual(e,n,r){if(!e||!n)return!1;let i=!0;if(r){const o=e.idTokenClaims||{},s=n.idTokenClaims||{};i=o.iat===s.iat&&o.nonce===s.nonce}return e.homeAccountId===n.homeAccountId&&e.localAccountId===n.localAccountId&&e.username===n.username&&e.tenantId===n.tenantId&&e.loginHint===n.loginHint&&e.environment===n.environment&&e.nativeAccountId===n.nativeAccountId&&i}}/*! @azure/msal-common v15.10.0 2025-08-05 */const ax="no_tokens_found",GB="native_account_unavailable",bT="refresh_token_expired",wT="ux_not_allowed",Lne="interaction_required",Fne="consent_required",Bne="login_required",I0="bad_token";/*! @azure/msal-common v15.10.0 2025-08-05 */const PI=[Lne,Fne,Bne,I0,wT],Une=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],Hne={[ax]:"No refresh token found in the cache. Please sign-in.",[GB]:"The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API.",[bT]:"Refresh token has expired.",[I0]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",[wT]:"`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve."};class ls extends _n{constructor(e,n,r,i,o,s,c,l){super(e,n,r),Object.setPrototypeOf(this,ls.prototype),this.timestamp=i||pe.EMPTY_STRING,this.traceId=o||pe.EMPTY_STRING,this.correlationId=s||pe.EMPTY_STRING,this.claims=c||pe.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=l}}function VB(t,e,n){const r=!!t&&PI.indexOf(t)>-1,i=!!n&&Une.indexOf(n)>-1,o=!!e&&PI.some(s=>e.indexOf(s)>-1);return r||o||i}function cx(t){return new ls(t,Hne[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */class zf{static setRequestState(e,n,r){const i=zf.generateLibraryState(e,r);return n?`${i}${pe.RESOURCE_DELIM}${n}`:i}static generateLibraryState(e,n){if(!e)throw we(nA);const r={id:e.createNewGuid()};n&&(r.meta=n);const i=JSON.stringify(r);return e.base64Encode(i)}static parseRequestState(e,n){if(!e)throw we(nA);if(!n)throw we(Xd);try{const r=n.split(pe.RESOURCE_DELIM),i=r[0],o=r.length>1?r.slice(1).join(pe.RESOURCE_DELIM):pe.EMPTY_STRING,s=e.base64Decode(i),c=JSON.parse(s);return{userRequestState:o||pe.EMPTY_STRING,libraryState:c}}catch{throw we(Xd)}}}/*! @azure/msal-common v15.10.0 2025-08-05 */const zne={SW:"sw"};class Jd{constructor(e,n){this.cryptoUtils=e,this.performanceClient=n}async generateCnf(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(K.PopTokenGenerateCnf,e.correlationId);const r=await fe(this.generateKid.bind(this),K.PopTokenGenerateCnf,n,this.performanceClient,e.correlationId)(e),i=this.cryptoUtils.base64UrlEncode(JSON.stringify(r));return{kid:r.kid,reqCnfString:i}}async generateKid(e){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(K.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:zne.SW}}async signPopToken(e,n,r){return this.signPayload(e,n,r)}async signPayload(e,n,r,i){const{resourceRequestMethod:o,resourceRequestUri:s,shrClaims:c,shrNonce:l,shrOptions:u}=r,d=s?new tn(s):void 0,f=d==null?void 0:d.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:$i(),m:o==null?void 0:o.toUpperCase(),u:f==null?void 0:f.HostNameAndPort,nonce:l||this.cryptoUtils.createNewGuid(),p:f==null?void 0:f.AbsolutePath,q:f!=null&&f.QueryString?[[],f.QueryString]:void 0,client_claims:c||void 0,...i},n,u,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Gne{constructor(e,n){this.cache=e,this.hasChanged=n}get cacheHasChanged(){return this.hasChanged}get tokenCache(){return this.cache}}/*! @azure/msal-common v15.10.0 2025-08-05 */class hu{constructor(e,n,r,i,o,s,c){this.clientId=e,this.cacheStorage=n,this.cryptoObj=r,this.logger=i,this.serializableCache=o,this.persistencePlugin=s,this.performanceClient=c}validateTokenResponse(e,n){var r;if(e.error||e.error_description||e.suberror){const i=`Error(s): ${e.error_codes||pe.NOT_AVAILABLE} - Timestamp: ${e.timestamp||pe.NOT_AVAILABLE} - Description: ${e.error_description||pe.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||pe.NOT_AVAILABLE} - Trace ID: ${e.trace_id||pe.NOT_AVAILABLE}`,o=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,s=new Tu(e.error,i,e.suberror,o,e.status);if(n&&e.status&&e.status>=wc.SERVER_ERROR_RANGE_START&&e.status<=wc.SERVER_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently unavailable and the access token is unable to be refreshed. ${s}`);return}else if(n&&e.status&&e.status>=wc.CLIENT_ERROR_RANGE_START&&e.status<=wc.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token. -${s}`);return}throw VB(e.error,e.error_description,e.suberror)?new ls(e.error,e.error_description,e.suberror,e.timestamp||pe.EMPTY_STRING,e.trace_id||pe.EMPTY_STRING,e.correlation_id||pe.EMPTY_STRING,e.claims||pe.EMPTY_STRING,o):s}}async handleServerTokenResponse(e,n,r,i,o,s,c,l,u){var g;(g=this.performanceClient)==null||g.addQueueMeasurement(K.HandleServerTokenResponse,e.correlation_id);let d;if(e.id_token){if(d=Hf(e.id_token||pe.EMPTY_STRING,this.cryptoObj.base64Decode),o&&o.nonce&&d.nonce!==o.nonce)throw we(q5);if(i.maxAge||i.maxAge===0){const m=d.auth_time;if(!m)throw we(WE);bB(m,i.maxAge)}}this.homeAccountIdentifier=cs.generateHomeAccountId(e.client_info||pe.EMPTY_STRING,n.authorityType,this.logger,this.cryptoObj,d);let f;o&&o.state&&(f=zf.parseRequestState(this.cryptoObj,o.state)),e.key_id=e.key_id||i.sshKid||void 0;const h=this.generateCacheRecord(e,n,r,i,d,s,o);let p;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),p=new Gne(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(p)),c&&!l&&h.account){const m=this.cacheStorage.generateAccountKey(h.account.getAccountInfo());if(!this.cacheStorage.getAccount(m,i.correlationId))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await hu.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,void 0,u)}await this.cacheStorage.saveCacheRecord(h,i.correlationId,i.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&p&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(p))}return hu.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,e,u)}generateCacheRecord(e,n,r,i,o,s,c){const l=n.getPreferredCache();if(!l)throw we(YE);const u=zB(o);let d,f;e.id_token&&o&&(d=N0(this.homeAccountIdentifier,l,e.id_token,this.clientId,u||""),f=ST(this.cacheStorage,n,this.homeAccountIdentifier,this.cryptoObj.base64Decode,i.correlationId,o,e.client_info,l,u,c,void 0,this.logger));let h=null;if(e.access_token){const m=e.scope?Ar.fromString(e.scope):new Ar(i.scopes||[]),y=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,b=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,x=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,w=r+y,S=w+b,C=x&&x>0?r+x:void 0;h=P0(this.homeAccountIdentifier,l,e.access_token,this.clientId,u||n.tenant||"",m.printScopes(),w,S,this.cryptoObj.base64Decode,C,e.token_type,s,e.key_id,i.claims,i.requestedClaimsHash)}let p=null;if(e.refresh_token){let m;if(e.refresh_token_expires_in){const y=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;m=r+y}p=BB(this.homeAccountIdentifier,l,e.refresh_token,this.clientId,e.foci,s,m)}let g=null;return e.foci&&(g={clientId:this.clientId,environment:l,familyId:e.foci}),{account:f,idToken:d,accessToken:h,refreshToken:p,appMetadata:g}}static async generateAuthenticationResult(e,n,r,i,o,s,c,l,u){var w,S,C,_,A;let d=pe.EMPTY_STRING,f=[],h=null,p,g,m=pe.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===vn.POP&&!o.popKid){const j=new Jd(e),{secret:P,keyId:k}=r.accessToken;if(!k)throw we(QE);d=await j.signPopToken(P,k,o)}else d=r.accessToken.secret;f=Ar.fromString(r.accessToken.target).asArray(),h=_d(r.accessToken.expiresOn),p=_d(r.accessToken.extendedExpiresOn),r.accessToken.refreshOn&&(g=_d(r.accessToken.refreshOn))}r.appMetadata&&(m=r.appMetadata.familyId===Yy?Yy:"");const y=(s==null?void 0:s.oid)||(s==null?void 0:s.sub)||"",b=(s==null?void 0:s.tid)||"";l!=null&&l.spa_accountid&&r.account&&(r.account.nativeAccountId=l==null?void 0:l.spa_accountid);const x=r.account?oT(r.account.getAccountInfo(),void 0,s,(w=r.idToken)==null?void 0:w.secret):null;return{authority:n.canonicalAuthority,uniqueId:y,tenantId:b,scopes:f,account:x,idToken:((S=r==null?void 0:r.idToken)==null?void 0:S.secret)||"",idTokenClaims:s||{},accessToken:d,fromCache:i,expiresOn:h,extExpiresOn:p,refreshOn:g,correlationId:o.correlationId,requestId:u||pe.EMPTY_STRING,familyId:m,tokenType:((C=r.accessToken)==null?void 0:C.tokenType)||pe.EMPTY_STRING,state:c?c.userRequestState:pe.EMPTY_STRING,cloudGraphHostName:((_=r.account)==null?void 0:_.cloudGraphHostName)||pe.EMPTY_STRING,msGraphHost:((A=r.account)==null?void 0:A.msGraphHost)||pe.EMPTY_STRING,code:l==null?void 0:l.spa_code,fromNativeBroker:!1}}}function ST(t,e,n,r,i,o,s,c,l,u,d,f){f==null||f.verbose("setCachedAccount called");const p=t.getAccountKeys().find(x=>x.startsWith(n));let g=null;p&&(g=t.getAccount(p,i));const m=g||cs.createAccount({homeAccountId:n,idTokenClaims:o,clientInfo:s,environment:c,cloudGraphHostName:u==null?void 0:u.cloud_graph_host_name,msGraphHost:u==null?void 0:u.msgraph_host,nativeAccountId:d},e,r),y=m.tenantProfiles||[],b=l||m.realm;if(b&&!y.find(x=>x.tenantId===b)){const x=iT(n,m.localAccountId,b,o);y.push(x)}return m.tenantProfiles=y,m}/*! @azure/msal-common v15.10.0 2025-08-05 */async function KB(t,e,n){return typeof t=="string"?t:t({clientId:e,tokenEndpoint:n})}/*! @azure/msal-common v15.10.0 2025-08-05 */class WB extends xT{constructor(e,n){var r;super(e,n),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async acquireToken(e,n){var c,l;if((c=this.performanceClient)==null||c.addQueueMeasurement(K.AuthClientAcquireToken,e.correlationId),!e.code)throw we(X5);const r=$i(),i=await fe(this.executeTokenRequest.bind(this),K.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),o=(l=i.headers)==null?void 0:l[di.X_MS_REQUEST_ID],s=new hu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return s.validateTokenResponse(i.body),fe(s.handleServerTokenResponse.bind(s),K.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,r,e,n,void 0,void 0,void 0,o)}getLogoutUri(e){if(!e)throw jn(dB);const n=this.createLogoutUrlQueryString(e);return en.appendQueryString(this.authority.endSessionEndpoint,n)}async executeTokenRequest(e,n){var u;(u=this.performanceClient)==null||u.addQueueMeasurement(K.AuthClientExecuteTokenRequest,n.correlationId);const r=this.createTokenQueryParameters(n),i=en.appendQueryString(e.tokenEndpoint,r),o=await fe(this.createTokenRequestBody.bind(this),K.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,n.correlationId)(n);let s;if(n.clientInfo)try{const d=nx(n.clientInfo,this.cryptoUtils.base64Decode);s={credential:`${d.uid}${Qp.CLIENT_INFO_SEPARATOR}${d.utid}`,type:Wo.HOME_ACCOUNT_ID}}catch(d){this.logger.verbose("Could not parse client info for CCS Header: "+d)}const c=this.createTokenRequestHeaders(s||n.ccsCredential),l=k0(this.config.authOptions.clientId,n);return fe(this.executePostToTokenEndpoint.bind(this),K.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,n.correlationId)(i,o,c,l,n.correlationId,K.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(uT(n,e.embeddedClientId||((o=e.tokenBodyParameters)==null?void 0:o[fu])||this.config.authOptions.clientId),this.includeRedirectUri)dT(n,e.redirectUri);else if(!e.redirectUri)throw jn(sB);if(lT(n,e.scopes,!0,this.oidcDefaultScopes),yne(n,e.code),pT(n,this.config.libraryInfo),mT(n,this.config.telemetry.application),FB(n),this.serverTelemetryManager&&!jB(this.config)&&LB(n,this.serverTelemetryManager),e.codeVerifier&&bne(n,e.codeVerifier),this.config.clientCredentials.clientSecret&&OB(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;IB(n,await KB(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),RB(n,s.assertionType)}if(MB(n,B5.AUTHORIZATION_CODE_GRANT),gT(n),e.authenticationScheme===vn.POP){const s=new Jd(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await fe(s.generateCnf.bind(s),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,vT(n,c)}else if(e.authenticationScheme===vn.SSH)if(e.sshJwk)$B(n,e.sshJwk);else throw jn(A0);(!$s.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&fT(n,e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const s=nx(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${s.uid}${Qp.CLIENT_INFO_SEPARATOR}${s.utid}`,type:Wo.HOME_ACCOUNT_ID}}catch(s){this.logger.verbose("Could not parse client info for CCS Header: "+s)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Wo.HOME_ACCOUNT_ID:try{const s=Cd(r.credential);lp(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Wo.UPN:ox(n,r.credential);break}return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Mc(n,e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[CI])&&Mc(n,{[CI]:"1"}),j0(n,e.correlationId,this.performanceClient),Xp(n)}createLogoutUrlQueryString(e){const n=new Map;return e.postLogoutRedirectUri&&hne(n,e.postLogoutRedirectUri),e.correlationId&&hT(n,e.correlationId),e.idTokenHint&&pne(n,e.idTokenHint),e.state&&PB(n,e.state),e.logoutHint&&Sne(n,e.logoutHint),e.extraQueryParameters&&Mc(n,e.extraQueryParameters),this.config.authOptions.instanceAware&&DB(n),Xp(n,this.config.authOptions.encodeExtraQueryParams,e.extraQueryParameters)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Vne=300;class Kne extends xT{constructor(e,n){super(e,n)}async acquireToken(e){var s,c;(s=this.performanceClient)==null||s.addQueueMeasurement(K.RefreshTokenClientAcquireToken,e.correlationId);const n=$i(),r=await fe(this.executeTokenRequest.bind(this),K.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(c=r.headers)==null?void 0:c[di.X_MS_REQUEST_ID],o=new hu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(r.body),fe(o.handleServerTokenResponse.bind(o),K.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e){var r;if(!e)throw jn(uB);if((r=this.performanceClient)==null||r.addQueueMeasurement(K.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw we(qE);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const o=i instanceof ls&&i.errorCode===ax,s=i instanceof Tu&&i.errorCode===gI.INVALID_GRANT_ERROR&&i.subError===gI.CLIENT_MISMATCH_ERROR;if(o||s)return fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,n){var o,s,c;(o=this.performanceClient)==null||o.addQueueMeasurement(K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Zi(this.cacheManager.getRefreshToken.bind(this.cacheManager),K.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,n,e.correlationId,void 0,this.performanceClient);if(!r)throw cx(ax);if(r.expiresOn&&sx(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||Vne))throw(s=this.performanceClient)==null||s.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),cx(bT);const i={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||vn.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Wo.HOME_ACCOUNT_ID}};try{return await fe(this.acquireToken.bind(this),K.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(l){if(l instanceof ls&&((c=this.performanceClient)==null||c.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),l.subError===I0)){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const u=this.cacheManager.generateCredentialKey(r);this.cacheManager.removeRefreshToken(u,e.correlationId)}throw l}}async executeTokenRequest(e,n){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(K.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),i=en.appendQueryString(n.tokenEndpoint,r),o=await fe(this.createTokenRequestBody.bind(this),K.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),s=this.createTokenRequestHeaders(e.ccsCredential),c=k0(this.config.authOptions.clientId,e);return fe(this.executePostToTokenEndpoint.bind(this),K.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,o,s,c,e.correlationId,K.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(K.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(uT(n,e.embeddedClientId||((i=e.tokenBodyParameters)==null?void 0:i[fu])||this.config.authOptions.clientId),e.redirectUri&&dT(n,e.redirectUri),lT(n,e.scopes,!0,(o=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:o.defaultScopes),MB(n,B5.REFRESH_TOKEN_GRANT),gT(n),pT(n,this.config.libraryInfo),mT(n,this.config.telemetry.application),FB(n),this.serverTelemetryManager&&!jB(this.config)&&LB(n,this.serverTelemetryManager),xne(n,e.refreshToken),this.config.clientCredentials.clientSecret&&OB(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;IB(n,await KB(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),RB(n,s.assertionType)}if(e.authenticationScheme===vn.POP){const s=new Jd(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await fe(s.generateCnf.bind(s),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,vT(n,c)}else if(e.authenticationScheme===vn.SSH)if(e.sshJwk)$B(n,e.sshJwk);else throw jn(A0);if((!$s.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&fT(n,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Wo.HOME_ACCOUNT_ID:try{const s=Cd(e.ccsCredential.credential);lp(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Wo.UPN:ox(n,e.ccsCredential.credential);break}return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Mc(n,e.tokenBodyParameters),j0(n,e.correlationId,this.performanceClient),Xp(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Wne extends xT{constructor(e,n){super(e,n)}async acquireCachedToken(e){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(K.SilentFlowClientAcquireCachedToken,e.correlationId);let n=Cl.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!$s.isEmptyObj(e.claims))throw this.setCacheOutcome(Cl.FORCE_REFRESH_OR_CLAIMS,e.correlationId),we(Rc);if(!e.account)throw we(qE);const r=e.account.tenantId||Dne(e.authority),i=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,i,r);if(o){if(Nne(o.cachedAt)||sx(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Cl.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),we(Rc);o.refreshOn&&sx(o.refreshOn,0)&&(n=Cl.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Cl.NO_CACHED_ACCESS_TOKEN,e.correlationId),we(Rc);const s=e.authority||this.authority.getPreferredCache(),c={account:this.cacheManager.getAccount(this.cacheManager.generateAccountKey(e.account),e.correlationId),accessToken:o,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,i,r,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(s)};return this.setCacheOutcome(n,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await fe(this.generateResultFromCacheRecord.bind(this),K.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(c,e),n]}setCacheOutcome(e,n){var r,i;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(i=this.performanceClient)==null||i.addFields({cacheOutcome:e},n),e!==Cl.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.SilentFlowClientGenerateResultFromCacheRecord,n.correlationId);let r;if(e.idToken&&(r=Hf(e.idToken.secret,this.config.cryptoInterface.base64Decode)),n.maxAge||n.maxAge===0){const o=r==null?void 0:r.auth_time;if(!o)throw we(WE);bB(o,n.maxAge)}return hu.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,n,r)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const qne={sendGetRequestAsync:()=>Promise.reject(we(Vt)),sendPostRequestAsync:()=>Promise.reject(we(Vt))};/*! @azure/msal-common v15.10.0 2025-08-05 */function Yne(t,e,n,r){var c,l;const i=e.correlationId,o=new Map;uT(o,e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[fu])||t.clientId);const s=[...e.scopes||[],...e.extraScopesToConsent||[]];if(lT(o,s,!0,(l=t.authority.options.OIDCOptions)==null?void 0:l.defaultScopes),dT(o,e.redirectUri),hT(o,i),dne(o,e.responseMode),gT(o),e.prompt&&(gne(o,e.prompt),r==null||r.addFields({prompt:e.prompt},i)),e.domainHint&&(mne(o,e.domainHint),r==null||r.addFields({domainHintFromRequest:!0},i)),e.prompt!==pi.SELECT_ACCOUNT)if(e.sid&&e.prompt===pi.NONE)n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),_I(o,e.sid),r==null||r.addFields({sidFromRequest:!0},i);else if(e.account){const u=Jne(e.account);let d=Zne(e.account);if(d&&e.domainHint&&(n.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),d=null),d){n.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),dv(o,d),r==null||r.addFields({loginHintFromClaim:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(u&&e.prompt===pi.NONE){n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),_I(o,u),r==null||r.addFields({sidFromClaim:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)n.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),dv(o,e.loginHint),ox(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i);else if(e.account.username){n.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),dv(o,e.account.username),r==null||r.addFields({loginHintFromUpn:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(n.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),dv(o,e.loginHint),ox(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i));else n.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return e.nonce&&vne(o,e.nonce),e.state&&PB(o,e.state),(e.claims||t.clientCapabilities&&t.clientCapabilities.length>0)&&fT(o,e.claims,t.clientCapabilities),e.embeddedClientId&&E0(o,t.clientId,t.redirectUri),t.instanceAware&&(!e.extraQueryParameters||!Object.keys(e.extraQueryParameters).includes(oA))&&DB(o),o}function CT(t,e,n,r){const i=Xp(e,n,r);return en.appendQueryString(t.authorizationEndpoint,i)}function Qne(t,e){if(qB(t,e),!t.code)throw we(nB);return t}function qB(t,e){if(!t.state||!e)throw t.state?we(Z_,"Cached State"):we(Z_,"Server State");let n,r;try{n=decodeURIComponent(t.state)}catch{throw we(Xd,t.state)}try{r=decodeURIComponent(e)}catch{throw we(Xd,t.state)}if(n!==r)throw we(W5);if(t.error||t.error_description||t.suberror){const i=Xne(t);throw VB(t.error,t.error_description,t.suberror)?new ls(t.error||"",t.error_description,t.suberror,t.timestamp||"",t.trace_id||"",t.correlation_id||"",t.claims||"",i):new Tu(t.error||"",t.error_description,t.suberror,i)}}function Xne(t){var r,i;const e="code=",n=(r=t.error_uri)==null?void 0:r.lastIndexOf(e);return n&&n>=0?(i=t.error_uri)==null?void 0:i.substring(n+e.length):void 0}function Jne(t){var e;return((e=t.idTokenClaims)==null?void 0:e.sid)||null}function Zne(t){var e;return t.loginHint||((e=t.idTokenClaims)==null?void 0:e.login_hint)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */const kI=",",YB="|";function ere(t){const{skus:e,libraryName:n,libraryVersion:r,extensionName:i,extensionVersion:o}=t,s=new Map([[0,[n,r]],[2,[i,o]]]);let c=[];if(e!=null&&e.length){if(c=e.split(kI),c.length<4)return e}else c=Array.from({length:4},()=>YB);return s.forEach((l,u)=>{var d,f;l.length===2&&((d=l[0])!=null&&d.length)&&((f=l[1])!=null&&f.length)&&tre({skuArr:c,index:u,skuName:l[0],skuVersion:l[1]})}),c.join(kI)}function tre(t){const{skuArr:e,index:n,skuName:r,skuVersion:i}=t;n>=e.length||(e[n]=[r,i].join(YB))}class Jp{constructor(e,n){this.cacheOutcome=Cl.NOT_APPLICABLE,this.cacheManager=n,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||pe.EMPTY_STRING,this.wrapperVer=e.wrapperVer||pe.EMPTY_STRING,this.telemetryCacheKey=Lr.CACHE_KEY+Qp.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Lr.VALUE_SEPARATOR}${this.cacheOutcome}`,n=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&n.push(`broker_error=${r}`);const i=n.join(Lr.VALUE_SEPARATOR),o=this.getRegionDiscoveryFields(),s=[e,o].join(Lr.VALUE_SEPARATOR);return[Lr.SCHEMA_VERSION,s,i].join(Lr.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),n=Jp.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*n).join(Lr.VALUE_SEPARATOR),i=e.errors.slice(0,n).join(Lr.VALUE_SEPARATOR),o=e.errors.length,s=n=Lr.MAX_CACHED_ERRORS&&(n.failedRequests.shift(),n.failedRequests.shift(),n.errors.shift()),n.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof _n?e.subError?n.errors.push(e.subError):e.errorCode?n.errors.push(e.errorCode):n.errors.push(e.toString()):n.errors.push(e.toString()):n.errors.push(Lr.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),n=Jp.maxErrorsToSend(e),r=e.errors.length;if(n===r)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const i={failedRequests:e.failedRequests.slice(n*2),errors:e.errors.slice(n),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i,this.correlationId)}}static maxErrorsToSend(e){let n,r=0,i=0;const o=e.errors.length;for(n=0;nString.fromCodePoint(n)).join("");return btoa(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Zo(t){return new TextDecoder().decode(Dc(t))}function Dc(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw Ge(CU)}const n=atob(e);return Uint8Array.from(n,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const hre="RSASSA-PKCS1-v1_5",Gf="AES-GCM",NU="HKDF",OT="SHA-256",pre=2048,mre=new Uint8Array([1,0,1]),MI="0123456789abcdef",DI=new Uint32Array(1),IT="raw",PU="encrypt",RT="decrypt",gre="deriveKey",vre="crypto_subtle_undefined",MT={name:hre,hash:OT,modulusLength:pre,publicExponent:mre};function yre(t){if(!window)throw Ge(D0);if(!window.crypto)throw Ge(sA);if(!t&&!window.crypto.subtle)throw Ge(sA,vre)}async function kU(t,e,n){e==null||e.addQueueMeasurement(K.Sha256Digest,n);const i=new TextEncoder().encode(t);return window.crypto.subtle.digest(OT,i)}function xre(t){return window.crypto.getRandomValues(t)}function BS(){return window.crypto.getRandomValues(DI),DI[0]}function us(){const t=Date.now(),e=BS()*1024+(BS()&1023),n=new Uint8Array(16),r=Math.trunc(e/2**30),i=e&2**30-1,o=BS();n[0]=t/2**40,n[1]=t/2**32,n[2]=t/2**24,n[3]=t/2**16,n[4]=t/2**8,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=o>>>24,n[13]=o>>>16,n[14]=o>>>8,n[15]=o;let s="";for(let c=0;c>>4),s+=MI.charAt(n[c]&15),(c===3||c===5||c===7||c===9)&&(s+="-");return s}async function bre(t,e){return window.crypto.subtle.generateKey(MT,t,e)}async function US(t){return window.crypto.subtle.exportKey(EU,t)}async function wre(t,e,n){return window.crypto.subtle.importKey(EU,t,MT,e,n)}async function Sre(t,e){return window.crypto.subtle.sign(MT,t,e)}async function DT(){const t=await OU(),n={alg:"dir",kty:"oct",k:Xc(new Uint8Array(t))};return em(JSON.stringify(n))}async function Cre(t){const e=Zo(t),r=JSON.parse(e).k,i=Dc(r);return window.crypto.subtle.importKey(IT,i,Gf,!1,[RT])}async function _re(t,e){const n=e.split(".");if(n.length!==5)throw Ge(ty,"jwe_length");const r=await Cre(t).catch(()=>{throw Ge(ty,"import_key")});try{const i=new TextEncoder().encode(n[0]),o=Dc(n[2]),s=Dc(n[3]),c=Dc(n[4]),l=c.byteLength*8,u=new Uint8Array(s.length+c.length);u.set(s),u.set(c,s.length);const d=await window.crypto.subtle.decrypt({name:Gf,iv:o,tagLength:l,additionalData:i},r,u);return new TextDecoder().decode(d)}catch{throw Ge(ty,"decrypt")}}async function OU(){const t=await window.crypto.subtle.generateKey({name:Gf,length:256},!0,[PU,RT]);return window.crypto.subtle.exportKey(IT,t)}async function $I(t){return window.crypto.subtle.importKey(IT,t,NU,!1,[gre])}async function IU(t,e,n){return window.crypto.subtle.deriveKey({name:NU,salt:e,hash:OT,info:new TextEncoder().encode(n)},t,{name:Gf,length:256},!1,[PU,RT])}async function Are(t,e,n){const r=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(16)),o=await IU(t,i,n),s=await window.crypto.subtle.encrypt({name:Gf,iv:new Uint8Array(12)},o,r);return{data:Xc(new Uint8Array(s)),nonce:Xc(i)}}async function LI(t,e,n,r){const i=Dc(r),o=await IU(t,Dc(e),n),s=await window.crypto.subtle.decrypt({name:Gf,iv:new Uint8Array(12)},o,i);return new TextDecoder().decode(s)}async function RU(t){const e=await kU(t),n=new Uint8Array(e);return Xc(n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const tm="storage_not_supported",cr="stubbed_public_client_application_called",dx="in_mem_redirect_unavailable";/*! @azure/msal-browser v4.19.0 2025-08-05 */const ny={[tm]:"Given storage configuration option was not supported.",[cr]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[dx]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};ny[tm],ny[cr],ny[dx];class $T extends _n{constructor(e,n){super(e,n),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,$T.prototype)}}function lr(t){return new $T(t,ny[t])}/*! @azure/msal-browser v4.19.0 2025-08-05 */function MU(t){t.location.hash="",typeof t.history.replaceState=="function"&&t.history.replaceState(null,"",`${t.location.origin}${t.location.pathname}${t.location.search}`)}function jre(t){const e=t.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function LT(){return window.parent!==window}function Ere(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Ti.POPUP_NAME_PREFIX}.`)===0}function xa(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Tre(){const e=new en(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function Nre(){if(en.hashContainsKnownProperties(window.location.hash)&<())throw Ge(cU)}function Pre(t){if(LT()&&!t)throw Ge(aU)}function kre(){if(Ere())throw Ge(lU)}function DU(){if(typeof window>"u")throw Ge(D0)}function $U(t){if(!t)throw Ge(up)}function FT(t){DU(),Nre(),kre(),$U(t)}function FI(t,e){if(FT(t),Pre(e.system.allowRedirectInIframe),e.cache.cacheLocation===jr.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw lr(dx)}function LU(t){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(t).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function Ore(){return us()}/*! @azure/msal-browser v4.19.0 2025-08-05 */class fx{navigateInternal(e,n){return fx.defaultNavigateWindow(e,n)}navigateExternal(e,n){return fx.defaultNavigateWindow(e,n)}static defaultNavigateWindow(e,n){return n.noHistory?window.location.replace(e):window.location.assign(e),new Promise((r,i)=>{setTimeout(()=>{i(Ge(ux,"failed_to_redirect"))},n.timeout)})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ire{async sendGetRequestAsync(e,n){let r,i={},o=0;const s=BI(n);try{r=await fetch(e,{method:II.GET,headers:s})}catch(c){throw Vh(Ge(window.navigator.onLine?pU:lx),void 0,void 0,c)}i=UI(r.headers);try{return o=r.status,{headers:i,body:await r.json(),status:o}}catch(c){throw Vh(Ge(aA),o,i,c)}}async sendPostRequestAsync(e,n){const r=n&&n.body||"",i=BI(n);let o,s=0,c={};try{o=await fetch(e,{method:II.POST,headers:i,body:r})}catch(l){throw Vh(Ge(window.navigator.onLine?hU:lx),void 0,void 0,l)}c=UI(o.headers);try{return s=o.status,{headers:c,body:await o.json(),status:s}}catch(l){throw Vh(Ge(aA),s,c,l)}}}function BI(t){try{const e=new Headers;if(!(t&&t.headers))return e;const n=t.headers;return Object.entries(n).forEach(([r,i])=>{e.append(r,i)}),e}catch(e){throw Vh(Ge(AU),void 0,void 0,e)}}function UI(t){try{const e={};return t.forEach((n,r)=>{e[r]=n}),e}catch{throw Ge(jU)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Rre=6e4,lA=1e4,Mre=3e4,FU=2e3;function Dre({auth:t,cache:e,system:n,telemetry:r},i){const o={clientId:pe.EMPTY_STRING,authority:`${pe.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:pe.EMPTY_STRING,authorityMetadata:pe.EMPTY_STRING,redirectUri:typeof window<"u"?xa():"",postLogoutRedirectUri:pe.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Di.AAD,OIDCOptions:{serverResponseType:_0.FRAGMENT,defaultScopes:[pe.OPENID_SCOPE,pe.PROFILE_SCOPE,pe.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:ZE.None,tenant:pe.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1,encodeExtraQueryParams:!1},s={cacheLocation:jr.SessionStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===jr.LocalStorage),claimsBasedCachingEnabled:!1},c={loggerCallback:()=>{},logLevel:Mn.Info,piiLoggingEnabled:!1},u={...{...AB,loggerOptions:c,networkClient:i?new Ire:qne,navigationClient:new fx,loadFrameTimeout:0,windowHashTimeout:(n==null?void 0:n.loadFrameTimeout)||Rre,iframeHashTimeout:(n==null?void 0:n.loadFrameTimeout)||lA,navigateFrameWait:0,redirectNavigationTimeout:Mre,asyncPopups:!1,allowRedirectInIframe:!1,allowPlatformBroker:!1,nativeBrokerHandshakeTimeout:(n==null?void 0:n.nativeBrokerHandshakeTimeout)||FU,pollIntervalMilliseconds:Ti.DEFAULT_POLL_INTERVAL_MS},...n,loggerOptions:(n==null?void 0:n.loggerOptions)||c},d={application:{appName:pe.EMPTY_STRING,appVersion:pe.EMPTY_STRING},client:new _B};if((t==null?void 0:t.protocolMode)!==Di.OIDC&&(t!=null&&t.OIDCOptions)&&new Da(u.loggerOptions).warning(JSON.stringify(jn(mB))),t!=null&&t.protocolMode&&t.protocolMode===Di.OIDC&&(u!=null&&u.allowPlatformBroker))throw jn(gB);return{auth:{...o,...t,OIDCOptions:{...o.OIDCOptions,...t==null?void 0:t.OIDCOptions}},cache:{...s,...e},system:u,telemetry:{...d,...r}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const $re="@azure/msal-browser",pu="4.19.0";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Pr="msal",BT="browser",HS="-",ec=1,uA=1,Lre=`${Pr}.${BT}.log.level`,Fre=`${Pr}.${BT}.log.pii`,Bre=`${Pr}.${BT}.platform.auth.dom`,HI=`${Pr}.version`,zI="account.keys",GI="token.keys";function ws(t=uA){return t<1?`${Pr}.${zI}`:`${Pr}.${t}.${zI}`}function Il(t,e=ec){return e<1?`${Pr}.${GI}.${t}`:`${Pr}.${e}.${GI}.${t}`}/*! @azure/msal-browser v4.19.0 2025-08-05 */class UT{static loggerCallback(e,n){switch(e){case Mn.Error:console.error(n);return;case Mn.Info:console.info(n);return;case Mn.Verbose:console.debug(n);return;case Mn.Warning:console.warn(n);return;default:console.log(n);return}}constructor(e){var l;this.browserEnvironment=typeof window<"u",this.config=Dre(e,this.browserEnvironment);let n;try{n=window[jr.SessionStorage]}catch{}const r=n==null?void 0:n.getItem(Lre),i=(l=n==null?void 0:n.getItem(Fre))==null?void 0:l.toLowerCase(),o=i==="true"?!0:i==="false"?!1:void 0,s={...this.config.system.loggerOptions},c=r&&Object.keys(Mn).includes(r)?Mn[r]:void 0;c&&(s.loggerCallback=UT.loggerCallback,s.logLevel=c),o!==void 0&&(s.piiLoggingEnabled=o),this.logger=new Da(s,$re,pu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mu extends UT{getModuleName(){return mu.MODULE_NAME}getId(){return mu.ID}async initialize(){return this.available=typeof window<"u",this.available}}mu.MODULE_NAME="";mu.ID="StandardOperatingContext";/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ure{constructor(){this.dbName=cA,this.version=ure,this.tableName=dre,this.dbOpen=!1}async open(){return new Promise((e,n)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",i=>{const o=i;this.db=o.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>n(Ge(PT)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);s.addEventListener("success",c=>{const l=c;this.closeConnection(),n(l.target.result)}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async setItem(e,n){return await this.validateDbIsOpen(),new Promise((r,i)=>{if(!this.db)return i(Ge(Wu));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(n,e);c.addEventListener("success",()=>{this.closeConnection(),r()}),c.addEventListener("error",l=>{this.closeConnection(),i(l)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);s.addEventListener("success",()=>{this.closeConnection(),n()}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,n)=>{if(!this.db)return n(Ge(Wu));const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();o.addEventListener("success",s=>{const c=s;this.closeConnection(),e(c.target.result)}),o.addEventListener("error",s=>{this.closeConnection(),n(s)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);s.addEventListener("success",c=>{const l=c;this.closeConnection(),n(l.target.result===1)}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,n)=>{const r=window.indexedDB.deleteDatabase(cA),i=setTimeout(()=>n(!1),200);r.addEventListener("success",()=>(clearTimeout(i),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),r.addEventListener("error",()=>(clearTimeout(i),n(!1)))})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class $0{constructor(){this.cache=new Map}async initialize(){}getItem(e){return this.cache.get(e)||null}getUserData(e){return this.getItem(e)}setItem(e,n){this.cache.set(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((n,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Hre{constructor(e){this.inMemoryCache=new $0,this.indexedDBCache=new Ure,this.logger=e}handleDatabaseAccessError(e){if(e instanceof yg&&e.errorCode===PT)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const n=this.inMemoryCache.getItem(e);if(!n)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return n}async setItem(e,n){this.inMemoryCache.setItem(e,n);try{await this.indexedDBCache.setItem(e,n)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(n){this.handleDatabaseAccessError(n)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(n){this.handleDatabaseAccessError(n)}return e}async containsKey(e){const n=this.inMemoryCache.containsKey(e);if(!n)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return n}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class $a{constructor(e,n,r){this.logger=e,yre(r??!1),this.cache=new Hre(this.logger),this.performanceClient=n}createNewGuid(){return us()}base64Encode(e){return em(e)}base64Decode(e){return Zo(e)}base64UrlEncode(e){return pv(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var d;const n=(d=this.performanceClient)==null?void 0:d.startMeasurement(K.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await bre($a.EXTRACTABLE,$a.POP_KEY_USAGES),i=await US(r.publicKey),o={e:i.e,kty:i.kty,n:i.n},s=VI(o),c=await this.hashString(s),l=await US(r.privateKey),u=await wre(l,!1,["sign"]);return await this.cache.setItem(c,{privateKey:u,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),n&&n.end({success:!0}),c}async removeTokenBindingKey(e){if(await this.cache.removeItem(e),await this.cache.containsKey(e))throw we(rB)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,n,r,i){var w;const o=(w=this.performanceClient)==null?void 0:w.startMeasurement(K.CryptoOptsSignJwt,i),s=await this.cache.getItem(n);if(!s)throw Ge(NT);const c=await US(s.publicKey),l=VI(c),u=pv(JSON.stringify({kid:n})),d=AT.getShrHeaderString({...r==null?void 0:r.header,alg:c.alg,kid:u}),f=pv(d);e.cnf={jwk:JSON.parse(l)};const h=pv(JSON.stringify(e)),p=`${f}.${h}`,m=new TextEncoder().encode(p),y=await Sre(s.privateKey,m),b=Xc(new Uint8Array(y)),x=`${p}.${b}`;return o&&o.end({success:!0}),x}async hashString(e){return RU(e)}}$a.POP_KEY_USAGES=["sign","verify"];$a.EXTRACTABLE=!0;function VI(t){return JSON.stringify(t,Object.keys(t).sort())}/*! @azure/msal-browser v4.19.0 2025-08-05 */const zre=24*60*60*1e3,dA={Lax:"Lax",None:"None"};class BU{initialize(){return Promise.resolve()}getItem(e){const n=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let i=0;i{const i=decodeURIComponent(r).trim().split("=");n.push(i[0])}),n}containsKey(e){return this.getKeys().includes(e)}decryptData(){return Promise.resolve(null)}}function Gre(t){const e=new Date;return new Date(e.getTime()+t*zre).toUTCString()}/*! @azure/msal-browser v4.19.0 2025-08-05 */function dp(t,e){const n=t.getItem(ws(e));return n?JSON.parse(n):[]}function fp(t,e,n){const r=e.getItem(Il(t,n));if(r){const i=JSON.parse(r);if(i&&i.hasOwnProperty("idToken")&&i.hasOwnProperty("accessToken")&&i.hasOwnProperty("refreshToken"))return i}return{idToken:[],accessToken:[],refreshToken:[]}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function fA(t){return t.hasOwnProperty("id")&&t.hasOwnProperty("nonce")&&t.hasOwnProperty("data")}/*! @azure/msal-browser v4.19.0 2025-08-05 */const KI="msal.cache.encryption",Vre="msal.broadcast.cache";class Kre{constructor(e,n,r){if(!window.localStorage)throw lr(tm);this.memoryStorage=new $0,this.initialized=!1,this.clientId=e,this.logger=n,this.performanceClient=r,this.broadcast=new BroadcastChannel(Vre)}async initialize(e){const n=new BU,r=n.getItem(KI);let i={key:"",id:""};if(r)try{i=JSON.parse(r)}catch{}if(i.key&&i.id){const o=Zi(Dc,K.Base64Decode,this.logger,this.performanceClient,e)(i.key);this.encryptionCookie={id:i.id,key:await fe($I,K.GenerateHKDF,this.logger,this.performanceClient,e)(o)}}else{const o=us(),s=await fe(OU,K.GenerateBaseKey,this.logger,this.performanceClient,e)(),c=Zi(Xc,K.UrlEncodeArr,this.logger,this.performanceClient,e)(new Uint8Array(s));this.encryptionCookie={id:o,key:await fe($I,K.GenerateHKDF,this.logger,this.performanceClient,e)(s)};const l={id:o,key:c};n.setItem(KI,JSON.stringify(l),0,!0,dA.None)}await fe(this.importExistingCache.bind(this),K.ImportExistingCache,this.logger,this.performanceClient,e)(e),this.broadcast.addEventListener("message",this.updateCache.bind(this)),this.initialized=!0}getItem(e){return window.localStorage.getItem(e)}getUserData(e){if(!this.initialized)throw Ge(up);return this.memoryStorage.getItem(e)}async decryptData(e,n,r){if(!this.initialized||!this.encryptionCookie)throw Ge(up);if(n.id!==this.encryptionCookie.id)return this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},r),null;const i=await fe(LI,K.Decrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n.nonce,this.getContext(e),n.data);if(!i)return null;try{return JSON.parse(i)}catch{return this.performanceClient.incrementFields({encryptedCacheCorruptionCount:1},r),null}}setItem(e,n){window.localStorage.setItem(e,n)}async setUserData(e,n,r,i){if(!this.initialized||!this.encryptionCookie)throw Ge(up);const{data:o,nonce:s}=await fe(Are,K.Encrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n,this.getContext(e)),c={id:this.encryptionCookie.id,nonce:s,data:o,lastUpdatedAt:i};this.memoryStorage.setItem(e,n),this.setItem(e,JSON.stringify(c)),this.broadcast.postMessage({key:e,value:n,context:this.getContext(e)})}removeItem(e){this.memoryStorage.containsKey(e)&&(this.memoryStorage.removeItem(e),this.broadcast.postMessage({key:e,value:null,context:this.getContext(e)})),window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}clear(){this.memoryStorage.clear(),dp(this).forEach(r=>this.removeItem(r));const n=fp(this.clientId,this);n.idToken.forEach(r=>this.removeItem(r)),n.accessToken.forEach(r=>this.removeItem(r)),n.refreshToken.forEach(r=>this.removeItem(r)),this.getKeys().forEach(r=>{(r.startsWith(Pr)||r.indexOf(this.clientId)!==-1)&&this.removeItem(r)})}async importExistingCache(e){if(!this.encryptionCookie)return;let n=dp(this);n=await this.importArray(n,e),n.length?this.setItem(ws(),JSON.stringify(n)):this.removeItem(ws());const r=fp(this.clientId,this);r.idToken=await this.importArray(r.idToken,e),r.accessToken=await this.importArray(r.accessToken,e),r.refreshToken=await this.importArray(r.refreshToken,e),r.idToken.length||r.accessToken.length||r.refreshToken.length?this.setItem(Il(this.clientId),JSON.stringify(r)):this.removeItem(Il(this.clientId))}async getItemFromEncryptedCache(e,n){if(!this.encryptionCookie)return null;const r=this.getItem(e);if(!r)return null;let i;try{i=JSON.parse(r)}catch{return null}return fA(i)?i.id!==this.encryptionCookie.id?(this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},n),null):fe(LI,K.Decrypt,this.logger,this.performanceClient,n)(this.encryptionCookie.key,i.nonce,this.getContext(e),i.data):(this.performanceClient.incrementFields({unencryptedCacheCount:1},n),i)}async importArray(e,n){const r=[],i=[];return e.forEach(o=>{const s=this.getItemFromEncryptedCache(o,n).then(c=>{c?(this.memoryStorage.setItem(o,c),r.push(o)):this.removeItem(o)});i.push(s)}),await Promise.all(i),r}getContext(e){let n="";return e.includes(this.clientId)&&(n=this.clientId),n}updateCache(e){this.logger.trace("Updating internal cache from broadcast event");const n=this.performanceClient.startMeasurement(K.LocalStorageUpdated);n.add({isBackground:!0});const{key:r,value:i,context:o}=e.data;if(!r){this.logger.error("Broadcast event missing key"),n.end({success:!1,errorCode:"noKey"});return}if(o&&o!==this.clientId){this.logger.trace(`Ignoring broadcast event from clientId: ${o}`),n.end({success:!1,errorCode:"contextMismatch"});return}i?(this.memoryStorage.setItem(r,i),this.logger.verbose("Updated item in internal cache")):(this.memoryStorage.removeItem(r),this.logger.verbose("Removed item from internal cache")),n.end({success:!0})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Wre{constructor(){if(!window.sessionStorage)throw lr(tm)}async initialize(){}getItem(e){return window.sessionStorage.getItem(e)}getUserData(e){return this.getItem(e)}setItem(e,n){window.sessionStorage.setItem(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Qe={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache",BROKER_CONNECTION_ESTABLISHED:"msal:brokerConnectionEstablished"};/*! @azure/msal-browser v4.19.0 2025-08-05 */function WI(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class hA extends iA{constructor(e,n,r,i,o,s,c){super(e,r,i,o,c),this.cacheConfig=n,this.logger=i,this.internalStorage=new $0,this.browserStorage=qI(e,n.cacheLocation,i,o),this.temporaryCacheStorage=qI(e,n.temporaryCacheLocation,i,o),this.cookieStorage=new BU,this.eventHandler=s}async initialize(e){this.performanceClient.addFields({cacheLocation:this.cacheConfig.cacheLocation,cacheRetentionDays:this.cacheConfig.cacheRetentionDays},e),await this.browserStorage.initialize(e),await this.migrateExistingCache(e),this.trackVersionChanges(e)}async migrateExistingCache(e){const n=dp(this.browserStorage,0),r=fp(this.clientId,this.browserStorage,0);this.performanceClient.addFields({oldAccountCount:n.length,oldAccessCount:r.accessToken.length,oldIdCount:r.idToken.length,oldRefreshCount:r.refreshToken.length},e);const i=dp(this.browserStorage,1),o=fp(this.clientId,this.browserStorage,1);this.performanceClient.addFields({currAccountCount:i.length,currAccessCount:o.accessToken.length,currIdCount:o.idToken.length,currRefreshCount:o.refreshToken.length},e),await Promise.all([this.updateV0ToCurrent(uA,n,i,e),this.updateV0ToCurrent(ec,r.idToken,o.idToken,e),this.updateV0ToCurrent(ec,r.accessToken,o.accessToken,e),this.updateV0ToCurrent(ec,r.refreshToken,o.refreshToken,e)]),n.length>0?this.browserStorage.setItem(ws(0),JSON.stringify(n)):this.browserStorage.removeItem(ws(0)),i.length>0?this.browserStorage.setItem(ws(1),JSON.stringify(i)):this.browserStorage.removeItem(ws(1)),this.setTokenKeys(r,e,0),this.setTokenKeys(o,e,1)}async updateV0ToCurrent(e,n,r,i){const o=[];for(const s of[...n]){const c=this.browserStorage.getItem(s),l=this.validateAndParseJson(c||"");if(!l){WI(n,s);continue}l.lastUpdatedAt||(l.lastUpdatedAt=Date.now().toString(),this.setItem(s,JSON.stringify(l),i));const u=fA(l)?await this.browserStorage.decryptData(s,l,i):l;let d;if(u&&(jI(u)||EI(u))&&(d=u.expiresOn),!u||Tne(l.lastUpdatedAt,this.cacheConfig.cacheRetentionDays)||d&&sx(d,U5)){this.browserStorage.removeItem(s),WI(n,s),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},i);continue}if(this.cacheConfig.cacheLocation!==jr.LocalStorage||fA(l)){const f=`${Pr}.${e}${HS}${s}`,h=this.browserStorage.getItem(f);if(h){const p=this.validateAndParseJson(h);if(Number(l.lastUpdatedAt)>Number(p.lastUpdatedAt)){o.push(this.setUserData(f,JSON.stringify(u),i,l.lastUpdatedAt).then(()=>{this.performanceClient.incrementFields({updatedCacheFromV0Count:1},i)}));continue}}else{o.push(this.setUserData(f,JSON.stringify(u),i,l.lastUpdatedAt).then(()=>{r.push(f),this.performanceClient.incrementFields({upgradedCacheCount:1},i)}));continue}}}return Promise.all(o)}trackVersionChanges(e){const n=this.browserStorage.getItem(HI);n&&(this.logger.info(`MSAL.js was last initialized by version: ${n}`),this.performanceClient.addFields({previousLibraryVersion:n},e)),n!==pu&&this.setItem(HI,pu,e)}validateAndParseJson(e){if(!e)return null;try{const n=JSON.parse(e);return n&&typeof n=="object"?n:null}catch{return null}}setItem(e,n,r){let i=0,o=[];const s=20;for(let c=0;c<=s;c++)try{this.browserStorage.setItem(e,n),c>0&&(c<=i?this.removeAccessTokenKeys(o.slice(0,c),r,0):(this.removeAccessTokenKeys(o.slice(0,i),r,0),this.removeAccessTokenKeys(o.slice(i,c),r)));break}catch(l){const u=rA(l);if(u.errorCode===tx&&c0&&(l<=o?this.removeAccessTokenKeys(s.slice(0,l),r,0):(this.removeAccessTokenKeys(s.slice(0,o),r,0),this.removeAccessTokenKeys(s.slice(o,l),r)));break}catch(u){const d=rA(u);if(d.errorCode===tx&&l-1){if(r.splice(i,1),r.length===0){this.removeItem(ws());return}else this.setItem(ws(),JSON.stringify(r),n);this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")}else this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}removeAccount(e,n){const r=this.getActiveAccount(n);(r==null?void 0:r.homeAccountId)===e.homeAccountId&&(r==null?void 0:r.environment)===e.environment&&this.setActiveAccount(null,n),super.removeAccount(e,n),this.removeAccountKeyFromMap(this.generateAccountKey(e),n),this.browserStorage.getKeys().forEach(i=>{i.includes(e.homeAccountId)&&i.includes(e.environment)&&this.browserStorage.removeItem(i)}),this.cacheConfig.cacheLocation===jr.LocalStorage&&this.eventHandler.emitEvent(Qe.ACCOUNT_REMOVED,void 0,e)}removeIdToken(e,n){super.removeIdToken(e,n);const r=this.getTokenKeys(),i=r.idToken.indexOf(e);i>-1&&(this.logger.info("idToken removed from tokenKeys map"),r.idToken.splice(i,1),this.setTokenKeys(r,n))}removeAccessToken(e,n,r=!0){super.removeAccessToken(e,n),r&&this.removeAccessTokenKeys([e],n)}removeAccessTokenKeys(e,n,r=ec){this.logger.trace("removeAccessTokenKey called");const i=this.getTokenKeys(r);let o=0;if(e.forEach(s=>{const c=i.accessToken.indexOf(s);c>-1&&(i.accessToken.splice(c,1),o++)}),o>0){this.logger.info(`removed ${o} accessToken keys from tokenKeys map`),this.setTokenKeys(i,n,r);return}}removeRefreshToken(e,n){super.removeRefreshToken(e,n);const r=this.getTokenKeys(),i=r.refreshToken.indexOf(e);i>-1&&(this.logger.info("refreshToken removed from tokenKeys map"),r.refreshToken.splice(i,1),this.setTokenKeys(r,n))}getTokenKeys(e=ec){return fp(this.clientId,this.browserStorage,e)}setTokenKeys(e,n,r=ec){if(e.idToken.length===0&&e.accessToken.length===0&&e.refreshToken.length===0){this.removeItem(Il(this.clientId,r));return}else this.setItem(Il(this.clientId,r),JSON.stringify(e),n)}getIdTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!Pne(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),i)}async setIdTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.idToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),o.idToken.push(r),this.setTokenKeys(o,n))}getAccessTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeAccessTokenKeys([e],n),null;const i=this.validateAndParseJson(r);return!i||!jI(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),i)}async setAccessTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys(),s=o.accessToken.indexOf(r);s!==-1&&o.accessToken.splice(s,1),this.logger.trace(`access token ${s===-1?"added to":"updated in"} map`),o.accessToken.push(r),this.setTokenKeys(o,n)}getRefreshTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeRefreshToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!EI(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),i)}async setRefreshTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.refreshToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),o.refreshToken.push(r),this.setTokenKeys(o,n))}getAppMetadata(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!Rne(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e,n){this.logger.trace("BrowserCacheManager.setAppMetadata called");const r=Ine(e);this.setItem(r,JSON.stringify(e),n)}getServerTelemetry(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!kne(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,n,r){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(n),r)}getAuthorityMetadata(e){const n=this.internalStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return r&&Mne(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(n=>this.isAuthorityMetadata(n))}setWrapperMetadata(e,n){this.internalStorage.setItem(hv.WRAPPER_SKU,e),this.internalStorage.setItem(hv.WRAPPER_VER,n)}getWrapperMetadata(){const e=this.internalStorage.getItem(hv.WRAPPER_SKU)||pe.EMPTY_STRING,n=this.internalStorage.getItem(hv.WRAPPER_VER)||pe.EMPTY_STRING;return[e,n]}setAuthorityMetadata(e,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(n))}getActiveAccount(e){const n=this.generateCacheKey(mI.ACTIVE_ACCOUNT_FILTERS),r=this.browserStorage.getItem(n);if(!r)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters found"),null;const i=this.validateAndParseJson(r);return i?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:i.homeAccountId,localAccountId:i.localAccountId,tenantId:i.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,n){const r=this.generateCacheKey(mI.ACTIVE_ACCOUNT_FILTERS);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:$i().toString()};this.setItem(r,JSON.stringify(i),n)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(r);this.eventHandler.emitEvent(Qe.ACTIVE_ACCOUNT_CHANGED)}getThrottlingCache(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!One(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,n,r){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(n),r)}getTemporaryCache(e,n){const r=n?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const o=this.cookieStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),o}const i=this.temporaryCacheStorage.getItem(r);if(!i){if(this.cacheConfig.cacheLocation===jr.LocalStorage){const o=this.browserStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),o}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,n,r){const i=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,n,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}clear(e){this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(n=>{(n.indexOf(Pr)!==-1||n.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(n)}),this.browserStorage.getKeys().forEach(n=>{(n.indexOf(Pr)!==-1||n.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(n)}),this.internalStorage.clear()}clearTokensAndKeysWithClaims(e){this.performanceClient.addQueueMeasurement(K.ClearTokensAndKeysWithClaims,e);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(i=>{const o=this.getAccessTokenCredential(i,e);o!=null&&o.requestedClaimsHash&&i.includes(o.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(i,e),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return $s.startsWith(e,Pr)?e:`${Pr}.${this.clientId}.${e}`}generateCredentialKey(e){const n=e.credentialType===Hr.REFRESH_TOKEN&&e.familyId||e.clientId,r=e.tokenType&&e.tokenType.toLowerCase()!==vn.BEARER.toLowerCase()?e.tokenType.toLowerCase():"";return[`${Pr}.${ec}`,e.homeAccountId,e.environment,e.credentialType,n,e.realm||"",e.target||"",e.requestedClaimsHash||"",r].join(HS).toLowerCase()}generateAccountKey(e){const n=e.homeAccountId.split(".")[1];return[`${Pr}.${uA}`,e.homeAccountId,e.environment,n||e.tenantId||""].join(HS).toLowerCase()}resetRequestCache(){this.logger.trace("BrowserCacheManager.resetRequestCache called"),this.removeTemporaryItem(this.generateCacheKey(dr.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(dr.VERIFIER)),this.removeTemporaryItem(this.generateCacheKey(dr.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(dr.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(dr.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cacheAuthorizeRequest(e,n){this.logger.trace("BrowserCacheManager.cacheAuthorizeRequest called");const r=em(JSON.stringify(e));if(this.setTemporaryCache(dr.REQUEST_PARAMS,r,!0),n){const i=em(n);this.setTemporaryCache(dr.VERIFIER,i,!0)}}getCachedRequest(){this.logger.trace("BrowserCacheManager.getCachedRequest called");const e=this.getTemporaryCache(dr.REQUEST_PARAMS,!0);if(!e)throw Ge(dU);const n=this.getTemporaryCache(dr.VERIFIER,!0);let r,i="";try{r=JSON.parse(Zo(e)),n&&(i=Zo(n))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${e}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),Ge(fU)}return[r,i]}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(dr.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const n=this.validateAndParseJson(e);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){var r;const n=(r=this.getInteractionInProgress())==null?void 0:r.clientId;return e?n===this.clientId:!!n}getInteractionInProgress(){const e=`${Pr}.${dr.INTERACTION_STATUS_KEY}`,n=this.getTemporaryCache(e,!1);try{return n?JSON.parse(n):null}catch{return this.logger.error("Cannot parse interaction status. Removing temporary cache items and clearing url hash. Retrying interaction should fix the error"),this.removeTemporaryItem(e),this.resetRequestCache(),MU(window),null}}setInteractionInProgress(e,n=lc.SIGNIN){var i;const r=`${Pr}.${dr.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw Ge(rU);this.setTemporaryCache(r,JSON.stringify({clientId:this.clientId,type:n}),!1)}else!e&&((i=this.getInteractionInProgress())==null?void 0:i.clientId)===this.clientId&&this.removeTemporaryItem(r)}async hydrateCache(e,n){var c,l,u;const r=N0((c=e.account)==null?void 0:c.homeAccountId,(l=e.account)==null?void 0:l.environment,e.idToken,this.clientId,e.tenantId);let i;n.claims&&(i=await this.cryptoImpl.hashString(n.claims));const o=P0((u=e.account)==null?void 0:u.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?AI(e.expiresOn):0,e.extExpiresOn?AI(e.extExpiresOn):0,Zo,void 0,e.tokenType,void 0,n.sshKid,n.claims,i),s={idToken:r,accessToken:o};return this.saveCacheRecord(s,e.correlationId)}async saveCacheRecord(e,n,r){try{await super.saveCacheRecord(e,n,r)}catch(i){if(i instanceof Sd&&this.performanceClient&&n)try{const o=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:o.refreshToken.length,cacheIdCount:o.idToken.length,cacheAtCount:o.accessToken.length},n)}catch{}throw i}}}function qI(t,e,n,r){try{switch(e){case jr.LocalStorage:return new Kre(t,n,r);case jr.SessionStorage:return new Wre;case jr.MemoryStorage:default:break}}catch(i){n.error(i)}return new $0}const qre=(t,e,n,r)=>{const i={cacheLocation:jr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new hA(t,i,Jy,e,n,r)};/*! @azure/msal-browser v4.19.0 2025-08-05 */function Yre(t,e,n,r,i){return t.verbose("getAllAccounts called"),n?e.getAllAccounts(i||{},r):[]}function Qre(t,e,n,r){if(e.trace("getAccount called"),Object.keys(t).length===0)return e.warning("getAccount: No accountFilter provided"),null;const i=n.getAccountInfoFilteredBy(t,r);return i?(e.verbose("getAccount: Account matching provided filter found, returning"),i):(e.verbose("getAccount: No matching account found, returning null"),null)}function Xre(t,e,n,r){if(e.trace("getAccountByUsername called"),!t)return e.warning("getAccountByUsername: No username provided"),null;const i=n.getAccountInfoFilteredBy({username:t},r);return i?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${t}`),i):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function Jre(t,e,n,r){if(e.trace("getAccountByHomeId called"),!t)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const i=n.getAccountInfoFilteredBy({homeAccountId:t},r);return i?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${t}`),i):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function Zre(t,e,n,r){if(e.trace("getAccountByLocalId called"),!t)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const i=n.getAccountInfoFilteredBy({localAccountId:t},r);return i?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${t}`),i):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function eie(t,e,n){e.setActiveAccount(t,n)}function tie(t,e){return t.getActiveAccount(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const nie="msal.broadcast.event";class rie{constructor(e){this.eventCallbacks=new Map,this.logger=e||new Da({}),typeof BroadcastChannel<"u"&&(this.broadcastChannel=new BroadcastChannel(nie)),this.invokeCrossTabCallbacks=this.invokeCrossTabCallbacks.bind(this)}addEventCallback(e,n,r){if(typeof window<"u"){const i=r||Ore();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,n||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,n,r,i){var s;const o={eventType:e,interactionType:n||null,payload:r||null,error:i||null,timestamp:Date.now()};switch(e){case Qe.ACCOUNT_ADDED:case Qe.ACCOUNT_REMOVED:case Qe.ACTIVE_ACCOUNT_CHANGED:(s=this.broadcastChannel)==null||s.postMessage(o);break;default:this.invokeCallbacks(o);break}}invokeCallbacks(e){this.eventCallbacks.forEach(([n,r],i)=>{(r.length===0||r.includes(e.eventType))&&(this.logger.verbose(`Emitting event to callback ${i}: ${e.eventType}`),n.apply(null,[e]))})}invokeCrossTabCallbacks(e){const n=e.data;this.invokeCallbacks(n)}subscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.addEventListener("message",this.invokeCrossTabCallbacks)}unsubscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.removeEventListener("message",this.invokeCrossTabCallbacks)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class UU{constructor(e,n,r,i,o,s,c,l,u){this.config=e,this.browserStorage=n,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=s,this.platformAuthProvider=l,this.correlationId=u||us(),this.logger=i.clone(Ti.MSAL_SKU,pu,this.correlationId),this.performanceClient=c}async clearCacheOnLogout(e,n){if(n)try{this.browserStorage.removeAccount(n,e),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),this.browserStorage.clear(e),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const n=e||this.config.auth.redirectUri;return en.getAbsoluteUrl(n,xa())}initializeServerTelemetryManager(e,n){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:n||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Jp(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:n}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(K.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},o=e.requestAuthority||this.config.auth.authority,s=r!=null&&r.length?r==="true":this.config.auth.instanceAware,c=n&&s?this.config.auth.authority.replace(en.getDomainFromUrl(o),n.environment):o,l=Zr.generateAuthority(c,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),u=await fe(HB,K.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(l,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(n&&!u.isAlias(n.environment))throw jn(vB);return u}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function HT(t,e,n,r){n.addQueueMeasurement(K.InitializeBaseRequest,t.correlationId);const i=t.authority||e.auth.authority,o=[...t&&t.scopes||[]],s={...t,correlationId:t.correlationId,authority:i,scopes:o};if(!s.authenticationScheme)s.authenticationScheme=vn.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(s.authenticationScheme===vn.SSH){if(!t.sshJwk)throw jn(A0);if(!t.sshKid)throw jn(pB)}r.verbose(`Authentication Scheme set to "${s.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&t.claims&&!$s.isEmptyObj(t.claims)&&(s.requestedClaimsHash=await RU(t.claims)),s}async function iie(t,e,n,r,i){r.addQueueMeasurement(K.InitializeSilentRequest,t.correlationId);const o=await fe(HT,K.InitializeBaseRequest,i,r,t.correlationId)(t,n,r,i);return{...t,...o,account:e,forceRefresh:t.forceRefresh||!1}}function HU(t,e){let n;const r=t.httpMethod;if(e===Di.EAR){if(n=r||Ol.POST,n!==Ol.POST)throw jn(yB)}else n=r||Ol.GET;if(t.authorizePostBodyParameters&&n!==Ol.POST)throw jn(xB);return n}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Vf extends UU{initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const n={correlationId:this.correlationId||us(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=en.getAbsoluteUrl(e.postLogoutRedirectUri,xa())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=en.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,xa())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=en.getAbsoluteUrl(xa(),xa())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n}getLogoutHintFromIdTokenClaims(e){const n=e.idTokenClaims;if(n){if(n.login_hint)return n.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(K.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const n=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new WB(n,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:n,requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}=e;this.performanceClient.addQueueMeasurement(K.StandardInteractionClientGetClientConfiguration,this.correlationId);const c=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}),l=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:c,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:l.loggerCallback,piiLoggingEnabled:l.piiLoggingEnabled,logLevel:l.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:n,libraryInfo:{sku:Ti.MSAL_SKU,version:pu,cpu:pe.EMPTY_STRING,os:pe.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,n){this.performanceClient.addQueueMeasurement(K.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),i={interactionType:n},o=zf.setRequestState(this.browserCrypto,e&&e.state||pe.EMPTY_STRING,i),c={...await fe(HT,K.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:o,nonce:e.nonce||us(),responseMode:this.config.auth.OIDCOptions.serverResponseType},l={...c,httpMethod:HU(c,this.config.auth.protocolMode)};if(e.loginHint||e.sid)return l;const u=e.account||this.browserStorage.getActiveAccount(this.correlationId);return u&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${u.homeAccountId}`,this.correlationId),l.account=u),l}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function oie(t,e){if(!e)return null;try{return zf.parseRequestState(t,e).libraryState.meta}catch{throw we(Xd)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function hp(t,e,n){const r=Zy(t);if(!r)throw wB(t)?(n.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${e} detected is: ${t}`),Ge(eU)):(n.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),Ge(ZB));return r}function sie(t,e,n){if(!t.state)throw Ge(TT);const r=oie(e,t.state);if(!r)throw Ge(tU);if(r.interactionType!==n)throw Ge(nU)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class zU{constructor(e,n,r,i,o){this.authModule=e,this.browserStorage=n,this.authCodeRequest=r,this.logger=i,this.performanceClient=o}async handleCodeResponse(e,n){this.performanceClient.addQueueMeasurement(K.HandleCodeResponse,n.correlationId);let r;try{r=Qne(e,n.state)}catch(i){throw i instanceof Tu&&i.subError===Zp?Ge(Zp):i}return fe(this.handleCodeResponseFromServer.bind(this),K.HandleCodeResponseFromServer,this.logger,this.performanceClient,n.correlationId)(r,n)}async handleCodeResponseFromServer(e,n,r=!0){if(this.performanceClient.addQueueMeasurement(K.HandleCodeResponseFromServer,n.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await fe(this.authModule.updateAuthority.bind(this.authModule),K.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,n.correlationId)(e.cloud_instance_host_name,n.correlationId),r&&(e.nonce=n.nonce||void 0),e.state=n.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const o=this.createCcsCredentials(n);o&&(this.authCodeRequest.ccsCredential=o)}return await fe(this.authModule.acquireToken.bind(this.authModule),K.AuthClientAcquireToken,this.logger,this.performanceClient,n.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Wo.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Wo.UPN}:null}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const aie="ContentError",GU="user_switch";/*! @azure/msal-browser v4.19.0 2025-08-05 */const cie="USER_INTERACTION_REQUIRED",lie="USER_CANCEL",uie="NO_NETWORK",die="PERSISTENT_ERROR",fie="DISABLED",hie="ACCOUNT_UNAVAILABLE",pie="UX_NOT_ALLOWED";/*! @azure/msal-browser v4.19.0 2025-08-05 */const mie=-2147186943,gie={[GU]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Ns extends _n{constructor(e,n,r){super(e,n),Object.setPrototypeOf(this,Ns.prototype),this.name="NativeAuthError",this.ext=r}}function qu(t){if(t.ext&&t.ext.status&&(t.ext.status===die||t.ext.status===fie)||t.ext&&t.ext.error&&t.ext.error===mie)return!0;switch(t.errorCode){case aie:return!0;default:return!1}}function hx(t,e,n){if(n&&n.status)switch(n.status){case hie:return cx(GB);case cie:return new ls(t,e);case lie:return Ge(Zp);case uie:return Ge(lx);case pie:return cx(wT)}return new Ns(t,gie[t]||e,n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class VU extends Vf{async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentCacheClientAcquireToken,e.correlationId);const n=this.initializeServerTelemetryManager(Cn.acquireTokenSilent_silentFlow),r=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new Wne(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const s=(await fe(i.acquireCachedToken.bind(i),K.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),s}catch(o){throw o instanceof yg&&o.errorCode===NT&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),o}}logout(e){this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(n.correlationId,n==null?void 0:n.account)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class ry extends UU{constructor(e,n,r,i,o,s,c,l,u,d,f,h){super(e,n,r,i,o,s,l,u,h),this.apiId=c,this.accountId=d,this.platformAuthProvider=u,this.nativeStorageManager=f,this.silentCacheClient=new VU(e,this.nativeStorageManager,r,i,o,s,l,u,h);const p=this.platformAuthProvider.getExtensionName();this.skus=Jp.makeExtraSkuString({libraryName:Ti.MSAL_SKU,libraryVersion:pu,extensionName:p,extensionVersion:this.platformAuthProvider.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[cne]:this.skus}}async acquireToken(e,n){this.performanceClient.addQueueMeasurement(K.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(K.NativeInteractionClientAcquireToken,e.correlationId),i=$i(),o=this.initializeServerTelemetryManager(this.apiId);try{const s=await this.initializeNativeRequest(e);try{const l=await this.acquireTokensFromCache(this.accountId,s);return r.end({success:!0,isNativeBroker:!1,fromCache:!0}),l}catch(l){if(n===ci.AccessToken)throw this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy"),l;this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const c=await this.platformAuthProvider.sendMessage(s);return await this.handleNativeResponse(c,s,i).then(l=>(r.end({success:!0,isNativeBroker:!0,requestId:l.requestId}),o.clearNativeBrokerErrorCode(),l)).catch(l=>{throw r.end({success:!1,errorCode:l.errorCode,subErrorCode:l.subError,isNativeBroker:!0}),l})}catch(s){throw s instanceof Ns&&o.setNativeBrokerErrorCode(s.errorCode),s}}createSilentCacheRequest(e,n){return{authority:e.authority,correlationId:this.correlationId,scopes:Ar.fromString(e.scope).asArray(),account:n,forceRefresh:!1}}async acquireTokensFromCache(e,n){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),we(tA);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},this.correlationId);if(!r)throw we(tA);try{const i=this.createSilentCacheRequest(n,r),o=await this.silentCacheClient.acquireToken(i),s={...r,idTokenClaims:o==null?void 0:o.idTokenClaims,idToken:o==null?void 0:o.idToken};return{...o,account:s}}catch(i){throw i}}async acquireTokenRedirect(e,n){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const i=await this.initializeNativeRequest(r);try{await this.platformAuthProvider.sendMessage(i)}catch(c){if(c instanceof Ns&&(this.initializeServerTelemetryManager(this.apiId).setNativeBrokerErrorCode(c.errorCode),qu(c)))throw c}this.browserStorage.setTemporaryCache(dr.NATIVE_REQUEST,JSON.stringify(i),!0);const o={apiId:Cn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);n.end({success:!0}),await this.navigationClient.navigateExternal(s,o)}async handleRedirectPromise(e,n){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&n&&(e==null||e.addFields({errorCode:"no_cached_request"},n)),null;const{prompt:i,...o}=r;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(dr.NATIVE_REQUEST));const s=$i();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const c=await this.platformAuthProvider.sendMessage(o),l=await this.handleNativeResponse(c,o,s);return this.initializeServerTelemetryManager(this.apiId).clearNativeBrokerErrorCode(),l}catch(c){throw c}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,n,r){var d,f;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=Hf(e.id_token,Zo),o=this.createHomeAccountIdentifier(e,i),s=(d=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:n.accountId},this.correlationId))==null?void 0:d.homeAccountId;if((f=n.extraParameters)!=null&&f.child_client_id&&e.account.id!==n.accountId)this.logger.info("handleNativeServerResponse: Double broker flow detected, ignoring accountId mismatch");else if(o!==s&&e.account.id!==n.accountId)throw hx(GU);const c=await this.getDiscoveredAuthority({requestAuthority:n.authority}),l=ST(this.browserStorage,c,o,Zo,this.correlationId,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger);e.expires_in=Number(e.expires_in);const u=await this.generateAuthenticationResult(e,n,i,l,c.canonicalAuthority,r);return await this.cacheAccount(l,this.correlationId),await this.cacheNativeTokens(e,n,o,i,e.access_token,u.tenantId,r),u}createHomeAccountIdentifier(e,n){return cs.generateHomeAccountId(e.client_info||pe.EMPTY_STRING,Uo.Default,this.logger,this.browserCrypto,n)}generateScopes(e,n){return n?Ar.fromString(n):Ar.fromString(e)}async generatePopAccessToken(e,n){if(n.tokenType===vn.POP&&n.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new Jd(this.browserCrypto),i={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce};if(!n.keyId)throw we(QE);return r.signPopToken(e.access_token,n.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,n,r,i,o,s){const c=this.addTelemetryFromNativeResponse(e.properties.MATS),l=this.generateScopes(n.scope,e.scope),u=e.account.properties||{},d=u.UID||r.oid||r.sub||pe.EMPTY_STRING,f=u.TenantId||r.tid||pe.EMPTY_STRING,h=oT(i.getAccountInfo(),void 0,r,e.id_token);h.nativeAccountId!==e.account.id&&(h.nativeAccountId=e.account.id);const p=await this.generatePopAccessToken(e,n),g=n.tokenType===vn.POP?vn.POP:vn.BEARER;return{authority:o,uniqueId:d,tenantId:f,scopes:l.asArray(),account:h,idToken:e.id_token,idTokenClaims:r,accessToken:p,fromCache:c?this.isResponseFromCache(c):!1,expiresOn:_d(s+e.expires_in),tokenType:g,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}async cacheAccount(e,n){await this.browserStorage.setAccount(e,this.correlationId),this.browserStorage.removeAccountContext(e.getAccountInfo(),n)}cacheNativeTokens(e,n,r,i,o,s,c){const l=N0(r,n.authority,e.id_token||"",n.clientId,i.tid||""),u=n.tokenType===vn.POP?pe.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,d=c+u,f=this.generateScopes(e.scope,n.scope),h=P0(r,n.authority,o,n.clientId,i.tid||s,f.printScopes(),d,0,Zo,void 0,n.tokenType,void 0,n.keyId),p={idToken:l,accessToken:h};return this.nativeStorageManager.saveCacheRecord(p,this.correlationId,n.storeInCache)}getExpiresInValue(e,n){return e===vn.POP?pe.SHR_NONCE_VALIDITY:(typeof n=="string"?parseInt(n,10):n)||0}addTelemetryFromNativeResponse(e){const n=this.getMATSFromResponse(e);return n?(this.performanceClient.addFields({extensionId:this.platformAuthProvider.getExtensionId(),extensionVersion:this.platformAuthProvider.getExtensionVersion(),matsBrokerVersion:n.broker_version,matsAccountJoinOnStart:n.account_join_on_start,matsAccountJoinOnEnd:n.account_join_on_end,matsDeviceJoin:n.device_join,matsPromptBehavior:n.prompt_behavior,matsApiErrorCode:n.api_error_code,matsUiVisible:n.ui_visible,matsSilentCode:n.silent_code,matsSilentBiSubCode:n.silent_bi_sub_code,matsSilentMessage:n.silent_message,matsSilentStatus:n.silent_status,matsHttpStatus:n.http_status,matsHttpEventCount:n.http_event_count},this.correlationId),n):null}getMATSFromResponse(e){if(e)try{return JSON.parse(e)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const n=await this.getCanonicalAuthority(e),{scopes:r,...i}=e,o=new Ar(r||[]);o.appendScopes(vg);const s={...i,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:o.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:this.getPrompt(e.prompt),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(s.signPopToken&&e.popKid)throw Ge(_U);if(this.handleExtraBrokerParams(s),s.extraParameters=s.extraParameters||{},s.extraParameters.telemetry=yo.MATS_TELEMETRY,e.authenticationScheme===vn.POP){const c={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},l=new Jd(this.browserCrypto);let u;if(s.keyId)u=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:s.keyId})),s.signPopToken=!1;else{const d=await fe(l.generateCnf.bind(l),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(c,this.logger);u=d.reqCnfString,s.keyId=d.kid,s.signPopToken=!0}s.reqCnf=u}return this.addRequestSKUs(s),s}async getCanonicalAuthority(e){const n=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:n,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new en(n);return r.validateAsUri(),r}getPrompt(e){switch(this.apiId){case Cn.ssoSilent:case Cn.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),pi.NONE}if(!e){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e){case pi.NONE:case pi.CONSENT:case pi.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e} is not compatible with native flow`),Ge(SU)}}handleExtraBrokerParams(e){var o;const n=e.extraParameters&&e.extraParameters.hasOwnProperty(rx)&&e.extraParameters.hasOwnProperty(ix)&&e.extraParameters.hasOwnProperty(fu);if(!e.embeddedClientId&&!n)return;let r="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[ix],r=e.extraParameters[fu]),e.extraParameters={child_client_id:r,child_redirect_uri:i},(o=this.performanceClient)==null||o.addFields({embeddedClientId:r,embeddedRedirectUri:i},e.correlationId)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function zT(t,e,n,r,i){const o=Yne({...t.auth,authority:e},n,r,i);if(pT(o,{sku:Ti.MSAL_SKU,version:pu,os:"",cpu:""}),t.auth.protocolMode!==Di.OIDC&&mT(o,t.telemetry.application),n.platformBroker&&(fne(o),n.authenticationScheme===vn.POP)){const s=new $a(r,i),c=new Jd(s);let l;n.popKid?l=s.encodeKid(n.popKid):l=(await fe(c.generateCnf.bind(c),K.PopTokenGenerateCnf,r,i,n.correlationId)(n,r)).reqCnfString,vT(o,l)}return j0(o,n.correlationId,i),o}async function GT(t,e,n,r,i){if(!n.codeChallenge)throw jn(tT);const o=await fe(zT,K.GetStandardParams,r,i,n.correlationId)(t,e,n,r,i);return cT(o,zE.CODE),kB(o,n.codeChallenge,pe.S256_CODE_CHALLENGE_METHOD),Mc(o,n.extraQueryParameters||{}),CT(e,o,t.auth.encodeExtraQueryParams,n.extraQueryParameters)}async function VT(t,e,n,r,i,o){if(!r.earJwk)throw Ge(ET);const s=await zT(e,n,r,i,o);cT(s,zE.IDTOKEN_TOKEN_REFRESHTOKEN),Cne(s,r.earJwk);const c=new Map;Mc(c,r.extraQueryParameters||{});const l=CT(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return KU(t,l,s)}async function KT(t,e,n,r,i,o){const s=await zT(e,n,r,i,o);cT(s,zE.CODE),kB(s,r.codeChallenge,r.codeChallengeMethod||pe.S256_CODE_CHALLENGE_METHOD),_ne(s,r.authorizePostBodyParameters||{});const c=new Map;Mc(c,r.extraQueryParameters||{});const l=CT(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return KU(t,l,s)}function KU(t,e,n){const r=t.createElement("form");return r.method="post",r.action=e,n.forEach((i,o)=>{const s=t.createElement("input");s.hidden=!0,s.name=o,s.value=i,r.appendChild(s)}),t.body.appendChild(r),r}async function WU(t,e,n,r,i,o,s,c,l,u){if(c.verbose("Account id found, calling WAM for token"),!u)throw Ge(kT);const d=new $a(c,l),f=new ry(r,i,d,c,s,r.system.navigationClient,n,l,u,e,o,t.correlationId),{userRequestState:h}=zf.parseRequestState(d,t.state);return fe(f.acquireToken.bind(f),K.NativeInteractionClientAcquireToken,c,l,t.correlationId)({...t,state:h,prompt:void 0})}async function px(t,e,n,r,i,o,s,c,l,u,d,f){if(Ts.removeThrottle(s,i.auth.clientId,t),e.accountId)return fe(WU,K.HandleResponsePlatformBroker,u,d,t.correlationId)(t,e.accountId,r,i,s,c,l,u,d,f);const h={...t,code:e.code||"",codeVerifier:n},p=new zU(o,s,h,u,d);return await fe(p.handleCodeResponse.bind(p),K.HandleCodeResponse,u,d,t.correlationId)(e,t)}async function WT(t,e,n,r,i,o,s,c,l,u,d){if(Ts.removeThrottle(o,r.auth.clientId,t),qB(e,t.state),!e.ear_jwe)throw Ge(JB);if(!t.earJwk)throw Ge(ET);const f=JSON.parse(await fe(_re,K.DecryptEarResponse,l,u,t.correlationId)(t.earJwk,e.ear_jwe));if(f.accountId)return fe(WU,K.HandleResponsePlatformBroker,l,u,t.correlationId)(t,f.accountId,n,r,o,s,c,l,u,d);const h=new hu(r.auth.clientId,o,new $a(l,u),l,null,null,u);h.validateTokenResponse(f);const p={code:"",state:t.state,nonce:t.nonce,client_info:f.client_info,cloud_graph_host_name:f.cloud_graph_host_name,cloud_instance_host_name:f.cloud_instance_host_name,cloud_instance_name:f.cloud_instance_name,msgraph_host:f.msgraph_host};return await fe(h.handleServerTokenResponse.bind(h),K.HandleServerTokenResponse,l,u,t.correlationId)(f,i,$i(),t,p,void 0,void 0,void 0,void 0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const vie=32;async function L0(t,e,n){t.addQueueMeasurement(K.GeneratePkceCodes,n);const r=Zi(yie,K.GenerateCodeVerifier,e,t,n)(t,e,n),i=await fe(xie,K.GenerateCodeChallengeFromVerifier,e,t,n)(r,t,e,n);return{verifier:r,challenge:i}}function yie(t,e,n){try{const r=new Uint8Array(vie);return Zi(xre,K.GetRandomValues,e,t,n)(r),Xc(r)}catch{throw Ge(jT)}}async function xie(t,e,n,r){e.addQueueMeasurement(K.GenerateCodeChallengeFromVerifier,r);try{const i=await fe(kU,K.Sha256Digest,n,e,r)(t,e,r);return Xc(new Uint8Array(i))}catch{throw Ge(jT)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mx{constructor(e,n,r,i){this.logger=e,this.handshakeTimeoutMs=n,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(K.NativeMessageHandlerHandshake),this.platformAuthType=yo.PLATFORM_EXTENSION_PROVIDER}async sendMessage(e){this.logger.trace(this.platformAuthType+" - sendMessage called.");const n={method:Ah.GetToken,request:e},r={channel:yo.CHANNEL_ID,extensionId:this.extensionId,responseId:us(),body:n};this.logger.trace(this.platformAuthType+" - Sending request to browser extension"),this.logger.tracePii(this.platformAuthType+` - Sending request to browser extension: ${JSON.stringify(r)}`),this.messageChannel.port1.postMessage(r);const i=await new Promise((s,c)=>{this.resolvers.set(r.responseId,{resolve:s,reject:c})});return this.validatePlatformBrokerResponse(i)}static async createProvider(e,n,r){e.trace("PlatformAuthExtensionHandler - createProvider called.");try{const i=new mx(e,n,r,yo.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const o=new mx(e,n,r);return await o.sendHandshakeRequest(),o}}async sendHandshakeRequest(){this.logger.trace(this.platformAuthType+" - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:yo.CHANNEL_ID,extensionId:this.extensionId,responseId:us(),body:{method:Ah.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=n=>{this.onChannelMessage(n)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((n,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:n,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(Ge(bU)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace(this.platformAuthType+" - onWindowMessage called"),e.source!==window)return;const n=e.data;if(!(!n.channel||n.channel!==yo.CHANNEL_ID)&&!(n.extensionId&&n.extensionId!==this.extensionId)&&n.body.method===Ah.HandshakeRequest){const r=this.handshakeResolvers.get(n.responseId);if(!r){this.logger.trace(this.platformAuthType+`.onWindowMessage - resolver can't be found for request ${n.responseId}`);return}this.logger.verbose(n.extensionId?`Extension with id: ${n.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(Ge(wU))}}onChannelMessage(e){this.logger.trace(this.platformAuthType+" - onChannelMessage called.");const n=e.data,r=this.resolvers.get(n.responseId),i=this.handshakeResolvers.get(n.responseId);try{const o=n.body.method;if(o===Ah.Response){if(!r)return;const s=n.body.response;if(this.logger.trace(this.platformAuthType+" - Received response from browser extension"),this.logger.tracePii(this.platformAuthType+` - Received response from browser extension: ${JSON.stringify(s)}`),s.status!=="Success")r.reject(hx(s.code,s.description,s.ext));else if(s.result)s.result.code&&s.result.description?r.reject(hx(s.result.code,s.result.description,s.result.ext)):r.resolve(s.result);else throw J_(Xy,"Event does not contain result.");this.resolvers.delete(n.responseId)}else if(o===Ah.HandshakeResponse){if(!i){this.logger.trace(this.platformAuthType+`.onChannelMessage - resolver can't be found for request ${n.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=n.extensionId,this.extensionVersion=n.body.version,this.logger.verbose(this.platformAuthType+` - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(n.responseId)}}catch(o){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${o}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(o):i&&i.reject(o)}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw J_(Xy,"Response missing expected properties.")}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}getExtensionName(){var e;return this.getExtensionId()===yo.PREFERRED_EXTENSION_ID?"chrome":(e=this.getExtensionId())!=null&&e.length?"unknown":void 0}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class qT{constructor(e,n,r){this.logger=e,this.performanceClient=n,this.correlationId=r,this.platformAuthType=yo.PLATFORM_DOM_PROVIDER}static async createProvider(e,n,r){var i;if(e.trace("PlatformAuthDOMHandler: createProvider called"),(i=window.navigator)!=null&&i.platformAuthentication){const o=await window.navigator.platformAuthentication.getSupportedContracts(yo.MICROSOFT_ENTRA_BROKERID);if(o!=null&&o.includes(yo.PLATFORM_DOM_APIS))return e.trace("Platform auth api available in DOM"),new qT(e,n,r)}}getExtensionId(){return yo.MICROSOFT_ENTRA_BROKERID}getExtensionVersion(){return""}getExtensionName(){return yo.DOM_API_NAME}async sendMessage(e){this.logger.trace(this.platformAuthType+" - Sending request to browser DOM API");try{const n=this.initializePlatformDOMRequest(e),r=await window.navigator.platformAuthentication.executeGetToken(n);return this.validatePlatformBrokerResponse(r)}catch(n){throw this.logger.error(this.platformAuthType+" - executeGetToken DOM API error"),n}}initializePlatformDOMRequest(e){this.logger.trace(this.platformAuthType+" - initializeNativeDOMRequest called");const{accountId:n,clientId:r,authority:i,scope:o,redirectUri:s,correlationId:c,state:l,storeInCache:u,embeddedClientId:d,extraParameters:f,...h}=e,p=this.getDOMExtraParams(h);return{accountId:n,brokerId:this.getExtensionId(),authority:i,clientId:r,correlationId:c||this.correlationId,extraParameters:{...f,...p},isSecurityTokenService:!1,redirectUri:s,scope:o,state:l,storeInCache:u,embeddedClientId:d}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("isSuccess")){if(e.hasOwnProperty("accessToken")&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("clientInfo")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scopes")&&e.hasOwnProperty("expiresIn"))return this.logger.trace(this.platformAuthType+" - platform broker returned successful and valid response"),this.convertToPlatformBrokerResponse(e);if(e.hasOwnProperty("error")){const n=e;if(n.isSuccess===!1&&n.error&&n.error.code)throw this.logger.trace(this.platformAuthType+" - platform broker returned error response"),hx(n.error.code,n.error.description,{error:parseInt(n.error.errorCode),protocol_error:n.error.protocolError,status:n.error.status,properties:n.error.properties})}}throw J_(Xy,"Response missing expected properties.")}convertToPlatformBrokerResponse(e){return this.logger.trace(this.platformAuthType+" - convertToNativeResponse called"),{access_token:e.accessToken,id_token:e.idToken,client_info:e.clientInfo,account:e.account,expires_in:e.expiresIn,scope:e.scopes,state:e.state||"",properties:e.properties||{},extendedLifetimeToken:e.extendedLifetimeToken??!1,shr:e.proofOfPossessionPayload}}getDOMExtraParams(e){return{...Object.entries(e).reduce((i,[o,s])=>(i[o]=String(s),i),{})}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function bie(t,e,n,r){t.trace("getPlatformAuthProvider called",n);const i=wie();t.trace("Has client allowed platform auth via DOM API: "+i);let o;try{i&&(o=await qT.createProvider(t,e,n)),o||(t.trace("Platform auth via DOM API not available, checking for extension"),o=await mx.createProvider(t,r||FU,e))}catch(s){t.trace("Platform auth not available",s)}return o}function wie(){let t;try{return t=window[jr.SessionStorage],(t==null?void 0:t.getItem(Bre))==="true"}catch{return!1}}function nm(t,e,n,r){if(e.trace("isPlatformAuthAllowed called"),!t.system.allowPlatformBroker)return e.trace("isPlatformAuthAllowed: allowPlatformBroker is not enabled, returning false"),!1;if(!n)return e.trace("isPlatformAuthAllowed: Platform auth provider is not initialized, returning false"),!1;if(r)switch(r){case vn.BEARER:case vn.POP:return e.trace("isPlatformAuthAllowed: authenticationScheme is supported, returning true"),!0;default:return e.trace("isPlatformAuthAllowed: authenticationScheme is not supported, returning false"),!1}return!0}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Sie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,c,u,d),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=l,this.eventHandler=o}acquireToken(e,n){let r;try{if(r={popupName:this.generatePopupName(e.scopes||vg,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window},this.performanceClient.addFields({isAsyncPopup:this.config.system.asyncPopups},this.correlationId),this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r,n);{const o={...e,httpMethod:HU(e,this.config.auth.protocolMode)};return this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(o,r,n)}}catch(i){return Promise.reject(i)}}logout(e){try{this.logger.verbose("logoutPopup called");const n=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(n),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},i=e&&e.authority,o=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,r,i,o)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(n,r,i,o))}catch(n){return Promise.reject(n)}}async acquireTokenPopupAsync(e,n,r){this.logger.verbose("acquireTokenPopupAsync called");const i=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,xt.Popup);n.popup&&LU(i.authority);const o=nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);return i.platformBroker=o,this.config.auth.protocolMode===Di.EAR?this.executeEarFlow(i,n):this.executeCodeFlow(i,n,r)}async executeCodeFlow(e,n,r){var l;const i=e.correlationId,o=this.initializeServerTelemetryManager(Cn.acquireTokenPopup),s=r||await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),c={...e,codeChallenge:s.challenge};try{const u=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:o,requestAuthority:c.authority,requestAzureCloudOptions:c.azureCloudOptions,requestExtraQueryParameters:c.extraQueryParameters,account:c.account});if(c.httpMethod===Ol.POST)return await this.executeCodeFlowWithPost(c,n,u,s.verifier);{const d=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,i)(this.config,u.authority,c,this.logger,this.performanceClient),f=this.initiateAuthRequest(d,n);this.eventHandler.emitEvent(Qe.POPUP_OPENED,xt.Popup,{popupWindow:f},null);const h=await this.monitorPopupForHash(f,n.popupWindowParent),p=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(h,this.config.auth.OIDCOptions.serverResponseType,this.logger);return await fe(px,K.HandleResponseCode,this.logger,this.performanceClient,i)(e,p,s.verifier,Cn.acquireTokenPopup,this.config,u,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}catch(u){throw(l=n.popup)==null||l.close(),u instanceof _n&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),u}}async executeEarFlow(e,n){const r=e.correlationId,i=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,r)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),o=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,r)(),s={...e,earJwk:o},c=n.popup||this.openPopup("about:blank",n);(await VT(c.document,this.config,i,s,this.logger,this.performanceClient)).submit();const u=await fe(this.monitorPopupForHash.bind(this),K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(c,n.popupWindowParent),d=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,r)(s,d,Cn.acquireTokenPopup,this.config,i,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async executeCodeFlowWithPost(e,n,r,i){const o=e.correlationId,s=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,o)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),c=n.popup||this.openPopup("about:blank",n);(await KT(c.document,this.config,s,e,this.logger,this.performanceClient)).submit();const u=await fe(this.monitorPopupForHash.bind(this),K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,o)(c,n.popupWindowParent),d=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,o)(e,d,i,Cn.acquireTokenPopup,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async logoutPopupAsync(e,n,r,i){var s,c,l;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(Qe.LOGOUT_START,xt.Popup,e);const o=this.initializeServerTelemetryManager(Cn.logoutPopup);try{await this.clearCacheOnLogout(this.correlationId,e.account);const u=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:o,requestAuthority:r,account:e.account||void 0});try{u.authority.endSessionEndpoint}catch{if((s=e.account)!=null&&s.homeAccountId&&e.postLogoutRedirectUri&&u.authority.protocolMode===Di.OIDC){if(this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Popup,e),i){const h={apiId:Cn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=en.getAbsoluteUrl(i,xa());await this.navigationClient.navigateInternal(p,h)}(c=n.popup)==null||c.close();return}}const d=u.getLogoutUri(e);this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Popup,e);const f=this.openPopup(d,n);if(this.eventHandler.emitEvent(Qe.POPUP_OPENED,xt.Popup,{popupWindow:f},null),await this.monitorPopupForHash(f,n.popupWindowParent).catch(()=>{}),i){const h={apiId:Cn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=en.getAbsoluteUrl(i,xa());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${p}`),await this.navigationClient.navigateInternal(p,h)}else this.logger.verbose("No main window navigation requested")}catch(u){throw(l=n.popup)==null||l.close(),u instanceof _n&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),this.eventHandler.emitEvent(Qe.LOGOUT_FAILURE,xt.Popup,null,u),this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Popup),u}this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Popup)}initiateAuthRequest(e,n){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,n);throw this.logger.error("Navigate url is empty"),Ge(R0)}monitorPopupForHash(e,n){return new Promise((r,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const o=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(o),i(Ge(Zp));return}let s="";try{s=e.location.href}catch{}if(!s||s==="about:blank")return;clearInterval(o);let c="";const l=this.config.auth.OIDCOptions.serverResponseType;e&&(l===_0.QUERY?c=e.location.search:c=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(c)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,n)})}openPopup(e,n){try{let r;if(n.popup?(r=n.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof n.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,n)),!r)throw Ge(oU);return r.focus&&r.focus(),this.currentWindow=r,n.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),Ge(iU)}}openSizedPopup(e,{popupName:n,popupWindowAttributes:r,popupWindowParent:i}){var p,g,m,y;const o=i.screenLeft?i.screenLeft:i.screenX,s=i.screenTop?i.screenTop:i.screenY,c=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,l=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let u=(p=r.popupSize)==null?void 0:p.width,d=(g=r.popupSize)==null?void 0:g.height,f=(m=r.popupPosition)==null?void 0:m.top,h=(y=r.popupPosition)==null?void 0:y.left;return(!u||u<0||u>c)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),u=Ti.POPUP_WIDTH),(!d||d<0||d>l)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),d=Ti.POPUP_HEIGHT),(!f||f<0||f>l)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),f=Math.max(0,l/2-Ti.POPUP_HEIGHT/2+s)),(!h||h<0||h>c)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),h=Math.max(0,c/2-Ti.POPUP_WIDTH/2+o)),i.open(e,n,`width=${u}, height=${d}, top=${f}, left=${h}, scrollbars=yes`)}unloadWindow(e){this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,n){e.close(),n.removeEventListener("beforeunload",this.unloadWindow)}generatePopupName(e,n){return`${Ti.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${n}.${this.correlationId}`}generateLogoutPopupName(e){const n=e.account&&e.account.homeAccountId;return`${Ti.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${n}.${this.correlationId}`}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Cie(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const t=window.performance.getEntriesByType("navigation"),e=t.length?t[0]:void 0;return e==null?void 0:e.type}class _ie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,c,u,d),this.nativeStorage=l}async acquireToken(e){const n=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,xt.Redirect);n.platformBroker=nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);const r=o=>{o.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.resetRequestCache(),this.eventHandler.emitEvent(Qe.RESTORE_FROM_BFCACHE,xt.Redirect))},i=this.getRedirectStartPage(e.redirectStartPage);this.logger.verbosePii(`Redirect start page: ${i}`),this.browserStorage.setTemporaryCache(dr.ORIGIN_URI,i,!0),window.addEventListener("pageshow",r);try{this.config.auth.protocolMode===Di.EAR?await this.executeEarFlow(n):await this.executeCodeFlow(n,e.onRedirectNavigate)}catch(o){throw o instanceof _n&&o.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o}}async executeCodeFlow(e,n){const r=e.correlationId,i=this.initializeServerTelemetryManager(Cn.acquireTokenRedirect),o=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),s={...e,codeChallenge:o.challenge};this.browserStorage.cacheAuthorizeRequest(s,o.verifier);try{if(s.httpMethod===Ol.POST)return await this.executeCodeFlowWithPost(s);{const c=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:s.authority,requestAzureCloudOptions:s.azureCloudOptions,requestExtraQueryParameters:s.extraQueryParameters,account:s.account}),l=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,e.correlationId)(this.config,c.authority,s,this.logger,this.performanceClient);return await this.initiateAuthRequest(l,n)}}catch(c){throw c instanceof _n&&(c.setCorrelationId(this.correlationId),i.cacheFailedRequest(c)),c}}async executeEarFlow(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i};return this.browserStorage.cacheAuthorizeRequest(o),(await VT(document,this.config,r,o,this.logger,this.performanceClient)).submit(),new Promise((c,l)=>{setTimeout(()=>{l(Ge(ux,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async executeCodeFlowWithPost(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return this.browserStorage.cacheAuthorizeRequest(e),(await KT(document,this.config,r,e,this.logger,this.performanceClient)).submit(),new Promise((o,s)=>{setTimeout(()=>{s(Ge(ux,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async handleRedirectPromise(e="",n,r,i){const o=this.initializeServerTelemetryManager(Cn.handleRedirectPromise);try{const[s,c]=this.getRedirectResponse(e||"");if(!s)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.resetRequestCache(),Cie()!=="back_forward"?i.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const l=this.browserStorage.getTemporaryCache(dr.ORIGIN_URI,!0)||pe.EMPTY_STRING,u=en.removeHashFromUrl(l),d=en.removeHashFromUrl(window.location.href);if(u===d&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),l.indexOf("#")>-1&&jre(l),await this.handleResponse(s,n,r,o);if(this.config.auth.navigateToLoginRequestUrl){if(!LT()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(dr.URL_HASH,c,!0);const f={apiId:Cn.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let h=!0;if(!l||l==="null"){const p=Tre();this.browserStorage.setTemporaryCache(dr.ORIGIN_URI,p,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),h=await this.navigationClient.navigateInternal(p,f)}else this.logger.verbose(`Navigating to loginRequestUrl: ${l}`),h=await this.navigationClient.navigateInternal(l,f);if(!h)return await this.handleResponse(s,n,r,o)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(s,n,r,o);return null}catch(s){throw s instanceof _n&&(s.setCorrelationId(this.correlationId),o.cacheFailedRequest(s)),s}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let n=e;n||(this.config.auth.OIDCOptions.serverResponseType===_0.QUERY?n=window.location.search:n=window.location.hash);let r=Zy(n);if(r){try{sie(r,this.browserCrypto,xt.Redirect)}catch(o){return o instanceof _n&&this.logger.error(`Interaction type validation failed due to ${o.errorCode}: ${o.errorMessage}`),[null,""]}return MU(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,n]}const i=this.browserStorage.getTemporaryCache(dr.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(dr.URL_HASH)),i&&(r=Zy(i),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,i]):[null,""]}async handleResponse(e,n,r,i){if(!e.state)throw Ge(TT);if(e.ear_jwe){const c=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n.correlationId)({requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account});return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,n.correlationId)(n,e,Cn.acquireTokenRedirect,this.config,c,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}const s=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority});return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,n.correlationId)(n,e,r,Cn.acquireTokenRedirect,this.config,s,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async initiateAuthRequest(e,n){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:Cn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=n||this.config.auth.onRedirectNavigate;if(typeof i=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),i(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await this.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await this.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),Ge(R0)}async logout(e){var i;this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(Cn.logout);try{this.eventHandler.emitEvent(Qe.LOGOUT_START,xt.Redirect,e),await this.clearCacheOnLogout(this.correlationId,n.account);const o={apiId:Cn.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(s.authority.protocolMode===Di.OIDC)try{s.authority.endSessionEndpoint}catch{if((i=n.account)!=null&&i.homeAccountId){this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Redirect,n);return}}const c=s.getLogoutUri(n);if(this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Redirect,n),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(c)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),await this.navigationClient.navigateExternal(c,o);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),await this.navigationClient.navigateExternal(c,o);return}}catch(o){throw o instanceof _n&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.eventHandler.emitEvent(Qe.LOGOUT_FAILURE,xt.Redirect,null,o),this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Redirect),o}this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Redirect)}getRedirectStartPage(e){const n=e||window.location.href;return en.getAbsoluteUrl(n,xa())}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function Aie(t,e,n,r,i){if(e.addQueueMeasurement(K.SilentHandlerInitiateAuthRequest,r),!t)throw n.info("Navigate url is empty"),Ge(R0);return i?fe(Tie,K.SilentHandlerLoadFrame,n,e,r)(t,i,e,r):Zi(Nie,K.SilentHandlerLoadFrameSync,n,e,r)(t)}async function jie(t,e,n,r,i){const o=F0();if(!o.contentDocument)throw"No document associated with iframe!";return(await KT(o.contentDocument,t,e,n,r,i)).submit(),o}async function Eie(t,e,n,r,i){const o=F0();if(!o.contentDocument)throw"No document associated with iframe!";return(await VT(o.contentDocument,t,e,n,r,i)).submit(),o}async function YI(t,e,n,r,i,o,s){return r.addQueueMeasurement(K.SilentHandlerMonitorIframeForHash,o),new Promise((c,l)=>{e{window.clearInterval(d),l(Ge(sU))},e),d=window.setInterval(()=>{let f="";const h=t.contentWindow;try{f=h?h.location.href:""}catch{}if(!f||f==="about:blank")return;let p="";h&&(s===_0.QUERY?p=h.location.search:p=h.location.hash),window.clearTimeout(u),window.clearInterval(d),c(p)},n)}).finally(()=>{Zi(Pie,K.RemoveHiddenIframe,i,r,o)(t)})}function Tie(t,e,n,r){return n.addQueueMeasurement(K.SilentHandlerLoadFrame,r),new Promise((i,o)=>{const s=F0();window.setTimeout(()=>{if(!s){o("Unable to load iframe");return}s.src=t,i(s)},e)})}function Nie(t){const e=F0();return e.src=t,e}function F0(){const t=document.createElement("iframe");return t.className="msalSilentIframe",t.style.visibility="hidden",t.style.position="absolute",t.style.width=t.style.height="0",t.style.border="0",t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(t),t}function Pie(t){document.body===t.parentNode&&document.body.removeChild(t)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class kie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d,f){super(e,n,r,i,o,s,l,d,f),this.apiId=c,this.nativeStorage=u}async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const n={...e};n.prompt?n.prompt!==pi.NONE&&n.prompt!==pi.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${n.prompt} with ${pi.NONE}`),n.prompt=pi.NONE):n.prompt=pi.NONE;const r=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(n,xt.Silent);return r.platformBroker=nm(this.config,this.logger,this.platformAuthProvider,r.authenticationScheme),LU(r.authority),this.config.auth.protocolMode===Di.EAR?this.executeEarFlow(r):this.executeCodeFlow(r)}async executeCodeFlow(e){let n;const r=this.initializeServerTelemetryManager(this.apiId);try{return n=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),await fe(this.silentTokenHelper.bind(this),K.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(n,e)}catch(i){if(i instanceof _n&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),!n||!(i instanceof _n)||i.errorCode!==Ti.INVALID_GRANT_ERROR)throw i;return this.performanceClient.addFields({retryError:i.errorCode},this.correlationId),await fe(this.silentTokenHelper.bind(this),K.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(n,e)}}async executeEarFlow(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i},s=await fe(Eie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(this.config,r,o,this.logger,this.performanceClient),c=this.config.auth.OIDCOptions.serverResponseType,l=await fe(YI,K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,c),u=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,n)(l,c,this.logger);return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,n)(o,u,this.apiId,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}logout(){return Promise.reject(Ge(M0))}async silentTokenHelper(e,n){const r=n.correlationId;this.performanceClient.addQueueMeasurement(K.SilentIframeClientTokenHelper,r);const i=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),o={...n,codeChallenge:i.challenge};let s;if(n.httpMethod===Ol.POST)s=await fe(jie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);else{const d=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);s=await fe(Aie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(d,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait)}const c=this.config.auth.OIDCOptions.serverResponseType,l=await fe(YI,K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,c),u=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,r)(l,c,this.logger);return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,r)(n,u,i.verifier,this.apiId,this.config,e,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Oie extends Vf{async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentRefreshClientAcquireToken,e.correlationId);const n=await fe(HT,K.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...n};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(Cn.acquireTokenSilent_silentFlow),o=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return fe(o.acquireTokenByRefreshToken.bind(o),K.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(s=>{throw s.setCorrelationId(this.correlationId),i.cacheFailedRequest(s),s})}logout(){return Promise.reject(Ge(M0))}async createRefreshTokenClient(e){const n=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Kne(n,this.performanceClient)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Iie{constructor(e,n,r,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=n,this.logger=r,this.cryptoObj=i}async loadExternalTokens(e,n,r){if(!this.isBrowserEnvironment)throw Ge(D0);const i=e.correlationId||us(),o=n.id_token?Hf(n.id_token,Zo):void 0,s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},c=e.authority?new Zr(Zr.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,s,this.logger,e.correlationId||us()):void 0,l=await this.loadAccount(e,r.clientInfo||n.client_info||"",i,o,c),u=await this.loadIdToken(n,l.homeAccountId,l.environment,l.realm,i),d=await this.loadAccessToken(e,n,l.homeAccountId,l.environment,l.realm,r,i),f=await this.loadRefreshToken(n,l.homeAccountId,l.environment,i);return this.generateAuthenticationResult(e,{account:l,idToken:u,accessToken:d,refreshToken:f},o,c)}async loadAccount(e,n,r,i,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const u=cs.createFromAccountInfo(e.account);return await this.storage.setAccount(u,r),u}else if(!o||!n&&!i)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),Ge(mU);const s=cs.generateHomeAccountId(n,o.authorityType,this.logger,this.cryptoObj,i),c=i==null?void 0:i.tid,l=ST(this.storage,o,s,Zo,r,i,n,o.hostnameAndPort,c,void 0,void 0,this.logger);return await this.storage.setAccount(l,r),l}async loadIdToken(e,n,r,i,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const s=N0(n,r,e.id_token,this.config.auth.clientId,i);return await this.storage.setIdTokenCredential(s,o),s}async loadAccessToken(e,n,r,i,o,s,c){if(n.access_token)if(n.expires_in){if(!n.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const l=n.scope?Ar.fromString(n.scope):new Ar(e.scopes),u=s.expiresOn||n.expires_in+$i(),d=s.extendedExpiresOn||(n.ext_expires_in||n.expires_in)+$i(),f=P0(r,i,n.access_token,this.config.auth.clientId,o,l.printScopes(),u,d,Zo);return await this.storage.setAccessTokenCredential(f,c),f}async loadRefreshToken(e,n,r,i){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=BB(n,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return await this.storage.setRefreshTokenCredential(o,i),o}generateAuthenticationResult(e,n,r,i){var d,f,h;let o="",s=[],c=null,l;n!=null&&n.accessToken&&(o=n.accessToken.secret,s=Ar.fromString(n.accessToken.target).asArray(),c=_d(n.accessToken.expiresOn),l=_d(n.accessToken.extendedExpiresOn));const u=n.account;return{authority:i?i.canonicalAuthority:"",uniqueId:n.account.localAccountId,tenantId:n.account.realm,scopes:s,account:u.getAccountInfo(),idToken:((d=n.idToken)==null?void 0:d.secret)||"",idTokenClaims:r||{},accessToken:o,fromCache:!0,expiresOn:c,correlationId:e.correlationId||"",requestId:"",extExpiresOn:l,familyId:((f=n.refreshToken)==null?void 0:f.familyId)||"",tokenType:((h=n==null?void 0:n.accessToken)==null?void 0:h.tokenType)||"",state:e.state||"",cloudGraphHostName:u.cloudGraphHostName||"",msGraphHost:u.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Rie extends WB{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Mie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,l,u,d),this.apiId=c}async acquireToken(e){if(!e.code)throw Ge(gU);const n=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,xt.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const i={...n,code:e.code},o=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),s=new Rie(o);this.logger.verbose("Auth code client created");const c=new zU(s,this.browserStorage,i,this.logger,this.performanceClient);return await fe(c.handleCodeResponseFromServer.bind(c),K.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},n,!1)}catch(i){throw i instanceof _n&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),i}}logout(){return Promise.reject(Ge(M0))}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Die(t,e,n){var s;const r=((s=window.msal)==null?void 0:s.clientIds)||[],i=r.length,o=r.filter(c=>c===t).length;o>1&&n.warning("There is already an instance of MSAL.js in the window with the same client id."),e.add({msalInstanceCount:i,sameClientIdInstanceCount:o})}/*! @azure/msal-browser v4.19.0 2025-08-05 */function xs(t){const e=t==null?void 0:t.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function mv(t,e){try{FT(t)}catch(n){throw e.end({success:!1},n),n}}class B0{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new $a(this.logger,this.performanceClient):Jy,this.eventHandler=new rie(this.logger),this.browserStorage=this.isBrowserEnvironment?new hA(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler,$ne(this.config.auth)):qre(this.config.auth.clientId,this.logger,this.performanceClient,this.eventHandler);const n={cacheLocation:jr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new hA(this.config.auth.clientId,n,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler),this.tokenCache=new Iie(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}static async createController(e,n){const r=new B0(e);return await r.initialize(n),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e,n){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(Qe.INITIALIZE_END);return}const r=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),i=this.config.system.allowPlatformBroker,o=this.performanceClient.startMeasurement(K.InitializeClientApplication,r);if(this.eventHandler.emitEvent(Qe.INITIALIZE_START),!n)try{this.logMultipleInstances(o)}catch{}if(await fe(this.browserStorage.initialize.bind(this.browserStorage),K.InitializeCache,this.logger,this.performanceClient,r)(r),i)try{this.platformAuthProvider=await bie(this.logger,this.performanceClient,r,this.config.system.nativeBrokerHandshakeTimeout)}catch(s){this.logger.verbose(s)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),Zi(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),K.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,r)(r)),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(r),this.initialized=!0,this.eventHandler.emitEvent(Qe.INITIALIZE_END),o.end({allowPlatformBroker:i,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),$U(this.initialized),this.isBrowserEnvironment){const n=e||"";let r=this.redirectResponse.get(n);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(n,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){var l;if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;if(((l=this.browserStorage.getInteractionInProgress())==null?void 0:l.type)===lc.SIGNOUT)return this.logger.verbose("handleRedirectPromise removing interaction_in_progress flag and returning null after sign-out"),this.browserStorage.setInteractionInProgress(!1),Promise.resolve(null);const r=this.getAllAccounts(),i=this.browserStorage.getCachedNativeRequest(),o=i&&this.platformAuthProvider&&!e;let s;this.eventHandler.emitEvent(Qe.HANDLE_REDIRECT_START,xt.Redirect);let c;try{if(o&&this.platformAuthProvider){s=this.performanceClient.startMeasurement(K.AcquireTokenRedirect,(i==null?void 0:i.correlationId)||""),this.logger.trace("handleRedirectPromise - acquiring token from native platform");const u=new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.handleRedirectPromise,this.performanceClient,this.platformAuthProvider,i.accountId,this.nativeInternalStorage,i.correlationId);c=fe(u.handleRedirectPromise.bind(u),K.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(this.performanceClient,s.event.correlationId)}else{const[u,d]=this.browserStorage.getCachedRequest(),f=u.correlationId;s=this.performanceClient.startMeasurement(K.AcquireTokenRedirect,f),this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(f);c=fe(h.handleRedirectPromise.bind(h),K.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(e,u,d,s)}}catch(u){throw this.browserStorage.resetRequestCache(),u}return c.then(u=>(u?(this.browserStorage.resetRequestCache(),r.length{this.browserStorage.resetRequestCache();const d=u;throw r.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Redirect,null,d):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Redirect,null,d),this.eventHandler.emitEvent(Qe.HANDLE_REDIRECT_END,xt.Redirect),s.end({success:!1},d),u})}async acquireTokenRedirect(e){const n=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",n);const r=this.performanceClient.startMeasurement(K.AcquireTokenPreRedirect,n);r.add({accountType:xs(e.account),scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=s=>{const c=typeof i=="function"?i(s):void 0;return c!==!1?r.end({success:!0}):r.discard(),c};else{const s=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=c=>{const l=typeof s=="function"?s(c):void 0;return l!==!1?r.end({success:!0}):r.discard(),l}}const o=this.getAllAccounts().length>0;try{FI(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,lc.SIGNIN),o?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Redirect,e):this.eventHandler.emitEvent(Qe.LOGIN_START,xt.Redirect,e);let s;return this.platformAuthProvider&&this.canUsePlatformBroker(e)?s=new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.acquireTokenRedirect,this.performanceClient,this.platformAuthProvider,this.getNativeAccountId(e),this.nativeInternalStorage,n).acquireTokenRedirect(e,r).catch(l=>{if(l instanceof Ns&&qu(l))return this.platformAuthProvider=void 0,this.createRedirectClient(n).acquireToken(e);if(l instanceof ls)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(n).acquireToken(e);throw l}):s=this.createRedirectClient(n).acquireToken(e),await s}catch(s){throw this.browserStorage.resetRequestCache(),r.end({success:!1},s),o?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Redirect,null,s):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Redirect,null,s),s}}acquireTokenPopup(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(K.AcquireTokenPopup,n);r.add({scenarioId:e.scenarioId,accountType:xs(e.account)});try{this.logger.verbose("acquireTokenPopup called",n),mv(this.initialized,r),this.browserStorage.setInteractionInProgress(!0,lc.SIGNIN)}catch(c){return Promise.reject(c)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Popup,e):this.eventHandler.emitEvent(Qe.LOGIN_START,xt.Popup,e);let o;const s=this.getPreGeneratedPkceCodes(n);return this.canUsePlatformBroker(e)?o=this.acquireTokenNative({...e,correlationId:n},Cn.acquireTokenPopup).then(c=>(r.end({success:!0,isNativeBroker:!0,accountType:xs(c.account)}),c)).catch(c=>{if(c instanceof Ns&&qu(c))return this.platformAuthProvider=void 0,this.createPopupClient(n).acquireToken(e,s);if(c instanceof ls)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(n).acquireToken(e,s);throw c}):o=this.createPopupClient(n).acquireToken(e,s),o.then(c=>(i.length(i.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Popup,null,c):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Popup,null,c),r.end({success:!1},c),Promise.reject(c))).finally(async()=>{this.browserStorage.setInteractionInProgress(!1),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(n)})}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var o,s;const n=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:n};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(K.SsoSilent,n),(o=this.ssoSilentMeasurement)==null||o.add({scenarioId:e.scenarioId,accountType:xs(e.account)}),mv(this.initialized,this.ssoSilentMeasurement),(s=this.ssoSilentMeasurement)==null||s.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",n),this.eventHandler.emitEvent(Qe.SSO_SILENT_START,xt.Silent,r);let i;return this.canUsePlatformBroker(r)?i=this.acquireTokenNative(r,Cn.ssoSilent).catch(c=>{if(c instanceof Ns&&qu(c))return this.platformAuthProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw c}):i=this.createSilentIframeClient(r.correlationId).acquireToken(r),i.then(c=>{var l;return this.eventHandler.emitEvent(Qe.SSO_SILENT_SUCCESS,xt.Silent,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:xs(c.account)}),c}).catch(c=>{var l;throw this.eventHandler.emitEvent(Qe.SSO_SILENT_FAILURE,xt.Silent,null,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!1},c),c}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const n=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",n);const r=this.performanceClient.startMeasurement(K.AcquireTokenByCode,n);mv(this.initialized,r),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_START,xt.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw Ge(yU);if(e.code){const i=e.code;let o=this.hybridAuthCodeResponses.get(i);return o?(this.logger.verbose("Existing acquireTokenByCode request found",n),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",n),o=this.acquireTokenByCodeAsync({...e,correlationId:n}).then(s=>(this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_SUCCESS,xt.Silent,s),this.hybridAuthCodeResponses.delete(i),r.end({success:!0,isNativeBroker:s.fromNativeBroker,accessTokenSize:s.accessToken.length,idTokenSize:s.idToken.length,accountType:xs(s.account)}),s)).catch(s=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_FAILURE,xt.Silent,null,s),r.end({success:!1},s),s}),this.hybridAuthCodeResponses.set(i,o)),await o}else if(e.nativeAccountId)if(this.canUsePlatformBroker(e,e.nativeAccountId)){const i=await this.acquireTokenNative({...e,correlationId:n},Cn.acquireTokenByCode,e.nativeAccountId).catch(o=>{throw o instanceof Ns&&qu(o)&&(this.platformAuthProvider=void 0),o});return r.end({accountType:xs(i.account),success:!0}),i}else throw Ge(xU);else throw Ge(vU)}catch(i){throw this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_FAILURE,xt.Silent,null,i),r.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){var i;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(K.AcquireTokenByCodeAsync,e.correlationId),(i=this.acquireTokenByCodeAsyncMeasurement)==null||i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(o=>{var s;return(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker}),o}).catch(o=>{var s;throw(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!1},o),o}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,n){switch(this.performanceClient.addQueueMeasurement(K.AcquireTokenFromCache,e.correlationId),n){case ci.Default:case ci.AccessToken:case ci.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return fe(r.acquireToken.bind(r),K.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw we(Rc)}}async acquireTokenByRefreshToken(e,n){switch(this.performanceClient.addQueueMeasurement(K.AcquireTokenByRefreshToken,e.correlationId),n){case ci.Default:case ci.AccessTokenAndRefreshToken:case ci.RefreshToken:case ci.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return fe(r.acquireToken.bind(r),K.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw we(Rc)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(K.AcquireTokenBySilentIframe,e.correlationId);const n=this.createSilentIframeClient(e.correlationId);return fe(n.acquireToken.bind(n),K.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const n=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",n),this.logoutRedirect({correlationId:n,...e})}async logoutRedirect(e){const n=this.getRequestCorrelationId(e);return FI(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),this.createRedirectClient(n).logout(e)}logoutPopup(e){try{const n=this.getRequestCorrelationId(e);return FT(this.initialized),this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),this.createPopupClient(n).logout(e).finally(()=>{this.browserStorage.setInteractionInProgress(!1)})}catch(n){return Promise.reject(n)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const n=this.getRequestCorrelationId(e);return this.createSilentCacheClient(n).logout(e)}getAllAccounts(e){const n=this.getRequestCorrelationId();return Yre(this.logger,this.browserStorage,this.isBrowserEnvironment,n,e)}getAccount(e){const n=this.getRequestCorrelationId();return Qre(e,this.logger,this.browserStorage,n)}getAccountByUsername(e){const n=this.getRequestCorrelationId();return Xre(e,this.logger,this.browserStorage,n)}getAccountByHomeId(e){const n=this.getRequestCorrelationId();return Jre(e,this.logger,this.browserStorage,n)}getAccountByLocalId(e){const n=this.getRequestCorrelationId();return Zre(e,this.logger,this.browserStorage,n)}setActiveAccount(e){const n=this.getRequestCorrelationId();eie(e,this.browserStorage,n)}getActiveAccount(){const e=this.getRequestCorrelationId();return tie(this.browserStorage,e)}async hydrateCache(e,n){this.logger.verbose("hydrateCache called");const r=cs.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return await this.browserStorage.setAccount(r,e.correlationId),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,n)):this.browserStorage.hydrateCache(e,n)}async acquireTokenNative(e,n,r,i){if(this.logger.trace("acquireTokenNative called"),!this.platformAuthProvider)throw Ge(kT);return new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,n,this.performanceClient,this.platformAuthProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e,i)}canUsePlatformBroker(e,n){if(this.logger.trace("canUsePlatformBroker called"),!this.platformAuthProvider)return this.logger.trace("canUsePlatformBroker: platform broker unavilable, returning false"),!1;if(!nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme))return this.logger.trace("canUsePlatformBroker: isBrokerAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case pi.NONE:case pi.CONSENT:case pi.LOGIN:this.logger.trace("canUsePlatformBroker: prompt is compatible with platform broker flow");break;default:return this.logger.trace(`canUsePlatformBroker: prompt = ${e.prompt} is not compatible with platform broker flow, returning false`),!1}return!n&&!this.getNativeAccountId(e)?(this.logger.trace("canUsePlatformBroker: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const n=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return n&&n.nativeAccountId||""}createPopupClient(e){return new Sie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createRedirectClient(e){return new _ie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentIframeClient(e){return new kie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentCacheClient(e){return new VU(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentRefreshClient(e){return new Oie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentAuthCodeClient(e){return new Mie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.acquireTokenByCode,this.performanceClient,this.platformAuthProvider,e)}addEventCallback(e,n){return this.eventHandler.addEventCallback(e,n)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return DU(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){if(this.config.cache.cacheLocation!==jr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.subscribeCrossTab()}disableAccountStorageEvents(){if(this.config.cache.cacheLocation!==jr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.unsubscribeCrossTab()}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,n){this.browserStorage.setWrapperMetadata(e,n)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?us():pe.EMPTY_STRING}async loginRedirect(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",n),this.acquireTokenRedirect({correlationId:n,...e||RI})}loginPopup(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup({correlationId:n,...e||RI})}async acquireTokenSilent(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(K.AcquireTokenSilent,n);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),mv(this.initialized,r),this.logger.verbose("acquireTokenSilent called",n);const i=e.account||this.getActiveAccount();if(!i)throw Ge(uU);return r.add({accountType:xs(i)}),this.acquireTokenSilentDeduped(e,i,n).then(o=>(r.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker,accessTokenSize:o.accessToken.length,idTokenSize:o.idToken.length}),{...o,state:e.state,correlationId:n})).catch(o=>{throw o instanceof _n&&o.setCorrelationId(n),r.end({success:!1},o),o})}async acquireTokenSilentDeduped(e,n,r){const i=k0(this.config.auth.clientId,{...e,authority:e.authority||this.config.auth.authority,correlationId:r},n.homeAccountId),o=JSON.stringify(i),s=this.activeSilentTokenRequests.get(o);if(typeof s>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",r),this.performanceClient.addFields({deduped:!1},r);const c=fe(this.acquireTokenSilentAsync.bind(this),K.AcquireTokenSilentAsync,this.logger,this.performanceClient,r)({...e,correlationId:r},n);return this.activeSilentTokenRequests.set(o,c),c.finally(()=>{this.activeSilentTokenRequests.delete(o)})}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",r),this.performanceClient.addFields({deduped:!0},r),s}async acquireTokenSilentAsync(e,n){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(K.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const i=await fe(iie,K.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,n,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||ci.Default;return this.acquireTokenSilentNoIframe(i,o).catch(async c=>{if($ie(c,o))if(this.activeIframeRequest)if(o!==ci.Skip){const[u,d]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${d}`,i.correlationId);const f=this.performanceClient.startMeasurement(K.AwaitConcurrentIframe,i.correlationId);f.add({awaitIframeCorrelationId:d});const h=await u;if(f.end({success:h}),h)return this.logger.verbose(`Parallel iframe request with correlationId: ${d} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,o);throw this.logger.info(`Iframe request with correlationId: ${d} failed. Interaction is required.`),c}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),fe(this.acquireTokenBySilentIframe.bind(this),K.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let u;return this.activeIframeRequest=[new Promise(d=>{u=d}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),fe(this.acquireTokenBySilentIframe.bind(this),K.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(d=>(u(!0),d)).catch(d=>{throw u(!1),d}).finally(()=>{this.activeIframeRequest=void 0})}else throw c}).then(c=>(this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_SUCCESS,xt.Silent,c),e.correlationId&&this.performanceClient.addFields({fromCache:c.fromCache,isNativeBroker:c.fromNativeBroker},e.correlationId),c)).catch(c=>{throw this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Silent,null,c),c}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,n){return nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,Cn.acquireTokenSilent_silentFlow,e.account.nativeAccountId,n).catch(async r=>{throw r instanceof Ns&&qu(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.platformAuthProvider=void 0,we(Rc)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),n===ci.AccessToken&&this.logger.verbose("acquireTokenSilent - cache lookup policy set to AccessToken, attempting to acquire token from local cache"),fe(this.acquireTokenFromCache.bind(this),K.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,n).catch(r=>{if(n===ci.AccessToken)throw r;return this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_NETWORK_START,xt.Silent,e),fe(this.acquireTokenByRefreshToken.bind(this),K.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,n)}))}async preGeneratePkceCodes(e){return this.logger.verbose("Generating new PKCE codes"),this.pkceCode=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,e)(this.performanceClient,this.logger,e),Promise.resolve()}getPreGeneratedPkceCodes(e){this.logger.verbose("Attempting to pick up pre-generated PKCE codes");const n=this.pkceCode?{...this.pkceCode}:void 0;return this.pkceCode=void 0,this.logger.verbose(`${n?"Found":"Did not find"} pre-generated PKCE codes`),this.performanceClient.addFields({usePreGeneratedPkce:!!n},e),n}logMultipleInstances(e){const n=this.config.auth.clientId;if(!window)return;window.msal=window.msal||{},window.msal.clientIds=window.msal.clientIds||[],window.msal.clientIds.length>0&&this.logger.verbose("There is already an instance of MSAL.js in the window."),window.msal.clientIds.push(n),Die(n,e,this.logger)}}function $ie(t,e){const n=!(t instanceof ls&&t.subError!==I0),r=t.errorCode===Ti.INVALID_GRANT_ERROR||t.errorCode===Rc,i=n&&r||t.errorCode===ax||t.errorCode===bT,o=fre.includes(e);return i&&o}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function Lie(t,e){const n=new mu(t);return await n.initialize(),B0.createController(n,e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class YT{static async createPublicClientApplication(e){const n=await Lie(e);return new YT(e,n)}constructor(e,n){this.isBroker=!1,this.controller=n||new B0(new mu(e))}async initialize(e){return this.controller.initialize(e,this.isBroker)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,n){return this.controller.addEventCallback(e,n)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,n){return this.controller.initializeWrapperLibrary(e,n)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,n){return this.controller.hydrateCache(e,n)}clearCache(e){return this.controller.clearCache(e)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Fie={initialize:()=>Promise.reject(lr(cr)),acquireTokenPopup:()=>Promise.reject(lr(cr)),acquireTokenRedirect:()=>Promise.reject(lr(cr)),acquireTokenSilent:()=>Promise.reject(lr(cr)),acquireTokenByCode:()=>Promise.reject(lr(cr)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(lr(cr)),loginPopup:()=>Promise.reject(lr(cr)),loginRedirect:()=>Promise.reject(lr(cr)),logout:()=>Promise.reject(lr(cr)),logoutRedirect:()=>Promise.reject(lr(cr)),logoutPopup:()=>Promise.reject(lr(cr)),ssoSilent:()=>Promise.reject(lr(cr)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw lr(cr)},getLogger:()=>{throw lr(cr)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw lr(cr)},hydrateCache:()=>Promise.reject(lr(cr)),clearCache:()=>Promise.reject(lr(cr))};/*! @azure/msal-browser v4.19.0 2025-08-05 */class Bie{static getInteractionStatusFromEvent(e,n){switch(e.eventType){case Qe.LOGIN_START:return xr.Login;case Qe.SSO_SILENT_START:return xr.SsoSilent;case Qe.ACQUIRE_TOKEN_START:if(e.interactionType===xt.Redirect||e.interactionType===xt.Popup)return xr.AcquireToken;break;case Qe.HANDLE_REDIRECT_START:return xr.HandleRedirect;case Qe.LOGOUT_START:return xr.Logout;case Qe.SSO_SILENT_SUCCESS:case Qe.SSO_SILENT_FAILURE:if(n&&n!==xr.SsoSilent)break;return xr.None;case Qe.LOGOUT_END:if(n&&n!==xr.Logout)break;return xr.None;case Qe.HANDLE_REDIRECT_END:if(n&&n!==xr.HandleRedirect)break;return xr.None;case Qe.LOGIN_SUCCESS:case Qe.LOGIN_FAILURE:case Qe.ACQUIRE_TOKEN_SUCCESS:case Qe.ACQUIRE_TOKEN_FAILURE:case Qe.RESTORE_FROM_BFCACHE:if(e.interactionType===xt.Redirect||e.interactionType===xt.Popup){if(n&&n!==xr.Login&&n!==xr.AcquireToken)break;return xr.None}break}return null}}const Uie="modulepreload",Hie=function(t){return"/semblance/"+t},QI={},zie=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=Hie(l),l in QI)return;QI[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Uie,u||(f.as="script"),f.crossOrigin="",f.href=l,c&&f.setAttribute("nonce",c),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return i.then(s=>{for(const c of s||[])c.status==="rejected"&&o(c.reason);return e().catch(o)})};/*! @azure/msal-react v3.0.17 2025-08-05 */const Gie={instance:Fie,inProgress:xr.None,accounts:[],logger:new Da({})},QT=v.createContext(Gie);QT.Consumer;/*! @azure/msal-react v3.0.17 2025-08-05 */function XI(t,e){if(t.length!==e.length)return!1;const n=[...e];return t.every(r=>{const i=n.shift();return!r||!i?!1:r.homeAccountId===i.homeAccountId&&r.localAccountId===i.localAccountId&&r.username===i.username})}/*! @azure/msal-react v3.0.17 2025-08-05 */const Vie="@azure/msal-react",JI="3.0.17";/*! @azure/msal-react v3.0.17 2025-08-05 */const gx={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},Kie=(t,e)=>{const{type:n,payload:r}=e;let i=t.inProgress;switch(n){case gx.UNBLOCK_INPROGRESS:t.inProgress===xr.Startup&&(i=xr.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case gx.EVENT:const s=r.message,c=Bie.getInteractionStatusFromEvent(s,t.inProgress);c&&(r.logger.info(`MsalProvider - ${s.eventType} results in setting inProgress from ${t.inProgress} to ${c}`),i=c);break;default:throw new Error(`Unknown action type: ${n}`)}if(i===xr.Startup)return t;const o=r.instance.getAllAccounts();return i!==t.inProgress&&!XI(o,t.accounts)?{...t,inProgress:i,accounts:o}:i!==t.inProgress?{...t,inProgress:i}:XI(o,t.accounts)?t:{...t,accounts:o}};function Wie({instance:t,children:e}){v.useEffect(()=>{t.initializeWrapperLibrary(lre.React,JI)},[t]);const n=v.useMemo(()=>t.getLogger().clone(Vie,JI),[t]),[r,i]=v.useReducer(Kie,void 0,()=>({inProgress:xr.Startup,accounts:[]}));v.useEffect(()=>{const s=t.addEventCallback(c=>{i({payload:{instance:t,logger:n,message:c},type:gx.EVENT})});return n.verbose(`MsalProvider - Registered event callback with id: ${s}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{i({payload:{instance:t,logger:n},type:gx.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{s&&(n.verbose(`MsalProvider - Removing event callback ${s}`),t.removeEventCallback(s))}},[t,n]);const o={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:n};return N.createElement(QT.Provider,{value:o},e)}/*! @azure/msal-react v3.0.17 2025-08-05 */const qie=()=>v.useContext(QT),Yie={auth:{clientId:"7e9b250a-d984-4fba-8e1c-a0622242a595",authority:"https://login.microsoftonline.com/e519c2e6-bc6d-4fdf-8d9c-923c2f002385",redirectUri:"https://ai-sandbox.oliver.solutions/semblance",postLogoutRedirectUri:"https://ai-sandbox.oliver.solutions/semblance"},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(t,e,n)=>{n||console.log(e)},logLevel:Mn.Verbose,piiLoggingEnabled:!1},allowNativeBroker:!1}},Qie={scopes:["openid","profile","email"],prompt:"select_account",extraQueryParameters:{code_challenge_method:"S256"}},qU=v.createContext(void 0);function Xie({children:t}){const[e,n]=v.useState(null),[r,i]=v.useState(null),[o,s]=v.useState(!0),[c,l]=v.useState(!1),u=ar(),{instance:d,accounts:f,inProgress:h}=qie();v.useEffect(()=>{const w=S=>{const _=S.detail||{};if(_.isPersonaCreation){console.log("Ignoring auth error from persona creation",_);return}i(null),n(null),re.error("Session expired",{description:"Please log in again"}),u("/login")};return window.addEventListener(X_,w),()=>{window.removeEventListener(X_,w)}},[u]),v.useEffect(()=>{const w=localStorage.getItem("auth_token"),S=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!w,hasUser:!!S}),w&&S)try{i(w),n(JSON.parse(S)),console.log("User session restored from localStorage")}catch(C){console.error("Failed to parse stored user data:",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");s(!1)},[]),v.useEffect(()=>{if(r){console.log("Verifying token...");const w=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(w)==="true"&&e){console.log("Token already validated this session, skipping validation");return}ey.getProfile().then(C=>{C&&"data"in C&&(console.log("Profile verified successfully"),n(C.data),sessionStorage.setItem(w,"true"))}).catch(C=>{C.response&&C.response.status===401?(console.error("Token invalid (401):",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),i(null),n(null)):(console.warn("Profile validation error (not clearing token):",C),sessionStorage.setItem(w,"true"))})}else console.log("No token available, not validating profile")},[r,e]);const p=async(w,S)=>{var C,_;s(!0),console.log("Attempting login for user:",w);try{const A=await ey.login(w,S);if(console.log("Login API response received"),!A.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",A.data.access_token),localStorage.setItem("user",JSON.stringify(A.data.user)),i(A.data.access_token),n(A.data.user),console.log("Authentication state updated"),re.success("Login successful!"),A.data.access_token}catch(A){throw console.error("Login failed:",A),re.error("Login failed",{description:((_=(C=A.response)==null?void 0:C.data)==null?void 0:_.message)||"Invalid username or password"}),A}finally{s(!1)}},g=async()=>{l(!0);try{console.log("Starting Microsoft authentication...");const w=await d.loginPopup(Qie);if(w&&w.account&&w.idToken){console.log("Microsoft authentication successful",w.account);const S=await ey.loginWithMicrosoft(w.idToken);S.data.access_token&&(localStorage.setItem("auth_token",S.data.access_token),localStorage.setItem("user",JSON.stringify(S.data.user)),localStorage.setItem("auth_type","microsoft"),i(S.data.access_token),n(S.data.user),console.log("Microsoft user authenticated and stored"),re.success("Successfully signed in with Microsoft!"))}}catch(w){throw console.error("Microsoft login failed:",w),w.name==="BrowserAuthError"&&w.errorCode==="popup_window_error"?re.error("Sign-in cancelled",{description:"The sign-in popup was closed before completing authentication."}):w.name==="InteractionRequiredAuthError"?re.error("Authentication required",{description:"Please complete the authentication process."}):re.error("Microsoft sign-in failed",{description:w.message||"An error occurred during authentication"}),w}finally{l(!1)}},m=async()=>{const w=localStorage.getItem("auth_type");if(localStorage.removeItem("auth_token"),localStorage.removeItem("user"),localStorage.removeItem("auth_type"),i(null),n(null),w==="microsoft"&&f.length>0)try{await d.logoutPopup({account:f[0],postLogoutRedirectUri:window.location.origin+"/semblance/"})}catch(S){console.error("Microsoft logout error:",S)}re.info("You have been logged out")},y=!!localStorage.getItem("auth_token"),x={user:e,token:r,isLoading:o,login:p,loginWithMicrosoft:g,logout:m,isAuthenticated:!!r||y,isMsalLoading:c};return a.jsx(qU.Provider,{value:x,children:t})}function Xs(){const t=v.useContext(qU);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function Aa(){const[t,e]=v.useState(!1),n=Fi(),r=ar(),{isAuthenticated:i,logout:o}=Xs(),s=[{name:"Home",href:"/",icon:Vy},{name:"Synthetic Personas",href:"/synthetic-users",icon:Dr},{name:"Focus Groups",href:"/focus-groups",icon:Vs},{name:"Dashboard",href:"/dashboard",icon:G_}],c=()=>{e(!t)},l=d=>n.pathname===d,u=d=>{if(d==="/synthetic-users"){const f=new CustomEvent("syntheticUsersNavigation");window.dispatchEvent(f)}r(d)};return a.jsxs("header",{className:"fixed top-0 left-0 right-0 z-50 bg-white/80 backdrop-blur-md border-b border-slate-200/80",children:[a.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex h-16 items-center justify-between",children:[a.jsx("div",{className:"flex items-center",children:a.jsx(bo,{to:"/",className:"flex items-center",children:a.jsx("span",{className:"font-sf text-2xl font-semibold text-gradient",children:"Semblance"})})}),a.jsx("nav",{className:"hidden md:block",children:a.jsxs("ul",{className:"flex items-center space-x-8",children:[s.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(bo,{to:d.href,className:Ne("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",l(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]}):a.jsxs("button",{onClick:()=>u(d.href),className:Ne("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",l(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]})},d.name)),a.jsx("li",{children:i?a.jsxs("button",{onClick:()=>{o(),r("/login")},className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(JO,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(bo,{to:"/login",className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(XO,{className:"mr-1 h-4 w-4"}),"Login"]})})]})}),a.jsx("div",{className:"flex md:hidden",children:a.jsxs("button",{type:"button",className:"inline-flex items-center justify-center rounded-md p-2 text-slate-700 hover:bg-slate-100 hover:text-slate-900 button-transition",onClick:c,children:[a.jsx("span",{className:"sr-only",children:"Open main menu"}),t?a.jsx(Jo,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(rZ,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),t&&a.jsx("div",{className:"md:hidden glass-panel animate-fade-in",children:a.jsxs("div",{className:"space-y-1 px-4 pb-3 pt-2",children:[s.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(bo,{to:d.href,className:Ne("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition",l(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>e(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:Ne("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition w-full text-left",l(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>{e(!1),u(d.href)},children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]})},d.name)),i?a.jsxs("button",{onClick:()=>{o(),e(!1),r("/login")},className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900 w-full",children:[a.jsx(JO,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(bo,{to:"/login",className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900",onClick:()=>e(!1),children:[a.jsx(XO,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const ZI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,eR=Mt,XT=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return eR(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=o==null?void 0:o[u];if(d===null)return null;const h=ZI(d)||ZI(f);return i[u][h]}),c=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,y]=g;return Array.isArray(y)?y.includes({...o,...c}[m]):{...o,...c}[m]===y})?[...u,f,h]:u},[]);return eR(t,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},JT=XT("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),J=v.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},o)=>{const s=r?Hs:"button";return a.jsx(s,{className:Ne(JT({variant:e,size:n,className:t})),ref:o,...i})});J.displayName="Button";function Jie(){return a.jsxs("div",{className:"relative isolate overflow-hidden",children:[a.jsx("div",{className:"absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-primary to-blue-400 opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})}),a.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-24 sm:py-32 lg:flex lg:items-center lg:gap-x-10 lg:px-8 lg:py-40",children:[a.jsxs("div",{className:"mx-auto max-w-2xl lg:mx-0 lg:flex-auto",children:[a.jsx("div",{className:"flex",children:a.jsxs("div",{className:"relative flex items-center gap-x-4 rounded-full px-4 py-1 text-sm leading-6 text-gray-600 ring-1 ring-gray-900/10 hover:ring-gray-900/20",children:[a.jsx("span",{className:"font-semibold text-primary",children:"New"}),a.jsx("span",{className:"h-4 w-px bg-gray-900/10","aria-hidden":"true"}),a.jsx("span",{children:"Introducing AI-driven focus groups"})]})}),a.jsxs("h1",{className:"mt-10 max-w-lg text-4xl font-sf font-bold tracking-tight text-gray-900 sm:text-6xl",children:["Research with ",a.jsx("span",{className:"text-gradient",children:"synthetic personas"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-gray-600",children:"Conduct research using AI-powered synthetic personas and autonomous focus groups. Gain valuable insights without the limitations of traditional research methods."}),a.jsxs("div",{className:"mt-10 flex items-center gap-x-6",children:[a.jsx(bo,{to:"/synthetic-users",children:a.jsxs(J,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(fo,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(bo,{to:"/focus-groups",className:"text-sm font-semibold leading-6 text-gray-900 hover:text-primary button-transition",children:["Set up focus groups ",a.jsx("span",{"aria-hidden":"true",children:"→"})]})]})]}),a.jsx("div",{className:"mt-16 sm:mt-24 lg:mt-0 lg:flex-shrink-0 lg:flex-grow",children:a.jsxs("div",{className:"relative glass-card mx-auto w-[350px] h-[450px] rounded-2xl shadow-xl overflow-hidden animate-float",children:[a.jsxs("div",{className:"absolute top-4 left-4 right-4 h-12 bg-white/70 backdrop-blur-sm rounded-lg flex items-center px-4",children:[a.jsx("div",{className:"h-3 w-3 rounded-full bg-red-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-yellow-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-green-400 mr-2"}),a.jsx("div",{className:"text-xs text-gray-500 ml-2",children:"Shampoo Brand Perception"})]}),a.jsx("div",{className:"absolute top-20 left-4 right-4 bottom-4 bg-gray-50 rounded-lg overflow-hidden",children:[1,2,3,4].map(t=>a.jsx("div",{className:`flex ${t%2===0?"justify-end":"justify-start"} px-3 py-2`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg px-3 py-2 text-xs ${t%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[t===1&&"What qualities do you look for in a premium shampoo brand?",t===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",t===3&&"How important is fragrance in your shampoo selection?",t===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},t))})]})})]}),a.jsx("div",{className:"absolute inset-x-0 bottom-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:bottom-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%+11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-blue-400 to-primary opacity-20 sm:left-[calc(50%+30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})})]})}function Lu({title:t,description:e,icon:n,className:r}){return a.jsxs("div",{className:Ne("relative group glass-card rounded-xl overflow-hidden p-6 hover:shadow-lg hover:translate-y-[-4px] button-transition",r),children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/5 to-blue-400/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-12 h-12 flex items-center justify-center mb-4",children:a.jsx(n,{className:"h-6 w-6 text-primary"})}),a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:t}),a.jsx("p",{className:"text-gray-600 text-sm",children:e})]})]})}const Zie=()=>(Xs(),ar(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(Aa,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(Jie,{}),a.jsx("section",{className:"py-20 px-6 bg-white",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"Why Synthetic Personas?"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Our platform combines advanced AI with intuitive design to help researchers gain deeper insights faster than traditional methods."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[a.jsx(Lu,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:Dr}),a.jsx(Lu,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:Vs}),a.jsx(Lu,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:G_}),a.jsx(Lu,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:Dr}),a.jsx(Lu,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:uZ}),a.jsx(Lu,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:G_})]})]})}),a.jsx("section",{className:"py-20 px-6 bg-gradient-to-b from-white to-slate-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"How It Works"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Just three simple steps to gather valuable insights from synthetic personas."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"1"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Create Synthetic Personas"}),a.jsx("p",{className:"text-gray-600",children:"Define your target audience with customizable demographic profiles and personality traits."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"2"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Set Up Focus Groups"}),a.jsx("p",{className:"text-gray-600",children:"Configure your research objectives, topics, and parameters for the AI moderator."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"3"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Analyze Results"}),a.jsx("p",{className:"text-gray-600",children:"Review comprehensive visual reports and actionable insights from your synthetic research."})]})]}),a.jsx("div",{className:"text-center mt-12",children:a.jsx(bo,{to:"synthetic-users",className:"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary hover:bg-primary/90 button-transition",children:"Get Started"})})]})}),a.jsxs("footer",{className:"bg-white py-12 px-6",children:[a.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center",children:[a.jsxs("div",{className:"mb-6 md:mb-0",children:[a.jsx("span",{className:"text-xl font-sf font-semibold text-gradient",children:"Semblance"}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"AI-powered synthetic persona research"})]}),a.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Platform"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx(bo,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(bo,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(bo,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(bo,{to:"/dashboard",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Dashboard"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Company"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"About"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Blog"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Careers"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Contact"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Legal"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Privacy"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Terms"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Security"})})]})]})]})]}),a.jsx("div",{className:"max-w-7xl mx-auto mt-8 pt-8 border-t border-gray-200",children:a.jsxs("p",{className:"text-sm text-gray-500 text-center",children:["© ",new Date().getFullYear()," Semblance. All rights reserved."]})})]})]})})]})),eoe=()=>{const t=Fi(),e=ar();v.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]);const n=t.pathname.startsWith("/synthetic-users/"),i=new URLSearchParams(t.search).get("fromReview")==="true";return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:a.jsxs("div",{className:"text-center p-8 max-w-md bg-white rounded-lg shadow-md",children:[a.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),n?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The persona you're looking for may have been removed or doesn't exist."}),i?a.jsx(J,{onClick:()=>e("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(J,{onClick:()=>e("/synthetic-users"),className:"mb-2 w-full",children:"View All Personas"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The page you're looking for doesn't exist or has been moved."})]}),a.jsx(J,{variant:"outline",onClick:()=>e("/"),className:"w-full",children:"Return to Home"})]})})};function toe(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,noe(i,...e)]}function noe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var ZT="Progress",eN=100,[roe,aFe]=toe(ZT),[ioe,ooe]=roe(ZT),YU=v.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:o=soe,...s}=t;(i||i===0)&&!tR(i)&&console.error(aoe(`${i}`,"Progress"));const c=tR(i)?i:eN;r!==null&&!nR(r,c)&&console.error(coe(`${r}`,"Progress"));const l=nR(r,c)?r:null,u=vx(l)?o(l,c):void 0;return a.jsx(ioe,{scope:n,value:l,max:c,children:a.jsx(it.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":vx(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":JU(l,c),"data-value":l??void 0,"data-max":c,...s,ref:e})})});YU.displayName=ZT;var QU="ProgressIndicator",XU=v.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=ooe(QU,n);return a.jsx(it.div,{"data-state":JU(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});XU.displayName=QU;function soe(t,e){return`${Math.round(t/e*100)}%`}function JU(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function vx(t){return typeof t=="number"}function tR(t){return vx(t)&&!isNaN(t)&&t>0}function nR(t,e){return vx(t)&&!isNaN(t)&&t<=e&&t>=0}function aoe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${eN}\`.`}function coe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +${s}`);return}throw VB(e.error,e.error_description,e.suberror)?new ls(e.error,e.error_description,e.suberror,e.timestamp||pe.EMPTY_STRING,e.trace_id||pe.EMPTY_STRING,e.correlation_id||pe.EMPTY_STRING,e.claims||pe.EMPTY_STRING,o):s}}async handleServerTokenResponse(e,n,r,i,o,s,c,l,u){var g;(g=this.performanceClient)==null||g.addQueueMeasurement(K.HandleServerTokenResponse,e.correlation_id);let d;if(e.id_token){if(d=Hf(e.id_token||pe.EMPTY_STRING,this.cryptoObj.base64Decode),o&&o.nonce&&d.nonce!==o.nonce)throw we(q5);if(i.maxAge||i.maxAge===0){const m=d.auth_time;if(!m)throw we(WE);bB(m,i.maxAge)}}this.homeAccountIdentifier=cs.generateHomeAccountId(e.client_info||pe.EMPTY_STRING,n.authorityType,this.logger,this.cryptoObj,d);let f;o&&o.state&&(f=zf.parseRequestState(this.cryptoObj,o.state)),e.key_id=e.key_id||i.sshKid||void 0;const h=this.generateCacheRecord(e,n,r,i,d,s,o);let p;try{if(this.persistencePlugin&&this.serializableCache&&(this.logger.verbose("Persistence enabled, calling beforeCacheAccess"),p=new Gne(this.serializableCache,!0),await this.persistencePlugin.beforeCacheAccess(p)),c&&!l&&h.account){const m=this.cacheStorage.generateAccountKey(h.account.getAccountInfo());if(!this.cacheStorage.getAccount(m,i.correlationId))return this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache"),await hu.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,void 0,u)}await this.cacheStorage.saveCacheRecord(h,i.correlationId,i.storeInCache)}finally{this.persistencePlugin&&this.serializableCache&&p&&(this.logger.verbose("Persistence enabled, calling afterCacheAccess"),await this.persistencePlugin.afterCacheAccess(p))}return hu.generateAuthenticationResult(this.cryptoObj,n,h,!1,i,d,f,e,u)}generateCacheRecord(e,n,r,i,o,s,c){const l=n.getPreferredCache();if(!l)throw we(YE);const u=zB(o);let d,f;e.id_token&&o&&(d=N0(this.homeAccountIdentifier,l,e.id_token,this.clientId,u||""),f=ST(this.cacheStorage,n,this.homeAccountIdentifier,this.cryptoObj.base64Decode,i.correlationId,o,e.client_info,l,u,c,void 0,this.logger));let h=null;if(e.access_token){const m=e.scope?Ar.fromString(e.scope):new Ar(i.scopes||[]),y=(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,b=(typeof e.ext_expires_in=="string"?parseInt(e.ext_expires_in,10):e.ext_expires_in)||0,x=(typeof e.refresh_in=="string"?parseInt(e.refresh_in,10):e.refresh_in)||void 0,w=r+y,S=w+b,C=x&&x>0?r+x:void 0;h=P0(this.homeAccountIdentifier,l,e.access_token,this.clientId,u||n.tenant||"",m.printScopes(),w,S,this.cryptoObj.base64Decode,C,e.token_type,s,e.key_id,i.claims,i.requestedClaimsHash)}let p=null;if(e.refresh_token){let m;if(e.refresh_token_expires_in){const y=typeof e.refresh_token_expires_in=="string"?parseInt(e.refresh_token_expires_in,10):e.refresh_token_expires_in;m=r+y}p=BB(this.homeAccountIdentifier,l,e.refresh_token,this.clientId,e.foci,s,m)}let g=null;return e.foci&&(g={clientId:this.clientId,environment:l,familyId:e.foci}),{account:f,idToken:d,accessToken:h,refreshToken:p,appMetadata:g}}static async generateAuthenticationResult(e,n,r,i,o,s,c,l,u){var w,S,C,_,A;let d=pe.EMPTY_STRING,f=[],h=null,p,g,m=pe.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===yn.POP&&!o.popKid){const j=new Jd(e),{secret:P,keyId:k}=r.accessToken;if(!k)throw we(QE);d=await j.signPopToken(P,k,o)}else d=r.accessToken.secret;f=Ar.fromString(r.accessToken.target).asArray(),h=_d(r.accessToken.expiresOn),p=_d(r.accessToken.extendedExpiresOn),r.accessToken.refreshOn&&(g=_d(r.accessToken.refreshOn))}r.appMetadata&&(m=r.appMetadata.familyId===Yy?Yy:"");const y=(s==null?void 0:s.oid)||(s==null?void 0:s.sub)||"",b=(s==null?void 0:s.tid)||"";l!=null&&l.spa_accountid&&r.account&&(r.account.nativeAccountId=l==null?void 0:l.spa_accountid);const x=r.account?oT(r.account.getAccountInfo(),void 0,s,(w=r.idToken)==null?void 0:w.secret):null;return{authority:n.canonicalAuthority,uniqueId:y,tenantId:b,scopes:f,account:x,idToken:((S=r==null?void 0:r.idToken)==null?void 0:S.secret)||"",idTokenClaims:s||{},accessToken:d,fromCache:i,expiresOn:h,extExpiresOn:p,refreshOn:g,correlationId:o.correlationId,requestId:u||pe.EMPTY_STRING,familyId:m,tokenType:((C=r.accessToken)==null?void 0:C.tokenType)||pe.EMPTY_STRING,state:c?c.userRequestState:pe.EMPTY_STRING,cloudGraphHostName:((_=r.account)==null?void 0:_.cloudGraphHostName)||pe.EMPTY_STRING,msGraphHost:((A=r.account)==null?void 0:A.msGraphHost)||pe.EMPTY_STRING,code:l==null?void 0:l.spa_code,fromNativeBroker:!1}}}function ST(t,e,n,r,i,o,s,c,l,u,d,f){f==null||f.verbose("setCachedAccount called");const p=t.getAccountKeys().find(x=>x.startsWith(n));let g=null;p&&(g=t.getAccount(p,i));const m=g||cs.createAccount({homeAccountId:n,idTokenClaims:o,clientInfo:s,environment:c,cloudGraphHostName:u==null?void 0:u.cloud_graph_host_name,msGraphHost:u==null?void 0:u.msgraph_host,nativeAccountId:d},e,r),y=m.tenantProfiles||[],b=l||m.realm;if(b&&!y.find(x=>x.tenantId===b)){const x=iT(n,m.localAccountId,b,o);y.push(x)}return m.tenantProfiles=y,m}/*! @azure/msal-common v15.10.0 2025-08-05 */async function KB(t,e,n){return typeof t=="string"?t:t({clientId:e,tokenEndpoint:n})}/*! @azure/msal-common v15.10.0 2025-08-05 */class WB extends xT{constructor(e,n){var r;super(e,n),this.includeRedirectUri=!0,this.oidcDefaultScopes=(r=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:r.defaultScopes}async acquireToken(e,n){var c,l;if((c=this.performanceClient)==null||c.addQueueMeasurement(K.AuthClientAcquireToken,e.correlationId),!e.code)throw we(X5);const r=$i(),i=await fe(this.executeTokenRequest.bind(this),K.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),o=(l=i.headers)==null?void 0:l[di.X_MS_REQUEST_ID],s=new hu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return s.validateTokenResponse(i.body),fe(s.handleServerTokenResponse.bind(s),K.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(i.body,this.authority,r,e,n,void 0,void 0,void 0,o)}getLogoutUri(e){if(!e)throw jn(dB);const n=this.createLogoutUrlQueryString(e);return tn.appendQueryString(this.authority.endSessionEndpoint,n)}async executeTokenRequest(e,n){var u;(u=this.performanceClient)==null||u.addQueueMeasurement(K.AuthClientExecuteTokenRequest,n.correlationId);const r=this.createTokenQueryParameters(n),i=tn.appendQueryString(e.tokenEndpoint,r),o=await fe(this.createTokenRequestBody.bind(this),K.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,n.correlationId)(n);let s;if(n.clientInfo)try{const d=nx(n.clientInfo,this.cryptoUtils.base64Decode);s={credential:`${d.uid}${Qp.CLIENT_INFO_SEPARATOR}${d.utid}`,type:Wo.HOME_ACCOUNT_ID}}catch(d){this.logger.verbose("Could not parse client info for CCS Header: "+d)}const c=this.createTokenRequestHeaders(s||n.ccsCredential),l=k0(this.config.authOptions.clientId,n);return fe(this.executePostToTokenEndpoint.bind(this),K.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,n.correlationId)(i,o,c,l,n.correlationId,K.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(K.AuthClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(uT(n,e.embeddedClientId||((o=e.tokenBodyParameters)==null?void 0:o[fu])||this.config.authOptions.clientId),this.includeRedirectUri)dT(n,e.redirectUri);else if(!e.redirectUri)throw jn(sB);if(lT(n,e.scopes,!0,this.oidcDefaultScopes),yne(n,e.code),pT(n,this.config.libraryInfo),mT(n,this.config.telemetry.application),FB(n),this.serverTelemetryManager&&!jB(this.config)&&LB(n,this.serverTelemetryManager),e.codeVerifier&&bne(n,e.codeVerifier),this.config.clientCredentials.clientSecret&&OB(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;IB(n,await KB(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),RB(n,s.assertionType)}if(MB(n,B5.AUTHORIZATION_CODE_GRANT),gT(n),e.authenticationScheme===yn.POP){const s=new Jd(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await fe(s.generateCnf.bind(s),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,vT(n,c)}else if(e.authenticationScheme===yn.SSH)if(e.sshJwk)$B(n,e.sshJwk);else throw jn(A0);(!$s.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&fT(n,e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const s=nx(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${s.uid}${Qp.CLIENT_INFO_SEPARATOR}${s.utid}`,type:Wo.HOME_ACCOUNT_ID}}catch(s){this.logger.verbose("Could not parse client info for CCS Header: "+s)}else r=e.ccsCredential;if(this.config.systemOptions.preventCorsPreflight&&r)switch(r.type){case Wo.HOME_ACCOUNT_ID:try{const s=Cd(r.credential);lp(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Wo.UPN:ox(n,r.credential);break}return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Mc(n,e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[CI])&&Mc(n,{[CI]:"1"}),j0(n,e.correlationId,this.performanceClient),Xp(n)}createLogoutUrlQueryString(e){const n=new Map;return e.postLogoutRedirectUri&&hne(n,e.postLogoutRedirectUri),e.correlationId&&hT(n,e.correlationId),e.idTokenHint&&pne(n,e.idTokenHint),e.state&&PB(n,e.state),e.logoutHint&&Sne(n,e.logoutHint),e.extraQueryParameters&&Mc(n,e.extraQueryParameters),this.config.authOptions.instanceAware&&DB(n),Xp(n,this.config.authOptions.encodeExtraQueryParams,e.extraQueryParameters)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Vne=300;class Kne extends xT{constructor(e,n){super(e,n)}async acquireToken(e){var s,c;(s=this.performanceClient)==null||s.addQueueMeasurement(K.RefreshTokenClientAcquireToken,e.correlationId);const n=$i(),r=await fe(this.executeTokenRequest.bind(this),K.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(c=r.headers)==null?void 0:c[di.X_MS_REQUEST_ID],o=new hu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(r.body),fe(o.handleServerTokenResponse.bind(o),K.HandleServerTokenResponse,this.logger,this.performanceClient,e.correlationId)(r.body,this.authority,n,e,void 0,void 0,!0,e.forceCache,i)}async acquireTokenByRefreshToken(e){var r;if(!e)throw jn(uB);if((r=this.performanceClient)==null||r.addQueueMeasurement(K.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw we(qE);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const o=i instanceof ls&&i.errorCode===ax,s=i instanceof Tu&&i.errorCode===gI.INVALID_GRANT_ERROR&&i.subError===gI.CLIENT_MISMATCH_ERROR;if(o||s)return fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return fe(this.acquireTokenWithCachedRefreshToken.bind(this),K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,n){var o,s,c;(o=this.performanceClient)==null||o.addQueueMeasurement(K.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=Zi(this.cacheManager.getRefreshToken.bind(this.cacheManager),K.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,n,e.correlationId,void 0,this.performanceClient);if(!r)throw cx(ax);if(r.expiresOn&&sx(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||Vne))throw(s=this.performanceClient)==null||s.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),cx(bT);const i={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||yn.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:Wo.HOME_ACCOUNT_ID}};try{return await fe(this.acquireToken.bind(this),K.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(l){if(l instanceof ls&&((c=this.performanceClient)==null||c.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),l.subError===I0)){this.logger.verbose("acquireTokenWithRefreshToken: bad refresh token, removing from cache");const u=this.cacheManager.generateCredentialKey(r);this.cacheManager.removeRefreshToken(u,e.correlationId)}throw l}}async executeTokenRequest(e,n){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(K.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),i=tn.appendQueryString(n.tokenEndpoint,r),o=await fe(this.createTokenRequestBody.bind(this),K.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),s=this.createTokenRequestHeaders(e.ccsCredential),c=k0(this.config.authOptions.clientId,e);return fe(this.executePostToTokenEndpoint.bind(this),K.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,o,s,c,e.correlationId,K.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(K.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(uT(n,e.embeddedClientId||((i=e.tokenBodyParameters)==null?void 0:i[fu])||this.config.authOptions.clientId),e.redirectUri&&dT(n,e.redirectUri),lT(n,e.scopes,!0,(o=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:o.defaultScopes),MB(n,B5.REFRESH_TOKEN_GRANT),gT(n),pT(n,this.config.libraryInfo),mT(n,this.config.telemetry.application),FB(n),this.serverTelemetryManager&&!jB(this.config)&&LB(n,this.serverTelemetryManager),xne(n,e.refreshToken),this.config.clientCredentials.clientSecret&&OB(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;IB(n,await KB(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),RB(n,s.assertionType)}if(e.authenticationScheme===yn.POP){const s=new Jd(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await fe(s.generateCnf.bind(s),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,vT(n,c)}else if(e.authenticationScheme===yn.SSH)if(e.sshJwk)$B(n,e.sshJwk);else throw jn(A0);if((!$s.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&fT(n,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case Wo.HOME_ACCOUNT_ID:try{const s=Cd(e.ccsCredential.credential);lp(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case Wo.UPN:ox(n,e.ccsCredential.credential);break}return e.embeddedClientId&&E0(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Mc(n,e.tokenBodyParameters),j0(n,e.correlationId,this.performanceClient),Xp(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Wne extends xT{constructor(e,n){super(e,n)}async acquireCachedToken(e){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(K.SilentFlowClientAcquireCachedToken,e.correlationId);let n=Cl.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!$s.isEmptyObj(e.claims))throw this.setCacheOutcome(Cl.FORCE_REFRESH_OR_CLAIMS,e.correlationId),we(Rc);if(!e.account)throw we(qE);const r=e.account.tenantId||Dne(e.authority),i=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,i,r);if(o){if(Nne(o.cachedAt)||sx(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Cl.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),we(Rc);o.refreshOn&&sx(o.refreshOn,0)&&(n=Cl.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Cl.NO_CACHED_ACCESS_TOKEN,e.correlationId),we(Rc);const s=e.authority||this.authority.getPreferredCache(),c={account:this.cacheManager.getAccount(this.cacheManager.generateAccountKey(e.account),e.correlationId),accessToken:o,idToken:this.cacheManager.getIdToken(e.account,e.correlationId,i,r,this.performanceClient),refreshToken:null,appMetadata:this.cacheManager.readAppMetadataFromCache(s)};return this.setCacheOutcome(n,e.correlationId),this.config.serverTelemetryManager&&this.config.serverTelemetryManager.incrementCacheHits(),[await fe(this.generateResultFromCacheRecord.bind(this),K.SilentFlowClientGenerateResultFromCacheRecord,this.logger,this.performanceClient,e.correlationId)(c,e),n]}setCacheOutcome(e,n){var r,i;(r=this.serverTelemetryManager)==null||r.setCacheOutcome(e),(i=this.performanceClient)==null||i.addFields({cacheOutcome:e},n),e!==Cl.NOT_APPLICABLE&&this.logger.info(`Token refresh is required due to cache outcome: ${e}`)}async generateResultFromCacheRecord(e,n){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(K.SilentFlowClientGenerateResultFromCacheRecord,n.correlationId);let r;if(e.idToken&&(r=Hf(e.idToken.secret,this.config.cryptoInterface.base64Decode)),n.maxAge||n.maxAge===0){const o=r==null?void 0:r.auth_time;if(!o)throw we(WE);bB(o,n.maxAge)}return hu.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,n,r)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const qne={sendGetRequestAsync:()=>Promise.reject(we(Kt)),sendPostRequestAsync:()=>Promise.reject(we(Kt))};/*! @azure/msal-common v15.10.0 2025-08-05 */function Yne(t,e,n,r){var c,l;const i=e.correlationId,o=new Map;uT(o,e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[fu])||t.clientId);const s=[...e.scopes||[],...e.extraScopesToConsent||[]];if(lT(o,s,!0,(l=t.authority.options.OIDCOptions)==null?void 0:l.defaultScopes),dT(o,e.redirectUri),hT(o,i),dne(o,e.responseMode),gT(o),e.prompt&&(gne(o,e.prompt),r==null||r.addFields({prompt:e.prompt},i)),e.domainHint&&(mne(o,e.domainHint),r==null||r.addFields({domainHintFromRequest:!0},i)),e.prompt!==pi.SELECT_ACCOUNT)if(e.sid&&e.prompt===pi.NONE)n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),_I(o,e.sid),r==null||r.addFields({sidFromRequest:!0},i);else if(e.account){const u=Jne(e.account);let d=Zne(e.account);if(d&&e.domainHint&&(n.warning('AuthorizationCodeClient.createAuthCodeUrlQueryString: "domainHint" param is set, skipping opaque "login_hint" claim. Please consider not passing domainHint'),d=null),d){n.verbose("createAuthCodeUrlQueryString: login_hint claim present on account"),dv(o,d),r==null||r.addFields({loginHintFromClaim:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(u&&e.prompt===pi.NONE){n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),_I(o,u),r==null||r.addFields({sidFromClaim:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(e.loginHint)n.verbose("createAuthCodeUrlQueryString: Adding login_hint from request"),dv(o,e.loginHint),ox(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i);else if(e.account.username){n.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),dv(o,e.account.username),r==null||r.addFields({loginHintFromUpn:!0},i);try{const f=Cd(e.account.homeAccountId);lp(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}}else e.loginHint&&(n.verbose("createAuthCodeUrlQueryString: No account, adding login_hint from request"),dv(o,e.loginHint),ox(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i));else n.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return e.nonce&&vne(o,e.nonce),e.state&&PB(o,e.state),(e.claims||t.clientCapabilities&&t.clientCapabilities.length>0)&&fT(o,e.claims,t.clientCapabilities),e.embeddedClientId&&E0(o,t.clientId,t.redirectUri),t.instanceAware&&(!e.extraQueryParameters||!Object.keys(e.extraQueryParameters).includes(oA))&&DB(o),o}function CT(t,e,n,r){const i=Xp(e,n,r);return tn.appendQueryString(t.authorizationEndpoint,i)}function Qne(t,e){if(qB(t,e),!t.code)throw we(nB);return t}function qB(t,e){if(!t.state||!e)throw t.state?we(Z_,"Cached State"):we(Z_,"Server State");let n,r;try{n=decodeURIComponent(t.state)}catch{throw we(Xd,t.state)}try{r=decodeURIComponent(e)}catch{throw we(Xd,t.state)}if(n!==r)throw we(W5);if(t.error||t.error_description||t.suberror){const i=Xne(t);throw VB(t.error,t.error_description,t.suberror)?new ls(t.error||"",t.error_description,t.suberror,t.timestamp||"",t.trace_id||"",t.correlation_id||"",t.claims||"",i):new Tu(t.error||"",t.error_description,t.suberror,i)}}function Xne(t){var r,i;const e="code=",n=(r=t.error_uri)==null?void 0:r.lastIndexOf(e);return n&&n>=0?(i=t.error_uri)==null?void 0:i.substring(n+e.length):void 0}function Jne(t){var e;return((e=t.idTokenClaims)==null?void 0:e.sid)||null}function Zne(t){var e;return t.loginHint||((e=t.idTokenClaims)==null?void 0:e.login_hint)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */const kI=",",YB="|";function ere(t){const{skus:e,libraryName:n,libraryVersion:r,extensionName:i,extensionVersion:o}=t,s=new Map([[0,[n,r]],[2,[i,o]]]);let c=[];if(e!=null&&e.length){if(c=e.split(kI),c.length<4)return e}else c=Array.from({length:4},()=>YB);return s.forEach((l,u)=>{var d,f;l.length===2&&((d=l[0])!=null&&d.length)&&((f=l[1])!=null&&f.length)&&tre({skuArr:c,index:u,skuName:l[0],skuVersion:l[1]})}),c.join(kI)}function tre(t){const{skuArr:e,index:n,skuName:r,skuVersion:i}=t;n>=e.length||(e[n]=[r,i].join(YB))}class Jp{constructor(e,n){this.cacheOutcome=Cl.NOT_APPLICABLE,this.cacheManager=n,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||pe.EMPTY_STRING,this.wrapperVer=e.wrapperVer||pe.EMPTY_STRING,this.telemetryCacheKey=Lr.CACHE_KEY+Qp.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Lr.VALUE_SEPARATOR}${this.cacheOutcome}`,n=[this.wrapperSKU,this.wrapperVer],r=this.getNativeBrokerErrorCode();r!=null&&r.length&&n.push(`broker_error=${r}`);const i=n.join(Lr.VALUE_SEPARATOR),o=this.getRegionDiscoveryFields(),s=[e,o].join(Lr.VALUE_SEPARATOR);return[Lr.SCHEMA_VERSION,s,i].join(Lr.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),n=Jp.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*n).join(Lr.VALUE_SEPARATOR),i=e.errors.slice(0,n).join(Lr.VALUE_SEPARATOR),o=e.errors.length,s=n=Lr.MAX_CACHED_ERRORS&&(n.failedRequests.shift(),n.failedRequests.shift(),n.errors.shift()),n.failedRequests.push(this.apiId,this.correlationId),e instanceof Error&&e&&e.toString()?e instanceof _n?e.subError?n.errors.push(e.subError):e.errorCode?n.errors.push(e.errorCode):n.errors.push(e.toString()):n.errors.push(e.toString()):n.errors.push(Lr.UNKNOWN_ERROR),this.cacheManager.setServerTelemetry(this.telemetryCacheKey,n,this.correlationId)}incrementCacheHits(){const e=this.getLastRequests();return e.cacheHits+=1,this.cacheManager.setServerTelemetry(this.telemetryCacheKey,e,this.correlationId),e.cacheHits}getLastRequests(){const e={failedRequests:[],errors:[],cacheHits:0};return this.cacheManager.getServerTelemetry(this.telemetryCacheKey)||e}clearTelemetryCache(){const e=this.getLastRequests(),n=Jp.maxErrorsToSend(e),r=e.errors.length;if(n===r)this.cacheManager.removeItem(this.telemetryCacheKey,this.correlationId);else{const i={failedRequests:e.failedRequests.slice(n*2),errors:e.errors.slice(n),cacheHits:0};this.cacheManager.setServerTelemetry(this.telemetryCacheKey,i,this.correlationId)}}static maxErrorsToSend(e){let n,r=0,i=0;const o=e.errors.length;for(n=0;nString.fromCodePoint(n)).join("");return btoa(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Zo(t){return new TextDecoder().decode(Dc(t))}function Dc(t){let e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw Ge(CU)}const n=atob(e);return Uint8Array.from(n,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const hre="RSASSA-PKCS1-v1_5",Gf="AES-GCM",NU="HKDF",OT="SHA-256",pre=2048,mre=new Uint8Array([1,0,1]),MI="0123456789abcdef",DI=new Uint32Array(1),IT="raw",PU="encrypt",RT="decrypt",gre="deriveKey",vre="crypto_subtle_undefined",MT={name:hre,hash:OT,modulusLength:pre,publicExponent:mre};function yre(t){if(!window)throw Ge(D0);if(!window.crypto)throw Ge(sA);if(!t&&!window.crypto.subtle)throw Ge(sA,vre)}async function kU(t,e,n){e==null||e.addQueueMeasurement(K.Sha256Digest,n);const i=new TextEncoder().encode(t);return window.crypto.subtle.digest(OT,i)}function xre(t){return window.crypto.getRandomValues(t)}function BS(){return window.crypto.getRandomValues(DI),DI[0]}function us(){const t=Date.now(),e=BS()*1024+(BS()&1023),n=new Uint8Array(16),r=Math.trunc(e/2**30),i=e&2**30-1,o=BS();n[0]=t/2**40,n[1]=t/2**32,n[2]=t/2**24,n[3]=t/2**16,n[4]=t/2**8,n[5]=t,n[6]=112|r>>>8,n[7]=r,n[8]=128|i>>>24,n[9]=i>>>16,n[10]=i>>>8,n[11]=i,n[12]=o>>>24,n[13]=o>>>16,n[14]=o>>>8,n[15]=o;let s="";for(let c=0;c>>4),s+=MI.charAt(n[c]&15),(c===3||c===5||c===7||c===9)&&(s+="-");return s}async function bre(t,e){return window.crypto.subtle.generateKey(MT,t,e)}async function US(t){return window.crypto.subtle.exportKey(EU,t)}async function wre(t,e,n){return window.crypto.subtle.importKey(EU,t,MT,e,n)}async function Sre(t,e){return window.crypto.subtle.sign(MT,t,e)}async function DT(){const t=await OU(),n={alg:"dir",kty:"oct",k:Xc(new Uint8Array(t))};return em(JSON.stringify(n))}async function Cre(t){const e=Zo(t),r=JSON.parse(e).k,i=Dc(r);return window.crypto.subtle.importKey(IT,i,Gf,!1,[RT])}async function _re(t,e){const n=e.split(".");if(n.length!==5)throw Ge(ty,"jwe_length");const r=await Cre(t).catch(()=>{throw Ge(ty,"import_key")});try{const i=new TextEncoder().encode(n[0]),o=Dc(n[2]),s=Dc(n[3]),c=Dc(n[4]),l=c.byteLength*8,u=new Uint8Array(s.length+c.length);u.set(s),u.set(c,s.length);const d=await window.crypto.subtle.decrypt({name:Gf,iv:o,tagLength:l,additionalData:i},r,u);return new TextDecoder().decode(d)}catch{throw Ge(ty,"decrypt")}}async function OU(){const t=await window.crypto.subtle.generateKey({name:Gf,length:256},!0,[PU,RT]);return window.crypto.subtle.exportKey(IT,t)}async function $I(t){return window.crypto.subtle.importKey(IT,t,NU,!1,[gre])}async function IU(t,e,n){return window.crypto.subtle.deriveKey({name:NU,salt:e,hash:OT,info:new TextEncoder().encode(n)},t,{name:Gf,length:256},!1,[PU,RT])}async function Are(t,e,n){const r=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(16)),o=await IU(t,i,n),s=await window.crypto.subtle.encrypt({name:Gf,iv:new Uint8Array(12)},o,r);return{data:Xc(new Uint8Array(s)),nonce:Xc(i)}}async function LI(t,e,n,r){const i=Dc(r),o=await IU(t,Dc(e),n),s=await window.crypto.subtle.decrypt({name:Gf,iv:new Uint8Array(12)},o,i);return new TextDecoder().decode(s)}async function RU(t){const e=await kU(t),n=new Uint8Array(e);return Xc(n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const tm="storage_not_supported",cr="stubbed_public_client_application_called",dx="in_mem_redirect_unavailable";/*! @azure/msal-browser v4.19.0 2025-08-05 */const ny={[tm]:"Given storage configuration option was not supported.",[cr]:"Stub instance of Public Client Application was called. If using msal-react, please ensure context is not used without a provider. For more visit: aka.ms/msaljs/browser-errors",[dx]:"Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."};ny[tm],ny[cr],ny[dx];class $T extends _n{constructor(e,n){super(e,n),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,$T.prototype)}}function lr(t){return new $T(t,ny[t])}/*! @azure/msal-browser v4.19.0 2025-08-05 */function MU(t){t.location.hash="",typeof t.history.replaceState=="function"&&t.history.replaceState(null,"",`${t.location.origin}${t.location.pathname}${t.location.search}`)}function jre(t){const e=t.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function LT(){return window.parent!==window}function Ere(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Ti.POPUP_NAME_PREFIX}.`)===0}function xa(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Tre(){const e=new tn(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function Nre(){if(tn.hashContainsKnownProperties(window.location.hash)&<())throw Ge(cU)}function Pre(t){if(LT()&&!t)throw Ge(aU)}function kre(){if(Ere())throw Ge(lU)}function DU(){if(typeof window>"u")throw Ge(D0)}function $U(t){if(!t)throw Ge(up)}function FT(t){DU(),Nre(),kre(),$U(t)}function FI(t,e){if(FT(t),Pre(e.system.allowRedirectInIframe),e.cache.cacheLocation===jr.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw lr(dx)}function LU(t){const e=document.createElement("link");e.rel="preconnect",e.href=new URL(t).origin,e.crossOrigin="anonymous",document.head.appendChild(e),window.setTimeout(()=>{try{document.head.removeChild(e)}catch{}},1e4)}function Ore(){return us()}/*! @azure/msal-browser v4.19.0 2025-08-05 */class fx{navigateInternal(e,n){return fx.defaultNavigateWindow(e,n)}navigateExternal(e,n){return fx.defaultNavigateWindow(e,n)}static defaultNavigateWindow(e,n){return n.noHistory?window.location.replace(e):window.location.assign(e),new Promise((r,i)=>{setTimeout(()=>{i(Ge(ux,"failed_to_redirect"))},n.timeout)})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ire{async sendGetRequestAsync(e,n){let r,i={},o=0;const s=BI(n);try{r=await fetch(e,{method:II.GET,headers:s})}catch(c){throw Vh(Ge(window.navigator.onLine?pU:lx),void 0,void 0,c)}i=UI(r.headers);try{return o=r.status,{headers:i,body:await r.json(),status:o}}catch(c){throw Vh(Ge(aA),o,i,c)}}async sendPostRequestAsync(e,n){const r=n&&n.body||"",i=BI(n);let o,s=0,c={};try{o=await fetch(e,{method:II.POST,headers:i,body:r})}catch(l){throw Vh(Ge(window.navigator.onLine?hU:lx),void 0,void 0,l)}c=UI(o.headers);try{return s=o.status,{headers:c,body:await o.json(),status:s}}catch(l){throw Vh(Ge(aA),s,c,l)}}}function BI(t){try{const e=new Headers;if(!(t&&t.headers))return e;const n=t.headers;return Object.entries(n).forEach(([r,i])=>{e.append(r,i)}),e}catch(e){throw Vh(Ge(AU),void 0,void 0,e)}}function UI(t){try{const e={};return t.forEach((n,r)=>{e[r]=n}),e}catch{throw Ge(jU)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Rre=6e4,lA=1e4,Mre=3e4,FU=2e3;function Dre({auth:t,cache:e,system:n,telemetry:r},i){const o={clientId:pe.EMPTY_STRING,authority:`${pe.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:pe.EMPTY_STRING,authorityMetadata:pe.EMPTY_STRING,redirectUri:typeof window<"u"?xa():"",postLogoutRedirectUri:pe.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Di.AAD,OIDCOptions:{serverResponseType:_0.FRAGMENT,defaultScopes:[pe.OPENID_SCOPE,pe.PROFILE_SCOPE,pe.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:ZE.None,tenant:pe.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1,encodeExtraQueryParams:!1},s={cacheLocation:jr.SessionStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===jr.LocalStorage),claimsBasedCachingEnabled:!1},c={loggerCallback:()=>{},logLevel:Dn.Info,piiLoggingEnabled:!1},u={...{...AB,loggerOptions:c,networkClient:i?new Ire:qne,navigationClient:new fx,loadFrameTimeout:0,windowHashTimeout:(n==null?void 0:n.loadFrameTimeout)||Rre,iframeHashTimeout:(n==null?void 0:n.loadFrameTimeout)||lA,navigateFrameWait:0,redirectNavigationTimeout:Mre,asyncPopups:!1,allowRedirectInIframe:!1,allowPlatformBroker:!1,nativeBrokerHandshakeTimeout:(n==null?void 0:n.nativeBrokerHandshakeTimeout)||FU,pollIntervalMilliseconds:Ti.DEFAULT_POLL_INTERVAL_MS},...n,loggerOptions:(n==null?void 0:n.loggerOptions)||c},d={application:{appName:pe.EMPTY_STRING,appVersion:pe.EMPTY_STRING},client:new _B};if((t==null?void 0:t.protocolMode)!==Di.OIDC&&(t!=null&&t.OIDCOptions)&&new Da(u.loggerOptions).warning(JSON.stringify(jn(mB))),t!=null&&t.protocolMode&&t.protocolMode===Di.OIDC&&(u!=null&&u.allowPlatformBroker))throw jn(gB);return{auth:{...o,...t,OIDCOptions:{...o.OIDCOptions,...t==null?void 0:t.OIDCOptions}},cache:{...s,...e},system:u,telemetry:{...d,...r}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const $re="@azure/msal-browser",pu="4.19.0";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Pr="msal",BT="browser",HS="-",ec=1,uA=1,Lre=`${Pr}.${BT}.log.level`,Fre=`${Pr}.${BT}.log.pii`,Bre=`${Pr}.${BT}.platform.auth.dom`,HI=`${Pr}.version`,zI="account.keys",GI="token.keys";function ws(t=uA){return t<1?`${Pr}.${zI}`:`${Pr}.${t}.${zI}`}function Il(t,e=ec){return e<1?`${Pr}.${GI}.${t}`:`${Pr}.${e}.${GI}.${t}`}/*! @azure/msal-browser v4.19.0 2025-08-05 */class UT{static loggerCallback(e,n){switch(e){case Dn.Error:console.error(n);return;case Dn.Info:console.info(n);return;case Dn.Verbose:console.debug(n);return;case Dn.Warning:console.warn(n);return;default:console.log(n);return}}constructor(e){var l;this.browserEnvironment=typeof window<"u",this.config=Dre(e,this.browserEnvironment);let n;try{n=window[jr.SessionStorage]}catch{}const r=n==null?void 0:n.getItem(Lre),i=(l=n==null?void 0:n.getItem(Fre))==null?void 0:l.toLowerCase(),o=i==="true"?!0:i==="false"?!1:void 0,s={...this.config.system.loggerOptions},c=r&&Object.keys(Dn).includes(r)?Dn[r]:void 0;c&&(s.loggerCallback=UT.loggerCallback,s.logLevel=c),o!==void 0&&(s.piiLoggingEnabled=o),this.logger=new Da(s,$re,pu),this.available=!1}getConfig(){return this.config}getLogger(){return this.logger}isAvailable(){return this.available}isBrowserEnvironment(){return this.browserEnvironment}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mu extends UT{getModuleName(){return mu.MODULE_NAME}getId(){return mu.ID}async initialize(){return this.available=typeof window<"u",this.available}}mu.MODULE_NAME="";mu.ID="StandardOperatingContext";/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ure{constructor(){this.dbName=cA,this.version=ure,this.tableName=dre,this.dbOpen=!1}async open(){return new Promise((e,n)=>{const r=window.indexedDB.open(this.dbName,this.version);r.addEventListener("upgradeneeded",i=>{i.target.result.createObjectStore(this.tableName)}),r.addEventListener("success",i=>{const o=i;this.db=o.target.result,this.dbOpen=!0,e()}),r.addEventListener("error",()=>n(Ge(PT)))})}closeConnection(){const e=this.db;e&&this.dbOpen&&(e.close(),this.dbOpen=!1)}async validateDbIsOpen(){if(!this.dbOpen)return this.open()}async getItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).get(e);s.addEventListener("success",c=>{const l=c;this.closeConnection(),n(l.target.result)}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async setItem(e,n){return await this.validateDbIsOpen(),new Promise((r,i)=>{if(!this.db)return i(Ge(Wu));const c=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).put(n,e);c.addEventListener("success",()=>{this.closeConnection(),r()}),c.addEventListener("error",l=>{this.closeConnection(),i(l)})})}async removeItem(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readwrite").objectStore(this.tableName).delete(e);s.addEventListener("success",()=>{this.closeConnection(),n()}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async getKeys(){return await this.validateDbIsOpen(),new Promise((e,n)=>{if(!this.db)return n(Ge(Wu));const o=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).getAllKeys();o.addEventListener("success",s=>{const c=s;this.closeConnection(),e(c.target.result)}),o.addEventListener("error",s=>{this.closeConnection(),n(s)})})}async containsKey(e){return await this.validateDbIsOpen(),new Promise((n,r)=>{if(!this.db)return r(Ge(Wu));const s=this.db.transaction([this.tableName],"readonly").objectStore(this.tableName).count(e);s.addEventListener("success",c=>{const l=c;this.closeConnection(),n(l.target.result===1)}),s.addEventListener("error",c=>{this.closeConnection(),r(c)})})}async deleteDatabase(){return this.db&&this.dbOpen&&this.closeConnection(),new Promise((e,n)=>{const r=window.indexedDB.deleteDatabase(cA),i=setTimeout(()=>n(!1),200);r.addEventListener("success",()=>(clearTimeout(i),e(!0))),r.addEventListener("blocked",()=>(clearTimeout(i),e(!0))),r.addEventListener("error",()=>(clearTimeout(i),n(!1)))})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class $0{constructor(){this.cache=new Map}async initialize(){}getItem(e){return this.cache.get(e)||null}getUserData(e){return this.getItem(e)}setItem(e,n){this.cache.set(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){this.cache.delete(e)}getKeys(){const e=[];return this.cache.forEach((n,r)=>{e.push(r)}),e}containsKey(e){return this.cache.has(e)}clear(){this.cache.clear()}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Hre{constructor(e){this.inMemoryCache=new $0,this.indexedDBCache=new Ure,this.logger=e}handleDatabaseAccessError(e){if(e instanceof yg&&e.errorCode===PT)this.logger.error("Could not access persistent storage. This may be caused by browser privacy features which block persistent storage in third-party contexts.");else throw e}async getItem(e){const n=this.inMemoryCache.getItem(e);if(!n)try{return this.logger.verbose("Queried item not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.getItem(e)}catch(r){this.handleDatabaseAccessError(r)}return n}async setItem(e,n){this.inMemoryCache.setItem(e,n);try{await this.indexedDBCache.setItem(e,n)}catch(r){this.handleDatabaseAccessError(r)}}async removeItem(e){this.inMemoryCache.removeItem(e);try{await this.indexedDBCache.removeItem(e)}catch(n){this.handleDatabaseAccessError(n)}}async getKeys(){const e=this.inMemoryCache.getKeys();if(e.length===0)try{return this.logger.verbose("In-memory cache is empty, now querying persistent storage."),await this.indexedDBCache.getKeys()}catch(n){this.handleDatabaseAccessError(n)}return e}async containsKey(e){const n=this.inMemoryCache.containsKey(e);if(!n)try{return this.logger.verbose("Key not found in in-memory cache, now querying persistent storage."),await this.indexedDBCache.containsKey(e)}catch(r){this.handleDatabaseAccessError(r)}return n}clearInMemory(){this.logger.verbose("Deleting in-memory keystore"),this.inMemoryCache.clear(),this.logger.verbose("In-memory keystore deleted")}async clearPersistent(){try{this.logger.verbose("Deleting persistent keystore");const e=await this.indexedDBCache.deleteDatabase();return e&&this.logger.verbose("Persistent keystore deleted"),e}catch(e){return this.handleDatabaseAccessError(e),!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class $a{constructor(e,n,r){this.logger=e,yre(r??!1),this.cache=new Hre(this.logger),this.performanceClient=n}createNewGuid(){return us()}base64Encode(e){return em(e)}base64Decode(e){return Zo(e)}base64UrlEncode(e){return pv(e)}encodeKid(e){return this.base64UrlEncode(JSON.stringify({kid:e}))}async getPublicKeyThumbprint(e){var d;const n=(d=this.performanceClient)==null?void 0:d.startMeasurement(K.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await bre($a.EXTRACTABLE,$a.POP_KEY_USAGES),i=await US(r.publicKey),o={e:i.e,kty:i.kty,n:i.n},s=VI(o),c=await this.hashString(s),l=await US(r.privateKey),u=await wre(l,!1,["sign"]);return await this.cache.setItem(c,{privateKey:u,publicKey:r.publicKey,requestMethod:e.resourceRequestMethod,requestUri:e.resourceRequestUri}),n&&n.end({success:!0}),c}async removeTokenBindingKey(e){if(await this.cache.removeItem(e),await this.cache.containsKey(e))throw we(rB)}async clearKeystore(){this.cache.clearInMemory();try{return await this.cache.clearPersistent(),!0}catch(e){return e instanceof Error?this.logger.error(`Clearing keystore failed with error: ${e.message}`):this.logger.error("Clearing keystore failed with unknown error"),!1}}async signJwt(e,n,r,i){var w;const o=(w=this.performanceClient)==null?void 0:w.startMeasurement(K.CryptoOptsSignJwt,i),s=await this.cache.getItem(n);if(!s)throw Ge(NT);const c=await US(s.publicKey),l=VI(c),u=pv(JSON.stringify({kid:n})),d=AT.getShrHeaderString({...r==null?void 0:r.header,alg:c.alg,kid:u}),f=pv(d);e.cnf={jwk:JSON.parse(l)};const h=pv(JSON.stringify(e)),p=`${f}.${h}`,m=new TextEncoder().encode(p),y=await Sre(s.privateKey,m),b=Xc(new Uint8Array(y)),x=`${p}.${b}`;return o&&o.end({success:!0}),x}async hashString(e){return RU(e)}}$a.POP_KEY_USAGES=["sign","verify"];$a.EXTRACTABLE=!0;function VI(t){return JSON.stringify(t,Object.keys(t).sort())}/*! @azure/msal-browser v4.19.0 2025-08-05 */const zre=24*60*60*1e3,dA={Lax:"Lax",None:"None"};class BU{initialize(){return Promise.resolve()}getItem(e){const n=`${encodeURIComponent(e)}`,r=document.cookie.split(";");for(let i=0;i{const i=decodeURIComponent(r).trim().split("=");n.push(i[0])}),n}containsKey(e){return this.getKeys().includes(e)}decryptData(){return Promise.resolve(null)}}function Gre(t){const e=new Date;return new Date(e.getTime()+t*zre).toUTCString()}/*! @azure/msal-browser v4.19.0 2025-08-05 */function dp(t,e){const n=t.getItem(ws(e));return n?JSON.parse(n):[]}function fp(t,e,n){const r=e.getItem(Il(t,n));if(r){const i=JSON.parse(r);if(i&&i.hasOwnProperty("idToken")&&i.hasOwnProperty("accessToken")&&i.hasOwnProperty("refreshToken"))return i}return{idToken:[],accessToken:[],refreshToken:[]}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function fA(t){return t.hasOwnProperty("id")&&t.hasOwnProperty("nonce")&&t.hasOwnProperty("data")}/*! @azure/msal-browser v4.19.0 2025-08-05 */const KI="msal.cache.encryption",Vre="msal.broadcast.cache";class Kre{constructor(e,n,r){if(!window.localStorage)throw lr(tm);this.memoryStorage=new $0,this.initialized=!1,this.clientId=e,this.logger=n,this.performanceClient=r,this.broadcast=new BroadcastChannel(Vre)}async initialize(e){const n=new BU,r=n.getItem(KI);let i={key:"",id:""};if(r)try{i=JSON.parse(r)}catch{}if(i.key&&i.id){const o=Zi(Dc,K.Base64Decode,this.logger,this.performanceClient,e)(i.key);this.encryptionCookie={id:i.id,key:await fe($I,K.GenerateHKDF,this.logger,this.performanceClient,e)(o)}}else{const o=us(),s=await fe(OU,K.GenerateBaseKey,this.logger,this.performanceClient,e)(),c=Zi(Xc,K.UrlEncodeArr,this.logger,this.performanceClient,e)(new Uint8Array(s));this.encryptionCookie={id:o,key:await fe($I,K.GenerateHKDF,this.logger,this.performanceClient,e)(s)};const l={id:o,key:c};n.setItem(KI,JSON.stringify(l),0,!0,dA.None)}await fe(this.importExistingCache.bind(this),K.ImportExistingCache,this.logger,this.performanceClient,e)(e),this.broadcast.addEventListener("message",this.updateCache.bind(this)),this.initialized=!0}getItem(e){return window.localStorage.getItem(e)}getUserData(e){if(!this.initialized)throw Ge(up);return this.memoryStorage.getItem(e)}async decryptData(e,n,r){if(!this.initialized||!this.encryptionCookie)throw Ge(up);if(n.id!==this.encryptionCookie.id)return this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},r),null;const i=await fe(LI,K.Decrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n.nonce,this.getContext(e),n.data);if(!i)return null;try{return JSON.parse(i)}catch{return this.performanceClient.incrementFields({encryptedCacheCorruptionCount:1},r),null}}setItem(e,n){window.localStorage.setItem(e,n)}async setUserData(e,n,r,i){if(!this.initialized||!this.encryptionCookie)throw Ge(up);const{data:o,nonce:s}=await fe(Are,K.Encrypt,this.logger,this.performanceClient,r)(this.encryptionCookie.key,n,this.getContext(e)),c={id:this.encryptionCookie.id,nonce:s,data:o,lastUpdatedAt:i};this.memoryStorage.setItem(e,n),this.setItem(e,JSON.stringify(c)),this.broadcast.postMessage({key:e,value:n,context:this.getContext(e)})}removeItem(e){this.memoryStorage.containsKey(e)&&(this.memoryStorage.removeItem(e),this.broadcast.postMessage({key:e,value:null,context:this.getContext(e)})),window.localStorage.removeItem(e)}getKeys(){return Object.keys(window.localStorage)}containsKey(e){return window.localStorage.hasOwnProperty(e)}clear(){this.memoryStorage.clear(),dp(this).forEach(r=>this.removeItem(r));const n=fp(this.clientId,this);n.idToken.forEach(r=>this.removeItem(r)),n.accessToken.forEach(r=>this.removeItem(r)),n.refreshToken.forEach(r=>this.removeItem(r)),this.getKeys().forEach(r=>{(r.startsWith(Pr)||r.indexOf(this.clientId)!==-1)&&this.removeItem(r)})}async importExistingCache(e){if(!this.encryptionCookie)return;let n=dp(this);n=await this.importArray(n,e),n.length?this.setItem(ws(),JSON.stringify(n)):this.removeItem(ws());const r=fp(this.clientId,this);r.idToken=await this.importArray(r.idToken,e),r.accessToken=await this.importArray(r.accessToken,e),r.refreshToken=await this.importArray(r.refreshToken,e),r.idToken.length||r.accessToken.length||r.refreshToken.length?this.setItem(Il(this.clientId),JSON.stringify(r)):this.removeItem(Il(this.clientId))}async getItemFromEncryptedCache(e,n){if(!this.encryptionCookie)return null;const r=this.getItem(e);if(!r)return null;let i;try{i=JSON.parse(r)}catch{return null}return fA(i)?i.id!==this.encryptionCookie.id?(this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},n),null):fe(LI,K.Decrypt,this.logger,this.performanceClient,n)(this.encryptionCookie.key,i.nonce,this.getContext(e),i.data):(this.performanceClient.incrementFields({unencryptedCacheCount:1},n),i)}async importArray(e,n){const r=[],i=[];return e.forEach(o=>{const s=this.getItemFromEncryptedCache(o,n).then(c=>{c?(this.memoryStorage.setItem(o,c),r.push(o)):this.removeItem(o)});i.push(s)}),await Promise.all(i),r}getContext(e){let n="";return e.includes(this.clientId)&&(n=this.clientId),n}updateCache(e){this.logger.trace("Updating internal cache from broadcast event");const n=this.performanceClient.startMeasurement(K.LocalStorageUpdated);n.add({isBackground:!0});const{key:r,value:i,context:o}=e.data;if(!r){this.logger.error("Broadcast event missing key"),n.end({success:!1,errorCode:"noKey"});return}if(o&&o!==this.clientId){this.logger.trace(`Ignoring broadcast event from clientId: ${o}`),n.end({success:!1,errorCode:"contextMismatch"});return}i?(this.memoryStorage.setItem(r,i),this.logger.verbose("Updated item in internal cache")):(this.memoryStorage.removeItem(r),this.logger.verbose("Removed item from internal cache")),n.end({success:!0})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Wre{constructor(){if(!window.sessionStorage)throw lr(tm)}async initialize(){}getItem(e){return window.sessionStorage.getItem(e)}getUserData(e){return this.getItem(e)}setItem(e,n){window.sessionStorage.setItem(e,n)}async setUserData(e,n){this.setItem(e,n)}removeItem(e){window.sessionStorage.removeItem(e)}getKeys(){return Object.keys(window.sessionStorage)}containsKey(e){return window.sessionStorage.hasOwnProperty(e)}decryptData(){return Promise.resolve(null)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Qe={INITIALIZE_START:"msal:initializeStart",INITIALIZE_END:"msal:initializeEnd",ACCOUNT_ADDED:"msal:accountAdded",ACCOUNT_REMOVED:"msal:accountRemoved",ACTIVE_ACCOUNT_CHANGED:"msal:activeAccountChanged",LOGIN_START:"msal:loginStart",LOGIN_SUCCESS:"msal:loginSuccess",LOGIN_FAILURE:"msal:loginFailure",ACQUIRE_TOKEN_START:"msal:acquireTokenStart",ACQUIRE_TOKEN_SUCCESS:"msal:acquireTokenSuccess",ACQUIRE_TOKEN_FAILURE:"msal:acquireTokenFailure",ACQUIRE_TOKEN_NETWORK_START:"msal:acquireTokenFromNetworkStart",SSO_SILENT_START:"msal:ssoSilentStart",SSO_SILENT_SUCCESS:"msal:ssoSilentSuccess",SSO_SILENT_FAILURE:"msal:ssoSilentFailure",ACQUIRE_TOKEN_BY_CODE_START:"msal:acquireTokenByCodeStart",ACQUIRE_TOKEN_BY_CODE_SUCCESS:"msal:acquireTokenByCodeSuccess",ACQUIRE_TOKEN_BY_CODE_FAILURE:"msal:acquireTokenByCodeFailure",HANDLE_REDIRECT_START:"msal:handleRedirectStart",HANDLE_REDIRECT_END:"msal:handleRedirectEnd",POPUP_OPENED:"msal:popupOpened",LOGOUT_START:"msal:logoutStart",LOGOUT_SUCCESS:"msal:logoutSuccess",LOGOUT_FAILURE:"msal:logoutFailure",LOGOUT_END:"msal:logoutEnd",RESTORE_FROM_BFCACHE:"msal:restoreFromBFCache",BROKER_CONNECTION_ESTABLISHED:"msal:brokerConnectionEstablished"};/*! @azure/msal-browser v4.19.0 2025-08-05 */function WI(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class hA extends iA{constructor(e,n,r,i,o,s,c){super(e,r,i,o,c),this.cacheConfig=n,this.logger=i,this.internalStorage=new $0,this.browserStorage=qI(e,n.cacheLocation,i,o),this.temporaryCacheStorage=qI(e,n.temporaryCacheLocation,i,o),this.cookieStorage=new BU,this.eventHandler=s}async initialize(e){this.performanceClient.addFields({cacheLocation:this.cacheConfig.cacheLocation,cacheRetentionDays:this.cacheConfig.cacheRetentionDays},e),await this.browserStorage.initialize(e),await this.migrateExistingCache(e),this.trackVersionChanges(e)}async migrateExistingCache(e){const n=dp(this.browserStorage,0),r=fp(this.clientId,this.browserStorage,0);this.performanceClient.addFields({oldAccountCount:n.length,oldAccessCount:r.accessToken.length,oldIdCount:r.idToken.length,oldRefreshCount:r.refreshToken.length},e);const i=dp(this.browserStorage,1),o=fp(this.clientId,this.browserStorage,1);this.performanceClient.addFields({currAccountCount:i.length,currAccessCount:o.accessToken.length,currIdCount:o.idToken.length,currRefreshCount:o.refreshToken.length},e),await Promise.all([this.updateV0ToCurrent(uA,n,i,e),this.updateV0ToCurrent(ec,r.idToken,o.idToken,e),this.updateV0ToCurrent(ec,r.accessToken,o.accessToken,e),this.updateV0ToCurrent(ec,r.refreshToken,o.refreshToken,e)]),n.length>0?this.browserStorage.setItem(ws(0),JSON.stringify(n)):this.browserStorage.removeItem(ws(0)),i.length>0?this.browserStorage.setItem(ws(1),JSON.stringify(i)):this.browserStorage.removeItem(ws(1)),this.setTokenKeys(r,e,0),this.setTokenKeys(o,e,1)}async updateV0ToCurrent(e,n,r,i){const o=[];for(const s of[...n]){const c=this.browserStorage.getItem(s),l=this.validateAndParseJson(c||"");if(!l){WI(n,s);continue}l.lastUpdatedAt||(l.lastUpdatedAt=Date.now().toString(),this.setItem(s,JSON.stringify(l),i));const u=fA(l)?await this.browserStorage.decryptData(s,l,i):l;let d;if(u&&(jI(u)||EI(u))&&(d=u.expiresOn),!u||Tne(l.lastUpdatedAt,this.cacheConfig.cacheRetentionDays)||d&&sx(d,U5)){this.browserStorage.removeItem(s),WI(n,s),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},i);continue}if(this.cacheConfig.cacheLocation!==jr.LocalStorage||fA(l)){const f=`${Pr}.${e}${HS}${s}`,h=this.browserStorage.getItem(f);if(h){const p=this.validateAndParseJson(h);if(Number(l.lastUpdatedAt)>Number(p.lastUpdatedAt)){o.push(this.setUserData(f,JSON.stringify(u),i,l.lastUpdatedAt).then(()=>{this.performanceClient.incrementFields({updatedCacheFromV0Count:1},i)}));continue}}else{o.push(this.setUserData(f,JSON.stringify(u),i,l.lastUpdatedAt).then(()=>{r.push(f),this.performanceClient.incrementFields({upgradedCacheCount:1},i)}));continue}}}return Promise.all(o)}trackVersionChanges(e){const n=this.browserStorage.getItem(HI);n&&(this.logger.info(`MSAL.js was last initialized by version: ${n}`),this.performanceClient.addFields({previousLibraryVersion:n},e)),n!==pu&&this.setItem(HI,pu,e)}validateAndParseJson(e){if(!e)return null;try{const n=JSON.parse(e);return n&&typeof n=="object"?n:null}catch{return null}}setItem(e,n,r){let i=0,o=[];const s=20;for(let c=0;c<=s;c++)try{this.browserStorage.setItem(e,n),c>0&&(c<=i?this.removeAccessTokenKeys(o.slice(0,c),r,0):(this.removeAccessTokenKeys(o.slice(0,i),r,0),this.removeAccessTokenKeys(o.slice(i,c),r)));break}catch(l){const u=rA(l);if(u.errorCode===tx&&c0&&(l<=o?this.removeAccessTokenKeys(s.slice(0,l),r,0):(this.removeAccessTokenKeys(s.slice(0,o),r,0),this.removeAccessTokenKeys(s.slice(o,l),r)));break}catch(u){const d=rA(u);if(d.errorCode===tx&&l-1){if(r.splice(i,1),r.length===0){this.removeItem(ws());return}else this.setItem(ws(),JSON.stringify(r),n);this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed")}else this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map")}removeAccount(e,n){const r=this.getActiveAccount(n);(r==null?void 0:r.homeAccountId)===e.homeAccountId&&(r==null?void 0:r.environment)===e.environment&&this.setActiveAccount(null,n),super.removeAccount(e,n),this.removeAccountKeyFromMap(this.generateAccountKey(e),n),this.browserStorage.getKeys().forEach(i=>{i.includes(e.homeAccountId)&&i.includes(e.environment)&&this.browserStorage.removeItem(i)}),this.cacheConfig.cacheLocation===jr.LocalStorage&&this.eventHandler.emitEvent(Qe.ACCOUNT_REMOVED,void 0,e)}removeIdToken(e,n){super.removeIdToken(e,n);const r=this.getTokenKeys(),i=r.idToken.indexOf(e);i>-1&&(this.logger.info("idToken removed from tokenKeys map"),r.idToken.splice(i,1),this.setTokenKeys(r,n))}removeAccessToken(e,n,r=!0){super.removeAccessToken(e,n),r&&this.removeAccessTokenKeys([e],n)}removeAccessTokenKeys(e,n,r=ec){this.logger.trace("removeAccessTokenKey called");const i=this.getTokenKeys(r);let o=0;if(e.forEach(s=>{const c=i.accessToken.indexOf(s);c>-1&&(i.accessToken.splice(c,1),o++)}),o>0){this.logger.info(`removed ${o} accessToken keys from tokenKeys map`),this.setTokenKeys(i,n,r);return}}removeRefreshToken(e,n){super.removeRefreshToken(e,n);const r=this.getTokenKeys(),i=r.refreshToken.indexOf(e);i>-1&&(this.logger.info("refreshToken removed from tokenKeys map"),r.refreshToken.splice(i,1),this.setTokenKeys(r,n))}getTokenKeys(e=ec){return fp(this.clientId,this.browserStorage,e)}setTokenKeys(e,n,r=ec){if(e.idToken.length===0&&e.accessToken.length===0&&e.refreshToken.length===0){this.removeItem(Il(this.clientId,r));return}else this.setItem(Il(this.clientId,r),JSON.stringify(e),n)}getIdTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),this.removeIdToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!Pne(i)?(this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getIdTokenCredential: cache hit"),i)}async setIdTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setIdTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.idToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map"),o.idToken.push(r),this.setTokenKeys(o,n))}getAccessTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),this.removeAccessTokenKeys([e],n),null;const i=this.validateAndParseJson(r);return!i||!jI(i)?(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAccessTokenCredential: cache hit"),i)}async setAccessTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setAccessTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys(),s=o.accessToken.indexOf(r);s!==-1&&o.accessToken.splice(s,1),this.logger.trace(`access token ${s===-1?"added to":"updated in"} map`),o.accessToken.push(r),this.setTokenKeys(o,n)}getRefreshTokenCredential(e,n){const r=this.browserStorage.getUserData(e);if(!r)return this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),this.removeRefreshToken(e,n),null;const i=this.validateAndParseJson(r);return!i||!EI(i)?(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: cache hit"),i)}async setRefreshTokenCredential(e,n){this.logger.trace("BrowserCacheManager.setRefreshTokenCredential called");const r=this.generateCredentialKey(e),i=Date.now().toString();e.lastUpdatedAt=i,await this.setUserData(r,JSON.stringify(e),n,i);const o=this.getTokenKeys();o.refreshToken.indexOf(r)===-1&&(this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map"),o.refreshToken.push(r),this.setTokenKeys(o,n))}getAppMetadata(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!Rne(e,r)?(this.logger.trace("BrowserCacheManager.getAppMetadata: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getAppMetadata: cache hit"),r)}setAppMetadata(e,n){this.logger.trace("BrowserCacheManager.setAppMetadata called");const r=Ine(e);this.setItem(r,JSON.stringify(e),n)}getServerTelemetry(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!kne(e,r)?(this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit"),r)}setServerTelemetry(e,n,r){this.logger.trace("BrowserCacheManager.setServerTelemetry called"),this.setItem(e,JSON.stringify(n),r)}getAuthorityMetadata(e){const n=this.internalStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getAuthorityMetadata: called, no cache hit"),null;const r=this.validateAndParseJson(n);return r&&Mne(e,r)?(this.logger.trace("BrowserCacheManager.getAuthorityMetadata: cache hit"),r):null}getAuthorityMetadataKeys(){return this.internalStorage.getKeys().filter(n=>this.isAuthorityMetadata(n))}setWrapperMetadata(e,n){this.internalStorage.setItem(hv.WRAPPER_SKU,e),this.internalStorage.setItem(hv.WRAPPER_VER,n)}getWrapperMetadata(){const e=this.internalStorage.getItem(hv.WRAPPER_SKU)||pe.EMPTY_STRING,n=this.internalStorage.getItem(hv.WRAPPER_VER)||pe.EMPTY_STRING;return[e,n]}setAuthorityMetadata(e,n){this.logger.trace("BrowserCacheManager.setAuthorityMetadata called"),this.internalStorage.setItem(e,JSON.stringify(n))}getActiveAccount(e){const n=this.generateCacheKey(mI.ACTIVE_ACCOUNT_FILTERS),r=this.browserStorage.getItem(n);if(!r)return this.logger.trace("BrowserCacheManager.getActiveAccount: No active account filters found"),null;const i=this.validateAndParseJson(r);return i?(this.logger.trace("BrowserCacheManager.getActiveAccount: Active account filters schema found"),this.getAccountInfoFilteredBy({homeAccountId:i.homeAccountId,localAccountId:i.localAccountId,tenantId:i.tenantId},e)):(this.logger.trace("BrowserCacheManager.getActiveAccount: No active account found"),null)}setActiveAccount(e,n){const r=this.generateCacheKey(mI.ACTIVE_ACCOUNT_FILTERS);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:$i().toString()};this.setItem(r,JSON.stringify(i),n)}else this.logger.verbose("setActiveAccount: No account passed, active account not set"),this.browserStorage.removeItem(r);this.eventHandler.emitEvent(Qe.ACTIVE_ACCOUNT_CHANGED)}getThrottlingCache(e){const n=this.browserStorage.getItem(e);if(!n)return this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null;const r=this.validateAndParseJson(n);return!r||!One(e,r)?(this.logger.trace("BrowserCacheManager.getThrottlingCache: called, no cache hit"),null):(this.logger.trace("BrowserCacheManager.getThrottlingCache: cache hit"),r)}setThrottlingCache(e,n,r){this.logger.trace("BrowserCacheManager.setThrottlingCache called"),this.setItem(e,JSON.stringify(n),r)}getTemporaryCache(e,n){const r=n?this.generateCacheKey(e):e;if(this.cacheConfig.storeAuthStateInCookie){const o=this.cookieStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: storeAuthStateInCookies set to true, retrieving from cookies"),o}const i=this.temporaryCacheStorage.getItem(r);if(!i){if(this.cacheConfig.cacheLocation===jr.LocalStorage){const o=this.browserStorage.getItem(r);if(o)return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage"),o}return this.logger.trace("BrowserCacheManager.getTemporaryCache: No cache item found in local storage"),null}return this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item returned"),i}setTemporaryCache(e,n,r){const i=r?this.generateCacheKey(e):e;this.temporaryCacheStorage.setItem(i,n),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.setTemporaryCache: storeAuthStateInCookie set to true, setting item cookie"),this.cookieStorage.setItem(i,n,void 0,this.cacheConfig.secureCookies))}removeItem(e){this.browserStorage.removeItem(e)}removeTemporaryItem(e){this.temporaryCacheStorage.removeItem(e),this.cacheConfig.storeAuthStateInCookie&&(this.logger.trace("BrowserCacheManager.removeItem: storeAuthStateInCookie is true, clearing item cookie"),this.cookieStorage.removeItem(e))}getKeys(){return this.browserStorage.getKeys()}clear(e){this.removeAllAccounts(e),this.removeAppMetadata(e),this.temporaryCacheStorage.getKeys().forEach(n=>{(n.indexOf(Pr)!==-1||n.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(n)}),this.browserStorage.getKeys().forEach(n=>{(n.indexOf(Pr)!==-1||n.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(n)}),this.internalStorage.clear()}clearTokensAndKeysWithClaims(e){this.performanceClient.addQueueMeasurement(K.ClearTokensAndKeysWithClaims,e);const n=this.getTokenKeys();let r=0;n.accessToken.forEach(i=>{const o=this.getAccessTokenCredential(i,e);o!=null&&o.requestedClaimsHash&&i.includes(o.requestedClaimsHash.toLowerCase())&&(this.removeAccessToken(i,e),r++)}),r>0&&this.logger.warning(`${r} access tokens with claims in the cache keys have been removed from the cache.`)}generateCacheKey(e){return $s.startsWith(e,Pr)?e:`${Pr}.${this.clientId}.${e}`}generateCredentialKey(e){const n=e.credentialType===Hr.REFRESH_TOKEN&&e.familyId||e.clientId,r=e.tokenType&&e.tokenType.toLowerCase()!==yn.BEARER.toLowerCase()?e.tokenType.toLowerCase():"";return[`${Pr}.${ec}`,e.homeAccountId,e.environment,e.credentialType,n,e.realm||"",e.target||"",e.requestedClaimsHash||"",r].join(HS).toLowerCase()}generateAccountKey(e){const n=e.homeAccountId.split(".")[1];return[`${Pr}.${uA}`,e.homeAccountId,e.environment,n||e.tenantId||""].join(HS).toLowerCase()}resetRequestCache(){this.logger.trace("BrowserCacheManager.resetRequestCache called"),this.removeTemporaryItem(this.generateCacheKey(dr.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(dr.VERIFIER)),this.removeTemporaryItem(this.generateCacheKey(dr.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(dr.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(dr.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cacheAuthorizeRequest(e,n){this.logger.trace("BrowserCacheManager.cacheAuthorizeRequest called");const r=em(JSON.stringify(e));if(this.setTemporaryCache(dr.REQUEST_PARAMS,r,!0),n){const i=em(n);this.setTemporaryCache(dr.VERIFIER,i,!0)}}getCachedRequest(){this.logger.trace("BrowserCacheManager.getCachedRequest called");const e=this.getTemporaryCache(dr.REQUEST_PARAMS,!0);if(!e)throw Ge(dU);const n=this.getTemporaryCache(dr.VERIFIER,!0);let r,i="";try{r=JSON.parse(Zo(e)),n&&(i=Zo(n))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${e}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),Ge(fU)}return[r,i]}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(dr.NATIVE_REQUEST,!0);if(!e)return this.logger.trace("BrowserCacheManager.getCachedNativeRequest: No cached native request found"),null;const n=this.validateAndParseJson(e);return n||(this.logger.error("BrowserCacheManager.getCachedNativeRequest: Unable to parse native request"),null)}isInteractionInProgress(e){var r;const n=(r=this.getInteractionInProgress())==null?void 0:r.clientId;return e?n===this.clientId:!!n}getInteractionInProgress(){const e=`${Pr}.${dr.INTERACTION_STATUS_KEY}`,n=this.getTemporaryCache(e,!1);try{return n?JSON.parse(n):null}catch{return this.logger.error("Cannot parse interaction status. Removing temporary cache items and clearing url hash. Retrying interaction should fix the error"),this.removeTemporaryItem(e),this.resetRequestCache(),MU(window),null}}setInteractionInProgress(e,n=lc.SIGNIN){var i;const r=`${Pr}.${dr.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw Ge(rU);this.setTemporaryCache(r,JSON.stringify({clientId:this.clientId,type:n}),!1)}else!e&&((i=this.getInteractionInProgress())==null?void 0:i.clientId)===this.clientId&&this.removeTemporaryItem(r)}async hydrateCache(e,n){var c,l,u;const r=N0((c=e.account)==null?void 0:c.homeAccountId,(l=e.account)==null?void 0:l.environment,e.idToken,this.clientId,e.tenantId);let i;n.claims&&(i=await this.cryptoImpl.hashString(n.claims));const o=P0((u=e.account)==null?void 0:u.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?AI(e.expiresOn):0,e.extExpiresOn?AI(e.extExpiresOn):0,Zo,void 0,e.tokenType,void 0,n.sshKid,n.claims,i),s={idToken:r,accessToken:o};return this.saveCacheRecord(s,e.correlationId)}async saveCacheRecord(e,n,r){try{await super.saveCacheRecord(e,n,r)}catch(i){if(i instanceof Sd&&this.performanceClient&&n)try{const o=this.getTokenKeys();this.performanceClient.addFields({cacheRtCount:o.refreshToken.length,cacheIdCount:o.idToken.length,cacheAtCount:o.accessToken.length},n)}catch{}throw i}}}function qI(t,e,n,r){try{switch(e){case jr.LocalStorage:return new Kre(t,n,r);case jr.SessionStorage:return new Wre;case jr.MemoryStorage:default:break}}catch(i){n.error(i)}return new $0}const qre=(t,e,n,r)=>{const i={cacheLocation:jr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new hA(t,i,Jy,e,n,r)};/*! @azure/msal-browser v4.19.0 2025-08-05 */function Yre(t,e,n,r,i){return t.verbose("getAllAccounts called"),n?e.getAllAccounts(i||{},r):[]}function Qre(t,e,n,r){if(e.trace("getAccount called"),Object.keys(t).length===0)return e.warning("getAccount: No accountFilter provided"),null;const i=n.getAccountInfoFilteredBy(t,r);return i?(e.verbose("getAccount: Account matching provided filter found, returning"),i):(e.verbose("getAccount: No matching account found, returning null"),null)}function Xre(t,e,n,r){if(e.trace("getAccountByUsername called"),!t)return e.warning("getAccountByUsername: No username provided"),null;const i=n.getAccountInfoFilteredBy({username:t},r);return i?(e.verbose("getAccountByUsername: Account matching username found, returning"),e.verbosePii(`getAccountByUsername: Returning signed-in accounts matching username: ${t}`),i):(e.verbose("getAccountByUsername: No matching account found, returning null"),null)}function Jre(t,e,n,r){if(e.trace("getAccountByHomeId called"),!t)return e.warning("getAccountByHomeId: No homeAccountId provided"),null;const i=n.getAccountInfoFilteredBy({homeAccountId:t},r);return i?(e.verbose("getAccountByHomeId: Account matching homeAccountId found, returning"),e.verbosePii(`getAccountByHomeId: Returning signed-in accounts matching homeAccountId: ${t}`),i):(e.verbose("getAccountByHomeId: No matching account found, returning null"),null)}function Zre(t,e,n,r){if(e.trace("getAccountByLocalId called"),!t)return e.warning("getAccountByLocalId: No localAccountId provided"),null;const i=n.getAccountInfoFilteredBy({localAccountId:t},r);return i?(e.verbose("getAccountByLocalId: Account matching localAccountId found, returning"),e.verbosePii(`getAccountByLocalId: Returning signed-in accounts matching localAccountId: ${t}`),i):(e.verbose("getAccountByLocalId: No matching account found, returning null"),null)}function eie(t,e,n){e.setActiveAccount(t,n)}function tie(t,e){return t.getActiveAccount(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const nie="msal.broadcast.event";class rie{constructor(e){this.eventCallbacks=new Map,this.logger=e||new Da({}),typeof BroadcastChannel<"u"&&(this.broadcastChannel=new BroadcastChannel(nie)),this.invokeCrossTabCallbacks=this.invokeCrossTabCallbacks.bind(this)}addEventCallback(e,n,r){if(typeof window<"u"){const i=r||Ore();return this.eventCallbacks.has(i)?(this.logger.error(`Event callback with id: ${i} is already registered. Please provide a unique id or remove the existing callback and try again.`),null):(this.eventCallbacks.set(i,[e,n||[]]),this.logger.verbose(`Event callback registered with id: ${i}`),i)}return null}removeEventCallback(e){this.eventCallbacks.delete(e),this.logger.verbose(`Event callback ${e} removed.`)}emitEvent(e,n,r,i){var s;const o={eventType:e,interactionType:n||null,payload:r||null,error:i||null,timestamp:Date.now()};switch(e){case Qe.ACCOUNT_ADDED:case Qe.ACCOUNT_REMOVED:case Qe.ACTIVE_ACCOUNT_CHANGED:(s=this.broadcastChannel)==null||s.postMessage(o);break;default:this.invokeCallbacks(o);break}}invokeCallbacks(e){this.eventCallbacks.forEach(([n,r],i)=>{(r.length===0||r.includes(e.eventType))&&(this.logger.verbose(`Emitting event to callback ${i}: ${e.eventType}`),n.apply(null,[e]))})}invokeCrossTabCallbacks(e){const n=e.data;this.invokeCallbacks(n)}subscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.addEventListener("message",this.invokeCrossTabCallbacks)}unsubscribeCrossTab(){var e;(e=this.broadcastChannel)==null||e.removeEventListener("message",this.invokeCrossTabCallbacks)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class UU{constructor(e,n,r,i,o,s,c,l,u){this.config=e,this.browserStorage=n,this.browserCrypto=r,this.networkClient=this.config.system.networkClient,this.eventHandler=o,this.navigationClient=s,this.platformAuthProvider=l,this.correlationId=u||us(),this.logger=i.clone(Ti.MSAL_SKU,pu,this.correlationId),this.performanceClient=c}async clearCacheOnLogout(e,n){if(n)try{this.browserStorage.removeAccount(n,e),this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.")}catch{this.logger.error("Account provided in logout request was not found. Local cache unchanged.")}else try{this.logger.verbose("No account provided in logout request, clearing all cache items.",this.correlationId),this.browserStorage.clear(e),await this.browserCrypto.clearKeystore()}catch{this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.")}}getRedirectUri(e){this.logger.verbose("getRedirectUri called");const n=e||this.config.auth.redirectUri;return tn.getAbsoluteUrl(n,xa())}initializeServerTelemetryManager(e,n){this.logger.verbose("initializeServerTelemetryManager called");const r={clientId:this.config.auth.clientId,correlationId:this.correlationId,apiId:e,forceRefresh:n||!1,wrapperSKU:this.browserStorage.getWrapperMetadata()[0],wrapperVer:this.browserStorage.getWrapperMetadata()[1]};return new Jp(r,this.browserStorage)}async getDiscoveredAuthority(e){const{account:n}=e,r=e.requestExtraQueryParameters&&e.requestExtraQueryParameters.hasOwnProperty("instance_aware")?e.requestExtraQueryParameters.instance_aware:void 0;this.performanceClient.addQueueMeasurement(K.StandardInteractionClientGetDiscoveredAuthority,this.correlationId);const i={protocolMode:this.config.auth.protocolMode,OIDCOptions:this.config.auth.OIDCOptions,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},o=e.requestAuthority||this.config.auth.authority,s=r!=null&&r.length?r==="true":this.config.auth.instanceAware,c=n&&s?this.config.auth.authority.replace(tn.getDomainFromUrl(o),n.environment):o,l=Zr.generateAuthority(c,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),u=await fe(HB,K.AuthorityFactoryCreateDiscoveredInstance,this.logger,this.performanceClient,this.correlationId)(l,this.config.system.networkClient,this.browserStorage,i,this.logger,this.correlationId,this.performanceClient);if(n&&!u.isAlias(n.environment))throw jn(vB);return u}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function HT(t,e,n,r){n.addQueueMeasurement(K.InitializeBaseRequest,t.correlationId);const i=t.authority||e.auth.authority,o=[...t&&t.scopes||[]],s={...t,correlationId:t.correlationId,authority:i,scopes:o};if(!s.authenticationScheme)s.authenticationScheme=yn.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(s.authenticationScheme===yn.SSH){if(!t.sshJwk)throw jn(A0);if(!t.sshKid)throw jn(pB)}r.verbose(`Authentication Scheme set to "${s.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&t.claims&&!$s.isEmptyObj(t.claims)&&(s.requestedClaimsHash=await RU(t.claims)),s}async function iie(t,e,n,r,i){r.addQueueMeasurement(K.InitializeSilentRequest,t.correlationId);const o=await fe(HT,K.InitializeBaseRequest,i,r,t.correlationId)(t,n,r,i);return{...t,...o,account:e,forceRefresh:t.forceRefresh||!1}}function HU(t,e){let n;const r=t.httpMethod;if(e===Di.EAR){if(n=r||Ol.POST,n!==Ol.POST)throw jn(yB)}else n=r||Ol.GET;if(t.authorizePostBodyParameters&&n!==Ol.POST)throw jn(xB);return n}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Vf extends UU{initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const n={correlationId:this.correlationId||us(),...e};if(e)if(e.logoutHint)this.logger.verbose("logoutHint has already been set in logoutRequest");else if(e.account){const r=this.getLogoutHintFromIdTokenClaims(e.account);r&&(this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided"),n.logoutHint=r)}else this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");else this.logger.verbose("logoutHint will not be set since no logout request was configured");return!e||e.postLogoutRedirectUri!==null?e&&e.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request",n.correlationId),n.postLogoutRedirectUri=tn.getAbsoluteUrl(e.postLogoutRedirectUri,xa())):this.config.auth.postLogoutRedirectUri===null?this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect",n.correlationId):this.config.auth.postLogoutRedirectUri?(this.logger.verbose("Setting postLogoutRedirectUri to configured uri",n.correlationId),n.postLogoutRedirectUri=tn.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,xa())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=tn.getAbsoluteUrl(xa(),xa())):this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri",n.correlationId),n}getLogoutHintFromIdTokenClaims(e){const n=e.idTokenClaims;if(n){if(n.login_hint)return n.login_hint;this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request")}else this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");return null}async createAuthCodeClient(e){this.performanceClient.addQueueMeasurement(K.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const n=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new WB(n,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:n,requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}=e;this.performanceClient.addQueueMeasurement(K.StandardInteractionClientGetClientConfiguration,this.correlationId);const c=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,this.correlationId)({requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}),l=this.config.system.loggerOptions;return{authOptions:{clientId:this.config.auth.clientId,authority:c,clientCapabilities:this.config.auth.clientCapabilities,redirectUri:this.config.auth.redirectUri},systemOptions:{tokenRenewalOffsetSeconds:this.config.system.tokenRenewalOffsetSeconds,preventCorsPreflight:!0},loggerOptions:{loggerCallback:l.loggerCallback,piiLoggingEnabled:l.piiLoggingEnabled,logLevel:l.logLevel,correlationId:this.correlationId},cacheOptions:{claimsBasedCachingEnabled:this.config.cache.claimsBasedCachingEnabled},cryptoInterface:this.browserCrypto,networkInterface:this.networkClient,storageInterface:this.browserStorage,serverTelemetryManager:n,libraryInfo:{sku:Ti.MSAL_SKU,version:pu,cpu:pe.EMPTY_STRING,os:pe.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,n){this.performanceClient.addQueueMeasurement(K.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),i={interactionType:n},o=zf.setRequestState(this.browserCrypto,e&&e.state||pe.EMPTY_STRING,i),c={...await fe(HT,K.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:o,nonce:e.nonce||us(),responseMode:this.config.auth.OIDCOptions.serverResponseType},l={...c,httpMethod:HU(c,this.config.auth.protocolMode)};if(e.loginHint||e.sid)return l;const u=e.account||this.browserStorage.getActiveAccount(this.correlationId);return u&&(this.logger.verbose("Setting validated request account",this.correlationId),this.logger.verbosePii(`Setting validated request account: ${u.homeAccountId}`,this.correlationId),l.account=u),l}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function oie(t,e){if(!e)return null;try{return zf.parseRequestState(t,e).libraryState.meta}catch{throw we(Xd)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function hp(t,e,n){const r=Zy(t);if(!r)throw wB(t)?(n.error(`A ${e} is present in the iframe but it does not contain known properties. It's likely that the ${e} has been replaced by code running on the redirectUri page.`),n.errorPii(`The ${e} detected is: ${t}`),Ge(eU)):(n.error(`The request has returned to the redirectUri but a ${e} is not present. It's likely that the ${e} has been removed or the page has been redirected by code running on the redirectUri page.`),Ge(ZB));return r}function sie(t,e,n){if(!t.state)throw Ge(TT);const r=oie(e,t.state);if(!r)throw Ge(tU);if(r.interactionType!==n)throw Ge(nU)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class zU{constructor(e,n,r,i,o){this.authModule=e,this.browserStorage=n,this.authCodeRequest=r,this.logger=i,this.performanceClient=o}async handleCodeResponse(e,n){this.performanceClient.addQueueMeasurement(K.HandleCodeResponse,n.correlationId);let r;try{r=Qne(e,n.state)}catch(i){throw i instanceof Tu&&i.subError===Zp?Ge(Zp):i}return fe(this.handleCodeResponseFromServer.bind(this),K.HandleCodeResponseFromServer,this.logger,this.performanceClient,n.correlationId)(r,n)}async handleCodeResponseFromServer(e,n,r=!0){if(this.performanceClient.addQueueMeasurement(K.HandleCodeResponseFromServer,n.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await fe(this.authModule.updateAuthority.bind(this.authModule),K.UpdateTokenEndpointAuthority,this.logger,this.performanceClient,n.correlationId)(e.cloud_instance_host_name,n.correlationId),r&&(e.nonce=n.nonce||void 0),e.state=n.state,e.client_info)this.authCodeRequest.clientInfo=e.client_info;else{const o=this.createCcsCredentials(n);o&&(this.authCodeRequest.ccsCredential=o)}return await fe(this.authModule.acquireToken.bind(this.authModule),K.AuthClientAcquireToken,this.logger,this.performanceClient,n.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:Wo.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:Wo.UPN}:null}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const aie="ContentError",GU="user_switch";/*! @azure/msal-browser v4.19.0 2025-08-05 */const cie="USER_INTERACTION_REQUIRED",lie="USER_CANCEL",uie="NO_NETWORK",die="PERSISTENT_ERROR",fie="DISABLED",hie="ACCOUNT_UNAVAILABLE",pie="UX_NOT_ALLOWED";/*! @azure/msal-browser v4.19.0 2025-08-05 */const mie=-2147186943,gie={[GU]:"User attempted to switch accounts in the native broker, which is not allowed. All new accounts must sign-in through the standard web flow first, please try again."};class Ns extends _n{constructor(e,n,r){super(e,n),Object.setPrototypeOf(this,Ns.prototype),this.name="NativeAuthError",this.ext=r}}function qu(t){if(t.ext&&t.ext.status&&(t.ext.status===die||t.ext.status===fie)||t.ext&&t.ext.error&&t.ext.error===mie)return!0;switch(t.errorCode){case aie:return!0;default:return!1}}function hx(t,e,n){if(n&&n.status)switch(n.status){case hie:return cx(GB);case cie:return new ls(t,e);case lie:return Ge(Zp);case uie:return Ge(lx);case pie:return cx(wT)}return new Ns(t,gie[t]||e,n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class VU extends Vf{async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentCacheClientAcquireToken,e.correlationId);const n=this.initializeServerTelemetryManager(Cn.acquireTokenSilent_silentFlow),r=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new Wne(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const s=(await fe(i.acquireCachedToken.bind(i),K.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),s}catch(o){throw o instanceof yg&&o.errorCode===NT&&this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."),o}}logout(e){this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e);return this.clearCacheOnLogout(n.correlationId,n==null?void 0:n.account)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class ry extends UU{constructor(e,n,r,i,o,s,c,l,u,d,f,h){super(e,n,r,i,o,s,l,u,h),this.apiId=c,this.accountId=d,this.platformAuthProvider=u,this.nativeStorageManager=f,this.silentCacheClient=new VU(e,this.nativeStorageManager,r,i,o,s,l,u,h);const p=this.platformAuthProvider.getExtensionName();this.skus=Jp.makeExtraSkuString({libraryName:Ti.MSAL_SKU,libraryVersion:pu,extensionName:p,extensionVersion:this.platformAuthProvider.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[cne]:this.skus}}async acquireToken(e,n){this.performanceClient.addQueueMeasurement(K.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(K.NativeInteractionClientAcquireToken,e.correlationId),i=$i(),o=this.initializeServerTelemetryManager(this.apiId);try{const s=await this.initializeNativeRequest(e);try{const l=await this.acquireTokensFromCache(this.accountId,s);return r.end({success:!0,isNativeBroker:!1,fromCache:!0}),l}catch(l){if(n===ci.AccessToken)throw this.logger.info("MSAL internal Cache does not contain tokens, return error as per cache policy"),l;this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call")}const c=await this.platformAuthProvider.sendMessage(s);return await this.handleNativeResponse(c,s,i).then(l=>(r.end({success:!0,isNativeBroker:!0,requestId:l.requestId}),o.clearNativeBrokerErrorCode(),l)).catch(l=>{throw r.end({success:!1,errorCode:l.errorCode,subErrorCode:l.subError,isNativeBroker:!0}),l})}catch(s){throw s instanceof Ns&&o.setNativeBrokerErrorCode(s.errorCode),s}}createSilentCacheRequest(e,n){return{authority:e.authority,correlationId:this.correlationId,scopes:Ar.fromString(e.scope).asArray(),account:n,forceRefresh:!1}}async acquireTokensFromCache(e,n){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),we(tA);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},this.correlationId);if(!r)throw we(tA);try{const i=this.createSilentCacheRequest(n,r),o=await this.silentCacheClient.acquireToken(i),s={...r,idTokenClaims:o==null?void 0:o.idTokenClaims,idToken:o==null?void 0:o.idToken};return{...o,account:s}}catch(i){throw i}}async acquireTokenRedirect(e,n){this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");const{...r}=e;delete r.onRedirectNavigate;const i=await this.initializeNativeRequest(r);try{await this.platformAuthProvider.sendMessage(i)}catch(c){if(c instanceof Ns&&(this.initializeServerTelemetryManager(this.apiId).setNativeBrokerErrorCode(c.errorCode),qu(c)))throw c}this.browserStorage.setTemporaryCache(dr.NATIVE_REQUEST,JSON.stringify(i),!0);const o={apiId:Cn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=this.config.auth.navigateToLoginRequestUrl?window.location.href:this.getRedirectUri(e.redirectUri);n.end({success:!0}),await this.navigationClient.navigateExternal(s,o)}async handleRedirectPromise(e,n){if(this.logger.trace("NativeInteractionClient - handleRedirectPromise called."),!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;const r=this.browserStorage.getCachedNativeRequest();if(!r)return this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null."),e&&n&&(e==null||e.addFields({errorCode:"no_cached_request"},n)),null;const{prompt:i,...o}=r;i&&this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window."),this.browserStorage.removeItem(this.browserStorage.generateCacheKey(dr.NATIVE_REQUEST));const s=$i();try{this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");const c=await this.platformAuthProvider.sendMessage(o),l=await this.handleNativeResponse(c,o,s);return this.initializeServerTelemetryManager(this.apiId).clearNativeBrokerErrorCode(),l}catch(c){throw c}}logout(){return this.logger.trace("NativeInteractionClient - logout called."),Promise.reject("Logout not implemented yet")}async handleNativeResponse(e,n,r){var d,f;this.logger.trace("NativeInteractionClient - handleNativeResponse called.");const i=Hf(e.id_token,Zo),o=this.createHomeAccountIdentifier(e,i),s=(d=this.browserStorage.getAccountInfoFilteredBy({nativeAccountId:n.accountId},this.correlationId))==null?void 0:d.homeAccountId;if((f=n.extraParameters)!=null&&f.child_client_id&&e.account.id!==n.accountId)this.logger.info("handleNativeServerResponse: Double broker flow detected, ignoring accountId mismatch");else if(o!==s&&e.account.id!==n.accountId)throw hx(GU);const c=await this.getDiscoveredAuthority({requestAuthority:n.authority}),l=ST(this.browserStorage,c,o,Zo,this.correlationId,i,e.client_info,void 0,i.tid,void 0,e.account.id,this.logger);e.expires_in=Number(e.expires_in);const u=await this.generateAuthenticationResult(e,n,i,l,c.canonicalAuthority,r);return await this.cacheAccount(l,this.correlationId),await this.cacheNativeTokens(e,n,o,i,e.access_token,u.tenantId,r),u}createHomeAccountIdentifier(e,n){return cs.generateHomeAccountId(e.client_info||pe.EMPTY_STRING,Uo.Default,this.logger,this.browserCrypto,n)}generateScopes(e,n){return n?Ar.fromString(n):Ar.fromString(e)}async generatePopAccessToken(e,n){if(n.tokenType===yn.POP&&n.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new Jd(this.browserCrypto),i={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce};if(!n.keyId)throw we(QE);return r.signPopToken(e.access_token,n.keyId,i)}else return e.access_token}async generateAuthenticationResult(e,n,r,i,o,s){const c=this.addTelemetryFromNativeResponse(e.properties.MATS),l=this.generateScopes(n.scope,e.scope),u=e.account.properties||{},d=u.UID||r.oid||r.sub||pe.EMPTY_STRING,f=u.TenantId||r.tid||pe.EMPTY_STRING,h=oT(i.getAccountInfo(),void 0,r,e.id_token);h.nativeAccountId!==e.account.id&&(h.nativeAccountId=e.account.id);const p=await this.generatePopAccessToken(e,n),g=n.tokenType===yn.POP?yn.POP:yn.BEARER;return{authority:o,uniqueId:d,tenantId:f,scopes:l.asArray(),account:h,idToken:e.id_token,idTokenClaims:r,accessToken:p,fromCache:c?this.isResponseFromCache(c):!1,expiresOn:_d(s+e.expires_in),tokenType:g,correlationId:this.correlationId,state:e.state,fromNativeBroker:!0}}async cacheAccount(e,n){await this.browserStorage.setAccount(e,this.correlationId),this.browserStorage.removeAccountContext(e.getAccountInfo(),n)}cacheNativeTokens(e,n,r,i,o,s,c){const l=N0(r,n.authority,e.id_token||"",n.clientId,i.tid||""),u=n.tokenType===yn.POP?pe.SHR_NONCE_VALIDITY:(typeof e.expires_in=="string"?parseInt(e.expires_in,10):e.expires_in)||0,d=c+u,f=this.generateScopes(e.scope,n.scope),h=P0(r,n.authority,o,n.clientId,i.tid||s,f.printScopes(),d,0,Zo,void 0,n.tokenType,void 0,n.keyId),p={idToken:l,accessToken:h};return this.nativeStorageManager.saveCacheRecord(p,this.correlationId,n.storeInCache)}getExpiresInValue(e,n){return e===yn.POP?pe.SHR_NONCE_VALIDITY:(typeof n=="string"?parseInt(n,10):n)||0}addTelemetryFromNativeResponse(e){const n=this.getMATSFromResponse(e);return n?(this.performanceClient.addFields({extensionId:this.platformAuthProvider.getExtensionId(),extensionVersion:this.platformAuthProvider.getExtensionVersion(),matsBrokerVersion:n.broker_version,matsAccountJoinOnStart:n.account_join_on_start,matsAccountJoinOnEnd:n.account_join_on_end,matsDeviceJoin:n.device_join,matsPromptBehavior:n.prompt_behavior,matsApiErrorCode:n.api_error_code,matsUiVisible:n.ui_visible,matsSilentCode:n.silent_code,matsSilentBiSubCode:n.silent_bi_sub_code,matsSilentMessage:n.silent_message,matsSilentStatus:n.silent_status,matsHttpStatus:n.http_status,matsHttpEventCount:n.http_event_count},this.correlationId),n):null}getMATSFromResponse(e){if(e)try{return JSON.parse(e)}catch{this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead")}return null}isResponseFromCache(e){return typeof e.is_cached>"u"?(this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false."),!1):!!e.is_cached}async initializeNativeRequest(e){this.logger.trace("NativeInteractionClient - initializeNativeRequest called");const n=await this.getCanonicalAuthority(e),{scopes:r,...i}=e,o=new Ar(r||[]);o.appendScopes(vg);const s={...i,accountId:this.accountId,clientId:this.config.auth.clientId,authority:n.urlString,scope:o.printScopes(),redirectUri:this.getRedirectUri(e.redirectUri),prompt:this.getPrompt(e.prompt),correlationId:this.correlationId,tokenType:e.authenticationScheme,windowTitleSubstring:document.title,extraParameters:{...e.extraQueryParameters,...e.tokenQueryParameters},extendedExpiryToken:!1,keyId:e.popKid};if(s.signPopToken&&e.popKid)throw Ge(_U);if(this.handleExtraBrokerParams(s),s.extraParameters=s.extraParameters||{},s.extraParameters.telemetry=yo.MATS_TELEMETRY,e.authenticationScheme===yn.POP){const c={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},l=new Jd(this.browserCrypto);let u;if(s.keyId)u=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:s.keyId})),s.signPopToken=!1;else{const d=await fe(l.generateCnf.bind(l),K.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(c,this.logger);u=d.reqCnfString,s.keyId=d.kid,s.signPopToken=!0}s.reqCnf=u}return this.addRequestSKUs(s),s}async getCanonicalAuthority(e){const n=e.authority||this.config.auth.authority;e.account&&await this.getDiscoveredAuthority({requestAuthority:n,requestAzureCloudOptions:e.azureCloudOptions,account:e.account});const r=new tn(n);return r.validateAsUri(),r}getPrompt(e){switch(this.apiId){case Cn.ssoSilent:case Cn.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),pi.NONE}if(!e){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e){case pi.NONE:case pi.CONSENT:case pi.LOGIN:return this.logger.trace("initializeNativeRequest: prompt is compatible with native flow"),e;default:throw this.logger.trace(`initializeNativeRequest: prompt = ${e} is not compatible with native flow`),Ge(SU)}}handleExtraBrokerParams(e){var o;const n=e.extraParameters&&e.extraParameters.hasOwnProperty(rx)&&e.extraParameters.hasOwnProperty(ix)&&e.extraParameters.hasOwnProperty(fu);if(!e.embeddedClientId&&!n)return;let r="";const i=e.redirectUri;e.embeddedClientId?(e.redirectUri=this.config.auth.redirectUri,r=e.embeddedClientId):e.extraParameters&&(e.redirectUri=e.extraParameters[ix],r=e.extraParameters[fu]),e.extraParameters={child_client_id:r,child_redirect_uri:i},(o=this.performanceClient)==null||o.addFields({embeddedClientId:r,embeddedRedirectUri:i},e.correlationId)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function zT(t,e,n,r,i){const o=Yne({...t.auth,authority:e},n,r,i);if(pT(o,{sku:Ti.MSAL_SKU,version:pu,os:"",cpu:""}),t.auth.protocolMode!==Di.OIDC&&mT(o,t.telemetry.application),n.platformBroker&&(fne(o),n.authenticationScheme===yn.POP)){const s=new $a(r,i),c=new Jd(s);let l;n.popKid?l=s.encodeKid(n.popKid):l=(await fe(c.generateCnf.bind(c),K.PopTokenGenerateCnf,r,i,n.correlationId)(n,r)).reqCnfString,vT(o,l)}return j0(o,n.correlationId,i),o}async function GT(t,e,n,r,i){if(!n.codeChallenge)throw jn(tT);const o=await fe(zT,K.GetStandardParams,r,i,n.correlationId)(t,e,n,r,i);return cT(o,zE.CODE),kB(o,n.codeChallenge,pe.S256_CODE_CHALLENGE_METHOD),Mc(o,n.extraQueryParameters||{}),CT(e,o,t.auth.encodeExtraQueryParams,n.extraQueryParameters)}async function VT(t,e,n,r,i,o){if(!r.earJwk)throw Ge(ET);const s=await zT(e,n,r,i,o);cT(s,zE.IDTOKEN_TOKEN_REFRESHTOKEN),Cne(s,r.earJwk);const c=new Map;Mc(c,r.extraQueryParameters||{});const l=CT(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return KU(t,l,s)}async function KT(t,e,n,r,i,o){const s=await zT(e,n,r,i,o);cT(s,zE.CODE),kB(s,r.codeChallenge,r.codeChallengeMethod||pe.S256_CODE_CHALLENGE_METHOD),_ne(s,r.authorizePostBodyParameters||{});const c=new Map;Mc(c,r.extraQueryParameters||{});const l=CT(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return KU(t,l,s)}function KU(t,e,n){const r=t.createElement("form");return r.method="post",r.action=e,n.forEach((i,o)=>{const s=t.createElement("input");s.hidden=!0,s.name=o,s.value=i,r.appendChild(s)}),t.body.appendChild(r),r}async function WU(t,e,n,r,i,o,s,c,l,u){if(c.verbose("Account id found, calling WAM for token"),!u)throw Ge(kT);const d=new $a(c,l),f=new ry(r,i,d,c,s,r.system.navigationClient,n,l,u,e,o,t.correlationId),{userRequestState:h}=zf.parseRequestState(d,t.state);return fe(f.acquireToken.bind(f),K.NativeInteractionClientAcquireToken,c,l,t.correlationId)({...t,state:h,prompt:void 0})}async function px(t,e,n,r,i,o,s,c,l,u,d,f){if(Ts.removeThrottle(s,i.auth.clientId,t),e.accountId)return fe(WU,K.HandleResponsePlatformBroker,u,d,t.correlationId)(t,e.accountId,r,i,s,c,l,u,d,f);const h={...t,code:e.code||"",codeVerifier:n},p=new zU(o,s,h,u,d);return await fe(p.handleCodeResponse.bind(p),K.HandleCodeResponse,u,d,t.correlationId)(e,t)}async function WT(t,e,n,r,i,o,s,c,l,u,d){if(Ts.removeThrottle(o,r.auth.clientId,t),qB(e,t.state),!e.ear_jwe)throw Ge(JB);if(!t.earJwk)throw Ge(ET);const f=JSON.parse(await fe(_re,K.DecryptEarResponse,l,u,t.correlationId)(t.earJwk,e.ear_jwe));if(f.accountId)return fe(WU,K.HandleResponsePlatformBroker,l,u,t.correlationId)(t,f.accountId,n,r,o,s,c,l,u,d);const h=new hu(r.auth.clientId,o,new $a(l,u),l,null,null,u);h.validateTokenResponse(f);const p={code:"",state:t.state,nonce:t.nonce,client_info:f.client_info,cloud_graph_host_name:f.cloud_graph_host_name,cloud_instance_host_name:f.cloud_instance_host_name,cloud_instance_name:f.cloud_instance_name,msgraph_host:f.msgraph_host};return await fe(h.handleServerTokenResponse.bind(h),K.HandleServerTokenResponse,l,u,t.correlationId)(f,i,$i(),t,p,void 0,void 0,void 0,void 0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const vie=32;async function L0(t,e,n){t.addQueueMeasurement(K.GeneratePkceCodes,n);const r=Zi(yie,K.GenerateCodeVerifier,e,t,n)(t,e,n),i=await fe(xie,K.GenerateCodeChallengeFromVerifier,e,t,n)(r,t,e,n);return{verifier:r,challenge:i}}function yie(t,e,n){try{const r=new Uint8Array(vie);return Zi(xre,K.GetRandomValues,e,t,n)(r),Xc(r)}catch{throw Ge(jT)}}async function xie(t,e,n,r){e.addQueueMeasurement(K.GenerateCodeChallengeFromVerifier,r);try{const i=await fe(kU,K.Sha256Digest,n,e,r)(t,e,r);return Xc(new Uint8Array(i))}catch{throw Ge(jT)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class mx{constructor(e,n,r,i){this.logger=e,this.handshakeTimeoutMs=n,this.extensionId=i,this.resolvers=new Map,this.handshakeResolvers=new Map,this.messageChannel=new MessageChannel,this.windowListener=this.onWindowMessage.bind(this),this.performanceClient=r,this.handshakeEvent=r.startMeasurement(K.NativeMessageHandlerHandshake),this.platformAuthType=yo.PLATFORM_EXTENSION_PROVIDER}async sendMessage(e){this.logger.trace(this.platformAuthType+" - sendMessage called.");const n={method:Ah.GetToken,request:e},r={channel:yo.CHANNEL_ID,extensionId:this.extensionId,responseId:us(),body:n};this.logger.trace(this.platformAuthType+" - Sending request to browser extension"),this.logger.tracePii(this.platformAuthType+` - Sending request to browser extension: ${JSON.stringify(r)}`),this.messageChannel.port1.postMessage(r);const i=await new Promise((s,c)=>{this.resolvers.set(r.responseId,{resolve:s,reject:c})});return this.validatePlatformBrokerResponse(i)}static async createProvider(e,n,r){e.trace("PlatformAuthExtensionHandler - createProvider called.");try{const i=new mx(e,n,r,yo.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const o=new mx(e,n,r);return await o.sendHandshakeRequest(),o}}async sendHandshakeRequest(){this.logger.trace(this.platformAuthType+" - sendHandshakeRequest called."),window.addEventListener("message",this.windowListener,!1);const e={channel:yo.CHANNEL_ID,extensionId:this.extensionId,responseId:us(),body:{method:Ah.HandshakeRequest}};return this.handshakeEvent.add({extensionId:this.extensionId,extensionHandshakeTimeoutMs:this.handshakeTimeoutMs}),this.messageChannel.port1.onmessage=n=>{this.onChannelMessage(n)},window.postMessage(e,window.origin,[this.messageChannel.port2]),new Promise((n,r)=>{this.handshakeResolvers.set(e.responseId,{resolve:n,reject:r}),this.timeoutId=window.setTimeout(()=>{window.removeEventListener("message",this.windowListener,!1),this.messageChannel.port1.close(),this.messageChannel.port2.close(),this.handshakeEvent.end({extensionHandshakeTimedOut:!0,success:!1}),r(Ge(bU)),this.handshakeResolvers.delete(e.responseId)},this.handshakeTimeoutMs)})}onWindowMessage(e){if(this.logger.trace(this.platformAuthType+" - onWindowMessage called"),e.source!==window)return;const n=e.data;if(!(!n.channel||n.channel!==yo.CHANNEL_ID)&&!(n.extensionId&&n.extensionId!==this.extensionId)&&n.body.method===Ah.HandshakeRequest){const r=this.handshakeResolvers.get(n.responseId);if(!r){this.logger.trace(this.platformAuthType+`.onWindowMessage - resolver can't be found for request ${n.responseId}`);return}this.logger.verbose(n.extensionId?`Extension with id: ${n.extensionId} not installed`:"No extension installed"),clearTimeout(this.timeoutId),this.messageChannel.port1.close(),this.messageChannel.port2.close(),window.removeEventListener("message",this.windowListener,!1),this.handshakeEvent.end({success:!1,extensionInstalled:!1}),r.reject(Ge(wU))}}onChannelMessage(e){this.logger.trace(this.platformAuthType+" - onChannelMessage called.");const n=e.data,r=this.resolvers.get(n.responseId),i=this.handshakeResolvers.get(n.responseId);try{const o=n.body.method;if(o===Ah.Response){if(!r)return;const s=n.body.response;if(this.logger.trace(this.platformAuthType+" - Received response from browser extension"),this.logger.tracePii(this.platformAuthType+` - Received response from browser extension: ${JSON.stringify(s)}`),s.status!=="Success")r.reject(hx(s.code,s.description,s.ext));else if(s.result)s.result.code&&s.result.description?r.reject(hx(s.result.code,s.result.description,s.result.ext)):r.resolve(s.result);else throw J_(Xy,"Event does not contain result.");this.resolvers.delete(n.responseId)}else if(o===Ah.HandshakeResponse){if(!i){this.logger.trace(this.platformAuthType+`.onChannelMessage - resolver can't be found for request ${n.responseId}`);return}clearTimeout(this.timeoutId),window.removeEventListener("message",this.windowListener,!1),this.extensionId=n.extensionId,this.extensionVersion=n.body.version,this.logger.verbose(this.platformAuthType+` - Received HandshakeResponse from extension: ${this.extensionId}`),this.handshakeEvent.end({extensionInstalled:!0,success:!0}),i.resolve(),this.handshakeResolvers.delete(n.responseId)}}catch(o){this.logger.error("Error parsing response from WAM Extension"),this.logger.errorPii(`Error parsing response from WAM Extension: ${o}`),this.logger.errorPii(`Unable to parse ${e}`),r?r.reject(o):i&&i.reject(o)}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("access_token")&&e.hasOwnProperty("id_token")&&e.hasOwnProperty("client_info")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scope")&&e.hasOwnProperty("expires_in"))return e;throw J_(Xy,"Response missing expected properties.")}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}getExtensionName(){var e;return this.getExtensionId()===yo.PREFERRED_EXTENSION_ID?"chrome":(e=this.getExtensionId())!=null&&e.length?"unknown":void 0}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class qT{constructor(e,n,r){this.logger=e,this.performanceClient=n,this.correlationId=r,this.platformAuthType=yo.PLATFORM_DOM_PROVIDER}static async createProvider(e,n,r){var i;if(e.trace("PlatformAuthDOMHandler: createProvider called"),(i=window.navigator)!=null&&i.platformAuthentication){const o=await window.navigator.platformAuthentication.getSupportedContracts(yo.MICROSOFT_ENTRA_BROKERID);if(o!=null&&o.includes(yo.PLATFORM_DOM_APIS))return e.trace("Platform auth api available in DOM"),new qT(e,n,r)}}getExtensionId(){return yo.MICROSOFT_ENTRA_BROKERID}getExtensionVersion(){return""}getExtensionName(){return yo.DOM_API_NAME}async sendMessage(e){this.logger.trace(this.platformAuthType+" - Sending request to browser DOM API");try{const n=this.initializePlatformDOMRequest(e),r=await window.navigator.platformAuthentication.executeGetToken(n);return this.validatePlatformBrokerResponse(r)}catch(n){throw this.logger.error(this.platformAuthType+" - executeGetToken DOM API error"),n}}initializePlatformDOMRequest(e){this.logger.trace(this.platformAuthType+" - initializeNativeDOMRequest called");const{accountId:n,clientId:r,authority:i,scope:o,redirectUri:s,correlationId:c,state:l,storeInCache:u,embeddedClientId:d,extraParameters:f,...h}=e,p=this.getDOMExtraParams(h);return{accountId:n,brokerId:this.getExtensionId(),authority:i,clientId:r,correlationId:c||this.correlationId,extraParameters:{...f,...p},isSecurityTokenService:!1,redirectUri:s,scope:o,state:l,storeInCache:u,embeddedClientId:d}}validatePlatformBrokerResponse(e){if(e.hasOwnProperty("isSuccess")){if(e.hasOwnProperty("accessToken")&&e.hasOwnProperty("idToken")&&e.hasOwnProperty("clientInfo")&&e.hasOwnProperty("account")&&e.hasOwnProperty("scopes")&&e.hasOwnProperty("expiresIn"))return this.logger.trace(this.platformAuthType+" - platform broker returned successful and valid response"),this.convertToPlatformBrokerResponse(e);if(e.hasOwnProperty("error")){const n=e;if(n.isSuccess===!1&&n.error&&n.error.code)throw this.logger.trace(this.platformAuthType+" - platform broker returned error response"),hx(n.error.code,n.error.description,{error:parseInt(n.error.errorCode),protocol_error:n.error.protocolError,status:n.error.status,properties:n.error.properties})}}throw J_(Xy,"Response missing expected properties.")}convertToPlatformBrokerResponse(e){return this.logger.trace(this.platformAuthType+" - convertToNativeResponse called"),{access_token:e.accessToken,id_token:e.idToken,client_info:e.clientInfo,account:e.account,expires_in:e.expiresIn,scope:e.scopes,state:e.state||"",properties:e.properties||{},extendedLifetimeToken:e.extendedLifetimeToken??!1,shr:e.proofOfPossessionPayload}}getDOMExtraParams(e){return{...Object.entries(e).reduce((i,[o,s])=>(i[o]=String(s),i),{})}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function bie(t,e,n,r){t.trace("getPlatformAuthProvider called",n);const i=wie();t.trace("Has client allowed platform auth via DOM API: "+i);let o;try{i&&(o=await qT.createProvider(t,e,n)),o||(t.trace("Platform auth via DOM API not available, checking for extension"),o=await mx.createProvider(t,r||FU,e))}catch(s){t.trace("Platform auth not available",s)}return o}function wie(){let t;try{return t=window[jr.SessionStorage],(t==null?void 0:t.getItem(Bre))==="true"}catch{return!1}}function nm(t,e,n,r){if(e.trace("isPlatformAuthAllowed called"),!t.system.allowPlatformBroker)return e.trace("isPlatformAuthAllowed: allowPlatformBroker is not enabled, returning false"),!1;if(!n)return e.trace("isPlatformAuthAllowed: Platform auth provider is not initialized, returning false"),!1;if(r)switch(r){case yn.BEARER:case yn.POP:return e.trace("isPlatformAuthAllowed: authenticationScheme is supported, returning true"),!0;default:return e.trace("isPlatformAuthAllowed: authenticationScheme is not supported, returning false"),!1}return!0}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Sie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,c,u,d),this.unloadWindow=this.unloadWindow.bind(this),this.nativeStorage=l,this.eventHandler=o}acquireToken(e,n){let r;try{if(r={popupName:this.generatePopupName(e.scopes||vg,e.authority||this.config.auth.authority),popupWindowAttributes:e.popupWindowAttributes||{},popupWindowParent:e.popupWindowParent??window},this.performanceClient.addFields({isAsyncPopup:this.config.system.asyncPopups},this.correlationId),this.config.system.asyncPopups)return this.logger.verbose("asyncPopups set to true, acquiring token"),this.acquireTokenPopupAsync(e,r,n);{const o={...e,httpMethod:HU(e,this.config.auth.protocolMode)};return this.logger.verbose("asyncPopup set to false, opening popup before acquiring token"),r.popup=this.openSizedPopup("about:blank",r),this.acquireTokenPopupAsync(o,r,n)}}catch(i){return Promise.reject(i)}}logout(e){try{this.logger.verbose("logoutPopup called");const n=this.initializeLogoutRequest(e),r={popupName:this.generateLogoutPopupName(n),popupWindowAttributes:(e==null?void 0:e.popupWindowAttributes)||{},popupWindowParent:(e==null?void 0:e.popupWindowParent)??window},i=e&&e.authority,o=e&&e.mainWindowRedirectUri;return this.config.system.asyncPopups?(this.logger.verbose("asyncPopups set to true"),this.logoutPopupAsync(n,r,i,o)):(this.logger.verbose("asyncPopup set to false, opening popup"),r.popup=this.openSizedPopup("about:blank",r),this.logoutPopupAsync(n,r,i,o))}catch(n){return Promise.reject(n)}}async acquireTokenPopupAsync(e,n,r){this.logger.verbose("acquireTokenPopupAsync called");const i=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,xt.Popup);n.popup&&LU(i.authority);const o=nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);return i.platformBroker=o,this.config.auth.protocolMode===Di.EAR?this.executeEarFlow(i,n):this.executeCodeFlow(i,n,r)}async executeCodeFlow(e,n,r){var l;const i=e.correlationId,o=this.initializeServerTelemetryManager(Cn.acquireTokenPopup),s=r||await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),c={...e,codeChallenge:s.challenge};try{const u=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:o,requestAuthority:c.authority,requestAzureCloudOptions:c.azureCloudOptions,requestExtraQueryParameters:c.extraQueryParameters,account:c.account});if(c.httpMethod===Ol.POST)return await this.executeCodeFlowWithPost(c,n,u,s.verifier);{const d=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,i)(this.config,u.authority,c,this.logger,this.performanceClient),f=this.initiateAuthRequest(d,n);this.eventHandler.emitEvent(Qe.POPUP_OPENED,xt.Popup,{popupWindow:f},null);const h=await this.monitorPopupForHash(f,n.popupWindowParent),p=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(h,this.config.auth.OIDCOptions.serverResponseType,this.logger);return await fe(px,K.HandleResponseCode,this.logger,this.performanceClient,i)(e,p,s.verifier,Cn.acquireTokenPopup,this.config,u,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}catch(u){throw(l=n.popup)==null||l.close(),u instanceof _n&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),u}}async executeEarFlow(e,n){const r=e.correlationId,i=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,r)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),o=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,r)(),s={...e,earJwk:o},c=n.popup||this.openPopup("about:blank",n);(await VT(c.document,this.config,i,s,this.logger,this.performanceClient)).submit();const u=await fe(this.monitorPopupForHash.bind(this),K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(c,n.popupWindowParent),d=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,r)(s,d,Cn.acquireTokenPopup,this.config,i,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async executeCodeFlowWithPost(e,n,r,i){const o=e.correlationId,s=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,o)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),c=n.popup||this.openPopup("about:blank",n);(await KT(c.document,this.config,s,e,this.logger,this.performanceClient)).submit();const u=await fe(this.monitorPopupForHash.bind(this),K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,o)(c,n.popupWindowParent),d=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,o)(e,d,i,Cn.acquireTokenPopup,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async logoutPopupAsync(e,n,r,i){var s,c,l;this.logger.verbose("logoutPopupAsync called"),this.eventHandler.emitEvent(Qe.LOGOUT_START,xt.Popup,e);const o=this.initializeServerTelemetryManager(Cn.logoutPopup);try{await this.clearCacheOnLogout(this.correlationId,e.account);const u=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:o,requestAuthority:r,account:e.account||void 0});try{u.authority.endSessionEndpoint}catch{if((s=e.account)!=null&&s.homeAccountId&&e.postLogoutRedirectUri&&u.authority.protocolMode===Di.OIDC){if(this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Popup,e),i){const h={apiId:Cn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=tn.getAbsoluteUrl(i,xa());await this.navigationClient.navigateInternal(p,h)}(c=n.popup)==null||c.close();return}}const d=u.getLogoutUri(e);this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Popup,e);const f=this.openPopup(d,n);if(this.eventHandler.emitEvent(Qe.POPUP_OPENED,xt.Popup,{popupWindow:f},null),await this.monitorPopupForHash(f,n.popupWindowParent).catch(()=>{}),i){const h={apiId:Cn.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=tn.getAbsoluteUrl(i,xa());this.logger.verbose("Redirecting main window to url specified in the request"),this.logger.verbosePii(`Redirecting main window to: ${p}`),await this.navigationClient.navigateInternal(p,h)}else this.logger.verbose("No main window navigation requested")}catch(u){throw(l=n.popup)==null||l.close(),u instanceof _n&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),this.eventHandler.emitEvent(Qe.LOGOUT_FAILURE,xt.Popup,null,u),this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Popup),u}this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Popup)}initiateAuthRequest(e,n){if(e)return this.logger.infoPii(`Navigate to: ${e}`),this.openPopup(e,n);throw this.logger.error("Navigate url is empty"),Ge(R0)}monitorPopupForHash(e,n){return new Promise((r,i)=>{this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");const o=setInterval(()=>{if(e.closed){this.logger.error("PopupHandler.monitorPopupForHash - window closed"),clearInterval(o),i(Ge(Zp));return}let s="";try{s=e.location.href}catch{}if(!s||s==="about:blank")return;clearInterval(o);let c="";const l=this.config.auth.OIDCOptions.serverResponseType;e&&(l===_0.QUERY?c=e.location.search:c=e.location.hash),this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller"),r(c)},this.config.system.pollIntervalMilliseconds)}).finally(()=>{this.cleanPopup(e,n)})}openPopup(e,n){try{let r;if(n.popup?(r=n.popup,this.logger.verbosePii(`Navigating popup window to: ${e}`),r.location.assign(e)):typeof n.popup>"u"&&(this.logger.verbosePii(`Opening popup window to: ${e}`),r=this.openSizedPopup(e,n)),!r)throw Ge(oU);return r.focus&&r.focus(),this.currentWindow=r,n.popupWindowParent.addEventListener("beforeunload",this.unloadWindow),r}catch(r){throw this.logger.error("error opening popup "+r.message),Ge(iU)}}openSizedPopup(e,{popupName:n,popupWindowAttributes:r,popupWindowParent:i}){var p,g,m,y;const o=i.screenLeft?i.screenLeft:i.screenX,s=i.screenTop?i.screenTop:i.screenY,c=i.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,l=i.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;let u=(p=r.popupSize)==null?void 0:p.width,d=(g=r.popupSize)==null?void 0:g.height,f=(m=r.popupPosition)==null?void 0:m.top,h=(y=r.popupPosition)==null?void 0:y.left;return(!u||u<0||u>c)&&(this.logger.verbose("Default popup window width used. Window width not configured or invalid."),u=Ti.POPUP_WIDTH),(!d||d<0||d>l)&&(this.logger.verbose("Default popup window height used. Window height not configured or invalid."),d=Ti.POPUP_HEIGHT),(!f||f<0||f>l)&&(this.logger.verbose("Default popup window top position used. Window top not configured or invalid."),f=Math.max(0,l/2-Ti.POPUP_HEIGHT/2+s)),(!h||h<0||h>c)&&(this.logger.verbose("Default popup window left position used. Window left not configured or invalid."),h=Math.max(0,c/2-Ti.POPUP_WIDTH/2+o)),i.open(e,n,`width=${u}, height=${d}, top=${f}, left=${h}, scrollbars=yes`)}unloadWindow(e){this.currentWindow&&this.currentWindow.close(),e.preventDefault()}cleanPopup(e,n){e.close(),n.removeEventListener("beforeunload",this.unloadWindow)}generatePopupName(e,n){return`${Ti.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${e.join("-")}.${n}.${this.correlationId}`}generateLogoutPopupName(e){const n=e.account&&e.account.homeAccountId;return`${Ti.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${n}.${this.correlationId}`}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Cie(){if(typeof window>"u"||typeof window.performance>"u"||typeof window.performance.getEntriesByType!="function")return;const t=window.performance.getEntriesByType("navigation"),e=t.length?t[0]:void 0;return e==null?void 0:e.type}class _ie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,c,u,d),this.nativeStorage=l}async acquireToken(e){const n=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,xt.Redirect);n.platformBroker=nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);const r=o=>{o.persisted&&(this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache."),this.browserStorage.resetRequestCache(),this.eventHandler.emitEvent(Qe.RESTORE_FROM_BFCACHE,xt.Redirect))},i=this.getRedirectStartPage(e.redirectStartPage);this.logger.verbosePii(`Redirect start page: ${i}`),this.browserStorage.setTemporaryCache(dr.ORIGIN_URI,i,!0),window.addEventListener("pageshow",r);try{this.config.auth.protocolMode===Di.EAR?await this.executeEarFlow(n):await this.executeCodeFlow(n,e.onRedirectNavigate)}catch(o){throw o instanceof _n&&o.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o}}async executeCodeFlow(e,n){const r=e.correlationId,i=this.initializeServerTelemetryManager(Cn.acquireTokenRedirect),o=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),s={...e,codeChallenge:o.challenge};this.browserStorage.cacheAuthorizeRequest(s,o.verifier);try{if(s.httpMethod===Ol.POST)return await this.executeCodeFlowWithPost(s);{const c=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:s.authority,requestAzureCloudOptions:s.azureCloudOptions,requestExtraQueryParameters:s.extraQueryParameters,account:s.account}),l=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,e.correlationId)(this.config,c.authority,s,this.logger,this.performanceClient);return await this.initiateAuthRequest(l,n)}}catch(c){throw c instanceof _n&&(c.setCorrelationId(this.correlationId),i.cacheFailedRequest(c)),c}}async executeEarFlow(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i};return this.browserStorage.cacheAuthorizeRequest(o),(await VT(document,this.config,r,o,this.logger,this.performanceClient)).submit(),new Promise((c,l)=>{setTimeout(()=>{l(Ge(ux,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async executeCodeFlowWithPost(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return this.browserStorage.cacheAuthorizeRequest(e),(await KT(document,this.config,r,e,this.logger,this.performanceClient)).submit(),new Promise((o,s)=>{setTimeout(()=>{s(Ge(ux,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async handleRedirectPromise(e="",n,r,i){const o=this.initializeServerTelemetryManager(Cn.handleRedirectPromise);try{const[s,c]=this.getRedirectResponse(e||"");if(!s)return this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache."),this.browserStorage.resetRequestCache(),Cie()!=="back_forward"?i.event.errorCode="no_server_response":this.logger.verbose("Back navigation event detected. Muting no_server_response error"),null;const l=this.browserStorage.getTemporaryCache(dr.ORIGIN_URI,!0)||pe.EMPTY_STRING,u=tn.removeHashFromUrl(l),d=tn.removeHashFromUrl(window.location.href);if(u===d&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),l.indexOf("#")>-1&&jre(l),await this.handleResponse(s,n,r,o);if(this.config.auth.navigateToLoginRequestUrl){if(!LT()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(dr.URL_HASH,c,!0);const f={apiId:Cn.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let h=!0;if(!l||l==="null"){const p=Tre();this.browserStorage.setTemporaryCache(dr.ORIGIN_URI,p,!0),this.logger.warning("Unable to get valid login request url from cache, redirecting to home page"),h=await this.navigationClient.navigateInternal(p,f)}else this.logger.verbose(`Navigating to loginRequestUrl: ${l}`),h=await this.navigationClient.navigateInternal(l,f);if(!h)return await this.handleResponse(s,n,r,o)}}else return this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response"),await this.handleResponse(s,n,r,o);return null}catch(s){throw s instanceof _n&&(s.setCorrelationId(this.correlationId),o.cacheFailedRequest(s)),s}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let n=e;n||(this.config.auth.OIDCOptions.serverResponseType===_0.QUERY?n=window.location.search:n=window.location.hash);let r=Zy(n);if(r){try{sie(r,this.browserCrypto,xt.Redirect)}catch(o){return o instanceof _n&&this.logger.error(`Interaction type validation failed due to ${o.errorCode}: ${o.errorMessage}`),[null,""]}return MU(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,n]}const i=this.browserStorage.getTemporaryCache(dr.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(dr.URL_HASH)),i&&(r=Zy(i),r)?(this.logger.verbose("Hash does not contain known properties, returning cached hash"),[r,i]):[null,""]}async handleResponse(e,n,r,i){if(!e.state)throw Ge(TT);if(e.ear_jwe){const c=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n.correlationId)({requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account});return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,n.correlationId)(n,e,Cn.acquireTokenRedirect,this.config,c,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}const s=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority});return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,n.correlationId)(n,e,r,Cn.acquireTokenRedirect,this.config,s,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}async initiateAuthRequest(e,n){if(this.logger.verbose("RedirectHandler.initiateAuthRequest called"),e){this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${e}`);const r={apiId:Cn.acquireTokenRedirect,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},i=n||this.config.auth.onRedirectNavigate;if(typeof i=="function")if(this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback"),i(e)!==!1){this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating"),await this.navigationClient.navigateExternal(e,r);return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");return}else{this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url"),await this.navigationClient.navigateExternal(e,r);return}}else throw this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty"),Ge(R0)}async logout(e){var i;this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(Cn.logout);try{this.eventHandler.emitEvent(Qe.LOGOUT_START,xt.Redirect,e),await this.clearCacheOnLogout(this.correlationId,n.account);const o={apiId:Cn.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:r,requestAuthority:e&&e.authority,requestExtraQueryParameters:e==null?void 0:e.extraQueryParameters,account:e&&e.account||void 0});if(s.authority.protocolMode===Di.OIDC)try{s.authority.endSessionEndpoint}catch{if((i=n.account)!=null&&i.homeAccountId){this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Redirect,n);return}}const c=s.getLogoutUri(n);if(this.eventHandler.emitEvent(Qe.LOGOUT_SUCCESS,xt.Redirect,n),e&&typeof e.onRedirectNavigate=="function")if(e.onRedirectNavigate(c)!==!1){this.logger.verbose("Logout onRedirectNavigate did not return false, navigating"),this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),await this.navigationClient.navigateExternal(c,o);return}else this.browserStorage.setInteractionInProgress(!1),this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");else{this.browserStorage.getInteractionInProgress()||this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),await this.navigationClient.navigateExternal(c,o);return}}catch(o){throw o instanceof _n&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.eventHandler.emitEvent(Qe.LOGOUT_FAILURE,xt.Redirect,null,o),this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Redirect),o}this.eventHandler.emitEvent(Qe.LOGOUT_END,xt.Redirect)}getRedirectStartPage(e){const n=e||window.location.href;return tn.getAbsoluteUrl(n,xa())}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function Aie(t,e,n,r,i){if(e.addQueueMeasurement(K.SilentHandlerInitiateAuthRequest,r),!t)throw n.info("Navigate url is empty"),Ge(R0);return i?fe(Tie,K.SilentHandlerLoadFrame,n,e,r)(t,i,e,r):Zi(Nie,K.SilentHandlerLoadFrameSync,n,e,r)(t)}async function jie(t,e,n,r,i){const o=F0();if(!o.contentDocument)throw"No document associated with iframe!";return(await KT(o.contentDocument,t,e,n,r,i)).submit(),o}async function Eie(t,e,n,r,i){const o=F0();if(!o.contentDocument)throw"No document associated with iframe!";return(await VT(o.contentDocument,t,e,n,r,i)).submit(),o}async function YI(t,e,n,r,i,o,s){return r.addQueueMeasurement(K.SilentHandlerMonitorIframeForHash,o),new Promise((c,l)=>{e{window.clearInterval(d),l(Ge(sU))},e),d=window.setInterval(()=>{let f="";const h=t.contentWindow;try{f=h?h.location.href:""}catch{}if(!f||f==="about:blank")return;let p="";h&&(s===_0.QUERY?p=h.location.search:p=h.location.hash),window.clearTimeout(u),window.clearInterval(d),c(p)},n)}).finally(()=>{Zi(Pie,K.RemoveHiddenIframe,i,r,o)(t)})}function Tie(t,e,n,r){return n.addQueueMeasurement(K.SilentHandlerLoadFrame,r),new Promise((i,o)=>{const s=F0();window.setTimeout(()=>{if(!s){o("Unable to load iframe");return}s.src=t,i(s)},e)})}function Nie(t){const e=F0();return e.src=t,e}function F0(){const t=document.createElement("iframe");return t.className="msalSilentIframe",t.style.visibility="hidden",t.style.position="absolute",t.style.width=t.style.height="0",t.style.border="0",t.setAttribute("sandbox","allow-scripts allow-same-origin allow-forms"),document.body.appendChild(t),t}function Pie(t){document.body===t.parentNode&&document.body.removeChild(t)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class kie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d,f){super(e,n,r,i,o,s,l,d,f),this.apiId=c,this.nativeStorage=u}async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentIframeClientAcquireToken,e.correlationId),!e.loginHint&&!e.sid&&(!e.account||!e.account.username)&&this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");const n={...e};n.prompt?n.prompt!==pi.NONE&&n.prompt!==pi.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${n.prompt} with ${pi.NONE}`),n.prompt=pi.NONE):n.prompt=pi.NONE;const r=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(n,xt.Silent);return r.platformBroker=nm(this.config,this.logger,this.platformAuthProvider,r.authenticationScheme),LU(r.authority),this.config.auth.protocolMode===Di.EAR?this.executeEarFlow(r):this.executeCodeFlow(r)}async executeCodeFlow(e){let n;const r=this.initializeServerTelemetryManager(this.apiId);try{return n=await fe(this.createAuthCodeClient.bind(this),K.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),await fe(this.silentTokenHelper.bind(this),K.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(n,e)}catch(i){if(i instanceof _n&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),!n||!(i instanceof _n)||i.errorCode!==Ti.INVALID_GRANT_ERROR)throw i;return this.performanceClient.addFields({retryError:i.errorCode},this.correlationId),await fe(this.silentTokenHelper.bind(this),K.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(n,e)}}async executeEarFlow(e){const n=e.correlationId,r=await fe(this.getDiscoveredAuthority.bind(this),K.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await fe(DT,K.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i},s=await fe(Eie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(this.config,r,o,this.logger,this.performanceClient),c=this.config.auth.OIDCOptions.serverResponseType,l=await fe(YI,K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,c),u=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,n)(l,c,this.logger);return fe(WT,K.HandleResponseEar,this.logger,this.performanceClient,n)(o,u,this.apiId,this.config,r,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}logout(){return Promise.reject(Ge(M0))}async silentTokenHelper(e,n){const r=n.correlationId;this.performanceClient.addQueueMeasurement(K.SilentIframeClientTokenHelper,r);const i=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),o={...n,codeChallenge:i.challenge};let s;if(n.httpMethod===Ol.POST)s=await fe(jie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);else{const d=await fe(GT,K.GetAuthCodeUrl,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);s=await fe(Aie,K.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(d,this.performanceClient,this.logger,r,this.config.system.navigateFrameWait)}const c=this.config.auth.OIDCOptions.serverResponseType,l=await fe(YI,K.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,c),u=Zi(hp,K.DeserializeResponse,this.logger,this.performanceClient,r)(l,c,this.logger);return fe(px,K.HandleResponseCode,this.logger,this.performanceClient,r)(n,u,i.verifier,this.apiId,this.config,e,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Oie extends Vf{async acquireToken(e){this.performanceClient.addQueueMeasurement(K.SilentRefreshClientAcquireToken,e.correlationId);const n=await fe(HT,K.InitializeBaseRequest,this.logger,this.performanceClient,e.correlationId)(e,this.config,this.performanceClient,this.logger),r={...e,...n};e.redirectUri&&(r.redirectUri=this.getRedirectUri(e.redirectUri));const i=this.initializeServerTelemetryManager(Cn.acquireTokenSilent_silentFlow),o=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return fe(o.acquireTokenByRefreshToken.bind(o),K.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(s=>{throw s.setCorrelationId(this.correlationId),i.cacheFailedRequest(s),s})}logout(){return Promise.reject(Ge(M0))}async createRefreshTokenClient(e){const n=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Kne(n,this.performanceClient)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Iie{constructor(e,n,r,i){this.isBrowserEnvironment=typeof window<"u",this.config=e,this.storage=n,this.logger=r,this.cryptoObj=i}async loadExternalTokens(e,n,r){if(!this.isBrowserEnvironment)throw Ge(D0);const i=e.correlationId||us(),o=n.id_token?Hf(n.id_token,Zo):void 0,s={protocolMode:this.config.auth.protocolMode,knownAuthorities:this.config.auth.knownAuthorities,cloudDiscoveryMetadata:this.config.auth.cloudDiscoveryMetadata,authorityMetadata:this.config.auth.authorityMetadata,skipAuthorityMetadataCache:this.config.auth.skipAuthorityMetadataCache},c=e.authority?new Zr(Zr.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,s,this.logger,e.correlationId||us()):void 0,l=await this.loadAccount(e,r.clientInfo||n.client_info||"",i,o,c),u=await this.loadIdToken(n,l.homeAccountId,l.environment,l.realm,i),d=await this.loadAccessToken(e,n,l.homeAccountId,l.environment,l.realm,r,i),f=await this.loadRefreshToken(n,l.homeAccountId,l.environment,i);return this.generateAuthenticationResult(e,{account:l,idToken:u,accessToken:d,refreshToken:f},o,c)}async loadAccount(e,n,r,i,o){if(this.logger.verbose("TokenCache - loading account"),e.account){const u=cs.createFromAccountInfo(e.account);return await this.storage.setAccount(u,r),u}else if(!o||!n&&!i)throw this.logger.error("TokenCache - if an account is not provided on the request, authority and either clientInfo or idToken must be provided instead."),Ge(mU);const s=cs.generateHomeAccountId(n,o.authorityType,this.logger,this.cryptoObj,i),c=i==null?void 0:i.tid,l=ST(this.storage,o,s,Zo,r,i,n,o.hostnameAndPort,c,void 0,void 0,this.logger);return await this.storage.setAccount(l,r),l}async loadIdToken(e,n,r,i,o){if(!e.id_token)return this.logger.verbose("TokenCache - no id token found in response"),null;this.logger.verbose("TokenCache - loading id token");const s=N0(n,r,e.id_token,this.config.auth.clientId,i);return await this.storage.setIdTokenCredential(s,o),s}async loadAccessToken(e,n,r,i,o,s,c){if(n.access_token)if(n.expires_in){if(!n.scope&&(!e.scopes||!e.scopes.length))return this.logger.error("TokenCache - scopes not specified in the request or response. Cannot add token to the cache."),null}else return this.logger.error("TokenCache - no expiration set on the access token. Cannot add it to the cache."),null;else return this.logger.verbose("TokenCache - no access token found in response"),null;this.logger.verbose("TokenCache - loading access token");const l=n.scope?Ar.fromString(n.scope):new Ar(e.scopes),u=s.expiresOn||n.expires_in+$i(),d=s.extendedExpiresOn||(n.ext_expires_in||n.expires_in)+$i(),f=P0(r,i,n.access_token,this.config.auth.clientId,o,l.printScopes(),u,d,Zo);return await this.storage.setAccessTokenCredential(f,c),f}async loadRefreshToken(e,n,r,i){if(!e.refresh_token)return this.logger.verbose("TokenCache - no refresh token found in response"),null;this.logger.verbose("TokenCache - loading refresh token");const o=BB(n,r,e.refresh_token,this.config.auth.clientId,e.foci,void 0,e.refresh_token_expires_in);return await this.storage.setRefreshTokenCredential(o,i),o}generateAuthenticationResult(e,n,r,i){var d,f,h;let o="",s=[],c=null,l;n!=null&&n.accessToken&&(o=n.accessToken.secret,s=Ar.fromString(n.accessToken.target).asArray(),c=_d(n.accessToken.expiresOn),l=_d(n.accessToken.extendedExpiresOn));const u=n.account;return{authority:i?i.canonicalAuthority:"",uniqueId:n.account.localAccountId,tenantId:n.account.realm,scopes:s,account:u.getAccountInfo(),idToken:((d=n.idToken)==null?void 0:d.secret)||"",idTokenClaims:r||{},accessToken:o,fromCache:!0,expiresOn:c,correlationId:e.correlationId||"",requestId:"",extExpiresOn:l,familyId:((f=n.refreshToken)==null?void 0:f.familyId)||"",tokenType:((h=n==null?void 0:n.accessToken)==null?void 0:h.tokenType)||"",state:e.state||"",cloudGraphHostName:u.cloudGraphHostName||"",msGraphHost:u.msGraphHost||"",fromNativeBroker:!1}}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Rie extends WB{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Mie extends Vf{constructor(e,n,r,i,o,s,c,l,u,d){super(e,n,r,i,o,s,l,u,d),this.apiId=c}async acquireToken(e){if(!e.code)throw Ge(gU);const n=await fe(this.initializeAuthorizationRequest.bind(this),K.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,xt.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const i={...n,code:e.code},o=await fe(this.getClientConfiguration.bind(this),K.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),s=new Rie(o);this.logger.verbose("Auth code client created");const c=new zU(s,this.browserStorage,i,this.logger,this.performanceClient);return await fe(c.handleCodeResponseFromServer.bind(c),K.HandleCodeResponseFromServer,this.logger,this.performanceClient,e.correlationId)({code:e.code,msgraph_host:e.msGraphHost,cloud_graph_host_name:e.cloudGraphHostName,cloud_instance_host_name:e.cloudInstanceHostName},n,!1)}catch(i){throw i instanceof _n&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),i}}logout(){return Promise.reject(Ge(M0))}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Die(t,e,n){var s;const r=((s=window.msal)==null?void 0:s.clientIds)||[],i=r.length,o=r.filter(c=>c===t).length;o>1&&n.warning("There is already an instance of MSAL.js in the window with the same client id."),e.add({msalInstanceCount:i,sameClientIdInstanceCount:o})}/*! @azure/msal-browser v4.19.0 2025-08-05 */function xs(t){const e=t==null?void 0:t.idTokenClaims;if(e!=null&&e.tfp||e!=null&&e.acr)return"B2C";if(e!=null&&e.tid){if((e==null?void 0:e.tid)==="9188040d-6c67-4c5b-b112-36a304b66dad")return"MSA"}else return;return"AAD"}function mv(t,e){try{FT(t)}catch(n){throw e.end({success:!1},n),n}}class B0{constructor(e){this.operatingContext=e,this.isBrowserEnvironment=this.operatingContext.isBrowserEnvironment(),this.config=e.getConfig(),this.initialized=!1,this.logger=this.operatingContext.getLogger(),this.networkClient=this.config.system.networkClient,this.navigationClient=this.config.system.navigationClient,this.redirectResponse=new Map,this.hybridAuthCodeResponses=new Map,this.performanceClient=this.config.telemetry.client,this.browserCrypto=this.isBrowserEnvironment?new $a(this.logger,this.performanceClient):Jy,this.eventHandler=new rie(this.logger),this.browserStorage=this.isBrowserEnvironment?new hA(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler,$ne(this.config.auth)):qre(this.config.auth.clientId,this.logger,this.performanceClient,this.eventHandler);const n={cacheLocation:jr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:jr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new hA(this.config.auth.clientId,n,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler),this.tokenCache=new Iie(this.config,this.browserStorage,this.logger,this.browserCrypto),this.activeSilentTokenRequests=new Map,this.trackPageVisibility=this.trackPageVisibility.bind(this),this.trackPageVisibilityWithMeasurement=this.trackPageVisibilityWithMeasurement.bind(this)}static async createController(e,n){const r=new B0(e);return await r.initialize(n),r}trackPageVisibility(e){e&&(this.logger.info("Perf: Visibility change detected"),this.performanceClient.incrementFields({visibilityChangeCount:1},e))}async initialize(e,n){if(this.logger.trace("initialize called"),this.initialized){this.logger.info("initialize has already been called, exiting early.");return}if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, exiting early."),this.initialized=!0,this.eventHandler.emitEvent(Qe.INITIALIZE_END);return}const r=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),i=this.config.system.allowPlatformBroker,o=this.performanceClient.startMeasurement(K.InitializeClientApplication,r);if(this.eventHandler.emitEvent(Qe.INITIALIZE_START),!n)try{this.logMultipleInstances(o)}catch{}if(await fe(this.browserStorage.initialize.bind(this.browserStorage),K.InitializeCache,this.logger,this.performanceClient,r)(r),i)try{this.platformAuthProvider=await bie(this.logger,this.performanceClient,r,this.config.system.nativeBrokerHandshakeTimeout)}catch(s){this.logger.verbose(s)}this.config.cache.claimsBasedCachingEnabled||(this.logger.verbose("Claims-based caching is disabled. Clearing the previous cache with claims"),Zi(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),K.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,r)(r)),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(r),this.initialized=!0,this.eventHandler.emitEvent(Qe.INITIALIZE_END),o.end({allowPlatformBroker:i,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),$U(this.initialized),this.isBrowserEnvironment){const n=e||"";let r=this.redirectResponse.get(n);return typeof r>"u"?(r=this.handleRedirectPromiseInternal(e),this.redirectResponse.set(n,r),this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise")):this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call"),r}return this.logger.verbose("handleRedirectPromise returns null, not browser environment"),null}async handleRedirectPromiseInternal(e){var l;if(!this.browserStorage.isInteractionInProgress(!0))return this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null."),null;if(((l=this.browserStorage.getInteractionInProgress())==null?void 0:l.type)===lc.SIGNOUT)return this.logger.verbose("handleRedirectPromise removing interaction_in_progress flag and returning null after sign-out"),this.browserStorage.setInteractionInProgress(!1),Promise.resolve(null);const r=this.getAllAccounts(),i=this.browserStorage.getCachedNativeRequest(),o=i&&this.platformAuthProvider&&!e;let s;this.eventHandler.emitEvent(Qe.HANDLE_REDIRECT_START,xt.Redirect);let c;try{if(o&&this.platformAuthProvider){s=this.performanceClient.startMeasurement(K.AcquireTokenRedirect,(i==null?void 0:i.correlationId)||""),this.logger.trace("handleRedirectPromise - acquiring token from native platform");const u=new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.handleRedirectPromise,this.performanceClient,this.platformAuthProvider,i.accountId,this.nativeInternalStorage,i.correlationId);c=fe(u.handleRedirectPromise.bind(u),K.HandleNativeRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(this.performanceClient,s.event.correlationId)}else{const[u,d]=this.browserStorage.getCachedRequest(),f=u.correlationId;s=this.performanceClient.startMeasurement(K.AcquireTokenRedirect,f),this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(f);c=fe(h.handleRedirectPromise.bind(h),K.HandleRedirectPromiseMeasurement,this.logger,this.performanceClient,s.event.correlationId)(e,u,d,s)}}catch(u){throw this.browserStorage.resetRequestCache(),u}return c.then(u=>(u?(this.browserStorage.resetRequestCache(),r.length{this.browserStorage.resetRequestCache();const d=u;throw r.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Redirect,null,d):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Redirect,null,d),this.eventHandler.emitEvent(Qe.HANDLE_REDIRECT_END,xt.Redirect),s.end({success:!1},d),u})}async acquireTokenRedirect(e){const n=this.getRequestCorrelationId(e);this.logger.verbose("acquireTokenRedirect called",n);const r=this.performanceClient.startMeasurement(K.AcquireTokenPreRedirect,n);r.add({accountType:xs(e.account),scenarioId:e.scenarioId});const i=e.onRedirectNavigate;if(i)e.onRedirectNavigate=s=>{const c=typeof i=="function"?i(s):void 0;return c!==!1?r.end({success:!0}):r.discard(),c};else{const s=this.config.auth.onRedirectNavigate;this.config.auth.onRedirectNavigate=c=>{const l=typeof s=="function"?s(c):void 0;return l!==!1?r.end({success:!0}):r.discard(),l}}const o=this.getAllAccounts().length>0;try{FI(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,lc.SIGNIN),o?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Redirect,e):this.eventHandler.emitEvent(Qe.LOGIN_START,xt.Redirect,e);let s;return this.platformAuthProvider&&this.canUsePlatformBroker(e)?s=new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.acquireTokenRedirect,this.performanceClient,this.platformAuthProvider,this.getNativeAccountId(e),this.nativeInternalStorage,n).acquireTokenRedirect(e,r).catch(l=>{if(l instanceof Ns&&qu(l))return this.platformAuthProvider=void 0,this.createRedirectClient(n).acquireToken(e);if(l instanceof ls)return this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createRedirectClient(n).acquireToken(e);throw l}):s=this.createRedirectClient(n).acquireToken(e),await s}catch(s){throw this.browserStorage.resetRequestCache(),r.end({success:!1},s),o?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Redirect,null,s):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Redirect,null,s),s}}acquireTokenPopup(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(K.AcquireTokenPopup,n);r.add({scenarioId:e.scenarioId,accountType:xs(e.account)});try{this.logger.verbose("acquireTokenPopup called",n),mv(this.initialized,r),this.browserStorage.setInteractionInProgress(!0,lc.SIGNIN)}catch(c){return Promise.reject(c)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Popup,e):this.eventHandler.emitEvent(Qe.LOGIN_START,xt.Popup,e);let o;const s=this.getPreGeneratedPkceCodes(n);return this.canUsePlatformBroker(e)?o=this.acquireTokenNative({...e,correlationId:n},Cn.acquireTokenPopup).then(c=>(r.end({success:!0,isNativeBroker:!0,accountType:xs(c.account)}),c)).catch(c=>{if(c instanceof Ns&&qu(c))return this.platformAuthProvider=void 0,this.createPopupClient(n).acquireToken(e,s);if(c instanceof ls)return this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow"),this.createPopupClient(n).acquireToken(e,s);throw c}):o=this.createPopupClient(n).acquireToken(e,s),o.then(c=>(i.length(i.length>0?this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Popup,null,c):this.eventHandler.emitEvent(Qe.LOGIN_FAILURE,xt.Popup,null,c),r.end({success:!1},c),Promise.reject(c))).finally(async()=>{this.browserStorage.setInteractionInProgress(!1),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(n)})}trackPageVisibilityWithMeasurement(){const e=this.ssoSilentMeasurement||this.acquireTokenByCodeAsyncMeasurement;e&&(this.logger.info("Perf: Visibility change detected in ",e.event.name),e.increment({visibilityChangeCount:1}))}async ssoSilent(e){var o,s;const n=this.getRequestCorrelationId(e),r={...e,prompt:e.prompt,correlationId:n};this.ssoSilentMeasurement=this.performanceClient.startMeasurement(K.SsoSilent,n),(o=this.ssoSilentMeasurement)==null||o.add({scenarioId:e.scenarioId,accountType:xs(e.account)}),mv(this.initialized,this.ssoSilentMeasurement),(s=this.ssoSilentMeasurement)==null||s.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),this.logger.verbose("ssoSilent called",n),this.eventHandler.emitEvent(Qe.SSO_SILENT_START,xt.Silent,r);let i;return this.canUsePlatformBroker(r)?i=this.acquireTokenNative(r,Cn.ssoSilent).catch(c=>{if(c instanceof Ns&&qu(c))return this.platformAuthProvider=void 0,this.createSilentIframeClient(r.correlationId).acquireToken(r);throw c}):i=this.createSilentIframeClient(r.correlationId).acquireToken(r),i.then(c=>{var l;return this.eventHandler.emitEvent(Qe.SSO_SILENT_SUCCESS,xt.Silent,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:xs(c.account)}),c}).catch(c=>{var l;throw this.eventHandler.emitEvent(Qe.SSO_SILENT_FAILURE,xt.Silent,null,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!1},c),c}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenByCode(e){const n=this.getRequestCorrelationId(e);this.logger.trace("acquireTokenByCode called",n);const r=this.performanceClient.startMeasurement(K.AcquireTokenByCode,n);mv(this.initialized,r),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_START,xt.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw Ge(yU);if(e.code){const i=e.code;let o=this.hybridAuthCodeResponses.get(i);return o?(this.logger.verbose("Existing acquireTokenByCode request found",n),r.discard()):(this.logger.verbose("Initiating new acquireTokenByCode request",n),o=this.acquireTokenByCodeAsync({...e,correlationId:n}).then(s=>(this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_SUCCESS,xt.Silent,s),this.hybridAuthCodeResponses.delete(i),r.end({success:!0,isNativeBroker:s.fromNativeBroker,accessTokenSize:s.accessToken.length,idTokenSize:s.idToken.length,accountType:xs(s.account)}),s)).catch(s=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_FAILURE,xt.Silent,null,s),r.end({success:!1},s),s}),this.hybridAuthCodeResponses.set(i,o)),await o}else if(e.nativeAccountId)if(this.canUsePlatformBroker(e,e.nativeAccountId)){const i=await this.acquireTokenNative({...e,correlationId:n},Cn.acquireTokenByCode,e.nativeAccountId).catch(o=>{throw o instanceof Ns&&qu(o)&&(this.platformAuthProvider=void 0),o});return r.end({accountType:xs(i.account),success:!0}),i}else throw Ge(xU);else throw Ge(vU)}catch(i){throw this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_BY_CODE_FAILURE,xt.Silent,null,i),r.end({success:!1},i),i}}async acquireTokenByCodeAsync(e){var i;return this.logger.trace("acquireTokenByCodeAsync called",e.correlationId),this.acquireTokenByCodeAsyncMeasurement=this.performanceClient.startMeasurement(K.AcquireTokenByCodeAsync,e.correlationId),(i=this.acquireTokenByCodeAsyncMeasurement)==null||i.increment({visibilityChangeCount:0}),document.addEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement),await this.createSilentAuthCodeClient(e.correlationId).acquireToken(e).then(o=>{var s;return(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker}),o}).catch(o=>{var s;throw(s=this.acquireTokenByCodeAsyncMeasurement)==null||s.end({success:!1},o),o}).finally(()=>{document.removeEventListener("visibilitychange",this.trackPageVisibilityWithMeasurement)})}async acquireTokenFromCache(e,n){switch(this.performanceClient.addQueueMeasurement(K.AcquireTokenFromCache,e.correlationId),n){case ci.Default:case ci.AccessToken:case ci.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return fe(r.acquireToken.bind(r),K.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw we(Rc)}}async acquireTokenByRefreshToken(e,n){switch(this.performanceClient.addQueueMeasurement(K.AcquireTokenByRefreshToken,e.correlationId),n){case ci.Default:case ci.AccessTokenAndRefreshToken:case ci.RefreshToken:case ci.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return fe(r.acquireToken.bind(r),K.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw we(Rc)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(K.AcquireTokenBySilentIframe,e.correlationId);const n=this.createSilentIframeClient(e.correlationId);return fe(n.acquireToken.bind(n),K.SilentIframeClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e)}async logout(e){const n=this.getRequestCorrelationId(e);return this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.",n),this.logoutRedirect({correlationId:n,...e})}async logoutRedirect(e){const n=this.getRequestCorrelationId(e);return FI(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),this.createRedirectClient(n).logout(e)}logoutPopup(e){try{const n=this.getRequestCorrelationId(e);return FT(this.initialized),this.browserStorage.setInteractionInProgress(!0,lc.SIGNOUT),this.createPopupClient(n).logout(e).finally(()=>{this.browserStorage.setInteractionInProgress(!1)})}catch(n){return Promise.reject(n)}}async clearCache(e){if(!this.isBrowserEnvironment){this.logger.info("in non-browser environment, returning early.");return}const n=this.getRequestCorrelationId(e);return this.createSilentCacheClient(n).logout(e)}getAllAccounts(e){const n=this.getRequestCorrelationId();return Yre(this.logger,this.browserStorage,this.isBrowserEnvironment,n,e)}getAccount(e){const n=this.getRequestCorrelationId();return Qre(e,this.logger,this.browserStorage,n)}getAccountByUsername(e){const n=this.getRequestCorrelationId();return Xre(e,this.logger,this.browserStorage,n)}getAccountByHomeId(e){const n=this.getRequestCorrelationId();return Jre(e,this.logger,this.browserStorage,n)}getAccountByLocalId(e){const n=this.getRequestCorrelationId();return Zre(e,this.logger,this.browserStorage,n)}setActiveAccount(e){const n=this.getRequestCorrelationId();eie(e,this.browserStorage,n)}getActiveAccount(){const e=this.getRequestCorrelationId();return tie(this.browserStorage,e)}async hydrateCache(e,n){this.logger.verbose("hydrateCache called");const r=cs.createFromAccountInfo(e.account,e.cloudGraphHostName,e.msGraphHost);return await this.browserStorage.setAccount(r,e.correlationId),e.fromNativeBroker?(this.logger.verbose("Response was from native broker, storing in-memory"),this.nativeInternalStorage.hydrateCache(e,n)):this.browserStorage.hydrateCache(e,n)}async acquireTokenNative(e,n,r,i){if(this.logger.trace("acquireTokenNative called"),!this.platformAuthProvider)throw Ge(kT);return new ry(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,n,this.performanceClient,this.platformAuthProvider,r||this.getNativeAccountId(e),this.nativeInternalStorage,e.correlationId).acquireToken(e,i)}canUsePlatformBroker(e,n){if(this.logger.trace("canUsePlatformBroker called"),!this.platformAuthProvider)return this.logger.trace("canUsePlatformBroker: platform broker unavilable, returning false"),!1;if(!nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme))return this.logger.trace("canUsePlatformBroker: isBrokerAvailable returned false, returning false"),!1;if(e.prompt)switch(e.prompt){case pi.NONE:case pi.CONSENT:case pi.LOGIN:this.logger.trace("canUsePlatformBroker: prompt is compatible with platform broker flow");break;default:return this.logger.trace(`canUsePlatformBroker: prompt = ${e.prompt} is not compatible with platform broker flow, returning false`),!1}return!n&&!this.getNativeAccountId(e)?(this.logger.trace("canUsePlatformBroker: nativeAccountId is not available, returning false"),!1):!0}getNativeAccountId(e){const n=e.account||this.getAccount({loginHint:e.loginHint,sid:e.sid})||this.getActiveAccount();return n&&n.nativeAccountId||""}createPopupClient(e){return new Sie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createRedirectClient(e){return new _ie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentIframeClient(e){return new kie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentCacheClient(e){return new VU(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentRefreshClient(e){return new Oie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentAuthCodeClient(e){return new Mie(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,Cn.acquireTokenByCode,this.performanceClient,this.platformAuthProvider,e)}addEventCallback(e,n){return this.eventHandler.addEventCallback(e,n)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return DU(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){if(this.config.cache.cacheLocation!==jr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.subscribeCrossTab()}disableAccountStorageEvents(){if(this.config.cache.cacheLocation!==jr.LocalStorage){this.logger.info("Account storage events are only available when cacheLocation is set to localStorage");return}this.eventHandler.unsubscribeCrossTab()}getTokenCache(){return this.tokenCache}getLogger(){return this.logger}setLogger(e){this.logger=e}initializeWrapperLibrary(e,n){this.browserStorage.setWrapperMetadata(e,n)}setNavigationClient(e){this.navigationClient=e}getConfiguration(){return this.config}getPerformanceClient(){return this.performanceClient}isBrowserEnv(){return this.isBrowserEnvironment}getRequestCorrelationId(e){return e!=null&&e.correlationId?e.correlationId:this.isBrowserEnvironment?us():pe.EMPTY_STRING}async loginRedirect(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",n),this.acquireTokenRedirect({correlationId:n,...e||RI})}loginPopup(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup({correlationId:n,...e||RI})}async acquireTokenSilent(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(K.AcquireTokenSilent,n);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),mv(this.initialized,r),this.logger.verbose("acquireTokenSilent called",n);const i=e.account||this.getActiveAccount();if(!i)throw Ge(uU);return r.add({accountType:xs(i)}),this.acquireTokenSilentDeduped(e,i,n).then(o=>(r.end({success:!0,fromCache:o.fromCache,isNativeBroker:o.fromNativeBroker,accessTokenSize:o.accessToken.length,idTokenSize:o.idToken.length}),{...o,state:e.state,correlationId:n})).catch(o=>{throw o instanceof _n&&o.setCorrelationId(n),r.end({success:!1},o),o})}async acquireTokenSilentDeduped(e,n,r){const i=k0(this.config.auth.clientId,{...e,authority:e.authority||this.config.auth.authority,correlationId:r},n.homeAccountId),o=JSON.stringify(i),s=this.activeSilentTokenRequests.get(o);if(typeof s>"u"){this.logger.verbose("acquireTokenSilent called for the first time, storing active request",r),this.performanceClient.addFields({deduped:!1},r);const c=fe(this.acquireTokenSilentAsync.bind(this),K.AcquireTokenSilentAsync,this.logger,this.performanceClient,r)({...e,correlationId:r},n);return this.activeSilentTokenRequests.set(o,c),c.finally(()=>{this.activeSilentTokenRequests.delete(o)})}else return this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call",r),this.performanceClient.addFields({deduped:!0},r),s}async acquireTokenSilentAsync(e,n){const r=()=>this.trackPageVisibility(e.correlationId);this.performanceClient.addQueueMeasurement(K.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_START,xt.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const i=await fe(iie,K.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,n,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||ci.Default;return this.acquireTokenSilentNoIframe(i,o).catch(async c=>{if($ie(c,o))if(this.activeIframeRequest)if(o!==ci.Skip){const[u,d]=this.activeIframeRequest;this.logger.verbose(`Iframe request is already in progress, awaiting resolution for request with correlationId: ${d}`,i.correlationId);const f=this.performanceClient.startMeasurement(K.AwaitConcurrentIframe,i.correlationId);f.add({awaitIframeCorrelationId:d});const h=await u;if(f.end({success:h}),h)return this.logger.verbose(`Parallel iframe request with correlationId: ${d} succeeded. Retrying cache and/or RT redemption`,i.correlationId),this.acquireTokenSilentNoIframe(i,o);throw this.logger.info(`Iframe request with correlationId: ${d} failed. Interaction is required.`),c}else return this.logger.warning("Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",i.correlationId),fe(this.acquireTokenBySilentIframe.bind(this),K.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i);else{let u;return this.activeIframeRequest=[new Promise(d=>{u=d}),i.correlationId],this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",i.correlationId),fe(this.acquireTokenBySilentIframe.bind(this),K.AcquireTokenBySilentIframe,this.logger,this.performanceClient,i.correlationId)(i).then(d=>(u(!0),d)).catch(d=>{throw u(!1),d}).finally(()=>{this.activeIframeRequest=void 0})}else throw c}).then(c=>(this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_SUCCESS,xt.Silent,c),e.correlationId&&this.performanceClient.addFields({fromCache:c.fromCache,isNativeBroker:c.fromNativeBroker},e.correlationId),c)).catch(c=>{throw this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_FAILURE,xt.Silent,null,c),c}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,n){return nm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme)&&e.account.nativeAccountId?(this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform"),this.acquireTokenNative(e,Cn.acquireTokenSilent_silentFlow,e.account.nativeAccountId,n).catch(async r=>{throw r instanceof Ns&&qu(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.platformAuthProvider=void 0,we(Rc)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),n===ci.AccessToken&&this.logger.verbose("acquireTokenSilent - cache lookup policy set to AccessToken, attempting to acquire token from local cache"),fe(this.acquireTokenFromCache.bind(this),K.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,n).catch(r=>{if(n===ci.AccessToken)throw r;return this.eventHandler.emitEvent(Qe.ACQUIRE_TOKEN_NETWORK_START,xt.Silent,e),fe(this.acquireTokenByRefreshToken.bind(this),K.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,n)}))}async preGeneratePkceCodes(e){return this.logger.verbose("Generating new PKCE codes"),this.pkceCode=await fe(L0,K.GeneratePkceCodes,this.logger,this.performanceClient,e)(this.performanceClient,this.logger,e),Promise.resolve()}getPreGeneratedPkceCodes(e){this.logger.verbose("Attempting to pick up pre-generated PKCE codes");const n=this.pkceCode?{...this.pkceCode}:void 0;return this.pkceCode=void 0,this.logger.verbose(`${n?"Found":"Did not find"} pre-generated PKCE codes`),this.performanceClient.addFields({usePreGeneratedPkce:!!n},e),n}logMultipleInstances(e){const n=this.config.auth.clientId;if(!window)return;window.msal=window.msal||{},window.msal.clientIds=window.msal.clientIds||[],window.msal.clientIds.length>0&&this.logger.verbose("There is already an instance of MSAL.js in the window."),window.msal.clientIds.push(n),Die(n,e,this.logger)}}function $ie(t,e){const n=!(t instanceof ls&&t.subError!==I0),r=t.errorCode===Ti.INVALID_GRANT_ERROR||t.errorCode===Rc,i=n&&r||t.errorCode===ax||t.errorCode===bT,o=fre.includes(e);return i&&o}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function Lie(t,e){const n=new mu(t);return await n.initialize(),B0.createController(n,e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class YT{static async createPublicClientApplication(e){const n=await Lie(e);return new YT(e,n)}constructor(e,n){this.isBroker=!1,this.controller=n||new B0(new mu(e))}async initialize(e){return this.controller.initialize(e,this.isBroker)}async acquireTokenPopup(e){return this.controller.acquireTokenPopup(e)}acquireTokenRedirect(e){return this.controller.acquireTokenRedirect(e)}acquireTokenSilent(e){return this.controller.acquireTokenSilent(e)}acquireTokenByCode(e){return this.controller.acquireTokenByCode(e)}addEventCallback(e,n){return this.controller.addEventCallback(e,n)}removeEventCallback(e){return this.controller.removeEventCallback(e)}addPerformanceCallback(e){return this.controller.addPerformanceCallback(e)}removePerformanceCallback(e){return this.controller.removePerformanceCallback(e)}enableAccountStorageEvents(){this.controller.enableAccountStorageEvents()}disableAccountStorageEvents(){this.controller.disableAccountStorageEvents()}getAccount(e){return this.controller.getAccount(e)}getAccountByHomeId(e){return this.controller.getAccountByHomeId(e)}getAccountByLocalId(e){return this.controller.getAccountByLocalId(e)}getAccountByUsername(e){return this.controller.getAccountByUsername(e)}getAllAccounts(e){return this.controller.getAllAccounts(e)}handleRedirectPromise(e){return this.controller.handleRedirectPromise(e)}loginPopup(e){return this.controller.loginPopup(e)}loginRedirect(e){return this.controller.loginRedirect(e)}logout(e){return this.controller.logout(e)}logoutRedirect(e){return this.controller.logoutRedirect(e)}logoutPopup(e){return this.controller.logoutPopup(e)}ssoSilent(e){return this.controller.ssoSilent(e)}getTokenCache(){return this.controller.getTokenCache()}getLogger(){return this.controller.getLogger()}setLogger(e){this.controller.setLogger(e)}setActiveAccount(e){this.controller.setActiveAccount(e)}getActiveAccount(){return this.controller.getActiveAccount()}initializeWrapperLibrary(e,n){return this.controller.initializeWrapperLibrary(e,n)}setNavigationClient(e){this.controller.setNavigationClient(e)}getConfiguration(){return this.controller.getConfiguration()}async hydrateCache(e,n){return this.controller.hydrateCache(e,n)}clearCache(e){return this.controller.clearCache(e)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Fie={initialize:()=>Promise.reject(lr(cr)),acquireTokenPopup:()=>Promise.reject(lr(cr)),acquireTokenRedirect:()=>Promise.reject(lr(cr)),acquireTokenSilent:()=>Promise.reject(lr(cr)),acquireTokenByCode:()=>Promise.reject(lr(cr)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(lr(cr)),loginPopup:()=>Promise.reject(lr(cr)),loginRedirect:()=>Promise.reject(lr(cr)),logout:()=>Promise.reject(lr(cr)),logoutRedirect:()=>Promise.reject(lr(cr)),logoutPopup:()=>Promise.reject(lr(cr)),ssoSilent:()=>Promise.reject(lr(cr)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw lr(cr)},getLogger:()=>{throw lr(cr)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw lr(cr)},hydrateCache:()=>Promise.reject(lr(cr)),clearCache:()=>Promise.reject(lr(cr))};/*! @azure/msal-browser v4.19.0 2025-08-05 */class Bie{static getInteractionStatusFromEvent(e,n){switch(e.eventType){case Qe.LOGIN_START:return xr.Login;case Qe.SSO_SILENT_START:return xr.SsoSilent;case Qe.ACQUIRE_TOKEN_START:if(e.interactionType===xt.Redirect||e.interactionType===xt.Popup)return xr.AcquireToken;break;case Qe.HANDLE_REDIRECT_START:return xr.HandleRedirect;case Qe.LOGOUT_START:return xr.Logout;case Qe.SSO_SILENT_SUCCESS:case Qe.SSO_SILENT_FAILURE:if(n&&n!==xr.SsoSilent)break;return xr.None;case Qe.LOGOUT_END:if(n&&n!==xr.Logout)break;return xr.None;case Qe.HANDLE_REDIRECT_END:if(n&&n!==xr.HandleRedirect)break;return xr.None;case Qe.LOGIN_SUCCESS:case Qe.LOGIN_FAILURE:case Qe.ACQUIRE_TOKEN_SUCCESS:case Qe.ACQUIRE_TOKEN_FAILURE:case Qe.RESTORE_FROM_BFCACHE:if(e.interactionType===xt.Redirect||e.interactionType===xt.Popup){if(n&&n!==xr.Login&&n!==xr.AcquireToken)break;return xr.None}break}return null}}const Uie="modulepreload",Hie=function(t){return"/semblance/"+t},QI={},zie=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),c=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));i=Promise.allSettled(n.map(l=>{if(l=Hie(l),l in QI)return;QI[l]=!0;const u=l.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${l}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Uie,u||(f.as="script"),f.crossOrigin="",f.href=l,c&&f.setAttribute("nonce",c),document.head.appendChild(f),u)return new Promise((h,p)=>{f.addEventListener("load",h),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${l}`)))})}))}function o(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return i.then(s=>{for(const c of s||[])c.status==="rejected"&&o(c.reason);return e().catch(o)})};/*! @azure/msal-react v3.0.17 2025-08-05 */const Gie={instance:Fie,inProgress:xr.None,accounts:[],logger:new Da({})},QT=v.createContext(Gie);QT.Consumer;/*! @azure/msal-react v3.0.17 2025-08-05 */function XI(t,e){if(t.length!==e.length)return!1;const n=[...e];return t.every(r=>{const i=n.shift();return!r||!i?!1:r.homeAccountId===i.homeAccountId&&r.localAccountId===i.localAccountId&&r.username===i.username})}/*! @azure/msal-react v3.0.17 2025-08-05 */const Vie="@azure/msal-react",JI="3.0.17";/*! @azure/msal-react v3.0.17 2025-08-05 */const gx={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},Kie=(t,e)=>{const{type:n,payload:r}=e;let i=t.inProgress;switch(n){case gx.UNBLOCK_INPROGRESS:t.inProgress===xr.Startup&&(i=xr.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case gx.EVENT:const s=r.message,c=Bie.getInteractionStatusFromEvent(s,t.inProgress);c&&(r.logger.info(`MsalProvider - ${s.eventType} results in setting inProgress from ${t.inProgress} to ${c}`),i=c);break;default:throw new Error(`Unknown action type: ${n}`)}if(i===xr.Startup)return t;const o=r.instance.getAllAccounts();return i!==t.inProgress&&!XI(o,t.accounts)?{...t,inProgress:i,accounts:o}:i!==t.inProgress?{...t,inProgress:i}:XI(o,t.accounts)?t:{...t,accounts:o}};function Wie({instance:t,children:e}){v.useEffect(()=>{t.initializeWrapperLibrary(lre.React,JI)},[t]);const n=v.useMemo(()=>t.getLogger().clone(Vie,JI),[t]),[r,i]=v.useReducer(Kie,void 0,()=>({inProgress:xr.Startup,accounts:[]}));v.useEffect(()=>{const s=t.addEventCallback(c=>{i({payload:{instance:t,logger:n,message:c},type:gx.EVENT})});return n.verbose(`MsalProvider - Registered event callback with id: ${s}`),t.initialize().then(()=>{t.handleRedirectPromise().catch(()=>{}).finally(()=>{i({payload:{instance:t,logger:n},type:gx.UNBLOCK_INPROGRESS})})}).catch(()=>{}),()=>{s&&(n.verbose(`MsalProvider - Removing event callback ${s}`),t.removeEventCallback(s))}},[t,n]);const o={instance:t,inProgress:r.inProgress,accounts:r.accounts,logger:n};return N.createElement(QT.Provider,{value:o},e)}/*! @azure/msal-react v3.0.17 2025-08-05 */const qie=()=>v.useContext(QT),Yie={auth:{clientId:"7e9b250a-d984-4fba-8e1c-a0622242a595",authority:"https://login.microsoftonline.com/e519c2e6-bc6d-4fdf-8d9c-923c2f002385",redirectUri:"https://ai-sandbox.oliver.solutions/semblance",postLogoutRedirectUri:"https://ai-sandbox.oliver.solutions/semblance"},cache:{cacheLocation:"localStorage",storeAuthStateInCookie:!1},system:{loggerOptions:{loggerCallback:(t,e,n)=>{n||console.log(e)},logLevel:Dn.Verbose,piiLoggingEnabled:!1},allowNativeBroker:!1}},Qie={scopes:["openid","profile","email"],prompt:"select_account",extraQueryParameters:{code_challenge_method:"S256"}},qU=v.createContext(void 0);function Xie({children:t}){const[e,n]=v.useState(null),[r,i]=v.useState(null),[o,s]=v.useState(!0),[c,l]=v.useState(!1),u=ar(),{instance:d,accounts:f,inProgress:h}=qie();v.useEffect(()=>{const w=S=>{const _=S.detail||{};if(_.isPersonaCreation){console.log("Ignoring auth error from persona creation",_);return}i(null),n(null),re.error("Session expired",{description:"Please log in again"}),u("/login")};return window.addEventListener(X_,w),()=>{window.removeEventListener(X_,w)}},[u]),v.useEffect(()=>{const w=localStorage.getItem("auth_token"),S=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!w,hasUser:!!S}),w&&S)try{i(w),n(JSON.parse(S)),console.log("User session restored from localStorage")}catch(C){console.error("Failed to parse stored user data:",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");s(!1)},[]),v.useEffect(()=>{if(r){console.log("Verifying token...");const w=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(w)==="true"&&e){console.log("Token already validated this session, skipping validation");return}ey.getProfile().then(C=>{C&&"data"in C&&(console.log("Profile verified successfully"),n(C.data),sessionStorage.setItem(w,"true"))}).catch(C=>{C.response&&C.response.status===401?(console.error("Token invalid (401):",C),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),i(null),n(null)):(console.warn("Profile validation error (not clearing token):",C),sessionStorage.setItem(w,"true"))})}else console.log("No token available, not validating profile")},[r,e]);const p=async(w,S)=>{var C,_;s(!0),console.log("Attempting login for user:",w);try{const A=await ey.login(w,S);if(console.log("Login API response received"),!A.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",A.data.access_token),localStorage.setItem("user",JSON.stringify(A.data.user)),i(A.data.access_token),n(A.data.user),console.log("Authentication state updated"),re.success("Login successful!"),A.data.access_token}catch(A){throw console.error("Login failed:",A),re.error("Login failed",{description:((_=(C=A.response)==null?void 0:C.data)==null?void 0:_.message)||"Invalid username or password"}),A}finally{s(!1)}},g=async()=>{l(!0);try{console.log("Starting Microsoft authentication...");const w=await d.loginPopup(Qie);if(w&&w.account&&w.idToken){console.log("Microsoft authentication successful",w.account);const S=await ey.loginWithMicrosoft(w.idToken);S.data.access_token&&(localStorage.setItem("auth_token",S.data.access_token),localStorage.setItem("user",JSON.stringify(S.data.user)),localStorage.setItem("auth_type","microsoft"),i(S.data.access_token),n(S.data.user),console.log("Microsoft user authenticated and stored"),re.success("Successfully signed in with Microsoft!"))}}catch(w){throw console.error("Microsoft login failed:",w),w.name==="BrowserAuthError"&&w.errorCode==="popup_window_error"?re.error("Sign-in cancelled",{description:"The sign-in popup was closed before completing authentication."}):w.name==="InteractionRequiredAuthError"?re.error("Authentication required",{description:"Please complete the authentication process."}):re.error("Microsoft sign-in failed",{description:w.message||"An error occurred during authentication"}),w}finally{l(!1)}},m=async()=>{const w=localStorage.getItem("auth_type");if(localStorage.removeItem("auth_token"),localStorage.removeItem("user"),localStorage.removeItem("auth_type"),i(null),n(null),w==="microsoft"&&f.length>0)try{await d.logoutPopup({account:f[0],postLogoutRedirectUri:window.location.origin+"/semblance/"})}catch(S){console.error("Microsoft logout error:",S)}re.info("You have been logged out")},y=!!localStorage.getItem("auth_token"),x={user:e,token:r,isLoading:o,login:p,loginWithMicrosoft:g,logout:m,isAuthenticated:!!r||y,isMsalLoading:c};return a.jsx(qU.Provider,{value:x,children:t})}function Xs(){const t=v.useContext(qU);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function Aa(){const[t,e]=v.useState(!1),n=Fi(),r=ar(),{isAuthenticated:i,logout:o}=Xs(),s=[{name:"Home",href:"/",icon:Vy},{name:"Synthetic Personas",href:"/synthetic-users",icon:Dr},{name:"Focus Groups",href:"/focus-groups",icon:Vs},{name:"Dashboard",href:"/dashboard",icon:G_}],c=()=>{e(!t)},l=d=>n.pathname===d,u=d=>{if(d==="/synthetic-users"){const f=new CustomEvent("syntheticUsersNavigation");window.dispatchEvent(f)}r(d)};return a.jsxs("header",{className:"fixed top-0 left-0 right-0 z-50 bg-white/80 backdrop-blur-md border-b border-slate-200/80",children:[a.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex h-16 items-center justify-between",children:[a.jsx("div",{className:"flex items-center",children:a.jsx(bo,{to:"/",className:"flex items-center",children:a.jsx("span",{className:"font-sf text-2xl font-semibold text-gradient",children:"Semblance"})})}),a.jsx("nav",{className:"hidden md:block",children:a.jsxs("ul",{className:"flex items-center space-x-8",children:[s.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(bo,{to:d.href,className:Ne("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",l(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]}):a.jsxs("button",{onClick:()=>u(d.href),className:Ne("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",l(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[a.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]})},d.name)),a.jsx("li",{children:i?a.jsxs("button",{onClick:()=>{o(),r("/login")},className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(JO,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(bo,{to:"/login",className:"flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-slate-900 button-transition rounded-md hover:bg-slate-50",children:[a.jsx(XO,{className:"mr-1 h-4 w-4"}),"Login"]})})]})}),a.jsx("div",{className:"flex md:hidden",children:a.jsxs("button",{type:"button",className:"inline-flex items-center justify-center rounded-md p-2 text-slate-700 hover:bg-slate-100 hover:text-slate-900 button-transition",onClick:c,children:[a.jsx("span",{className:"sr-only",children:"Open main menu"}),t?a.jsx(Jo,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(rZ,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),t&&a.jsx("div",{className:"md:hidden glass-panel animate-fade-in",children:a.jsxs("div",{className:"space-y-1 px-4 pb-3 pt-2",children:[s.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(bo,{to:d.href,className:Ne("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition",l(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>e(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:Ne("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition w-full text-left",l(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>{e(!1),u(d.href)},children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]})},d.name)),i?a.jsxs("button",{onClick:()=>{o(),e(!1),r("/login")},className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900 w-full",children:[a.jsx(JO,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(bo,{to:"/login",className:"flex items-center rounded-md px-3 py-2 text-base font-medium button-transition text-slate-600 hover:bg-slate-50 hover:text-slate-900",onClick:()=>e(!1),children:[a.jsx(XO,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const ZI=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,eR=Mt,XT=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return eR(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:o}=e,s=Object.keys(i).map(u=>{const d=n==null?void 0:n[u],f=o==null?void 0:o[u];if(d===null)return null;const h=ZI(d)||ZI(f);return i[u][h]}),c=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),l=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,y]=g;return Array.isArray(y)?y.includes({...o,...c}[m]):{...o,...c}[m]===y})?[...u,f,h]:u},[]);return eR(t,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},JT=XT("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),J=v.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},o)=>{const s=r?Hs:"button";return a.jsx(s,{className:Ne(JT({variant:e,size:n,className:t})),ref:o,...i})});J.displayName="Button";function Jie(){return a.jsxs("div",{className:"relative isolate overflow-hidden",children:[a.jsx("div",{className:"absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-primary to-blue-400 opacity-20 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})}),a.jsxs("div",{className:"mx-auto max-w-7xl px-6 py-24 sm:py-32 lg:flex lg:items-center lg:gap-x-10 lg:px-8 lg:py-40",children:[a.jsxs("div",{className:"mx-auto max-w-2xl lg:mx-0 lg:flex-auto",children:[a.jsx("div",{className:"flex",children:a.jsxs("div",{className:"relative flex items-center gap-x-4 rounded-full px-4 py-1 text-sm leading-6 text-gray-600 ring-1 ring-gray-900/10 hover:ring-gray-900/20",children:[a.jsx("span",{className:"font-semibold text-primary",children:"New"}),a.jsx("span",{className:"h-4 w-px bg-gray-900/10","aria-hidden":"true"}),a.jsx("span",{children:"Introducing AI-driven focus groups"})]})}),a.jsxs("h1",{className:"mt-10 max-w-lg text-4xl font-sf font-bold tracking-tight text-gray-900 sm:text-6xl",children:["Research with ",a.jsx("span",{className:"text-gradient",children:"synthetic personas"})]}),a.jsx("p",{className:"mt-6 text-lg leading-8 text-gray-600",children:"Conduct research using AI-powered synthetic personas and autonomous focus groups. Gain valuable insights without the limitations of traditional research methods."}),a.jsxs("div",{className:"mt-10 flex items-center gap-x-6",children:[a.jsx(bo,{to:"/synthetic-users",children:a.jsxs(J,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(fo,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(bo,{to:"/focus-groups",className:"text-sm font-semibold leading-6 text-gray-900 hover:text-primary button-transition",children:["Set up focus groups ",a.jsx("span",{"aria-hidden":"true",children:"→"})]})]})]}),a.jsx("div",{className:"mt-16 sm:mt-24 lg:mt-0 lg:flex-shrink-0 lg:flex-grow",children:a.jsxs("div",{className:"relative glass-card mx-auto w-[350px] h-[450px] rounded-2xl shadow-xl overflow-hidden animate-float",children:[a.jsxs("div",{className:"absolute top-4 left-4 right-4 h-12 bg-white/70 backdrop-blur-sm rounded-lg flex items-center px-4",children:[a.jsx("div",{className:"h-3 w-3 rounded-full bg-red-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-yellow-400 mr-2"}),a.jsx("div",{className:"h-3 w-3 rounded-full bg-green-400 mr-2"}),a.jsx("div",{className:"text-xs text-gray-500 ml-2",children:"Shampoo Brand Perception"})]}),a.jsx("div",{className:"absolute top-20 left-4 right-4 bottom-4 bg-gray-50 rounded-lg overflow-hidden",children:[1,2,3,4].map(t=>a.jsx("div",{className:`flex ${t%2===0?"justify-end":"justify-start"} px-3 py-2`,children:a.jsxs("div",{className:`max-w-[70%] rounded-lg px-3 py-2 text-xs ${t%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[t===1&&"What qualities do you look for in a premium shampoo brand?",t===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",t===3&&"How important is fragrance in your shampoo selection?",t===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},t))})]})})]}),a.jsx("div",{className:"absolute inset-x-0 bottom-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:bottom-[-20rem]","aria-hidden":"true",children:a.jsx("div",{className:"relative left-[calc(50%+11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-blue-400 to-primary opacity-20 sm:left-[calc(50%+30rem)] sm:w-[72.1875rem]",style:{clipPath:"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)"}})})]})}function Lu({title:t,description:e,icon:n,className:r}){return a.jsxs("div",{className:Ne("relative group glass-card rounded-xl overflow-hidden p-6 hover:shadow-lg hover:translate-y-[-4px] button-transition",r),children:[a.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-primary/5 to-blue-400/5 opacity-0 group-hover:opacity-100 transition-opacity duration-300"}),a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-12 h-12 flex items-center justify-center mb-4",children:a.jsx(n,{className:"h-6 w-6 text-primary"})}),a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:t}),a.jsx("p",{className:"text-gray-600 text-sm",children:e})]})]})}const Zie=()=>(Xs(),ar(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(Aa,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(Jie,{}),a.jsx("section",{className:"py-20 px-6 bg-white",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"Why Synthetic Personas?"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Our platform combines advanced AI with intuitive design to help researchers gain deeper insights faster than traditional methods."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[a.jsx(Lu,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:Dr}),a.jsx(Lu,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:Vs}),a.jsx(Lu,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:G_}),a.jsx(Lu,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:Dr}),a.jsx(Lu,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:uZ}),a.jsx(Lu,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:G_})]})]})}),a.jsx("section",{className:"py-20 px-6 bg-gradient-to-b from-white to-slate-50",children:a.jsxs("div",{className:"max-w-7xl mx-auto",children:[a.jsxs("div",{className:"text-center mb-16",children:[a.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"How It Works"}),a.jsx("p",{className:"mt-4 text-lg text-gray-600 max-w-3xl mx-auto",children:"Just three simple steps to gather valuable insights from synthetic personas."})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"1"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Create Synthetic Personas"}),a.jsx("p",{className:"text-gray-600",children:"Define your target audience with customizable demographic profiles and personality traits."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"2"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Set Up Focus Groups"}),a.jsx("p",{className:"text-gray-600",children:"Configure your research objectives, topics, and parameters for the AI moderator."})]}),a.jsxs("div",{className:"text-center p-6",children:[a.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:a.jsx("span",{className:"text-2xl font-bold text-primary",children:"3"})}),a.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Analyze Results"}),a.jsx("p",{className:"text-gray-600",children:"Review comprehensive visual reports and actionable insights from your synthetic research."})]})]}),a.jsx("div",{className:"text-center mt-12",children:a.jsx(bo,{to:"synthetic-users",className:"inline-flex items-center justify-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary hover:bg-primary/90 button-transition",children:"Get Started"})})]})}),a.jsxs("footer",{className:"bg-white py-12 px-6",children:[a.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center",children:[a.jsxs("div",{className:"mb-6 md:mb-0",children:[a.jsx("span",{className:"text-xl font-sf font-semibold text-gradient",children:"Semblance"}),a.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"AI-powered synthetic persona research"})]}),a.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Platform"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx(bo,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(bo,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(bo,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(bo,{to:"/dashboard",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Dashboard"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Company"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"About"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Blog"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Careers"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Contact"})})]})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Legal"}),a.jsxs("ul",{className:"space-y-2",children:[a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Privacy"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Terms"})}),a.jsx("li",{children:a.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Security"})})]})]})]})]}),a.jsx("div",{className:"max-w-7xl mx-auto mt-8 pt-8 border-t border-gray-200",children:a.jsxs("p",{className:"text-sm text-gray-500 text-center",children:["© ",new Date().getFullYear()," Semblance. All rights reserved."]})})]})]})})]})),eoe=()=>{const t=Fi(),e=ar();v.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]);const n=t.pathname.startsWith("/synthetic-users/"),i=new URLSearchParams(t.search).get("fromReview")==="true";return a.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:a.jsxs("div",{className:"text-center p-8 max-w-md bg-white rounded-lg shadow-md",children:[a.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),n?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The persona you're looking for may have been removed or doesn't exist."}),i?a.jsx(J,{onClick:()=>e("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(J,{onClick:()=>e("/synthetic-users"),className:"mb-2 w-full",children:"View All Personas"})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),a.jsx("p",{className:"text-gray-500 mb-6",children:"The page you're looking for doesn't exist or has been moved."})]}),a.jsx(J,{variant:"outline",onClick:()=>e("/"),className:"w-full",children:"Return to Home"})]})})};function toe(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,noe(i,...e)]}function noe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var ZT="Progress",eN=100,[roe,aFe]=toe(ZT),[ioe,ooe]=roe(ZT),YU=v.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:o=soe,...s}=t;(i||i===0)&&!tR(i)&&console.error(aoe(`${i}`,"Progress"));const c=tR(i)?i:eN;r!==null&&!nR(r,c)&&console.error(coe(`${r}`,"Progress"));const l=nR(r,c)?r:null,u=vx(l)?o(l,c):void 0;return a.jsx(ioe,{scope:n,value:l,max:c,children:a.jsx(it.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":vx(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":JU(l,c),"data-value":l??void 0,"data-max":c,...s,ref:e})})});YU.displayName=ZT;var QU="ProgressIndicator",XU=v.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=ooe(QU,n);return a.jsx(it.div,{"data-state":JU(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});XU.displayName=QU;function soe(t,e){return`${Math.round(t/e*100)}%`}function JU(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function vx(t){return typeof t=="number"}function tR(t){return vx(t)&&!isNaN(t)&&t>0}function nR(t,e){return vx(t)&&!isNaN(t)&&t<=e&&t>=0}function aoe(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${eN}\`.`}function coe(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${eN} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. -Defaulting to \`null\`.`}var ZU=YU,loe=XU;const Rl=v.forwardRef(({className:t,value:e,...n},r)=>a.jsx(ZU,{ref:r,className:Ne("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(loe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Rl.displayName=ZU.displayName;var xg=t=>t.type==="checkbox",Ml=t=>t instanceof Date,fi=t=>t==null;const e3=t=>typeof t=="object";var sr=t=>!fi(t)&&!Array.isArray(t)&&e3(t)&&!Ml(t),t3=t=>sr(t)&&t.target?xg(t.target)?t.target.checked:t.target.value:t,uoe=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,n3=(t,e)=>t.has(uoe(e)),doe=t=>{const e=t.constructor&&t.constructor.prototype;return sr(e)&&e.hasOwnProperty("isPrototypeOf")},tN=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function _i(t){let e;const n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(tN&&(t instanceof Blob||t instanceof FileList))&&(n||sr(t)))if(e=n?[]:{},!n&&!doe(t))e=t;else for(const r in t)t.hasOwnProperty(r)&&(e[r]=_i(t[r]));else return t;return e}var U0=t=>Array.isArray(t)?t.filter(Boolean):[],Jn=t=>t===void 0,Ie=(t,e,n)=>{if(!e||!sr(t))return n;const r=U0(e.split(/[,[\].]+?/)).reduce((i,o)=>fi(i)?i:i[o],t);return Jn(r)||r===t?Jn(t[e])?n:t[e]:r},po=t=>typeof t=="boolean",nN=t=>/^\w*$/.test(t),r3=t=>U0(t.replace(/["|']|\]/g,"").split(/\.|\[/)),pn=(t,e,n)=>{let r=-1;const i=nN(e)?[e]:r3(e),o=i.length,s=o-1;for(;++rN.useContext(i3),foe=t=>{const{children:e,...n}=t;return N.createElement(i3.Provider,{value:n},e)};var o3=(t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(i,o,{get:()=>{const s=o;return e._proxyFormState[s]!==Vo.all&&(e._proxyFormState[s]=!r||Vo.all),n&&(n[s]=!0),t[s]}});return i},Ai=t=>sr(t)&&!Object.keys(t).length,s3=(t,e,n,r)=>{n(t);const{name:i,...o}=t;return Ai(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(s=>e[s]===(!r||Vo.all))},pp=t=>Array.isArray(t)?t:[t],a3=(t,e,n)=>!t||!e||t===e||pp(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function rN(t){const e=N.useRef(t);e.current=t,N.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function hoe(t){const e=H0(),{control:n=e.control,disabled:r,name:i,exact:o}=t||{},[s,c]=N.useState(n._formState),l=N.useRef(!0),u=N.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=N.useRef(i);return d.current=i,rN({disabled:r,next:f=>l.current&&a3(d.current,f.name,o)&&s3(f,u.current,n._updateFormState)&&c({...n._formState,...f}),subject:n._subjects.state}),N.useEffect(()=>(l.current=!0,u.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),o3(s,n,u.current,!1)}var ks=t=>typeof t=="string",c3=(t,e,n,r,i)=>ks(t)?(r&&e.watch.add(t),Ie(n,t,i)):Array.isArray(t)?t.map(o=>(r&&e.watch.add(o),Ie(n,o))):(r&&(e.watchAll=!0),n);function poe(t){const e=H0(),{control:n=e.control,name:r,defaultValue:i,disabled:o,exact:s}=t||{},c=N.useRef(r);c.current=r,rN({disabled:o,subject:n._subjects.values,next:d=>{a3(c.current,d.name,s)&&u(_i(c3(c.current,n._names,d.values||n._formValues,!1,i)))}});const[l,u]=N.useState(n._getWatch(r,i));return N.useEffect(()=>n._removeUnmounted()),l}function moe(t){const e=H0(),{name:n,disabled:r,control:i=e.control,shouldUnregister:o}=t,s=n3(i._names.array,n),c=poe({control:i,name:n,defaultValue:Ie(i._formValues,n,Ie(i._defaultValues,n,t.defaultValue)),exact:!0}),l=hoe({control:i,name:n,exact:!0}),u=N.useRef(i.register(n,{...t.rules,value:c,...po(t.disabled)?{disabled:t.disabled}:{}}));return N.useEffect(()=>{const d=i._options.shouldUnregister||o,f=(h,p)=>{const g=Ie(i._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=_i(Ie(i._options.defaultValues,n));pn(i._defaultValues,n,h),Jn(Ie(i._formValues,n))&&pn(i._formValues,n,h)}return()=>{(s?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,s,o]),N.useEffect(()=>{Ie(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:Ie(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:c,...po(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:N.useCallback(d=>u.current.onChange({target:{value:t3(d),name:n},type:yx.CHANGE}),[n]),onBlur:N.useCallback(()=>u.current.onBlur({target:{value:Ie(i._formValues,n),name:n},type:yx.BLUR}),[n,i]),ref:N.useCallback(d=>{const f=Ie(i._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})},[i._fields,n])},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ie(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ie(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ie(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ie(l.validatingFields,n)},error:{enumerable:!0,get:()=>Ie(l.errors,n)}})}}const goe=t=>t.render(moe(t));var l3=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},rR=t=>({isOnSubmit:!t||t===Vo.onSubmit,isOnBlur:t===Vo.onBlur,isOnChange:t===Vo.onChange,isOnAll:t===Vo.all,isOnTouch:t===Vo.onTouched}),iR=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const mp=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const o=Ie(t,i);if(o){const{_f:s,...c}=o;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],i)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(mp(c,e))break}else if(sr(c)&&mp(c,e))break}}};var voe=(t,e,n)=>{const r=pp(Ie(t,n));return pn(r,"root",e[n]),pn(t,n,r),t},iN=t=>t.type==="file",ba=t=>typeof t=="function",xx=t=>{if(!tN)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},iy=t=>ks(t),oN=t=>t.type==="radio",bx=t=>t instanceof RegExp;const oR={value:!1,isValid:!1},sR={value:!0,isValid:!0};var u3=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Jn(t[0].attributes.value)?Jn(t[0].value)||t[0].value===""?sR:{value:t[0].value,isValid:!0}:sR:oR}return oR};const aR={isValid:!1,value:null};var d3=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,aR):aR;function cR(t,e,n="validate"){if(iy(t)||Array.isArray(t)&&t.every(iy)||po(t)&&!t)return{type:n,message:iy(t)?t:"",ref:e}}var Fu=t=>sr(t)&&!bx(t)?t:{value:t,message:""},lR=async(t,e,n,r,i)=>{const{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:y,disabled:b}=t._f,x=Ie(e,g);if(!y||b)return{};const w=s?s[0]:o,S=E=>{r&&w.reportValidity&&(w.setCustomValidity(po(E)?"":E||""),w.reportValidity())},C={},_=oN(o),A=xg(o),j=_||A,P=(m||iN(o))&&Jn(o.value)&&Jn(x)||xx(o)&&o.value===""||x===""||Array.isArray(x)&&!x.length,k=l3.bind(null,g,n,C),O=(E,I,D,z=oa.maxLength,$=oa.minLength)=>{const G=E?I:D;C[g]={type:E?z:$,message:G,ref:o,...k(E?z:$,G)}};if(i?!Array.isArray(x)||!x.length:c&&(!j&&(P||fi(x))||po(x)&&!x||A&&!u3(s).isValid||_&&!d3(s).isValid)){const{value:E,message:I}=iy(c)?{value:!!c,message:c}:Fu(c);if(E&&(C[g]={type:oa.required,message:I,ref:w,...k(oa.required,I)},!n))return S(I),C}if(!P&&(!fi(d)||!fi(f))){let E,I;const D=Fu(f),z=Fu(d);if(!fi(x)&&!isNaN(x)){const $=o.valueAsNumber||x&&+x;fi(D.value)||(E=$>D.value),fi(z.value)||(I=$new Date(new Date().toDateString()+" "+W),R=o.type=="time",L=o.type=="week";ks(D.value)&&x&&(E=R?G(x)>G(D.value):L?x>D.value:$>new Date(D.value)),ks(z.value)&&x&&(I=R?G(x)+E.value,z=!fi(I.value)&&x.length<+I.value;if((D||z)&&(O(D,E.message,I.message),!n))return S(C[g].message),C}if(h&&!P&&ks(x)){const{value:E,message:I}=Fu(h);if(bx(E)&&!x.match(E)&&(C[g]={type:oa.pattern,message:I,ref:o,...k(oa.pattern,I)},!n))return S(I),C}if(p){if(ba(p)){const E=await p(x,e),I=cR(E,w);if(I&&(C[g]={...I,...k(oa.validate,I.message)},!n))return S(I.message),C}else if(sr(p)){let E={};for(const I in p){if(!Ai(E)&&!n)break;const D=cR(await p[I](x,e),w,I);D&&(E={...D,...k(I,D.message)},S(D.message),n&&(C[g]=E))}if(!Ai(E)&&(C[g]={ref:w,...E},!n))return C}}return S(!0),C};function yoe(t,e){const n=e.slice(0,-1).length;let r=0;for(;r{let t=[];return{get observers(){return t},next:i=>{for(const o of t)o.next&&o.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(o=>o!==i)}}),unsubscribe:()=>{t=[]}}},pA=t=>fi(t)||!e3(t);function uc(t,e){if(pA(t)||pA(e))return t===e;if(Ml(t)&&Ml(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n){const o=t[i];if(!r.includes(i))return!1;if(i!=="ref"){const s=e[i];if(Ml(o)&&Ml(s)||sr(o)&&sr(s)||Array.isArray(o)&&Array.isArray(s)?!uc(o,s):o!==s)return!1}}return!0}var f3=t=>t.type==="select-multiple",boe=t=>oN(t)||xg(t),GS=t=>xx(t)&&t.isConnected,h3=t=>{for(const e in t)if(ba(t[e]))return!0;return!1};function wx(t,e={}){const n=Array.isArray(t);if(sr(t)||n)for(const r in t)Array.isArray(t[r])||sr(t[r])&&!h3(t[r])?(e[r]=Array.isArray(t[r])?[]:{},wx(t[r],e[r])):fi(t[r])||(e[r]=!0);return e}function p3(t,e,n){const r=Array.isArray(t);if(sr(t)||r)for(const i in t)Array.isArray(t[i])||sr(t[i])&&!h3(t[i])?Jn(e)||pA(n[i])?n[i]=Array.isArray(t[i])?wx(t[i],[]):{...wx(t[i])}:p3(t[i],fi(e)?{}:e[i],n[i]):n[i]=!uc(t[i],e[i]);return n}var jh=(t,e)=>p3(t,e,wx(e)),m3=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Jn(t)?t:e?t===""?NaN:t&&+t:n&&ks(t)?new Date(t):r?r(t):t;function VS(t){const e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return iN(e)?e.files:oN(e)?d3(t.refs).value:f3(e)?[...e.selectedOptions].map(({value:n})=>n):xg(e)?u3(t.refs).value:m3(Jn(e.value)?t.ref.value:e.value,t)}var woe=(t,e,n,r)=>{const i={};for(const o of t){const s=Ie(e,o);s&&pn(i,o,s._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},Eh=t=>Jn(t)?t:bx(t)?t.source:sr(t)?bx(t.value)?t.value.source:t.value:t;const uR="AsyncFunction";var Soe=t=>(!t||!t.validate)&&!!(ba(t.validate)&&t.validate.constructor.name===uR||sr(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===uR)),Coe=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function dR(t,e,n){const r=Ie(t,n);if(r||nN(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),s=Ie(e,o),c=Ie(t,o);if(s&&!Array.isArray(s)&&n!==o)return{name:n};if(c&&c.type)return{name:o,error:c};i.pop()}return{name:n}}var _oe=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,Aoe=(t,e)=>!U0(Ie(t,e)).length&&yr(t,e);const joe={mode:Vo.onSubmit,reValidateMode:Vo.onChange,shouldFocusError:!0};function Eoe(t={}){let e={...joe,...t},n={submitCount:0,isDirty:!1,isLoading:ba(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=sr(e.defaultValues)||sr(e.values)?_i(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:_i(i),s={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:zS(),array:zS(),state:zS()},h=rR(e.mode),p=rR(e.reValidateMode),g=e.criteriaMode===Vo.all,m=T=>M=>{clearTimeout(u),u=setTimeout(T,M)},y=async T=>{if(!t.disabled&&(d.isValid||T)){const M=e.resolver?Ai((await j()).errors):await k(r,!0);M!==n.isValid&&f.state.next({isValid:M})}},b=(T,M)=>{!t.disabled&&(d.isValidating||d.validatingFields)&&((T||Array.from(c.mount)).forEach(U=>{U&&(M?pn(n.validatingFields,U,M):yr(n.validatingFields,U))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Ai(n.validatingFields)}))},x=(T,M=[],U,V,Q=!0,B=!0)=>{if(V&&U&&!t.disabled){if(s.action=!0,B&&Array.isArray(Ie(r,T))){const X=U(Ie(r,T),V.argA,V.argB);Q&&pn(r,T,X)}if(B&&Array.isArray(Ie(n.errors,T))){const X=U(Ie(n.errors,T),V.argA,V.argB);Q&&pn(n.errors,T,X),Aoe(n.errors,T)}if(d.touchedFields&&B&&Array.isArray(Ie(n.touchedFields,T))){const X=U(Ie(n.touchedFields,T),V.argA,V.argB);Q&&pn(n.touchedFields,T,X)}d.dirtyFields&&(n.dirtyFields=jh(i,o)),f.state.next({name:T,isDirty:E(T,M),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else pn(o,T,M)},w=(T,M)=>{pn(n.errors,T,M),f.state.next({errors:n.errors})},S=T=>{n.errors=T,f.state.next({errors:n.errors,isValid:!1})},C=(T,M,U,V)=>{const Q=Ie(r,T);if(Q){const B=Ie(o,T,Jn(U)?Ie(i,T):U);Jn(B)||V&&V.defaultChecked||M?pn(o,T,M?B:VS(Q._f)):z(T,B),s.mount&&y()}},_=(T,M,U,V,Q)=>{let B=!1,X=!1;const ge={name:T};if(!t.disabled){const xe=!!(Ie(r,T)&&Ie(r,T)._f&&Ie(r,T)._f.disabled);if(!U||V){d.isDirty&&(X=n.isDirty,n.isDirty=ge.isDirty=E(),B=X!==ge.isDirty);const Re=xe||uc(Ie(i,T),M);X=!!(!xe&&Ie(n.dirtyFields,T)),Re||xe?yr(n.dirtyFields,T):pn(n.dirtyFields,T,!0),ge.dirtyFields=n.dirtyFields,B=B||d.dirtyFields&&X!==!Re}if(U){const Re=Ie(n.touchedFields,T);Re||(pn(n.touchedFields,T,U),ge.touchedFields=n.touchedFields,B=B||d.touchedFields&&Re!==U)}B&&Q&&f.state.next(ge)}return B?ge:{}},A=(T,M,U,V)=>{const Q=Ie(n.errors,T),B=d.isValid&&po(M)&&n.isValid!==M;if(t.delayError&&U?(l=m(()=>w(T,U)),l(t.delayError)):(clearTimeout(u),l=null,U?pn(n.errors,T,U):yr(n.errors,T)),(U?!uc(Q,U):Q)||!Ai(V)||B){const X={...V,...B&&po(M)?{isValid:M}:{},errors:n.errors,name:T};n={...n,...X},f.state.next(X)}},j=async T=>{b(T,!0);const M=await e.resolver(o,e.context,woe(T||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return b(T),M},P=async T=>{const{errors:M}=await j(T);if(T)for(const U of T){const V=Ie(M,U);V?pn(n.errors,U,V):yr(n.errors,U)}else n.errors=M;return M},k=async(T,M,U={valid:!0})=>{for(const V in T){const Q=T[V];if(Q){const{_f:B,...X}=Q;if(B){const ge=c.array.has(B.name),xe=Q._f&&Soe(Q._f);xe&&d.validatingFields&&b([V],!0);const Re=await lR(Q,o,g,e.shouldUseNativeValidation&&!M,ge);if(xe&&d.validatingFields&&b([V]),Re[B.name]&&(U.valid=!1,M))break;!M&&(Ie(Re,B.name)?ge?voe(n.errors,Re,B.name):pn(n.errors,B.name,Re[B.name]):yr(n.errors,B.name))}!Ai(X)&&await k(X,M,U)}}return U.valid},O=()=>{for(const T of c.unMount){const M=Ie(r,T);M&&(M._f.refs?M._f.refs.every(U=>!GS(U)):!GS(M._f.ref))&&ne(T)}c.unMount=new Set},E=(T,M)=>!t.disabled&&(T&&M&&pn(o,T,M),!uc(Y(),i)),I=(T,M,U)=>c3(T,c,{...s.mount?o:Jn(M)?i:ks(T)?{[T]:M}:M},U,M),D=T=>U0(Ie(s.mount?o:i,T,t.shouldUnregister?Ie(i,T,[]):[])),z=(T,M,U={})=>{const V=Ie(r,T);let Q=M;if(V){const B=V._f;B&&(!B.disabled&&pn(o,T,m3(M,B)),Q=xx(B.ref)&&fi(M)?"":M,f3(B.ref)?[...B.ref.options].forEach(X=>X.selected=Q.includes(X.value)):B.refs?xg(B.ref)?B.refs.length>1?B.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(Q)?!!Q.find(ge=>ge===X.value):Q===X.value)):B.refs[0]&&(B.refs[0].checked=!!Q):B.refs.forEach(X=>X.checked=X.value===Q):iN(B.ref)?B.ref.value="":(B.ref.value=Q,B.ref.type||f.values.next({name:T,values:{...o}})))}(U.shouldDirty||U.shouldTouch)&&_(T,Q,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&W(T)},$=(T,M,U)=>{for(const V in M){const Q=M[V],B=`${T}.${V}`,X=Ie(r,B);(c.array.has(T)||sr(Q)||X&&!X._f)&&!Ml(Q)?$(B,Q,U):z(B,Q,U)}},G=(T,M,U={})=>{const V=Ie(r,T),Q=c.array.has(T),B=_i(M);pn(o,T,B),Q?(f.array.next({name:T,values:{...o}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&f.state.next({name:T,dirtyFields:jh(i,o),isDirty:E(T,B)})):V&&!V._f&&!fi(B)?$(T,B,U):z(T,B,U),iR(T,c)&&f.state.next({...n}),f.values.next({name:s.mount?T:void 0,values:{...o}})},R=async T=>{s.mount=!0;const M=T.target;let U=M.name,V=!0;const Q=Ie(r,U),B=()=>M.type?VS(Q._f):t3(T),X=ge=>{V=Number.isNaN(ge)||Ml(ge)&&isNaN(ge.getTime())||uc(ge,Ie(o,U,ge))};if(Q){let ge,xe;const Re=B(),be=T.type===yx.BLUR||T.type===yx.FOCUS_OUT,Ve=!Coe(Q._f)&&!e.resolver&&!Ie(n.errors,U)&&!Q._f.deps||_oe(be,Ie(n.touchedFields,U),n.isSubmitted,p,h),st=iR(U,c,be);pn(o,U,Re),be?(Q._f.onBlur&&Q._f.onBlur(T),l&&l(0)):Q._f.onChange&&Q._f.onChange(T);const kt=_(U,Re,be,!1),Ke=!Ai(kt)||st;if(!be&&f.values.next({name:U,type:T.type,values:{...o}}),Ve)return d.isValid&&(t.mode==="onBlur"?be&&y():y()),Ke&&f.state.next({name:U,...st?{}:kt});if(!be&&st&&f.state.next({...n}),e.resolver){const{errors:tt}=await j([U]);if(X(Re),V){const Nt=dR(n.errors,r,U),sn=dR(tt,r,Nt.name||U);ge=sn.error,U=sn.name,xe=Ai(tt)}}else b([U],!0),ge=(await lR(Q,o,g,e.shouldUseNativeValidation))[U],b([U]),X(Re),V&&(ge?xe=!1:d.isValid&&(xe=await k(r,!0)));V&&(Q._f.deps&&W(Q._f.deps),A(U,xe,ge,kt))}},L=(T,M)=>{if(Ie(n.errors,M)&&T.focus)return T.focus(),1},W=async(T,M={})=>{let U,V;const Q=pp(T);if(e.resolver){const B=await P(Jn(T)?T:Q);U=Ai(B),V=T?!Q.some(X=>Ie(B,X)):U}else T?(V=(await Promise.all(Q.map(async B=>{const X=Ie(r,B);return await k(X&&X._f?{[B]:X}:X)}))).every(Boolean),!(!V&&!n.isValid)&&y()):V=U=await k(r);return f.state.next({...!ks(T)||d.isValid&&U!==n.isValid?{}:{name:T},...e.resolver||!T?{isValid:U}:{},errors:n.errors}),M.shouldFocus&&!V&&mp(r,L,T?Q:c.mount),V},Y=T=>{const M={...s.mount?o:i};return Jn(T)?M:ks(T)?Ie(M,T):T.map(U=>Ie(M,U))},te=(T,M)=>({invalid:!!Ie((M||n).errors,T),isDirty:!!Ie((M||n).dirtyFields,T),error:Ie((M||n).errors,T),isValidating:!!Ie(n.validatingFields,T),isTouched:!!Ie((M||n).touchedFields,T)}),me=T=>{T&&pp(T).forEach(M=>yr(n.errors,M)),f.state.next({errors:T?n.errors:{}})},F=(T,M,U)=>{const V=(Ie(r,T,{_f:{}})._f||{}).ref,Q=Ie(n.errors,T)||{},{ref:B,message:X,type:ge,...xe}=Q;pn(n.errors,T,{...xe,...M,ref:V}),f.state.next({name:T,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&V&&V.focus&&V.focus()},se=(T,M)=>ba(T)?f.values.subscribe({next:U=>T(I(void 0,M),U)}):I(T,M,!0),ne=(T,M={})=>{for(const U of T?pp(T):c.mount)c.mount.delete(U),c.array.delete(U),M.keepValue||(yr(r,U),yr(o,U)),!M.keepError&&yr(n.errors,U),!M.keepDirty&&yr(n.dirtyFields,U),!M.keepTouched&&yr(n.touchedFields,U),!M.keepIsValidating&&yr(n.validatingFields,U),!e.shouldUnregister&&!M.keepDefaultValue&&yr(i,U);f.values.next({values:{...o}}),f.state.next({...n,...M.keepDirty?{isDirty:E()}:{}}),!M.keepIsValid&&y()},ae=({disabled:T,name:M,field:U,fields:V,value:Q})=>{if(po(T)&&s.mount||T){const B=T?void 0:Jn(Q)?VS(U?U._f:Ie(V,M)._f):Q;pn(o,M,B),_(M,B,!1,!1,!0)}},De=(T,M={})=>{let U=Ie(r,T);const V=po(M.disabled)||po(t.disabled);return pn(r,T,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:T}},name:T,mount:!0,...M}}),c.mount.add(T),U?ae({field:U,disabled:po(M.disabled)?M.disabled:t.disabled,name:T,value:M.value}):C(T,!0,M.value),{...V?{disabled:M.disabled||t.disabled}:{},...e.progressive?{required:!!M.required,min:Eh(M.min),max:Eh(M.max),minLength:Eh(M.minLength),maxLength:Eh(M.maxLength),pattern:Eh(M.pattern)}:{},name:T,onChange:R,onBlur:R,ref:Q=>{if(Q){De(T,M),U=Ie(r,T);const B=Jn(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,X=boe(B),ge=U._f.refs||[];if(X?ge.find(xe=>xe===B):B===U._f.ref)return;pn(r,T,{_f:{...U._f,...X?{refs:[...ge.filter(GS),B,...Array.isArray(Ie(i,T))?[{}]:[]],ref:{type:B.type,name:T}}:{ref:B}}}),C(T,!1,void 0,B)}else U=Ie(r,T,{}),U._f&&(U._f.mount=!1),(e.shouldUnregister||M.shouldUnregister)&&!(n3(c.array,T)&&s.action)&&c.unMount.add(T)}}},de=()=>e.shouldFocusError&&mp(r,L,c.mount),ye=T=>{po(T)&&(f.state.next({disabled:T}),mp(r,(M,U)=>{const V=Ie(r,U);V&&(M.disabled=V._f.disabled||T,Array.isArray(V._f.refs)&&V._f.refs.forEach(Q=>{Q.disabled=V._f.disabled||T}))},0,!1))},Ee=(T,M)=>async U=>{let V;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let Q=_i(o);if(f.state.next({isSubmitting:!0}),e.resolver){const{errors:B,values:X}=await j();n.errors=B,Q=X}else await k(r);if(yr(n.errors,"root"),Ai(n.errors)){f.state.next({errors:{}});try{await T(Q,U)}catch(B){V=B}}else M&&await M({...n.errors},U),de(),setTimeout(de);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ai(n.errors)&&!V,submitCount:n.submitCount+1,errors:n.errors}),V)throw V},Z=(T,M={})=>{Ie(r,T)&&(Jn(M.defaultValue)?G(T,_i(Ie(i,T))):(G(T,M.defaultValue),pn(i,T,_i(M.defaultValue))),M.keepTouched||yr(n.touchedFields,T),M.keepDirty||(yr(n.dirtyFields,T),n.isDirty=M.defaultValue?E(T,_i(Ie(i,T))):E()),M.keepError||(yr(n.errors,T),d.isValid&&y()),f.state.next({...n}))},ct=(T,M={})=>{const U=T?_i(T):i,V=_i(U),Q=Ai(T),B=Q?i:V;if(M.keepDefaultValues||(i=U),!M.keepValues){if(M.keepDirtyValues){const X=new Set([...c.mount,...Object.keys(jh(i,o))]);for(const ge of Array.from(X))Ie(n.dirtyFields,ge)?pn(B,ge,Ie(o,ge)):G(ge,Ie(B,ge))}else{if(tN&&Jn(T))for(const X of c.mount){const ge=Ie(r,X);if(ge&&ge._f){const xe=Array.isArray(ge._f.refs)?ge._f.refs[0]:ge._f.ref;if(xx(xe)){const Re=xe.closest("form");if(Re){Re.reset();break}}}}r={}}o=t.shouldUnregister?M.keepDefaultValues?_i(i):{}:_i(B),f.array.next({values:{...B}}),f.values.next({values:{...B}})}c={mount:M.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!M.keepIsValid||!!M.keepDirtyValues,s.watch=!!t.shouldUnregister,f.state.next({submitCount:M.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:M.keepDirty?n.isDirty:!!(M.keepDefaultValues&&!uc(T,i)),isSubmitted:M.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:M.keepDirtyValues?M.keepDefaultValues&&o?jh(i,o):n.dirtyFields:M.keepDefaultValues&&T?jh(i,T):M.keepDirty?n.dirtyFields:{},touchedFields:M.keepTouched?n.touchedFields:{},errors:M.keepErrors?n.errors:{},isSubmitSuccessful:M.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Le=(T,M)=>ct(ba(T)?T(o):T,M);return{control:{register:De,unregister:ne,getFieldState:te,handleSubmit:Ee,setError:F,_executeSchema:j,_getWatch:I,_getDirty:E,_updateValid:y,_removeUnmounted:O,_updateFieldArray:x,_updateDisabledField:ae,_getFieldArray:D,_reset:ct,_resetDefaultValues:()=>ba(e.defaultValues)&&e.defaultValues().then(T=>{Le(T,e.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:T=>{n={...n,...T}},_disableForm:ye,_subjects:f,_proxyFormState:d,_setErrors:S,get _fields(){return r},get _formValues(){return o},get _state(){return s},set _state(T){s=T},get _defaultValues(){return i},get _names(){return c},set _names(T){c=T},get _formState(){return n},set _formState(T){n=T},get _options(){return e},set _options(T){e={...e,...T}}},trigger:W,register:De,handleSubmit:Ee,watch:se,setValue:G,getValues:Y,reset:Le,resetField:Z,clearErrors:me,unregister:ne,setError:F,setFocus:(T,M={})=>{const U=Ie(r,T),V=U&&U._f;if(V){const Q=V.refs?V.refs[0]:V.ref;Q.focus&&(Q.focus(),M.shouldSelect&&Q.select())}},getFieldState:te}}function z0(t={}){const e=N.useRef(),n=N.useRef(),[r,i]=N.useState({isDirty:!1,isValidating:!1,isLoading:ba(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:ba(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...Eoe(t),formState:r});const o=e.current.control;return o._options=t,rN({subject:o._subjects.state,next:s=>{s3(s,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),N.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),N.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==r.isDirty&&o._subjects.state.next({isDirty:s})}},[o,r.isDirty]),N.useEffect(()=>{t.values&&!uc(t.values,n.current)?(o._reset(t.values,o._options.resetOptions),n.current=t.values,i(s=>({...s}))):o._resetDefaultValues()},[t.values,o]),N.useEffect(()=>{t.errors&&o._setErrors(t.errors)},[t.errors,o]),N.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),N.useEffect(()=>{t.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[t.shouldUnregister,o]),N.useEffect(()=>{e.current&&(e.current.watch=e.current.watch.bind({}))},[r]),e.current.formState=o3(r,o),e.current}const fR=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Ie(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},g3=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?fR(r.ref,n,t):r.refs&&r.refs.forEach(i=>fR(i,n,t))}},Toe=(t,e)=>{e.shouldUseNativeValidation&&g3(t,e);const n={};for(const r in t){const i=Ie(e.fields,r),o=Object.assign(t[r]||{},{ref:i&&i.ref});if(Noe(e.names||Object.keys(t),r)){const s=Object.assign({},Ie(n,r));pn(s,"root",o),pn(n,r,s)}else pn(n,r,o)}return n},Noe=(t,e)=>t.some(n=>n.startsWith(e+"."));var Poe=function(t,e){for(var n={};t.length;){var r=t[0],i=r.code,o=r.message,s=r.path.join(".");if(!n[s])if("unionErrors"in r){var c=r.unionErrors[0].errors[0];n[s]={message:c.message,type:c.code}}else n[s]={message:o,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return t.push(f)})}),e){var l=n[s].types,u=l&&l[r.code];n[s]=l3(s,e,n,i,u?[].concat(u,r.message):r.message)}t.shift()}return n},G0=function(t,e,n){return n===void 0&&(n={}),function(r,i,o){try{return Promise.resolve(function(s,c){try{var l=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(u){return o.shouldUseNativeValidation&&g3({},o),{errors:{},values:n.raw?r:u}})}catch(u){return c(u)}return l&&l.then?l.then(void 0,c):l}(0,function(s){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(s))return{values:{},errors:Toe(Poe(s.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw s}))}catch(s){return Promise.reject(s)}}},tn;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),s={};for(const c of o)s[c]=i[c];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(const s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(tn||(tn={}));var mA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(mA||(mA={}));const qe=tn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dc=t=>{switch(typeof t){case"undefined":return qe.undefined;case"string":return qe.string;case"number":return isNaN(t)?qe.nan:qe.number;case"boolean":return qe.boolean;case"function":return qe.function;case"bigint":return qe.bigint;case"symbol":return qe.symbol;case"object":return Array.isArray(t)?qe.array:t===null?qe.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?qe.promise:typeof Map<"u"&&t instanceof Map?qe.map:typeof Set<"u"&&t instanceof Set?qe.set:typeof Date<"u"&&t instanceof Date?qe.date:qe.object;default:return qe.unknown}},_e=tn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),koe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class eo extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let c=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}eo.create=t=>new eo(t);const Zd=(t,e)=>{let n;switch(t.code){case _e.invalid_type:t.received===qe.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case _e.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,tn.jsonStringifyReplacer)}`;break;case _e.unrecognized_keys:n=`Unrecognized key(s) in object: ${tn.joinValues(t.keys,", ")}`;break;case _e.invalid_union:n="Invalid input";break;case _e.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${tn.joinValues(t.options)}`;break;case _e.invalid_enum_value:n=`Invalid enum value. Expected ${tn.joinValues(t.options)}, received '${t.received}'`;break;case _e.invalid_arguments:n="Invalid function arguments";break;case _e.invalid_return_type:n="Invalid function return type";break;case _e.invalid_date:n="Invalid date";break;case _e.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:tn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case _e.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case _e.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case _e.custom:n="Invalid input";break;case _e.invalid_intersection_types:n="Intersection results could not be merged";break;case _e.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case _e.not_finite:n="Number must be finite";break;default:n=e.defaultError,tn.assertNever(t)}return{message:n}};let v3=Zd;function Ooe(t){v3=t}function Sx(){return v3}const Cx=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let c="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)c=u(s,{data:e,defaultError:c}).message;return{...i,path:o,message:c}},Ioe=[];function ze(t,e){const n=Sx(),r=Cx({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Zd?void 0:Zd].filter(i=>!!i)});t.common.issues.push(r)}class oi{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Tt;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const o=await i.key,s=await i.value;r.push({key:o,value:s})}return oi.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Tt;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}}const Tt=Object.freeze({status:"aborted"}),cd=t=>({status:"dirty",value:t}),xi=t=>({status:"valid",value:t}),gA=t=>t.status==="aborted",vA=t=>t.status==="dirty",rm=t=>t.status==="valid",im=t=>typeof Promise<"u"&&t instanceof Promise;function _x(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function y3(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var at;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(at||(at={}));var Kh,Wh;class Ks{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const hR=(t,e)=>{if(rm(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new eo(t.common.issues);return this._error=n,this._error}}};function Lt(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,c)=>{var l,u;const{message:d}=t;return s.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:(l=d??r)!==null&&l!==void 0?l:c.defaultError}:s.code!=="invalid_type"?{message:c.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:c.defaultError}},description:i}}class Kt{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return dc(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:dc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new oi,ctx:{common:e.parent.common,data:e.data,parsedType:dc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(im(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dc(e)},o=this._parseSync({data:e,path:i.path,parent:i});return hR(i,o)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dc(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(im(i)?i:Promise.resolve(i));return hR(r,o)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=e(i),c=()=>o.addIssue({code:_e.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new ds({schema:this,typeName:jt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ls.create(this,this._def)}nullable(){return tl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return es.create(this,this._def)}promise(){return tf.create(this,this._def)}or(e){return cm.create([this,e],this._def)}and(e){return lm.create(this,e,this._def)}transform(e){return new ds({...Lt(this._def),schema:this,typeName:jt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new pm({...Lt(this._def),innerType:this,defaultValue:n,typeName:jt.ZodDefault})}brand(){return new sN({typeName:jt.ZodBranded,type:this,...Lt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new mm({...Lt(this._def),innerType:this,catchValue:n,typeName:jt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return bg.create(this,e)}readonly(){return gm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Roe=/^c[^\s-]{8,}$/i,Moe=/^[0-9a-z]+$/,Doe=/^[0-9A-HJKMNP-TV-Z]{26}$/,$oe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Loe=/^[a-z0-9_-]{21}$/i,Foe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Boe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Uoe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let KS;const Hoe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zoe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Goe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Voe=new RegExp(`^${x3}$`);function b3(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Koe(t){return new RegExp(`^${b3(t)}$`)}function w3(t){let e=`${x3}T${b3(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Woe(t,e){return!!((e==="v4"||!e)&&Hoe.test(t)||(e==="v6"||!e)&&zoe.test(t))}class qo extends Kt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==qe.string){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:qe.string,received:o.parsedType}),Tt}const r=new oi;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),ze(i,{code:_e.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=e.data.length>o.value,c=e.data.lengthe.test(i),{validation:n,code:_e.invalid_string,...at.errToObj(r)})}_addCheck(e){return new qo({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...at.errToObj(e)})}url(e){return this._addCheck({kind:"url",...at.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...at.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...at.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...at.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...at.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...at.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...at.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...at.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...at.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...at.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...at.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...at.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...at.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...at.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...at.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...at.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...at.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...at.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...at.errToObj(n)})}nonempty(e){return this.min(1,at.errToObj(e))}trim(){return new qo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new qo({checks:[],typeName:jt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Lt(t)})};function qoe(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(t.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class Jc extends Kt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==qe.number){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:qe.number,received:o.parsedType}),Tt}let r;const i=new oi;for(const o of this._def.checks)o.kind==="int"?tn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?qoe(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_finite,message:o.message}),i.dirty()):tn.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,at.toString(n))}gt(e,n){return this.setLimit("min",e,!1,at.toString(n))}lte(e,n){return this.setLimit("max",e,!0,at.toString(n))}lt(e,n){return this.setLimit("max",e,!1,at.toString(n))}setLimit(e,n,r,i){return new Jc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:at.toString(i)}]})}_addCheck(e){return new Jc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:at.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:at.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:at.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:at.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:at.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:at.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:at.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:at.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:at.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&tn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.valuenew Jc({checks:[],typeName:jt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Lt(t)});class Zc extends Kt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==qe.bigint){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:qe.bigint,received:o.parsedType}),Tt}let r;const i=new oi;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):tn.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,at.toString(n))}gt(e,n){return this.setLimit("min",e,!1,at.toString(n))}lte(e,n){return this.setLimit("max",e,!0,at.toString(n))}lt(e,n){return this.setLimit("max",e,!1,at.toString(n))}setLimit(e,n,r,i){return new Zc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:at.toString(i)}]})}_addCheck(e){return new Zc({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:at.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:at.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:at.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:at.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:at.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Zc({checks:[],typeName:jt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Lt(t)})};class om extends Kt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==qe.boolean){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:qe.boolean,received:r.parsedType}),Tt}return xi(e.data)}}om.create=t=>new om({typeName:jt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Lt(t)});class gu extends Kt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==qe.date){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:qe.date,received:o.parsedType}),Tt}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_date}),Tt}const r=new oi;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),ze(i,{code:_e.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):tn.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new gu({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:at.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:at.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew gu({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:jt.ZodDate,...Lt(t)});class Ax extends Kt{_parse(e){if(this._getType(e)!==qe.symbol){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:qe.symbol,received:r.parsedType}),Tt}return xi(e.data)}}Ax.create=t=>new Ax({typeName:jt.ZodSymbol,...Lt(t)});class sm extends Kt{_parse(e){if(this._getType(e)!==qe.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:qe.undefined,received:r.parsedType}),Tt}return xi(e.data)}}sm.create=t=>new sm({typeName:jt.ZodUndefined,...Lt(t)});class am extends Kt{_parse(e){if(this._getType(e)!==qe.null){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:qe.null,received:r.parsedType}),Tt}return xi(e.data)}}am.create=t=>new am({typeName:jt.ZodNull,...Lt(t)});class ef extends Kt{constructor(){super(...arguments),this._any=!0}_parse(e){return xi(e.data)}}ef.create=t=>new ef({typeName:jt.ZodAny,...Lt(t)});class Yl extends Kt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xi(e.data)}}Yl.create=t=>new Yl({typeName:jt.ZodUnknown,...Lt(t)});class La extends Kt{_parse(e){const n=this._getOrReturnCtx(e);return ze(n,{code:_e.invalid_type,expected:qe.never,received:n.parsedType}),Tt}}La.create=t=>new La({typeName:jt.ZodNever,...Lt(t)});class jx extends Kt{_parse(e){if(this._getType(e)!==qe.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:qe.void,received:r.parsedType}),Tt}return xi(e.data)}}jx.create=t=>new jx({typeName:jt.ZodVoid,...Lt(t)});class es extends Kt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==qe.array)return ze(n,{code:_e.invalid_type,expected:qe.array,received:n.parsedType}),Tt;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,c=n.data.lengthi.maxLength.value&&(ze(n,{code:_e.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,c)=>i.type._parseAsync(new Ks(n,s,n.path,c)))).then(s=>oi.mergeArray(r,s));const o=[...n.data].map((s,c)=>i.type._parseSync(new Ks(n,s,n.path,c)));return oi.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new es({...this._def,minLength:{value:e,message:at.toString(n)}})}max(e,n){return new es({...this._def,maxLength:{value:e,message:at.toString(n)}})}length(e,n){return new es({...this._def,exactLength:{value:e,message:at.toString(n)}})}nonempty(e){return this.min(1,e)}}es.create=(t,e)=>new es({type:t,minLength:null,maxLength:null,exactLength:null,typeName:jt.ZodArray,...Lt(e)});function Yu(t){if(t instanceof Gn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ls.create(Yu(r))}return new Gn({...t._def,shape:()=>e})}else return t instanceof es?new es({...t._def,type:Yu(t.element)}):t instanceof Ls?Ls.create(Yu(t.unwrap())):t instanceof tl?tl.create(Yu(t.unwrap())):t instanceof Ws?Ws.create(t.items.map(e=>Yu(e))):t}class Gn extends Kt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=tn.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==qe.object){const u=this._getOrReturnCtx(e);return ze(u,{code:_e.invalid_type,expected:qe.object,received:u.parsedType}),Tt}const{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof La&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||c.push(u);const l=[];for(const u of s){const d=o[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Ks(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof La){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of c)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")c.length>0&&(ze(i,{code:_e.unrecognized_keys,keys:c}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of c){const f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Ks(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>oi.mergeObjectSync(r,u)):oi.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return at.errToObj,new Gn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o,s,c;const l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=at.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Gn({...this._def,unknownKeys:"strip"})}passthrough(){return new Gn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Gn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Gn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:jt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Gn({...this._def,catchall:e})}pick(e){const n={};return tn.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Gn({...this._def,shape:()=>n})}omit(e){const n={};return tn.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Gn({...this._def,shape:()=>n})}deepPartial(){return Yu(this)}partial(e){const n={};return tn.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new Gn({...this._def,shape:()=>n})}required(e){const n={};return tn.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ls;)o=o._def.innerType;n[r]=o}}),new Gn({...this._def,shape:()=>n})}keyof(){return S3(tn.objectKeys(this.shape))}}Gn.create=(t,e)=>new Gn({shape:()=>t,unknownKeys:"strip",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});Gn.strictCreate=(t,e)=>new Gn({shape:()=>t,unknownKeys:"strict",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});Gn.lazycreate=(t,e)=>new Gn({shape:t,unknownKeys:"strip",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});class cm extends Kt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(const c of o)if(c.result.status==="valid")return c.result;for(const c of o)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const s=o.map(c=>new eo(c.ctx.common.issues));return ze(n,{code:_e.invalid_union,unionErrors:s}),Tt}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const c=s.map(l=>new eo(l));return ze(n,{code:_e.invalid_union,unionErrors:c}),Tt}}get options(){return this._def.options}}cm.create=(t,e)=>new cm({options:t,typeName:jt.ZodUnion,...Lt(e)});const ca=t=>t instanceof dm?ca(t.schema):t instanceof ds?ca(t.innerType()):t instanceof fm?[t.value]:t instanceof el?t.options:t instanceof hm?tn.objectValues(t.enum):t instanceof pm?ca(t._def.innerType):t instanceof sm?[void 0]:t instanceof am?[null]:t instanceof Ls?[void 0,...ca(t.unwrap())]:t instanceof tl?[null,...ca(t.unwrap())]:t instanceof sN||t instanceof gm?ca(t.unwrap()):t instanceof mm?ca(t._def.innerType):[];class V0 extends Kt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.object)return ze(n,{code:_e.invalid_type,expected:qe.object,received:n.parsedType}),Tt;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ze(n,{code:_e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Tt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const o of n){const s=ca(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of s){if(i.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);i.set(c,o)}}return new V0({typeName:jt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Lt(r)})}}function yA(t,e){const n=dc(t),r=dc(e);if(t===e)return{valid:!0,data:t};if(n===qe.object&&r===qe.object){const i=tn.objectKeys(e),o=tn.objectKeys(t).filter(c=>i.indexOf(c)!==-1),s={...t,...e};for(const c of o){const l=yA(t[c],e[c]);if(!l.valid)return{valid:!1};s[c]=l.data}return{valid:!0,data:s}}else if(n===qe.array&&r===qe.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(gA(o)||gA(s))return Tt;const c=yA(o.value,s.value);return c.valid?((vA(o)||vA(s))&&n.dirty(),{status:n.value,value:c.data}):(ze(r,{code:_e.invalid_intersection_types}),Tt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}lm.create=(t,e,n)=>new lm({left:t,right:e,typeName:jt.ZodIntersection,...Lt(n)});class Ws extends Kt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.array)return ze(r,{code:_e.invalid_type,expected:qe.array,received:r.parsedType}),Tt;if(r.data.lengththis._def.items.length&&(ze(r,{code:_e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new Ks(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>oi.mergeArray(n,s)):oi.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Ws({...this._def,rest:e})}}Ws.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ws({items:t,typeName:jt.ZodTuple,rest:null,...Lt(e)})};class um extends Kt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.object)return ze(r,{code:_e.invalid_type,expected:qe.object,received:r.parsedType}),Tt;const i=[],o=this._def.keyType,s=this._def.valueType;for(const c in r.data)i.push({key:o._parse(new Ks(r,c,r.path,c)),value:s._parse(new Ks(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?oi.mergeObjectAsync(n,i):oi.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Kt?new um({keyType:e,valueType:n,typeName:jt.ZodRecord,...Lt(r)}):new um({keyType:qo.create(),valueType:e,typeName:jt.ZodRecord,...Lt(n)})}}class Ex extends Kt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.map)return ze(r,{code:_e.invalid_type,expected:qe.map,received:r.parsedType}),Tt;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([c,l],u)=>({key:i._parse(new Ks(r,c,r.path,[u,"key"])),value:o._parse(new Ks(r,l,r.path,[u,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of s){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return Tt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const l of s){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return Tt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}}}}Ex.create=(t,e,n)=>new Ex({valueType:e,keyType:t,typeName:jt.ZodMap,...Lt(n)});class vu extends Kt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==qe.set)return ze(r,{code:_e.invalid_type,expected:qe.set,received:r.parsedType}),Tt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(ze(r,{code:_e.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(l){const u=new Set;for(const d of l){if(d.status==="aborted")return Tt;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const c=[...r.data.values()].map((l,u)=>o._parse(new Ks(r,l,r.path,u)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,n){return new vu({...this._def,minSize:{value:e,message:at.toString(n)}})}max(e,n){return new vu({...this._def,maxSize:{value:e,message:at.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}vu.create=(t,e)=>new vu({valueType:t,minSize:null,maxSize:null,typeName:jt.ZodSet,...Lt(e)});class Ad extends Kt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.function)return ze(n,{code:_e.invalid_type,expected:qe.function,received:n.parsedType}),Tt;function r(c,l){return Cx({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Sx(),Zd].filter(u=>!!u),issueData:{code:_e.invalid_arguments,argumentsError:l}})}function i(c,l){return Cx({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Sx(),Zd].filter(u=>!!u),issueData:{code:_e.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof tf){const c=this;return xi(async function(...l){const u=new eo([]),d=await c._def.args.parseAsync(l,o).catch(p=>{throw u.addIssue(r(l,p)),u}),f=await Reflect.apply(s,this,d);return await c._def.returns._def.type.parseAsync(f,o).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{const c=this;return xi(function(...l){const u=c._def.args.safeParse(l,o);if(!u.success)throw new eo([r(l,u.error)]);const d=Reflect.apply(s,this,u.data),f=c._def.returns.safeParse(d,o);if(!f.success)throw new eo([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ad({...this._def,args:Ws.create(e).rest(Yl.create())})}returns(e){return new Ad({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Ad({args:e||Ws.create([]).rest(Yl.create()),returns:n||Yl.create(),typeName:jt.ZodFunction,...Lt(r)})}}class dm extends Kt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}dm.create=(t,e)=>new dm({getter:t,typeName:jt.ZodLazy,...Lt(e)});class fm extends Kt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ze(n,{received:n.data,code:_e.invalid_literal,expected:this._def.value}),Tt}return{status:"valid",value:e.data}}get value(){return this._def.value}}fm.create=(t,e)=>new fm({value:t,typeName:jt.ZodLiteral,...Lt(e)});function S3(t,e){return new el({values:t,typeName:jt.ZodEnum,...Lt(e)})}class el extends Kt{constructor(){super(...arguments),Kh.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{expected:tn.joinValues(r),received:n.parsedType,code:_e.invalid_type}),Tt}if(_x(this,Kh)||y3(this,Kh,new Set(this._def.values)),!_x(this,Kh).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{received:n.data,code:_e.invalid_enum_value,options:r}),Tt}return xi(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return el.create(e,{...this._def,...n})}exclude(e,n=this._def){return el.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Kh=new WeakMap;el.create=S3;class hm extends Kt{constructor(){super(...arguments),Wh.set(this,void 0)}_parse(e){const n=tn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==qe.string&&r.parsedType!==qe.number){const i=tn.objectValues(n);return ze(r,{expected:tn.joinValues(i),received:r.parsedType,code:_e.invalid_type}),Tt}if(_x(this,Wh)||y3(this,Wh,new Set(tn.getValidEnumValues(this._def.values))),!_x(this,Wh).has(e.data)){const i=tn.objectValues(n);return ze(r,{received:r.data,code:_e.invalid_enum_value,options:i}),Tt}return xi(e.data)}get enum(){return this._def.values}}Wh=new WeakMap;hm.create=(t,e)=>new hm({values:t,typeName:jt.ZodNativeEnum,...Lt(e)});class tf extends Kt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==qe.promise&&n.common.async===!1)return ze(n,{code:_e.invalid_type,expected:qe.promise,received:n.parsedType}),Tt;const r=n.parsedType===qe.promise?n.data:Promise.resolve(n.data);return xi(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}tf.create=(t,e)=>new tf({type:t,typeName:jt.ZodPromise,...Lt(e)});class ds extends Kt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===jt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{ze(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async c=>{if(n.value==="aborted")return Tt;const l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Tt:l.status==="dirty"||n.value==="dirty"?cd(l.value):l});{if(n.value==="aborted")return Tt;const c=this._def.schema._parseSync({data:s,path:r.path,parent:r});return c.status==="aborted"?Tt:c.status==="dirty"||n.value==="dirty"?cd(c.value):c}}if(i.type==="refinement"){const s=c=>{const l=i.refinement(c,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Tt:(c.status==="dirty"&&n.dirty(),s(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Tt:(c.status==="dirty"&&n.dirty(),s(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!rm(s))return s;const c=i.transform(s.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>rm(s)?Promise.resolve(i.transform(s.value,o)).then(c=>({status:n.value,value:c})):s);tn.assertNever(i)}}ds.create=(t,e,n)=>new ds({schema:t,typeName:jt.ZodEffects,effect:e,...Lt(n)});ds.createWithPreprocess=(t,e,n)=>new ds({schema:e,effect:{type:"preprocess",transform:t},typeName:jt.ZodEffects,...Lt(n)});class Ls extends Kt{_parse(e){return this._getType(e)===qe.undefined?xi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ls.create=(t,e)=>new Ls({innerType:t,typeName:jt.ZodOptional,...Lt(e)});class tl extends Kt{_parse(e){return this._getType(e)===qe.null?xi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tl.create=(t,e)=>new tl({innerType:t,typeName:jt.ZodNullable,...Lt(e)});class pm extends Kt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===qe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}pm.create=(t,e)=>new pm({innerType:t,typeName:jt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Lt(e)});class mm extends Kt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return im(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new eo(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new eo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}mm.create=(t,e)=>new mm({innerType:t,typeName:jt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Lt(e)});class Tx extends Kt{_parse(e){if(this._getType(e)!==qe.nan){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:qe.nan,received:r.parsedType}),Tt}return{status:"valid",value:e.data}}}Tx.create=t=>new Tx({typeName:jt.ZodNaN,...Lt(t)});const Yoe=Symbol("zod_brand");class sN extends Kt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class bg extends Kt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Tt:o.status==="dirty"?(n.dirty(),cd(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Tt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new bg({in:e,out:n,typeName:jt.ZodPipeline})}}class gm extends Kt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(rm(i)&&(i.value=Object.freeze(i.value)),i);return im(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}gm.create=(t,e)=>new gm({innerType:t,typeName:jt.ZodReadonly,...Lt(e)});function C3(t,e={},n){return t?ef.create().superRefine((r,i)=>{var o,s;if(!t(r)){const c=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(s=(o=c.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof c=="string"?{message:c}:c;i.addIssue({code:"custom",...u,fatal:l})}}):ef.create()}const Qoe={object:Gn.lazycreate};var jt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(jt||(jt={}));const Xoe=(t,e={message:`Input not instance of ${t.name}`})=>C3(n=>n instanceof t,e),_3=qo.create,A3=Jc.create,Joe=Tx.create,Zoe=Zc.create,j3=om.create,ese=gu.create,tse=Ax.create,nse=sm.create,rse=am.create,ise=ef.create,ose=Yl.create,sse=La.create,ase=jx.create,cse=es.create,lse=Gn.create,use=Gn.strictCreate,dse=cm.create,fse=V0.create,hse=lm.create,pse=Ws.create,mse=um.create,gse=Ex.create,vse=vu.create,yse=Ad.create,xse=dm.create,bse=fm.create,wse=el.create,Sse=hm.create,Cse=tf.create,pR=ds.create,_se=Ls.create,Ase=tl.create,jse=ds.createWithPreprocess,Ese=bg.create,Tse=()=>_3().optional(),Nse=()=>A3().optional(),Pse=()=>j3().optional(),kse={string:t=>qo.create({...t,coerce:!0}),number:t=>Jc.create({...t,coerce:!0}),boolean:t=>om.create({...t,coerce:!0}),bigint:t=>Zc.create({...t,coerce:!0}),date:t=>gu.create({...t,coerce:!0})},Ose=Tt;var Oe=Object.freeze({__proto__:null,defaultErrorMap:Zd,setErrorMap:Ooe,getErrorMap:Sx,makeIssue:Cx,EMPTY_PATH:Ioe,addIssueToContext:ze,ParseStatus:oi,INVALID:Tt,DIRTY:cd,OK:xi,isAborted:gA,isDirty:vA,isValid:rm,isAsync:im,get util(){return tn},get objectUtil(){return mA},ZodParsedType:qe,getParsedType:dc,ZodType:Kt,datetimeRegex:w3,ZodString:qo,ZodNumber:Jc,ZodBigInt:Zc,ZodBoolean:om,ZodDate:gu,ZodSymbol:Ax,ZodUndefined:sm,ZodNull:am,ZodAny:ef,ZodUnknown:Yl,ZodNever:La,ZodVoid:jx,ZodArray:es,ZodObject:Gn,ZodUnion:cm,ZodDiscriminatedUnion:V0,ZodIntersection:lm,ZodTuple:Ws,ZodRecord:um,ZodMap:Ex,ZodSet:vu,ZodFunction:Ad,ZodLazy:dm,ZodLiteral:fm,ZodEnum:el,ZodNativeEnum:hm,ZodPromise:tf,ZodEffects:ds,ZodTransformer:ds,ZodOptional:Ls,ZodNullable:tl,ZodDefault:pm,ZodCatch:mm,ZodNaN:Tx,BRAND:Yoe,ZodBranded:sN,ZodPipeline:bg,ZodReadonly:gm,custom:C3,Schema:Kt,ZodSchema:Kt,late:Qoe,get ZodFirstPartyTypeKind(){return jt},coerce:kse,any:ise,array:cse,bigint:Zoe,boolean:j3,date:ese,discriminatedUnion:fse,effect:pR,enum:wse,function:yse,instanceof:Xoe,intersection:hse,lazy:xse,literal:bse,map:gse,nan:Joe,nativeEnum:Sse,never:sse,null:rse,nullable:Ase,number:A3,object:lse,oboolean:Pse,onumber:Nse,optional:_se,ostring:Tse,pipeline:Ese,preprocess:jse,promise:Cse,record:mse,set:vse,strictObject:use,string:_3,symbol:tse,transformer:pR,tuple:pse,undefined:nse,union:dse,unknown:ose,void:ase,NEVER:Ose,ZodIssueCode:_e,quotelessJson:koe,ZodError:eo}),Ise="Label",E3=v.forwardRef((t,e)=>a.jsx(it.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));E3.displayName=Ise;var T3=E3;const Rse=XT("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),mo=v.forwardRef(({className:t,...e},n)=>a.jsx(T3,{ref:n,className:Ne(Rse(),t),...e}));mo.displayName=T3.displayName;const K0=foe,N3=v.createContext({}),vt=({...t})=>a.jsx(N3.Provider,{value:{name:t.name},children:a.jsx(goe,{...t})}),W0=()=>{const t=v.useContext(N3),e=v.useContext(P3),{getFieldState:n,formState:r}=H0(),i=n(t.name,r);if(!t)throw new Error("useFormField should be used within ");const{id:o}=e;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},P3=v.createContext({}),dt=v.forwardRef(({className:t,...e},n)=>{const r=v.useId();return a.jsx(P3.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Ne("space-y-2",t),...e})})});dt.displayName="FormItem";const ft=v.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:i}=W0();return a.jsx(mo,{ref:n,className:Ne(r&&"text-destructive",t),htmlFor:i,...e})});ft.displayName="FormLabel";const ht=v.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:o}=W0();return a.jsx(Hs,{ref:e,id:r,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...t})});ht.displayName="FormControl";const Nn=v.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=W0();return a.jsx("p",{ref:n,id:r,className:Ne("text-sm text-muted-foreground",t),...e})});Nn.displayName="FormDescription";const pt=v.forwardRef(({className:t,children:e,...n},r)=>{const{error:i,formMessageId:o}=W0(),s=i?String(i==null?void 0:i.message):e;return s?a.jsx("p",{ref:r,id:o,className:Ne("text-sm font-medium text-destructive",t),...n,children:s}):null});pt.displayName="FormMessage";const Ht=v.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:Ne("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Ht.displayName="Input";const mt=v.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:Ne("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));mt.displayName="Textarea";function vm(t,[e,n]){return Math.min(n,Math.max(e,t))}function Mse(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Dse(i,...e)]}function Dse(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function q0(t){const e=t+"CollectionProvider",[n,r]=Mse(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:m}=p,y=N.useRef(null),b=N.useRef(new Map).current;return a.jsx(i,{scope:g,itemMap:b,collectionRef:y,children:m})};s.displayName=e;const c=t+"CollectionSlot",l=N.forwardRef((p,g)=>{const{scope:m,children:y}=p,b=o(c,m),x=Pt(g,b.collectionRef);return a.jsx(Hs,{ref:x,children:y})});l.displayName=c;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=N.forwardRef((p,g)=>{const{scope:m,children:y,...b}=p,x=N.useRef(null),w=Pt(g,x),S=o(u,m);return N.useEffect(()=>(S.itemMap.set(x,{ref:x,...b}),()=>void S.itemMap.delete(x))),a.jsx(Hs,{[d]:"",ref:w,children:y})});f.displayName=u;function h(p){const g=o(t+"CollectionConsumer",p);return N.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((S,C)=>b.indexOf(S.ref.current)-b.indexOf(C.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var $se=v.createContext(void 0);function Nu(t){const e=v.useContext($se);return t||e||"ltr"}var WS=0;function aN(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??mR()),document.body.insertAdjacentElement("beforeend",t[1]??mR()),WS++,()=>{WS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),WS--}},[])}function mR(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var qS="focusScope.autoFocusOnMount",YS="focusScope.autoFocusOnUnmount",gR={bubbles:!1,cancelable:!0},Lse="FocusScope",Y0=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=t,[c,l]=v.useState(null),u=Cr(i),d=Cr(o),f=v.useRef(null),h=Pt(e,m=>l(m)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(w){if(p.paused||!c)return;const S=w.target;c.contains(S)?f.current=S:tc(f.current,{select:!0})},y=function(w){if(p.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||tc(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&tc(c)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const x=new MutationObserver(b);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),x.disconnect()}}},[r,c,p.paused]),v.useEffect(()=>{if(c){yR.add(p);const m=document.activeElement;if(!c.contains(m)){const b=new CustomEvent(qS,gR);c.addEventListener(qS,u),c.dispatchEvent(b),b.defaultPrevented||(Fse(Gse(k3(c)),{select:!0}),document.activeElement===m&&tc(c))}return()=>{c.removeEventListener(qS,u),setTimeout(()=>{const b=new CustomEvent(YS,gR);c.addEventListener(YS,d),c.dispatchEvent(b),b.defaultPrevented||tc(m??document.body,{select:!0}),c.removeEventListener(YS,d),yR.remove(p)},0)}}},[c,u,d,p]);const g=v.useCallback(m=>{if(!n&&!r||p.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(y&&b){const x=m.currentTarget,[w,S]=Bse(x);w&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&tc(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&tc(S,{select:!0})):b===x&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(it.div,{tabIndex:-1,...s,ref:h,onKeyDown:g})});Y0.displayName=Lse;function Fse(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(tc(r,{select:e}),document.activeElement!==n)return}function Bse(t){const e=k3(t),n=vR(e,t),r=vR(e.reverse(),t);return[n,r]}function k3(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function vR(t,e){for(const n of t)if(!Use(n,{upTo:e}))return n}function Use(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Hse(t){return t instanceof HTMLInputElement&&"select"in t}function tc(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Hse(t)&&e&&t.select()}}var yR=zse();function zse(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=xR(t,e),t.unshift(e)},remove(e){var n;t=xR(t,e),(n=t[0])==null||n.resume()}}}function xR(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Gse(t){return t.filter(e=>e.tagName!=="A")}function wg(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Vse=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Bu=new WeakMap,gv=new WeakMap,vv={},QS=0,O3=function(t){return t&&(t.host||O3(t.parentNode))},Kse=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=O3(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Wse=function(t,e,n,r){var i=Kse(e,Array.isArray(t)?t:[t]);vv[n]||(vv[n]=new WeakMap);var o=vv[n],s=[],c=new Set,l=new Set(i),u=function(f){!f||c.has(f)||(c.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(c.has(h))d(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",m=(Bu.get(h)||0)+1,y=(o.get(h)||0)+1;Bu.set(h,m),o.set(h,y),s.push(h),m===1&&g&&gv.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),c.clear(),QS++,function(){s.forEach(function(f){var h=Bu.get(f)-1,p=o.get(f)-1;Bu.set(f,h),o.set(f,p),h||(gv.has(f)||f.removeAttribute(r),gv.delete(f)),p||f.removeAttribute(n)}),QS--,QS||(Bu=new WeakMap,Bu=new WeakMap,gv=new WeakMap,vv={})}},cN=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Vse(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Wse(r,i,n,"aria-hidden")):function(){return null}},Ps=function(){return Ps=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return uae;var e=dae(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},hae=D3(),jd="data-scroll-locked",pae=function(t,e,n,r){var i=t.left,o=t.top,s=t.right,c=t.gap;return n===void 0&&(n="margin"),` +Defaulting to \`null\`.`}var ZU=YU,loe=XU;const Rl=v.forwardRef(({className:t,value:e,...n},r)=>a.jsx(ZU,{ref:r,className:Ne("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(loe,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Rl.displayName=ZU.displayName;var xg=t=>t.type==="checkbox",Ml=t=>t instanceof Date,fi=t=>t==null;const e3=t=>typeof t=="object";var sr=t=>!fi(t)&&!Array.isArray(t)&&e3(t)&&!Ml(t),t3=t=>sr(t)&&t.target?xg(t.target)?t.target.checked:t.target.value:t,uoe=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,n3=(t,e)=>t.has(uoe(e)),doe=t=>{const e=t.constructor&&t.constructor.prototype;return sr(e)&&e.hasOwnProperty("isPrototypeOf")},tN=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function _i(t){let e;const n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(tN&&(t instanceof Blob||t instanceof FileList))&&(n||sr(t)))if(e=n?[]:{},!n&&!doe(t))e=t;else for(const r in t)t.hasOwnProperty(r)&&(e[r]=_i(t[r]));else return t;return e}var U0=t=>Array.isArray(t)?t.filter(Boolean):[],Jn=t=>t===void 0,Ie=(t,e,n)=>{if(!e||!sr(t))return n;const r=U0(e.split(/[,[\].]+?/)).reduce((i,o)=>fi(i)?i:i[o],t);return Jn(r)||r===t?Jn(t[e])?n:t[e]:r},po=t=>typeof t=="boolean",nN=t=>/^\w*$/.test(t),r3=t=>U0(t.replace(/["|']|\]/g,"").split(/\.|\[/)),mn=(t,e,n)=>{let r=-1;const i=nN(e)?[e]:r3(e),o=i.length,s=o-1;for(;++rN.useContext(i3),foe=t=>{const{children:e,...n}=t;return N.createElement(i3.Provider,{value:n},e)};var o3=(t,e,n,r=!0)=>{const i={defaultValues:e._defaultValues};for(const o in t)Object.defineProperty(i,o,{get:()=>{const s=o;return e._proxyFormState[s]!==Vo.all&&(e._proxyFormState[s]=!r||Vo.all),n&&(n[s]=!0),t[s]}});return i},Ai=t=>sr(t)&&!Object.keys(t).length,s3=(t,e,n,r)=>{n(t);const{name:i,...o}=t;return Ai(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(s=>e[s]===(!r||Vo.all))},pp=t=>Array.isArray(t)?t:[t],a3=(t,e,n)=>!t||!e||t===e||pp(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function rN(t){const e=N.useRef(t);e.current=t,N.useEffect(()=>{const n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}function hoe(t){const e=H0(),{control:n=e.control,disabled:r,name:i,exact:o}=t||{},[s,c]=N.useState(n._formState),l=N.useRef(!0),u=N.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=N.useRef(i);return d.current=i,rN({disabled:r,next:f=>l.current&&a3(d.current,f.name,o)&&s3(f,u.current,n._updateFormState)&&c({...n._formState,...f}),subject:n._subjects.state}),N.useEffect(()=>(l.current=!0,u.current.isValid&&n._updateValid(!0),()=>{l.current=!1}),[n]),o3(s,n,u.current,!1)}var ks=t=>typeof t=="string",c3=(t,e,n,r,i)=>ks(t)?(r&&e.watch.add(t),Ie(n,t,i)):Array.isArray(t)?t.map(o=>(r&&e.watch.add(o),Ie(n,o))):(r&&(e.watchAll=!0),n);function poe(t){const e=H0(),{control:n=e.control,name:r,defaultValue:i,disabled:o,exact:s}=t||{},c=N.useRef(r);c.current=r,rN({disabled:o,subject:n._subjects.values,next:d=>{a3(c.current,d.name,s)&&u(_i(c3(c.current,n._names,d.values||n._formValues,!1,i)))}});const[l,u]=N.useState(n._getWatch(r,i));return N.useEffect(()=>n._removeUnmounted()),l}function moe(t){const e=H0(),{name:n,disabled:r,control:i=e.control,shouldUnregister:o}=t,s=n3(i._names.array,n),c=poe({control:i,name:n,defaultValue:Ie(i._formValues,n,Ie(i._defaultValues,n,t.defaultValue)),exact:!0}),l=hoe({control:i,name:n,exact:!0}),u=N.useRef(i.register(n,{...t.rules,value:c,...po(t.disabled)?{disabled:t.disabled}:{}}));return N.useEffect(()=>{const d=i._options.shouldUnregister||o,f=(h,p)=>{const g=Ie(i._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=_i(Ie(i._options.defaultValues,n));mn(i._defaultValues,n,h),Jn(Ie(i._formValues,n))&&mn(i._formValues,n,h)}return()=>{(s?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,s,o]),N.useEffect(()=>{Ie(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:Ie(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:c,...po(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:N.useCallback(d=>u.current.onChange({target:{value:t3(d),name:n},type:yx.CHANGE}),[n]),onBlur:N.useCallback(()=>u.current.onBlur({target:{value:Ie(i._formValues,n),name:n},type:yx.BLUR}),[n,i]),ref:N.useCallback(d=>{const f=Ie(i._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})},[i._fields,n])},formState:l,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ie(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ie(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ie(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ie(l.validatingFields,n)},error:{enumerable:!0,get:()=>Ie(l.errors,n)}})}}const goe=t=>t.render(moe(t));var l3=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},rR=t=>({isOnSubmit:!t||t===Vo.onSubmit,isOnBlur:t===Vo.onBlur,isOnChange:t===Vo.onChange,isOnAll:t===Vo.all,isOnTouch:t===Vo.onTouched}),iR=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const mp=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const o=Ie(t,i);if(o){const{_f:s,...c}=o;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],i)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(mp(c,e))break}else if(sr(c)&&mp(c,e))break}}};var voe=(t,e,n)=>{const r=pp(Ie(t,n));return mn(r,"root",e[n]),mn(t,n,r),t},iN=t=>t.type==="file",ba=t=>typeof t=="function",xx=t=>{if(!tN)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},iy=t=>ks(t),oN=t=>t.type==="radio",bx=t=>t instanceof RegExp;const oR={value:!1,isValid:!1},sR={value:!0,isValid:!0};var u3=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!Jn(t[0].attributes.value)?Jn(t[0].value)||t[0].value===""?sR:{value:t[0].value,isValid:!0}:sR:oR}return oR};const aR={isValid:!1,value:null};var d3=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,aR):aR;function cR(t,e,n="validate"){if(iy(t)||Array.isArray(t)&&t.every(iy)||po(t)&&!t)return{type:n,message:iy(t)?t:"",ref:e}}var Fu=t=>sr(t)&&!bx(t)?t:{value:t,message:""},lR=async(t,e,n,r,i)=>{const{ref:o,refs:s,required:c,maxLength:l,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:y,disabled:b}=t._f,x=Ie(e,g);if(!y||b)return{};const w=s?s[0]:o,S=E=>{r&&w.reportValidity&&(w.setCustomValidity(po(E)?"":E||""),w.reportValidity())},C={},_=oN(o),A=xg(o),j=_||A,P=(m||iN(o))&&Jn(o.value)&&Jn(x)||xx(o)&&o.value===""||x===""||Array.isArray(x)&&!x.length,k=l3.bind(null,g,n,C),O=(E,I,D,z=oa.maxLength,$=oa.minLength)=>{const G=E?I:D;C[g]={type:E?z:$,message:G,ref:o,...k(E?z:$,G)}};if(i?!Array.isArray(x)||!x.length:c&&(!j&&(P||fi(x))||po(x)&&!x||A&&!u3(s).isValid||_&&!d3(s).isValid)){const{value:E,message:I}=iy(c)?{value:!!c,message:c}:Fu(c);if(E&&(C[g]={type:oa.required,message:I,ref:w,...k(oa.required,I)},!n))return S(I),C}if(!P&&(!fi(d)||!fi(f))){let E,I;const D=Fu(f),z=Fu(d);if(!fi(x)&&!isNaN(x)){const $=o.valueAsNumber||x&&+x;fi(D.value)||(E=$>D.value),fi(z.value)||(I=$new Date(new Date().toDateString()+" "+W),R=o.type=="time",L=o.type=="week";ks(D.value)&&x&&(E=R?G(x)>G(D.value):L?x>D.value:$>new Date(D.value)),ks(z.value)&&x&&(I=R?G(x)+E.value,z=!fi(I.value)&&x.length<+I.value;if((D||z)&&(O(D,E.message,I.message),!n))return S(C[g].message),C}if(h&&!P&&ks(x)){const{value:E,message:I}=Fu(h);if(bx(E)&&!x.match(E)&&(C[g]={type:oa.pattern,message:I,ref:o,...k(oa.pattern,I)},!n))return S(I),C}if(p){if(ba(p)){const E=await p(x,e),I=cR(E,w);if(I&&(C[g]={...I,...k(oa.validate,I.message)},!n))return S(I.message),C}else if(sr(p)){let E={};for(const I in p){if(!Ai(E)&&!n)break;const D=cR(await p[I](x,e),w,I);D&&(E={...D,...k(I,D.message)},S(D.message),n&&(C[g]=E))}if(!Ai(E)&&(C[g]={ref:w,...E},!n))return C}}return S(!0),C};function yoe(t,e){const n=e.slice(0,-1).length;let r=0;for(;r{let t=[];return{get observers(){return t},next:i=>{for(const o of t)o.next&&o.next(i)},subscribe:i=>(t.push(i),{unsubscribe:()=>{t=t.filter(o=>o!==i)}}),unsubscribe:()=>{t=[]}}},pA=t=>fi(t)||!e3(t);function uc(t,e){if(pA(t)||pA(e))return t===e;if(Ml(t)&&Ml(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const i of n){const o=t[i];if(!r.includes(i))return!1;if(i!=="ref"){const s=e[i];if(Ml(o)&&Ml(s)||sr(o)&&sr(s)||Array.isArray(o)&&Array.isArray(s)?!uc(o,s):o!==s)return!1}}return!0}var f3=t=>t.type==="select-multiple",boe=t=>oN(t)||xg(t),GS=t=>xx(t)&&t.isConnected,h3=t=>{for(const e in t)if(ba(t[e]))return!0;return!1};function wx(t,e={}){const n=Array.isArray(t);if(sr(t)||n)for(const r in t)Array.isArray(t[r])||sr(t[r])&&!h3(t[r])?(e[r]=Array.isArray(t[r])?[]:{},wx(t[r],e[r])):fi(t[r])||(e[r]=!0);return e}function p3(t,e,n){const r=Array.isArray(t);if(sr(t)||r)for(const i in t)Array.isArray(t[i])||sr(t[i])&&!h3(t[i])?Jn(e)||pA(n[i])?n[i]=Array.isArray(t[i])?wx(t[i],[]):{...wx(t[i])}:p3(t[i],fi(e)?{}:e[i],n[i]):n[i]=!uc(t[i],e[i]);return n}var jh=(t,e)=>p3(t,e,wx(e)),m3=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>Jn(t)?t:e?t===""?NaN:t&&+t:n&&ks(t)?new Date(t):r?r(t):t;function VS(t){const e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return iN(e)?e.files:oN(e)?d3(t.refs).value:f3(e)?[...e.selectedOptions].map(({value:n})=>n):xg(e)?u3(t.refs).value:m3(Jn(e.value)?t.ref.value:e.value,t)}var woe=(t,e,n,r)=>{const i={};for(const o of t){const s=Ie(e,o);s&&mn(i,o,s._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},Eh=t=>Jn(t)?t:bx(t)?t.source:sr(t)?bx(t.value)?t.value.source:t.value:t;const uR="AsyncFunction";var Soe=t=>(!t||!t.validate)&&!!(ba(t.validate)&&t.validate.constructor.name===uR||sr(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===uR)),Coe=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function dR(t,e,n){const r=Ie(t,n);if(r||nN(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),s=Ie(e,o),c=Ie(t,o);if(s&&!Array.isArray(s)&&n!==o)return{name:n};if(c&&c.type)return{name:o,error:c};i.pop()}return{name:n}}var _oe=(t,e,n,r,i)=>i.isOnAll?!1:!n&&i.isOnTouch?!(e||t):(n?r.isOnBlur:i.isOnBlur)?!t:(n?r.isOnChange:i.isOnChange)?t:!0,Aoe=(t,e)=>!U0(Ie(t,e)).length&&yr(t,e);const joe={mode:Vo.onSubmit,reValidateMode:Vo.onChange,shouldFocusError:!0};function Eoe(t={}){let e={...joe,...t},n={submitCount:0,isDirty:!1,isLoading:ba(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=sr(e.defaultValues)||sr(e.values)?_i(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:_i(i),s={action:!1,mount:!1,watch:!1},c={mount:new Set,unMount:new Set,array:new Set,watch:new Set},l,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:zS(),array:zS(),state:zS()},h=rR(e.mode),p=rR(e.reValidateMode),g=e.criteriaMode===Vo.all,m=T=>M=>{clearTimeout(u),u=setTimeout(T,M)},y=async T=>{if(!t.disabled&&(d.isValid||T)){const M=e.resolver?Ai((await j()).errors):await k(r,!0);M!==n.isValid&&f.state.next({isValid:M})}},b=(T,M)=>{!t.disabled&&(d.isValidating||d.validatingFields)&&((T||Array.from(c.mount)).forEach(U=>{U&&(M?mn(n.validatingFields,U,M):yr(n.validatingFields,U))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Ai(n.validatingFields)}))},x=(T,M=[],U,V,Q=!0,B=!0)=>{if(V&&U&&!t.disabled){if(s.action=!0,B&&Array.isArray(Ie(r,T))){const X=U(Ie(r,T),V.argA,V.argB);Q&&mn(r,T,X)}if(B&&Array.isArray(Ie(n.errors,T))){const X=U(Ie(n.errors,T),V.argA,V.argB);Q&&mn(n.errors,T,X),Aoe(n.errors,T)}if(d.touchedFields&&B&&Array.isArray(Ie(n.touchedFields,T))){const X=U(Ie(n.touchedFields,T),V.argA,V.argB);Q&&mn(n.touchedFields,T,X)}d.dirtyFields&&(n.dirtyFields=jh(i,o)),f.state.next({name:T,isDirty:E(T,M),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else mn(o,T,M)},w=(T,M)=>{mn(n.errors,T,M),f.state.next({errors:n.errors})},S=T=>{n.errors=T,f.state.next({errors:n.errors,isValid:!1})},C=(T,M,U,V)=>{const Q=Ie(r,T);if(Q){const B=Ie(o,T,Jn(U)?Ie(i,T):U);Jn(B)||V&&V.defaultChecked||M?mn(o,T,M?B:VS(Q._f)):z(T,B),s.mount&&y()}},_=(T,M,U,V,Q)=>{let B=!1,X=!1;const ge={name:T};if(!t.disabled){const xe=!!(Ie(r,T)&&Ie(r,T)._f&&Ie(r,T)._f.disabled);if(!U||V){d.isDirty&&(X=n.isDirty,n.isDirty=ge.isDirty=E(),B=X!==ge.isDirty);const Re=xe||uc(Ie(i,T),M);X=!!(!xe&&Ie(n.dirtyFields,T)),Re||xe?yr(n.dirtyFields,T):mn(n.dirtyFields,T,!0),ge.dirtyFields=n.dirtyFields,B=B||d.dirtyFields&&X!==!Re}if(U){const Re=Ie(n.touchedFields,T);Re||(mn(n.touchedFields,T,U),ge.touchedFields=n.touchedFields,B=B||d.touchedFields&&Re!==U)}B&&Q&&f.state.next(ge)}return B?ge:{}},A=(T,M,U,V)=>{const Q=Ie(n.errors,T),B=d.isValid&&po(M)&&n.isValid!==M;if(t.delayError&&U?(l=m(()=>w(T,U)),l(t.delayError)):(clearTimeout(u),l=null,U?mn(n.errors,T,U):yr(n.errors,T)),(U?!uc(Q,U):Q)||!Ai(V)||B){const X={...V,...B&&po(M)?{isValid:M}:{},errors:n.errors,name:T};n={...n,...X},f.state.next(X)}},j=async T=>{b(T,!0);const M=await e.resolver(o,e.context,woe(T||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return b(T),M},P=async T=>{const{errors:M}=await j(T);if(T)for(const U of T){const V=Ie(M,U);V?mn(n.errors,U,V):yr(n.errors,U)}else n.errors=M;return M},k=async(T,M,U={valid:!0})=>{for(const V in T){const Q=T[V];if(Q){const{_f:B,...X}=Q;if(B){const ge=c.array.has(B.name),xe=Q._f&&Soe(Q._f);xe&&d.validatingFields&&b([V],!0);const Re=await lR(Q,o,g,e.shouldUseNativeValidation&&!M,ge);if(xe&&d.validatingFields&&b([V]),Re[B.name]&&(U.valid=!1,M))break;!M&&(Ie(Re,B.name)?ge?voe(n.errors,Re,B.name):mn(n.errors,B.name,Re[B.name]):yr(n.errors,B.name))}!Ai(X)&&await k(X,M,U)}}return U.valid},O=()=>{for(const T of c.unMount){const M=Ie(r,T);M&&(M._f.refs?M._f.refs.every(U=>!GS(U)):!GS(M._f.ref))&&ne(T)}c.unMount=new Set},E=(T,M)=>!t.disabled&&(T&&M&&mn(o,T,M),!uc(Y(),i)),I=(T,M,U)=>c3(T,c,{...s.mount?o:Jn(M)?i:ks(T)?{[T]:M}:M},U,M),D=T=>U0(Ie(s.mount?o:i,T,t.shouldUnregister?Ie(i,T,[]):[])),z=(T,M,U={})=>{const V=Ie(r,T);let Q=M;if(V){const B=V._f;B&&(!B.disabled&&mn(o,T,m3(M,B)),Q=xx(B.ref)&&fi(M)?"":M,f3(B.ref)?[...B.ref.options].forEach(X=>X.selected=Q.includes(X.value)):B.refs?xg(B.ref)?B.refs.length>1?B.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(Q)?!!Q.find(ge=>ge===X.value):Q===X.value)):B.refs[0]&&(B.refs[0].checked=!!Q):B.refs.forEach(X=>X.checked=X.value===Q):iN(B.ref)?B.ref.value="":(B.ref.value=Q,B.ref.type||f.values.next({name:T,values:{...o}})))}(U.shouldDirty||U.shouldTouch)&&_(T,Q,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&W(T)},$=(T,M,U)=>{for(const V in M){const Q=M[V],B=`${T}.${V}`,X=Ie(r,B);(c.array.has(T)||sr(Q)||X&&!X._f)&&!Ml(Q)?$(B,Q,U):z(B,Q,U)}},G=(T,M,U={})=>{const V=Ie(r,T),Q=c.array.has(T),B=_i(M);mn(o,T,B),Q?(f.array.next({name:T,values:{...o}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&f.state.next({name:T,dirtyFields:jh(i,o),isDirty:E(T,B)})):V&&!V._f&&!fi(B)?$(T,B,U):z(T,B,U),iR(T,c)&&f.state.next({...n}),f.values.next({name:s.mount?T:void 0,values:{...o}})},R=async T=>{s.mount=!0;const M=T.target;let U=M.name,V=!0;const Q=Ie(r,U),B=()=>M.type?VS(Q._f):t3(T),X=ge=>{V=Number.isNaN(ge)||Ml(ge)&&isNaN(ge.getTime())||uc(ge,Ie(o,U,ge))};if(Q){let ge,xe;const Re=B(),be=T.type===yx.BLUR||T.type===yx.FOCUS_OUT,Ve=!Coe(Q._f)&&!e.resolver&&!Ie(n.errors,U)&&!Q._f.deps||_oe(be,Ie(n.touchedFields,U),n.isSubmitted,p,h),st=iR(U,c,be);mn(o,U,Re),be?(Q._f.onBlur&&Q._f.onBlur(T),l&&l(0)):Q._f.onChange&&Q._f.onChange(T);const kt=_(U,Re,be,!1),Ke=!Ai(kt)||st;if(!be&&f.values.next({name:U,type:T.type,values:{...o}}),Ve)return d.isValid&&(t.mode==="onBlur"?be&&y():y()),Ke&&f.state.next({name:U,...st?{}:kt});if(!be&&st&&f.state.next({...n}),e.resolver){const{errors:tt}=await j([U]);if(X(Re),V){const Nt=dR(n.errors,r,U),sn=dR(tt,r,Nt.name||U);ge=sn.error,U=sn.name,xe=Ai(tt)}}else b([U],!0),ge=(await lR(Q,o,g,e.shouldUseNativeValidation))[U],b([U]),X(Re),V&&(ge?xe=!1:d.isValid&&(xe=await k(r,!0)));V&&(Q._f.deps&&W(Q._f.deps),A(U,xe,ge,kt))}},L=(T,M)=>{if(Ie(n.errors,M)&&T.focus)return T.focus(),1},W=async(T,M={})=>{let U,V;const Q=pp(T);if(e.resolver){const B=await P(Jn(T)?T:Q);U=Ai(B),V=T?!Q.some(X=>Ie(B,X)):U}else T?(V=(await Promise.all(Q.map(async B=>{const X=Ie(r,B);return await k(X&&X._f?{[B]:X}:X)}))).every(Boolean),!(!V&&!n.isValid)&&y()):V=U=await k(r);return f.state.next({...!ks(T)||d.isValid&&U!==n.isValid?{}:{name:T},...e.resolver||!T?{isValid:U}:{},errors:n.errors}),M.shouldFocus&&!V&&mp(r,L,T?Q:c.mount),V},Y=T=>{const M={...s.mount?o:i};return Jn(T)?M:ks(T)?Ie(M,T):T.map(U=>Ie(M,U))},te=(T,M)=>({invalid:!!Ie((M||n).errors,T),isDirty:!!Ie((M||n).dirtyFields,T),error:Ie((M||n).errors,T),isValidating:!!Ie(n.validatingFields,T),isTouched:!!Ie((M||n).touchedFields,T)}),me=T=>{T&&pp(T).forEach(M=>yr(n.errors,M)),f.state.next({errors:T?n.errors:{}})},F=(T,M,U)=>{const V=(Ie(r,T,{_f:{}})._f||{}).ref,Q=Ie(n.errors,T)||{},{ref:B,message:X,type:ge,...xe}=Q;mn(n.errors,T,{...xe,...M,ref:V}),f.state.next({name:T,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&V&&V.focus&&V.focus()},se=(T,M)=>ba(T)?f.values.subscribe({next:U=>T(I(void 0,M),U)}):I(T,M,!0),ne=(T,M={})=>{for(const U of T?pp(T):c.mount)c.mount.delete(U),c.array.delete(U),M.keepValue||(yr(r,U),yr(o,U)),!M.keepError&&yr(n.errors,U),!M.keepDirty&&yr(n.dirtyFields,U),!M.keepTouched&&yr(n.touchedFields,U),!M.keepIsValidating&&yr(n.validatingFields,U),!e.shouldUnregister&&!M.keepDefaultValue&&yr(i,U);f.values.next({values:{...o}}),f.state.next({...n,...M.keepDirty?{isDirty:E()}:{}}),!M.keepIsValid&&y()},ae=({disabled:T,name:M,field:U,fields:V,value:Q})=>{if(po(T)&&s.mount||T){const B=T?void 0:Jn(Q)?VS(U?U._f:Ie(V,M)._f):Q;mn(o,M,B),_(M,B,!1,!1,!0)}},De=(T,M={})=>{let U=Ie(r,T);const V=po(M.disabled)||po(t.disabled);return mn(r,T,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:T}},name:T,mount:!0,...M}}),c.mount.add(T),U?ae({field:U,disabled:po(M.disabled)?M.disabled:t.disabled,name:T,value:M.value}):C(T,!0,M.value),{...V?{disabled:M.disabled||t.disabled}:{},...e.progressive?{required:!!M.required,min:Eh(M.min),max:Eh(M.max),minLength:Eh(M.minLength),maxLength:Eh(M.maxLength),pattern:Eh(M.pattern)}:{},name:T,onChange:R,onBlur:R,ref:Q=>{if(Q){De(T,M),U=Ie(r,T);const B=Jn(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,X=boe(B),ge=U._f.refs||[];if(X?ge.find(xe=>xe===B):B===U._f.ref)return;mn(r,T,{_f:{...U._f,...X?{refs:[...ge.filter(GS),B,...Array.isArray(Ie(i,T))?[{}]:[]],ref:{type:B.type,name:T}}:{ref:B}}}),C(T,!1,void 0,B)}else U=Ie(r,T,{}),U._f&&(U._f.mount=!1),(e.shouldUnregister||M.shouldUnregister)&&!(n3(c.array,T)&&s.action)&&c.unMount.add(T)}}},de=()=>e.shouldFocusError&&mp(r,L,c.mount),ye=T=>{po(T)&&(f.state.next({disabled:T}),mp(r,(M,U)=>{const V=Ie(r,U);V&&(M.disabled=V._f.disabled||T,Array.isArray(V._f.refs)&&V._f.refs.forEach(Q=>{Q.disabled=V._f.disabled||T}))},0,!1))},Ee=(T,M)=>async U=>{let V;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let Q=_i(o);if(f.state.next({isSubmitting:!0}),e.resolver){const{errors:B,values:X}=await j();n.errors=B,Q=X}else await k(r);if(yr(n.errors,"root"),Ai(n.errors)){f.state.next({errors:{}});try{await T(Q,U)}catch(B){V=B}}else M&&await M({...n.errors},U),de(),setTimeout(de);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Ai(n.errors)&&!V,submitCount:n.submitCount+1,errors:n.errors}),V)throw V},Z=(T,M={})=>{Ie(r,T)&&(Jn(M.defaultValue)?G(T,_i(Ie(i,T))):(G(T,M.defaultValue),mn(i,T,_i(M.defaultValue))),M.keepTouched||yr(n.touchedFields,T),M.keepDirty||(yr(n.dirtyFields,T),n.isDirty=M.defaultValue?E(T,_i(Ie(i,T))):E()),M.keepError||(yr(n.errors,T),d.isValid&&y()),f.state.next({...n}))},ct=(T,M={})=>{const U=T?_i(T):i,V=_i(U),Q=Ai(T),B=Q?i:V;if(M.keepDefaultValues||(i=U),!M.keepValues){if(M.keepDirtyValues){const X=new Set([...c.mount,...Object.keys(jh(i,o))]);for(const ge of Array.from(X))Ie(n.dirtyFields,ge)?mn(B,ge,Ie(o,ge)):G(ge,Ie(B,ge))}else{if(tN&&Jn(T))for(const X of c.mount){const ge=Ie(r,X);if(ge&&ge._f){const xe=Array.isArray(ge._f.refs)?ge._f.refs[0]:ge._f.ref;if(xx(xe)){const Re=xe.closest("form");if(Re){Re.reset();break}}}}r={}}o=t.shouldUnregister?M.keepDefaultValues?_i(i):{}:_i(B),f.array.next({values:{...B}}),f.values.next({values:{...B}})}c={mount:M.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!M.keepIsValid||!!M.keepDirtyValues,s.watch=!!t.shouldUnregister,f.state.next({submitCount:M.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:M.keepDirty?n.isDirty:!!(M.keepDefaultValues&&!uc(T,i)),isSubmitted:M.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:M.keepDirtyValues?M.keepDefaultValues&&o?jh(i,o):n.dirtyFields:M.keepDefaultValues&&T?jh(i,T):M.keepDirty?n.dirtyFields:{},touchedFields:M.keepTouched?n.touchedFields:{},errors:M.keepErrors?n.errors:{},isSubmitSuccessful:M.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Le=(T,M)=>ct(ba(T)?T(o):T,M);return{control:{register:De,unregister:ne,getFieldState:te,handleSubmit:Ee,setError:F,_executeSchema:j,_getWatch:I,_getDirty:E,_updateValid:y,_removeUnmounted:O,_updateFieldArray:x,_updateDisabledField:ae,_getFieldArray:D,_reset:ct,_resetDefaultValues:()=>ba(e.defaultValues)&&e.defaultValues().then(T=>{Le(T,e.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:T=>{n={...n,...T}},_disableForm:ye,_subjects:f,_proxyFormState:d,_setErrors:S,get _fields(){return r},get _formValues(){return o},get _state(){return s},set _state(T){s=T},get _defaultValues(){return i},get _names(){return c},set _names(T){c=T},get _formState(){return n},set _formState(T){n=T},get _options(){return e},set _options(T){e={...e,...T}}},trigger:W,register:De,handleSubmit:Ee,watch:se,setValue:G,getValues:Y,reset:Le,resetField:Z,clearErrors:me,unregister:ne,setError:F,setFocus:(T,M={})=>{const U=Ie(r,T),V=U&&U._f;if(V){const Q=V.refs?V.refs[0]:V.ref;Q.focus&&(Q.focus(),M.shouldSelect&&Q.select())}},getFieldState:te}}function z0(t={}){const e=N.useRef(),n=N.useRef(),[r,i]=N.useState({isDirty:!1,isValidating:!1,isLoading:ba(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:ba(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...Eoe(t),formState:r});const o=e.current.control;return o._options=t,rN({subject:o._subjects.state,next:s=>{s3(s,o._proxyFormState,o._updateFormState,!0)&&i({...o._formState})}}),N.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),N.useEffect(()=>{if(o._proxyFormState.isDirty){const s=o._getDirty();s!==r.isDirty&&o._subjects.state.next({isDirty:s})}},[o,r.isDirty]),N.useEffect(()=>{t.values&&!uc(t.values,n.current)?(o._reset(t.values,o._options.resetOptions),n.current=t.values,i(s=>({...s}))):o._resetDefaultValues()},[t.values,o]),N.useEffect(()=>{t.errors&&o._setErrors(t.errors)},[t.errors,o]),N.useEffect(()=>{o._state.mount||(o._updateValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),N.useEffect(()=>{t.shouldUnregister&&o._subjects.values.next({values:o._getWatch()})},[t.shouldUnregister,o]),N.useEffect(()=>{e.current&&(e.current.watch=e.current.watch.bind({}))},[r]),e.current.formState=o3(r,o),e.current}const fR=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Ie(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},g3=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?fR(r.ref,n,t):r.refs&&r.refs.forEach(i=>fR(i,n,t))}},Toe=(t,e)=>{e.shouldUseNativeValidation&&g3(t,e);const n={};for(const r in t){const i=Ie(e.fields,r),o=Object.assign(t[r]||{},{ref:i&&i.ref});if(Noe(e.names||Object.keys(t),r)){const s=Object.assign({},Ie(n,r));mn(s,"root",o),mn(n,r,s)}else mn(n,r,o)}return n},Noe=(t,e)=>t.some(n=>n.startsWith(e+"."));var Poe=function(t,e){for(var n={};t.length;){var r=t[0],i=r.code,o=r.message,s=r.path.join(".");if(!n[s])if("unionErrors"in r){var c=r.unionErrors[0].errors[0];n[s]={message:c.message,type:c.code}}else n[s]={message:o,type:i};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return t.push(f)})}),e){var l=n[s].types,u=l&&l[r.code];n[s]=l3(s,e,n,i,u?[].concat(u,r.message):r.message)}t.shift()}return n},G0=function(t,e,n){return n===void 0&&(n={}),function(r,i,o){try{return Promise.resolve(function(s,c){try{var l=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(u){return o.shouldUseNativeValidation&&g3({},o),{errors:{},values:n.raw?r:u}})}catch(u){return c(u)}return l&&l.then?l.then(void 0,c):l}(0,function(s){if(function(c){return Array.isArray(c==null?void 0:c.errors)}(s))return{values:{},errors:Toe(Poe(s.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw s}))}catch(s){return Promise.reject(s)}}},nn;(function(t){t.assertEqual=i=>i;function e(i){}t.assertIs=e;function n(i){throw new Error}t.assertNever=n,t.arrayToEnum=i=>{const o={};for(const s of i)o[s]=s;return o},t.getValidEnumValues=i=>{const o=t.objectKeys(i).filter(c=>typeof i[i[c]]!="number"),s={};for(const c of o)s[c]=i[c];return t.objectValues(s)},t.objectValues=i=>t.objectKeys(i).map(function(o){return i[o]}),t.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const s in i)Object.prototype.hasOwnProperty.call(i,s)&&o.push(s);return o},t.find=(i,o)=>{for(const s of i)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}t.joinValues=r,t.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(nn||(nn={}));var mA;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(mA||(mA={}));const Ye=nn.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),dc=t=>{switch(typeof t){case"undefined":return Ye.undefined;case"string":return Ye.string;case"number":return isNaN(t)?Ye.nan:Ye.number;case"boolean":return Ye.boolean;case"function":return Ye.function;case"bigint":return Ye.bigint;case"symbol":return Ye.symbol;case"object":return Array.isArray(t)?Ye.array:t===null?Ye.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Ye.promise:typeof Map<"u"&&t instanceof Map?Ye.map:typeof Set<"u"&&t instanceof Set?Ye.set:typeof Date<"u"&&t instanceof Date?Ye.date:Ye.object;default:return Ye.unknown}},_e=nn.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),koe=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class eo extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const n=e||function(o){return o.message},r={_errors:[]},i=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(i);else if(s.code==="invalid_return_type")i(s.returnTypeError);else if(s.code==="invalid_arguments")i(s.argumentsError);else if(s.path.length===0)r._errors.push(n(s));else{let c=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}eo.create=t=>new eo(t);const Zd=(t,e)=>{let n;switch(t.code){case _e.invalid_type:t.received===Ye.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case _e.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,nn.jsonStringifyReplacer)}`;break;case _e.unrecognized_keys:n=`Unrecognized key(s) in object: ${nn.joinValues(t.keys,", ")}`;break;case _e.invalid_union:n="Invalid input";break;case _e.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${nn.joinValues(t.options)}`;break;case _e.invalid_enum_value:n=`Invalid enum value. Expected ${nn.joinValues(t.options)}, received '${t.received}'`;break;case _e.invalid_arguments:n="Invalid function arguments";break;case _e.invalid_return_type:n="Invalid function return type";break;case _e.invalid_date:n="Invalid date";break;case _e.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:nn.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case _e.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case _e.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case _e.custom:n="Invalid input";break;case _e.invalid_intersection_types:n="Intersection results could not be merged";break;case _e.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case _e.not_finite:n="Number must be finite";break;default:n=e.defaultError,nn.assertNever(t)}return{message:n}};let v3=Zd;function Ooe(t){v3=t}function Sx(){return v3}const Cx=t=>{const{data:e,path:n,errorMaps:r,issueData:i}=t,o=[...n,...i.path||[]],s={...i,path:o};if(i.message!==void 0)return{...i,path:o,message:i.message};let c="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)c=u(s,{data:e,defaultError:c}).message;return{...i,path:o,message:c}},Ioe=[];function ze(t,e){const n=Sx(),r=Cx({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Zd?void 0:Zd].filter(i=>!!i)});t.common.issues.push(r)}class oi{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const i of n){if(i.status==="aborted")return Tt;i.status==="dirty"&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const i of n){const o=await i.key,s=await i.value;r.push({key:o,value:s})}return oi.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const i of n){const{key:o,value:s}=i;if(o.status==="aborted"||s.status==="aborted")return Tt;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||i.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}}const Tt=Object.freeze({status:"aborted"}),cd=t=>({status:"dirty",value:t}),xi=t=>({status:"valid",value:t}),gA=t=>t.status==="aborted",vA=t=>t.status==="dirty",rm=t=>t.status==="valid",im=t=>typeof Promise<"u"&&t instanceof Promise;function _x(t,e,n,r){if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function y3(t,e,n,r,i){if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var at;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(at||(at={}));var Kh,Wh;class Ks{constructor(e,n,r,i){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const hR=(t,e)=>{if(rm(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new eo(t.common.issues);return this._error=n,this._error}}};function Lt(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:i}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:i}:{errorMap:(s,c)=>{var l,u;const{message:d}=t;return s.code==="invalid_enum_value"?{message:d??c.defaultError}:typeof c.data>"u"?{message:(l=d??r)!==null&&l!==void 0?l:c.defaultError}:s.code!=="invalid_type"?{message:c.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:c.defaultError}},description:i}}class Wt{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return dc(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:dc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new oi,ctx:{common:e.parent.common,data:e.data,parsedType:dc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(im(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dc(e)},o=this._parseSync({data:e,path:i.path,parent:i});return hR(i,o)}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:dc(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(im(i)?i:Promise.resolve(i));return hR(r,o)}refine(e,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const s=e(i),c=()=>o.addIssue({code:_e.custom,...r(i)});return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,n){return this._refinement((r,i)=>e(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(e){return new ds({schema:this,typeName:jt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ls.create(this,this._def)}nullable(){return tl.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return es.create(this,this._def)}promise(){return tf.create(this,this._def)}or(e){return cm.create([this,e],this._def)}and(e){return lm.create(this,e,this._def)}transform(e){return new ds({...Lt(this._def),schema:this,typeName:jt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new pm({...Lt(this._def),innerType:this,defaultValue:n,typeName:jt.ZodDefault})}brand(){return new sN({typeName:jt.ZodBranded,type:this,...Lt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new mm({...Lt(this._def),innerType:this,catchValue:n,typeName:jt.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return bg.create(this,e)}readonly(){return gm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Roe=/^c[^\s-]{8,}$/i,Moe=/^[0-9a-z]+$/,Doe=/^[0-9A-HJKMNP-TV-Z]{26}$/,$oe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Loe=/^[a-z0-9_-]{21}$/i,Foe=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Boe=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Uoe="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let KS;const Hoe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zoe=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Goe=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x3="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Voe=new RegExp(`^${x3}$`);function b3(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Koe(t){return new RegExp(`^${b3(t)}$`)}function w3(t){let e=`${x3}T${b3(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Woe(t,e){return!!((e==="v4"||!e)&&Hoe.test(t)||(e==="v6"||!e)&&zoe.test(t))}class qo extends Wt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Ye.string){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:Ye.string,received:o.parsedType}),Tt}const r=new oi;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),ze(i,{code:_e.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const s=e.data.length>o.value,c=e.data.lengthe.test(i),{validation:n,code:_e.invalid_string,...at.errToObj(r)})}_addCheck(e){return new qo({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...at.errToObj(e)})}url(e){return this._addCheck({kind:"url",...at.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...at.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...at.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...at.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...at.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...at.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...at.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...at.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...at.errToObj(e)})}datetime(e){var n,r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1,...at.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...at.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...at.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...at.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...at.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...at.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...at.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...at.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...at.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...at.errToObj(n)})}nonempty(e){return this.min(1,at.errToObj(e))}trim(){return new qo({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new qo({checks:[],typeName:jt.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Lt(t)})};function qoe(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(t.toFixed(i).replace(".","")),s=parseInt(e.toFixed(i).replace(".",""));return o%s/Math.pow(10,i)}class Jc extends Wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Ye.number){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:Ye.number,received:o.parsedType}),Tt}let r;const i=new oi;for(const o of this._def.checks)o.kind==="int"?nn.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?qoe(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_finite,message:o.message}),i.dirty()):nn.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,at.toString(n))}gt(e,n){return this.setLimit("min",e,!1,at.toString(n))}lte(e,n){return this.setLimit("max",e,!0,at.toString(n))}lt(e,n){return this.setLimit("max",e,!1,at.toString(n))}setLimit(e,n,r,i){return new Jc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:at.toString(i)}]})}_addCheck(e){return new Jc({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:at.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:at.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:at.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:at.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:at.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:at.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:at.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:at.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:at.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&nn.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.valuenew Jc({checks:[],typeName:jt.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Lt(t)});class Zc extends Wt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==Ye.bigint){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:Ye.bigint,received:o.parsedType}),Tt}let r;const i=new oi;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),ze(r,{code:_e.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):nn.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,at.toString(n))}gt(e,n){return this.setLimit("min",e,!1,at.toString(n))}lte(e,n){return this.setLimit("max",e,!0,at.toString(n))}lt(e,n){return this.setLimit("max",e,!1,at.toString(n))}setLimit(e,n,r,i){return new Zc({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:at.toString(i)}]})}_addCheck(e){return new Zc({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:at.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:at.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:at.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:at.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:at.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value{var e;return new Zc({checks:[],typeName:jt.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...Lt(t)})};class om extends Wt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Ye.boolean){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.boolean,received:r.parsedType}),Tt}return xi(e.data)}}om.create=t=>new om({typeName:jt.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Lt(t)});class gu extends Wt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Ye.date){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_type,expected:Ye.date,received:o.parsedType}),Tt}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return ze(o,{code:_e.invalid_date}),Tt}const r=new oi;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),ze(i,{code:_e.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):nn.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new gu({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:at.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:at.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew gu({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:jt.ZodDate,...Lt(t)});class Ax extends Wt{_parse(e){if(this._getType(e)!==Ye.symbol){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.symbol,received:r.parsedType}),Tt}return xi(e.data)}}Ax.create=t=>new Ax({typeName:jt.ZodSymbol,...Lt(t)});class sm extends Wt{_parse(e){if(this._getType(e)!==Ye.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.undefined,received:r.parsedType}),Tt}return xi(e.data)}}sm.create=t=>new sm({typeName:jt.ZodUndefined,...Lt(t)});class am extends Wt{_parse(e){if(this._getType(e)!==Ye.null){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.null,received:r.parsedType}),Tt}return xi(e.data)}}am.create=t=>new am({typeName:jt.ZodNull,...Lt(t)});class ef extends Wt{constructor(){super(...arguments),this._any=!0}_parse(e){return xi(e.data)}}ef.create=t=>new ef({typeName:jt.ZodAny,...Lt(t)});class Yl extends Wt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xi(e.data)}}Yl.create=t=>new Yl({typeName:jt.ZodUnknown,...Lt(t)});class La extends Wt{_parse(e){const n=this._getOrReturnCtx(e);return ze(n,{code:_e.invalid_type,expected:Ye.never,received:n.parsedType}),Tt}}La.create=t=>new La({typeName:jt.ZodNever,...Lt(t)});class jx extends Wt{_parse(e){if(this._getType(e)!==Ye.undefined){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.void,received:r.parsedType}),Tt}return xi(e.data)}}jx.create=t=>new jx({typeName:jt.ZodVoid,...Lt(t)});class es extends Wt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==Ye.array)return ze(n,{code:_e.invalid_type,expected:Ye.array,received:n.parsedType}),Tt;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,c=n.data.lengthi.maxLength.value&&(ze(n,{code:_e.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((s,c)=>i.type._parseAsync(new Ks(n,s,n.path,c)))).then(s=>oi.mergeArray(r,s));const o=[...n.data].map((s,c)=>i.type._parseSync(new Ks(n,s,n.path,c)));return oi.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new es({...this._def,minLength:{value:e,message:at.toString(n)}})}max(e,n){return new es({...this._def,maxLength:{value:e,message:at.toString(n)}})}length(e,n){return new es({...this._def,exactLength:{value:e,message:at.toString(n)}})}nonempty(e){return this.min(1,e)}}es.create=(t,e)=>new es({type:t,minLength:null,maxLength:null,exactLength:null,typeName:jt.ZodArray,...Lt(e)});function Yu(t){if(t instanceof Vn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ls.create(Yu(r))}return new Vn({...t._def,shape:()=>e})}else return t instanceof es?new es({...t._def,type:Yu(t.element)}):t instanceof Ls?Ls.create(Yu(t.unwrap())):t instanceof tl?tl.create(Yu(t.unwrap())):t instanceof Ws?Ws.create(t.items.map(e=>Yu(e))):t}class Vn extends Wt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=nn.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==Ye.object){const u=this._getOrReturnCtx(e);return ze(u,{code:_e.invalid_type,expected:Ye.object,received:u.parsedType}),Tt}const{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof La&&this._def.unknownKeys==="strip"))for(const u in i.data)s.includes(u)||c.push(u);const l=[];for(const u of s){const d=o[u],f=i.data[u];l.push({key:{status:"valid",value:u},value:d._parse(new Ks(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof La){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of c)l.push({key:{status:"valid",value:d},value:{status:"valid",value:i.data[d]}});else if(u==="strict")c.length>0&&(ze(i,{code:_e.unrecognized_keys,keys:c}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const d of c){const f=i.data[d];l.push({key:{status:"valid",value:d},value:u._parse(new Ks(i,f,i.path,d)),alwaysSet:d in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of l){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>oi.mergeObjectSync(r,u)):oi.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return at.errToObj,new Vn({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o,s,c;const l=(s=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&s!==void 0?s:r.defaultError;return n.code==="unrecognized_keys"?{message:(c=at.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Vn({...this._def,unknownKeys:"strip"})}passthrough(){return new Vn({...this._def,unknownKeys:"passthrough"})}extend(e){return new Vn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Vn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:jt.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Vn({...this._def,catchall:e})}pick(e){const n={};return nn.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Vn({...this._def,shape:()=>n})}omit(e){const n={};return nn.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new Vn({...this._def,shape:()=>n})}deepPartial(){return Yu(this)}partial(e){const n={};return nn.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new Vn({...this._def,shape:()=>n})}required(e){const n={};return nn.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ls;)o=o._def.innerType;n[r]=o}}),new Vn({...this._def,shape:()=>n})}keyof(){return S3(nn.objectKeys(this.shape))}}Vn.create=(t,e)=>new Vn({shape:()=>t,unknownKeys:"strip",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});Vn.strictCreate=(t,e)=>new Vn({shape:()=>t,unknownKeys:"strict",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});Vn.lazycreate=(t,e)=>new Vn({shape:t,unknownKeys:"strip",catchall:La.create(),typeName:jt.ZodObject,...Lt(e)});class cm extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function i(o){for(const c of o)if(c.result.status==="valid")return c.result;for(const c of o)if(c.result.status==="dirty")return n.common.issues.push(...c.ctx.common.issues),c.result;const s=o.map(c=>new eo(c.ctx.common.issues));return ze(n,{code:_e.invalid_union,unionErrors:s}),Tt}if(n.common.async)return Promise.all(r.map(async o=>{const s={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:s}),ctx:s}})).then(i);{let o;const s=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=l._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!o&&(o={result:d,ctx:u}),u.common.issues.length&&s.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const c=s.map(l=>new eo(l));return ze(n,{code:_e.invalid_union,unionErrors:c}),Tt}}get options(){return this._def.options}}cm.create=(t,e)=>new cm({options:t,typeName:jt.ZodUnion,...Lt(e)});const ca=t=>t instanceof dm?ca(t.schema):t instanceof ds?ca(t.innerType()):t instanceof fm?[t.value]:t instanceof el?t.options:t instanceof hm?nn.objectValues(t.enum):t instanceof pm?ca(t._def.innerType):t instanceof sm?[void 0]:t instanceof am?[null]:t instanceof Ls?[void 0,...ca(t.unwrap())]:t instanceof tl?[null,...ca(t.unwrap())]:t instanceof sN||t instanceof gm?ca(t.unwrap()):t instanceof mm?ca(t._def.innerType):[];class V0 extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.object)return ze(n,{code:_e.invalid_type,expected:Ye.object,received:n.parsedType}),Tt;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(ze(n,{code:_e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Tt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const i=new Map;for(const o of n){const s=ca(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const c of s){if(i.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);i.set(c,o)}}return new V0({typeName:jt.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...Lt(r)})}}function yA(t,e){const n=dc(t),r=dc(e);if(t===e)return{valid:!0,data:t};if(n===Ye.object&&r===Ye.object){const i=nn.objectKeys(e),o=nn.objectKeys(t).filter(c=>i.indexOf(c)!==-1),s={...t,...e};for(const c of o){const l=yA(t[c],e[c]);if(!l.valid)return{valid:!1};s[c]=l.data}return{valid:!0,data:s}}else if(n===Ye.array&&r===Ye.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(gA(o)||gA(s))return Tt;const c=yA(o.value,s.value);return c.valid?((vA(o)||vA(s))&&n.dirty(),{status:n.value,value:c.data}):(ze(r,{code:_e.invalid_intersection_types}),Tt)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,s])=>i(o,s)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}lm.create=(t,e,n)=>new lm({left:t,right:e,typeName:jt.ZodIntersection,...Lt(n)});class Ws extends Wt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.array)return ze(r,{code:_e.invalid_type,expected:Ye.array,received:r.parsedType}),Tt;if(r.data.lengththis._def.items.length&&(ze(r,{code:_e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((s,c)=>{const l=this._def.items[c]||this._def.rest;return l?l._parse(new Ks(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>oi.mergeArray(n,s)):oi.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Ws({...this._def,rest:e})}}Ws.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ws({items:t,typeName:jt.ZodTuple,rest:null,...Lt(e)})};class um extends Wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.object)return ze(r,{code:_e.invalid_type,expected:Ye.object,received:r.parsedType}),Tt;const i=[],o=this._def.keyType,s=this._def.valueType;for(const c in r.data)i.push({key:o._parse(new Ks(r,c,r.path,c)),value:s._parse(new Ks(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?oi.mergeObjectAsync(n,i):oi.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Wt?new um({keyType:e,valueType:n,typeName:jt.ZodRecord,...Lt(r)}):new um({keyType:qo.create(),valueType:e,typeName:jt.ZodRecord,...Lt(n)})}}class Ex extends Wt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.map)return ze(r,{code:_e.invalid_type,expected:Ye.map,received:r.parsedType}),Tt;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([c,l],u)=>({key:i._parse(new Ks(r,c,r.path,[u,"key"])),value:o._parse(new Ks(r,l,r.path,[u,"value"]))}));if(r.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const l of s){const u=await l.key,d=await l.value;if(u.status==="aborted"||d.status==="aborted")return Tt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}})}else{const c=new Map;for(const l of s){const u=l.key,d=l.value;if(u.status==="aborted"||d.status==="aborted")return Tt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}}}}Ex.create=(t,e,n)=>new Ex({valueType:e,keyType:t,typeName:jt.ZodMap,...Lt(n)});class vu extends Wt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==Ye.set)return ze(r,{code:_e.invalid_type,expected:Ye.set,received:r.parsedType}),Tt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(ze(r,{code:_e.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function s(l){const u=new Set;for(const d of l){if(d.status==="aborted")return Tt;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const c=[...r.data.values()].map((l,u)=>o._parse(new Ks(r,l,r.path,u)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,n){return new vu({...this._def,minSize:{value:e,message:at.toString(n)}})}max(e,n){return new vu({...this._def,maxSize:{value:e,message:at.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}vu.create=(t,e)=>new vu({valueType:t,minSize:null,maxSize:null,typeName:jt.ZodSet,...Lt(e)});class Ad extends Wt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.function)return ze(n,{code:_e.invalid_type,expected:Ye.function,received:n.parsedType}),Tt;function r(c,l){return Cx({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Sx(),Zd].filter(u=>!!u),issueData:{code:_e.invalid_arguments,argumentsError:l}})}function i(c,l){return Cx({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Sx(),Zd].filter(u=>!!u),issueData:{code:_e.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof tf){const c=this;return xi(async function(...l){const u=new eo([]),d=await c._def.args.parseAsync(l,o).catch(p=>{throw u.addIssue(r(l,p)),u}),f=await Reflect.apply(s,this,d);return await c._def.returns._def.type.parseAsync(f,o).catch(p=>{throw u.addIssue(i(f,p)),u})})}else{const c=this;return xi(function(...l){const u=c._def.args.safeParse(l,o);if(!u.success)throw new eo([r(l,u.error)]);const d=Reflect.apply(s,this,u.data),f=c._def.returns.safeParse(d,o);if(!f.success)throw new eo([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Ad({...this._def,args:Ws.create(e).rest(Yl.create())})}returns(e){return new Ad({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Ad({args:e||Ws.create([]).rest(Yl.create()),returns:n||Yl.create(),typeName:jt.ZodFunction,...Lt(r)})}}class dm extends Wt{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}dm.create=(t,e)=>new dm({getter:t,typeName:jt.ZodLazy,...Lt(e)});class fm extends Wt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return ze(n,{received:n.data,code:_e.invalid_literal,expected:this._def.value}),Tt}return{status:"valid",value:e.data}}get value(){return this._def.value}}fm.create=(t,e)=>new fm({value:t,typeName:jt.ZodLiteral,...Lt(e)});function S3(t,e){return new el({values:t,typeName:jt.ZodEnum,...Lt(e)})}class el extends Wt{constructor(){super(...arguments),Kh.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{expected:nn.joinValues(r),received:n.parsedType,code:_e.invalid_type}),Tt}if(_x(this,Kh)||y3(this,Kh,new Set(this._def.values)),!_x(this,Kh).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return ze(n,{received:n.data,code:_e.invalid_enum_value,options:r}),Tt}return xi(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return el.create(e,{...this._def,...n})}exclude(e,n=this._def){return el.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}Kh=new WeakMap;el.create=S3;class hm extends Wt{constructor(){super(...arguments),Wh.set(this,void 0)}_parse(e){const n=nn.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==Ye.string&&r.parsedType!==Ye.number){const i=nn.objectValues(n);return ze(r,{expected:nn.joinValues(i),received:r.parsedType,code:_e.invalid_type}),Tt}if(_x(this,Wh)||y3(this,Wh,new Set(nn.getValidEnumValues(this._def.values))),!_x(this,Wh).has(e.data)){const i=nn.objectValues(n);return ze(r,{received:r.data,code:_e.invalid_enum_value,options:i}),Tt}return xi(e.data)}get enum(){return this._def.values}}Wh=new WeakMap;hm.create=(t,e)=>new hm({values:t,typeName:jt.ZodNativeEnum,...Lt(e)});class tf extends Wt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Ye.promise&&n.common.async===!1)return ze(n,{code:_e.invalid_type,expected:Ye.promise,received:n.parsedType}),Tt;const r=n.parsedType===Ye.promise?n.data:Promise.resolve(n.data);return xi(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}tf.create=(t,e)=>new tf({type:t,typeName:jt.ZodPromise,...Lt(e)});class ds extends Wt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===jt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),i=this._def.effect||null,o={addIssue:s=>{ze(r,s),s.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const s=i.transform(r.data,o);if(r.common.async)return Promise.resolve(s).then(async c=>{if(n.value==="aborted")return Tt;const l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?Tt:l.status==="dirty"||n.value==="dirty"?cd(l.value):l});{if(n.value==="aborted")return Tt;const c=this._def.schema._parseSync({data:s,path:r.path,parent:r});return c.status==="aborted"?Tt:c.status==="dirty"||n.value==="dirty"?cd(c.value):c}}if(i.type==="refinement"){const s=c=>{const l=i.refinement(c,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(r.common.async===!1){const c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Tt:(c.status==="dirty"&&n.dirty(),s(c.value),{status:n.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Tt:(c.status==="dirty"&&n.dirty(),s(c.value).then(()=>({status:n.value,value:c.value}))))}if(i.type==="transform")if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!rm(s))return s;const c=i.transform(s.value,o);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>rm(s)?Promise.resolve(i.transform(s.value,o)).then(c=>({status:n.value,value:c})):s);nn.assertNever(i)}}ds.create=(t,e,n)=>new ds({schema:t,typeName:jt.ZodEffects,effect:e,...Lt(n)});ds.createWithPreprocess=(t,e,n)=>new ds({schema:e,effect:{type:"preprocess",transform:t},typeName:jt.ZodEffects,...Lt(n)});class Ls extends Wt{_parse(e){return this._getType(e)===Ye.undefined?xi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ls.create=(t,e)=>new Ls({innerType:t,typeName:jt.ZodOptional,...Lt(e)});class tl extends Wt{_parse(e){return this._getType(e)===Ye.null?xi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}tl.create=(t,e)=>new tl({innerType:t,typeName:jt.ZodNullable,...Lt(e)});class pm extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===Ye.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}pm.create=(t,e)=>new pm({innerType:t,typeName:jt.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Lt(e)});class mm extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return im(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new eo(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new eo(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}mm.create=(t,e)=>new mm({innerType:t,typeName:jt.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Lt(e)});class Tx extends Wt{_parse(e){if(this._getType(e)!==Ye.nan){const r=this._getOrReturnCtx(e);return ze(r,{code:_e.invalid_type,expected:Ye.nan,received:r.parsedType}),Tt}return{status:"valid",value:e.data}}}Tx.create=t=>new Tx({typeName:jt.ZodNaN,...Lt(t)});const Yoe=Symbol("zod_brand");class sN extends Wt{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class bg extends Wt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Tt:o.status==="dirty"?(n.dirty(),cd(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Tt:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(e,n){return new bg({in:e,out:n,typeName:jt.ZodPipeline})}}class gm extends Wt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(rm(i)&&(i.value=Object.freeze(i.value)),i);return im(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}gm.create=(t,e)=>new gm({innerType:t,typeName:jt.ZodReadonly,...Lt(e)});function C3(t,e={},n){return t?ef.create().superRefine((r,i)=>{var o,s;if(!t(r)){const c=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,l=(s=(o=c.fatal)!==null&&o!==void 0?o:n)!==null&&s!==void 0?s:!0,u=typeof c=="string"?{message:c}:c;i.addIssue({code:"custom",...u,fatal:l})}}):ef.create()}const Qoe={object:Vn.lazycreate};var jt;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(jt||(jt={}));const Xoe=(t,e={message:`Input not instance of ${t.name}`})=>C3(n=>n instanceof t,e),_3=qo.create,A3=Jc.create,Joe=Tx.create,Zoe=Zc.create,j3=om.create,ese=gu.create,tse=Ax.create,nse=sm.create,rse=am.create,ise=ef.create,ose=Yl.create,sse=La.create,ase=jx.create,cse=es.create,lse=Vn.create,use=Vn.strictCreate,dse=cm.create,fse=V0.create,hse=lm.create,pse=Ws.create,mse=um.create,gse=Ex.create,vse=vu.create,yse=Ad.create,xse=dm.create,bse=fm.create,wse=el.create,Sse=hm.create,Cse=tf.create,pR=ds.create,_se=Ls.create,Ase=tl.create,jse=ds.createWithPreprocess,Ese=bg.create,Tse=()=>_3().optional(),Nse=()=>A3().optional(),Pse=()=>j3().optional(),kse={string:t=>qo.create({...t,coerce:!0}),number:t=>Jc.create({...t,coerce:!0}),boolean:t=>om.create({...t,coerce:!0}),bigint:t=>Zc.create({...t,coerce:!0}),date:t=>gu.create({...t,coerce:!0})},Ose=Tt;var Oe=Object.freeze({__proto__:null,defaultErrorMap:Zd,setErrorMap:Ooe,getErrorMap:Sx,makeIssue:Cx,EMPTY_PATH:Ioe,addIssueToContext:ze,ParseStatus:oi,INVALID:Tt,DIRTY:cd,OK:xi,isAborted:gA,isDirty:vA,isValid:rm,isAsync:im,get util(){return nn},get objectUtil(){return mA},ZodParsedType:Ye,getParsedType:dc,ZodType:Wt,datetimeRegex:w3,ZodString:qo,ZodNumber:Jc,ZodBigInt:Zc,ZodBoolean:om,ZodDate:gu,ZodSymbol:Ax,ZodUndefined:sm,ZodNull:am,ZodAny:ef,ZodUnknown:Yl,ZodNever:La,ZodVoid:jx,ZodArray:es,ZodObject:Vn,ZodUnion:cm,ZodDiscriminatedUnion:V0,ZodIntersection:lm,ZodTuple:Ws,ZodRecord:um,ZodMap:Ex,ZodSet:vu,ZodFunction:Ad,ZodLazy:dm,ZodLiteral:fm,ZodEnum:el,ZodNativeEnum:hm,ZodPromise:tf,ZodEffects:ds,ZodTransformer:ds,ZodOptional:Ls,ZodNullable:tl,ZodDefault:pm,ZodCatch:mm,ZodNaN:Tx,BRAND:Yoe,ZodBranded:sN,ZodPipeline:bg,ZodReadonly:gm,custom:C3,Schema:Wt,ZodSchema:Wt,late:Qoe,get ZodFirstPartyTypeKind(){return jt},coerce:kse,any:ise,array:cse,bigint:Zoe,boolean:j3,date:ese,discriminatedUnion:fse,effect:pR,enum:wse,function:yse,instanceof:Xoe,intersection:hse,lazy:xse,literal:bse,map:gse,nan:Joe,nativeEnum:Sse,never:sse,null:rse,nullable:Ase,number:A3,object:lse,oboolean:Pse,onumber:Nse,optional:_se,ostring:Tse,pipeline:Ese,preprocess:jse,promise:Cse,record:mse,set:vse,strictObject:use,string:_3,symbol:tse,transformer:pR,tuple:pse,undefined:nse,union:dse,unknown:ose,void:ase,NEVER:Ose,ZodIssueCode:_e,quotelessJson:koe,ZodError:eo}),Ise="Label",E3=v.forwardRef((t,e)=>a.jsx(it.label,{...t,ref:e,onMouseDown:n=>{var i;n.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));E3.displayName=Ise;var T3=E3;const Rse=XT("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),mo=v.forwardRef(({className:t,...e},n)=>a.jsx(T3,{ref:n,className:Ne(Rse(),t),...e}));mo.displayName=T3.displayName;const K0=foe,N3=v.createContext({}),vt=({...t})=>a.jsx(N3.Provider,{value:{name:t.name},children:a.jsx(goe,{...t})}),W0=()=>{const t=v.useContext(N3),e=v.useContext(P3),{getFieldState:n,formState:r}=H0(),i=n(t.name,r);if(!t)throw new Error("useFormField should be used within ");const{id:o}=e;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...i}},P3=v.createContext({}),dt=v.forwardRef(({className:t,...e},n)=>{const r=v.useId();return a.jsx(P3.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Ne("space-y-2",t),...e})})});dt.displayName="FormItem";const ft=v.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:i}=W0();return a.jsx(mo,{ref:n,className:Ne(r&&"text-destructive",t),htmlFor:i,...e})});ft.displayName="FormLabel";const ht=v.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:o}=W0();return a.jsx(Hs,{ref:e,id:r,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...t})});ht.displayName="FormControl";const Nn=v.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=W0();return a.jsx("p",{ref:n,id:r,className:Ne("text-sm text-muted-foreground",t),...e})});Nn.displayName="FormDescription";const pt=v.forwardRef(({className:t,children:e,...n},r)=>{const{error:i,formMessageId:o}=W0(),s=i?String(i==null?void 0:i.message):e;return s?a.jsx("p",{ref:r,id:o,className:Ne("text-sm font-medium text-destructive",t),...n,children:s}):null});pt.displayName="FormMessage";const Ht=v.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:Ne("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Ht.displayName="Input";const mt=v.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:Ne("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));mt.displayName="Textarea";function vm(t,[e,n]){return Math.min(n,Math.max(e,t))}function Mse(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Dse(i,...e)]}function Dse(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function q0(t){const e=t+"CollectionProvider",[n,r]=Mse(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:m}=p,y=N.useRef(null),b=N.useRef(new Map).current;return a.jsx(i,{scope:g,itemMap:b,collectionRef:y,children:m})};s.displayName=e;const c=t+"CollectionSlot",l=N.forwardRef((p,g)=>{const{scope:m,children:y}=p,b=o(c,m),x=Pt(g,b.collectionRef);return a.jsx(Hs,{ref:x,children:y})});l.displayName=c;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=N.forwardRef((p,g)=>{const{scope:m,children:y,...b}=p,x=N.useRef(null),w=Pt(g,x),S=o(u,m);return N.useEffect(()=>(S.itemMap.set(x,{ref:x,...b}),()=>void S.itemMap.delete(x))),a.jsx(Hs,{[d]:"",ref:w,children:y})});f.displayName=u;function h(p){const g=o(t+"CollectionConsumer",p);return N.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((S,C)=>b.indexOf(S.ref.current)-b.indexOf(C.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var $se=v.createContext(void 0);function Nu(t){const e=v.useContext($se);return t||e||"ltr"}var WS=0;function aN(){v.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??mR()),document.body.insertAdjacentElement("beforeend",t[1]??mR()),WS++,()=>{WS===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),WS--}},[])}function mR(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var qS="focusScope.autoFocusOnMount",YS="focusScope.autoFocusOnUnmount",gR={bubbles:!1,cancelable:!0},Lse="FocusScope",Y0=v.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=t,[c,l]=v.useState(null),u=Cr(i),d=Cr(o),f=v.useRef(null),h=Pt(e,m=>l(m)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(w){if(p.paused||!c)return;const S=w.target;c.contains(S)?f.current=S:tc(f.current,{select:!0})},y=function(w){if(p.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||tc(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&tc(c)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const x=new MutationObserver(b);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),x.disconnect()}}},[r,c,p.paused]),v.useEffect(()=>{if(c){yR.add(p);const m=document.activeElement;if(!c.contains(m)){const b=new CustomEvent(qS,gR);c.addEventListener(qS,u),c.dispatchEvent(b),b.defaultPrevented||(Fse(Gse(k3(c)),{select:!0}),document.activeElement===m&&tc(c))}return()=>{c.removeEventListener(qS,u),setTimeout(()=>{const b=new CustomEvent(YS,gR);c.addEventListener(YS,d),c.dispatchEvent(b),b.defaultPrevented||tc(m??document.body,{select:!0}),c.removeEventListener(YS,d),yR.remove(p)},0)}}},[c,u,d,p]);const g=v.useCallback(m=>{if(!n&&!r||p.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(y&&b){const x=m.currentTarget,[w,S]=Bse(x);w&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&tc(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&tc(S,{select:!0})):b===x&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(it.div,{tabIndex:-1,...s,ref:h,onKeyDown:g})});Y0.displayName=Lse;function Fse(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(tc(r,{select:e}),document.activeElement!==n)return}function Bse(t){const e=k3(t),n=vR(e,t),r=vR(e.reverse(),t);return[n,r]}function k3(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function vR(t,e){for(const n of t)if(!Use(n,{upTo:e}))return n}function Use(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Hse(t){return t instanceof HTMLInputElement&&"select"in t}function tc(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Hse(t)&&e&&t.select()}}var yR=zse();function zse(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=xR(t,e),t.unshift(e)},remove(e){var n;t=xR(t,e),(n=t[0])==null||n.resume()}}}function xR(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Gse(t){return t.filter(e=>e.tagName!=="A")}function wg(t){const e=v.useRef({value:t,previous:t});return v.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Vse=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Bu=new WeakMap,gv=new WeakMap,vv={},QS=0,O3=function(t){return t&&(t.host||O3(t.parentNode))},Kse=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=O3(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Wse=function(t,e,n,r){var i=Kse(e,Array.isArray(t)?t:[t]);vv[n]||(vv[n]=new WeakMap);var o=vv[n],s=[],c=new Set,l=new Set(i),u=function(f){!f||c.has(f)||(c.add(f),u(f.parentNode))};i.forEach(u);var d=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(h){if(c.has(h))d(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",m=(Bu.get(h)||0)+1,y=(o.get(h)||0)+1;Bu.set(h,m),o.set(h,y),s.push(h),m===1&&g&&gv.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),c.clear(),QS++,function(){s.forEach(function(f){var h=Bu.get(f)-1,p=o.get(f)-1;Bu.set(f,h),o.set(f,p),h||(gv.has(f)||f.removeAttribute(r),gv.delete(f)),p||f.removeAttribute(n)}),QS--,QS||(Bu=new WeakMap,Bu=new WeakMap,gv=new WeakMap,vv={})}},cN=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Vse(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Wse(r,i,n,"aria-hidden")):function(){return null}},Ps=function(){return Ps=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return uae;var e=dae(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},hae=D3(),jd="data-scroll-locked",pae=function(t,e,n,r){var i=t.left,o=t.top,s=t.right,c=t.gap;return n===void 0&&(n="margin"),` .`.concat(Yse,` { overflow: hidden `).concat(r,`; padding-right: `).concat(c,"px ").concat(r,`; @@ -536,7 +536,7 @@ Defaulting to \`null\`.`}var ZU=YU,loe=XU;const Rl=v.forwardRef(({className:t,va `)},wR=function(){var t=parseInt(document.body.getAttribute(jd)||"0",10);return isFinite(t)?t:0},mae=function(){v.useEffect(function(){return document.body.setAttribute(jd,(wR()+1).toString()),function(){var t=wR()-1;t<=0?document.body.removeAttribute(jd):document.body.setAttribute(jd,t.toString())}},[])},gae=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;mae();var o=v.useMemo(function(){return fae(i)},[i]);return v.createElement(hae,{styles:pae(o,!e,i,n?"":"!important")})},xA=!1;if(typeof window<"u")try{var yv=Object.defineProperty({},"passive",{get:function(){return xA=!0,!0}});window.addEventListener("test",yv,yv),window.removeEventListener("test",yv,yv)}catch{xA=!1}var Uu=xA?{passive:!1}:!1,vae=function(t){return t.tagName==="TEXTAREA"},$3=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!vae(t)&&n[e]==="visible")},yae=function(t){return $3(t,"overflowY")},xae=function(t){return $3(t,"overflowX")},SR=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=L3(t,r);if(i){var o=F3(t,r),s=o[1],c=o[2];if(s>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},bae=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},wae=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},L3=function(t,e){return t==="v"?yae(e):xae(e)},F3=function(t,e){return t==="v"?bae(e):wae(e)},Sae=function(t,e){return t==="h"&&e==="rtl"?-1:1},Cae=function(t,e,n,r,i){var o=Sae(t,window.getComputedStyle(e).direction),s=o*r,c=n.target,l=e.contains(c),u=!1,d=s>0,f=0,h=0;do{var p=F3(t,c),g=p[0],m=p[1],y=p[2],b=m-y-o*g;(g||b)&&L3(t,c)&&(f+=b,h+=g),c instanceof ShadowRoot?c=c.host:c=c.parentNode}while(!l&&c!==document.body||l&&(e.contains(c)||e===c));return(d&&(Math.abs(f)<1||!i)||!d&&(Math.abs(h)<1||!i))&&(u=!0),u},xv=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},CR=function(t){return[t.deltaX,t.deltaY]},_R=function(t){return t&&"current"in t?t.current:t},_ae=function(t,e){return t[0]===e[0]&&t[1]===e[1]},Aae=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},jae=0,Hu=[];function Eae(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(jae++)[0],o=v.useState(D3)[0],s=v.useRef(t);v.useEffect(function(){s.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=qse([t.lockRef.current],(t.shards||[]).map(_R),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=v.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=xv(m),x=n.current,w="deltaX"in m?m.deltaX:x[0]-b[0],S="deltaY"in m?m.deltaY:x[1]-b[1],C,_=m.target,A=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&A==="h"&&_.type==="range")return!1;var j=SR(A,_);if(!j)return!0;if(j?C=A:(C=A==="v"?"h":"v",j=SR(A,_)),!j)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=C),!C)return!0;var P=r.current||C;return Cae(P,y,m,P==="h"?w:S,!0)},[]),l=v.useCallback(function(m){var y=m;if(!(!Hu.length||Hu[Hu.length-1]!==o)){var b="deltaY"in y?CR(y):xv(y),x=e.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&_ae(C.delta,b)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(_R).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=w.length>0?c(y,w[0]):!s.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=v.useCallback(function(m,y,b,x){var w={name:m,delta:y,target:b,should:x,shadowParent:Tae(b)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),d=v.useCallback(function(m){n.current=xv(m),r.current=void 0},[]),f=v.useCallback(function(m){u(m.type,CR(m),m.target,c(m,t.lockRef.current))},[]),h=v.useCallback(function(m){u(m.type,xv(m),m.target,c(m,t.lockRef.current))},[]);v.useEffect(function(){return Hu.push(o),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Uu),document.addEventListener("touchmove",l,Uu),document.addEventListener("touchstart",d,Uu),function(){Hu=Hu.filter(function(m){return m!==o}),document.removeEventListener("wheel",l,Uu),document.removeEventListener("touchmove",l,Uu),document.removeEventListener("touchstart",d,Uu)}},[]);var p=t.removeScrollBar,g=t.inert;return v.createElement(v.Fragment,null,g?v.createElement(o,{styles:Aae(i)}):null,p?v.createElement(gae,{gapMode:t.gapMode}):null)}function Tae(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Nae=rae(M3,Eae);var X0=v.forwardRef(function(t,e){return v.createElement(Q0,Ps({},t,{ref:e,sideCar:Nae}))});X0.classNames=Q0.classNames;var Pae=[" ","Enter","ArrowUp","ArrowDown"],kae=[" ","Enter"],Sg="Select",[J0,Z0,Oae]=q0(Sg),[Kf,cFe]=Li(Sg,[Oae,Df]),ew=Df(),[Iae,ll]=Kf(Sg),[Rae,Mae]=Kf(Sg),B3=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=t,m=ew(e),[y,b]=v.useState(null),[x,w]=v.useState(null),[S,C]=v.useState(!1),_=Nu(u),[A=!1,j]=as({prop:r,defaultProp:i,onChange:o}),[P,k]=as({prop:s,defaultProp:c,onChange:l}),O=v.useRef(null),E=y?g||!!y.closest("form"):!0,[I,D]=v.useState(new Set),z=Array.from(I).map($=>$.props.value).join(";");return a.jsx(k4,{...m,children:a.jsxs(Iae,{required:p,scope:e,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Xo(),value:P,onValueChange:k,open:A,onOpenChange:j,dir:_,triggerPointerDownPosRef:O,disabled:h,children:[a.jsx(J0.Provider,{scope:e,children:a.jsx(Rae,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback($=>{D(G=>new Set(G).add($))},[]),onNativeOptionRemove:v.useCallback($=>{D(G=>{const R=new Set(G);return R.delete($),R})},[]),children:n})}),E?a.jsxs(d6,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:$=>k($.target.value),disabled:h,form:g,children:[P===void 0?a.jsx("option",{value:""}):null,Array.from(I)]},z):null]})})};B3.displayName=Sg;var U3="SelectTrigger",H3=v.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,o=ew(n),s=ll(U3,n),c=s.disabled||r,l=Pt(e,s.onTriggerChange),u=Z0(n),d=v.useRef("touch"),[f,h,p]=f6(m=>{const y=u().filter(w=>!w.disabled),b=y.find(w=>w.value===s.value),x=h6(y,m,b);x!==void 0&&s.onValueChange(x.value)}),g=m=>{c||(s.onOpenChange(!0),p()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(bE,{asChild:!0,...o,children:a.jsx(it.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":u6(s.value)?"":void 0,...i,ref:l,onClick:Te(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:Te(i.onPointerDown,m=>{d.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Te(i.onKeyDown,m=>{const y=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(y&&m.key===" ")&&Pae.includes(m.key)&&(g(),m.preventDefault())})})})});H3.displayName=U3;var z3="SelectValue",G3=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...c}=t,l=ll(z3,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=Pt(e,l.onValueNodeChange);return Kr(()=>{u(d)},[u,d]),a.jsx(it.span,{...c,ref:f,style:{pointerEvents:"none"},children:u6(l.value)?a.jsx(a.Fragment,{children:s}):o})});G3.displayName=z3;var Dae="SelectIcon",V3=v.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return a.jsx(it.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});V3.displayName=Dae;var $ae="SelectPortal",K3=t=>a.jsx(d0,{asChild:!0,...t});K3.displayName=$ae;var yu="SelectContent",W3=v.forwardRef((t,e)=>{const n=ll(yu,t.__scopeSelect),[r,i]=v.useState();if(Kr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?If.createPortal(a.jsx(q3,{scope:t.__scopeSelect,children:a.jsx(J0.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),o):null}return a.jsx(Y3,{...t,ref:e})});W3.displayName=yu;var Do=10,[q3,ul]=Kf(yu),Lae="SelectContentImpl",Y3=v.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:y,...b}=t,x=ll(yu,n),[w,S]=v.useState(null),[C,_]=v.useState(null),A=Pt(e,ae=>S(ae)),[j,P]=v.useState(null),[k,O]=v.useState(null),E=Z0(n),[I,D]=v.useState(!1),z=v.useRef(!1);v.useEffect(()=>{if(w)return cN(w)},[w]),aN();const $=v.useCallback(ae=>{const[De,...de]=E().map(Z=>Z.ref.current),[ye]=de.slice(-1),Ee=document.activeElement;for(const Z of ae)if(Z===Ee||(Z==null||Z.scrollIntoView({block:"nearest"}),Z===De&&C&&(C.scrollTop=0),Z===ye&&C&&(C.scrollTop=C.scrollHeight),Z==null||Z.focus(),document.activeElement!==Ee))return},[E,C]),G=v.useCallback(()=>$([j,w]),[$,j,w]);v.useEffect(()=>{I&&G()},[I,G]);const{onOpenChange:R,triggerPointerDownPosRef:L}=x;v.useEffect(()=>{if(w){let ae={x:0,y:0};const De=ye=>{var Ee,Z;ae={x:Math.abs(Math.round(ye.pageX)-(((Ee=L.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((Z=L.current)==null?void 0:Z.y)??0))}},de=ye=>{ae.x<=10&&ae.y<=10?ye.preventDefault():w.contains(ye.target)||R(!1),document.removeEventListener("pointermove",De),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",De),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",De),document.removeEventListener("pointerup",de,{capture:!0})}}},[w,R,L]),v.useEffect(()=>{const ae=()=>R(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[R]);const[W,Y]=f6(ae=>{const De=E().filter(Ee=>!Ee.disabled),de=De.find(Ee=>Ee.ref.current===document.activeElement),ye=h6(De,ae,de);ye&&setTimeout(()=>ye.ref.current.focus())}),te=v.useCallback((ae,De,de)=>{const ye=!z.current&&!de;(x.value!==void 0&&x.value===De||ye)&&(P(ae),ye&&(z.current=!0))},[x.value]),me=v.useCallback(()=>w==null?void 0:w.focus(),[w]),F=v.useCallback((ae,De,de)=>{const ye=!z.current&&!de;(x.value!==void 0&&x.value===De||ye)&&O(ae)},[x.value]),se=r==="popper"?bA:Q3,ne=se===bA?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:y}:{};return a.jsx(q3,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:te,selectedItem:j,onItemLeave:me,itemTextRefCallback:F,focusSelectedItem:G,selectedItemText:k,position:r,isPositioned:I,searchRef:W,children:a.jsx(X0,{as:Hs,allowPinchZoom:!0,children:a.jsx(Y0,{asChild:!0,trapped:x.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Te(i,ae=>{var De;(De=x.trigger)==null||De.focus({preventScroll:!0}),ae.preventDefault()}),children:a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(se,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ae=>ae.preventDefault(),...b,...ne,onPlaced:()=>D(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Te(b.onKeyDown,ae=>{const De=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!De&&ae.key.length===1&&Y(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let ye=E().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const Ee=ae.target,Z=ye.indexOf(Ee);ye=ye.slice(Z+1)}setTimeout(()=>$(ye)),ae.preventDefault()}})})})})})})});Y3.displayName=Lae;var Fae="SelectItemAlignedPosition",Q3=v.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,o=ll(yu,n),s=ul(yu,n),[c,l]=v.useState(null),[u,d]=v.useState(null),f=Pt(e,A=>d(A)),h=Z0(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&m&&y&&b){const A=o.trigger.getBoundingClientRect(),j=u.getBoundingClientRect(),P=o.valueNode.getBoundingClientRect(),k=b.getBoundingClientRect();if(o.dir!=="rtl"){const Ee=k.left-j.left,Z=P.left-Ee,ct=A.left-Z,Le=A.width+ct,At=Math.max(Le,j.width),lt=window.innerWidth-Do,Jt=vm(Z,[Do,Math.max(Do,lt-At)]);c.style.minWidth=Le+"px",c.style.left=Jt+"px"}else{const Ee=j.right-k.right,Z=window.innerWidth-P.right-Ee,ct=window.innerWidth-A.right-Z,Le=A.width+ct,At=Math.max(Le,j.width),lt=window.innerWidth-Do,Jt=vm(Z,[Do,Math.max(Do,lt-At)]);c.style.minWidth=Le+"px",c.style.right=Jt+"px"}const O=h(),E=window.innerHeight-Do*2,I=m.scrollHeight,D=window.getComputedStyle(u),z=parseInt(D.borderTopWidth,10),$=parseInt(D.paddingTop,10),G=parseInt(D.borderBottomWidth,10),R=parseInt(D.paddingBottom,10),L=z+$+I+R+G,W=Math.min(y.offsetHeight*5,L),Y=window.getComputedStyle(m),te=parseInt(Y.paddingTop,10),me=parseInt(Y.paddingBottom,10),F=A.top+A.height/2-Do,se=E-F,ne=y.offsetHeight/2,ae=y.offsetTop+ne,De=z+$+ae,de=L-De;if(De<=F){const Ee=O.length>0&&y===O[O.length-1].ref.current;c.style.bottom="0px";const Z=u.clientHeight-m.offsetTop-m.offsetHeight,ct=Math.max(se,ne+(Ee?me:0)+Z+G),Le=De+ct;c.style.height=Le+"px"}else{const Ee=O.length>0&&y===O[0].ref.current;c.style.top="0px";const ct=Math.max(F,z+m.offsetTop+(Ee?te:0)+ne)+de;c.style.height=ct+"px",m.scrollTop=De-F+m.offsetTop}c.style.margin=`${Do}px 0`,c.style.minHeight=W+"px",c.style.maxHeight=E+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,o.trigger,o.valueNode,c,u,m,y,b,o.dir,r]);Kr(()=>w(),[w]);const[S,C]=v.useState();Kr(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const _=v.useCallback(A=>{A&&g.current===!0&&(w(),x==null||x(),g.current=!1)},[w,x]);return a.jsx(Uae,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:a.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(it.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Q3.displayName=Fae;var Bae="SelectPopperPosition",bA=v.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Do,...o}=t,s=ew(n);return a.jsx(wE,{...s,...o,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});bA.displayName=Bae;var[Uae,lN]=Kf(yu,{}),wA="SelectViewport",X3=v.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,o=ul(wA,n),s=lN(wA,n),c=Pt(e,o.onViewportChange),l=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(J0.Slot,{scope:n,children:a.jsx(it.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Te(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&f){const p=Math.abs(l.current-d.scrollTop);if(p>0){const g=window.innerHeight-Do*2,m=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(m,y);if(b0?S:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});X3.displayName=wA;var J3="SelectGroup",[Hae,zae]=Kf(J3),Gae=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Xo();return a.jsx(Hae,{scope:n,id:i,children:a.jsx(it.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Gae.displayName=J3;var Z3="SelectLabel",e6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=zae(Z3,n);return a.jsx(it.div,{id:i.id,...r,ref:e})});e6.displayName=Z3;var Nx="SelectItem",[Vae,t6]=Kf(Nx),n6=v.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=t,c=ll(Nx,n),l=ul(Nx,n),u=c.value===r,[d,f]=v.useState(o??""),[h,p]=v.useState(!1),g=Pt(e,x=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,x,r,i)}),m=Xo(),y=v.useRef("touch"),b=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Vae,{scope:n,value:r,disabled:i,textId:m,isSelected:u,onItemTextChange:v.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(J0.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:a.jsx(it.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...s,ref:g,onFocus:Te(s.onFocus,()=>p(!0)),onBlur:Te(s.onBlur,()=>p(!1)),onClick:Te(s.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Te(s.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Te(s.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:Te(s.onPointerMove,x=>{var w;y.current=x.pointerType,i?(w=l.onItemLeave)==null||w.call(l):y.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(s.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Te(s.onKeyDown,x=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&x.key===" "||(kae.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});n6.displayName=Nx;var qh="SelectItemText",r6=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...o}=t,s=ll(qh,n),c=ul(qh,n),l=t6(qh,n),u=Mae(qh,n),[d,f]=v.useState(null),h=Pt(e,b=>f(b),l.onItemTextChange,b=>{var x;return(x=c.itemTextRefCallback)==null?void 0:x.call(c,b,l.value,l.disabled)}),p=d==null?void 0:d.textContent,g=v.useMemo(()=>a.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=u;return Kr(()=>(m(g),()=>y(g)),[m,y,g]),a.jsxs(a.Fragment,{children:[a.jsx(it.span,{id:l.textId,...o,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?If.createPortal(o.children,s.valueNode):null]})});r6.displayName=qh;var i6="SelectItemIndicator",o6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return t6(i6,n).isSelected?a.jsx(it.span,{"aria-hidden":!0,...r,ref:e}):null});o6.displayName=i6;var SA="SelectScrollUpButton",s6=v.forwardRef((t,e)=>{const n=ul(SA,t.__scopeSelect),r=lN(SA,t.__scopeSelect),[i,o]=v.useState(!1),s=Pt(e,r.onScrollButtonChange);return Kr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;o(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?a.jsx(c6,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});s6.displayName=SA;var CA="SelectScrollDownButton",a6=v.forwardRef((t,e)=>{const n=ul(CA,t.__scopeSelect),r=lN(CA,t.__scopeSelect),[i,o]=v.useState(!1),s=Pt(e,r.onScrollButtonChange);return Kr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?a.jsx(c6,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});a6.displayName=CA;var c6=v.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,o=ul("SelectScrollButton",n),s=v.useRef(null),c=Z0(n),l=v.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return v.useEffect(()=>()=>l(),[l]),Kr(()=>{var d;const u=c().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[c]),a.jsx(it.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Te(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Te(i.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Te(i.onPointerLeave,()=>{l()})})}),Kae="SelectSeparator",l6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(it.div,{"aria-hidden":!0,...r,ref:e})});l6.displayName=Kae;var _A="SelectArrow",Wae=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=ew(n),o=ll(_A,n),s=ul(_A,n);return o.open&&s.position==="popper"?a.jsx(SE,{...i,...r,ref:e}):null});Wae.displayName=_A;function u6(t){return t===""||t===void 0}var d6=v.forwardRef((t,e)=>{const{value:n,...r}=t,i=v.useRef(null),o=Pt(e,i),s=wg(n);return v.useEffect(()=>{const c=i.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&d){const f=new Event("change",{bubbles:!0});d.call(c,n),c.dispatchEvent(f)}},[s,n]),a.jsx(CE,{asChild:!0,children:a.jsx("select",{...r,ref:o,defaultValue:n})})});d6.displayName="BubbleSelect";function f6(t){const e=Cr(t),n=v.useRef(""),r=v.useRef(0),i=v.useCallback(s=>{const c=n.current+s;e(c),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(c)},[e]),o=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function h6(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=qae(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function qae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Yae=B3,p6=H3,Qae=G3,Xae=V3,Jae=K3,m6=W3,Zae=X3,g6=e6,v6=n6,ece=r6,tce=o6,y6=s6,x6=a6,b6=l6;const Bn=Yae,Un=Qae,$n=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(p6,{ref:r,className:Ne("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(Xae,{asChild:!0,children:a.jsx(Ma,{className:"h-4 w-4 opacity-50"})})]}));$n.displayName=p6.displayName;const w6=v.forwardRef(({className:t,...e},n)=>a.jsx(y6,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(cu,{className:"h-4 w-4"})}));w6.displayName=y6.displayName;const S6=v.forwardRef(({className:t,...e},n)=>a.jsx(x6,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(Ma,{className:"h-4 w-4"})}));S6.displayName=x6.displayName;const Ln=v.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>a.jsx(Jae,{children:a.jsxs(m6,{ref:i,className:Ne("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[a.jsx(w6,{}),a.jsx(Zae,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(S6,{})]})}));Ln.displayName=m6.displayName;const nce=v.forwardRef(({className:t,...e},n)=>a.jsx(g6,{ref:n,className:Ne("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));nce.displayName=g6.displayName;const oe=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v6,{ref:r,className:Ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tce,{children:a.jsx(Gs,{className:"h-4 w-4"})})}),a.jsx(ece,{children:e})]}));oe.displayName=v6.displayName;const rce=v.forwardRef(({className:t,...e},n)=>a.jsx(b6,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",t),...e}));rce.displayName=b6.displayName;const ice=Oe.object({audienceBrief:Oe.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Oe.string().optional(),personaCount:Oe.string().min(1,{message:"Number of personas is required."}),dataFile:Oe.instanceof(FileList).optional(),llm_model:Oe.string().optional()});function oce({onSubmit:t,isGenerating:e}){const[n,r]=v.useState(!1),[i,o]=v.useState(!1),[s,c]=v.useState({audience_brief:[],research_objective:[]}),[l,u]=v.useState(!1),[d,f]=v.useState(null),h=z0({resolver:G0(ice),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,S,C,_,A,j,P,k,O,E,I;const b=p==null?void 0:p.trim(),x=g==null?void 0:g.trim();if(!b||b.length<10){re.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!x||x.length<10){re.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const D=await ua.enhanceAudienceBrief(b,x);c(D.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),o(!1);const z=(((S=(w=D.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:S.length)||0)+(((_=(C=D.data.suggestions)==null?void 0:C.research_objective)==null?void 0:_.length)||0);re.success("Enhancement suggestions generated",{description:`Generated ${z} suggestions to improve your research inputs`})}catch(D){console.error("Error enhancing audience brief:",D);let z="Please try again or modify your brief",$="Failed to generate suggestions";if(D&&typeof D=="object"){const G=D;G.code==="ECONNABORTED"||(A=G.message)!=null&&A.includes("timeout")?($="Request timeout",z="The AI took too long to analyze your brief. Please try again."):((j=G.response)==null?void 0:j.status)===500?($="Server error",z=((k=(P=G.response)==null?void 0:P.data)==null?void 0:k.message)||"The server encountered an error. Please try again later."):((O=G.response)==null?void 0:O.status)===400?($="Invalid brief",z=((I=(E=G.response)==null?void 0:E.data)==null?void 0:I.message)||"Please check your audience brief and try again."):G.message&&(z=G.message)}else D instanceof Error&&(z=D.message);f(z),re.error($,{description:z,duration:5e3})}finally{u(!1)}},y=()=>{o(!i)};return a.jsx(K0,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(t),className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Audience Brief"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(Nn,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Research Objective"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(Nn,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(pt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||l||e,className:"flex items-center gap-2 hover-transition",children:l?a.jsxs(a.Fragment,{children:[a.jsx(wd,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(uu,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:x,...w}})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Customer Data (Optional)"}),a.jsx(ht,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(d5,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload customer data for more accurate personas"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Supports PDF, Office docs, images, and more"}),a.jsx(Ht,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:S=>{x(S.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:()=>{var S;return(S=document.getElementById("data-file-input"))==null?void 0:S.click()},children:[a.jsx(h5,{className:"mr-2 h-4 w-4"}),"Select Files"]}),b&&b.length>0&&a.jsx("p",{className:"text-xs text-primary mt-2",children:b.length===1?b[0].name:`${b.length} files selected`})]})}),a.jsx(Nn,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg border border-border",children:[a.jsxs("div",{className:"flex items-center mb-2",children:[a.jsx(H_,{className:"h-5 w-5 text-muted-foreground mr-2"}),a.jsx("h3",{className:"font-sf font-medium",children:"What's included?"})]}),a.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Demographic profiles based on your brief"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Personality traits and behavioral patterns"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Review and refine capabilities"]})]})]})]})]}),n&&a.jsxs("div",{className:"glass-panel rounded-lg p-4 border border-border bg-muted/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-sf font-medium text-sm flex items-center gap-2",children:[a.jsx(uu,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:y,className:"h-6 w-6 p-0 hover:bg-slate-200",title:i?"Expand suggestions":"Collapse suggestions",children:i?a.jsx(Ma,{className:"h-4 w-4"}):a.jsx(cu,{className:"h-4 w-4"})})]}),!i&&a.jsx(a.Fragment,{children:d?a.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-md",children:d}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{children:s.audience_brief.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(Dr,{className:"h-4 w-4 text-blue-600"}),"Suggestions for your Audience Brief:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:s.audience_brief.map((b,x)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-blue-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:s.research_objective.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(H_,{className:"h-4 w-4 text-green-600"}),"Suggestions for your Research Objective:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:s.research_objective.map((b,x)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-green-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),s.audience_brief.length===0&&s.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(vt,{control:h.control,name:"llm_model",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"AI Model"}),a.jsxs(Bn,{onValueChange:b.onChange,defaultValue:b.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select AI model"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Nn,{children:"Choose which AI model to use for generating personas"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Number of Personas to Generate"}),a.jsx(ht,{children:a.jsx(Ht,{type:"number",min:"1",max:"20",...b})}),a.jsx(Nn,{children:"How many synthetic users do you need for your research?"}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(J,{type:"submit",disabled:e,className:"min-w-36",children:e?a.jsxs(a.Fragment,{children:[a.jsx(wd,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Dr,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),e&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const gt=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));gt.displayName="Card";const ji=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("flex flex-col space-y-1.5 p-6",t),...e}));ji.displayName="CardHeader";const Wi=v.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:Ne("text-2xl font-semibold leading-none tracking-tight",t),...e}));Wi.displayName="CardTitle";const uN=v.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));uN.displayName="CardDescription";const Rt=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("p-6 pt-0",t),...e}));Rt.displayName="CardContent";const dN=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("flex items-center p-6 pt-0",t),...e}));dN.displayName="CardFooter";const sce=t=>{const e=t==null?void 0:t.toLowerCase(),n="/semblance/";switch(e){case"male":return`${n}male_avatar.png`;case"female":return`${n}female_avatar.png`;case"non-binary":case"nonbinary":case"non binary":return`${n}nonbinary_avatar.png`;default:return`${n}male_avatar.png`}},Cg=t=>t.avatar||sce(t.gender);function fN({user:t,selected:e=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:i,showAddToFolderButton:o=!1,onAddToFolder:s,onViewDetails:c,folders:l=[]}){const u=ar();v.useState(!1);const[d,f]=v.useState(t),h=t._id||t.id,p=y=>{y.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=y=>{var w,S;const b=y.target;b.closest("button")&&((S=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&S.includes("View Details"))||(i?i(y):n&&n(y))},m=y=>{y.stopPropagation(),c?c(d):p(y)};return a.jsxs("div",{className:Ne("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",e&&"selected ring-2 ring-primary"),onClick:g,children:[a.jsx("div",{className:"persona-card-overlay"}),a.jsx("div",{className:"persona-card-checkmark",children:a.jsx(Gs,{className:"h-4 w-4 text-primary"})}),a.jsx("div",{className:"relative z-10",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Cg(d),alt:`${d.name} avatar`,className:"h-12 w-12 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h3",{className:"text-sm font-medium truncate flex-1",children:d.name})}),a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[d.age," • ",d.gender]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d.occupation}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.location}),a.jsx("div",{className:"mt-2",children:d.aiSynthesizedBio?a.jsxs("p",{className:"text-xs text-slate-700 line-clamp-3 leading-relaxed",children:[d.aiSynthesizedBio,d.aiSynthesizedBio.length>150&&"..."]}):a.jsxs("p",{className:"text-xs text-muted-foreground italic line-clamp-3",children:['"',d.personality,'"']})}),d.qualitativeAttributes&&d.qualitativeAttributes.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.qualitativeAttributes.slice(0,3).map((y,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded-full",children:[a.jsx(hZ,{className:"h-3 w-3"}),y]},b))})}),d.folder_ids&&d.folder_ids.length>0&&a.jsx("div",{className:"mt-2",children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[d.folder_ids.slice(0,2).map(y=>{const b=l.find(x=>x._id===y);return b?a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",title:`In folder: ${b.name}`,children:[a.jsx(ho,{className:"h-3 w-3"}),b.name]},y):null}),d.folder_ids.length>2&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",children:[a.jsx(Ur,{className:"h-3 w-3"}),d.folder_ids.length-2," more"]})]})}),d.topPersonalityTraits&&d.topPersonalityTraits.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.topPersonalityTraits.slice(0,3).map((y,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-purple-50 text-purple-700 text-xs rounded-full",children:[a.jsx(au,{className:"h-3 w-3"}),y]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(J,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var hN="Collapsible",[ace,lFe]=Li(hN),[cce,pN]=ace(hN),C6=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...c}=t,[l=!1,u]=as({prop:r,defaultProp:i,onChange:s});return a.jsx(cce,{scope:n,disabled:o,contentId:Xo(),open:l,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:a.jsx(it.div,{"data-state":gN(l),"data-disabled":o?"":void 0,...c,ref:e})})});C6.displayName=hN;var _6="CollapsibleTrigger",A6=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=pN(_6,n);return a.jsx(it.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":gN(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Te(t.onClick,i.onOpenToggle)})});A6.displayName=_6;var mN="CollapsibleContent",j6=v.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=pN(mN,t.__scopeCollapsible);return a.jsx(Wr,{present:n||i.open,children:({present:o})=>a.jsx(lce,{...r,ref:e,present:o})})});j6.displayName=mN;var lce=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...o}=t,s=pN(mN,n),[c,l]=v.useState(r),u=v.useRef(null),d=Pt(e,u),f=v.useRef(0),h=f.current,p=v.useRef(0),g=p.current,m=s.open||c,y=v.useRef(m),b=v.useRef();return v.useEffect(()=>{const x=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(x)},[]),Kr(()=>{const x=u.current;if(x){b.current=b.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();f.current=w.height,p.current=w.width,y.current||(x.style.transitionDuration=b.current.transitionDuration,x.style.animationName=b.current.animationName),l(r)}},[s.open,r]),a.jsx(it.div,{"data-state":gN(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!m,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:m&&i})});function gN(t){return t?"open":"closed"}var uce=C6;const _g=uce,Ag=A6,jg=j6;function dce({generatedPersonas:t,selectedPersonas:e,isGenerating:n,onPersonaSelection:r,onRefinePersonas:i,onApprovePersonas:o,onBackToGenerator:s}){const c=ar(),[l,u]=v.useState(""),[d,f]=v.useState(!1),h=p=>{c(`/synthetic-users/${p}?fromReview=true`)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Review Generated Personas"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.length," of ",t.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:t.map(p=>a.jsx(gt,{className:`border ${e.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(Rt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("div",{className:"flex-1",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:`persona-${p.id}`,checked:e.includes(p.id),onChange:g=>{g.stopPropagation(),r(p.id)},className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:p.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.age," • ",p.gender," • ",p.occupation]})]})]})}),a.jsx(fN,{user:p,showDetailedDialog:!1,onClick:g=>{g.stopPropagation(),h(p.id)}})]})})},p.id))}),a.jsx("div",{className:"space-y-4 pt-4 border-t",children:a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsxs(J,{variant:"outline",onClick:s,children:[a.jsx(Kp,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(_g,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Ag,{asChild:!0,children:a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(wd,{className:"h-4 w-4"}),"Refine Personas",a.jsx(Ma,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(J,{onClick:o,disabled:e.length===0,children:[a.jsx(zh,{className:"mr-2 h-4 w-4"}),"Approve Selected (",e.length,")"]})]}),a.jsx(jg,{children:a.jsx(gt,{className:"border shadow-sm w-full mt-4",children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"refinement-prompt",className:"text-sm font-medium block mb-2",children:"Refinement Instructions"}),a.jsx(mt,{id:"refinement-prompt",placeholder:"Example: Make all personas 5 years younger, or ensure everyone is from different locations...",value:l,onChange:p=>u(p.target.value),className:"min-h-[100px] w-full resize-y"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Use natural language to describe how you'd like to refine the selected personas."})]}),a.jsxs(J,{onClick:()=>i(l),disabled:n||l.trim()==="",className:"w-full",children:[n?a.jsx(wd,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(wd,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function fce(t,e,n,r,i,o){console.log(`generateSyntheticPersonas called with targetFolderId: ${i||"none"}`),console.log(`🔄 generateSyntheticPersonas using model: ${o||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),t.trim().length<10)throw new Error("Audience brief is too short. Please provide more context for better persona generation.");let s;if(r&&r.length>0){console.log(`Uploading ${r.length} customer data files...`);try{s=(await ua.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${s}`)}catch(l){throw console.error("Failed to upload customer data:",l),new Error("Failed to upload customer data files. Please try again.")}}const c=await ua.batchGenerateWithStages(t,e,n,.8,s,o);if(c.data){const l=c.data.partial_success===!0,u=c.data.personas&&c.data.personas.length>0,d=c.data.errors&&c.data.errors.length>0;if(u){if(console.log(`Generated ${c.data.personas.length} personas with two-stage process${d?` (${c.data.errors.length} failed)`:""}`),i){const f=c.data.personas,h=f.map(p=>p._id||p.id).filter(Boolean);console.log(`Adding ${h.length} newly generated personas to folder: ${i}`);try{await js.addPersonasBatch(i,h),console.log(`Added ${h.length} newly generated personas to folder: ${i}`)}catch(p){console.error("Error adding personas to folder:",p)}if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return l||d?{...c.data,length:f.length}:{...c.data,personas:f}}if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}if(l||d)return{...c.data.personas,length:c.data.personas.length,partial_success:l,errors:c.data.errors};if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return c.data.personas}else if(d){if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}throw new Error(`Failed to generate personas: ${c.data.errors.length} generation attempts failed.`)}else throw new Error("No personas returned from API")}else throw new Error("Invalid response format from API")}catch(s){if(customerDataSessionId)try{await ua.cleanupCustomerData(customerDataSessionId),console.log(`Cleaned up customer data for session: ${customerDataSessionId}`)}catch(c){console.warn("Failed to cleanup customer data:",c)}throw console.error("Error generating AI personas:",s),s}}function E6(){const[t,e]=v.useState([]),n=async o=>{const s=[];for(const c of o){const l={...c};l._id&&typeof l._id=="string"&&l._id.startsWith("local-")&&delete l._id;const u=await zr.create(l);console.log("Persona saved to database:",u.data),s.push({...c,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}e(s)},r=async()=>{const o=await zr.getAll();return o&&o.data&&Array.isArray(o.data)?(console.log("Personas loaded from database:",o.data.length),o.data.map(s=>({...s,id:s._id||s.id,isDbPersona:!0}))):[]};return v.useEffect(()=>{(async()=>{const s=await r();e(s)})()},[]),{storedPersonas:t,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const o=await r();for(const s of o)s._id&&await zr.delete(s._id);e([])}}}function hce({targetFolderId:t,targetFolderName:e}){const n=Fi(),r=ar(),{loadPersonas:i,savePersonas:o}=E6(),[s,c]=v.useState(!1),[l,u]=v.useState([]),[d,f]=v.useState([]),[h,p]=v.useState(!1),[g,m]=v.useState(0);v.useEffect(()=>{const C=new URLSearchParams(n.search),_=C.get("mode"),A=C.get("tab"),j=C.get("step");if(_==="create"&&A==="ai"&&j==="review"){const P=i();P.length>0&&(u(P),f(P.map(k=>k.id)),p(!0))}},[n,i]);async function y(C){var _,A,j,P,k,O,E,I,D,z;try{c(!0),m(0);const $=parseInt(C.personaCount);if(isNaN($)||$<1||$>10){re.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),c(!1);return}m(5);const G=setInterval(()=>{m(Y=>Y<90?Y+Math.random()*5:Y)},500),R=$<=2?"30-60 seconds":$<=4?"1-2 minutes":$<=6?"2-3 minutes":"3-5 minutes";$>4&&re.info("Generation may take longer",{description:`Generating ${$} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),re.info("Generating AI personas in parallel",{description:`Creating ${$} synthetic personas based on your brief. This may take ${R}. Please be patient.`,duration:1e4}),t&&e?(console.log(`Target folder for new personas: ID=${t}, Name=${e}`),re.info(`Creating personas in "${e}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`🤖 Starting persona generation with model: ${C.llm_model||"gemini-2.5-pro"}`);const L=await fce(C.audienceBrief,C.researchObjective,$,C.dataFile,t,C.llm_model),W=L.personas||L;if(clearInterval(G),m(100),W&&W.length>0)console.log(`✅ Successfully generated ${W.length} personas using model: ${C.llm_model||"gemini-2.5-pro"}`),L.partial_success||L.errors&&L.errors.length>0?(re.success("Some personas generated successfully",{description:`${W.length} synthetic personas were created using ${C.llm_model||"Gemini 2.5 Pro"}. ${((_=L.errors)==null?void 0:_.length)||0} failed due to timeout or other errors.`,duration:8e3}),L.errors&&L.errors.length>0&&setTimeout(()=>{re.error("Some personas failed to generate",{description:`${L.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${t?" in the selected folder":""}.`,duration:1e4})},1e3)):re.success("Personas generated and saved successfully",{description:`${W.length} synthetic personas have been created using ${C.llm_model||"Gemini 2.5 Pro"} and saved ${t?`to the "${e}" folder`:"to the database"}.`}),r("/synthetic-users?mode=view");else throw new Error("No personas were generated")}catch($){console.error(`❌ Error generating personas using model: ${C.llm_model||"gemini-2.5-pro"}:`,$);let G="Please try again or adjust your parameters",R="Failed to generate personas";$.code==="ECONNABORTED"||(A=$.message)!=null&&A.includes("timeout")||((j=$.response)==null?void 0:j.status)===504?(R="Generation timeout",G="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((P=$.response)==null?void 0:P.status)===500?(R="Server error",(O=(k=$.response)==null?void 0:k.data)!=null&&O.message?G=$.response.data.message:(I=(E=$.response)==null?void 0:E.data)!=null&&I.error?G=$.response.data.error:G="The server encountered an error processing your request. Please try again later."):((D=$.response)==null?void 0:D.status)===401?(R="Authentication required",G="Please log in to generate personas."):(z=$.message)!=null&&z.includes("504 Deadline Exceeded")?(R="Generation timeout",G="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):$ instanceof Error&&(G=$.message),re.error(R,{description:G,duration:6e3})}finally{setTimeout(()=>{c(!1),m(0)},500)}}const b=C=>{f(_=>_.includes(C)?_.filter(A=>A!==C):[..._,C])},x=(C,_)=>{const A=_.toLowerCase();return C.map(j=>{const P={...j};if(A.includes("younger")){const k=parseInt(P.age);P.age=(k-5).toString()}else if(A.includes("older")){const k=parseInt(P.age);P.age=(k+5).toString()}if(A.includes("different locations")&&(P.location=`${P.location} (Diversified)`),A.includes("more extroverted")?P.personality=`Extroverted, ${P.personality.toLowerCase()}`:A.includes("more introverted")&&(P.personality=`Introverted, ${P.personality.toLowerCase()}`),A.includes("diverse")){const k=["tech-savvy","traditional","innovative","conservative","creative"],O=k[Math.floor(Math.random()*k.length)];P.personality=`${O}, ${P.personality}`}return P})},w=C=>{if(!C.trim()){re.error("Please provide refinement instructions");return}c(!0),setTimeout(()=>{try{const _=l.filter(P=>d.includes(P.id)),A=x(_,C),j=l.map(P=>A.find(O=>O.id===P.id)||P);u(j),c(!1),o(j),re.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(_){console.error("Error refining personas:",_),re.error("Failed to refine personas",{description:"Please try different instructions"}),c(!1)}},1500)},S=()=>{const C=l.filter(_=>d.includes(_.id));re.success(`${C.length} personas approved`,{description:"Added to your synthetic persona library"}),o(C),r("/synthetic-users?mode=view")};return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),s&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Generating personas in parallel..."}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(g),"%"]})]}),a.jsx(Rl,{value:g,className:"h-2"})]}),h?a.jsx(dce,{generatedPersonas:l,selectedPersonas:d,isGenerating:s,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:S,onBackToGenerator:()=>p(!1)}):a.jsx(oce,{onSubmit:y,isGenerating:s})]})}const nl=new Map;function T6(t){const{id:e,title:n,description:r,type:i="default",duration:o}=t;let s;switch(i){case"success":s=re.success(n,{description:r,duration:o});break;case"error":s=re.error(n,{description:r,duration:o});break;case"warning":s=re.warning(n,{description:r,duration:o});break;case"info":s=re.info(n,{description:r,duration:o});break;default:s=re(n,{description:r,duration:o});break}return nl.set(e,s.toString()),e}function pce(t,e){const n=nl.get(t);if(!n)return console.warn(`Toast with ID "${t}" not found. Creating new toast instead.`),T6({id:t,...e,title:e.title||"Updated"}),!1;const{title:r,description:i,type:o="default",duration:s}=e;re.dismiss(n);let c;switch(o){case"success":c=re.success(r,{description:i,duration:s});break;case"error":c=re.error(r,{description:i,duration:s});break;case"warning":c=re.warning(r,{description:i,duration:s});break;case"info":c=re.info(r,{description:i,duration:s});break;default:c=re(r,{description:i,duration:s});break}return nl.set(t,c.toString()),!0}function mce(t){const e=nl.get(t);return e?(re.dismiss(e),nl.delete(t),!0):(console.warn(`Toast with ID "${t}" not found.`),!1)}function gce(t){return nl.has(t)}function vce(){nl.forEach(t=>{re.dismiss(t)}),nl.clear()}const Ye={success:re.success,error:re.error,warning:re.warning,info:re.info,loading:re.loading,dismiss:re.dismiss,createPersistent:T6,updatePersistent:pce,dismissPersistent:mce,hasPersistent:gce,dismissAllPersistent:vce};var N6=["PageUp","PageDown"],P6=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],k6={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Wf="Slider",[AA,yce,xce]=q0(Wf),[O6,uFe]=Li(Wf,[xce]),[bce,tw]=O6(Wf),I6=v.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:o=1,orientation:s="horizontal",disabled:c=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=t,y=v.useRef(new Set),b=v.useRef(0),w=s==="horizontal"?wce:Sce,[S=[],C]=as({prop:d,defaultProp:u,onChange:O=>{var I;(I=[...y.current][b.current])==null||I.focus(),f(O)}}),_=v.useRef(S);function A(O){const E=Ece(S,O);k(O,E)}function j(O){k(O,b.current)}function P(){const O=_.current[b.current];S[b.current]!==O&&h(S)}function k(O,E,{commit:I}={commit:!1}){const D=kce(o),z=Oce(Math.round((O-r)/o)*o+r,D),$=vm(z,[r,i]);C((G=[])=>{const R=Ace(G,$,E);if(Pce(R,l*o)){b.current=R.indexOf($);const L=String(R)!==String(G);return L&&I&&h(R),L?R:G}else return G})}return a.jsx(bce,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:b,thumbs:y.current,values:S,orientation:s,form:g,children:a.jsx(AA.Provider,{scope:t.__scopeSlider,children:a.jsx(AA.Slot,{scope:t.__scopeSlider,children:a.jsx(w,{"aria-disabled":c,"data-disabled":c?"":void 0,...m,ref:e,onPointerDown:Te(m.onPointerDown,()=>{c||(_.current=S)}),min:r,max:i,inverted:p,onSlideStart:c?void 0:A,onSlideMove:c?void 0:j,onSlideEnd:c?void 0:P,onHomeKeyDown:()=>!c&&k(r,0,{commit:!0}),onEndKeyDown:()=>!c&&k(i,S.length-1,{commit:!0}),onStepKeyDown:({event:O,direction:E})=>{if(!c){const z=N6.includes(O.key)||O.shiftKey&&P6.includes(O.key)?10:1,$=b.current,G=S[$],R=o*z*E;k(G+R,$,{commit:!0})}}})})})})});I6.displayName=Wf;var[R6,M6]=O6(Wf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),wce=v.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:o,onSlideStart:s,onSlideMove:c,onSlideEnd:l,onStepKeyDown:u,...d}=t,[f,h]=v.useState(null),p=Pt(e,w=>h(w)),g=v.useRef(),m=Nu(i),y=m==="ltr",b=y&&!o||!y&&o;function x(w){const S=g.current||f.getBoundingClientRect(),C=[0,S.width],A=vN(C,b?[n,r]:[r,n]);return g.current=S,A(w-S.left)}return a.jsx(R6,{scope:t.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(D6,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=x(w.clientX);s==null||s(S)},onSlideMove:w=>{const S=x(w.clientX);c==null||c(S)},onSlideEnd:()=>{g.current=void 0,l==null||l()},onStepKeyDown:w=>{const C=k6[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:C?-1:1})}})})}),Sce=v.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=t,d=v.useRef(null),f=Pt(e,d),h=v.useRef(),p=!i;function g(m){const y=h.current||d.current.getBoundingClientRect(),b=[0,y.height],w=vN(b,p?[r,n]:[n,r]);return h.current=y,w(m-y.top)}return a.jsx(R6,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(D6,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const y=g(m.clientY);o==null||o(y)},onSlideMove:m=>{const y=g(m.clientY);s==null||s(y)},onSlideEnd:()=>{h.current=void 0,c==null||c()},onStepKeyDown:m=>{const b=k6[p?"from-bottom":"from-top"].includes(m.key);l==null||l({event:m,direction:b?-1:1})}})})}),D6=v.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:c,onStepKeyDown:l,...u}=t,d=tw(Wf,n);return a.jsx(it.span,{...u,ref:e,onKeyDown:Te(t.onKeyDown,f=>{f.key==="Home"?(s(f),f.preventDefault()):f.key==="End"?(c(f),f.preventDefault()):N6.concat(P6).includes(f.key)&&(l(f),f.preventDefault())}),onPointerDown:Te(t.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Te(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Te(t.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),$6="SliderTrack",L6=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=tw($6,n);return a.jsx(it.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});L6.displayName=$6;var jA="SliderRange",F6=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=tw(jA,n),o=M6(jA,n),s=v.useRef(null),c=Pt(e,s),l=i.values.length,u=i.values.map(h=>U6(h,i.min,i.max)),d=l>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(it.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});F6.displayName=jA;var EA="SliderThumb",B6=v.forwardRef((t,e)=>{const n=yce(t.__scopeSlider),[r,i]=v.useState(null),o=Pt(e,c=>i(c)),s=v.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(Cce,{...t,ref:o,index:s})}),Cce=v.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...o}=t,s=tw(EA,n),c=M6(EA,n),[l,u]=v.useState(null),d=Pt(e,x=>u(x)),f=l?s.form||!!l.closest("form"):!0,h=pg(l),p=s.values[r],g=p===void 0?0:U6(p,s.min,s.max),m=jce(r,s.values.length),y=h==null?void 0:h[c.size],b=y?Tce(y,g,c.direction):0;return v.useEffect(()=>{if(l)return s.thumbs.add(l),()=>{s.thumbs.delete(l)}},[l,s.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(AA.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(it.span,{role:"slider","aria-label":t["aria-label"]||m,"aria-valuemin":s.min,"aria-valuenow":p,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:s.disabled?void 0:0,...o,ref:d,style:p===void 0?{display:"none"}:t.style,onFocus:Te(t.onFocus,()=>{s.valueIndexToChangeRef.current=r})})}),f&&a.jsx(_ce,{name:i??(s.name?s.name+(s.values.length>1?"[]":""):void 0),form:s.form,value:p},r)]})});B6.displayName=EA;var _ce=t=>{const{value:e,...n}=t,r=v.useRef(null),i=wg(e);return v.useEffect(()=>{const o=r.current,s=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(s,"value").set;if(i!==e&&l){const u=new Event("input",{bubbles:!0});l.call(o,e),o.dispatchEvent(u)}},[i,e]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:e})};function Ace(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,o)=>i-o)}function U6(t,e,n){const o=100/(n-e)*(t-e);return vm(o,[0,100])}function jce(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Ece(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function Tce(t,e,n){const r=t/2,o=vN([0,50],[0,r]);return(r-o(e)*n)*n}function Nce(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Pce(t,e){if(e>0){const n=Nce(t);return Math.min(...n)>=e}return!0}function vN(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function kce(t){return(String(t).split(".")[1]||"").length}function Oce(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var H6=I6,Ice=L6,Rce=F6,Mce=B6;const br=v.forwardRef(({className:t,...e},n)=>a.jsxs(H6,{ref:n,className:Ne("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(Ice,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(Rce,{className:"absolute h-full bg-primary"})}),a.jsx(Mce,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));br.displayName=H6.displayName;var yN="Switch",[Dce,dFe]=Li(yN),[$ce,Lce]=Dce(yN),z6=v.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:s,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=t,[h,p]=v.useState(null),g=Pt(e,w=>p(w)),m=v.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=as({prop:i,defaultProp:o,onChange:u});return a.jsxs($ce,{scope:n,checked:b,disabled:c,children:[a.jsx(it.button,{type:"button",role:"switch","aria-checked":b,"aria-required":s,"data-state":K6(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:g,onClick:Te(t.onClick,w=>{x(S=>!S),y&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),y&&a.jsx(Fce,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})});z6.displayName=yN;var G6="SwitchThumb",V6=v.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=Lce(G6,n);return a.jsx(it.span,{"data-state":K6(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});V6.displayName=G6;var Fce=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=v.useRef(null),s=wg(n),c=pg(e);return v.useEffect(()=>{const l=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function K6(t){return t?"checked":"unchecked"}var W6=z6,Bce=V6;const ym=v.forwardRef(({className:t,...e},n)=>a.jsx(W6,{className:Ne("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:a.jsx(Bce,{className:Ne("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));ym.displayName=W6.displayName;function Uce(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Hce(i,...e)]}function Hce(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var eC="rovingFocusGroup.onEntryFocus",zce={bubbles:!1,cancelable:!0},nw="RovingFocusGroup",[TA,q6,Gce]=q0(nw),[Vce,qf]=Uce(nw,[Gce]),[Kce,Wce]=Vce(nw),Y6=v.forwardRef((t,e)=>a.jsx(TA.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(TA.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(qce,{...t,ref:e})})}));Y6.displayName=nw;var qce=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,h=v.useRef(null),p=Pt(e,h),g=Nu(o),[m=null,y]=as({prop:s,defaultProp:c,onChange:l}),[b,x]=v.useState(!1),w=Cr(u),S=q6(n),C=v.useRef(!1),[_,A]=v.useState(0);return v.useEffect(()=>{const j=h.current;if(j)return j.addEventListener(eC,w),()=>j.removeEventListener(eC,w)},[w]),a.jsx(Kce,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(j=>y(j),[y]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>A(j=>j+1),[]),onFocusableItemRemove:v.useCallback(()=>A(j=>j-1),[]),children:a.jsx(it.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Te(t.onMouseDown,()=>{C.current=!0}),onFocus:Te(t.onFocus,j=>{const P=!C.current;if(j.target===j.currentTarget&&P&&!b){const k=new CustomEvent(eC,zce);if(j.currentTarget.dispatchEvent(k),!k.defaultPrevented){const O=S().filter($=>$.focusable),E=O.find($=>$.active),I=O.find($=>$.id===m),z=[E,I,...O].filter(Boolean).map($=>$.ref.current);J6(z,d)}}C.current=!1}),onBlur:Te(t.onBlur,()=>x(!1))})})}),Q6="RovingFocusGroupItem",X6=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=t,c=Xo(),l=o||c,u=Wce(Q6,n),d=u.currentTabStopId===l,f=q6(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(TA.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:a.jsx(it.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:Te(t.onMouseDown,g=>{r?u.onItemFocus(l):g.preventDefault()}),onFocus:Te(t.onFocus,()=>u.onItemFocus(l)),onKeyDown:Te(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=Xce(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=f().filter(x=>x.focusable).map(x=>x.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const x=b.indexOf(g.currentTarget);b=u.loop?Jce(b,x+1):b.slice(x+1)}setTimeout(()=>J6(b))}})})})});X6.displayName=Q6;var Yce={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qce(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Xce(t,e,n){const r=Qce(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Yce[r]}function J6(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Jce(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var xN=Y6,bN=X6,wN="Tabs",[Zce,fFe]=Li(wN,[qf]),Z6=qf(),[ele,SN]=Zce(wN),eH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:c,activationMode:l="automatic",...u}=t,d=Nu(c),[f,h]=as({prop:r,onChange:i,defaultProp:o});return a.jsx(ele,{scope:n,baseId:Xo(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:l,children:a.jsx(it.div,{dir:d,"data-orientation":s,...u,ref:e})})});eH.displayName=wN;var tH="TabsList",nH=v.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,o=SN(tH,n),s=Z6(n);return a.jsx(xN,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(it.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});nH.displayName=tH;var rH="TabsTrigger",iH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=t,s=SN(rH,n),c=Z6(n),l=aH(s.baseId,r),u=cH(s.baseId,r),d=r===s.value;return a.jsx(bN,{asChild:!0,...c,focusable:!i,active:d,children:a.jsx(it.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:e,onMouseDown:Te(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Te(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Te(t.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});iH.displayName=rH;var oH="TabsContent",sH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=t,c=SN(oH,n),l=aH(c.baseId,r),u=cH(c.baseId,r),d=r===c.value,f=v.useRef(d);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(Wr,{present:i||d,children:({present:h})=>a.jsx(it.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...s,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});sH.displayName=oH;function aH(t,e){return`${t}-trigger-${e}`}function cH(t,e){return`${t}-content-${e}`}var tle=eH,lH=nH,uH=iH,dH=sH;const dl=tle,Va=v.forwardRef(({className:t,...e},n)=>a.jsx(lH,{ref:n,className:Ne("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Va.displayName=lH.displayName;const mn=v.forwardRef(({className:t,...e},n)=>a.jsx(uH,{ref:n,className:Ne("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));mn.displayName=uH.displayName;const gn=v.forwardRef(({className:t,...e},n)=>a.jsx(dH,{ref:n,className:Ne("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));gn.displayName=dH.displayName;const nle=Oe.object({name:Oe.string().min(2,{message:"Name must be at least 2 characters."}),age:Oe.string().min(1,{message:"Age is required."}),gender:Oe.string().min(1,{message:"Gender is required."}),occupation:Oe.string().min(2,{message:"Occupation is required."}),education:Oe.string().min(1,{message:"Education is required."}),location:Oe.string().min(2,{message:"Location is required."}),ethnicity:Oe.string().optional(),personality:Oe.string(),interests:Oe.string(),hasPurchasingPower:Oe.boolean().optional(),hasChildren:Oe.boolean().optional(),techSavviness:Oe.number().min(0).max(100),brandLoyalty:Oe.number().min(0).max(100),priceConsciousness:Oe.number().min(0).max(100),environmentalConcern:Oe.number().min(0).max(100),socialGrade:Oe.string().optional(),householdIncome:Oe.string().optional(),householdComposition:Oe.string().optional(),livingSituation:Oe.string().optional(),goals:Oe.array(Oe.string()).optional(),frustrations:Oe.array(Oe.string()).optional(),motivations:Oe.array(Oe.string()).optional(),scenarios:Oe.array(Oe.string()).optional(),scenarioType:Oe.string().optional(),oceanTraits:Oe.object({openness:Oe.number().min(0).max(100),conscientiousness:Oe.number().min(0).max(100),extraversion:Oe.number().min(0).max(100),agreeableness:Oe.number().min(0).max(100),neuroticism:Oe.number().min(0).max(100)}).optional(),thinkFeelDo:Oe.object({thinks:Oe.array(Oe.string()),feels:Oe.array(Oe.string()),does:Oe.array(Oe.string())}).optional(),mediaConsumption:Oe.string().optional(),deviceUsage:Oe.string().optional(),shoppingHabits:Oe.string().optional(),brandPreferences:Oe.string().optional(),communicationPreferences:Oe.string().optional(),paymentMethods:Oe.string().optional(),purchaseBehaviour:Oe.string().optional(),coreValues:Oe.string().optional(),lifestyleChoices:Oe.string().optional(),socialActivities:Oe.string().optional(),categoryKnowledge:Oe.string().optional(),decisionInfluences:Oe.string().optional(),painPoints:Oe.string().optional(),journeyContext:Oe.string().optional(),keyTouchpoints:Oe.string().optional(),selfDeterminationNeeds:Oe.object({autonomy:Oe.string(),competence:Oe.string(),relatedness:Oe.string()}).optional(),fears:Oe.array(Oe.string()).optional(),narrative:Oe.string().optional(),additionalInformation:Oe.string().optional()});function rle({targetFolderId:t,targetFolderName:e}){const[n,r]=v.useState(1),[i,o]=v.useState(!1),[s,c]=v.useState(!1),[l,u]=v.useState(0),d=ar(),{isAuthenticated:f,login:h}=Xs();v.useEffect(()=>{u(0)},[]),v.useEffect(()=>{(async()=>{if(!f&&!s){c(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const A=localStorage.getItem("auth_token");A?(console.log("Token successfully stored:",A.substring(0,10)+"..."),Ye.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),Ye.error("Authentication problem, token not stored"))}catch(A){console.error("Auto login failed:",A)}finally{c(!1)}}})()},[]);const p=z0({resolver:G0(nle),defaultValues:{name:"",age:"",gender:"",occupation:"",education:"",location:"",ethnicity:"",personality:"",interests:"",hasPurchasingPower:!1,hasChildren:!1,techSavviness:50,brandLoyalty:50,priceConsciousness:50,environmentalConcern:50,socialGrade:"",householdIncome:"",householdComposition:"",livingSituation:"",goals:[],frustrations:[],motivations:[],scenarios:[],scenarioType:"",oceanTraits:{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:{thinks:[],feels:[],does:[]},mediaConsumption:"",deviceUsage:"",shoppingHabits:"",brandPreferences:"",communicationPreferences:"",paymentMethods:"",purchaseBehaviour:"",coreValues:"",lifestyleChoices:"",socialActivities:"",categoryKnowledge:"",decisionInfluences:"",painPoints:"",journeyContext:"",keyTouchpoints:"",selfDeterminationNeeds:{autonomy:"",competence:"",relatedness:""},fears:[],narrative:"",additionalInformation:""}}),g=_=>{const A=p.getValues(_)||[];p.setValue(_,[...A,""])},m=(_,A,j)=>{const k=[...p.getValues(_)||[]];k[A]=j,p.setValue(_,k)},y=(_,A)=>{const P=[...p.getValues(_)||[]];P.splice(A,1),p.setValue(_,P)},b=_=>{const A=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},j={...A,[_]:[...A[_]||[],""]};p.setValue("thinkFeelDo",j)},x=(_,A,j)=>{const P=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},k=[...P[_]||[]];k[A]=j;const O={...P,[_]:k};p.setValue("thinkFeelDo",O)},w=(_,A)=>{const j=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},P=[...j[_]||[]];P.splice(A,1);const k={...j,[_]:P};p.setValue("thinkFeelDo",k)},S=(_,A)=>{const P={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[_]:A};p.setValue("oceanTraits",P)};async function C(_,A=!1){var j,P,k,O,E;if(A&&l>=1){console.log("Max retry attempts reached, stopping retry loop"),Ye.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}A?(u(I=>I+1),console.log(`Retry attempt ${l+1}`)):u(0),o(!0);try{if(!f)try{console.log("Not authenticated, attempting login with default credentials before submission"),await h("user","pass"),console.log("Login successful before persona creation")}catch(L){console.error("Login failed before persona creation:",L),Ye.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}const I=`persona-generation-${Date.now()}`,D=t&&e?` in "${e}" folder`:"",z=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${z}${D}`),Ye.createPersistent({id:I,title:`Generating ${z}...`,description:`Creating synthetic user profile${n>1?"s":""}${D}`,type:"info"});const $={..._,oceanTraits:_.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:_.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:t||void 0},G={id:`temp-${Date.now()}`,...$},R=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(R.push(G),localStorage.setItem("tempPersonas",JSON.stringify(R)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),Ye.error("Authentication required",{description:"No valid token found. Please log in again."});try{console.log("No token found, attempting new login"),await h("user","pass"),console.log("Login successful, token:",((j=localStorage.getItem("auth_token"))==null?void 0:j.substring(0,10))+"...")}catch(Y){throw console.error("Login retry failed:",Y),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const W=await zr.create($);console.log("Persona created successfully:",W),Ye.updatePersistent(I,{title:"Synthetic user created successfully",description:`Created profile for ${_.name}`,type:"success"})}catch(L){throw console.error("Error creating persona via API:",L),L.response&&L.response.status===401&&Ye.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),L}else{const L=[];L.push($);for(let W=1;W{d("/synthetic-users?mode=view")},300)}catch(I){if(console.error("Error creating personas:",I),I.response&&I.response.status===401||I.message&&I.message.includes("Authentication failed")&&l<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const D=await ey.login("user","pass");if((k=D==null?void 0:D.data)!=null&&k.access_token){localStorage.setItem("auth_token",D.data.access_token),localStorage.setItem("user",JSON.stringify(D.data.user)),console.log("Manual login successful, got new token:",D.data.access_token.substring(0,10)+"..."),Ye.info("Logged in with default account, retrying submission..."),setTimeout(()=>{C(_,!0)},500);return}else throw new Error("No access token received")}catch(D){console.error("Login retry failed:",D),Ye.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else Ye.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((E=(O=I.response)==null?void 0:O.data)==null?void 0:E.message)||I.message||"An unexpected error occurred",type:"error"})}finally{o(!1)}}return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"text-2xl font-sf font-semibold",children:"Create Synthetic Users"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(J,{variant:"outline",size:"sm",onClick:()=>r(Math.max(1,n-1)),children:"-"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dr,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(J,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(K0,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(C),className:"space-y-6",children:[a.jsxs(dl,{defaultValue:"basic",children:[a.jsxs(Va,{className:"grid w-full grid-cols-6",children:[a.jsx(mn,{value:"basic",children:"Basic"}),a.jsx(mn,{value:"cooper",children:"Cooper"}),a.jsx(mn,{value:"personality",children:"Personality"}),a.jsx(mn,{value:"demographics",children:"Demographics"}),a.jsx(mn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(mn,{value:"extended",children:"Extended"})]}),a.jsx(gn,{value:"basic",className:"mt-6",children:a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"name",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Name"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Jane Smith",..._})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(vt,{control:p.control,name:"age",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Age Range"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select age range"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"18-24",children:"18-24"}),a.jsx(oe,{value:"25-34",children:"25-34"}),a.jsx(oe,{value:"35-44",children:"35-44"}),a.jsx(oe,{value:"45-54",children:"45-54"}),a.jsx(oe,{value:"55-64",children:"55-64"}),a.jsx(oe,{value:"65+",children:"65+"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"gender",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Gender"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select gender"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"Male",children:"Male"}),a.jsx(oe,{value:"Female",children:"Female"}),a.jsx(oe,{value:"Non-binary",children:"Non-binary"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})})]}),a.jsx(vt,{control:p.control,name:"occupation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Occupation"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Software Engineer",..._})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"education",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Education"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select education level"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"High School",children:"High School"}),a.jsx(oe,{value:"Some College",children:"Some College"}),a.jsx(oe,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(oe,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(oe,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(oe,{value:"PhD",children:"PhD"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"location",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Location"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"New York, USA",..._})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"ethnicity",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Ethnicity (Optional)"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select ethnicity"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"white",children:"White"}),a.jsx(oe,{value:"black",children:"Black"}),a.jsx(oe,{value:"asian",children:"Asian"}),a.jsx(oe,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(oe,{value:"native-american",children:"Native American"}),a.jsx(oe,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(oe,{value:"mixed",children:"Mixed"}),a.jsx(oe,{value:"other",children:"Other"}),a.jsx(oe,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"personality",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Personality Traits"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Curious, analytical, detail-oriented",..._,rows:3})}),a.jsx(Nn,{children:"Describe key personality traits that define this user"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"interests",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Interests"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Technology, fitness, cooking, travel",..._,rows:3})}),a.jsx(Nn,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(vt,{control:p.control,name:"techSavviness",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"brandLoyalty",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"priceConsciousness",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"environmentalConcern",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(vt,{control:p.control,name:"hasPurchasingPower",render:({field:_})=>a.jsxs(dt,{className:"flex items-center justify-between",children:[a.jsx(ft,{children:"Purchasing Power"}),a.jsx(ht,{children:a.jsx(ym,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"hasChildren",render:({field:_})=>a.jsxs(dt,{className:"flex items-center justify-between",children:[a.jsx(ft,{children:"Has Children"}),a.jsx(ht,{children:a.jsx(ym,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(pt,{})]})})]})]})]})]})})})}),a.jsxs(gn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(p.watch("goals")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("goals",A,j.target.value),placeholder:"Enter a goal"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("goals",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(p.watch("frustrations")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("frustrations",A,j.target.value),placeholder:"Enter a frustration"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("frustrations",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(p.watch("motivations")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("motivations",A,j.target.value),placeholder:"Enter a motivation"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("motivations",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).thinks||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("thinks",A,j.target.value),placeholder:"What they think"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).feels||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("feels",A,j.target.value),placeholder:"What they feel"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).does||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("does",A,j.target.value),placeholder:"What they do"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"scenarioType",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Scenario Section Title"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Life Scenarios",..._})}),a.jsx(Nn,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(pt,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(mt,{value:_,onChange:j=>m("scenarios",A,j.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("scenarios",A),className:"mt-2",children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(gn,{value:"personality",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{openness:50}).openness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:_=>S("openness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:_=>S("conscientiousness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:_=>S("extraversion",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:_=>S("agreeableness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:_=>S("neuroticism",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(gn,{value:"demographics",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"socialGrade",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Social Grade"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select social grade"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"A",children:"A - Higher managerial"}),a.jsx(oe,{value:"B",children:"B - Intermediate managerial"}),a.jsx(oe,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(oe,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(oe,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(oe,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"householdIncome",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Household Income"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select income range"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"Under $25k",children:"Under $25,000"}),a.jsx(oe,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(oe,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(oe,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(oe,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(oe,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(oe,{value:"Over $250k",children:"Over $250,000"}),a.jsx(oe,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"householdComposition",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Household Composition"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select household type"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"Single person",children:"Single person"}),a.jsx(oe,{value:"Couple without children",children:"Couple without children"}),a.jsx(oe,{value:"Couple with children",children:"Couple with children"}),a.jsx(oe,{value:"Single parent",children:"Single parent"}),a.jsx(oe,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(oe,{value:"Shared housing",children:"Shared housing"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"livingSituation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Living Situation"}),a.jsxs(Bn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select living situation"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"Own home",children:"Own home"}),a.jsx(oe,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(oe,{value:"Rent house",children:"Rent house"}),a.jsx(oe,{value:"Live with family",children:"Live with family"}),a.jsx(oe,{value:"Student housing",children:"Student housing"}),a.jsx(oe,{value:"Assisted living",children:"Assisted living"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})})]})]})]})})}),a.jsx(gn,{value:"lifestyle",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"mediaConsumption",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Media Consumption"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"TV shows, podcasts, news sources, social media platforms",..._,rows:3})}),a.jsx(Nn,{children:"Describe media consumption habits and preferences"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"deviceUsage",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Device Usage"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",..._,rows:3})}),a.jsx(Nn,{children:"Primary devices and usage patterns"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"shoppingHabits",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Shopping Habits"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Online vs in-store, frequency, preferred retailers",..._,rows:3})}),a.jsx(Nn,{children:"Shopping behavior and preferences"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"brandPreferences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Brand Preferences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Favorite brands, brand values alignment",..._,rows:3})}),a.jsx(Nn,{children:"Preferred brands and reasoning"}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"communicationPreferences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Communication Preferences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Email, phone, text, video calls, in-person",..._,rows:3})}),a.jsx(Nn,{children:"Preferred communication methods and channels"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"paymentMethods",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Payment Methods"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Credit cards, digital wallets, cash, BNPL",..._,rows:3})}),a.jsx(Nn,{children:"Preferred payment methods and financial tools"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"purchaseBehaviour",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Purchase Behavior"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Research habits, decision factors, impulse vs planned buying",..._,rows:3})}),a.jsx(Nn,{children:"How they approach making purchase decisions"}),a.jsx(pt,{})]})})]})]})]})})}),a.jsxs(gn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"coreValues",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Core Values"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Key principles and values that guide decisions",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"lifestyleChoices",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Lifestyle Choices"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Health, fitness, diet, work-life balance preferences",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"socialActivities",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Social Activities"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Social hobbies, community involvement, networking",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"categoryKnowledge",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Category Knowledge"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Expertise in specific product/service categories",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"decisionInfluences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Decision Influences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"What factors most influence their decisions",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"painPoints",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Pain Points"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Common challenges and friction points",..._,rows:3})}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"journeyContext",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Journey Context"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Current life stage and contextual factors",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"keyTouchpoints",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Key Touchpoints"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Important interaction points and channels",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Autonomy"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need for independence and self-direction",..._,rows:2})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Competence"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need to feel capable and effective",..._,rows:2})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Relatedness"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need for connection and belonging",..._,rows:2})}),a.jsx(pt,{})]})})]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(p.watch("fears")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("fears",A,j.target.value),placeholder:"Enter a fear or concern"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("fears",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(vt,{control:p.control,name:"narrative",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Personal Narrative"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Personal story, background, key life experiences",..._,rows:4})}),a.jsx(Nn,{children:"A brief narrative that captures their personal story"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"additionalInformation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Additional Information"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Any other relevant details or context",..._,rows:4})}),a.jsx(Nn,{children:"Additional context or details not covered elsewhere"}),a.jsx(pt,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(J,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(J,{type:"submit",disabled:i,children:[i?a.jsx(tZ,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(DE,{className:"mr-2 h-4 w-4"}),i?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var NA=["Enter"," "],ile=["ArrowDown","PageUp","Home"],fH=["ArrowUp","PageDown","End"],ole=[...ile,...fH],sle={ltr:[...NA,"ArrowRight"],rtl:[...NA,"ArrowLeft"]},ale={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Eg="Menu",[xm,cle,lle]=q0(Eg),[Pu,hH]=Li(Eg,[lle,Df,qf]),rw=Df(),pH=qf(),[ule,ku]=Pu(Eg),[dle,Tg]=Pu(Eg),mH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=t,c=rw(e),[l,u]=v.useState(null),d=v.useRef(!1),f=Cr(o),h=Nu(i);return v.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(k4,{...c,children:a.jsx(ule,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:u,children:a.jsx(dle,{scope:e,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:s,children:r})})})};mH.displayName=Eg;var fle="MenuAnchor",CN=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=rw(n);return a.jsx(bE,{...i,...r,ref:e})});CN.displayName=fle;var _N="MenuPortal",[hle,gH]=Pu(_N,{forceMount:void 0}),vH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,o=ku(_N,e);return a.jsx(hle,{scope:e,forceMount:n,children:a.jsx(Wr,{present:n||o.open,children:a.jsx(d0,{asChild:!0,container:i,children:r})})})};vH.displayName=_N;var Ao="MenuContent",[ple,AN]=Pu(Ao),yH=v.forwardRef((t,e)=>{const n=gH(Ao,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=ku(Ao,t.__scopeMenu),s=Tg(Ao,t.__scopeMenu);return a.jsx(xm.Provider,{scope:t.__scopeMenu,children:a.jsx(Wr,{present:r||o.open,children:a.jsx(xm.Slot,{scope:t.__scopeMenu,children:s.modal?a.jsx(mle,{...i,ref:e}):a.jsx(gle,{...i,ref:e})})})})}),mle=v.forwardRef((t,e)=>{const n=ku(Ao,t.__scopeMenu),r=v.useRef(null),i=Pt(e,r);return v.useEffect(()=>{const o=r.current;if(o)return cN(o)},[]),a.jsx(jN,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Te(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),gle=v.forwardRef((t,e)=>{const n=ku(Ao,t.__scopeMenu);return a.jsx(jN,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),jN=v.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=t,y=ku(Ao,n),b=Tg(Ao,n),x=rw(n),w=pH(n),S=cle(n),[C,_]=v.useState(null),A=v.useRef(null),j=Pt(e,A,y.onContentChange),P=v.useRef(0),k=v.useRef(""),O=v.useRef(0),E=v.useRef(null),I=v.useRef("right"),D=v.useRef(0),z=g?X0:v.Fragment,$=g?{as:Hs,allowPinchZoom:!0}:void 0,G=L=>{var ae,De;const W=k.current+L,Y=S().filter(de=>!de.disabled),te=document.activeElement,me=(ae=Y.find(de=>de.ref.current===te))==null?void 0:ae.textValue,F=Y.map(de=>de.textValue),se=Tle(F,W,me),ne=(De=Y.find(de=>de.textValue===se))==null?void 0:De.ref.current;(function de(ye){k.current=ye,window.clearTimeout(P.current),ye!==""&&(P.current=window.setTimeout(()=>de(""),1e3))})(W),ne&&setTimeout(()=>ne.focus())};v.useEffect(()=>()=>window.clearTimeout(P.current),[]),aN();const R=v.useCallback(L=>{var Y,te;return I.current===((Y=E.current)==null?void 0:Y.side)&&Ple(L,(te=E.current)==null?void 0:te.area)},[]);return a.jsx(ple,{scope:n,searchRef:k,onItemEnter:v.useCallback(L=>{R(L)&&L.preventDefault()},[R]),onItemLeave:v.useCallback(L=>{var W;R(L)||((W=A.current)==null||W.focus(),_(null))},[R]),onTriggerLeave:v.useCallback(L=>{R(L)&&L.preventDefault()},[R]),pointerGraceTimerRef:O,onPointerGraceIntentChange:v.useCallback(L=>{E.current=L},[]),children:a.jsx(z,{...$,children:a.jsx(Y0,{asChild:!0,trapped:i,onMountAutoFocus:Te(o,L=>{var W;L.preventDefault(),(W=A.current)==null||W.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(xN,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:_,onEntryFocus:Te(l,L=>{b.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(wE,{role:"menu","aria-orientation":"vertical","data-state":RH(y.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:j,style:{outline:"none",...m.style},onKeyDown:Te(m.onKeyDown,L=>{const Y=L.target.closest("[data-radix-menu-content]")===L.currentTarget,te=L.ctrlKey||L.altKey||L.metaKey,me=L.key.length===1;Y&&(L.key==="Tab"&&L.preventDefault(),!te&&me&&G(L.key));const F=A.current;if(L.target!==F||!ole.includes(L.key))return;L.preventDefault();const ne=S().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);fH.includes(L.key)&&ne.reverse(),jle(ne)}),onBlur:Te(t.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(P.current),k.current="")}),onPointerMove:Te(t.onPointerMove,bm(L=>{const W=L.target,Y=D.current!==L.clientX;if(L.currentTarget.contains(W)&&Y){const te=L.clientX>D.current?"right":"left";I.current=te,D.current=L.clientX}}))})})})})})})});yH.displayName=Ao;var vle="MenuGroup",EN=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{role:"group",...r,ref:e})});EN.displayName=vle;var yle="MenuLabel",xH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{...r,ref:e})});xH.displayName=yle;var Px="MenuItem",AR="menu.itemSelect",iw=v.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,o=v.useRef(null),s=Tg(Px,t.__scopeMenu),c=AN(Px,t.__scopeMenu),l=Pt(e,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const h=new CustomEvent(AR,{bubbles:!0,cancelable:!0});f.addEventListener(AR,p=>r==null?void 0:r(p),{once:!0}),u4(f,h),h.defaultPrevented?u.current=!1:s.onClose()}};return a.jsx(bH,{...i,ref:l,disabled:n,onClick:Te(t.onClick,d),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),u.current=!0},onPointerUp:Te(t.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Te(t.onKeyDown,f=>{const h=c.searchRef.current!=="";n||h&&f.key===" "||NA.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});iw.displayName=Px;var bH=v.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=t,s=AN(Px,n),c=pH(n),l=v.useRef(null),u=Pt(e,l),[d,f]=v.useState(!1),[h,p]=v.useState("");return v.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[o.children]),a.jsx(xm.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:a.jsx(bN,{asChild:!0,...c,focusable:!r,children:a.jsx(it.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:Te(t.onPointerMove,bm(g=>{r?s.onItemLeave(g):(s.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(t.onPointerLeave,bm(g=>s.onItemLeave(g))),onFocus:Te(t.onFocus,()=>f(!0)),onBlur:Te(t.onBlur,()=>f(!1))})})})}),xle="MenuCheckboxItem",wH=v.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return a.jsx(jH,{scope:t.__scopeMenu,checked:n,children:a.jsx(iw,{role:"menuitemcheckbox","aria-checked":kx(n)?"mixed":n,...i,ref:e,"data-state":NN(n),onSelect:Te(i.onSelect,()=>r==null?void 0:r(kx(n)?!0:!n),{checkForDefaultPrevented:!1})})})});wH.displayName=xle;var SH="MenuRadioGroup",[ble,wle]=Pu(SH,{value:void 0,onValueChange:()=>{}}),CH=v.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,o=Cr(r);return a.jsx(ble,{scope:t.__scopeMenu,value:n,onValueChange:o,children:a.jsx(EN,{...i,ref:e})})});CH.displayName=SH;var _H="MenuRadioItem",AH=v.forwardRef((t,e)=>{const{value:n,...r}=t,i=wle(_H,t.__scopeMenu),o=n===i.value;return a.jsx(jH,{scope:t.__scopeMenu,checked:o,children:a.jsx(iw,{role:"menuitemradio","aria-checked":o,...r,ref:e,"data-state":NN(o),onSelect:Te(r.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,n)},{checkForDefaultPrevented:!1})})})});AH.displayName=_H;var TN="MenuItemIndicator",[jH,Sle]=Pu(TN,{checked:!1}),EH=v.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,o=Sle(TN,n);return a.jsx(Wr,{present:r||kx(o.checked)||o.checked===!0,children:a.jsx(it.span,{...i,ref:e,"data-state":NN(o.checked)})})});EH.displayName=TN;var Cle="MenuSeparator",TH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});TH.displayName=Cle;var _le="MenuArrow",NH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=rw(n);return a.jsx(SE,{...i,...r,ref:e})});NH.displayName=_le;var Ale="MenuSub",[hFe,PH]=Pu(Ale),Yh="MenuSubTrigger",kH=v.forwardRef((t,e)=>{const n=ku(Yh,t.__scopeMenu),r=Tg(Yh,t.__scopeMenu),i=PH(Yh,t.__scopeMenu),o=AN(Yh,t.__scopeMenu),s=v.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:t.__scopeMenu},d=v.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=c.current;return()=>{window.clearTimeout(f),l(null)}},[c,l]),a.jsx(CN,{asChild:!0,...u,children:a.jsx(bH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":RH(n.open),...t,ref:a0(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Te(t.onPointerMove,bm(f=>{o.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Te(t.onPointerLeave,bm(f=>{var p,g;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,y=m==="right",b=y?-5:5,x=h[y?"left":"right"],w=h[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x,y:h.bottom}],side:m}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Te(t.onKeyDown,f=>{var p;const h=o.searchRef.current!=="";t.disabled||h&&f.key===" "||sle[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});kH.displayName=Yh;var OH="MenuSubContent",IH=v.forwardRef((t,e)=>{const n=gH(Ao,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=ku(Ao,t.__scopeMenu),s=Tg(Ao,t.__scopeMenu),c=PH(OH,t.__scopeMenu),l=v.useRef(null),u=Pt(e,l);return a.jsx(xm.Provider,{scope:t.__scopeMenu,children:a.jsx(Wr,{present:r||o.open,children:a.jsx(xm.Slot,{scope:t.__scopeMenu,children:a.jsx(jN,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Te(t.onFocusOutside,d=>{d.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Te(t.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Te(t.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=ale[s.dir].includes(d.key);f&&h&&(o.onOpenChange(!1),(p=c.trigger)==null||p.focus(),d.preventDefault())})})})})})});IH.displayName=OH;function RH(t){return t?"open":"closed"}function kx(t){return t==="indeterminate"}function NN(t){return kx(t)?"indeterminate":t?"checked":"unchecked"}function jle(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Ele(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Tle(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=Ele(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Nle(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ple(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Nle(n,e)}function bm(t){return e=>e.pointerType==="mouse"?t(e):void 0}var kle=mH,Ole=CN,Ile=vH,Rle=yH,Mle=EN,Dle=xH,$le=iw,Lle=wH,Fle=CH,Ble=AH,Ule=EH,Hle=TH,zle=NH,Gle=kH,Vle=IH,PN="DropdownMenu",[Kle,pFe]=Li(PN,[hH]),Si=hH(),[Wle,MH]=Kle(PN),DH=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:c=!0}=t,l=Si(e),u=v.useRef(null),[d=!1,f]=as({prop:i,defaultProp:o,onChange:s});return a.jsx(Wle,{scope:e,triggerId:Xo(),triggerRef:u,contentId:Xo(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:c,children:a.jsx(kle,{...l,open:d,onOpenChange:f,dir:r,modal:c,children:n})})};DH.displayName=PN;var $H="DropdownMenuTrigger",LH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,o=MH($H,n),s=Si(n);return a.jsx(Ole,{asChild:!0,...s,children:a.jsx(it.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:a0(e,o.triggerRef),onPointerDown:Te(t.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:Te(t.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});LH.displayName=$H;var qle="DropdownMenuPortal",FH=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Si(e);return a.jsx(Ile,{...r,...n})};FH.displayName=qle;var BH="DropdownMenuContent",UH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=MH(BH,n),o=Si(n),s=v.useRef(!1);return a.jsx(Rle,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:e,onCloseAutoFocus:Te(t.onCloseAutoFocus,c=>{var l;s.current||(l=i.triggerRef.current)==null||l.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Te(t.onInteractOutside,c=>{const l=c.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!i.modal||d)&&(s.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});UH.displayName=BH;var Yle="DropdownMenuGroup",Qle=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Mle,{...i,...r,ref:e})});Qle.displayName=Yle;var Xle="DropdownMenuLabel",HH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Dle,{...i,...r,ref:e})});HH.displayName=Xle;var Jle="DropdownMenuItem",zH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx($le,{...i,...r,ref:e})});zH.displayName=Jle;var Zle="DropdownMenuCheckboxItem",GH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Lle,{...i,...r,ref:e})});GH.displayName=Zle;var eue="DropdownMenuRadioGroup",tue=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Fle,{...i,...r,ref:e})});tue.displayName=eue;var nue="DropdownMenuRadioItem",VH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Ble,{...i,...r,ref:e})});VH.displayName=nue;var rue="DropdownMenuItemIndicator",KH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Ule,{...i,...r,ref:e})});KH.displayName=rue;var iue="DropdownMenuSeparator",WH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Hle,{...i,...r,ref:e})});WH.displayName=iue;var oue="DropdownMenuArrow",sue=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(zle,{...i,...r,ref:e})});sue.displayName=oue;var aue="DropdownMenuSubTrigger",qH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Gle,{...i,...r,ref:e})});qH.displayName=aue;var cue="DropdownMenuSubContent",YH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Vle,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});YH.displayName=cue;var lue=DH,uue=LH,due=FH,QH=UH,XH=HH,JH=zH,ZH=GH,ez=VH,tz=KH,nz=WH,rz=qH,iz=YH;const PA=lue,kA=uue,fue=v.forwardRef(({className:t,inset:e,children:n,...r},i)=>a.jsxs(rz,{ref:i,className:Ne("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,a.jsx(fo,{className:"ml-auto h-4 w-4"})]}));fue.displayName=rz.displayName;const hue=v.forwardRef(({className:t,...e},n)=>a.jsx(iz,{ref:n,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));hue.displayName=iz.displayName;const Ox=v.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(due,{children:a.jsx(QH,{ref:r,sideOffset:e,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Ox.displayName=QH.displayName;const oc=v.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(JH,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));oc.displayName=JH.displayName;const pue=v.forwardRef(({className:t,children:e,checked:n,...r},i)=>a.jsxs(ZH,{ref:i,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tz,{children:a.jsx(Gs,{className:"h-4 w-4"})})}),e]}));pue.displayName=ZH.displayName;const mue=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(ez,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tz,{children:a.jsx(RE,{className:"h-2 w-2 fill-current"})})}),e]}));mue.displayName=ez.displayName;const gue=v.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(XH,{ref:r,className:Ne("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));gue.displayName=XH.displayName;const vue=v.forwardRef(({className:t,...e},n)=>a.jsx(nz,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",t),...e}));vue.displayName=nz.displayName;var kN="Dialog",[oz,sz]=Li(kN),[yue,ps]=oz(kN),az=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=t,c=v.useRef(null),l=v.useRef(null),[u=!1,d]=as({prop:r,defaultProp:i,onChange:o});return a.jsx(yue,{scope:e,triggerRef:c,contentRef:l,contentId:Xo(),titleId:Xo(),descriptionId:Xo(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:s,children:n})};az.displayName=kN;var cz="DialogTrigger",lz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(cz,n),o=Pt(e,i.triggerRef);return a.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":RN(i.open),...r,ref:o,onClick:Te(t.onClick,i.onOpenToggle)})});lz.displayName=cz;var ON="DialogPortal",[xue,uz]=oz(ON,{forceMount:void 0}),dz=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,o=ps(ON,e);return a.jsx(xue,{scope:e,forceMount:n,children:v.Children.map(r,s=>a.jsx(Wr,{present:n||o.open,children:a.jsx(d0,{asChild:!0,container:i,children:s})}))})};dz.displayName=ON;var Ix="DialogOverlay",fz=v.forwardRef((t,e)=>{const n=uz(Ix,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=ps(Ix,t.__scopeDialog);return o.modal?a.jsx(Wr,{present:r||o.open,children:a.jsx(bue,{...i,ref:e})}):null});fz.displayName=Ix;var bue=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(Ix,n);return a.jsx(X0,{as:Hs,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(it.div,{"data-state":RN(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),xu="DialogContent",hz=v.forwardRef((t,e)=>{const n=uz(xu,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=ps(xu,t.__scopeDialog);return a.jsx(Wr,{present:r||o.open,children:o.modal?a.jsx(wue,{...i,ref:e}):a.jsx(Sue,{...i,ref:e})})});hz.displayName=xu;var wue=v.forwardRef((t,e)=>{const n=ps(xu,t.__scopeDialog),r=v.useRef(null),i=Pt(e,n.contentRef,r);return v.useEffect(()=>{const o=r.current;if(o)return cN(o)},[]),a.jsx(pz,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(t.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Te(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&o.preventDefault()}),onFocusOutside:Te(t.onFocusOutside,o=>o.preventDefault())})}),Sue=v.forwardRef((t,e)=>{const n=ps(xu,t.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return a.jsx(pz,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,c;(s=t.onCloseAutoFocus)==null||s.call(t,o),o.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),pz=v.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=t,c=ps(xu,n),l=v.useRef(null),u=Pt(e,l);return aN(),a.jsxs(a.Fragment,{children:[a.jsx(Y0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:a.jsx(fg,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":RN(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(_ue,{titleId:c.titleId}),a.jsx(jue,{contentRef:l,descriptionId:c.descriptionId})]})]})}),IN="DialogTitle",mz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(IN,n);return a.jsx(it.h2,{id:i.titleId,...r,ref:e})});mz.displayName=IN;var gz="DialogDescription",vz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(gz,n);return a.jsx(it.p,{id:i.descriptionId,...r,ref:e})});vz.displayName=gz;var yz="DialogClose",xz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(yz,n);return a.jsx(it.button,{type:"button",...r,ref:e,onClick:Te(t.onClick,()=>i.onOpenChange(!1))})});xz.displayName=yz;function RN(t){return t?"open":"closed"}var bz="DialogTitleWarning",[Cue,wz]=G9(bz,{contentName:xu,titleName:IN,docsSlug:"dialog"}),_ue=({titleId:t})=>{const e=wz(bz),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. +`)},jae=0,Hu=[];function Eae(t){var e=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(jae++)[0],o=v.useState(D3)[0],s=v.useRef(t);v.useEffect(function(){s.current=t},[t]),v.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=qse([t.lockRef.current],(t.shards||[]).map(_R),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(i))}),function(){document.body.classList.remove("block-interactivity-".concat(i)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(i))})}}},[t.inert,t.lockRef.current,t.shards]);var c=v.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=xv(m),x=n.current,w="deltaX"in m?m.deltaX:x[0]-b[0],S="deltaY"in m?m.deltaY:x[1]-b[1],C,_=m.target,A=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in m&&A==="h"&&_.type==="range")return!1;var j=SR(A,_);if(!j)return!0;if(j?C=A:(C=A==="v"?"h":"v",j=SR(A,_)),!j)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=C),!C)return!0;var P=r.current||C;return Cae(P,y,m,P==="h"?w:S,!0)},[]),l=v.useCallback(function(m){var y=m;if(!(!Hu.length||Hu[Hu.length-1]!==o)){var b="deltaY"in y?CR(y):xv(y),x=e.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&_ae(C.delta,b)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(_R).filter(Boolean).filter(function(C){return C.contains(y.target)}),S=w.length>0?c(y,w[0]):!s.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),u=v.useCallback(function(m,y,b,x){var w={name:m,delta:y,target:b,should:x,shadowParent:Tae(b)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),d=v.useCallback(function(m){n.current=xv(m),r.current=void 0},[]),f=v.useCallback(function(m){u(m.type,CR(m),m.target,c(m,t.lockRef.current))},[]),h=v.useCallback(function(m){u(m.type,xv(m),m.target,c(m,t.lockRef.current))},[]);v.useEffect(function(){return Hu.push(o),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Uu),document.addEventListener("touchmove",l,Uu),document.addEventListener("touchstart",d,Uu),function(){Hu=Hu.filter(function(m){return m!==o}),document.removeEventListener("wheel",l,Uu),document.removeEventListener("touchmove",l,Uu),document.removeEventListener("touchstart",d,Uu)}},[]);var p=t.removeScrollBar,g=t.inert;return v.createElement(v.Fragment,null,g?v.createElement(o,{styles:Aae(i)}):null,p?v.createElement(gae,{gapMode:t.gapMode}):null)}function Tae(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Nae=rae(M3,Eae);var X0=v.forwardRef(function(t,e){return v.createElement(Q0,Ps({},t,{ref:e,sideCar:Nae}))});X0.classNames=Q0.classNames;var Pae=[" ","Enter","ArrowUp","ArrowDown"],kae=[" ","Enter"],Sg="Select",[J0,Z0,Oae]=q0(Sg),[Kf,cFe]=Li(Sg,[Oae,Df]),ew=Df(),[Iae,ll]=Kf(Sg),[Rae,Mae]=Kf(Sg),B3=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:i,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=t,m=ew(e),[y,b]=v.useState(null),[x,w]=v.useState(null),[S,C]=v.useState(!1),_=Nu(u),[A=!1,j]=as({prop:r,defaultProp:i,onChange:o}),[P,k]=as({prop:s,defaultProp:c,onChange:l}),O=v.useRef(null),E=y?g||!!y.closest("form"):!0,[I,D]=v.useState(new Set),z=Array.from(I).map($=>$.props.value).join(";");return a.jsx(k4,{...m,children:a.jsxs(Iae,{required:p,scope:e,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:Xo(),value:P,onValueChange:k,open:A,onOpenChange:j,dir:_,triggerPointerDownPosRef:O,disabled:h,children:[a.jsx(J0.Provider,{scope:e,children:a.jsx(Rae,{scope:t.__scopeSelect,onNativeOptionAdd:v.useCallback($=>{D(G=>new Set(G).add($))},[]),onNativeOptionRemove:v.useCallback($=>{D(G=>{const R=new Set(G);return R.delete($),R})},[]),children:n})}),E?a.jsxs(d6,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:P,onChange:$=>k($.target.value),disabled:h,form:g,children:[P===void 0?a.jsx("option",{value:""}):null,Array.from(I)]},z):null]})})};B3.displayName=Sg;var U3="SelectTrigger",H3=v.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,o=ew(n),s=ll(U3,n),c=s.disabled||r,l=Pt(e,s.onTriggerChange),u=Z0(n),d=v.useRef("touch"),[f,h,p]=f6(m=>{const y=u().filter(w=>!w.disabled),b=y.find(w=>w.value===s.value),x=h6(y,m,b);x!==void 0&&s.onValueChange(x.value)}),g=m=>{c||(s.onOpenChange(!0),p()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(bE,{asChild:!0,...o,children:a.jsx(it.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":u6(s.value)?"":void 0,...i,ref:l,onClick:Te(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:Te(i.onPointerDown,m=>{d.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Te(i.onKeyDown,m=>{const y=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(y&&m.key===" ")&&Pae.includes(m.key)&&(g(),m.preventDefault())})})})});H3.displayName=U3;var z3="SelectValue",G3=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...c}=t,l=ll(z3,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=Pt(e,l.onValueNodeChange);return Kr(()=>{u(d)},[u,d]),a.jsx(it.span,{...c,ref:f,style:{pointerEvents:"none"},children:u6(l.value)?a.jsx(a.Fragment,{children:s}):o})});G3.displayName=z3;var Dae="SelectIcon",V3=v.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return a.jsx(it.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});V3.displayName=Dae;var $ae="SelectPortal",K3=t=>a.jsx(d0,{asChild:!0,...t});K3.displayName=$ae;var yu="SelectContent",W3=v.forwardRef((t,e)=>{const n=ll(yu,t.__scopeSelect),[r,i]=v.useState();if(Kr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?If.createPortal(a.jsx(q3,{scope:t.__scopeSelect,children:a.jsx(J0.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),o):null}return a.jsx(Y3,{...t,ref:e})});W3.displayName=yu;var Do=10,[q3,ul]=Kf(yu),Lae="SelectContentImpl",Y3=v.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:o,onPointerDownOutside:s,side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:y,...b}=t,x=ll(yu,n),[w,S]=v.useState(null),[C,_]=v.useState(null),A=Pt(e,ae=>S(ae)),[j,P]=v.useState(null),[k,O]=v.useState(null),E=Z0(n),[I,D]=v.useState(!1),z=v.useRef(!1);v.useEffect(()=>{if(w)return cN(w)},[w]),aN();const $=v.useCallback(ae=>{const[De,...de]=E().map(Z=>Z.ref.current),[ye]=de.slice(-1),Ee=document.activeElement;for(const Z of ae)if(Z===Ee||(Z==null||Z.scrollIntoView({block:"nearest"}),Z===De&&C&&(C.scrollTop=0),Z===ye&&C&&(C.scrollTop=C.scrollHeight),Z==null||Z.focus(),document.activeElement!==Ee))return},[E,C]),G=v.useCallback(()=>$([j,w]),[$,j,w]);v.useEffect(()=>{I&&G()},[I,G]);const{onOpenChange:R,triggerPointerDownPosRef:L}=x;v.useEffect(()=>{if(w){let ae={x:0,y:0};const De=ye=>{var Ee,Z;ae={x:Math.abs(Math.round(ye.pageX)-(((Ee=L.current)==null?void 0:Ee.x)??0)),y:Math.abs(Math.round(ye.pageY)-(((Z=L.current)==null?void 0:Z.y)??0))}},de=ye=>{ae.x<=10&&ae.y<=10?ye.preventDefault():w.contains(ye.target)||R(!1),document.removeEventListener("pointermove",De),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",De),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",De),document.removeEventListener("pointerup",de,{capture:!0})}}},[w,R,L]),v.useEffect(()=>{const ae=()=>R(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[R]);const[W,Y]=f6(ae=>{const De=E().filter(Ee=>!Ee.disabled),de=De.find(Ee=>Ee.ref.current===document.activeElement),ye=h6(De,ae,de);ye&&setTimeout(()=>ye.ref.current.focus())}),te=v.useCallback((ae,De,de)=>{const ye=!z.current&&!de;(x.value!==void 0&&x.value===De||ye)&&(P(ae),ye&&(z.current=!0))},[x.value]),me=v.useCallback(()=>w==null?void 0:w.focus(),[w]),F=v.useCallback((ae,De,de)=>{const ye=!z.current&&!de;(x.value!==void 0&&x.value===De||ye)&&O(ae)},[x.value]),se=r==="popper"?bA:Q3,ne=se===bA?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:y}:{};return a.jsx(q3,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:te,selectedItem:j,onItemLeave:me,itemTextRefCallback:F,focusSelectedItem:G,selectedItemText:k,position:r,isPositioned:I,searchRef:W,children:a.jsx(X0,{as:Hs,allowPinchZoom:!0,children:a.jsx(Y0,{asChild:!0,trapped:x.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Te(i,ae=>{var De;(De=x.trigger)==null||De.focus({preventScroll:!0}),ae.preventDefault()}),children:a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(se,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ae=>ae.preventDefault(),...b,...ne,onPlaced:()=>D(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Te(b.onKeyDown,ae=>{const De=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!De&&ae.key.length===1&&Y(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let ye=E().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(ye=ye.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const Ee=ae.target,Z=ye.indexOf(Ee);ye=ye.slice(Z+1)}setTimeout(()=>$(ye)),ae.preventDefault()}})})})})})})});Y3.displayName=Lae;var Fae="SelectItemAlignedPosition",Q3=v.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,o=ll(yu,n),s=ul(yu,n),[c,l]=v.useState(null),[u,d]=v.useState(null),f=Pt(e,A=>d(A)),h=Z0(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,w=v.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&m&&y&&b){const A=o.trigger.getBoundingClientRect(),j=u.getBoundingClientRect(),P=o.valueNode.getBoundingClientRect(),k=b.getBoundingClientRect();if(o.dir!=="rtl"){const Ee=k.left-j.left,Z=P.left-Ee,ct=A.left-Z,Le=A.width+ct,At=Math.max(Le,j.width),lt=window.innerWidth-Do,Jt=vm(Z,[Do,Math.max(Do,lt-At)]);c.style.minWidth=Le+"px",c.style.left=Jt+"px"}else{const Ee=j.right-k.right,Z=window.innerWidth-P.right-Ee,ct=window.innerWidth-A.right-Z,Le=A.width+ct,At=Math.max(Le,j.width),lt=window.innerWidth-Do,Jt=vm(Z,[Do,Math.max(Do,lt-At)]);c.style.minWidth=Le+"px",c.style.right=Jt+"px"}const O=h(),E=window.innerHeight-Do*2,I=m.scrollHeight,D=window.getComputedStyle(u),z=parseInt(D.borderTopWidth,10),$=parseInt(D.paddingTop,10),G=parseInt(D.borderBottomWidth,10),R=parseInt(D.paddingBottom,10),L=z+$+I+R+G,W=Math.min(y.offsetHeight*5,L),Y=window.getComputedStyle(m),te=parseInt(Y.paddingTop,10),me=parseInt(Y.paddingBottom,10),F=A.top+A.height/2-Do,se=E-F,ne=y.offsetHeight/2,ae=y.offsetTop+ne,De=z+$+ae,de=L-De;if(De<=F){const Ee=O.length>0&&y===O[O.length-1].ref.current;c.style.bottom="0px";const Z=u.clientHeight-m.offsetTop-m.offsetHeight,ct=Math.max(se,ne+(Ee?me:0)+Z+G),Le=De+ct;c.style.height=Le+"px"}else{const Ee=O.length>0&&y===O[0].ref.current;c.style.top="0px";const ct=Math.max(F,z+m.offsetTop+(Ee?te:0)+ne)+de;c.style.height=ct+"px",m.scrollTop=De-F+m.offsetTop}c.style.margin=`${Do}px 0`,c.style.minHeight=W+"px",c.style.maxHeight=E+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,o.trigger,o.valueNode,c,u,m,y,b,o.dir,r]);Kr(()=>w(),[w]);const[S,C]=v.useState();Kr(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const _=v.useCallback(A=>{A&&g.current===!0&&(w(),x==null||x(),g.current=!1)},[w,x]);return a.jsx(Uae,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:p,onScrollButtonChange:_,children:a.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:a.jsx(it.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Q3.displayName=Fae;var Bae="SelectPopperPosition",bA=v.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Do,...o}=t,s=ew(n);return a.jsx(wE,{...s,...o,ref:e,align:r,collisionPadding:i,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});bA.displayName=Bae;var[Uae,lN]=Kf(yu,{}),wA="SelectViewport",X3=v.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,o=ul(wA,n),s=lN(wA,n),c=Pt(e,o.onViewportChange),l=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(J0.Slot,{scope:n,children:a.jsx(it.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Te(i.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=s;if(h!=null&&h.current&&f){const p=Math.abs(l.current-d.scrollTop);if(p>0){const g=window.innerHeight-Do*2,m=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(m,y);if(b0?S:0,f.style.justifyContent="flex-end")}}}l.current=d.scrollTop})})})]})});X3.displayName=wA;var J3="SelectGroup",[Hae,zae]=Kf(J3),Gae=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Xo();return a.jsx(Hae,{scope:n,id:i,children:a.jsx(it.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Gae.displayName=J3;var Z3="SelectLabel",e6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=zae(Z3,n);return a.jsx(it.div,{id:i.id,...r,ref:e})});e6.displayName=Z3;var Nx="SelectItem",[Vae,t6]=Kf(Nx),n6=v.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=t,c=ll(Nx,n),l=ul(Nx,n),u=c.value===r,[d,f]=v.useState(o??""),[h,p]=v.useState(!1),g=Pt(e,x=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,x,r,i)}),m=Xo(),y=v.useRef("touch"),b=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Vae,{scope:n,value:r,disabled:i,textId:m,isSelected:u,onItemTextChange:v.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(J0.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:a.jsx(it.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...s,ref:g,onFocus:Te(s.onFocus,()=>p(!0)),onBlur:Te(s.onBlur,()=>p(!1)),onClick:Te(s.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Te(s.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Te(s.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:Te(s.onPointerMove,x=>{var w;y.current=x.pointerType,i?(w=l.onItemLeave)==null||w.call(l):y.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(s.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Te(s.onKeyDown,x=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&x.key===" "||(kae.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});n6.displayName=Nx;var qh="SelectItemText",r6=v.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...o}=t,s=ll(qh,n),c=ul(qh,n),l=t6(qh,n),u=Mae(qh,n),[d,f]=v.useState(null),h=Pt(e,b=>f(b),l.onItemTextChange,b=>{var x;return(x=c.itemTextRefCallback)==null?void 0:x.call(c,b,l.value,l.disabled)}),p=d==null?void 0:d.textContent,g=v.useMemo(()=>a.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=u;return Kr(()=>(m(g),()=>y(g)),[m,y,g]),a.jsxs(a.Fragment,{children:[a.jsx(it.span,{id:l.textId,...o,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?If.createPortal(o.children,s.valueNode):null]})});r6.displayName=qh;var i6="SelectItemIndicator",o6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return t6(i6,n).isSelected?a.jsx(it.span,{"aria-hidden":!0,...r,ref:e}):null});o6.displayName=i6;var SA="SelectScrollUpButton",s6=v.forwardRef((t,e)=>{const n=ul(SA,t.__scopeSelect),r=lN(SA,t.__scopeSelect),[i,o]=v.useState(!1),s=Pt(e,r.onScrollButtonChange);return Kr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollTop>0;o(u)};const l=n.viewport;return c(),l.addEventListener("scroll",c),()=>l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?a.jsx(c6,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});s6.displayName=SA;var CA="SelectScrollDownButton",a6=v.forwardRef((t,e)=>{const n=ul(CA,t.__scopeSelect),r=lN(CA,t.__scopeSelect),[i,o]=v.useState(!1),s=Pt(e,r.onScrollButtonChange);return Kr(()=>{if(n.viewport&&n.isPositioned){let c=function(){const u=l.scrollHeight-l.clientHeight,d=Math.ceil(l.scrollTop)l.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),i?a.jsx(c6,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});a6.displayName=CA;var c6=v.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,o=ul("SelectScrollButton",n),s=v.useRef(null),c=Z0(n),l=v.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return v.useEffect(()=>()=>l(),[l]),Kr(()=>{var d;const u=c().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[c]),a.jsx(it.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Te(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Te(i.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Te(i.onPointerLeave,()=>{l()})})}),Kae="SelectSeparator",l6=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(it.div,{"aria-hidden":!0,...r,ref:e})});l6.displayName=Kae;var _A="SelectArrow",Wae=v.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=ew(n),o=ll(_A,n),s=ul(_A,n);return o.open&&s.position==="popper"?a.jsx(SE,{...i,...r,ref:e}):null});Wae.displayName=_A;function u6(t){return t===""||t===void 0}var d6=v.forwardRef((t,e)=>{const{value:n,...r}=t,i=v.useRef(null),o=Pt(e,i),s=wg(n);return v.useEffect(()=>{const c=i.current,l=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(l,"value").set;if(s!==n&&d){const f=new Event("change",{bubbles:!0});d.call(c,n),c.dispatchEvent(f)}},[s,n]),a.jsx(CE,{asChild:!0,children:a.jsx("select",{...r,ref:o,defaultValue:n})})});d6.displayName="BubbleSelect";function f6(t){const e=Cr(t),n=v.useRef(""),r=v.useRef(0),i=v.useCallback(s=>{const c=n.current+s;e(c),function l(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(c)},[e]),o=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function h6(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=qae(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function qae(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Yae=B3,p6=H3,Qae=G3,Xae=V3,Jae=K3,m6=W3,Zae=X3,g6=e6,v6=n6,ece=r6,tce=o6,y6=s6,x6=a6,b6=l6;const Un=Yae,Hn=Qae,Ln=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(p6,{ref:r,className:Ne("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(Xae,{asChild:!0,children:a.jsx(Ma,{className:"h-4 w-4 opacity-50"})})]}));Ln.displayName=p6.displayName;const w6=v.forwardRef(({className:t,...e},n)=>a.jsx(y6,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(cu,{className:"h-4 w-4"})}));w6.displayName=y6.displayName;const S6=v.forwardRef(({className:t,...e},n)=>a.jsx(x6,{ref:n,className:Ne("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(Ma,{className:"h-4 w-4"})}));S6.displayName=x6.displayName;const Fn=v.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>a.jsx(Jae,{children:a.jsxs(m6,{ref:i,className:Ne("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[a.jsx(w6,{}),a.jsx(Zae,{className:Ne("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(S6,{})]})}));Fn.displayName=m6.displayName;const nce=v.forwardRef(({className:t,...e},n)=>a.jsx(g6,{ref:n,className:Ne("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));nce.displayName=g6.displayName;const oe=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(v6,{ref:r,className:Ne("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tce,{children:a.jsx(Gs,{className:"h-4 w-4"})})}),a.jsx(ece,{children:e})]}));oe.displayName=v6.displayName;const rce=v.forwardRef(({className:t,...e},n)=>a.jsx(b6,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",t),...e}));rce.displayName=b6.displayName;const ice=Oe.object({audienceBrief:Oe.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Oe.string().optional(),personaCount:Oe.string().min(1,{message:"Number of personas is required."}),dataFile:Oe.instanceof(FileList).optional(),llm_model:Oe.string().optional()});function oce({onSubmit:t,isGenerating:e}){const[n,r]=v.useState(!1),[i,o]=v.useState(!1),[s,c]=v.useState({audience_brief:[],research_objective:[]}),[l,u]=v.useState(!1),[d,f]=v.useState(null),h=z0({resolver:G0(ice),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,S,C,_,A,j,P,k,O,E,I;const b=p==null?void 0:p.trim(),x=g==null?void 0:g.trim();if(!b||b.length<10){re.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!x||x.length<10){re.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const D=await ua.enhanceAudienceBrief(b,x);c(D.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),o(!1);const z=(((S=(w=D.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:S.length)||0)+(((_=(C=D.data.suggestions)==null?void 0:C.research_objective)==null?void 0:_.length)||0);re.success("Enhancement suggestions generated",{description:`Generated ${z} suggestions to improve your research inputs`})}catch(D){console.error("Error enhancing audience brief:",D);let z="Please try again or modify your brief",$="Failed to generate suggestions";if(D&&typeof D=="object"){const G=D;G.code==="ECONNABORTED"||(A=G.message)!=null&&A.includes("timeout")?($="Request timeout",z="The AI took too long to analyze your brief. Please try again."):((j=G.response)==null?void 0:j.status)===500?($="Server error",z=((k=(P=G.response)==null?void 0:P.data)==null?void 0:k.message)||"The server encountered an error. Please try again later."):((O=G.response)==null?void 0:O.status)===400?($="Invalid brief",z=((I=(E=G.response)==null?void 0:E.data)==null?void 0:I.message)||"Please check your audience brief and try again."):G.message&&(z=G.message)}else D instanceof Error&&(z=D.message);f(z),re.error($,{description:z,duration:5e3})}finally{u(!1)}},y=()=>{o(!i)};return a.jsx(K0,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(t),className:"space-y-6",children:[a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Audience Brief"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(Nn,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Research Objective"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(Nn,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(pt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(J,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||l||e,className:"flex items-center gap-2 hover-transition",children:l?a.jsxs(a.Fragment,{children:[a.jsx(wd,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(uu,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:x,...w}})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Customer Data (Optional)"}),a.jsx(ht,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(d5,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload customer data for more accurate personas"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Supports PDF, Office docs, images, and more"}),a.jsx(Ht,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:S=>{x(S.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:()=>{var S;return(S=document.getElementById("data-file-input"))==null?void 0:S.click()},children:[a.jsx(h5,{className:"mr-2 h-4 w-4"}),"Select Files"]}),b&&b.length>0&&a.jsx("p",{className:"text-xs text-primary mt-2",children:b.length===1?b[0].name:`${b.length} files selected`})]})}),a.jsx(Nn,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg border border-border",children:[a.jsxs("div",{className:"flex items-center mb-2",children:[a.jsx(H_,{className:"h-5 w-5 text-muted-foreground mr-2"}),a.jsx("h3",{className:"font-sf font-medium",children:"What's included?"})]}),a.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Demographic profiles based on your brief"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Personality traits and behavioral patterns"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(zh,{className:"h-4 w-4 text-green-500 mr-2"}),"Review and refine capabilities"]})]})]})]})]}),n&&a.jsxs("div",{className:"glass-panel rounded-lg p-4 border border-border bg-muted/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsxs("h3",{className:"font-sf font-medium text-sm flex items-center gap-2",children:[a.jsx(uu,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(J,{type:"button",variant:"ghost",size:"sm",onClick:y,className:"h-6 w-6 p-0 hover:bg-slate-200",title:i?"Expand suggestions":"Collapse suggestions",children:i?a.jsx(Ma,{className:"h-4 w-4"}):a.jsx(cu,{className:"h-4 w-4"})})]}),!i&&a.jsx(a.Fragment,{children:d?a.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-md",children:d}):a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{children:s.audience_brief.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(Dr,{className:"h-4 w-4 text-blue-600"}),"Suggestions for your Audience Brief:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:s.audience_brief.map((b,x)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-blue-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:s.research_objective.length>0?a.jsxs("div",{children:[a.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[a.jsx(H_,{className:"h-4 w-4 text-green-600"}),"Suggestions for your Research Objective:"]}),a.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:s.research_objective.map((b,x)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-green-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},x))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),s.audience_brief.length===0&&s.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(vt,{control:h.control,name:"llm_model",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"AI Model"}),a.jsxs(Un,{onValueChange:b.onChange,defaultValue:b.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select AI model"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Nn,{children:"Choose which AI model to use for generating personas"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Number of Personas to Generate"}),a.jsx(ht,{children:a.jsx(Ht,{type:"number",min:"1",max:"20",...b})}),a.jsx(Nn,{children:"How many synthetic users do you need for your research?"}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(J,{type:"submit",disabled:e,className:"min-w-36",children:e?a.jsxs(a.Fragment,{children:[a.jsx(wd,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Dr,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),e&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const gt=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));gt.displayName="Card";const ji=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("flex flex-col space-y-1.5 p-6",t),...e}));ji.displayName="CardHeader";const Wi=v.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:Ne("text-2xl font-semibold leading-none tracking-tight",t),...e}));Wi.displayName="CardTitle";const uN=v.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));uN.displayName="CardDescription";const Rt=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("p-6 pt-0",t),...e}));Rt.displayName="CardContent";const dN=v.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Ne("flex items-center p-6 pt-0",t),...e}));dN.displayName="CardFooter";const sce=t=>{const e=t==null?void 0:t.toLowerCase(),n="/semblance/";switch(e){case"male":return`${n}male_avatar.png`;case"female":return`${n}female_avatar.png`;case"non-binary":case"nonbinary":case"non binary":return`${n}nonbinary_avatar.png`;default:return`${n}male_avatar.png`}},Cg=t=>t.avatar||sce(t.gender);function fN({user:t,selected:e=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:i,showAddToFolderButton:o=!1,onAddToFolder:s,onViewDetails:c,folders:l=[]}){const u=ar();v.useState(!1);const[d,f]=v.useState(t),h=t._id||t.id,p=y=>{y.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=y=>{var w,S;const b=y.target;b.closest("button")&&((S=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&S.includes("View Details"))||(i?i(y):n&&n(y))},m=y=>{y.stopPropagation(),c?c(d):p(y)};return a.jsxs("div",{className:Ne("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",e&&"selected ring-2 ring-primary"),onClick:g,children:[a.jsx("div",{className:"persona-card-overlay"}),a.jsx("div",{className:"persona-card-checkmark",children:a.jsx(Gs,{className:"h-4 w-4 text-primary"})}),a.jsx("div",{className:"relative z-10",children:a.jsxs("div",{className:"flex items-start space-x-4",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Cg(d),alt:`${d.name} avatar`,className:"h-12 w-12 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center justify-between gap-2",children:a.jsx("h3",{className:"text-sm font-medium truncate flex-1",children:d.name})}),a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[d.age," • ",d.gender]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:d.occupation}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.location}),a.jsx("div",{className:"mt-2",children:d.aiSynthesizedBio?a.jsxs("p",{className:"text-xs text-slate-700 line-clamp-3 leading-relaxed",children:[d.aiSynthesizedBio,d.aiSynthesizedBio.length>150&&"..."]}):a.jsxs("p",{className:"text-xs text-muted-foreground italic line-clamp-3",children:['"',d.personality,'"']})}),d.qualitativeAttributes&&d.qualitativeAttributes.length>0&&a.jsx("div",{className:"mt-3",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.qualitativeAttributes.slice(0,3).map((y,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded-full",children:[a.jsx(hZ,{className:"h-3 w-3"}),y]},b))})}),d.folder_ids&&d.folder_ids.length>0&&a.jsx("div",{className:"mt-2",children:a.jsxs("div",{className:"flex flex-wrap gap-1",children:[d.folder_ids.slice(0,2).map(y=>{const b=l.find(x=>x._id===y);return b?a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",title:`In folder: ${b.name}`,children:[a.jsx(ho,{className:"h-3 w-3"}),b.name]},y):null}),d.folder_ids.length>2&&a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-gray-100 text-gray-700 text-xs rounded-full",children:[a.jsx(Ur,{className:"h-3 w-3"}),d.folder_ids.length-2," more"]})]})}),d.topPersonalityTraits&&d.topPersonalityTraits.length>0&&a.jsx("div",{className:"mt-2",children:a.jsx("div",{className:"flex flex-wrap gap-1",children:d.topPersonalityTraits.slice(0,3).map((y,b)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-purple-50 text-purple-700 text-xs rounded-full",children:[a.jsx(au,{className:"h-3 w-3"}),y]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(J,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var hN="Collapsible",[ace,lFe]=Li(hN),[cce,pN]=ace(hN),C6=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...c}=t,[l=!1,u]=as({prop:r,defaultProp:i,onChange:s});return a.jsx(cce,{scope:n,disabled:o,contentId:Xo(),open:l,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:a.jsx(it.div,{"data-state":gN(l),"data-disabled":o?"":void 0,...c,ref:e})})});C6.displayName=hN;var _6="CollapsibleTrigger",A6=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=pN(_6,n);return a.jsx(it.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":gN(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Te(t.onClick,i.onOpenToggle)})});A6.displayName=_6;var mN="CollapsibleContent",j6=v.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=pN(mN,t.__scopeCollapsible);return a.jsx(Wr,{present:n||i.open,children:({present:o})=>a.jsx(lce,{...r,ref:e,present:o})})});j6.displayName=mN;var lce=v.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...o}=t,s=pN(mN,n),[c,l]=v.useState(r),u=v.useRef(null),d=Pt(e,u),f=v.useRef(0),h=f.current,p=v.useRef(0),g=p.current,m=s.open||c,y=v.useRef(m),b=v.useRef();return v.useEffect(()=>{const x=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(x)},[]),Kr(()=>{const x=u.current;if(x){b.current=b.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();f.current=w.height,p.current=w.width,y.current||(x.style.transitionDuration=b.current.transitionDuration,x.style.animationName=b.current.animationName),l(r)}},[s.open,r]),a.jsx(it.div,{"data-state":gN(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!m,...o,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...t.style},children:m&&i})});function gN(t){return t?"open":"closed"}var uce=C6;const _g=uce,Ag=A6,jg=j6;function dce({generatedPersonas:t,selectedPersonas:e,isGenerating:n,onPersonaSelection:r,onRefinePersonas:i,onApprovePersonas:o,onBackToGenerator:s}){const c=ar(),[l,u]=v.useState(""),[d,f]=v.useState(!1),h=p=>{c(`/synthetic-users/${p}?fromReview=true`)};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Review Generated Personas"}),a.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.length," of ",t.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:t.map(p=>a.jsx(gt,{className:`border ${e.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(Rt,{className:"p-4",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("div",{className:"flex-1",children:a.jsxs("div",{className:"flex items-center",children:[a.jsx("input",{type:"checkbox",id:`persona-${p.id}`,checked:e.includes(p.id),onChange:g=>{g.stopPropagation(),r(p.id)},className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:p.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.age," • ",p.gender," • ",p.occupation]})]})]})}),a.jsx(fN,{user:p,showDetailedDialog:!1,onClick:g=>{g.stopPropagation(),h(p.id)}})]})})},p.id))}),a.jsx("div",{className:"space-y-4 pt-4 border-t",children:a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsxs(J,{variant:"outline",onClick:s,children:[a.jsx(Kp,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(_g,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Ag,{asChild:!0,children:a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(wd,{className:"h-4 w-4"}),"Refine Personas",a.jsx(Ma,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(J,{onClick:o,disabled:e.length===0,children:[a.jsx(zh,{className:"mr-2 h-4 w-4"}),"Approve Selected (",e.length,")"]})]}),a.jsx(jg,{children:a.jsx(gt,{className:"border shadow-sm w-full mt-4",children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{htmlFor:"refinement-prompt",className:"text-sm font-medium block mb-2",children:"Refinement Instructions"}),a.jsx(mt,{id:"refinement-prompt",placeholder:"Example: Make all personas 5 years younger, or ensure everyone is from different locations...",value:l,onChange:p=>u(p.target.value),className:"min-h-[100px] w-full resize-y"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"Use natural language to describe how you'd like to refine the selected personas."})]}),a.jsxs(J,{onClick:()=>i(l),disabled:n||l.trim()==="",className:"w-full",children:[n?a.jsx(wd,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(wd,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function fce(t,e,n,r,i,o){console.log(`generateSyntheticPersonas called with targetFolderId: ${i||"none"}`),console.log(`🔄 generateSyntheticPersonas using model: ${o||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),t.trim().length<10)throw new Error("Audience brief is too short. Please provide more context for better persona generation.");let s;if(r&&r.length>0){console.log(`Uploading ${r.length} customer data files...`);try{s=(await ua.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${s}`)}catch(l){throw console.error("Failed to upload customer data:",l),new Error("Failed to upload customer data files. Please try again.")}}const c=await ua.batchGenerateWithStages(t,e,n,.8,s,o);if(c.data){const l=c.data.partial_success===!0,u=c.data.personas&&c.data.personas.length>0,d=c.data.errors&&c.data.errors.length>0;if(u){if(console.log(`Generated ${c.data.personas.length} personas with two-stage process${d?` (${c.data.errors.length} failed)`:""}`),i){const f=c.data.personas,h=f.map(p=>p._id||p.id).filter(Boolean);console.log(`Adding ${h.length} newly generated personas to folder: ${i}`);try{await js.addPersonasBatch(i,h),console.log(`Added ${h.length} newly generated personas to folder: ${i}`)}catch(p){console.error("Error adding personas to folder:",p)}if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return l||d?{...c.data,length:f.length}:{...c.data,personas:f}}if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}if(l||d)return{...c.data.personas,length:c.data.personas.length,partial_success:l,errors:c.data.errors};if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return c.data.personas}else if(d){if(s)try{await ua.cleanupCustomerData(s),console.log(`Cleaned up customer data for session: ${s}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}throw new Error(`Failed to generate personas: ${c.data.errors.length} generation attempts failed.`)}else throw new Error("No personas returned from API")}else throw new Error("Invalid response format from API")}catch(s){if(customerDataSessionId)try{await ua.cleanupCustomerData(customerDataSessionId),console.log(`Cleaned up customer data for session: ${customerDataSessionId}`)}catch(c){console.warn("Failed to cleanup customer data:",c)}throw console.error("Error generating AI personas:",s),s}}function E6(){const[t,e]=v.useState([]),n=async o=>{const s=[];for(const c of o){const l={...c};l._id&&typeof l._id=="string"&&l._id.startsWith("local-")&&delete l._id;const u=await zr.create(l);console.log("Persona saved to database:",u.data),s.push({...c,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}e(s)},r=async()=>{const o=await zr.getAll();return o&&o.data&&Array.isArray(o.data)?(console.log("Personas loaded from database:",o.data.length),o.data.map(s=>({...s,id:s._id||s.id,isDbPersona:!0}))):[]};return v.useEffect(()=>{(async()=>{const s=await r();e(s)})()},[]),{storedPersonas:t,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const o=await r();for(const s of o)s._id&&await zr.delete(s._id);e([])}}}function hce({targetFolderId:t,targetFolderName:e}){const n=Fi(),r=ar(),{loadPersonas:i,savePersonas:o}=E6(),[s,c]=v.useState(!1),[l,u]=v.useState([]),[d,f]=v.useState([]),[h,p]=v.useState(!1),[g,m]=v.useState(0);v.useEffect(()=>{const C=new URLSearchParams(n.search),_=C.get("mode"),A=C.get("tab"),j=C.get("step");if(_==="create"&&A==="ai"&&j==="review"){const P=i();P.length>0&&(u(P),f(P.map(k=>k.id)),p(!0))}},[n,i]);async function y(C){var _,A,j,P,k,O,E,I,D,z;try{c(!0),m(0);const $=parseInt(C.personaCount);if(isNaN($)||$<1||$>10){re.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),c(!1);return}m(5);const G=setInterval(()=>{m(Y=>Y<90?Y+Math.random()*5:Y)},500),R=$<=2?"30-60 seconds":$<=4?"1-2 minutes":$<=6?"2-3 minutes":"3-5 minutes";$>4&&re.info("Generation may take longer",{description:`Generating ${$} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),re.info("Generating AI personas in parallel",{description:`Creating ${$} synthetic personas based on your brief. This may take ${R}. Please be patient.`,duration:1e4}),t&&e?(console.log(`Target folder for new personas: ID=${t}, Name=${e}`),re.info(`Creating personas in "${e}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`🤖 Starting persona generation with model: ${C.llm_model||"gemini-2.5-pro"}`);const L=await fce(C.audienceBrief,C.researchObjective,$,C.dataFile,t,C.llm_model),W=L.personas||L;if(clearInterval(G),m(100),W&&W.length>0)console.log(`✅ Successfully generated ${W.length} personas using model: ${C.llm_model||"gemini-2.5-pro"}`),L.partial_success||L.errors&&L.errors.length>0?(re.success("Some personas generated successfully",{description:`${W.length} synthetic personas were created using ${C.llm_model||"Gemini 2.5 Pro"}. ${((_=L.errors)==null?void 0:_.length)||0} failed due to timeout or other errors.`,duration:8e3}),L.errors&&L.errors.length>0&&setTimeout(()=>{re.error("Some personas failed to generate",{description:`${L.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${t?" in the selected folder":""}.`,duration:1e4})},1e3)):re.success("Personas generated and saved successfully",{description:`${W.length} synthetic personas have been created using ${C.llm_model||"Gemini 2.5 Pro"} and saved ${t?`to the "${e}" folder`:"to the database"}.`}),r("/synthetic-users?mode=view");else throw new Error("No personas were generated")}catch($){console.error(`❌ Error generating personas using model: ${C.llm_model||"gemini-2.5-pro"}:`,$);let G="Please try again or adjust your parameters",R="Failed to generate personas";$.code==="ECONNABORTED"||(A=$.message)!=null&&A.includes("timeout")||((j=$.response)==null?void 0:j.status)===504?(R="Generation timeout",G="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((P=$.response)==null?void 0:P.status)===500?(R="Server error",(O=(k=$.response)==null?void 0:k.data)!=null&&O.message?G=$.response.data.message:(I=(E=$.response)==null?void 0:E.data)!=null&&I.error?G=$.response.data.error:G="The server encountered an error processing your request. Please try again later."):((D=$.response)==null?void 0:D.status)===401?(R="Authentication required",G="Please log in to generate personas."):(z=$.message)!=null&&z.includes("504 Deadline Exceeded")?(R="Generation timeout",G="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):$ instanceof Error&&(G=$.message),re.error(R,{description:G,duration:6e3})}finally{setTimeout(()=>{c(!1),m(0)},500)}}const b=C=>{f(_=>_.includes(C)?_.filter(A=>A!==C):[..._,C])},x=(C,_)=>{const A=_.toLowerCase();return C.map(j=>{const P={...j};if(A.includes("younger")){const k=parseInt(P.age);P.age=(k-5).toString()}else if(A.includes("older")){const k=parseInt(P.age);P.age=(k+5).toString()}if(A.includes("different locations")&&(P.location=`${P.location} (Diversified)`),A.includes("more extroverted")?P.personality=`Extroverted, ${P.personality.toLowerCase()}`:A.includes("more introverted")&&(P.personality=`Introverted, ${P.personality.toLowerCase()}`),A.includes("diverse")){const k=["tech-savvy","traditional","innovative","conservative","creative"],O=k[Math.floor(Math.random()*k.length)];P.personality=`${O}, ${P.personality}`}return P})},w=C=>{if(!C.trim()){re.error("Please provide refinement instructions");return}c(!0),setTimeout(()=>{try{const _=l.filter(P=>d.includes(P.id)),A=x(_,C),j=l.map(P=>A.find(O=>O.id===P.id)||P);u(j),c(!1),o(j),re.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(_){console.error("Error refining personas:",_),re.error("Failed to refine personas",{description:"Please try different instructions"}),c(!1)}},1500)},S=()=>{const C=l.filter(_=>d.includes(_.id));re.success(`${C.length} personas approved`,{description:"Added to your synthetic persona library"}),o(C),r("/synthetic-users?mode=view")};return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),s&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Generating personas in parallel..."}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(g),"%"]})]}),a.jsx(Rl,{value:g,className:"h-2"})]}),h?a.jsx(dce,{generatedPersonas:l,selectedPersonas:d,isGenerating:s,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:S,onBackToGenerator:()=>p(!1)}):a.jsx(oce,{onSubmit:y,isGenerating:s})]})}const nl=new Map;function T6(t){const{id:e,title:n,description:r,type:i="default",duration:o}=t;let s;switch(i){case"success":s=re.success(n,{description:r,duration:o});break;case"error":s=re.error(n,{description:r,duration:o});break;case"warning":s=re.warning(n,{description:r,duration:o});break;case"info":s=re.info(n,{description:r,duration:o});break;default:s=re(n,{description:r,duration:o});break}return nl.set(e,s.toString()),e}function pce(t,e){const n=nl.get(t);if(!n)return console.warn(`Toast with ID "${t}" not found. Creating new toast instead.`),T6({id:t,...e,title:e.title||"Updated"}),!1;const{title:r,description:i,type:o="default",duration:s}=e;re.dismiss(n);let c;switch(o){case"success":c=re.success(r,{description:i,duration:s});break;case"error":c=re.error(r,{description:i,duration:s});break;case"warning":c=re.warning(r,{description:i,duration:s});break;case"info":c=re.info(r,{description:i,duration:s});break;default:c=re(r,{description:i,duration:s});break}return nl.set(t,c.toString()),!0}function mce(t){const e=nl.get(t);return e?(re.dismiss(e),nl.delete(t),!0):(console.warn(`Toast with ID "${t}" not found.`),!1)}function gce(t){return nl.has(t)}function vce(){nl.forEach(t=>{re.dismiss(t)}),nl.clear()}const qe={success:re.success,error:re.error,warning:re.warning,info:re.info,loading:re.loading,dismiss:re.dismiss,createPersistent:T6,updatePersistent:pce,dismissPersistent:mce,hasPersistent:gce,dismissAllPersistent:vce};var N6=["PageUp","PageDown"],P6=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],k6={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Wf="Slider",[AA,yce,xce]=q0(Wf),[O6,uFe]=Li(Wf,[xce]),[bce,tw]=O6(Wf),I6=v.forwardRef((t,e)=>{const{name:n,min:r=0,max:i=100,step:o=1,orientation:s="horizontal",disabled:c=!1,minStepsBetweenThumbs:l=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=t,y=v.useRef(new Set),b=v.useRef(0),w=s==="horizontal"?wce:Sce,[S=[],C]=as({prop:d,defaultProp:u,onChange:O=>{var I;(I=[...y.current][b.current])==null||I.focus(),f(O)}}),_=v.useRef(S);function A(O){const E=Ece(S,O);k(O,E)}function j(O){k(O,b.current)}function P(){const O=_.current[b.current];S[b.current]!==O&&h(S)}function k(O,E,{commit:I}={commit:!1}){const D=kce(o),z=Oce(Math.round((O-r)/o)*o+r,D),$=vm(z,[r,i]);C((G=[])=>{const R=Ace(G,$,E);if(Pce(R,l*o)){b.current=R.indexOf($);const L=String(R)!==String(G);return L&&I&&h(R),L?R:G}else return G})}return a.jsx(bce,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:b,thumbs:y.current,values:S,orientation:s,form:g,children:a.jsx(AA.Provider,{scope:t.__scopeSlider,children:a.jsx(AA.Slot,{scope:t.__scopeSlider,children:a.jsx(w,{"aria-disabled":c,"data-disabled":c?"":void 0,...m,ref:e,onPointerDown:Te(m.onPointerDown,()=>{c||(_.current=S)}),min:r,max:i,inverted:p,onSlideStart:c?void 0:A,onSlideMove:c?void 0:j,onSlideEnd:c?void 0:P,onHomeKeyDown:()=>!c&&k(r,0,{commit:!0}),onEndKeyDown:()=>!c&&k(i,S.length-1,{commit:!0}),onStepKeyDown:({event:O,direction:E})=>{if(!c){const z=N6.includes(O.key)||O.shiftKey&&P6.includes(O.key)?10:1,$=b.current,G=S[$],R=o*z*E;k(G+R,$,{commit:!0})}}})})})})});I6.displayName=Wf;var[R6,M6]=O6(Wf,{startEdge:"left",endEdge:"right",size:"width",direction:1}),wce=v.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:o,onSlideStart:s,onSlideMove:c,onSlideEnd:l,onStepKeyDown:u,...d}=t,[f,h]=v.useState(null),p=Pt(e,w=>h(w)),g=v.useRef(),m=Nu(i),y=m==="ltr",b=y&&!o||!y&&o;function x(w){const S=g.current||f.getBoundingClientRect(),C=[0,S.width],A=vN(C,b?[n,r]:[r,n]);return g.current=S,A(w-S.left)}return a.jsx(R6,{scope:t.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(D6,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const S=x(w.clientX);s==null||s(S)},onSlideMove:w=>{const S=x(w.clientX);c==null||c(S)},onSlideEnd:()=>{g.current=void 0,l==null||l()},onStepKeyDown:w=>{const C=k6[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:C?-1:1})}})})}),Sce=v.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=t,d=v.useRef(null),f=Pt(e,d),h=v.useRef(),p=!i;function g(m){const y=h.current||d.current.getBoundingClientRect(),b=[0,y.height],w=vN(b,p?[r,n]:[n,r]);return h.current=y,w(m-y.top)}return a.jsx(R6,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(D6,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const y=g(m.clientY);o==null||o(y)},onSlideMove:m=>{const y=g(m.clientY);s==null||s(y)},onSlideEnd:()=>{h.current=void 0,c==null||c()},onStepKeyDown:m=>{const b=k6[p?"from-bottom":"from-top"].includes(m.key);l==null||l({event:m,direction:b?-1:1})}})})}),D6=v.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:c,onStepKeyDown:l,...u}=t,d=tw(Wf,n);return a.jsx(it.span,{...u,ref:e,onKeyDown:Te(t.onKeyDown,f=>{f.key==="Home"?(s(f),f.preventDefault()):f.key==="End"?(c(f),f.preventDefault()):N6.concat(P6).includes(f.key)&&(l(f),f.preventDefault())}),onPointerDown:Te(t.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Te(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Te(t.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),$6="SliderTrack",L6=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=tw($6,n);return a.jsx(it.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});L6.displayName=$6;var jA="SliderRange",F6=v.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=tw(jA,n),o=M6(jA,n),s=v.useRef(null),c=Pt(e,s),l=i.values.length,u=i.values.map(h=>U6(h,i.min,i.max)),d=l>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(it.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});F6.displayName=jA;var EA="SliderThumb",B6=v.forwardRef((t,e)=>{const n=yce(t.__scopeSlider),[r,i]=v.useState(null),o=Pt(e,c=>i(c)),s=v.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(Cce,{...t,ref:o,index:s})}),Cce=v.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...o}=t,s=tw(EA,n),c=M6(EA,n),[l,u]=v.useState(null),d=Pt(e,x=>u(x)),f=l?s.form||!!l.closest("form"):!0,h=pg(l),p=s.values[r],g=p===void 0?0:U6(p,s.min,s.max),m=jce(r,s.values.length),y=h==null?void 0:h[c.size],b=y?Tce(y,g,c.direction):0;return v.useEffect(()=>{if(l)return s.thumbs.add(l),()=>{s.thumbs.delete(l)}},[l,s.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[c.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(AA.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(it.span,{role:"slider","aria-label":t["aria-label"]||m,"aria-valuemin":s.min,"aria-valuenow":p,"aria-valuemax":s.max,"aria-orientation":s.orientation,"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,tabIndex:s.disabled?void 0:0,...o,ref:d,style:p===void 0?{display:"none"}:t.style,onFocus:Te(t.onFocus,()=>{s.valueIndexToChangeRef.current=r})})}),f&&a.jsx(_ce,{name:i??(s.name?s.name+(s.values.length>1?"[]":""):void 0),form:s.form,value:p},r)]})});B6.displayName=EA;var _ce=t=>{const{value:e,...n}=t,r=v.useRef(null),i=wg(e);return v.useEffect(()=>{const o=r.current,s=window.HTMLInputElement.prototype,l=Object.getOwnPropertyDescriptor(s,"value").set;if(i!==e&&l){const u=new Event("input",{bubbles:!0});l.call(o,e),o.dispatchEvent(u)}},[i,e]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:e})};function Ace(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,o)=>i-o)}function U6(t,e,n){const o=100/(n-e)*(t-e);return vm(o,[0,100])}function jce(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Ece(t,e){if(t.length===1)return 0;const n=t.map(i=>Math.abs(i-e)),r=Math.min(...n);return n.indexOf(r)}function Tce(t,e,n){const r=t/2,o=vN([0,50],[0,r]);return(r-o(e)*n)*n}function Nce(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Pce(t,e){if(e>0){const n=Nce(t);return Math.min(...n)>=e}return!0}function vN(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function kce(t){return(String(t).split(".")[1]||"").length}function Oce(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var H6=I6,Ice=L6,Rce=F6,Mce=B6;const br=v.forwardRef(({className:t,...e},n)=>a.jsxs(H6,{ref:n,className:Ne("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(Ice,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(Rce,{className:"absolute h-full bg-primary"})}),a.jsx(Mce,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));br.displayName=H6.displayName;var yN="Switch",[Dce,dFe]=Li(yN),[$ce,Lce]=Dce(yN),z6=v.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:o,required:s,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=t,[h,p]=v.useState(null),g=Pt(e,w=>p(w)),m=v.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=as({prop:i,defaultProp:o,onChange:u});return a.jsxs($ce,{scope:n,checked:b,disabled:c,children:[a.jsx(it.button,{type:"button",role:"switch","aria-checked":b,"aria-required":s,"data-state":K6(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:g,onClick:Te(t.onClick,w=>{x(S=>!S),y&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),y&&a.jsx(Fce,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})});z6.displayName=yN;var G6="SwitchThumb",V6=v.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=Lce(G6,n);return a.jsx(it.span,{"data-state":K6(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});V6.displayName=G6;var Fce=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=v.useRef(null),s=wg(n),c=pg(e);return v.useEffect(()=>{const l=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function K6(t){return t?"checked":"unchecked"}var W6=z6,Bce=V6;const ym=v.forwardRef(({className:t,...e},n)=>a.jsx(W6,{className:Ne("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:a.jsx(Bce,{className:Ne("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));ym.displayName=W6.displayName;function Uce(t,e=[]){let n=[];function r(o,s){const c=v.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[t][l])||c,y=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,g=v.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>v.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return v.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Hce(i,...e)]}function Hce(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return v.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var eC="rovingFocusGroup.onEntryFocus",zce={bubbles:!1,cancelable:!0},nw="RovingFocusGroup",[TA,q6,Gce]=q0(nw),[Vce,qf]=Uce(nw,[Gce]),[Kce,Wce]=Vce(nw),Y6=v.forwardRef((t,e)=>a.jsx(TA.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(TA.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(qce,{...t,ref:e})})}));Y6.displayName=nw;var qce=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=t,h=v.useRef(null),p=Pt(e,h),g=Nu(o),[m=null,y]=as({prop:s,defaultProp:c,onChange:l}),[b,x]=v.useState(!1),w=Cr(u),S=q6(n),C=v.useRef(!1),[_,A]=v.useState(0);return v.useEffect(()=>{const j=h.current;if(j)return j.addEventListener(eC,w),()=>j.removeEventListener(eC,w)},[w]),a.jsx(Kce,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:v.useCallback(j=>y(j),[y]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>A(j=>j+1),[]),onFocusableItemRemove:v.useCallback(()=>A(j=>j-1),[]),children:a.jsx(it.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Te(t.onMouseDown,()=>{C.current=!0}),onFocus:Te(t.onFocus,j=>{const P=!C.current;if(j.target===j.currentTarget&&P&&!b){const k=new CustomEvent(eC,zce);if(j.currentTarget.dispatchEvent(k),!k.defaultPrevented){const O=S().filter($=>$.focusable),E=O.find($=>$.active),I=O.find($=>$.id===m),z=[E,I,...O].filter(Boolean).map($=>$.ref.current);J6(z,d)}}C.current=!1}),onBlur:Te(t.onBlur,()=>x(!1))})})}),Q6="RovingFocusGroupItem",X6=v.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=t,c=Xo(),l=o||c,u=Wce(Q6,n),d=u.currentTabStopId===l,f=q6(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(TA.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:a.jsx(it.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:Te(t.onMouseDown,g=>{r?u.onItemFocus(l):g.preventDefault()}),onFocus:Te(t.onFocus,()=>u.onItemFocus(l)),onKeyDown:Te(t.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=Xce(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=f().filter(x=>x.focusable).map(x=>x.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const x=b.indexOf(g.currentTarget);b=u.loop?Jce(b,x+1):b.slice(x+1)}setTimeout(()=>J6(b))}})})})});X6.displayName=Q6;var Yce={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Qce(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Xce(t,e,n){const r=Qce(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Yce[r]}function J6(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Jce(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var xN=Y6,bN=X6,wN="Tabs",[Zce,fFe]=Li(wN,[qf]),Z6=qf(),[ele,SN]=Zce(wN),eH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:c,activationMode:l="automatic",...u}=t,d=Nu(c),[f,h]=as({prop:r,onChange:i,defaultProp:o});return a.jsx(ele,{scope:n,baseId:Xo(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:l,children:a.jsx(it.div,{dir:d,"data-orientation":s,...u,ref:e})})});eH.displayName=wN;var tH="TabsList",nH=v.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,o=SN(tH,n),s=Z6(n);return a.jsx(xN,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(it.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});nH.displayName=tH;var rH="TabsTrigger",iH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=t,s=SN(rH,n),c=Z6(n),l=aH(s.baseId,r),u=cH(s.baseId,r),d=r===s.value;return a.jsx(bN,{asChild:!0,...c,focusable:!i,active:d,children:a.jsx(it.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:e,onMouseDown:Te(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Te(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Te(t.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});iH.displayName=rH;var oH="TabsContent",sH=v.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=t,c=SN(oH,n),l=aH(c.baseId,r),u=cH(c.baseId,r),d=r===c.value,f=v.useRef(d);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(Wr,{present:i||d,children:({present:h})=>a.jsx(it.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!h,id:u,tabIndex:0,...s,ref:e,style:{...t.style,animationDuration:f.current?"0s":void 0},children:h&&o})})});sH.displayName=oH;function aH(t,e){return`${t}-trigger-${e}`}function cH(t,e){return`${t}-content-${e}`}var tle=eH,lH=nH,uH=iH,dH=sH;const dl=tle,Va=v.forwardRef(({className:t,...e},n)=>a.jsx(lH,{ref:n,className:Ne("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));Va.displayName=lH.displayName;const gn=v.forwardRef(({className:t,...e},n)=>a.jsx(uH,{ref:n,className:Ne("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...e}));gn.displayName=uH.displayName;const vn=v.forwardRef(({className:t,...e},n)=>a.jsx(dH,{ref:n,className:Ne("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));vn.displayName=dH.displayName;const nle=Oe.object({name:Oe.string().min(2,{message:"Name must be at least 2 characters."}),age:Oe.string().min(1,{message:"Age is required."}),gender:Oe.string().min(1,{message:"Gender is required."}),occupation:Oe.string().min(2,{message:"Occupation is required."}),education:Oe.string().min(1,{message:"Education is required."}),location:Oe.string().min(2,{message:"Location is required."}),ethnicity:Oe.string().optional(),personality:Oe.string(),interests:Oe.string(),hasPurchasingPower:Oe.boolean().optional(),hasChildren:Oe.boolean().optional(),techSavviness:Oe.number().min(0).max(100),brandLoyalty:Oe.number().min(0).max(100),priceConsciousness:Oe.number().min(0).max(100),environmentalConcern:Oe.number().min(0).max(100),socialGrade:Oe.string().optional(),householdIncome:Oe.string().optional(),householdComposition:Oe.string().optional(),livingSituation:Oe.string().optional(),goals:Oe.array(Oe.string()).optional(),frustrations:Oe.array(Oe.string()).optional(),motivations:Oe.array(Oe.string()).optional(),scenarios:Oe.array(Oe.string()).optional(),scenarioType:Oe.string().optional(),oceanTraits:Oe.object({openness:Oe.number().min(0).max(100),conscientiousness:Oe.number().min(0).max(100),extraversion:Oe.number().min(0).max(100),agreeableness:Oe.number().min(0).max(100),neuroticism:Oe.number().min(0).max(100)}).optional(),thinkFeelDo:Oe.object({thinks:Oe.array(Oe.string()),feels:Oe.array(Oe.string()),does:Oe.array(Oe.string())}).optional(),mediaConsumption:Oe.string().optional(),deviceUsage:Oe.string().optional(),shoppingHabits:Oe.string().optional(),brandPreferences:Oe.string().optional(),communicationPreferences:Oe.string().optional(),paymentMethods:Oe.string().optional(),purchaseBehaviour:Oe.string().optional(),coreValues:Oe.string().optional(),lifestyleChoices:Oe.string().optional(),socialActivities:Oe.string().optional(),categoryKnowledge:Oe.string().optional(),decisionInfluences:Oe.string().optional(),painPoints:Oe.string().optional(),journeyContext:Oe.string().optional(),keyTouchpoints:Oe.string().optional(),selfDeterminationNeeds:Oe.object({autonomy:Oe.string(),competence:Oe.string(),relatedness:Oe.string()}).optional(),fears:Oe.array(Oe.string()).optional(),narrative:Oe.string().optional(),additionalInformation:Oe.string().optional()});function rle({targetFolderId:t,targetFolderName:e}){const[n,r]=v.useState(1),[i,o]=v.useState(!1),[s,c]=v.useState(!1),[l,u]=v.useState(0),d=ar(),{isAuthenticated:f,login:h}=Xs();v.useEffect(()=>{u(0)},[]),v.useEffect(()=>{(async()=>{if(!f&&!s){c(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const A=localStorage.getItem("auth_token");A?(console.log("Token successfully stored:",A.substring(0,10)+"..."),qe.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),qe.error("Authentication problem, token not stored"))}catch(A){console.error("Auto login failed:",A)}finally{c(!1)}}})()},[]);const p=z0({resolver:G0(nle),defaultValues:{name:"",age:"",gender:"",occupation:"",education:"",location:"",ethnicity:"",personality:"",interests:"",hasPurchasingPower:!1,hasChildren:!1,techSavviness:50,brandLoyalty:50,priceConsciousness:50,environmentalConcern:50,socialGrade:"",householdIncome:"",householdComposition:"",livingSituation:"",goals:[],frustrations:[],motivations:[],scenarios:[],scenarioType:"",oceanTraits:{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:{thinks:[],feels:[],does:[]},mediaConsumption:"",deviceUsage:"",shoppingHabits:"",brandPreferences:"",communicationPreferences:"",paymentMethods:"",purchaseBehaviour:"",coreValues:"",lifestyleChoices:"",socialActivities:"",categoryKnowledge:"",decisionInfluences:"",painPoints:"",journeyContext:"",keyTouchpoints:"",selfDeterminationNeeds:{autonomy:"",competence:"",relatedness:""},fears:[],narrative:"",additionalInformation:""}}),g=_=>{const A=p.getValues(_)||[];p.setValue(_,[...A,""])},m=(_,A,j)=>{const k=[...p.getValues(_)||[]];k[A]=j,p.setValue(_,k)},y=(_,A)=>{const P=[...p.getValues(_)||[]];P.splice(A,1),p.setValue(_,P)},b=_=>{const A=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},j={...A,[_]:[...A[_]||[],""]};p.setValue("thinkFeelDo",j)},x=(_,A,j)=>{const P=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},k=[...P[_]||[]];k[A]=j;const O={...P,[_]:k};p.setValue("thinkFeelDo",O)},w=(_,A)=>{const j=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},P=[...j[_]||[]];P.splice(A,1);const k={...j,[_]:P};p.setValue("thinkFeelDo",k)},S=(_,A)=>{const P={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[_]:A};p.setValue("oceanTraits",P)};async function C(_,A=!1){var j,P,k,O,E;if(A&&l>=1){console.log("Max retry attempts reached, stopping retry loop"),qe.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}A?(u(I=>I+1),console.log(`Retry attempt ${l+1}`)):u(0),o(!0);try{if(!f)try{console.log("Not authenticated, attempting login with default credentials before submission"),await h("user","pass"),console.log("Login successful before persona creation")}catch(L){console.error("Login failed before persona creation:",L),qe.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}const I=`persona-generation-${Date.now()}`,D=t&&e?` in "${e}" folder`:"",z=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${z}${D}`),qe.createPersistent({id:I,title:`Generating ${z}...`,description:`Creating synthetic user profile${n>1?"s":""}${D}`,type:"info"});const $={..._,oceanTraits:_.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:_.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:t||void 0},G={id:`temp-${Date.now()}`,...$},R=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(R.push(G),localStorage.setItem("tempPersonas",JSON.stringify(R)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),qe.error("Authentication required",{description:"No valid token found. Please log in again."});try{console.log("No token found, attempting new login"),await h("user","pass"),console.log("Login successful, token:",((j=localStorage.getItem("auth_token"))==null?void 0:j.substring(0,10))+"...")}catch(Y){throw console.error("Login retry failed:",Y),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const W=await zr.create($);console.log("Persona created successfully:",W),qe.updatePersistent(I,{title:"Synthetic user created successfully",description:`Created profile for ${_.name}`,type:"success"})}catch(L){throw console.error("Error creating persona via API:",L),L.response&&L.response.status===401&&qe.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),L}else{const L=[];L.push($);for(let W=1;W{d("/synthetic-users?mode=view")},300)}catch(I){if(console.error("Error creating personas:",I),I.response&&I.response.status===401||I.message&&I.message.includes("Authentication failed")&&l<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const D=await ey.login("user","pass");if((k=D==null?void 0:D.data)!=null&&k.access_token){localStorage.setItem("auth_token",D.data.access_token),localStorage.setItem("user",JSON.stringify(D.data.user)),console.log("Manual login successful, got new token:",D.data.access_token.substring(0,10)+"..."),qe.info("Logged in with default account, retrying submission..."),setTimeout(()=>{C(_,!0)},500);return}else throw new Error("No access token received")}catch(D){console.error("Login retry failed:",D),qe.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else qe.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((E=(O=I.response)==null?void 0:O.data)==null?void 0:E.message)||I.message||"An unexpected error occurred",type:"error"})}finally{o(!1)}}return a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsx("h2",{className:"text-2xl font-sf font-semibold",children:"Create Synthetic Users"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(J,{variant:"outline",size:"sm",onClick:()=>r(Math.max(1,n-1)),children:"-"}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dr,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(J,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(K0,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(C),className:"space-y-6",children:[a.jsxs(dl,{defaultValue:"basic",children:[a.jsxs(Va,{className:"grid w-full grid-cols-6",children:[a.jsx(gn,{value:"basic",children:"Basic"}),a.jsx(gn,{value:"cooper",children:"Cooper"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"demographics",children:"Demographics"}),a.jsx(gn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(gn,{value:"extended",children:"Extended"})]}),a.jsx(vn,{value:"basic",className:"mt-6",children:a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"name",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Name"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Jane Smith",..._})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(vt,{control:p.control,name:"age",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Age Range"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select age range"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"18-24",children:"18-24"}),a.jsx(oe,{value:"25-34",children:"25-34"}),a.jsx(oe,{value:"35-44",children:"35-44"}),a.jsx(oe,{value:"45-54",children:"45-54"}),a.jsx(oe,{value:"55-64",children:"55-64"}),a.jsx(oe,{value:"65+",children:"65+"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"gender",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Gender"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select gender"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Male",children:"Male"}),a.jsx(oe,{value:"Female",children:"Female"}),a.jsx(oe,{value:"Non-binary",children:"Non-binary"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})})]}),a.jsx(vt,{control:p.control,name:"occupation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Occupation"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Software Engineer",..._})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"education",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Education"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select education level"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"High School",children:"High School"}),a.jsx(oe,{value:"Some College",children:"Some College"}),a.jsx(oe,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(oe,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(oe,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(oe,{value:"PhD",children:"PhD"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"location",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Location"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"New York, USA",..._})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"ethnicity",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Ethnicity (Optional)"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select ethnicity"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"white",children:"White"}),a.jsx(oe,{value:"black",children:"Black"}),a.jsx(oe,{value:"asian",children:"Asian"}),a.jsx(oe,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(oe,{value:"native-american",children:"Native American"}),a.jsx(oe,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(oe,{value:"mixed",children:"Mixed"}),a.jsx(oe,{value:"other",children:"Other"}),a.jsx(oe,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"personality",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Personality Traits"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Curious, analytical, detail-oriented",..._,rows:3})}),a.jsx(Nn,{children:"Describe key personality traits that define this user"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"interests",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Interests"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Technology, fitness, cooking, travel",..._,rows:3})}),a.jsx(Nn,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(vt,{control:p.control,name:"techSavviness",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"brandLoyalty",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"priceConsciousness",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"environmentalConcern",render:({field:_})=>a.jsxs(dt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(ft,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(ht,{children:a.jsx(br,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(vt,{control:p.control,name:"hasPurchasingPower",render:({field:_})=>a.jsxs(dt,{className:"flex items-center justify-between",children:[a.jsx(ft,{children:"Purchasing Power"}),a.jsx(ht,{children:a.jsx(ym,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"hasChildren",render:({field:_})=>a.jsxs(dt,{className:"flex items-center justify-between",children:[a.jsx(ft,{children:"Has Children"}),a.jsx(ht,{children:a.jsx(ym,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(pt,{})]})})]})]})]})]})})})}),a.jsxs(vn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(p.watch("goals")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("goals",A,j.target.value),placeholder:"Enter a goal"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("goals",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(p.watch("frustrations")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("frustrations",A,j.target.value),placeholder:"Enter a frustration"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("frustrations",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(p.watch("motivations")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("motivations",A,j.target.value),placeholder:"Enter a motivation"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("motivations",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).thinks||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("thinks",A,j.target.value),placeholder:"What they think"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).feels||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("feels",A,j.target.value),placeholder:"What they feel"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).does||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>x("does",A,j.target.value),placeholder:"What they do"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"scenarioType",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Scenario Section Title"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Life Scenarios",..._})}),a.jsx(Nn,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(pt,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(mt,{value:_,onChange:j=>m("scenarios",A,j.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("scenarios",A),className:"mt-2",children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{openness:50}).openness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:_=>S("openness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:_=>S("conscientiousness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:_=>S("extraversion",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:_=>S("agreeableness",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50,"%"]})]}),a.jsx(br,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:_=>S("neuroticism",_[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(vn,{value:"demographics",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"socialGrade",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Social Grade"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select social grade"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"A",children:"A - Higher managerial"}),a.jsx(oe,{value:"B",children:"B - Intermediate managerial"}),a.jsx(oe,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(oe,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(oe,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(oe,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"householdIncome",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Household Income"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select income range"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Under $25k",children:"Under $25,000"}),a.jsx(oe,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(oe,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(oe,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(oe,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(oe,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(oe,{value:"Over $250k",children:"Over $250,000"}),a.jsx(oe,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"householdComposition",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Household Composition"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select household type"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Single person",children:"Single person"}),a.jsx(oe,{value:"Couple without children",children:"Couple without children"}),a.jsx(oe,{value:"Couple with children",children:"Couple with children"}),a.jsx(oe,{value:"Single parent",children:"Single parent"}),a.jsx(oe,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(oe,{value:"Shared housing",children:"Shared housing"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"livingSituation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Living Situation"}),a.jsxs(Un,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select living situation"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Own home",children:"Own home"}),a.jsx(oe,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(oe,{value:"Rent house",children:"Rent house"}),a.jsx(oe,{value:"Live with family",children:"Live with family"}),a.jsx(oe,{value:"Student housing",children:"Student housing"}),a.jsx(oe,{value:"Assisted living",children:"Assisted living"}),a.jsx(oe,{value:"Other",children:"Other"})]})]}),a.jsx(pt,{})]})})]})]})]})})}),a.jsx(vn,{value:"lifestyle",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"mediaConsumption",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Media Consumption"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"TV shows, podcasts, news sources, social media platforms",..._,rows:3})}),a.jsx(Nn,{children:"Describe media consumption habits and preferences"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"deviceUsage",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Device Usage"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",..._,rows:3})}),a.jsx(Nn,{children:"Primary devices and usage patterns"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"shoppingHabits",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Shopping Habits"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Online vs in-store, frequency, preferred retailers",..._,rows:3})}),a.jsx(Nn,{children:"Shopping behavior and preferences"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"brandPreferences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Brand Preferences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Favorite brands, brand values alignment",..._,rows:3})}),a.jsx(Nn,{children:"Preferred brands and reasoning"}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"communicationPreferences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Communication Preferences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Email, phone, text, video calls, in-person",..._,rows:3})}),a.jsx(Nn,{children:"Preferred communication methods and channels"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"paymentMethods",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Payment Methods"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Credit cards, digital wallets, cash, BNPL",..._,rows:3})}),a.jsx(Nn,{children:"Preferred payment methods and financial tools"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"purchaseBehaviour",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Purchase Behavior"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Research habits, decision factors, impulse vs planned buying",..._,rows:3})}),a.jsx(Nn,{children:"How they approach making purchase decisions"}),a.jsx(pt,{})]})})]})]})]})})}),a.jsxs(vn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"coreValues",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Core Values"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Key principles and values that guide decisions",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"lifestyleChoices",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Lifestyle Choices"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Health, fitness, diet, work-life balance preferences",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"socialActivities",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Social Activities"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Social hobbies, community involvement, networking",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"categoryKnowledge",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Category Knowledge"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Expertise in specific product/service categories",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"decisionInfluences",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Decision Influences"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"What factors most influence their decisions",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"painPoints",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Pain Points"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Common challenges and friction points",..._,rows:3})}),a.jsx(pt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(vt,{control:p.control,name:"journeyContext",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Journey Context"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Current life stage and contextual factors",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"keyTouchpoints",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Key Touchpoints"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Important interaction points and channels",..._,rows:3})}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Autonomy"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need for independence and self-direction",..._,rows:2})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Competence"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need to feel capable and effective",..._,rows:2})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Relatedness"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Need for connection and belonging",..._,rows:2})}),a.jsx(pt,{})]})})]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(p.watch("fears")||[]).map((_,A)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:_,onChange:j=>m("fears",A,j.target.value),placeholder:"Enter a fear or concern"}),a.jsx(J,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("fears",A),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(J,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(vt,{control:p.control,name:"narrative",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Personal Narrative"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Personal story, background, key life experiences",..._,rows:4})}),a.jsx(Nn,{children:"A brief narrative that captures their personal story"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:p.control,name:"additionalInformation",render:({field:_})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Additional Information"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Any other relevant details or context",..._,rows:4})}),a.jsx(Nn,{children:"Additional context or details not covered elsewhere"}),a.jsx(pt,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(J,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(J,{type:"submit",disabled:i,children:[i?a.jsx(tZ,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(DE,{className:"mr-2 h-4 w-4"}),i?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var NA=["Enter"," "],ile=["ArrowDown","PageUp","Home"],fH=["ArrowUp","PageDown","End"],ole=[...ile,...fH],sle={ltr:[...NA,"ArrowRight"],rtl:[...NA,"ArrowLeft"]},ale={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Eg="Menu",[xm,cle,lle]=q0(Eg),[Pu,hH]=Li(Eg,[lle,Df,qf]),rw=Df(),pH=qf(),[ule,ku]=Pu(Eg),[dle,Tg]=Pu(Eg),mH=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=t,c=rw(e),[l,u]=v.useState(null),d=v.useRef(!1),f=Cr(o),h=Nu(i);return v.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(k4,{...c,children:a.jsx(ule,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:u,children:a.jsx(dle,{scope:e,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:s,children:r})})})};mH.displayName=Eg;var fle="MenuAnchor",CN=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=rw(n);return a.jsx(bE,{...i,...r,ref:e})});CN.displayName=fle;var _N="MenuPortal",[hle,gH]=Pu(_N,{forceMount:void 0}),vH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,o=ku(_N,e);return a.jsx(hle,{scope:e,forceMount:n,children:a.jsx(Wr,{present:n||o.open,children:a.jsx(d0,{asChild:!0,container:i,children:r})})})};vH.displayName=_N;var Ao="MenuContent",[ple,AN]=Pu(Ao),yH=v.forwardRef((t,e)=>{const n=gH(Ao,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=ku(Ao,t.__scopeMenu),s=Tg(Ao,t.__scopeMenu);return a.jsx(xm.Provider,{scope:t.__scopeMenu,children:a.jsx(Wr,{present:r||o.open,children:a.jsx(xm.Slot,{scope:t.__scopeMenu,children:s.modal?a.jsx(mle,{...i,ref:e}):a.jsx(gle,{...i,ref:e})})})})}),mle=v.forwardRef((t,e)=>{const n=ku(Ao,t.__scopeMenu),r=v.useRef(null),i=Pt(e,r);return v.useEffect(()=>{const o=r.current;if(o)return cN(o)},[]),a.jsx(jN,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Te(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),gle=v.forwardRef((t,e)=>{const n=ku(Ao,t.__scopeMenu);return a.jsx(jN,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),jN=v.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:s,disableOutsidePointerEvents:c,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=t,y=ku(Ao,n),b=Tg(Ao,n),x=rw(n),w=pH(n),S=cle(n),[C,_]=v.useState(null),A=v.useRef(null),j=Pt(e,A,y.onContentChange),P=v.useRef(0),k=v.useRef(""),O=v.useRef(0),E=v.useRef(null),I=v.useRef("right"),D=v.useRef(0),z=g?X0:v.Fragment,$=g?{as:Hs,allowPinchZoom:!0}:void 0,G=L=>{var ae,De;const W=k.current+L,Y=S().filter(de=>!de.disabled),te=document.activeElement,me=(ae=Y.find(de=>de.ref.current===te))==null?void 0:ae.textValue,F=Y.map(de=>de.textValue),se=Tle(F,W,me),ne=(De=Y.find(de=>de.textValue===se))==null?void 0:De.ref.current;(function de(ye){k.current=ye,window.clearTimeout(P.current),ye!==""&&(P.current=window.setTimeout(()=>de(""),1e3))})(W),ne&&setTimeout(()=>ne.focus())};v.useEffect(()=>()=>window.clearTimeout(P.current),[]),aN();const R=v.useCallback(L=>{var Y,te;return I.current===((Y=E.current)==null?void 0:Y.side)&&Ple(L,(te=E.current)==null?void 0:te.area)},[]);return a.jsx(ple,{scope:n,searchRef:k,onItemEnter:v.useCallback(L=>{R(L)&&L.preventDefault()},[R]),onItemLeave:v.useCallback(L=>{var W;R(L)||((W=A.current)==null||W.focus(),_(null))},[R]),onTriggerLeave:v.useCallback(L=>{R(L)&&L.preventDefault()},[R]),pointerGraceTimerRef:O,onPointerGraceIntentChange:v.useCallback(L=>{E.current=L},[]),children:a.jsx(z,{...$,children:a.jsx(Y0,{asChild:!0,trapped:i,onMountAutoFocus:Te(o,L=>{var W;L.preventDefault(),(W=A.current)==null||W.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:a.jsx(fg,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(xN,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:_,onEntryFocus:Te(l,L=>{b.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(wE,{role:"menu","aria-orientation":"vertical","data-state":RH(y.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:j,style:{outline:"none",...m.style},onKeyDown:Te(m.onKeyDown,L=>{const Y=L.target.closest("[data-radix-menu-content]")===L.currentTarget,te=L.ctrlKey||L.altKey||L.metaKey,me=L.key.length===1;Y&&(L.key==="Tab"&&L.preventDefault(),!te&&me&&G(L.key));const F=A.current;if(L.target!==F||!ole.includes(L.key))return;L.preventDefault();const ne=S().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);fH.includes(L.key)&&ne.reverse(),jle(ne)}),onBlur:Te(t.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(P.current),k.current="")}),onPointerMove:Te(t.onPointerMove,bm(L=>{const W=L.target,Y=D.current!==L.clientX;if(L.currentTarget.contains(W)&&Y){const te=L.clientX>D.current?"right":"left";I.current=te,D.current=L.clientX}}))})})})})})})});yH.displayName=Ao;var vle="MenuGroup",EN=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{role:"group",...r,ref:e})});EN.displayName=vle;var yle="MenuLabel",xH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{...r,ref:e})});xH.displayName=yle;var Px="MenuItem",AR="menu.itemSelect",iw=v.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,o=v.useRef(null),s=Tg(Px,t.__scopeMenu),c=AN(Px,t.__scopeMenu),l=Pt(e,o),u=v.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const h=new CustomEvent(AR,{bubbles:!0,cancelable:!0});f.addEventListener(AR,p=>r==null?void 0:r(p),{once:!0}),u4(f,h),h.defaultPrevented?u.current=!1:s.onClose()}};return a.jsx(bH,{...i,ref:l,disabled:n,onClick:Te(t.onClick,d),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),u.current=!0},onPointerUp:Te(t.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Te(t.onKeyDown,f=>{const h=c.searchRef.current!=="";n||h&&f.key===" "||NA.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});iw.displayName=Px;var bH=v.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=t,s=AN(Px,n),c=pH(n),l=v.useRef(null),u=Pt(e,l),[d,f]=v.useState(!1),[h,p]=v.useState("");return v.useEffect(()=>{const g=l.current;g&&p((g.textContent??"").trim())},[o.children]),a.jsx(xm.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:a.jsx(bN,{asChild:!0,...c,focusable:!r,children:a.jsx(it.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:Te(t.onPointerMove,bm(g=>{r?s.onItemLeave(g):(s.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(t.onPointerLeave,bm(g=>s.onItemLeave(g))),onFocus:Te(t.onFocus,()=>f(!0)),onBlur:Te(t.onBlur,()=>f(!1))})})})}),xle="MenuCheckboxItem",wH=v.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return a.jsx(jH,{scope:t.__scopeMenu,checked:n,children:a.jsx(iw,{role:"menuitemcheckbox","aria-checked":kx(n)?"mixed":n,...i,ref:e,"data-state":NN(n),onSelect:Te(i.onSelect,()=>r==null?void 0:r(kx(n)?!0:!n),{checkForDefaultPrevented:!1})})})});wH.displayName=xle;var SH="MenuRadioGroup",[ble,wle]=Pu(SH,{value:void 0,onValueChange:()=>{}}),CH=v.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,o=Cr(r);return a.jsx(ble,{scope:t.__scopeMenu,value:n,onValueChange:o,children:a.jsx(EN,{...i,ref:e})})});CH.displayName=SH;var _H="MenuRadioItem",AH=v.forwardRef((t,e)=>{const{value:n,...r}=t,i=wle(_H,t.__scopeMenu),o=n===i.value;return a.jsx(jH,{scope:t.__scopeMenu,checked:o,children:a.jsx(iw,{role:"menuitemradio","aria-checked":o,...r,ref:e,"data-state":NN(o),onSelect:Te(r.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,n)},{checkForDefaultPrevented:!1})})})});AH.displayName=_H;var TN="MenuItemIndicator",[jH,Sle]=Pu(TN,{checked:!1}),EH=v.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,o=Sle(TN,n);return a.jsx(Wr,{present:r||kx(o.checked)||o.checked===!0,children:a.jsx(it.span,{...i,ref:e,"data-state":NN(o.checked)})})});EH.displayName=TN;var Cle="MenuSeparator",TH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(it.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});TH.displayName=Cle;var _le="MenuArrow",NH=v.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=rw(n);return a.jsx(SE,{...i,...r,ref:e})});NH.displayName=_le;var Ale="MenuSub",[hFe,PH]=Pu(Ale),Yh="MenuSubTrigger",kH=v.forwardRef((t,e)=>{const n=ku(Yh,t.__scopeMenu),r=Tg(Yh,t.__scopeMenu),i=PH(Yh,t.__scopeMenu),o=AN(Yh,t.__scopeMenu),s=v.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:t.__scopeMenu},d=v.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=c.current;return()=>{window.clearTimeout(f),l(null)}},[c,l]),a.jsx(CN,{asChild:!0,...u,children:a.jsx(bH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":RH(n.open),...t,ref:a0(e,i.onTriggerChange),onClick:f=>{var h;(h=t.onClick)==null||h.call(t,f),!(t.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Te(t.onPointerMove,bm(f=>{o.onItemEnter(f),!f.defaultPrevented&&!t.disabled&&!n.open&&!s.current&&(o.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Te(t.onPointerLeave,bm(f=>{var p,g;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,y=m==="right",b=y?-5:5,x=h[y?"left":"right"],w=h[y?"right":"left"];o.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x,y:h.bottom}],side:m}),window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(f),f.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Te(t.onKeyDown,f=>{var p;const h=o.searchRef.current!=="";t.disabled||h&&f.key===" "||sle[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});kH.displayName=Yh;var OH="MenuSubContent",IH=v.forwardRef((t,e)=>{const n=gH(Ao,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=ku(Ao,t.__scopeMenu),s=Tg(Ao,t.__scopeMenu),c=PH(OH,t.__scopeMenu),l=v.useRef(null),u=Pt(e,l);return a.jsx(xm.Provider,{scope:t.__scopeMenu,children:a.jsx(Wr,{present:r||o.open,children:a.jsx(xm.Slot,{scope:t.__scopeMenu,children:a.jsx(jN,{id:c.contentId,"aria-labelledby":c.triggerId,...i,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;s.isUsingKeyboardRef.current&&((f=l.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Te(t.onFocusOutside,d=>{d.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Te(t.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Te(t.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=ale[s.dir].includes(d.key);f&&h&&(o.onOpenChange(!1),(p=c.trigger)==null||p.focus(),d.preventDefault())})})})})})});IH.displayName=OH;function RH(t){return t?"open":"closed"}function kx(t){return t==="indeterminate"}function NN(t){return kx(t)?"indeterminate":t?"checked":"unchecked"}function jle(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Ele(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function Tle(t,e,n){const i=e.length>1&&Array.from(e).every(u=>u===e[0])?e[0]:e,o=n?t.indexOf(n):-1;let s=Ele(t,Math.max(o,0));i.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function Nle(t,e){const{x:n,y:r}=t;let i=!1;for(let o=0,s=e.length-1;or!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Ple(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Nle(n,e)}function bm(t){return e=>e.pointerType==="mouse"?t(e):void 0}var kle=mH,Ole=CN,Ile=vH,Rle=yH,Mle=EN,Dle=xH,$le=iw,Lle=wH,Fle=CH,Ble=AH,Ule=EH,Hle=TH,zle=NH,Gle=kH,Vle=IH,PN="DropdownMenu",[Kle,pFe]=Li(PN,[hH]),Si=hH(),[Wle,MH]=Kle(PN),DH=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:c=!0}=t,l=Si(e),u=v.useRef(null),[d=!1,f]=as({prop:i,defaultProp:o,onChange:s});return a.jsx(Wle,{scope:e,triggerId:Xo(),triggerRef:u,contentId:Xo(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:c,children:a.jsx(kle,{...l,open:d,onOpenChange:f,dir:r,modal:c,children:n})})};DH.displayName=PN;var $H="DropdownMenuTrigger",LH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,o=MH($H,n),s=Si(n);return a.jsx(Ole,{asChild:!0,...s,children:a.jsx(it.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...i,ref:a0(e,o.triggerRef),onPointerDown:Te(t.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:Te(t.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});LH.displayName=$H;var qle="DropdownMenuPortal",FH=t=>{const{__scopeDropdownMenu:e,...n}=t,r=Si(e);return a.jsx(Ile,{...r,...n})};FH.displayName=qle;var BH="DropdownMenuContent",UH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=MH(BH,n),o=Si(n),s=v.useRef(!1);return a.jsx(Rle,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:e,onCloseAutoFocus:Te(t.onCloseAutoFocus,c=>{var l;s.current||(l=i.triggerRef.current)==null||l.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Te(t.onInteractOutside,c=>{const l=c.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!i.modal||d)&&(s.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});UH.displayName=BH;var Yle="DropdownMenuGroup",Qle=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Mle,{...i,...r,ref:e})});Qle.displayName=Yle;var Xle="DropdownMenuLabel",HH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Dle,{...i,...r,ref:e})});HH.displayName=Xle;var Jle="DropdownMenuItem",zH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx($le,{...i,...r,ref:e})});zH.displayName=Jle;var Zle="DropdownMenuCheckboxItem",GH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Lle,{...i,...r,ref:e})});GH.displayName=Zle;var eue="DropdownMenuRadioGroup",tue=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Fle,{...i,...r,ref:e})});tue.displayName=eue;var nue="DropdownMenuRadioItem",VH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Ble,{...i,...r,ref:e})});VH.displayName=nue;var rue="DropdownMenuItemIndicator",KH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Ule,{...i,...r,ref:e})});KH.displayName=rue;var iue="DropdownMenuSeparator",WH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Hle,{...i,...r,ref:e})});WH.displayName=iue;var oue="DropdownMenuArrow",sue=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(zle,{...i,...r,ref:e})});sue.displayName=oue;var aue="DropdownMenuSubTrigger",qH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Gle,{...i,...r,ref:e})});qH.displayName=aue;var cue="DropdownMenuSubContent",YH=v.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=Si(n);return a.jsx(Vle,{...i,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});YH.displayName=cue;var lue=DH,uue=LH,due=FH,QH=UH,XH=HH,JH=zH,ZH=GH,ez=VH,tz=KH,nz=WH,rz=qH,iz=YH;const PA=lue,kA=uue,fue=v.forwardRef(({className:t,inset:e,children:n,...r},i)=>a.jsxs(rz,{ref:i,className:Ne("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",e&&"pl-8",t),...r,children:[n,a.jsx(fo,{className:"ml-auto h-4 w-4"})]}));fue.displayName=rz.displayName;const hue=v.forwardRef(({className:t,...e},n)=>a.jsx(iz,{ref:n,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));hue.displayName=iz.displayName;const Ox=v.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(due,{children:a.jsx(QH,{ref:r,sideOffset:e,className:Ne("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Ox.displayName=QH.displayName;const oc=v.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(JH,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));oc.displayName=JH.displayName;const pue=v.forwardRef(({className:t,children:e,checked:n,...r},i)=>a.jsxs(ZH,{ref:i,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tz,{children:a.jsx(Gs,{className:"h-4 w-4"})})}),e]}));pue.displayName=ZH.displayName;const mue=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(ez,{ref:r,className:Ne("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(tz,{children:a.jsx(RE,{className:"h-2 w-2 fill-current"})})}),e]}));mue.displayName=ez.displayName;const gue=v.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(XH,{ref:r,className:Ne("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));gue.displayName=XH.displayName;const vue=v.forwardRef(({className:t,...e},n)=>a.jsx(nz,{ref:n,className:Ne("-mx-1 my-1 h-px bg-muted",t),...e}));vue.displayName=nz.displayName;var kN="Dialog",[oz,sz]=Li(kN),[yue,ps]=oz(kN),az=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=t,c=v.useRef(null),l=v.useRef(null),[u=!1,d]=as({prop:r,defaultProp:i,onChange:o});return a.jsx(yue,{scope:e,triggerRef:c,contentRef:l,contentId:Xo(),titleId:Xo(),descriptionId:Xo(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:s,children:n})};az.displayName=kN;var cz="DialogTrigger",lz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(cz,n),o=Pt(e,i.triggerRef);return a.jsx(it.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":RN(i.open),...r,ref:o,onClick:Te(t.onClick,i.onOpenToggle)})});lz.displayName=cz;var ON="DialogPortal",[xue,uz]=oz(ON,{forceMount:void 0}),dz=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,o=ps(ON,e);return a.jsx(xue,{scope:e,forceMount:n,children:v.Children.map(r,s=>a.jsx(Wr,{present:n||o.open,children:a.jsx(d0,{asChild:!0,container:i,children:s})}))})};dz.displayName=ON;var Ix="DialogOverlay",fz=v.forwardRef((t,e)=>{const n=uz(Ix,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=ps(Ix,t.__scopeDialog);return o.modal?a.jsx(Wr,{present:r||o.open,children:a.jsx(bue,{...i,ref:e})}):null});fz.displayName=Ix;var bue=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(Ix,n);return a.jsx(X0,{as:Hs,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(it.div,{"data-state":RN(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),xu="DialogContent",hz=v.forwardRef((t,e)=>{const n=uz(xu,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=ps(xu,t.__scopeDialog);return a.jsx(Wr,{present:r||o.open,children:o.modal?a.jsx(wue,{...i,ref:e}):a.jsx(Sue,{...i,ref:e})})});hz.displayName=xu;var wue=v.forwardRef((t,e)=>{const n=ps(xu,t.__scopeDialog),r=v.useRef(null),i=Pt(e,n.contentRef,r);return v.useEffect(()=>{const o=r.current;if(o)return cN(o)},[]),a.jsx(pz,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Te(t.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Te(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&o.preventDefault()}),onFocusOutside:Te(t.onFocusOutside,o=>o.preventDefault())})}),Sue=v.forwardRef((t,e)=>{const n=ps(xu,t.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return a.jsx(pz,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var s,c;(s=t.onCloseAutoFocus)==null||s.call(t,o),o.defaultPrevented||(r.current||(c=n.triggerRef.current)==null||c.focus(),o.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:o=>{var l,u;(l=t.onInteractOutside)==null||l.call(t,o),o.defaultPrevented||(r.current=!0,o.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const s=o.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&i.current&&o.preventDefault()}})}),pz=v.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=t,c=ps(xu,n),l=v.useRef(null),u=Pt(e,l);return aN(),a.jsxs(a.Fragment,{children:[a.jsx(Y0,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:a.jsx(fg,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":RN(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(_ue,{titleId:c.titleId}),a.jsx(jue,{contentRef:l,descriptionId:c.descriptionId})]})]})}),IN="DialogTitle",mz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(IN,n);return a.jsx(it.h2,{id:i.titleId,...r,ref:e})});mz.displayName=IN;var gz="DialogDescription",vz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(gz,n);return a.jsx(it.p,{id:i.descriptionId,...r,ref:e})});vz.displayName=gz;var yz="DialogClose",xz=v.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=ps(yz,n);return a.jsx(it.button,{type:"button",...r,ref:e,onClick:Te(t.onClick,()=>i.onOpenChange(!1))})});xz.displayName=yz;function RN(t){return t?"open":"closed"}var bz="DialogTitleWarning",[Cue,wz]=G9(bz,{contentName:xu,titleName:IN,docsSlug:"dialog"}),_ue=({titleId:t})=>{const e=wz(bz),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component. @@ -546,14 +546,14 @@ You can add a description to the \`${Ed}\` by passing a \`${kz}\` component as a Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ed}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},$ue=Az,Lue=jz,Dz=Ez,$z=Tz,Lz=Iz,Fz=Mz,Bz=Pz,Uz=Oz;const OA=$ue,Fue=Lue,Hz=v.forwardRef(({className:t,...e},n)=>a.jsx(Dz,{className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));Hz.displayName=Dz.displayName;const Rx=v.forwardRef(({className:t,...e},n)=>a.jsxs(Fue,{children:[a.jsx(Hz,{}),a.jsx($z,{ref:n,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Rx.displayName=$z.displayName;const Mx=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col space-y-2 text-center sm:text-left",t),...e});Mx.displayName="AlertDialogHeader";const Dx=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Dx.displayName="AlertDialogFooter";const $x=v.forwardRef(({className:t,...e},n)=>a.jsx(Bz,{ref:n,className:Ne("text-lg font-semibold",t),...e}));$x.displayName=Bz.displayName;const Lx=v.forwardRef(({className:t,...e},n)=>a.jsx(Uz,{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));Lx.displayName=Uz.displayName;const Fx=v.forwardRef(({className:t,...e},n)=>a.jsx(Lz,{ref:n,className:Ne(JT(),t),...e}));Fx.displayName=Lz.displayName;const Bx=v.forwardRef(({className:t,...e},n)=>a.jsx(Fz,{ref:n,className:Ne(JT({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Bx.displayName=Fz.displayName;const Ql=Sz,Bue=Cz,zz=v.forwardRef(({className:t,...e},n)=>a.jsx(MN,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));zz.displayName=MN.displayName;const $c=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Bue,{children:[a.jsx(zz,{}),a.jsxs(DN,{ref:r,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,a.jsxs(FN,{className:"absolute right-4 top-4 z-[100] rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Jo,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$c.displayName=DN.displayName;const Lc=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Lc.displayName="DialogHeader";const Fc=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Fc.displayName="DialogFooter";const Bc=v.forwardRef(({className:t,...e},n)=>a.jsx($N,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",t),...e}));Bc.displayName=$N.displayName;const Xl=v.forwardRef(({className:t,...e},n)=>a.jsx(LN,{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));Xl.displayName=LN.displayName;var BN="Radio",[Uue,Gz]=Li(BN),[Hue,zue]=Uue(BN),Vz=v.forwardRef((t,e)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:c="on",onCheck:l,form:u,...d}=t,[f,h]=v.useState(null),p=Pt(e,y=>h(y)),g=v.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(Hue,{scope:n,checked:i,disabled:s,children:[a.jsx(it.button,{type:"button",role:"radio","aria-checked":i,"data-state":qz(i),"data-disabled":s?"":void 0,disabled:s,value:c,...d,ref:p,onClick:Te(t.onClick,y=>{i||l==null||l(),m&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})}),m&&a.jsx(Gue,{control:f,bubbles:!g.current,name:r,value:c,checked:i,required:o,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})});Vz.displayName=BN;var Kz="RadioIndicator",Wz=v.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...i}=t,o=zue(Kz,n);return a.jsx(Wr,{present:r||o.checked,children:a.jsx(it.span,{"data-state":qz(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})})});Wz.displayName=Kz;var Gue=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=v.useRef(null),s=wg(n),c=pg(e);return v.useEffect(()=>{const l=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qz(t){return t?"checked":"unchecked"}var Vue=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],UN="RadioGroup",[Kue,gFe]=Li(UN,[qf,Gz]),Yz=qf(),Qz=Gz(),[Wue,que]=Kue(UN),Xz=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...h}=t,p=Yz(n),g=Nu(u),[m,y]=as({prop:o,defaultProp:i,onChange:f});return a.jsx(Wue,{scope:n,name:r,required:s,disabled:c,value:m,onValueChange:y,children:a.jsx(xN,{asChild:!0,...p,orientation:l,dir:g,loop:d,children:a.jsx(it.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:g,...h,ref:e})})})});Xz.displayName=UN;var Jz="RadioGroupItem",Zz=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...i}=t,o=que(Jz,n),s=o.disabled||r,c=Yz(n),l=Qz(n),u=v.useRef(null),d=Pt(e,u),f=o.value===i.value,h=v.useRef(!1);return v.useEffect(()=>{const p=m=>{Vue.includes(m.key)&&(h.current=!0)},g=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",g)}},[]),a.jsx(bN,{asChild:!0,...c,focusable:!s,active:f,children:a.jsx(Vz,{disabled:s,required:o.required,checked:f,...l,...i,name:o.name,ref:d,onCheck:()=>o.onValueChange(i.value),onKeyDown:Te(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Te(i.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});Zz.displayName=Jz;var Yue="RadioGroupIndicator",eG=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,i=Qz(n);return a.jsx(Wz,{...i,...r,ref:e})});eG.displayName=Yue;var tG=Xz,nG=Zz,Que=eG;const IA=v.forwardRef(({className:t,...e},n)=>a.jsx(tG,{className:Ne("grid gap-2",t),...e,ref:n}));IA.displayName=tG.displayName;const Qh=v.forwardRef(({className:t,...e},n)=>a.jsx(nG,{ref:n,className:Ne("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:a.jsx(Que,{className:"flex items-center justify-center",children:a.jsx(RE,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Qh.displayName=nG.displayName;var HN="Checkbox",[Xue,vFe]=Li(HN),[Jue,Zue]=Xue(HN),rG=v.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=t,[h,p]=v.useState(null),g=Pt(e,S=>p(S)),m=v.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=as({prop:i,defaultProp:o,onChange:u}),w=v.useRef(b);return v.useEffect(()=>{const S=h==null?void 0:h.form;if(S){const C=()=>x(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[h,x]),a.jsxs(Jue,{scope:n,state:b,disabled:c,children:[a.jsx(it.button,{type:"button",role:"checkbox","aria-checked":Uc(b)?"mixed":b,"aria-required":s,"data-state":sG(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:g,onKeyDown:Te(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Te(t.onClick,S=>{x(C=>Uc(C)?!0:!C),y&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),y&&a.jsx(ede,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Uc(o)?!1:o})]})});rG.displayName=HN;var iG="CheckboxIndicator",oG=v.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,o=Zue(iG,n);return a.jsx(Wr,{present:r||Uc(o.state)||o.state===!0,children:a.jsx(it.span,{"data-state":sG(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});oG.displayName=iG;var ede=t=>{const{control:e,checked:n,bubbles:r=!0,defaultChecked:i,...o}=t,s=v.useRef(null),c=wg(n),l=pg(e);v.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=Uc(n),p.call(d,Uc(n)?!1:n),d.dispatchEvent(g)}},[c,n,r]);const u=v.useRef(Uc(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Uc(t){return t==="indeterminate"}function sG(t){return Uc(t)?"indeterminate":t?"checked":"unchecked"}var aG=rG,tde=oG;const Dl=v.forwardRef(({className:t,...e},n)=>a.jsx(aG,{ref:n,className:Ne("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(tde,{className:Ne("flex items-center justify-center text-current"),children:a.jsx(Gs,{className:"h-4 w-4"})})}));Dl.displayName=aG.displayName;const zN=({isActive:t,isComplete:e,hasError:n,label:r,onComplete:i,className:o})=>{const[s,c]=v.useState(0),[l,u]=v.useState("progressing"),[d,f]=v.useState(!1),h=v.useRef(null),p=v.useRef(null),g=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{g(),c(0),u("progressing"),f(!1)},y=S=>{g(),u("completing");const C=100-S,_=50,A=500/_,j=C/A;let P=0;h.current=setInterval(()=>{P++;const k=S+j*P;k>=100||P>=A?(c(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),i==null||i()},300)},2e3)):c(k)},_)},b=()=>{l==="progressing"&&y(s)},x=()=>{l==="waiting"&&y(90)},w=()=>{g()};return v.useEffect(()=>{if(t&&!d){f(!0),c(0),u("progressing");const S=90/540;let C=0;h.current=setInterval(()=>{C+=S,C>=90?(c(90),u("waiting"),g()):c(C)},100)}return e&&l==="progressing"&&b(),e&&l==="waiting"&&x(),n&&(l==="progressing"||l==="waiting")&&w(),!t&&d&&m(),()=>{t||g()}},[t,e,n,l,d]),v.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:Ne("w-full space-y-2",o),children:[r&&a.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[a.jsx("span",{children:l==="waiting"?`${r} - finalizing...`:r}),a.jsxs("span",{children:[Math.round(s),"%"]})]}),a.jsx(Rl,{value:s,className:Ne("w-full transition-all duration-200",n&&"opacity-75",l==="completed"&&"bg-green-100")}),n&&a.jsx("div",{className:"text-sm text-red-600",children:"Generation failed. Please try again."}),l==="completed"&&!n&&a.jsx("div",{className:"text-sm text-green-600",children:"Generation completed successfully!"})]}):null},tr="all",nde=()=>{var Xt,bn,oo,ta;const t=v.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),e=ar(),[n]=FJ(),{loadPersonas:r}=E6(),[i,o]=v.useState("view"),[s,c]=v.useState("ai"),[l,u]=v.useState("");v.useState(null);const[d,f]=v.useState(tr),[h,p]=v.useState(!1),[g,m]=v.useState("");v.useEffect(()=>{const q=n.get("mode");(q==="view"||q==="create")&&o(q)},[n]);const[y,b]=v.useState([]),[x,w]=v.useState([]),[S,C]=v.useState(!0);v.useState(null);const[_,A]=v.useState(new Set),[j,P]=v.useState(!1),[k,O]=v.useState(null),[E,I]=v.useState(""),[D,z]=v.useState(!1),[$,G]=v.useState(null),[R,L]=v.useState(!1),[W,Y]=v.useState(null),[te,me]=v.useState(!1),[F,se]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[ne,ae]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[De,de]=v.useState(!1),[ye,Ee]=v.useState(!1),[Z,ct]=v.useState(!1),[Le,At]=v.useState(!1),[lt,Jt]=v.useState("gemini-2.5-pro"),T=()=>{de(!1),Ee(!1),ct(!1)},M=q=>{const Pe={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return q.forEach(We=>{if(We.age&&Pe.age.add(We.age),We.gender&&Pe.gender.add(We.gender),We.occupation&&Pe.occupation.add(We.occupation),We.location&&Pe.location.add(We.location),We.techSavviness!==void 0){const yt=We.techSavviness<30?"Low (0-30)":We.techSavviness<70?"Medium (31-70)":"High (71-100)";Pe.techSavviness.add(yt)}We.ethnicity&&Pe.ethnicity.add(We.ethnicity)}),{age:Array.from(Pe.age).sort(),gender:Array.from(Pe.gender).sort(),occupation:Array.from(Pe.occupation).sort(),location:Array.from(Pe.location).sort(),techSavviness:Array.from(Pe.techSavviness).sort((We,yt)=>{const et=["Low (0-30)","Medium (31-70)","High (71-100)"];return et.indexOf(We)-et.indexOf(yt)}),ethnicity:Array.from(Pe.ethnicity).sort()}},U=()=>{me(!1),setTimeout(()=>{se({...ne})},0)},V=()=>{ae({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]})},Q=(q,Pe)=>{ae(We=>{const yt={...We};return yt[q].includes(Pe)?yt[q]=yt[q].filter(et=>et!==Pe):yt[q]=[...yt[q],Pe],yt})},B=async()=>{try{const We=(await js.getAll()).data.map(yt=>({...yt,id:yt._id}));return w(We),We}catch(q){return console.error("Error fetching folders:",q),Ye.error("Failed to load folders"),w([]),[]}},X=async()=>{C(!0);try{const We=(await zr.getAll()).data;{const et=[...We.map(bt=>({...bt,id:bt.id||bt._id}))];try{(async()=>{const fn=await r();console.log("Loaded stored personas (for debugging only):",fn?fn.length:0)})()}catch(bt){console.warn("Error loading stored personas:",bt)}b(et)}}catch(Pe){console.error("Error fetching personas:",Pe),Ye.error("Failed to load personas"),b([])}finally{C(!1)}};v.useEffect(()=>((async()=>{try{const[,]=await Promise.all([B(),X()])}catch(Pe){console.error("Error loading data:",Pe)}})(),()=>{}),[t]),v.useEffect(()=>{var q;if(i==="view")X();else if(i==="create"&&(console.log(`Switching to create mode with folder: ${d}, ${d!==tr?"NOT default":"IS default"}`),d!==tr)){const Pe=(q=x.find(We=>We.id===d))==null?void 0:q.name;console.log(`Selected folder for creation: ${d} (${Pe})`)}},[i]),v.useEffect(()=>{X();const q=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),X())},Pe=()=>{console.log("Synthetic users navigation event detected, refreshing data"),X()};console.log("Setting up MutationObserver for body style");const We=new MutationObserver(yt=>{yt.forEach(et=>{et.type==="attributes"&&et.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),t())})});return We.observe(document.body,{attributes:!0,attributeFilter:["style"]}),t(),window.addEventListener("popstate",q),window.addEventListener("syntheticUsersNavigation",Pe),()=>{window.removeEventListener("popstate",q),window.removeEventListener("syntheticUsersNavigation",Pe),console.log("Disconnecting MutationObserver"),We.disconnect()}},[]);const ge=async()=>{if(!g.trim()){Ye.error("Please enter a folder name");return}try{const q=await js.create({name:g.trim(),persona_ids:[]});await B(),m(""),p(!1),Ye.success(`Folder "${g}" created`)}catch(q){console.error("Error creating folder:",q),Ye.error("Failed to create folder")}},xe=()=>{m(""),p(!1)},Re=q=>{O(q),I(q.name)},be=async()=>{if(!k||!E.trim()){O(null);return}try{await js.update(k._id,{name:E.trim()}),await B(),O(null),Ye.success(`Folder renamed to "${E}"`)}catch(q){console.error("Error renaming folder:",q),Ye.error("Failed to rename folder"),O(null)}},Ve=()=>{O(null),I("")},st=q=>{G(q),z(!0)},kt=async()=>{if($)try{await js.delete($._id),await B(),(d===$._id||d===$.id)&&f(tr),z(!1),G(null),Ye.success(`Folder "${$.name}" deleted`)}catch(q){console.error("Error deleting folder:",q),Ye.error("Failed to delete folder")}},Ke=async(q,Pe)=>{var fn;const We=q||_,yt=Pe||W;if(!yt||We.size===0)return;const et=Array.from(We),bt=et.map(ut=>{const An=y.find(an=>an.id===ut);return(An==null?void 0:An._id)||(An==null?void 0:An.id)||ut}).filter(Boolean);try{const ut=[],An=[];if(yt!==tr)try{await js.addPersonasBatch(yt,bt),ut.push(...et)}catch(nn){console.error("Error adding personas to folder:",nn),An.push(...et)}else ut.push(...et);await Promise.all([B(),X()]);const an=yt===tr?"All Personas":((fn=x.find(nn=>nn._id===yt||nn.id===yt))==null?void 0:fn.name)||"folder";return ut.length>0&&Ye.success(`Added ${ut.length} persona${ut.length!==1?"s":""} to ${an}`),An.length>0&&Ye.error(`Failed to add ${An.length} persona${An.length!==1?"s":""} to ${an}.`),q||A(new Set),{success:ut.length>0,successCount:ut.length,failureCount:An.length}}catch(ut){return console.error("Error moving personas to folder:",ut),Ye.error("An unexpected error occurred while adding personas to folder."),{success:!1,error:ut}}},tt=async()=>{var We,yt,et;if(_.size===0||d===tr)return;const q=Array.from(_),Pe=q.map(bt=>{const fn=y.find(ut=>ut.id===bt);return(fn==null?void 0:fn._id)||(fn==null?void 0:fn.id)||bt}).filter(Boolean);console.log("Removing personas from folder:",{selectedFolder:d,selectedIds:q,mongoIds:Pe,folderName:(We=x.find(bt=>bt._id===d))==null?void 0:We.name});try{await js.removePersonasBatch(d,Pe),await Promise.all([B(),X()]);const bt=((yt=x.find(fn=>fn._id===d))==null?void 0:yt.name)||"folder";Ye.success(`Removed ${q.length} persona${q.length!==1?"s":""} from ${bt}`),A(new Set)}catch(bt){console.error("Error removing personas from folder:",bt),console.error("Error details:",((et=bt.response)==null?void 0:et.data)||bt.message),Ye.error("Failed to remove personas from folder")}},Nt=q=>{A(Pe=>{const We=new Set(Pe);return We.has(q)?We.delete(q):We.add(q),We})},sn=()=>{_.size===dn.length?A(new Set):A(new Set(dn.map(q=>q.id)))},Nr=async()=>{if(_.size===0)return;const q=Array.from(_);A(new Set),P(!1),C(!0);const Pe=[],We=[];for(const yt of q)try{const et=y.find(fn=>fn.id===yt);if(!et){console.error(`Could not find persona with id: ${yt}`),We.push(yt);continue}let bt=yt;et._id&&(bt=et._id.toString()),console.log(`Attempting to delete persona: ${bt}`),await zr.delete(bt),Pe.push(yt)}catch(et){console.error(`Failed to delete persona ${yt}:`,et),We.push(yt)}b(yt=>yt.filter(et=>!Pe.includes(et.id))),await B(),C(!1),setTimeout(()=>{Pe.length>0&&Ye.success(`Successfully deleted ${Pe.length} persona${Pe.length!==1?"s":""}`),We.length>0&&Ye.error(`Failed to delete ${We.length} persona${We.length!==1?"s":""}`),(Pe.length>0||We.length>0)&&X()},50)},dn=y.filter(q=>{const Pe=q.name.toLowerCase().includes(l.toLowerCase())||q.occupation.toLowerCase().includes(l.toLowerCase())||q.location.toLowerCase().includes(l.toLowerCase()),We=(F.age.length===0||F.age.includes(q.age))&&(F.gender.length===0||F.gender.includes(q.gender))&&(F.occupation.length===0||F.occupation.includes(q.occupation))&&(F.location.length===0||F.location.includes(q.location))&&(F.ethnicity.length===0||q.ethnicity&&F.ethnicity.includes(q.ethnicity))&&(F.techSavviness.length===0||q.techSavviness!==void 0&&F.techSavviness.includes(q.techSavviness<30?"Low (0-30)":q.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&(F.folderStatus.length===0||F.folderStatus.includes("hasFolder")&&F.folderStatus.includes("noFolder")||F.folderStatus.includes("hasFolder")&&!F.folderStatus.includes("noFolder")&&q.folderId&&q.folderId!==tr||F.folderStatus.includes("noFolder")&&!F.folderStatus.includes("hasFolder")&&(!q.folderId||q.folderId===tr));return d===tr||q.folder_ids&&Array.isArray(q.folder_ids)&&q.folder_ids.includes(d)||q.folder_id===d||q.folderId===d?Pe&&We:!1}),wt=(q,Pe)=>{const We=new Date().toISOString().split("T")[0],yt=q.length;let et=`# Persona Summary Report +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},$ue=Az,Lue=jz,Dz=Ez,$z=Tz,Lz=Iz,Fz=Mz,Bz=Pz,Uz=Oz;const OA=$ue,Fue=Lue,Hz=v.forwardRef(({className:t,...e},n)=>a.jsx(Dz,{className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));Hz.displayName=Dz.displayName;const Rx=v.forwardRef(({className:t,...e},n)=>a.jsxs(Fue,{children:[a.jsx(Hz,{}),a.jsx($z,{ref:n,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Rx.displayName=$z.displayName;const Mx=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col space-y-2 text-center sm:text-left",t),...e});Mx.displayName="AlertDialogHeader";const Dx=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Dx.displayName="AlertDialogFooter";const $x=v.forwardRef(({className:t,...e},n)=>a.jsx(Bz,{ref:n,className:Ne("text-lg font-semibold",t),...e}));$x.displayName=Bz.displayName;const Lx=v.forwardRef(({className:t,...e},n)=>a.jsx(Uz,{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));Lx.displayName=Uz.displayName;const Fx=v.forwardRef(({className:t,...e},n)=>a.jsx(Lz,{ref:n,className:Ne(JT(),t),...e}));Fx.displayName=Lz.displayName;const Bx=v.forwardRef(({className:t,...e},n)=>a.jsx(Fz,{ref:n,className:Ne(JT({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));Bx.displayName=Fz.displayName;const Ql=Sz,Bue=Cz,zz=v.forwardRef(({className:t,...e},n)=>a.jsx(MN,{ref:n,className:Ne("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));zz.displayName=MN.displayName;const $c=v.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Bue,{children:[a.jsx(zz,{}),a.jsxs(DN,{ref:r,className:Ne("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,a.jsxs(FN,{className:"absolute right-4 top-4 z-[100] rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(Jo,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));$c.displayName=DN.displayName;const Lc=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Lc.displayName="DialogHeader";const Fc=({className:t,...e})=>a.jsx("div",{className:Ne("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Fc.displayName="DialogFooter";const Bc=v.forwardRef(({className:t,...e},n)=>a.jsx($N,{ref:n,className:Ne("text-lg font-semibold leading-none tracking-tight",t),...e}));Bc.displayName=$N.displayName;const Xl=v.forwardRef(({className:t,...e},n)=>a.jsx(LN,{ref:n,className:Ne("text-sm text-muted-foreground",t),...e}));Xl.displayName=LN.displayName;var BN="Radio",[Uue,Gz]=Li(BN),[Hue,zue]=Uue(BN),Vz=v.forwardRef((t,e)=>{const{__scopeRadio:n,name:r,checked:i=!1,required:o,disabled:s,value:c="on",onCheck:l,form:u,...d}=t,[f,h]=v.useState(null),p=Pt(e,y=>h(y)),g=v.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(Hue,{scope:n,checked:i,disabled:s,children:[a.jsx(it.button,{type:"button",role:"radio","aria-checked":i,"data-state":qz(i),"data-disabled":s?"":void 0,disabled:s,value:c,...d,ref:p,onClick:Te(t.onClick,y=>{i||l==null||l(),m&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})}),m&&a.jsx(Gue,{control:f,bubbles:!g.current,name:r,value:c,checked:i,required:o,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})});Vz.displayName=BN;var Kz="RadioIndicator",Wz=v.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...i}=t,o=zue(Kz,n);return a.jsx(Wr,{present:r||o.checked,children:a.jsx(it.span,{"data-state":qz(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})})});Wz.displayName=Kz;var Gue=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=v.useRef(null),s=wg(n),c=pg(e);return v.useEffect(()=>{const l=o.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(s!==n&&f){const h=new Event("click",{bubbles:r});f.call(l,n),l.dispatchEvent(h)}},[s,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:o,style:{...t.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function qz(t){return t?"checked":"unchecked"}var Vue=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],UN="RadioGroup",[Kue,gFe]=Li(UN,[qf,Gz]),Yz=qf(),Qz=Gz(),[Wue,que]=Kue(UN),Xz=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:r,defaultValue:i,value:o,required:s=!1,disabled:c=!1,orientation:l,dir:u,loop:d=!0,onValueChange:f,...h}=t,p=Yz(n),g=Nu(u),[m,y]=as({prop:o,defaultProp:i,onChange:f});return a.jsx(Wue,{scope:n,name:r,required:s,disabled:c,value:m,onValueChange:y,children:a.jsx(xN,{asChild:!0,...p,orientation:l,dir:g,loop:d,children:a.jsx(it.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:g,...h,ref:e})})})});Xz.displayName=UN;var Jz="RadioGroupItem",Zz=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...i}=t,o=que(Jz,n),s=o.disabled||r,c=Yz(n),l=Qz(n),u=v.useRef(null),d=Pt(e,u),f=o.value===i.value,h=v.useRef(!1);return v.useEffect(()=>{const p=m=>{Vue.includes(m.key)&&(h.current=!0)},g=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",g)}},[]),a.jsx(bN,{asChild:!0,...c,focusable:!s,active:f,children:a.jsx(Vz,{disabled:s,required:o.required,checked:f,...l,...i,name:o.name,ref:d,onCheck:()=>o.onValueChange(i.value),onKeyDown:Te(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Te(i.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});Zz.displayName=Jz;var Yue="RadioGroupIndicator",eG=v.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,i=Qz(n);return a.jsx(Wz,{...i,...r,ref:e})});eG.displayName=Yue;var tG=Xz,nG=Zz,Que=eG;const IA=v.forwardRef(({className:t,...e},n)=>a.jsx(tG,{className:Ne("grid gap-2",t),...e,ref:n}));IA.displayName=tG.displayName;const Qh=v.forwardRef(({className:t,...e},n)=>a.jsx(nG,{ref:n,className:Ne("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:a.jsx(Que,{className:"flex items-center justify-center",children:a.jsx(RE,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Qh.displayName=nG.displayName;var HN="Checkbox",[Xue,vFe]=Li(HN),[Jue,Zue]=Xue(HN),rG=v.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=t,[h,p]=v.useState(null),g=Pt(e,S=>p(S)),m=v.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=as({prop:i,defaultProp:o,onChange:u}),w=v.useRef(b);return v.useEffect(()=>{const S=h==null?void 0:h.form;if(S){const C=()=>x(w.current);return S.addEventListener("reset",C),()=>S.removeEventListener("reset",C)}},[h,x]),a.jsxs(Jue,{scope:n,state:b,disabled:c,children:[a.jsx(it.button,{type:"button",role:"checkbox","aria-checked":Uc(b)?"mixed":b,"aria-required":s,"data-state":sG(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:g,onKeyDown:Te(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Te(t.onClick,S=>{x(C=>Uc(C)?!0:!C),y&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),y&&a.jsx(ede,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Uc(o)?!1:o})]})});rG.displayName=HN;var iG="CheckboxIndicator",oG=v.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,o=Zue(iG,n);return a.jsx(Wr,{present:r||Uc(o.state)||o.state===!0,children:a.jsx(it.span,{"data-state":sG(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});oG.displayName=iG;var ede=t=>{const{control:e,checked:n,bubbles:r=!0,defaultChecked:i,...o}=t,s=v.useRef(null),c=wg(n),l=pg(e);v.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=Uc(n),p.call(d,Uc(n)?!1:n),d.dispatchEvent(g)}},[c,n,r]);const u=v.useRef(Uc(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...t.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Uc(t){return t==="indeterminate"}function sG(t){return Uc(t)?"indeterminate":t?"checked":"unchecked"}var aG=rG,tde=oG;const Dl=v.forwardRef(({className:t,...e},n)=>a.jsx(aG,{ref:n,className:Ne("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:a.jsx(tde,{className:Ne("flex items-center justify-center text-current"),children:a.jsx(Gs,{className:"h-4 w-4"})})}));Dl.displayName=aG.displayName;const zN=({isActive:t,isComplete:e,hasError:n,label:r,onComplete:i,className:o})=>{const[s,c]=v.useState(0),[l,u]=v.useState("progressing"),[d,f]=v.useState(!1),h=v.useRef(null),p=v.useRef(null),g=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{g(),c(0),u("progressing"),f(!1)},y=S=>{g(),u("completing");const C=100-S,_=50,A=500/_,j=C/A;let P=0;h.current=setInterval(()=>{P++;const k=S+j*P;k>=100||P>=A?(c(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),i==null||i()},300)},2e3)):c(k)},_)},b=()=>{l==="progressing"&&y(s)},x=()=>{l==="waiting"&&y(90)},w=()=>{g()};return v.useEffect(()=>{if(t&&!d){f(!0),c(0),u("progressing");const S=90/540;let C=0;h.current=setInterval(()=>{C+=S,C>=90?(c(90),u("waiting"),g()):c(C)},100)}return e&&l==="progressing"&&b(),e&&l==="waiting"&&x(),n&&(l==="progressing"||l==="waiting")&&w(),!t&&d&&m(),()=>{t||g()}},[t,e,n,l,d]),v.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:Ne("w-full space-y-2",o),children:[r&&a.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[a.jsx("span",{children:l==="waiting"?`${r} - finalizing...`:r}),a.jsxs("span",{children:[Math.round(s),"%"]})]}),a.jsx(Rl,{value:s,className:Ne("w-full transition-all duration-200",n&&"opacity-75",l==="completed"&&"bg-green-100")}),n&&a.jsx("div",{className:"text-sm text-red-600",children:"Generation failed. Please try again."}),l==="completed"&&!n&&a.jsx("div",{className:"text-sm text-green-600",children:"Generation completed successfully!"})]}):null},tr="all",nde=()=>{var Xt,wn,oo,ta;const t=v.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),e=ar(),[n]=FJ(),{loadPersonas:r}=E6(),[i,o]=v.useState("view"),[s,c]=v.useState("ai"),[l,u]=v.useState("");v.useState(null);const[d,f]=v.useState(tr),[h,p]=v.useState(!1),[g,m]=v.useState("");v.useEffect(()=>{const q=n.get("mode");(q==="view"||q==="create")&&o(q)},[n]);const[y,b]=v.useState([]),[x,w]=v.useState([]),[S,C]=v.useState(!0);v.useState(null);const[_,A]=v.useState(new Set),[j,P]=v.useState(!1),[k,O]=v.useState(null),[E,I]=v.useState(""),[D,z]=v.useState(!1),[$,G]=v.useState(null),[R,L]=v.useState(!1),[W,Y]=v.useState(null),[te,me]=v.useState(!1),[F,se]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[ne,ae]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[De,de]=v.useState(!1),[ye,Ee]=v.useState(!1),[Z,ct]=v.useState(!1),[Le,At]=v.useState(!1),[lt,Jt]=v.useState("gemini-2.5-pro"),T=()=>{de(!1),Ee(!1),ct(!1)},M=q=>{const Pe={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return q.forEach(We=>{if(We.age&&Pe.age.add(We.age),We.gender&&Pe.gender.add(We.gender),We.occupation&&Pe.occupation.add(We.occupation),We.location&&Pe.location.add(We.location),We.techSavviness!==void 0){const yt=We.techSavviness<30?"Low (0-30)":We.techSavviness<70?"Medium (31-70)":"High (71-100)";Pe.techSavviness.add(yt)}We.ethnicity&&Pe.ethnicity.add(We.ethnicity)}),{age:Array.from(Pe.age).sort(),gender:Array.from(Pe.gender).sort(),occupation:Array.from(Pe.occupation).sort(),location:Array.from(Pe.location).sort(),techSavviness:Array.from(Pe.techSavviness).sort((We,yt)=>{const et=["Low (0-30)","Medium (31-70)","High (71-100)"];return et.indexOf(We)-et.indexOf(yt)}),ethnicity:Array.from(Pe.ethnicity).sort()}},U=()=>{me(!1),setTimeout(()=>{se({...ne})},0)},V=()=>{ae({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]})},Q=(q,Pe)=>{ae(We=>{const yt={...We};return yt[q].includes(Pe)?yt[q]=yt[q].filter(et=>et!==Pe):yt[q]=[...yt[q],Pe],yt})},B=async()=>{try{const We=(await js.getAll()).data.map(yt=>({...yt,id:yt._id}));return w(We),We}catch(q){return console.error("Error fetching folders:",q),qe.error("Failed to load folders"),w([]),[]}},X=async()=>{C(!0);try{const We=(await zr.getAll()).data;{const et=[...We.map(bt=>({...bt,id:bt.id||bt._id}))];try{(async()=>{const hn=await r();console.log("Loaded stored personas (for debugging only):",hn?hn.length:0)})()}catch(bt){console.warn("Error loading stored personas:",bt)}b(et)}}catch(Pe){console.error("Error fetching personas:",Pe),qe.error("Failed to load personas"),b([])}finally{C(!1)}};v.useEffect(()=>((async()=>{try{const[,]=await Promise.all([B(),X()])}catch(Pe){console.error("Error loading data:",Pe)}})(),()=>{}),[t]),v.useEffect(()=>{var q;if(i==="view")X();else if(i==="create"&&(console.log(`Switching to create mode with folder: ${d}, ${d!==tr?"NOT default":"IS default"}`),d!==tr)){const Pe=(q=x.find(We=>We.id===d))==null?void 0:q.name;console.log(`Selected folder for creation: ${d} (${Pe})`)}},[i]),v.useEffect(()=>{X();const q=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),X())},Pe=()=>{console.log("Synthetic users navigation event detected, refreshing data"),X()};console.log("Setting up MutationObserver for body style");const We=new MutationObserver(yt=>{yt.forEach(et=>{et.type==="attributes"&&et.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),t())})});return We.observe(document.body,{attributes:!0,attributeFilter:["style"]}),t(),window.addEventListener("popstate",q),window.addEventListener("syntheticUsersNavigation",Pe),()=>{window.removeEventListener("popstate",q),window.removeEventListener("syntheticUsersNavigation",Pe),console.log("Disconnecting MutationObserver"),We.disconnect()}},[]);const ge=async()=>{if(!g.trim()){qe.error("Please enter a folder name");return}try{const q=await js.create({name:g.trim(),persona_ids:[]});await B(),m(""),p(!1),qe.success(`Folder "${g}" created`)}catch(q){console.error("Error creating folder:",q),qe.error("Failed to create folder")}},xe=()=>{m(""),p(!1)},Re=q=>{O(q),I(q.name)},be=async()=>{if(!k||!E.trim()){O(null);return}try{await js.update(k._id,{name:E.trim()}),await B(),O(null),qe.success(`Folder renamed to "${E}"`)}catch(q){console.error("Error renaming folder:",q),qe.error("Failed to rename folder"),O(null)}},Ve=()=>{O(null),I("")},st=q=>{G(q),z(!0)},kt=async()=>{if($)try{await js.delete($._id),await B(),(d===$._id||d===$.id)&&f(tr),z(!1),G(null),qe.success(`Folder "${$.name}" deleted`)}catch(q){console.error("Error deleting folder:",q),qe.error("Failed to delete folder")}},Ke=async(q,Pe)=>{var hn;const We=q||_,yt=Pe||W;if(!yt||We.size===0)return;const et=Array.from(We),bt=et.map(ut=>{const An=y.find(an=>an.id===ut);return(An==null?void 0:An._id)||(An==null?void 0:An.id)||ut}).filter(Boolean);try{const ut=[],An=[];if(yt!==tr)try{await js.addPersonasBatch(yt,bt),ut.push(...et)}catch(rn){console.error("Error adding personas to folder:",rn),An.push(...et)}else ut.push(...et);await Promise.all([B(),X()]);const an=yt===tr?"All Personas":((hn=x.find(rn=>rn._id===yt||rn.id===yt))==null?void 0:hn.name)||"folder";return ut.length>0&&qe.success(`Added ${ut.length} persona${ut.length!==1?"s":""} to ${an}`),An.length>0&&qe.error(`Failed to add ${An.length} persona${An.length!==1?"s":""} to ${an}.`),q||A(new Set),{success:ut.length>0,successCount:ut.length,failureCount:An.length}}catch(ut){return console.error("Error moving personas to folder:",ut),qe.error("An unexpected error occurred while adding personas to folder."),{success:!1,error:ut}}},tt=async()=>{var We,yt,et;if(_.size===0||d===tr)return;const q=Array.from(_),Pe=q.map(bt=>{const hn=y.find(ut=>ut.id===bt);return(hn==null?void 0:hn._id)||(hn==null?void 0:hn.id)||bt}).filter(Boolean);console.log("Removing personas from folder:",{selectedFolder:d,selectedIds:q,mongoIds:Pe,folderName:(We=x.find(bt=>bt._id===d))==null?void 0:We.name});try{await js.removePersonasBatch(d,Pe),await Promise.all([B(),X()]);const bt=((yt=x.find(hn=>hn._id===d))==null?void 0:yt.name)||"folder";qe.success(`Removed ${q.length} persona${q.length!==1?"s":""} from ${bt}`),A(new Set)}catch(bt){console.error("Error removing personas from folder:",bt),console.error("Error details:",((et=bt.response)==null?void 0:et.data)||bt.message),qe.error("Failed to remove personas from folder")}},Nt=q=>{A(Pe=>{const We=new Set(Pe);return We.has(q)?We.delete(q):We.add(q),We})},sn=()=>{_.size===fn.length?A(new Set):A(new Set(fn.map(q=>q.id)))},Nr=async()=>{if(_.size===0)return;const q=Array.from(_);A(new Set),P(!1),C(!0);const Pe=[],We=[];for(const yt of q)try{const et=y.find(hn=>hn.id===yt);if(!et){console.error(`Could not find persona with id: ${yt}`),We.push(yt);continue}let bt=yt;et._id&&(bt=et._id.toString()),console.log(`Attempting to delete persona: ${bt}`),await zr.delete(bt),Pe.push(yt)}catch(et){console.error(`Failed to delete persona ${yt}:`,et),We.push(yt)}b(yt=>yt.filter(et=>!Pe.includes(et.id))),await B(),C(!1),setTimeout(()=>{Pe.length>0&&qe.success(`Successfully deleted ${Pe.length} persona${Pe.length!==1?"s":""}`),We.length>0&&qe.error(`Failed to delete ${We.length} persona${We.length!==1?"s":""}`),(Pe.length>0||We.length>0)&&X()},50)},fn=y.filter(q=>{const Pe=q.name.toLowerCase().includes(l.toLowerCase())||q.occupation.toLowerCase().includes(l.toLowerCase())||q.location.toLowerCase().includes(l.toLowerCase()),We=(F.age.length===0||F.age.includes(q.age))&&(F.gender.length===0||F.gender.includes(q.gender))&&(F.occupation.length===0||F.occupation.includes(q.occupation))&&(F.location.length===0||F.location.includes(q.location))&&(F.ethnicity.length===0||q.ethnicity&&F.ethnicity.includes(q.ethnicity))&&(F.techSavviness.length===0||q.techSavviness!==void 0&&F.techSavviness.includes(q.techSavviness<30?"Low (0-30)":q.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&(F.folderStatus.length===0||F.folderStatus.includes("hasFolder")&&F.folderStatus.includes("noFolder")||F.folderStatus.includes("hasFolder")&&!F.folderStatus.includes("noFolder")&&q.folderId&&q.folderId!==tr||F.folderStatus.includes("noFolder")&&!F.folderStatus.includes("hasFolder")&&(!q.folderId||q.folderId===tr));return d===tr||q.folder_ids&&Array.isArray(q.folder_ids)&&q.folder_ids.includes(d)||q.folder_id===d||q.folderId===d?Pe&&We:!1}),St=(q,Pe)=>{const We=new Date().toISOString().split("T")[0],yt=q.length;let et=`# Persona Summary Report `;return et+=`**Folder:** ${Pe} `,et+=`**Date:** ${We} `,et+=`**Total Personas:** ${yt} `,yt===0?(et+=`No personas found in this folder. -`,et):(q.forEach((bt,fn)=>{et+=`## ${bt.name} +`,et):(q.forEach((bt,hn)=>{et+=`## ${bt.name} `,et+=`### Demographics `,et+=`- **Age:** ${bt.age} @@ -570,9 +570,9 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert- `),bt.topPersonalityTraits&&bt.topPersonalityTraits.length>0&&(et+=`### Top Personality Traits `,bt.topPersonalityTraits.forEach(ut=>{et+=`- 🧠 ${ut} `}),et+=` -`),fn{if(dn.length===0){Ye.error("No personas to download");return}At(!0)},ot=async()=>{var We,yt,et,bt,fn;const q=d===tr?"All Personas":((We=x.find(ut=>ut.id===d))==null?void 0:We.name)||"Unknown Folder",Pe=dn.map(ut=>ut._id||ut.id);console.log(`🤖 Frontend: User selected ${lt} for persona summary download`),At(!1),de(!0),Ee(!1),ct(!1),C(!0);try{Ye.info("Generating persona summaries...",{description:`Processing ${dn.length} persona${dn.length!==1?"s":""} with AI`});const ut=await ua.batchGenerateSummaries(Pe,.7,lt),{summaries:An,summary_stats:an,errors:nn}=ut.data,gr=new Date().toISOString().split("T")[0],H=`persona-summary-${q.toLowerCase().replace(/\s+/g,"-")}-${gr}.md`;let he=`# Persona Summary Report +`)}),et)},Ze=async()=>{if(fn.length===0){qe.error("No personas to download");return}At(!0)},ot=async()=>{var We,yt,et,bt,hn;const q=d===tr?"All Personas":((We=x.find(ut=>ut.id===d))==null?void 0:We.name)||"Unknown Folder",Pe=fn.map(ut=>ut._id||ut.id);console.log(`🤖 Frontend: User selected ${lt} for persona summary download`),At(!1),de(!0),Ee(!1),ct(!1),C(!0);try{qe.info("Generating persona summaries...",{description:`Processing ${fn.length} persona${fn.length!==1?"s":""} with AI`});const ut=await ua.batchGenerateSummaries(Pe,.7,lt),{summaries:An,summary_stats:an,errors:rn}=ut.data,gr=new Date().toISOString().split("T")[0],H=`persona-summary-${q.toLowerCase().replace(/\s+/g,"-")}-${gr}.md`;let he=`# Persona Summary Report `;he+=`**Folder:** ${q} `,he+=`**Date:** ${gr} @@ -589,19 +589,19 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert- `,er0||((et=nn.missing_personas)==null?void 0:et.length)>0)&&(he+=` +`)}),rn&&(((yt=rn.failed_summaries)==null?void 0:yt.length)>0||((et=rn.missing_personas)==null?void 0:et.length)>0)&&(he+=` --- ## Processing Errors -`,((bt=nn.failed_summaries)==null?void 0:bt.length)>0&&(he+=`### Failed to Generate Summaries -`,nn.failed_summaries.forEach(zt=>{he+=`- **${zt.persona_name}** (ID: ${zt.persona_id}): ${zt.error} +`,((bt=rn.failed_summaries)==null?void 0:bt.length)>0&&(he+=`### Failed to Generate Summaries +`,rn.failed_summaries.forEach(zt=>{he+=`- **${zt.persona_name}** (ID: ${zt.persona_id}): ${zt.error} `}),he+=` -`),((fn=nn.missing_personas)==null?void 0:fn.length)>0&&(he+=`### Missing Personas -`,nn.missing_personas.forEach(zt=>{he+=`- ID: ${zt} -`})));const ue=document.createElement("a"),je=new Blob([he],{type:"text/markdown"});ue.href=URL.createObjectURL(je),ue.download=H,document.body.appendChild(ue),ue.click(),document.body.removeChild(ue),Ee(!0);const Be=lt==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";an.total_successful===an.total_requested?Ye.success("Persona summary downloaded",{description:`Successfully processed all ${an.total_successful} persona${an.total_successful!==1?"s":""} from "${q}" using ${Be}`}):Ye.success("Persona summary downloaded with warnings",{description:`Processed ${an.total_successful} of ${an.total_requested} personas from "${q}" using ${Be}`})}catch(ut){console.error("Error generating persona summaries:",ut),ut.response?(console.error("Error response data:",ut.response.data),console.error("Error response status:",ut.response.status),console.error("Error response headers:",ut.response.headers)):ut.request?console.error("Error request:",ut.request):console.error("Error message:",ut.message),ct(!0),Ye.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const An=new Date().toISOString().split("T")[0],an=`persona-summary-basic-${q.toLowerCase().replace(/\s+/g,"-")}-${An}.md`,nn=wt(dn,q),gr=document.createElement("a"),H=new Blob([nn],{type:"text/markdown"});gr.href=URL.createObjectURL(H),gr.download=an,document.body.appendChild(gr),gr.click(),document.body.removeChild(gr)}catch{Ye.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{C(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Synthetic Personas"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Create and manage AI-generated research participants"})]}),a.jsx("div",{className:"mt-4 sm:mt-0 flex flex-col items-end gap-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[i==="view"&&dn.length>0&&a.jsxs(J,{variant:"outline",onClick:Ze,disabled:De,className:"flex items-center gap-2 hover-transition",children:[a.jsx(lu,{className:"h-4 w-4"}),De?"Generating Summary...":"Download Persona Summary"]}),a.jsx(J,{onClick:()=>o(i==="view"?"create":"view"),className:"hover-transition",children:i==="view"?"Create New Personas":"View All Personas"})]})})]}),i==="view"&&dn.length>0&&De&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:De,isComplete:ye,hasError:Z,label:"Generating comprehensive persona summaries",onComplete:T,className:"max-w-4xl mx-auto"})}),i==="view"?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex flex-col md:flex-row gap-6 mb-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>p(!0),className:"h-7 w-7 p-0",children:a.jsx(f5,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>f(tr),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===tr?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),x.map(q=>a.jsx("div",{className:"flex items-center justify-between group",children:k&&k._id===q._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:E,onChange:Pe=>I(Pe.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Pe=>{Pe.key==="Enter"?be():Pe.key==="Escape"&&Ve()}}),a.jsx(J,{size:"sm",variant:"ghost",onClick:be,className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:Ve,className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>f(q._id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===q._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:q.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:y.filter(Pe=>Pe.folder_ids&&Pe.folder_ids.includes(q._id)).length})]}),a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(U_,{className:"h-4 w-4"})})}),a.jsxs(Ox,{align:"end",children:[a.jsx(oc,{onClick:()=>Re(q),children:"Rename"}),a.jsx(oc,{className:"text-red-600",onClick:()=>st(q),children:"Delete"})]})]})]})},q._id)),h&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:g,onChange:q=>m(q.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"?ge():q.key==="Escape"&&xe()}})]}),a.jsx(J,{size:"sm",variant:"ghost",onClick:ge,className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:xe,className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:l,onChange:q=>u(q.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[_.size>0&&a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsxs(J,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:q=>{q.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",_.size,")"]}),a.jsx(U_,{className:"h-4 w-4"})]})}),a.jsxs(Ox,{align:"end",onCloseAutoFocus:q=>{q.preventDefault()},children:[a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation();const Pe=Array.from(_);e("/focus-groups",{state:{mode:"create",preSelectedParticipants:Pe}})},children:[a.jsx(Vs,{className:"h-4 w-4"}),"Create Focus Group with selected Personas"]}),a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),P(!0)},children:[a.jsx(nr,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),L(!0)},children:[a.jsx(ho,{className:"h-4 w-4"}),"Move to folder"]}),d!==tr&&a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),tt()},children:[a.jsx(Jo,{className:"h-4 w-4"}),"Remove from ",((Xt=x.find(q=>q._id===d))==null?void 0:Xt.name)||"folder"]})]})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",onClick:()=>me(!0),children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(F).some(q=>q.length>0)?` (${Object.values(F).reduce((q,Pe)=>q+Pe.length,0)})`:""]})]})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6 mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:d===tr?"Your Synthetic Persona Library":((bn=x.find(q=>q._id===d))==null?void 0:bn.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",dn.length,")"]})]}),dn.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dl,{id:"select-all",checked:dn.length>0&&_.size===dn.length,onCheckedChange:sn,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),dn.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-2 gap-4",children:dn.map(q=>a.jsx("div",{className:"relative group",children:a.jsx(fN,{user:q,selected:_.has(q.id),onClick:()=>e(`/synthetic-users/${q._id||q.id}`),onSelectionToggle:Pe=>{Pe.stopPropagation(),Nt(q.id)},showAddToFolderButton:!1,folders:x})},q.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas found matching your criteria."})})]}),a.jsx(OA,{open:j,onOpenChange:q=>{P(q||!1)},children:a.jsxs(Rx,{onInteractOutside:q=>{q.preventDefault()},children:[a.jsxs(Mx,{children:[a.jsx($x,{children:"Delete Personas"}),a.jsxs(Lx,{children:["Are you sure you want to delete ",_.size," selected persona",_.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{onClick:()=>{setTimeout(()=>A(new Set),50)},children:"Cancel"}),a.jsx(Fx,{onClick:Nr,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(OA,{open:D,onOpenChange:q=>{z(q||!1)},children:a.jsxs(Rx,{children:[a.jsxs(Mx,{children:[a.jsx($x,{children:"Delete Folder"}),a.jsxs(Lx,{children:['Are you sure you want to delete the folder "',$==null?void 0:$.name,'"?',a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Note:"})," Any personas in this folder will not be deleted - they will still be available under 'All Personas' after folder deletion."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{children:"Cancel"}),a.jsx(Fx,{onClick:kt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(Ql,{open:R,onOpenChange:q=>{L(q||!1)},children:a.jsxs($c,{className:"z-50",children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Move to Folder"}),a.jsxs(Xl,{children:["Choose a folder to move ",_.size," selected persona",_.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(IA,{value:W||"",onValueChange:Y,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:tr,id:"folder-all"}),a.jsxs(mo,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),x.map(q=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:q._id,id:`folder-${q._id}`}),a.jsxs(mo,{htmlFor:`folder-${q._id}`,className:"flex items-center gap-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:q.name})]})]},q._id))]})}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:q=>{q.preventDefault(),q.stopPropagation(),L(!1),Y(null)},children:"Cancel"}),a.jsx(J,{onClick:async q=>{if(q.preventDefault(),q.stopPropagation(),!W)return;const Pe=new Set(_),We=W;if(L(!1),Y(null),We&&Pe.size>0){C(!0);try{await Ke(Pe,We)}finally{C(!1),A(new Set)}}},disabled:!W,children:"Move"})]})]})}),a.jsx(Ql,{open:te,onOpenChange:q=>{q?(me(q),ae({...F})):(_.size>0&&A(new Set),me(!1))},children:a.jsxs($c,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:q=>{q.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Filter Personas"}),a.jsx(Xl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic. Filter options dynamically update to show only relevant values."})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-1 py-4 space-y-6",children:[Object.values(ne).some(q=>q.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(ne).reduce((q,Pe)=>q+Pe.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const q=et=>{const bt={...ne};bt[et]=[];const fn=y.filter(ut=>Object.entries(bt).every(([An,an])=>{if(an.length===0)return!0;const nn=An;if(nn==="techSavviness"&&ut.techSavviness!==void 0){const gr=ut.techSavviness<30?"Low (0-30)":ut.techSavviness<70?"Medium (31-70)":"High (71-100)";return an.includes(gr)}else{if(nn==="age"&&ut.age)return an.includes(ut.age);if(nn==="gender"&&ut.gender)return an.includes(ut.gender);if(nn==="occupation"&&ut.occupation)return an.includes(ut.occupation);if(nn==="location"&&ut.location)return an.includes(ut.location);if(nn==="ethnicity"&&ut.ethnicity)return an.includes(ut.ethnicity)}return!0}));return M(fn)},Pe=Object.values(ne).every(et=>et.length===0),We=M(y),yt=(et,bt,fn,ut=1)=>{const An=ne[bt],an=[...new Set([...fn,...An])].sort();return an.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:et}),a.jsx("div",{className:`grid grid-cols-1 ${ut===2?"sm:grid-cols-2":ut===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:an.map(nn=>{const gr=ne[bt].includes(nn),H=fn.includes(nn);return a.jsxs("div",{className:`flex items-center space-x-2 ${!H&&!gr?"opacity-50":""}`,children:[a.jsx(Dl,{id:`${bt}-${nn}`,checked:gr,onCheckedChange:()=>Q(bt,nn),disabled:!H&&!gr}),a.jsxs(mo,{htmlFor:`${bt}-${nn}`,className:"truncate overflow-hidden",children:[nn,gr&&!H&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},nn)})})]})};return a.jsxs(a.Fragment,{children:[yt("Gender","gender",Pe?We.gender:q("gender").gender,3),yt("Age","age",Pe?We.age:q("age").age,3),yt("Ethnicity","ethnicity",Pe?We.ethnicity:q("ethnicity").ethnicity,2),yt("Location","location",Pe?We.location:q("location").location,2),yt("Occupation","occupation",Pe?We.occupation:q("occupation").occupation,2),yt("Tech Savviness","techSavviness",Pe?We.techSavviness:q("techSavviness").techSavviness,3),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Folder Assignment"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dl,{id:"folderStatus-hasFolder",checked:ne.folderStatus.includes("hasFolder"),onCheckedChange:()=>Q("folderStatus","hasFolder")}),a.jsx(mo,{htmlFor:"folderStatus-hasFolder",className:"truncate overflow-hidden",children:"Has folder assignment"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dl,{id:"folderStatus-noFolder",checked:ne.folderStatus.includes("noFolder"),onCheckedChange:()=>Q("folderStatus","noFolder")}),a.jsx(mo,{htmlFor:"folderStatus-noFolder",className:"truncate overflow-hidden",children:"No folder assignment"})]})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()})]}),a.jsx("div",{className:"sticky bottom-0 bg-background border-t shadow-[0_-2px_4px_rgba(0,0,0,0.05)] pt-4 z-10",children:a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:V,children:"Reset"}),a.jsx(J,{onClick:U,children:"Apply Filters"})]})})]})}),a.jsx(Ql,{open:Le,onOpenChange:At,children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Select AI Model for Summary Generation"}),a.jsx(Xl,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(IA,{value:lt,onValueChange:Jt,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(mo,{htmlFor:"download-gemini",className:"text-sm font-medium",children:"Gemini 2.5 Pro"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(mo,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:()=>At(!1),children:"Cancel"}),a.jsx(J,{onClick:ot,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(dl,{defaultValue:"ai",onValueChange:q=>c(q),children:[a.jsxs(Va,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(mn,{value:"ai",children:"AI Recruiter"}),a.jsx(mn,{value:"manual",children:"Manual Creation"})]}),a.jsxs(gn,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${d!==tr?d:"null"}`),console.log("Current folders:",x.map(q=>({id:q.id,name:q.name}))),a.jsx(hce,{targetFolderId:d!==tr?d:null,targetFolderName:d!==tr?(oo=x.find(q=>q.id===d))==null?void 0:oo.name:null})]}),a.jsx(gn,{value:"manual",children:a.jsx(rle,{targetFolderId:d!==tr?d:null,targetFolderName:d!==tr?(ta=x.find(q=>q.id===d))==null?void 0:ta.name:null})})]})]})]})},cG=v.createContext(void 0),tC="synthetic-society-navigation-state",rde=({children:t})=>{const[e,n]=v.useState(()=>{try{const o=localStorage.getItem(tC);return o?JSON.parse(o):{}}catch{return{}}});v.useEffect(()=>{localStorage.setItem(tC,JSON.stringify(e))},[e]);const r=(o,s)=>{n({...e,previousRoute:o,...s})},i=()=>{n({}),localStorage.removeItem(tC)};return a.jsx(cG.Provider,{value:{navigationState:e,setNavigationState:n,clearNavigationState:i,setPreviousRoute:r},children:t})},ow=()=>{const t=v.useContext(cG);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t},ide=XT("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Sr({className:t,variant:e,...n}){return a.jsx("div",{className:Ne(ide({variant:e}),t),...n})}const GN=N.memo(t=>{const{discussionGuide:e,moderatorStatus:n,onSectionSelect:r,onSetPosition:i,onSave:o,showProgress:s=!0,collapsible:c=!0,defaultExpanded:l=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h,onEditingChange:p}=t,g=typeof e=="string",m=v.useMemo(()=>g?null:e,[e,g]),[y,b]=v.useState(new Set),[x,w]=v.useState(null),[S,C]=v.useState(null),[_,A]=v.useState(!1),[j,P]=v.useState(null),[k,O]=v.useState("");v.useEffect(()=>{p&&p(!!x)},[x,p]),v.useEffect(()=>{if(x&&m){const T=m.sections.find(M=>M.id===x);T&&!S&&C({...T})}},[m,x,S]);const E=T=>{w(T.id),C({...T}),b(M=>new Set(M).add(T.id))},I=()=>{w(null),C(null)},D=v.useCallback(T=>{C(M=>M&&{...M,...T})},[]),z=v.useCallback((T,M,U)=>{C(V=>{if(!V)return V;const Q={...V};if(U==="question"&&Q.questions){if(Q.questions.findIndex(X=>X.id===T)!==-1)return Q.questions=Q.questions.map(X=>X.id===T?{...X,...M}:X),Q}else if(U==="activity"&&Q.activities&&Q.activities.findIndex(X=>X.id===T)!==-1)return Q.activities=Q.activities.map(X=>X.id===T?{...X,...M}:X),Q;return Q.subsections&&(Q.subsections=Q.subsections.map(B=>{const X={...B};return U==="question"&&X.questions?X.questions.findIndex(xe=>xe.id===T)!==-1&&(X.questions=X.questions.map(xe=>xe.id===T?{...xe,...M}:xe)):U==="activity"&&X.activities&&X.activities.findIndex(xe=>xe.id===T)!==-1&&(X.activities=X.activities.map(xe=>xe.id===T?{...xe,...M}:xe)),X})),Q})},[]),$=T=>{if(!S)return;const M={id:`${T}-${Date.now()}`,content:`New ${T}`,type:T==="question"?"open_ended":"discussion",time_limit:void 0},U={...S};T==="question"?U.questions=[...U.questions||[],M]:U.activities=[...U.activities||[],M],C(U)},G=(T,M)=>{if(!S||!S.subsections)return;const U={id:`${M}-${Date.now()}`,content:`New ${M}`,type:M==="question"?"open_ended":"discussion",time_limit:void 0},V=[...S.subsections],Q={...V[T]};M==="question"?Q.questions=[...Q.questions||[],U]:Q.activities=[...Q.activities||[],U],V[T]=Q,C(B=>B&&{...B,subsections:V})},R=()=>{if(!S)return;const T={id:`subsection-${Date.now()}`,title:"New Subsection",questions:[],activities:[]},M=[...S.subsections||[],T];C(U=>U&&{...U,subsections:M})},L=T=>{if(!S||!S.subsections)return;const M=S.subsections.filter((U,V)=>V!==T);C(U=>U&&{...U,subsections:M})},W=(T,M)=>{var V,Q;if(!S)return;const U={...S};M==="question"?U.questions=(V=U.questions)==null?void 0:V.filter(B=>B.id!==T):U.activities=(Q=U.activities)==null?void 0:Q.filter(B=>B.id!==T),C(U)},Y=async()=>{if(!(!S||!m||!o)){A(!0);try{const T={...m,sections:m.sections.map(M=>M.id===x?S:M)};await o(T),I(),re.success("Section updated successfully")}catch(T){console.error("Error saving section:",T),re.error("Failed to save section")}finally{A(!1)}}},te=T=>{b(M=>{const U=new Set(M);return U.has(T)?U.delete(T):U.add(T),U})};v.useEffect(()=>{m&&m.sections.length>0&&b(l?new Set(m.sections.map(T=>T.id)):new Set)},[l,m]);const me=(T,M,U,V)=>{if(!n||n.legacy_format)return null;const Q=n.moderator_position;if(Q.section_index!==T)return Q.section_index>T?"completed":null;if(V!==void 0){if(Q.subsection_index===void 0)return null;if(Q.subsection_index!==V)return Q.subsection_index>V?"completed":null}else if(Q.subsection_index!==void 0)return"completed";return Q.item_type!==U?U==="activity"&&Q.item_type==="question"?"completed":null:Q.item_index===M?"current":Q.item_index>M?"completed":null},F=(T,M)=>T===`New ${M}`,se=v.useCallback((T,M,U)=>{if(M<0||M>=T.length||U<0||U>=T.length)return T;const V=[...T],[Q]=V.splice(M,1);return V.splice(U,0,Q),V},[]),ne=v.useCallback((T,M)=>M>0,[]),ae=v.useCallback((T,M)=>M{if(!S||!S.subsections)return;const M=S.subsections;if(ne(M,T)){const U=se(M,T,T-1);C(V=>V&&{...V,subsections:U})}},[S,ne,se]),de=v.useCallback(T=>{if(!S||!S.subsections)return;const M=S.subsections;if(ae(M,T)){const U=se(M,T,T+1);C(V=>V&&{...V,subsections:U})}},[S,ae,se]),ye=v.useCallback((T,M)=>{P(T),O(M)},[]),Ee=v.useCallback(()=>{P(null),O("")},[]),Z=v.useCallback(()=>{if(!j||!S||!S.subsections)return;const T=S.subsections.map(M=>M.id===j?{...M,title:k.trim()}:M);C(M=>M&&{...M,subsections:T}),Ee()},[j,S,k,Ee]),ct=v.useCallback((T,M,U,V)=>{if(!S)return;const Q=M==="question"?"questions":"activities";if(V!==void 0){const B=S.subsections||[];if(V>=0&&Vbe&&{...be,subsections:Re})}}}else{const B=S[Q]||[];if(ne(B,U)){const X=se(B,U,U-1);C(ge=>ge&&{...ge,[Q]:X})}}},[S,ne,se]),Le=v.useCallback((T,M,U,V)=>{if(!S)return;const Q=M==="question"?"questions":"activities";if(V!==void 0){const B=S.subsections||[];if(V>=0&&Vbe&&{...be,subsections:Re})}}}else{const B=S[Q]||[];if(ae(B,U)){const X=se(B,U,U+1);C(ge=>ge&&{...ge,[Q]:X})}}},[S,ae,se]),At=(T,M,U,V,Q)=>{var kt,Ke,tt,Nt,sn,Nr,dn,wt,Ze;const B=m==null?void 0:m.sections[M],X=x===(B==null?void 0:B.id),ge=me(M,U,V,Q),xe=ge==="current",Re=ge==="completed",Ve=(ot=>{const Xt=ot.match(/['"`]([^'"`]*fg-[^'"`]*\.(jpe?g|png|gif|webp))['"`]/i);return Xt?Xt[1]:null})(T.content),st=F(T.content,V);return X?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[a.jsxs("div",{className:"flex-shrink-0 flex flex-col gap-1",children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>ct(T.id,V,U,Q),disabled:(()=>{if(Q!==void 0){const Xt=((S==null?void 0:S.subsections)||[])[Q],bn=(Xt==null?void 0:Xt[V==="question"?"questions":"activities"])||[];return!ne(bn,U)}else{const ot=(S==null?void 0:S[V==="question"?"questions":"activities"])||[];return!ne(ot,U)}})(),className:"h-6 w-6 p-0",title:"Move item up",children:a.jsx(cu,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>Le(T.id,V,U,Q),disabled:(()=>{if(Q!==void 0){const Xt=((S==null?void 0:S.subsections)||[])[Q],bn=(Xt==null?void 0:Xt[V==="question"?"questions":"activities"])||[];return!ae(bn,U)}else{const ot=(S==null?void 0:S[V==="question"?"questions":"activities"])||[];return!ae(ot,U)}})(),className:"h-6 w-6 p-0",title:"Move item down",children:a.jsx(Ma,{className:"h-3 w-3"})})]}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sr,{variant:"outline",className:"text-xs",children:V==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]})}),T.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(Wp,{className:"h-3 w-3"}),a.jsx(Ht,{type:"number",value:T.time_limit,onChange:ot=>z(T.id,{time_limit:parseInt(ot.target.value)||void 0},V),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(mt,{value:st?"":T.content,onChange:ot=>z(T.id,{content:ot.target.value},V),placeholder:st?T.content:"Enter content...",className:"min-h-[60px]"}),V==="question"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Probe Questions (one per line)"}),a.jsx(mt,{value:((kt=T.probes)==null?void 0:kt.join(` +`),((hn=rn.missing_personas)==null?void 0:hn.length)>0&&(he+=`### Missing Personas +`,rn.missing_personas.forEach(zt=>{he+=`- ID: ${zt} +`})));const ue=document.createElement("a"),je=new Blob([he],{type:"text/markdown"});ue.href=URL.createObjectURL(je),ue.download=H,document.body.appendChild(ue),ue.click(),document.body.removeChild(ue),Ee(!0);const Be=lt==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";an.total_successful===an.total_requested?qe.success("Persona summary downloaded",{description:`Successfully processed all ${an.total_successful} persona${an.total_successful!==1?"s":""} from "${q}" using ${Be}`}):qe.success("Persona summary downloaded with warnings",{description:`Processed ${an.total_successful} of ${an.total_requested} personas from "${q}" using ${Be}`})}catch(ut){console.error("Error generating persona summaries:",ut),ut.response?(console.error("Error response data:",ut.response.data),console.error("Error response status:",ut.response.status),console.error("Error response headers:",ut.response.headers)):ut.request?console.error("Error request:",ut.request):console.error("Error message:",ut.message),ct(!0),qe.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const An=new Date().toISOString().split("T")[0],an=`persona-summary-basic-${q.toLowerCase().replace(/\s+/g,"-")}-${An}.md`,rn=St(fn,q),gr=document.createElement("a"),H=new Blob([rn],{type:"text/markdown"});gr.href=URL.createObjectURL(H),gr.download=an,document.body.appendChild(gr),gr.click(),document.body.removeChild(gr)}catch{qe.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{C(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Synthetic Personas"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Create and manage AI-generated research participants"})]}),a.jsx("div",{className:"mt-4 sm:mt-0 flex flex-col items-end gap-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[i==="view"&&fn.length>0&&a.jsxs(J,{variant:"outline",onClick:Ze,disabled:De,className:"flex items-center gap-2 hover-transition",children:[a.jsx(lu,{className:"h-4 w-4"}),De?"Generating Summary...":"Download Persona Summary"]}),a.jsx(J,{onClick:()=>o(i==="view"?"create":"view"),className:"hover-transition",children:i==="view"?"Create New Personas":"View All Personas"})]})})]}),i==="view"&&fn.length>0&&De&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:De,isComplete:ye,hasError:Z,label:"Generating comprehensive persona summaries",onComplete:T,className:"max-w-4xl mx-auto"})}),i==="view"?a.jsx(a.Fragment,{children:a.jsxs("div",{className:"flex flex-col md:flex-row gap-6 mb-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>p(!0),className:"h-7 w-7 p-0",children:a.jsx(f5,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>f(tr),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===tr?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),x.map(q=>a.jsx("div",{className:"flex items-center justify-between group",children:k&&k._id===q._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:E,onChange:Pe=>I(Pe.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Pe=>{Pe.key==="Enter"?be():Pe.key==="Escape"&&Ve()}}),a.jsx(J,{size:"sm",variant:"ghost",onClick:be,className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:Ve,className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>f(q._id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===q._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:q.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:y.filter(Pe=>Pe.folder_ids&&Pe.folder_ids.includes(q._id)).length})]}),a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(U_,{className:"h-4 w-4"})})}),a.jsxs(Ox,{align:"end",children:[a.jsx(oc,{onClick:()=>Re(q),children:"Rename"}),a.jsx(oc,{className:"text-red-600",onClick:()=>st(q),children:"Delete"})]})]})]})},q._id)),h&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:g,onChange:q=>m(q.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"?ge():q.key==="Escape"&&xe()}})]}),a.jsx(J,{size:"sm",variant:"ghost",onClick:ge,className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:xe,className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:l,onChange:q=>u(q.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[_.size>0&&a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsxs(J,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:q=>{q.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",_.size,")"]}),a.jsx(U_,{className:"h-4 w-4"})]})}),a.jsxs(Ox,{align:"end",onCloseAutoFocus:q=>{q.preventDefault()},children:[a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation();const Pe=Array.from(_);e("/focus-groups",{state:{mode:"create",preSelectedParticipants:Pe}})},children:[a.jsx(Vs,{className:"h-4 w-4"}),"Create Focus Group with selected Personas"]}),a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),P(!0)},children:[a.jsx(nr,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),L(!0)},children:[a.jsx(ho,{className:"h-4 w-4"}),"Move to folder"]}),d!==tr&&a.jsxs(oc,{className:"flex items-center gap-2 cursor-pointer",onClick:q=>{q.preventDefault(),q.stopPropagation(),tt()},children:[a.jsx(Jo,{className:"h-4 w-4"}),"Remove from ",((Xt=x.find(q=>q._id===d))==null?void 0:Xt.name)||"folder"]})]})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",onClick:()=>me(!0),children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(F).some(q=>q.length>0)?` (${Object.values(F).reduce((q,Pe)=>q+Pe.length,0)})`:""]})]})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6 mb-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:d===tr?"Your Synthetic Persona Library":((wn=x.find(q=>q._id===d))==null?void 0:wn.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",fn.length,")"]})]}),fn.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dl,{id:"select-all",checked:fn.length>0&&_.size===fn.length,onCheckedChange:sn,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),fn.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-2 gap-4",children:fn.map(q=>a.jsx("div",{className:"relative group",children:a.jsx(fN,{user:q,selected:_.has(q.id),onClick:()=>e(`/synthetic-users/${q._id||q.id}`),onSelectionToggle:Pe=>{Pe.stopPropagation(),Nt(q.id)},showAddToFolderButton:!1,folders:x})},q.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas found matching your criteria."})})]}),a.jsx(OA,{open:j,onOpenChange:q=>{P(q||!1)},children:a.jsxs(Rx,{onInteractOutside:q=>{q.preventDefault()},children:[a.jsxs(Mx,{children:[a.jsx($x,{children:"Delete Personas"}),a.jsxs(Lx,{children:["Are you sure you want to delete ",_.size," selected persona",_.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{onClick:()=>{setTimeout(()=>A(new Set),50)},children:"Cancel"}),a.jsx(Fx,{onClick:Nr,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(OA,{open:D,onOpenChange:q=>{z(q||!1)},children:a.jsxs(Rx,{children:[a.jsxs(Mx,{children:[a.jsx($x,{children:"Delete Folder"}),a.jsxs(Lx,{children:['Are you sure you want to delete the folder "',$==null?void 0:$.name,'"?',a.jsx("br",{}),a.jsx("br",{}),a.jsx("strong",{children:"Note:"})," Any personas in this folder will not be deleted - they will still be available under 'All Personas' after folder deletion."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{children:"Cancel"}),a.jsx(Fx,{onClick:kt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(Ql,{open:R,onOpenChange:q=>{L(q||!1)},children:a.jsxs($c,{className:"z-50",children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Move to Folder"}),a.jsxs(Xl,{children:["Choose a folder to move ",_.size," selected persona",_.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(IA,{value:W||"",onValueChange:Y,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:tr,id:"folder-all"}),a.jsxs(mo,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),x.map(q=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:q._id,id:`folder-${q._id}`}),a.jsxs(mo,{htmlFor:`folder-${q._id}`,className:"flex items-center gap-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:q.name})]})]},q._id))]})}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:q=>{q.preventDefault(),q.stopPropagation(),L(!1),Y(null)},children:"Cancel"}),a.jsx(J,{onClick:async q=>{if(q.preventDefault(),q.stopPropagation(),!W)return;const Pe=new Set(_),We=W;if(L(!1),Y(null),We&&Pe.size>0){C(!0);try{await Ke(Pe,We)}finally{C(!1),A(new Set)}}},disabled:!W,children:"Move"})]})]})}),a.jsx(Ql,{open:te,onOpenChange:q=>{q?(me(q),ae({...F})):(_.size>0&&A(new Set),me(!1))},children:a.jsxs($c,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:q=>{q.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Filter Personas"}),a.jsx(Xl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic. Filter options dynamically update to show only relevant values."})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-1 py-4 space-y-6",children:[Object.values(ne).some(q=>q.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(ne).reduce((q,Pe)=>q+Pe.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const q=et=>{const bt={...ne};bt[et]=[];const hn=y.filter(ut=>Object.entries(bt).every(([An,an])=>{if(an.length===0)return!0;const rn=An;if(rn==="techSavviness"&&ut.techSavviness!==void 0){const gr=ut.techSavviness<30?"Low (0-30)":ut.techSavviness<70?"Medium (31-70)":"High (71-100)";return an.includes(gr)}else{if(rn==="age"&&ut.age)return an.includes(ut.age);if(rn==="gender"&&ut.gender)return an.includes(ut.gender);if(rn==="occupation"&&ut.occupation)return an.includes(ut.occupation);if(rn==="location"&&ut.location)return an.includes(ut.location);if(rn==="ethnicity"&&ut.ethnicity)return an.includes(ut.ethnicity)}return!0}));return M(hn)},Pe=Object.values(ne).every(et=>et.length===0),We=M(y),yt=(et,bt,hn,ut=1)=>{const An=ne[bt],an=[...new Set([...hn,...An])].sort();return an.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:et}),a.jsx("div",{className:`grid grid-cols-1 ${ut===2?"sm:grid-cols-2":ut===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:an.map(rn=>{const gr=ne[bt].includes(rn),H=hn.includes(rn);return a.jsxs("div",{className:`flex items-center space-x-2 ${!H&&!gr?"opacity-50":""}`,children:[a.jsx(Dl,{id:`${bt}-${rn}`,checked:gr,onCheckedChange:()=>Q(bt,rn),disabled:!H&&!gr}),a.jsxs(mo,{htmlFor:`${bt}-${rn}`,className:"truncate overflow-hidden",children:[rn,gr&&!H&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},rn)})})]})};return a.jsxs(a.Fragment,{children:[yt("Gender","gender",Pe?We.gender:q("gender").gender,3),yt("Age","age",Pe?We.age:q("age").age,3),yt("Ethnicity","ethnicity",Pe?We.ethnicity:q("ethnicity").ethnicity,2),yt("Location","location",Pe?We.location:q("location").location,2),yt("Occupation","occupation",Pe?We.occupation:q("occupation").occupation,2),yt("Tech Savviness","techSavviness",Pe?We.techSavviness:q("techSavviness").techSavviness,3),a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:"Folder Assignment"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dl,{id:"folderStatus-hasFolder",checked:ne.folderStatus.includes("hasFolder"),onCheckedChange:()=>Q("folderStatus","hasFolder")}),a.jsx(mo,{htmlFor:"folderStatus-hasFolder",className:"truncate overflow-hidden",children:"Has folder assignment"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Dl,{id:"folderStatus-noFolder",checked:ne.folderStatus.includes("noFolder"),onCheckedChange:()=>Q("folderStatus","noFolder")}),a.jsx(mo,{htmlFor:"folderStatus-noFolder",className:"truncate overflow-hidden",children:"No folder assignment"})]})]})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()})]}),a.jsx("div",{className:"sticky bottom-0 bg-background border-t shadow-[0_-2px_4px_rgba(0,0,0,0.05)] pt-4 z-10",children:a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:V,children:"Reset"}),a.jsx(J,{onClick:U,children:"Apply Filters"})]})})]})}),a.jsx(Ql,{open:Le,onOpenChange:At,children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Select AI Model for Summary Generation"}),a.jsx(Xl,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(IA,{value:lt,onValueChange:Jt,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(mo,{htmlFor:"download-gemini",className:"text-sm font-medium",children:"Gemini 2.5 Pro"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Qh,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(mo,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:()=>At(!1),children:"Cancel"}),a.jsx(J,{onClick:ot,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(dl,{defaultValue:"ai",onValueChange:q=>c(q),children:[a.jsxs(Va,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(gn,{value:"ai",children:"AI Recruiter"}),a.jsx(gn,{value:"manual",children:"Manual Creation"})]}),a.jsxs(vn,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${d!==tr?d:"null"}`),console.log("Current folders:",x.map(q=>({id:q.id,name:q.name}))),a.jsx(hce,{targetFolderId:d!==tr?d:null,targetFolderName:d!==tr?(oo=x.find(q=>q.id===d))==null?void 0:oo.name:null})]}),a.jsx(vn,{value:"manual",children:a.jsx(rle,{targetFolderId:d!==tr?d:null,targetFolderName:d!==tr?(ta=x.find(q=>q.id===d))==null?void 0:ta.name:null})})]})]})]})},cG=v.createContext(void 0),tC="synthetic-society-navigation-state",rde=({children:t})=>{const[e,n]=v.useState(()=>{try{const o=localStorage.getItem(tC);return o?JSON.parse(o):{}}catch{return{}}});v.useEffect(()=>{localStorage.setItem(tC,JSON.stringify(e))},[e]);const r=(o,s)=>{n({...e,previousRoute:o,...s})},i=()=>{n({}),localStorage.removeItem(tC)};return a.jsx(cG.Provider,{value:{navigationState:e,setNavigationState:n,clearNavigationState:i,setPreviousRoute:r},children:t})},ow=()=>{const t=v.useContext(cG);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t},ide=XT("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Sr({className:t,variant:e,...n}){return a.jsx("div",{className:Ne(ide({variant:e}),t),...n})}const GN=N.memo(t=>{const{discussionGuide:e,moderatorStatus:n,onSectionSelect:r,onSetPosition:i,onSave:o,showProgress:s=!0,collapsible:c=!0,defaultExpanded:l=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h,onEditingChange:p}=t,g=typeof e=="string",m=v.useMemo(()=>g?null:e,[e,g]),[y,b]=v.useState(new Set),[x,w]=v.useState(null),[S,C]=v.useState(null),[_,A]=v.useState(!1),[j,P]=v.useState(null),[k,O]=v.useState("");v.useEffect(()=>{p&&p(!!x)},[x,p]),v.useEffect(()=>{if(x&&m){const T=m.sections.find(M=>M.id===x);T&&!S&&C({...T})}},[m,x,S]);const E=T=>{w(T.id),C({...T}),b(M=>new Set(M).add(T.id))},I=()=>{w(null),C(null)},D=v.useCallback(T=>{C(M=>M&&{...M,...T})},[]),z=v.useCallback((T,M,U)=>{C(V=>{if(!V)return V;const Q={...V};if(U==="question"&&Q.questions){if(Q.questions.findIndex(X=>X.id===T)!==-1)return Q.questions=Q.questions.map(X=>X.id===T?{...X,...M}:X),Q}else if(U==="activity"&&Q.activities&&Q.activities.findIndex(X=>X.id===T)!==-1)return Q.activities=Q.activities.map(X=>X.id===T?{...X,...M}:X),Q;return Q.subsections&&(Q.subsections=Q.subsections.map(B=>{const X={...B};return U==="question"&&X.questions?X.questions.findIndex(xe=>xe.id===T)!==-1&&(X.questions=X.questions.map(xe=>xe.id===T?{...xe,...M}:xe)):U==="activity"&&X.activities&&X.activities.findIndex(xe=>xe.id===T)!==-1&&(X.activities=X.activities.map(xe=>xe.id===T?{...xe,...M}:xe)),X})),Q})},[]),$=T=>{if(!S)return;const M={id:`${T}-${Date.now()}`,content:`New ${T}`,type:T==="question"?"open_ended":"discussion",time_limit:void 0},U={...S};T==="question"?U.questions=[...U.questions||[],M]:U.activities=[...U.activities||[],M],C(U)},G=(T,M)=>{if(!S||!S.subsections)return;const U={id:`${M}-${Date.now()}`,content:`New ${M}`,type:M==="question"?"open_ended":"discussion",time_limit:void 0},V=[...S.subsections],Q={...V[T]};M==="question"?Q.questions=[...Q.questions||[],U]:Q.activities=[...Q.activities||[],U],V[T]=Q,C(B=>B&&{...B,subsections:V})},R=()=>{if(!S)return;const T={id:`subsection-${Date.now()}`,title:"New Subsection",questions:[],activities:[]},M=[...S.subsections||[],T];C(U=>U&&{...U,subsections:M})},L=T=>{if(!S||!S.subsections)return;const M=S.subsections.filter((U,V)=>V!==T);C(U=>U&&{...U,subsections:M})},W=(T,M)=>{var V,Q;if(!S)return;const U={...S};M==="question"?U.questions=(V=U.questions)==null?void 0:V.filter(B=>B.id!==T):U.activities=(Q=U.activities)==null?void 0:Q.filter(B=>B.id!==T),C(U)},Y=async()=>{if(!(!S||!m||!o)){A(!0);try{const T={...m,sections:m.sections.map(M=>M.id===x?S:M)};await o(T),I(),re.success("Section updated successfully")}catch(T){console.error("Error saving section:",T),re.error("Failed to save section")}finally{A(!1)}}},te=T=>{b(M=>{const U=new Set(M);return U.has(T)?U.delete(T):U.add(T),U})};v.useEffect(()=>{m&&m.sections.length>0&&b(l?new Set(m.sections.map(T=>T.id)):new Set)},[l,m]);const me=(T,M,U,V)=>{if(!n||n.legacy_format)return null;const Q=n.moderator_position;if(Q.section_index!==T)return Q.section_index>T?"completed":null;if(V!==void 0){if(Q.subsection_index===void 0)return null;if(Q.subsection_index!==V)return Q.subsection_index>V?"completed":null}else if(Q.subsection_index!==void 0)return"completed";return Q.item_type!==U?U==="activity"&&Q.item_type==="question"?"completed":null:Q.item_index===M?"current":Q.item_index>M?"completed":null},F=(T,M)=>T===`New ${M}`,se=v.useCallback((T,M,U)=>{if(M<0||M>=T.length||U<0||U>=T.length)return T;const V=[...T],[Q]=V.splice(M,1);return V.splice(U,0,Q),V},[]),ne=v.useCallback((T,M)=>M>0,[]),ae=v.useCallback((T,M)=>M{if(!S||!S.subsections)return;const M=S.subsections;if(ne(M,T)){const U=se(M,T,T-1);C(V=>V&&{...V,subsections:U})}},[S,ne,se]),de=v.useCallback(T=>{if(!S||!S.subsections)return;const M=S.subsections;if(ae(M,T)){const U=se(M,T,T+1);C(V=>V&&{...V,subsections:U})}},[S,ae,se]),ye=v.useCallback((T,M)=>{P(T),O(M)},[]),Ee=v.useCallback(()=>{P(null),O("")},[]),Z=v.useCallback(()=>{if(!j||!S||!S.subsections)return;const T=S.subsections.map(M=>M.id===j?{...M,title:k.trim()}:M);C(M=>M&&{...M,subsections:T}),Ee()},[j,S,k,Ee]),ct=v.useCallback((T,M,U,V)=>{if(!S)return;const Q=M==="question"?"questions":"activities";if(V!==void 0){const B=S.subsections||[];if(V>=0&&Vbe&&{...be,subsections:Re})}}}else{const B=S[Q]||[];if(ne(B,U)){const X=se(B,U,U-1);C(ge=>ge&&{...ge,[Q]:X})}}},[S,ne,se]),Le=v.useCallback((T,M,U,V)=>{if(!S)return;const Q=M==="question"?"questions":"activities";if(V!==void 0){const B=S.subsections||[];if(V>=0&&Vbe&&{...be,subsections:Re})}}}else{const B=S[Q]||[];if(ae(B,U)){const X=se(B,U,U+1);C(ge=>ge&&{...ge,[Q]:X})}}},[S,ae,se]),At=(T,M,U,V,Q)=>{var kt,Ke,tt,Nt,sn,Nr,fn,St,Ze;const B=m==null?void 0:m.sections[M],X=x===(B==null?void 0:B.id),ge=me(M,U,V,Q),xe=ge==="current",Re=ge==="completed",Ve=(ot=>{const Xt=ot.match(/['"`]([^'"`]*fg-[^'"`]*\.(jpe?g|png|gif|webp))['"`]/i);return Xt?Xt[1]:null})(T.content),st=F(T.content,V);return X?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[a.jsxs("div",{className:"flex-shrink-0 flex flex-col gap-1",children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>ct(T.id,V,U,Q),disabled:(()=>{if(Q!==void 0){const Xt=((S==null?void 0:S.subsections)||[])[Q],wn=(Xt==null?void 0:Xt[V==="question"?"questions":"activities"])||[];return!ne(wn,U)}else{const ot=(S==null?void 0:S[V==="question"?"questions":"activities"])||[];return!ne(ot,U)}})(),className:"h-6 w-6 p-0",title:"Move item up",children:a.jsx(cu,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>Le(T.id,V,U,Q),disabled:(()=>{if(Q!==void 0){const Xt=((S==null?void 0:S.subsections)||[])[Q],wn=(Xt==null?void 0:Xt[V==="question"?"questions":"activities"])||[];return!ae(wn,U)}else{const ot=(S==null?void 0:S[V==="question"?"questions":"activities"])||[];return!ae(ot,U)}})(),className:"h-6 w-6 p-0",title:"Move item down",children:a.jsx(Ma,{className:"h-3 w-3"})})]}),a.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sr,{variant:"outline",className:"text-xs",children:V==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]})}),T.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(Wp,{className:"h-3 w-3"}),a.jsx(Ht,{type:"number",value:T.time_limit,onChange:ot=>z(T.id,{time_limit:parseInt(ot.target.value)||void 0},V),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(mt,{value:st?"":T.content,onChange:ot=>z(T.id,{content:ot.target.value},V),placeholder:st?T.content:"Enter content...",className:"min-h-[60px]"}),V==="question"&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Probe Questions (one per line)"}),a.jsx(mt,{value:((kt=T.probes)==null?void 0:kt.join(` `))||"",onChange:ot=>{const Xt=ot.target.value.trim()?ot.target.value.split(` -`).filter(bn=>bn.trim()):[];z(T.id,{probes:Xt},V)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]}),(((Ke=T.metadata)==null?void 0:Ke.image_url)||((tt=T.metadata)==null?void 0:tt.image_id)||Ve)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(Nt=T.metadata)!=null&&Nt.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(sn=T.metadata)!=null&&sn.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):Ve&&h?a.jsx("img",{src:Ot.getAssetUrl(h,Ve),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>W(T.id,V),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(nr,{className:"h-3 w-3"})})})]},`edit-item-${T.id}`):a.jsxs("div",{className:Ne("flex items-start gap-3 p-3 rounded-lg border transition-colors",xe&&"bg-blue-50 border-blue-200",Re&&"bg-green-50 border-green-200",!xe&&!Re&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(m.sections[M].id,T.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:Re?a.jsx(IE,{className:"h-4 w-4 text-green-600"}):xe?a.jsx(u5,{className:"h-4 w-4 text-blue-600"}):a.jsx(RE,{className:"h-4 w-4 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx(Sr,{variant:"outline",className:"text-xs whitespace-nowrap",children:V==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]})}),T.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(Wp,{className:"h-3 w-3"}),T.time_limit," min"]}),i&&a.jsxs(J,{size:"sm",variant:"ghost",onClick:ot=>{ot.stopPropagation();const Xt=m.sections[M],bn=V==="activity"?`Activity ${U+1}`:`Question ${U+1}`;i(Xt.id,T.id,T.content,Xt.title,bn,V)},className:"h-6 px-2 ml-auto",children:[a.jsx(Qv,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:T.content}),T.probes&&T.probes.length>0&&a.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-slate-200",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600 mb-1",children:"Probe Questions:"}),a.jsx("ul",{className:"space-y-1",children:T.probes.map((ot,Xt)=>a.jsxs("li",{className:"text-xs text-slate-600",children:["• ",ot]},Xt))})]}),(((Nr=T.metadata)==null?void 0:Nr.image_url)||((dn=T.metadata)==null?void 0:dn.image_id)||Ve)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(wt=T.metadata)!=null&&wt.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Ze=T.metadata)!=null&&Ze.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):Ve&&h?a.jsx("img",{src:Ot.getAssetUrl(h,Ve),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},T.id)},lt=(T,M)=>{var X,ge,xe,Re;const U=y.has(T.id),V=x===T.id,Q=V?S:T,B=(n==null?void 0:n.moderator_position.section_index)===M;return a.jsxs("div",{className:Ne("border rounded-lg overflow-hidden transition-colors",B&&"border-blue-500 shadow-md",!B&&"border-slate-200"),children:[a.jsxs("div",{className:Ne("px-4 py-3 flex items-center justify-between cursor-pointer hover:bg-slate-50 transition-colors",B&&"bg-blue-50"),onClick:()=>!V&&te(T.id),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"transition-transform",style:{transform:U?"rotate(90deg)":"rotate(0deg)"},children:a.jsx(fo,{className:"h-5 w-5 text-slate-500"})}),a.jsx("h3",{className:"font-semibold text-slate-800",children:V?a.jsx(Ht,{value:Q.title,onChange:be=>D({title:be.target.value}),onClick:be=>be.stopPropagation(),className:"font-semibold"}):Q.title}),B&&a.jsx(Sr,{variant:"default",className:"text-xs",children:"Current"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o&&!V&&a.jsx(J,{size:"sm",variant:"ghost",onClick:be=>{be.stopPropagation(),E(T)},className:"h-8 px-2",children:a.jsx(eI,{className:"h-3 w-3"})}),V&&a.jsxs("div",{className:"flex items-center gap-2",onClick:be=>be.stopPropagation(),children:[a.jsxs(J,{size:"sm",variant:"default",onClick:Y,disabled:_,className:"h-8",children:[_?a.jsx(Ds,{className:"h-3 w-3 animate-spin"}):a.jsx(DE,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Save"})]}),a.jsxs(J,{size:"sm",variant:"ghost",onClick:I,disabled:_,className:"h-8",children:[a.jsx(Jo,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Cancel"})]})]})]})]}),U&&a.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 space-y-4",children:[Q.content&&a.jsx("div",{className:"prose prose-sm max-w-none",children:V?a.jsx(mt,{value:Q.content,onChange:be=>D({content:be.target.value}),placeholder:"Section introduction or context...",className:"min-h-[80px] w-full"}):a.jsx("p",{className:"text-slate-700",children:Q.content})}),Q.activities&&Q.activities.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(pa,{className:"h-4 w-4"}),"Activities"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>$("activity"),className:"h-7",children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(X=Q.activities)==null?void 0:X.map((be,Ve)=>At(be,M,Ve,"activity"))})]}):null,Q.questions&&Q.questions.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(As,{className:"h-4 w-4"}),"Questions"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>$("question"),className:"h-7",children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(ge=Q.questions)==null?void 0:ge.map((be,Ve)=>At(be,M,Ve,"question"))})]}):null,V&&a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(Qv,{className:"h-4 w-4"}),"Subsections"]}),a.jsxs(J,{size:"sm",variant:"outline",onClick:R,className:"h-7",children:[a.jsx(Qv,{className:"h-3 w-3 mr-1"}),"Add Subsection"]})]})}),Q.subsections&&Q.subsections.length>0&&a.jsx("div",{className:"space-y-3 ml-4",children:Q.subsections.map((be,Ve)=>{var st,kt;return a.jsxs("div",{className:"border-l-2 border-slate-200 pl-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[V&&a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>De(Ve),disabled:!ne(Q.subsections||[],Ve),className:"h-7 w-7 p-0",title:"Move subsection up",children:a.jsx(cu,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>de(Ve),disabled:!ae(Q.subsections||[],Ve),className:"h-7 w-7 p-0",title:"Move subsection down",children:a.jsx(Ma,{className:"h-4 w-4"})})]}),V&&j===be.id?a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx(Ht,{value:k,onChange:Ke=>O(Ke.target.value),className:"flex-1",onKeyDown:Ke=>{Ke.key==="Enter"?Z():Ke.key==="Escape"&&Ee()},autoFocus:!0}),a.jsx(J,{size:"sm",onClick:Z,children:a.jsx(Gs,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"outline",onClick:Ee,children:a.jsx(Jo,{className:"h-3 w-3"})})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("h5",{className:Ne("font-medium text-slate-700",V&&"cursor-pointer hover:text-blue-600"),onClick:()=>V&&ye(be.id,be.title),children:be.title}),V&&a.jsxs(a.Fragment,{children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>ye(be.id,be.title),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100",children:a.jsx(eI,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>L(Ve),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100 text-red-600 hover:text-red-700",title:"Delete subsection",children:a.jsx(nr,{className:"h-3 w-3"})})]})]})]}),be.questions&&be.questions.length>0||V?a.jsxs("div",{className:"space-y-2 mb-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(As,{className:"h-3 w-3"}),"Questions"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>G(Ve,"question"),className:"h-6",children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(st=be.questions)==null?void 0:st.map((Ke,tt)=>At(Ke,M,tt,"question",Ve))})]}):null,be.activities&&be.activities.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(pa,{className:"h-3 w-3"}),"Activities"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>G(Ve,"activity"),className:"h-6",children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(kt=be.activities)==null?void 0:kt.map((Ke,tt)=>At(Ke,M,tt,"activity",Ve))})]}):null]},be.id)})}),(((xe=T.metadata)==null?void 0:xe.image_url)||((Re=T.metadata)==null?void 0:Re.image_id))&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),T.metadata.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):T.metadata.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},T.id)};if(g)return a.jsxs("div",{className:Ne("space-y-4",u),children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-slate-800",children:"Discussion Guide"}),d&&a.jsxs(J,{size:"sm",variant:"outline",onClick:d,disabled:f,children:[f?a.jsx(Ds,{className:"h-4 w-4 animate-spin mr-2"}):a.jsx(lu,{className:"h-4 w-4 mr-2"}),"Download"]})]}),a.jsx("div",{className:"prose prose-sm max-w-none",children:a.jsx("pre",{className:"whitespace-pre-wrap text-sm text-slate-700 font-sans",children:e})}),n&&a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg border border-blue-200",children:[a.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Current Position"}),a.jsx("p",{className:"text-sm text-blue-800",children:n.current_section}),n.current_item&&a.jsx("p",{className:"text-sm text-blue-700 mt-1",children:n.current_item})]})]})]});if(!m)return a.jsx("div",{className:Ne("bg-slate-50 rounded-lg p-8 text-center",u),children:a.jsx("p",{className:"text-slate-600",children:"No discussion guide available"})});const Jt=a.jsxs("div",{className:"space-y-4",children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Overall Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-500 mt-2",children:[a.jsxs("span",{children:["Section ",n.moderator_position.section_index+1," of ",n.total_sections]}),a.jsxs("span",{children:[Math.round(n.section_progress),"% of current section"]})]})]}),a.jsx("div",{className:"space-y-3",children:m.sections.map((T,M)=>lt(T,M))})]});return c?a.jsxs(_g,{defaultOpen:l,className:u,children:[a.jsx(Ag,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-slate-200 cursor-pointer hover:bg-slate-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(fo,{className:"h-5 w-5 text-slate-500 transition-transform data-[state=open]:rotate-90"}),a.jsx("h2",{className:"text-lg font-semibold text-slate-800",children:m.title||"Discussion Guide"}),a.jsxs(Sr,{variant:"outline",className:"text-xs",children:[m.total_duration," min"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[n&&a.jsxs(Sr,{variant:n.progress===100?"success":"default",className:"text-xs",children:[Math.round(n.progress),"% Complete"]}),d&&a.jsx(J,{size:"sm",variant:"outline",onClick:T=>{T.stopPropagation(),d()},disabled:f,children:f?a.jsx(Ds,{className:"h-4 w-4 animate-spin"}):a.jsx(lu,{className:"h-4 w-4"})})]})]})}),a.jsx(jg,{className:"mt-4",children:Jt})]}):a.jsx("div",{className:u,children:Jt})});GN.displayName="DiscussionGuideViewer";const vl="all",ode=Oe.object({researchBrief:Oe.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Oe.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Oe.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Oe.instanceof(FileList).optional(),duration:Oe.string().min(1,{message:"Duration is required."}),llm_model:Oe.string().optional(),reasoning_effort:Oe.string().optional(),verbosity:Oe.string().optional()});function sde({draftToEdit:t,onDraftSaved:e,preSelectedParticipants:n=[]}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",t);const r=ar();Fi();const{setPreviousRoute:i,navigationState:o,clearNavigationState:s}=ow(),[c,l]=v.useState("setup"),[u,d]=v.useState(!1),[f,h]=v.useState(!1),[p,g]=v.useState(!1),[m,y]=v.useState(null),[b,x]=v.useState(null),[w,S]=v.useState(!1),C=v.useRef(m);C.current=m;const _=v.useRef(!1),A=H=>H&&typeof H=="object"&&H.title&&H.sections,[j,P]=v.useState([]),[k,O]=v.useState([]),[E,I]=v.useState([]),[D,z]=v.useState(!1),[$,G]=v.useState(!1),[R,L]=v.useState([]),[W,Y]=v.useState(vl),[te,me]=v.useState(!1),[F,se]=v.useState(""),[ne,ae]=v.useState(null),[De,de]=v.useState(""),[ye,Ee]=v.useState(""),[Z,ct]=v.useState(!1),[Le,At]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[lt,Jt]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[T,M]=v.useState("idle"),[U,V]=v.useState(null),[Q,B]=v.useState(0),X=v.useRef(null),ge=v.useRef(!1),xe=v.useRef(!1),Re=H=>{i("/focus-groups",{focusGroupId:b,focusGroupTab:"participants",isNewFocusGroup:!t,focusGroupData:{name:Ze.getValues("name"),description:Ze.getValues("description"),selectedParticipants:j,discussionGuide:m}}),r(`/synthetic-users/${H.id}`)},be=H=>{const he={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return H.forEach(ue=>{if(ue.age&&he.age.add(ue.age),ue.gender&&he.gender.add(ue.gender),ue.occupation&&he.occupation.add(ue.occupation),ue.location&&he.location.add(ue.location),ue.techSavviness!==void 0){const je=ue.techSavviness<30?"Low (0-30)":ue.techSavviness<70?"Medium (31-70)":"High (71-100)";he.techSavviness.add(je)}ue.ethnicity&&he.ethnicity.add(ue.ethnicity)}),{age:Array.from(he.age).sort(),gender:Array.from(he.gender).sort(),occupation:Array.from(he.occupation).sort(),location:Array.from(he.location).sort(),techSavviness:Array.from(he.techSavviness).sort((ue,je)=>{const Be=["Low (0-30)","Medium (31-70)","High (71-100)"];return Be.indexOf(ue)-Be.indexOf(je)}),ethnicity:Array.from(he.ethnicity).sort()}},Ve=H=>{const he={...lt};he[H]=[];const ue=E.filter(je=>{let Be=!0;return W!==vl&&(Be=!1,je.folder_ids&&Array.isArray(je.folder_ids)&&(Be=je.folder_ids.includes(W)),!Be&&(je.folder_id===W||je.folderId===W)&&(Be=!0)),Be?Object.entries(he).every(([zt,er])=>{if(er.length===0)return!0;const so=zt;if(so==="techSavviness"&&je.techSavviness!==void 0){const Mu=je.techSavviness<30?"Low (0-30)":je.techSavviness<70?"Medium (31-70)":"High (71-100)";return er.includes(Mu)}else{if(so==="age"&&je.age)return er.includes(je.age);if(so==="gender"&&je.gender)return er.includes(je.gender);if(so==="occupation"&&je.occupation)return er.includes(je.occupation);if(so==="location"&&je.location)return er.includes(je.location);if(so==="ethnicity"&&je.ethnicity)return er.includes(je.ethnicity)}return!0}):!1});return be(ue)},st=()=>{ct(!1),setTimeout(()=>{At({...lt})},0)},kt=()=>{Jt({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},Ke=(H,he)=>{Jt(ue=>{const je={...ue};return je[H].includes(he)?je[H]=je[H].filter(Be=>Be!==he):je[H]=[...je[H],he],je})},tt=async()=>{try{const ue=(await js.getAll()).data.map(je=>({...je,id:je._id}));return L(ue),ue}catch(H){return console.error("Error fetching folders:",H),re.error("Failed to load folders"),L([]),[]}},Nt=async()=>{if(!F.trim()){re.error("Please enter a folder name");return}try{const H=await js.create({name:F.trim()});await tt(),se(""),me(!1),re.success(`Folder "${F}" created`)}catch(H){console.error("Error creating folder:",H),re.error("Failed to create folder")}},sn=()=>{se(""),me(!1)},Nr=H=>{ae(H),de(H.name)},dn=async()=>{if(!ne||!De.trim()){ae(null);return}try{await js.update(ne._id,{name:De.trim()}),await tt(),ae(null),re.success(`Folder renamed to "${De}"`)}catch(H){console.error("Error renaming folder:",H),re.error("Failed to rename folder"),ae(null)}},wt=()=>{ae(null),de("")};v.useEffect(()=>{const H=async()=>{z(!0);try{const ue=await zr.getAll();console.log("Fetched personas for FocusGroupModerator:",ue.data),Array.isArray(ue.data)&&ue.data.length>0?I(ue.data):(console.warn("No personas returned from API or invalid format",ue.data),re.warning("No participants available"))}catch(ue){console.error("Error fetching personas:",ue),re.error("Failed to load participants")}finally{z(!1)}};(async()=>{await Promise.all([tt(),H()])})()},[]),console.log("About to initialize form with useForm hook");const Ze=z0({resolver:G0(ode),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro",reasoning_effort:"medium",verbosity:"medium"}});console.log("Form initialized successfully");const ot=()=>{c!=="setup"||xe.current||(X.current&&clearTimeout(X.current),X.current=setTimeout(async()=>{if(ge.current)return;const H=Ze.getValues(),he={name:H.focusGroupName||"",description:H.researchBrief||"",objective:H.researchBrief||"",topic:H.discussionTopics||"",duration:H.duration?parseInt(H.duration):60,llm_model:H.llm_model||"gemini-2.5-pro",reasoning_effort:H.reasoning_effort||"medium",verbosity:H.verbosity||"medium",participants:j,participants_count:j.length,status:"draft",date:new Date().toISOString(),uploadedAssets:k.map(ue=>ue.name)};if(!(U&&JSON.stringify(he)===JSON.stringify(U))&&!(!he.name&&!he.description&&!he.topic)){ge.current=!0,M("saving");try{let ue=b||(t==null?void 0:t.id)||(t==null?void 0:t._id);if(console.log("Auto-save: draftFocusGroupId =",b),console.log("Auto-save: draftToEdit ID =",(t==null?void 0:t.id)||(t==null?void 0:t._id)),console.log("Auto-save: using focusGroupId =",ue),console.log("Auto-save: llm_model in currentData =",he.llm_model),console.log("Auto-save: duration in currentData =",he.duration),ue)console.log("Auto-save: Updating existing focus group:",ue),await Ot.update(ue,he),console.log("Auto-save: Updated existing draft:",ue);else{console.log("Auto-save: Creating NEW focus group (no existing ID)");const je=await Ot.create(he);ue=je.data.focus_group_id||je.data.id||je.data._id,x(ue),console.log("Auto-save: Created new draft with ID:",ue)}V(he),M("saved"),B(0),setTimeout(()=>{M("idle")},2e3)}catch(ue){if(console.error("Auto-save failed:",ue),M("error"),B(je=>je+1),Q<3){const je=Math.pow(2,Q)*2e3;setTimeout(()=>{ot()},je)}else re.error("Auto-save failed",{description:"Your changes may not be saved. Please check your connection."})}finally{ge.current=!1}}},2e3))},Xt=Ze.watch(),bn=v.useRef(""),oo=v.useRef(""),ta=v.useRef("");v.useEffect(()=>{const H=JSON.stringify(Xt);c==="setup"&&H!==bn.current&&(bn.current=H,ot())},[Xt,c]),v.useEffect(()=>{const H=JSON.stringify(j);c==="setup"&&H!==oo.current&&(oo.current=H,ot())},[j,c]),v.useEffect(()=>{const H=JSON.stringify(k.map(he=>he.name));c==="setup"&&H!==ta.current&&(ta.current=H,ot())},[k,c]),v.useEffect(()=>(c!=="setup"&&X.current&&clearTimeout(X.current),()=>{X.current&&clearTimeout(X.current)}),[c]),v.useEffect(()=>{if(console.log("Draft loading effect - draftToEdit:",t,"draftLoadedRef.current:",_.current),!t){_.current=!1;return}if(t&&!_.current){console.log("Loading draft focus group:",t),xe.current=!0,_.current=!0;const H=t.id||t._id;x(H),console.log("Setting draft ID from draftToEdit:",H),t.name&&Ze.setValue("focusGroupName",t.name),(t.description||t.objective)&&Ze.setValue("researchBrief",t.description||t.objective||""),t.topic&&Ze.setValue("discussionTopics",t.topic),t.duration&&Ze.setValue("duration",t.duration.toString()),t.llm_model&&Ze.setValue("llm_model",t.llm_model),t.reasoning_effort&&Ze.setValue("reasoning_effort",t.reasoning_effort),t.verbosity&&Ze.setValue("verbosity",t.verbosity),t.discussionGuide&&(y(t.discussionGuide),(!o.focusGroupTab||o.previousRoute!=="/focus-groups")&&l("review")),t.participants&&Array.isArray(t.participants)&&P(t.participants);const he={name:t.name||"",description:t.description||t.objective||"",objective:t.description||t.objective||"",topic:t.topic||"",duration:t.duration||60,llm_model:t.llm_model||"gemini-2.5-pro",reasoning_effort:t.reasoning_effort||"medium",verbosity:t.verbosity||"medium",participants:t.participants||[],participants_count:(t.participants||[]).length,status:"draft",date:t.date||new Date().toISOString(),uploadedAssets:[]};V(he),console.log("Set lastSavedData to current draft:",he),re.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}),setTimeout(()=>{xe.current=!1;const ue=JSON.stringify(Ze.getValues());bn.current=ue},1e3)}},[t,Ze]),v.useEffect(()=>{n.length>0&&(console.log("Pre-selected participants received:",n),P(n),l("participants"))},[n]),v.useEffect(()=>{o.focusGroupTab&&o.previousRoute==="/focus-groups"&&setTimeout(()=>{l(o.focusGroupTab),s()},0)},[o.focusGroupTab,t,s]),v.useEffect(()=>{t||setTimeout(()=>{xe.current=!1;const H=JSON.stringify(Ze.getValues());bn.current=H},500)},[t,Ze]);const q=()=>{if(T==="idle")return null;const he={saving:{text:"Saving...",className:"text-blue-600 bg-blue-50"},saved:{text:"All changes saved",className:"text-green-600 bg-green-50"},error:{text:"Save failed - retrying...",className:"text-red-600 bg-red-50"}}[T];return a.jsx("div",{className:`fixed top-16 left-1/2 transform -translate-x-1/2 z-50 px-3 py-1 rounded-md text-sm font-medium border shadow-sm ${he.className}`,children:he.text})},Pe=async(H,he)=>{var ue,je;d(!0),h(!1),g(!1);try{const Be={name:H.focusGroupName,description:H.researchBrief,objective:H.researchBrief,topic:H.discussionTopics,duration:parseInt(H.duration),llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity},zt=he?await Ot.generateDiscussionGuideForGroup(he,Be):await Ot.generateDiscussionGuide(Be);if(zt.data&&zt.data.discussionGuide)return h(!0),zt.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(Be){console.error("Error generating discussion guide:",Be),g(!0);let zt="Unknown error occurred";throw(je=(ue=Be==null?void 0:Be.response)==null?void 0:ue.data)!=null&&je.error?zt=Be.response.data.error:Be!=null&&Be.message&&(zt=Be.message),zt.includes("500")||zt.includes("internal error")||zt.includes("Internal Server Error")?re.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>Pe(H)}}):re.error("Failed to generate discussion guide",{description:zt,action:{label:"Retry",onClick:()=>Pe(H)}}),Be}},We=()=>{d(!1),h(!1),g(!1)};async function yt(H){var he;try{let ue=b;if(!ue){const je={name:H.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity},Be=await Ot.create(je);ue=Be.data.focus_group_id||Be.data.id||Be.data._id,x(ue),console.log("Draft focus group created for asset upload:",Be,"with ID:",ue)}if(H.creativeAssets&&H.creativeAssets.length>0&&ue)try{const je=new FormData;Array.from(H.creativeAssets).forEach(so=>{je.append("assets",so)});const zt=(await Ot.uploadAssets(ue,je,!0)).data;console.log("Assets uploaded successfully:",zt),re.success(`${zt.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const er=Array.from(H.creativeAssets);O(er)}catch(je){console.error("Asset upload failed:",je);const Be=(he=je.response)==null?void 0:he.data;let zt="Asset upload failed",er="Some assets could not be uploaded";(Be==null?void 0:Be.code)==="TEMP_DIR_ERROR"?(zt="Upload temporarily unavailable",er="Server storage issue. Please try again in a moment."):(Be==null?void 0:Be.code)==="UPLOAD_SYSTEM_FAILURE"?(zt="Upload system unavailable",er="Critical server issue. Please contact support."):Be!=null&&Be.can_retry&&(zt="Upload failed - can retry",er=(Be==null?void 0:Be.details)||"Please try uploading again."),re.error(zt,{description:er}),console.log("Continuing without assets due to upload failure")}if(ue)try{const je={name:H.focusGroupName,participants:j,participants_count:j.length,duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity};await Ot.update(ue,je),console.log("Focus group updated with latest form values before guide generation"),console.log(`🔄 Updated focus group ${ue} with model: ${H.llm_model}`)}catch(je){console.error("Failed to update focus group before guide generation:",je)}try{const je=await Pe(H,ue);y(je);try{const Be={name:H.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity,discussionGuide:je};await Ot.update(ue,Be),console.log("Focus group updated with discussion guide"),re.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(Be){console.error("Failed to update focus group with discussion guide:",Be),re.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}l("review"),re.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(je){console.error("Discussion guide generation failed:",je),re.error("Discussion guide generation failed",{description:"Please go back to the setup tab and try generating again. Check your inputs and try a different AI model if the issue persists.",duration:8e3});return}}catch(ue){console.error("Error in focus group creation flow:",ue),re.error("Focus group creation failed",{description:ue.message||"An unexpected error occurred"})}}const et=(()=>{var he;const H=E.filter(ue=>{const je=ue.name.toLowerCase().includes(ye.toLowerCase())||ue.occupation&&ue.occupation.toLowerCase().includes(ye.toLowerCase())||ue.location&&ue.location.toLowerCase().includes(ye.toLowerCase()),Be=(Le.age.length===0||Le.age.includes(ue.age))&&(Le.gender.length===0||Le.gender.includes(ue.gender))&&(Le.occupation.length===0||Le.occupation.includes(ue.occupation))&&(Le.location.length===0||Le.location.includes(ue.location))&&(Le.ethnicity.length===0||ue.ethnicity&&Le.ethnicity.includes(ue.ethnicity))&&(Le.techSavviness.length===0||ue.techSavviness!==void 0&&Le.techSavviness.includes(ue.techSavviness<30?"Low (0-30)":ue.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let zt=!0;return W!==vl&&(zt=!1,ue.folder_ids&&Array.isArray(ue.folder_ids)&&(zt=ue.folder_ids.includes(W)),zt||(ue.folder_id===W||ue.folderId===W)&&(zt=!0)),je&&Be&&zt});if(console.log(`Filtered personas: ${H.length}/${E.length}`),console.log(`Selected folder: ${W===vl?"All Personas":((he=R.find(ue=>ue._id===W||ue.id===W))==null?void 0:he.name)||W}`),W!==vl){const ue=R.find(je=>je._id===W||je.id===W);if(ue){const je=E.filter(Be=>Be.folder_ids&&Array.isArray(Be.folder_ids)?Be.folder_ids.includes(W):Be.folder_id===W||Be.folderId===W);console.log(`Folder details: ${ue.name}, ID: ${ue._id}, Contains: ${je.length} personas`),console.log("Personas in this folder:",je.map(Be=>Be.name))}}return H})(),bt=H=>{console.log("Toggling selection for participant ID:",H),P(he=>{const ue=he.includes(H);console.log("Current selection:",{id:H,isCurrentlySelected:ue,currentSelections:[...he]});const je=ue?he.filter(Be=>Be!==H):[...he,H];return console.log("New selection:",je),je})},fn=async()=>{try{const H=Ze.getValues(),he={name:H.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:m},je=(await Ot.create(he)).data;return console.log("Focus group created successfully:",je),je.focus_group_id}catch(H){throw console.error("Error saving focus group:",H),H}},ut=v.useCallback(async()=>{if(!C.current){re.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}G(!0);try{const{downloadDiscussionGuideAsMarkdown:H}=await zie(async()=>{const{downloadDiscussionGuideAsMarkdown:ue}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:ue}},[]),he=Ze.getValues();H(C.current,he.focusGroupName),re.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(H){console.error("Error downloading discussion guide:",H),re.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{G(!1)}},[Ze]),An=v.useCallback(async H=>{console.log("📝 handleSaveDiscussionGuide called with:",H),w?(C.current=H,console.log("📝 Skipping discussionGuide state update during editing to preserve focus")):(y(H),re.success("Discussion guide updated",{description:"Your changes have been saved."}))},[w]),an=v.useCallback(H=>{console.log("📝 Discussion guide editing state changed:",H),S(H),!H&&C.current&&(console.log("📝 Updating discussionGuide state after editing ended"),y(C.current))},[]),nn=v.useCallback(()=>{},[]),gr=async()=>{if(!Ze.getValues().focusGroupName){re.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!m){re.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(j.length<1){re.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",j);try{re.loading("Creating focus group...");let H;if(b){const he=Ze.getValues(),ue={name:he.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(he.duration),topic:he.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:he.researchBrief,objective:he.researchBrief,discussionGuide:m},je=await Ot.update(b,ue);H=b,console.log("Draft focus group updated to in-progress:",je),e&&e()}else H=await fn();re.dismiss(),re.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),r(`/focus-groups/${H}`)}catch(H){re.dismiss(),H!=null&&H.message,console.error("Failed to start focus group:",H),re.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs(a.Fragment,{children:[a.jsx(q,{}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Vs,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),u&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:u,isComplete:f,hasError:p,label:"Generating discussion guide",onComplete:We})}),a.jsxs(dl,{value:c,onValueChange:l,children:[a.jsxs(Va,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(mn,{value:"setup",children:"Setup"}),a.jsx(mn,{value:"review",children:"Review & Edit"}),a.jsx(mn,{value:"participants",children:"Participants"})]}),a.jsx(gn,{value:"setup",children:a.jsx(K0,{...Ze,children:a.jsxs("form",{onSubmit:Ze.handleSubmit(yt),className:"space-y-6",children:[a.jsx(vt,{control:Ze.control,name:"focusGroupName",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Focus Group Name"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"e.g., Mobile App UX Evaluation",...H})}),a.jsx(Nn,{children:"Give your focus group a descriptive name"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(vt,{control:Ze.control,name:"researchBrief",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Research Brief"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Describe your research objectives...",className:"h-36",...H})}),a.jsx(Nn,{children:"Provide context about what you want to learn"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:Ze.control,name:"discussionTopics",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Discussion Topics"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...H})}),a.jsx(Nn,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"duration",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Duration (minutes)"}),a.jsxs(Bn,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select duration"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"30",children:"30 minutes"}),a.jsx(oe,{value:"45",children:"45 minutes"}),a.jsx(oe,{value:"60",children:"60 minutes"}),a.jsx(oe,{value:"90",children:"90 minutes"}),a.jsx(oe,{value:"120",children:"120 minutes"})]})]}),a.jsx(Nn,{children:"How long should the focus group session last?"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"llm_model",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"AI Model"}),a.jsxs(Bn,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select AI model"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Nn,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(pt,{})]})}),Ze.watch("llm_model")==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsx(vt,{control:Ze.control,name:"reasoning_effort",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Reasoning Effort"}),a.jsxs(Bn,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select reasoning effort"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(oe,{value:"low",children:"Low - Quick thinking"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(oe,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx(Nn,{children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"verbosity",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Response Verbosity"}),a.jsxs(Bn,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx($n,{children:a.jsx(Un,{placeholder:"Select verbosity level"})})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"low",children:"Low - Concise responses"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(oe,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx(Nn,{children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(pt,{})]})})]})]})]}),a.jsx(vt,{control:Ze.control,name:"creativeAssets",render:({field:{value:H,onChange:he,...ue}})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Creative Assets (Optional)"}),a.jsx(ht,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(d5,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload creative assets for testing"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Images, mockups, or product designs"}),a.jsx(Ht,{...ue,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:je=>{he(je.target.files)},className:"hidden",id:"assets-file-input"}),a.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:()=>{var je;return(je=document.getElementById("assets-file-input"))==null?void 0:je.click()},children:[a.jsx(h5,{className:"mr-2 h-4 w-4"}),"Select Files"]}),H&&H.length>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[H.length," file(s) selected"]})]})}),a.jsx(Nn,{children:"Upload visuals that you want feedback on during the session"}),a.jsx(pt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(J,{type:"submit",disabled:u,className:"min-w-32",children:[a.jsx(Vs,{className:"mr-2 h-4 w-4"}),u?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(gn,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"AI-Generated Discussion Guide"}),m&&a.jsx(Sr,{variant:"outline",className:"text-xs",children:A(m)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:m?a.jsx(GN,{discussionGuide:m,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:An,onDownload:ut,onSectionSelect:nn,isDownloading:$,focusGroupId:b,onEditingChange:an}):a.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:p?a.jsxs("div",{children:[a.jsx("p",{className:"mb-2",children:"Discussion guide generation failed."}),a.jsxs("p",{className:"text-sm",children:["Go back to the ",a.jsx("strong",{children:"Setup"})," tab and try generating again. Check your inputs and try a different AI model if the issue persists."]})]}):a.jsx("p",{children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})})]})}),k.length>0&&a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Uploaded Creative Assets"}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:k.map((H,he)=>a.jsxs("div",{className:"border rounded-md p-2",children:[a.jsx("div",{className:"aspect-square bg-slate-100 rounded flex items-center justify-center mb-2",children:H.type.startsWith("image/")?a.jsx("img",{src:URL.createObjectURL(H),alt:`Asset ${he+1}`,className:"max-h-full max-w-full object-contain"}):a.jsx(H_,{className:"h-10 w-10 text-slate-400"})}),a.jsx("p",{className:"text-xs truncate",children:H.name})]},he))})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:()=>l("setup"),children:"Back to Setup"}),a.jsxs(J,{onClick:()=>l("participants"),children:["Select Participants",a.jsx(Dr,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(gn,{value:"participants",children:[a.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),me(!0)},className:"h-7 w-7 p-0",children:a.jsx(f5,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>{console.log("Clicked 'All Personas' folder"),console.log("All personas count:",E.length),Y(vl),setTimeout(()=>{console.log(`Will show all ${E.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${W===vl?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),R.map(H=>a.jsx("div",{className:"flex items-center justify-between group",children:ne&&ne._id===H._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:De,onChange:he=>de(he.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:he=>{he.key==="Enter"?dn():he.key==="Escape"&&wt()}}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${ne==null?void 0:ne.name}" to "${De}"`),dn()},className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${ne==null?void 0:ne.name}"`),wt()},className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${H.name} (ID: ${H._id})`);const he=E.filter(ue=>ue.folder_ids&&Array.isArray(ue.folder_ids)?ue.folder_ids.includes(H._id):ue.folder_id===H._id||ue.folderId===H._id);console.log(`Current persona count in folder: ${he.length}`),console.log("All personas count:",E.length),Y(H._id),setTimeout(()=>{console.log(`Will show ${he.length} personas after filtering`),console.log("Filtered personas:",he.map(ue=>ue.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${W===H._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:H.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:E.filter(he=>he.folder_ids&&Array.isArray(he.folder_ids)?he.folder_ids.includes(H._id):he.folder_id===H._id||he.folderId===H._id).length})]}),a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(U_,{className:"h-4 w-4"})})}),a.jsx(Ox,{align:"end",children:a.jsx(oc,{onClick:()=>{console.log(`Initiating rename for folder: ${H.name} (ID: ${H.id})`),Nr(H)},children:"Rename"})})]})]})},H._id)),te&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:F,onChange:H=>se(H.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:H=>{H.key==="Enter"?Nt():H.key==="Escape"&&sn()}})]}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${F}"`),Nt()},className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),sn()},className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(gt,{className:"mb-4",children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Select Participants"}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dr,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[j.length," of ",et.length," selected"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:ye,onChange:H=>Ee(H.target.value)})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",onClick:()=>ct(!0),children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Le).some(H=>H.length>0)?` (${Object.values(Le).reduce((H,he)=>H+he.length,0)})`:""]})]})]}),D?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Ds,{className:"h-8 w-8 animate-spin text-primary"})}):et.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:et.map(H=>{const he=H._id||H.id;return a.jsx(fN,{user:{id:he,_id:H._id,name:H.name,age:H.age,gender:H.gender,occupation:H.occupation,location:H.location||"Unknown",techSavviness:H.techSavviness||50,personality:H.personality||"No description available",oceanTraits:H.oceanTraits,qualitativeAttributes:H.qualitativeAttributes,topPersonalityTraits:H.topPersonalityTraits,aiSynthesizedBio:H.aiSynthesizedBio},selected:j.includes(he),onSelectionToggle:()=>bt(he),onViewDetails:Re},he)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas available matching your criteria."})})]})})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:()=>l("review"),children:"Back to Review"}),a.jsxs(J,{onClick:gr,disabled:j.length<1||!m,children:[a.jsx(sZ,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(Ql,{open:Z,onOpenChange:H=>{H?(ct(H),Jt({...Le})):ct(!1)},children:a.jsxs($c,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Filter Personas"}),a.jsx(Xl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic."})]}),a.jsxs("div",{className:"py-4 space-y-6",children:[Object.values(lt).some(H=>H.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(lt).reduce((H,he)=>H+he.length,0)," active filters"]})}),(()=>{const H=be(E),he=Object.values(lt).every(je=>je.length===0),ue=(je,Be,zt=1)=>{const er=he?H[Be]:Ve(Be)[Be],so=lt[Be],Mu=[...new Set([...er,...so])].sort();return Mu.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:je}),a.jsx("div",{className:`grid grid-cols-1 ${zt===2?"sm:grid-cols-2":zt===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Mu.map(na=>{const ee=lt[Be].includes(na),ce=er.includes(na);return a.jsxs("div",{className:`flex items-center space-x-2 ${!ce&&!ee?"opacity-50":""}`,children:[a.jsx(Dl,{id:`${Be}-${na}`,checked:ee,onCheckedChange:()=>Ke(Be,na),disabled:!ce&&!ee}),a.jsxs(mo,{htmlFor:`${Be}-${na}`,className:"truncate overflow-hidden",children:[na,ee&&!ce&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},na)})})]})};return a.jsxs(a.Fragment,{children:[ue("Gender","gender",3),ue("Age","age",3),ue("Ethnicity","ethnicity",2),ue("Location","location",2),ue("Occupation","occupation",2),ue("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:kt,children:"Reset"}),a.jsx(J,{onClick:st,children:"Apply Filters"})]})]})})]})]})]})]})}const ade=[{id:"1",name:"Mobile App UX Evaluation",status:"completed",participants:6,date:"2023-06-10T14:00:00Z",duration:60,topic:"user-experience"},{id:"2",name:"Product Feature Feedback",status:"scheduled",participants:8,date:"2023-06-15T10:00:00Z",duration:90,topic:"product-feedback"},{id:"3",name:"Marketing Campaign Testing",status:"in-progress",participants:5,date:"2023-06-12T15:30:00Z",duration:45,topic:"creative-testing"},{id:"4",name:"Website Navigation Study",status:"scheduled",participants:7,date:"2023-06-18T13:00:00Z",duration:60,topic:"user-experience"}],cde={completed:"bg-green-100 text-green-800 border-green-200",scheduled:"bg-blue-100 text-blue-800 border-blue-200","in-progress":"bg-amber-100 text-amber-800 border-amber-200",active:"bg-amber-100 text-amber-800 border-amber-200",paused:"bg-purple-100 text-purple-800 border-purple-200",new:"bg-slate-100 text-slate-800 border-slate-200",ai_mode:"bg-amber-100 text-amber-800 border-amber-200",draft:"bg-gray-100 text-gray-800 border-gray-200"},lde=()=>{console.log("FocusGroups component rendering");const[t,e]=v.useState("view"),[n,r]=v.useState(""),[i,o]=v.useState([]),[s,c]=v.useState(!0),[l,u]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),[g,m]=v.useState(null),y=ar(),b=Fi(),[x,w]=v.useState([]),S=v.useRef(!0),C=async(E=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",E),console.log("isMounted.current:",S.current),E&&!S.current){console.log("Exiting early: component not mounted");return}console.log("Setting loading to true and making API call"),c(!0);try{console.log("Calling focusGroupsApi.getAll()");const I=await Ot.getAll();if(console.log("API response received:",I),!E||S.current){const D=I.data.map(z=>({...z,id:z.id||z._id,participants_count:Array.isArray(z.participants)?z.participants.length:typeof z.participants=="number"?z.participants:0}));o(D)}}catch(I){console.error("Error fetching focus groups:",I),(!E||S.current)&&(Ye.error("Failed to load focus groups"),o(ade))}finally{(!E||S.current)&&c(!1)}},_=async E=>{try{const I=await Ot.getById(E);I&&I.data&&(m(I.data),e("create"))}catch(I){console.error("Error fetching focus group for edit:",I),Ye.error("Failed to load focus group for editing")}};v.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),C(),()=>{console.log("useEffect cleanup - setting isMounted to false"),S.current=!1}),[]),v.useEffect(()=>{console.log("Mode change useEffect running, mode:",t),t==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),C())},[t]),v.useEffect(()=>{const E=b.state;(E==null?void 0:E.mode)==="create"&&(E!=null&&E.preSelectedParticipants)&&(w(E.preSelectedParticipants),e("create"),y(b.pathname,{replace:!0,state:null}))},[b.state,b.pathname,y]),v.useEffect(()=>{const E=new URLSearchParams(b.search),I=E.get("mode"),D=E.get("id"),z=E.get("tab");if(I==="create")e("create"),m(null);else if(I==="edit"&&D){const $=i.find(G=>(G._id||G.id)===D);$?(m($),e("create")):_(D)}if(I||D||z){const $=b.pathname;y($,{replace:!0})}},[b.search,i,y,b.pathname]);const A=i.filter(E=>E.name.toLowerCase().includes(n.toLowerCase())||E.topic.toLowerCase().includes(n.toLowerCase())),j=E=>new Date(E).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),P=E=>new Date(E).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),k=E=>{u(I=>I.includes(E)?I.filter(D=>D!==E):[...I,E])},O=async()=>{if(l.length!==0){p(!0);try{const E=l.map(I=>Ot.delete(I));await Promise.all(E),o(I=>I.filter(D=>!l.includes(D.id||D._id||""))),u([]),Ye.success(`${l.length} focus group${l.length>1?"s":""} deleted successfully`)}catch(E){console.error("Error deleting focus groups:",E),Ye.error("Failed to delete focus groups")}finally{p(!1),f(!1)}}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Focus Groups"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Set up and manage AI-moderated research sessions"})]}),a.jsx("div",{className:"mt-4 sm:mt-0",children:a.jsx(J,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",t);try{t==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),e("create")):(console.log("Switching back to view mode"),e("view"))}catch(E){console.error("Error in Create New Focus Group onClick:",E)}},className:"hover-transition",children:t==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),t==="view"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:E=>r(E.target.value)})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsx("span",{children:"Filter"})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Vs,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Your Focus Groups"})]}),l.length>0&&a.jsxs(J,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(nr,{className:"h-4 w-4"}),"Delete Selected (",l.length,")"]})]}),s?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Ds,{className:"h-8 w-8 animate-spin text-primary"})}):A.length>0?a.jsx("div",{className:"space-y-4",children:A.map(E=>a.jsx("div",{className:"glass-card rounded-xl overflow-hidden hover:shadow-md button-transition",children:a.jsxs("div",{className:"flex flex-col md:flex-row",children:[a.jsxs("div",{className:"flex-1 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Dl,{id:`select-${E.id||E._id}`,checked:l.includes(E.id||E._id||""),onCheckedChange:()=>k(E.id||E._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:E.name}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(zJ,{className:"h-4 w-4 mr-1"}),j(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Wp,{className:"h-4 w-4 mr-1"}),P(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dr,{className:"h-4 w-4 mr-1"}),E.participants_count||(Array.isArray(E.participants)?E.participants.length:0)," participant",E.participants_count>1||Array.isArray(E.participants)&&E.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Wp,{className:"h-4 w-4 mr-1"}),E.duration," min"]})]})]})]}),a.jsxs("div",{className:Ne("px-3 py-1 rounded-full text-xs font-medium border",cde[E.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[E.status==="completed"&&"Completed",E.status==="scheduled"&&"Scheduled",E.status==="in-progress"&&"In Progress",E.status==="active"&&"In Progress",E.status==="ai_mode"&&"In Progress",E.status==="paused"&&"Paused",E.status==="new"&&"Not Started",E.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(E.status)&&E.status]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:[E.topic==="user-experience"&&"User Experience",E.topic==="product-feedback"&&"Product Feedback",E.topic==="creative-testing"&&"Creative Testing",E.topic==="messaging-evaluation"&&"Messaging Evaluation",E.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(E.topic)&&E.topic.charAt(0).toUpperCase()+E.topic.slice(1).replace(/-/g," ")]}),a.jsx("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:"AI Moderated"})]})]}),a.jsx("div",{className:"bg-slate-50 p-6 flex flex-col justify-center items-center md:border-l border-slate-100",children:a.jsx(J,{variant:E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?"default":E.status==="new"||E.status==="draft"?"outline":"default",className:Ne("w-full hover-transition",E.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",E.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(E.status==="draft")m(E),e("create");else{const I=E.id||E._id;console.log("Navigating to focus group:",I),y(`/focus-groups/${I}`)}},children:E.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]})})})]})},E.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No focus groups found matching your search criteria."})})]})]}):a.jsx(sde,{draftToEdit:g,preSelectedParticipants:x,onDraftSaved:()=>{m(null),e("view"),w([]),C()}})]}),a.jsx(OA,{open:d,onOpenChange:f,children:a.jsxs(Rx,{children:[a.jsxs(Mx,{children:[a.jsxs($x,{children:["Delete ",l.length," Focus Group",l.length!==1?"s":"","?"]}),a.jsxs(Lx,{children:["This action cannot be undone. This will permanently delete the selected focus group",l.length!==1?"s":""," and remove all data associated with ",l.length!==1?"them":"it","."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{disabled:h,children:"Cancel"}),a.jsx(Fx,{onClick:E=>{E.preventDefault(),O()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},ude=({participants:t,selectedParticipantIds:e,onToggleParticipantFilter:n})=>{const r=ar(),{id:i}=OE(),{setPreviousRoute:o}=ow(),s=l=>{const u=l.id||l._id;u&&i&&(o(`/focus-groups/${i}`,{focusGroupId:i}),r(`/personas/${u}`))},c=l=>{const u=l.id||l._id;u&&n(u)};return a.jsx("div",{className:"w-full lg:w-64 shrink-0",children:a.jsxs("div",{className:"glass-panel rounded-xl p-4",children:[a.jsxs("h2",{className:"font-sf text-lg font-semibold flex items-center mb-3",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary mr-2"})," Participants"]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center p-2 bg-primary/5 rounded-lg",children:[a.jsx(ya,{className:"h-8 w-8 text-primary mr-3"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-primary",children:"AI Moderator"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Session facilitator"})]})]}),t.map(l=>{const u=l.id||l._id,d=e.includes(u);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${d?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>s(l),title:`View ${l.name}'s profile`,children:a.jsx("img",{src:Cg(l),alt:l.name,className:"h-8 w-8 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("p",{className:"font-medium cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>c(l),title:`Filter to show only ${l.name}'s messages`,children:l.name}),d&&a.jsx(Gs,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:l.occupation})]})]},l.id)})]})]})})};function dde(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var VN="ScrollArea",[lG,yFe]=Li(VN),[fde,Po]=lG(VN),uG=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...s}=t,[c,l]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,g]=v.useState(null),[m,y]=v.useState(null),[b,x]=v.useState(0),[w,S]=v.useState(0),[C,_]=v.useState(!1),[A,j]=v.useState(!1),P=Pt(e,O=>l(O)),k=Nu(i);return a.jsx(fde,{scope:n,type:r,dir:k,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:A,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:S,children:a.jsx(it.div,{dir:k,...s,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});uG.displayName=VN;var dG="ScrollAreaViewport",fG=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,asChild:i,nonce:o,...s}=t,c=Po(dG,n),l=v.useRef(null),u=Pt(e,l,c.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:` +`).filter(wn=>wn.trim()):[];z(T.id,{probes:Xt},V)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]}),(((Ke=T.metadata)==null?void 0:Ke.image_url)||((tt=T.metadata)==null?void 0:tt.image_id)||Ve)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(Nt=T.metadata)!=null&&Nt.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(sn=T.metadata)!=null&&sn.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):Ve&&h?a.jsx("img",{src:Ot.getAssetUrl(h,Ve),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>W(T.id,V),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(nr,{className:"h-3 w-3"})})})]},`edit-item-${T.id}`):a.jsxs("div",{className:Ne("flex items-start gap-3 p-3 rounded-lg border transition-colors",xe&&"bg-blue-50 border-blue-200",Re&&"bg-green-50 border-green-200",!xe&&!Re&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(m.sections[M].id,T.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:Re?a.jsx(IE,{className:"h-4 w-4 text-green-600"}):xe?a.jsx(u5,{className:"h-4 w-4 text-blue-600"}):a.jsx(RE,{className:"h-4 w-4 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx(Sr,{variant:"outline",className:"text-xs whitespace-nowrap",children:V==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),typeof T.type=="string"?T.type.replace("_"," "):String(T.type||"unknown")]})}),T.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(Wp,{className:"h-3 w-3"}),T.time_limit," min"]}),i&&a.jsxs(J,{size:"sm",variant:"ghost",onClick:ot=>{ot.stopPropagation();const Xt=m.sections[M],wn=V==="activity"?`Activity ${U+1}`:`Question ${U+1}`;i(Xt.id,T.id,T.content,Xt.title,wn,V)},className:"h-6 px-2 ml-auto",children:[a.jsx(Qv,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:T.content}),T.probes&&T.probes.length>0&&a.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-slate-200",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600 mb-1",children:"Probe Questions:"}),a.jsx("ul",{className:"space-y-1",children:T.probes.map((ot,Xt)=>a.jsxs("li",{className:"text-xs text-slate-600",children:["• ",ot]},Xt))})]}),(((Nr=T.metadata)==null?void 0:Nr.image_url)||((fn=T.metadata)==null?void 0:fn.image_id)||Ve)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(St=T.metadata)!=null&&St.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Ze=T.metadata)!=null&&Ze.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):Ve&&h?a.jsx("img",{src:Ot.getAssetUrl(h,Ve),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},T.id)},lt=(T,M)=>{var X,ge,xe,Re;const U=y.has(T.id),V=x===T.id,Q=V?S:T,B=(n==null?void 0:n.moderator_position.section_index)===M;return a.jsxs("div",{className:Ne("border rounded-lg overflow-hidden transition-colors",B&&"border-blue-500 shadow-md",!B&&"border-slate-200"),children:[a.jsxs("div",{className:Ne("px-4 py-3 flex items-center justify-between cursor-pointer hover:bg-slate-50 transition-colors",B&&"bg-blue-50"),onClick:()=>!V&&te(T.id),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"transition-transform",style:{transform:U?"rotate(90deg)":"rotate(0deg)"},children:a.jsx(fo,{className:"h-5 w-5 text-slate-500"})}),a.jsx("h3",{className:"font-semibold text-slate-800",children:V?a.jsx(Ht,{value:Q.title,onChange:be=>D({title:be.target.value}),onClick:be=>be.stopPropagation(),className:"font-semibold"}):Q.title}),B&&a.jsx(Sr,{variant:"default",className:"text-xs",children:"Current"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o&&!V&&a.jsx(J,{size:"sm",variant:"ghost",onClick:be=>{be.stopPropagation(),E(T)},className:"h-8 px-2",children:a.jsx(eI,{className:"h-3 w-3"})}),V&&a.jsxs("div",{className:"flex items-center gap-2",onClick:be=>be.stopPropagation(),children:[a.jsxs(J,{size:"sm",variant:"default",onClick:Y,disabled:_,className:"h-8",children:[_?a.jsx(Ds,{className:"h-3 w-3 animate-spin"}):a.jsx(DE,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Save"})]}),a.jsxs(J,{size:"sm",variant:"ghost",onClick:I,disabled:_,className:"h-8",children:[a.jsx(Jo,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Cancel"})]})]})]})]}),U&&a.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 space-y-4",children:[Q.content&&a.jsx("div",{className:"prose prose-sm max-w-none",children:V?a.jsx(mt,{value:Q.content,onChange:be=>D({content:be.target.value}),placeholder:"Section introduction or context...",className:"min-h-[80px] w-full"}):a.jsx("p",{className:"text-slate-700",children:Q.content})}),Q.activities&&Q.activities.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(pa,{className:"h-4 w-4"}),"Activities"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>$("activity"),className:"h-7",children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(X=Q.activities)==null?void 0:X.map((be,Ve)=>At(be,M,Ve,"activity"))})]}):null,Q.questions&&Q.questions.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(As,{className:"h-4 w-4"}),"Questions"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>$("question"),className:"h-7",children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(ge=Q.questions)==null?void 0:ge.map((be,Ve)=>At(be,M,Ve,"question"))})]}):null,V&&a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[a.jsx(Qv,{className:"h-4 w-4"}),"Subsections"]}),a.jsxs(J,{size:"sm",variant:"outline",onClick:R,className:"h-7",children:[a.jsx(Qv,{className:"h-3 w-3 mr-1"}),"Add Subsection"]})]})}),Q.subsections&&Q.subsections.length>0&&a.jsx("div",{className:"space-y-3 ml-4",children:Q.subsections.map((be,Ve)=>{var st,kt;return a.jsxs("div",{className:"border-l-2 border-slate-200 pl-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[V&&a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>De(Ve),disabled:!ne(Q.subsections||[],Ve),className:"h-7 w-7 p-0",title:"Move subsection up",children:a.jsx(cu,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>de(Ve),disabled:!ae(Q.subsections||[],Ve),className:"h-7 w-7 p-0",title:"Move subsection down",children:a.jsx(Ma,{className:"h-4 w-4"})})]}),V&&j===be.id?a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx(Ht,{value:k,onChange:Ke=>O(Ke.target.value),className:"flex-1",onKeyDown:Ke=>{Ke.key==="Enter"?Z():Ke.key==="Escape"&&Ee()},autoFocus:!0}),a.jsx(J,{size:"sm",onClick:Z,children:a.jsx(Gs,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"outline",onClick:Ee,children:a.jsx(Jo,{className:"h-3 w-3"})})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("h5",{className:Ne("font-medium text-slate-700",V&&"cursor-pointer hover:text-blue-600"),onClick:()=>V&&ye(be.id,be.title),children:be.title}),V&&a.jsxs(a.Fragment,{children:[a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>ye(be.id,be.title),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100",children:a.jsx(eI,{className:"h-3 w-3"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>L(Ve),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100 text-red-600 hover:text-red-700",title:"Delete subsection",children:a.jsx(nr,{className:"h-3 w-3"})})]})]})]}),be.questions&&be.questions.length>0||V?a.jsxs("div",{className:"space-y-2 mb-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(As,{className:"h-3 w-3"}),"Questions"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>G(Ve,"question"),className:"h-6",children:[a.jsx(As,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx("div",{className:"space-y-2",children:(st=be.questions)==null?void 0:st.map((Ke,tt)=>At(Ke,M,tt,"question",Ve))})]}):null,be.activities&&be.activities.length>0||V?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[a.jsx(pa,{className:"h-3 w-3"}),"Activities"]}),V&&a.jsxs(J,{size:"sm",variant:"outline",onClick:()=>G(Ve,"activity"),className:"h-6",children:[a.jsx(pa,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx("div",{className:"space-y-2",children:(kt=be.activities)==null?void 0:kt.map((Ke,tt)=>At(Ke,M,tt,"activity",Ve))})]}):null]},be.id)})}),(((xe=T.metadata)==null?void 0:xe.image_url)||((Re=T.metadata)==null?void 0:Re.image_id))&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Yv,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),T.metadata.image_url?a.jsx("img",{src:T.metadata.image_url,alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):T.metadata.image_id&&h?a.jsx("img",{src:Ot.getAssetUrl(h,T.metadata.image_id),alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},T.id)};if(g)return a.jsxs("div",{className:Ne("space-y-4",u),children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})})]}),a.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-xl font-semibold text-slate-800",children:"Discussion Guide"}),d&&a.jsxs(J,{size:"sm",variant:"outline",onClick:d,disabled:f,children:[f?a.jsx(Ds,{className:"h-4 w-4 animate-spin mr-2"}):a.jsx(lu,{className:"h-4 w-4 mr-2"}),"Download"]})]}),a.jsx("div",{className:"prose prose-sm max-w-none",children:a.jsx("pre",{className:"whitespace-pre-wrap text-sm text-slate-700 font-sans",children:e})}),n&&a.jsxs("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg border border-blue-200",children:[a.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Current Position"}),a.jsx("p",{className:"text-sm text-blue-800",children:n.current_section}),n.current_item&&a.jsx("p",{className:"text-sm text-blue-700 mt-1",children:n.current_item})]})]})]});if(!m)return a.jsx("div",{className:Ne("bg-slate-50 rounded-lg p-8 text-center",u),children:a.jsx("p",{className:"text-slate-600",children:"No discussion guide available"})});const Jt=a.jsxs("div",{className:"space-y-4",children:[s&&n&&a.jsxs("div",{className:"mb-4",children:[a.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[a.jsx("span",{children:"Overall Progress"}),a.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-500 mt-2",children:[a.jsxs("span",{children:["Section ",n.moderator_position.section_index+1," of ",n.total_sections]}),a.jsxs("span",{children:[Math.round(n.section_progress),"% of current section"]})]})]}),a.jsx("div",{className:"space-y-3",children:m.sections.map((T,M)=>lt(T,M))})]});return c?a.jsxs(_g,{defaultOpen:l,className:u,children:[a.jsx(Ag,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-4 bg-white rounded-lg border border-slate-200 cursor-pointer hover:bg-slate-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(fo,{className:"h-5 w-5 text-slate-500 transition-transform data-[state=open]:rotate-90"}),a.jsx("h2",{className:"text-lg font-semibold text-slate-800",children:m.title||"Discussion Guide"}),a.jsxs(Sr,{variant:"outline",className:"text-xs",children:[m.total_duration," min"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[n&&a.jsxs(Sr,{variant:n.progress===100?"success":"default",className:"text-xs",children:[Math.round(n.progress),"% Complete"]}),d&&a.jsx(J,{size:"sm",variant:"outline",onClick:T=>{T.stopPropagation(),d()},disabled:f,children:f?a.jsx(Ds,{className:"h-4 w-4 animate-spin"}):a.jsx(lu,{className:"h-4 w-4"})})]})]})}),a.jsx(jg,{className:"mt-4",children:Jt})]}):a.jsx("div",{className:u,children:Jt})});GN.displayName="DiscussionGuideViewer";const vl="all",ode=Oe.object({researchBrief:Oe.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Oe.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Oe.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Oe.instanceof(FileList).optional(),duration:Oe.string().min(1,{message:"Duration is required."}),llm_model:Oe.string().optional(),reasoning_effort:Oe.string().optional(),verbosity:Oe.string().optional()});function sde({draftToEdit:t,onDraftSaved:e,preSelectedParticipants:n=[]}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",t);const r=ar();Fi();const{setPreviousRoute:i,navigationState:o,clearNavigationState:s}=ow(),[c,l]=v.useState("setup"),[u,d]=v.useState(!1),[f,h]=v.useState(!1),[p,g]=v.useState(!1),[m,y]=v.useState(null),[b,x]=v.useState(null),[w,S]=v.useState(!1),C=v.useRef(m);C.current=m;const _=v.useRef(!1),A=H=>H&&typeof H=="object"&&H.title&&H.sections,[j,P]=v.useState([]),[k,O]=v.useState([]),[E,I]=v.useState([]),[D,z]=v.useState(!1),[$,G]=v.useState(!1),[R,L]=v.useState([]),[W,Y]=v.useState(vl),[te,me]=v.useState(!1),[F,se]=v.useState(""),[ne,ae]=v.useState(null),[De,de]=v.useState(""),[ye,Ee]=v.useState(""),[Z,ct]=v.useState(!1),[Le,At]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[lt,Jt]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[T,M]=v.useState("idle"),[U,V]=v.useState(null),[Q,B]=v.useState(0),X=v.useRef(null),ge=v.useRef(!1),xe=v.useRef(!1),Re=H=>{i("/focus-groups",{focusGroupId:b,focusGroupTab:"participants",isNewFocusGroup:!t,focusGroupData:{name:Ze.getValues("name"),description:Ze.getValues("description"),selectedParticipants:j,discussionGuide:m}}),r(`/synthetic-users/${H.id}`)},be=H=>{const he={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return H.forEach(ue=>{if(ue.age&&he.age.add(ue.age),ue.gender&&he.gender.add(ue.gender),ue.occupation&&he.occupation.add(ue.occupation),ue.location&&he.location.add(ue.location),ue.techSavviness!==void 0){const je=ue.techSavviness<30?"Low (0-30)":ue.techSavviness<70?"Medium (31-70)":"High (71-100)";he.techSavviness.add(je)}ue.ethnicity&&he.ethnicity.add(ue.ethnicity)}),{age:Array.from(he.age).sort(),gender:Array.from(he.gender).sort(),occupation:Array.from(he.occupation).sort(),location:Array.from(he.location).sort(),techSavviness:Array.from(he.techSavviness).sort((ue,je)=>{const Be=["Low (0-30)","Medium (31-70)","High (71-100)"];return Be.indexOf(ue)-Be.indexOf(je)}),ethnicity:Array.from(he.ethnicity).sort()}},Ve=H=>{const he={...lt};he[H]=[];const ue=E.filter(je=>{let Be=!0;return W!==vl&&(Be=!1,je.folder_ids&&Array.isArray(je.folder_ids)&&(Be=je.folder_ids.includes(W)),!Be&&(je.folder_id===W||je.folderId===W)&&(Be=!0)),Be?Object.entries(he).every(([zt,er])=>{if(er.length===0)return!0;const so=zt;if(so==="techSavviness"&&je.techSavviness!==void 0){const Mu=je.techSavviness<30?"Low (0-30)":je.techSavviness<70?"Medium (31-70)":"High (71-100)";return er.includes(Mu)}else{if(so==="age"&&je.age)return er.includes(je.age);if(so==="gender"&&je.gender)return er.includes(je.gender);if(so==="occupation"&&je.occupation)return er.includes(je.occupation);if(so==="location"&&je.location)return er.includes(je.location);if(so==="ethnicity"&&je.ethnicity)return er.includes(je.ethnicity)}return!0}):!1});return be(ue)},st=()=>{ct(!1),setTimeout(()=>{At({...lt})},0)},kt=()=>{Jt({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},Ke=(H,he)=>{Jt(ue=>{const je={...ue};return je[H].includes(he)?je[H]=je[H].filter(Be=>Be!==he):je[H]=[...je[H],he],je})},tt=async()=>{try{const ue=(await js.getAll()).data.map(je=>({...je,id:je._id}));return L(ue),ue}catch(H){return console.error("Error fetching folders:",H),re.error("Failed to load folders"),L([]),[]}},Nt=async()=>{if(!F.trim()){re.error("Please enter a folder name");return}try{const H=await js.create({name:F.trim()});await tt(),se(""),me(!1),re.success(`Folder "${F}" created`)}catch(H){console.error("Error creating folder:",H),re.error("Failed to create folder")}},sn=()=>{se(""),me(!1)},Nr=H=>{ae(H),de(H.name)},fn=async()=>{if(!ne||!De.trim()){ae(null);return}try{await js.update(ne._id,{name:De.trim()}),await tt(),ae(null),re.success(`Folder renamed to "${De}"`)}catch(H){console.error("Error renaming folder:",H),re.error("Failed to rename folder"),ae(null)}},St=()=>{ae(null),de("")};v.useEffect(()=>{const H=async()=>{z(!0);try{const ue=await zr.getAll();console.log("Fetched personas for FocusGroupModerator:",ue.data),Array.isArray(ue.data)&&ue.data.length>0?I(ue.data):(console.warn("No personas returned from API or invalid format",ue.data),re.warning("No participants available"))}catch(ue){console.error("Error fetching personas:",ue),re.error("Failed to load participants")}finally{z(!1)}};(async()=>{await Promise.all([tt(),H()])})()},[]),console.log("About to initialize form with useForm hook");const Ze=z0({resolver:G0(ode),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro",reasoning_effort:"medium",verbosity:"medium"}});console.log("Form initialized successfully");const ot=()=>{c!=="setup"||xe.current||(X.current&&clearTimeout(X.current),X.current=setTimeout(async()=>{if(ge.current)return;const H=Ze.getValues(),he={name:H.focusGroupName||"",description:H.researchBrief||"",objective:H.researchBrief||"",topic:H.discussionTopics||"",duration:H.duration?parseInt(H.duration):60,llm_model:H.llm_model||"gemini-2.5-pro",reasoning_effort:H.reasoning_effort||"medium",verbosity:H.verbosity||"medium",participants:j,participants_count:j.length,status:"draft",date:new Date().toISOString(),uploadedAssets:k.map(ue=>ue.name)};if(!(U&&JSON.stringify(he)===JSON.stringify(U))&&!(!he.name&&!he.description&&!he.topic)){ge.current=!0,M("saving");try{let ue=b||(t==null?void 0:t.id)||(t==null?void 0:t._id);if(console.log("Auto-save: draftFocusGroupId =",b),console.log("Auto-save: draftToEdit ID =",(t==null?void 0:t.id)||(t==null?void 0:t._id)),console.log("Auto-save: using focusGroupId =",ue),console.log("Auto-save: llm_model in currentData =",he.llm_model),console.log("Auto-save: duration in currentData =",he.duration),ue)console.log("Auto-save: Updating existing focus group:",ue),await Ot.update(ue,he),console.log("Auto-save: Updated existing draft:",ue);else{console.log("Auto-save: Creating NEW focus group (no existing ID)");const je=await Ot.create(he);ue=je.data.focus_group_id||je.data.id||je.data._id,x(ue),console.log("Auto-save: Created new draft with ID:",ue)}V(he),M("saved"),B(0),setTimeout(()=>{M("idle")},2e3)}catch(ue){if(console.error("Auto-save failed:",ue),M("error"),B(je=>je+1),Q<3){const je=Math.pow(2,Q)*2e3;setTimeout(()=>{ot()},je)}else re.error("Auto-save failed",{description:"Your changes may not be saved. Please check your connection."})}finally{ge.current=!1}}},2e3))},Xt=Ze.watch(),wn=v.useRef(""),oo=v.useRef(""),ta=v.useRef("");v.useEffect(()=>{const H=JSON.stringify(Xt);c==="setup"&&H!==wn.current&&(wn.current=H,ot())},[Xt,c]),v.useEffect(()=>{const H=JSON.stringify(j);c==="setup"&&H!==oo.current&&(oo.current=H,ot())},[j,c]),v.useEffect(()=>{const H=JSON.stringify(k.map(he=>he.name));c==="setup"&&H!==ta.current&&(ta.current=H,ot())},[k,c]),v.useEffect(()=>(c!=="setup"&&X.current&&clearTimeout(X.current),()=>{X.current&&clearTimeout(X.current)}),[c]),v.useEffect(()=>{if(console.log("Draft loading effect - draftToEdit:",t,"draftLoadedRef.current:",_.current),!t){_.current=!1;return}if(t&&!_.current){console.log("Loading draft focus group:",t),xe.current=!0,_.current=!0;const H=t.id||t._id;x(H),console.log("Setting draft ID from draftToEdit:",H),t.name&&Ze.setValue("focusGroupName",t.name),(t.description||t.objective)&&Ze.setValue("researchBrief",t.description||t.objective||""),t.topic&&Ze.setValue("discussionTopics",t.topic),t.duration&&Ze.setValue("duration",t.duration.toString()),t.llm_model&&Ze.setValue("llm_model",t.llm_model),t.reasoning_effort&&Ze.setValue("reasoning_effort",t.reasoning_effort),t.verbosity&&Ze.setValue("verbosity",t.verbosity),t.discussionGuide&&(y(t.discussionGuide),(!o.focusGroupTab||o.previousRoute!=="/focus-groups")&&l("review")),t.participants&&Array.isArray(t.participants)&&P(t.participants);const he={name:t.name||"",description:t.description||t.objective||"",objective:t.description||t.objective||"",topic:t.topic||"",duration:t.duration||60,llm_model:t.llm_model||"gemini-2.5-pro",reasoning_effort:t.reasoning_effort||"medium",verbosity:t.verbosity||"medium",participants:t.participants||[],participants_count:(t.participants||[]).length,status:"draft",date:t.date||new Date().toISOString(),uploadedAssets:[]};V(he),console.log("Set lastSavedData to current draft:",he),re.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}),setTimeout(()=>{xe.current=!1;const ue=JSON.stringify(Ze.getValues());wn.current=ue},1e3)}},[t,Ze]),v.useEffect(()=>{n.length>0&&(console.log("Pre-selected participants received:",n),P(n),l("participants"))},[n]),v.useEffect(()=>{o.focusGroupTab&&o.previousRoute==="/focus-groups"&&setTimeout(()=>{l(o.focusGroupTab),s()},0)},[o.focusGroupTab,t,s]),v.useEffect(()=>{t||setTimeout(()=>{xe.current=!1;const H=JSON.stringify(Ze.getValues());wn.current=H},500)},[t,Ze]);const q=()=>{if(T==="idle")return null;const he={saving:{text:"Saving...",className:"text-blue-600 bg-blue-50"},saved:{text:"All changes saved",className:"text-green-600 bg-green-50"},error:{text:"Save failed - retrying...",className:"text-red-600 bg-red-50"}}[T];return a.jsx("div",{className:`fixed top-16 left-1/2 transform -translate-x-1/2 z-50 px-3 py-1 rounded-md text-sm font-medium border shadow-sm ${he.className}`,children:he.text})},Pe=async(H,he)=>{var ue,je;d(!0),h(!1),g(!1);try{const Be={name:H.focusGroupName,description:H.researchBrief,objective:H.researchBrief,topic:H.discussionTopics,duration:parseInt(H.duration),llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity},zt=he?await Ot.generateDiscussionGuideForGroup(he,Be):await Ot.generateDiscussionGuide(Be);if(zt.data&&zt.data.discussionGuide)return h(!0),zt.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(Be){console.error("Error generating discussion guide:",Be),g(!0);let zt="Unknown error occurred";throw(je=(ue=Be==null?void 0:Be.response)==null?void 0:ue.data)!=null&&je.error?zt=Be.response.data.error:Be!=null&&Be.message&&(zt=Be.message),zt.includes("500")||zt.includes("internal error")||zt.includes("Internal Server Error")?re.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>Pe(H)}}):re.error("Failed to generate discussion guide",{description:zt,action:{label:"Retry",onClick:()=>Pe(H)}}),Be}},We=()=>{d(!1),h(!1),g(!1)};async function yt(H){var he;try{let ue=b;if(!ue){const je={name:H.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity},Be=await Ot.create(je);ue=Be.data.focus_group_id||Be.data.id||Be.data._id,x(ue),console.log("Draft focus group created for asset upload:",Be,"with ID:",ue)}if(H.creativeAssets&&H.creativeAssets.length>0&&ue)try{const je=new FormData;Array.from(H.creativeAssets).forEach(so=>{je.append("assets",so)});const zt=(await Ot.uploadAssets(ue,je,!0)).data;console.log("Assets uploaded successfully:",zt),re.success(`${zt.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const er=Array.from(H.creativeAssets);O(er)}catch(je){console.error("Asset upload failed:",je);const Be=(he=je.response)==null?void 0:he.data;let zt="Asset upload failed",er="Some assets could not be uploaded";(Be==null?void 0:Be.code)==="TEMP_DIR_ERROR"?(zt="Upload temporarily unavailable",er="Server storage issue. Please try again in a moment."):(Be==null?void 0:Be.code)==="UPLOAD_SYSTEM_FAILURE"?(zt="Upload system unavailable",er="Critical server issue. Please contact support."):Be!=null&&Be.can_retry&&(zt="Upload failed - can retry",er=(Be==null?void 0:Be.details)||"Please try uploading again."),re.error(zt,{description:er}),console.log("Continuing without assets due to upload failure")}if(ue)try{const je={name:H.focusGroupName,participants:j,participants_count:j.length,duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity};await Ot.update(ue,je),console.log("Focus group updated with latest form values before guide generation"),console.log(`🔄 Updated focus group ${ue} with model: ${H.llm_model}`)}catch(je){console.error("Failed to update focus group before guide generation:",je)}try{const je=await Pe(H,ue);y(je);try{const Be={name:H.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:H.researchBrief,objective:H.researchBrief,llm_model:H.llm_model,reasoning_effort:H.reasoning_effort,verbosity:H.verbosity,discussionGuide:je};await Ot.update(ue,Be),console.log("Focus group updated with discussion guide"),re.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(Be){console.error("Failed to update focus group with discussion guide:",Be),re.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}l("review"),re.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(je){console.error("Discussion guide generation failed:",je),re.error("Discussion guide generation failed",{description:"Please go back to the setup tab and try generating again. Check your inputs and try a different AI model if the issue persists.",duration:8e3});return}}catch(ue){console.error("Error in focus group creation flow:",ue),re.error("Focus group creation failed",{description:ue.message||"An unexpected error occurred"})}}const et=(()=>{var he;const H=E.filter(ue=>{const je=ue.name.toLowerCase().includes(ye.toLowerCase())||ue.occupation&&ue.occupation.toLowerCase().includes(ye.toLowerCase())||ue.location&&ue.location.toLowerCase().includes(ye.toLowerCase()),Be=(Le.age.length===0||Le.age.includes(ue.age))&&(Le.gender.length===0||Le.gender.includes(ue.gender))&&(Le.occupation.length===0||Le.occupation.includes(ue.occupation))&&(Le.location.length===0||Le.location.includes(ue.location))&&(Le.ethnicity.length===0||ue.ethnicity&&Le.ethnicity.includes(ue.ethnicity))&&(Le.techSavviness.length===0||ue.techSavviness!==void 0&&Le.techSavviness.includes(ue.techSavviness<30?"Low (0-30)":ue.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let zt=!0;return W!==vl&&(zt=!1,ue.folder_ids&&Array.isArray(ue.folder_ids)&&(zt=ue.folder_ids.includes(W)),zt||(ue.folder_id===W||ue.folderId===W)&&(zt=!0)),je&&Be&&zt});if(console.log(`Filtered personas: ${H.length}/${E.length}`),console.log(`Selected folder: ${W===vl?"All Personas":((he=R.find(ue=>ue._id===W||ue.id===W))==null?void 0:he.name)||W}`),W!==vl){const ue=R.find(je=>je._id===W||je.id===W);if(ue){const je=E.filter(Be=>Be.folder_ids&&Array.isArray(Be.folder_ids)?Be.folder_ids.includes(W):Be.folder_id===W||Be.folderId===W);console.log(`Folder details: ${ue.name}, ID: ${ue._id}, Contains: ${je.length} personas`),console.log("Personas in this folder:",je.map(Be=>Be.name))}}return H})(),bt=H=>{console.log("Toggling selection for participant ID:",H),P(he=>{const ue=he.includes(H);console.log("Current selection:",{id:H,isCurrentlySelected:ue,currentSelections:[...he]});const je=ue?he.filter(Be=>Be!==H):[...he,H];return console.log("New selection:",je),je})},hn=async()=>{try{const H=Ze.getValues(),he={name:H.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(H.duration),topic:H.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:m},je=(await Ot.create(he)).data;return console.log("Focus group created successfully:",je),je.focus_group_id}catch(H){throw console.error("Error saving focus group:",H),H}},ut=v.useCallback(async()=>{if(!C.current){re.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}G(!0);try{const{downloadDiscussionGuideAsMarkdown:H}=await zie(async()=>{const{downloadDiscussionGuideAsMarkdown:ue}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:ue}},[]),he=Ze.getValues();H(C.current,he.focusGroupName),re.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(H){console.error("Error downloading discussion guide:",H),re.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{G(!1)}},[Ze]),An=v.useCallback(async H=>{console.log("📝 handleSaveDiscussionGuide called with:",H),w?(C.current=H,console.log("📝 Skipping discussionGuide state update during editing to preserve focus")):(y(H),re.success("Discussion guide updated",{description:"Your changes have been saved."}))},[w]),an=v.useCallback(H=>{console.log("📝 Discussion guide editing state changed:",H),S(H),!H&&C.current&&(console.log("📝 Updating discussionGuide state after editing ended"),y(C.current))},[]),rn=v.useCallback(()=>{},[]),gr=async()=>{if(!Ze.getValues().focusGroupName){re.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!m){re.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(j.length<1){re.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",j);try{re.loading("Creating focus group...");let H;if(b){const he=Ze.getValues(),ue={name:he.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(he.duration),topic:he.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:he.researchBrief,objective:he.researchBrief,discussionGuide:m},je=await Ot.update(b,ue);H=b,console.log("Draft focus group updated to in-progress:",je),e&&e()}else H=await hn();re.dismiss(),re.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),r(`/focus-groups/${H}`)}catch(H){re.dismiss(),H!=null&&H.message,console.error("Failed to start focus group:",H),re.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs(a.Fragment,{children:[a.jsx(q,{}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[a.jsx(Vs,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),u&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:u,isComplete:f,hasError:p,label:"Generating discussion guide",onComplete:We})}),a.jsxs(dl,{value:c,onValueChange:l,children:[a.jsxs(Va,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(gn,{value:"setup",children:"Setup"}),a.jsx(gn,{value:"review",children:"Review & Edit"}),a.jsx(gn,{value:"participants",children:"Participants"})]}),a.jsx(vn,{value:"setup",children:a.jsx(K0,{...Ze,children:a.jsxs("form",{onSubmit:Ze.handleSubmit(yt),className:"space-y-6",children:[a.jsx(vt,{control:Ze.control,name:"focusGroupName",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Focus Group Name"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"e.g., Mobile App UX Evaluation",...H})}),a.jsx(Nn,{children:"Give your focus group a descriptive name"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(vt,{control:Ze.control,name:"researchBrief",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Research Brief"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"Describe your research objectives...",className:"h-36",...H})}),a.jsx(Nn,{children:"Provide context about what you want to learn"}),a.jsx(pt,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(vt,{control:Ze.control,name:"discussionTopics",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Discussion Topics"}),a.jsx(ht,{children:a.jsx(mt,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...H})}),a.jsx(Nn,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"duration",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Duration (minutes)"}),a.jsxs(Un,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select duration"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"30",children:"30 minutes"}),a.jsx(oe,{value:"45",children:"45 minutes"}),a.jsx(oe,{value:"60",children:"60 minutes"}),a.jsx(oe,{value:"90",children:"90 minutes"}),a.jsx(oe,{value:"120",children:"120 minutes"})]})]}),a.jsx(Nn,{children:"How long should the focus group session last?"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"llm_model",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"AI Model"}),a.jsxs(Un,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select AI model"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Nn,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(pt,{})]})}),Ze.watch("llm_model")==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsx(vt,{control:Ze.control,name:"reasoning_effort",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Reasoning Effort"}),a.jsxs(Un,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select reasoning effort"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(oe,{value:"low",children:"Low - Quick thinking"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(oe,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx(Nn,{children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(pt,{})]})}),a.jsx(vt,{control:Ze.control,name:"verbosity",render:({field:H})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Response Verbosity"}),a.jsxs(Un,{onValueChange:H.onChange,value:H.value,children:[a.jsx(ht,{children:a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select verbosity level"})})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"low",children:"Low - Concise responses"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(oe,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx(Nn,{children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("div",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx(pt,{})]})})]})]})]}),a.jsx(vt,{control:Ze.control,name:"creativeAssets",render:({field:{value:H,onChange:he,...ue}})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Creative Assets (Optional)"}),a.jsx(ht,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(d5,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload creative assets for testing"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Images, mockups, or product designs"}),a.jsx(Ht,{...ue,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:je=>{he(je.target.files)},className:"hidden",id:"assets-file-input"}),a.jsxs(J,{type:"button",variant:"outline",size:"sm",onClick:()=>{var je;return(je=document.getElementById("assets-file-input"))==null?void 0:je.click()},children:[a.jsx(h5,{className:"mr-2 h-4 w-4"}),"Select Files"]}),H&&H.length>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[H.length," file(s) selected"]})]})}),a.jsx(Nn,{children:"Upload visuals that you want feedback on during the session"}),a.jsx(pt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(J,{type:"submit",disabled:u,className:"min-w-32",children:[a.jsx(Vs,{className:"mr-2 h-4 w-4"}),u?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(vn,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("div",{className:"flex items-center justify-between mb-4",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"AI-Generated Discussion Guide"}),m&&a.jsx(Sr,{variant:"outline",className:"text-xs",children:A(m)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:m?a.jsx(GN,{discussionGuide:m,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:An,onDownload:ut,onSectionSelect:rn,isDownloading:$,focusGroupId:b,onEditingChange:an}):a.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:p?a.jsxs("div",{children:[a.jsx("p",{className:"mb-2",children:"Discussion guide generation failed."}),a.jsxs("p",{className:"text-sm",children:["Go back to the ",a.jsx("strong",{children:"Setup"})," tab and try generating again. Check your inputs and try a different AI model if the issue persists."]})]}):a.jsx("p",{children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})})]})}),k.length>0&&a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Uploaded Creative Assets"}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:k.map((H,he)=>a.jsxs("div",{className:"border rounded-md p-2",children:[a.jsx("div",{className:"aspect-square bg-slate-100 rounded flex items-center justify-center mb-2",children:H.type.startsWith("image/")?a.jsx("img",{src:URL.createObjectURL(H),alt:`Asset ${he+1}`,className:"max-h-full max-w-full object-contain"}):a.jsx(H_,{className:"h-10 w-10 text-slate-400"})}),a.jsx("p",{className:"text-xs truncate",children:H.name})]},he))})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:()=>l("setup"),children:"Back to Setup"}),a.jsxs(J,{onClick:()=>l("participants"),children:["Select Participants",a.jsx(Dr,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(vn,{value:"participants",children:[a.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[a.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),a.jsx(J,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),me(!0)},className:"h-7 w-7 p-0",children:a.jsx(f5,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>{console.log("Clicked 'All Personas' folder"),console.log("All personas count:",E.length),Y(vl),setTimeout(()=>{console.log(`Will show all ${E.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${W===vl?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),R.map(H=>a.jsx("div",{className:"flex items-center justify-between group",children:ne&&ne._id===H._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:De,onChange:he=>de(he.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:he=>{he.key==="Enter"?fn():he.key==="Escape"&&St()}}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${ne==null?void 0:ne.name}" to "${De}"`),fn()},className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${ne==null?void 0:ne.name}"`),St()},className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${H.name} (ID: ${H._id})`);const he=E.filter(ue=>ue.folder_ids&&Array.isArray(ue.folder_ids)?ue.folder_ids.includes(H._id):ue.folder_id===H._id||ue.folderId===H._id);console.log(`Current persona count in folder: ${he.length}`),console.log("All personas count:",E.length),Y(H._id),setTimeout(()=>{console.log(`Will show ${he.length} personas after filtering`),console.log("Filtered personas:",he.map(ue=>ue.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${W===H._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx("span",{children:H.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:E.filter(he=>he.folder_ids&&Array.isArray(he.folder_ids)?he.folder_ids.includes(H._id):he.folder_id===H._id||he.folderId===H._id).length})]}),a.jsxs(PA,{children:[a.jsx(kA,{asChild:!0,children:a.jsx(J,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(U_,{className:"h-4 w-4"})})}),a.jsx(Ox,{align:"end",children:a.jsx(oc,{onClick:()=>{console.log(`Initiating rename for folder: ${H.name} (ID: ${H.id})`),Nr(H)},children:"Rename"})})]})]})},H._id)),te&&a.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[a.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[a.jsx(ho,{className:"h-4 w-4"}),a.jsx(Ht,{value:F,onChange:H=>se(H.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:H=>{H.key==="Enter"?Nt():H.key==="Escape"&&sn()}})]}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${F}"`),Nt()},className:"h-7 w-7 p-0",children:a.jsx(Gs,{className:"h-4 w-4"})}),a.jsx(J,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),sn()},className:"h-7 w-7 p-0",children:a.jsx(Jo,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(gt,{className:"mb-4",children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"flex flex-col space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Select Participants"}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dr,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[j.length," of ",et.length," selected"]})]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:ye,onChange:H=>Ee(H.target.value)})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",onClick:()=>ct(!0),children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Le).some(H=>H.length>0)?` (${Object.values(Le).reduce((H,he)=>H+he.length,0)})`:""]})]})]}),D?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Ds,{className:"h-8 w-8 animate-spin text-primary"})}):et.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:et.map(H=>{const he=H._id||H.id;return a.jsx(fN,{user:{id:he,_id:H._id,name:H.name,age:H.age,gender:H.gender,occupation:H.occupation,location:H.location||"Unknown",techSavviness:H.techSavviness||50,personality:H.personality||"No description available",oceanTraits:H.oceanTraits,qualitativeAttributes:H.qualitativeAttributes,topPersonalityTraits:H.topPersonalityTraits,aiSynthesizedBio:H.aiSynthesizedBio},selected:j.includes(he),onSelectionToggle:()=>bt(he),onViewDetails:Re},he)})}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No personas available matching your criteria."})})]})})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:()=>l("review"),children:"Back to Review"}),a.jsxs(J,{onClick:gr,disabled:j.length<1||!m,children:[a.jsx(sZ,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(Ql,{open:Z,onOpenChange:H=>{H?(ct(H),Jt({...Le})):ct(!1)},children:a.jsxs($c,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Filter Personas"}),a.jsx(Xl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic."})]}),a.jsxs("div",{className:"py-4 space-y-6",children:[Object.values(lt).some(H=>H.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(lt).reduce((H,he)=>H+he.length,0)," active filters"]})}),(()=>{const H=be(E),he=Object.values(lt).every(je=>je.length===0),ue=(je,Be,zt=1)=>{const er=he?H[Be]:Ve(Be)[Be],so=lt[Be],Mu=[...new Set([...er,...so])].sort();return Mu.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:je}),a.jsx("div",{className:`grid grid-cols-1 ${zt===2?"sm:grid-cols-2":zt===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Mu.map(na=>{const ee=lt[Be].includes(na),ce=er.includes(na);return a.jsxs("div",{className:`flex items-center space-x-2 ${!ce&&!ee?"opacity-50":""}`,children:[a.jsx(Dl,{id:`${Be}-${na}`,checked:ee,onCheckedChange:()=>Ke(Be,na),disabled:!ce&&!ee}),a.jsxs(mo,{htmlFor:`${Be}-${na}`,className:"truncate overflow-hidden",children:[na,ee&&!ce&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},na)})})]})};return a.jsxs(a.Fragment,{children:[ue("Gender","gender",3),ue("Age","age",3),ue("Ethnicity","ethnicity",2),ue("Location","location",2),ue("Occupation","occupation",2),ue("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:kt,children:"Reset"}),a.jsx(J,{onClick:st,children:"Apply Filters"})]})]})})]})]})]})]})}const ade=[{id:"1",name:"Mobile App UX Evaluation",status:"completed",participants:6,date:"2023-06-10T14:00:00Z",duration:60,topic:"user-experience"},{id:"2",name:"Product Feature Feedback",status:"scheduled",participants:8,date:"2023-06-15T10:00:00Z",duration:90,topic:"product-feedback"},{id:"3",name:"Marketing Campaign Testing",status:"in-progress",participants:5,date:"2023-06-12T15:30:00Z",duration:45,topic:"creative-testing"},{id:"4",name:"Website Navigation Study",status:"scheduled",participants:7,date:"2023-06-18T13:00:00Z",duration:60,topic:"user-experience"}],cde={completed:"bg-green-100 text-green-800 border-green-200",scheduled:"bg-blue-100 text-blue-800 border-blue-200","in-progress":"bg-amber-100 text-amber-800 border-amber-200",active:"bg-amber-100 text-amber-800 border-amber-200",paused:"bg-purple-100 text-purple-800 border-purple-200",new:"bg-slate-100 text-slate-800 border-slate-200",ai_mode:"bg-amber-100 text-amber-800 border-amber-200",draft:"bg-gray-100 text-gray-800 border-gray-200"},lde=()=>{console.log("FocusGroups component rendering");const[t,e]=v.useState("view"),[n,r]=v.useState(""),[i,o]=v.useState([]),[s,c]=v.useState(!0),[l,u]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),[g,m]=v.useState(null),y=ar(),b=Fi(),[x,w]=v.useState([]),S=v.useRef(!0),C=async(E=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",E),console.log("isMounted.current:",S.current),E&&!S.current){console.log("Exiting early: component not mounted");return}console.log("Setting loading to true and making API call"),c(!0);try{console.log("Calling focusGroupsApi.getAll()");const I=await Ot.getAll();if(console.log("API response received:",I),!E||S.current){const D=I.data.map(z=>({...z,id:z.id||z._id,participants_count:Array.isArray(z.participants)?z.participants.length:typeof z.participants=="number"?z.participants:0}));o(D)}}catch(I){console.error("Error fetching focus groups:",I),(!E||S.current)&&(qe.error("Failed to load focus groups"),o(ade))}finally{(!E||S.current)&&c(!1)}},_=async E=>{try{const I=await Ot.getById(E);I&&I.data&&(m(I.data),e("create"))}catch(I){console.error("Error fetching focus group for edit:",I),qe.error("Failed to load focus group for editing")}};v.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),C(),()=>{console.log("useEffect cleanup - setting isMounted to false"),S.current=!1}),[]),v.useEffect(()=>{console.log("Mode change useEffect running, mode:",t),t==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),C())},[t]),v.useEffect(()=>{const E=b.state;(E==null?void 0:E.mode)==="create"&&(E!=null&&E.preSelectedParticipants)&&(w(E.preSelectedParticipants),e("create"),y(b.pathname,{replace:!0,state:null}))},[b.state,b.pathname,y]),v.useEffect(()=>{const E=new URLSearchParams(b.search),I=E.get("mode"),D=E.get("id"),z=E.get("tab");if(I==="create")e("create"),m(null);else if(I==="edit"&&D){const $=i.find(G=>(G._id||G.id)===D);$?(m($),e("create")):_(D)}if(I||D||z){const $=b.pathname;y($,{replace:!0})}},[b.search,i,y,b.pathname]);const A=i.filter(E=>E.name.toLowerCase().includes(n.toLowerCase())||E.topic.toLowerCase().includes(n.toLowerCase())),j=E=>new Date(E).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),P=E=>new Date(E).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),k=E=>{u(I=>I.includes(E)?I.filter(D=>D!==E):[...I,E])},O=async()=>{if(l.length!==0){p(!0);try{const E=l.map(I=>Ot.delete(I));await Promise.all(E),o(I=>I.filter(D=>!l.includes(D.id||D._id||""))),u([]),qe.success(`${l.length} focus group${l.length>1?"s":""} deleted successfully`)}catch(E){console.error("Error deleting focus groups:",E),qe.error("Failed to delete focus groups")}finally{p(!1),f(!1)}}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Focus Groups"}),a.jsx("p",{className:"text-slate-600 mt-1",children:"Set up and manage AI-moderated research sessions"})]}),a.jsx("div",{className:"mt-4 sm:mt-0",children:a.jsx(J,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",t);try{t==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),e("create")):(console.log("Switching back to view mode"),e("view"))}catch(E){console.error("Error in Create New Focus Group onClick:",E)}},className:"hover-transition",children:t==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),t==="view"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx($E,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Ht,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:E=>r(E.target.value)})]}),a.jsxs(J,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(ME,{className:"h-4 w-4"}),a.jsx("span",{children:"Filter"})]})]}),a.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-6",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Vs,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Your Focus Groups"})]}),l.length>0&&a.jsxs(J,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(nr,{className:"h-4 w-4"}),"Delete Selected (",l.length,")"]})]}),s?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Ds,{className:"h-8 w-8 animate-spin text-primary"})}):A.length>0?a.jsx("div",{className:"space-y-4",children:A.map(E=>a.jsx("div",{className:"glass-card rounded-xl overflow-hidden hover:shadow-md button-transition",children:a.jsxs("div",{className:"flex flex-col md:flex-row",children:[a.jsxs("div",{className:"flex-1 p-6",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Dl,{id:`select-${E.id||E._id}`,checked:l.includes(E.id||E._id||""),onCheckedChange:()=>k(E.id||E._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:E.name}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(zJ,{className:"h-4 w-4 mr-1"}),j(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Wp,{className:"h-4 w-4 mr-1"}),P(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Dr,{className:"h-4 w-4 mr-1"}),E.participants_count||(Array.isArray(E.participants)?E.participants.length:0)," participant",E.participants_count>1||Array.isArray(E.participants)&&E.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Wp,{className:"h-4 w-4 mr-1"}),E.duration," min"]})]})]})]}),a.jsxs("div",{className:Ne("px-3 py-1 rounded-full text-xs font-medium border",cde[E.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[E.status==="completed"&&"Completed",E.status==="scheduled"&&"Scheduled",E.status==="in-progress"&&"In Progress",E.status==="active"&&"In Progress",E.status==="ai_mode"&&"In Progress",E.status==="paused"&&"Paused",E.status==="new"&&"Not Started",E.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(E.status)&&E.status]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[a.jsxs("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:[E.topic==="user-experience"&&"User Experience",E.topic==="product-feedback"&&"Product Feedback",E.topic==="creative-testing"&&"Creative Testing",E.topic==="messaging-evaluation"&&"Messaging Evaluation",E.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(E.topic)&&E.topic.charAt(0).toUpperCase()+E.topic.slice(1).replace(/-/g," ")]}),a.jsx("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:"AI Moderated"})]})]}),a.jsx("div",{className:"bg-slate-50 p-6 flex flex-col justify-center items-center md:border-l border-slate-100",children:a.jsx(J,{variant:E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?"default":E.status==="new"||E.status==="draft"?"outline":"default",className:Ne("w-full hover-transition",E.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",E.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(E.status==="draft")m(E),e("create");else{const I=E.id||E._id;console.log("Navigating to focus group:",I),y(`/focus-groups/${I}`)}},children:E.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):E.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(fo,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(fo,{className:"ml-2 h-4 w-4"})]})})})]})},E.id))}):a.jsx("div",{className:"text-center py-12",children:a.jsx("p",{className:"text-muted-foreground",children:"No focus groups found matching your search criteria."})})]})]}):a.jsx(sde,{draftToEdit:g,preSelectedParticipants:x,onDraftSaved:()=>{m(null),e("view"),w([]),C()}})]}),a.jsx(OA,{open:d,onOpenChange:f,children:a.jsxs(Rx,{children:[a.jsxs(Mx,{children:[a.jsxs($x,{children:["Delete ",l.length," Focus Group",l.length!==1?"s":"","?"]}),a.jsxs(Lx,{children:["This action cannot be undone. This will permanently delete the selected focus group",l.length!==1?"s":""," and remove all data associated with ",l.length!==1?"them":"it","."]})]}),a.jsxs(Dx,{children:[a.jsx(Bx,{disabled:h,children:"Cancel"}),a.jsx(Fx,{onClick:E=>{E.preventDefault(),O()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},ude=({participants:t,selectedParticipantIds:e,onToggleParticipantFilter:n})=>{const r=ar(),{id:i}=OE(),{setPreviousRoute:o}=ow(),s=l=>{const u=l.id||l._id;u&&i&&(o(`/focus-groups/${i}`,{focusGroupId:i}),r(`/personas/${u}`))},c=l=>{const u=l.id||l._id;u&&n(u)};return a.jsx("div",{className:"w-full lg:w-64 shrink-0",children:a.jsxs("div",{className:"glass-panel rounded-xl p-4",children:[a.jsxs("h2",{className:"font-sf text-lg font-semibold flex items-center mb-3",children:[a.jsx(Dr,{className:"h-5 w-5 text-primary mr-2"})," Participants"]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center p-2 bg-primary/5 rounded-lg",children:[a.jsx(ya,{className:"h-8 w-8 text-primary mr-3"}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-primary",children:"AI Moderator"}),a.jsx("p",{className:"text-xs text-slate-500",children:"Session facilitator"})]})]}),t.map(l=>{const u=l.id||l._id,d=e.includes(u);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${d?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>s(l),title:`View ${l.name}'s profile`,children:a.jsx("img",{src:Cg(l),alt:l.name,className:"h-8 w-8 rounded-full object-cover"})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx("p",{className:"font-medium cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>c(l),title:`Filter to show only ${l.name}'s messages`,children:l.name}),d&&a.jsx(Gs,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:l.occupation})]})]},l.id)})]})]})})};function dde(t,e){return v.useReducer((n,r)=>e[n][r]??n,t)}var VN="ScrollArea",[lG,yFe]=Li(VN),[fde,Po]=lG(VN),uG=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...s}=t,[c,l]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,g]=v.useState(null),[m,y]=v.useState(null),[b,x]=v.useState(0),[w,S]=v.useState(0),[C,_]=v.useState(!1),[A,j]=v.useState(!1),P=Pt(e,O=>l(O)),k=Nu(i);return a.jsx(fde,{scope:n,type:r,dir:k,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:A,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:S,children:a.jsx(it.div,{dir:k,...s,ref:P,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});uG.displayName=VN;var dG="ScrollAreaViewport",fG=v.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,asChild:i,nonce:o,...s}=t,c=Po(dG,n),l=v.useRef(null),u=Pt(e,l,c.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:` [data-radix-scroll-area-viewport] { scrollbar-width: none; -ms-overflow-style: none; @@ -632,7 +632,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert- `}})),u+=`--- -`});const f=new Blob([u],{type:"text/markdown"}),h=URL.createObjectURL(f),p=document.createElement("a");p.href=h,p.download=`key-themes-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(p),p.click(),document.body.removeChild(p),URL.revokeObjectURL(h),re.success("Themes exported successfully",{description:`Downloaded ${d.length} themes as markdown file.`})};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"mb-4 space-y-2",children:[a.jsxs(J,{onClick:c,className:"w-full",children:[a.jsx(gZ,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),a.jsxs(J,{onClick:l,disabled:!t||t.length===0,variant:"outline",className:"w-full",children:[a.jsx(lu,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),a.jsx("div",{className:"flex-grow overflow-hidden",children:a.jsx(Bde,{themes:t,messages:e,personas:n,onThemeDelete:o,focusGroupId:r,onQuoteClick:s})})]})};var Hde=Array.isArray,Bi=Hde,zde=typeof Bg=="object"&&Bg&&Bg.Object===Object&&Bg,_G=zde,Gde=_G,Vde=typeof self=="object"&&self&&self.Object===Object&&self,Kde=Gde||Vde||Function("return this")(),Zs=Kde,Wde=Zs,qde=Wde.Symbol,Ng=qde,ER=Ng,AG=Object.prototype,Yde=AG.hasOwnProperty,Qde=AG.toString,Th=ER?ER.toStringTag:void 0;function Xde(t){var e=Yde.call(t,Th),n=t[Th];try{t[Th]=void 0;var r=!0}catch{}var i=Qde.call(t);return r&&(e?t[Th]=n:delete t[Th]),i}var Jde=Xde,Zde=Object.prototype,efe=Zde.toString;function tfe(t){return efe.call(t)}var nfe=tfe,TR=Ng,rfe=Jde,ife=nfe,ofe="[object Null]",sfe="[object Undefined]",NR=TR?TR.toStringTag:void 0;function afe(t){return t==null?t===void 0?sfe:ofe:NR&&NR in Object(t)?rfe(t):ife(t)}var Wa=afe;function cfe(t){return t!=null&&typeof t=="object"}var qa=cfe,lfe=Wa,ufe=qa,dfe="[object Symbol]";function ffe(t){return typeof t=="symbol"||ufe(t)&&lfe(t)==dfe}var Yf=ffe,hfe=Bi,pfe=Yf,mfe=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,gfe=/^\w*$/;function vfe(t,e){if(hfe(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||pfe(t)?!0:gfe.test(t)||!mfe.test(t)||e!=null&&t in Object(e)}var YN=vfe;function yfe(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var fl=yfe;const Qf=un(fl);var xfe=Wa,bfe=fl,wfe="[object AsyncFunction]",Sfe="[object Function]",Cfe="[object GeneratorFunction]",_fe="[object Proxy]";function Afe(t){if(!bfe(t))return!1;var e=xfe(t);return e==Sfe||e==Cfe||e==wfe||e==_fe}var QN=Afe;const Ct=un(QN);var jfe=Zs,Efe=jfe["__core-js_shared__"],Tfe=Efe,nC=Tfe,PR=function(){var t=/[^.]+$/.exec(nC&&nC.keys&&nC.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Nfe(t){return!!PR&&PR in t}var Pfe=Nfe,kfe=Function.prototype,Ofe=kfe.toString;function Ife(t){if(t!=null){try{return Ofe.call(t)}catch{}try{return t+""}catch{}}return""}var jG=Ife,Rfe=QN,Mfe=Pfe,Dfe=fl,$fe=jG,Lfe=/[\\^$.*+?()[\]{}|]/g,Ffe=/^\[object .+?Constructor\]$/,Bfe=Function.prototype,Ufe=Object.prototype,Hfe=Bfe.toString,zfe=Ufe.hasOwnProperty,Gfe=RegExp("^"+Hfe.call(zfe).replace(Lfe,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Vfe(t){if(!Dfe(t)||Mfe(t))return!1;var e=Rfe(t)?Gfe:Ffe;return e.test($fe(t))}var Kfe=Vfe;function Wfe(t,e){return t==null?void 0:t[e]}var qfe=Wfe,Yfe=Kfe,Qfe=qfe;function Xfe(t,e){var n=Qfe(t,e);return Yfe(n)?n:void 0}var Ou=Xfe,Jfe=Ou,Zfe=Jfe(Object,"create"),lw=Zfe,kR=lw;function ehe(){this.__data__=kR?kR(null):{},this.size=0}var the=ehe;function nhe(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var rhe=nhe,ihe=lw,ohe="__lodash_hash_undefined__",she=Object.prototype,ahe=she.hasOwnProperty;function che(t){var e=this.__data__;if(ihe){var n=e[t];return n===ohe?void 0:n}return ahe.call(e,t)?e[t]:void 0}var lhe=che,uhe=lw,dhe=Object.prototype,fhe=dhe.hasOwnProperty;function hhe(t){var e=this.__data__;return uhe?e[t]!==void 0:fhe.call(e,t)}var phe=hhe,mhe=lw,ghe="__lodash_hash_undefined__";function vhe(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=mhe&&e===void 0?ghe:e,this}var yhe=vhe,xhe=the,bhe=rhe,whe=lhe,She=phe,Che=yhe;function Xf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var Bhe=Fhe,Uhe=uw;function Hhe(t,e){var n=this.__data__,r=Uhe(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var zhe=Hhe,Ghe=jhe,Vhe=Rhe,Khe=$he,Whe=Bhe,qhe=zhe;function Jf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var Bhe=Fhe,Uhe=uw;function Hhe(t,e){var n=this.__data__,r=Uhe(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var zhe=Hhe,Ghe=jhe,Vhe=Rhe,Khe=$he,Whe=Bhe,qhe=zhe;function Jf(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},$l=function(e){return Pg(e)&&e.indexOf("%")===e.length-1},Ae=function(e){return mme(e)&&!eh(e)},Er=function(e){return Ae(e)||Pg(e)},xme=0,th=function(e){var n=++xme;return"".concat(e||"").concat(n)},gi=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ae(e)&&!Pg(e))return r;var o;if($l(e)){var s=e.indexOf("%");o=n*parseFloat(e.slice(0,s))/100}else o=+e;return eh(o)&&(o=r),i&&o>n&&(o=n),o},fc=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},bme=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function DA(t){"@babel/helpers - typeof";return DA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DA(t)}var LR={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},ja=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},FR=null,iC=null,sP=function t(e){if(e===FR&&Array.isArray(iC))return iC;var n=[];return v.Children.forEach(e,function(r){Dt(r)||(MG.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),iC=n,FR=e,n};function jo(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(i){return ja(i)}):r=[ja(e)],sP(t).forEach(function(i){var o=to(i,"type.displayName")||to(i,"type.name");r.indexOf(o)!==-1&&n.push(i)}),n}function Ki(t,e){var n=jo(t,e);return n&&n[0]}var BR=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!Ae(r)||r<=0||!Ae(i)||i<=0)},Eme=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Tme=function(e){return e&&e.type&&Pg(e.type)&&Eme.indexOf(e.type)>=0},Nme=function(e){return e&&DA(e)==="object"&&"clipDot"in e},Pme=function(e,n,r,i){var o,s=(o=rC==null?void 0:rC[i])!==null&&o!==void 0?o:[];return!Ct(e)&&(i&&s.includes(n)||Sme.includes(n))||r&&oP.includes(n)},rt=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(v.isValidElement(e)&&(i=e.props),!Qf(i))return null;var o={};return Object.keys(i).forEach(function(s){var c;Pme((c=i)===null||c===void 0?void 0:c[s],s,n,r)&&(o[s]=i[s])}),o},$A=function t(e,n){if(e===n)return!0;var r=v.Children.count(e);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return UR(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Mme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function FA(t){var e=t.children,n=t.width,r=t.height,i=t.viewBox,o=t.className,s=t.style,c=t.title,l=t.desc,u=Rme(t,Ime),d=i||{width:n,height:r,x:0,y:0},f=Mt("recharts-surface",o);return N.createElement("svg",LA({},rt(u,!0,"svg"),{className:f,width:n,height:r,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),N.createElement("title",null,c),N.createElement("desc",null,l),e)}var Dme=["children","className"];function BA(){return BA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Lme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Yt=N.forwardRef(function(t,e){var n=t.children,r=t.className,i=$me(t,Dme),o=Mt("recharts-layer",r);return N.createElement("g",BA({className:o},rt(i,!0),{ref:e}),n)}),ts=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;oi?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=r?t:Ume(t,e,n)}var zme=Hme,Gme="\\ud800-\\udfff",Vme="\\u0300-\\u036f",Kme="\\ufe20-\\ufe2f",Wme="\\u20d0-\\u20ff",qme=Vme+Kme+Wme,Yme="\\ufe0e\\ufe0f",Qme="\\u200d",Xme=RegExp("["+Qme+Gme+qme+Yme+"]");function Jme(t){return Xme.test(t)}var $G=Jme;function Zme(t){return t.split("")}var ege=Zme,LG="\\ud800-\\udfff",tge="\\u0300-\\u036f",nge="\\ufe20-\\ufe2f",rge="\\u20d0-\\u20ff",ige=tge+nge+rge,oge="\\ufe0e\\ufe0f",sge="["+LG+"]",UA="["+ige+"]",HA="\\ud83c[\\udffb-\\udfff]",age="(?:"+UA+"|"+HA+")",FG="[^"+LG+"]",BG="(?:\\ud83c[\\udde6-\\uddff]){2}",UG="[\\ud800-\\udbff][\\udc00-\\udfff]",cge="\\u200d",HG=age+"?",zG="["+oge+"]?",lge="(?:"+cge+"(?:"+[FG,BG,UG].join("|")+")"+zG+HG+")*",uge=zG+HG+lge,dge="(?:"+[FG+UA+"?",UA,BG,UG,sge].join("|")+")",fge=RegExp(HA+"(?="+HA+")|"+dge+uge,"g");function hge(t){return t.match(fge)||[]}var pge=hge,mge=ege,gge=$G,vge=pge;function yge(t){return gge(t)?vge(t):mge(t)}var xge=yge,bge=zme,wge=$G,Sge=xge,Cge=PG;function _ge(t){return function(e){e=Cge(e);var n=wge(e)?Sge(e):void 0,r=n?n[0]:e.charAt(0),i=n?bge(n,1).join(""):e.slice(1);return r[t]()+i}}var Age=_ge,jge=Age,Ege=jge("toUpperCase"),Tge=Ege;const _w=un(Tge);function Pn(t){return function(){return t}}const GG=Math.cos,Vx=Math.sin,ms=Math.sqrt,Kx=Math.PI,Aw=2*Kx,zA=Math.PI,GA=2*zA,_l=1e-6,Nge=GA-_l;function VG(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return VG;const n=10**e;return function(r){this._+=r[0];for(let i=1,o=r.length;i_l)if(!(Math.abs(f*l-u*d)>_l)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-s,g=i-c,m=l*l+u*u,y=p*p+g*g,b=Math.sqrt(m),x=Math.sqrt(h),w=o*Math.tan((zA-Math.acos((m+h-y)/(2*b*x)))/2),S=w/x,C=w/b;Math.abs(S-1)>_l&&this._append`L${e+S*d},${n+S*f}`,this._append`A${o},${o},0,0,${+(f*p>d*g)},${this._x1=e+C*l},${this._y1=n+C*u}`}}arc(e,n,r,i,o,s){if(e=+e,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(i),l=r*Math.sin(i),u=e+c,d=n+l,f=1^s,h=s?i-o:o-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>_l||Math.abs(this._y1-d)>_l)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%GA+GA),h>Nge?this._append`A${r},${r},0,1,${f},${e-c},${n-l}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>_l&&this._append`A${r},${r},0,${+(h>=zA)},${f},${this._x1=e+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function aP(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new kge(e)}function cP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function KG(t){this._context=t}KG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function jw(t){return new KG(t)}function WG(t){return t[0]}function qG(t){return t[1]}function YG(t,e){var n=Pn(!0),r=null,i=jw,o=null,s=aP(c);t=typeof t=="function"?t:t===void 0?WG:Pn(t),e=typeof e=="function"?e:e===void 0?qG:Pn(e);function c(l){var u,d=(l=cP(l)).length,f,h=!1,p;for(r==null&&(o=i(p=s())),u=0;u<=d;++u)!(u=p;--g)c.point(w[g],S[g]);c.lineEnd(),c.areaEnd()}b&&(w[h]=+t(y,h,f),S[h]=+e(y,h,f),c.point(r?+r(y,h,f):w[h],n?+n(y,h,f):S[h]))}if(x)return c=null,x+""||null}function d(){return YG().defined(i).curve(s).context(o)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:Pn(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Pn(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Pn(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:Pn(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Pn(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Pn(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Pn(!!f),u):i},u.curve=function(f){return arguments.length?(s=f,o!=null&&(c=s(o)),u):s},u.context=function(f){return arguments.length?(f==null?o=c=null:c=s(o=f),u):o},u}class QG{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function Oge(t){return new QG(t,!0)}function Ige(t){return new QG(t,!1)}const lP={draw(t,e){const n=ms(e/Kx);t.moveTo(n,0),t.arc(0,0,n,0,Aw)}},Rge={draw(t,e){const n=ms(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},XG=ms(1/3),Mge=XG*2,Dge={draw(t,e){const n=ms(e/Mge),r=n*XG;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},$ge={draw(t,e){const n=ms(e),r=-n/2;t.rect(r,r,n,n)}},Lge=.8908130915292852,JG=Vx(Kx/10)/Vx(7*Kx/10),Fge=Vx(Aw/10)*JG,Bge=-GG(Aw/10)*JG,Uge={draw(t,e){const n=ms(e*Lge),r=Fge*n,i=Bge*n;t.moveTo(0,-n),t.lineTo(r,i);for(let o=1;o<5;++o){const s=Aw*o/5,c=GG(s),l=Vx(s);t.lineTo(l*n,-c*n),t.lineTo(c*r-l*i,l*r+c*i)}t.closePath()}},oC=ms(3),Hge={draw(t,e){const n=-ms(e/(oC*3));t.moveTo(0,n*2),t.lineTo(-oC*n,-n),t.lineTo(oC*n,-n),t.closePath()}},ao=-.5,co=ms(3)/2,VA=1/ms(12),zge=(VA/2+1)*3,Gge={draw(t,e){const n=ms(e/zge),r=n/2,i=n*VA,o=r,s=n*VA+n,c=-o,l=s;t.moveTo(r,i),t.lineTo(o,s),t.lineTo(c,l),t.lineTo(ao*r-co*i,co*r+ao*i),t.lineTo(ao*o-co*s,co*o+ao*s),t.lineTo(ao*c-co*l,co*c+ao*l),t.lineTo(ao*r+co*i,ao*i-co*r),t.lineTo(ao*o+co*s,ao*s-co*o),t.lineTo(ao*c+co*l,ao*l-co*c),t.closePath()}};function Vge(t,e){let n=null,r=aP(i);t=typeof t=="function"?t:Pn(t||lP),e=typeof e=="function"?e:Pn(e===void 0?64:+e);function i(){let o;if(n||(n=o=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:Pn(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:Pn(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function Wx(){}function qx(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function ZG(t){this._context=t}ZG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:qx(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Kge(t){return new ZG(t)}function eV(t){this._context=t}eV.prototype={areaStart:Wx,areaEnd:Wx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Wge(t){return new eV(t)}function tV(t){this._context=t}tV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function qge(t){return new tV(t)}function nV(t){this._context=t}nV.prototype={areaStart:Wx,areaEnd:Wx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Yge(t){return new nV(t)}function zR(t){return t<0?-1:1}function GR(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),s=(n-t._y1)/(i||r<0&&-0),c=(o*i+s*r)/(r+i);return(zR(o)+zR(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(c))||0}function VR(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function sC(t,e,n){var r=t._x0,i=t._y0,o=t._x1,s=t._y1,c=(o-r)/3;t._context.bezierCurveTo(r+c,i+c*e,o-c,s-c*n,o,s)}function Yx(t){this._context=t}Yx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sC(this,this._t0,VR(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,sC(this,VR(this,n=GR(this,t,e)),n);break;default:sC(this,this._t0,n=GR(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function rV(t){this._context=new iV(t)}(rV.prototype=Object.create(Yx.prototype)).point=function(t,e){Yx.prototype.point.call(this,e,t)};function iV(t){this._context=t}iV.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}};function Qge(t){return new Yx(t)}function Xge(t){return new rV(t)}function oV(t){this._context=t}oV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=KR(t),i=KR(e),o=0,s=1;s=0;--e)i[e]=(s[e]-i[e+1])/o[e];for(o[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Zge(t){return new Ew(t,.5)}function eve(t){return new Ew(t,0)}function tve(t){return new Ew(t,1)}function rf(t,e){if((s=t.length)>1)for(var n=1,r,i,o=t[e[0]],s,c=o.length;n=0;)n[e]=e;return n}function nve(t,e){return t[e]}function rve(t){const e=[];return e.key=t,e}function ive(){var t=Pn([]),e=KA,n=rf,r=nve;function i(o){var s=Array.from(t.apply(this,arguments),rve),c,l=s.length,u=-1,d;for(const f of o)for(c=0,++u;c0){for(var n,r,i=0,o=t[0].length,s;i0){for(var n=0,r=t[e[0]],i,o=r.length;n0)||!((o=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,o,s;r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hve(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var sV={symbolCircle:lP,symbolCross:Rge,symbolDiamond:Dge,symbolSquare:$ge,symbolStar:Uge,symbolTriangle:Hge,symbolWye:Gge},pve=Math.PI/180,mve=function(e){var n="symbol".concat(_w(e));return sV[n]||lP},gve=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*pve;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},vve=function(e,n){sV["symbol".concat(_w(e))]=n},uP=function(e){var n=e.type,r=n===void 0?"circle":n,i=e.size,o=i===void 0?64:i,s=e.sizeType,c=s===void 0?"area":s,l=fve(e,cve),u=qR(qR({},l),{},{type:r,size:o,sizeType:c}),d=function(){var y=mve(r),b=Vge().type(y).size(gve(o,c,r));return b()},f=u.className,h=u.cx,p=u.cy,g=rt(u,!0);return h===+h&&p===+p&&o===+o?N.createElement("path",WA({},g,{className:Mt("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};uP.registerSymbol=vve;function of(t){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(t)}function qA(){return qA=Object.assign?Object.assign.bind():function(t){for(var e=1;e0?1:-1},$l=function(e){return Pg(e)&&e.indexOf("%")===e.length-1},Ae=function(e){return mme(e)&&!eh(e)},Er=function(e){return Ae(e)||Pg(e)},xme=0,th=function(e){var n=++xme;return"".concat(e||"").concat(n)},gi=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ae(e)&&!Pg(e))return r;var o;if($l(e)){var s=e.indexOf("%");o=n*parseFloat(e.slice(0,s))/100}else o=+e;return eh(o)&&(o=r),i&&o>n&&(o=n),o},fc=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},bme=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function jme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function DA(t){"@babel/helpers - typeof";return DA=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},DA(t)}var LR={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},ja=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},FR=null,iC=null,sP=function t(e){if(e===FR&&Array.isArray(iC))return iC;var n=[];return v.Children.forEach(e,function(r){Dt(r)||(MG.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),iC=n,FR=e,n};function jo(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(i){return ja(i)}):r=[ja(e)],sP(t).forEach(function(i){var o=to(i,"type.displayName")||to(i,"type.name");r.indexOf(o)!==-1&&n.push(i)}),n}function Ki(t,e){var n=jo(t,e);return n&&n[0]}var BR=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!Ae(r)||r<=0||!Ae(i)||i<=0)},Eme=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Tme=function(e){return e&&e.type&&Pg(e.type)&&Eme.indexOf(e.type)>=0},Nme=function(e){return e&&DA(e)==="object"&&"clipDot"in e},Pme=function(e,n,r,i){var o,s=(o=rC==null?void 0:rC[i])!==null&&o!==void 0?o:[];return!Ct(e)&&(i&&s.includes(n)||Sme.includes(n))||r&&oP.includes(n)},rt=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(v.isValidElement(e)&&(i=e.props),!Qf(i))return null;var o={};return Object.keys(i).forEach(function(s){var c;Pme((c=i)===null||c===void 0?void 0:c[s],s,n,r)&&(o[s]=i[s])}),o},$A=function t(e,n){if(e===n)return!0;var r=v.Children.count(e);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return UR(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Mme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function FA(t){var e=t.children,n=t.width,r=t.height,i=t.viewBox,o=t.className,s=t.style,c=t.title,l=t.desc,u=Rme(t,Ime),d=i||{width:n,height:r,x:0,y:0},f=Mt("recharts-surface",o);return N.createElement("svg",LA({},rt(u,!0,"svg"),{className:f,width:n,height:r,style:s,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),N.createElement("title",null,c),N.createElement("desc",null,l),e)}var Dme=["children","className"];function BA(){return BA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Lme(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Yt=N.forwardRef(function(t,e){var n=t.children,r=t.className,i=$me(t,Dme),o=Mt("recharts-layer",r);return N.createElement("g",BA({className:o},rt(i,!0),{ref:e}),n)}),ts=function(e,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;oi?0:i+e),n=n>i?i:n,n<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var o=Array(i);++r=r?t:Ume(t,e,n)}var zme=Hme,Gme="\\ud800-\\udfff",Vme="\\u0300-\\u036f",Kme="\\ufe20-\\ufe2f",Wme="\\u20d0-\\u20ff",qme=Vme+Kme+Wme,Yme="\\ufe0e\\ufe0f",Qme="\\u200d",Xme=RegExp("["+Qme+Gme+qme+Yme+"]");function Jme(t){return Xme.test(t)}var $G=Jme;function Zme(t){return t.split("")}var ege=Zme,LG="\\ud800-\\udfff",tge="\\u0300-\\u036f",nge="\\ufe20-\\ufe2f",rge="\\u20d0-\\u20ff",ige=tge+nge+rge,oge="\\ufe0e\\ufe0f",sge="["+LG+"]",UA="["+ige+"]",HA="\\ud83c[\\udffb-\\udfff]",age="(?:"+UA+"|"+HA+")",FG="[^"+LG+"]",BG="(?:\\ud83c[\\udde6-\\uddff]){2}",UG="[\\ud800-\\udbff][\\udc00-\\udfff]",cge="\\u200d",HG=age+"?",zG="["+oge+"]?",lge="(?:"+cge+"(?:"+[FG,BG,UG].join("|")+")"+zG+HG+")*",uge=zG+HG+lge,dge="(?:"+[FG+UA+"?",UA,BG,UG,sge].join("|")+")",fge=RegExp(HA+"(?="+HA+")|"+dge+uge,"g");function hge(t){return t.match(fge)||[]}var pge=hge,mge=ege,gge=$G,vge=pge;function yge(t){return gge(t)?vge(t):mge(t)}var xge=yge,bge=zme,wge=$G,Sge=xge,Cge=PG;function _ge(t){return function(e){e=Cge(e);var n=wge(e)?Sge(e):void 0,r=n?n[0]:e.charAt(0),i=n?bge(n,1).join(""):e.slice(1);return r[t]()+i}}var Age=_ge,jge=Age,Ege=jge("toUpperCase"),Tge=Ege;const _w=dn(Tge);function Pn(t){return function(){return t}}const GG=Math.cos,Vx=Math.sin,ms=Math.sqrt,Kx=Math.PI,Aw=2*Kx,zA=Math.PI,GA=2*zA,_l=1e-6,Nge=GA-_l;function VG(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return VG;const n=10**e;return function(r){this._+=r[0];for(let i=1,o=r.length;i_l)if(!(Math.abs(f*l-u*d)>_l)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-s,g=i-c,m=l*l+u*u,y=p*p+g*g,b=Math.sqrt(m),x=Math.sqrt(h),w=o*Math.tan((zA-Math.acos((m+h-y)/(2*b*x)))/2),S=w/x,C=w/b;Math.abs(S-1)>_l&&this._append`L${e+S*d},${n+S*f}`,this._append`A${o},${o},0,0,${+(f*p>d*g)},${this._x1=e+C*l},${this._y1=n+C*u}`}}arc(e,n,r,i,o,s){if(e=+e,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let c=r*Math.cos(i),l=r*Math.sin(i),u=e+c,d=n+l,f=1^s,h=s?i-o:o-i;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>_l||Math.abs(this._y1-d)>_l)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%GA+GA),h>Nge?this._append`A${r},${r},0,1,${f},${e-c},${n-l}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>_l&&this._append`A${r},${r},0,${+(h>=zA)},${f},${this._x1=e+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(e,n,r,i){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function aP(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new kge(e)}function cP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function KG(t){this._context=t}KG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function jw(t){return new KG(t)}function WG(t){return t[0]}function qG(t){return t[1]}function YG(t,e){var n=Pn(!0),r=null,i=jw,o=null,s=aP(c);t=typeof t=="function"?t:t===void 0?WG:Pn(t),e=typeof e=="function"?e:e===void 0?qG:Pn(e);function c(l){var u,d=(l=cP(l)).length,f,h=!1,p;for(r==null&&(o=i(p=s())),u=0;u<=d;++u)!(u=p;--g)c.point(w[g],S[g]);c.lineEnd(),c.areaEnd()}b&&(w[h]=+t(y,h,f),S[h]=+e(y,h,f),c.point(r?+r(y,h,f):w[h],n?+n(y,h,f):S[h]))}if(x)return c=null,x+""||null}function d(){return YG().defined(i).curve(s).context(o)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:Pn(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Pn(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Pn(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:Pn(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Pn(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Pn(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(t).y(e)},u.lineY1=function(){return d().x(t).y(n)},u.lineX1=function(){return d().x(r).y(e)},u.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Pn(!!f),u):i},u.curve=function(f){return arguments.length?(s=f,o!=null&&(c=s(o)),u):s},u.context=function(f){return arguments.length?(f==null?o=c=null:c=s(o=f),u):o},u}class QG{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function Oge(t){return new QG(t,!0)}function Ige(t){return new QG(t,!1)}const lP={draw(t,e){const n=ms(e/Kx);t.moveTo(n,0),t.arc(0,0,n,0,Aw)}},Rge={draw(t,e){const n=ms(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},XG=ms(1/3),Mge=XG*2,Dge={draw(t,e){const n=ms(e/Mge),r=n*XG;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},$ge={draw(t,e){const n=ms(e),r=-n/2;t.rect(r,r,n,n)}},Lge=.8908130915292852,JG=Vx(Kx/10)/Vx(7*Kx/10),Fge=Vx(Aw/10)*JG,Bge=-GG(Aw/10)*JG,Uge={draw(t,e){const n=ms(e*Lge),r=Fge*n,i=Bge*n;t.moveTo(0,-n),t.lineTo(r,i);for(let o=1;o<5;++o){const s=Aw*o/5,c=GG(s),l=Vx(s);t.lineTo(l*n,-c*n),t.lineTo(c*r-l*i,l*r+c*i)}t.closePath()}},oC=ms(3),Hge={draw(t,e){const n=-ms(e/(oC*3));t.moveTo(0,n*2),t.lineTo(-oC*n,-n),t.lineTo(oC*n,-n),t.closePath()}},ao=-.5,co=ms(3)/2,VA=1/ms(12),zge=(VA/2+1)*3,Gge={draw(t,e){const n=ms(e/zge),r=n/2,i=n*VA,o=r,s=n*VA+n,c=-o,l=s;t.moveTo(r,i),t.lineTo(o,s),t.lineTo(c,l),t.lineTo(ao*r-co*i,co*r+ao*i),t.lineTo(ao*o-co*s,co*o+ao*s),t.lineTo(ao*c-co*l,co*c+ao*l),t.lineTo(ao*r+co*i,ao*i-co*r),t.lineTo(ao*o+co*s,ao*s-co*o),t.lineTo(ao*c+co*l,ao*l-co*c),t.closePath()}};function Vge(t,e){let n=null,r=aP(i);t=typeof t=="function"?t:Pn(t||lP),e=typeof e=="function"?e:Pn(e===void 0?64:+e);function i(){let o;if(n||(n=o=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(t=typeof o=="function"?o:Pn(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:Pn(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function Wx(){}function qx(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function ZG(t){this._context=t}ZG.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:qx(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Kge(t){return new ZG(t)}function eV(t){this._context=t}eV.prototype={areaStart:Wx,areaEnd:Wx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Wge(t){return new eV(t)}function tV(t){this._context=t}tV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:qx(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function qge(t){return new tV(t)}function nV(t){this._context=t}nV.prototype={areaStart:Wx,areaEnd:Wx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function Yge(t){return new nV(t)}function zR(t){return t<0?-1:1}function GR(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),s=(n-t._y1)/(i||r<0&&-0),c=(o*i+s*r)/(r+i);return(zR(o)+zR(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(c))||0}function VR(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function sC(t,e,n){var r=t._x0,i=t._y0,o=t._x1,s=t._y1,c=(o-r)/3;t._context.bezierCurveTo(r+c,i+c*e,o-c,s-c*n,o,s)}function Yx(t){this._context=t}Yx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:sC(this,this._t0,VR(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,sC(this,VR(this,n=GR(this,t,e)),n);break;default:sC(this,this._t0,n=GR(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function rV(t){this._context=new iV(t)}(rV.prototype=Object.create(Yx.prototype)).point=function(t,e){Yx.prototype.point.call(this,e,t)};function iV(t){this._context=t}iV.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}};function Qge(t){return new Yx(t)}function Xge(t){return new rV(t)}function oV(t){this._context=t}oV.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=KR(t),i=KR(e),o=0,s=1;s=0;--e)i[e]=(s[e]-i[e+1])/o[e];for(o[n-1]=(t[n]+i[n-1])/2,e=0;e=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function Zge(t){return new Ew(t,.5)}function eve(t){return new Ew(t,0)}function tve(t){return new Ew(t,1)}function rf(t,e){if((s=t.length)>1)for(var n=1,r,i,o=t[e[0]],s,c=o.length;n=0;)n[e]=e;return n}function nve(t,e){return t[e]}function rve(t){const e=[];return e.key=t,e}function ive(){var t=Pn([]),e=KA,n=rf,r=nve;function i(o){var s=Array.from(t.apply(this,arguments),rve),c,l=s.length,u=-1,d;for(const f of o)for(c=0,++u;c0){for(var n,r,i=0,o=t[0].length,s;i0){for(var n=0,r=t[e[0]],i,o=r.length;n0)||!((o=(i=t[e[0]]).length)>0))){for(var n=0,r=1,i,o,s;r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hve(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var sV={symbolCircle:lP,symbolCross:Rge,symbolDiamond:Dge,symbolSquare:$ge,symbolStar:Uge,symbolTriangle:Hge,symbolWye:Gge},pve=Math.PI/180,mve=function(e){var n="symbol".concat(_w(e));return sV[n]||lP},gve=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var i=18*pve;return 1.25*e*e*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},vve=function(e,n){sV["symbol".concat(_w(e))]=n},uP=function(e){var n=e.type,r=n===void 0?"circle":n,i=e.size,o=i===void 0?64:i,s=e.sizeType,c=s===void 0?"area":s,l=fve(e,cve),u=qR(qR({},l),{},{type:r,size:o,sizeType:c}),d=function(){var y=mve(r),b=Vge().type(y).size(gve(o,c,r));return b()},f=u.className,h=u.cx,p=u.cy,g=rt(u,!0);return h===+h&&p===+p&&o===+o?N.createElement("path",WA({},g,{className:Mt("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};uP.registerSymbol=vve;function of(t){"@babel/helpers - typeof";return of=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(t)}function qA(){return qA=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var x=p.inactive?u:p.color;return N.createElement("li",qA({className:y,style:f,key:"legend-item-".concat(g)},bu(r.props,p,g)),N.createElement(FA,{width:s,height:s,viewBox:d,style:h},r.renderIcon(p)),N.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,i=r.payload,o=r.layout,s=r.align;if(!i||!i.length)return null;var c={padding:0,margin:0,textAlign:o==="horizontal"?s:"left"};return N.createElement("ul",{className:"recharts-default-legend",style:c},this.renderItems())}}])}(v.PureComponent);Sm(dP,"displayName","Legend");Sm(dP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Eve=dw;function Tve(){this.__data__=new Eve,this.size=0}var Nve=Tve;function Pve(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var kve=Pve;function Ove(t){return this.__data__.get(t)}var Ive=Ove;function Rve(t){return this.__data__.has(t)}var Mve=Rve,Dve=dw,$ve=JN,Lve=ZN,Fve=200;function Bve(t,e){var n=this.__data__;if(n instanceof Dve){var r=n.__data__;if(!$ve||r.lengthc))return!1;var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var f=-1,h=!0,p=n&cye?new iye:void 0;for(o.set(t,e),o.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=fxe}var mP=hxe,pxe=Wa,mxe=mP,gxe=qa,vxe="[object Arguments]",yxe="[object Array]",xxe="[object Boolean]",bxe="[object Date]",wxe="[object Error]",Sxe="[object Function]",Cxe="[object Map]",_xe="[object Number]",Axe="[object Object]",jxe="[object RegExp]",Exe="[object Set]",Txe="[object String]",Nxe="[object WeakMap]",Pxe="[object ArrayBuffer]",kxe="[object DataView]",Oxe="[object Float32Array]",Ixe="[object Float64Array]",Rxe="[object Int8Array]",Mxe="[object Int16Array]",Dxe="[object Int32Array]",$xe="[object Uint8Array]",Lxe="[object Uint8ClampedArray]",Fxe="[object Uint16Array]",Bxe="[object Uint32Array]",Rn={};Rn[Oxe]=Rn[Ixe]=Rn[Rxe]=Rn[Mxe]=Rn[Dxe]=Rn[$xe]=Rn[Lxe]=Rn[Fxe]=Rn[Bxe]=!0;Rn[vxe]=Rn[yxe]=Rn[Pxe]=Rn[xxe]=Rn[kxe]=Rn[bxe]=Rn[wxe]=Rn[Sxe]=Rn[Cxe]=Rn[_xe]=Rn[Axe]=Rn[jxe]=Rn[Exe]=Rn[Txe]=Rn[Nxe]=!1;function Uxe(t){return gxe(t)&&mxe(t.length)&&!!Rn[pxe(t)]}var Hxe=Uxe;function zxe(t){return function(e){return t(e)}}var vV=zxe,Zx={exports:{}};Zx.exports;(function(t,e){var n=_G,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,c=function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}}();t.exports=c})(Zx,Zx.exports);var Gxe=Zx.exports,Vxe=Hxe,Kxe=vV,t2=Gxe,n2=t2&&t2.isTypedArray,Wxe=n2?Kxe(n2):Vxe,yV=Wxe,qxe=Xye,Yxe=hP,Qxe=Bi,Xxe=gV,Jxe=pP,Zxe=yV,ebe=Object.prototype,tbe=ebe.hasOwnProperty;function nbe(t,e){var n=Qxe(t),r=!n&&Yxe(t),i=!n&&!r&&Xxe(t),o=!n&&!r&&!i&&Zxe(t),s=n||r||i||o,c=s?qxe(t.length,String):[],l=c.length;for(var u in t)(e||tbe.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Jxe(u,l)))&&c.push(u);return c}var rbe=nbe,ibe=Object.prototype;function obe(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||ibe;return t===n}var sbe=obe;function abe(t,e){return function(n){return t(e(n))}}var xV=abe,cbe=xV,lbe=cbe(Object.keys,Object),ube=lbe,dbe=sbe,fbe=ube,hbe=Object.prototype,pbe=hbe.hasOwnProperty;function mbe(t){if(!dbe(t))return fbe(t);var e=[];for(var n in Object(t))pbe.call(t,n)&&n!="constructor"&&e.push(n);return e}var gbe=mbe,vbe=QN,ybe=mP;function xbe(t){return t!=null&&ybe(t.length)&&!vbe(t)}var kg=xbe,bbe=rbe,wbe=gbe,Sbe=kg;function Cbe(t){return Sbe(t)?bbe(t):wbe(t)}var Tw=Cbe,_be=Fye,Abe=Yye,jbe=Tw;function Ebe(t){return _be(t,jbe,Abe)}var Tbe=Ebe,r2=Tbe,Nbe=1,Pbe=Object.prototype,kbe=Pbe.hasOwnProperty;function Obe(t,e,n,r,i,o){var s=n&Nbe,c=r2(t),l=c.length,u=r2(e),d=u.length;if(l!=d&&!s)return!1;for(var f=l;f--;){var h=c[f];if(!(s?h in e:kbe.call(e,h)))return!1}var p=o.get(t),g=o.get(e);if(p&&g)return p==e&&g==t;var m=!0;o.set(t,e),o.set(e,t);for(var y=s;++f-1}var Pwe=Nwe;function kwe(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=Kwe){var u=e?null:Gwe(t);if(u)return Vwe(u);s=!1,i=zwe,l=new Bwe}else l=e?[]:c;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function cSe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function lSe(t){return t.value}function uSe(t,e){if(N.isValidElement(t))return N.cloneElement(t,e);if(typeof t=="function")return N.createElement(t,e);e.ref;var n=aSe(e,Zwe);return N.createElement(dP,n)}var x2=1,Ea=function(t){function e(){var n;eSe(this,e);for(var r=arguments.length,i=new Array(r),o=0;ox2||Math.abs(i.height-this.lastBoundingBox.height)>x2)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?sa({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,o=i.layout,s=i.align,c=i.verticalAlign,l=i.margin,u=i.chartWidth,d=i.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(s==="center"&&o==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(c==="middle"){var g=this.getBBoxSnapshot();h={top:((d||0)-g.height)/2}}else h=c==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return sa(sa({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,o=i.content,s=i.width,c=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=sa(sa({position:"absolute",width:s||"auto",height:c||"auto"},this.getDefaultPosition(l)),l);return N.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},uSe(o,sa(sa({},this.props),{},{payload:jV(d,u,lSe)})))}}],[{key:"getWithHeight",value:function(r,i){var o=sa(sa({},this.defaultProps),r.props),s=o.layout;return s==="vertical"&&Ae(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])}(v.PureComponent);Nw(Ea,"displayName","Legend");Nw(Ea,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var b2=Ng,dSe=hP,fSe=Bi,w2=b2?b2.isConcatSpreadable:void 0;function hSe(t){return fSe(t)||dSe(t)||!!(w2&&t&&t[w2])}var pSe=hSe,mSe=pV,gSe=pSe;function NV(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=gSe),i||(i=[]);++o0&&n(c)?e>1?NV(c,e-1,n,r,i):mSe(i,c):r||(i[i.length]=c)}return i}var PV=NV;function vSe(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),c=s.length;c--;){var l=s[t?c:++i];if(n(o[l],l,o)===!1)break}return e}}var ySe=vSe,xSe=ySe,bSe=xSe(),wSe=bSe,SSe=wSe,CSe=Tw;function _Se(t,e){return t&&SSe(t,e,CSe)}var kV=_Se,ASe=kg;function jSe(t,e){return function(n,r){if(n==null)return n;if(!ASe(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Object(n);(e?o--:++oe||o&&s&&l&&!c&&!u||r&&s&&l||!n&&l||!i)return 1;if(!r&&!o&&!u&&t=c)return l;var u=n[r];return l*(u=="desc"?-1:1)}}return t.index-e.index}var BSe=FSe,uC=tP,USe=nP,HSe=ea,zSe=OV,GSe=MSe,VSe=vV,KSe=BSe,WSe=ih,qSe=Bi;function YSe(t,e,n){e.length?e=uC(e,function(o){return qSe(o)?function(s){return USe(s,o.length===1?o[0]:o)}:o}):e=[WSe];var r=-1;e=uC(e,VSe(HSe));var i=zSe(t,function(o,s,c){var l=uC(e,function(u){return u(o)});return{criteria:l,index:++r,value:o}});return GSe(i,function(o,s){return KSe(o,s,n)})}var QSe=YSe;function XSe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var JSe=XSe,ZSe=JSe,C2=Math.max;function eCe(t,e,n){return e=C2(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=C2(r.length-e,0),s=Array(o);++i0){if(++e>=uCe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var pCe=hCe,mCe=lCe,gCe=pCe,vCe=gCe(mCe),yCe=vCe,xCe=ih,bCe=tCe,wCe=yCe;function SCe(t,e){return wCe(bCe(t,e,xCe),t+"")}var CCe=SCe,_Ce=XN,ACe=kg,jCe=pP,ECe=fl;function TCe(t,e,n){if(!ECe(n))return!1;var r=typeof e;return(r=="number"?ACe(n)&&jCe(e,n.length):r=="string"&&e in n)?_Ce(n[e],t):!1}var Pw=TCe,NCe=PV,PCe=QSe,kCe=CCe,A2=Pw,OCe=kCe(function(t,e){if(t==null)return[];var n=e.length;return n>1&&A2(t,e[0],e[1])?e=[]:n>2&&A2(e[0],e[1],e[2])&&(e=[e[0]]),PCe(t,NCe(e,1),[])}),ICe=OCe;const yP=un(ICe);function Cm(t){"@babel/helpers - typeof";return Cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cm(t)}function n1(){return n1=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e.x),"".concat(Nh,"-left"),Ae(n)&&e&&Ae(e.x)&&n=e.y),"".concat(Nh,"-top"),Ae(r)&&e&&Ae(e.y)&&rm?Math.max(d,l[r]):Math.max(f,l[r])}function qCe(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function YCe(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,i=t.position,o=t.reverseDirection,s=t.tooltipBox,c=t.useTranslate3d,l=t.viewBox,u,d,f;return s.height>0&&s.width>0&&n?(d=T2({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=T2({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=qCe({translateX:d,translateY:f,useTranslate3d:c})):u=KCe,{cssProperties:u,cssClasses:WCe({translateX:d,translateY:f,coordinate:n})}}function af(t){"@babel/helpers - typeof";return af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},af(t)}function N2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function P2(t){for(var e=1;ek2||Math.abs(r.height-this.state.lastBoundingBox.height)>k2)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,o=i.active,s=i.allowEscapeViewBox,c=i.animationDuration,l=i.animationEasing,u=i.children,d=i.coordinate,f=i.hasPayload,h=i.isAnimationActive,p=i.offset,g=i.position,m=i.reverseDirection,y=i.useTranslate3d,b=i.viewBox,x=i.wrapperStyle,w=YCe({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:b}),S=w.cssClasses,C=w.cssProperties,_=P2(P2({transition:h&&o?"transform ".concat(c,"ms ").concat(l):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&f?"visible":"hidden",position:"absolute",top:0,left:0},x);return N.createElement("div",{tabIndex:-1,className:S,style:_,ref:function(j){r.wrapperNode=j}},u)}}])}(v.PureComponent),o_e=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ns={isSsr:o_e(),get:function(e){return ns[e]},set:function(e,n){if(typeof e=="string")ns[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(i){ns[i]=e[i]})}}};function cf(t){"@babel/helpers - typeof";return cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cf(t)}function O2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function I2(t){for(var e=1;e0;return N.createElement(i_e,{allowEscapeViewBox:s,animationDuration:c,animationEasing:l,isAnimationActive:h,active:o,coordinate:d,hasPayload:_,offset:p,position:y,reverseDirection:b,useTranslate3d:x,viewBox:w,wrapperStyle:S},m_e(u,I2(I2({},this.props),{},{payload:C})))}}])}(v.PureComponent);xP(ei,"displayName","Tooltip");xP(ei,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ns.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var g_e=Zs,v_e=function(){return g_e.Date.now()},y_e=v_e,x_e=/\s/;function b_e(t){for(var e=t.length;e--&&x_e.test(t.charAt(e)););return e}var w_e=b_e,S_e=w_e,C_e=/^\s+/;function __e(t){return t&&t.slice(0,S_e(t)+1).replace(C_e,"")}var A_e=__e,j_e=A_e,R2=fl,E_e=Yf,M2=NaN,T_e=/^[-+]0x[0-9a-f]+$/i,N_e=/^0b[01]+$/i,P_e=/^0o[0-7]+$/i,k_e=parseInt;function O_e(t){if(typeof t=="number")return t;if(E_e(t))return M2;if(R2(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=R2(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=j_e(t);var n=N_e.test(t);return n||P_e.test(t)?k_e(t.slice(2),n?2:8):T_e.test(t)?M2:+t}var LV=O_e,I_e=fl,fC=y_e,D2=LV,R_e="Expected a function",M_e=Math.max,D_e=Math.min;function $_e(t,e,n){var r,i,o,s,c,l,u=0,d=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(R_e);e=D2(e)||0,I_e(n)&&(d=!!n.leading,f="maxWait"in n,o=f?M_e(D2(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function p(_){var A=r,j=i;return r=i=void 0,u=_,s=t.apply(j,A),s}function g(_){return u=_,c=setTimeout(b,e),d?p(_):s}function m(_){var A=_-l,j=_-u,P=e-A;return f?D_e(P,o-j):P}function y(_){var A=_-l,j=_-u;return l===void 0||A>=e||A<0||f&&j>=o}function b(){var _=fC();if(y(_))return x(_);c=setTimeout(b,m(_))}function x(_){return c=void 0,h&&r?p(_):(r=i=void 0,s)}function w(){c!==void 0&&clearTimeout(c),u=0,r=l=i=c=void 0}function S(){return c===void 0?s:x(fC())}function C(){var _=fC(),A=y(_);if(r=arguments,i=this,l=_,A){if(c===void 0)return g(l);if(f)return clearTimeout(c),c=setTimeout(b,e),p(l)}return c===void 0&&(c=setTimeout(b,e)),s}return C.cancel=w,C.flush=S,C}var L_e=$_e,F_e=L_e,B_e=fl,U_e="Expected a function";function H_e(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(U_e);return B_e(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),F_e(t,e,{leading:r,maxWait:e,trailing:i})}var z_e=H_e;const FV=un(z_e);function Am(t){"@babel/helpers - typeof";return Am=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Am(t)}function $2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Cv(t){for(var e=1;e`);var x=p.inactive?u:p.color;return N.createElement("li",qA({className:y,style:f,key:"legend-item-".concat(g)},bu(r.props,p,g)),N.createElement(FA,{width:s,height:s,viewBox:d,style:h},r.renderIcon(p)),N.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,i=r.payload,o=r.layout,s=r.align;if(!i||!i.length)return null;var c={padding:0,margin:0,textAlign:o==="horizontal"?s:"left"};return N.createElement("ul",{className:"recharts-default-legend",style:c},this.renderItems())}}])}(v.PureComponent);Sm(dP,"displayName","Legend");Sm(dP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var Eve=dw;function Tve(){this.__data__=new Eve,this.size=0}var Nve=Tve;function Pve(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var kve=Pve;function Ove(t){return this.__data__.get(t)}var Ive=Ove;function Rve(t){return this.__data__.has(t)}var Mve=Rve,Dve=dw,$ve=JN,Lve=ZN,Fve=200;function Bve(t,e){var n=this.__data__;if(n instanceof Dve){var r=n.__data__;if(!$ve||r.lengthc))return!1;var u=o.get(t),d=o.get(e);if(u&&d)return u==e&&d==t;var f=-1,h=!0,p=n&cye?new iye:void 0;for(o.set(t,e),o.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=fxe}var mP=hxe,pxe=Wa,mxe=mP,gxe=qa,vxe="[object Arguments]",yxe="[object Array]",xxe="[object Boolean]",bxe="[object Date]",wxe="[object Error]",Sxe="[object Function]",Cxe="[object Map]",_xe="[object Number]",Axe="[object Object]",jxe="[object RegExp]",Exe="[object Set]",Txe="[object String]",Nxe="[object WeakMap]",Pxe="[object ArrayBuffer]",kxe="[object DataView]",Oxe="[object Float32Array]",Ixe="[object Float64Array]",Rxe="[object Int8Array]",Mxe="[object Int16Array]",Dxe="[object Int32Array]",$xe="[object Uint8Array]",Lxe="[object Uint8ClampedArray]",Fxe="[object Uint16Array]",Bxe="[object Uint32Array]",Mn={};Mn[Oxe]=Mn[Ixe]=Mn[Rxe]=Mn[Mxe]=Mn[Dxe]=Mn[$xe]=Mn[Lxe]=Mn[Fxe]=Mn[Bxe]=!0;Mn[vxe]=Mn[yxe]=Mn[Pxe]=Mn[xxe]=Mn[kxe]=Mn[bxe]=Mn[wxe]=Mn[Sxe]=Mn[Cxe]=Mn[_xe]=Mn[Axe]=Mn[jxe]=Mn[Exe]=Mn[Txe]=Mn[Nxe]=!1;function Uxe(t){return gxe(t)&&mxe(t.length)&&!!Mn[pxe(t)]}var Hxe=Uxe;function zxe(t){return function(e){return t(e)}}var vV=zxe,Zx={exports:{}};Zx.exports;(function(t,e){var n=_G,r=e&&!e.nodeType&&e,i=r&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===r,s=o&&n.process,c=function(){try{var l=i&&i.require&&i.require("util").types;return l||s&&s.binding&&s.binding("util")}catch{}}();t.exports=c})(Zx,Zx.exports);var Gxe=Zx.exports,Vxe=Hxe,Kxe=vV,t2=Gxe,n2=t2&&t2.isTypedArray,Wxe=n2?Kxe(n2):Vxe,yV=Wxe,qxe=Xye,Yxe=hP,Qxe=Bi,Xxe=gV,Jxe=pP,Zxe=yV,ebe=Object.prototype,tbe=ebe.hasOwnProperty;function nbe(t,e){var n=Qxe(t),r=!n&&Yxe(t),i=!n&&!r&&Xxe(t),o=!n&&!r&&!i&&Zxe(t),s=n||r||i||o,c=s?qxe(t.length,String):[],l=c.length;for(var u in t)(e||tbe.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||Jxe(u,l)))&&c.push(u);return c}var rbe=nbe,ibe=Object.prototype;function obe(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||ibe;return t===n}var sbe=obe;function abe(t,e){return function(n){return t(e(n))}}var xV=abe,cbe=xV,lbe=cbe(Object.keys,Object),ube=lbe,dbe=sbe,fbe=ube,hbe=Object.prototype,pbe=hbe.hasOwnProperty;function mbe(t){if(!dbe(t))return fbe(t);var e=[];for(var n in Object(t))pbe.call(t,n)&&n!="constructor"&&e.push(n);return e}var gbe=mbe,vbe=QN,ybe=mP;function xbe(t){return t!=null&&ybe(t.length)&&!vbe(t)}var kg=xbe,bbe=rbe,wbe=gbe,Sbe=kg;function Cbe(t){return Sbe(t)?bbe(t):wbe(t)}var Tw=Cbe,_be=Fye,Abe=Yye,jbe=Tw;function Ebe(t){return _be(t,jbe,Abe)}var Tbe=Ebe,r2=Tbe,Nbe=1,Pbe=Object.prototype,kbe=Pbe.hasOwnProperty;function Obe(t,e,n,r,i,o){var s=n&Nbe,c=r2(t),l=c.length,u=r2(e),d=u.length;if(l!=d&&!s)return!1;for(var f=l;f--;){var h=c[f];if(!(s?h in e:kbe.call(e,h)))return!1}var p=o.get(t),g=o.get(e);if(p&&g)return p==e&&g==t;var m=!0;o.set(t,e),o.set(e,t);for(var y=s;++f-1}var Pwe=Nwe;function kwe(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=Kwe){var u=e?null:Gwe(t);if(u)return Vwe(u);s=!1,i=zwe,l=new Bwe}else l=e?[]:c;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function cSe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function lSe(t){return t.value}function uSe(t,e){if(N.isValidElement(t))return N.cloneElement(t,e);if(typeof t=="function")return N.createElement(t,e);e.ref;var n=aSe(e,Zwe);return N.createElement(dP,n)}var x2=1,Ea=function(t){function e(){var n;eSe(this,e);for(var r=arguments.length,i=new Array(r),o=0;ox2||Math.abs(i.height-this.lastBoundingBox.height)>x2)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?sa({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,o=i.layout,s=i.align,c=i.verticalAlign,l=i.margin,u=i.chartWidth,d=i.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(s==="center"&&o==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=s==="right"?{right:l&&l.right||0}:{left:l&&l.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(c==="middle"){var g=this.getBBoxSnapshot();h={top:((d||0)-g.height)/2}}else h=c==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return sa(sa({},f),h)}},{key:"render",value:function(){var r=this,i=this.props,o=i.content,s=i.width,c=i.height,l=i.wrapperStyle,u=i.payloadUniqBy,d=i.payload,f=sa(sa({position:"absolute",width:s||"auto",height:c||"auto"},this.getDefaultPosition(l)),l);return N.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},uSe(o,sa(sa({},this.props),{},{payload:jV(d,u,lSe)})))}}],[{key:"getWithHeight",value:function(r,i){var o=sa(sa({},this.defaultProps),r.props),s=o.layout;return s==="vertical"&&Ae(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])}(v.PureComponent);Nw(Ea,"displayName","Legend");Nw(Ea,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var b2=Ng,dSe=hP,fSe=Bi,w2=b2?b2.isConcatSpreadable:void 0;function hSe(t){return fSe(t)||dSe(t)||!!(w2&&t&&t[w2])}var pSe=hSe,mSe=pV,gSe=pSe;function NV(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=gSe),i||(i=[]);++o0&&n(c)?e>1?NV(c,e-1,n,r,i):mSe(i,c):r||(i[i.length]=c)}return i}var PV=NV;function vSe(t){return function(e,n,r){for(var i=-1,o=Object(e),s=r(e),c=s.length;c--;){var l=s[t?c:++i];if(n(o[l],l,o)===!1)break}return e}}var ySe=vSe,xSe=ySe,bSe=xSe(),wSe=bSe,SSe=wSe,CSe=Tw;function _Se(t,e){return t&&SSe(t,e,CSe)}var kV=_Se,ASe=kg;function jSe(t,e){return function(n,r){if(n==null)return n;if(!ASe(n))return t(n,r);for(var i=n.length,o=e?i:-1,s=Object(n);(e?o--:++oe||o&&s&&l&&!c&&!u||r&&s&&l||!n&&l||!i)return 1;if(!r&&!o&&!u&&t=c)return l;var u=n[r];return l*(u=="desc"?-1:1)}}return t.index-e.index}var BSe=FSe,uC=tP,USe=nP,HSe=ea,zSe=OV,GSe=MSe,VSe=vV,KSe=BSe,WSe=ih,qSe=Bi;function YSe(t,e,n){e.length?e=uC(e,function(o){return qSe(o)?function(s){return USe(s,o.length===1?o[0]:o)}:o}):e=[WSe];var r=-1;e=uC(e,VSe(HSe));var i=zSe(t,function(o,s,c){var l=uC(e,function(u){return u(o)});return{criteria:l,index:++r,value:o}});return GSe(i,function(o,s){return KSe(o,s,n)})}var QSe=YSe;function XSe(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var JSe=XSe,ZSe=JSe,C2=Math.max;function eCe(t,e,n){return e=C2(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=C2(r.length-e,0),s=Array(o);++i0){if(++e>=uCe)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var pCe=hCe,mCe=lCe,gCe=pCe,vCe=gCe(mCe),yCe=vCe,xCe=ih,bCe=tCe,wCe=yCe;function SCe(t,e){return wCe(bCe(t,e,xCe),t+"")}var CCe=SCe,_Ce=XN,ACe=kg,jCe=pP,ECe=fl;function TCe(t,e,n){if(!ECe(n))return!1;var r=typeof e;return(r=="number"?ACe(n)&&jCe(e,n.length):r=="string"&&e in n)?_Ce(n[e],t):!1}var Pw=TCe,NCe=PV,PCe=QSe,kCe=CCe,A2=Pw,OCe=kCe(function(t,e){if(t==null)return[];var n=e.length;return n>1&&A2(t,e[0],e[1])?e=[]:n>2&&A2(e[0],e[1],e[2])&&(e=[e[0]]),PCe(t,NCe(e,1),[])}),ICe=OCe;const yP=dn(ICe);function Cm(t){"@babel/helpers - typeof";return Cm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cm(t)}function n1(){return n1=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e.x),"".concat(Nh,"-left"),Ae(n)&&e&&Ae(e.x)&&n=e.y),"".concat(Nh,"-top"),Ae(r)&&e&&Ae(e.y)&&rm?Math.max(d,l[r]):Math.max(f,l[r])}function qCe(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function YCe(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,i=t.position,o=t.reverseDirection,s=t.tooltipBox,c=t.useTranslate3d,l=t.viewBox,u,d,f;return s.height>0&&s.width>0&&n?(d=T2({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=T2({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=qCe({translateX:d,translateY:f,useTranslate3d:c})):u=KCe,{cssProperties:u,cssClasses:WCe({translateX:d,translateY:f,coordinate:n})}}function af(t){"@babel/helpers - typeof";return af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},af(t)}function N2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function P2(t){for(var e=1;ek2||Math.abs(r.height-this.state.lastBoundingBox.height)>k2)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,o=i.active,s=i.allowEscapeViewBox,c=i.animationDuration,l=i.animationEasing,u=i.children,d=i.coordinate,f=i.hasPayload,h=i.isAnimationActive,p=i.offset,g=i.position,m=i.reverseDirection,y=i.useTranslate3d,b=i.viewBox,x=i.wrapperStyle,w=YCe({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:b}),S=w.cssClasses,C=w.cssProperties,_=P2(P2({transition:h&&o?"transform ".concat(c,"ms ").concat(l):void 0},C),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&f?"visible":"hidden",position:"absolute",top:0,left:0},x);return N.createElement("div",{tabIndex:-1,className:S,style:_,ref:function(j){r.wrapperNode=j}},u)}}])}(v.PureComponent),o_e=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ns={isSsr:o_e(),get:function(e){return ns[e]},set:function(e,n){if(typeof e=="string")ns[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(i){ns[i]=e[i]})}}};function cf(t){"@babel/helpers - typeof";return cf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cf(t)}function O2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function I2(t){for(var e=1;e0;return N.createElement(i_e,{allowEscapeViewBox:s,animationDuration:c,animationEasing:l,isAnimationActive:h,active:o,coordinate:d,hasPayload:_,offset:p,position:y,reverseDirection:b,useTranslate3d:x,viewBox:w,wrapperStyle:S},m_e(u,I2(I2({},this.props),{},{payload:C})))}}])}(v.PureComponent);xP(ei,"displayName","Tooltip");xP(ei,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ns.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var g_e=Zs,v_e=function(){return g_e.Date.now()},y_e=v_e,x_e=/\s/;function b_e(t){for(var e=t.length;e--&&x_e.test(t.charAt(e)););return e}var w_e=b_e,S_e=w_e,C_e=/^\s+/;function __e(t){return t&&t.slice(0,S_e(t)+1).replace(C_e,"")}var A_e=__e,j_e=A_e,R2=fl,E_e=Yf,M2=NaN,T_e=/^[-+]0x[0-9a-f]+$/i,N_e=/^0b[01]+$/i,P_e=/^0o[0-7]+$/i,k_e=parseInt;function O_e(t){if(typeof t=="number")return t;if(E_e(t))return M2;if(R2(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=R2(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=j_e(t);var n=N_e.test(t);return n||P_e.test(t)?k_e(t.slice(2),n?2:8):T_e.test(t)?M2:+t}var LV=O_e,I_e=fl,fC=y_e,D2=LV,R_e="Expected a function",M_e=Math.max,D_e=Math.min;function $_e(t,e,n){var r,i,o,s,c,l,u=0,d=!1,f=!1,h=!0;if(typeof t!="function")throw new TypeError(R_e);e=D2(e)||0,I_e(n)&&(d=!!n.leading,f="maxWait"in n,o=f?M_e(D2(n.maxWait)||0,e):o,h="trailing"in n?!!n.trailing:h);function p(_){var A=r,j=i;return r=i=void 0,u=_,s=t.apply(j,A),s}function g(_){return u=_,c=setTimeout(b,e),d?p(_):s}function m(_){var A=_-l,j=_-u,P=e-A;return f?D_e(P,o-j):P}function y(_){var A=_-l,j=_-u;return l===void 0||A>=e||A<0||f&&j>=o}function b(){var _=fC();if(y(_))return x(_);c=setTimeout(b,m(_))}function x(_){return c=void 0,h&&r?p(_):(r=i=void 0,s)}function w(){c!==void 0&&clearTimeout(c),u=0,r=l=i=c=void 0}function S(){return c===void 0?s:x(fC())}function C(){var _=fC(),A=y(_);if(r=arguments,i=this,l=_,A){if(c===void 0)return g(l);if(f)return clearTimeout(c),c=setTimeout(b,e),p(l)}return c===void 0&&(c=setTimeout(b,e)),s}return C.cancel=w,C.flush=S,C}var L_e=$_e,F_e=L_e,B_e=fl,U_e="Expected a function";function H_e(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(U_e);return B_e(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),F_e(t,e,{leading:r,maxWait:e,trailing:i})}var z_e=H_e;const FV=dn(z_e);function Am(t){"@babel/helpers - typeof";return Am=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Am(t)}function $2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Cv(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&(I=FV(I,m,{trailing:!0,leading:!1}));var D=new ResizeObserver(I),z=C.current.getBoundingClientRect(),$=z.width,G=z.height;return O($,G),D.observe(C.current),function(){D.disconnect()}},[O,m]);var E=v.useMemo(function(){var I=P.containerWidth,D=P.containerHeight;if(I<0||D<0)return null;ts($l(s)||$l(l),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,s,l),ts(!n||n>0,"The aspect(%s) must be greater than zero.",n);var z=$l(s)?I:s,$=$l(l)?D:l;n&&n>0&&(z?$=z/n:$&&(z=$*n),h&&$>h&&($=h)),ts(z>0||$>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,z,$,s,l,d,f,n);var G=!Array.isArray(p)&&ja(p.type).endsWith("Chart");return N.Children.map(p,function(R){return MG.isElement(R)?v.cloneElement(R,Cv({width:z,height:$},G?{style:Cv({height:"100%",width:"100%",maxHeight:$,maxWidth:z},R.props.style)}:{})):R})},[n,p,l,h,f,d,P,s]);return N.createElement("div",{id:y?"".concat(y):void 0,className:Mt("recharts-responsive-container",b),style:Cv(Cv({},S),{},{width:s,height:l,minWidth:d,minHeight:f,maxHeight:h}),ref:C},E)}),Og=function(e){return null};Og.displayName="Cell";function jm(t){"@babel/helpers - typeof";return jm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jm(t)}function F2(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function s1(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||ns.isSsr)return{width:0,height:0};var r=rAe(n),i=JSON.stringify({text:e,copyStyle:r});if(zu.widthCache[i])return zu.widthCache[i];try{var o=document.getElementById(B2);o||(o=document.createElement("span"),o.setAttribute("id",B2),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var s=s1(s1({},nAe),r);Object.assign(o.style,s),o.textContent="".concat(e);var c=o.getBoundingClientRect(),l={width:c.width,height:c.height};return zu.widthCache[i]=l,++zu.cacheCount>tAe&&(zu.cacheCount=0,zu.widthCache={}),l}catch{return{width:0,height:0}}},iAe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function Em(t){"@babel/helpers - typeof";return Em=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Em(t)}function rb(t,e){return cAe(t)||aAe(t,e)||sAe(t,e)||oAe()}function oAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function sAe(t,e){if(t){if(typeof t=="string")return U2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U2(t,e)}}function U2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function SAe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function W2(t,e){return jAe(t)||AAe(t,e)||_Ae(t,e)||CAe()}function CAe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Ae(t,e){if(t){if(typeof t=="string")return q2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q2(t,e)}}function q2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return z.reduce(function($,G){var R=G.word,L=G.width,W=$[$.length-1];if(W&&(i==null||o||W.width+L+rG.width?$:G})};if(!d)return p;for(var m="…",y=function(z){var $=f.slice(0,z),G=zV({breakAll:u,style:l,children:$+m}).wordsWithComputedWidth,R=h(G),L=R.length>s||g(R).width>Number(i);return[L,R]},b=0,x=f.length-1,w=0,S;b<=x&&w<=f.length-1;){var C=Math.floor((b+x)/2),_=C-1,A=y(_),j=W2(A,2),P=j[0],k=j[1],O=y(C),E=W2(O,1),I=E[0];if(!P&&!I&&(b=C+1),P&&I&&(x=C-1),!P&&I){S=k;break}w++}return S||p},Y2=function(e){var n=Dt(e)?[]:e.toString().split(HV);return[{words:n}]},TAe=function(e){var n=e.width,r=e.scaleToFit,i=e.children,o=e.style,s=e.breakAll,c=e.maxLines;if((n||r)&&!ns.isSsr){var l,u,d=zV({breakAll:s,children:i,style:o});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;l=f,u=h}else return Y2(i);return EAe({breakAll:s,children:i,maxLines:c,style:o},l,u,n,r)}return Y2(i)},Q2="#808080",wu=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.lineHeight,c=s===void 0?"1em":s,l=e.capHeight,u=l===void 0?"0.71em":l,d=e.scaleToFit,f=d===void 0?!1:d,h=e.textAnchor,p=h===void 0?"start":h,g=e.verticalAnchor,m=g===void 0?"end":g,y=e.fill,b=y===void 0?Q2:y,x=K2(e,bAe),w=v.useMemo(function(){return TAe({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:f,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,f,x.style,x.width]),S=x.dx,C=x.dy,_=x.angle,A=x.className,j=x.breakAll,P=K2(x,wAe);if(!Er(r)||!Er(o))return null;var k=r+(Ae(S)?S:0),O=o+(Ae(C)?C:0),E;switch(m){case"start":E=hC("calc(".concat(u,")"));break;case"middle":E=hC("calc(".concat((w.length-1)/2," * -").concat(c," + (").concat(u," / 2))"));break;default:E=hC("calc(".concat(w.length-1," * -").concat(c,")"));break}var I=[];if(f){var D=w[0].width,z=x.width;I.push("scale(".concat((Ae(z)?z/D:1)/D,")"))}return _&&I.push("rotate(".concat(_,", ").concat(k,", ").concat(O,")")),I.length&&(P.transform=I.join(" ")),N.createElement("text",a1({},rt(P,!0),{x:k,y:O,className:Mt("recharts-text",A),textAnchor:p,fill:b.includes("url")?Q2:b}),w.map(function($,G){var R=$.words.join(j?"":" ");return N.createElement("tspan",{x:k,dy:G===0?E:c,key:"".concat(R,"-").concat(G)},R)}))};function zc(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function NAe(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function bP(t){let e,n,r;t.length!==2?(e=zc,n=(c,l)=>zc(t(c),l),r=(c,l)=>t(c)-l):(e=t===zc||t===NAe?t:PAe,n=t,r=t);function i(c,l,u=0,d=c.length){if(u>>1;n(c[f],l)<0?u=f+1:d=f}while(u>>1;n(c[f],l)<=0?u=f+1:d=f}while(uu&&r(c[f-1],l)>-r(c[f],l)?f-1:f}return{left:i,center:s,right:o}}function PAe(){return 0}function GV(t){return t===null?NaN:+t}function*kAe(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const OAe=bP(zc),Ig=OAe.right;bP(GV).center;class X2 extends Map{constructor(e,n=MAe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(J2(this,e))}has(e){return super.has(J2(this,e))}set(e,n){return super.set(IAe(this,e),n)}delete(e){return super.delete(RAe(this,e))}}function J2({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function IAe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function RAe({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function MAe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function DAe(t=zc){if(t===zc)return VV;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function VV(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const $Ae=Math.sqrt(50),LAe=Math.sqrt(10),FAe=Math.sqrt(2);function ib(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=$Ae?10:o>=LAe?5:o>=FAe?2:1;let c,l,u;return i<0?(u=Math.pow(10,-i)/s,c=Math.round(t*u),l=Math.round(e*u),c/ue&&--l,u=-u):(u=Math.pow(10,i)*s,c=Math.round(t/u),l=Math.round(e/u),c*ue&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const c=o-i+1,l=new Array(c);if(r)if(s<0)for(let u=0;u=r)&&(n=r);return n}function eM(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function KV(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?VV:DAe(i);r>n;){if(r-n>600){const l=r-n+1,u=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(l-f)/l)*(u-l/2<0?-1:1),p=Math.max(n,Math.floor(e-u*f/l+h)),g=Math.min(r,Math.floor(e+(l-u)*f/l+h));KV(t,e,p,g,i)}const o=t[e];let s=n,c=r;for(Ph(t,n,e),i(t[r],o)>0&&Ph(t,n,r);s0;)--c}i(t[n],o)===0?Ph(t,n,c):(++c,Ph(t,c,r)),c<=e&&(n=c+1),e<=c&&(r=c-1)}return t}function Ph(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function BAe(t,e,n){if(t=Float64Array.from(kAe(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return eM(t);if(e>=1)return Z2(t);var r,i=(r-1)*e,o=Math.floor(i),s=Z2(KV(t,o).subarray(0,o+1)),c=eM(t.subarray(o+1));return s+(c-s)*(i-o)}}function UAe(t,e,n=GV){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),s=+n(t[o],o,t),c=+n(t[o+1],o+1,t);return s+(c-s)*(i-o)}}function HAe(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Av(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Av(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=GAe.exec(t))?new Pi(e[1],e[2],e[3],1):(e=VAe.exec(t))?new Pi(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=KAe.exec(t))?Av(e[1],e[2],e[3],e[4]):(e=WAe.exec(t))?Av(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=qAe.exec(t))?aM(e[1],e[2]/100,e[3]/100,1):(e=YAe.exec(t))?aM(e[1],e[2]/100,e[3]/100,e[4]):tM.hasOwnProperty(t)?iM(tM[t]):t==="transparent"?new Pi(NaN,NaN,NaN,0):null}function iM(t){return new Pi(t>>16&255,t>>8&255,t&255,1)}function Av(t,e,n,r){return r<=0&&(t=e=n=NaN),new Pi(t,e,n,r)}function JAe(t){return t instanceof Rg||(t=km(t)),t?(t=t.rgb(),new Pi(t.r,t.g,t.b,t.opacity)):new Pi}function f1(t,e,n,r){return arguments.length===1?JAe(t):new Pi(t,e,n,r??1)}function Pi(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}SP(Pi,f1,qV(Rg,{brighter(t){return t=t==null?ob:Math.pow(ob,t),new Pi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Nm:Math.pow(Nm,t),new Pi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Pi(Jl(this.r),Jl(this.g),Jl(this.b),sb(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oM,formatHex:oM,formatHex8:ZAe,formatRgb:sM,toString:sM}));function oM(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}`}function ZAe(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}${Ll((isNaN(this.opacity)?1:this.opacity)*255)}`}function sM(){const t=sb(this.opacity);return`${t===1?"rgb(":"rgba("}${Jl(this.r)}, ${Jl(this.g)}, ${Jl(this.b)}${t===1?")":`, ${t})`}`}function sb(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Jl(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ll(t){return t=Jl(t),(t<16?"0":"")+t.toString(16)}function aM(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ko(t,e,n,r)}function YV(t){if(t instanceof Ko)return new Ko(t.h,t.s,t.l,t.opacity);if(t instanceof Rg||(t=km(t)),!t)return new Ko;if(t instanceof Ko)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,c=o-i,l=(o+i)/2;return c?(e===o?s=(n-r)/c+(n0&&l<1?0:s,new Ko(s,c,l,t.opacity)}function e1e(t,e,n,r){return arguments.length===1?YV(t):new Ko(t,e,n,r??1)}function Ko(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}SP(Ko,e1e,qV(Rg,{brighter(t){return t=t==null?ob:Math.pow(ob,t),new Ko(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Nm:Math.pow(Nm,t),new Ko(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Pi(pC(t>=240?t-240:t+120,i,r),pC(t,i,r),pC(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ko(cM(this.h),jv(this.s),jv(this.l),sb(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=sb(this.opacity);return`${t===1?"hsl(":"hsla("}${cM(this.h)}, ${jv(this.s)*100}%, ${jv(this.l)*100}%${t===1?")":`, ${t})`}`}}));function cM(t){return t=(t||0)%360,t<0?t+360:t}function jv(t){return Math.max(0,Math.min(1,t||0))}function pC(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const CP=t=>()=>t;function t1e(t,e){return function(n){return t+n*e}}function n1e(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function r1e(t){return(t=+t)==1?QV:function(e,n){return n-e?n1e(e,n,t):CP(isNaN(e)?n:e)}}function QV(t,e){var n=e-t;return n?t1e(t,n):CP(isNaN(t)?e:t)}const lM=function t(e){var n=r1e(e);function r(i,o){var s=n((i=f1(i)).r,(o=f1(o)).r),c=n(i.g,o.g),l=n(i.b,o.b),u=QV(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=c(d),i.b=l(d),i.opacity=u(d),i+""}}return r.gamma=t,r}(1);function i1e(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;in&&(o=e.slice(n,o),c[s]?c[s]+=o:c[++s]=o),(r=r[0])===(i=i[0])?c[s]?c[s]+=i:c[++s]=i:(c[++s]=null,l.push({i:s,x:ab(r,i)})),n=mC.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function m1e(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i2?g1e:m1e,l=u=null,f}function f(h){return h==null||isNaN(h=+h)?o:(l||(l=c(t.map(r),e,n)))(r(s(h)))}return f.invert=function(h){return s(i((u||(u=c(e,t.map(r),ab)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,cb),d()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=_P,d()},f.clamp=function(h){return arguments.length?(s=h?!0:vi,d()):s!==vi},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,p){return r=h,i=p,d()}}function AP(){return kw()(vi,vi)}function v1e(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function lb(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function lf(t){return t=lb(Math.abs(t)),t?t[1]:NaN}function y1e(t,e){return function(n,r){for(var i=n.length,o=[],s=0,c=t[0],l=0;i>0&&c>0&&(l+c+1>r&&(c=Math.max(1,r-l)),o.push(n.substring(i-=c,i+c)),!((l+=c+1)>r));)c=t[s=(s+1)%t.length];return o.reverse().join(e)}}function x1e(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var b1e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Om(t){if(!(e=b1e.exec(t)))throw new Error("invalid format: "+t);var e;return new jP({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Om.prototype=jP.prototype;function jP(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}jP.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function w1e(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var XV;function S1e(t,e){var n=lb(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(XV=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+lb(t,Math.max(0,e+o-1))[0]}function dM(t,e){var n=lb(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const fM={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:v1e,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>dM(t*100,e),r:dM,s:S1e,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function hM(t){return t}var pM=Array.prototype.map,mM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function C1e(t){var e=t.grouping===void 0||t.thousands===void 0?hM:y1e(pM.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?hM:x1e(pM.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",c=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(f){f=Om(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,y=f.zero,b=f.width,x=f.comma,w=f.precision,S=f.trim,C=f.type;C==="n"?(x=!0,C="g"):fM[C]||(w===void 0&&(w=12),S=!0,C="g"),(y||h==="0"&&p==="=")&&(y=!0,h="0",p="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",A=m==="$"?r:/[%p]/.test(C)?s:"",j=fM[C],P=/[defgprs%]/.test(C);w=w===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function k(O){var E=_,I=A,D,z,$;if(C==="c")I=j(O)+I,O="";else{O=+O;var G=O<0||1/O<0;if(O=isNaN(O)?l:j(Math.abs(O),w),S&&(O=w1e(O)),G&&+O==0&&g!=="+"&&(G=!1),E=(G?g==="("?g:c:g==="-"||g==="("?"":g)+E,I=(C==="s"?mM[8+XV/3]:"")+I+(G&&g==="("?")":""),P){for(D=-1,z=O.length;++D$||$>57){I=($===46?i+O.slice(D+1):O.slice(D))+I,O=O.slice(0,D);break}}}x&&!y&&(O=e(O,1/0));var R=E.length+O.length+I.length,L=R>1)+E+O+I+L.slice(R);break;default:O=L+E+O+I;break}return o(O)}return k.toString=function(){return f+""},k}function d(f,h){var p=u((f=Om(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(lf(h)/3)))*3,m=Math.pow(10,-g),y=mM[8+g/3];return function(b){return p(m*b)+y}}return{format:u,formatPrefix:d}}var Ev,EP,JV;_1e({thousands:",",grouping:[3],currency:["$",""]});function _1e(t){return Ev=C1e(t),EP=Ev.format,JV=Ev.formatPrefix,Ev}function A1e(t){return Math.max(0,-lf(Math.abs(t)))}function j1e(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(lf(e)/3)))*3-lf(Math.abs(t)))}function E1e(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,lf(e)-lf(t))+1}function ZV(t,e,n,r){var i=u1(t,e,n),o;switch(r=Om(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=j1e(i,s))&&(r.precision=o),JV(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=E1e(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=A1e(i))&&(r.precision=o-(r.type==="%")*2);break}}return EP(r)}function hl(t){var e=t.domain;return t.ticks=function(n){var r=e();return c1(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return ZV(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],c=r[o],l,u,d=10;for(c0;){if(u=l1(s,c,n),u===l)return r[i]=s,r[o]=c,e(r);if(u>0)s=Math.floor(s/u)*u,c=Math.ceil(c/u)*u;else if(u<0)s=Math.ceil(s*u)/u,c=Math.floor(c*u)/u;else break;l=u}return t},t}function ub(){var t=AP();return t.copy=function(){return Mg(t,ub())},Oo.apply(t,arguments),hl(t)}function e8(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,cb),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return e8(t).unknown(e)},t=arguments.length?Array.from(t,cb):[0,1],hl(n)}function t8(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],o=t[r],s;return oMath.pow(t,e)}function O1e(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function yM(t){return(e,n)=>-t(-e,n)}function TP(t){const e=t(gM,vM),n=e.domain;let r=10,i,o;function s(){return i=O1e(r),o=k1e(r),n()[0]<0?(i=yM(i),o=yM(o),t(T1e,N1e)):t(gM,vM),e}return e.base=function(c){return arguments.length?(r=+c,s()):r},e.domain=function(c){return arguments.length?(n(c),s()):n()},e.ticks=c=>{const l=n();let u=l[0],d=l[l.length-1];const f=d0){for(;h<=p;++h)for(g=1;gd)break;b.push(m)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(m=h>0?g/o(-h):g*o(h),!(md)break;b.push(m)}b.length*2{if(c==null&&(c=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=Om(l)).precision==null&&(l.trim=!0),l=EP(l)),c===1/0)return l;const u=Math.max(1,r*c/e.ticks().length);return d=>{let f=d/o(Math.round(i(d)));return f*rn(t8(n(),{floor:c=>o(Math.floor(i(c))),ceil:c=>o(Math.ceil(i(c)))})),e}function n8(){const t=TP(kw()).domain([1,10]);return t.copy=()=>Mg(t,n8()).base(t.base()),Oo.apply(t,arguments),t}function xM(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function bM(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function NP(t){var e=1,n=t(xM(e),bM(e));return n.constant=function(r){return arguments.length?t(xM(e=+r),bM(e)):e},hl(n)}function r8(){var t=NP(kw());return t.copy=function(){return Mg(t,r8()).constant(t.constant())},Oo.apply(t,arguments)}function wM(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function I1e(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function R1e(t){return t<0?-t*t:t*t}function PP(t){var e=t(vi,vi),n=1;function r(){return n===1?t(vi,vi):n===.5?t(I1e,R1e):t(wM(n),wM(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},hl(e)}function kP(){var t=PP(kw());return t.copy=function(){return Mg(t,kP()).exponent(t.exponent())},Oo.apply(t,arguments),t}function M1e(){return kP.apply(null,arguments).exponent(.5)}function SM(t){return Math.sign(t)*t*t}function D1e(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function i8(){var t=AP(),e=[0,1],n=!1,r;function i(o){var s=D1e(t(o));return isNaN(s)?r:n?Math.round(s):s}return i.invert=function(o){return t.invert(SM(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,cb)).map(SM)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return i8(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Oo.apply(i,arguments),hl(i)}function o8(){var t=[],e=[],n=[],r;function i(){var s=0,c=Math.max(1,e.length);for(n=new Array(c-1);++s0?n[c-1]:t[0],c=n?[r[n-1],e]:[r[u-1],r[u]]},s.unknown=function(l){return arguments.length&&(o=l),s},s.thresholds=function(){return r.slice()},s.copy=function(){return s8().domain([t,e]).range(i).unknown(o)},Oo.apply(hl(s),arguments)}function a8(){var t=[.5],e=[0,1],n,r=1;function i(o){return o!=null&&o<=o?e[Ig(t,o,0,r)]:n}return i.domain=function(o){return arguments.length?(t=Array.from(o),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var s=e.indexOf(o);return[t[s-1],t[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return a8().domain(t).range(e).unknown(n)},Oo.apply(i,arguments)}const gC=new Date,vC=new Date;function Tr(t,e,n,r){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const s=i(o),c=i.ceil(o);return o-s(e(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,c)=>{const l=[];if(o=i.ceil(o),c=c==null?1:Math.floor(c),!(o0))return l;let u;do l.push(u=new Date(+o)),e(o,c),t(o);while(uTr(s=>{if(s>=s)for(;t(s),!o(s);)s.setTime(s-1)},(s,c)=>{if(s>=s)if(c<0)for(;++c<=0;)for(;e(s,-1),!o(s););else for(;--c>=0;)for(;e(s,1),!o(s););}),n&&(i.count=(o,s)=>(gC.setTime(+o),vC.setTime(+s),t(gC),t(vC),Math.floor(n(gC,vC))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const db=Tr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);db.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Tr(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):db);db.range;const wa=1e3,Co=wa*60,Sa=Co*60,Fa=Sa*24,OP=Fa*7,CM=Fa*30,yC=Fa*365,Fl=Tr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*wa)},(t,e)=>(e-t)/wa,t=>t.getUTCSeconds());Fl.range;const IP=Tr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*wa)},(t,e)=>{t.setTime(+t+e*Co)},(t,e)=>(e-t)/Co,t=>t.getMinutes());IP.range;const RP=Tr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Co)},(t,e)=>(e-t)/Co,t=>t.getUTCMinutes());RP.range;const MP=Tr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*wa-t.getMinutes()*Co)},(t,e)=>{t.setTime(+t+e*Sa)},(t,e)=>(e-t)/Sa,t=>t.getHours());MP.range;const DP=Tr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Sa)},(t,e)=>(e-t)/Sa,t=>t.getUTCHours());DP.range;const Dg=Tr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Co)/Fa,t=>t.getDate()-1);Dg.range;const Ow=Tr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Fa,t=>t.getUTCDate()-1);Ow.range;const c8=Tr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Fa,t=>Math.floor(t/Fa));c8.range;function Iu(t){return Tr(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Co)/OP)}const Iw=Iu(0),fb=Iu(1),$1e=Iu(2),L1e=Iu(3),uf=Iu(4),F1e=Iu(5),B1e=Iu(6);Iw.range;fb.range;$1e.range;L1e.range;uf.range;F1e.range;B1e.range;function Ru(t){return Tr(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/OP)}const Rw=Ru(0),hb=Ru(1),U1e=Ru(2),H1e=Ru(3),df=Ru(4),z1e=Ru(5),G1e=Ru(6);Rw.range;hb.range;U1e.range;H1e.range;df.range;z1e.range;G1e.range;const $P=Tr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());$P.range;const LP=Tr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());LP.range;const Ba=Tr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Ba.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Tr(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Ba.range;const Ua=Tr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Ua.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Tr(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Ua.range;function l8(t,e,n,r,i,o){const s=[[Fl,1,wa],[Fl,5,5*wa],[Fl,15,15*wa],[Fl,30,30*wa],[o,1,Co],[o,5,5*Co],[o,15,15*Co],[o,30,30*Co],[i,1,Sa],[i,3,3*Sa],[i,6,6*Sa],[i,12,12*Sa],[r,1,Fa],[r,2,2*Fa],[n,1,OP],[e,1,CM],[e,3,3*CM],[t,1,yC]];function c(u,d,f){const h=dy).right(s,h);if(p===s.length)return t.every(u1(u/yC,d/yC,f));if(p===0)return db.every(Math.max(u1(u,d,f),1));const[g,m]=s[h/s[p-1][2]53)return null;"w"in Z||(Z.w=1),"Z"in Z?(Le=bC(kh(Z.y,0,1)),At=Le.getUTCDay(),Le=At>4||At===0?hb.ceil(Le):hb(Le),Le=Ow.offset(Le,(Z.V-1)*7),Z.y=Le.getUTCFullYear(),Z.m=Le.getUTCMonth(),Z.d=Le.getUTCDate()+(Z.w+6)%7):(Le=xC(kh(Z.y,0,1)),At=Le.getDay(),Le=At>4||At===0?fb.ceil(Le):fb(Le),Le=Dg.offset(Le,(Z.V-1)*7),Z.y=Le.getFullYear(),Z.m=Le.getMonth(),Z.d=Le.getDate()+(Z.w+6)%7)}else("W"in Z||"U"in Z)&&("w"in Z||(Z.w="u"in Z?Z.u%7:"W"in Z?1:0),At="Z"in Z?bC(kh(Z.y,0,1)).getUTCDay():xC(kh(Z.y,0,1)).getDay(),Z.m=0,Z.d="W"in Z?(Z.w+6)%7+Z.W*7-(At+5)%7:Z.w+Z.U*7-(At+6)%7);return"Z"in Z?(Z.H+=Z.Z/100|0,Z.M+=Z.Z%100,bC(Z)):xC(Z)}}function j(de,ye,Ee,Z){for(var ct=0,Le=ye.length,At=Ee.length,lt,Jt;ct=At)return-1;if(lt=ye.charCodeAt(ct++),lt===37){if(lt=ye.charAt(ct++),Jt=C[lt in _M?ye.charAt(ct++):lt],!Jt||(Z=Jt(de,Ee,Z))<0)return-1}else if(lt!=Ee.charCodeAt(Z++))return-1}return Z}function P(de,ye,Ee){var Z=u.exec(ye.slice(Ee));return Z?(de.p=d.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function k(de,ye,Ee){var Z=p.exec(ye.slice(Ee));return Z?(de.w=g.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function O(de,ye,Ee){var Z=f.exec(ye.slice(Ee));return Z?(de.w=h.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function E(de,ye,Ee){var Z=b.exec(ye.slice(Ee));return Z?(de.m=x.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function I(de,ye,Ee){var Z=m.exec(ye.slice(Ee));return Z?(de.m=y.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function D(de,ye,Ee){return j(de,e,ye,Ee)}function z(de,ye,Ee){return j(de,n,ye,Ee)}function $(de,ye,Ee){return j(de,r,ye,Ee)}function G(de){return s[de.getDay()]}function R(de){return o[de.getDay()]}function L(de){return l[de.getMonth()]}function W(de){return c[de.getMonth()]}function Y(de){return i[+(de.getHours()>=12)]}function te(de){return 1+~~(de.getMonth()/3)}function me(de){return s[de.getUTCDay()]}function F(de){return o[de.getUTCDay()]}function se(de){return l[de.getUTCMonth()]}function ne(de){return c[de.getUTCMonth()]}function ae(de){return i[+(de.getUTCHours()>=12)]}function De(de){return 1+~~(de.getUTCMonth()/3)}return{format:function(de){var ye=_(de+="",w);return ye.toString=function(){return de},ye},parse:function(de){var ye=A(de+="",!1);return ye.toString=function(){return de},ye},utcFormat:function(de){var ye=_(de+="",S);return ye.toString=function(){return de},ye},utcParse:function(de){var ye=A(de+="",!0);return ye.toString=function(){return de},ye}}}var _M={"-":"",_:" ",0:"0"},$r=/^\s*\d+/,Q1e=/^%/,X1e=/[\\^$*+?|[\]().{}]/g;function cn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[e.toLowerCase(),n]))}function Z1e(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function eje(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function tje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function nje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function rje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function AM(t,e,n){var r=$r.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function jM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function ije(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function oje(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function sje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function EM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function aje(t,e,n){var r=$r.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function TM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function cje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function lje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function uje(t,e,n){var r=$r.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function dje(t,e,n){var r=$r.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function fje(t,e,n){var r=Q1e.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function hje(t,e,n){var r=$r.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function pje(t,e,n){var r=$r.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function NM(t,e){return cn(t.getDate(),e,2)}function mje(t,e){return cn(t.getHours(),e,2)}function gje(t,e){return cn(t.getHours()%12||12,e,2)}function vje(t,e){return cn(1+Dg.count(Ba(t),t),e,3)}function u8(t,e){return cn(t.getMilliseconds(),e,3)}function yje(t,e){return u8(t,e)+"000"}function xje(t,e){return cn(t.getMonth()+1,e,2)}function bje(t,e){return cn(t.getMinutes(),e,2)}function wje(t,e){return cn(t.getSeconds(),e,2)}function Sje(t){var e=t.getDay();return e===0?7:e}function Cje(t,e){return cn(Iw.count(Ba(t)-1,t),e,2)}function d8(t){var e=t.getDay();return e>=4||e===0?uf(t):uf.ceil(t)}function _je(t,e){return t=d8(t),cn(uf.count(Ba(t),t)+(Ba(t).getDay()===4),e,2)}function Aje(t){return t.getDay()}function jje(t,e){return cn(fb.count(Ba(t)-1,t),e,2)}function Eje(t,e){return cn(t.getFullYear()%100,e,2)}function Tje(t,e){return t=d8(t),cn(t.getFullYear()%100,e,2)}function Nje(t,e){return cn(t.getFullYear()%1e4,e,4)}function Pje(t,e){var n=t.getDay();return t=n>=4||n===0?uf(t):uf.ceil(t),cn(t.getFullYear()%1e4,e,4)}function kje(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+cn(e/60|0,"0",2)+cn(e%60,"0",2)}function PM(t,e){return cn(t.getUTCDate(),e,2)}function Oje(t,e){return cn(t.getUTCHours(),e,2)}function Ije(t,e){return cn(t.getUTCHours()%12||12,e,2)}function Rje(t,e){return cn(1+Ow.count(Ua(t),t),e,3)}function f8(t,e){return cn(t.getUTCMilliseconds(),e,3)}function Mje(t,e){return f8(t,e)+"000"}function Dje(t,e){return cn(t.getUTCMonth()+1,e,2)}function $je(t,e){return cn(t.getUTCMinutes(),e,2)}function Lje(t,e){return cn(t.getUTCSeconds(),e,2)}function Fje(t){var e=t.getUTCDay();return e===0?7:e}function Bje(t,e){return cn(Rw.count(Ua(t)-1,t),e,2)}function h8(t){var e=t.getUTCDay();return e>=4||e===0?df(t):df.ceil(t)}function Uje(t,e){return t=h8(t),cn(df.count(Ua(t),t)+(Ua(t).getUTCDay()===4),e,2)}function Hje(t){return t.getUTCDay()}function zje(t,e){return cn(hb.count(Ua(t)-1,t),e,2)}function Gje(t,e){return cn(t.getUTCFullYear()%100,e,2)}function Vje(t,e){return t=h8(t),cn(t.getUTCFullYear()%100,e,2)}function Kje(t,e){return cn(t.getUTCFullYear()%1e4,e,4)}function Wje(t,e){var n=t.getUTCDay();return t=n>=4||n===0?df(t):df.ceil(t),cn(t.getUTCFullYear()%1e4,e,4)}function qje(){return"+0000"}function kM(){return"%"}function OM(t){return+t}function IM(t){return Math.floor(+t/1e3)}var Gu,p8,m8;Yje({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Yje(t){return Gu=Y1e(t),p8=Gu.format,Gu.parse,m8=Gu.utcFormat,Gu.utcParse,Gu}function Qje(t){return new Date(t)}function Xje(t){return t instanceof Date?+t:+new Date(+t)}function FP(t,e,n,r,i,o,s,c,l,u){var d=AP(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),y=u("%I %p"),b=u("%a %d"),x=u("%b %d"),w=u("%B"),S=u("%Y");function C(_){return(l(_)<_?p:c(_)<_?g:s(_)<_?m:o(_)<_?y:r(_)<_?i(_)<_?b:x:n(_)<_?w:S)(_)}return d.invert=function(_){return new Date(f(_))},d.domain=function(_){return arguments.length?h(Array.from(_,Xje)):h().map(Qje)},d.ticks=function(_){var A=h();return t(A[0],A[A.length-1],_??10)},d.tickFormat=function(_,A){return A==null?C:u(A)},d.nice=function(_){var A=h();return(!_||typeof _.range!="function")&&(_=e(A[0],A[A.length-1],_??10)),_?h(t8(A,_)):d},d.copy=function(){return Mg(d,FP(t,e,n,r,i,o,s,c,l,u))},d}function Jje(){return Oo.apply(FP(W1e,q1e,Ba,$P,Iw,Dg,MP,IP,Fl,p8).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Zje(){return Oo.apply(FP(V1e,K1e,Ua,LP,Rw,Ow,DP,RP,Fl,m8).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Mw(){var t=0,e=1,n,r,i,o,s=vi,c=!1,l;function u(f){return f==null||isNaN(f=+f)?l:s(i===0?.5:(f=(o(f)-n)*i,c?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([t,e]=f,n=o(t=+t),r=o(e=+e),i=n===r?0:1/(r-n),u):[t,e]},u.clamp=function(f){return arguments.length?(c=!!f,u):c},u.interpolator=function(f){return arguments.length?(s=f,u):s};function d(f){return function(h){var p,g;return arguments.length?([p,g]=h,s=f(p,g),u):[s(0),s(1)]}}return u.range=d(oh),u.rangeRound=d(_P),u.unknown=function(f){return arguments.length?(l=f,u):l},function(f){return o=f,n=f(t),r=f(e),i=n===r?0:1/(r-n),u}}function pl(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function g8(){var t=hl(Mw()(vi));return t.copy=function(){return pl(t,g8())},Ya.apply(t,arguments)}function v8(){var t=TP(Mw()).domain([1,10]);return t.copy=function(){return pl(t,v8()).base(t.base())},Ya.apply(t,arguments)}function y8(){var t=NP(Mw());return t.copy=function(){return pl(t,y8()).constant(t.constant())},Ya.apply(t,arguments)}function BP(){var t=PP(Mw());return t.copy=function(){return pl(t,BP()).exponent(t.exponent())},Ya.apply(t,arguments)}function eEe(){return BP.apply(null,arguments).exponent(.5)}function x8(){var t=[],e=vi;function n(r){if(r!=null&&!isNaN(r=+r))return e((Ig(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(zc),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,o)=>BAe(t,o/r))},n.copy=function(){return x8(e).domain(t)},Ya.apply(n,arguments)}function Dw(){var t=0,e=.5,n=1,r=1,i,o,s,c,l,u=vi,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-o)*(r*me}var C8=iEe,oEe=$w,sEe=C8,aEe=ih;function cEe(t){return t&&t.length?oEe(t,aEe,sEe):void 0}var lEe=cEe;const Sc=un(lEe);function uEe(t,e){return tt.e^o.s<0?1:-1;for(r=o.d.length,i=t.d.length,e=0,n=rt.d[e]^o.s<0?1:-1;return r===i?0:r>i^o.s<0?1:-1};Je.decimalPlaces=Je.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Dn;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Je.dividedBy=Je.div=function(t){return Ta(this,new this.constructor(t))};Je.dividedToIntegerBy=Je.idiv=function(t){var e=this,n=e.constructor;return En(Ta(e,new n(t),0,1),n.precision)};Je.equals=Je.eq=function(t){return!this.cmp(t)};Je.exponent=function(){return pr(this)};Je.greaterThan=Je.gt=function(t){return this.cmp(t)>0};Je.greaterThanOrEqualTo=Je.gte=function(t){return this.cmp(t)>=0};Je.isInteger=Je.isint=function(){return this.e>this.d.length-2};Je.isNegative=Je.isneg=function(){return this.s<0};Je.isPositive=Je.ispos=function(){return this.s>0};Je.isZero=function(){return this.s===0};Je.lessThan=Je.lt=function(t){return this.cmp(t)<0};Je.lessThanOrEqualTo=Je.lte=function(t){return this.cmp(t)<1};Je.logarithm=Je.log=function(t){var e,n=this,r=n.constructor,i=r.precision,o=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(Yi))throw Error(No+"NaN");if(n.s<1)throw Error(No+(n.s?"NaN":"-Infinity"));return n.eq(Yi)?new r(0):(zn=!1,e=Ta(Im(n,o),Im(t,o),o),zn=!0,En(e,i))};Je.minus=Je.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?T8(e,t):j8(e,(t.s=-t.s,t))};Je.modulo=Je.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(No+"NaN");return n.s?(zn=!1,e=Ta(n,t,0,1).times(t),zn=!0,n.minus(e)):En(new r(n),i)};Je.naturalExponential=Je.exp=function(){return E8(this)};Je.naturalLogarithm=Je.ln=function(){return Im(this)};Je.negated=Je.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Je.plus=Je.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?j8(e,t):T8(e,(t.s=-t.s,t))};Je.precision=Je.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Zl+t);if(e=pr(i)+1,r=i.d.length-1,n=r*Dn+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Je.squareRoot=Je.sqrt=function(){var t,e,n,r,i,o,s,c=this,l=c.constructor;if(c.s<1){if(!c.s)return new l(0);throw Error(No+"NaN")}for(t=pr(c),zn=!1,i=Math.sqrt(+c),i==0||i==1/0?(e=Os(c.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=ah((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=s=n+3;;)if(o=r,r=o.plus(Ta(c,o,s+2)).times(.5),Os(o.d).slice(0,s)===(e=Os(r.d)).slice(0,s)){if(e=e.slice(s-3,s+1),i==s&&e=="4999"){if(En(o,n+1,0),o.times(o).eq(c)){r=o;break}}else if(e!="9999")break;s+=4}return zn=!0,En(r,n)};Je.times=Je.mul=function(t){var e,n,r,i,o,s,c,l,u,d=this,f=d.constructor,h=d.d,p=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=h.length,u=p.length,l=0;){for(e=0,i=l+r;i>r;)c=o[i]+p[r]*h[i-r-1]+e,o[i--]=c%kr|0,e=c/kr|0;o[i]=(o[i]+e)%kr|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,zn?En(t,f.precision):t};Je.toDecimalPlaces=Je.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(qs(t,0,sh),e===void 0?e=r.rounding:qs(e,0,8),En(n,t+pr(n)+1,e))};Je.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Cu(r,!0):(qs(t,0,sh),e===void 0?e=i.rounding:qs(e,0,8),r=En(new i(r),t+1,e),n=Cu(r,!0,t+1)),n};Je.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?Cu(i):(qs(t,0,sh),e===void 0?e=o.rounding:qs(e,0,8),r=En(new o(i),t+pr(i)+1,e),n=Cu(r.abs(),!1,t+pr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Je.toInteger=Je.toint=function(){var t=this,e=t.constructor;return En(new e(t),pr(t)+1,e.rounding)};Je.toNumber=function(){return+this};Je.toPower=Je.pow=function(t){var e,n,r,i,o,s,c=this,l=c.constructor,u=12,d=+(t=new l(t));if(!t.s)return new l(Yi);if(c=new l(c),!c.s){if(t.s<1)throw Error(No+"Infinity");return c}if(c.eq(Yi))return c;if(r=l.precision,t.eq(Yi))return En(c,r);if(e=t.e,n=t.d.length-1,s=e>=n,o=c.s,s){if((n=d<0?-d:d)<=A8){for(i=new l(Yi),e=Math.ceil(r/Dn+4),zn=!1;n%2&&(i=i.times(c),DM(i.d,e)),n=ah(n/2),n!==0;)c=c.times(c),DM(c.d,e);return zn=!0,t.s<0?new l(Yi).div(i):En(i,r)}}else if(o<0)throw Error(No+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,c.s=1,zn=!1,i=t.times(Im(c,r+u)),zn=!0,i=E8(i),i.s=o,i};Je.toPrecision=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?(n=pr(i),r=Cu(i,n<=o.toExpNeg||n>=o.toExpPos)):(qs(t,1,sh),e===void 0?e=o.rounding:qs(e,0,8),i=En(new o(i),t,e),n=pr(i),r=Cu(i,t<=n||n<=o.toExpNeg,t)),r};Je.toSignificantDigits=Je.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(qs(t,1,sh),e===void 0?e=r.rounding:qs(e,0,8)),En(new r(n),t,e)};Je.toString=Je.valueOf=Je.val=Je.toJSON=Je[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=pr(t),n=t.constructor;return Cu(t,e<=n.toExpNeg||e>=n.toExpPos)};function j8(t,e){var n,r,i,o,s,c,l,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),zn?En(e,f):e;if(l=t.d,u=e.d,s=t.e,i=e.e,l=l.slice(),o=s-i,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,i=s,c=l.length),s=Math.ceil(f/Dn),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/kr|0,l[o]%=kr;for(n&&(l.unshift(n),++i),c=l.length;l[--c]==0;)l.pop();return e.d=l,e.e=i,zn?En(e,f):e}function qs(t,e,n){if(t!==~~t||tn)throw Error(Zl+t)}function Os(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;es?1:-1;else for(c=l=0;ci[c]?1:-1;break}return l}function n(r,i,o){for(var s=0;o--;)r[o]-=s,s=r[o]1;)r.shift()}return function(r,i,o,s){var c,l,u,d,f,h,p,g,m,y,b,x,w,S,C,_,A,j,P=r.constructor,k=r.s==i.s?1:-1,O=r.d,E=i.d;if(!r.s)return new P(r);if(!i.s)throw Error(No+"Division by zero");for(l=r.e-i.e,A=E.length,C=O.length,p=new P(k),g=p.d=[],u=0;E[u]==(O[u]||0);)++u;if(E[u]>(O[u]||0)&&--l,o==null?x=o=P.precision:s?x=o+(pr(r)-pr(i))+1:x=o,x<0)return new P(0);if(x=x/Dn+2|0,u=0,A==1)for(d=0,E=E[0],x++;(u1&&(E=t(E,d),O=t(O,d),A=E.length,C=O.length),S=A,m=O.slice(0,A),y=m.length;y=kr/2&&++_;do d=0,c=e(E,m,A,y),c<0?(b=m[0],A!=y&&(b=b*kr+(m[1]||0)),d=b/_|0,d>1?(d>=kr&&(d=kr-1),f=t(E,d),h=f.length,y=m.length,c=e(f,m,h,y),c==1&&(d--,n(f,A16)throw Error(HP+pr(t));if(!t.s)return new d(Yi);for(e==null?(zn=!1,c=f):c=e,s=new d(.03125);t.abs().gte(.1);)t=t.times(s),u+=5;for(r=Math.log(jl(2,u))/Math.LN10*2+5|0,c+=r,n=i=o=new d(Yi),d.precision=c;;){if(i=En(i.times(t),c),n=n.times(++l),s=o.plus(Ta(i,n,c)),Os(s.d).slice(0,c)===Os(o.d).slice(0,c)){for(;u--;)o=En(o.times(o),c);return d.precision=f,e==null?(zn=!0,En(o,f)):o}o=s}}function pr(t){for(var e=t.e*Dn,n=t.d[0];n>=10;n/=10)e++;return e}function wC(t,e,n){if(e>t.LN10.sd())throw zn=!0,n&&(t.precision=n),Error(No+"LN10 precision limit exceeded");return En(new t(t.LN10),e)}function sc(t){for(var e="";t--;)e+="0";return e}function Im(t,e){var n,r,i,o,s,c,l,u,d,f=1,h=10,p=t,g=p.d,m=p.constructor,y=m.precision;if(p.s<1)throw Error(No+(p.s?"NaN":"-Infinity"));if(p.eq(Yi))return new m(0);if(e==null?(zn=!1,u=y):u=e,p.eq(10))return e==null&&(zn=!0),wC(m,u);if(u+=h,m.precision=u,n=Os(g),r=n.charAt(0),o=pr(p),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Os(p.d),r=n.charAt(0),f++;o=pr(p),r>1?(p=new m("0."+n),o++):p=new m(r+"."+n.slice(1))}else return l=wC(m,u+2,y).times(o+""),p=Im(new m(r+"."+n.slice(1)),u-h).plus(l),m.precision=y,e==null?(zn=!0,En(p,y)):p;for(c=s=p=Ta(p.minus(Yi),p.plus(Yi),u),d=En(p.times(p),u),i=3;;){if(s=En(s.times(d),u),l=c.plus(Ta(s,new m(i),u)),Os(l.d).slice(0,u)===Os(c.d).slice(0,u))return c=c.times(2),o!==0&&(c=c.plus(wC(m,u+2,y).times(o+""))),c=Ta(c,new m(f),u),m.precision=y,e==null?(zn=!0,En(c,y)):c;c=l,i+=2}}function MM(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=ah(n/Dn),t.d=[],r=(n+1)%Dn,n<0&&(r+=Dn),rpb||t.e<-pb))throw Error(HP+n)}else t.s=0,t.e=0,t.d=[0];return t}function En(t,e,n){var r,i,o,s,c,l,u,d,f=t.d;for(s=1,o=f[0];o>=10;o/=10)s++;if(r=e-s,r<0)r+=Dn,i=e,u=f[d=0];else{if(d=Math.ceil((r+1)/Dn),o=f.length,d>=o)return t;for(u=o=f[d],s=1;o>=10;o/=10)s++;r%=Dn,i=r-Dn+s}if(n!==void 0&&(o=jl(10,s-i-1),c=u/o%10|0,l=e<0||f[d+1]!==void 0||u%o,l=n<4?(c||l)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||l||n==6&&(r>0?i>0?u/jl(10,s-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(o=pr(t),f.length=1,e=e-o-1,f[0]=jl(10,(Dn-e%Dn)%Dn),t.e=ah(-e/Dn)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,o=1,d--):(f.length=d+1,o=jl(10,Dn-r),f[d]=i>0?(u/jl(10,s-i)%jl(10,i)|0)*o:0),l)for(;;)if(d==0){(f[0]+=o)==kr&&(f[0]=1,++t.e);break}else{if(f[d]+=o,f[d]!=kr)break;f[d--]=0,o=1}for(r=f.length;f[--r]===0;)f.pop();if(zn&&(t.e>pb||t.e<-pb))throw Error(HP+pr(t));return t}function T8(t,e){var n,r,i,o,s,c,l,u,d,f,h=t.constructor,p=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),zn?En(e,p):e;if(l=t.d,f=e.d,r=e.e,u=t.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=f.length):(n=f,r=u,c=l.length),i=Math.max(Math.ceil(p/Dn),c)+2,s>i&&(s=i,n.length=1),n.reverse(),i=s;i--;)n.push(0);n.reverse()}else{for(i=l.length,c=f.length,d=i0;--i)l[c++]=0;for(i=f.length;i>s;){if(l[--i]0?o=o.charAt(0)+"."+o.slice(1)+sc(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+sc(-i-1)+o,n&&(r=n-s)>0&&(o+=sc(r))):i>=s?(o+=sc(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+sc(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=sc(r))),t.s<0?"-"+o:o}function DM(t,e){if(t.length>e)return t.length=e,!0}function N8(t){var e,n,r;function i(o){var s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,o instanceof i){s.s=o.s,s.e=o.e,s.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Zl+o);if(o>0)s.s=1;else if(o<0)o=-o,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(o===~~o&&o<1e7){s.e=0,s.d=[o];return}return MM(s,o.toString())}else if(typeof o!="string")throw Error(Zl+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,kEe.test(o))MM(s,o);else throw Error(Zl+o)}if(i.prototype=Je,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=N8,i.config=i.set=OEe,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Zl+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Zl+n+": "+r);return this}var zP=N8(PEe);Yi=new zP(1);const Sn=zP;function IEe(t){return $Ee(t)||DEe(t)||MEe(t)||REe()}function REe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Ae(t,e){if(t){if(typeof t=="string")return q2(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return q2(t,e)}}function q2(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[];return z.reduce(function($,G){var R=G.word,L=G.width,W=$[$.length-1];if(W&&(i==null||o||W.width+L+rG.width?$:G})};if(!d)return p;for(var m="…",y=function(z){var $=f.slice(0,z),G=zV({breakAll:u,style:l,children:$+m}).wordsWithComputedWidth,R=h(G),L=R.length>s||g(R).width>Number(i);return[L,R]},b=0,x=f.length-1,w=0,S;b<=x&&w<=f.length-1;){var C=Math.floor((b+x)/2),_=C-1,A=y(_),j=W2(A,2),P=j[0],k=j[1],O=y(C),E=W2(O,1),I=E[0];if(!P&&!I&&(b=C+1),P&&I&&(x=C-1),!P&&I){S=k;break}w++}return S||p},Y2=function(e){var n=Dt(e)?[]:e.toString().split(HV);return[{words:n}]},TAe=function(e){var n=e.width,r=e.scaleToFit,i=e.children,o=e.style,s=e.breakAll,c=e.maxLines;if((n||r)&&!ns.isSsr){var l,u,d=zV({breakAll:s,children:i,style:o});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;l=f,u=h}else return Y2(i);return EAe({breakAll:s,children:i,maxLines:c,style:o},l,u,n,r)}return Y2(i)},Q2="#808080",wu=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.lineHeight,c=s===void 0?"1em":s,l=e.capHeight,u=l===void 0?"0.71em":l,d=e.scaleToFit,f=d===void 0?!1:d,h=e.textAnchor,p=h===void 0?"start":h,g=e.verticalAnchor,m=g===void 0?"end":g,y=e.fill,b=y===void 0?Q2:y,x=K2(e,bAe),w=v.useMemo(function(){return TAe({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:f,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,f,x.style,x.width]),S=x.dx,C=x.dy,_=x.angle,A=x.className,j=x.breakAll,P=K2(x,wAe);if(!Er(r)||!Er(o))return null;var k=r+(Ae(S)?S:0),O=o+(Ae(C)?C:0),E;switch(m){case"start":E=hC("calc(".concat(u,")"));break;case"middle":E=hC("calc(".concat((w.length-1)/2," * -").concat(c," + (").concat(u," / 2))"));break;default:E=hC("calc(".concat(w.length-1," * -").concat(c,")"));break}var I=[];if(f){var D=w[0].width,z=x.width;I.push("scale(".concat((Ae(z)?z/D:1)/D,")"))}return _&&I.push("rotate(".concat(_,", ").concat(k,", ").concat(O,")")),I.length&&(P.transform=I.join(" ")),N.createElement("text",a1({},rt(P,!0),{x:k,y:O,className:Mt("recharts-text",A),textAnchor:p,fill:b.includes("url")?Q2:b}),w.map(function($,G){var R=$.words.join(j?"":" ");return N.createElement("tspan",{x:k,dy:G===0?E:c,key:"".concat(R,"-").concat(G)},R)}))};function zc(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function NAe(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function bP(t){let e,n,r;t.length!==2?(e=zc,n=(c,l)=>zc(t(c),l),r=(c,l)=>t(c)-l):(e=t===zc||t===NAe?t:PAe,n=t,r=t);function i(c,l,u=0,d=c.length){if(u>>1;n(c[f],l)<0?u=f+1:d=f}while(u>>1;n(c[f],l)<=0?u=f+1:d=f}while(uu&&r(c[f-1],l)>-r(c[f],l)?f-1:f}return{left:i,center:s,right:o}}function PAe(){return 0}function GV(t){return t===null?NaN:+t}function*kAe(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const OAe=bP(zc),Ig=OAe.right;bP(GV).center;class X2 extends Map{constructor(e,n=MAe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,i]of e)this.set(r,i)}get(e){return super.get(J2(this,e))}has(e){return super.has(J2(this,e))}set(e,n){return super.set(IAe(this,e),n)}delete(e){return super.delete(RAe(this,e))}}function J2({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function IAe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function RAe({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function MAe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function DAe(t=zc){if(t===zc)return VV;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function VV(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const $Ae=Math.sqrt(50),LAe=Math.sqrt(10),FAe=Math.sqrt(2);function ib(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=$Ae?10:o>=LAe?5:o>=FAe?2:1;let c,l,u;return i<0?(u=Math.pow(10,-i)/s,c=Math.round(t*u),l=Math.round(e*u),c/ue&&--l,u=-u):(u=Math.pow(10,i)*s,c=Math.round(t/u),l=Math.round(e/u),c*ue&&--l),l0))return[];if(t===e)return[t];const r=e=i))return[];const c=o-i+1,l=new Array(c);if(r)if(s<0)for(let u=0;u=r)&&(n=r);return n}function eM(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function KV(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=i===void 0?VV:DAe(i);r>n;){if(r-n>600){const l=r-n+1,u=e-n+1,d=Math.log(l),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(l-f)/l)*(u-l/2<0?-1:1),p=Math.max(n,Math.floor(e-u*f/l+h)),g=Math.min(r,Math.floor(e+(l-u)*f/l+h));KV(t,e,p,g,i)}const o=t[e];let s=n,c=r;for(Ph(t,n,e),i(t[r],o)>0&&Ph(t,n,r);s0;)--c}i(t[n],o)===0?Ph(t,n,c):(++c,Ph(t,c,r)),c<=e&&(n=c+1),e<=c&&(r=c-1)}return t}function Ph(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function BAe(t,e,n){if(t=Float64Array.from(kAe(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return eM(t);if(e>=1)return Z2(t);var r,i=(r-1)*e,o=Math.floor(i),s=Z2(KV(t,o).subarray(0,o+1)),c=eM(t.subarray(o+1));return s+(c-s)*(i-o)}}function UAe(t,e,n=GV){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,i=(r-1)*e,o=Math.floor(i),s=+n(t[o],o,t),c=+n(t[o+1],o+1,t);return s+(c-s)*(i-o)}}function HAe(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Av(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Av(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=GAe.exec(t))?new Pi(e[1],e[2],e[3],1):(e=VAe.exec(t))?new Pi(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=KAe.exec(t))?Av(e[1],e[2],e[3],e[4]):(e=WAe.exec(t))?Av(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=qAe.exec(t))?aM(e[1],e[2]/100,e[3]/100,1):(e=YAe.exec(t))?aM(e[1],e[2]/100,e[3]/100,e[4]):tM.hasOwnProperty(t)?iM(tM[t]):t==="transparent"?new Pi(NaN,NaN,NaN,0):null}function iM(t){return new Pi(t>>16&255,t>>8&255,t&255,1)}function Av(t,e,n,r){return r<=0&&(t=e=n=NaN),new Pi(t,e,n,r)}function JAe(t){return t instanceof Rg||(t=km(t)),t?(t=t.rgb(),new Pi(t.r,t.g,t.b,t.opacity)):new Pi}function f1(t,e,n,r){return arguments.length===1?JAe(t):new Pi(t,e,n,r??1)}function Pi(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}SP(Pi,f1,qV(Rg,{brighter(t){return t=t==null?ob:Math.pow(ob,t),new Pi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Nm:Math.pow(Nm,t),new Pi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Pi(Jl(this.r),Jl(this.g),Jl(this.b),sb(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oM,formatHex:oM,formatHex8:ZAe,formatRgb:sM,toString:sM}));function oM(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}`}function ZAe(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}${Ll((isNaN(this.opacity)?1:this.opacity)*255)}`}function sM(){const t=sb(this.opacity);return`${t===1?"rgb(":"rgba("}${Jl(this.r)}, ${Jl(this.g)}, ${Jl(this.b)}${t===1?")":`, ${t})`}`}function sb(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Jl(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ll(t){return t=Jl(t),(t<16?"0":"")+t.toString(16)}function aM(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Ko(t,e,n,r)}function YV(t){if(t instanceof Ko)return new Ko(t.h,t.s,t.l,t.opacity);if(t instanceof Rg||(t=km(t)),!t)return new Ko;if(t instanceof Ko)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),s=NaN,c=o-i,l=(o+i)/2;return c?(e===o?s=(n-r)/c+(n0&&l<1?0:s,new Ko(s,c,l,t.opacity)}function e1e(t,e,n,r){return arguments.length===1?YV(t):new Ko(t,e,n,r??1)}function Ko(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}SP(Ko,e1e,qV(Rg,{brighter(t){return t=t==null?ob:Math.pow(ob,t),new Ko(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Nm:Math.pow(Nm,t),new Ko(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Pi(pC(t>=240?t-240:t+120,i,r),pC(t,i,r),pC(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Ko(cM(this.h),jv(this.s),jv(this.l),sb(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=sb(this.opacity);return`${t===1?"hsl(":"hsla("}${cM(this.h)}, ${jv(this.s)*100}%, ${jv(this.l)*100}%${t===1?")":`, ${t})`}`}}));function cM(t){return t=(t||0)%360,t<0?t+360:t}function jv(t){return Math.max(0,Math.min(1,t||0))}function pC(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const CP=t=>()=>t;function t1e(t,e){return function(n){return t+n*e}}function n1e(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function r1e(t){return(t=+t)==1?QV:function(e,n){return n-e?n1e(e,n,t):CP(isNaN(e)?n:e)}}function QV(t,e){var n=e-t;return n?t1e(t,n):CP(isNaN(t)?e:t)}const lM=function t(e){var n=r1e(e);function r(i,o){var s=n((i=f1(i)).r,(o=f1(o)).r),c=n(i.g,o.g),l=n(i.b,o.b),u=QV(i.opacity,o.opacity);return function(d){return i.r=s(d),i.g=c(d),i.b=l(d),i.opacity=u(d),i+""}}return r.gamma=t,r}(1);function i1e(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),i;return function(o){for(i=0;in&&(o=e.slice(n,o),c[s]?c[s]+=o:c[++s]=o),(r=r[0])===(i=i[0])?c[s]?c[s]+=i:c[++s]=i:(c[++s]=null,l.push({i:s,x:ab(r,i)})),n=mC.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function m1e(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i2?g1e:m1e,l=u=null,f}function f(h){return h==null||isNaN(h=+h)?o:(l||(l=c(t.map(r),e,n)))(r(s(h)))}return f.invert=function(h){return s(i((u||(u=c(e,t.map(r),ab)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,cb),d()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),d()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=_P,d()},f.clamp=function(h){return arguments.length?(s=h?!0:vi,d()):s!==vi},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,p){return r=h,i=p,d()}}function AP(){return kw()(vi,vi)}function v1e(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function lb(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function lf(t){return t=lb(Math.abs(t)),t?t[1]:NaN}function y1e(t,e){return function(n,r){for(var i=n.length,o=[],s=0,c=t[0],l=0;i>0&&c>0&&(l+c+1>r&&(c=Math.max(1,r-l)),o.push(n.substring(i-=c,i+c)),!((l+=c+1)>r));)c=t[s=(s+1)%t.length];return o.reverse().join(e)}}function x1e(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var b1e=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Om(t){if(!(e=b1e.exec(t)))throw new Error("invalid format: "+t);var e;return new jP({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Om.prototype=jP.prototype;function jP(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}jP.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function w1e(t){e:for(var e=t.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(i+1):t}var XV;function S1e(t,e){var n=lb(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(XV=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+lb(t,Math.max(0,e+o-1))[0]}function dM(t,e){var n=lb(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const fM={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:v1e,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>dM(t*100,e),r:dM,s:S1e,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function hM(t){return t}var pM=Array.prototype.map,mM=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function C1e(t){var e=t.grouping===void 0||t.thousands===void 0?hM:y1e(pM.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",i=t.decimal===void 0?".":t.decimal+"",o=t.numerals===void 0?hM:x1e(pM.call(t.numerals,String)),s=t.percent===void 0?"%":t.percent+"",c=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function u(f){f=Om(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,y=f.zero,b=f.width,x=f.comma,w=f.precision,S=f.trim,C=f.type;C==="n"?(x=!0,C="g"):fM[C]||(w===void 0&&(w=12),S=!0,C="g"),(y||h==="0"&&p==="=")&&(y=!0,h="0",p="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(C)?"0"+C.toLowerCase():"",A=m==="$"?r:/[%p]/.test(C)?s:"",j=fM[C],P=/[defgprs%]/.test(C);w=w===void 0?6:/[gprs]/.test(C)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function k(O){var E=_,I=A,D,z,$;if(C==="c")I=j(O)+I,O="";else{O=+O;var G=O<0||1/O<0;if(O=isNaN(O)?l:j(Math.abs(O),w),S&&(O=w1e(O)),G&&+O==0&&g!=="+"&&(G=!1),E=(G?g==="("?g:c:g==="-"||g==="("?"":g)+E,I=(C==="s"?mM[8+XV/3]:"")+I+(G&&g==="("?")":""),P){for(D=-1,z=O.length;++D$||$>57){I=($===46?i+O.slice(D+1):O.slice(D))+I,O=O.slice(0,D);break}}}x&&!y&&(O=e(O,1/0));var R=E.length+O.length+I.length,L=R>1)+E+O+I+L.slice(R);break;default:O=L+E+O+I;break}return o(O)}return k.toString=function(){return f+""},k}function d(f,h){var p=u((f=Om(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(lf(h)/3)))*3,m=Math.pow(10,-g),y=mM[8+g/3];return function(b){return p(m*b)+y}}return{format:u,formatPrefix:d}}var Ev,EP,JV;_1e({thousands:",",grouping:[3],currency:["$",""]});function _1e(t){return Ev=C1e(t),EP=Ev.format,JV=Ev.formatPrefix,Ev}function A1e(t){return Math.max(0,-lf(Math.abs(t)))}function j1e(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(lf(e)/3)))*3-lf(Math.abs(t)))}function E1e(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,lf(e)-lf(t))+1}function ZV(t,e,n,r){var i=u1(t,e,n),o;switch(r=Om(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=j1e(i,s))&&(r.precision=o),JV(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=E1e(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=A1e(i))&&(r.precision=o-(r.type==="%")*2);break}}return EP(r)}function hl(t){var e=t.domain;return t.ticks=function(n){var r=e();return c1(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return ZV(i[0],i[i.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),i=0,o=r.length-1,s=r[i],c=r[o],l,u,d=10;for(c0;){if(u=l1(s,c,n),u===l)return r[i]=s,r[o]=c,e(r);if(u>0)s=Math.floor(s/u)*u,c=Math.ceil(c/u)*u;else if(u<0)s=Math.ceil(s*u)/u,c=Math.floor(c*u)/u;else break;l=u}return t},t}function ub(){var t=AP();return t.copy=function(){return Mg(t,ub())},Oo.apply(t,arguments),hl(t)}function e8(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,cb),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return e8(t).unknown(e)},t=arguments.length?Array.from(t,cb):[0,1],hl(n)}function t8(t,e){t=t.slice();var n=0,r=t.length-1,i=t[n],o=t[r],s;return oMath.pow(t,e)}function O1e(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function yM(t){return(e,n)=>-t(-e,n)}function TP(t){const e=t(gM,vM),n=e.domain;let r=10,i,o;function s(){return i=O1e(r),o=k1e(r),n()[0]<0?(i=yM(i),o=yM(o),t(T1e,N1e)):t(gM,vM),e}return e.base=function(c){return arguments.length?(r=+c,s()):r},e.domain=function(c){return arguments.length?(n(c),s()):n()},e.ticks=c=>{const l=n();let u=l[0],d=l[l.length-1];const f=d0){for(;h<=p;++h)for(g=1;gd)break;b.push(m)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(m=h>0?g/o(-h):g*o(h),!(md)break;b.push(m)}b.length*2{if(c==null&&(c=10),l==null&&(l=r===10?"s":","),typeof l!="function"&&(!(r%1)&&(l=Om(l)).precision==null&&(l.trim=!0),l=EP(l)),c===1/0)return l;const u=Math.max(1,r*c/e.ticks().length);return d=>{let f=d/o(Math.round(i(d)));return f*rn(t8(n(),{floor:c=>o(Math.floor(i(c))),ceil:c=>o(Math.ceil(i(c)))})),e}function n8(){const t=TP(kw()).domain([1,10]);return t.copy=()=>Mg(t,n8()).base(t.base()),Oo.apply(t,arguments),t}function xM(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function bM(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function NP(t){var e=1,n=t(xM(e),bM(e));return n.constant=function(r){return arguments.length?t(xM(e=+r),bM(e)):e},hl(n)}function r8(){var t=NP(kw());return t.copy=function(){return Mg(t,r8()).constant(t.constant())},Oo.apply(t,arguments)}function wM(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function I1e(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function R1e(t){return t<0?-t*t:t*t}function PP(t){var e=t(vi,vi),n=1;function r(){return n===1?t(vi,vi):n===.5?t(I1e,R1e):t(wM(n),wM(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},hl(e)}function kP(){var t=PP(kw());return t.copy=function(){return Mg(t,kP()).exponent(t.exponent())},Oo.apply(t,arguments),t}function M1e(){return kP.apply(null,arguments).exponent(.5)}function SM(t){return Math.sign(t)*t*t}function D1e(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function i8(){var t=AP(),e=[0,1],n=!1,r;function i(o){var s=D1e(t(o));return isNaN(s)?r:n?Math.round(s):s}return i.invert=function(o){return t.invert(SM(o))},i.domain=function(o){return arguments.length?(t.domain(o),i):t.domain()},i.range=function(o){return arguments.length?(t.range((e=Array.from(o,cb)).map(SM)),i):e.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(t.clamp(o),i):t.clamp()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return i8(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},Oo.apply(i,arguments),hl(i)}function o8(){var t=[],e=[],n=[],r;function i(){var s=0,c=Math.max(1,e.length);for(n=new Array(c-1);++s0?n[c-1]:t[0],c=n?[r[n-1],e]:[r[u-1],r[u]]},s.unknown=function(l){return arguments.length&&(o=l),s},s.thresholds=function(){return r.slice()},s.copy=function(){return s8().domain([t,e]).range(i).unknown(o)},Oo.apply(hl(s),arguments)}function a8(){var t=[.5],e=[0,1],n,r=1;function i(o){return o!=null&&o<=o?e[Ig(t,o,0,r)]:n}return i.domain=function(o){return arguments.length?(t=Array.from(o),r=Math.min(t.length,e.length-1),i):t.slice()},i.range=function(o){return arguments.length?(e=Array.from(o),r=Math.min(t.length,e.length-1),i):e.slice()},i.invertExtent=function(o){var s=e.indexOf(o);return[t[s-1],t[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return a8().domain(t).range(e).unknown(n)},Oo.apply(i,arguments)}const gC=new Date,vC=new Date;function Tr(t,e,n,r){function i(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(t(o=new Date(+o)),o),i.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),i.round=o=>{const s=i(o),c=i.ceil(o);return o-s(e(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,c)=>{const l=[];if(o=i.ceil(o),c=c==null?1:Math.floor(c),!(o0))return l;let u;do l.push(u=new Date(+o)),e(o,c),t(o);while(uTr(s=>{if(s>=s)for(;t(s),!o(s);)s.setTime(s-1)},(s,c)=>{if(s>=s)if(c<0)for(;++c<=0;)for(;e(s,-1),!o(s););else for(;--c>=0;)for(;e(s,1),!o(s););}),n&&(i.count=(o,s)=>(gC.setTime(+o),vC.setTime(+s),t(gC),t(vC),Math.floor(n(gC,vC))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}const db=Tr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);db.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Tr(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):db);db.range;const wa=1e3,Co=wa*60,Sa=Co*60,Fa=Sa*24,OP=Fa*7,CM=Fa*30,yC=Fa*365,Fl=Tr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*wa)},(t,e)=>(e-t)/wa,t=>t.getUTCSeconds());Fl.range;const IP=Tr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*wa)},(t,e)=>{t.setTime(+t+e*Co)},(t,e)=>(e-t)/Co,t=>t.getMinutes());IP.range;const RP=Tr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Co)},(t,e)=>(e-t)/Co,t=>t.getUTCMinutes());RP.range;const MP=Tr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*wa-t.getMinutes()*Co)},(t,e)=>{t.setTime(+t+e*Sa)},(t,e)=>(e-t)/Sa,t=>t.getHours());MP.range;const DP=Tr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Sa)},(t,e)=>(e-t)/Sa,t=>t.getUTCHours());DP.range;const Dg=Tr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Co)/Fa,t=>t.getDate()-1);Dg.range;const Ow=Tr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Fa,t=>t.getUTCDate()-1);Ow.range;const c8=Tr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Fa,t=>Math.floor(t/Fa));c8.range;function Iu(t){return Tr(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Co)/OP)}const Iw=Iu(0),fb=Iu(1),$1e=Iu(2),L1e=Iu(3),uf=Iu(4),F1e=Iu(5),B1e=Iu(6);Iw.range;fb.range;$1e.range;L1e.range;uf.range;F1e.range;B1e.range;function Ru(t){return Tr(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/OP)}const Rw=Ru(0),hb=Ru(1),U1e=Ru(2),H1e=Ru(3),df=Ru(4),z1e=Ru(5),G1e=Ru(6);Rw.range;hb.range;U1e.range;H1e.range;df.range;z1e.range;G1e.range;const $P=Tr(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());$P.range;const LP=Tr(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());LP.range;const Ba=Tr(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());Ba.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Tr(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});Ba.range;const Ua=Tr(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Ua.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Tr(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});Ua.range;function l8(t,e,n,r,i,o){const s=[[Fl,1,wa],[Fl,5,5*wa],[Fl,15,15*wa],[Fl,30,30*wa],[o,1,Co],[o,5,5*Co],[o,15,15*Co],[o,30,30*Co],[i,1,Sa],[i,3,3*Sa],[i,6,6*Sa],[i,12,12*Sa],[r,1,Fa],[r,2,2*Fa],[n,1,OP],[e,1,CM],[e,3,3*CM],[t,1,yC]];function c(u,d,f){const h=dy).right(s,h);if(p===s.length)return t.every(u1(u/yC,d/yC,f));if(p===0)return db.every(Math.max(u1(u,d,f),1));const[g,m]=s[h/s[p-1][2]53)return null;"w"in Z||(Z.w=1),"Z"in Z?(Le=bC(kh(Z.y,0,1)),At=Le.getUTCDay(),Le=At>4||At===0?hb.ceil(Le):hb(Le),Le=Ow.offset(Le,(Z.V-1)*7),Z.y=Le.getUTCFullYear(),Z.m=Le.getUTCMonth(),Z.d=Le.getUTCDate()+(Z.w+6)%7):(Le=xC(kh(Z.y,0,1)),At=Le.getDay(),Le=At>4||At===0?fb.ceil(Le):fb(Le),Le=Dg.offset(Le,(Z.V-1)*7),Z.y=Le.getFullYear(),Z.m=Le.getMonth(),Z.d=Le.getDate()+(Z.w+6)%7)}else("W"in Z||"U"in Z)&&("w"in Z||(Z.w="u"in Z?Z.u%7:"W"in Z?1:0),At="Z"in Z?bC(kh(Z.y,0,1)).getUTCDay():xC(kh(Z.y,0,1)).getDay(),Z.m=0,Z.d="W"in Z?(Z.w+6)%7+Z.W*7-(At+5)%7:Z.w+Z.U*7-(At+6)%7);return"Z"in Z?(Z.H+=Z.Z/100|0,Z.M+=Z.Z%100,bC(Z)):xC(Z)}}function j(de,ye,Ee,Z){for(var ct=0,Le=ye.length,At=Ee.length,lt,Jt;ct=At)return-1;if(lt=ye.charCodeAt(ct++),lt===37){if(lt=ye.charAt(ct++),Jt=C[lt in _M?ye.charAt(ct++):lt],!Jt||(Z=Jt(de,Ee,Z))<0)return-1}else if(lt!=Ee.charCodeAt(Z++))return-1}return Z}function P(de,ye,Ee){var Z=u.exec(ye.slice(Ee));return Z?(de.p=d.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function k(de,ye,Ee){var Z=p.exec(ye.slice(Ee));return Z?(de.w=g.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function O(de,ye,Ee){var Z=f.exec(ye.slice(Ee));return Z?(de.w=h.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function E(de,ye,Ee){var Z=b.exec(ye.slice(Ee));return Z?(de.m=x.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function I(de,ye,Ee){var Z=m.exec(ye.slice(Ee));return Z?(de.m=y.get(Z[0].toLowerCase()),Ee+Z[0].length):-1}function D(de,ye,Ee){return j(de,e,ye,Ee)}function z(de,ye,Ee){return j(de,n,ye,Ee)}function $(de,ye,Ee){return j(de,r,ye,Ee)}function G(de){return s[de.getDay()]}function R(de){return o[de.getDay()]}function L(de){return l[de.getMonth()]}function W(de){return c[de.getMonth()]}function Y(de){return i[+(de.getHours()>=12)]}function te(de){return 1+~~(de.getMonth()/3)}function me(de){return s[de.getUTCDay()]}function F(de){return o[de.getUTCDay()]}function se(de){return l[de.getUTCMonth()]}function ne(de){return c[de.getUTCMonth()]}function ae(de){return i[+(de.getUTCHours()>=12)]}function De(de){return 1+~~(de.getUTCMonth()/3)}return{format:function(de){var ye=_(de+="",w);return ye.toString=function(){return de},ye},parse:function(de){var ye=A(de+="",!1);return ye.toString=function(){return de},ye},utcFormat:function(de){var ye=_(de+="",S);return ye.toString=function(){return de},ye},utcParse:function(de){var ye=A(de+="",!0);return ye.toString=function(){return de},ye}}}var _M={"-":"",_:" ",0:"0"},$r=/^\s*\d+/,Q1e=/^%/,X1e=/[\\^$*+?|[\]().{}]/g;function cn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[e.toLowerCase(),n]))}function Z1e(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function eje(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function tje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function nje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function rje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function AM(t,e,n){var r=$r.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function jM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function ije(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function oje(t,e,n){var r=$r.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function sje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function EM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function aje(t,e,n){var r=$r.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function TM(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function cje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function lje(t,e,n){var r=$r.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function uje(t,e,n){var r=$r.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function dje(t,e,n){var r=$r.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function fje(t,e,n){var r=Q1e.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function hje(t,e,n){var r=$r.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function pje(t,e,n){var r=$r.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function NM(t,e){return cn(t.getDate(),e,2)}function mje(t,e){return cn(t.getHours(),e,2)}function gje(t,e){return cn(t.getHours()%12||12,e,2)}function vje(t,e){return cn(1+Dg.count(Ba(t),t),e,3)}function u8(t,e){return cn(t.getMilliseconds(),e,3)}function yje(t,e){return u8(t,e)+"000"}function xje(t,e){return cn(t.getMonth()+1,e,2)}function bje(t,e){return cn(t.getMinutes(),e,2)}function wje(t,e){return cn(t.getSeconds(),e,2)}function Sje(t){var e=t.getDay();return e===0?7:e}function Cje(t,e){return cn(Iw.count(Ba(t)-1,t),e,2)}function d8(t){var e=t.getDay();return e>=4||e===0?uf(t):uf.ceil(t)}function _je(t,e){return t=d8(t),cn(uf.count(Ba(t),t)+(Ba(t).getDay()===4),e,2)}function Aje(t){return t.getDay()}function jje(t,e){return cn(fb.count(Ba(t)-1,t),e,2)}function Eje(t,e){return cn(t.getFullYear()%100,e,2)}function Tje(t,e){return t=d8(t),cn(t.getFullYear()%100,e,2)}function Nje(t,e){return cn(t.getFullYear()%1e4,e,4)}function Pje(t,e){var n=t.getDay();return t=n>=4||n===0?uf(t):uf.ceil(t),cn(t.getFullYear()%1e4,e,4)}function kje(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+cn(e/60|0,"0",2)+cn(e%60,"0",2)}function PM(t,e){return cn(t.getUTCDate(),e,2)}function Oje(t,e){return cn(t.getUTCHours(),e,2)}function Ije(t,e){return cn(t.getUTCHours()%12||12,e,2)}function Rje(t,e){return cn(1+Ow.count(Ua(t),t),e,3)}function f8(t,e){return cn(t.getUTCMilliseconds(),e,3)}function Mje(t,e){return f8(t,e)+"000"}function Dje(t,e){return cn(t.getUTCMonth()+1,e,2)}function $je(t,e){return cn(t.getUTCMinutes(),e,2)}function Lje(t,e){return cn(t.getUTCSeconds(),e,2)}function Fje(t){var e=t.getUTCDay();return e===0?7:e}function Bje(t,e){return cn(Rw.count(Ua(t)-1,t),e,2)}function h8(t){var e=t.getUTCDay();return e>=4||e===0?df(t):df.ceil(t)}function Uje(t,e){return t=h8(t),cn(df.count(Ua(t),t)+(Ua(t).getUTCDay()===4),e,2)}function Hje(t){return t.getUTCDay()}function zje(t,e){return cn(hb.count(Ua(t)-1,t),e,2)}function Gje(t,e){return cn(t.getUTCFullYear()%100,e,2)}function Vje(t,e){return t=h8(t),cn(t.getUTCFullYear()%100,e,2)}function Kje(t,e){return cn(t.getUTCFullYear()%1e4,e,4)}function Wje(t,e){var n=t.getUTCDay();return t=n>=4||n===0?df(t):df.ceil(t),cn(t.getUTCFullYear()%1e4,e,4)}function qje(){return"+0000"}function kM(){return"%"}function OM(t){return+t}function IM(t){return Math.floor(+t/1e3)}var Gu,p8,m8;Yje({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Yje(t){return Gu=Y1e(t),p8=Gu.format,Gu.parse,m8=Gu.utcFormat,Gu.utcParse,Gu}function Qje(t){return new Date(t)}function Xje(t){return t instanceof Date?+t:+new Date(+t)}function FP(t,e,n,r,i,o,s,c,l,u){var d=AP(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),y=u("%I %p"),b=u("%a %d"),x=u("%b %d"),w=u("%B"),S=u("%Y");function C(_){return(l(_)<_?p:c(_)<_?g:s(_)<_?m:o(_)<_?y:r(_)<_?i(_)<_?b:x:n(_)<_?w:S)(_)}return d.invert=function(_){return new Date(f(_))},d.domain=function(_){return arguments.length?h(Array.from(_,Xje)):h().map(Qje)},d.ticks=function(_){var A=h();return t(A[0],A[A.length-1],_??10)},d.tickFormat=function(_,A){return A==null?C:u(A)},d.nice=function(_){var A=h();return(!_||typeof _.range!="function")&&(_=e(A[0],A[A.length-1],_??10)),_?h(t8(A,_)):d},d.copy=function(){return Mg(d,FP(t,e,n,r,i,o,s,c,l,u))},d}function Jje(){return Oo.apply(FP(W1e,q1e,Ba,$P,Iw,Dg,MP,IP,Fl,p8).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Zje(){return Oo.apply(FP(V1e,K1e,Ua,LP,Rw,Ow,DP,RP,Fl,m8).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Mw(){var t=0,e=1,n,r,i,o,s=vi,c=!1,l;function u(f){return f==null||isNaN(f=+f)?l:s(i===0?.5:(f=(o(f)-n)*i,c?Math.max(0,Math.min(1,f)):f))}u.domain=function(f){return arguments.length?([t,e]=f,n=o(t=+t),r=o(e=+e),i=n===r?0:1/(r-n),u):[t,e]},u.clamp=function(f){return arguments.length?(c=!!f,u):c},u.interpolator=function(f){return arguments.length?(s=f,u):s};function d(f){return function(h){var p,g;return arguments.length?([p,g]=h,s=f(p,g),u):[s(0),s(1)]}}return u.range=d(oh),u.rangeRound=d(_P),u.unknown=function(f){return arguments.length?(l=f,u):l},function(f){return o=f,n=f(t),r=f(e),i=n===r?0:1/(r-n),u}}function pl(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function g8(){var t=hl(Mw()(vi));return t.copy=function(){return pl(t,g8())},Ya.apply(t,arguments)}function v8(){var t=TP(Mw()).domain([1,10]);return t.copy=function(){return pl(t,v8()).base(t.base())},Ya.apply(t,arguments)}function y8(){var t=NP(Mw());return t.copy=function(){return pl(t,y8()).constant(t.constant())},Ya.apply(t,arguments)}function BP(){var t=PP(Mw());return t.copy=function(){return pl(t,BP()).exponent(t.exponent())},Ya.apply(t,arguments)}function eEe(){return BP.apply(null,arguments).exponent(.5)}function x8(){var t=[],e=vi;function n(r){if(r!=null&&!isNaN(r=+r))return e((Ig(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let i of r)i!=null&&!isNaN(i=+i)&&t.push(i);return t.sort(zc),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,i)=>e(i/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,o)=>BAe(t,o/r))},n.copy=function(){return x8(e).domain(t)},Ya.apply(n,arguments)}function Dw(){var t=0,e=.5,n=1,r=1,i,o,s,c,l,u=vi,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-o)*(r*me}var C8=iEe,oEe=$w,sEe=C8,aEe=ih;function cEe(t){return t&&t.length?oEe(t,aEe,sEe):void 0}var lEe=cEe;const Sc=dn(lEe);function uEe(t,e){return tt.e^o.s<0?1:-1;for(r=o.d.length,i=t.d.length,e=0,n=rt.d[e]^o.s<0?1:-1;return r===i?0:r>i^o.s<0?1:-1};Je.decimalPlaces=Je.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*$n;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};Je.dividedBy=Je.div=function(t){return Ta(this,new this.constructor(t))};Je.dividedToIntegerBy=Je.idiv=function(t){var e=this,n=e.constructor;return En(Ta(e,new n(t),0,1),n.precision)};Je.equals=Je.eq=function(t){return!this.cmp(t)};Je.exponent=function(){return pr(this)};Je.greaterThan=Je.gt=function(t){return this.cmp(t)>0};Je.greaterThanOrEqualTo=Je.gte=function(t){return this.cmp(t)>=0};Je.isInteger=Je.isint=function(){return this.e>this.d.length-2};Je.isNegative=Je.isneg=function(){return this.s<0};Je.isPositive=Je.ispos=function(){return this.s>0};Je.isZero=function(){return this.s===0};Je.lessThan=Je.lt=function(t){return this.cmp(t)<0};Je.lessThanOrEqualTo=Je.lte=function(t){return this.cmp(t)<1};Je.logarithm=Je.log=function(t){var e,n=this,r=n.constructor,i=r.precision,o=i+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(Yi))throw Error(No+"NaN");if(n.s<1)throw Error(No+(n.s?"NaN":"-Infinity"));return n.eq(Yi)?new r(0):(Gn=!1,e=Ta(Im(n,o),Im(t,o),o),Gn=!0,En(e,i))};Je.minus=Je.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?T8(e,t):j8(e,(t.s=-t.s,t))};Je.modulo=Je.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(No+"NaN");return n.s?(Gn=!1,e=Ta(n,t,0,1).times(t),Gn=!0,n.minus(e)):En(new r(n),i)};Je.naturalExponential=Je.exp=function(){return E8(this)};Je.naturalLogarithm=Je.ln=function(){return Im(this)};Je.negated=Je.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};Je.plus=Je.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?j8(e,t):T8(e,(t.s=-t.s,t))};Je.precision=Je.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(Zl+t);if(e=pr(i)+1,r=i.d.length-1,n=r*$n+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};Je.squareRoot=Je.sqrt=function(){var t,e,n,r,i,o,s,c=this,l=c.constructor;if(c.s<1){if(!c.s)return new l(0);throw Error(No+"NaN")}for(t=pr(c),Gn=!1,i=Math.sqrt(+c),i==0||i==1/0?(e=Os(c.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=ah((t+1)/2)-(t<0||t%2),i==1/0?e="5e"+t:(e=i.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new l(e)):r=new l(i.toString()),n=l.precision,i=s=n+3;;)if(o=r,r=o.plus(Ta(c,o,s+2)).times(.5),Os(o.d).slice(0,s)===(e=Os(r.d)).slice(0,s)){if(e=e.slice(s-3,s+1),i==s&&e=="4999"){if(En(o,n+1,0),o.times(o).eq(c)){r=o;break}}else if(e!="9999")break;s+=4}return Gn=!0,En(r,n)};Je.times=Je.mul=function(t){var e,n,r,i,o,s,c,l,u,d=this,f=d.constructor,h=d.d,p=(t=new f(t)).d;if(!d.s||!t.s)return new f(0);for(t.s*=d.s,n=d.e+t.e,l=h.length,u=p.length,l=0;){for(e=0,i=l+r;i>r;)c=o[i]+p[r]*h[i-r-1]+e,o[i--]=c%kr|0,e=c/kr|0;o[i]=(o[i]+e)%kr|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,Gn?En(t,f.precision):t};Je.toDecimalPlaces=Je.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(qs(t,0,sh),e===void 0?e=r.rounding:qs(e,0,8),En(n,t+pr(n)+1,e))};Je.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Cu(r,!0):(qs(t,0,sh),e===void 0?e=i.rounding:qs(e,0,8),r=En(new i(r),t+1,e),n=Cu(r,!0,t+1)),n};Je.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?Cu(i):(qs(t,0,sh),e===void 0?e=o.rounding:qs(e,0,8),r=En(new o(i),t+pr(i)+1,e),n=Cu(r.abs(),!1,t+pr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Je.toInteger=Je.toint=function(){var t=this,e=t.constructor;return En(new e(t),pr(t)+1,e.rounding)};Je.toNumber=function(){return+this};Je.toPower=Je.pow=function(t){var e,n,r,i,o,s,c=this,l=c.constructor,u=12,d=+(t=new l(t));if(!t.s)return new l(Yi);if(c=new l(c),!c.s){if(t.s<1)throw Error(No+"Infinity");return c}if(c.eq(Yi))return c;if(r=l.precision,t.eq(Yi))return En(c,r);if(e=t.e,n=t.d.length-1,s=e>=n,o=c.s,s){if((n=d<0?-d:d)<=A8){for(i=new l(Yi),e=Math.ceil(r/$n+4),Gn=!1;n%2&&(i=i.times(c),DM(i.d,e)),n=ah(n/2),n!==0;)c=c.times(c),DM(c.d,e);return Gn=!0,t.s<0?new l(Yi).div(i):En(i,r)}}else if(o<0)throw Error(No+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,c.s=1,Gn=!1,i=t.times(Im(c,r+u)),Gn=!0,i=E8(i),i.s=o,i};Je.toPrecision=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?(n=pr(i),r=Cu(i,n<=o.toExpNeg||n>=o.toExpPos)):(qs(t,1,sh),e===void 0?e=o.rounding:qs(e,0,8),i=En(new o(i),t,e),n=pr(i),r=Cu(i,t<=n||n<=o.toExpNeg,t)),r};Je.toSignificantDigits=Je.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(qs(t,1,sh),e===void 0?e=r.rounding:qs(e,0,8)),En(new r(n),t,e)};Je.toString=Je.valueOf=Je.val=Je.toJSON=Je[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=pr(t),n=t.constructor;return Cu(t,e<=n.toExpNeg||e>=n.toExpPos)};function j8(t,e){var n,r,i,o,s,c,l,u,d=t.constructor,f=d.precision;if(!t.s||!e.s)return e.s||(e=new d(t)),Gn?En(e,f):e;if(l=t.d,u=e.d,s=t.e,i=e.e,l=l.slice(),o=s-i,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,i=s,c=l.length),s=Math.ceil(f/$n),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/kr|0,l[o]%=kr;for(n&&(l.unshift(n),++i),c=l.length;l[--c]==0;)l.pop();return e.d=l,e.e=i,Gn?En(e,f):e}function qs(t,e,n){if(t!==~~t||tn)throw Error(Zl+t)}function Os(t){var e,n,r,i=t.length-1,o="",s=t[0];if(i>0){for(o+=s,e=1;es?1:-1;else for(c=l=0;ci[c]?1:-1;break}return l}function n(r,i,o){for(var s=0;o--;)r[o]-=s,s=r[o]1;)r.shift()}return function(r,i,o,s){var c,l,u,d,f,h,p,g,m,y,b,x,w,S,C,_,A,j,P=r.constructor,k=r.s==i.s?1:-1,O=r.d,E=i.d;if(!r.s)return new P(r);if(!i.s)throw Error(No+"Division by zero");for(l=r.e-i.e,A=E.length,C=O.length,p=new P(k),g=p.d=[],u=0;E[u]==(O[u]||0);)++u;if(E[u]>(O[u]||0)&&--l,o==null?x=o=P.precision:s?x=o+(pr(r)-pr(i))+1:x=o,x<0)return new P(0);if(x=x/$n+2|0,u=0,A==1)for(d=0,E=E[0],x++;(u1&&(E=t(E,d),O=t(O,d),A=E.length,C=O.length),S=A,m=O.slice(0,A),y=m.length;y=kr/2&&++_;do d=0,c=e(E,m,A,y),c<0?(b=m[0],A!=y&&(b=b*kr+(m[1]||0)),d=b/_|0,d>1?(d>=kr&&(d=kr-1),f=t(E,d),h=f.length,y=m.length,c=e(f,m,h,y),c==1&&(d--,n(f,A16)throw Error(HP+pr(t));if(!t.s)return new d(Yi);for(e==null?(Gn=!1,c=f):c=e,s=new d(.03125);t.abs().gte(.1);)t=t.times(s),u+=5;for(r=Math.log(jl(2,u))/Math.LN10*2+5|0,c+=r,n=i=o=new d(Yi),d.precision=c;;){if(i=En(i.times(t),c),n=n.times(++l),s=o.plus(Ta(i,n,c)),Os(s.d).slice(0,c)===Os(o.d).slice(0,c)){for(;u--;)o=En(o.times(o),c);return d.precision=f,e==null?(Gn=!0,En(o,f)):o}o=s}}function pr(t){for(var e=t.e*$n,n=t.d[0];n>=10;n/=10)e++;return e}function wC(t,e,n){if(e>t.LN10.sd())throw Gn=!0,n&&(t.precision=n),Error(No+"LN10 precision limit exceeded");return En(new t(t.LN10),e)}function sc(t){for(var e="";t--;)e+="0";return e}function Im(t,e){var n,r,i,o,s,c,l,u,d,f=1,h=10,p=t,g=p.d,m=p.constructor,y=m.precision;if(p.s<1)throw Error(No+(p.s?"NaN":"-Infinity"));if(p.eq(Yi))return new m(0);if(e==null?(Gn=!1,u=y):u=e,p.eq(10))return e==null&&(Gn=!0),wC(m,u);if(u+=h,m.precision=u,n=Os(g),r=n.charAt(0),o=pr(p),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Os(p.d),r=n.charAt(0),f++;o=pr(p),r>1?(p=new m("0."+n),o++):p=new m(r+"."+n.slice(1))}else return l=wC(m,u+2,y).times(o+""),p=Im(new m(r+"."+n.slice(1)),u-h).plus(l),m.precision=y,e==null?(Gn=!0,En(p,y)):p;for(c=s=p=Ta(p.minus(Yi),p.plus(Yi),u),d=En(p.times(p),u),i=3;;){if(s=En(s.times(d),u),l=c.plus(Ta(s,new m(i),u)),Os(l.d).slice(0,u)===Os(c.d).slice(0,u))return c=c.times(2),o!==0&&(c=c.plus(wC(m,u+2,y).times(o+""))),c=Ta(c,new m(f),u),m.precision=y,e==null?(Gn=!0,En(c,y)):c;c=l,i+=2}}function MM(t,e){var n,r,i;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(i=e.length;e.charCodeAt(i-1)===48;)--i;if(e=e.slice(r,i),e){if(i-=r,n=n-r-1,t.e=ah(n/$n),t.d=[],r=(n+1)%$n,n<0&&(r+=$n),rpb||t.e<-pb))throw Error(HP+n)}else t.s=0,t.e=0,t.d=[0];return t}function En(t,e,n){var r,i,o,s,c,l,u,d,f=t.d;for(s=1,o=f[0];o>=10;o/=10)s++;if(r=e-s,r<0)r+=$n,i=e,u=f[d=0];else{if(d=Math.ceil((r+1)/$n),o=f.length,d>=o)return t;for(u=o=f[d],s=1;o>=10;o/=10)s++;r%=$n,i=r-$n+s}if(n!==void 0&&(o=jl(10,s-i-1),c=u/o%10|0,l=e<0||f[d+1]!==void 0||u%o,l=n<4?(c||l)&&(n==0||n==(t.s<0?3:2)):c>5||c==5&&(n==4||l||n==6&&(r>0?i>0?u/jl(10,s-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(o=pr(t),f.length=1,e=e-o-1,f[0]=jl(10,($n-e%$n)%$n),t.e=ah(-e/$n)||0):(f.length=1,f[0]=t.e=t.s=0),t;if(r==0?(f.length=d,o=1,d--):(f.length=d+1,o=jl(10,$n-r),f[d]=i>0?(u/jl(10,s-i)%jl(10,i)|0)*o:0),l)for(;;)if(d==0){(f[0]+=o)==kr&&(f[0]=1,++t.e);break}else{if(f[d]+=o,f[d]!=kr)break;f[d--]=0,o=1}for(r=f.length;f[--r]===0;)f.pop();if(Gn&&(t.e>pb||t.e<-pb))throw Error(HP+pr(t));return t}function T8(t,e){var n,r,i,o,s,c,l,u,d,f,h=t.constructor,p=h.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new h(t),Gn?En(e,p):e;if(l=t.d,f=e.d,r=e.e,u=t.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=f.length):(n=f,r=u,c=l.length),i=Math.max(Math.ceil(p/$n),c)+2,s>i&&(s=i,n.length=1),n.reverse(),i=s;i--;)n.push(0);n.reverse()}else{for(i=l.length,c=f.length,d=i0;--i)l[c++]=0;for(i=f.length;i>s;){if(l[--i]0?o=o.charAt(0)+"."+o.slice(1)+sc(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+sc(-i-1)+o,n&&(r=n-s)>0&&(o+=sc(r))):i>=s?(o+=sc(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+sc(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=sc(r))),t.s<0?"-"+o:o}function DM(t,e){if(t.length>e)return t.length=e,!0}function N8(t){var e,n,r;function i(o){var s=this;if(!(s instanceof i))return new i(o);if(s.constructor=i,o instanceof i){s.s=o.s,s.e=o.e,s.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(Zl+o);if(o>0)s.s=1;else if(o<0)o=-o,s.s=-1;else{s.s=0,s.e=0,s.d=[0];return}if(o===~~o&&o<1e7){s.e=0,s.d=[o];return}return MM(s,o.toString())}else if(typeof o!="string")throw Error(Zl+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,kEe.test(o))MM(s,o);else throw Error(Zl+o)}if(i.prototype=Je,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=N8,i.config=i.set=OEe,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e=i[e+1]&&r<=i[e+2])this[n]=r;else throw Error(Zl+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Zl+n+": "+r);return this}var zP=N8(PEe);Yi=new zP(1);const Sn=zP;function IEe(t){return $Ee(t)||DEe(t)||MEe(t)||REe()}function REe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function MEe(t,e){if(t){if(typeof t=="string")return m1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m1(t,e)}}function DEe(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function $Ee(t){if(Array.isArray(t))return m1(t)}function m1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=e?n.apply(void 0,i):t(e-s,$M(function(){for(var c=arguments.length,l=new Array(c),u=0;ut.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,i=!1,o=void 0;try{for(var s=t[Symbol.iterator](),c;!(r=(c=s.next()).done)&&(n.push(c.value),!(e&&n.length===e));r=!0);}catch(l){i=!0,o=l}finally{try{!r&&s.return!=null&&s.return()}finally{if(i)throw o}}return n}}function JEe(t){if(Array.isArray(t))return t}function R8(t){var e=Rm(t,2),n=e[0],r=e[1],i=n,o=r;return n>r&&(i=r,o=n),[i,o]}function M8(t,e,n){if(t.lte(0))return new Sn(0);var r=Bw.getDigitCount(t.toNumber()),i=new Sn(10).pow(r),o=t.div(i),s=r!==1?.05:.1,c=new Sn(Math.ceil(o.div(s).toNumber())).add(n).mul(s),l=c.mul(i);return e?l:new Sn(Math.ceil(l))}function ZEe(t,e,n){var r=1,i=new Sn(t);if(!i.isint()&&n){var o=Math.abs(t);o<1?(r=new Sn(10).pow(Bw.getDigitCount(t)-1),i=new Sn(Math.floor(i.div(r).toNumber())).mul(r)):o>1&&(i=new Sn(Math.floor(t)))}else t===0?i=new Sn(Math.floor((e-1)/2)):n||(i=new Sn(Math.floor(t)));var s=Math.floor((e-1)/2),c=UEe(BEe(function(l){return i.add(new Sn(l-s).mul(r)).toNumber()}),g1);return c(0,e)}function D8(t,e,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new Sn(0),tickMin:new Sn(0),tickMax:new Sn(0)};var o=M8(new Sn(e).sub(t).div(n-1),r,i),s;t<=0&&e>=0?s=new Sn(0):(s=new Sn(t).add(e).div(2),s=s.sub(new Sn(s).mod(o)));var c=Math.ceil(s.sub(t).div(o).toNumber()),l=Math.ceil(new Sn(e).sub(s).div(o).toNumber()),u=c+l+1;return u>n?D8(t,e,n,r,i+1):(u0?l+(n-u):l,c=e>0?c:c+(n-u)),{step:o,tickMin:s.sub(new Sn(c).mul(o)),tickMax:s.add(new Sn(l).mul(o))})}function eTe(t){var e=Rm(t,2),n=e[0],r=e[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=Math.max(i,2),c=R8([n,r]),l=Rm(c,2),u=l[0],d=l[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(y1(g1(0,i-1).map(function(){return 1/0}))):[].concat(y1(g1(0,i-1).map(function(){return-1/0})),[d]);return n>r?v1(f):f}if(u===d)return ZEe(u,i,o);var h=D8(u,d,s,o),p=h.step,g=h.tickMin,m=h.tickMax,y=Bw.rangeStep(g,m.add(new Sn(.1).mul(p)),p);return n>r?v1(y):y}function tTe(t,e){var n=Rm(t,2),r=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=R8([r,i]),c=Rm(s,2),l=c[0],u=c[1];if(l===-1/0||u===1/0)return[r,i];if(l===u)return[l];var d=Math.max(e,2),f=M8(new Sn(u).sub(l).div(d-1),o,0),h=[].concat(y1(Bw.rangeStep(new Sn(l),new Sn(u).sub(new Sn(.99).mul(f)),f)),[u]);return r>i?v1(h):h}var nTe=O8(eTe),rTe=O8(tTe),iTe="Invariant failed";function _u(t,e){throw new Error(iTe)}var oTe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function ff(t){"@babel/helpers - typeof";return ff=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ff(t)}function mb(){return mb=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function fTe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function hTe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pTe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,s=-1,c=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(c<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var l=o.range,u=0;u0?i[u-1].coordinate:i[c-1].coordinate,f=i[u].coordinate,h=u>=c-1?i[0].coordinate:i[u+1].coordinate,p=void 0;if(mi(f-d)!==mi(h-f)){var g=[];if(mi(h-f)===mi(l[1]-l[0])){p=h;var m=f+l[1]-l[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var y=h+l[1]-l[0];g[0]=Math.min(f,(y+f)/2),g[1]=Math.max(f,(y+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(e>b[0]&&e<=b[1]||e>=g[0]&&e<=g[1]){s=i[u].index;break}}else{var x=Math.min(d,h),w=Math.max(d,h);if(e>(x+f)/2&&e<=(w+f)/2){s=i[u].index;break}}}else for(var S=0;S0&&S(r[S].coordinate+r[S-1].coordinate)/2&&e<=(r[S].coordinate+r[S+1].coordinate)/2||S===c-1&&e>(r[S].coordinate+r[S-1].coordinate)/2){s=r[S].index;break}return s},GP=function(e){var n,r=e,i=r.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Zn(Zn({},e.type.defaultProps),e.props):e.props,s=o.stroke,c=o.fill,l;switch(i){case"Line":l=s;break;case"Area":case"Radar":l=s&&s!=="none"?s:c;break;default:l=c;break}return l},kTe=function(e){var n=e.barSize,r=e.totalSize,i=e.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var s={},c=Object.keys(o),l=0,u=c.length;l=0});if(b&&b.length){var x=b[0].type.defaultProps,w=x!==void 0?Zn(Zn({},x),b[0].props):b[0].props,S=w.barSize,C=w[y];s[C]||(s[C]=[]);var _=Dt(S)?n:S;s[C].push({item:b[0],stackList:b.slice(1),barSize:Dt(_)?void 0:gi(_,r,0)})}}return s},OTe=function(e){var n=e.barGap,r=e.barCategoryGap,i=e.bandSize,o=e.sizeList,s=o===void 0?[]:o,c=e.maxBarSize,l=s.length;if(l<1)return null;var u=gi(n,i,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=i/l,g=s.reduce(function(S,C){return S+C.barSize||0},0);g+=(l-1)*u,g>=i&&(g-=(l-1)*u,u=0),g>=i&&p>0&&(h=!0,p*=.9,g=l*p);var m=(i-g)/2>>0,y={offset:m-u,size:0};d=s.reduce(function(S,C){var _={item:C.item,position:{offset:y.offset+y.size+u,size:h?p:C.barSize}},A=[].concat(BM(S),[_]);return y=A[A.length-1].position,C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){A.push({item:j,position:y})}),A},f)}else{var b=gi(r,i,0,!0);i-2*b-(l-1)*u<=0&&(u=0);var x=(i-2*b-(l-1)*u)/l;x>1&&(x>>=0);var w=c===+c?Math.min(x,c):x;d=s.reduce(function(S,C,_){var A=[].concat(BM(S),[{item:C.item,position:{offset:b+(x+u)*_+(x-w)/2,size:w}}]);return C.stackList&&C.stackList.length&&C.stackList.forEach(function(j){A.push({item:j,position:A[A.length-1].position})}),A},f)}return d},ITe=function(e,n,r,i){var o=r.children,s=r.width,c=r.margin,l=s-(c.left||0)-(c.right||0),u=B8({children:o,legendWidth:l});if(u){var d=i||{},f=d.width,h=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&Ae(e[p]))return Zn(Zn({},e),{},Pd({},p,e[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&Ae(e[g]))return Zn(Zn({},e),{},Pd({},g,e[g]+(h||0)))}return e},RTe=function(e,n,r){return Dt(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},U8=function(e,n,r,i,o){var s=n.props.children,c=jo(s,Uw).filter(function(u){return RTe(i,o,u.props.direction)});if(c&&c.length){var l=c.map(function(u){return u.props.dataKey});return e.reduce(function(u,d){var f=ir(d,r);if(Dt(f))return u;var h=Array.isArray(f)?[Lw(f),Sc(f)]:[f,f],p=l.reduce(function(g,m){var y=ir(d,m,0),b=h[0]-Math.abs(Array.isArray(y)?y[0]:y),x=h[1]+Math.abs(Array.isArray(y)?y[1]:y);return[Math.min(b,g[0]),Math.max(x,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},MTe=function(e,n,r,i,o){var s=n.map(function(c){return U8(e,c,r,o,i)}).filter(function(c){return!Dt(c)});return s&&s.length?s.reduce(function(c,l){return[Math.min(c[0],l[0]),Math.max(c[1],l[1])]},[1/0,-1/0]):null},H8=function(e,n,r,i,o){var s=n.map(function(l){var u=l.props.dataKey;return r==="number"&&u&&U8(e,l,u,i)||yp(e,u,r,o)});if(r==="number")return s.reduce(function(l,u){return[Math.min(l[0],u[0]),Math.max(l[1],u[1])]},[1/0,-1/0]);var c={};return s.reduce(function(l,u){for(var d=0,f=u.length;d=2?mi(c[0]-c[1])*2*u:u,n&&(e.ticks||e.niceTicks)){var d=(e.ticks||e.niceTicks).map(function(f){var h=o?o.indexOf(f):f;return{coordinate:i(h)+u,value:f,offset:u}});return d.filter(function(f){return!eh(f.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(f,h){return{coordinate:i(f)+u,value:f,index:h,offset:u}}):i.ticks&&!r?i.ticks(e.tickCount).map(function(f){return{coordinate:i(f)+u,value:f,offset:u}}):i.domain().map(function(f,h){return{coordinate:i(f)+u,value:o?o[f]:f,index:h,offset:u}})},SC=new WeakMap,Tv=function(e,n){if(typeof n!="function")return e;SC.has(e)||SC.set(e,new WeakMap);var r=SC.get(e);if(r.has(n))return r.get(n);var i=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},V8=function(e,n,r){var i=e.scale,o=e.type,s=e.layout,c=e.axisType;if(i==="auto")return s==="radial"&&c==="radiusAxis"?{scale:Tm(),realScaleType:"band"}:s==="radial"&&c==="angleAxis"?{scale:ub(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:vp(),realScaleType:"point"}:o==="category"?{scale:Tm(),realScaleType:"band"}:{scale:ub(),realScaleType:"linear"};if(Pg(i)){var l="scale".concat(_w(i));return{scale:(RM[l]||vp)(),realScaleType:RM[l]?l:"point"}}return Ct(i)?{scale:i}:{scale:vp(),realScaleType:"point"}},HM=1e-4,K8=function(e){var n=e.domain();if(!(!n||n.length<=2)){var r=n.length,i=e.range(),o=Math.min(i[0],i[1])-HM,s=Math.max(i[0],i[1])+HM,c=e(n[0]),l=e(n[r-1]);(cs||ls)&&e.domain([n[0],n[r-1]])}},DTe=function(e,n){if(!e)return null;for(var r=0,i=e.length;ri)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(e[c][r][0]=o,e[c][r][1]=o+l,o=e[c][r][1]):(e[c][r][0]=s,e[c][r][1]=s+l,s=e[c][r][1])}},FTe=function(e){var n=e.length;if(!(n<=0))for(var r=0,i=e[0].length;r=0?(e[s][r][0]=o,e[s][r][1]=o+c,o=e[s][r][1]):(e[s][r][0]=0,e[s][r][1]=0)}},BTe={sign:LTe,expand:ove,none:rf,silhouette:sve,wiggle:ave,positive:FTe},UTe=function(e,n,r){var i=n.map(function(c){return c.props.dataKey}),o=BTe[r],s=ive().keys(i).value(function(c,l){return+ir(c,l,0)}).order(KA).offset(o);return s(e)},HTe=function(e,n,r,i,o,s){if(!e)return null;var c=s?n.reverse():n,l={},u=c.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Zn(Zn({},h.type.defaultProps),h.props):h.props,m=g.stackId,y=g.hide;if(y)return f;var b=g[r],x=f[b]||{hasStack:!1,stackGroups:{}};if(Er(m)){var w=x.stackGroups[m]||{numericAxisId:r,cateAxisId:i,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[m]=w}else x.stackGroups[th("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return Zn(Zn({},f),{},Pd({},b,x))},l),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,y){var b=p.stackGroups[y];return Zn(Zn({},m),{},Pd({},y,{numericAxisId:r,cateAxisId:i,items:b.items,stackedData:UTe(e,b.items,o)}))},g)}return Zn(Zn({},f),{},Pd({},h,p))},d)},W8=function(e,n){var r=n.realScaleType,i=n.type,o=n.tickCount,s=n.originalDomain,c=n.allowDecimals,l=r||n.scale;if(l!=="auto"&&l!=="linear")return null;if(o&&i==="number"&&s&&(s[0]==="auto"||s[1]==="auto")){var u=e.domain();if(!u.length)return null;var d=nTe(u,o,c);return e.domain([Lw(d),Sc(d)]),{niceTicks:d}}if(o&&i==="number"){var f=e.domain(),h=rTe(f,o,c);return{niceTicks:h}}return null};function zM(t){var e=t.axis,n=t.ticks,r=t.bandSize,i=t.entry,o=t.index,s=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!Dt(i[e.dataKey])){var c=zx(n,"value",i[e.dataKey]);if(c)return c.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var l=ir(i,Dt(s)?e.dataKey:s);return Dt(l)?null:e.scale(l)}var GM=function(e){var n=e.axis,r=e.ticks,i=e.offset,o=e.bandSize,s=e.entry,c=e.index;if(n.type==="category")return r[c]?r[c].coordinate+i:null;var l=ir(s,n.dataKey,n.domain[c]);return Dt(l)?null:n.scale(l)-o/2+i},zTe=function(e){var n=e.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return i<=0&&o>=0?0:o<0?o:i}return r[0]},GTe=function(e,n){var r,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Zn(Zn({},e.type.defaultProps),e.props):e.props,o=i.stackId;if(Er(o)){var s=n[o];if(s){var c=s.items.indexOf(e);return c>=0?s.stackedData[c]:null}}return null},VTe=function(e){return e.reduce(function(n,r){return[Lw(r.concat([n[0]]).filter(Ae)),Sc(r.concat([n[1]]).filter(Ae))]},[1/0,-1/0])},q8=function(e,n,r){return Object.keys(e).reduce(function(i,o){var s=e[o],c=s.stackedData,l=c.reduce(function(u,d){var f=VTe(d.slice(n,r+1));return[Math.min(u[0],f[0]),Math.max(u[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],i[0]),Math.max(l[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},VM=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,KM=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,S1=function(e,n,r){if(Ct(e))return e(n,r);if(!Array.isArray(e))return n;var i=[];if(Ae(e[0]))i[0]=r?e[0]:Math.min(e[0],n[0]);else if(VM.test(e[0])){var o=+VM.exec(e[0])[1];i[0]=n[0]-o}else Ct(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(Ae(e[1]))i[1]=r?e[1]:Math.max(e[1],n[1]);else if(KM.test(e[1])){var s=+KM.exec(e[1])[1];i[1]=n[1]+s}else Ct(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},vb=function(e,n,r){if(e&&e.scale&&e.scale.bandwidth){var i=e.scale.bandwidth();if(!r||i>0)return i}if(e&&n&&n.length>=2){for(var o=yP(n,function(f){return f.coordinate}),s=1/0,c=1,l=o.length;ct.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},J8=function(e,n,r,i,o){var s=e.width,c=e.height,l=e.startAngle,u=e.endAngle,d=gi(e.cx,s,s/2),f=gi(e.cy,c,c/2),h=X8(s,c,r),p=gi(e.innerRadius,h,0),g=gi(e.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(y,b){var x=n[b],w=x.domain,S=x.reversed,C;if(Dt(x.range))i==="angleAxis"?C=[l,u]:i==="radiusAxis"&&(C=[p,g]),S&&(C=[C[1],C[0]]);else{C=x.range;var _=C,A=qTe(_,2);l=A[0],u=A[1]}var j=V8(x,o),P=j.realScaleType,k=j.scale;k.domain(w).range(C),K8(k);var O=W8(k,fa(fa({},x),{},{realScaleType:P})),E=fa(fa(fa({},x),O),{},{range:C,radius:g,realScaleType:P,scale:k,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:l,endAngle:u});return fa(fa({},y),{},Q8({},b,E))},{})},eNe=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(i-s,2))},tNe=function(e,n){var r=e.x,i=e.y,o=n.cx,s=n.cy,c=eNe({x:r,y:i},{x:o,y:s});if(c<=0)return{radius:c};var l=(r-o)/c,u=Math.acos(l);return i>s&&(u=2*Math.PI-u),{radius:c,angle:ZTe(u),angleInRadian:u}},nNe=function(e){var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),o=Math.floor(r/360),s=Math.min(i,o);return{startAngle:n-s*360,endAngle:r-s*360}},rNe=function(e,n){var r=n.startAngle,i=n.endAngle,o=Math.floor(r/360),s=Math.floor(i/360),c=Math.min(o,s);return e+c*360},QM=function(e,n){var r=e.x,i=e.y,o=tNe({x:r,y:i},n),s=o.radius,c=o.angle,l=n.innerRadius,u=n.outerRadius;if(su)return!1;if(s===0)return!0;var d=nNe(n),f=d.startAngle,h=d.endAngle,p=c,g;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return g?fa(fa({},n),{},{radius:s,angle:rNe(p,n)}):null},Z8=function(e){return!v.isValidElement(e)&&!Ct(e)&&typeof e!="boolean"?e.className:""};function Lm(t){"@babel/helpers - typeof";return Lm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lm(t)}var iNe=["offset"];function oNe(t){return lNe(t)||cNe(t)||aNe(t)||sNe()}function sNe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aNe(t,e){if(t){if(typeof t=="string")return C1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C1(t,e)}}function cNe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lNe(t){if(Array.isArray(t))return C1(t)}function C1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function dNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function XM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vr(t){for(var e=1;e=0?1:-1,w,S;i==="insideStart"?(w=p+x*s,S=m):i==="insideEnd"?(w=g-x*s,S=!m):i==="end"&&(w=g+x*s,S=m),S=b<=0?S:!S;var C=ln(u,d,y,w),_=ln(u,d,y,w+(S?1:-1)*359),A="M".concat(C.x,",").concat(C.y,` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function QTe(t,e){if(t){if(typeof t=="string")return YM(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return YM(t,e)}}function YM(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},J8=function(e,n,r,i,o){var s=e.width,c=e.height,l=e.startAngle,u=e.endAngle,d=gi(e.cx,s,s/2),f=gi(e.cy,c,c/2),h=X8(s,c,r),p=gi(e.innerRadius,h,0),g=gi(e.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(y,b){var x=n[b],w=x.domain,S=x.reversed,C;if(Dt(x.range))i==="angleAxis"?C=[l,u]:i==="radiusAxis"&&(C=[p,g]),S&&(C=[C[1],C[0]]);else{C=x.range;var _=C,A=qTe(_,2);l=A[0],u=A[1]}var j=V8(x,o),P=j.realScaleType,k=j.scale;k.domain(w).range(C),K8(k);var O=W8(k,fa(fa({},x),{},{realScaleType:P})),E=fa(fa(fa({},x),O),{},{range:C,radius:g,realScaleType:P,scale:k,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:l,endAngle:u});return fa(fa({},y),{},Q8({},b,E))},{})},eNe=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return Math.sqrt(Math.pow(r-o,2)+Math.pow(i-s,2))},tNe=function(e,n){var r=e.x,i=e.y,o=n.cx,s=n.cy,c=eNe({x:r,y:i},{x:o,y:s});if(c<=0)return{radius:c};var l=(r-o)/c,u=Math.acos(l);return i>s&&(u=2*Math.PI-u),{radius:c,angle:ZTe(u),angleInRadian:u}},nNe=function(e){var n=e.startAngle,r=e.endAngle,i=Math.floor(n/360),o=Math.floor(r/360),s=Math.min(i,o);return{startAngle:n-s*360,endAngle:r-s*360}},rNe=function(e,n){var r=n.startAngle,i=n.endAngle,o=Math.floor(r/360),s=Math.floor(i/360),c=Math.min(o,s);return e+c*360},QM=function(e,n){var r=e.x,i=e.y,o=tNe({x:r,y:i},n),s=o.radius,c=o.angle,l=n.innerRadius,u=n.outerRadius;if(su)return!1;if(s===0)return!0;var d=nNe(n),f=d.startAngle,h=d.endAngle,p=c,g;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return g?fa(fa({},n),{},{radius:s,angle:rNe(p,n)}):null},Z8=function(e){return!v.isValidElement(e)&&!Ct(e)&&typeof e!="boolean"?e.className:""};function Lm(t){"@babel/helpers - typeof";return Lm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lm(t)}var iNe=["offset"];function oNe(t){return lNe(t)||cNe(t)||aNe(t)||sNe()}function sNe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function aNe(t,e){if(t){if(typeof t=="string")return C1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return C1(t,e)}}function cNe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lNe(t){if(Array.isArray(t))return C1(t)}function C1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function dNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function XM(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function vr(t){for(var e=1;e=0?1:-1,w,S;i==="insideStart"?(w=p+x*s,S=m):i==="insideEnd"?(w=g-x*s,S=!m):i==="end"&&(w=g+x*s,S=m),S=b<=0?S:!S;var C=un(u,d,y,w),_=un(u,d,y,w+(S?1:-1)*359),A="M".concat(C.x,",").concat(C.y,` A`).concat(y,",").concat(y,",0,1,").concat(S?0:1,`, - `).concat(_.x,",").concat(_.y),j=Dt(e.id)?th("recharts-radial-line-"):e.id;return N.createElement("text",Fm({},r,{dominantBaseline:"central",className:Mt("recharts-radial-bar-label",c)}),N.createElement("defs",null,N.createElement("path",{id:j,d:A})),N.createElement("textPath",{xlinkHref:"#".concat(j)},n))},yNe=function(e){var n=e.viewBox,r=e.offset,i=e.position,o=n,s=o.cx,c=o.cy,l=o.innerRadius,u=o.outerRadius,d=o.startAngle,f=o.endAngle,h=(d+f)/2;if(i==="outside"){var p=ln(s,c,u+r,h),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=s?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"end"};var y=(l+u)/2,b=ln(s,c,y,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},xNe=function(e){var n=e.viewBox,r=e.parentViewBox,i=e.offset,o=e.position,s=n,c=s.x,l=s.y,u=s.width,d=s.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,y=m*i,b=m>0?"end":"start",x=m>0?"start":"end";if(o==="top"){var w={x:c+u/2,y:l-f*i,textAnchor:"middle",verticalAnchor:p};return vr(vr({},w),r?{height:Math.max(l-r.y,0),width:u}:{})}if(o==="bottom"){var S={x:c+u/2,y:l+d+h,textAnchor:"middle",verticalAnchor:g};return vr(vr({},S),r?{height:Math.max(r.y+r.height-(l+d),0),width:u}:{})}if(o==="left"){var C={x:c-y,y:l+d/2,textAnchor:b,verticalAnchor:"middle"};return vr(vr({},C),r?{width:Math.max(C.x-r.x,0),height:d}:{})}if(o==="right"){var _={x:c+u+y,y:l+d/2,textAnchor:x,verticalAnchor:"middle"};return vr(vr({},_),r?{width:Math.max(r.x+r.width-_.x,0),height:d}:{})}var A=r?{width:u,height:d}:{};return o==="insideLeft"?vr({x:c+y,y:l+d/2,textAnchor:x,verticalAnchor:"middle"},A):o==="insideRight"?vr({x:c+u-y,y:l+d/2,textAnchor:b,verticalAnchor:"middle"},A):o==="insideTop"?vr({x:c+u/2,y:l+h,textAnchor:"middle",verticalAnchor:g},A):o==="insideBottom"?vr({x:c+u/2,y:l+d-h,textAnchor:"middle",verticalAnchor:p},A):o==="insideTopLeft"?vr({x:c+y,y:l+h,textAnchor:x,verticalAnchor:g},A):o==="insideTopRight"?vr({x:c+u-y,y:l+h,textAnchor:b,verticalAnchor:g},A):o==="insideBottomLeft"?vr({x:c+y,y:l+d-h,textAnchor:x,verticalAnchor:p},A):o==="insideBottomRight"?vr({x:c+u-y,y:l+d-h,textAnchor:b,verticalAnchor:p},A):Qf(o)&&(Ae(o.x)||$l(o.x))&&(Ae(o.y)||$l(o.y))?vr({x:c+gi(o.x,u),y:l+gi(o.y,d),textAnchor:"end",verticalAnchor:"end"},A):vr({x:c+u/2,y:l+d/2,textAnchor:"middle",verticalAnchor:"middle"},A)},bNe=function(e){return"cx"in e&&Ae(e.cx)};function Rr(t){var e=t.offset,n=e===void 0?5:e,r=uNe(t,iNe),i=vr({offset:n},r),o=i.viewBox,s=i.position,c=i.value,l=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!o||Dt(c)&&Dt(l)&&!v.isValidElement(u)&&!Ct(u))return null;if(v.isValidElement(u))return v.cloneElement(u,i);var p;if(Ct(u)){if(p=v.createElement(u,i),v.isValidElement(p))return p}else p=mNe(i);var g=bNe(o),m=rt(i,!0);if(g&&(s==="insideStart"||s==="insideEnd"||s==="end"))return vNe(i,p,m);var y=g?yNe(i):xNe(i);return N.createElement(wu,Fm({className:Mt("recharts-label",f)},m,y,{breakAll:h}),p)}Rr.displayName="Label";var eK=function(e){var n=e.cx,r=e.cy,i=e.angle,o=e.startAngle,s=e.endAngle,c=e.r,l=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,h=e.y,p=e.top,g=e.left,m=e.width,y=e.height,b=e.clockWise,x=e.labelViewBox;if(x)return x;if(Ae(m)&&Ae(y)){if(Ae(f)&&Ae(h))return{x:f,y:h,width:m,height:y};if(Ae(p)&&Ae(g))return{x:p,y:g,width:m,height:y}}return Ae(f)&&Ae(h)?{x:f,y:h,width:0,height:0}:Ae(n)&&Ae(r)?{cx:n,cy:r,startAngle:o||i||0,endAngle:s||i||0,innerRadius:u||0,outerRadius:d||l||c||0,clockWise:b}:e.viewBox?e.viewBox:{}},wNe=function(e,n){return e?e===!0?N.createElement(Rr,{key:"label-implicit",viewBox:n}):Er(e)?N.createElement(Rr,{key:"label-implicit",viewBox:n,value:e}):v.isValidElement(e)?e.type===Rr?v.cloneElement(e,{key:"label-implicit",viewBox:n}):N.createElement(Rr,{key:"label-implicit",content:e,viewBox:n}):Ct(e)?N.createElement(Rr,{key:"label-implicit",content:e,viewBox:n}):Qf(e)?N.createElement(Rr,Fm({viewBox:n},e,{key:"label-implicit"})):null:null},SNe=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var i=e.children,o=eK(e),s=jo(i,Rr).map(function(l,u){return v.cloneElement(l,{viewBox:n||o,key:"label-".concat(u)})});if(!r)return s;var c=wNe(e.label,n||o);return[c].concat(oNe(s))};Rr.parseViewBox=eK;Rr.renderCallByParent=SNe;function CNe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var _Ne=CNe;const tK=un(_Ne);function Bm(t){"@babel/helpers - typeof";return Bm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bm(t)}var ANe=["valueAccessor"],jNe=["data","dataKey","clockWise","id","textBreakAll"];function ENe(t){return kNe(t)||PNe(t)||NNe(t)||TNe()}function TNe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NNe(t,e){if(t){if(typeof t=="string")return _1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _1(t,e)}}function PNe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function kNe(t){if(Array.isArray(t))return _1(t)}function _1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function MNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var DNe=function(e){return Array.isArray(e.value)?tK(e.value):e.value};function Bs(t){var e=t.valueAccessor,n=e===void 0?DNe:e,r=eD(t,ANe),i=r.data,o=r.dataKey,s=r.clockWise,c=r.id,l=r.textBreakAll,u=eD(r,jNe);return!i||!i.length?null:N.createElement(Yt,{className:"recharts-label-list"},i.map(function(d,f){var h=Dt(o)?n(d,f):ir(d&&d.payload,o),p=Dt(c)?{}:{id:"".concat(c,"-").concat(f)};return N.createElement(Rr,xb({},rt(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:l,viewBox:Rr.parseViewBox(Dt(s)?d:ZM(ZM({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}Bs.displayName="LabelList";function $Ne(t,e){return t?t===!0?N.createElement(Bs,{key:"labelList-implicit",data:e}):N.isValidElement(t)||Ct(t)?N.createElement(Bs,{key:"labelList-implicit",data:e,content:t}):Qf(t)?N.createElement(Bs,xb({data:e},t,{key:"labelList-implicit"})):null:null}function LNe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,i=jo(r,Bs).map(function(s,c){return v.cloneElement(s,{data:e,key:"labelList-".concat(c)})});if(!n)return i;var o=$Ne(t.label,e);return[o].concat(ENe(i))}Bs.renderCallByParent=LNe;function Um(t){"@babel/helpers - typeof";return Um=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Um(t)}function A1(){return A1=Object.assign?Object.assign.bind():function(t){for(var e=1;e=s?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:s,y:c,textAnchor:"middle",verticalAnchor:"end"};var y=(l+u)/2,b=un(s,c,y,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},xNe=function(e){var n=e.viewBox,r=e.parentViewBox,i=e.offset,o=e.position,s=n,c=s.x,l=s.y,u=s.width,d=s.height,f=d>=0?1:-1,h=f*i,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,y=m*i,b=m>0?"end":"start",x=m>0?"start":"end";if(o==="top"){var w={x:c+u/2,y:l-f*i,textAnchor:"middle",verticalAnchor:p};return vr(vr({},w),r?{height:Math.max(l-r.y,0),width:u}:{})}if(o==="bottom"){var S={x:c+u/2,y:l+d+h,textAnchor:"middle",verticalAnchor:g};return vr(vr({},S),r?{height:Math.max(r.y+r.height-(l+d),0),width:u}:{})}if(o==="left"){var C={x:c-y,y:l+d/2,textAnchor:b,verticalAnchor:"middle"};return vr(vr({},C),r?{width:Math.max(C.x-r.x,0),height:d}:{})}if(o==="right"){var _={x:c+u+y,y:l+d/2,textAnchor:x,verticalAnchor:"middle"};return vr(vr({},_),r?{width:Math.max(r.x+r.width-_.x,0),height:d}:{})}var A=r?{width:u,height:d}:{};return o==="insideLeft"?vr({x:c+y,y:l+d/2,textAnchor:x,verticalAnchor:"middle"},A):o==="insideRight"?vr({x:c+u-y,y:l+d/2,textAnchor:b,verticalAnchor:"middle"},A):o==="insideTop"?vr({x:c+u/2,y:l+h,textAnchor:"middle",verticalAnchor:g},A):o==="insideBottom"?vr({x:c+u/2,y:l+d-h,textAnchor:"middle",verticalAnchor:p},A):o==="insideTopLeft"?vr({x:c+y,y:l+h,textAnchor:x,verticalAnchor:g},A):o==="insideTopRight"?vr({x:c+u-y,y:l+h,textAnchor:b,verticalAnchor:g},A):o==="insideBottomLeft"?vr({x:c+y,y:l+d-h,textAnchor:x,verticalAnchor:p},A):o==="insideBottomRight"?vr({x:c+u-y,y:l+d-h,textAnchor:b,verticalAnchor:p},A):Qf(o)&&(Ae(o.x)||$l(o.x))&&(Ae(o.y)||$l(o.y))?vr({x:c+gi(o.x,u),y:l+gi(o.y,d),textAnchor:"end",verticalAnchor:"end"},A):vr({x:c+u/2,y:l+d/2,textAnchor:"middle",verticalAnchor:"middle"},A)},bNe=function(e){return"cx"in e&&Ae(e.cx)};function Rr(t){var e=t.offset,n=e===void 0?5:e,r=uNe(t,iNe),i=vr({offset:n},r),o=i.viewBox,s=i.position,c=i.value,l=i.children,u=i.content,d=i.className,f=d===void 0?"":d,h=i.textBreakAll;if(!o||Dt(c)&&Dt(l)&&!v.isValidElement(u)&&!Ct(u))return null;if(v.isValidElement(u))return v.cloneElement(u,i);var p;if(Ct(u)){if(p=v.createElement(u,i),v.isValidElement(p))return p}else p=mNe(i);var g=bNe(o),m=rt(i,!0);if(g&&(s==="insideStart"||s==="insideEnd"||s==="end"))return vNe(i,p,m);var y=g?yNe(i):xNe(i);return N.createElement(wu,Fm({className:Mt("recharts-label",f)},m,y,{breakAll:h}),p)}Rr.displayName="Label";var eK=function(e){var n=e.cx,r=e.cy,i=e.angle,o=e.startAngle,s=e.endAngle,c=e.r,l=e.radius,u=e.innerRadius,d=e.outerRadius,f=e.x,h=e.y,p=e.top,g=e.left,m=e.width,y=e.height,b=e.clockWise,x=e.labelViewBox;if(x)return x;if(Ae(m)&&Ae(y)){if(Ae(f)&&Ae(h))return{x:f,y:h,width:m,height:y};if(Ae(p)&&Ae(g))return{x:p,y:g,width:m,height:y}}return Ae(f)&&Ae(h)?{x:f,y:h,width:0,height:0}:Ae(n)&&Ae(r)?{cx:n,cy:r,startAngle:o||i||0,endAngle:s||i||0,innerRadius:u||0,outerRadius:d||l||c||0,clockWise:b}:e.viewBox?e.viewBox:{}},wNe=function(e,n){return e?e===!0?N.createElement(Rr,{key:"label-implicit",viewBox:n}):Er(e)?N.createElement(Rr,{key:"label-implicit",viewBox:n,value:e}):v.isValidElement(e)?e.type===Rr?v.cloneElement(e,{key:"label-implicit",viewBox:n}):N.createElement(Rr,{key:"label-implicit",content:e,viewBox:n}):Ct(e)?N.createElement(Rr,{key:"label-implicit",content:e,viewBox:n}):Qf(e)?N.createElement(Rr,Fm({viewBox:n},e,{key:"label-implicit"})):null:null},SNe=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var i=e.children,o=eK(e),s=jo(i,Rr).map(function(l,u){return v.cloneElement(l,{viewBox:n||o,key:"label-".concat(u)})});if(!r)return s;var c=wNe(e.label,n||o);return[c].concat(oNe(s))};Rr.parseViewBox=eK;Rr.renderCallByParent=SNe;function CNe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var _Ne=CNe;const tK=dn(_Ne);function Bm(t){"@babel/helpers - typeof";return Bm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bm(t)}var ANe=["valueAccessor"],jNe=["data","dataKey","clockWise","id","textBreakAll"];function ENe(t){return kNe(t)||PNe(t)||NNe(t)||TNe()}function TNe(){throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NNe(t,e){if(t){if(typeof t=="string")return _1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _1(t,e)}}function PNe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function kNe(t){if(Array.isArray(t))return _1(t)}function _1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function MNe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var DNe=function(e){return Array.isArray(e.value)?tK(e.value):e.value};function Bs(t){var e=t.valueAccessor,n=e===void 0?DNe:e,r=eD(t,ANe),i=r.data,o=r.dataKey,s=r.clockWise,c=r.id,l=r.textBreakAll,u=eD(r,jNe);return!i||!i.length?null:N.createElement(Yt,{className:"recharts-label-list"},i.map(function(d,f){var h=Dt(o)?n(d,f):ir(d&&d.payload,o),p=Dt(c)?{}:{id:"".concat(c,"-").concat(f)};return N.createElement(Rr,xb({},rt(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:l,viewBox:Rr.parseViewBox(Dt(s)?d:ZM(ZM({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}Bs.displayName="LabelList";function $Ne(t,e){return t?t===!0?N.createElement(Bs,{key:"labelList-implicit",data:e}):N.isValidElement(t)||Ct(t)?N.createElement(Bs,{key:"labelList-implicit",data:e,content:t}):Qf(t)?N.createElement(Bs,xb({data:e},t,{key:"labelList-implicit"})):null:null}function LNe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,i=jo(r,Bs).map(function(s,c){return v.cloneElement(s,{data:e,key:"labelList-".concat(c)})});if(!n)return i;var o=$Ne(t.label,e);return[o].concat(ENe(i))}Bs.renderCallByParent=LNe;function Um(t){"@babel/helpers - typeof";return Um=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Um(t)}function A1(){return A1=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(s>u),`, `).concat(f.x,",").concat(f.y,` - `);if(i>0){var p=ln(n,r,i,s),g=ln(n,r,i,u);h+="L ".concat(g.x,",").concat(g.y,` + `);if(i>0){var p=un(n,r,i,s),g=un(n,r,i,u);h+="L ".concat(g.x,",").concat(g.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(l)>180),",").concat(+(s<=u),`, `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},zNe=function(e){var n=e.cx,r=e.cy,i=e.innerRadius,o=e.outerRadius,s=e.cornerRadius,c=e.forceCornerRadius,l=e.cornerIsExternal,u=e.startAngle,d=e.endAngle,f=mi(d-u),h=Nv({cx:n,cy:r,radius:o,angle:u,sign:f,cornerRadius:s,cornerIsExternal:l}),p=h.circleTangency,g=h.lineTangency,m=h.theta,y=Nv({cx:n,cy:r,radius:o,angle:d,sign:-f,cornerRadius:s,cornerIsExternal:l}),b=y.circleTangency,x=y.lineTangency,w=y.theta,S=l?Math.abs(u-d):Math.abs(u-d)-m-w;if(S<0)return c?"M ".concat(g.x,",").concat(g.y,` @@ -678,7 +678,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `);if(i>0){var _=Nv({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),A=_.circleTangency,j=_.lineTangency,P=_.theta,k=Nv({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),O=k.circleTangency,E=k.lineTangency,I=k.theta,D=l?Math.abs(u-d):Math.abs(u-d)-P-I;if(D<0&&s===0)return"".concat(C,"L").concat(n,",").concat(r,"Z");C+="L".concat(E.x,",").concat(E.y,` A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(O.x,",").concat(O.y,` A`).concat(i,",").concat(i,",0,").concat(+(D>180),",").concat(+(f>0),",").concat(A.x,",").concat(A.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(j.x,",").concat(j.y,"Z")}else C+="L".concat(n,",").concat(r,"Z");return C},GNe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},rK=function(e){var n=nD(nD({},GNe),e),r=n.cx,i=n.cy,o=n.innerRadius,s=n.outerRadius,c=n.cornerRadius,l=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(s0&&Math.abs(d-f)<360?y=zNe({cx:r,cy:i,innerRadius:o,outerRadius:s,cornerRadius:Math.min(m,g/2),forceCornerRadius:l,cornerIsExternal:u,startAngle:d,endAngle:f}):y=nK({cx:r,cy:i,innerRadius:o,outerRadius:s,startAngle:d,endAngle:f}),N.createElement("path",A1({},rt(n,!0),{className:p,d:y,role:"img"}))};function Hm(t){"@babel/helpers - typeof";return Hm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hm(t)}function j1(){return j1=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function oPe(t,e){return ch(t.getTime(),e.getTime())}function uD(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,s,c;(s=i.next())&&!s.done;){for(var l=e.entries(),u=!1,d=0;(c=l.next())&&!c.done;){var f=s.value,h=f[0],p=f[1],g=c.value,m=g[0],y=g[1];!u&&!r[d]&&(u=n.equals(h,m,o,d,t,e,n)&&n.equals(p,y,h,m,t,e,n))&&(r[d]=!0),d++}if(!u)return!1;o++}return!0}function sPe(t,e,n){var r=lD(t),i=r.length;if(lD(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===cK&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!aK(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function Dh(t,e,n){var r=aD(t),i=r.length;if(aD(e).length!==i)return!1;for(var o,s,c;i-- >0;)if(o=r[i],o===cK&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!aK(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(s=cD(t,o),c=cD(e,o),(s||c)&&(!s||!c||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable)))return!1;return!0}function aPe(t,e){return ch(t.valueOf(),e.valueOf())}function cPe(t,e){return t.source===e.source&&t.flags===e.flags}function dD(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,s;(o=i.next())&&!o.done;){for(var c=e.values(),l=!1,u=0;(s=c.next())&&!s.done;)!l&&!r[u]&&(l=n.equals(o.value,s.value,o.value,s.value,t,e,n))&&(r[u]=!0),u++;if(!l)return!1}return!0}function lPe(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var uPe="[object Arguments]",dPe="[object Boolean]",fPe="[object Date]",hPe="[object Map]",pPe="[object Number]",mPe="[object Object]",gPe="[object RegExp]",vPe="[object Set]",yPe="[object String]",xPe=Array.isArray,fD=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,hD=Object.assign,bPe=Object.prototype.toString.call.bind(Object.prototype.toString);function wPe(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,s=t.areRegExpsEqual,c=t.areSetsEqual,l=t.areTypedArraysEqual;return function(d,f,h){if(d===f)return!0;if(d==null||f==null||typeof d!="object"||typeof f!="object")return d!==d&&f!==f;var p=d.constructor;if(p!==f.constructor)return!1;if(p===Object)return i(d,f,h);if(xPe(d))return e(d,f,h);if(fD!=null&&fD(d))return l(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return s(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return c(d,f,h);var g=bPe(d);return g===fPe?n(d,f,h):g===gPe?s(d,f,h):g===hPe?r(d,f,h):g===vPe?c(d,f,h):g===mPe?typeof d.then!="function"&&typeof f.then!="function"&&i(d,f,h):g===uPe?i(d,f,h):g===dPe||g===pPe||g===yPe?o(d,f,h):!1}}function SPe(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Dh:iPe,areDatesEqual:oPe,areMapsEqual:r?sD(uD,Dh):uD,areObjectsEqual:r?Dh:sPe,arePrimitiveWrappersEqual:aPe,areRegExpsEqual:cPe,areSetsEqual:r?sD(dD,Dh):dD,areTypedArraysEqual:r?Dh:lPe};if(n&&(i=hD({},i,n(i))),e){var o=kv(i.areArraysEqual),s=kv(i.areMapsEqual),c=kv(i.areObjectsEqual),l=kv(i.areSetsEqual);i=hD({},i,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:c,areSetsEqual:l})}return i}function CPe(t){return function(e,n,r,i,o,s,c){return t(e,n,c)}}function _Pe(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(l,u){var d=r(),f=d.cache,h=f===void 0?e?new WeakMap:void 0:f,p=d.meta;return n(l,u,{cache:h,equals:i,meta:p,strict:o})};if(e)return function(l,u){return n(l,u,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var s={cache:void 0,equals:i,meta:void 0,strict:o};return function(l,u){return n(l,u,s)}}var APe=ml();ml({strict:!0});ml({circular:!0});ml({circular:!0,strict:!0});ml({createInternalComparator:function(){return ch}});ml({strict:!0,createInternalComparator:function(){return ch}});ml({circular:!0,createInternalComparator:function(){return ch}});ml({circular:!0,createInternalComparator:function(){return ch},strict:!0});function ml(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,s=o===void 0?!1:o,c=SPe(t),l=wPe(c),u=r?r(l):CPe(l);return _Pe({circular:n,comparator:l,createState:i,equals:u,strict:s})}function jPe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function pD(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(o){n<0&&(n=o),o-n>e?(t(o),n=-1):jPe(i)};requestAnimationFrame(r)}function E1(t){"@babel/helpers - typeof";return E1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E1(t)}function EPe(t){return kPe(t)||PPe(t)||NPe(t)||TPe()}function TPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. + A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(j.x,",").concat(j.y,"Z")}else C+="L".concat(n,",").concat(r,"Z");return C},GNe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},rK=function(e){var n=nD(nD({},GNe),e),r=n.cx,i=n.cy,o=n.innerRadius,s=n.outerRadius,c=n.cornerRadius,l=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(s0&&Math.abs(d-f)<360?y=zNe({cx:r,cy:i,innerRadius:o,outerRadius:s,cornerRadius:Math.min(m,g/2),forceCornerRadius:l,cornerIsExternal:u,startAngle:d,endAngle:f}):y=nK({cx:r,cy:i,innerRadius:o,outerRadius:s,startAngle:d,endAngle:f}),N.createElement("path",A1({},rt(n,!0),{className:p,d:y,role:"img"}))};function Hm(t){"@babel/helpers - typeof";return Hm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Hm(t)}function j1(){return j1=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function oPe(t,e){return ch(t.getTime(),e.getTime())}function uD(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.entries(),o=0,s,c;(s=i.next())&&!s.done;){for(var l=e.entries(),u=!1,d=0;(c=l.next())&&!c.done;){var f=s.value,h=f[0],p=f[1],g=c.value,m=g[0],y=g[1];!u&&!r[d]&&(u=n.equals(h,m,o,d,t,e,n)&&n.equals(p,y,h,m,t,e,n))&&(r[d]=!0),d++}if(!u)return!1;o++}return!0}function sPe(t,e,n){var r=lD(t),i=r.length;if(lD(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===cK&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!aK(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function Dh(t,e,n){var r=aD(t),i=r.length;if(aD(e).length!==i)return!1;for(var o,s,c;i-- >0;)if(o=r[i],o===cK&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!aK(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(s=cD(t,o),c=cD(e,o),(s||c)&&(!s||!c||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable)))return!1;return!0}function aPe(t,e){return ch(t.valueOf(),e.valueOf())}function cPe(t,e){return t.source===e.source&&t.flags===e.flags}function dD(t,e,n){if(t.size!==e.size)return!1;for(var r={},i=t.values(),o,s;(o=i.next())&&!o.done;){for(var c=e.values(),l=!1,u=0;(s=c.next())&&!s.done;)!l&&!r[u]&&(l=n.equals(o.value,s.value,o.value,s.value,t,e,n))&&(r[u]=!0),u++;if(!l)return!1}return!0}function lPe(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}var uPe="[object Arguments]",dPe="[object Boolean]",fPe="[object Date]",hPe="[object Map]",pPe="[object Number]",mPe="[object Object]",gPe="[object RegExp]",vPe="[object Set]",yPe="[object String]",xPe=Array.isArray,fD=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,hD=Object.assign,bPe=Object.prototype.toString.call.bind(Object.prototype.toString);function wPe(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areMapsEqual,i=t.areObjectsEqual,o=t.arePrimitiveWrappersEqual,s=t.areRegExpsEqual,c=t.areSetsEqual,l=t.areTypedArraysEqual;return function(d,f,h){if(d===f)return!0;if(d==null||f==null||typeof d!="object"||typeof f!="object")return d!==d&&f!==f;var p=d.constructor;if(p!==f.constructor)return!1;if(p===Object)return i(d,f,h);if(xPe(d))return e(d,f,h);if(fD!=null&&fD(d))return l(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return s(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return c(d,f,h);var g=bPe(d);return g===fPe?n(d,f,h):g===gPe?s(d,f,h):g===hPe?r(d,f,h):g===vPe?c(d,f,h):g===mPe?typeof d.then!="function"&&typeof f.then!="function"&&i(d,f,h):g===uPe?i(d,f,h):g===dPe||g===pPe||g===yPe?o(d,f,h):!1}}function SPe(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Dh:iPe,areDatesEqual:oPe,areMapsEqual:r?sD(uD,Dh):uD,areObjectsEqual:r?Dh:sPe,arePrimitiveWrappersEqual:aPe,areRegExpsEqual:cPe,areSetsEqual:r?sD(dD,Dh):dD,areTypedArraysEqual:r?Dh:lPe};if(n&&(i=hD({},i,n(i))),e){var o=kv(i.areArraysEqual),s=kv(i.areMapsEqual),c=kv(i.areObjectsEqual),l=kv(i.areSetsEqual);i=hD({},i,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:c,areSetsEqual:l})}return i}function CPe(t){return function(e,n,r,i,o,s,c){return t(e,n,c)}}function _Pe(t){var e=t.circular,n=t.comparator,r=t.createState,i=t.equals,o=t.strict;if(r)return function(l,u){var d=r(),f=d.cache,h=f===void 0?e?new WeakMap:void 0:f,p=d.meta;return n(l,u,{cache:h,equals:i,meta:p,strict:o})};if(e)return function(l,u){return n(l,u,{cache:new WeakMap,equals:i,meta:void 0,strict:o})};var s={cache:void 0,equals:i,meta:void 0,strict:o};return function(l,u){return n(l,u,s)}}var APe=ml();ml({strict:!0});ml({circular:!0});ml({circular:!0,strict:!0});ml({createInternalComparator:function(){return ch}});ml({strict:!0,createInternalComparator:function(){return ch}});ml({circular:!0,createInternalComparator:function(){return ch}});ml({circular:!0,createInternalComparator:function(){return ch},strict:!0});function ml(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,i=t.createState,o=t.strict,s=o===void 0?!1:o,c=SPe(t),l=wPe(c),u=r?r(l):CPe(l);return _Pe({circular:n,comparator:l,createState:i,equals:u,strict:s})}function jPe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function pD(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(o){n<0&&(n=o),o-n>e?(t(o),n=-1):jPe(i)};requestAnimationFrame(r)}function E1(t){"@babel/helpers - typeof";return E1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E1(t)}function EPe(t){return kPe(t)||PPe(t)||NPe(t)||TPe()}function TPe(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NPe(t,e){if(t){if(typeof t=="string")return mD(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mD(t,e)}}function mD(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n1?1:b<0?0:b},m=function(b){for(var x=b>1?1:b,w=x,S=0;S<8;++S){var C=f(w)-x,_=p(w);if(Math.abs(C-x)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,i=e.damping,o=i===void 0?8:i,s=e.dt,c=s===void 0?17:s,l=function(d,f,h){var p=-(d-f)*r,g=h*o,m=h+(p-g)*c/1e3,y=h*c/1e3+d;return Math.abs(y-f)0&&Math.abs(l)>0){var u=Math.min(o,o+c),d=Math.max(o,o+c),f=Math.min(s,s+l),h=Math.max(s,s+l);return r>=u&&r<=d&&i>=f&&i<=h}return!1},Nke={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},VP=function(e){var n=jD(jD({},Nke),e),r=v.useRef(),i=v.useState(-1),o=bke(i,2),s=o[0],c=o[1];v.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var S=r.current.getTotalLength();S&&c(S)}catch{}},[]);var l=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,g=n.animationEasing,m=n.animationDuration,y=n.animationBegin,b=n.isAnimationActive,x=n.isUpdateAnimationActive;if(l!==+l||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=Mt("recharts-rectangle",p);return x?N.createElement(fs,{canBegin:s>0,from:{width:d,height:f,x:l,y:u},to:{width:d,height:f,x:l,y:u},duration:m,animationEasing:g,isActive:x},function(S){var C=S.width,_=S.height,A=S.x,j=S.y;return N.createElement(fs,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:m,isActive:b,easing:g},N.createElement("path",Cb({},rt(n,!0),{className:w,d:ED(A,j,C,_,h),ref:r})))}):N.createElement("path",Cb({},rt(n,!0),{className:w,d:ED(l,u,d,f,h)}))},Pke=["points","className","baseLinePoints","connectNulls"];function ud(){return ud=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Oke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function TD(t){return Dke(t)||Mke(t)||Rke(t)||Ike()}function Ike(){throw new TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rke(t,e){if(t){if(typeof t=="string")return D1(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D1(t,e)}}function Mke(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Dke(t){if(Array.isArray(t))return D1(t)}function D1(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){ND(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),ND(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},bp=function(e,n){var r=$ke(e);n&&(r=[r.reduce(function(o,s){return[].concat(TD(o),TD(s))},[])]);var i=r.map(function(o){return o.reduce(function(s,c,l){return"".concat(s).concat(l===0?"M":"L").concat(c.x,",").concat(c.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},Lke=function(e,n,r){var i=bp(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(bp(n.reverse(),r).slice(1))},mK=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,o=e.connectNulls,s=kke(e,Pke);if(!n||!n.length)return null;var c=Mt("recharts-polygon",r);if(i&&i.length){var l=s.stroke&&s.stroke!=="none",u=Lke(n,i,o);return N.createElement("g",{className:c},N.createElement("path",ud({},rt(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),l?N.createElement("path",ud({},rt(s,!0),{fill:"none",d:bp(n,o)})):null,l?N.createElement("path",ud({},rt(s,!0),{fill:"none",d:bp(i,o)})):null)}var d=bp(n,o);return N.createElement("path",ud({},rt(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:c,d}))};function $1(){return $1=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Vke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Kke=function(e,n,r,i,o,s){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(s,",").concat(n,"h").concat(r)},Wke=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.top,c=s===void 0?0:s,l=e.left,u=l===void 0?0:l,d=e.width,f=d===void 0?0:d,h=e.height,p=h===void 0?0:h,g=e.className,m=Gke(e,Fke),y=Bke({x:r,y:o,top:c,left:u,width:f,height:p},m);return!Ae(r)||!Ae(o)||!Ae(f)||!Ae(p)||!Ae(c)||!Ae(u)?null:N.createElement("path",L1({},rt(y,!0),{className:Mt("recharts-cross",g),d:Kke(r,o,f,p,c,u)}))},qke=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Wm(t){"@babel/helpers - typeof";return Wm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wm(t)}function Yke(t,e){if(t==null)return{};var n=Qke(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Qke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ha(){return Ha=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xOe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function bOe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function RD(t,e){for(var n=0;n$D?s=i==="outer"?"start":"end":o<-$D?s=i==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,o=r.cy,s=r.radius,c=r.axisLine,l=r.axisLineType,u=bl(bl({},rt(this.props,!1)),{},{fill:"none"},rt(c,!1));if(l==="circle")return N.createElement($g,El({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:o,r:s}));var d=this.props.ticks,f=d.map(function(h){return ln(i,o,s,h.coordinate)});return N.createElement(mK,El({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,o=i.ticks,s=i.tick,c=i.tickLine,l=i.tickFormatter,u=i.stroke,d=rt(this.props,!1),f=rt(s,!1),h=bl(bl({},d),{},{fill:"none"},rt(c,!1)),p=o.map(function(g,m){var y=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),x=bl(bl(bl({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:y.x2,y:y.y2});return N.createElement(Yt,El({className:Mt("recharts-polar-angle-axis-tick",Z8(s)),key:"tick-".concat(g.coordinate)},bu(r.props,g,m)),c&&N.createElement("line",El({className:"recharts-polar-angle-axis-tick-line"},h,y)),s&&e.renderTickItem(s,x,l?l(g.value,m):g.value))});return N.createElement(Yt,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,o=r.radius,s=r.axisLine;return o<=0||!i||!i.length?null:N.createElement(Yt,{className:Mt("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,o){var s;return N.isValidElement(r)?s=N.cloneElement(r,i):Ct(r)?s=r(i):s=N.createElement(wu,El({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),s}}])}(v.PureComponent);zw(uh,"displayName","PolarAngleAxis");zw(uh,"axisType","angleAxis");zw(uh,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var MOe=xV,DOe=MOe(Object.getPrototypeOf,Object),$Oe=DOe,LOe=Wa,FOe=$Oe,BOe=qa,UOe="[object Object]",HOe=Function.prototype,zOe=Object.prototype,wK=HOe.toString,GOe=zOe.hasOwnProperty,VOe=wK.call(Object);function KOe(t){if(!BOe(t)||LOe(t)!=UOe)return!1;var e=FOe(t);if(e===null)return!0;var n=GOe.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&wK.call(n)==VOe}var WOe=KOe;const qOe=un(WOe);var YOe=Wa,QOe=qa,XOe="[object Boolean]";function JOe(t){return t===!0||t===!1||QOe(t)&&YOe(t)==XOe}var ZOe=JOe;const eIe=un(ZOe);function Ym(t){"@babel/helpers - typeof";return Ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ym(t)}function jb(){return jb=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0,from:{upperWidth:0,lowerWidth:0,height:h,x:l,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:l,y:u},duration:m,animationEasing:g,isActive:b},function(w){var S=w.upperWidth,C=w.lowerWidth,_=w.height,A=w.x,j=w.y;return N.createElement(fs,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:m,easing:g},N.createElement("path",jb({},rt(n,!0),{className:x,d:UD(A,j,S,C,_),ref:r})))}):N.createElement("g",null,N.createElement("path",jb({},rt(n,!0),{className:x,d:UD(l,u,d,f,h)})))},dIe=["option","shapeType","propTransformer","activeClassName","isActive"];function Qm(t){"@babel/helpers - typeof";return Qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qm(t)}function fIe(t,e){if(t==null)return{};var n=hIe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function HD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Eb(t){for(var e=1;e0?to(w,"paddingAngle",0):0;if(C){var A=Ir(C.endAngle-C.startAngle,w.endAngle-w.startAngle),j=Tn(Tn({},w),{},{startAngle:x+_,endAngle:x+A(m)+_});y.push(j),x=j.endAngle}else{var P=w.endAngle,k=w.startAngle,O=Ir(0,P-k),E=O(m),I=Tn(Tn({},w),{},{startAngle:x+_,endAngle:x+E+_});y.push(I),x=I.endAngle}}),N.createElement(Yt,null,r.renderSectorsStatically(y))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var s=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});break}case"ArrowRight":{var c=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[c].focus(),i.setState({sectorToFocus:c});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,i=r.sectors,o=r.isAnimationActive,s=this.state.prevSectors;return o&&i&&i.length&&(!s||!Su(s,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,i=this.props,o=i.hide,s=i.sectors,c=i.className,l=i.label,u=i.cx,d=i.cy,f=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,g=this.state.isAnimationFinished;if(o||!s||!s.length||!Ae(u)||!Ae(d)||!Ae(f)||!Ae(h))return null;var m=Mt("recharts-pie",c);return N.createElement(Yt,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),l&&this.renderLabels(s),Rr.renderCallByParent(this.props,null,!1),(!p||g)&&Bs.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return i.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:r.sectors!==i.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,i){return r>i?"start":rt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){ND(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),ND(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},bp=function(e,n){var r=$ke(e);n&&(r=[r.reduce(function(o,s){return[].concat(TD(o),TD(s))},[])]);var i=r.map(function(o){return o.reduce(function(s,c,l){return"".concat(s).concat(l===0?"M":"L").concat(c.x,",").concat(c.y)},"")}).join("");return r.length===1?"".concat(i,"Z"):i},Lke=function(e,n,r){var i=bp(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(bp(n.reverse(),r).slice(1))},mK=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,o=e.connectNulls,s=kke(e,Pke);if(!n||!n.length)return null;var c=Mt("recharts-polygon",r);if(i&&i.length){var l=s.stroke&&s.stroke!=="none",u=Lke(n,i,o);return N.createElement("g",{className:c},N.createElement("path",ud({},rt(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),l?N.createElement("path",ud({},rt(s,!0),{fill:"none",d:bp(n,o)})):null,l?N.createElement("path",ud({},rt(s,!0),{fill:"none",d:bp(i,o)})):null)}var d=bp(n,o);return N.createElement("path",ud({},rt(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:c,d}))};function $1(){return $1=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Vke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Kke=function(e,n,r,i,o,s){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(s,",").concat(n,"h").concat(r)},Wke=function(e){var n=e.x,r=n===void 0?0:n,i=e.y,o=i===void 0?0:i,s=e.top,c=s===void 0?0:s,l=e.left,u=l===void 0?0:l,d=e.width,f=d===void 0?0:d,h=e.height,p=h===void 0?0:h,g=e.className,m=Gke(e,Fke),y=Bke({x:r,y:o,top:c,left:u,width:f,height:p},m);return!Ae(r)||!Ae(o)||!Ae(f)||!Ae(p)||!Ae(c)||!Ae(u)?null:N.createElement("path",L1({},rt(y,!0),{className:Mt("recharts-cross",g),d:Kke(r,o,f,p,c,u)}))},qke=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Wm(t){"@babel/helpers - typeof";return Wm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wm(t)}function Yke(t,e){if(t==null)return{};var n=Qke(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Qke(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ha(){return Ha=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xOe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function bOe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function RD(t,e){for(var n=0;n$D?s=i==="outer"?"start":"end":o<-$D?s=i==="outer"?"end":"start":s="middle",s}},{key:"renderAxisLine",value:function(){var r=this.props,i=r.cx,o=r.cy,s=r.radius,c=r.axisLine,l=r.axisLineType,u=bl(bl({},rt(this.props,!1)),{},{fill:"none"},rt(c,!1));if(l==="circle")return N.createElement($g,El({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:o,r:s}));var d=this.props.ticks,f=d.map(function(h){return un(i,o,s,h.coordinate)});return N.createElement(mK,El({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,i=this.props,o=i.ticks,s=i.tick,c=i.tickLine,l=i.tickFormatter,u=i.stroke,d=rt(this.props,!1),f=rt(s,!1),h=bl(bl({},d),{},{fill:"none"},rt(c,!1)),p=o.map(function(g,m){var y=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),x=bl(bl(bl({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:y.x2,y:y.y2});return N.createElement(Yt,El({className:Mt("recharts-polar-angle-axis-tick",Z8(s)),key:"tick-".concat(g.coordinate)},bu(r.props,g,m)),c&&N.createElement("line",El({className:"recharts-polar-angle-axis-tick-line"},h,y)),s&&e.renderTickItem(s,x,l?l(g.value,m):g.value))});return N.createElement(Yt,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,i=r.ticks,o=r.radius,s=r.axisLine;return o<=0||!i||!i.length?null:N.createElement(Yt,{className:Mt("recharts-polar-angle-axis",this.props.className)},s&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,i,o){var s;return N.isValidElement(r)?s=N.cloneElement(r,i):Ct(r)?s=r(i):s=N.createElement(wu,El({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),s}}])}(v.PureComponent);zw(uh,"displayName","PolarAngleAxis");zw(uh,"axisType","angleAxis");zw(uh,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var MOe=xV,DOe=MOe(Object.getPrototypeOf,Object),$Oe=DOe,LOe=Wa,FOe=$Oe,BOe=qa,UOe="[object Object]",HOe=Function.prototype,zOe=Object.prototype,wK=HOe.toString,GOe=zOe.hasOwnProperty,VOe=wK.call(Object);function KOe(t){if(!BOe(t)||LOe(t)!=UOe)return!1;var e=FOe(t);if(e===null)return!0;var n=GOe.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&wK.call(n)==VOe}var WOe=KOe;const qOe=dn(WOe);var YOe=Wa,QOe=qa,XOe="[object Boolean]";function JOe(t){return t===!0||t===!1||QOe(t)&&YOe(t)==XOe}var ZOe=JOe;const eIe=dn(ZOe);function Ym(t){"@babel/helpers - typeof";return Ym=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ym(t)}function jb(){return jb=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0,from:{upperWidth:0,lowerWidth:0,height:h,x:l,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:l,y:u},duration:m,animationEasing:g,isActive:b},function(w){var S=w.upperWidth,C=w.lowerWidth,_=w.height,A=w.x,j=w.y;return N.createElement(fs,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:m,easing:g},N.createElement("path",jb({},rt(n,!0),{className:x,d:UD(A,j,S,C,_),ref:r})))}):N.createElement("g",null,N.createElement("path",jb({},rt(n,!0),{className:x,d:UD(l,u,d,f,h)})))},dIe=["option","shapeType","propTransformer","activeClassName","isActive"];function Qm(t){"@babel/helpers - typeof";return Qm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qm(t)}function fIe(t,e){if(t==null)return{};var n=hIe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function hIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function HD(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Eb(t){for(var e=1;e0?to(w,"paddingAngle",0):0;if(C){var A=Ir(C.endAngle-C.startAngle,w.endAngle-w.startAngle),j=Tn(Tn({},w),{},{startAngle:x+_,endAngle:x+A(m)+_});y.push(j),x=j.endAngle}else{var P=w.endAngle,k=w.startAngle,O=Ir(0,P-k),E=O(m),I=Tn(Tn({},w),{},{startAngle:x+_,endAngle:x+E+_});y.push(I),x=I.endAngle}}),N.createElement(Yt,null,r.renderSectorsStatically(y))})}},{key:"attachKeyboardHandlers",value:function(r){var i=this;r.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var s=++i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[s].focus(),i.setState({sectorToFocus:s});break}case"ArrowRight":{var c=--i.state.sectorToFocus<0?i.sectorRefs.length-1:i.state.sectorToFocus%i.sectorRefs.length;i.sectorRefs[c].focus(),i.setState({sectorToFocus:c});break}case"Escape":{i.sectorRefs[i.state.sectorToFocus].blur(),i.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,i=r.sectors,o=r.isAnimationActive,s=this.state.prevSectors;return o&&i&&i.length&&(!s||!Su(s,i))?this.renderSectorsWithAnimation():this.renderSectorsStatically(i)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,i=this.props,o=i.hide,s=i.sectors,c=i.className,l=i.label,u=i.cx,d=i.cy,f=i.innerRadius,h=i.outerRadius,p=i.isAnimationActive,g=this.state.isAnimationFinished;if(o||!s||!s.length||!Ae(u)||!Ae(d)||!Ae(f)||!Ae(h))return null;var m=Mt("recharts-pie",c);return N.createElement(Yt,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),l&&this.renderLabels(s),Rr.renderCallByParent(this.props,null,!1),(!p||g)&&Bs.renderCallByParent(this.props,s,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return i.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:i.curSectors,isAnimationFinished:!0}:r.sectors!==i.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,i){return r>i?"start":r=360?x:x-1)*l,S=y-x*p-w,C=i.reduce(function(j,P){var k=ir(P,b,0);return j+(Ae(k)?k:0)},0),_;if(C>0){var A;_=i.map(function(j,P){var k=ir(j,b,0),O=ir(j,d,P),E=(Ae(k)?k:0)/C,I;P?I=A.endAngle+mi(m)*l*(k!==0?1:0):I=s;var D=I+mi(m)*((k!==0?p:0)+E*S),z=(I+D)/2,$=(g.innerRadius+g.outerRadius)/2,G=[{name:O,value:k,payload:j,dataKey:b,type:h}],R=ln(g.cx,g.cy,$,z);return A=Tn(Tn(Tn({percent:E,cornerRadius:o,name:O,tooltipPayload:G,midAngle:z,middleRadius:$,tooltipPosition:R},j),g),{},{value:ir(j,b),startAngle:I,endAngle:D,payload:j,paddingAngle:mi(m)*l}),A})}return Tn(Tn({},g),{},{sectors:_,data:i})});function RIe(t){return t&&t.length?t[0]:void 0}var MIe=RIe,DIe=MIe;const $Ie=un(DIe);var LIe=["key"];function vf(t){"@babel/helpers - typeof";return vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vf(t)}function FIe(t,e){if(t==null)return{};var n=BIe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function BIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Nb(){return Nb=Object.assign?Object.assign.bind():function(t){for(var e=1;e=2&&(l=!0),u.push(li(li({},ln(s,c,x,y)),{},{name:g,value:m,cx:s,cy:c,radius:x,angle:y,payload:h}))});var f=[];return l&&u.forEach(function(h){if(Array.isArray(h.value)){var p=$Ie(h.value),g=Dt(p)?void 0:e.scale(p);f.push(li(li({},h),{},{radius:g},ln(s,c,g,h.angle)))}else f.push(h)}),{points:u,isRange:l,baseLinePoints:f}});var qIe=Math.ceil,YIe=Math.max;function QIe(t,e,n,r){for(var i=-1,o=YIe(qIe((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}var XIe=QIe,JIe=LV,qD=1/0,ZIe=17976931348623157e292;function eRe(t){if(!t)return t===0?t:0;if(t=JIe(t),t===qD||t===-qD){var e=t<0?-1:1;return e*ZIe}return t===t?t:0}var EK=eRe,tRe=XIe,nRe=Pw,_C=EK;function rRe(t){return function(e,n,r){return r&&typeof r!="number"&&nRe(e,n,r)&&(n=r=void 0),e=_C(e),n===void 0?(n=e,e=0):n=_C(n),r=r===void 0?e0&&r.handleDrag(i.changedTouches[0])}),Hi(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,o=i.endIndex,s=i.onDragEnd,c=i.startIndex;s==null||s({endIndex:o,startIndex:c})}),r.detachDragEndListener()}),Hi(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Hi(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Hi(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Hi(r,"handleSlideDragStart",function(i){var o=ZD(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return vRe(e,t),hRe(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,o=r.endX,s=this.state.scaleValues,c=this.props,l=c.gap,u=c.data,d=u.length-1,f=Math.min(i,o),h=Math.max(i,o),p=e.getIndexInRange(s,f),g=e.getIndexInRange(s,h);return{startIndex:p-p%l,endIndex:g===d?d:g-g%l}}},{key:"getTextOfTick",value:function(r){var i=this.props,o=i.data,s=i.tickFormatter,c=i.dataKey,l=ir(o[r],c,r);return Ct(s)?s(l,r):l}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,o=i.slideMoveStartX,s=i.startX,c=i.endX,l=this.props,u=l.x,d=l.width,f=l.travellerWidth,h=l.startIndex,p=l.endIndex,g=l.onChange,m=r.pageX-o;m>0?m=Math.min(m,u+d-f-c,u+d-f-s):m<0&&(m=Math.max(m,u-s,u-c));var y=this.getIndex({startX:s+m,endX:c+m});(y.startIndex!==h||y.endIndex!==p)&&g&&g(y),this.setState({startX:s+m,endX:c+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var o=ZD(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,o=i.brushMoveStartX,s=i.movingTravellerId,c=i.endX,l=i.startX,u=this.state[s],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,y=d.data,b={startX:this.state.startX,endX:this.state.endX},x=r.pageX-o;x>0?x=Math.min(x,f+h-p-u):x<0&&(x=Math.max(x,f-u)),b[s]=u+x;var w=this.getIndex(b),S=w.startIndex,C=w.endIndex,_=function(){var j=y.length-1;return s==="startX"&&(c>l?S%m===0:C%m===0)||cl?C%m===0:S%m===0)||c>l&&C===j};this.setState(Hi(Hi({},s,u+x),"brushMoveStartX",r.pageX),function(){g&&_()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var o=this,s=this.state,c=s.scaleValues,l=s.startX,u=s.endX,d=this.state[i],f=c.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=c.length)){var p=c[h];i==="startX"&&p>=u||i==="endX"&&p<=l||this.setState(Hi({},i,p),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,c=r.height,l=r.fill,u=r.stroke;return N.createElement("rect",{stroke:u,fill:l,x:i,y:o,width:s,height:c})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,c=r.height,l=r.data,u=r.children,d=r.padding,f=v.Children.only(u);return f?N.cloneElement(f,{x:i,y:o,width:s,height:c,margin:d,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(r,i){var o,s,c=this,l=this.props,u=l.y,d=l.travellerWidth,f=l.height,h=l.traveller,p=l.ariaLabel,g=l.data,m=l.startIndex,y=l.endIndex,b=Math.max(r,this.props.x),x=AC(AC({},rt(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((o=g[m])===null||o===void 0?void 0:o.name,", Max value: ").concat((s=g[y])===null||s===void 0?void 0:s.name);return N.createElement(Yt,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(C){["ArrowLeft","ArrowRight"].includes(C.key)&&(C.preventDefault(),C.stopPropagation(),c.handleTravellerMoveKeyboard(C.key==="ArrowRight"?1:-1,i))},onFocus:function(){c.setState({isTravellerFocused:!0})},onBlur:function(){c.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,x))}},{key:"renderSlide",value:function(r,i){var o=this.props,s=o.y,c=o.height,l=o.stroke,u=o.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return N.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:d,y:s,width:f,height:c})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,o=r.endIndex,s=r.y,c=r.height,l=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,g={pointerEvents:"none",fill:u};return N.createElement(Yt,{className:"recharts-brush-texts"},N.createElement(wu,Ob({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+c/2},g),this.getTextOfTick(i)),N.createElement(wu,Ob({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+l+p,y:s+c/2},g),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,i=r.data,o=r.className,s=r.children,c=r.x,l=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,g=h.endX,m=h.isTextActive,y=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!Ae(c)||!Ae(l)||!Ae(u)||!Ae(d)||u<=0||d<=0)return null;var w=Mt("recharts-brush",o),S=N.Children.count(s)===1,C=dRe("userSelect","none");return N.createElement(Yt,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||y||b||x||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,o=r.y,s=r.width,c=r.height,l=r.stroke,u=Math.floor(o+c/2)-1;return N.createElement(N.Fragment,null,N.createElement("rect",{x:i,y:o,width:s,height:c,fill:l,stroke:"none"}),N.createElement("line",{x1:i+1,y1:u,x2:i+s-1,y2:u,fill:"none",stroke:"#fff"}),N.createElement("line",{x1:i+1,y1:u+2,x2:i+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var o;return N.isValidElement(r)?o=N.cloneElement(r,i):Ct(r)?o=r(i):o=e.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(r,i){var o=r.data,s=r.width,c=r.x,l=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(o!==i.prevData||u!==i.prevUpdateId)return AC({prevData:o,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:s},o&&o.length?xRe({data:o,width:s,x:c,travellerWidth:l,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(s!==i.prevWidth||c!==i.prevX||l!==i.prevTravellerWidth)){i.scale.range([c,c+s-l]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:o,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:s,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var o=r.length,s=0,c=o-1;c-s>1;){var l=Math.floor((s+c)/2);r[l]>i?c=l:s=l}return i>=r[c]?c:s}}])}(v.PureComponent);Hi(xf,"displayName","Brush");Hi(xf,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var bRe=vP;function wRe(t,e){var n;return bRe(t,function(r,i,o){return n=e(r,i,o),!n}),!!n}var SRe=wRe,CRe=dV,_Re=ea,ARe=SRe,jRe=Bi,ERe=Pw;function TRe(t,e,n){var r=jRe(t)?CRe:ARe;return n&&ERe(t,e,n)&&(e=void 0),r(t,_Re(e))}var NRe=TRe;const PRe=un(NRe);var Us=function(e,n){var r=e.alwaysShow,i=e.ifOverflow;return r&&(i="extendDomain"),i===n},e$=IV;function kRe(t,e,n){e=="__proto__"&&e$?e$(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var ORe=kRe,IRe=ORe,RRe=kV,MRe=ea;function DRe(t,e){var n={};return e=MRe(e),RRe(t,function(r,i,o){IRe(n,i,e(r,i,o))}),n}var $Re=DRe;const LRe=un($Re);function FRe(t,e){for(var n=-1,r=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function n2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function r2e(t,e){var n=t.x,r=t.y,i=t2e(t,XRe),o="".concat(n),s=parseInt(o,10),c="".concat(r),l=parseInt(c,10),u="".concat(e.height||i.height),d=parseInt(u,10),f="".concat(e.width||i.width),h=parseInt(f,10);return $h($h($h($h($h({},e),i),s?{x:s}:{}),l?{y:l}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function n$(t){return N.createElement(SK,G1({shapeType:"rectangle",propTransformer:r2e,activeClassName:"recharts-active-bar"},t))}var i2e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof e=="number")return e;var o=typeof r=="number";return o?e(r,i):(o||_u(),n)}},o2e=["value","background"],OK;function bf(t){"@babel/helpers - typeof";return bf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bf(t)}function s2e(t,e){if(t==null)return{};var n=a2e(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function a2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Rb(){return Rb=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(z)0&&Math.abs(D)0&&(I=Math.min((F||0)-(D[se-1]||0),I))}),Number.isFinite(I)){var z=I/E,$=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(A=z*$/2),m.padding==="no-gap"){var G=gi(e.barCategoryGap,z*$),R=z*$/2;A=R-G-(R-G)/$*G}}}i==="xAxis"?j=[r.left+(w.left||0)+(A||0),r.left+r.width-(w.right||0)-(A||0)]:i==="yAxis"?j=l==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(A||0),r.top+r.height-(w.bottom||0)-(A||0)]:j=m.range,C&&(j=[j[1],j[0]]);var L=V8(m,o,h),W=L.scale,Y=L.realScaleType;W.domain(b).range(j),K8(W);var te=W8(W,Ho(Ho({},m),{},{realScaleType:Y}));i==="xAxis"?(O=y==="top"&&!S||y==="bottom"&&S,P=r.left,k=f[_]-O*m.height):i==="yAxis"&&(O=y==="left"&&!S||y==="right"&&S,P=f[_]-O*m.width,k=r.top);var me=Ho(Ho(Ho({},m),te),{},{realScaleType:Y,x:P,y:k,scale:W,width:i==="xAxis"?r.width:m.width,height:i==="yAxis"?r.height:m.height});return me.bandSize=vb(me,te),!m.hide&&i==="xAxis"?f[_]+=(O?-1:1)*me.height:m.hide||(f[_]+=(O?-1:1)*me.width),Ho(Ho({},p),{},Kw({},g,me))},{})},$K=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return{x:Math.min(r,o),y:Math.min(i,s),width:Math.abs(o-r),height:Math.abs(s-i)}},y2e=function(e){var n=e.x1,r=e.y1,i=e.x2,o=e.y2;return $K({x:n,y:r},{x:i,y:o})},LK=function(){function t(e){m2e(this,t),this.scale=e}return g2e(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+s}case"end":{var c=this.bandwidth?this.bandwidth():0;return this.scale(n)+c}default:return this.scale(n)}if(i){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],o=r[r.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();Kw(LK,"EPS",1e-4);var KP=function(e){var n=Object.keys(e).reduce(function(r,i){return Ho(Ho({},r),{},Kw({},i,LK.create(e[i])))},{});return Ho(Ho({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.bandAware,c=o.position;return LRe(i,function(l,u){return n[u].apply(l,{bandAware:s,position:c})})},isInRange:function(i){return kK(i,function(o,s){return n[s].isInRange(o)})}})};function x2e(t){return(t%180+180)%180}var b2e=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=x2e(i),s=o*Math.PI/180,c=Math.atan(r/n),l=s>c&&s-1?i[o?e[s]:s]:void 0}}var A2e=_2e,j2e=EK;function E2e(t){var e=j2e(t),n=e%1;return e===e?n?e-n:e:0}var T2e=E2e,N2e=AV,P2e=ea,k2e=T2e,O2e=Math.max;function I2e(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:k2e(n);return i<0&&(i=O2e(r+i,0)),N2e(t,P2e(e),i)}var R2e=I2e,M2e=A2e,D2e=R2e,$2e=M2e(D2e),L2e=$2e;const F2e=un(L2e);var B2e=_pe(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),WP=v.createContext(void 0),qP=v.createContext(void 0),FK=v.createContext(void 0),BK=v.createContext({}),UK=v.createContext(void 0),HK=v.createContext(0),zK=v.createContext(0),a$=function(e){var n=e.state,r=n.xAxisMap,i=n.yAxisMap,o=n.offset,s=e.clipPathId,c=e.children,l=e.width,u=e.height,d=B2e(o);return N.createElement(WP.Provider,{value:r},N.createElement(qP.Provider,{value:i},N.createElement(BK.Provider,{value:o},N.createElement(FK.Provider,{value:d},N.createElement(UK.Provider,{value:s},N.createElement(HK.Provider,{value:u},N.createElement(zK.Provider,{value:l},c)))))))},U2e=function(){return v.useContext(UK)},GK=function(e){var n=v.useContext(WP);n==null&&_u();var r=n[e];return r==null&&_u(),r},H2e=function(){var e=v.useContext(WP);return fc(e)},z2e=function(){var e=v.useContext(qP),n=F2e(e,function(r){return kK(r.domain,Number.isFinite)});return n||fc(e)},VK=function(e){var n=v.useContext(qP);n==null&&_u();var r=n[e];return r==null&&_u(),r},G2e=function(){var e=v.useContext(FK);return e},V2e=function(){return v.useContext(BK)},YP=function(){return v.useContext(zK)},QP=function(){return v.useContext(HK)};function wf(t){"@babel/helpers - typeof";return wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wf(t)}function K2e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function W2e(t,e){for(var n=0;n=360?x:x-1)*l,S=y-x*p-w,C=i.reduce(function(j,P){var k=ir(P,b,0);return j+(Ae(k)?k:0)},0),_;if(C>0){var A;_=i.map(function(j,P){var k=ir(j,b,0),O=ir(j,d,P),E=(Ae(k)?k:0)/C,I;P?I=A.endAngle+mi(m)*l*(k!==0?1:0):I=s;var D=I+mi(m)*((k!==0?p:0)+E*S),z=(I+D)/2,$=(g.innerRadius+g.outerRadius)/2,G=[{name:O,value:k,payload:j,dataKey:b,type:h}],R=un(g.cx,g.cy,$,z);return A=Tn(Tn(Tn({percent:E,cornerRadius:o,name:O,tooltipPayload:G,midAngle:z,middleRadius:$,tooltipPosition:R},j),g),{},{value:ir(j,b),startAngle:I,endAngle:D,payload:j,paddingAngle:mi(m)*l}),A})}return Tn(Tn({},g),{},{sectors:_,data:i})});function RIe(t){return t&&t.length?t[0]:void 0}var MIe=RIe,DIe=MIe;const $Ie=dn(DIe);var LIe=["key"];function vf(t){"@babel/helpers - typeof";return vf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},vf(t)}function FIe(t,e){if(t==null)return{};var n=BIe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function BIe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Nb(){return Nb=Object.assign?Object.assign.bind():function(t){for(var e=1;e=2&&(l=!0),u.push(li(li({},un(s,c,x,y)),{},{name:g,value:m,cx:s,cy:c,radius:x,angle:y,payload:h}))});var f=[];return l&&u.forEach(function(h){if(Array.isArray(h.value)){var p=$Ie(h.value),g=Dt(p)?void 0:e.scale(p);f.push(li(li({},h),{},{radius:g},un(s,c,g,h.angle)))}else f.push(h)}),{points:u,isRange:l,baseLinePoints:f}});var qIe=Math.ceil,YIe=Math.max;function QIe(t,e,n,r){for(var i=-1,o=YIe(qIe((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}var XIe=QIe,JIe=LV,qD=1/0,ZIe=17976931348623157e292;function eRe(t){if(!t)return t===0?t:0;if(t=JIe(t),t===qD||t===-qD){var e=t<0?-1:1;return e*ZIe}return t===t?t:0}var EK=eRe,tRe=XIe,nRe=Pw,_C=EK;function rRe(t){return function(e,n,r){return r&&typeof r!="number"&&nRe(e,n,r)&&(n=r=void 0),e=_C(e),n===void 0?(n=e,e=0):n=_C(n),r=r===void 0?e0&&r.handleDrag(i.changedTouches[0])}),Hi(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,o=i.endIndex,s=i.onDragEnd,c=i.startIndex;s==null||s({endIndex:o,startIndex:c})}),r.detachDragEndListener()}),Hi(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Hi(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Hi(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Hi(r,"handleSlideDragStart",function(i){var o=ZD(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return vRe(e,t),hRe(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,o=r.endX,s=this.state.scaleValues,c=this.props,l=c.gap,u=c.data,d=u.length-1,f=Math.min(i,o),h=Math.max(i,o),p=e.getIndexInRange(s,f),g=e.getIndexInRange(s,h);return{startIndex:p-p%l,endIndex:g===d?d:g-g%l}}},{key:"getTextOfTick",value:function(r){var i=this.props,o=i.data,s=i.tickFormatter,c=i.dataKey,l=ir(o[r],c,r);return Ct(s)?s(l,r):l}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,o=i.slideMoveStartX,s=i.startX,c=i.endX,l=this.props,u=l.x,d=l.width,f=l.travellerWidth,h=l.startIndex,p=l.endIndex,g=l.onChange,m=r.pageX-o;m>0?m=Math.min(m,u+d-f-c,u+d-f-s):m<0&&(m=Math.max(m,u-s,u-c));var y=this.getIndex({startX:s+m,endX:c+m});(y.startIndex!==h||y.endIndex!==p)&&g&&g(y),this.setState({startX:s+m,endX:c+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var o=ZD(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,o=i.brushMoveStartX,s=i.movingTravellerId,c=i.endX,l=i.startX,u=this.state[s],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,y=d.data,b={startX:this.state.startX,endX:this.state.endX},x=r.pageX-o;x>0?x=Math.min(x,f+h-p-u):x<0&&(x=Math.max(x,f-u)),b[s]=u+x;var w=this.getIndex(b),S=w.startIndex,C=w.endIndex,_=function(){var j=y.length-1;return s==="startX"&&(c>l?S%m===0:C%m===0)||cl?C%m===0:S%m===0)||c>l&&C===j};this.setState(Hi(Hi({},s,u+x),"brushMoveStartX",r.pageX),function(){g&&_()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var o=this,s=this.state,c=s.scaleValues,l=s.startX,u=s.endX,d=this.state[i],f=c.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=c.length)){var p=c[h];i==="startX"&&p>=u||i==="endX"&&p<=l||this.setState(Hi({},i,p),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,c=r.height,l=r.fill,u=r.stroke;return N.createElement("rect",{stroke:u,fill:l,x:i,y:o,width:s,height:c})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,o=r.y,s=r.width,c=r.height,l=r.data,u=r.children,d=r.padding,f=v.Children.only(u);return f?N.cloneElement(f,{x:i,y:o,width:s,height:c,margin:d,compact:!0,data:l}):null}},{key:"renderTravellerLayer",value:function(r,i){var o,s,c=this,l=this.props,u=l.y,d=l.travellerWidth,f=l.height,h=l.traveller,p=l.ariaLabel,g=l.data,m=l.startIndex,y=l.endIndex,b=Math.max(r,this.props.x),x=AC(AC({},rt(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((o=g[m])===null||o===void 0?void 0:o.name,", Max value: ").concat((s=g[y])===null||s===void 0?void 0:s.name);return N.createElement(Yt,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(C){["ArrowLeft","ArrowRight"].includes(C.key)&&(C.preventDefault(),C.stopPropagation(),c.handleTravellerMoveKeyboard(C.key==="ArrowRight"?1:-1,i))},onFocus:function(){c.setState({isTravellerFocused:!0})},onBlur:function(){c.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(h,x))}},{key:"renderSlide",value:function(r,i){var o=this.props,s=o.y,c=o.height,l=o.stroke,u=o.travellerWidth,d=Math.min(r,i)+u,f=Math.max(Math.abs(i-r)-u,0);return N.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:l,fillOpacity:.2,x:d,y:s,width:f,height:c})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,o=r.endIndex,s=r.y,c=r.height,l=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,g={pointerEvents:"none",fill:u};return N.createElement(Yt,{className:"recharts-brush-texts"},N.createElement(wu,Ob({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+c/2},g),this.getTextOfTick(i)),N.createElement(wu,Ob({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+l+p,y:s+c/2},g),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,i=r.data,o=r.className,s=r.children,c=r.x,l=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,g=h.endX,m=h.isTextActive,y=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!Ae(c)||!Ae(l)||!Ae(u)||!Ae(d)||u<=0||d<=0)return null;var w=Mt("recharts-brush",o),S=N.Children.count(s)===1,C=dRe("userSelect","none");return N.createElement(Yt,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||y||b||x||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,o=r.y,s=r.width,c=r.height,l=r.stroke,u=Math.floor(o+c/2)-1;return N.createElement(N.Fragment,null,N.createElement("rect",{x:i,y:o,width:s,height:c,fill:l,stroke:"none"}),N.createElement("line",{x1:i+1,y1:u,x2:i+s-1,y2:u,fill:"none",stroke:"#fff"}),N.createElement("line",{x1:i+1,y1:u+2,x2:i+s-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var o;return N.isValidElement(r)?o=N.cloneElement(r,i):Ct(r)?o=r(i):o=e.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(r,i){var o=r.data,s=r.width,c=r.x,l=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(o!==i.prevData||u!==i.prevUpdateId)return AC({prevData:o,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:s},o&&o.length?xRe({data:o,width:s,x:c,travellerWidth:l,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(i.scale&&(s!==i.prevWidth||c!==i.prevX||l!==i.prevTravellerWidth)){i.scale.range([c,c+s-l]);var h=i.scale.domain().map(function(p){return i.scale(p)});return{prevData:o,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:s,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,i){for(var o=r.length,s=0,c=o-1;c-s>1;){var l=Math.floor((s+c)/2);r[l]>i?c=l:s=l}return i>=r[c]?c:s}}])}(v.PureComponent);Hi(xf,"displayName","Brush");Hi(xf,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var bRe=vP;function wRe(t,e){var n;return bRe(t,function(r,i,o){return n=e(r,i,o),!n}),!!n}var SRe=wRe,CRe=dV,_Re=ea,ARe=SRe,jRe=Bi,ERe=Pw;function TRe(t,e,n){var r=jRe(t)?CRe:ARe;return n&&ERe(t,e,n)&&(e=void 0),r(t,_Re(e))}var NRe=TRe;const PRe=dn(NRe);var Us=function(e,n){var r=e.alwaysShow,i=e.ifOverflow;return r&&(i="extendDomain"),i===n},e$=IV;function kRe(t,e,n){e=="__proto__"&&e$?e$(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var ORe=kRe,IRe=ORe,RRe=kV,MRe=ea;function DRe(t,e){var n={};return e=MRe(e),RRe(t,function(r,i,o){IRe(n,i,e(r,i,o))}),n}var $Re=DRe;const LRe=dn($Re);function FRe(t,e){for(var n=-1,r=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function n2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function r2e(t,e){var n=t.x,r=t.y,i=t2e(t,XRe),o="".concat(n),s=parseInt(o,10),c="".concat(r),l=parseInt(c,10),u="".concat(e.height||i.height),d=parseInt(u,10),f="".concat(e.width||i.width),h=parseInt(f,10);return $h($h($h($h($h({},e),i),s?{x:s}:{}),l?{y:l}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function n$(t){return N.createElement(SK,G1({shapeType:"rectangle",propTransformer:r2e,activeClassName:"recharts-active-bar"},t))}var i2e=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof e=="number")return e;var o=typeof r=="number";return o?e(r,i):(o||_u(),n)}},o2e=["value","background"],OK;function bf(t){"@babel/helpers - typeof";return bf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},bf(t)}function s2e(t,e){if(t==null)return{};var n=a2e(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function a2e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Rb(){return Rb=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(z)0&&Math.abs(D)0&&(I=Math.min((F||0)-(D[se-1]||0),I))}),Number.isFinite(I)){var z=I/E,$=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(A=z*$/2),m.padding==="no-gap"){var G=gi(e.barCategoryGap,z*$),R=z*$/2;A=R-G-(R-G)/$*G}}}i==="xAxis"?j=[r.left+(w.left||0)+(A||0),r.left+r.width-(w.right||0)-(A||0)]:i==="yAxis"?j=l==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(A||0),r.top+r.height-(w.bottom||0)-(A||0)]:j=m.range,C&&(j=[j[1],j[0]]);var L=V8(m,o,h),W=L.scale,Y=L.realScaleType;W.domain(b).range(j),K8(W);var te=W8(W,Ho(Ho({},m),{},{realScaleType:Y}));i==="xAxis"?(O=y==="top"&&!S||y==="bottom"&&S,P=r.left,k=f[_]-O*m.height):i==="yAxis"&&(O=y==="left"&&!S||y==="right"&&S,P=f[_]-O*m.width,k=r.top);var me=Ho(Ho(Ho({},m),te),{},{realScaleType:Y,x:P,y:k,scale:W,width:i==="xAxis"?r.width:m.width,height:i==="yAxis"?r.height:m.height});return me.bandSize=vb(me,te),!m.hide&&i==="xAxis"?f[_]+=(O?-1:1)*me.height:m.hide||(f[_]+=(O?-1:1)*me.width),Ho(Ho({},p),{},Kw({},g,me))},{})},$K=function(e,n){var r=e.x,i=e.y,o=n.x,s=n.y;return{x:Math.min(r,o),y:Math.min(i,s),width:Math.abs(o-r),height:Math.abs(s-i)}},y2e=function(e){var n=e.x1,r=e.y1,i=e.x2,o=e.y2;return $K({x:n,y:r},{x:i,y:o})},LK=function(){function t(e){m2e(this,t),this.scale=e}return g2e(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var s=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+s}case"end":{var c=this.bandwidth?this.bandwidth():0;return this.scale(n)+c}default:return this.scale(n)}if(i){var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],o=r[r.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new t(n)}}])}();Kw(LK,"EPS",1e-4);var KP=function(e){var n=Object.keys(e).reduce(function(r,i){return Ho(Ho({},r),{},Kw({},i,LK.create(e[i])))},{});return Ho(Ho({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.bandAware,c=o.position;return LRe(i,function(l,u){return n[u].apply(l,{bandAware:s,position:c})})},isInRange:function(i){return kK(i,function(o,s){return n[s].isInRange(o)})}})};function x2e(t){return(t%180+180)%180}var b2e=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=x2e(i),s=o*Math.PI/180,c=Math.atan(r/n),l=s>c&&s-1?i[o?e[s]:s]:void 0}}var A2e=_2e,j2e=EK;function E2e(t){var e=j2e(t),n=e%1;return e===e?n?e-n:e:0}var T2e=E2e,N2e=AV,P2e=ea,k2e=T2e,O2e=Math.max;function I2e(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:k2e(n);return i<0&&(i=O2e(r+i,0)),N2e(t,P2e(e),i)}var R2e=I2e,M2e=A2e,D2e=R2e,$2e=M2e(D2e),L2e=$2e;const F2e=dn(L2e);var B2e=_pe(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),WP=v.createContext(void 0),qP=v.createContext(void 0),FK=v.createContext(void 0),BK=v.createContext({}),UK=v.createContext(void 0),HK=v.createContext(0),zK=v.createContext(0),a$=function(e){var n=e.state,r=n.xAxisMap,i=n.yAxisMap,o=n.offset,s=e.clipPathId,c=e.children,l=e.width,u=e.height,d=B2e(o);return N.createElement(WP.Provider,{value:r},N.createElement(qP.Provider,{value:i},N.createElement(BK.Provider,{value:o},N.createElement(FK.Provider,{value:d},N.createElement(UK.Provider,{value:s},N.createElement(HK.Provider,{value:u},N.createElement(zK.Provider,{value:l},c)))))))},U2e=function(){return v.useContext(UK)},GK=function(e){var n=v.useContext(WP);n==null&&_u();var r=n[e];return r==null&&_u(),r},H2e=function(){var e=v.useContext(WP);return fc(e)},z2e=function(){var e=v.useContext(qP),n=F2e(e,function(r){return kK(r.domain,Number.isFinite)});return n||fc(e)},VK=function(e){var n=v.useContext(qP);n==null&&_u();var r=n[e];return r==null&&_u(),r},G2e=function(){var e=v.useContext(FK);return e},V2e=function(){return v.useContext(BK)},YP=function(){return v.useContext(zK)},QP=function(){return v.useContext(HK)};function wf(t){"@babel/helpers - typeof";return wf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wf(t)}function K2e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function W2e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nt*i)return!1;var o=n();return t*(e-t*o/2-r)>=0&&t*(e+t*o/2-i)<=0}function TMe(t,e){return JK(t,e+1)}function NMe(t,e,n,r,i){for(var o=(r||[]).slice(),s=e.start,c=e.end,l=0,u=1,d=s,f=function(){var g=r==null?void 0:r[l];if(g===void 0)return{v:JK(r,u)};var m=l,y,b=function(){return y===void 0&&(y=n(g,m)),y},x=g.coordinate,w=l===0||Fb(t,x,b,d,c);w||(l=0,d=s,u+=1),w&&(d=x+t*(b()/2+i),l+=u)},h;u<=o.length;)if(h=f(),h)return h.v;return[]}function tg(t){"@babel/helpers - typeof";return tg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tg(t)}function m$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Jr(t){for(var e=1;e0?p.coordinate-y*t:p.coordinate})}else o[h]=p=Jr(Jr({},p),{},{tickCoord:p.coordinate});var b=Fb(t,p.tickCoord,m,c,l);b&&(l=p.tickCoord-t*(m()/2+i),o[h]=Jr(Jr({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return o}function RMe(t,e,n,r,i,o){var s=(r||[]).slice(),c=s.length,l=e.start,u=e.end;if(o){var d=r[c-1],f=n(d,c-1),h=t*(d.coordinate+t*f/2-u);s[c-1]=d=Jr(Jr({},d),{},{tickCoord:h>0?d.coordinate-h*t:d.coordinate});var p=Fb(t,d.tickCoord,function(){return f},l,u);p&&(u=d.tickCoord-t*(f/2+i),s[c-1]=Jr(Jr({},d),{},{isShow:!0}))}for(var g=o?c-1:c,m=function(x){var w=s[x],S,C=function(){return S===void 0&&(S=n(w,x)),S};if(x===0){var _=t*(w.coordinate-t*C()/2-l);s[x]=w=Jr(Jr({},w),{},{tickCoord:_<0?w.coordinate-_*t:w.coordinate})}else s[x]=w=Jr(Jr({},w),{},{tickCoord:w.coordinate});var A=Fb(t,w.tickCoord,C,l,u);A&&(l=w.tickCoord+t*(C()/2+i),s[x]=Jr(Jr({},w),{},{isShow:!0}))},y=0;y=2?mi(i[1].coordinate-i[0].coordinate):1,b=EMe(o,y,p);return l==="equidistantPreserveStart"?NMe(y,b,m,i,s):(l==="preserveStart"||l==="preserveStartEnd"?h=RMe(y,b,m,i,s,l==="preserveStartEnd"):h=IMe(y,b,m,i,s),h.filter(function(x){return x.isShow}))}var MMe=["viewBox"],DMe=["viewBox"],$Me=["ticks"];function _f(t){"@babel/helpers - typeof";return _f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_f(t)}function fd(){return fd=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function LMe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function FMe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v$(t,e){for(var n=0;n0?l(this.props):l(p)),s<=0||c<=0||!g||!g.length?null:N.createElement(Yt,{className:Mt("recharts-cartesian-axis",u),ref:function(y){r.layerReference=y}},o&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Rr.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,o){var s;return N.isValidElement(r)?s=N.cloneElement(r,i):Ct(r)?s=r(i):s=N.createElement(wu,fd({},i,{className:"recharts-cartesian-axis-tick-value"}),o),s}}])}(v.Component);ek(dh,"displayName","CartesianAxis");ek(dh,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var KMe=["x1","y1","x2","y2","key"],WMe=["offset"];function Au(t){"@babel/helpers - typeof";return Au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Au(t)}function y$(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ni(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function XMe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var JMe=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,i=e.x,o=e.y,s=e.width,c=e.height,l=e.ry;return N.createElement("rect",{x:i,y:o,ry:l,width:s,height:c,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function tW(t,e){var n;if(N.isValidElement(t))n=N.cloneElement(t,e);else if(Ct(t))n=t(e);else{var r=e.x1,i=e.y1,o=e.x2,s=e.y2,c=e.key,l=x$(e,KMe),u=rt(l,!1);u.offset;var d=x$(u,WMe);n=N.createElement("line",Bl({},d,{x1:r,y1:i,x2:o,y2:s,fill:"none",key:c}))}return n}function ZMe(t){var e=t.x,n=t.width,r=t.horizontal,i=r===void 0?!0:r,o=t.horizontalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(c,l){var u=ni(ni({},t),{},{x1:e,y1:c,x2:e+n,y2:c,key:"line-".concat(l),index:l});return tW(i,u)});return N.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function eDe(t){var e=t.y,n=t.height,r=t.vertical,i=r===void 0?!0:r,o=t.verticalPoints;if(!i||!o||!o.length)return null;var s=o.map(function(c,l){var u=ni(ni({},t),{},{x1:c,y1:e,x2:c,y2:e+n,key:"line-".concat(l),index:l});return tW(i,u)});return N.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function tDe(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,i=t.y,o=t.width,s=t.height,c=t.horizontalPoints,l=t.horizontal,u=l===void 0?!0:l;if(!u||!e||!e.length)return null;var d=c.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?i+s-h:d[p+1]-h;if(m<=0)return null;var y=p%e.length;return N.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:o,stroke:"none",fill:e[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return N.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function nDe(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,i=t.fillOpacity,o=t.x,s=t.y,c=t.width,l=t.height,u=t.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+o-o)}).sort(function(h,p){return h-p});o!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?o+c-h:d[p+1]-h;if(m<=0)return null;var y=p%r.length;return N.createElement("rect",{key:"react-".concat(p),x:h,y:s,width:m,height:l,stroke:"none",fill:r[y],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return N.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var rDe=function(e,n){var r=e.xAxis,i=e.width,o=e.height,s=e.offset;return G8(ZP(ni(ni(ni({},dh.defaultProps),r),{},{ticks:Ca(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.left,s.left+s.width,n)},iDe=function(e,n){var r=e.yAxis,i=e.width,o=e.height,s=e.offset;return G8(ZP(ni(ni(ni({},dh.defaultProps),r),{},{ticks:Ca(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.top,s.top+s.height,n)},Vu={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function ng(t){var e,n,r,i,o,s,c=YP(),l=QP(),u=V2e(),d=ni(ni({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:Vu.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:Vu.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:Vu.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:Vu.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:Vu.vertical,verticalFill:(s=t.verticalFill)!==null&&s!==void 0?s:Vu.verticalFill,x:Ae(t.x)?t.x:u.left,y:Ae(t.y)?t.y:u.top,width:Ae(t.width)?t.width:u.width,height:Ae(t.height)?t.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,y=d.horizontalValues,b=d.verticalValues,x=H2e(),w=z2e();if(!Ae(p)||p<=0||!Ae(g)||g<=0||!Ae(f)||f!==+f||!Ae(h)||h!==+h)return null;var S=d.verticalCoordinatesGenerator||rDe,C=d.horizontalCoordinatesGenerator||iDe,_=d.horizontalPoints,A=d.verticalPoints;if((!_||!_.length)&&Ct(C)){var j=y&&y.length,P=C({yAxis:w?ni(ni({},w),{},{ticks:j?y:w.ticks}):void 0,width:c,height:l,offset:u},j?!0:m);ts(Array.isArray(P),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Au(P),"]")),Array.isArray(P)&&(_=P)}if((!A||!A.length)&&Ct(S)){var k=b&&b.length,O=S({xAxis:x?ni(ni({},x),{},{ticks:k?b:x.ticks}):void 0,width:c,height:l,offset:u},k?!0:m);ts(Array.isArray(O),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Au(O),"]")),Array.isArray(O)&&(A=O)}return N.createElement("g",{className:"recharts-cartesian-grid"},N.createElement(JMe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),N.createElement(ZMe,Bl({},d,{offset:u,horizontalPoints:_,xAxis:x,yAxis:w})),N.createElement(eDe,Bl({},d,{offset:u,verticalPoints:A,xAxis:x,yAxis:w})),N.createElement(tDe,Bl({},d,{horizontalPoints:_})),N.createElement(nDe,Bl({},d,{verticalPoints:A})))}ng.displayName="CartesianGrid";var oDe=["layout","type","stroke","connectNulls","isRange","ref"],sDe=["key"],nW;function Af(t){"@babel/helpers - typeof";return Af=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Af(t)}function rW(t,e){if(t==null)return{};var n=aDe(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function aDe(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ul(){return Ul=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!Su(d,s)||!Su(f,c))?this.renderAreaWithAnimation(r,i):this.renderAreaStatically(s,c,r,i)}},{key:"render",value:function(){var r,i=this.props,o=i.hide,s=i.dot,c=i.points,l=i.className,u=i.top,d=i.left,f=i.xAxis,h=i.yAxis,p=i.width,g=i.height,m=i.isAnimationActive,y=i.id;if(o||!c||!c.length)return null;var b=this.state.isAnimationFinished,x=c.length===1,w=Mt("recharts-area",l),S=f&&f.allowDataOverflow,C=h&&h.allowDataOverflow,_=S||C,A=Dt(y)?this.id:y,j=(r=rt(s,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},P=j.r,k=P===void 0?3:P,O=j.strokeWidth,E=O===void 0?2:O,I=Nme(s)?s:{},D=I.clipDot,z=D===void 0?!0:D,$=k*2+E;return N.createElement(Yt,{className:w},S||C?N.createElement("defs",null,N.createElement("clipPath",{id:"clipPath-".concat(A)},N.createElement("rect",{x:S?d:d-p/2,y:C?u:u-g/2,width:S?p:p*2,height:C?g:g*2})),!z&&N.createElement("clipPath",{id:"clipPath-dots-".concat(A)},N.createElement("rect",{x:d-$/2,y:u-$/2,width:p+$,height:g+$}))):null,x?null:this.renderArea(_,A),(s||x)&&this.renderDots(_,z,A),(!m||b)&&Bs.renderCallByParent(this.props,c))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:i.curPoints,prevBaseLine:i.curBaseLine}:r.points!==i.curPoints||r.baseLine!==i.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(v.PureComponent);nW=rs;Is(rs,"displayName","Area");Is(rs,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ns.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Is(rs,"getBaseValue",function(t,e,n,r){var i=t.layout,o=t.baseValue,s=e.props.baseValue,c=s??o;if(Ae(c)&&typeof c=="number")return c;var l=i==="horizontal"?r:n,u=l.scale.domain();if(l.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return c==="dataMin"?f:c==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return c==="dataMin"?u[0]:c==="dataMax"?u[1]:u[0]});Is(rs,"getComposedData",function(t){var e=t.props,n=t.item,r=t.xAxis,i=t.yAxis,o=t.xAxisTicks,s=t.yAxisTicks,c=t.bandSize,l=t.dataKey,u=t.stackedData,d=t.dataStartIndex,f=t.displayedData,h=t.offset,p=e.layout,g=u&&u.length,m=nW.getBaseValue(e,n,r,i),y=p==="horizontal",b=!1,x=f.map(function(S,C){var _;g?_=u[d+C]:(_=ir(S,l),Array.isArray(_)?b=!0:_=[m,_]);var A=_[1]==null||g&&ir(S,l)==null;return y?{x:zM({axis:r,ticks:o,bandSize:c,entry:S,index:C}),y:A?null:i.scale(_[1]),value:_,payload:S}:{x:A?null:r.scale(_[1]),y:zM({axis:i,ticks:s,bandSize:c,entry:S,index:C}),value:_,payload:S}}),w;return g||b?w=x.map(function(S){var C=Array.isArray(S.value)?S.value[0]:null;return y?{x:S.x,y:C!=null&&S.y!=null?i.scale(C):null}:{x:C!=null?r.scale(C):null,y:S.y}}):w=y?i.scale(m):r.scale(m),nc({points:x,baseLine:w,layout:p,isRange:b},h)});Is(rs,"renderDotItem",function(t,e){var n;if(N.isValidElement(t))n=N.cloneElement(t,e);else if(Ct(t))n=t(e);else{var r=Mt("recharts-area-dot",typeof t!="boolean"?t.className:""),i=e.key,o=rW(e,sDe);n=N.createElement($g,Ul({},o,{key:i,className:r}))}return n});function jf(t){"@babel/helpers - typeof";return jf=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jf(t)}function mDe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function gDe(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function n$e(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function r$e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i$e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?s:e&&e.length&&Ae(i)&&Ae(o)?e.slice(i,o+1):[]};function xW(t){return t==="number"?[0,"auto"]:void 0}var cj=function(e,n,r,i){var o=e.graphicalItems,s=e.tooltipAxis,c=Xw(n,e);return r<0||!o||!o.length||r>=c.length?null:o.reduce(function(l,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?c:f;h=zx(p,s.dataKey,i)}else h=f&&f[r]||c[r];return h?[].concat(Nf(l),[Y8(u,h)]):l},[])},E$=function(e,n,r,i){var o=i||{x:e.chartX,y:e.chartY},s=g$e(o,r),c=e.orderedTooltipTicks,l=e.tooltipAxis,u=e.tooltipTicks,d=PTe(s,c,u,l);if(d>=0&&u){var f=u[d]&&u[d].value,h=cj(e,n,d,f),p=v$e(r,c,d,o);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},y$e=function(e,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,s=n.axisIdKey,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=e.stackOffset,p=z8(d,o);return r.reduce(function(g,m){var y,b=m.type.defaultProps!==void 0?le(le({},m.type.defaultProps),m.props):m.props,x=b.type,w=b.dataKey,S=b.allowDataOverflow,C=b.allowDuplicatedCategory,_=b.scale,A=b.ticks,j=b.includeHidden,P=b[s];if(g[P])return g;var k=Xw(e.data,{graphicalItems:i.filter(function(te){var me,F=s in te.props?te.props[s]:(me=te.type.defaultProps)===null||me===void 0?void 0:me[s];return F===P}),dataStartIndex:l,dataEndIndex:u}),O=k.length,E,I,D;GDe(b.domain,S,x)&&(E=S1(b.domain,null,S),p&&(x==="number"||_!=="auto")&&(D=yp(k,w,"category")));var z=xW(x);if(!E||E.length===0){var $,G=($=b.domain)!==null&&$!==void 0?$:z;if(w){if(E=yp(k,w,x),x==="category"&&p){var R=bme(E);C&&R?(I=E,E=kb(0,O)):C||(E=WM(G,E,m).reduce(function(te,me){return te.indexOf(me)>=0?te:[].concat(Nf(te),[me])},[]))}else if(x==="category")C?E=E.filter(function(te){return te!==""&&!Dt(te)}):E=WM(G,E,m).reduce(function(te,me){return te.indexOf(me)>=0||me===""||Dt(me)?te:[].concat(Nf(te),[me])},[]);else if(x==="number"){var L=MTe(k,i.filter(function(te){var me,F,se=s in te.props?te.props[s]:(me=te.type.defaultProps)===null||me===void 0?void 0:me[s],ne="hide"in te.props?te.props.hide:(F=te.type.defaultProps)===null||F===void 0?void 0:F.hide;return se===P&&(j||!ne)}),w,o,d);L&&(E=L)}p&&(x==="number"||_!=="auto")&&(D=yp(k,w,"category"))}else p?E=kb(0,O):c&&c[P]&&c[P].hasStack&&x==="number"?E=h==="expand"?[0,1]:q8(c[P].stackGroups,l,u):E=H8(k,i.filter(function(te){var me=s in te.props?te.props[s]:te.type.defaultProps[s],F="hide"in te.props?te.props.hide:te.type.defaultProps.hide;return me===P&&(j||!F)}),x,d,!0);if(x==="number")E=oj(f,E,P,o,A),G&&(E=S1(G,E,S));else if(x==="category"&&G){var W=G,Y=E.every(function(te){return W.indexOf(te)>=0});Y&&(E=W)}}return le(le({},g),{},Et({},P,le(le({},b),{},{axisType:o,domain:E,categoricalDomain:D,duplicateDomain:I,originalDomain:(y=b.domain)!==null&&y!==void 0?y:z,isCategorical:p,layout:d})))},{})},x$e=function(e,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,s=n.axisIdKey,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=Xw(e.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:u}),p=h.length,g=z8(d,o),m=-1;return r.reduce(function(y,b){var x=b.type.defaultProps!==void 0?le(le({},b.type.defaultProps),b.props):b.props,w=x[s],S=xW("number");if(!y[w]){m++;var C;return g?C=kb(0,p):c&&c[w]&&c[w].hasStack?(C=q8(c[w].stackGroups,l,u),C=oj(f,C,w,o)):(C=S1(S,H8(h,r.filter(function(_){var A,j,P=s in _.props?_.props[s]:(A=_.type.defaultProps)===null||A===void 0?void 0:A[s],k="hide"in _.props?_.props.hide:(j=_.type.defaultProps)===null||j===void 0?void 0:j.hide;return P===w&&!k}),"number",d),i.defaultProps.allowDataOverflow),C=oj(f,C,w,o)),le(le({},y),{},Et({},w,le(le({axisType:o},i.defaultProps),{},{hide:!0,orientation:to(p$e,"".concat(o,".").concat(m%2),null),domain:C,originalDomain:S,isCategorical:g,layout:d})))}return y},{})},b$e=function(e,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,s=n.graphicalItems,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.children,f="".concat(i,"Id"),h=jo(d,o),p={};return h&&h.length?p=y$e(e,{axes:h,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u}):s&&s.length&&(p=x$e(e,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u})),p},w$e=function(e){var n=fc(e),r=Ca(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:yP(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:vb(n,r)}},T$=function(e){var n=e.children,r=e.defaultShowTooltip,i=Ki(n,xf),o=0,s=0;return e.data&&e.data.length!==0&&(s=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!r}},S$e=function(e){return!e||!e.length?!1:e.some(function(n){var r=ja(n&&n.type);return r&&r.indexOf("Bar")>=0})},N$=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},C$e=function(e,n){var r=e.props,i=e.graphicalItems,o=e.xAxisMap,s=o===void 0?{}:o,c=e.yAxisMap,l=c===void 0?{}:c,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=Ki(f,xf),g=Ki(f,Ea),m=Object.keys(l).reduce(function(C,_){var A=l[_],j=A.orientation;return!A.mirror&&!A.hide?le(le({},C),{},Et({},j,C[j]+A.width)):C},{left:h.left||0,right:h.right||0}),y=Object.keys(s).reduce(function(C,_){var A=s[_],j=A.orientation;return!A.mirror&&!A.hide?le(le({},C),{},Et({},j,to(C,"".concat(j))+A.height)):C},{top:h.top||0,bottom:h.bottom||0}),b=le(le({},y),m),x=b.bottom;p&&(b.bottom+=p.props.height||xf.defaultProps.height),g&&n&&(b=ITe(b,i,r,n));var w=u-b.left-b.right,S=d-b.top-b.bottom;return le(le({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(S,0)})},_$e=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},Jw=function(e){var n=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,o=i===void 0?"axis":i,s=e.validateTooltipEventTypes,c=s===void 0?["axis"]:s,l=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,h=function(y,b){var x=b.graphicalItems,w=b.stackGroups,S=b.offset,C=b.updateId,_=b.dataStartIndex,A=b.dataEndIndex,j=y.barSize,P=y.layout,k=y.barGap,O=y.barCategoryGap,E=y.maxBarSize,I=N$(P),D=I.numericAxisName,z=I.cateAxisName,$=S$e(x),G=[];return x.forEach(function(R,L){var W=Xw(y.data,{graphicalItems:[R],dataStartIndex:_,dataEndIndex:A}),Y=R.type.defaultProps!==void 0?le(le({},R.type.defaultProps),R.props):R.props,te=Y.dataKey,me=Y.maxBarSize,F=Y["".concat(D,"Id")],se=Y["".concat(z,"Id")],ne={},ae=l.reduce(function(U,V){var Q=b["".concat(V.axisType,"Map")],B=Y["".concat(V.axisType,"Id")];Q&&Q[B]||V.axisType==="zAxis"||_u();var X=Q[B];return le(le({},U),{},Et(Et({},V.axisType,X),"".concat(V.axisType,"Ticks"),Ca(X)))},ne),De=ae[z],de=ae["".concat(z,"Ticks")],ye=w&&w[F]&&w[F].hasStack&>e(R,w[F].stackGroups),Ee=ja(R.type).indexOf("Bar")>=0,Z=vb(De,de),ct=[],Le=$&&kTe({barSize:j,stackGroups:w,totalSize:_$e(ae,z)});if(Ee){var At,lt,Jt=Dt(me)?E:me,T=(At=(lt=vb(De,de,!0))!==null&<!==void 0?lt:Jt)!==null&&At!==void 0?At:0;ct=OTe({barGap:k,barCategoryGap:O,bandSize:T!==Z?T:Z,sizeList:Le[se],maxBarSize:Jt}),T!==Z&&(ct=ct.map(function(U){return le(le({},U),{},{position:le(le({},U.position),{},{offset:U.position.offset-T/2})})}))}var M=R&&R.type&&R.type.getComposedData;M&&G.push({props:le(le({},M(le(le({},ae),{},{displayedData:W,props:y,dataKey:te,item:R,bandSize:Z,barPosition:ct,offset:S,stackedData:ye,layout:P,dataStartIndex:_,dataEndIndex:A}))),{},Et(Et(Et({key:R.key||"item-".concat(L)},D,ae[D]),z,ae[z]),"animationId",C)),childIndex:Ome(R,y.children),item:R})}),G},p=function(y,b){var x=y.props,w=y.dataStartIndex,S=y.dataEndIndex,C=y.updateId;if(!BR({props:x}))return null;var _=x.children,A=x.layout,j=x.stackOffset,P=x.data,k=x.reverseStackOrder,O=N$(A),E=O.numericAxisName,I=O.cateAxisName,D=jo(_,r),z=HTe(P,D,"".concat(E,"Id"),"".concat(I,"Id"),j,k),$=l.reduce(function(Y,te){var me="".concat(te.axisType,"Map");return le(le({},Y),{},Et({},me,b$e(x,le(le({},te),{},{graphicalItems:D,stackGroups:te.axisType===E&&z,dataStartIndex:w,dataEndIndex:S}))))},{}),G=C$e(le(le({},$),{},{props:x,graphicalItems:D}),b==null?void 0:b.legendBBox);Object.keys($).forEach(function(Y){$[Y]=d(x,$[Y],G,Y.replace("Map",""),n)});var R=$["".concat(I,"Map")],L=w$e(R),W=h(x,le(le({},$),{},{dataStartIndex:w,dataEndIndex:S,updateId:C,graphicalItems:D,stackGroups:z,offset:G}));return le(le({formattedGraphicalItems:W,graphicalItems:D,offset:G,stackGroups:z},L),$)},g=function(m){function y(b){var x,w,S;return r$e(this,y),S=s$e(this,y,[b]),Et(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Et(S,"accessibilityManager",new zDe),Et(S,"handleLegendBBoxUpdate",function(C){if(C){var _=S.state,A=_.dataStartIndex,j=_.dataEndIndex,P=_.updateId;S.setState(le({legendBBox:C},p({props:S.props,dataStartIndex:A,dataEndIndex:j,updateId:P},le(le({},S.state),{},{legendBBox:C}))))}}),Et(S,"handleReceiveSyncEvent",function(C,_,A){if(S.props.syncId===C){if(A===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(_)}}),Et(S,"handleBrushChange",function(C){var _=C.startIndex,A=C.endIndex;if(_!==S.state.dataStartIndex||A!==S.state.dataEndIndex){var j=S.state.updateId;S.setState(function(){return le({dataStartIndex:_,dataEndIndex:A},p({props:S.props,dataStartIndex:_,dataEndIndex:A,updateId:j},S.state))}),S.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),Et(S,"handleMouseEnter",function(C){var _=S.getMouseInfo(C);if(_){var A=le(le({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseEnter;Ct(j)&&j(A,C)}}),Et(S,"triggeredAfterMouseMove",function(C){var _=S.getMouseInfo(C),A=_?le(le({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseMove;Ct(j)&&j(A,C)}),Et(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Et(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Et(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),Et(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};S.setState(_),S.triggerSyncEvent(_);var A=S.props.onMouseLeave;Ct(A)&&A(_,C)}),Et(S,"handleOuterEvent",function(C){var _=kme(C),A=to(S.props,"".concat(_));if(_&&Ct(A)){var j,P;/.*touch.*/i.test(_)?P=S.getMouseInfo(C.changedTouches[0]):P=S.getMouseInfo(C),A((j=P)!==null&&j!==void 0?j:{},C)}}),Et(S,"handleClick",function(C){var _=S.getMouseInfo(C);if(_){var A=le(le({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onClick;Ct(j)&&j(A,C)}}),Et(S,"handleMouseDown",function(C){var _=S.props.onMouseDown;if(Ct(_)){var A=S.getMouseInfo(C);_(A,C)}}),Et(S,"handleMouseUp",function(C){var _=S.props.onMouseUp;if(Ct(_)){var A=S.getMouseInfo(C);_(A,C)}}),Et(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Et(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),Et(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),Et(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&EC.emit(TC,S.props.syncId,C,S.eventEmitterSymbol)}),Et(S,"applySyncEvent",function(C){var _=S.props,A=_.layout,j=_.syncMethod,P=S.state.updateId,k=C.dataStartIndex,O=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(le({dataStartIndex:k,dataEndIndex:O},p({props:S.props,dataStartIndex:k,dataEndIndex:O,updateId:P},S.state)));else if(C.activeTooltipIndex!==void 0){var E=C.chartX,I=C.chartY,D=C.activeTooltipIndex,z=S.state,$=z.offset,G=z.tooltipTicks;if(!$)return;if(typeof j=="function")D=j(G,C);else if(j==="value"){D=-1;for(var R=0;R=0){var ye,Ee;if(E.dataKey&&!E.allowDuplicatedCategory){var Z=typeof E.dataKey=="function"?de:"payload.".concat(E.dataKey.toString());ye=zx(R,Z,D),Ee=L&&W&&zx(W,Z,D)}else ye=R==null?void 0:R[I],Ee=L&&W&&W[I];if(se||F){var ct=C.props.activeIndex!==void 0?C.props.activeIndex:I;return[v.cloneElement(C,le(le(le({},j.props),ae),{},{activeIndex:ct})),null,null]}if(!Dt(ye))return[De].concat(Nf(S.renderActivePoints({item:j,activePoint:ye,basePoint:Ee,childIndex:I,isRange:L})))}else{var Le,At=(Le=S.getItemByXY(S.state.activeCoordinate))!==null&&Le!==void 0?Le:{graphicalItem:De},lt=At.graphicalItem,Jt=lt.item,T=Jt===void 0?C:Jt,M=lt.childIndex,U=le(le(le({},j.props),ae),{},{activeIndex:M});return[v.cloneElement(T,U),null,null]}return L?[De,null,null]:[De,null]}),Et(S,"renderCustomized",function(C,_,A){return v.cloneElement(C,le(le({key:"recharts-customized-".concat(A)},S.props),S.state))}),Et(S,"renderMap",{CartesianGrid:{handler:Iv,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:Iv},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:Iv},YAxis:{handler:Iv},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:th("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=FV(S.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),S.state={},S}return l$e(y,m),o$e(y,[{key:"componentDidMount",value:function(){var x,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,w=x.children,S=x.data,C=x.height,_=x.layout,A=Ki(w,ei);if(A){var j=A.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var P=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,k=cj(this.state,S,j,P),O=this.state.tooltipTicks[j].coordinate,E=(this.state.offset.top+C)/2,I=_==="horizontal",D=I?{x:O,y:E}:{y:O,x:E},z=this.state.formattedGraphicalItems.find(function(G){var R=G.item;return R.type.name==="Scatter"});z&&(D=le(le({},D),z.props.points[j].tooltipPosition),k=z.props.points[j].tooltipPayload);var $={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:P,activePayload:k,activeCoordinate:D};this.setState($),this.renderCursor(A),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(x){$A([Ki(x.children,ei)],[Ki(this.props.children,ei)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=Ki(this.props.children,ei);if(x&&typeof x.props.shared=="boolean"){var w=x.props.shared?"axis":"item";return c.indexOf(w)>=0?w:o}return o}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var w=this.container,S=w.getBoundingClientRect(),C=iAe(S),_={chartX:Math.round(x.pageX-C.left),chartY:Math.round(x.pageY-C.top)},A=S.width/w.offsetWidth||1,j=this.inRange(_.chartX,_.chartY,A);if(!j)return null;var P=this.state,k=P.xAxisMap,O=P.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&k&&O){var I=fc(k).scale,D=fc(O).scale,z=I&&I.invert?I.invert(_.chartX):null,$=D&&D.invert?D.invert(_.chartY):null;return le(le({},_),{},{xValue:z,yValue:$})}var G=E$(this.state,this.props.data,this.props.layout,j);return G?le(le({},_),G):null}},{key:"inRange",value:function(x,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,_=x/S,A=w/S;if(C==="horizontal"||C==="vertical"){var j=this.state.offset,P=_>=j.left&&_<=j.left+j.width&&A>=j.top&&A<=j.top+j.height;return P?{x:_,y:A}:null}var k=this.state,O=k.angleAxisMap,E=k.radiusAxisMap;if(O&&E){var I=fc(O);return QM({x:_,y:A},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,w=this.getTooltipEventType(),S=Ki(x,ei),C={};S&&w==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var _=Gx(this.props,this.handleOuterEvent);return le(le({},_),C)}},{key:"addListener",value:function(){EC.on(TC,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){EC.removeListener(TC,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,w,S){for(var C=this.state.formattedGraphicalItems,_=0,A=C.length;_{var g;const[r,i]=v.useState([{name:"Very Positive",value:0,color:"#4ade80"},{name:"Positive",value:0,color:"#a3e635"},{name:"Neutral",value:0,color:"#93c5fd"},{name:"Negative",value:0,color:"#fb923c"},{name:"Very Negative",value:0,color:"#f87171"}]),[o,s]=v.useState([]),[c,l]=v.useState({}),[u,d]=v.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const y=n.find(b=>b.id===m);return y?y.name:`Participant ${m}`};v.useEffect(()=>{if(t.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},y={},b={};t.forEach(S=>{if(S.senderId!=="moderator"&&S.senderId!=="facilitator"){const C=S.text.toLowerCase();let _="Neutral";C.includes("love")||C.includes("excellent")||C.includes("amazing")?_="Very Positive":C.includes("good")||C.includes("like")||C.includes("great")?_="Positive":C.includes("bad")||C.includes("issue")||C.includes("problem")?_="Negative":(C.includes("terrible")||C.includes("hate")||C.includes("awful"))&&(_="Very Negative"),m[_]++,b[S.senderId]||(b[S.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[S.senderId][_]++,y[S.senderId]=(y[S.senderId]||0)+1}}),i(S=>S.map(C=>({...C,value:m[C.name]||0})));const x=Object.entries(y).map(([S,C])=>({name:f(S),messages:C}));s(x);const w={};Object.entries(b).forEach(([S,C])=>{w[S]={name:f(S),sentiments:C}}),l(w),h(y,b)},[t,n,f]);const h=(m,y)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const x=Object.values(m).reduce((G,R)=>G+R,0)/Object.keys(m).length,w=Object.values(m).map(G=>Math.abs(G-x)/x),S=w.reduce((G,R)=>G+R,0)/w.length,C=Object.values(y).map(G=>Object.values(G).filter(R=>R>0).length),_=C.reduce((G,R)=>G+R,0)/C.length,A=["Very Positive","Positive","Neutral","Negative","Very Negative"],j=Object.values(y).map(G=>{const R=Math.max(...Object.values(G));return A.find(L=>G[L]===R)||"Neutral"}),P=new Set(j).size,k=P/A.length,O=Math.max(0,100-S*100),E=_/5*100,I=k*100,D=Math.round(O*.6+E*.2+I*.2);let z="";const $=D>=70;S>.3&&(z+="Participation is uneven among participants. "),_<2&&(z+="Limited range of sentiments expressed. "),P<=1?z+="Participants show similar sentiment patterns, suggesting potential group-think. ":P>=4&&(z+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),z===""&&(z=$?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:$,score:D,reason:z})},p=m=>{const y=c[m];if(!y)return"N/A";const b=y.sentiments;let x=0,w="Neutral";return Object.entries(b).forEach(([S,C])=>{C>x&&(x=C,w=S)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(dl,{defaultValue:"sentiment",children:[a.jsxs(Va,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(mn,{value:"sentiment",className:"flex items-center",children:[a.jsx(VJ,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(mn,{value:"participation",className:"flex items-center",children:[a.jsx(B_,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(gn,{value:"sentiment",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Sentiment Analysis"}),a.jsxs("div",{className:`px-3 py-1 rounded-full text-sm ${u.isBalanced?"bg-green-100 text-green-800":"bg-amber-100 text-amber-800"}`,children:["Balance score: ",u.score,"/100"]})]}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:y})=>y>0?`${m} ${(y*100).toFixed(0)}%`:"",children:r.map((m,y)=>a.jsx(Og,{fill:m.color},`cell-${y}`))}),a.jsx(Ea,{})]})})}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Sentiment by Participant"}),a.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto pr-2",children:Object.entries(c).map(([m,y])=>{var w;const b=p(m),x=((w=r.find(S=>S.name===b))==null?void 0:w.color)||"#93c5fd";return a.jsxs("div",{className:"flex items-center justify-between p-2 bg-slate-50 rounded",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(qp,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:y.name})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:"text-xs mr-2",children:"Predominant:"}),a.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded",style:{backgroundColor:`${x}30`,color:x},children:b})]})]},m)})})]}),a.jsxs("div",{className:"mt-4 pt-4 border-t",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Focus Group Balance Assessment"}),a.jsxs("div",{className:`p-3 rounded text-sm ${u.isBalanced?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"}`,children:[a.jsx("span",{className:"font-medium",children:u.isBalanced?"Balanced Focus Group":"Potential Balance Issues"}),a.jsx("p",{className:"mt-1 text-xs",children:u.reason})]})]})]})})}),a.jsx(gn,{value:"participation",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"pt-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Participation Distribution"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(bW,{data:o,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{type:"number"}),a.jsx(il,{dataKey:"name",type:"category",width:100}),a.jsx(ei,{}),a.jsx(gl,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:o.length>0?`Most active: ${(g=o.sort((m,y)=>y.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})};function E$e(t){if(console.log("🔍 [GPT-5 CONVERTER] Input wsMessage:",JSON.stringify(t,null,2)),!t)return console.error("🔍 [GPT-5 CONVERTER] ERROR: wsMessage is null/undefined"),null;const e={id:t.id,senderId:t.senderId,text:t.text,timestamp:new Date(t.timestamp),type:t.type,highlighted:t.highlighted,attached_assets:t.attached_assets||[],activates_visual_context:t.activates_visual_context||!1};return console.log("🔍 [GPT-5 CONVERTER] Output converted:",JSON.stringify(e,null,2)),e}function T$e(t){return{id:t.id,title:t.title,description:t.description,quotes:t.quotes,source:t.source,created_at:t.created_at}}function SW(){return!0}const N$e=({focusGroupId:t,personas:e,isVisible:n,onToggle:r})=>{const[i,o]=v.useState(null),[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(!1),[g,m]=v.useState(null),[y,b]=v.useState(null);Xs();const x=SW();v.useEffect(()=>{if(!(!n||!t))return S(),console.log("📊 Setting up STABLE WebSocket event listeners for dashboard"),console.log("📊 Dashboard WebSocket listeners temporarily disabled for GPT-5 fix"),()=>{console.log("📊 Cleaning up STABLE dashboard WebSocket listeners")}},[n,t,x,!0]);const S=async()=>{p(!0),m(null);try{const[P,k,O,E]=await Promise.allSettled([Xn.getConversationAnalytics(t),Xn.getConversationState(t),Xn.getAutonomousConversationStatus(t),Xn.getConversationInsights(t)]);P.status==="fulfilled"&&o(P.value.data.analytics),k.status==="fulfilled"&&c(k.value.data.state),O.status==="fulfilled"&&u(O.value.data.status),E.status==="fulfilled"&&f(E.value.data.insights),b(new Date)}catch(P){console.error("Error fetching dashboard data:",P),m("Failed to load dashboard data")}finally{p(!1)}},C=()=>{S()},_=P=>{switch(P){case"running":return"bg-green-500";case"paused":return"bg-amber-500";case"completed":return"bg-blue-500";case"error":return"bg-red-500";default:return"bg-gray-500"}},A=P=>{switch(P){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},j=P=>{switch(P){case"excellent":return"text-green-600";case"good":return"text-blue-600";case"fair":return"text-amber-600";case"poor":return"text-red-600";default:return"text-gray-600"}};return n?a.jsxs("div",{className:"fixed right-4 top-4 bottom-4 w-80 bg-white rounded-lg shadow-lg border border-gray-200 flex flex-col overflow-hidden z-50",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ya,{className:"h-5 w-5 text-blue-600"}),a.jsx("h3",{className:"font-semibold text-gray-900",children:"AI Dashboard"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(J,{variant:"ghost",size:"sm",onClick:C,disabled:h,className:"p-1",children:a.jsx(wd,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(J,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(QJ,{className:"h-4 w-4"})})]})]}),y&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",y.toLocaleTimeString()]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[g&&a.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(KJ,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),l&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${_(l.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"State:"}),a.jsx(Sr,{variant:l.conversation_state==="running"?"default":"secondary",children:l.conversation_state})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Actions:"}),a.jsx("span",{className:"font-medium",children:l.action_count||0})]})]})})]}),s&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(pa,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall Health:"}),a.jsx(Sr,{className:j(s.conversation_health.status),children:s.conversation_health.status})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Score:"}),a.jsxs("span",{className:"font-medium",children:[s.conversation_health.score,"/100"]})]}),a.jsx(Rl,{value:s.conversation_health.score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("span",{className:"text-xs text-gray-600",children:"Indicators:"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:s.conversation_health.indicators.map((P,k)=>a.jsx(Sr,{variant:"outline",className:"text-xs",children:P.replace("_"," ")},k))})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Dr,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-blue-600",children:i.overview.active_participants}),a.jsx("div",{className:"text-xs text-gray-600",children:"Active"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-green-600",children:i.overview.participant_messages}),a.jsx("div",{className:"text-xs text-gray-600",children:"Messages"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Balance:"}),a.jsx(Sr,{variant:i.participation.participation_balance==="balanced"?"default":"secondary",children:i.participation.participation_balance.replace("_"," ")})]}),i.participation.dominant_participants.length>0&&a.jsxs("div",{className:"text-xs text-amber-600",children:["Dominant: ",i.participation.dominant_participants.length," participant(s)"]}),i.participation.quiet_participants.length>0&&a.jsxs("div",{className:"text-xs text-blue-600",children:["Quiet: ",i.participation.quiet_participants.length," participant(s)"]})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(pZ,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall:"}),a.jsx(Sr,{className:A(i.sentiment_analysis.overall_sentiment),children:i.sentiment_analysis.overall_sentiment})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsxs("span",{children:["Positive: ",i.sentiment_analysis.sentiment_distribution.positive]}),a.jsxs("span",{children:["Neutral: ",i.sentiment_analysis.sentiment_distribution.neutral]}),a.jsxs("span",{children:["Negative: ",i.sentiment_analysis.sentiment_distribution.negative]})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Trend:"}),a.jsx("span",{className:"font-medium",children:i.sentiment_analysis.sentiment_trend})]})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(GJ,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.engagement_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.engagement_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Depth:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.depth_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.depth_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Overall:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.quality_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(uu,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Energy:"}),a.jsx(Sr,{variant:d.conversation_energy==="high"?"default":"secondary",children:d.conversation_energy})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsx(Sr,{variant:d.topic_engagement==="high"?"default":"secondary",children:d.topic_engagement})]}),d.next_suggested_action&&a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-2 mt-2",children:a.jsxs("div",{className:"text-xs text-blue-800",children:[a.jsx("strong",{children:"Suggestion:"})," ",d.next_suggested_action]})})]})})]}),i&&i.recommendations.length>0&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(IE,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:i.recommendations.map((P,k)=>a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2",children:a.jsx("div",{className:"text-xs text-amber-800",children:P})},k))})})]})]})]}):null},P$e=({discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,focusGroupId:o,isOpen:s,onToggle:c,className:l,onEditingChange:u})=>{const d=v.useRef(!1),f=v.useCallback(y=>{d.current=y,u==null||u(y)},[u]),[h,p]=v.useState(!1),g=async()=>{if(!t){re.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}p(!0);try{await Ot.downloadDiscussionGuide(o),re.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(y){console.error("Error downloading discussion guide:",y),re.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{p(!1)}},m=t&&typeof t=="object"&&t.sections;return a.jsx("div",{className:Ne("w-full border-b bg-white shadow-sm",l),children:a.jsxs(_g,{open:s,onOpenChange:c,children:[a.jsx(Ag,{asChild:!0,children:a.jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between hover:bg-slate-50 transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(YJ,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),m&&a.jsxs("p",{className:"text-xs text-slate-500",children:[t.title," • ",t.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(J,{variant:"ghost",size:"sm",onClick:y=>{y.stopPropagation(),g()},disabled:!t||h,className:"h-8",children:h?a.jsx(Ds,{className:"h-4 w-4 animate-spin"}):a.jsx(lu,{className:"h-4 w-4"})}),s?a.jsx(cu,{className:"h-4 w-4 text-slate-500"}):a.jsx(Ma,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(jg,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(gt,{className:"mx-4 mb-4 mt-2",children:a.jsx(Rt,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(GN,{discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,showProgress:!0,collapsible:!0,defaultExpanded:!0,focusGroupId:o,onEditingChange:f})})})})})})]})})},k$e=({focusGroupId:t,focusGroupName:e="Focus Group",onNoteClick:n})=>{const[r,i]=v.useState([]),[o,s]=v.useState(!0),[c,l]=v.useState(null);v.useEffect(()=>{u()},[t]);const u=async()=>{try{s(!0);const x=await Ot.getNotes(t);if(x.data&&Array.isArray(x.data)){const w=x.data.map(S=>({...S,timestamp:new Date(S.timestamp),createdAt:new Date(S.createdAt)}));i(y(w))}}catch(x){console.error("Error fetching notes:",x),re.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{s(!1)}},d=async x=>{l(x);try{await Ot.deleteNote(t,x),i(r.filter(w=>w.id!==x)),re.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),re.error("Failed to delete note",{description:"Please try again."})}finally{l(null)}},f=x=>{x.associatedMessageId&&n?n(x.associatedMessageId):re.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){re.warning("No notes to export",{description:"Create some notes first before exporting."});return}const x=p(),w=document.createElement("a"),S=new Blob([x],{type:"text/markdown"});w.href=URL.createObjectURL(S),w.download=`${e.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),re.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const x=[`# Notes: ${e}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,S)=>{var C;x.push(`## Note ${S+1}`),x.push(""),x.push(`**Created:** ${w.createdAt.toLocaleString()}`),(C=w.sectionInfo)!=null&&C.sectionTitle&&x.push(`**Section:** ${w.sectionInfo.sectionTitle}`),x.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),x.push(""),x.push("**Content:**"),x.push(w.content),x.push(""),x.push("---"),x.push("")}),x.join(` -`)},g=x=>{const w=Math.floor(x/1e3),S=Math.floor(w/60),C=w%60;return`${S}:${C.toString().padStart(2,"0")}`},m=x=>x.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),y=x=>[...x].sort((w,S)=>S.createdAt.getTime()-w.createdAt.getTime()),b=x=>{i(w=>y([...w,x]))};return v.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),o?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Ky,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Notes"}),r.length>0&&a.jsxs("span",{className:"ml-2 text-sm text-slate-500",children:["(",r.length,")"]})]}),a.jsxs(J,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(lu,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(cw,{className:"flex-1",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(Ky,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No notes yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:'Click the "Note" button during the session to add contextual notes.'})]}):a.jsx("div",{className:"space-y-4",children:r.map(x=>{var w;return a.jsxs(gt,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(x),children:[a.jsx(ji,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Wi,{className:"text-sm font-medium text-slate-600",children:m(x.createdAt)}),((w=x.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:x.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[x.associatedMessageId&&a.jsx(J,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:S=>{S.stopPropagation(),f(x)},title:"Go to discussion point",children:a.jsx(aZ,{className:"h-3 w-3"})}),a.jsx(J,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:S=>{S.stopPropagation(),d(x.id)},disabled:c===x.id,title:"Delete note",children:a.jsx(nr,{className:"h-3 w-3"})})]})]})}),a.jsx(Rt,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:x.content})})]},x.id)})})})]})},O$e=({isOpen:t,onClose:e,focusGroupId:n,associatedMessageId:r,sectionInfo:i,messageTimestamp:o,onNoteSaved:s})=>{const[c,l]=v.useState(""),[u,d]=v.useState(!1),f=async()=>{if(!c.trim()){re.error("Note content cannot be empty");return}d(!0);try{const p={content:c.trim(),associatedMessageId:r,sectionInfo:i,elapsedTime:0,timestamp:o.toISOString(),createdAt:new Date().toISOString()},g=await Ot.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},y=i!=null&&i.sectionTitle?`'${i.sectionTitle}'`:"current section",b=o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});re.success("Quick note saved",{description:`Note linked to ${y} at ${b}`}),s&&s(m),l(""),e()}}catch(p){console.error("Error saving note:",p),re.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{l(""),e()};return a.jsx(Ql,{open:t,onOpenChange:h,children:a.jsxs($c,{className:"sm:max-w-md",children:[a.jsx(Lc,{children:a.jsx(Bc,{children:"Quick Note"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-sm text-slate-600",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Section:"})," ",(i==null?void 0:i.sectionTitle)||"Unknown section"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Time:"})," ",o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(mt,{placeholder:"Enter your note here...",value:c,onChange:p=>l(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(J,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},Ys=Object.create(null);Ys.open="0";Ys.close="1";Ys.ping="2";Ys.pong="3";Ys.message="4";Ys.upgrade="5";Ys.noop="6";const cy=Object.create(null);Object.keys(Ys).forEach(t=>{cy[Ys[t]]=t});const lj={type:"error",data:"parser error"},CW=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_W=typeof ArrayBuffer=="function",AW=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,nk=({type:t,data:e},n,r)=>CW&&e instanceof Blob?n?r(e):P$(e,r):_W&&(e instanceof ArrayBuffer||AW(e))?n?r(e):P$(new Blob([e]),r):r(Ys[t]+(e||"")),P$=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function k$(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let PC;function I$e(t,e){if(CW&&t.data instanceof Blob)return t.data.arrayBuffer().then(k$).then(e);if(_W&&(t.data instanceof ArrayBuffer||AW(t.data)))return e(k$(t.data));nk(t,!1,n=>{PC||(PC=new TextEncoder),e(PC.encode(n))})}const O$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,o,s,c,l;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const u=new ArrayBuffer(e),d=new Uint8Array(u);for(r=0;r>4,d[i++]=(s&15)<<4|c>>2,d[i++]=(c&3)<<6|l&63;return u},M$e=typeof ArrayBuffer=="function",rk=(t,e)=>{if(typeof t!="string")return{type:"message",data:jW(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:D$e(t.substring(1),e)}:cy[n]?t.length>1?{type:cy[n],data:t.substring(1)}:{type:cy[n]}:lj},D$e=(t,e)=>{if(M$e){const n=R$e(t);return jW(n,e)}else return{base64:!0,data:t}},jW=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},EW="",$$e=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,s)=>{nk(o,!1,c=>{r[s]=c,++i===n&&e(r.join(EW))})})},L$e=(t,e)=>{const n=t.split(EW),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let kC;function Rv(t){return t.reduce((e,n)=>e+n.length,0)}function Mv(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;iMath.pow(2,21)-1){c.enqueue(lj);break}i=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Rv(n)t){c.enqueue(lj);break}}}})}const TW=4;function hr(t){if(t)return U$e(t)}function U$e(t){for(var e in hr.prototype)t[e]=hr.prototype[e];return t}hr.prototype.on=hr.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};hr.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};hr.prototype.off=hr.prototype.removeListener=hr.prototype.removeAllListeners=hr.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;iPromise.resolve().then(e):(e,n)=>n(e,0),xo=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),H$e="arraybuffer";function NW(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const z$e=xo.setTimeout,G$e=xo.clearTimeout;function eS(t,e){e.useNativeTimers?(t.setTimeoutFn=z$e.bind(xo),t.clearTimeoutFn=G$e.bind(xo)):(t.setTimeoutFn=xo.setTimeout.bind(xo),t.clearTimeoutFn=xo.clearTimeout.bind(xo))}const V$e=1.33;function K$e(t){return typeof t=="string"?W$e(t):Math.ceil((t.byteLength||t.size)*V$e)}function W$e(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}function PW(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function q$e(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Y$e(t){let e={},n=t.split("&");for(let r=0,i=n.length;r{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};L$e(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,$$e(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=PW()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let kW=!1;try{kW=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const J$e=kW;function Z$e(){}class eLe extends X$e{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let Od=class ly extends hr{constructor(e,n,r){super(),this.createRequest=e,eS(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=NW(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=ly.requestsCount++,ly.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Z$e,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ly.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Od.requestsCount=0;Od.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",I$);else if(typeof addEventListener=="function"){const t="onpagehide"in xo?"pagehide":"unload";addEventListener(t,I$,!1)}}function I$(){for(let t in Od.requests)Od.requests.hasOwnProperty(t)&&Od.requests[t].abort()}const tLe=function(){const t=OW({xdomain:!1});return t&&t.responseType!==null}();class nLe extends eLe{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=tLe&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Od(OW,this.uri(),e)}}function OW(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||J$e))return new XMLHttpRequest}catch{}if(!e)try{return new xo[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const IW=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class rLe extends ik{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=IW?{}:NW(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{try{this.doWrite(r,o)}catch{}i&&Zw(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=PW()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const OC=xo.WebSocket||xo.MozWebSocket;class iLe extends rLe{createSocket(e,n,r){return IW?new OC(e,n,r):n?new OC(e,n):new OC(e)}doWrite(e,n){this.ws.send(n)}}class oLe extends ik{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=B$e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=F$e();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:c,value:l})=>{c||(this.onPacket(l),o())}).catch(c=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n{i&&Zw(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const sLe={websocket:iLe,webtransport:oLe,polling:nLe},aLe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,cLe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uj(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=aLe.exec(t||""),o={},s=14;for(;s--;)o[cLe[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=lLe(o,o.path),o.queryKey=uLe(o,o.query),o}function lLe(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function uLe(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const dj=typeof addEventListener=="function"&&typeof removeEventListener=="function",uy=[];dj&&addEventListener("offline",()=>{uy.forEach(t=>t())},!1);class Gc extends hr{constructor(e,n){if(super(),this.binaryType=H$e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=uj(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=uj(n.host).host);eS(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Y$e(this.opts.query)),dj&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},uy.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=TW,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Gc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Gc.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Zw(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:e,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(Gc.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),dj&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=uy.indexOf(this._offlineEventListener);r!==-1&&uy.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Gc.protocol=TW;class dLe extends Gc{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Gc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,d(),n.close(),n=null)}const s=f=>{const h=new Error("probe error: "+f);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function c(){s("transport closed")}function l(){s("socket closed")}function u(f){n&&f.name!==n.name&&o()}const d=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",c),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",c),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;rsLe[i]).filter(i=>!!i)),super(e,r)}};function hLe(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=uj(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+e,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const pLe=typeof ArrayBuffer=="function",mLe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,RW=Object.prototype.toString,gLe=typeof Blob=="function"||typeof Blob<"u"&&RW.call(Blob)==="[object BlobConstructor]",vLe=typeof File=="function"||typeof File<"u"&&RW.call(File)==="[object FileConstructor]";function ok(t){return pLe&&(t instanceof ArrayBuffer||mLe(t))||gLe&&t instanceof Blob||vLe&&t instanceof File}function dy(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num{delete this.acks[e];for(let c=0;c{this.io.clearTimeoutFn(o),n.apply(this,c)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(s,c)=>s?i(s):r(c);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Zt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Zt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Zt.EVENT:case Zt.BINARY_EVENT:this.onevent(e);break;case Zt.ACK:case Zt.BINARY_ACK:this.onack(e);break;case Zt.DISCONNECT:this.ondisconnect();break;case Zt.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Zt.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Zt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}fh.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};fh.prototype.reset=function(){this.attempts=0};fh.prototype.setMin=function(t){this.ms=t};fh.prototype.setMax=function(t){this.max=t};fh.prototype.setJitter=function(t){this.jitter=t};class pj extends hr{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,eS(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new fh({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||_Le;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new fLe(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=zo(n,"open",function(){r.onopen(),e&&e()}),o=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},s=zo(n,"error",o);if(this._timeout!==!1){const c=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},c);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(zo(e,"ping",this.onping.bind(this)),zo(e,"data",this.ondata.bind(this)),zo(e,"error",this.onerror.bind(this)),zo(e,"close",this.onclose.bind(this)),zo(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Zw(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new MW(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Lh={};function fy(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=hLe(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=Lh[i]&&o in Lh[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return c?l=new pj(r,e):(Lh[i]||(Lh[i]=new pj(r,e)),l=Lh[i]),n.query&&!e.query&&(e.query=n.queryKey),l.socket(n.path,e)}Object.assign(fy,{Manager:pj,Socket:MW,io:fy,connect:fy});const M$=window.location.origin,D$=new URLSearchParams(window.location.search).get("direct")==="1"?"/socket.io/":"/semblance_back/socket.io/";let It=null,eu=null,$$=!1;function DW(t){if(It)return It.io.opts.auth={token:t()},It;console.log("🔧 [GPT-5] Creating singleton socket:",M$,D$),It=fy(M$,{path:D$,transports:["websocket"],reconnection:!0,autoConnect:!1,timeout:6e4,pingInterval:45e3,pingTimeout:12e4,auth:n=>n({token:t()})}),It.io.on("reconnect_attempt",()=>{console.log("🔧 [GPT-5] Reconnect attempt - refreshing token"),It.io.opts.auth={token:t()}});const e=()=>{console.log("🔧 [GPT-5] Socket connected, rebinding listeners and rejoining room"),NLe(),eu&&TLe()};return It.on("connect",e),It.onAny((n,...r)=>{console.log(`🔧 [GPT-5 onAny] ${n}:`,r);const i=r[0];switch(n){case"joined_focus_group":console.log("🔧 [GPT-5] *** ROUTING joined_focus_group from onAny ***"),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:i}));break;case"left_focus_group":console.log("🔧 [GPT-5] *** ROUTING left_focus_group from onAny ***"),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:i}));break;case"message_update":console.log("🔧 [GPT-5] *** ROUTING message_update from onAny ***");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:i})),console.log("🔧 [GPT-5] DISPATCHED window event ws:message_update SUCCESS (via onAny)")}catch(o){console.error("🔧 [GPT-5] ERROR dispatching window event (via onAny):",o)}break;case"ai_status_update":console.log("🔧 [GPT-5] *** ROUTING ai_status_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:i}));break;case"moderator_status_update":console.log("🔧 [GPT-5] *** ROUTING moderator_status_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:i}));break;case"theme_update":console.log("🔧 [GPT-5] *** ROUTING theme_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:i}));break;case"focus_group_update":console.log("🔧 [GPT-5] *** ROUTING focus_group_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:i}));break;case"connected":console.log("🔧 [GPT-5] *** ROUTING connected from onAny ***");break;case"error":console.error("🔧 [GPT-5] *** ROUTING error from onAny ***",i);break}}),It.on("connect_error",n=>{console.error("🔧 [GPT-5] Connect error:",n)}),It.on("disconnect",n=>{console.log("🔧 [GPT-5] Disconnected:",n)}),It}function $W(){It&&!It.connected&&(console.log("🔧 [GPT-5] Connecting socket"),It.connect())}function jLe(t,e){if(console.log("🔧 [GPT-5] Joining focus group:",t),eu=t,!(It!=null&&It.connected)){console.log("🔧 [GPT-5] Socket not connected, will auto-rejoin on connect"),$W(),setTimeout(()=>{It!=null&&It.connected?(console.log("🔧 [GPT-5] Retrying join after connection established"),It.emit("join_focus_group",{focus_group_id:t},n=>{console.log("🔧 [GPT-5] join_focus_group RETRY ACK:",n)})):console.log("🔧 [GPT-5] Still not connected, will rejoin on next connect event")},1e3);return}It.emit("join_focus_group",{focus_group_id:t},n=>{console.log("🔧 [GPT-5] join_focus_group ACK:",n)})}function ELe(t){console.log("🔧 [GPT-5] Leaving focus group:",t),eu===t&&(eu=null),It!=null&&It.connected&&It.emit("leave_focus_group",{focus_group_id:t})}function TLe(){!(It!=null&&It.connected)||!eu||(console.log("🔧 [GPT-5] Auto-rejoining room after reconnect:",eu),It.emit("join_focus_group",{focus_group_id:eu}))}function NLe(){if(!It){console.log("🔧 [GPT-5] bindCoreListeners called but socket is null!");return}$$&&console.log("🔧 [GPT-5] Listeners already bound, but rebinding anyway for safety"),console.log("🔧 [GPT-5] bindCoreListeners called - socket exists, binding listeners");const t=c=>{console.log("🔧 [GPT-5] joined_focus_group:",c),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:c}))},e=c=>{console.log("🔧 [GPT-5] left_focus_group:",c),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:c}))},n=c=>{console.log("🔧 [GPT-5] *** MESSAGE_UPDATE LISTENER FIRED! ***"),console.log("🔧 [GPT-5] message_update payload:",c),console.log("🔧 [GPT-5] DISPATCHING window event ws:message_update");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:c})),console.log("🔧 [GPT-5] DISPATCHED window event ws:message_update SUCCESS")}catch(l){console.error("🔧 [GPT-5] ERROR dispatching window event:",l)}},r=c=>{console.log("🔧 [GPT-5] ai_status_update:",c),console.log("🔧 [GPT-5] DISPATCHING window event ws:ai_status_update"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:c})),console.log("🔧 [GPT-5] DISPATCHED window event ws:ai_status_update")},i=c=>{console.log("🔧 [GPT-5] moderator_status_update:",c),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:c}))},o=c=>{console.log("🔧 [GPT-5] theme_update:",c),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:c}))},s=c=>{console.log("🔧 [GPT-5] focus_group_update:",c),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:c}))};console.log("🔧 [GPT-5] BINDING specific listeners to socket"),It.on("joined_focus_group",t),It.on("left_focus_group",e),It.on("message_update",n),It.on("ai_status_update",r),It.on("moderator_status_update",i),It.on("theme_update",o),It.on("focus_group_update",s),console.log("🔧 [GPT-5] BOUND specific listeners to socket"),console.log("🔧 [GPT-5] Socket listeners after binding:",It.listeners("message_update").length),console.log("🔧 [GPT-5] Socket hasListeners message_update:",It.hasListeners("message_update")),setTimeout(()=>{It!=null&&It.connected&&(console.log("🔧 [GPT-5] SELF-TEST: Emitting test event"),It.emit("message_update",{test:"self-emit-test"}))},1e3),It.on("connected",c=>{console.log("🔧 [GPT-5] connected:",c)}),It.on("error",c=>{console.error("🔧 [GPT-5] socket error:",c)}),$$=!0}const PLe=()=>{const{id:t}=OE(),e=ar(),{token:n}=Xs(),[r,i]=v.useState([]),[o,s]=v.useState([]),[c,l]=v.useState([]),[u,d]=v.useState(null),[f,h]=v.useState([]),[p,g]=v.useState("chat"),[m,y]=v.useState(null),[b,x]=v.useState(!1),[w,S]=v.useState(!1),[C,_]=v.useState(!0),[A,j]=v.useState(!1),[P,k]=v.useState(!1),O=v.useRef(!1),[E,I]=v.useState(!1),D=v.useRef(u);D.current=u;const[z,$]=v.useState([]),[G,R]=v.useState(!1),[L,W]=v.useState(""),[Y,te]=v.useState("medium"),[me,F]=v.useState("medium"),[se,ne]=v.useState(!1),[ae,De]=v.useState(!1),[de,ye]=v.useState(null),[Ee,Z]=v.useState([]),[ct,Le]=v.useState(!1),[At,lt]=v.useState(!1),[Jt,T]=v.useState(!1),[M,U]=v.useState(!0),[V,Q]=v.useState({isOpen:!1}),B=v.useRef(!1),[X,ge]=v.useState(""),xe=v.useRef(""),Re=v.useRef(!1),be=v.useRef({wasConnected:!1,wasConnecting:!1,initialConnection:!0,hasShownFallbackNotification:!1}),Ve=SW(),[st,kt]=v.useState(!1),[Ke,tt]=v.useState(!1),[Nt,sn]=v.useState(null),Nr=v.useCallback(()=>n||"",[n]);v.useEffect(()=>{console.log("🔧 [GPT-5 Session] Initializing WebSocket"),DW(Nr)},[Ve,Nr]),v.useEffect(()=>{if(!t)return;(()=>{console.log("🔧 [GPT-5 Session] Joining focus group:",t),jLe(t)})()},[t,Ve]),v.useEffect(()=>{tt(!0),kt(!1),sn(null);const ee=setTimeout(()=>{kt(!0),tt(!1)},1e3);return()=>{clearTimeout(ee)}},[Ve]),v.useEffect(()=>{console.log("🔧 [GPT-5 Session] Setting up window event listeners");const ee=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] message_update:",nt),nt.focus_group_id&&(console.log("🔧 [GPT-5] Message focus_group_id:",nt.focus_group_id),console.log("🔧 [GPT-5] Current focus group from URL:",t));const Se=E$e(nt.message);if(!Se){console.error("🔧 [GPT-5] convertWebSocketMessage returned null");return}i(Wt=>Wt.find(rn=>rn.id===Se.id)?(console.log("🔧 [GPT-5] Message already exists, skipping"),Wt):(console.log("🔧 [GPT-5] Adding new message, count:",Wt.length+1),[...Wt,Se]))},ce=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] ai_status_update:",nt),S(Se=>nt.status.status==="ai_mode"),ge(Se=>nt.status.status)},ke=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] moderator_status_update:",nt),y(nt.moderator_status)},Fe=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] theme_update:",nt);const Se=T$e(nt.theme);l(Wt=>{const St=[...Wt],rn=St.findIndex(qt=>qt.id===Se.id);return rn>=0?St[rn]=Se:St.push(Se),St})},Ue=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] focus_group_update:",nt),d(Se=>Se?{...Se,...nt}:null)},_t=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] joined_focus_group:",nt)};return console.log("🔧 [GPT-5 Session] ADDING window event listeners"),window.addEventListener("ws:message_update",ee),window.addEventListener("ws:ai_status_update",ce),window.addEventListener("ws:moderator_status_update",ke),window.addEventListener("ws:theme_update",Fe),window.addEventListener("ws:focus_group_update",Ue),window.addEventListener("ws:joined_focus_group",_t),console.log("🔧 [GPT-5 Session] ADDED all window event listeners"),()=>{console.log("🔧 [GPT-5 Session] Cleaning up window event listeners"),window.removeEventListener("ws:message_update",ee),window.removeEventListener("ws:ai_status_update",ce),window.removeEventListener("ws:moderator_status_update",ke),window.removeEventListener("ws:theme_update",Fe),window.removeEventListener("ws:focus_group_update",Ue),window.removeEventListener("ws:joined_focus_group",_t),t&&ELe(t)}},[Ve,t]),v.useEffect(()=>{if(!t)return;const ee=be.current;st&&!ee.wasConnected&&(ee.initialConnection?Ye.success("Live updates enabled",{description:"Connected to real-time updates. Changes will appear instantly.",duration:3e3}):Ye.success("Real-time updates restored",{description:"WebSocket connection re-established. You'll now receive instant updates.",duration:4e3}),ee.wasConnected=!0,ee.initialConnection=!1),!st&&!Ke&&ee.wasConnected&&!ee.initialConnection&&(Ye.warning("Connection lost",{description:"Real-time updates unavailable. Attempting to reconnect...",duration:5e3}),ee.wasConnected=!1,U(!0)),Nt&&!Ke&&!st&&!ee.initialConnection&&(Ye.error("Connection failed",{description:"Unable to establish real-time connection. Using periodic updates instead.",duration:6e3}),U(!0)),ee.wasConnecting=Ke},[st,Ke,Nt,Ve,t]),v.useEffect(()=>{},[Ve,t,u]);const dn=async()=>{var ee;if(t)try{const ce=await Xn.getModeratorStatus(t);if((ee=ce==null?void 0:ce.data)!=null&&ee.status){const ke=ce.data.status;if(m){const Fe=m.current_section_id!==ke.current_section_id||m.current_item_id!==ke.current_item_id||m.progress!==ke.progress}O.current||y(ke)}}catch(ce){console.error("Error fetching moderator status:",ce)}},wt=async()=>{if(!t)return{aiActive:!1,sessionStatus:""};try{if(typeof(Ot==null?void 0:Ot.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(Ot==null?void 0:Ot.getById)),{aiActive:w,sessionStatus:X};const ee=await Ot.getById(t);if(!ee||typeof ee!="object")return console.error("Invalid response object received:",ee),{aiActive:w,sessionStatus:X};if(!ee.data||typeof ee.data!="object")return console.warn("Focus group response missing data property:",ee),{aiActive:w,sessionStatus:X};const ce=ee.data.status;if(typeof ce>"u")return console.warn("Focus group response missing status field:",ee.data),{aiActive:w,sessionStatus:X};const ke=ce==="ai_mode";return ce==="autonomous_active"?console.warn('Detected legacy "autonomous_active" status - backend may need updating to "ai_mode"'):["ai_mode","active","completed","paused","draft","in-progress"].includes(ce)||console.warn("Unexpected focus group status value:",ce),{aiActive:ke,sessionStatus:ce}}catch(ee){console.error("Error checking AI mode status:",ee);const ce={focusGroupId:t,currentAiModeStatus:w,errorType:"unknown",timestamp:new Date().toISOString()};return ee.response?(ce.errorType="api_error",ce.status=ee.response.status,ce.data=ee.response.data,console.error("API error response:",ee.response.status,ee.response.data),ee.response.status===404?console.warn("Focus group not found - may have been deleted"):ee.response.status===500&&console.error("Server error during status check - backend issue")):ee.request?(ce.errorType="network_error",console.error("Network error - no response received, check connectivity")):(ce.errorType="request_setup",ce.message=ee.message,console.error("Request setup error:",ee.message)),console.debug("Status check error details:",ce),{aiActive:w,sessionStatus:X,isGenerating:!1}}},Ze=async(ee,ce)=>{if(!t||Re.current)return;const ke=["completed","paused"],Ue=["ai_mode","autonomous_active","active","in-progress"].includes(ce),_t=ke.includes(ee);if(Ue&&_t){Re.current=!0;try{let He="session_ended";ee==="completed"?He="auto_complete":ee==="paused"&&(He="manual_stop");const nt=await Xn.endSession(t,He);nt!=null&&nt.data&&(Ye.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{ot()},1e3))}catch(He){console.error("❌ Error ending session with concluding statement:",He),Ye.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},ot=async()=>{var ee;if(t)try{const ce=await Ot.getMessages(t);let ke=[],Fe=[];ce&&ce.data&&(Array.isArray(ce.data)?(ke=ce.data,Fe=[]):ce.data.messages||ce.data.mode_events?(ke=ce.data.messages||[],Fe=ce.data.mode_events||[]):(ke=Array.isArray(ce.data)?ce.data:[],Fe=[]));const Ue=ke.map(Se=>({id:Se._id||Se.id||`msg-${Date.now()}`,senderId:Se.senderId,text:Se.text,timestamp:new Date(Se.timestamp||Se.created_at||new Date),type:Se.type||"response",highlighted:Se.highlighted||!1})),_t=Fe.map(Se=>({id:Se._id||Se.id||`event-${Date.now()}`,focus_group_id:Se.focus_group_id,event_type:Se.event_type,timestamp:new Date(Se.timestamp||Se.created_at||new Date),user_id:Se.user_id,created_at:new Date(Se.created_at||new Date)}));s(_t),Ue.length>0?i(Se=>{if(Se.length===0)return Ue;{const Wt=new Map;Se.forEach(qn=>Wt.set(qn.id,qn));const St=Ue.map(qn=>{if(Wt.has(qn.id)){const wn=Wt.get(qn.id);return{...qn,highlighted:wn.highlighted}}return qn}),rn=new Set(St.map(qn=>qn.id)),qt=Se.filter(qn=>!rn.has(qn.id));return[...St,...qt].sort((qn,wn)=>qn.timestamp.getTime()-wn.timestamp.getTime())}}):Ue.length===0&&i(Se=>Se.length===0?[]:Se);const He=Ue.filter(Se=>Se.highlighted),nt=He.length>0?He.map(Se=>({id:`theme-${Se.id}`,text:Se.text.substring(0,40)+(Se.text.length>40?"...":""),count:1,messages:[Se.id],source:"highlight"})):[];try{const Se=await Xn.getKeyThemes(t);if((ee=Se==null?void 0:Se.data)!=null&&ee.themes&&Array.isArray(Se.data.themes)){const Wt=Se.data.themes;l([...nt,...Wt])}else l(nt)}catch(Se){console.error("Error fetching AI-generated themes:",Se),l(nt)}}catch(ce){console.error("Error fetching messages:",ce),r.length===0&&Ye.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},Xt=async()=>{if(!t)return!1;try{const ce=(await zr.getAll()).data||[],ke=await Ot.getById(t);if(ke&&ke.data){const Fe=ke.data;console.log("Focus group data from API:",Fe);const Ue={id:Fe._id||Fe.id,name:Fe.name,status:Fe.status||"in-progress",participants:Fe.participants||[],date:Fe.date||new Date().toISOString(),duration:Fe.duration||60,topic:Fe.topic||"general",discussionGuide:Fe.discussionGuide||"",llm_model:Fe.llm_model||"gemini-2.5-pro"};if(d(Ue),W(Ue.llm_model||"gemini-2.5-pro"),te(Ue.reasoning_effort||"medium"),F(Ue.verbosity||"medium"),Fe.participants_data&&Array.isArray(Fe.participants_data))h(Fe.participants_data.map(He=>({...He,id:He._id||He.id})));else if(Ue.participants&&Array.isArray(Ue.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:Ue.participants,allPersonas:ce.map(nt=>({id:nt._id||nt.id,name:nt.name}))});const He=ce.filter(nt=>{const Se=nt._id||nt.id;return Ue.participants.includes(Se)});console.log("Matched participants:",He.map(nt=>nt.name)),h(He)}await ot(),await dn();const _t=await wt();return S(_t.aiActive),ge(_t.sessionStatus),B.current=_t.aiActive,xe.current=_t.sessionStatus,!0}return!1}catch(ee){return console.error("Error fetching focus group:",ee),!1}},bn=async(ee,ce,ke)=>{if(console.log("🔧 updateFocusGroupModel called with:",{id:t,focusGroup:!!u,newModel:ee,reasoningEffort:ce,verbosity:ke}),!t||!u){console.log("❌ updateFocusGroupModel: Missing id or focusGroup",{id:t,focusGroup:!!u});return}ne(!0);try{const Fe={llm_model:ee};ee==="gpt-5"&&(Fe.reasoning_effort=ce||Y,Fe.verbosity=ke||me),console.log("🔧 Making API call to update focus group model:",{id:t,updateData:Fe});const Ue=await Ot.update(t,Fe);console.log("🔧 API response:",Ue),Ue&&Ue.data?(d(_t=>_t?{..._t,llm_model:ee,reasoning_effort:ee==="gpt-5"?ce||Y:_t==null?void 0:_t.reasoning_effort,verbosity:ee==="gpt-5"?ke||me:_t==null?void 0:_t.verbosity}:null),Ye.success("AI Model Updated",{description:`Focus group will now use ${ee==="gemini-2.5-pro"?"Gemini 2.5 Pro":ee==="gpt-4.1"?"GPT-4.1":ee==="gpt-5"?"GPT-5":ee} for AI responses`}),R(!1),console.log("✅ Model update successful")):console.log("❌ API response missing data:",Ue)}catch(Fe){console.error("❌ Error updating focus group model:",Fe),Ye.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{ne(!1)}};v.useEffect(()=>{console.log("Looking for focus group with ID:",t);const ee=async()=>{try{return(await zr.getAll()).data||[]}catch(Ue){return console.error("Error fetching personas:",Ue),[]}},ce=async Ue=>{try{const _t=await Ot.getById(t);if(_t&&_t.data){const He=_t.data;console.log("Focus group data from API:",He);const nt={id:He._id||He.id,name:He.name,status:He.status||"in-progress",participants:He.participants||[],date:He.date||new Date().toISOString(),duration:He.duration||60,topic:He.topic||"general",discussionGuide:He.discussionGuide||"",llm_model:He.llm_model||"gemini-2.5-pro"};if(d(nt),W(nt.llm_model||"gemini-2.5-pro"),te(nt.reasoning_effort||"medium"),F(nt.verbosity||"medium"),He.participants_data&&Array.isArray(He.participants_data))h(He.participants_data.map(Se=>({...Se,id:Se._id||Se.id})));else if(nt.participants&&Array.isArray(nt.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:nt.participants,allPersonas:Ue.map(Wt=>({id:Wt._id||Wt.id,name:Wt.name}))});const Se=Ue.filter(Wt=>{const St=Wt._id||Wt.id;return nt.participants.includes(St)});console.log("Matched participants:",Se.map(Wt=>Wt.name)),h(Se)}return ot(),dn(),_(!1),!0}return!1}catch(_t){return console.error("Error fetching focus group:",_t),!1}};let ke,Fe;return ee().then(Ue=>{ce(Ue).then(_t=>{_t?Nt&&(Nt.includes("unavailable")||Nt.includes("websocket error"))?(console.log("📡 WebSocket connection failed, falling back to polling"),(()=>{ot(),dn(),ke&&window.clearInterval(ke);const St=w?3e3:1e4;console.log("📡 Setting up message polling:",{aiModeActive:w,pollInterval:St,timestamp:new Date().toISOString()}),ke=window.setInterval(()=>{O.current?console.log("📡 Skipping poll - editing discussion guide"):(console.log("📡 Polling for messages...",new Date().toISOString()),ot(),dn())},St)})(),Fe=window.setInterval(async()=>{const St=B.current,rn=xe.current,qt=await wt();if(B.current=qt.aiActive,xe.current=qt.sessionStatus,S(qt.aiActive),ge(qt.sessionStatus),rn&&rn!==qt.sessionStatus&&await Ze(qt.sessionStatus,rn),St!==qt.aiActive&&ke){window.clearInterval(ke);const Ci=qt.aiActive?3e3:1e4;ke=window.setInterval(()=>{O.current||(ot(),dn())},Ci)}},15e3)):console.log("📡 WebSocket enabled, skipping polling setup"):(console.error("Focus group not found with ID:",t),_(!1),Ye.error("Focus group not found",{description:`Could not find focus group with ID: ${t}`}))})}),()=>{ke&&window.clearInterval(ke),Fe&&window.clearInterval(Fe)}},[t,e,Ve,Nt]);const oo=ee=>{if(!ee||!ee.sections||!Array.isArray(ee.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ce=ee.sections[0];if(!ce)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ke=Ue=>Ue.questions&&Array.isArray(Ue.questions)&&Ue.questions.length>0?{content:Ue.questions[0].content,itemId:Ue.questions[0].id,type:"question"}:Ue.activities&&Array.isArray(Ue.activities)&&Ue.activities.length>0?{content:Ue.activities[0].content,itemId:Ue.activities[0].id,type:"activity"}:null;let Fe=ke(ce);if(!Fe&&ce.subsections&&Array.isArray(ce.subsections)){for(const Ue of ce.subsections)if(Fe=ke(Ue),Fe)break}return Fe?{content:Fe.content,sectionId:ce.id,itemId:Fe.itemId}:{content:`Welcome to our focus group session on "${ce.title||"our topic"}". Let's begin our discussion.`,sectionId:ce.id,itemId:"section-intro"}},ta=async()=>{var ee,ce,ke,Fe,Ue,_t;if(t)try{Ye.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const He=await Xn.getModeratorStatus(t),nt=(ce=(ee=He==null?void 0:He.data)==null?void 0:ee.status)==null?void 0:ce.moderator_position;nt?console.log("📍 Preserving existing moderator position:",nt):(await Xn.setModeratorPosition(t,((Ue=(Fe=(ke=u==null?void 0:u.discussionGuide)==null?void 0:ke.sections)==null?void 0:Fe[0])==null?void 0:Ue.id)||"welcome"),console.log("🚀 Moderator position initialized to start of discussion guide (first time)"))}catch(He){console.warn("Failed to check/initialize moderator position:",He)}await Ot.update(t,{status:"active"});try{const He=oo(u==null?void 0:u.discussionGuide),nt={id:`msg-${Date.now()}`,senderId:"moderator",text:He.content,timestamp:new Date,type:"question"},Se=await Ot.sendMessage(t,{senderId:"moderator",text:nt.text,type:"question"});(_t=Se==null?void 0:Se.data)!=null&&_t.message_id&&(nt.id=Se.data.message_id),q(nt),console.log("🚀 Initial moderator message created:",{content:He.content,sectionId:He.sectionId,itemId:He.itemId})}catch(He){console.warn("Failed to create initial moderator message:",He)}Ye.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(He){console.error("Error starting session:",He),Ye.error("Error starting session",{description:"There was a problem connecting to the server."})}},q=ee=>{i(ce=>[...ce,ee])},Pe=async ee=>{const ce=[...r],ke=ce.findIndex(Fe=>Fe.id===ee);if(ke!==-1){const Fe=ce[ke],Ue=!Fe.highlighted;if(ce[ke]={...Fe,highlighted:Ue},i(ce),t)try{!ee.startsWith("local-")&&!ee.startsWith("msg-")?await Ot.updateMessageHighlight(t,ee,Ue):console.log("Skipping database update for local message:",ee)}catch(_t){console.error("Error updating message highlight state:",_t),Ye.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},We=ee=>f.find(ce=>ce.id===ee||ce._id===ee),yt=()=>{const ee=r.map(Fe=>{var He;let Ue;return Fe.senderId==="moderator"?Ue="AI Moderator":Fe.senderId==="facilitator"?Ue="Human Facilitator":Ue=((He=We(Fe.senderId))==null?void 0:He.name)||"Unknown",`[${Fe.timestamp.toLocaleTimeString()}] ${Ue}: ${Fe.text}`}).join(` +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gW(t,e){if(t){if(typeof t=="string")return aj(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return aj(t,e)}}function d$e(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function f$e(t){if(Array.isArray(t))return aj(t)}function aj(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?s:e&&e.length&&Ae(i)&&Ae(o)?e.slice(i,o+1):[]};function xW(t){return t==="number"?[0,"auto"]:void 0}var cj=function(e,n,r,i){var o=e.graphicalItems,s=e.tooltipAxis,c=Xw(n,e);return r<0||!o||!o.length||r>=c.length?null:o.reduce(function(l,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(f=f.slice(e.dataStartIndex,e.dataEndIndex+1));var h;if(s.dataKey&&!s.allowDuplicatedCategory){var p=f===void 0?c:f;h=zx(p,s.dataKey,i)}else h=f&&f[r]||c[r];return h?[].concat(Nf(l),[Y8(u,h)]):l},[])},E$=function(e,n,r,i){var o=i||{x:e.chartX,y:e.chartY},s=g$e(o,r),c=e.orderedTooltipTicks,l=e.tooltipAxis,u=e.tooltipTicks,d=PTe(s,c,u,l);if(d>=0&&u){var f=u[d]&&u[d].value,h=cj(e,n,d,f),p=v$e(r,c,d,o);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},y$e=function(e,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,s=n.axisIdKey,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=e.stackOffset,p=z8(d,o);return r.reduce(function(g,m){var y,b=m.type.defaultProps!==void 0?le(le({},m.type.defaultProps),m.props):m.props,x=b.type,w=b.dataKey,S=b.allowDataOverflow,C=b.allowDuplicatedCategory,_=b.scale,A=b.ticks,j=b.includeHidden,P=b[s];if(g[P])return g;var k=Xw(e.data,{graphicalItems:i.filter(function(te){var me,F=s in te.props?te.props[s]:(me=te.type.defaultProps)===null||me===void 0?void 0:me[s];return F===P}),dataStartIndex:l,dataEndIndex:u}),O=k.length,E,I,D;GDe(b.domain,S,x)&&(E=S1(b.domain,null,S),p&&(x==="number"||_!=="auto")&&(D=yp(k,w,"category")));var z=xW(x);if(!E||E.length===0){var $,G=($=b.domain)!==null&&$!==void 0?$:z;if(w){if(E=yp(k,w,x),x==="category"&&p){var R=bme(E);C&&R?(I=E,E=kb(0,O)):C||(E=WM(G,E,m).reduce(function(te,me){return te.indexOf(me)>=0?te:[].concat(Nf(te),[me])},[]))}else if(x==="category")C?E=E.filter(function(te){return te!==""&&!Dt(te)}):E=WM(G,E,m).reduce(function(te,me){return te.indexOf(me)>=0||me===""||Dt(me)?te:[].concat(Nf(te),[me])},[]);else if(x==="number"){var L=MTe(k,i.filter(function(te){var me,F,se=s in te.props?te.props[s]:(me=te.type.defaultProps)===null||me===void 0?void 0:me[s],ne="hide"in te.props?te.props.hide:(F=te.type.defaultProps)===null||F===void 0?void 0:F.hide;return se===P&&(j||!ne)}),w,o,d);L&&(E=L)}p&&(x==="number"||_!=="auto")&&(D=yp(k,w,"category"))}else p?E=kb(0,O):c&&c[P]&&c[P].hasStack&&x==="number"?E=h==="expand"?[0,1]:q8(c[P].stackGroups,l,u):E=H8(k,i.filter(function(te){var me=s in te.props?te.props[s]:te.type.defaultProps[s],F="hide"in te.props?te.props.hide:te.type.defaultProps.hide;return me===P&&(j||!F)}),x,d,!0);if(x==="number")E=oj(f,E,P,o,A),G&&(E=S1(G,E,S));else if(x==="category"&&G){var W=G,Y=E.every(function(te){return W.indexOf(te)>=0});Y&&(E=W)}}return le(le({},g),{},Et({},P,le(le({},b),{},{axisType:o,domain:E,categoricalDomain:D,duplicateDomain:I,originalDomain:(y=b.domain)!==null&&y!==void 0?y:z,isCategorical:p,layout:d})))},{})},x$e=function(e,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,s=n.axisIdKey,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.layout,f=e.children,h=Xw(e.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:u}),p=h.length,g=z8(d,o),m=-1;return r.reduce(function(y,b){var x=b.type.defaultProps!==void 0?le(le({},b.type.defaultProps),b.props):b.props,w=x[s],S=xW("number");if(!y[w]){m++;var C;return g?C=kb(0,p):c&&c[w]&&c[w].hasStack?(C=q8(c[w].stackGroups,l,u),C=oj(f,C,w,o)):(C=S1(S,H8(h,r.filter(function(_){var A,j,P=s in _.props?_.props[s]:(A=_.type.defaultProps)===null||A===void 0?void 0:A[s],k="hide"in _.props?_.props.hide:(j=_.type.defaultProps)===null||j===void 0?void 0:j.hide;return P===w&&!k}),"number",d),i.defaultProps.allowDataOverflow),C=oj(f,C,w,o)),le(le({},y),{},Et({},w,le(le({axisType:o},i.defaultProps),{},{hide:!0,orientation:to(p$e,"".concat(o,".").concat(m%2),null),domain:C,originalDomain:S,isCategorical:g,layout:d})))}return y},{})},b$e=function(e,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,s=n.graphicalItems,c=n.stackGroups,l=n.dataStartIndex,u=n.dataEndIndex,d=e.children,f="".concat(i,"Id"),h=jo(d,o),p={};return h&&h.length?p=y$e(e,{axes:h,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u}):s&&s.length&&(p=x$e(e,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u})),p},w$e=function(e){var n=fc(e),r=Ca(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:yP(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:vb(n,r)}},T$=function(e){var n=e.children,r=e.defaultShowTooltip,i=Ki(n,xf),o=0,s=0;return e.data&&e.data.length!==0&&(s=e.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(s=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:s,activeTooltipIndex:-1,isTooltipActive:!!r}},S$e=function(e){return!e||!e.length?!1:e.some(function(n){var r=ja(n&&n.type);return r&&r.indexOf("Bar")>=0})},N$=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},C$e=function(e,n){var r=e.props,i=e.graphicalItems,o=e.xAxisMap,s=o===void 0?{}:o,c=e.yAxisMap,l=c===void 0?{}:c,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=Ki(f,xf),g=Ki(f,Ea),m=Object.keys(l).reduce(function(C,_){var A=l[_],j=A.orientation;return!A.mirror&&!A.hide?le(le({},C),{},Et({},j,C[j]+A.width)):C},{left:h.left||0,right:h.right||0}),y=Object.keys(s).reduce(function(C,_){var A=s[_],j=A.orientation;return!A.mirror&&!A.hide?le(le({},C),{},Et({},j,to(C,"".concat(j))+A.height)):C},{top:h.top||0,bottom:h.bottom||0}),b=le(le({},y),m),x=b.bottom;p&&(b.bottom+=p.props.height||xf.defaultProps.height),g&&n&&(b=ITe(b,i,r,n));var w=u-b.left-b.right,S=d-b.top-b.bottom;return le(le({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(S,0)})},_$e=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},Jw=function(e){var n=e.chartName,r=e.GraphicalChild,i=e.defaultTooltipEventType,o=i===void 0?"axis":i,s=e.validateTooltipEventTypes,c=s===void 0?["axis"]:s,l=e.axisComponents,u=e.legendContent,d=e.formatAxisMap,f=e.defaultProps,h=function(y,b){var x=b.graphicalItems,w=b.stackGroups,S=b.offset,C=b.updateId,_=b.dataStartIndex,A=b.dataEndIndex,j=y.barSize,P=y.layout,k=y.barGap,O=y.barCategoryGap,E=y.maxBarSize,I=N$(P),D=I.numericAxisName,z=I.cateAxisName,$=S$e(x),G=[];return x.forEach(function(R,L){var W=Xw(y.data,{graphicalItems:[R],dataStartIndex:_,dataEndIndex:A}),Y=R.type.defaultProps!==void 0?le(le({},R.type.defaultProps),R.props):R.props,te=Y.dataKey,me=Y.maxBarSize,F=Y["".concat(D,"Id")],se=Y["".concat(z,"Id")],ne={},ae=l.reduce(function(U,V){var Q=b["".concat(V.axisType,"Map")],B=Y["".concat(V.axisType,"Id")];Q&&Q[B]||V.axisType==="zAxis"||_u();var X=Q[B];return le(le({},U),{},Et(Et({},V.axisType,X),"".concat(V.axisType,"Ticks"),Ca(X)))},ne),De=ae[z],de=ae["".concat(z,"Ticks")],ye=w&&w[F]&&w[F].hasStack&>e(R,w[F].stackGroups),Ee=ja(R.type).indexOf("Bar")>=0,Z=vb(De,de),ct=[],Le=$&&kTe({barSize:j,stackGroups:w,totalSize:_$e(ae,z)});if(Ee){var At,lt,Jt=Dt(me)?E:me,T=(At=(lt=vb(De,de,!0))!==null&<!==void 0?lt:Jt)!==null&&At!==void 0?At:0;ct=OTe({barGap:k,barCategoryGap:O,bandSize:T!==Z?T:Z,sizeList:Le[se],maxBarSize:Jt}),T!==Z&&(ct=ct.map(function(U){return le(le({},U),{},{position:le(le({},U.position),{},{offset:U.position.offset-T/2})})}))}var M=R&&R.type&&R.type.getComposedData;M&&G.push({props:le(le({},M(le(le({},ae),{},{displayedData:W,props:y,dataKey:te,item:R,bandSize:Z,barPosition:ct,offset:S,stackedData:ye,layout:P,dataStartIndex:_,dataEndIndex:A}))),{},Et(Et(Et({key:R.key||"item-".concat(L)},D,ae[D]),z,ae[z]),"animationId",C)),childIndex:Ome(R,y.children),item:R})}),G},p=function(y,b){var x=y.props,w=y.dataStartIndex,S=y.dataEndIndex,C=y.updateId;if(!BR({props:x}))return null;var _=x.children,A=x.layout,j=x.stackOffset,P=x.data,k=x.reverseStackOrder,O=N$(A),E=O.numericAxisName,I=O.cateAxisName,D=jo(_,r),z=HTe(P,D,"".concat(E,"Id"),"".concat(I,"Id"),j,k),$=l.reduce(function(Y,te){var me="".concat(te.axisType,"Map");return le(le({},Y),{},Et({},me,b$e(x,le(le({},te),{},{graphicalItems:D,stackGroups:te.axisType===E&&z,dataStartIndex:w,dataEndIndex:S}))))},{}),G=C$e(le(le({},$),{},{props:x,graphicalItems:D}),b==null?void 0:b.legendBBox);Object.keys($).forEach(function(Y){$[Y]=d(x,$[Y],G,Y.replace("Map",""),n)});var R=$["".concat(I,"Map")],L=w$e(R),W=h(x,le(le({},$),{},{dataStartIndex:w,dataEndIndex:S,updateId:C,graphicalItems:D,stackGroups:z,offset:G}));return le(le({formattedGraphicalItems:W,graphicalItems:D,offset:G,stackGroups:z},L),$)},g=function(m){function y(b){var x,w,S;return r$e(this,y),S=s$e(this,y,[b]),Et(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Et(S,"accessibilityManager",new zDe),Et(S,"handleLegendBBoxUpdate",function(C){if(C){var _=S.state,A=_.dataStartIndex,j=_.dataEndIndex,P=_.updateId;S.setState(le({legendBBox:C},p({props:S.props,dataStartIndex:A,dataEndIndex:j,updateId:P},le(le({},S.state),{},{legendBBox:C}))))}}),Et(S,"handleReceiveSyncEvent",function(C,_,A){if(S.props.syncId===C){if(A===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(_)}}),Et(S,"handleBrushChange",function(C){var _=C.startIndex,A=C.endIndex;if(_!==S.state.dataStartIndex||A!==S.state.dataEndIndex){var j=S.state.updateId;S.setState(function(){return le({dataStartIndex:_,dataEndIndex:A},p({props:S.props,dataStartIndex:_,dataEndIndex:A,updateId:j},S.state))}),S.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),Et(S,"handleMouseEnter",function(C){var _=S.getMouseInfo(C);if(_){var A=le(le({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseEnter;Ct(j)&&j(A,C)}}),Et(S,"triggeredAfterMouseMove",function(C){var _=S.getMouseInfo(C),A=_?le(le({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseMove;Ct(j)&&j(A,C)}),Et(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Et(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Et(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),Et(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};S.setState(_),S.triggerSyncEvent(_);var A=S.props.onMouseLeave;Ct(A)&&A(_,C)}),Et(S,"handleOuterEvent",function(C){var _=kme(C),A=to(S.props,"".concat(_));if(_&&Ct(A)){var j,P;/.*touch.*/i.test(_)?P=S.getMouseInfo(C.changedTouches[0]):P=S.getMouseInfo(C),A((j=P)!==null&&j!==void 0?j:{},C)}}),Et(S,"handleClick",function(C){var _=S.getMouseInfo(C);if(_){var A=le(le({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onClick;Ct(j)&&j(A,C)}}),Et(S,"handleMouseDown",function(C){var _=S.props.onMouseDown;if(Ct(_)){var A=S.getMouseInfo(C);_(A,C)}}),Et(S,"handleMouseUp",function(C){var _=S.props.onMouseUp;if(Ct(_)){var A=S.getMouseInfo(C);_(A,C)}}),Et(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Et(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),Et(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),Et(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&EC.emit(TC,S.props.syncId,C,S.eventEmitterSymbol)}),Et(S,"applySyncEvent",function(C){var _=S.props,A=_.layout,j=_.syncMethod,P=S.state.updateId,k=C.dataStartIndex,O=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(le({dataStartIndex:k,dataEndIndex:O},p({props:S.props,dataStartIndex:k,dataEndIndex:O,updateId:P},S.state)));else if(C.activeTooltipIndex!==void 0){var E=C.chartX,I=C.chartY,D=C.activeTooltipIndex,z=S.state,$=z.offset,G=z.tooltipTicks;if(!$)return;if(typeof j=="function")D=j(G,C);else if(j==="value"){D=-1;for(var R=0;R=0){var ye,Ee;if(E.dataKey&&!E.allowDuplicatedCategory){var Z=typeof E.dataKey=="function"?de:"payload.".concat(E.dataKey.toString());ye=zx(R,Z,D),Ee=L&&W&&zx(W,Z,D)}else ye=R==null?void 0:R[I],Ee=L&&W&&W[I];if(se||F){var ct=C.props.activeIndex!==void 0?C.props.activeIndex:I;return[v.cloneElement(C,le(le(le({},j.props),ae),{},{activeIndex:ct})),null,null]}if(!Dt(ye))return[De].concat(Nf(S.renderActivePoints({item:j,activePoint:ye,basePoint:Ee,childIndex:I,isRange:L})))}else{var Le,At=(Le=S.getItemByXY(S.state.activeCoordinate))!==null&&Le!==void 0?Le:{graphicalItem:De},lt=At.graphicalItem,Jt=lt.item,T=Jt===void 0?C:Jt,M=lt.childIndex,U=le(le(le({},j.props),ae),{},{activeIndex:M});return[v.cloneElement(T,U),null,null]}return L?[De,null,null]:[De,null]}),Et(S,"renderCustomized",function(C,_,A){return v.cloneElement(C,le(le({key:"recharts-customized-".concat(A)},S.props),S.state))}),Et(S,"renderMap",{CartesianGrid:{handler:Iv,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:Iv},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:Iv},YAxis:{handler:Iv},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:th("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=FV(S.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),S.state={},S}return l$e(y,m),o$e(y,[{key:"componentDidMount",value:function(){var x,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,w=x.children,S=x.data,C=x.height,_=x.layout,A=Ki(w,ei);if(A){var j=A.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var P=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,k=cj(this.state,S,j,P),O=this.state.tooltipTicks[j].coordinate,E=(this.state.offset.top+C)/2,I=_==="horizontal",D=I?{x:O,y:E}:{y:O,x:E},z=this.state.formattedGraphicalItems.find(function(G){var R=G.item;return R.type.name==="Scatter"});z&&(D=le(le({},D),z.props.points[j].tooltipPosition),k=z.props.points[j].tooltipPayload);var $={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:P,activePayload:k,activeCoordinate:D};this.setState($),this.renderCursor(A),this.accessibilityManager.setIndex(j)}}}},{key:"getSnapshotBeforeUpdate",value:function(x,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==x.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==x.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(x){$A([Ki(x.children,ei)],[Ki(this.props.children,ei)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=Ki(this.props.children,ei);if(x&&typeof x.props.shared=="boolean"){var w=x.props.shared?"axis":"item";return c.indexOf(w)>=0?w:o}return o}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var w=this.container,S=w.getBoundingClientRect(),C=iAe(S),_={chartX:Math.round(x.pageX-C.left),chartY:Math.round(x.pageY-C.top)},A=S.width/w.offsetWidth||1,j=this.inRange(_.chartX,_.chartY,A);if(!j)return null;var P=this.state,k=P.xAxisMap,O=P.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&k&&O){var I=fc(k).scale,D=fc(O).scale,z=I&&I.invert?I.invert(_.chartX):null,$=D&&D.invert?D.invert(_.chartY):null;return le(le({},_),{},{xValue:z,yValue:$})}var G=E$(this.state,this.props.data,this.props.layout,j);return G?le(le({},_),G):null}},{key:"inRange",value:function(x,w){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,_=x/S,A=w/S;if(C==="horizontal"||C==="vertical"){var j=this.state.offset,P=_>=j.left&&_<=j.left+j.width&&A>=j.top&&A<=j.top+j.height;return P?{x:_,y:A}:null}var k=this.state,O=k.angleAxisMap,E=k.radiusAxisMap;if(O&&E){var I=fc(O);return QM({x:_,y:A},I)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,w=this.getTooltipEventType(),S=Ki(x,ei),C={};S&&w==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var _=Gx(this.props,this.handleOuterEvent);return le(le({},_),C)}},{key:"addListener",value:function(){EC.on(TC,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){EC.removeListener(TC,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,w,S){for(var C=this.state.formattedGraphicalItems,_=0,A=C.length;_{var g;const[r,i]=v.useState([{name:"Very Positive",value:0,color:"#4ade80"},{name:"Positive",value:0,color:"#a3e635"},{name:"Neutral",value:0,color:"#93c5fd"},{name:"Negative",value:0,color:"#fb923c"},{name:"Very Negative",value:0,color:"#f87171"}]),[o,s]=v.useState([]),[c,l]=v.useState({}),[u,d]=v.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const y=n.find(b=>b.id===m);return y?y.name:`Participant ${m}`};v.useEffect(()=>{if(t.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},y={},b={};t.forEach(S=>{if(S.senderId!=="moderator"&&S.senderId!=="facilitator"){const C=S.text.toLowerCase();let _="Neutral";C.includes("love")||C.includes("excellent")||C.includes("amazing")?_="Very Positive":C.includes("good")||C.includes("like")||C.includes("great")?_="Positive":C.includes("bad")||C.includes("issue")||C.includes("problem")?_="Negative":(C.includes("terrible")||C.includes("hate")||C.includes("awful"))&&(_="Very Negative"),m[_]++,b[S.senderId]||(b[S.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[S.senderId][_]++,y[S.senderId]=(y[S.senderId]||0)+1}}),i(S=>S.map(C=>({...C,value:m[C.name]||0})));const x=Object.entries(y).map(([S,C])=>({name:f(S),messages:C}));s(x);const w={};Object.entries(b).forEach(([S,C])=>{w[S]={name:f(S),sentiments:C}}),l(w),h(y,b)},[t,n,f]);const h=(m,y)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const x=Object.values(m).reduce((G,R)=>G+R,0)/Object.keys(m).length,w=Object.values(m).map(G=>Math.abs(G-x)/x),S=w.reduce((G,R)=>G+R,0)/w.length,C=Object.values(y).map(G=>Object.values(G).filter(R=>R>0).length),_=C.reduce((G,R)=>G+R,0)/C.length,A=["Very Positive","Positive","Neutral","Negative","Very Negative"],j=Object.values(y).map(G=>{const R=Math.max(...Object.values(G));return A.find(L=>G[L]===R)||"Neutral"}),P=new Set(j).size,k=P/A.length,O=Math.max(0,100-S*100),E=_/5*100,I=k*100,D=Math.round(O*.6+E*.2+I*.2);let z="";const $=D>=70;S>.3&&(z+="Participation is uneven among participants. "),_<2&&(z+="Limited range of sentiments expressed. "),P<=1?z+="Participants show similar sentiment patterns, suggesting potential group-think. ":P>=4&&(z+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),z===""&&(z=$?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:$,score:D,reason:z})},p=m=>{const y=c[m];if(!y)return"N/A";const b=y.sentiments;let x=0,w="Neutral";return Object.entries(b).forEach(([S,C])=>{C>x&&(x=C,w=S)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(dl,{defaultValue:"sentiment",children:[a.jsxs(Va,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(gn,{value:"sentiment",className:"flex items-center",children:[a.jsx(VJ,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(gn,{value:"participation",className:"flex items-center",children:[a.jsx(B_,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(vn,{value:"sentiment",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"pt-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-lg font-semibold",children:"Sentiment Analysis"}),a.jsxs("div",{className:`px-3 py-1 rounded-full text-sm ${u.isBalanced?"bg-green-100 text-green-800":"bg-amber-100 text-amber-800"}`,children:["Balance score: ",u.score,"/100"]})]}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:y})=>y>0?`${m} ${(y*100).toFixed(0)}%`:"",children:r.map((m,y)=>a.jsx(Og,{fill:m.color},`cell-${y}`))}),a.jsx(Ea,{})]})})}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Sentiment by Participant"}),a.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto pr-2",children:Object.entries(c).map(([m,y])=>{var w;const b=p(m),x=((w=r.find(S=>S.name===b))==null?void 0:w.color)||"#93c5fd";return a.jsxs("div",{className:"flex items-center justify-between p-2 bg-slate-50 rounded",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(qp,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:y.name})]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx("span",{className:"text-xs mr-2",children:"Predominant:"}),a.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded",style:{backgroundColor:`${x}30`,color:x},children:b})]})]},m)})})]}),a.jsxs("div",{className:"mt-4 pt-4 border-t",children:[a.jsx("h4",{className:"text-sm font-medium mb-2",children:"Focus Group Balance Assessment"}),a.jsxs("div",{className:`p-3 rounded text-sm ${u.isBalanced?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"}`,children:[a.jsx("span",{className:"font-medium",children:u.isBalanced?"Balanced Focus Group":"Potential Balance Issues"}),a.jsx("p",{className:"mt-1 text-xs",children:u.reason})]})]})]})})}),a.jsx(vn,{value:"participation",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"pt-6",children:[a.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Participation Distribution"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(bW,{data:o,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{type:"number"}),a.jsx(il,{dataKey:"name",type:"category",width:100}),a.jsx(ei,{}),a.jsx(gl,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:o.length>0?`Most active: ${(g=o.sort((m,y)=>y.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})};function E$e(t){if(console.log("🔍 [GPT-5 CONVERTER] Input wsMessage:",JSON.stringify(t,null,2)),!t)return console.error("🔍 [GPT-5 CONVERTER] ERROR: wsMessage is null/undefined"),null;const e={id:t.id,senderId:t.senderId,text:t.text,timestamp:new Date(t.timestamp),type:t.type,highlighted:t.highlighted,attached_assets:t.attached_assets||[],activates_visual_context:t.activates_visual_context||!1};return console.log("🔍 [GPT-5 CONVERTER] Output converted:",JSON.stringify(e,null,2)),e}function T$e(t){return{id:t.id,title:t.title,description:t.description,quotes:t.quotes,source:t.source,created_at:t.created_at}}function SW(){return!0}const N$e=({focusGroupId:t,personas:e,isVisible:n,onToggle:r})=>{const[i,o]=v.useState(null),[s,c]=v.useState(null),[l,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(!1),[g,m]=v.useState(null),[y,b]=v.useState(null);Xs();const x=SW();v.useEffect(()=>{if(!(!n||!t))return S(),console.log("📊 Setting up STABLE WebSocket event listeners for dashboard"),console.log("📊 Dashboard WebSocket listeners temporarily disabled for GPT-5 fix"),()=>{console.log("📊 Cleaning up STABLE dashboard WebSocket listeners")}},[n,t,x,!0]);const S=async()=>{p(!0),m(null);try{const[P,k,O,E]=await Promise.allSettled([Xn.getConversationAnalytics(t),Xn.getConversationState(t),Xn.getAutonomousConversationStatus(t),Xn.getConversationInsights(t)]);P.status==="fulfilled"&&o(P.value.data.analytics),k.status==="fulfilled"&&c(k.value.data.state),O.status==="fulfilled"&&u(O.value.data.status),E.status==="fulfilled"&&f(E.value.data.insights),b(new Date)}catch(P){console.error("Error fetching dashboard data:",P),m("Failed to load dashboard data")}finally{p(!1)}},C=()=>{S()},_=P=>{switch(P){case"running":return"bg-green-500";case"paused":return"bg-amber-500";case"completed":return"bg-blue-500";case"error":return"bg-red-500";default:return"bg-gray-500"}},A=P=>{switch(P){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},j=P=>{switch(P){case"excellent":return"text-green-600";case"good":return"text-blue-600";case"fair":return"text-amber-600";case"poor":return"text-red-600";default:return"text-gray-600"}};return n?a.jsxs("div",{className:"fixed right-4 top-4 bottom-4 w-80 bg-white rounded-lg shadow-lg border border-gray-200 flex flex-col overflow-hidden z-50",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ya,{className:"h-5 w-5 text-blue-600"}),a.jsx("h3",{className:"font-semibold text-gray-900",children:"AI Dashboard"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(J,{variant:"ghost",size:"sm",onClick:C,disabled:h,className:"p-1",children:a.jsx(wd,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(J,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(QJ,{className:"h-4 w-4"})})]})]}),y&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",y.toLocaleTimeString()]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[g&&a.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(KJ,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),l&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${_(l.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"State:"}),a.jsx(Sr,{variant:l.conversation_state==="running"?"default":"secondary",children:l.conversation_state})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Actions:"}),a.jsx("span",{className:"font-medium",children:l.action_count||0})]})]})})]}),s&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(pa,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall Health:"}),a.jsx(Sr,{className:j(s.conversation_health.status),children:s.conversation_health.status})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Score:"}),a.jsxs("span",{className:"font-medium",children:[s.conversation_health.score,"/100"]})]}),a.jsx(Rl,{value:s.conversation_health.score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("span",{className:"text-xs text-gray-600",children:"Indicators:"}),a.jsx("div",{className:"flex flex-wrap gap-1",children:s.conversation_health.indicators.map((P,k)=>a.jsx(Sr,{variant:"outline",className:"text-xs",children:P.replace("_"," ")},k))})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Dr,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-blue-600",children:i.overview.active_participants}),a.jsx("div",{className:"text-xs text-gray-600",children:"Active"})]}),a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-lg font-semibold text-green-600",children:i.overview.participant_messages}),a.jsx("div",{className:"text-xs text-gray-600",children:"Messages"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Balance:"}),a.jsx(Sr,{variant:i.participation.participation_balance==="balanced"?"default":"secondary",children:i.participation.participation_balance.replace("_"," ")})]}),i.participation.dominant_participants.length>0&&a.jsxs("div",{className:"text-xs text-amber-600",children:["Dominant: ",i.participation.dominant_participants.length," participant(s)"]}),i.participation.quiet_participants.length>0&&a.jsxs("div",{className:"text-xs text-blue-600",children:["Quiet: ",i.participation.quiet_participants.length," participant(s)"]})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(pZ,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx("span",{className:"text-sm",children:"Overall:"}),a.jsx(Sr,{className:A(i.sentiment_analysis.overall_sentiment),children:i.sentiment_analysis.overall_sentiment})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsxs("span",{children:["Positive: ",i.sentiment_analysis.sentiment_distribution.positive]}),a.jsxs("span",{children:["Neutral: ",i.sentiment_analysis.sentiment_distribution.neutral]}),a.jsxs("span",{children:["Negative: ",i.sentiment_analysis.sentiment_distribution.negative]})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Trend:"}),a.jsx("span",{className:"font-medium",children:i.sentiment_analysis.sentiment_trend})]})]})]})})]}),i&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(GJ,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.engagement_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.engagement_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Depth:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.depth_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.depth_score,className:"h-2"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Overall:"}),a.jsxs("span",{className:"font-medium",children:[Math.round(i.quality_metrics.quality_score),"/100"]})]}),a.jsx(Rl,{value:i.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(uu,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Energy:"}),a.jsx(Sr,{variant:d.conversation_energy==="high"?"default":"secondary",children:d.conversation_energy})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Engagement:"}),a.jsx(Sr,{variant:d.topic_engagement==="high"?"default":"secondary",children:d.topic_engagement})]}),d.next_suggested_action&&a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-2 mt-2",children:a.jsxs("div",{className:"text-xs text-blue-800",children:[a.jsx("strong",{children:"Suggestion:"})," ",d.next_suggested_action]})})]})})]}),i&&i.recommendations.length>0&&a.jsxs(gt,{children:[a.jsx(ji,{className:"pb-3",children:a.jsxs(Wi,{className:"text-sm flex items-center gap-2",children:[a.jsx(IE,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:i.recommendations.map((P,k)=>a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2",children:a.jsx("div",{className:"text-xs text-amber-800",children:P})},k))})})]})]})]}):null},P$e=({discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,focusGroupId:o,isOpen:s,onToggle:c,className:l,onEditingChange:u})=>{const d=v.useRef(!1),f=v.useCallback(y=>{d.current=y,u==null||u(y)},[u]),[h,p]=v.useState(!1),g=async()=>{if(!t){re.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}p(!0);try{await Ot.downloadDiscussionGuide(o),re.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(y){console.error("Error downloading discussion guide:",y),re.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{p(!1)}},m=t&&typeof t=="object"&&t.sections;return a.jsx("div",{className:Ne("w-full border-b bg-white shadow-sm",l),children:a.jsxs(_g,{open:s,onOpenChange:c,children:[a.jsx(Ag,{asChild:!0,children:a.jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between hover:bg-slate-50 transition-colors cursor-pointer",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(YJ,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),m&&a.jsxs("p",{className:"text-xs text-slate-500",children:[t.title," • ",t.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(J,{variant:"ghost",size:"sm",onClick:y=>{y.stopPropagation(),g()},disabled:!t||h,className:"h-8",children:h?a.jsx(Ds,{className:"h-4 w-4 animate-spin"}):a.jsx(lu,{className:"h-4 w-4"})}),s?a.jsx(cu,{className:"h-4 w-4 text-slate-500"}):a.jsx(Ma,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(jg,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(gt,{className:"mx-4 mb-4 mt-2",children:a.jsx(Rt,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(GN,{discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,showProgress:!0,collapsible:!0,defaultExpanded:!0,focusGroupId:o,onEditingChange:f})})})})})})]})})},k$e=({focusGroupId:t,focusGroupName:e="Focus Group",onNoteClick:n})=>{const[r,i]=v.useState([]),[o,s]=v.useState(!0),[c,l]=v.useState(null);v.useEffect(()=>{u()},[t]);const u=async()=>{try{s(!0);const x=await Ot.getNotes(t);if(x.data&&Array.isArray(x.data)){const w=x.data.map(S=>({...S,timestamp:new Date(S.timestamp),createdAt:new Date(S.createdAt)}));i(y(w))}}catch(x){console.error("Error fetching notes:",x),re.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{s(!1)}},d=async x=>{l(x);try{await Ot.deleteNote(t,x),i(r.filter(w=>w.id!==x)),re.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),re.error("Failed to delete note",{description:"Please try again."})}finally{l(null)}},f=x=>{x.associatedMessageId&&n?n(x.associatedMessageId):re.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){re.warning("No notes to export",{description:"Create some notes first before exporting."});return}const x=p(),w=document.createElement("a"),S=new Blob([x],{type:"text/markdown"});w.href=URL.createObjectURL(S),w.download=`${e.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),re.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const x=[`# Notes: ${e}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,S)=>{var C;x.push(`## Note ${S+1}`),x.push(""),x.push(`**Created:** ${w.createdAt.toLocaleString()}`),(C=w.sectionInfo)!=null&&C.sectionTitle&&x.push(`**Section:** ${w.sectionInfo.sectionTitle}`),x.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),x.push(""),x.push("**Content:**"),x.push(w.content),x.push(""),x.push("---"),x.push("")}),x.join(` +`)},g=x=>{const w=Math.floor(x/1e3),S=Math.floor(w/60),C=w%60;return`${S}:${C.toString().padStart(2,"0")}`},m=x=>x.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),y=x=>[...x].sort((w,S)=>S.createdAt.getTime()-w.createdAt.getTime()),b=x=>{i(w=>y([...w,x]))};return v.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),o?a.jsx("div",{className:"flex items-center justify-center h-64",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(Ky,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Notes"}),r.length>0&&a.jsxs("span",{className:"ml-2 text-sm text-slate-500",children:["(",r.length,")"]})]}),a.jsxs(J,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(lu,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(cw,{className:"flex-1",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[a.jsx(Ky,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No notes yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:'Click the "Note" button during the session to add contextual notes.'})]}):a.jsx("div",{className:"space-y-4",children:r.map(x=>{var w;return a.jsxs(gt,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(x),children:[a.jsx(ji,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Wi,{className:"text-sm font-medium text-slate-600",children:m(x.createdAt)}),((w=x.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:x.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[x.associatedMessageId&&a.jsx(J,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:S=>{S.stopPropagation(),f(x)},title:"Go to discussion point",children:a.jsx(aZ,{className:"h-3 w-3"})}),a.jsx(J,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:S=>{S.stopPropagation(),d(x.id)},disabled:c===x.id,title:"Delete note",children:a.jsx(nr,{className:"h-3 w-3"})})]})]})}),a.jsx(Rt,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:x.content})})]},x.id)})})})]})},O$e=({isOpen:t,onClose:e,focusGroupId:n,associatedMessageId:r,sectionInfo:i,messageTimestamp:o,onNoteSaved:s})=>{const[c,l]=v.useState(""),[u,d]=v.useState(!1),f=async()=>{if(!c.trim()){re.error("Note content cannot be empty");return}d(!0);try{const p={content:c.trim(),associatedMessageId:r,sectionInfo:i,elapsedTime:0,timestamp:o.toISOString(),createdAt:new Date().toISOString()},g=await Ot.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},y=i!=null&&i.sectionTitle?`'${i.sectionTitle}'`:"current section",b=o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});re.success("Quick note saved",{description:`Note linked to ${y} at ${b}`}),s&&s(m),l(""),e()}}catch(p){console.error("Error saving note:",p),re.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{l(""),e()};return a.jsx(Ql,{open:t,onOpenChange:h,children:a.jsxs($c,{className:"sm:max-w-md",children:[a.jsx(Lc,{children:a.jsx(Bc,{children:"Quick Note"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-sm text-slate-600",children:[a.jsxs("div",{children:[a.jsx("strong",{children:"Section:"})," ",(i==null?void 0:i.sectionTitle)||"Unknown section"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Time:"})," ",o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(mt,{placeholder:"Enter your note here...",value:c,onChange:p=>l(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(J,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},Ys=Object.create(null);Ys.open="0";Ys.close="1";Ys.ping="2";Ys.pong="3";Ys.message="4";Ys.upgrade="5";Ys.noop="6";const cy=Object.create(null);Object.keys(Ys).forEach(t=>{cy[Ys[t]]=t});const lj={type:"error",data:"parser error"},CW=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",_W=typeof ArrayBuffer=="function",AW=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,nk=({type:t,data:e},n,r)=>CW&&e instanceof Blob?n?r(e):P$(e,r):_W&&(e instanceof ArrayBuffer||AW(e))?n?r(e):P$(new Blob([e]),r):r(Ys[t]+(e||"")),P$=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function k$(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let PC;function I$e(t,e){if(CW&&t.data instanceof Blob)return t.data.arrayBuffer().then(k$).then(e);if(_W&&(t.data instanceof ArrayBuffer||AW(t.data)))return e(k$(t.data));nk(t,!1,n=>{PC||(PC=new TextEncoder),e(PC.encode(n))})}const O$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t{let e=t.length*.75,n=t.length,r,i=0,o,s,c,l;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const u=new ArrayBuffer(e),d=new Uint8Array(u);for(r=0;r>4,d[i++]=(s&15)<<4|c>>2,d[i++]=(c&3)<<6|l&63;return u},M$e=typeof ArrayBuffer=="function",rk=(t,e)=>{if(typeof t!="string")return{type:"message",data:jW(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:D$e(t.substring(1),e)}:cy[n]?t.length>1?{type:cy[n],data:t.substring(1)}:{type:cy[n]}:lj},D$e=(t,e)=>{if(M$e){const n=R$e(t);return jW(n,e)}else return{base64:!0,data:t}},jW=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},EW="",$$e=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,s)=>{nk(o,!1,c=>{r[s]=c,++i===n&&e(r.join(EW))})})},L$e=(t,e)=>{const n=t.split(EW),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(n)})}})}let kC;function Rv(t){return t.reduce((e,n)=>e+n.length,0)}function Mv(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let i=0;iMath.pow(2,21)-1){c.enqueue(lj);break}i=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(Rv(n)t){c.enqueue(lj);break}}}})}const TW=4;function hr(t){if(t)return U$e(t)}function U$e(t){for(var e in hr.prototype)t[e]=hr.prototype[e];return t}hr.prototype.on=hr.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};hr.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};hr.prototype.off=hr.prototype.removeListener=hr.prototype.removeAllListeners=hr.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,i=0;iPromise.resolve().then(e):(e,n)=>n(e,0),xo=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),H$e="arraybuffer";function NW(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const z$e=xo.setTimeout,G$e=xo.clearTimeout;function eS(t,e){e.useNativeTimers?(t.setTimeoutFn=z$e.bind(xo),t.clearTimeoutFn=G$e.bind(xo)):(t.setTimeoutFn=xo.setTimeout.bind(xo),t.clearTimeoutFn=xo.clearTimeout.bind(xo))}const V$e=1.33;function K$e(t){return typeof t=="string"?W$e(t):Math.ceil((t.byteLength||t.size)*V$e)}function W$e(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}function PW(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function q$e(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function Y$e(t){let e={},n=t.split("&");for(let r=0,i=n.length;r{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};L$e(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,$$e(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=PW()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let kW=!1;try{kW=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const J$e=kW;function Z$e(){}class eLe extends X$e{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let Od=class ly extends hr{constructor(e,n,r){super(),this.createRequest=e,eS(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=NW(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=ly.requestsCount++,ly.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Z$e,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete ly.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Od.requestsCount=0;Od.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",I$);else if(typeof addEventListener=="function"){const t="onpagehide"in xo?"pagehide":"unload";addEventListener(t,I$,!1)}}function I$(){for(let t in Od.requests)Od.requests.hasOwnProperty(t)&&Od.requests[t].abort()}const tLe=function(){const t=OW({xdomain:!1});return t&&t.responseType!==null}();class nLe extends eLe{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=tLe&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Od(OW,this.uri(),e)}}function OW(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||J$e))return new XMLHttpRequest}catch{}if(!e)try{return new xo[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const IW=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class rLe extends ik{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=IW?{}:NW(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n{try{this.doWrite(r,o)}catch{}i&&Zw(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=PW()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const OC=xo.WebSocket||xo.MozWebSocket;class iLe extends rLe{createSocket(e,n,r){return IW?new OC(e,n,r):n?new OC(e,n):new OC(e)}doWrite(e,n){this.ws.send(n)}}class oLe extends ik{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=B$e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=F$e();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:c,value:l})=>{c||(this.onPacket(l),o())}).catch(c=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n{i&&Zw(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const sLe={websocket:iLe,webtransport:oLe,polling:nLe},aLe=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,cLe=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function uj(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let i=aLe.exec(t||""),o={},s=14;for(;s--;)o[cLe[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=lLe(o,o.path),o.queryKey=uLe(o,o.query),o}function lLe(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function uLe(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const dj=typeof addEventListener=="function"&&typeof removeEventListener=="function",uy=[];dj&&addEventListener("offline",()=>{uy.forEach(t=>t())},!1);class Gc extends hr{constructor(e,n){if(super(),this.binaryType=H$e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=uj(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=uj(n.host).host);eS(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Y$e(this.opts.query)),dj&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},uy.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=TW,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&Gc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Gc.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Zw(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:e,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(Gc.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),dj&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=uy.indexOf(this._offlineEventListener);r!==-1&&uy.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Gc.protocol=TW;class dLe extends Gc{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",f=>{if(!r)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Gc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(d(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const h=new Error("probe error");h.transport=n.name,this.emitReserved("upgradeError",h)}}))};function o(){r||(r=!0,d(),n.close(),n=null)}const s=f=>{const h=new Error("probe error: "+f);h.transport=n.name,o(),this.emitReserved("upgradeError",h)};function c(){s("transport closed")}function l(){s("socket closed")}function u(f){n&&f.name!==n.name&&o()}const d=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",c),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",s),n.once("close",c),this.once("close",l),this.once("upgrading",u),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;rsLe[i]).filter(i=>!!i)),super(e,r)}};function hLe(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=uj(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+e,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const pLe=typeof ArrayBuffer=="function",mLe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,RW=Object.prototype.toString,gLe=typeof Blob=="function"||typeof Blob<"u"&&RW.call(Blob)==="[object BlobConstructor]",vLe=typeof File=="function"||typeof File<"u"&&RW.call(File)==="[object FileConstructor]";function ok(t){return pLe&&(t instanceof ArrayBuffer||mLe(t))||gLe&&t instanceof Blob||vLe&&t instanceof File}function dy(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n=0&&t.num{delete this.acks[e];for(let c=0;c{this.io.clearTimeoutFn(o),n.apply(this,c)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...n){return new Promise((r,i)=>{const o=(s,c)=>s?i(s):r(c);o.withError=!0,n.push(o),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Zt.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Zt.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Zt.EVENT:case Zt.BINARY_EVENT:this.onevent(e);break;case Zt.ACK:case Zt.BINARY_ACK:this.onack(e);break;case Zt.DISCONNECT:this.ondisconnect();break;case Zt.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Zt.ACK,id:e,data:i}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Zt.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r0&&t.jitter<=1?t.jitter:0,this.attempts=0}fh.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};fh.prototype.reset=function(){this.attempts=0};fh.prototype.setMin=function(t){this.ms=t};fh.prototype.setMax=function(t){this.max=t};fh.prototype.setJitter=function(t){this.jitter=t};class pj extends hr{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,eS(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new fh({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const i=n.parser||_Le;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new fLe(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=zo(n,"open",function(){r.onopen(),e&&e()}),o=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},s=zo(n,"error",o);if(this._timeout!==!1){const c=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},c);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(zo(e,"ping",this.onping.bind(this)),zo(e,"data",this.ondata.bind(this)),zo(e,"error",this.onerror.bind(this)),zo(e,"close",this.onclose.bind(this)),zo(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Zw(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new MW(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;re()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Lh={};function fy(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=hLe(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=Lh[i]&&o in Lh[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return c?l=new pj(r,e):(Lh[i]||(Lh[i]=new pj(r,e)),l=Lh[i]),n.query&&!e.query&&(e.query=n.queryKey),l.socket(n.path,e)}Object.assign(fy,{Manager:pj,Socket:MW,io:fy,connect:fy});const M$=window.location.origin,D$=new URLSearchParams(window.location.search).get("direct")==="1"?"/socket.io/":"/semblance_back/socket.io/";let It=null,eu=null,$$=!1;function DW(t){if(It)return It.io.opts.auth={token:t()},It;console.log("🔧 [GPT-5] Creating singleton socket:",M$,D$),It=fy(M$,{path:D$,transports:["websocket"],reconnection:!0,autoConnect:!1,timeout:6e4,pingInterval:45e3,pingTimeout:12e4,auth:n=>n({token:t()})}),It.io.on("reconnect_attempt",()=>{console.log("🔧 [GPT-5] Reconnect attempt - refreshing token"),It.io.opts.auth={token:t()}});const e=()=>{console.log("🔧 [GPT-5] Socket connected, rebinding listeners and rejoining room"),NLe(),eu&&TLe()};return It.on("connect",e),It.onAny((n,...r)=>{console.log(`🔧 [GPT-5 onAny] ${n}:`,r);const i=r[0];switch(n){case"joined_focus_group":console.log("🔧 [GPT-5] *** ROUTING joined_focus_group from onAny ***"),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:i}));break;case"left_focus_group":console.log("🔧 [GPT-5] *** ROUTING left_focus_group from onAny ***"),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:i}));break;case"message_update":console.log("🔧 [GPT-5] *** ROUTING message_update from onAny ***");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:i})),console.log("🔧 [GPT-5] DISPATCHED window event ws:message_update SUCCESS (via onAny)")}catch(o){console.error("🔧 [GPT-5] ERROR dispatching window event (via onAny):",o)}break;case"ai_status_update":console.log("🔧 [GPT-5] *** ROUTING ai_status_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:i}));break;case"moderator_status_update":console.log("🔧 [GPT-5] *** ROUTING moderator_status_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:i}));break;case"theme_update":console.log("🔧 [GPT-5] *** ROUTING theme_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:i}));break;case"focus_group_update":console.log("🔧 [GPT-5] *** ROUTING focus_group_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:i}));break;case"connected":console.log("🔧 [GPT-5] *** ROUTING connected from onAny ***");break;case"error":console.error("🔧 [GPT-5] *** ROUTING error from onAny ***",i);break}}),It.on("connect_error",n=>{console.error("🔧 [GPT-5] Connect error:",n)}),It.on("disconnect",n=>{console.log("🔧 [GPT-5] Disconnected:",n)}),It}function $W(){It&&!It.connected&&(console.log("🔧 [GPT-5] Connecting socket"),It.connect())}function jLe(t,e){if(console.log("🔧 [GPT-5] Joining focus group:",t),eu=t,!(It!=null&&It.connected)){console.log("🔧 [GPT-5] Socket not connected, will auto-rejoin on connect"),$W(),setTimeout(()=>{It!=null&&It.connected?(console.log("🔧 [GPT-5] Retrying join after connection established"),It.emit("join_focus_group",{focus_group_id:t},n=>{console.log("🔧 [GPT-5] join_focus_group RETRY ACK:",n)})):console.log("🔧 [GPT-5] Still not connected, will rejoin on next connect event")},1e3);return}It.emit("join_focus_group",{focus_group_id:t},n=>{console.log("🔧 [GPT-5] join_focus_group ACK:",n)})}function ELe(t){console.log("🔧 [GPT-5] Leaving focus group:",t),eu===t&&(eu=null),It!=null&&It.connected&&It.emit("leave_focus_group",{focus_group_id:t})}function TLe(){!(It!=null&&It.connected)||!eu||(console.log("🔧 [GPT-5] Auto-rejoining room after reconnect:",eu),It.emit("join_focus_group",{focus_group_id:eu}))}function NLe(){if(!It){console.log("🔧 [GPT-5] bindCoreListeners called but socket is null!");return}$$&&console.log("🔧 [GPT-5] Listeners already bound, but rebinding anyway for safety"),console.log("🔧 [GPT-5] bindCoreListeners called - socket exists, binding listeners");const t=c=>{console.log("🔧 [GPT-5] joined_focus_group:",c),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:c}))},e=c=>{console.log("🔧 [GPT-5] left_focus_group:",c),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:c}))},n=c=>{console.log("🔧 [GPT-5] *** MESSAGE_UPDATE LISTENER FIRED! ***"),console.log("🔧 [GPT-5] message_update payload:",c),console.log("🔧 [GPT-5] DISPATCHING window event ws:message_update");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:c})),console.log("🔧 [GPT-5] DISPATCHED window event ws:message_update SUCCESS")}catch(l){console.error("🔧 [GPT-5] ERROR dispatching window event:",l)}},r=c=>{console.log("🔧 [GPT-5] ai_status_update:",c),console.log("🔧 [GPT-5] DISPATCHING window event ws:ai_status_update"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:c})),console.log("🔧 [GPT-5] DISPATCHED window event ws:ai_status_update")},i=c=>{console.log("🔧 [GPT-5] moderator_status_update:",c),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:c}))},o=c=>{console.log("🔧 [GPT-5] theme_update:",c),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:c}))},s=c=>{console.log("🔧 [GPT-5] focus_group_update:",c),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:c}))};console.log("🔧 [GPT-5] BINDING specific listeners to socket"),It.on("joined_focus_group",t),It.on("left_focus_group",e),It.on("message_update",n),It.on("ai_status_update",r),It.on("moderator_status_update",i),It.on("theme_update",o),It.on("focus_group_update",s),console.log("🔧 [GPT-5] BOUND specific listeners to socket"),console.log("🔧 [GPT-5] Socket listeners after binding:",It.listeners("message_update").length),console.log("🔧 [GPT-5] Socket hasListeners message_update:",It.hasListeners("message_update")),setTimeout(()=>{It!=null&&It.connected&&(console.log("🔧 [GPT-5] SELF-TEST: Emitting test event"),It.emit("message_update",{test:"self-emit-test"}))},1e3),It.on("connected",c=>{console.log("🔧 [GPT-5] connected:",c)}),It.on("error",c=>{console.error("🔧 [GPT-5] socket error:",c)}),$$=!0}const PLe=()=>{const{id:t}=OE(),e=ar(),{token:n}=Xs(),[r,i]=v.useState([]),[o,s]=v.useState([]),[c,l]=v.useState([]),[u,d]=v.useState(null),[f,h]=v.useState([]),[p,g]=v.useState("chat"),[m,y]=v.useState(null),[b,x]=v.useState(!1),[w,S]=v.useState(!1),[C,_]=v.useState(!0),[A,j]=v.useState(!1),[P,k]=v.useState(!1),O=v.useRef(!1),[E,I]=v.useState(!1),D=v.useRef(u);D.current=u;const[z,$]=v.useState([]),[G,R]=v.useState(!1),[L,W]=v.useState(""),[Y,te]=v.useState("medium"),[me,F]=v.useState("medium"),[se,ne]=v.useState(!1),[ae,De]=v.useState(!1),[de,ye]=v.useState(null),[Ee,Z]=v.useState([]),[ct,Le]=v.useState(!1),[At,lt]=v.useState(!1),[Jt,T]=v.useState(!1),[M,U]=v.useState(!0),[V,Q]=v.useState({isOpen:!1}),B=v.useRef(!1),[X,ge]=v.useState(""),xe=v.useRef(""),Re=v.useRef(!1),be=v.useRef({wasConnected:!1,wasConnecting:!1,initialConnection:!0,hasShownFallbackNotification:!1}),Ve=SW(),[st,kt]=v.useState(!1),[Ke,tt]=v.useState(!1),[Nt,sn]=v.useState(null),Nr=v.useCallback(()=>n||"",[n]);v.useEffect(()=>{console.log("🔧 [GPT-5 Session] Initializing WebSocket"),DW(Nr)},[Ve,Nr]),v.useEffect(()=>{if(!t)return;(()=>{console.log("🔧 [GPT-5 Session] Joining focus group:",t),jLe(t)})()},[t,Ve]),v.useEffect(()=>{tt(!0),kt(!1),sn(null);const ee=setTimeout(()=>{kt(!0),tt(!1)},1e3);return()=>{clearTimeout(ee)}},[Ve]),v.useEffect(()=>{console.log("🔧 [GPT-5 Session] Setting up window event listeners");const ee=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] message_update:",nt),nt.focus_group_id&&(console.log("🔧 [GPT-5] Message focus_group_id:",nt.focus_group_id),console.log("🔧 [GPT-5] Current focus group from URL:",t));const Se=E$e(nt.message);if(!Se){console.error("🔧 [GPT-5] convertWebSocketMessage returned null");return}i(Gt=>Gt.find(en=>en.id===Se.id)?(console.log("🔧 [GPT-5] Message already exists, skipping"),Gt):(console.log("🔧 [GPT-5] Adding new message, count:",Gt.length+1),[...Gt,Se]))},ce=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] ai_status_update:",nt),S(Se=>nt.status.status==="ai_mode"),ge(Se=>nt.status.status)},ke=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] moderator_status_update:",nt),y(nt.moderator_status)},Fe=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] theme_update:",nt);const Se=T$e(nt.theme);l(Gt=>{const wt=[...Gt],en=wt.findIndex(qt=>qt.id===Se.id);return en>=0?wt[en]=Se:wt.push(Se),wt})},Ue=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] focus_group_update:",nt),d(Se=>Se?{...Se,...nt}:null)},_t=He=>{const nt=He.detail;console.log("🔧 [GPT-5 Session] joined_focus_group:",nt)};return console.log("🔧 [GPT-5 Session] ADDING window event listeners"),window.addEventListener("ws:message_update",ee),window.addEventListener("ws:ai_status_update",ce),window.addEventListener("ws:moderator_status_update",ke),window.addEventListener("ws:theme_update",Fe),window.addEventListener("ws:focus_group_update",Ue),window.addEventListener("ws:joined_focus_group",_t),console.log("🔧 [GPT-5 Session] ADDED all window event listeners"),()=>{console.log("🔧 [GPT-5 Session] Cleaning up window event listeners"),window.removeEventListener("ws:message_update",ee),window.removeEventListener("ws:ai_status_update",ce),window.removeEventListener("ws:moderator_status_update",ke),window.removeEventListener("ws:theme_update",Fe),window.removeEventListener("ws:focus_group_update",Ue),window.removeEventListener("ws:joined_focus_group",_t),t&&ELe(t)}},[Ve,t]),v.useEffect(()=>{if(!t)return;const ee=be.current;st&&!ee.wasConnected&&(ee.initialConnection?qe.success("Live updates enabled",{description:"Connected to real-time updates. Changes will appear instantly.",duration:3e3}):qe.success("Real-time updates restored",{description:"WebSocket connection re-established. You'll now receive instant updates.",duration:4e3}),ee.wasConnected=!0,ee.initialConnection=!1),!st&&!Ke&&ee.wasConnected&&!ee.initialConnection&&(qe.warning("Connection lost",{description:"Real-time updates unavailable. Attempting to reconnect...",duration:5e3}),ee.wasConnected=!1,U(!0)),Nt&&!Ke&&!st&&!ee.initialConnection&&(qe.error("Connection failed",{description:"Unable to establish real-time connection. Using periodic updates instead.",duration:6e3}),U(!0)),ee.wasConnecting=Ke},[st,Ke,Nt,Ve,t]),v.useEffect(()=>{},[Ve,t,u]);const fn=async()=>{var ee;if(t)try{const ce=await Xn.getModeratorStatus(t);if((ee=ce==null?void 0:ce.data)!=null&&ee.status){const ke=ce.data.status;if(m){const Fe=m.current_section_id!==ke.current_section_id||m.current_item_id!==ke.current_item_id||m.progress!==ke.progress}O.current||y(ke)}}catch(ce){console.error("Error fetching moderator status:",ce)}},St=async()=>{if(!t)return{aiActive:!1,sessionStatus:""};try{if(typeof(Ot==null?void 0:Ot.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(Ot==null?void 0:Ot.getById)),{aiActive:w,sessionStatus:X};const ee=await Ot.getById(t);if(!ee||typeof ee!="object")return console.error("Invalid response object received:",ee),{aiActive:w,sessionStatus:X};if(!ee.data||typeof ee.data!="object")return console.warn("Focus group response missing data property:",ee),{aiActive:w,sessionStatus:X};const ce=ee.data.status;if(typeof ce>"u")return console.warn("Focus group response missing status field:",ee.data),{aiActive:w,sessionStatus:X};const ke=ce==="ai_mode";return ce==="autonomous_active"?console.warn('Detected legacy "autonomous_active" status - backend may need updating to "ai_mode"'):["ai_mode","active","completed","paused","draft","in-progress"].includes(ce)||console.warn("Unexpected focus group status value:",ce),{aiActive:ke,sessionStatus:ce}}catch(ee){console.error("Error checking AI mode status:",ee);const ce={focusGroupId:t,currentAiModeStatus:w,errorType:"unknown",timestamp:new Date().toISOString()};return ee.response?(ce.errorType="api_error",ce.status=ee.response.status,ce.data=ee.response.data,console.error("API error response:",ee.response.status,ee.response.data),ee.response.status===404?console.warn("Focus group not found - may have been deleted"):ee.response.status===500&&console.error("Server error during status check - backend issue")):ee.request?(ce.errorType="network_error",console.error("Network error - no response received, check connectivity")):(ce.errorType="request_setup",ce.message=ee.message,console.error("Request setup error:",ee.message)),console.debug("Status check error details:",ce),{aiActive:w,sessionStatus:X,isGenerating:!1}}},Ze=async(ee,ce)=>{if(!t||Re.current)return;const ke=["completed","paused"],Ue=["ai_mode","autonomous_active","active","in-progress"].includes(ce),_t=ke.includes(ee);if(Ue&&_t){Re.current=!0;try{let He="session_ended";ee==="completed"?He="auto_complete":ee==="paused"&&(He="manual_stop");const nt=await Xn.endSession(t,He);nt!=null&&nt.data&&(qe.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{ot()},1e3))}catch(He){console.error("❌ Error ending session with concluding statement:",He),qe.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},ot=async()=>{var ee;if(t)try{const ce=await Ot.getMessages(t);let ke=[],Fe=[];ce&&ce.data&&(Array.isArray(ce.data)?(ke=ce.data,Fe=[]):ce.data.messages||ce.data.mode_events?(ke=ce.data.messages||[],Fe=ce.data.mode_events||[]):(ke=Array.isArray(ce.data)?ce.data:[],Fe=[]));const Ue=ke.map(Se=>({id:Se._id||Se.id||`msg-${Date.now()}`,senderId:Se.senderId,text:Se.text,timestamp:new Date(Se.timestamp||Se.created_at||new Date),type:Se.type||"response",highlighted:Se.highlighted||!1})),_t=Fe.map(Se=>({id:Se._id||Se.id||`event-${Date.now()}`,focus_group_id:Se.focus_group_id,event_type:Se.event_type,timestamp:new Date(Se.timestamp||Se.created_at||new Date),user_id:Se.user_id,created_at:new Date(Se.created_at||new Date)}));s(_t),Ue.length>0?i(Se=>{if(Se.length===0)return Ue;{const Gt=new Map;Se.forEach(On=>Gt.set(On.id,On));const wt=Ue.map(On=>{if(Gt.has(On.id)){const ln=Gt.get(On.id);return{...On,highlighted:ln.highlighted}}return On}),en=new Set(wt.map(On=>On.id)),qt=Se.filter(On=>!en.has(On.id));return[...wt,...qt].sort((On,ln)=>On.timestamp.getTime()-ln.timestamp.getTime())}}):Ue.length===0&&i(Se=>Se.length===0?[]:Se);const He=Ue.filter(Se=>Se.highlighted),nt=He.length>0?He.map(Se=>({id:`theme-${Se.id}`,text:Se.text.substring(0,40)+(Se.text.length>40?"...":""),count:1,messages:[Se.id],source:"highlight"})):[];try{const Se=await Xn.getKeyThemes(t);if((ee=Se==null?void 0:Se.data)!=null&&ee.themes&&Array.isArray(Se.data.themes)){const Gt=Se.data.themes;l([...nt,...Gt])}else l(nt)}catch(Se){console.error("Error fetching AI-generated themes:",Se),l(nt)}}catch(ce){console.error("Error fetching messages:",ce),r.length===0&&qe.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},Xt=async()=>{if(!t)return!1;try{const ce=(await zr.getAll()).data||[],ke=await Ot.getById(t);if(ke&&ke.data){const Fe=ke.data;console.log("Focus group data from API:",Fe);const Ue={id:Fe._id||Fe.id,name:Fe.name,status:Fe.status||"in-progress",participants:Fe.participants||[],date:Fe.date||new Date().toISOString(),duration:Fe.duration||60,topic:Fe.topic||"general",discussionGuide:Fe.discussionGuide||"",llm_model:Fe.llm_model||"gemini-2.5-pro"};if(d(Ue),W(Ue.llm_model||"gemini-2.5-pro"),te(Ue.reasoning_effort||"medium"),F(Ue.verbosity||"medium"),Fe.participants_data&&Array.isArray(Fe.participants_data))h(Fe.participants_data.map(He=>({...He,id:He._id||He.id})));else if(Ue.participants&&Array.isArray(Ue.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:Ue.participants,allPersonas:ce.map(nt=>({id:nt._id||nt.id,name:nt.name}))});const He=ce.filter(nt=>{const Se=nt._id||nt.id;return Ue.participants.includes(Se)});console.log("Matched participants:",He.map(nt=>nt.name)),h(He)}await ot(),await fn();const _t=await St();return S(_t.aiActive),ge(_t.sessionStatus),B.current=_t.aiActive,xe.current=_t.sessionStatus,!0}return!1}catch(ee){return console.error("Error fetching focus group:",ee),!1}},wn=async(ee,ce,ke)=>{if(console.log("🔧 updateFocusGroupModel called with:",{id:t,focusGroup:!!u,newModel:ee,reasoningEffort:ce,verbosity:ke}),!t||!u){console.log("❌ updateFocusGroupModel: Missing id or focusGroup",{id:t,focusGroup:!!u});return}ne(!0);try{const Fe={llm_model:ee};ee==="gpt-5"&&(Fe.reasoning_effort=ce||Y,Fe.verbosity=ke||me),console.log("🔧 Making API call to update focus group model:",{id:t,updateData:Fe});const Ue=await Ot.update(t,Fe);console.log("🔧 API response:",Ue),Ue&&Ue.data?(d(_t=>_t?{..._t,llm_model:ee,reasoning_effort:ee==="gpt-5"?ce||Y:_t==null?void 0:_t.reasoning_effort,verbosity:ee==="gpt-5"?ke||me:_t==null?void 0:_t.verbosity}:null),qe.success("AI Model Updated",{description:`Focus group will now use ${ee==="gemini-2.5-pro"?"Gemini 2.5 Pro":ee==="gpt-4.1"?"GPT-4.1":ee==="gpt-5"?"GPT-5":ee} for AI responses`}),R(!1),console.log("✅ Model update successful")):console.log("❌ API response missing data:",Ue)}catch(Fe){console.error("❌ Error updating focus group model:",Fe),qe.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{ne(!1)}};v.useEffect(()=>{console.log("Looking for focus group with ID:",t);const ee=async()=>{try{return(await zr.getAll()).data||[]}catch(Ue){return console.error("Error fetching personas:",Ue),[]}},ce=async Ue=>{try{const _t=await Ot.getById(t);if(_t&&_t.data){const He=_t.data;console.log("Focus group data from API:",He);const nt={id:He._id||He.id,name:He.name,status:He.status||"in-progress",participants:He.participants||[],date:He.date||new Date().toISOString(),duration:He.duration||60,topic:He.topic||"general",discussionGuide:He.discussionGuide||"",llm_model:He.llm_model||"gemini-2.5-pro"};if(d(nt),W(nt.llm_model||"gemini-2.5-pro"),te(nt.reasoning_effort||"medium"),F(nt.verbosity||"medium"),He.participants_data&&Array.isArray(He.participants_data))h(He.participants_data.map(Se=>({...Se,id:Se._id||Se.id})));else if(nt.participants&&Array.isArray(nt.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:nt.participants,allPersonas:Ue.map(Gt=>({id:Gt._id||Gt.id,name:Gt.name}))});const Se=Ue.filter(Gt=>{const wt=Gt._id||Gt.id;return nt.participants.includes(wt)});console.log("Matched participants:",Se.map(Gt=>Gt.name)),h(Se)}return ot(),fn(),_(!1),!0}return!1}catch(_t){return console.error("Error fetching focus group:",_t),!1}};let ke,Fe;return ee().then(Ue=>{ce(Ue).then(_t=>{_t?Nt&&(Nt.includes("unavailable")||Nt.includes("websocket error"))?(console.log("📡 WebSocket connection failed, falling back to polling"),(()=>{ot(),fn(),ke&&window.clearInterval(ke);const wt=w?3e3:1e4;console.log("📡 Setting up message polling:",{aiModeActive:w,pollInterval:wt,timestamp:new Date().toISOString()}),ke=window.setInterval(()=>{O.current?console.log("📡 Skipping poll - editing discussion guide"):(console.log("📡 Polling for messages...",new Date().toISOString()),ot(),fn())},wt)})(),Fe=window.setInterval(async()=>{const wt=B.current,en=xe.current,qt=await St();if(B.current=qt.aiActive,xe.current=qt.sessionStatus,S(qt.aiActive),ge(qt.sessionStatus),en&&en!==qt.sessionStatus&&await Ze(qt.sessionStatus,en),wt!==qt.aiActive&&ke){window.clearInterval(ke);const Ci=qt.aiActive?3e3:1e4;ke=window.setInterval(()=>{O.current||(ot(),fn())},Ci)}},15e3)):console.log("📡 WebSocket enabled, skipping polling setup"):(console.error("Focus group not found with ID:",t),_(!1),qe.error("Focus group not found",{description:`Could not find focus group with ID: ${t}`}))})}),()=>{ke&&window.clearInterval(ke),Fe&&window.clearInterval(Fe)}},[t,e,Ve,Nt]);const oo=ee=>{if(!ee||!ee.sections||!Array.isArray(ee.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ce=ee.sections[0];if(!ce)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ke=Ue=>Ue.questions&&Array.isArray(Ue.questions)&&Ue.questions.length>0?{content:Ue.questions[0].content,itemId:Ue.questions[0].id,type:"question"}:Ue.activities&&Array.isArray(Ue.activities)&&Ue.activities.length>0?{content:Ue.activities[0].content,itemId:Ue.activities[0].id,type:"activity"}:null;let Fe=ke(ce);if(!Fe&&ce.subsections&&Array.isArray(ce.subsections)){for(const Ue of ce.subsections)if(Fe=ke(Ue),Fe)break}return Fe?{content:Fe.content,sectionId:ce.id,itemId:Fe.itemId}:{content:`Welcome to our focus group session on "${ce.title||"our topic"}". Let's begin our discussion.`,sectionId:ce.id,itemId:"section-intro"}},ta=async()=>{var ee,ce,ke,Fe,Ue,_t;if(t)try{qe.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const He=await Xn.getModeratorStatus(t),nt=(ce=(ee=He==null?void 0:He.data)==null?void 0:ee.status)==null?void 0:ce.moderator_position;nt?console.log("📍 Preserving existing moderator position:",nt):(await Xn.setModeratorPosition(t,((Ue=(Fe=(ke=u==null?void 0:u.discussionGuide)==null?void 0:ke.sections)==null?void 0:Fe[0])==null?void 0:Ue.id)||"welcome"),console.log("🚀 Moderator position initialized to start of discussion guide (first time)"))}catch(He){console.warn("Failed to check/initialize moderator position:",He)}await Ot.update(t,{status:"active"});try{const He=oo(u==null?void 0:u.discussionGuide),nt={id:`msg-${Date.now()}`,senderId:"moderator",text:He.content,timestamp:new Date,type:"question"},Se=await Ot.sendMessage(t,{senderId:"moderator",text:nt.text,type:"question"});(_t=Se==null?void 0:Se.data)!=null&&_t.message_id&&(nt.id=Se.data.message_id),q(nt),console.log("🚀 Initial moderator message created:",{content:He.content,sectionId:He.sectionId,itemId:He.itemId})}catch(He){console.warn("Failed to create initial moderator message:",He)}qe.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(He){console.error("Error starting session:",He),qe.error("Error starting session",{description:"There was a problem connecting to the server."})}},q=ee=>{i(ce=>[...ce,ee])},Pe=async ee=>{const ce=[...r],ke=ce.findIndex(Fe=>Fe.id===ee);if(ke!==-1){const Fe=ce[ke],Ue=!Fe.highlighted;if(ce[ke]={...Fe,highlighted:Ue},i(ce),t)try{!ee.startsWith("local-")&&!ee.startsWith("msg-")?await Ot.updateMessageHighlight(t,ee,Ue):console.log("Skipping database update for local message:",ee)}catch(_t){console.error("Error updating message highlight state:",_t),qe.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},We=ee=>f.find(ce=>ce.id===ee||ce._id===ee),yt=()=>{const ee=r.map(Fe=>{var He;let Ue;return Fe.senderId==="moderator"?Ue="AI Moderator":Fe.senderId==="facilitator"?Ue="Human Facilitator":Ue=((He=We(Fe.senderId))==null?void 0:He.name)||"Unknown",`[${Fe.timestamp.toLocaleTimeString()}] ${Ue}: ${Fe.text}`}).join(` -`),ce=document.createElement("a"),ke=new Blob([ee],{type:"text/plain"});ce.href=URL.createObjectURL(ke),ce.download=`focus-group-${t}-transcript.txt`,document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),Ye.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},et=(ee,ce)=>{const ke=St=>{const rn=St.match(/^\[([^\]]+)\]:\s*(.*)$/);return rn?rn[2].trim():St.trim()},Fe=St=>St.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),Ue=(St,rn)=>{const qt=Fe(St),Ci=Fe(rn);if(qt===Ci)return 1;if(qt.includes(Ci)||Ci.includes(qt))return Math.min(qt.length,Ci.length)/Math.max(qt.length,Ci.length);const qn=qt.split(" "),wn=Ci.split(" "),hh=qn.filter(ak=>wn.includes(ak)&&ak.length>2);return qn.length===0||wn.length===0?0:hh.length/Math.max(qn.length,wn.length)},_t=typeof ee=="object"&&ee!==null,He=_t?ee.text:ke(ee),nt=_t?ee.original:ee;let Se=null,Wt="";if(ce&&(Se=r.find(St=>St.id===ce),Se?Wt="direct_message_id_match":console.warn(`Message ID ${ce} not found in current messages array`)),Se||(Se=r.find(St=>St.text.includes(nt)),Se&&(Wt="exact_full_match")),Se||(Se=r.find(St=>St.text.includes(He)),Se&&(Wt="exact_text_match")),Se||(Se=r.find(St=>He.includes(St.text.trim())),Se&&(Wt="reverse_exact_match")),!Se){const St=He.toLowerCase();Se=r.find(rn=>rn.text.toLowerCase().includes(St)||St.includes(rn.text.toLowerCase())),Se&&(Wt="case_insensitive_match")}if(!Se){const St=r.map(rn=>({message:rn,similarity:Ue(He,rn.text)})).filter(rn=>rn.similarity>.7).sort((rn,qt)=>qt.similarity-rn.similarity);St.length>0&&(Se=St[0].message,Wt=`fuzzy_match_${Math.round(St[0].similarity*100)}%`)}if(!Se){const rn=Fe(He).split(" ").filter(qt=>qt.length>3);rn.length>0&&(Se=r.find(qt=>{const Ci=Fe(qt.text);return rn.every(qn=>Ci.includes(qn))}),Se&&(Wt="partial_word_match"))}Se?(console.log(`Quote match found using strategy: ${Wt}`,{quoteType:_t?"QuoteData":"string",providedMessageId:ce,extractedText:He,matchedMessage:Se.text.substring(0,100),matchedMessageId:Se.id,originalQuote:nt.substring(0,100)}),g("chat"),setTimeout(()=>{const St=document.getElementById(`message-${Se.id}`);St&&(P||St.scrollIntoView({behavior:"smooth",block:"center"}),St.style.backgroundColor="#fbbf24",St.style.transition="background-color 0.3s ease",setTimeout(()=>{St.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:_t?"QuoteData":"string",providedMessageId:ce,originalQuote:nt.substring(0,100),extractedText:He.substring(0,100),totalMessages:r.length,messageSample:r.slice(0,3).map(St=>({id:St.id,text:St.text.substring(0,50)}))}),Ye.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},bt=ee=>{l(ce=>{const ke=new Set(ce.map(Ue=>Ue.id)),Fe=ee.filter(Ue=>!ke.has(Ue.id));return[...ce,...Fe]})},fn=async ee=>{if(!t)return;const ce=c.find(ke=>ke.id===ee);if(ce)try{"source"in ce&&ce.source==="generated"&&await Xn.deleteKeyTheme(t,ee),l(c.filter(ke=>ke.id!==ee))}catch(ke){console.error("Error deleting theme:",ke),Ye.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},ut=v.useCallback(async(ee,ce)=>{if(t)try{await Xn.setModeratorPosition(t,ee,ce),Ye.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(ke){console.error("Error setting moderator position:",ke),Ye.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[t]),An=v.useCallback(async ee=>{if(console.log("💾 handleDiscussionGuideSave called:",{hasId:!!t,isEditingGuideContent:E,timestamp:new Date().toISOString()}),!!t)try{await Ot.update(t,{discussionGuide:ee}),E?(D.current&&(D.current={...D.current,discussionGuide:ee}),console.log("⚠️ Skipping focus group state update during editing to preserve focus")):(console.log("🔄 Updating focus group state (not editing)"),d(ce=>ce?{...ce,discussionGuide:ee}:null))}catch(ce){throw console.error("Error saving discussion guide:",ce),ce}},[t,E]),an=v.useCallback(ee=>{console.log("🔄 handleGuideEditingStateChange called:",{editing:ee,timestamp:new Date().toISOString(),currentIsEditingGuideContent:E}),k(ee),I(ee),!ee&&D.current&&(console.log("📝 Updating focus group state after editing ended"),d(D.current))},[E]),nn=v.useCallback(()=>{j(ee=>!ee)},[]),gr=v.useCallback((ee,ce,ke,Fe,Ue,_t)=>{Q({isOpen:!0,sectionId:ee,itemId:ce,content:ke,sectionTitle:Fe,itemTitle:Ue,itemType:_t})},[]),H=ee=>{console.log("🔍 EXTRACT ASSET FILENAME DEBUG - Input content:",ee);const ce=[/'([^']*\.[a-zA-Z]{3,4})'/g,/"([^"]*\.[a-zA-Z]{3,4})"/g,/titled\s+['"]([^'"]*\.[a-zA-Z]{3,4})['"](?:\.|,|\s|$)/gi,/asset[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/image[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/file[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/\b([a-zA-Z0-9_-]+\.[a-zA-Z]{3,4})\b/g];for(let ke=0;ke0){const _t=Ue[0][1];if(console.log(`🔍 Pattern ${ke+1} extracted filename:`,_t),_t&&_t.includes("."))return console.log("✅ EXTRACT ASSET FILENAME - Found:",_t),_t}}return console.warn("❌ EXTRACT ASSET FILENAME - No filename found in content"),null},he=()=>{if(m)return{sectionId:m.current_section_id,sectionTitle:m.current_section,itemId:m.current_item_id,itemTitle:m.current_item}},ue=()=>{if(r.length!==0)return r[r.length-1].id},je=()=>{const ee=ue();if(!ee||r.length===0)return new Date;const ce=r.find(ke=>ke.id===ee);return ce?ce.timestamp:new Date},Be=async()=>{if(t){Le(!0),lt(!1),T(!1),Ye.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const ee=await Xn.generateKeyThemes(t);ee.data&&ee.data.themes?(lt(!0),Ye.success(`Generated ${ee.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(ce=>[...ce,...ee.data.themes])):(lt(!0),Ye.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(ee){console.error("Error generating key themes:",ee),T(!0),Ye.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},zt=()=>{Le(!1),lt(!1),T(!1)},er=()=>{de||ye(new Date),De(!0)},so=ee=>{$(ce=>[...ce,ee].sort((ke,Fe)=>Fe.createdAt.getTime()-ke.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(ee)},Mu=ee=>{const ce=r.find(ke=>ke.id===ee);ce?(g("chat"),setTimeout(()=>{const ke=document.getElementById(`message-${ce.id}`);ke&&(P||ke.scrollIntoView({behavior:"smooth",block:"center"}),ke.style.backgroundColor="#fbbf24",ke.style.transition="background-color 0.3s ease",setTimeout(()=>{ke.style.backgroundColor=""},2e3))},100)):Ye.info("Message not found",{description:"Could not locate the original message for this note."})};v.useEffect(()=>{r.length>0&&!de&&ye(new Date)},[r.length,de]),v.useEffect(()=>{O.current=P,P||dn()},[P]);const na=ee=>{Z(ce=>ce.includes(ee)?ce.filter(ke=>ke!==ee):[...ce,ee])};return C?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(Aa,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("div",{className:"flex justify-center items-center",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}),a.jsx("p",{className:"mt-4 text-slate-600",children:"Loading focus group..."})]})]}):u?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),M&&a.jsx("div",{className:`w-full transition-all duration-300 ${st?"bg-green-500":Ke?"bg-yellow-500":"bg-red-500"}`,children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex items-center justify-between py-2 text-white text-sm font-medium",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${st?"bg-white animate-pulse":Ke?"bg-white animate-spin":"bg-white"}`}),a.jsx("span",{children:st?"Real-time updates active - Changes appear instantly":Ke?"Connecting to real-time updates...":"Real-time updates unavailable - Using periodic refresh"}),Nt&&a.jsx("span",{className:"text-xs opacity-75 ml-2",title:Nt,children:"(Connection error)"})]}),a.jsx("button",{onClick:()=>U(!1),className:"ml-4 text-white hover:text-gray-200 transition-colors",title:"Hide status bar","aria-label":"Hide connection status",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}),!M&&a.jsx("div",{className:"fixed top-20 right-4 z-40",children:a.jsx("button",{onClick:()=>U(!0),className:`px-3 py-1 rounded-full text-white text-xs font-medium shadow-lg transition-all duration-200 hover:shadow-xl ${st?"bg-green-500 hover:bg-green-600":Ke?"bg-yellow-500 hover:bg-yellow-600":"bg-red-500 hover:bg-red-600"}`,title:st?"WebSocket connected - Show status bar":Ke?"WebSocket connecting - Show status bar":"WebSocket disconnected - Show status bar",children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:`w-2 h-2 rounded-full bg-white ${st?"animate-pulse":""}`}),a.jsx("span",{children:st?"Live":Ke?"Connecting":"Offline"})]})})}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(J,{variant:"ghost",onClick:()=>e("/focus-groups"),className:"mr-2",children:a.jsx(Kp,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-2xl font-bold text-slate-900",children:u.name}),a.jsx("p",{className:"text-slate-600",children:new Date(u.date).toLocaleString()}),a.jsxs("div",{className:"flex items-center mt-1",children:[a.jsx(ya,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx(Sr,{variant:"secondary",className:"text-xs",children:u.llm_model==="gpt-4.1"?"GPT-4.1":u.llm_model==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(J,{variant:"outline",onClick:()=>x(!b),className:b?"bg-blue-50 text-blue-600":"",children:[a.jsx(B_,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(J,{variant:"outline",onClick:()=>R(!0),children:[a.jsx(LE,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(J,{variant:"outline",onClick:yt,children:[a.jsx(lu,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),ct&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:ct,isComplete:At,hasError:Jt,label:"Analyzing discussion for key themes",onComplete:zt,className:"max-w-4xl mx-auto"})}),a.jsx(P$e,{discussionGuide:u.discussionGuide,moderatorStatus:m,onSectionSelect:ut,onSetPosition:gr,onSave:An,focusGroupId:t||"",isOpen:A,onToggle:nn,onEditingChange:an}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(ude,{participants:f,selectedParticipantIds:Ee,onToggleParticipantFilter:na}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(dl,{defaultValue:"chat",value:p,onValueChange:g,className:"w-full h-full flex flex-col",children:[a.jsxs(Va,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(mn,{value:"chat",className:"flex items-center",children:[a.jsx(As,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(mn,{value:"themes",className:"flex items-center",children:[a.jsx(uu,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(mn,{value:"notes",className:"flex items-center",children:[a.jsx(Ky,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(mn,{value:"analytics",className:"flex items-center",children:[a.jsx(B_,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(gn,{value:"chat",className:"m-0 flex-1 flex flex-col h-0",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx("p",{className:"text-lg text-slate-600",children:"No messages yet. Start the session to begin the discussion."}),a.jsxs(J,{onClick:ta,size:"lg",className:"flex items-center gap-2",children:[a.jsx(u5,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(Fde,{messages:r,modeEvents:o,personas:f,isSpeaking:!1,focusGroupId:t||"",isAiModeActive:w,selectedParticipantIds:Ee,onToggleHighlight:Pe,onAdvanceDiscussion:()=>null,onNewMessage:q,onStatusChange:Xt,isEditingDiscussionGuide:P})}),a.jsx(gn,{value:"themes",className:"m-0",children:a.jsx(Ude,{themes:c,messages:r,personas:f,focusGroupId:t||"",onThemesGenerated:bt,onThemeDelete:fn,onQuoteClick:et,onGenerateKeyThemes:Be})}),a.jsx(gn,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(k$e,{focusGroupId:t||"",focusGroupName:u==null?void 0:u.name,onNoteClick:Mu})})}),a.jsx(gn,{value:"analytics",className:"m-0",children:a.jsx(j$e,{messages:r,themes:c,personas:f})})]})})]})]}),r.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(J,{onClick:er,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(Ky,{className:"h-5 w-5"})})}),a.jsx(O$e,{isOpen:ae,onClose:()=>De(!1),focusGroupId:t||"",associatedMessageId:ue(),sectionInfo:he(),messageTimestamp:je(),onNoteSaved:so}),a.jsx(Ql,{open:V.isOpen,onOpenChange:ee=>Q(ce=>({...ce,isOpen:ee})),children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Set Moderator Position"}),a.jsxs(Xl,{children:['Are you sure you want to set the moderator position to "',V.itemTitle,'" in section "',V.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",disabled:V.isLoading,onClick:()=>Q({isOpen:!1}),children:"Cancel"}),a.jsxs(J,{disabled:V.isLoading,onClick:async()=>{var ee,ce,ke,Fe,Ue,_t,He,nt,Se;if(!(!t||!V.sectionId||!V.itemId||!V.content)){Q(Wt=>({...Wt,isLoading:!0}));try{await Xn.setModeratorPosition(t,V.sectionId,V.itemId);let Wt=[],St=!1,rn=V.content;const qt=V.content?H(V.content):null,Ci=!!qt;if(console.log("🔍 MANUAL POSITION DEBUG:",{itemType:V.itemType,hasImageAttached:Ci,assetFilename:qt,content:V.content,sectionTitle:V.sectionTitle,itemTitle:V.itemTitle,contentLength:(ee=V.content)==null?void 0:ee.length}),Ci&&V.content&&qt)if(console.log("🔍 ASSET EXTRACTION DEBUG:",{originalContent:V.content,extractedFilename:qt,contentLength:V.content.length}),qt){Wt=[qt],St=!0,console.log("🎨 MANUAL POSITION: Creative review detected, will activate visual context for:",qt);try{console.log("🎨 MANUAL MODE: Requesting AI description for",qt);try{console.log("🔍 TESTING: Calling test endpoint first...");const hh=await $e.post(`/focus-groups/${t}/test-endpoint`,{test:"data"});console.log("✅ TEST: Test endpoint response:",hh.data)}catch(hh){console.error("❌ TEST: Test endpoint failed:",hh)}const wn=await Ot.describeAsset(t,qt);wn.data.description&&(rn=V.content.replace(`'${qt}'`,`'${qt}' - ${wn.data.description}`),console.log("✅ MANUAL MODE: Enhanced question with AI description"),console.log("🔍 Original:",V.content),console.log("🔍 Enhanced:",rn))}catch(wn){console.error("⚠️ MANUAL MODE: Failed to generate AI description:",wn),console.error("⚠️ Error response data:",(ce=wn.response)==null?void 0:ce.data),console.error("⚠️ Error status:",(ke=wn.response)==null?void 0:ke.status),console.error("⚠️ Error headers:",(Fe=wn.response)==null?void 0:Fe.headers),console.error("⚠️ Full axios error:",{message:wn.message,code:wn.code,status:(Ue=wn.response)==null?void 0:Ue.status,statusText:(_t=wn.response)==null?void 0:_t.statusText,url:(He=wn.config)==null?void 0:He.url,method:(nt=wn.config)==null?void 0:nt.method}),Ye.warning("AI description failed",{description:"Using original question text. Image will still be available to participants."})}}else console.warn("⚠️ MANUAL POSITION: Creative review detected but no asset filename extracted from content");const qn={id:`msg-${Date.now()}`,senderId:"moderator",text:rn,timestamp:new Date,type:"question"};try{const wn=await Ot.sendMessage(t,{senderId:"moderator",text:rn,type:"question",attached_assets:Wt,activates_visual_context:St});(Se=wn==null?void 0:wn.data)!=null&&Se.message_id&&(qn.id=wn.data.message_id)}catch(wn){console.warn("Failed to save message to API, showing locally:",wn)}q(qn),Q({isOpen:!1}),Ye.success("Moderator position set",{description:`Position set to "${V.itemTitle}" in "${V.sectionTitle}"`})}catch(Wt){console.error("Error setting moderator position:",Wt),Q(St=>({...St,isLoading:!1})),Ye.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[V.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),V.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(Ql,{open:G,onOpenChange:R,children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"AI Model Settings"}),a.jsx(Xl,{children:"Choose which AI model to use for generating responses and discussion guides in this focus group."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ya,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx(Sr,{variant:"secondary",children:(u==null?void 0:u.llm_model)==="gpt-4.1"?"GPT-4.1":(u==null?void 0:u.llm_model)==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),a.jsxs(Bn,{value:L,onValueChange:ee=>{console.log("🔧 Model selection changed:",{from:L,to:ee}),W(ee)},children:[a.jsx($n,{className:"mt-1",children:a.jsx(Un,{placeholder:"Select AI model"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]})]}),L==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Reasoning Effort:"}),a.jsxs(Bn,{value:Y,onValueChange:te,children:[a.jsx($n,{className:"mt-1",children:a.jsx(Un,{placeholder:"Select reasoning effort"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(oe,{value:"low",children:"Low - Quick thinking"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(oe,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Response Verbosity:"}),a.jsxs(Bn,{value:me,onValueChange:F,children:[a.jsx($n,{className:"mt-1",children:a.jsx(Un,{placeholder:"Select verbosity level"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"low",children:"Low - Concise responses"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(oe,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]})]}),a.jsxs("div",{className:"text-xs text-slate-600",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Gemini 2.5 Pro:"})," Google's advanced model, great for creative and analytical tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-4.1:"})," OpenAI's latest model, excellent for conversational and reasoning tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-5:"})," OpenAI's newest model with advanced reasoning and customizable response styles."]})]})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:()=>R(!1),disabled:se,children:"Cancel"}),a.jsxs(J,{onClick:()=>{console.log("🔧 Update button clicked:",{selectedModel:L,selectedReasoningEffort:Y,selectedVerbosity:me,currentModel:u==null?void 0:u.llm_model,isDisabled:se||L===(u==null?void 0:u.llm_model)&&(L!=="gpt-5"||Y===(u==null?void 0:u.reasoning_effort)&&me===(u==null?void 0:u.verbosity))}),bn(L,Y,me)},disabled:se||L===(u==null?void 0:u.llm_model)&&(L!=="gpt-5"||Y===((u==null?void 0:u.reasoning_effort)||"medium")&&me===((u==null?void 0:u.verbosity)||"medium")),children:[se&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),se?"Updating...":"Update Model"]})]})]})}),a.jsx(N$e,{focusGroupId:t,personas:f,isVisible:b,onToggle:()=>x(!b)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(Aa,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Focus group not found"}),a.jsx("p",{className:"mt-2 text-slate-600",children:"We couldn't find the focus group you're looking for."}),a.jsxs(J,{onClick:()=>e("/focus-groups"),className:"mt-4",children:[a.jsx(Kp,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},kLe=({title:t,description:e})=>a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:t}),a.jsx("p",{className:"text-slate-600 mt-1",children:e})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(J,{variant:"outline",children:"Export Data"}),a.jsx(J,{children:"Generate Report"})]})]}),IC=({title:t,value:e,changePercentage:n,icon:r})=>a.jsx(gt,{className:"p-6 hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground text-sm",children:t}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:e}),a.jsxs("p",{className:`${n>=0?"text-green-500":"text-red-500"} text-xs mt-1`,children:[n>=0?"↑":"↓"," ",Math.abs(n),"% from last month"]})]}),a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(r,{className:"h-6 w-6 text-primary"})})]})}),OLe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],ILe=[{id:"1",title:"User Interface Feedback",description:"Users consistently mentioned difficulty with the navigation menu on mobile devices.",source:"Mobile App Focus Group",date:"2023-06-12",sentiment:"negative"},{id:"2",title:"Feature Adoption",description:'The new search functionality is well-received, with 85% of users rating it as "very useful".',source:"Product Testing Group",date:"2023-06-10",sentiment:"positive"},{id:"3",title:"Pricing Strategy",description:"Price-conscious users expressed willingness to pay up to 20% more for premium features.",source:"Pricing Model Analysis",date:"2023-06-08",sentiment:"positive"},{id:"4",title:"Competitive Analysis",description:"Users who switched from competitor products cited our streamlined onboarding as a key factor.",source:"Customer Journey Mapping",date:"2023-06-05",sentiment:"positive"}],RLe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Research Activity"}),a.jsx("div",{className:"h-64",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(wW,{data:OLe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(rs,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(rs,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(rs,{type:"monotone",dataKey:"interactions",stackId:"3",stroke:"#ffc658",fill:"#ffc658",name:"Interactions"})]})})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Recent AI Insights"}),a.jsxs("div",{className:"space-y-4",children:[ILe.slice(0,3).map(t=>a.jsx("div",{className:"border-b pb-4 last:border-b-0 last:pb-0",children:a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:`p-2 rounded-full mr-3 ${t.sentiment==="positive"?"bg-green-100":t.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(au,{className:`h-4 w-4 ${t.sentiment==="positive"?"text-green-600":t.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:t.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:t.source}),a.jsx("span",{className:"mx-2",children:"•"}),a.jsx("span",{children:t.date})]})]})]})},t.id)),a.jsx(J,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Upcoming Research Tasks"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-blue-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Website Redesign Feedback"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Focus group scheduled for Jun 20"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-purple-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Mobile App User Testing"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"8 participants needed by Jun 25"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-amber-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Pricing Strategy Evaluation"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Create discussion guide by Jun 22"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-green-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-green-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Product Onboarding Flow"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Results analysis due Jun 30"})]})]}),a.jsx(J,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),MLe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],DLe=()=>a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Synthetic Persona Analytics"}),a.jsx(J,{variant:"outline",size:"sm",children:"View Demographics"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Demographics"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:MLe,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,fill:"#FFDEE2",label:!0})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Distribution"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Age: 25-34"}),a.jsx("span",{children:"35%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-400 rounded-full",style:{width:"35%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savvy"}),a.jsx("span",{children:"72%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-300 rounded-full",style:{width:"72%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyal"}),a.jsx("span",{children:"58%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-500 rounded-full",style:{width:"58%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitive"}),a.jsx("span",{children:"67%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-200 rounded-full",style:{width:"67%"}})})]})]})]})]}),a.jsx("div",{className:"flex justify-center mt-6",children:a.jsx(J,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),$Le=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],L$=[{name:"Very Positive",value:25,color:"#4ade80"},{name:"Positive",value:40,color:"#a3e635"},{name:"Neutral",value:20,color:"#93c5fd"},{name:"Negative",value:10,color:"#fb923c"},{name:"Very Negative",value:5,color:"#f87171"}],LLe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],FLe=()=>{const t=ar();return a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Focus Group Insights"}),a.jsx(J,{variant:"outline",size:"sm",onClick:()=>t("/focus-groups"),children:"View All Sessions"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Session Analytics"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(wW,{data:$Le,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(rs,{type:"monotone",dataKey:"interactions",stroke:"#8884d8",fill:"#8884d8",name:"User Interactions"})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Feedback Sentiment"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:L$,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:e,percent:n})=>`${e} ${(n*100).toFixed(0)}%`,children:L$.map((e,n)=>a.jsx(Og,{fill:e.color},`cell-${n}`))}),a.jsx(Ea,{})]})})})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Topic Frequency Analysis"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(bW,{data:LLe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(Ea,{}),a.jsx(gl,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(J,{onClick:()=>t("/focus-groups"),children:"Manage Focus Groups"})})]})},BLe=()=>{const[t,e]=v.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(kLe,{title:"Dashboard",description:"Monitor and analyze your research insights"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:[a.jsx(IC,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:Dr}),a.jsx(IC,{title:"Active Focus Groups",value:7,changePercentage:5,icon:Vs}),a.jsx(IC,{title:"Research Insights",value:124,changePercentage:18,icon:uu})]}),a.jsxs(dl,{value:t,onValueChange:e,className:"glass-panel rounded-xl p-6",children:[a.jsxs(Va,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(mn,{value:"overview",children:"Overview"}),a.jsx(mn,{value:"users",children:"Synthetic Users"}),a.jsx(mn,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(gn,{value:"overview",children:a.jsx(RLe,{})}),a.jsx(gn,{value:"users",children:a.jsx(DLe,{})}),a.jsx(gn,{value:"focus-groups",children:a.jsx(FLe,{})})]})]})]})},LW=v.forwardRef(({...t},e)=>a.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));LW.displayName="Breadcrumb";const FW=v.forwardRef(({className:t,...e},n)=>a.jsx("ol",{ref:n,className:Ne("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));FW.displayName="BreadcrumbList";const hy=v.forwardRef(({className:t,...e},n)=>a.jsx("li",{ref:n,className:Ne("inline-flex items-center gap-1.5",t),...e}));hy.displayName="BreadcrumbItem";const mj=v.forwardRef(({asChild:t,className:e,...n},r)=>{const i=t?Hs:"a";return a.jsx(i,{ref:r,className:Ne("transition-colors hover:text-foreground",e),...n})});mj.displayName="BreadcrumbLink";const BW=v.forwardRef(({className:t,...e},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Ne("font-normal text-foreground",t),...e}));BW.displayName="BreadcrumbPage";const gj=({children:t,className:e,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:Ne("[&>svg]:size-3.5",e),...n,children:t??a.jsx(fo,{})});gj.displayName="BreadcrumbSeparator";function ULe({persona:t}){const e=t.id==="0",n=t.id==="1";return a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Cg(t),alt:t.name,className:"h-16 w-16 rounded-full object-cover"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-sf text-xl font-semibold",children:t.name}),a.jsx("p",{className:"text-muted-foreground",children:t.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Dr,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Demographics"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[t.age," ",t.gender?a.jsxs(a.Fragment,{children:["• ",t.gender]}):null,t.ethnicity?a.jsxs(a.Fragment,{children:[" • ",t.ethnicity]}):null]}),t.education&&a.jsx("p",{className:"sidebar-sub-item",children:t.education}),t.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",t.socialGrade]}),t.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",t.householdIncome]}),t.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",t.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(nZ,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Location"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.location}),t.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:t.livingSituation})]})]}),t.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z_,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Interests"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.interests})]})]}),t.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Media"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.mediaConsumption})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Digital Behavior"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savviness"}),a.jsxs("span",{children:[t.techSavviness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${t.techSavviness}%`}})})]}),t.brandLoyalty!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyalty"}),a.jsxs("span",{children:[t.brandLoyalty,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${t.brandLoyalty}%`}})})]}),t.priceConsciousness!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitivity"}),a.jsxs("span",{children:[t.priceConsciousness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${t.priceConsciousness}%`}})})]}),t.environmentalConcern!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Environmental Concern"}),a.jsxs("span",{children:[t.environmentalConcern,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${t.environmentalConcern}%`}})})]}),t.deviceUsage&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Device Usage"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Shopping Habits"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:t.shoppingHabits})]})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Additional Information"}),a.jsxs("div",{className:"space-y-2",children:[t.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z_,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.brandPreferences})]}),t.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(qp,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",t.communicationPreferences]})]}),t.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(iZ,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(cZ,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.shoppingHabits})]}),t.additionalInformation&&typeof t.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(JJ,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:t.additionalInformation.split(` -`).map((r,i)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("•")||r.trim().startsWith("-")?r.trim().substring(1).trim():r.trim()},i))})]}),e&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(YO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Maintains an extensive network of financial and luxury industry contacts"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Vy,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Owns vacation properties in the Cotswolds and South of France"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Collector of rare first-edition books and limited-edition art prints"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(QO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Significant investment portfolio with focus on sustainable luxury ventures"})]})]}),n&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Active in industry panels, luxury brand collaborations, follows influencers in luxury & design"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Vy,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Modern flat in exclusive Chelsea, accessible to boutique services"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(QO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Uses premium digital payment & secure banking for HNWIs"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(YO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Respected network in London's luxury sector; attends exclusive events"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(qp,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function HLe({persona:t}){var e,n,r,i,o,s,c,l,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Qv,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Goals"})]}),a.jsx("ul",{className:"space-y-2",children:(e=t.goals)==null?void 0:e.map((d,f)=>a.jsxs("li",{className:"flex items-start",children:[a.jsx("div",{className:"h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center mt-0.5 mr-3",children:a.jsx("span",{className:"text-xs text-primary font-medium",children:f+1})}),a.jsx("p",{className:"text-sm",children:d})]},f))})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(p5,{className:"h-5 w-5 text-amber-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Frustrations"})]}),a.jsx("ul",{className:"space-y-2",children:(n=t.frustrations)==null?void 0:n.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-amber-500 mr-2",children:"•"}),a.jsx("span",{children:d})]},f))})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(pa,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Motivations"})]}),a.jsx("ul",{className:"space-y-2",children:(r=t.motivations)==null?void 0:r.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-green-500 mr-2",children:"•"}),a.jsx("span",{children:d})]},f))})]})})]}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(au,{className:"h-5 w-5 text-blue-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Thinks"})]}),a.jsx("ul",{className:"space-y-2",children:(o=(i=t.thinkFeelDo)==null?void 0:i.thinks)==null?void 0:o.map((d,f)=>a.jsxs("li",{className:"text-sm bg-blue-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(z_,{className:"h-5 w-5 text-red-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Feels"})]}),a.jsx("ul",{className:"space-y-2",children:(c=(s=t.thinkFeelDo)==null?void 0:s.feels)==null?void 0:c.map((d,f)=>a.jsxs("li",{className:"text-sm bg-red-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(pa,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Does"})]}),a.jsx("ul",{className:"space-y-2",children:(u=(l=t.thinkFeelDo)==null?void 0:l.does)==null?void 0:u.map((d,f)=>a.jsxs("li",{className:"text-sm bg-green-50 p-2 rounded-md",children:['"',d,'"']},f))})]})]})]})})]})}function zLe({persona:t}){var n,r,i,o,s;const e=[{trait:"Openness",value:((n=t.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=t.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((i=t.oceanTraits)==null?void 0:i.extraversion)||50},{trait:"Agreeableness",value:((o=t.oceanTraits)==null?void 0:o.agreeableness)||50},{trait:"Neuroticism",value:((s=t.oceanTraits)==null?void 0:s.neuroticism)||50}];return a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-80",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(A$e,{outerRadius:90,data:e,children:[a.jsx(gK,{}),a.jsx(uh,{dataKey:"trait"}),a.jsx(lh,{domain:[0,100]}),a.jsx(Lg,{name:"Personality",dataKey:"value",stroke:"#8884d8",fill:"#8884d8",fillOpacity:.5})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Openness to Experience"}),a.jsxs("span",{className:"font-medium",children:[e[0].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${e[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[0].value>75?"Highly creative and curious":e[0].value>50?"Somewhat imaginative and open to new ideas":"Practical and prefers routine"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Conscientiousness"}),a.jsxs("span",{className:"font-medium",children:[e[1].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${e[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[1].value>75?"Highly organized and responsible":e[1].value>50?"Generally reliable and hardworking":"Spontaneous and flexible"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Extraversion"}),a.jsxs("span",{className:"font-medium",children:[e[2].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${e[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[2].value>75?"Highly sociable and outgoing":e[2].value>50?"Moderately social and talkative":"Reserved and reflective"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Agreeableness"}),a.jsxs("span",{className:"font-medium",children:[e[3].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${e[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[3].value>75?"Highly cooperative and compassionate":e[3].value>50?"Generally kind and helpful":"Competitive and challenging"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Neuroticism"}),a.jsxs("span",{className:"font-medium",children:[e[4].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-red-500 rounded-full",style:{width:`${e[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[4].value>75?"Highly sensitive and prone to stress":e[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function GLe({persona:t}){var r;const e=(i,o)=>{const s=[a.jsx(eZ,{className:"sidebar-icon"},"grid"),a.jsx(lZ,{className:"sidebar-icon"},"smartphone"),a.jsx(ZJ,{className:"sidebar-icon"},"laptop"),a.jsx(XJ,{className:"sidebar-icon"},"grid2x2")];return s[o%s.length]},n=()=>t.scenarioType?t.scenarioType:"Life Scenarios";return a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:n()}),a.jsx("div",{className:"space-y-4",children:(r=t.scenarios)==null?void 0:r.map((i,o)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[e(i,o),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",o+1]}),a.jsx("p",{className:"text-sm",children:i})]})]})},o))})]})})}function VLe(){const t=ar();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(gt,{className:"w-96 text-center p-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-muted-foreground mb-6",children:"The persona you're looking for couldn't be found."}),a.jsx(J,{onClick:()=>t("/synthetic-users"),children:"Return to Personas"})]})})}function Bt({className:t,...e}){return a.jsx("div",{className:Ne("animate-pulse rounded-md bg-muted",t),...e})}function KLe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(Bt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(Bt,{className:"h-8 w-48 mx-auto"}),a.jsx(Bt,{className:"absolute right-0 top-0 h-10 w-32"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(Bt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-6 w-32 mb-2"}),a.jsx(Bt,{className:"h-4 w-24"})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-20 mb-2"}),a.jsx(Bt,{className:"h-3 w-40 mb-1"}),a.jsx(Bt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-16 mb-2"}),a.jsx(Bt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-16 mb-2"}),a.jsx(Bt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-12 mb-2"}),a.jsx(Bt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Bt,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((t,e)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(Bt,{className:"h-3 w-24"}),a.jsx(Bt,{className:"h-3 w-8"})]}),a.jsx(Bt,{className:"h-1.5 w-full rounded-full"})]},e))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Bt,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((t,e)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(Bt,{className:"h-4 w-4 mr-2"}),a.jsx(Bt,{className:"h-3 w-40"})]},e))})]})]})]})}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"grid w-full grid-cols-3 gap-2 mb-6",children:[a.jsx(Bt,{className:"h-10 w-full"}),a.jsx(Bt,{className:"h-10 w-full"}),a.jsx(Bt,{className:"h-10 w-full"})]}),a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(Bt,{className:"h-6 w-48"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Bt,{className:"h-6 w-32"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Bt,{className:"h-6 w-40"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function WLe({message:t,onLoginSuccess:e,onCancel:n}){const{login:r}=Xs(),i=ar(),[o,s]=v.useState("user"),[c,l]=v.useState("pass"),[u,d]=v.useState(!1),f=async()=>{if(!o||!c){re.error("Please enter username and password");return}d(!0);try{await r(o,c),re.success("Login successful"),e&&e()}catch(p){console.error("Login error:",p),re.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():i("/synthetic-users")};return a.jsxs(gt,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(ji,{children:[a.jsx(Wi,{children:"Login Required"}),a.jsx(uN,{children:t||"You need to log in to save personas to the database"})]}),a.jsxs(Rt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mo,{htmlFor:"username",children:"Username"}),a.jsx(Ht,{id:"username",placeholder:"Username",value:o,onChange:p=>s(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mo,{htmlFor:"password",children:"Password"}),a.jsx(Ht,{id:"password",type:"password",placeholder:"Password",value:c,onChange:p=>l(p.target.value),disabled:u})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Default credentials: user / pass"})]}),a.jsxs(dN,{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(J,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function qLe({persona:t,onSave:e,onCancel:n}){var j,P,k,O,E,I,D,z,$,G,R,L,W,Y,te,me;const r={...t,education:t.education||"",interests:t.interests||"",brandLoyalty:t.brandLoyalty||0,priceConsciousness:t.priceConsciousness||0,environmentalConcern:t.environmentalConcern||0,hasPurchasingPower:t.hasPurchasingPower||!1,hasChildren:t.hasChildren||!1,goals:t.goals||[],frustrations:t.frustrations||[],motivations:t.motivations||[],scenarios:t.scenarios||[],oceanTraits:t.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:t.thinkFeelDo||{thinks:[],feels:[],does:[]}},[i,o]=v.useState(r),[s,c]=v.useState(!1),[l,u]=v.useState(!1),[d,f]=v.useState(null);v.useState(!1);const{isAuthenticated:h,token:p}=Xs();v.useEffect(()=>{(async()=>{l&&h&&p&&(u(!1),d&&await A())})()},[h,p,l]);const g=(F,se)=>{o(ne=>({...ne,[F]:se}))},m=(F,se)=>{o(ne=>({...ne,oceanTraits:{...ne.oceanTraits,[F]:se}}))},y=F=>{o(se=>({...se,[F]:[...se[F]||[],""]}))},b=(F,se,ne)=>{o(ae=>{const De=[...ae[F]||[]];return De[se]=ne,{...ae,[F]:De}})},x=(F,se)=>{o(ne=>{const ae=[...ne[F]||[]];return ae.splice(se,1),{...ne,[F]:ae}})},w=(F,se,ne)=>{o(ae=>{const De={...ae.thinkFeelDo},de=[...De[F]||[]];return de[se]=ne,De[F]=de,{...ae,thinkFeelDo:De}})},S=F=>{o(se=>{var ae;const ne={...se.thinkFeelDo,[F]:[...((ae=se.thinkFeelDo)==null?void 0:ae[F])||[],""]};return{...se,thinkFeelDo:ne}})},C=(F,se)=>{o(ne=>{const ae={...ne.thinkFeelDo},De=[...ae[F]||[]];return De.splice(se,1),ae[F]=De,{...ne,thinkFeelDo:ae}})},_=()=>{d&&(re.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},A=async()=>{if(d){c(!0);try{const F={...d};delete F._id,delete F.isDbPersona;const se=await zr.create(F),ne={...d,id:se.data._id||se.data.id,_id:se.data._id||se.data.id,isDbPersona:!0};re.success("Persona saved to database successfully"),u(!1),f(null),e(ne)}catch(F){console.error("Error saving after login:",F),re.error("Failed to save to database after login"),u(!1),f(null)}finally{c(!1)}}};return l?a.jsxs("div",{className:"max-w-5xl mx-auto bg-background p-6",children:[a.jsx("div",{className:"flex justify-between items-center mb-6",children:a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Authentication Required"})}),a.jsx("p",{className:"mb-6 text-muted-foreground",children:"Login is required to save personas to the database. You can either:"}),a.jsxs("ul",{className:"list-disc ml-6 mt-2 mb-6",children:[a.jsx("li",{children:"Log in to save this persona to the database"}),a.jsx("li",{children:"Cancel to discard your changes"})]}),a.jsx(WLe,{message:"Login is required to save your persona to the database",onLoginSuccess:A,onCancel:_})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(J,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(Kp,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(J,{onClick:async()=>{c(!0);try{const F=i._id||i.id,se={...i};se._id&&delete se._id,delete se.isDbPersona;let ne;if(F&&typeof F=="string"&&F.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),ne=await zr.create(se),re.success("Persona saved to database");const ae={...i,id:ne.data._id||ne.data.id,_id:ne.data._id||ne.data.id,isDbPersona:!0};e(ae)}else if(F){ne=await zr.update(F,se),re.success("Persona updated successfully");const ae={...i,isDbPersona:!0};e(ae)}else{ne=await zr.create(se);const ae={...i,id:ne.data._id||ne.data.id,_id:ne.data._id||ne.data.id,isDbPersona:!0};re.success("Persona created successfully"),e(ae)}}catch(F){console.error("Error saving persona:",F),F.response&&F.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),re.error("Authentication error - saving locally instead"),e(i)):(f(i),u(!0)):(re.error("Failed to save persona"),e(i))}finally{c(!1)}},disabled:s,children:[s?a.jsx(Ds,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(DE,{className:"h-4 w-4 mr-2"}),s?"Saving...":"Save Changes"]})]}),a.jsxs(dl,{defaultValue:"basic",children:[a.jsxs(Va,{className:"grid w-full grid-cols-6",children:[a.jsx(mn,{value:"basic",children:"Basic"}),a.jsx(mn,{value:"cooper",children:"Cooper"}),a.jsx(mn,{value:"personality",children:"Personality"}),a.jsx(mn,{value:"demographics",children:"Demographics"}),a.jsx(mn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(mn,{value:"extended",children:"Extended"})]}),a.jsx(gn,{value:"basic",className:"mt-6",children:a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Name"}),a.jsx(Ht,{value:i.name||"",onChange:F=>g("name",F.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Age Range"}),a.jsxs(Bn,{value:i.age||"",onValueChange:F=>g("age",F),children:[a.jsx($n,{children:a.jsx(Un,{placeholder:"Select age range"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"18-24",children:"18-24"}),a.jsx(oe,{value:"25-34",children:"25-34"}),a.jsx(oe,{value:"35-44",children:"35-44"}),a.jsx(oe,{value:"45-54",children:"45-54"}),a.jsx(oe,{value:"55-64",children:"55-64"}),a.jsx(oe,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(Bn,{value:i.gender||"",onValueChange:F=>g("gender",F),children:[a.jsx($n,{children:a.jsx(Un,{placeholder:"Select gender"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"Male",children:"Male"}),a.jsx(oe,{value:"Female",children:"Female"}),a.jsx(oe,{value:"Non-binary",children:"Non-binary"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(Ht,{value:i.occupation||"",onChange:F=>g("occupation",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(Bn,{value:i.education||"",onValueChange:F=>g("education",F),children:[a.jsx($n,{children:a.jsx(Un,{placeholder:"Select education level"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"High School",children:"High School"}),a.jsx(oe,{value:"Some College",children:"Some College"}),a.jsx(oe,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(oe,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(oe,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(oe,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(Ht,{value:i.location||"",onChange:F=>g("location",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(Bn,{value:i.ethnicity||"",onValueChange:F=>g("ethnicity",F),children:[a.jsx($n,{children:a.jsx(Un,{placeholder:"Select ethnicity"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"white",children:"White"}),a.jsx(oe,{value:"black",children:"Black"}),a.jsx(oe,{value:"asian",children:"Asian"}),a.jsx(oe,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(oe,{value:"native-american",children:"Native American"}),a.jsx(oe,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(oe,{value:"mixed",children:"Mixed"}),a.jsx(oe,{value:"other",children:"Other"}),a.jsx(oe,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personality"}),a.jsx(mt,{value:i.personality||"",onChange:F=>g("personality",F.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(mt,{value:i.interests||"",onChange:F=>g("interests",F.target.value),rows:3,placeholder:"Tech, travel, cooking, etc."})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm",children:[i.techSavviness,"%"]})]}),a.jsx(br,{value:[i.techSavviness],onValueChange:F=>g("techSavviness",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm",children:[i.brandLoyalty||0,"%"]})]}),a.jsx(br,{value:[i.brandLoyalty||0],onValueChange:F=>g("brandLoyalty",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm",children:[i.priceConsciousness||0,"%"]})]}),a.jsx(br,{value:[i.priceConsciousness||0],onValueChange:F=>g("priceConsciousness",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm",children:[i.environmentalConcern||0,"%"]})]}),a.jsx(br,{value:[i.environmentalConcern||0],onValueChange:F=>g("environmentalConcern",F[0]),max:100,step:1})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Purchasing Power"}),a.jsx(ym,{checked:i.hasPurchasingPower||!1,onCheckedChange:F=>g("hasPurchasingPower",F)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(ym,{checked:i.hasChildren||!1,onCheckedChange:F=>g("hasChildren",F)})]})]})]})]})})})}),a.jsxs(gn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(i.goals||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("goals",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("goals",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("goals"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(i.frustrations||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("frustrations",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("frustrations",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("frustrations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(i.motivations||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("motivations",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("motivations",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("motivations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),(((j=i.thinkFeelDo)==null?void 0:j.thinks)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("thinks",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("thinks",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("thinks"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),(((P=i.thinkFeelDo)==null?void 0:P.feels)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("feels",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("feels",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("feels"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),(((k=i.thinkFeelDo)==null?void 0:k.does)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("does",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("does",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("does"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("div",{className:"space-y-4 mb-6",children:a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Scenario Section Title"}),a.jsx(Ht,{value:i.scenarioType||"",onChange:F=>g("scenarioType",F.target.value),placeholder:"Life Scenarios"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'})]})}),a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(i.scenarios||[]).map((F,se)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(mt,{value:F||"",onChange:ne=>b("scenarios",se,ne.target.value),rows:2}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("scenarios",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("scenarios"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(gn,{value:"personality",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[((O=i.oceanTraits)==null?void 0:O.openness)||50,"%"]})]}),a.jsx(br,{value:[((E=i.oceanTraits)==null?void 0:E.openness)||50],onValueChange:F=>m("openness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[((I=i.oceanTraits)==null?void 0:I.conscientiousness)||50,"%"]})]}),a.jsx(br,{value:[((D=i.oceanTraits)==null?void 0:D.conscientiousness)||50],onValueChange:F=>m("conscientiousness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[((z=i.oceanTraits)==null?void 0:z.extraversion)||50,"%"]})]}),a.jsx(br,{value:[(($=i.oceanTraits)==null?void 0:$.extraversion)||50],onValueChange:F=>m("extraversion",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[((G=i.oceanTraits)==null?void 0:G.agreeableness)||50,"%"]})]}),a.jsx(br,{value:[((R=i.oceanTraits)==null?void 0:R.agreeableness)||50],onValueChange:F=>m("agreeableness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[((L=i.oceanTraits)==null?void 0:L.neuroticism)||50,"%"]})]}),a.jsx(br,{value:[((W=i.oceanTraits)==null?void 0:W.neuroticism)||50],onValueChange:F=>m("neuroticism",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(gn,{value:"demographics",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Grade"}),a.jsxs(Bn,{value:i.socialGrade||"",onValueChange:F=>g("socialGrade",F),children:[a.jsx($n,{children:a.jsx(Un,{placeholder:"Select social grade"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"A",children:"A - Higher managerial"}),a.jsx(oe,{value:"B",children:"B - Intermediate managerial"}),a.jsx(oe,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(oe,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(oe,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(oe,{value:"E",children:"E - State pensioners, unemployed"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Income"}),a.jsxs(Bn,{value:i.householdIncome||"",onValueChange:F=>g("householdIncome",F),children:[a.jsx($n,{children:a.jsx(Un,{placeholder:"Select income range"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"Under $25k",children:"Under $25,000"}),a.jsx(oe,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(oe,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(oe,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(oe,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(oe,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(oe,{value:"Over $250k",children:"Over $250,000"}),a.jsx(oe,{value:"Prefer not to say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Composition"}),a.jsxs(Bn,{value:i.householdComposition||"",onValueChange:F=>g("householdComposition",F),children:[a.jsx($n,{children:a.jsx(Un,{placeholder:"Select household type"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"Single person",children:"Single person"}),a.jsx(oe,{value:"Couple without children",children:"Couple without children"}),a.jsx(oe,{value:"Couple with children",children:"Couple with children"}),a.jsx(oe,{value:"Single parent",children:"Single parent"}),a.jsx(oe,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(oe,{value:"Shared housing",children:"Shared housing"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(Bn,{value:i.livingSituation||"",onValueChange:F=>g("livingSituation",F),children:[a.jsx($n,{children:a.jsx(Un,{placeholder:"Select living situation"})}),a.jsxs(Ln,{children:[a.jsx(oe,{value:"Own home",children:"Own home"}),a.jsx(oe,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(oe,{value:"Rent house",children:"Rent house"}),a.jsx(oe,{value:"Live with family",children:"Live with family"}),a.jsx(oe,{value:"Student housing",children:"Student housing"}),a.jsx(oe,{value:"Assisted living",children:"Assisted living"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(gn,{value:"lifestyle",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Media Consumption"}),a.jsx(mt,{value:i.mediaConsumption||"",onChange:F=>g("mediaConsumption",F.target.value),rows:3,placeholder:"TV shows, podcasts, news sources, social media platforms"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Describe media consumption habits and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Device Usage"}),a.jsx(mt,{value:i.deviceUsage||"",onChange:F=>g("deviceUsage",F.target.value),rows:3,placeholder:"Smartphone, laptop, tablet, smart TV, gaming console"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Primary devices and usage patterns"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Shopping Habits"}),a.jsx(mt,{value:i.shoppingHabits||"",onChange:F=>g("shoppingHabits",F.target.value),rows:3,placeholder:"Online vs in-store, frequency, preferred retailers"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shopping behavior and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Brand Preferences"}),a.jsx(mt,{value:i.brandPreferences||"",onChange:F=>g("brandPreferences",F.target.value),rows:3,placeholder:"Favorite brands, brand values alignment"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred brands and reasoning"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Communication Preferences"}),a.jsx(mt,{value:i.communicationPreferences||"",onChange:F=>g("communicationPreferences",F.target.value),rows:3,placeholder:"Email, phone, text, video calls, in-person"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred communication methods and channels"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Payment Methods"}),a.jsx(mt,{value:i.paymentMethods||"",onChange:F=>g("paymentMethods",F.target.value),rows:3,placeholder:"Credit cards, digital wallets, cash, BNPL"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred payment methods and financial tools"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Purchase Behavior"}),a.jsx(mt,{value:i.purchaseBehaviour||"",onChange:F=>g("purchaseBehaviour",F.target.value),rows:3,placeholder:"Research habits, decision factors, impulse vs planned buying"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"How they approach making purchase decisions"})]})]})]})]})})}),a.jsxs(gn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Core Values"}),a.jsx(mt,{value:i.coreValues||"",onChange:F=>g("coreValues",F.target.value),rows:3,placeholder:"Key principles and values that guide decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Lifestyle Choices"}),a.jsx(mt,{value:i.lifestyleChoices||"",onChange:F=>g("lifestyleChoices",F.target.value),rows:3,placeholder:"Health, fitness, diet, work-life balance preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Activities"}),a.jsx(mt,{value:i.socialActivities||"",onChange:F=>g("socialActivities",F.target.value),rows:3,placeholder:"Social hobbies, community involvement, networking"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Category Knowledge"}),a.jsx(mt,{value:i.categoryKnowledge||"",onChange:F=>g("categoryKnowledge",F.target.value),rows:3,placeholder:"Expertise in specific product/service categories"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Decision Influences"}),a.jsx(mt,{value:i.decisionInfluences||"",onChange:F=>g("decisionInfluences",F.target.value),rows:3,placeholder:"What factors most influence their decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Pain Points"}),a.jsx(mt,{value:i.painPoints||"",onChange:F=>g("painPoints",F.target.value),rows:3,placeholder:"Common challenges and friction points"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Journey Context"}),a.jsx(mt,{value:i.journeyContext||"",onChange:F=>g("journeyContext",F.target.value),rows:3,placeholder:"Current life stage and contextual factors"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Key Touchpoints"}),a.jsx(mt,{value:i.keyTouchpoints||"",onChange:F=>g("keyTouchpoints",F.target.value),rows:3,placeholder:"Important interaction points and channels"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Autonomy"}),a.jsx(mt,{value:((Y=i.selfDeterminationNeeds)==null?void 0:Y.autonomy)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,autonomy:F.target.value}),rows:2,placeholder:"Need for independence and self-direction"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Competence"}),a.jsx(mt,{value:((te=i.selfDeterminationNeeds)==null?void 0:te.competence)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,competence:F.target.value}),rows:2,placeholder:"Need to feel capable and effective"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Relatedness"}),a.jsx(mt,{value:((me=i.selfDeterminationNeeds)==null?void 0:me.relatedness)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,relatedness:F.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(i.fears||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F,onChange:ne=>b("fears",se,ne.target.value),placeholder:"Enter a fear or concern"}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("fears",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("fears"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personal Narrative"}),a.jsx(mt,{value:i.narrative||"",onChange:F=>g("narrative",F.target.value),rows:4,placeholder:"Personal story, background, key life experiences"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A brief narrative that captures their personal story"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Additional Information"}),a.jsx(mt,{value:i.additionalInformation||"",onChange:F=>g("additionalInformation",F.target.value),rows:4,placeholder:"Any other relevant details or context"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Additional context or details not covered elsewhere"})]})]})})})]})]})]})}function YLe(){const{id:t}=OE(),e=Fi(),n=ar(),{navigationState:r,clearNavigationState:i}=ow(),[o,s]=v.useState(void 0),[c,l]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(!0);return v.useEffect(()=>{if(!t){h(!1);return}let m=!0;const b=new URLSearchParams(e.search).get("fromReview")==="true";return l(b),h(!0),(async()=>{try{const w=t.startsWith("local-")?t.substring(6):t,S=await zr.getById(w);if(S&&S.data){const C=S.data;if(m){console.log("Found persona in database:",C),s({...C,id:C.id||C._id,isDbPersona:!0}),h(!1);return}}console.error("Could not find persona with id:",t),m&&(s(void 0),h(!1),re.error("Persona not found"))}catch(w){console.error("Error fetching persona:",w),m&&(s(void 0),h(!1),re.error("Failed to load persona details"))}})(),()=>{m=!1}},[t,e.search]),{currentPersona:o,isEditing:u,isFromReview:c,isLoading:f,setIsEditing:d,handleGoBack:()=>{r.previousRoute&&r.previousRoute.startsWith("/focus-groups/")&&r.focusGroupId?n(`/focus-groups/${r.focusGroupId}`):r.previousRoute==="/focus-groups"&&r.focusGroupTab?r.isNewFocusGroup?n(`/focus-groups?mode=create&tab=${r.focusGroupTab}`):r.focusGroupId?n(`/focus-groups?mode=edit&id=${r.focusGroupId}&tab=${r.focusGroupTab}`):n("/focus-groups?mode=create&tab=participants"):n(c?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async m=>{try{d(!1);const y=m.isDbPersona||t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t),b={...m};if(b._id&&delete b._id,delete b.isDbPersona,y&&t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t)){const x=await zr.update(t,b);console.log("Updated persona in database:",x);const w={...m,isDbPersona:!0};s(w),re.success("Persona updated in database successfully")}else{const x=await zr.create(b);console.log("Created new persona in database:",x.data);const w={...m,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};s(w),re.success("Persona saved to database successfully")}}catch(y){return console.error("Error saving persona:",y),y.response&&y.response.status===401?re.error("Authentication error - Please log in to save personas"):y.response&&y.response.status===404?re.error("API endpoint not found - Database service may be unavailable"):re.error("Failed to save persona to database: "+(y.message||"Unknown error")),!1}return!0}}}function F$(){var f;const{currentPersona:t,isEditing:e,isFromReview:n,isLoading:r,setIsEditing:i,handleGoBack:o,handleSaveEdit:s}=YLe(),{navigationState:c}=ow(),[l,u]=v.useState("");v.useEffect(()=>{var h;c.focusGroupId&&((h=c.previousRoute)!=null&&h.startsWith("/focus-groups/"))&&(async()=>{var g;try{const m=await Ot.getById(c.focusGroupId);(g=m==null?void 0:m.data)!=null&&g.name&&u(m.data.name)}catch(m){console.error("Error fetching focus group name:",m)}})()},[c.focusGroupId,c.previousRoute]);const d=((f=c.previousRoute)==null?void 0:f.startsWith("/focus-groups/"))&&c.focusGroupId;return r?a.jsx(KLe,{}):t?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:e?a.jsx(qLe,{persona:t,onSave:s,onCancel:()=>i(!1)}):a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{className:"mb-4",children:a.jsx(LW,{children:a.jsxs(FW,{children:[a.jsx(hy,{children:a.jsxs(mj,{href:"/focus-groups",className:"flex items-center",children:[a.jsx(Vy,{className:"h-4 w-4 mr-1"}),"Focus Groups"]})}),a.jsx(gj,{}),a.jsx(hy,{children:a.jsxs(mj,{href:`/focus-groups/${c.focusGroupId}`,className:"flex items-center",children:[a.jsx(Dr,{className:"h-4 w-4 mr-1"}),l||"Focus Group Session"]})}),a.jsx(gj,{}),a.jsx(hy,{children:a.jsxs(BW,{className:"flex items-center",children:[a.jsx(qp,{className:"h-4 w-4 mr-1"}),(t==null?void 0:t.name)||"Participant"]})})]})})}),a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(J,{variant:"ghost",onClick:o,className:"absolute left-0 top-0 flex items-center",children:a.jsx(Kp,{className:"h-5 w-5"})}),a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900 mx-auto",children:"Persona Profile"}),a.jsxs(J,{onClick:()=>i(!0),className:"absolute right-0 top-0",children:[a.jsx(dZ,{className:"h-4 w-4 mr-2"}),"Edit Persona"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsx(ULe,{persona:t})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(dl,{defaultValue:"cooper-profile",children:[a.jsxs(Va,{className:"grid w-full grid-cols-3",children:[a.jsx(mn,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(mn,{value:"personality",children:"Personality"}),a.jsx(mn,{value:"scenarios",children:"Scenarios"})]}),a.jsx(gn,{value:"cooper-profile",className:"mt-6",children:a.jsx(HLe,{persona:t})}),a.jsx(gn,{value:"personality",className:"mt-6",children:a.jsx(zLe,{persona:t})}),a.jsx(gn,{value:"scenarios",className:"mt-6",children:a.jsx(GLe,{persona:t})})]})})]})]})})]}):a.jsx(VLe,{})}const QLe=Oe.object({username:Oe.string().min(3,"Username must be at least 3 characters"),password:Oe.string().min(4,"Password must be at least 4 characters")});function XLe(){var h;const t=ar(),e=Fi(),{login:n,loginWithMicrosoft:r,isAuthenticated:i,isMsalLoading:o}=Xs(),[s,c]=v.useState(!1),l=((h=e.state)==null?void 0:h.from)||"/";console.log("Login page - destination path:",l),v.useEffect(()=>{i&&(console.log("User already authenticated, redirecting from login page"),t("/",{replace:!0}))},[i,t]);const u=z0({resolver:G0(QLe),defaultValues:{username:"",password:""}});async function d(p){c(!0);try{await n(p.username,p.password)?(console.log("Login successful, received token, navigating to:",l),t(l,{replace:!0})):(console.error("Login succeeded but no token received"),c(!1))}catch(g){console.error("Login error in form handler:",g),c(!1)}}async function f(){try{await r(),console.log("Microsoft login successful, navigating to:",l),t(l,{replace:!0})}catch(p){console.error("Microsoft login error in form handler:",p)}}return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-900 dark:to-gray-800 px-4",children:a.jsxs(gt,{className:"w-full max-w-md",children:[a.jsxs(ji,{className:"space-y-1",children:[a.jsx(Wi,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(uN,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsxs(Rt,{children:[a.jsx("div",{className:"mb-6",children:a.jsx(J,{type:"button",variant:"outline",className:"w-full bg-[#0078d4] hover:bg-[#106ebe] text-white border-[#0078d4] hover:border-[#106ebe]",onClick:f,disabled:s||o,children:o?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in with Microsoft..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"mr-2 h-4 w-4",viewBox:"0 0 21 21",fill:"currentColor",children:[a.jsx("path",{d:"M10 0H0v10h10V0z"}),a.jsx("path",{d:"M21 0H11v10h10V0z"}),a.jsx("path",{d:"M10 11H0v10h10V11z"}),a.jsx("path",{d:"M21 11H11v10h10V11z"})]}),"Sign in with Microsoft"]})})}),a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-gray-200"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"bg-white px-2 text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:"Or continue with username"})})]}),a.jsx(K0,{...u,children:a.jsxs("form",{onSubmit:u.handleSubmit(d),className:"space-y-4",children:[a.jsx(vt,{control:u.control,name:"username",render:({field:p})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Username"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Enter your username",...p,disabled:s,autoComplete:"username"})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:u.control,name:"password",render:({field:p})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Password"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Enter your password",type:"password",...p,disabled:s,autoComplete:"current-password"})}),a.jsx(pt,{})]})}),a.jsx(J,{type:"submit",className:"w-full",disabled:s||o,children:s?"Signing in...":"Sign In"})]})})]}),a.jsxs(dN,{className:"flex flex-col space-y-2",children:[a.jsx("div",{className:"text-sm text-center text-gray-500 mb-2",children:"Default account: user / pass"}),!s&&!o&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(J,{variant:"outline",onClick:()=>t("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(J,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const p={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(p)),Ye.success("Offline mode activated",{description:"Using demo account with limited functionality"}),t("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function Ku({children:t}){const{isAuthenticated:e,isLoading:n}=Xs(),r=Fi();return console.log("ProtectedRoute check:",{isAuthenticated:e,isLoading:n,path:r.pathname}),n?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"})}):e?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:t})):(console.log("Not authenticated, redirecting to login"),a.jsx(c5,{to:"/login",state:{from:r.pathname},replace:!0}))}const JLe=v.createContext({});let B$=!1;function ZLe({children:t}){const{token:e}=Xs(),n=()=>{const i=e||localStorage.getItem("auth_token");return console.log("🔧 [GPT-5 Context] Getting token:",i?"Found":"Missing"),i||""};v.useEffect(()=>(B$||(console.log("🔧 [GPT-5 Context] Initializing singleton socket"),DW(n),B$=!0),console.log("🔧 [GPT-5 Context] Connecting socket"),$W(),()=>{}),[e]);const r={};return a.jsx(JLe.Provider,{value:r,children:t})}const UW=new YT(Yie);UW.initialize().catch(t=>{console.error("MSAL initialization error:",t)});function eFe({children:t}){return a.jsx(Wie,{instance:UW,children:t})}const tFe=new $X,nFe=()=>a.jsx(FX,{client:tFe,children:a.jsx(MJ,{basename:"/semblance",children:a.jsx(eFe,{children:a.jsx(Xie,{children:a.jsx(ZLe,{children:a.jsx(rde,{children:a.jsxs(pX,{children:[a.jsx(H9,{}),a.jsxs(EJ,{children:[a.jsx(Mo,{path:"/",element:a.jsx(Zie,{})}),a.jsx(Mo,{path:"/login",element:a.jsx(XLe,{})}),a.jsx(Mo,{path:"/synthetic-users",element:a.jsx(Ku,{children:a.jsx(nde,{})})}),a.jsx(Mo,{path:"/synthetic-users/:id",element:a.jsx(Ku,{children:a.jsx(F$,{})})}),a.jsx(Mo,{path:"/personas/:id",element:a.jsx(Ku,{children:a.jsx(F$,{})})}),a.jsx(Mo,{path:"/focus-groups",element:a.jsx(Ku,{children:a.jsx(lde,{})})}),a.jsx(Mo,{path:"/focus-groups/:id",element:a.jsx(Ku,{children:a.jsx(PLe,{})})}),a.jsx(Mo,{path:"/dashboard",element:a.jsx(Ku,{children:a.jsx(BLe,{})})}),a.jsx(Mo,{path:"/old-path",element:a.jsx(c5,{to:"/",replace:!0})}),a.jsx(Mo,{path:"*",element:a.jsx(eoe,{})})]})]})})})})})})});l4(document.getElementById("root")).render(a.jsx(nFe,{})); +`),ce=document.createElement("a"),ke=new Blob([ee],{type:"text/plain"});ce.href=URL.createObjectURL(ke),ce.download=`focus-group-${t}-transcript.txt`,document.body.appendChild(ce),ce.click(),document.body.removeChild(ce),qe.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},et=(ee,ce)=>{const ke=wt=>{const en=wt.match(/^\[([^\]]+)\]:\s*(.*)$/);return en?en[2].trim():wt.trim()},Fe=wt=>wt.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),Ue=(wt,en)=>{const qt=Fe(wt),Ci=Fe(en);if(qt===Ci)return 1;if(qt.includes(Ci)||Ci.includes(qt))return Math.min(qt.length,Ci.length)/Math.max(qt.length,Ci.length);const On=qt.split(" "),ln=Ci.split(" "),hh=On.filter(ak=>ln.includes(ak)&&ak.length>2);return On.length===0||ln.length===0?0:hh.length/Math.max(On.length,ln.length)},_t=typeof ee=="object"&&ee!==null,He=_t?ee.text:ke(ee),nt=_t?ee.original:ee;let Se=null,Gt="";if(ce&&(Se=r.find(wt=>wt.id===ce),Se?Gt="direct_message_id_match":console.warn(`Message ID ${ce} not found in current messages array`)),Se||(Se=r.find(wt=>wt.text.includes(nt)),Se&&(Gt="exact_full_match")),Se||(Se=r.find(wt=>wt.text.includes(He)),Se&&(Gt="exact_text_match")),Se||(Se=r.find(wt=>He.includes(wt.text.trim())),Se&&(Gt="reverse_exact_match")),!Se){const wt=He.toLowerCase();Se=r.find(en=>en.text.toLowerCase().includes(wt)||wt.includes(en.text.toLowerCase())),Se&&(Gt="case_insensitive_match")}if(!Se){const wt=r.map(en=>({message:en,similarity:Ue(He,en.text)})).filter(en=>en.similarity>.7).sort((en,qt)=>qt.similarity-en.similarity);wt.length>0&&(Se=wt[0].message,Gt=`fuzzy_match_${Math.round(wt[0].similarity*100)}%`)}if(!Se){const en=Fe(He).split(" ").filter(qt=>qt.length>3);en.length>0&&(Se=r.find(qt=>{const Ci=Fe(qt.text);return en.every(On=>Ci.includes(On))}),Se&&(Gt="partial_word_match"))}Se?(console.log(`Quote match found using strategy: ${Gt}`,{quoteType:_t?"QuoteData":"string",providedMessageId:ce,extractedText:He,matchedMessage:Se.text.substring(0,100),matchedMessageId:Se.id,originalQuote:nt.substring(0,100)}),g("chat"),setTimeout(()=>{const wt=document.getElementById(`message-${Se.id}`);wt&&(P||wt.scrollIntoView({behavior:"smooth",block:"center"}),wt.style.backgroundColor="#fbbf24",wt.style.transition="background-color 0.3s ease",setTimeout(()=>{wt.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:_t?"QuoteData":"string",providedMessageId:ce,originalQuote:nt.substring(0,100),extractedText:He.substring(0,100),totalMessages:r.length,messageSample:r.slice(0,3).map(wt=>({id:wt.id,text:wt.text.substring(0,50)}))}),qe.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},bt=ee=>{l(ce=>{const ke=new Set(ce.map(Ue=>Ue.id)),Fe=ee.filter(Ue=>!ke.has(Ue.id));return[...ce,...Fe]})},hn=async ee=>{if(!t)return;const ce=c.find(ke=>ke.id===ee);if(ce)try{"source"in ce&&ce.source==="generated"&&await Xn.deleteKeyTheme(t,ee),l(c.filter(ke=>ke.id!==ee))}catch(ke){console.error("Error deleting theme:",ke),qe.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},ut=v.useCallback(async(ee,ce)=>{if(t)try{await Xn.setModeratorPosition(t,ee,ce),qe.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(ke){console.error("Error setting moderator position:",ke),qe.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[t]),An=v.useCallback(async ee=>{if(console.log("💾 handleDiscussionGuideSave called:",{hasId:!!t,isEditingGuideContent:E,timestamp:new Date().toISOString()}),!!t)try{await Ot.update(t,{discussionGuide:ee}),E?(D.current&&(D.current={...D.current,discussionGuide:ee}),console.log("⚠️ Skipping focus group state update during editing to preserve focus")):(console.log("🔄 Updating focus group state (not editing)"),d(ce=>ce?{...ce,discussionGuide:ee}:null))}catch(ce){throw console.error("Error saving discussion guide:",ce),ce}},[t,E]),an=v.useCallback(ee=>{console.log("🔄 handleGuideEditingStateChange called:",{editing:ee,timestamp:new Date().toISOString(),currentIsEditingGuideContent:E}),k(ee),I(ee),!ee&&D.current&&(console.log("📝 Updating focus group state after editing ended"),d(D.current))},[E]),rn=v.useCallback(()=>{j(ee=>!ee)},[]),gr=v.useCallback((ee,ce,ke,Fe,Ue,_t)=>{Q({isOpen:!0,sectionId:ee,itemId:ce,content:ke,sectionTitle:Fe,itemTitle:Ue,itemType:_t})},[]),H=ee=>{console.log("🔍 EXTRACT ASSET FILENAME DEBUG - Input content:",ee);const ce=[/'([^']*\.[a-zA-Z]{3,4})'/g,/"([^"]*\.[a-zA-Z]{3,4})"/g,/titled\s+['"]([^'"]*\.[a-zA-Z]{3,4})['"](?:\.|,|\s|$)/gi,/asset[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/image[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/file[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/\b([a-zA-Z0-9_-]+\.[a-zA-Z]{3,4})\b/g];for(let ke=0;ke0){const _t=Ue[0][1];if(console.log(`🔍 Pattern ${ke+1} extracted filename:`,_t),_t&&_t.includes("."))return console.log("✅ EXTRACT ASSET FILENAME - Found:",_t),_t}}return console.warn("❌ EXTRACT ASSET FILENAME - No filename found in content"),null},he=()=>{if(m)return{sectionId:m.current_section_id,sectionTitle:m.current_section,itemId:m.current_item_id,itemTitle:m.current_item}},ue=()=>{if(r.length!==0)return r[r.length-1].id},je=()=>{const ee=ue();if(!ee||r.length===0)return new Date;const ce=r.find(ke=>ke.id===ee);return ce?ce.timestamp:new Date},Be=async()=>{if(t){Le(!0),lt(!1),T(!1),qe.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const ee=await Xn.generateKeyThemes(t);ee.data&&ee.data.themes?(lt(!0),qe.success(`Generated ${ee.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(ce=>[...ce,...ee.data.themes])):(lt(!0),qe.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(ee){console.error("Error generating key themes:",ee),T(!0),qe.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},zt=()=>{Le(!1),lt(!1),T(!1)},er=()=>{de||ye(new Date),De(!0)},so=ee=>{$(ce=>[...ce,ee].sort((ke,Fe)=>Fe.createdAt.getTime()-ke.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(ee)},Mu=ee=>{const ce=r.find(ke=>ke.id===ee);ce?(g("chat"),setTimeout(()=>{const ke=document.getElementById(`message-${ce.id}`);ke&&(P||ke.scrollIntoView({behavior:"smooth",block:"center"}),ke.style.backgroundColor="#fbbf24",ke.style.transition="background-color 0.3s ease",setTimeout(()=>{ke.style.backgroundColor=""},2e3))},100)):qe.info("Message not found",{description:"Could not locate the original message for this note."})};v.useEffect(()=>{r.length>0&&!de&&ye(new Date)},[r.length,de]),v.useEffect(()=>{O.current=P,P||fn()},[P]);const na=ee=>{Z(ce=>ce.includes(ee)?ce.filter(ke=>ke!==ee):[...ce,ee])};return C?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(Aa,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("div",{className:"flex justify-center items-center",children:a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}),a.jsx("p",{className:"mt-4 text-slate-600",children:"Loading focus group..."})]})]}):u?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),M&&a.jsx("div",{className:`w-full transition-all duration-300 ${st?"bg-green-500":Ke?"bg-yellow-500":"bg-red-500"}`,children:a.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:a.jsxs("div",{className:"flex items-center justify-between py-2 text-white text-sm font-medium",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${st?"bg-white animate-pulse":Ke?"bg-white animate-spin":"bg-white"}`}),a.jsx("span",{children:st?"Real-time updates active - Changes appear instantly":Ke?"Connecting to real-time updates...":"Real-time updates unavailable - Using periodic refresh"}),Nt&&a.jsx("span",{className:"text-xs opacity-75 ml-2",title:Nt,children:"(Connection error)"})]}),a.jsx("button",{onClick:()=>U(!1),className:"ml-4 text-white hover:text-gray-200 transition-colors",title:"Hide status bar","aria-label":"Hide connection status",children:a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})})}),!M&&a.jsx("div",{className:"fixed top-20 right-4 z-40",children:a.jsx("button",{onClick:()=>U(!0),className:`px-3 py-1 rounded-full text-white text-xs font-medium shadow-lg transition-all duration-200 hover:shadow-xl ${st?"bg-green-500 hover:bg-green-600":Ke?"bg-yellow-500 hover:bg-yellow-600":"bg-red-500 hover:bg-red-600"}`,title:st?"WebSocket connected - Show status bar":Ke?"WebSocket connecting - Show status bar":"WebSocket disconnected - Show status bar",children:a.jsxs("div",{className:"flex items-center space-x-1",children:[a.jsx("div",{className:`w-2 h-2 rounded-full bg-white ${st?"animate-pulse":""}`}),a.jsx("span",{children:st?"Live":Ke?"Connecting":"Offline"})]})})}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(J,{variant:"ghost",onClick:()=>e("/focus-groups"),className:"mr-2",children:a.jsx(Kp,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-2xl font-bold text-slate-900",children:u.name}),a.jsx("p",{className:"text-slate-600",children:new Date(u.date).toLocaleString()}),a.jsxs("div",{className:"flex items-center mt-1",children:[a.jsx(ya,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx(Sr,{variant:"secondary",className:"text-xs",children:u.llm_model==="gpt-4.1"?"GPT-4.1":u.llm_model==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(J,{variant:"outline",onClick:()=>x(!b),className:b?"bg-blue-50 text-blue-600":"",children:[a.jsx(B_,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(J,{variant:"outline",onClick:()=>R(!0),children:[a.jsx(LE,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(J,{variant:"outline",onClick:yt,children:[a.jsx(lu,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),ct&&a.jsx("div",{className:"mb-6",children:a.jsx(zN,{isActive:ct,isComplete:At,hasError:Jt,label:"Analyzing discussion for key themes",onComplete:zt,className:"max-w-4xl mx-auto"})}),a.jsx(P$e,{discussionGuide:u.discussionGuide,moderatorStatus:m,onSectionSelect:ut,onSetPosition:gr,onSave:An,focusGroupId:t||"",isOpen:A,onToggle:rn,onEditingChange:an}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(ude,{participants:f,selectedParticipantIds:Ee,onToggleParticipantFilter:na}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(dl,{defaultValue:"chat",value:p,onValueChange:g,className:"w-full h-full flex flex-col",children:[a.jsxs(Va,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(gn,{value:"chat",className:"flex items-center",children:[a.jsx(As,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(gn,{value:"themes",className:"flex items-center",children:[a.jsx(uu,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(gn,{value:"notes",className:"flex items-center",children:[a.jsx(Ky,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(gn,{value:"analytics",className:"flex items-center",children:[a.jsx(B_,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(vn,{value:"chat",className:"m-0 flex-1 flex flex-col h-0",children:r.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[a.jsx("p",{className:"text-lg text-slate-600",children:"No messages yet. Start the session to begin the discussion."}),a.jsxs(J,{onClick:ta,size:"lg",className:"flex items-center gap-2",children:[a.jsx(u5,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(Fde,{messages:r,modeEvents:o,personas:f,isSpeaking:!1,focusGroupId:t||"",isAiModeActive:w,selectedParticipantIds:Ee,onToggleHighlight:Pe,onAdvanceDiscussion:()=>null,onNewMessage:q,onStatusChange:Xt,isEditingDiscussionGuide:P})}),a.jsx(vn,{value:"themes",className:"m-0",children:a.jsx(Ude,{themes:c,messages:r,personas:f,focusGroupId:t||"",onThemesGenerated:bt,onThemeDelete:hn,onQuoteClick:et,onGenerateKeyThemes:Be})}),a.jsx(vn,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(k$e,{focusGroupId:t||"",focusGroupName:u==null?void 0:u.name,onNoteClick:Mu})})}),a.jsx(vn,{value:"analytics",className:"m-0",children:a.jsx(j$e,{messages:r,themes:c,personas:f})})]})})]})]}),r.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(J,{onClick:er,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(Ky,{className:"h-5 w-5"})})}),a.jsx(O$e,{isOpen:ae,onClose:()=>De(!1),focusGroupId:t||"",associatedMessageId:ue(),sectionInfo:he(),messageTimestamp:je(),onNoteSaved:so}),a.jsx(Ql,{open:V.isOpen,onOpenChange:ee=>Q(ce=>({...ce,isOpen:ee})),children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"Set Moderator Position"}),a.jsxs(Xl,{children:['Are you sure you want to set the moderator position to "',V.itemTitle,'" in section "',V.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",disabled:V.isLoading,onClick:()=>Q({isOpen:!1}),children:"Cancel"}),a.jsxs(J,{disabled:V.isLoading,onClick:async()=>{var ee,ce,ke,Fe,Ue,_t,He,nt,Se;if(!(!t||!V.sectionId||!V.itemId||!V.content)){Q(Gt=>({...Gt,isLoading:!0}));try{await Xn.setModeratorPosition(t,V.sectionId,V.itemId);let Gt=[],wt=!1,en=V.content;const qt=V.content?H(V.content):null,Ci=!!qt;if(console.log("🔍 MANUAL POSITION DEBUG:",{itemType:V.itemType,hasImageAttached:Ci,assetFilename:qt,content:V.content,sectionTitle:V.sectionTitle,itemTitle:V.itemTitle,contentLength:(ee=V.content)==null?void 0:ee.length}),Ci&&V.content&&qt)if(console.log("🔍 ASSET EXTRACTION DEBUG:",{originalContent:V.content,extractedFilename:qt,contentLength:V.content.length}),qt){Gt=[qt],wt=!0,console.log("🎨 MANUAL POSITION: Creative review detected, will activate visual context for:",qt);try{console.log("🎨 MANUAL MODE: Requesting AI description for",qt);try{console.log("🔍 TESTING: Calling test endpoint first...");const hh=await $e.post(`/focus-groups/${t}/test-endpoint`,{test:"data"});console.log("✅ TEST: Test endpoint response:",hh.data)}catch(hh){console.error("❌ TEST: Test endpoint failed:",hh)}const ln=await Ot.describeAsset(t,qt);ln.data.description&&(en=V.content.replace(`'${qt}'`,`'${qt}' - ${ln.data.description}`),console.log("✅ MANUAL MODE: Enhanced question with AI description"),console.log("🔍 Original:",V.content),console.log("🔍 Enhanced:",en))}catch(ln){console.error("⚠️ MANUAL MODE: Failed to generate AI description:",ln),console.error("⚠️ Error response data:",(ce=ln.response)==null?void 0:ce.data),console.error("⚠️ Error status:",(ke=ln.response)==null?void 0:ke.status),console.error("⚠️ Error headers:",(Fe=ln.response)==null?void 0:Fe.headers),console.error("⚠️ Full axios error:",{message:ln.message,code:ln.code,status:(Ue=ln.response)==null?void 0:Ue.status,statusText:(_t=ln.response)==null?void 0:_t.statusText,url:(He=ln.config)==null?void 0:He.url,method:(nt=ln.config)==null?void 0:nt.method}),qe.warning("AI description failed",{description:"Using original question text. Image will still be available to participants."})}}else console.warn("⚠️ MANUAL POSITION: Creative review detected but no asset filename extracted from content");const On={id:`msg-${Date.now()}`,senderId:"moderator",text:en,timestamp:new Date,type:"question"};console.log("📤 Sending moderator message to API:",{text:en,attachedAssets:Gt,activatesVisualContext:wt});try{const ln=await Ot.sendMessage(t,{senderId:"moderator",text:en,type:"question",attached_assets:Gt,activates_visual_context:wt});(Se=ln==null?void 0:ln.data)!=null&&Se.message_id?(On.id=ln.data.message_id,console.log("✅ Message API call successful, assigned ID:",On.id)):console.warn("⚠️ Message API call succeeded but no message_id returned:",ln==null?void 0:ln.data)}catch(ln){console.error("❌ Failed to save message to API:",ln),qe.warning("Message display only",{description:"The moderator message is shown locally but may not be saved to the server."})}console.log("📨 Adding moderator message to UI:",{messageId:On.id,text:On.text,hasAssets:Gt.length>0}),q(On),Q({isOpen:!1}),console.log("✅ Set position complete, moderator message added to UI"),qe.success("Moderator position set",{description:`Position set to "${V.itemTitle}" in "${V.sectionTitle}"`})}catch(Gt){console.error("Error setting moderator position:",Gt),Q(wt=>({...wt,isLoading:!1})),qe.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[V.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),V.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(Ql,{open:G,onOpenChange:R,children:a.jsxs($c,{children:[a.jsxs(Lc,{children:[a.jsx(Bc,{children:"AI Model Settings"}),a.jsx(Xl,{children:"Choose which AI model to use for generating responses and discussion guides in this focus group."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(ya,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx(Sr,{variant:"secondary",children:(u==null?void 0:u.llm_model)==="gpt-4.1"?"GPT-4.1":(u==null?void 0:u.llm_model)==="gpt-5"?"GPT-5":"Gemini 2.5 Pro"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),a.jsxs(Un,{value:L,onValueChange:ee=>{console.log("🔧 Model selection changed:",{from:L,to:ee}),W(ee)},children:[a.jsx(Ln,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select AI model"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(oe,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(oe,{value:"gpt-5",children:"GPT-5"})]})]})]}),L==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Reasoning Effort:"}),a.jsxs(Un,{value:Y,onValueChange:te,children:[a.jsx(Ln,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select reasoning effort"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(oe,{value:"low",children:"Low - Quick thinking"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(oe,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how much time GPT-5 spends thinking before responding"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Response Verbosity:"}),a.jsxs(Un,{value:me,onValueChange:F,children:[a.jsx(Ln,{className:"mt-1",children:a.jsx(Hn,{placeholder:"Select verbosity level"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"low",children:"Low - Concise responses"}),a.jsx(oe,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(oe,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx("p",{className:"text-xs text-slate-600 mt-1",children:"Controls how detailed and lengthy GPT-5's responses will be"}),a.jsx("p",{className:"text-xs text-amber-600 font-medium mt-1",children:"Controls how thoroughly GPT-5 thinks and how detailed responses are"})]})]}),a.jsxs("div",{className:"text-xs text-slate-600",children:[a.jsxs("p",{children:[a.jsx("strong",{children:"Gemini 2.5 Pro:"})," Google's advanced model, great for creative and analytical tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-4.1:"})," OpenAI's latest model, excellent for conversational and reasoning tasks."]}),a.jsxs("p",{children:[a.jsx("strong",{children:"GPT-5:"})," OpenAI's newest model with advanced reasoning and customizable response styles."]})]})]}),a.jsxs(Fc,{children:[a.jsx(J,{variant:"outline",onClick:()=>R(!1),disabled:se,children:"Cancel"}),a.jsxs(J,{onClick:()=>{console.log("🔧 Update button clicked:",{selectedModel:L,selectedReasoningEffort:Y,selectedVerbosity:me,currentModel:u==null?void 0:u.llm_model,isDisabled:se||L===(u==null?void 0:u.llm_model)&&(L!=="gpt-5"||Y===(u==null?void 0:u.reasoning_effort)&&me===(u==null?void 0:u.verbosity))}),wn(L,Y,me)},disabled:se||L===(u==null?void 0:u.llm_model)&&(L!=="gpt-5"||Y===((u==null?void 0:u.reasoning_effort)||"medium")&&me===((u==null?void 0:u.verbosity)||"medium")),children:[se&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),se?"Updating...":"Update Model"]})]})]})}),a.jsx(N$e,{focusGroupId:t,personas:f,isVisible:b,onToggle:()=>x(!b)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(Aa,{}),a.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Focus group not found"}),a.jsx("p",{className:"mt-2 text-slate-600",children:"We couldn't find the focus group you're looking for."}),a.jsxs(J,{onClick:()=>e("/focus-groups"),className:"mt-4",children:[a.jsx(Kp,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},kLe=({title:t,description:e})=>a.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:t}),a.jsx("p",{className:"text-slate-600 mt-1",children:e})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(J,{variant:"outline",children:"Export Data"}),a.jsx(J,{children:"Generate Report"})]})]}),IC=({title:t,value:e,changePercentage:n,icon:r})=>a.jsx(gt,{className:"p-6 hover:shadow-md transition-shadow",children:a.jsxs("div",{className:"flex justify-between items-start",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-muted-foreground text-sm",children:t}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:e}),a.jsxs("p",{className:`${n>=0?"text-green-500":"text-red-500"} text-xs mt-1`,children:[n>=0?"↑":"↓"," ",Math.abs(n),"% from last month"]})]}),a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(r,{className:"h-6 w-6 text-primary"})})]})}),OLe=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],ILe=[{id:"1",title:"User Interface Feedback",description:"Users consistently mentioned difficulty with the navigation menu on mobile devices.",source:"Mobile App Focus Group",date:"2023-06-12",sentiment:"negative"},{id:"2",title:"Feature Adoption",description:'The new search functionality is well-received, with 85% of users rating it as "very useful".',source:"Product Testing Group",date:"2023-06-10",sentiment:"positive"},{id:"3",title:"Pricing Strategy",description:"Price-conscious users expressed willingness to pay up to 20% more for premium features.",source:"Pricing Model Analysis",date:"2023-06-08",sentiment:"positive"},{id:"4",title:"Competitive Analysis",description:"Users who switched from competitor products cited our streamlined onboarding as a key factor.",source:"Customer Journey Mapping",date:"2023-06-05",sentiment:"positive"}],RLe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Research Activity"}),a.jsx("div",{className:"h-64",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(wW,{data:OLe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(rs,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(rs,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(rs,{type:"monotone",dataKey:"interactions",stackId:"3",stroke:"#ffc658",fill:"#ffc658",name:"Interactions"})]})})})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Recent AI Insights"}),a.jsxs("div",{className:"space-y-4",children:[ILe.slice(0,3).map(t=>a.jsx("div",{className:"border-b pb-4 last:border-b-0 last:pb-0",children:a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:`p-2 rounded-full mr-3 ${t.sentiment==="positive"?"bg-green-100":t.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(au,{className:`h-4 w-4 ${t.sentiment==="positive"?"text-green-600":t.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:t.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:t.source}),a.jsx("span",{className:"mx-2",children:"•"}),a.jsx("span",{children:t.date})]})]})]})},t.id)),a.jsx(J,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(gt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Upcoming Research Tasks"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-blue-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-blue-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Website Redesign Feedback"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Focus group scheduled for Jun 20"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-purple-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-purple-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Mobile App User Testing"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"8 participants needed by Jun 25"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-amber-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Pricing Strategy Evaluation"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Create discussion guide by Jun 22"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx("div",{className:"bg-green-100 p-2 rounded-full mr-3",children:a.jsx(cv,{className:"h-4 w-4 text-green-600"})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:"Product Onboarding Flow"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Results analysis due Jun 30"})]})]}),a.jsx(J,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),MLe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],DLe=()=>a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Synthetic Persona Analytics"}),a.jsx(J,{variant:"outline",size:"sm",children:"View Demographics"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Demographics"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:MLe,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,fill:"#FFDEE2",label:!0})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Distribution"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Age: 25-34"}),a.jsx("span",{children:"35%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-400 rounded-full",style:{width:"35%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savvy"}),a.jsx("span",{children:"72%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-300 rounded-full",style:{width:"72%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyal"}),a.jsx("span",{children:"58%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-500 rounded-full",style:{width:"58%"}})})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitive"}),a.jsx("span",{children:"67%"})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-pink-200 rounded-full",style:{width:"67%"}})})]})]})]})]}),a.jsx("div",{className:"flex justify-center mt-6",children:a.jsx(J,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),$Le=[{name:"Jan",users:20,groups:3,interactions:120},{name:"Feb",users:25,groups:4,interactions:160},{name:"Mar",users:30,groups:5,interactions:220},{name:"Apr",users:40,groups:6,interactions:280},{name:"May",users:45,groups:7,interactions:350},{name:"Jun",users:48,groups:7,interactions:420}],L$=[{name:"Very Positive",value:25,color:"#4ade80"},{name:"Positive",value:40,color:"#a3e635"},{name:"Neutral",value:20,color:"#93c5fd"},{name:"Negative",value:10,color:"#fb923c"},{name:"Very Negative",value:5,color:"#f87171"}],LLe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],FLe=()=>{const t=ar();return a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-4",children:[a.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Focus Group Insights"}),a.jsx(J,{variant:"outline",size:"sm",onClick:()=>t("/focus-groups"),children:"View All Sessions"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Session Analytics"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(wW,{data:$Le,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(rs,{type:"monotone",dataKey:"interactions",stroke:"#8884d8",fill:"#8884d8",name:"User Interactions"})]})})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Feedback Sentiment"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(tk,{children:[a.jsx(ei,{}),a.jsx(gs,{data:L$,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:e,percent:n})=>`${e} ${(n*100).toFixed(0)}%`,children:L$.map((e,n)=>a.jsx(Og,{fill:e.color},`cell-${n}`))}),a.jsx(Ea,{})]})})})]})]}),a.jsxs("div",{className:"mb-6",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Topic Frequency Analysis"}),a.jsx("div",{className:"h-60",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(bW,{data:LLe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(ng,{strokeDasharray:"3 3"}),a.jsx(rl,{dataKey:"name"}),a.jsx(il,{}),a.jsx(ei,{}),a.jsx(Ea,{}),a.jsx(gl,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(J,{onClick:()=>t("/focus-groups"),children:"Manage Focus Groups"})})]})},BLe=()=>{const[t,e]=v.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(kLe,{title:"Dashboard",description:"Monitor and analyze your research insights"}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:[a.jsx(IC,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:Dr}),a.jsx(IC,{title:"Active Focus Groups",value:7,changePercentage:5,icon:Vs}),a.jsx(IC,{title:"Research Insights",value:124,changePercentage:18,icon:uu})]}),a.jsxs(dl,{value:t,onValueChange:e,className:"glass-panel rounded-xl p-6",children:[a.jsxs(Va,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(gn,{value:"overview",children:"Overview"}),a.jsx(gn,{value:"users",children:"Synthetic Users"}),a.jsx(gn,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(vn,{value:"overview",children:a.jsx(RLe,{})}),a.jsx(vn,{value:"users",children:a.jsx(DLe,{})}),a.jsx(vn,{value:"focus-groups",children:a.jsx(FLe,{})})]})]})]})},LW=v.forwardRef(({...t},e)=>a.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));LW.displayName="Breadcrumb";const FW=v.forwardRef(({className:t,...e},n)=>a.jsx("ol",{ref:n,className:Ne("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));FW.displayName="BreadcrumbList";const hy=v.forwardRef(({className:t,...e},n)=>a.jsx("li",{ref:n,className:Ne("inline-flex items-center gap-1.5",t),...e}));hy.displayName="BreadcrumbItem";const mj=v.forwardRef(({asChild:t,className:e,...n},r)=>{const i=t?Hs:"a";return a.jsx(i,{ref:r,className:Ne("transition-colors hover:text-foreground",e),...n})});mj.displayName="BreadcrumbLink";const BW=v.forwardRef(({className:t,...e},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Ne("font-normal text-foreground",t),...e}));BW.displayName="BreadcrumbPage";const gj=({children:t,className:e,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:Ne("[&>svg]:size-3.5",e),...n,children:t??a.jsx(fo,{})});gj.displayName="BreadcrumbSeparator";function ULe({persona:t}){const e=t.id==="0",n=t.id==="1";return a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center",children:a.jsx("img",{src:Cg(t),alt:t.name,className:"h-16 w-16 rounded-full object-cover"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-sf text-xl font-semibold",children:t.name}),a.jsx("p",{className:"text-muted-foreground",children:t.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Dr,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Demographics"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[t.age," ",t.gender?a.jsxs(a.Fragment,{children:["• ",t.gender]}):null,t.ethnicity?a.jsxs(a.Fragment,{children:[" • ",t.ethnicity]}):null]}),t.education&&a.jsx("p",{className:"sidebar-sub-item",children:t.education}),t.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",t.socialGrade]}),t.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",t.householdIncome]}),t.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",t.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(nZ,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Location"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.location}),t.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:t.livingSituation})]})]}),t.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z_,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Interests"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.interests})]})]}),t.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-sm",children:"Media"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.mediaConsumption})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Digital Behavior"}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Tech Savviness"}),a.jsxs("span",{children:[t.techSavviness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${t.techSavviness}%`}})})]}),t.brandLoyalty!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Brand Loyalty"}),a.jsxs("span",{children:[t.brandLoyalty,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${t.brandLoyalty}%`}})})]}),t.priceConsciousness!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Price Sensitivity"}),a.jsxs("span",{children:[t.priceConsciousness,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${t.priceConsciousness}%`}})})]}),t.environmentalConcern!==void 0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[a.jsx("span",{children:"Environmental Concern"}),a.jsxs("span",{children:[t.environmentalConcern,"%"]})]}),a.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${t.environmentalConcern}%`}})})]}),t.deviceUsage&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Device Usage"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-xs font-medium mt-3",children:"Shopping Habits"}),a.jsx("p",{className:"sidebar-sub-item text-xs",children:t.shoppingHabits})]})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-sm mb-3",children:"Additional Information"}),a.jsxs("div",{className:"space-y-2",children:[t.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(z_,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.brandPreferences})]}),t.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(qp,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",t.communicationPreferences]})]}),t.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(iZ,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.deviceUsage})]}),t.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(cZ,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:t.shoppingHabits})]}),t.additionalInformation&&typeof t.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(JJ,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:t.additionalInformation.split(` +`).map((r,i)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("•")||r.trim().startsWith("-")?r.trim().substring(1).trim():r.trim()},i))})]}),e&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(YO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Maintains an extensive network of financial and luxury industry contacts"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Vy,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Owns vacation properties in the Cotswolds and South of France"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Collector of rare first-edition books and limited-edition art prints"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(QO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Significant investment portfolio with focus on sustainable luxury ventures"})]})]}),n&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(IS,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Active in industry panels, luxury brand collaborations, follows influencers in luxury & design"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Vy,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Modern flat in exclusive Chelsea, accessible to boutique services"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(QO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Uses premium digital payment & secure banking for HNWIs"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(YO,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Respected network in London's luxury sector; attends exclusive events"})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(qp,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function HLe({persona:t}){var e,n,r,i,o,s,c,l,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Qv,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Goals"})]}),a.jsx("ul",{className:"space-y-2",children:(e=t.goals)==null?void 0:e.map((d,f)=>a.jsxs("li",{className:"flex items-start",children:[a.jsx("div",{className:"h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center mt-0.5 mr-3",children:a.jsx("span",{className:"text-xs text-primary font-medium",children:f+1})}),a.jsx("p",{className:"text-sm",children:d})]},f))})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(p5,{className:"h-5 w-5 text-amber-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Frustrations"})]}),a.jsx("ul",{className:"space-y-2",children:(n=t.frustrations)==null?void 0:n.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-amber-500 mr-2",children:"•"}),a.jsx("span",{children:d})]},f))})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(pa,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h3",{className:"font-sf text-lg font-medium",children:"Motivations"})]}),a.jsx("ul",{className:"space-y-2",children:(r=t.motivations)==null?void 0:r.map((d,f)=>a.jsxs("li",{className:"text-sm flex items-start",children:[a.jsx("span",{className:"text-green-500 mr-2",children:"•"}),a.jsx("span",{children:d})]},f))})]})})]}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(au,{className:"h-5 w-5 text-blue-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Thinks"})]}),a.jsx("ul",{className:"space-y-2",children:(o=(i=t.thinkFeelDo)==null?void 0:i.thinks)==null?void 0:o.map((d,f)=>a.jsxs("li",{className:"text-sm bg-blue-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(z_,{className:"h-5 w-5 text-red-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Feels"})]}),a.jsx("ul",{className:"space-y-2",children:(c=(s=t.thinkFeelDo)==null?void 0:s.feels)==null?void 0:c.map((d,f)=>a.jsxs("li",{className:"text-sm bg-red-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(pa,{className:"h-5 w-5 text-green-500 mr-2"}),a.jsx("h4",{className:"font-medium text-sm",children:"Does"})]}),a.jsx("ul",{className:"space-y-2",children:(u=(l=t.thinkFeelDo)==null?void 0:l.does)==null?void 0:u.map((d,f)=>a.jsxs("li",{className:"text-sm bg-green-50 p-2 rounded-md",children:['"',d,'"']},f))})]})]})]})})]})}function zLe({persona:t}){var n,r,i,o,s;const e=[{trait:"Openness",value:((n=t.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=t.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((i=t.oceanTraits)==null?void 0:i.extraversion)||50},{trait:"Agreeableness",value:((o=t.oceanTraits)==null?void 0:o.agreeableness)||50},{trait:"Neuroticism",value:((s=t.oceanTraits)==null?void 0:s.neuroticism)||50}];return a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-80",children:a.jsx(Hc,{width:"100%",height:"100%",children:a.jsxs(A$e,{outerRadius:90,data:e,children:[a.jsx(gK,{}),a.jsx(uh,{dataKey:"trait"}),a.jsx(lh,{domain:[0,100]}),a.jsx(Lg,{name:"Personality",dataKey:"value",stroke:"#8884d8",fill:"#8884d8",fillOpacity:.5})]})})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Openness to Experience"}),a.jsxs("span",{className:"font-medium",children:[e[0].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${e[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[0].value>75?"Highly creative and curious":e[0].value>50?"Somewhat imaginative and open to new ideas":"Practical and prefers routine"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Conscientiousness"}),a.jsxs("span",{className:"font-medium",children:[e[1].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${e[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[1].value>75?"Highly organized and responsible":e[1].value>50?"Generally reliable and hardworking":"Spontaneous and flexible"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Extraversion"}),a.jsxs("span",{className:"font-medium",children:[e[2].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${e[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[2].value>75?"Highly sociable and outgoing":e[2].value>50?"Moderately social and talkative":"Reserved and reflective"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Agreeableness"}),a.jsxs("span",{className:"font-medium",children:[e[3].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${e[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[3].value>75?"Highly cooperative and compassionate":e[3].value>50?"Generally kind and helpful":"Competitive and challenging"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[a.jsx("span",{children:"Neuroticism"}),a.jsxs("span",{className:"font-medium",children:[e[4].value,"%"]})]}),a.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:a.jsx("div",{className:"h-full bg-red-500 rounded-full",style:{width:`${e[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e[4].value>75?"Highly sensitive and prone to stress":e[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function GLe({persona:t}){var r;const e=(i,o)=>{const s=[a.jsx(eZ,{className:"sidebar-icon"},"grid"),a.jsx(lZ,{className:"sidebar-icon"},"smartphone"),a.jsx(ZJ,{className:"sidebar-icon"},"laptop"),a.jsx(XJ,{className:"sidebar-icon"},"grid2x2")];return s[o%s.length]},n=()=>t.scenarioType?t.scenarioType:"Life Scenarios";return a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:n()}),a.jsx("div",{className:"space-y-4",children:(r=t.scenarios)==null?void 0:r.map((i,o)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[e(i,o),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",o+1]}),a.jsx("p",{className:"text-sm",children:i})]})]})},o))})]})})}function VLe(){const t=ar();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(gt,{className:"w-96 text-center p-6",children:[a.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Persona Not Found"}),a.jsx("p",{className:"text-muted-foreground mb-6",children:"The persona you're looking for couldn't be found."}),a.jsx(J,{onClick:()=>t("/synthetic-users"),children:"Return to Personas"})]})})}function Bt({className:t,...e}){return a.jsx("div",{className:Ne("animate-pulse rounded-md bg-muted",t),...e})}function KLe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(Bt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(Bt,{className:"h-8 w-48 mx-auto"}),a.jsx(Bt,{className:"absolute right-0 top-0 h-10 w-32"})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsxs(gt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(Bt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-6 w-32 mb-2"}),a.jsx(Bt,{className:"h-4 w-24"})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-20 mb-2"}),a.jsx(Bt,{className:"h-3 w-40 mb-1"}),a.jsx(Bt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-16 mb-2"}),a.jsx(Bt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-16 mb-2"}),a.jsx(Bt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Bt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Bt,{className:"h-4 w-12 mb-2"}),a.jsx(Bt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Bt,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((t,e)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(Bt,{className:"h-3 w-24"}),a.jsx(Bt,{className:"h-3 w-8"})]}),a.jsx(Bt,{className:"h-1.5 w-full rounded-full"})]},e))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Bt,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((t,e)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(Bt,{className:"h-4 w-4 mr-2"}),a.jsx(Bt,{className:"h-3 w-40"})]},e))})]})]})]})}),a.jsxs("div",{className:"lg:col-span-2",children:[a.jsxs("div",{className:"grid w-full grid-cols-3 gap-2 mb-6",children:[a.jsx(Bt,{className:"h-10 w-full"}),a.jsx(Bt,{className:"h-10 w-full"}),a.jsx(Bt,{className:"h-10 w-full"})]}),a.jsx(gt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(Bt,{className:"h-6 w-48"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Bt,{className:"h-6 w-32"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Bt,{className:"h-6 w-40"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-full"}),a.jsx(Bt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function WLe({message:t,onLoginSuccess:e,onCancel:n}){const{login:r}=Xs(),i=ar(),[o,s]=v.useState("user"),[c,l]=v.useState("pass"),[u,d]=v.useState(!1),f=async()=>{if(!o||!c){re.error("Please enter username and password");return}d(!0);try{await r(o,c),re.success("Login successful"),e&&e()}catch(p){console.error("Login error:",p),re.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():i("/synthetic-users")};return a.jsxs(gt,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(ji,{children:[a.jsx(Wi,{children:"Login Required"}),a.jsx(uN,{children:t||"You need to log in to save personas to the database"})]}),a.jsxs(Rt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mo,{htmlFor:"username",children:"Username"}),a.jsx(Ht,{id:"username",placeholder:"Username",value:o,onChange:p=>s(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mo,{htmlFor:"password",children:"Password"}),a.jsx(Ht,{id:"password",type:"password",placeholder:"Password",value:c,onChange:p=>l(p.target.value),disabled:u})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Default credentials: user / pass"})]}),a.jsxs(dN,{className:"flex justify-between",children:[a.jsx(J,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(J,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function qLe({persona:t,onSave:e,onCancel:n}){var j,P,k,O,E,I,D,z,$,G,R,L,W,Y,te,me;const r={...t,education:t.education||"",interests:t.interests||"",brandLoyalty:t.brandLoyalty||0,priceConsciousness:t.priceConsciousness||0,environmentalConcern:t.environmentalConcern||0,hasPurchasingPower:t.hasPurchasingPower||!1,hasChildren:t.hasChildren||!1,goals:t.goals||[],frustrations:t.frustrations||[],motivations:t.motivations||[],scenarios:t.scenarios||[],oceanTraits:t.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:t.thinkFeelDo||{thinks:[],feels:[],does:[]}},[i,o]=v.useState(r),[s,c]=v.useState(!1),[l,u]=v.useState(!1),[d,f]=v.useState(null);v.useState(!1);const{isAuthenticated:h,token:p}=Xs();v.useEffect(()=>{(async()=>{l&&h&&p&&(u(!1),d&&await A())})()},[h,p,l]);const g=(F,se)=>{o(ne=>({...ne,[F]:se}))},m=(F,se)=>{o(ne=>({...ne,oceanTraits:{...ne.oceanTraits,[F]:se}}))},y=F=>{o(se=>({...se,[F]:[...se[F]||[],""]}))},b=(F,se,ne)=>{o(ae=>{const De=[...ae[F]||[]];return De[se]=ne,{...ae,[F]:De}})},x=(F,se)=>{o(ne=>{const ae=[...ne[F]||[]];return ae.splice(se,1),{...ne,[F]:ae}})},w=(F,se,ne)=>{o(ae=>{const De={...ae.thinkFeelDo},de=[...De[F]||[]];return de[se]=ne,De[F]=de,{...ae,thinkFeelDo:De}})},S=F=>{o(se=>{var ae;const ne={...se.thinkFeelDo,[F]:[...((ae=se.thinkFeelDo)==null?void 0:ae[F])||[],""]};return{...se,thinkFeelDo:ne}})},C=(F,se)=>{o(ne=>{const ae={...ne.thinkFeelDo},De=[...ae[F]||[]];return De.splice(se,1),ae[F]=De,{...ne,thinkFeelDo:ae}})},_=()=>{d&&(re.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},A=async()=>{if(d){c(!0);try{const F={...d};delete F._id,delete F.isDbPersona;const se=await zr.create(F),ne={...d,id:se.data._id||se.data.id,_id:se.data._id||se.data.id,isDbPersona:!0};re.success("Persona saved to database successfully"),u(!1),f(null),e(ne)}catch(F){console.error("Error saving after login:",F),re.error("Failed to save to database after login"),u(!1),f(null)}finally{c(!1)}}};return l?a.jsxs("div",{className:"max-w-5xl mx-auto bg-background p-6",children:[a.jsx("div",{className:"flex justify-between items-center mb-6",children:a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Authentication Required"})}),a.jsx("p",{className:"mb-6 text-muted-foreground",children:"Login is required to save personas to the database. You can either:"}),a.jsxs("ul",{className:"list-disc ml-6 mt-2 mb-6",children:[a.jsx("li",{children:"Log in to save this persona to the database"}),a.jsx("li",{children:"Cancel to discard your changes"})]}),a.jsx(WLe,{message:"Login is required to save your persona to the database",onLoginSuccess:A,onCancel:_})]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center",children:[a.jsx(J,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(Kp,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(J,{onClick:async()=>{c(!0);try{const F=i._id||i.id,se={...i};se._id&&delete se._id,delete se.isDbPersona;let ne;if(F&&typeof F=="string"&&F.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),ne=await zr.create(se),re.success("Persona saved to database");const ae={...i,id:ne.data._id||ne.data.id,_id:ne.data._id||ne.data.id,isDbPersona:!0};e(ae)}else if(F){ne=await zr.update(F,se),re.success("Persona updated successfully");const ae={...i,isDbPersona:!0};e(ae)}else{ne=await zr.create(se);const ae={...i,id:ne.data._id||ne.data.id,_id:ne.data._id||ne.data.id,isDbPersona:!0};re.success("Persona created successfully"),e(ae)}}catch(F){console.error("Error saving persona:",F),F.response&&F.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),re.error("Authentication error - saving locally instead"),e(i)):(f(i),u(!0)):(re.error("Failed to save persona"),e(i))}finally{c(!1)}},disabled:s,children:[s?a.jsx(Ds,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(DE,{className:"h-4 w-4 mr-2"}),s?"Saving...":"Save Changes"]})]}),a.jsxs(dl,{defaultValue:"basic",children:[a.jsxs(Va,{className:"grid w-full grid-cols-6",children:[a.jsx(gn,{value:"basic",children:"Basic"}),a.jsx(gn,{value:"cooper",children:"Cooper"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"demographics",children:"Demographics"}),a.jsx(gn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(gn,{value:"extended",children:"Extended"})]}),a.jsx(vn,{value:"basic",className:"mt-6",children:a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Name"}),a.jsx(Ht,{value:i.name||"",onChange:F=>g("name",F.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Age Range"}),a.jsxs(Un,{value:i.age||"",onValueChange:F=>g("age",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select age range"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"18-24",children:"18-24"}),a.jsx(oe,{value:"25-34",children:"25-34"}),a.jsx(oe,{value:"35-44",children:"35-44"}),a.jsx(oe,{value:"45-54",children:"45-54"}),a.jsx(oe,{value:"55-64",children:"55-64"}),a.jsx(oe,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(Un,{value:i.gender||"",onValueChange:F=>g("gender",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select gender"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Male",children:"Male"}),a.jsx(oe,{value:"Female",children:"Female"}),a.jsx(oe,{value:"Non-binary",children:"Non-binary"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(Ht,{value:i.occupation||"",onChange:F=>g("occupation",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(Un,{value:i.education||"",onValueChange:F=>g("education",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select education level"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"High School",children:"High School"}),a.jsx(oe,{value:"Some College",children:"Some College"}),a.jsx(oe,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(oe,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(oe,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(oe,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(Ht,{value:i.location||"",onChange:F=>g("location",F.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(Un,{value:i.ethnicity||"",onValueChange:F=>g("ethnicity",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select ethnicity"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"white",children:"White"}),a.jsx(oe,{value:"black",children:"Black"}),a.jsx(oe,{value:"asian",children:"Asian"}),a.jsx(oe,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(oe,{value:"native-american",children:"Native American"}),a.jsx(oe,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(oe,{value:"mixed",children:"Mixed"}),a.jsx(oe,{value:"other",children:"Other"}),a.jsx(oe,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personality"}),a.jsx(mt,{value:i.personality||"",onChange:F=>g("personality",F.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(mt,{value:i.interests||"",onChange:F=>g("interests",F.target.value),rows:3,placeholder:"Tech, travel, cooking, etc."})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm",children:[i.techSavviness,"%"]})]}),a.jsx(br,{value:[i.techSavviness],onValueChange:F=>g("techSavviness",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm",children:[i.brandLoyalty||0,"%"]})]}),a.jsx(br,{value:[i.brandLoyalty||0],onValueChange:F=>g("brandLoyalty",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm",children:[i.priceConsciousness||0,"%"]})]}),a.jsx(br,{value:[i.priceConsciousness||0],onValueChange:F=>g("priceConsciousness",F[0]),max:100,step:1})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm",children:[i.environmentalConcern||0,"%"]})]}),a.jsx(br,{value:[i.environmentalConcern||0],onValueChange:F=>g("environmentalConcern",F[0]),max:100,step:1})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Purchasing Power"}),a.jsx(ym,{checked:i.hasPurchasingPower||!1,onCheckedChange:F=>g("hasPurchasingPower",F)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(ym,{checked:i.hasChildren||!1,onCheckedChange:F=>g("hasChildren",F)})]})]})]})]})})})}),a.jsxs(vn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(i.goals||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("goals",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("goals",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("goals"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(i.frustrations||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("frustrations",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("frustrations",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("frustrations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),a.jsxs("div",{className:"mb-4 pt-4 border-t",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(i.motivations||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>b("motivations",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("motivations",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("motivations"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),(((j=i.thinkFeelDo)==null?void 0:j.thinks)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("thinks",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("thinks",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("thinks"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),(((P=i.thinkFeelDo)==null?void 0:P.feels)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("feels",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("feels",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("feels"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),(((k=i.thinkFeelDo)==null?void 0:k.does)||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F||"",onChange:ne=>w("does",se,ne.target.value)}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>C("does",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>S("does"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("div",{className:"space-y-4 mb-6",children:a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Scenario Section Title"}),a.jsx(Ht,{value:i.scenarioType||"",onChange:F=>g("scenarioType",F.target.value),placeholder:"Life Scenarios"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'})]})}),a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(i.scenarios||[]).map((F,se)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(mt,{value:F||"",onChange:ne=>b("scenarios",se,ne.target.value),rows:2}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("scenarios",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("scenarios"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),a.jsxs("span",{className:"text-sm",children:[((O=i.oceanTraits)==null?void 0:O.openness)||50,"%"]})]}),a.jsx(br,{value:[((E=i.oceanTraits)==null?void 0:E.openness)||50],onValueChange:F=>m("openness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),a.jsxs("span",{className:"text-sm",children:[((I=i.oceanTraits)==null?void 0:I.conscientiousness)||50,"%"]})]}),a.jsx(br,{value:[((D=i.oceanTraits)==null?void 0:D.conscientiousness)||50],onValueChange:F=>m("conscientiousness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),a.jsxs("span",{className:"text-sm",children:[((z=i.oceanTraits)==null?void 0:z.extraversion)||50,"%"]})]}),a.jsx(br,{value:[(($=i.oceanTraits)==null?void 0:$.extraversion)||50],onValueChange:F=>m("extraversion",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),a.jsxs("span",{className:"text-sm",children:[((G=i.oceanTraits)==null?void 0:G.agreeableness)||50,"%"]})]}),a.jsx(br,{value:[((R=i.oceanTraits)==null?void 0:R.agreeableness)||50],onValueChange:F=>m("agreeableness",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[((L=i.oceanTraits)==null?void 0:L.neuroticism)||50,"%"]})]}),a.jsx(br,{value:[((W=i.oceanTraits)==null?void 0:W.neuroticism)||50],onValueChange:F=>m("neuroticism",F[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),a.jsx(vn,{value:"demographics",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Grade"}),a.jsxs(Un,{value:i.socialGrade||"",onValueChange:F=>g("socialGrade",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select social grade"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"A",children:"A - Higher managerial"}),a.jsx(oe,{value:"B",children:"B - Intermediate managerial"}),a.jsx(oe,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(oe,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(oe,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(oe,{value:"E",children:"E - State pensioners, unemployed"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Income"}),a.jsxs(Un,{value:i.householdIncome||"",onValueChange:F=>g("householdIncome",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select income range"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Under $25k",children:"Under $25,000"}),a.jsx(oe,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(oe,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(oe,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(oe,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(oe,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(oe,{value:"Over $250k",children:"Over $250,000"}),a.jsx(oe,{value:"Prefer not to say",children:"Prefer not to say"})]})]})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Composition"}),a.jsxs(Un,{value:i.householdComposition||"",onValueChange:F=>g("householdComposition",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select household type"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Single person",children:"Single person"}),a.jsx(oe,{value:"Couple without children",children:"Couple without children"}),a.jsx(oe,{value:"Couple with children",children:"Couple with children"}),a.jsx(oe,{value:"Single parent",children:"Single parent"}),a.jsx(oe,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(oe,{value:"Shared housing",children:"Shared housing"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(Un,{value:i.livingSituation||"",onValueChange:F=>g("livingSituation",F),children:[a.jsx(Ln,{children:a.jsx(Hn,{placeholder:"Select living situation"})}),a.jsxs(Fn,{children:[a.jsx(oe,{value:"Own home",children:"Own home"}),a.jsx(oe,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(oe,{value:"Rent house",children:"Rent house"}),a.jsx(oe,{value:"Live with family",children:"Live with family"}),a.jsx(oe,{value:"Student housing",children:"Student housing"}),a.jsx(oe,{value:"Assisted living",children:"Assisted living"}),a.jsx(oe,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(vn,{value:"lifestyle",className:"mt-6",children:a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Media Consumption"}),a.jsx(mt,{value:i.mediaConsumption||"",onChange:F=>g("mediaConsumption",F.target.value),rows:3,placeholder:"TV shows, podcasts, news sources, social media platforms"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Describe media consumption habits and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Device Usage"}),a.jsx(mt,{value:i.deviceUsage||"",onChange:F=>g("deviceUsage",F.target.value),rows:3,placeholder:"Smartphone, laptop, tablet, smart TV, gaming console"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Primary devices and usage patterns"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Shopping Habits"}),a.jsx(mt,{value:i.shoppingHabits||"",onChange:F=>g("shoppingHabits",F.target.value),rows:3,placeholder:"Online vs in-store, frequency, preferred retailers"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shopping behavior and preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Brand Preferences"}),a.jsx(mt,{value:i.brandPreferences||"",onChange:F=>g("brandPreferences",F.target.value),rows:3,placeholder:"Favorite brands, brand values alignment"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred brands and reasoning"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Communication Preferences"}),a.jsx(mt,{value:i.communicationPreferences||"",onChange:F=>g("communicationPreferences",F.target.value),rows:3,placeholder:"Email, phone, text, video calls, in-person"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred communication methods and channels"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Payment Methods"}),a.jsx(mt,{value:i.paymentMethods||"",onChange:F=>g("paymentMethods",F.target.value),rows:3,placeholder:"Credit cards, digital wallets, cash, BNPL"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred payment methods and financial tools"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Purchase Behavior"}),a.jsx(mt,{value:i.purchaseBehaviour||"",onChange:F=>g("purchaseBehaviour",F.target.value),rows:3,placeholder:"Research habits, decision factors, impulse vs planned buying"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"How they approach making purchase decisions"})]})]})]})]})})}),a.jsxs(vn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(gt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Core Values"}),a.jsx(mt,{value:i.coreValues||"",onChange:F=>g("coreValues",F.target.value),rows:3,placeholder:"Key principles and values that guide decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Lifestyle Choices"}),a.jsx(mt,{value:i.lifestyleChoices||"",onChange:F=>g("lifestyleChoices",F.target.value),rows:3,placeholder:"Health, fitness, diet, work-life balance preferences"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Activities"}),a.jsx(mt,{value:i.socialActivities||"",onChange:F=>g("socialActivities",F.target.value),rows:3,placeholder:"Social hobbies, community involvement, networking"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Category Knowledge"}),a.jsx(mt,{value:i.categoryKnowledge||"",onChange:F=>g("categoryKnowledge",F.target.value),rows:3,placeholder:"Expertise in specific product/service categories"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Decision Influences"}),a.jsx(mt,{value:i.decisionInfluences||"",onChange:F=>g("decisionInfluences",F.target.value),rows:3,placeholder:"What factors most influence their decisions"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Pain Points"}),a.jsx(mt,{value:i.painPoints||"",onChange:F=>g("painPoints",F.target.value),rows:3,placeholder:"Common challenges and friction points"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Journey Context"}),a.jsx(mt,{value:i.journeyContext||"",onChange:F=>g("journeyContext",F.target.value),rows:3,placeholder:"Current life stage and contextual factors"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Key Touchpoints"}),a.jsx(mt,{value:i.keyTouchpoints||"",onChange:F=>g("keyTouchpoints",F.target.value),rows:3,placeholder:"Important interaction points and channels"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Autonomy"}),a.jsx(mt,{value:((Y=i.selfDeterminationNeeds)==null?void 0:Y.autonomy)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,autonomy:F.target.value}),rows:2,placeholder:"Need for independence and self-direction"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Competence"}),a.jsx(mt,{value:((te=i.selfDeterminationNeeds)==null?void 0:te.competence)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,competence:F.target.value}),rows:2,placeholder:"Need to feel capable and effective"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Relatedness"}),a.jsx(mt,{value:((me=i.selfDeterminationNeeds)==null?void 0:me.relatedness)||"",onChange:F=>g("selfDeterminationNeeds",{...i.selfDeterminationNeeds,relatedness:F.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(gt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(i.fears||[]).map((F,se)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Ht,{value:F,onChange:ne=>b("fears",se,ne.target.value),placeholder:"Enter a fear or concern"}),a.jsx(J,{variant:"ghost",size:"icon",onClick:()=>x("fears",se),children:a.jsx(nr,{className:"h-4 w-4 text-muted-foreground"})})]},se)),a.jsxs(J,{variant:"outline",size:"sm",onClick:()=>y("fears"),className:"mt-2",children:[a.jsx(Ur,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personal Narrative"}),a.jsx(mt,{value:i.narrative||"",onChange:F=>g("narrative",F.target.value),rows:4,placeholder:"Personal story, background, key life experiences"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A brief narrative that captures their personal story"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Additional Information"}),a.jsx(mt,{value:i.additionalInformation||"",onChange:F=>g("additionalInformation",F.target.value),rows:4,placeholder:"Any other relevant details or context"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Additional context or details not covered elsewhere"})]})]})})})]})]})]})}function YLe(){const{id:t}=OE(),e=Fi(),n=ar(),{navigationState:r,clearNavigationState:i}=ow(),[o,s]=v.useState(void 0),[c,l]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(!0);return v.useEffect(()=>{if(!t){h(!1);return}let m=!0;const b=new URLSearchParams(e.search).get("fromReview")==="true";return l(b),h(!0),(async()=>{try{const w=t.startsWith("local-")?t.substring(6):t,S=await zr.getById(w);if(S&&S.data){const C=S.data;if(m){console.log("Found persona in database:",C),s({...C,id:C.id||C._id,isDbPersona:!0}),h(!1);return}}console.error("Could not find persona with id:",t),m&&(s(void 0),h(!1),re.error("Persona not found"))}catch(w){console.error("Error fetching persona:",w),m&&(s(void 0),h(!1),re.error("Failed to load persona details"))}})(),()=>{m=!1}},[t,e.search]),{currentPersona:o,isEditing:u,isFromReview:c,isLoading:f,setIsEditing:d,handleGoBack:()=>{r.previousRoute&&r.previousRoute.startsWith("/focus-groups/")&&r.focusGroupId?n(`/focus-groups/${r.focusGroupId}`):r.previousRoute==="/focus-groups"&&r.focusGroupTab?r.isNewFocusGroup?n(`/focus-groups?mode=create&tab=${r.focusGroupTab}`):r.focusGroupId?n(`/focus-groups?mode=edit&id=${r.focusGroupId}&tab=${r.focusGroupTab}`):n("/focus-groups?mode=create&tab=participants"):n(c?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async m=>{try{d(!1);const y=m.isDbPersona||t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t),b={...m};if(b._id&&delete b._id,delete b.isDbPersona,y&&t&&t.length===24&&/^[0-9a-f]{24}$/i.test(t)){const x=await zr.update(t,b);console.log("Updated persona in database:",x);const w={...m,isDbPersona:!0};s(w),re.success("Persona updated in database successfully")}else{const x=await zr.create(b);console.log("Created new persona in database:",x.data);const w={...m,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};s(w),re.success("Persona saved to database successfully")}}catch(y){return console.error("Error saving persona:",y),y.response&&y.response.status===401?re.error("Authentication error - Please log in to save personas"):y.response&&y.response.status===404?re.error("API endpoint not found - Database service may be unavailable"):re.error("Failed to save persona to database: "+(y.message||"Unknown error")),!1}return!0}}}function F$(){var f;const{currentPersona:t,isEditing:e,isFromReview:n,isLoading:r,setIsEditing:i,handleGoBack:o,handleSaveEdit:s}=YLe(),{navigationState:c}=ow(),[l,u]=v.useState("");v.useEffect(()=>{var h;c.focusGroupId&&((h=c.previousRoute)!=null&&h.startsWith("/focus-groups/"))&&(async()=>{var g;try{const m=await Ot.getById(c.focusGroupId);(g=m==null?void 0:m.data)!=null&&g.name&&u(m.data.name)}catch(m){console.error("Error fetching focus group name:",m)}})()},[c.focusGroupId,c.previousRoute]);const d=((f=c.previousRoute)==null?void 0:f.startsWith("/focus-groups/"))&&c.focusGroupId;return r?a.jsx(KLe,{}):t?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Aa,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:e?a.jsx(qLe,{persona:t,onSave:s,onCancel:()=>i(!1)}):a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{className:"mb-4",children:a.jsx(LW,{children:a.jsxs(FW,{children:[a.jsx(hy,{children:a.jsxs(mj,{href:"/focus-groups",className:"flex items-center",children:[a.jsx(Vy,{className:"h-4 w-4 mr-1"}),"Focus Groups"]})}),a.jsx(gj,{}),a.jsx(hy,{children:a.jsxs(mj,{href:`/focus-groups/${c.focusGroupId}`,className:"flex items-center",children:[a.jsx(Dr,{className:"h-4 w-4 mr-1"}),l||"Focus Group Session"]})}),a.jsx(gj,{}),a.jsx(hy,{children:a.jsxs(BW,{className:"flex items-center",children:[a.jsx(qp,{className:"h-4 w-4 mr-1"}),(t==null?void 0:t.name)||"Participant"]})})]})})}),a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(J,{variant:"ghost",onClick:o,className:"absolute left-0 top-0 flex items-center",children:a.jsx(Kp,{className:"h-5 w-5"})}),a.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900 mx-auto",children:"Persona Profile"}),a.jsxs(J,{onClick:()=>i(!0),className:"absolute right-0 top-0",children:[a.jsx(dZ,{className:"h-4 w-4 mr-2"}),"Edit Persona"]})]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[a.jsx("div",{className:"lg:col-span-1",children:a.jsx(ULe,{persona:t})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(dl,{defaultValue:"cooper-profile",children:[a.jsxs(Va,{className:"grid w-full grid-cols-3",children:[a.jsx(gn,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(gn,{value:"personality",children:"Personality"}),a.jsx(gn,{value:"scenarios",children:"Scenarios"})]}),a.jsx(vn,{value:"cooper-profile",className:"mt-6",children:a.jsx(HLe,{persona:t})}),a.jsx(vn,{value:"personality",className:"mt-6",children:a.jsx(zLe,{persona:t})}),a.jsx(vn,{value:"scenarios",className:"mt-6",children:a.jsx(GLe,{persona:t})})]})})]})]})})]}):a.jsx(VLe,{})}const QLe=Oe.object({username:Oe.string().min(3,"Username must be at least 3 characters"),password:Oe.string().min(4,"Password must be at least 4 characters")});function XLe(){var h;const t=ar(),e=Fi(),{login:n,loginWithMicrosoft:r,isAuthenticated:i,isMsalLoading:o}=Xs(),[s,c]=v.useState(!1),l=((h=e.state)==null?void 0:h.from)||"/";console.log("Login page - destination path:",l),v.useEffect(()=>{i&&(console.log("User already authenticated, redirecting from login page"),t("/",{replace:!0}))},[i,t]);const u=z0({resolver:G0(QLe),defaultValues:{username:"",password:""}});async function d(p){c(!0);try{await n(p.username,p.password)?(console.log("Login successful, received token, navigating to:",l),t(l,{replace:!0})):(console.error("Login succeeded but no token received"),c(!1))}catch(g){console.error("Login error in form handler:",g),c(!1)}}async function f(){try{await r(),console.log("Microsoft login successful, navigating to:",l),t(l,{replace:!0})}catch(p){console.error("Microsoft login error in form handler:",p)}}return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-gray-100 to-gray-200 dark:from-gray-900 dark:to-gray-800 px-4",children:a.jsxs(gt,{className:"w-full max-w-md",children:[a.jsxs(ji,{className:"space-y-1",children:[a.jsx(Wi,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(uN,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsxs(Rt,{children:[a.jsx("div",{className:"mb-6",children:a.jsx(J,{type:"button",variant:"outline",className:"w-full bg-[#0078d4] hover:bg-[#106ebe] text-white border-[#0078d4] hover:border-[#106ebe]",onClick:f,disabled:s||o,children:o?a.jsxs(a.Fragment,{children:[a.jsx(Ds,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing in with Microsoft..."]}):a.jsxs(a.Fragment,{children:[a.jsxs("svg",{className:"mr-2 h-4 w-4",viewBox:"0 0 21 21",fill:"currentColor",children:[a.jsx("path",{d:"M10 0H0v10h10V0z"}),a.jsx("path",{d:"M21 0H11v10h10V0z"}),a.jsx("path",{d:"M10 11H0v10h10V11z"}),a.jsx("path",{d:"M21 11H11v10h10V11z"})]}),"Sign in with Microsoft"]})})}),a.jsxs("div",{className:"relative mb-6",children:[a.jsx("div",{className:"absolute inset-0 flex items-center",children:a.jsx("div",{className:"w-full border-t border-gray-200"})}),a.jsx("div",{className:"relative flex justify-center text-sm",children:a.jsx("span",{className:"bg-white px-2 text-gray-500 dark:bg-gray-800 dark:text-gray-400",children:"Or continue with username"})})]}),a.jsx(K0,{...u,children:a.jsxs("form",{onSubmit:u.handleSubmit(d),className:"space-y-4",children:[a.jsx(vt,{control:u.control,name:"username",render:({field:p})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Username"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Enter your username",...p,disabled:s,autoComplete:"username"})}),a.jsx(pt,{})]})}),a.jsx(vt,{control:u.control,name:"password",render:({field:p})=>a.jsxs(dt,{children:[a.jsx(ft,{children:"Password"}),a.jsx(ht,{children:a.jsx(Ht,{placeholder:"Enter your password",type:"password",...p,disabled:s,autoComplete:"current-password"})}),a.jsx(pt,{})]})}),a.jsx(J,{type:"submit",className:"w-full",disabled:s||o,children:s?"Signing in...":"Sign In"})]})})]}),a.jsxs(dN,{className:"flex flex-col space-y-2",children:[a.jsx("div",{className:"text-sm text-center text-gray-500 mb-2",children:"Default account: user / pass"}),!s&&!o&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(J,{variant:"outline",onClick:()=>t("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(J,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const p={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(p)),qe.success("Offline mode activated",{description:"Using demo account with limited functionality"}),t("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function Ku({children:t}){const{isAuthenticated:e,isLoading:n}=Xs(),r=Fi();return console.log("ProtectedRoute check:",{isAuthenticated:e,isLoading:n,path:r.pathname}),n?a.jsx("div",{className:"flex items-center justify-center min-h-screen",children:a.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"})}):e?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:t})):(console.log("Not authenticated, redirecting to login"),a.jsx(c5,{to:"/login",state:{from:r.pathname},replace:!0}))}const JLe=v.createContext({});let B$=!1;function ZLe({children:t}){const{token:e}=Xs(),n=()=>{const i=e||localStorage.getItem("auth_token");return console.log("🔧 [GPT-5 Context] Getting token:",i?"Found":"Missing"),i||""};v.useEffect(()=>(B$||(console.log("🔧 [GPT-5 Context] Initializing singleton socket"),DW(n),B$=!0),console.log("🔧 [GPT-5 Context] Connecting socket"),$W(),()=>{}),[e]);const r={};return a.jsx(JLe.Provider,{value:r,children:t})}const UW=new YT(Yie);UW.initialize().catch(t=>{console.error("MSAL initialization error:",t)});function eFe({children:t}){return a.jsx(Wie,{instance:UW,children:t})}const tFe=new $X,nFe=()=>a.jsx(FX,{client:tFe,children:a.jsx(MJ,{basename:"/semblance",children:a.jsx(eFe,{children:a.jsx(Xie,{children:a.jsx(ZLe,{children:a.jsx(rde,{children:a.jsxs(pX,{children:[a.jsx(H9,{}),a.jsxs(EJ,{children:[a.jsx(Mo,{path:"/",element:a.jsx(Zie,{})}),a.jsx(Mo,{path:"/login",element:a.jsx(XLe,{})}),a.jsx(Mo,{path:"/synthetic-users",element:a.jsx(Ku,{children:a.jsx(nde,{})})}),a.jsx(Mo,{path:"/synthetic-users/:id",element:a.jsx(Ku,{children:a.jsx(F$,{})})}),a.jsx(Mo,{path:"/personas/:id",element:a.jsx(Ku,{children:a.jsx(F$,{})})}),a.jsx(Mo,{path:"/focus-groups",element:a.jsx(Ku,{children:a.jsx(lde,{})})}),a.jsx(Mo,{path:"/focus-groups/:id",element:a.jsx(Ku,{children:a.jsx(PLe,{})})}),a.jsx(Mo,{path:"/dashboard",element:a.jsx(Ku,{children:a.jsx(BLe,{})})}),a.jsx(Mo,{path:"/old-path",element:a.jsx(c5,{to:"/",replace:!0})}),a.jsx(Mo,{path:"*",element:a.jsx(eoe,{})})]})]})})})})})})});l4(document.getElementById("root")).render(a.jsx(nFe,{})); diff --git a/dist/index.html b/dist/index.html index c19a9a95..318a60db 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,7 +7,7 @@ - + diff --git a/src/pages/FocusGroupSession.tsx b/src/pages/FocusGroupSession.tsx index 03d14103..6c4d2369 100644 --- a/src/pages/FocusGroupSession.tsx +++ b/src/pages/FocusGroupSession.tsx @@ -2198,6 +2198,12 @@ const FocusGroupSession = () => { }; // Send to API first with visual asset information + console.log('📤 Sending moderator message to API:', { + text: enhancedMessageText, + attachedAssets, + activatesVisualContext + }); + try { const msgResponse = await focusGroupsApi.sendMessage(id, { senderId: 'moderator', @@ -2209,18 +2215,31 @@ const FocusGroupSession = () => { if (msgResponse?.data?.message_id) { moderatorMessage.id = msgResponse.data.message_id; + console.log('✅ Message API call successful, assigned ID:', moderatorMessage.id); + } else { + console.warn('⚠️ Message API call succeeded but no message_id returned:', msgResponse?.data); } } catch (msgError) { - console.warn("Failed to save message to API, showing locally:", msgError); + console.error('❌ Failed to save message to API:', msgError); + toastService.warning('Message display only', { + description: 'The moderator message is shown locally but may not be saved to the server.' + }); } // Add the message to the UI + console.log('📨 Adding moderator message to UI:', { + messageId: moderatorMessage.id, + text: moderatorMessage.text, + hasAssets: attachedAssets.length > 0 + }); handleNewMessage(moderatorMessage); // Close dialog first for immediate feedback setSetPositionDialog({ isOpen: false }); - // Note: Moderator status will be updated automatically via WebSocket event + // Don't fetch moderator status immediately to avoid race condition + // The status will update via WebSocket or next polling cycle + console.log('✅ Set position complete, moderator message added to UI'); toastService.success('Moderator position set', { description: `Position set to "${setPositionDialog.itemTitle}" in "${setPositionDialog.sectionTitle}"`