From ece469d15e6f6338b3a43bf27e97e05e0e245337 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 26 Aug 2025 14:15:50 -0500 Subject: [PATCH] added generation prompt tracking and viewing in persona detail view (new tab) for audience brief and research objective --- .gitignore | 6 +- .../__pycache__/ai_personas.cpython-313.pyc | Bin 41989 -> 43226 bytes backend/app/routes/ai_personas.py | 24 +- dist/assets/index-D1F9eUHr.js | 729 ------------------ dist/assets/index-QYazl09u.css | 1 - dist/index.html | 4 +- .../persona/PersonaGenerationPrompts.tsx | 62 ++ src/components/persona/PersonaProfile.tsx | 10 +- src/lib/api.ts | 17 +- src/types/persona.ts | 4 + 10 files changed, 119 insertions(+), 738 deletions(-) delete mode 100644 dist/assets/index-D1F9eUHr.js delete mode 100644 dist/assets/index-QYazl09u.css create mode 100644 src/components/persona/PersonaGenerationPrompts.tsx diff --git a/.gitignore b/.gitignore index 4bae2983..d048741b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ venv/ -*pycache*/ +dist/ + +# Ignore Python cache files +__pycache__/ +*.py[cod] diff --git a/backend/app/routes/__pycache__/ai_personas.cpython-313.pyc b/backend/app/routes/__pycache__/ai_personas.cpython-313.pyc index a7e5159df4a697518644b5944e2fc4aa745fab6e..a09d39ebb86ff89cb11bec7db616f1ef3941841d 100644 GIT binary patch delta 3449 zcmb7`dr(x@9mnsv`(k(51?90k6fU^1timE90vk;NHCRwr;Ibet50~A$@{qfD7EB}p zKBC4ZHpr1o9$Funwm3FP?RHwzPG`*2q*T$l6!MsD#<5fVqyKc6Xq{>QNP2#kU0F0~ z(mS)C^E>DK&iDMz?|1Lrdt{OgO|!=P27`{F*S&wg+j-%g%SKn4UQfFU`nzw_jJ;tZ z+;M;#ZU_M4eN|n^knespZWUXmxx}xStd5=Z5>a(2pENO;c@gYQuMlp8Qs8T*t3+ zYM-J$ZhAvey;WK!s*uYVX8S%qE?R?1Ns98}C8i{*frVQo}M2C}EbMCR&shLT02McO3my0vV8 zm3J{z7|gI6ZGC7_pwB&~UAjmmti863FXxpuHj+C2Ta+X5TkY;*mSiP86}+DL96N$j z=wWas#Xup&+}TqnxJtLDM-aVsZj&Gi*xldd7r8#{@9paka9HpNU3&#D=ksIEGRRu& zgGn666>t>;-Y!A(2wWxZ5`1tL!ZP*1(x*we{v>*y9d{d5yMH?Zc3m>hm?*LQ^#LY81$b`KgED3RBbGYe;` z@Oo+V?r^m29S|+o@8|ji9Po>7&g<@Xb9uvqn)xWL1LfZ$0jGm_+x?MvpO9hmhJ%AE zQV>cYmz`;PI1F9~C?W5eSCQLh6Ec#A<^t`bB9QEy6-F1hz~dS)Qjot@B@!VgUEe`F zr(x8hB(LO*Ca9Ujtj`k6(+TEtjT6l?38e?NkaU06$U`*~ll*DwsxM*;Qv5SlW3LQP z)=S3P*_b+cBiCBYQ_0q{QbW`1j@H>Wx75)$)3#@32cB-g(!kJP z8iwW=rjd2Av}r&s(6q3v(8RT|4;V(<&dQ?JPfM#WS||5O*5(nZ*+pd?>`qo{X`k&7 zW_?{!_x>5*&`ihhbjvVZTgle2UouQ9ssSY*+av3u-O%i2du4f%{TG$@vv=VXl~>na zwMn&glCgd^hM!YbAXN{NXB?CJCq=2HTk7eTx(6iV-dR$edu=PtL2TOR>o!W+Yo=q1 zzldETC00+Zm=tGfTBYhXsZEfU`etKy-PSMv+`dK1UN;?EDm!hR@<{dG8HXTk^+~>7 zX{k6H>n8?_AC-`w*tfCIB68F6R@+BK73}6h=Hs;$s3w{DQ%NO9d)Je7oAVXdIXY!g z+{jkZp&J$z9lDXP0J~7Opl>^ubT{ju^WRZJi>G}cMt)(9+fj*YRHDv|!%U9@a-}`u=wVMoW zOhLWD*Eilo=y~F;vZG;gwkn@yZK|qr$r$xH4;v)Wf5!vN0~;xdPbaIJnt~@cU5Xuf z9wg-GDyikb|KHZI_yxc|Kri4$z_m_-gAG!c8Lj>AK=Z&l#s z;4n-P(uZGU?OomgZXxl`-*14gG7N7*4BvnF0N^0t5a2N2CBPBDQ2>04;$wi9NlatD zUM^d>V$U=tr7h&-I5_ zt>0=|zl`8lo}cT`1@beoTK7}x@N00$B`f2LgZX~H5uFO29?~f{Y@<`SmZAYSg9*2@ zRTN#p}nX)`0Akyq?XG)L4J9- z0JW3bhku9O55D=*c~pD=mX`t+9tF8Rj}=5NL%0IHM~l)RUm-)dwt;r|m%{IZjEh`3 zy4v(BFfRh279mxKyWi7^Pmr&Vnrw3V>DNDlF9Ci5co*;lh;G(k3>x}v@Yt6GV6ym{W7BAw#}s%bhp9(-#&M~(hSuD;!e zCW1w$^AWm9+Rm7B4j|Nn?kgBJ9#Dnml=8@2Uoh*! K9i+TV{r?Nka34Yd delta 2281 zcmb7^du&rx7{Kqjx3^u}wQOu%_iXoGtJ`GR25hWiiEQlQ7?c8Afl;=O!dN>`JKit_ z8Q^$CzGwsl$2J}#KG16-0fnH34V5@z)TGfl6G_nU2gwrs%f$2DwhWC1ZPMTU9_M`L zJKuNC3EkoMjq&;^ole8CU(?QG-oWYi^sZE`im3woPbG>F?;eJxglbrmR;@5`P9EG! z16)nhCA+jZ3xAFoPNkl6#5qMhSE_*9DqC;7Y?&Fhl#}qdOwN@MmN*v3DL55Q(UDN0 z@Tp9k%ka>nVjj_vSRwdgoG}iA$Q(|U!%%?V7)Me>Pm1Wqh;BqZnv;?xmF!eSa@E3z zYQ4#k?o`cVW87?KEMB^rbEPv?{w+1Z_*}#M?s7h?`!ue!h>LS-qWQB~8IP{Q7BM}# zPq@)#m~WQ%%sW;86v2^MEJUL@vdZ{eE{k&|MORXB?gqFXGl!(W?=d-WWVeQ-GATRG z%sJA0YP-7et?(D_Rb&t?_|;}uv@21_cBR36a~53B)aY^^Syl@rYJ)Ymj1TZ~1g%}0 zi;>v3gZyRLg&gObj+ZwbuPonD;7}Cv50n0vXdRqQFmoNmYH^qHkY$)B{hYOse?PC2 zNcZ!T38dTN;hAI&m@Og{TM9B}vprKh3?XG3^|*r`8iy8ah&2|vEJZME$<{AN8}=*^ z%K+b6inObl@CI7G;o)6xE<8xCgNe8tW2M+hCXKn@87+5=mJ3OjQoc6MI}rOlTzMh{ zKRxLud9b8#v3eF4n?1$xq8mPr&xi5CO=~_$wkOtPbDtL3Nwu2$tk|B)w3}*8jaj&v zVCQR6g;9gZOrxnHGmV-Bl(RK;Dq*zHE-We+#-1Wf87tQ@-r_6kc;QwRT0ZB+I+b*y z=$L43W%<&z2sdIKq7BiG@JRKg>4Y?Zx2#y~Virz1SvIJ$K4un9O-6J;Q>oET*E4y9 zrwwSzM?8mUL@Y)$Ar>KO5lawD85*er#bt1JL>aRp)nVj}`C0xd#xg5FjWw-UvN z{iDs`v6)jhp;2B|PQZogD#UU)ZJQ%@GqF+%+3K`4|9M+D8#ncff?btGlMmW&PBNbk%^eD%uA^5L-Zl` zGlXWY_xL=N-O2XWNOA#s0KEqhFC+R9a;FcWggc=}5pv^|kpf}0wL`-i z)Y4H$*23A2&BQOIuTR56Ki69Vr)(L}=QW8Z+1S<6i1&_$oPr&JT5*6GPD{4}=k?^M z^!y%;!dAyDw4PxZU4|l_U8^Fb3iPzKc>)0{zZfm(d5xjks-Q!tgw1fduRtqj9UcL{ z_H8CPl6$|2Xyq>B*zE-{aWDl|hNQn4^0U9^;~?e3tPUX-(f!~L^Xy^Z290{ajW*SUjjUb*0*_>P`n5B0PL{n1W@ zE58>pp71IkK+2&8@gwG$kTxEg(vnwU&FeSF5M&;|th|o1 zR>H*b=CC*lwi89-m(1EL`A_62mDiZKy%fd=O5lruN-`uV&lD0e2Bm|!`EmtjVuWt{throw TypeError(t)};var HS=(t,e,n)=>e.has(t)||gO("Cannot "+n);var _e=(t,e,n)=>(HS(t,e,"read from private field"),n?n.call(t):e.get(t)),mn=(t,e,n)=>e.has(t)?gO("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),qt=(t,e,n,r)=>(HS(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Qr=(t,e,n)=>(HS(t,e,"access private method"),n);var mv=(t,e,n,r)=>({set _(i){qt(t,e,i,n)},get _(){return _e(t,e,r)}});function O7(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 gv=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gF={exports:{}},I0={},vF={exports:{}},nn={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Tg=Symbol.for("react.element"),I7=Symbol.for("react.portal"),R7=Symbol.for("react.fragment"),M7=Symbol.for("react.strict_mode"),D7=Symbol.for("react.profiler"),$7=Symbol.for("react.provider"),L7=Symbol.for("react.context"),F7=Symbol.for("react.forward_ref"),B7=Symbol.for("react.suspense"),U7=Symbol.for("react.memo"),z7=Symbol.for("react.lazy"),vO=Symbol.iterator;function H7(t){return t===null||typeof t!="object"?null:(t=vO&&t[vO]||t["@@iterator"],typeof t=="function"?t:null)}var yF={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xF=Object.assign,bF={};function Ff(t,e,n){this.props=t,this.context=e,this.refs=bF,this.updater=n||yF}Ff.prototype.isReactComponent={};Ff.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")};Ff.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function wF(){}wF.prototype=Ff.prototype;function gE(t,e,n){this.props=t,this.context=e,this.refs=bF,this.updater=n||yF}var vE=gE.prototype=new wF;vE.constructor=gE;xF(vE,Ff.prototype);vE.isPureReactComponent=!0;var yO=Array.isArray,SF=Object.prototype.hasOwnProperty,yE={current:null},CF={key:!0,ref:!0,__self:!0,__source:!0};function _F(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)SF.call(e,r)&&!CF.hasOwnProperty(r)&&(i[r]=e[r]);var c=arguments.length-2;if(c===1)i.children=n;else if(1>>1,te=M[q];if(0>>1;qi(ce,Q))hei(U,ce)?(M[q]=U,M[he]=Q,q=he):(M[q]=ce,M[B]=Q,q=B);else if(hei(U,Q))M[q]=U,M[he]=Q,q=he;else break e}}return $}function i(M,$){var Q=M.sortIndex-$.sortIndex;return Q!==0?Q:M.id-$.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,c=s.now();t.unstable_now=function(){return s.now()-c}}var l=[],u=[],d=1,f=null,h=3,p=!1,v=!1,m=!1,y=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(M){for(var $=n(u);$!==null;){if($.callback===null)r(u);else if($.startTime<=M)r(u),$.sortIndex=$.expirationTime,e(l,$);else break;$=n(u)}}function S(M){if(m=!1,w(M),!v)if(n(l)!==null)v=!0,L(C);else{var $=n(u);$!==null&&z(S,$.startTime-M)}}function C(M,$){v=!1,m&&(m=!1,b(j),j=-1),p=!0;var Q=h;try{for(w($),f=n(l);f!==null&&(!(f.expirationTime>$)||M&&!O());){var q=f.callback;if(typeof q=="function"){f.callback=null,h=f.priorityLevel;var te=q(f.expirationTime<=$);$=t.unstable_now(),typeof te=="function"?f.callback=te:f===n(l)&&r(l),w($)}else r(l);f=n(l)}if(f!==null)var xe=!0;else{var B=n(u);B!==null&&z(S,B.startTime-$),xe=!1}return xe}finally{f=null,h=Q,p=!1}}var _=!1,A=null,j=-1,T=5,k=-1;function O(){return!(t.unstable_now()-kM||125q?(M.sortIndex=Q,e(u,M),n(l)===null&&M===n(u)&&(m?(b(j),j=-1):m=!0,z(S,Q-q))):(M.sortIndex=te,e(l,M),v||p||(v=!0,L(C))),M},t.unstable_shouldYield=O,t.unstable_wrapCallback=function(M){var $=h;return function(){var Q=h;h=$;try{return M.apply(this,arguments)}finally{h=Q}}}})(kF);TF.exports=kF;var e9=TF.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var t9=g,so=e9;function Oe(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"),E_=Object.prototype.hasOwnProperty,n9=/^[: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]*$/,bO={},wO={};function r9(t){return E_.call(wO,t)?!0:E_.call(bO,t)?!1:n9.test(t)?wO[t]=!0:(bO[t]=!0,!1)}function i9(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 o9(t,e,n,r){if(e===null||typeof e>"u"||i9(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 Ci(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 Wr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Wr[t]=new Ci(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Wr[e]=new Ci(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Wr[t]=new Ci(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Wr[t]=new Ci(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){Wr[t]=new Ci(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Wr[t]=new Ci(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Wr[t]=new Ci(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Wr[t]=new Ci(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Wr[t]=new Ci(t,5,!1,t.toLowerCase(),null,!1,!1)});var bE=/[\-:]([a-z])/g;function wE(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(bE,wE);Wr[e]=new Ci(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(bE,wE);Wr[e]=new Ci(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(bE,wE);Wr[e]=new Ci(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Wr[t]=new Ci(t,1,!1,t.toLowerCase(),null,!1,!1)});Wr.xlinkHref=new Ci("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Wr[t]=new Ci(t,1,!1,t.toLowerCase(),null,!0,!0)});function SE(t,e,n,r){var i=Wr.hasOwnProperty(e)?Wr[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{KS=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Zh(t):""}function s9(t){switch(t.tag){case 5:return Zh(t.type);case 16:return Zh("Lazy");case 13:return Zh("Suspense");case 19:return Zh("SuspenseList");case 0:case 2:case 15:return t=WS(t.type,!1),t;case 11:return t=WS(t.type.render,!1),t;case 1:return t=WS(t.type,!0),t;default:return""}}function P_(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 od:return"Fragment";case id:return"Portal";case N_:return"Profiler";case CE:return"StrictMode";case T_:return"Suspense";case k_:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case IF:return(t.displayName||"Context")+".Consumer";case OF:return(t._context.displayName||"Context")+".Provider";case _E:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case AE:return e=t.displayName||null,e!==null?e:P_(t.type)||"Memo";case hc:e=t._payload,t=t._init;try{return P_(t(e))}catch{}}return null}function a9(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 P_(e);case 8:return e===CE?"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 Zc(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function MF(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function c9(t){var e=MF(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 xv(t){t._valueTracker||(t._valueTracker=c9(t))}function DF(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=MF(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Xy(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 O_(t,e){var n=e.checked;return Jn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function CO(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Zc(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 $F(t,e){e=e.checked,e!=null&&SE(t,"checked",e,!1)}function I_(t,e){$F(t,e);var n=Zc(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")?R_(t,e.type,n):e.hasOwnProperty("defaultValue")&&R_(t,e.type,Zc(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function _O(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 R_(t,e,n){(e!=="number"||Xy(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var ep=Array.isArray;function wd(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=bv.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function zp(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var hp={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},l9=["Webkit","ms","Moz","O"];Object.keys(hp).forEach(function(t){l9.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),hp[e]=hp[t]})});function UF(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||hp.hasOwnProperty(t)&&hp[t]?(""+e).trim():e+"px"}function zF(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=UF(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}var u9=Jn({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 $_(t,e){if(e){if(u9[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Oe(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Oe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Oe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Oe(62))}}function L_(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 F_=null;function jE(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var B_=null,Sd=null,Cd=null;function EO(t){if(t=Og(t)){if(typeof B_!="function")throw Error(Oe(280));var e=t.stateNode;e&&(e=L0(e),B_(t.stateNode,t.type,e))}}function HF(t){Sd?Cd?Cd.push(t):Cd=[t]:Sd=t}function VF(){if(Sd){var t=Sd,e=Cd;if(Cd=Sd=null,EO(t),e)for(t=0;t>>=0,t===0?32:31-(w9(t)/S9|0)|0}var wv=64,Sv=4194304;function tp(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 tx(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=tp(c):(o&=s,o!==0&&(r=tp(o)))}else s=n&~i,s!==0?r=tp(s):o!==0&&(r=tp(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 kg(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-is(e),t[e]=n}function j9(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=mp),DO=" ",$O=!1;function u4(t,e){switch(t){case"keyup":return eY.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function d4(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var sd=!1;function nY(t,e){switch(t){case"compositionend":return d4(e);case"keypress":return e.which!==32?null:($O=!0,DO);case"textInput":return t=e.data,t===DO&&$O?null:t;default:return null}}function rY(t,e){if(sd)return t==="compositionend"||!RE&&u4(t,e)?(t=c4(),wy=PE=Tc=null,sd=!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=UO(n)}}function m4(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?m4(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function g4(){for(var t=window,e=Xy();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Xy(t.document)}return e}function ME(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 fY(t){var e=g4(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&m4(n.ownerDocument.documentElement,n)){if(r!==null&&ME(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=zO(n,o);var s=zO(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,ad=null,K_=null,vp=null,W_=!1;function HO(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;W_||ad==null||ad!==Xy(r)||(r=ad,"selectionStart"in r&&ME(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}),vp&&qp(vp,r)||(vp=r,r=ix(K_,"onSelect"),0ud||(t.current=Z_[ud],Z_[ud]=null,ud--)}function Ln(t,e){ud++,Z_[ud]=t.current,t.current=e}var el={},si=ml(el),Oi=ml(!1),lu=el;function Xd(t,e){var n=t.type.contextTypes;if(!n)return el;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 Ii(t){return t=t.childContextTypes,t!=null}function sx(){Vn(Oi),Vn(si)}function QO(t,e,n){if(si.current!==el)throw Error(Oe(168));Ln(si,e),Ln(Oi,n)}function A4(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(Oe(108,a9(t)||"Unknown",i));return Jn({},n,r)}function ax(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||el,lu=si.current,Ln(si,t),Ln(Oi,Oi.current),!0}function XO(t,e,n){var r=t.stateNode;if(!r)throw Error(Oe(169));n?(t=A4(t,e,lu),r.__reactInternalMemoizedMergedChildContext=t,Vn(Oi),Vn(si),Ln(si,t)):Vn(Oi),Ln(Oi,n)}var Ca=null,F0=!1,aC=!1;function j4(t){Ca===null?Ca=[t]:Ca.push(t)}function _Y(t){F0=!0,j4(t)}function gl(){if(!aC&&Ca!==null){aC=!0;var t=0,e=bn;try{var n=Ca;for(bn=1;t>=s,i-=s,ja=1<<32-is(e)+i|n<j?(T=A,A=null):T=A.sibling;var k=h(b,A,w[j],S);if(k===null){A===null&&(A=T);break}t&&A&&k.alternate===null&&e(b,A),x=o(k,x,j),_===null?C=k:_.sibling=k,_=k,A=T}if(j===w.length)return n(b,A),Gn&&Pl(b,j),C;if(A===null){for(;jj?(T=A,A=null):T=A.sibling;var O=h(b,A,k.value,S);if(O===null){A===null&&(A=T);break}t&&A&&O.alternate===null&&e(b,A),x=o(O,x,j),_===null?C=O:_.sibling=O,_=O,A=T}if(k.done)return n(b,A),Gn&&Pl(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 Gn&&Pl(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)}),Gn&&Pl(b,j),C}function y(b,x,w,S){if(typeof w=="object"&&w!==null&&w.type===od&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case yv:e:{for(var C=w.key,_=x;_!==null;){if(_.key===C){if(C=w.type,C===od){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===hc&&eI(C)===_.type){n(b,_.sibling),x=i(_,w.props),x.ref=Oh(b,_,w),x.return=b,b=x;break e}n(b,_);break}else e(b,_);_=_.sibling}w.type===od?(x=nu(w.props.children,b.mode,S,w.key),x.return=b,b=x):(S=Ty(w.type,w.key,w.props,null,b.mode,S),S.ref=Oh(b,x,w),S.return=b,b=S)}return s(b);case id: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=mC(w,b.mode,S),x.return=b,b=x}return s(b);case hc:return _=w._init,y(b,x,_(w._payload),S)}if(ep(w))return v(b,x,w,S);if(Eh(w))return m(b,x,w,S);Tv(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=pC(w,b.mode,S),x.return=b,b=x),s(b)):n(b,x)}return y}var Zd=k4(!0),P4=k4(!1),ux=ml(null),dx=null,hd=null,FE=null;function BE(){FE=hd=dx=null}function UE(t){var e=ux.current;Vn(ux),t._currentValue=e}function nA(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 Ad(t,e){dx=t,FE=hd=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(ki=!0),t.firstContext=null)}function Po(t){var e=t._currentValue;if(FE!==t)if(t={context:t,memoizedValue:e,next:null},hd===null){if(dx===null)throw Error(Oe(308));hd=t,dx.dependencies={lanes:0,firstContext:t}}else hd=hd.next=t;return e}var Fl=null;function zE(t){Fl===null?Fl=[t]:Fl.push(t)}function O4(t,e,n,r){var i=e.interleaved;return i===null?(n.next=n,zE(e)):(n.next=i.next,i.next=n),e.interleaved=n,za(t,r)}function za(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 pc=!1;function HE(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function I4(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 Ia(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Bc(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,un&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,za(t,n)}return i=r.interleaved,i===null?(e.next=e,zE(r)):(e.next=i.next,i.next=e),r.interleaved=e,za(t,n)}function Cy(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,NE(t,n)}}function tI(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 fx(t,e,n,r){var i=t.updateQueue;pc=!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 v=t,m=c;switch(h=e,p=n,m.tag){case 1:if(v=m.payload,typeof v=="function"){f=v.call(p,f,h);break e}f=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=m.payload,h=typeof v=="function"?v.call(p,f,h):v,h==null)break e;f=Jn({},f,h);break e;case 2:pc=!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);fu|=s,t.lanes=s,t.memoizedState=f}}function nI(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var r=lC.transition;lC.transition={};try{t(!1),e()}finally{bn=n,lC.transition=r}}function Q4(){return Oo().memoizedState}function NY(t,e,n){var r=zc(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},X4(t))J4(e,n);else if(n=O4(t,e,n,r),n!==null){var i=bi();os(n,t,r,i),Z4(n,e,r)}}function TY(t,e,n){var r=zc(t),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(X4(t))J4(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,fs(c,s)){var l=e.interleaved;l===null?(i.next=i,zE(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}n=O4(t,e,i,r),n!==null&&(i=bi(),os(n,t,r,i),Z4(n,e,r))}}function X4(t){var e=t.alternate;return t===Xn||e!==null&&e===Xn}function J4(t,e){yp=px=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Z4(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,NE(t,n)}}var mx={readContext:Po,useCallback:Xr,useContext:Xr,useEffect:Xr,useImperativeHandle:Xr,useInsertionEffect:Xr,useLayoutEffect:Xr,useMemo:Xr,useReducer:Xr,useRef:Xr,useState:Xr,useDebugValue:Xr,useDeferredValue:Xr,useTransition:Xr,useMutableSource:Xr,useSyncExternalStore:Xr,useId:Xr,unstable_isNewReconciler:!1},kY={readContext:Po,useCallback:function(t,e){return Ts().memoizedState=[t,e===void 0?null:e],t},useContext:Po,useEffect:iI,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,Ay(4194308,4,G4.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Ay(4194308,4,t,e)},useInsertionEffect:function(t,e){return Ay(4,2,t,e)},useMemo:function(t,e){var n=Ts();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ts();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=NY.bind(null,Xn,t),[r.memoizedState,t]},useRef:function(t){var e=Ts();return t={current:t},e.memoizedState=t},useState:rI,useDebugValue:XE,useDeferredValue:function(t){return Ts().memoizedState=t},useTransition:function(){var t=rI(!1),e=t[0];return t=EY.bind(null,t[1]),Ts().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Xn,i=Ts();if(Gn){if(n===void 0)throw Error(Oe(407));n=n()}else{if(n=e(),Lr===null)throw Error(Oe(349));du&30||$4(r,e,n)}i.memoizedState=n;var o={value:n,getSnapshot:e};return i.queue=o,iI(F4.bind(null,r,o,t),[t]),r.flags|=2048,nm(9,L4.bind(null,r,o,n,e),void 0,null),n},useId:function(){var t=Ts(),e=Lr.identifierPrefix;if(Gn){var n=Ea,r=ja;n=(r&~(1<<32-is(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=em++,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[Ds]=e,t[Xp]=r,l5(t,e,!1,!1),e.stateNode=t;e:{switch(s=L_(n,r),n){case"dialog":Bn("cancel",t),Bn("close",t),i=r;break;case"iframe":case"object":case"embed":Bn("load",t),i=r;break;case"video":case"audio":for(i=0;inf&&(e.flags|=128,r=!0,Ih(o,!1),e.lanes=4194304)}else{if(!r)if(t=hx(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),Ih(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Gn)return Jr(e),null}else 2*sr()-o.renderingStartTime>nf&&n!==1073741824&&(e.flags|=128,r=!0,Ih(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=sr(),e.sibling=null,n=Yn.current,Ln(Yn,r?n&1|2:n&1),e):(Jr(e),null);case 22:case 23:return rN(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?qi&1073741824&&(Jr(e),e.subtreeFlags&6&&(e.flags|=8192)):Jr(e),null;case 24:return null;case 25:return null}throw Error(Oe(156,e.tag))}function LY(t,e){switch($E(e),e.tag){case 1:return Ii(e.type)&&sx(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return ef(),Vn(Oi),Vn(si),KE(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return GE(e),null;case 13:if(Vn(Yn),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Oe(340));Jd()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Vn(Yn),null;case 4:return ef(),null;case 10:return UE(e.type._context),null;case 22:case 23:return rN(),null;case 24:return null;default:return null}}var Pv=!1,ri=!1,FY=typeof WeakSet=="function"?WeakSet:Set,ct=null;function pd(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){nr(t,e,r)}else n.current=null}function dA(t,e,n){try{n()}catch(r){nr(t,e,r)}}var mI=!1;function BY(t,e){if(q_=nx,t=g4(),ME(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(Y_={focusedElem:t,selectionRange:n},nx=!1,ct=e;ct!==null;)if(e=ct,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ct=t;else for(;ct!==null;){e=ct;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var m=v.memoizedProps,y=v.memoizedState,b=e.stateNode,x=b.getSnapshotBeforeUpdate(e.elementType===e.type?m:Vo(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(Oe(163))}}catch(S){nr(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,ct=t;break}ct=e.return}return v=mI,mI=!1,v}function xp(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&&dA(e,n,o)}i=i.next}while(i!==r)}}function z0(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 fA(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 f5(t){var e=t.alternate;e!==null&&(t.alternate=null,f5(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Ds],delete e[Xp],delete e[J_],delete e[SY],delete e[CY])),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 h5(t){return t.tag===5||t.tag===3||t.tag===4}function gI(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||h5(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 hA(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=ox));else if(r!==4&&(t=t.child,t!==null))for(hA(t,e,n),t=t.sibling;t!==null;)hA(t,e,n),t=t.sibling}function pA(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(pA(t,e,n),t=t.sibling;t!==null;)pA(t,e,n),t=t.sibling}var Hr=null,Wo=!1;function sc(t,e,n){for(n=n.child;n!==null;)p5(t,e,n),n=n.sibling}function p5(t,e,n){if(Hs&&typeof Hs.onCommitFiberUnmount=="function")try{Hs.onCommitFiberUnmount(R0,n)}catch{}switch(n.tag){case 5:ri||pd(n,e);case 6:var r=Hr,i=Wo;Hr=null,sc(t,e,n),Hr=r,Wo=i,Hr!==null&&(Wo?(t=Hr,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Hr.removeChild(n.stateNode));break;case 18:Hr!==null&&(Wo?(t=Hr,n=n.stateNode,t.nodeType===8?sC(t.parentNode,n):t.nodeType===1&&sC(t,n),Kp(t)):sC(Hr,n.stateNode));break;case 4:r=Hr,i=Wo,Hr=n.stateNode.containerInfo,Wo=!0,sc(t,e,n),Hr=r,Wo=i;break;case 0:case 11:case 14:case 15:if(!ri&&(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)&&dA(n,e,s),i=i.next}while(i!==r)}sc(t,e,n);break;case 1:if(!ri&&(pd(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){nr(n,e,c)}sc(t,e,n);break;case 21:sc(t,e,n);break;case 22:n.mode&1?(ri=(r=ri)||n.memoizedState!==null,sc(t,e,n),ri=r):sc(t,e,n);break;default:sc(t,e,n)}}function vI(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new FY),e.forEach(function(r){var i=YY.bind(null,t,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Bo(t,e){var n=e.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=sr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*zY(r/1960))-r,10t?16:t,kc===null)var r=!1;else{if(t=kc,kc=null,yx=0,un&6)throw Error(Oe(331));var i=un;for(un|=4,ct=t.current;ct!==null;){var o=ct,s=o.child;if(ct.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lsr()-tN?tu(t,0):eN|=n),Ri(t,e)}function S5(t,e){e===0&&(t.mode&1?(e=Sv,Sv<<=1,!(Sv&130023424)&&(Sv=4194304)):e=1);var n=bi();t=za(t,e),t!==null&&(kg(t,e,n),Ri(t,n))}function qY(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),S5(t,n)}function YY(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(Oe(314))}r!==null&&r.delete(e),S5(t,n)}var C5;C5=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Oi.current)ki=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return ki=!1,DY(t,e,n);ki=!!(t.flags&131072)}else ki=!1,Gn&&e.flags&1048576&&E4(e,lx,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;jy(t,e),t=e.pendingProps;var i=Xd(e,si.current);Ad(e,n),i=qE(null,e,r,t,i,n);var o=YE();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,Ii(r)?(o=!0,ax(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,HE(e),i.updater=U0,e.stateNode=i,i._reactInternals=e,iA(e,r,t,n),e=aA(null,e,r,!0,o,n)):(e.tag=0,Gn&&o&&DE(e),fi(null,e,i,n),e=e.child),e;case 16:r=e.elementType;e:{switch(jy(t,e),t=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=XY(r),t=Vo(r,t),i){case 0:e=sA(null,e,r,t,n);break e;case 1:e=fI(null,e,r,t,n);break e;case 11:e=uI(null,e,r,t,n);break e;case 14:e=dI(null,e,r,Vo(r.type,t),n);break e}throw Error(Oe(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Vo(r,i),sA(t,e,r,i,n);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Vo(r,i),fI(t,e,r,i,n);case 3:e:{if(s5(e),t===null)throw Error(Oe(387));r=e.pendingProps,o=e.memoizedState,i=o.element,I4(t,e),fx(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=tf(Error(Oe(423)),e),e=hI(t,e,r,n,i);break e}else if(r!==i){i=tf(Error(Oe(424)),e),e=hI(t,e,r,n,i);break e}else for(Zi=Fc(e.stateNode.containerInfo.firstChild),eo=e,Gn=!0,Xo=null,n=P4(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Jd(),r===i){e=Ha(t,e,n);break e}fi(t,e,r,n)}e=e.child}return e;case 5:return R4(e),t===null&&tA(e),r=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Q_(r,i)?s=null:o!==null&&Q_(r,o)&&(e.flags|=32),o5(t,e),fi(t,e,s,n),e.child;case 6:return t===null&&tA(e),null;case 13:return a5(t,e,n);case 4:return VE(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Zd(e,null,r,n):fi(t,e,r,n),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Vo(r,i),uI(t,e,r,i,n);case 7:return fi(t,e,e.pendingProps,n),e.child;case 8:return fi(t,e,e.pendingProps.children,n),e.child;case 12:return fi(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,Ln(ux,r._currentValue),r._currentValue=s,o!==null)if(fs(o.value,s)){if(o.children===i.children&&!Oi.current){e=Ha(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=Ia(-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),nA(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(Oe(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),nA(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}fi(t,e,i.children,n),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Ad(e,n),i=Po(i),r=r(i),e.flags|=1,fi(t,e,r,n),e.child;case 14:return r=e.type,i=Vo(r,e.pendingProps),i=Vo(r.type,i),dI(t,e,r,i,n);case 15:return r5(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Vo(r,i),jy(t,e),e.tag=1,Ii(r)?(t=!0,ax(e)):t=!1,Ad(e,n),e5(e,r,i),iA(e,r,i,n),aA(null,e,r,!0,t,n);case 19:return c5(t,e,n);case 22:return i5(t,e,n)}throw Error(Oe(156,e.tag))};function _5(t,e){return XF(t,e)}function QY(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 jo(t,e,n,r){return new QY(t,e,n,r)}function oN(t){return t=t.prototype,!(!t||!t.isReactComponent)}function XY(t){if(typeof t=="function")return oN(t)?1:0;if(t!=null){if(t=t.$$typeof,t===_E)return 11;if(t===AE)return 14}return 2}function Hc(t,e){var n=t.alternate;return n===null?(n=jo(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 Ty(t,e,n,r,i,o){var s=2;if(r=t,typeof t=="function")oN(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case od:return nu(n.children,i,o,e);case CE:s=8,i|=8;break;case N_:return t=jo(12,n,e,i|2),t.elementType=N_,t.lanes=o,t;case T_:return t=jo(13,n,e,i),t.elementType=T_,t.lanes=o,t;case k_:return t=jo(19,n,e,i),t.elementType=k_,t.lanes=o,t;case RF:return V0(n,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case OF:s=10;break e;case IF:s=9;break e;case _E:s=11;break e;case AE:s=14;break e;case hc:s=16,r=null;break e}throw Error(Oe(130,t==null?t:typeof t,""))}return e=jo(s,n,e,i),e.elementType=t,e.type=r,e.lanes=o,e}function nu(t,e,n,r){return t=jo(7,t,r,e),t.lanes=n,t}function V0(t,e,n,r){return t=jo(22,t,r,e),t.elementType=RF,t.lanes=n,t.stateNode={isHidden:!1},t}function pC(t,e,n){return t=jo(6,t,null,e),t.lanes=n,t}function mC(t,e,n){return e=jo(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function JY(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=YS(0),this.expirationTimes=YS(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=YS(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function sN(t,e,n,r,i,o,s,c,l){return t=new JY(t,e,n,c,l),e===1?(e=1,o===!0&&(e|=8)):e=0,o=jo(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},HE(o),t}function ZY(t,e,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(N5)}catch(t){console.error(t)}}N5(),NF.exports=ao;var es=NF.exports;const T5=hn(es);var k5,AI=es;k5=AI.createRoot,AI.hydrateRoot;var jI=["light","dark"],iQ="(prefers-color-scheme: dark)",oQ=g.createContext(void 0),sQ={setTheme:t=>{},themes:[]},aQ=()=>{var t;return(t=g.useContext(oQ))!=null?t:sQ};g.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(v=>`'${v}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=i?jI.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(v,m=!1,y=!0)=>{let b=s?s[v]:v,x=m?v+"|| ''":`'${b}'`,w="";return i&&y&&!m&&jI.includes(v)&&(w+=`d.style.colorScheme = '${v}';`),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='${iQ}',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 g.createElement("script",{nonce:l,dangerouslySetInnerHTML:{__html:p}})});var cQ=t=>{switch(t){case"success":return dQ;case"info":return hQ;case"warning":return fQ;case"error":return pQ;default:return null}},lQ=Array(12).fill(0),uQ=({visible:t})=>N.createElement("div",{className:"sonner-loading-wrapper","data-visible":t},N.createElement("div",{className:"sonner-spinner"},lQ.map((e,n)=>N.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),dQ=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"})),fQ=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"})),hQ=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"})),pQ=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"})),mQ=()=>{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},xA=1,gQ=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:xA++,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(yQ(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)||xA++;return this.create({jsx:t(n),id:n,...e}),n},this.subscribers=[],this.toasts=[]}},Wi=new gQ,vQ=(t,e)=>{let n=(e==null?void 0:e.id)||xA++;return Wi.addToast({title:t,...e,id:n}),n},yQ=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",xQ=vQ,bQ=()=>Wi.toasts,ae=Object.assign(xQ,{success:Wi.success,info:Wi.info,warning:Wi.warning,error:Wi.error,custom:Wi.custom,message:Wi.message,promise:Wi.promise,dismiss:Wi.dismiss,loading:Wi.loading},{getHistory:bQ});function wQ(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))}wQ(`: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 Rv(t){return t.label!==void 0}var SQ=3,CQ="32px",_Q=4e3,AQ=356,jQ=14,EQ=20,NQ=200;function TQ(...t){return t.filter(Boolean).join(" ")}var kQ=t=>{var e,n,r,i,o,s,c,l,u,d;let{invert:f,toast:h,unstyled:p,interacting:v,setHeights:m,visibleToasts:y,heights:b,index:x,toasts:w,expanded:S,removeToast:C,defaultRichColors:_,closeButton:A,style:j,cancelButtonStyle:T,actionButtonStyle:k,className:O="",descriptionClassName:E="",duration:R,position:D,gap:V,loadingIcon:L,expandByDefault:z,classNames:M,icons:$,closeButtonAriaLabel:Q="Close toast",pauseWhenPageIsHidden:q,cn:te}=t,[xe,B]=N.useState(!1),[ce,he]=N.useState(!1),[U,de]=N.useState(!1),[se,ne]=N.useState(!1),[je,K]=N.useState(0),[et,Me]=N.useState(0),ut=N.useRef(null),Ye=N.useRef(null),Pt=x===0,F=x+1<=y,J=h.type,oe=h.dismissible!==!1,ye=h.className||"",Ee=h.descriptionClassName||"",P=N.useMemo(()=>b.findIndex(Je=>Je.toastId===h.id)||0,[b,h.id]),H=N.useMemo(()=>{var Je;return(Je=h.closeButton)!=null?Je:A},[h.closeButton,A]),ee=N.useMemo(()=>h.duration||R||_Q,[h.duration,R]),re=N.useRef(0),Z=N.useRef(0),Se=N.useRef(0),Ae=N.useRef(null),[Ie,Ke]=D.split("-"),Ue=N.useMemo(()=>b.reduce((Je,rt,jt)=>jt>=P?Je:Je+rt.height,0),[b,P]),Be=mQ(),nt=h.invert||f,Ne=J==="loading";Z.current=N.useMemo(()=>P*V+Ue,[P,Ue]),N.useEffect(()=>{B(!0)},[]),N.useLayoutEffect(()=>{if(!xe)return;let Je=Ye.current,rt=Je.style.height;Je.style.height="auto";let jt=Je.getBoundingClientRect().height;Je.style.height=rt,Me(jt),m(Bt=>Bt.find(Dt=>Dt.toastId===h.id)?Bt.map(Dt=>Dt.toastId===h.id?{...Dt,height:jt}:Dt):[{toastId:h.id,height:jt,position:h.position},...Bt])},[xe,h.title,h.description,m,h.id]);let Nt=N.useCallback(()=>{he(!0),K(Z.current),m(Je=>Je.filter(rt=>rt.toastId!==h.id)),setTimeout(()=>{C(h)},NQ)},[h,C,m,Z]);N.useEffect(()=>{if(h.promise&&J==="loading"||h.duration===1/0||h.type==="loading")return;let Je,rt=ee;return S||v||q&&Be?(()=>{if(Se.current{var jt;(jt=h.onAutoClose)==null||jt.call(h,h),Nt()},rt)),()=>clearTimeout(Je)},[S,v,z,h,ee,Nt,h.promise,J,q,Be]),N.useEffect(()=>{let Je=Ye.current;if(Je){let rt=Je.getBoundingClientRect().height;return Me(rt),m(jt=>[{toastId:h.id,height:rt,position:h.position},...jt]),()=>m(jt=>jt.filter(Bt=>Bt.toastId!==h.id))}},[m,h.id]),N.useEffect(()=>{h.delete&&Nt()},[Nt,h.delete]);function pn(){return $!=null&&$.loading?N.createElement("div",{className:"sonner-loader","data-visible":J==="loading"},$.loading):L?N.createElement("div",{className:"sonner-loader","data-visible":J==="loading"},L):N.createElement(uQ,{visible:J==="loading"})}return N.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Ye,className:te(O,ye,M==null?void 0:M.toast,(e=h==null?void 0:h.classNames)==null?void 0:e.toast,M==null?void 0:M.default,M==null?void 0:M[J],(n=h==null?void 0:h.classNames)==null?void 0:n[J]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:_,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":xe,"data-promise":!!h.promise,"data-removed":ce,"data-visible":F,"data-y-position":Ie,"data-x-position":Ke,"data-index":x,"data-front":Pt,"data-swiping":U,"data-dismissible":oe,"data-type":J,"data-invert":nt,"data-swipe-out":se,"data-expanded":!!(S||z&&xe),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${ce?je:Z.current}px`,"--initial-height":z?"auto":`${et}px`,...j,...h.style},onPointerDown:Je=>{Ne||!oe||(ut.current=new Date,K(Z.current),Je.target.setPointerCapture(Je.pointerId),Je.target.tagName!=="BUTTON"&&(de(!0),Ae.current={x:Je.clientX,y:Je.clientY}))},onPointerUp:()=>{var Je,rt,jt,Bt;if(se||!oe)return;Ae.current=null;let Dt=Number(((Je=Ye.current)==null?void 0:Je.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Jt=new Date().getTime()-((rt=ut.current)==null?void 0:rt.getTime()),en=Math.abs(Dt)/Jt;if(Math.abs(Dt)>=EQ||en>.11){K(Z.current),(jt=h.onDismiss)==null||jt.call(h,h),Nt(),ne(!0);return}(Bt=Ye.current)==null||Bt.style.setProperty("--swipe-amount","0px"),de(!1)},onPointerMove:Je=>{var rt;if(!Ae.current||!oe)return;let jt=Je.clientY-Ae.current.y,Bt=Je.clientX-Ae.current.x,Dt=(Ie==="top"?Math.min:Math.max)(0,jt),Jt=Je.pointerType==="touch"?10:2;Math.abs(Dt)>Jt?(rt=Ye.current)==null||rt.style.setProperty("--swipe-amount",`${jt}px`):Math.abs(Bt)>Jt&&(Ae.current=null)}},H&&!h.jsx?N.createElement("button",{"aria-label":Q,"data-disabled":Ne,"data-close-button":!0,onClick:Ne||!oe?()=>{}:()=>{var Je;Nt(),(Je=h.onDismiss)==null||Je.call(h,h)},className:te(M==null?void 0:M.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,J||h.icon||h.promise?N.createElement("div",{"data-icon":"",className:te(M==null?void 0:M.icon,(o=h==null?void 0:h.classNames)==null?void 0:o.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||pn():null,h.type!=="loading"?h.icon||($==null?void 0:$[J])||cQ(J):null):null,N.createElement("div",{"data-content":"",className:te(M==null?void 0:M.content,(s=h==null?void 0:h.classNames)==null?void 0:s.content)},N.createElement("div",{"data-title":"",className:te(M==null?void 0:M.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,Ee,M==null?void 0:M.description,(l=h==null?void 0:h.classNames)==null?void 0:l.description)},h.description):null),N.isValidElement(h.cancel)?h.cancel:h.cancel&&Rv(h.cancel)?N.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||T,onClick:Je=>{var rt,jt;Rv(h.cancel)&&oe&&((jt=(rt=h.cancel).onClick)==null||jt.call(rt,Je),Nt())},className:te(M==null?void 0:M.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&&Rv(h.action)?N.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||k,onClick:Je=>{var rt,jt;Rv(h.action)&&(Je.defaultPrevented||((jt=(rt=h.action).onClick)==null||jt.call(rt,Je),Nt()))},className:te(M==null?void 0:M.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function EI(){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 PQ=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=SQ,toastOptions:p,dir:v=EI(),gap:m=jQ,loadingIcon:y,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:w,cn:S=TQ}=t,[C,_]=N.useState([]),A=N.useMemo(()=>Array.from(new Set([n].concat(C.filter(q=>q.position).map(q=>q.position)))),[C,n]),[j,T]=N.useState([]),[k,O]=N.useState(!1),[E,R]=N.useState(!1),[D,V]=N.useState(l!=="system"?l:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),L=N.useRef(null),z=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=N.useRef(null),$=N.useRef(!1),Q=N.useCallback(q=>{var te;(te=C.find(xe=>xe.id===q.id))!=null&&te.delete||Wi.dismiss(q.id),_(xe=>xe.filter(({id:B})=>B!==q.id))},[C]);return N.useEffect(()=>Wi.subscribe(q=>{if(q.dismiss){_(te=>te.map(xe=>xe.id===q.id?{...xe,delete:!0}:xe));return}setTimeout(()=>{T5.flushSync(()=>{_(te=>{let xe=te.findIndex(B=>B.id===q.id);return xe!==-1?[...te.slice(0,xe),{...te[xe],...q},...te.slice(xe+1)]:[q,...te]})})})}),[]),N.useEffect(()=>{if(l!=="system"){V(l);return}l==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?V("dark"):V("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:q})=>{V(q?"dark":"light")})},[l]),N.useEffect(()=>{C.length<=1&&O(!1)},[C]),N.useEffect(()=>{let q=te=>{var xe,B;r.every(ce=>te[ce]||te.code===ce)&&(O(!0),(xe=L.current)==null||xe.focus()),te.code==="Escape"&&(document.activeElement===L.current||(B=L.current)!=null&&B.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[r]),N.useEffect(()=>{if(L.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,$.current=!1)}},[L.current]),C.length?N.createElement("section",{"aria-label":`${x} ${z}`,tabIndex:-1},A.map((q,te)=>{var xe;let[B,ce]=q.split("-");return N.createElement("ol",{key:q,dir:v==="auto"?EI():v,tabIndex:-1,ref:L,className:s,"data-sonner-toaster":!0,"data-theme":D,"data-y-position":B,"data-x-position":ce,style:{"--front-toast-height":`${((xe=j[0])==null?void 0:xe.height)||0}px`,"--offset":typeof c=="number"?`${c}px`:c||CQ,"--width":`${AQ}px`,"--gap":`${m}px`,...f},onBlur:he=>{$.current&&!he.currentTarget.contains(he.relatedTarget)&&($.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:he=>{he.target instanceof HTMLElement&&he.target.dataset.dismissible==="false"||$.current||($.current=!0,M.current=he.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{E||O(!1)},onPointerDown:he=>{he.target instanceof HTMLElement&&he.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},C.filter(he=>!he.position&&te===0||he.position===q).map((he,U)=>{var de,se;return N.createElement(kQ,{key:he.id,icons:b,index:U,toast:he,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:(se=p==null?void 0:p.closeButton)!=null?se:o,interacting:E,position:q,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:Q,toasts:C.filter(ne=>ne.position==he.position),heights:j.filter(ne=>ne.position==he.position),setHeights:T,expandByDefault:i,gap:m,loadingIcon:y,expanded:k,pauseWhenPageIsHidden:w,cn:S})}))})):null};const OQ=({...t})=>{const{theme:e="system"}=aQ();return a.jsx(PQ,{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 Le(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 IQ(t,e){typeof t=="function"?t(e):t!=null&&(t.current=e)}function Y0(...t){return e=>t.forEach(n=>IQ(n,e))}function It(...t){return g.useCallback(Y0(...t),t)}function RQ(t,e){const n=g.createContext(e),r=o=>{const{children:s,...c}=o,l=g.useMemo(()=>c,Object.values(c));return a.jsx(n.Provider,{value:l,children:s})};r.displayName=t+"Provider";function i(o){const s=g.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 Bi(t,e=[]){let n=[];function r(o,s){const c=g.createContext(s),l=n.length;n=[...n,s];const u=f=>{var b;const{scope:h,children:p,...v}=f,m=((b=h==null?void 0:h[t])==null?void 0:b[l])||c,y=g.useMemo(()=>v,Object.values(v));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,v=g.useContext(p);if(v)return v;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=>g.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return g.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,MQ(i,...e)]}function MQ(...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 g.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var ea=g.forwardRef((t,e)=>{const{children:n,...r}=t,i=g.Children.toArray(n),o=i.find(DQ);if(o){const s=o.props.children,c=i.map(l=>l===o?g.Children.count(s)>1?g.Children.only(null):g.isValidElement(s)?s.props.children:null:l);return a.jsx(bA,{...r,ref:e,children:g.isValidElement(s)?g.cloneElement(s,void 0,c):null})}return a.jsx(bA,{...r,ref:e,children:n})});ea.displayName="Slot";var bA=g.forwardRef((t,e)=>{const{children:n,...r}=t;if(g.isValidElement(n)){const i=LQ(n);return g.cloneElement(n,{...$Q(r,n.props),ref:e?Y0(e,i):i})}return g.Children.count(n)>1?g.Children.only(null):null});bA.displayName="SlotClone";var uN=({children:t})=>a.jsx(a.Fragment,{children:t});function DQ(t){return g.isValidElement(t)&&t.type===uN}function $Q(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 LQ(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 FQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],ht=FQ.reduce((t,e)=>{const n=g.forwardRef((r,i)=>{const{asChild:o,...s}=r,c=o?ea: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 P5(t,e){t&&es.flushSync(()=>t.dispatchEvent(e))}function Ar(t){const e=g.useRef(t);return g.useEffect(()=>{e.current=t}),g.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function BQ(t,e=globalThis==null?void 0:globalThis.document){const n=Ar(t);g.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 UQ="DismissableLayer",wA="dismissableLayer.update",zQ="dismissableLayer.pointerDownOutside",HQ="dismissableLayer.focusOutside",NI,O5=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Rg=g.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=t,u=g.useContext(O5),[d,f]=g.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=g.useState({}),v=It(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=KQ(A=>{const j=A.target,T=[...u.branches].some(k=>k.contains(j));!S||T||(i==null||i(A),s==null||s(A),A.defaultPrevented||c==null||c())},h),_=WQ(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 BQ(A=>{x===u.layers.size-1&&(r==null||r(A),!A.defaultPrevented&&c&&(A.preventDefault(),c()))},h),g.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(NI=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),TI(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=NI)}},[d,h,n,u]),g.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),TI())},[d,u]),g.useEffect(()=>{const A=()=>p({});return document.addEventListener(wA,A),()=>document.removeEventListener(wA,A)},[]),a.jsx(ht.div,{...l,ref:v,style:{pointerEvents:w?S?"auto":"none":void 0,...t.style},onFocusCapture:Le(t.onFocusCapture,_.onFocusCapture),onBlurCapture:Le(t.onBlurCapture,_.onBlurCapture),onPointerDownCapture:Le(t.onPointerDownCapture,C.onPointerDownCapture)})});Rg.displayName=UQ;var VQ="DismissableLayerBranch",GQ=g.forwardRef((t,e)=>{const n=g.useContext(O5),r=g.useRef(null),i=It(e,r);return g.useEffect(()=>{const o=r.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),a.jsx(ht.div,{...t,ref:i})});GQ.displayName=VQ;function KQ(t,e=globalThis==null?void 0:globalThis.document){const n=Ar(t),r=g.useRef(!1),i=g.useRef(()=>{});return g.useEffect(()=>{const o=c=>{if(c.target&&!r.current){let l=function(){I5(zQ,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 WQ(t,e=globalThis==null?void 0:globalThis.document){const n=Ar(t),r=g.useRef(!1);return g.useEffect(()=>{const i=o=>{o.target&&!r.current&&I5(HQ,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 TI(){const t=new CustomEvent(wA);document.dispatchEvent(t)}function I5(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?P5(i,o):i.dispatchEvent(o)}var qr=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},qQ=jF.useId||(()=>{}),YQ=0;function ss(t){const[e,n]=g.useState(qQ());return qr(()=>{n(r=>r??String(YQ++))},[t]),e?`radix-${e}`:""}const QQ=["top","right","bottom","left"],tl=Math.min,Xi=Math.max,wx=Math.round,Mv=Math.floor,nl=t=>({x:t,y:t}),XQ={left:"right",right:"left",bottom:"top",top:"bottom"},JQ={start:"end",end:"start"};function SA(t,e,n){return Xi(t,tl(e,n))}function Va(t,e){return typeof t=="function"?t(e):t}function Ga(t){return t.split("-")[0]}function zf(t){return t.split("-")[1]}function dN(t){return t==="x"?"y":"x"}function fN(t){return t==="y"?"height":"width"}function rl(t){return["top","bottom"].includes(Ga(t))?"y":"x"}function hN(t){return dN(rl(t))}function ZQ(t,e,n){n===void 0&&(n=!1);const r=zf(t),i=hN(t),o=fN(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(s=Sx(s)),[s,Sx(s)]}function eX(t){const e=Sx(t);return[CA(t),e,CA(e)]}function CA(t){return t.replace(/start|end/g,e=>JQ[e])}function tX(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 nX(t,e,n,r){const i=zf(t);let o=tX(Ga(t),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),e&&(o=o.concat(o.map(CA)))),o}function Sx(t){return t.replace(/left|right|bottom|top/g,e=>XQ[e])}function rX(t){return{top:0,right:0,bottom:0,left:0,...t}}function R5(t){return typeof t!="number"?rX(t):{top:t,right:t,bottom:t,left:t}}function Cx(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 kI(t,e,n){let{reference:r,floating:i}=t;const o=rl(e),s=hN(e),c=fN(s),l=Ga(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(zf(e)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const iX=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}=kI(u,r,l),h=r,p={},v=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}=Va(t,e)||{};if(u==null)return{};const f=R5(d),h={x:n,y:r},p=hN(i),v=fN(p),m=await s.getDimensions(u),y=p==="y",b=y?"top":"left",x=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=o.reference[v]+o.reference[p]-h[p]-o.floating[v],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[v]);const j=S/2-C/2,T=A/2-m[v]/2-1,k=tl(f[b],T),O=tl(f[x],T),E=k,R=A-m[v]-O,D=A/2-m[v]/2+j,V=SA(E,D,R),L=!l.arrow&&zf(i)!=null&&D!==V&&o.reference[v]/2-(DD<=0)){var O,E;const D=(((O=o.flip)==null?void 0:O.index)||0)+1,V=A[D];if(V)return{data:{index:D,overflows:k},reset:{placement:V}};let L=(E=k.filter(z=>z.overflows[0]<=0).sort((z,M)=>z.overflows[1]-M.overflows[1])[0])==null?void 0:E.placement;if(!L)switch(p){case"bestFit":{var R;const z=(R=k.filter(M=>{if(_){const $=rl(M.placement);return $===x||$==="y"}return!0}).map(M=>[M.placement,M.overflows.filter($=>$>0).reduce(($,Q)=>$+Q,0)]).sort((M,$)=>M[1]-$[1])[0])==null?void 0:R[0];z&&(L=z);break}case"initialPlacement":L=c;break}if(i!==L)return{reset:{placement:L}}}return{}}}};function PI(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function OI(t){return QQ.some(e=>t[e]>=0)}const aX=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=Va(t,e);switch(r){case"referenceHidden":{const o=await im(e,{...i,elementContext:"reference"}),s=PI(o,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:OI(s)}}}case"escaped":{const o=await im(e,{...i,altBoundary:!0}),s=PI(o,n.floating);return{data:{escapedOffsets:s,escaped:OI(s)}}}default:return{}}}}};async function cX(t,e){const{placement:n,platform:r,elements:i}=t,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=Ga(n),c=zf(n),l=rl(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,f=Va(e,t);let{mainAxis:h,crossAxis:p,alignmentAxis:v}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof v=="number"&&(p=c==="end"?v*-1:v),l?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const lX=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 cX(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}}}}},uX=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}=Va(t,e),u={x:n,y:r},d=await im(e,l),f=rl(Ga(i)),h=dN(f);let p=u[h],v=u[f];if(o){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=p+d[y],w=p-d[b];p=SA(x,p,w)}if(s){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=v+d[y],w=v-d[b];v=SA(x,v,w)}const m=c.fn({...e,[h]:p,[f]:v});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:o,[f]:s}}}}}},dX=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}=Va(t,e),d={x:n,y:r},f=rl(i),h=dN(f);let p=d[h],v=d[f];const m=Va(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(Ga(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);v_&&(v=_)}return{[h]:p,[f]:v}}}},fX=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}=Va(t,e),d=await im(e,u),f=Ga(i),h=zf(i),p=rl(i)==="y",{width:v,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=v-d.left-d.right,S=tl(m-d[y],x),C=tl(v-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=Xi(d.left,0),O=Xi(d.right,0),E=Xi(d.top,0),R=Xi(d.bottom,0);p?j=v-2*(k!==0||O!==0?k+O:Xi(d.left,d.right)):A=m-2*(E!==0||R!==0?E+R:Xi(d.top,d.bottom))}await l({...e,availableWidth:j,availableHeight:A});const T=await s.getDimensions(c.floating);return v!==T.width||m!==T.height?{reset:{rects:!0}}:{}}}};function Q0(){return typeof window<"u"}function Hf(t){return M5(t)?(t.nodeName||"").toLowerCase():"#document"}function to(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function ca(t){var e;return(e=(M5(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function M5(t){return Q0()?t instanceof Node||t instanceof to(t).Node:!1}function hs(t){return Q0()?t instanceof Element||t instanceof to(t).Element:!1}function ta(t){return Q0()?t instanceof HTMLElement||t instanceof to(t).HTMLElement:!1}function II(t){return!Q0()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof to(t).ShadowRoot}function Mg(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=ps(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function hX(t){return["table","td","th"].includes(Hf(t))}function X0(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function pN(t){const e=mN(),n=hs(t)?ps(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 pX(t){let e=il(t);for(;ta(e)&&!rf(e);){if(pN(e))return e;if(X0(e))return null;e=il(e)}return null}function mN(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function rf(t){return["html","body","#document"].includes(Hf(t))}function ps(t){return to(t).getComputedStyle(t)}function J0(t){return hs(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function il(t){if(Hf(t)==="html")return t;const e=t.assignedSlot||t.parentNode||II(t)&&t.host||ca(t);return II(e)?e.host:e}function D5(t){const e=il(t);return rf(e)?t.ownerDocument?t.ownerDocument.body:t.body:ta(e)&&Mg(e)?e:D5(e)}function om(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=D5(t),o=i===((r=t.ownerDocument)==null?void 0:r.body),s=to(i);if(o){const c=_A(s);return e.concat(s,s.visualViewport||[],Mg(i)?i:[],c&&n?om(c):[])}return e.concat(i,om(i,[],n))}function _A(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function $5(t){const e=ps(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=ta(t),o=i?t.offsetWidth:n,s=i?t.offsetHeight:r,c=wx(n)!==o||wx(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function gN(t){return hs(t)?t:t.contextElement}function Ed(t){const e=gN(t);if(!ta(e))return nl(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:o}=$5(e);let s=(o?wx(n.width):n.width)/r,c=(o?wx(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const mX=nl(0);function L5(t){const e=to(t);return!mN()||!e.visualViewport?mX:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function gX(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==to(t)?!1:e}function pu(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),o=gN(t);let s=nl(1);e&&(r?hs(r)&&(s=Ed(r)):s=Ed(t));const c=gX(o,n,r)?L5(o):nl(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=to(o),p=r&&hs(r)?to(r):r;let v=h,m=_A(v);for(;m&&r&&p!==v;){const y=Ed(m),b=m.getBoundingClientRect(),x=ps(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,v=to(m),m=_A(v)}}return Cx({width:d,height:f,x:l,y:u})}function vX(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const o=i==="fixed",s=ca(r),c=e?X0(e.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=nl(1);const d=nl(0),f=ta(r);if((f||!f&&!o)&&((Hf(r)!=="body"||Mg(s))&&(l=J0(r)),ta(r))){const h=pu(r);u=Ed(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 yX(t){return Array.from(t.getClientRects())}function AA(t,e){const n=J0(t).scrollLeft;return e?e.left+n:pu(ca(t)).left+n}function xX(t){const e=ca(t),n=J0(t),r=t.ownerDocument.body,i=Xi(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=Xi(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+AA(t);const c=-n.scrollTop;return ps(r).direction==="rtl"&&(s+=Xi(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:c}}function bX(t,e){const n=to(t),r=ca(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=mN();(!u||u&&e==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:c,y:l}}function wX(t,e){const n=pu(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,o=ta(t)?Ed(t):nl(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 RI(t,e,n){let r;if(e==="viewport")r=bX(t,n);else if(e==="document")r=xX(ca(t));else if(hs(e))r=wX(e,n);else{const i=L5(t);r={...e,x:e.x-i.x,y:e.y-i.y}}return Cx(r)}function F5(t,e){const n=il(t);return n===e||!hs(n)||rf(n)?!1:ps(n).position==="fixed"||F5(n,e)}function SX(t,e){const n=e.get(t);if(n)return n;let r=om(t,[],!1).filter(c=>hs(c)&&Hf(c)!=="body"),i=null;const o=ps(t).position==="fixed";let s=o?il(t):t;for(;hs(s)&&!rf(s);){const c=ps(s),l=pN(s);!l&&c.position==="fixed"&&(i=null),(o?!l&&!i:!l&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Mg(s)&&!l&&F5(t,s))?r=r.filter(d=>d!==s):i=c,s=il(s)}return e.set(t,r),r}function CX(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const s=[...n==="clippingAncestors"?X0(e)?[]:SX(e,this._c):[].concat(n),r],c=s[0],l=s.reduce((u,d)=>{const f=RI(e,d,i);return u.top=Xi(f.top,u.top),u.right=tl(f.right,u.right),u.bottom=tl(f.bottom,u.bottom),u.left=Xi(f.left,u.left),u},RI(e,c,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function _X(t){const{width:e,height:n}=$5(t);return{width:e,height:n}}function AX(t,e,n){const r=ta(e),i=ca(e),o=n==="fixed",s=pu(t,!0,o,e);let c={scrollLeft:0,scrollTop:0};const l=nl(0);if(r||!r&&!o)if((Hf(e)!=="body"||Mg(i))&&(c=J0(e)),r){const p=pu(e,!0,o,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else i&&(l.x=AA(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+c.scrollTop,u=p.left+c.scrollLeft-AA(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 gC(t){return ps(t).position==="static"}function MI(t,e){if(!ta(t)||ps(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return ca(t)===n&&(n=n.ownerDocument.body),n}function B5(t,e){const n=to(t);if(X0(t))return n;if(!ta(t)){let i=il(t);for(;i&&!rf(i);){if(hs(i)&&!gC(i))return i;i=il(i)}return n}let r=MI(t,e);for(;r&&hX(r)&&gC(r);)r=MI(r,e);return r&&rf(r)&&gC(r)&&!pN(r)?n:r||pX(t)||n}const jX=async function(t){const e=this.getOffsetParent||B5,n=this.getDimensions,r=await n(t.floating);return{reference:AX(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function EX(t){return ps(t).direction==="rtl"}const NX={convertOffsetParentRelativeRectToViewportRelativeRect:vX,getDocumentElement:ca,getClippingRect:CX,getOffsetParent:B5,getElementRects:jX,getClientRects:yX,getDimensions:_X,getScale:Ed,isElement:hs,isRTL:EX};function TX(t,e){let n=null,r;const i=ca(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=Mv(d),v=Mv(i.clientWidth-(u+f)),m=Mv(i.clientHeight-(d+h)),y=Mv(u),x={rootMargin:-p+"px "+-v+"px "+-m+"px "+-y+"px",threshold:Xi(0,tl(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 kX(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=gN(t),d=i||o?[...u?om(u):[],...om(e)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),o&&b.addEventListener("resize",n)});const f=u&&c?TX(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 v,m=l?pu(t):null;l&&y();function y(){const b=pu(t);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,v=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(v)}}const PX=lX,OX=uX,IX=sX,RX=fX,MX=aX,DI=oX,DX=dX,$X=(t,e,n)=>{const r=new Map,i={platform:NX,...n},o={...i.platform,_c:r};return iX(t,e,{...i,platform:o})};var ky=typeof document<"u"?g.useLayoutEffect:g.useEffect;function _x(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(!_x(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)&&!_x(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function U5(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function $I(t,e){const n=U5(t);return Math.round(e*n)/n}function vC(t){const e=g.useRef(t);return ky(()=>{e.current=t}),e}function LX(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]=g.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[h,p]=g.useState(r);_x(h,r)||p(r);const[v,m]=g.useState(null),[y,b]=g.useState(null),x=g.useCallback(M=>{M!==_.current&&(_.current=M,m(M))},[]),w=g.useCallback(M=>{M!==A.current&&(A.current=M,b(M))},[]),S=o||v,C=s||y,_=g.useRef(null),A=g.useRef(null),j=g.useRef(d),T=l!=null,k=vC(l),O=vC(i),E=vC(u),R=g.useCallback(()=>{if(!_.current||!A.current)return;const M={placement:e,strategy:n,middleware:h};O.current&&(M.platform=O.current),$X(_.current,A.current,M).then($=>{const Q={...$,isPositioned:E.current!==!1};D.current&&!_x(j.current,Q)&&(j.current=Q,es.flushSync(()=>{f(Q)}))})},[h,e,n,O,E]);ky(()=>{u===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,f(M=>({...M,isPositioned:!1})))},[u]);const D=g.useRef(!1);ky(()=>(D.current=!0,()=>{D.current=!1}),[]),ky(()=>{if(S&&(_.current=S),C&&(A.current=C),S&&C){if(k.current)return k.current(S,C,R);R()}},[S,C,R,k,T]);const V=g.useMemo(()=>({reference:_,floating:A,setReference:x,setFloating:w}),[x,w]),L=g.useMemo(()=>({reference:S,floating:C}),[S,C]),z=g.useMemo(()=>{const M={position:n,left:0,top:0};if(!L.floating)return M;const $=$I(L.floating,d.x),Q=$I(L.floating,d.y);return c?{...M,transform:"translate("+$+"px, "+Q+"px)",...U5(L.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:Q}},[n,c,L.floating,d.x,d.y]);return g.useMemo(()=>({...d,update:R,refs:V,elements:L,floatingStyles:z}),[d,R,V,L,z])}const FX=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?DI({element:r.current,padding:i}).fn(n):{}:r?DI({element:r,padding:i}).fn(n):{}}}},BX=(t,e)=>({...PX(t),options:[t,e]}),UX=(t,e)=>({...OX(t),options:[t,e]}),zX=(t,e)=>({...DX(t),options:[t,e]}),HX=(t,e)=>({...IX(t),options:[t,e]}),VX=(t,e)=>({...RX(t),options:[t,e]}),GX=(t,e)=>({...MX(t),options:[t,e]}),KX=(t,e)=>({...FX(t),options:[t,e]});var WX="Arrow",z5=g.forwardRef((t,e)=>{const{children:n,width:r=10,height:i=5,...o}=t;return a.jsx(ht.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"})})});z5.displayName=WX;var qX=z5;function YX(t,e=[]){let n=[];function r(o,s){const c=g.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...v}=f,m=(h==null?void 0:h[t][l])||c,y=g.useMemo(()=>v,Object.values(v));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,v=g.useContext(p);if(v)return v;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=>g.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return g.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,QX(i,...e)]}function QX(...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 g.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function Dg(t){const[e,n]=g.useState(void 0);return qr(()=>{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 vN="Popper",[H5,Vf]=YX(vN),[XX,V5]=H5(vN),G5=t=>{const{__scopePopper:e,children:n}=t,[r,i]=g.useState(null);return a.jsx(XX,{scope:e,anchor:r,onAnchorChange:i,children:n})};G5.displayName=vN;var K5="PopperAnchor",W5=g.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...i}=t,o=V5(K5,n),s=g.useRef(null),c=It(e,s);return g.useEffect(()=>{o.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:a.jsx(ht.div,{...i,ref:c})});W5.displayName=K5;var yN="PopperContent",[JX,ZX]=H5(yN),q5=g.forwardRef((t,e)=>{var U,de,se,ne,je,K;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:v,...m}=t,y=V5(yN,n),[b,x]=g.useState(null),w=It(e,et=>x(et)),[S,C]=g.useState(null),_=Dg(S),A=(_==null?void 0:_.width)??0,j=(_==null?void 0:_.height)??0,T=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,R={padding:k,boundary:O.filter(tJ),altBoundary:E},{refs:D,floatingStyles:V,placement:L,isPositioned:z,middlewareData:M}=LX({strategy:"fixed",placement:T,whileElementsMounted:(...et)=>kX(...et,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[BX({mainAxis:i+j,alignmentAxis:s}),l&&UX({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?zX():void 0,...R}),l&&HX({...R}),VX({...R,apply:({elements:et,rects:Me,availableWidth:ut,availableHeight:Ye})=>{const{width:Pt,height:F}=Me.reference,J=et.floating.style;J.setProperty("--radix-popper-available-width",`${ut}px`),J.setProperty("--radix-popper-available-height",`${Ye}px`),J.setProperty("--radix-popper-anchor-width",`${Pt}px`),J.setProperty("--radix-popper-anchor-height",`${F}px`)}}),S&&KX({element:S,padding:c}),nJ({arrowWidth:A,arrowHeight:j}),h&&GX({strategy:"referenceHidden",...R})]}),[$,Q]=X5(L),q=Ar(v);qr(()=>{z&&(q==null||q())},[z,q]);const te=(U=M.arrow)==null?void 0:U.x,xe=(de=M.arrow)==null?void 0:de.y,B=((se=M.arrow)==null?void 0:se.centerOffset)!==0,[ce,he]=g.useState();return qr(()=>{b&&he(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:D.setFloating,"data-radix-popper-content-wrapper":"",style:{...V,transform:z?V.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[(ne=M.transformOrigin)==null?void 0:ne.x,(je=M.transformOrigin)==null?void 0:je.y].join(" "),...((K=M.hide)==null?void 0:K.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(JX,{scope:n,placedSide:$,onArrowChange:C,arrowX:te,arrowY:xe,shouldHideArrow:B,children:a.jsx(ht.div,{"data-side":$,"data-align":Q,...m,ref:w,style:{...m.style,animation:z?void 0:"none"}})})})});q5.displayName=yN;var Y5="PopperArrow",eJ={top:"bottom",right:"left",bottom:"top",left:"right"},Q5=g.forwardRef(function(e,n){const{__scopePopper:r,...i}=e,o=ZX(Y5,r),s=eJ[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(qX,{...i,ref:n,style:{...i.style,display:"block"}})})});Q5.displayName=Y5;function tJ(t){return t!==null}var nJ=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]=X5(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 v="",m="";return u==="bottom"?(v=s?f:`${h}px`,m=`${-l}px`):u==="top"?(v=s?f:`${h}px`,m=`${r.floating.height+l}px`):u==="right"?(v=`${-l}px`,m=s?f:`${p}px`):u==="left"&&(v=`${r.floating.width+l}px`,m=s?f:`${p}px`),{data:{x:v,y:m}}}});function X5(t){const[e,n="center"]=t.split("-");return[e,n]}var J5=G5,xN=W5,bN=q5,wN=Q5,rJ="Portal",Z0=g.forwardRef((t,e)=>{var c;const{container:n,...r}=t,[i,o]=g.useState(!1);qr(()=>o(!0),[]);const s=n||i&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return s?T5.createPortal(a.jsx(ht.div,{...r,ref:e}),s):null});Z0.displayName=rJ;function iJ(t,e){return g.useReducer((n,r)=>e[n][r]??n,t)}var Yr=t=>{const{present:e,children:n}=t,r=oJ(e),i=typeof n=="function"?n({present:r.isPresent}):g.Children.only(n),o=It(r.ref,sJ(i));return typeof n=="function"||r.isPresent?g.cloneElement(i,{ref:o}):null};Yr.displayName="Presence";function oJ(t){const[e,n]=g.useState(),r=g.useRef({}),i=g.useRef(t),o=g.useRef("none"),s=t?"mounted":"unmounted",[c,l]=iJ(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const u=Dv(r.current);o.current=c==="mounted"?u:"none"},[c]),qr(()=>{const u=r.current,d=i.current;if(d!==t){const h=o.current,p=Dv(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]),qr(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=p=>{const m=Dv(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=Dv(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:g.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Dv(t){return(t==null?void 0:t.animationName)||"none"}function sJ(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 ms({prop:t,defaultProp:e,onChange:n=()=>{}}){const[r,i]=aJ({defaultProp:e,onChange:n}),o=t!==void 0,s=o?t:r,c=Ar(n),l=g.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 aJ({defaultProp:t,onChange:e}){const n=g.useState(t),[r]=n,i=g.useRef(r),o=Ar(e);return g.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}var cJ="VisuallyHidden",SN=g.forwardRef((t,e)=>a.jsx(ht.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}}));SN.displayName=cJ;var lJ=SN,[ew,KBe]=Bi("Tooltip",[Vf]),CN=Vf(),Z5="TooltipProvider",uJ=700,LI="tooltip.open",[dJ,eB]=ew(Z5),tB=t=>{const{__scopeTooltip:e,delayDuration:n=uJ,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:o}=t,[s,c]=g.useState(!0),l=g.useRef(!1),u=g.useRef(0);return g.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(dJ,{scope:e,isOpenDelayed:s,delayDuration:n,onOpen:g.useCallback(()=>{window.clearTimeout(u.current),c(!1)},[]),onClose:g.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>c(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:g.useCallback(d=>{l.current=d},[]),disableHoverableContent:i,children:o})};tB.displayName=Z5;var nB="Tooltip",[WBe,tw]=ew(nB),jA="TooltipTrigger",fJ=g.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=tw(jA,n),o=eB(jA,n),s=CN(n),c=g.useRef(null),l=It(e,c,i.onTriggerChange),u=g.useRef(!1),d=g.useRef(!1),f=g.useCallback(()=>u.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(xN,{asChild:!0,...s,children:a.jsx(ht.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:l,onPointerMove:Le(t.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!o.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:Le(t.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:Le(t.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Le(t.onFocus,()=>{u.current||i.onOpen()}),onBlur:Le(t.onBlur,i.onClose),onClick:Le(t.onClick,i.onClose)})})});fJ.displayName=jA;var hJ="TooltipPortal",[qBe,pJ]=ew(hJ,{forceMount:void 0}),of="TooltipContent",rB=g.forwardRef((t,e)=>{const n=pJ(of,t.__scopeTooltip),{forceMount:r=n.forceMount,side:i="top",...o}=t,s=tw(of,t.__scopeTooltip);return a.jsx(Yr,{present:r||s.open,children:s.disableHoverableContent?a.jsx(iB,{side:i,...o,ref:e}):a.jsx(mJ,{side:i,...o,ref:e})})}),mJ=g.forwardRef((t,e)=>{const n=tw(of,t.__scopeTooltip),r=eB(of,t.__scopeTooltip),i=g.useRef(null),o=It(e,i),[s,c]=g.useState(null),{trigger:l,onClose:u}=n,d=i.current,{onPointerInTransitChange:f}=r,h=g.useCallback(()=>{c(null),f(!1)},[f]),p=g.useCallback((v,m)=>{const y=v.currentTarget,b={x:v.clientX,y:v.clientY},x=xJ(b,y.getBoundingClientRect()),w=bJ(b,x),S=wJ(m.getBoundingClientRect()),C=CJ([...w,...S]);c(C),f(!0)},[f]);return g.useEffect(()=>()=>h(),[h]),g.useEffect(()=>{if(l&&d){const v=y=>p(y,d),m=y=>p(y,l);return l.addEventListener("pointerleave",v),d.addEventListener("pointerleave",m),()=>{l.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",m)}}},[l,d,p,h]),g.useEffect(()=>{if(s){const v=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=!SJ(b,s);x?h():w&&(h(),u())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,d,s,u,h]),a.jsx(iB,{...t,ref:o})}),[gJ,vJ]=ew(nB,{isInside:!1}),iB=g.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=t,l=tw(of,n),u=CN(n),{onClose:d}=l;return g.useEffect(()=>(document.addEventListener(LI,d),()=>document.removeEventListener(LI,d)),[d]),g.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(Rg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(bN,{"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(uN,{children:r}),a.jsx(gJ,{scope:n,isInside:!0,children:a.jsx(lJ,{id:l.contentId,role:"tooltip",children:i||r})})]})})});rB.displayName=of;var oB="TooltipArrow",yJ=g.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,i=CN(n);return vJ(oB,n).isInside?null:a.jsx(wN,{...i,...r,ref:e})});yJ.displayName=oB;function xJ(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 bJ(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 wJ(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 SJ(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 CJ(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),_J(e)}function _J(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 AJ=tB,sB=rB;function aB(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=NJ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const c=s.split(_N);return c[0]===""&&c.length!==1&&c.shift(),cB(c,e)||EJ(s)},getConflictingClassGroupIds:(s,c)=>{const l=n[s]||[];return c&&r[s]?[...l,...r[s]]:l}}},cB=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?cB(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(_N);return(s=e.validators.find(({validator:c})=>c(o)))==null?void 0:s.classGroupId},FI=/^\[(.+)\]$/,EJ=t=>{if(FI.test(t)){const e=FI.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},NJ=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return kJ(Object.entries(t.classGroups),n).forEach(([o,s])=>{EA(s,r,o,e)}),r},EA=(t,e,n,r)=>{t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:BI(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(TJ(i)){EA(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{EA(s,BI(e,o),n,r)})})},BI=(t,e)=>{let n=t;return e.split(_N).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},TJ=t=>t.isThemeGetter,kJ=(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,PJ=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)}}},lB="!",OJ=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:v,maybePostfixModifierPosition:m}};return n?c=>n({className:c,parseClassName:s}):s},IJ=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},RJ=t=>({cache:PJ(t.cacheSize),parseClassName:OJ(t),...jJ(t)}),MJ=/\s+/,DJ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=[],s=t.trim().split(MJ);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 v=!!p,m=r(v?h.substring(0,p):h);if(!m){if(!v){c=u+(c.length>0?" "+c:c);continue}if(m=r(h),!m){c=u+(c.length>0?" "+c:c);continue}v=!1}const y=IJ(d).join(":"),b=f?y+lB:y,x=b+m;if(o.includes(x))continue;o.push(x);const w=i(m,v);for(let S=0;S0?" "+c:c)}return c};function $J(){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=RJ(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=DJ(l,n);return i(l,d),d}return function(){return o($J.apply(null,arguments))}}const Fn=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},dB=/^\[(?:([a-z-]+):)?(.+)\]$/i,FJ=/^\d+\/\d+$/,BJ=new Set(["px","full","screen"]),UJ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,zJ=/\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$/,HJ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,VJ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,GJ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ha=t=>Nd(t)||BJ.has(t)||FJ.test(t),ac=t=>Gf(t,"length",ZJ),Nd=t=>!!t&&!Number.isNaN(Number(t)),yC=t=>Gf(t,"number",Nd),Mh=t=>!!t&&Number.isInteger(Number(t)),KJ=t=>t.endsWith("%")&&Nd(t.slice(0,-1)),Ht=t=>dB.test(t),cc=t=>UJ.test(t),WJ=new Set(["length","size","percentage"]),qJ=t=>Gf(t,WJ,fB),YJ=t=>Gf(t,"position",fB),QJ=new Set(["image","url"]),XJ=t=>Gf(t,QJ,tZ),JJ=t=>Gf(t,"",eZ),Dh=()=>!0,Gf=(t,e,n)=>{const r=dB.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},ZJ=t=>zJ.test(t)&&!HJ.test(t),fB=()=>!1,eZ=t=>VJ.test(t),tZ=t=>GJ.test(t),nZ=()=>{const t=Fn("colors"),e=Fn("spacing"),n=Fn("blur"),r=Fn("brightness"),i=Fn("borderColor"),o=Fn("borderRadius"),s=Fn("borderSpacing"),c=Fn("borderWidth"),l=Fn("contrast"),u=Fn("grayscale"),d=Fn("hueRotate"),f=Fn("invert"),h=Fn("gap"),p=Fn("gradientColorStops"),v=Fn("gradientColorStopPositions"),m=Fn("inset"),y=Fn("margin"),b=Fn("opacity"),x=Fn("padding"),w=Fn("saturate"),S=Fn("scale"),C=Fn("sepia"),_=Fn("skew"),A=Fn("space"),j=Fn("translate"),T=()=>["auto","contain","none"],k=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",Ht,e],E=()=>[Ht,e],R=()=>["",ha,ac],D=()=>["auto",Nd,Ht],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],L=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],M=()=>["start","end","center","between","around","evenly","stretch"],$=()=>["","0",Ht],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],q=()=>[Nd,Ht];return{cacheSize:500,separator:":",theme:{colors:[Dh],spacing:[ha,ac],blur:["none","",cc,Ht],brightness:q(),borderColor:[t],borderRadius:["none","","full",cc,Ht],borderSpacing:E(),borderWidth:R(),contrast:q(),grayscale:$(),hueRotate:q(),invert:$(),gap:E(),gradientColorStops:[t],gradientColorStopPositions:[KJ,ac],inset:O(),margin:O(),opacity:q(),padding:E(),saturate:q(),scale:q(),sepia:$(),skew:q(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",Ht]}],container:["container"],columns:[{columns:[cc]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"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:[...V(),Ht]}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],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",Mh,Ht]}],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",Ht]}],grow:[{grow:$()}],shrink:[{shrink:$()}],order:[{order:["first","last","none",Mh,Ht]}],"grid-cols":[{"grid-cols":[Dh]}],"col-start-end":[{col:["auto",{span:["full",Mh,Ht]},Ht]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Dh]}],"row-start-end":[{row:["auto",{span:[Mh,Ht]},Ht]}],"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",Ht]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Ht]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...M()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...M(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...M(),"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",Ht,e]}],"min-w":[{"min-w":[Ht,e,"min","max","fit"]}],"max-w":[{"max-w":[Ht,e,"none","full","min","max","fit","prose",{screen:[cc]},cc]}],h:[{h:[Ht,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Ht,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Ht,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Ht,e,"auto","min","max","fit"]}],"font-size":[{text:["base",cc,ac]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",yC]}],"font-family":[{font:[Dh]}],"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",Ht]}],"line-clamp":[{"line-clamp":["none",Nd,yC]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ha,Ht]}],"list-image":[{"list-image":["none",Ht]}],"list-style-type":[{list:["none","disc","decimal",Ht]}],"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:[...L(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ha,ac]}],"underline-offset":[{"underline-offset":["auto",ha,Ht]}],"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",Ht]}],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",Ht]}],"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:[...V(),YJ]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",qJ]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},XJ]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"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:[...L(),"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:L()}],"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:["",...L()]}],"outline-offset":[{"outline-offset":[ha,Ht]}],"outline-w":[{outline:[ha,ac]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ha,ac]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",cc,JJ]}],"shadow-color":[{shadow:[Dh]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...z(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",cc,Ht]}],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",Ht]}],duration:[{duration:q()}],ease:[{ease:["linear","in","out","in-out",Ht]}],delay:[{delay:q()}],animate:[{animate:["none","spin","ping","pulse","bounce",Ht]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[S]}],"scale-x":[{"scale-x":[S]}],"scale-y":[{"scale-y":[S]}],rotate:[{rotate:[Mh,Ht]}],"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",Ht]}],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",Ht]}],"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",Ht]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ha,ac,yC]}],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"]}}},rZ=LJ(nZ);function Fe(...t){return rZ(Mt(t))}const iZ=AJ,oZ=g.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(sB,{ref:r,sideOffset:e,className:Fe("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}));oZ.displayName=sB.displayName;var nw=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(){}},rw=typeof window>"u"||"Deno"in globalThis;function Go(){}function sZ(t,e){return typeof t=="function"?t(e):t}function aZ(t){return typeof t=="number"&&t>=0&&t!==1/0}function cZ(t,e){return Math.max(t+(e||0)-Date.now(),0)}function UI(t,e){return typeof t=="function"?t(e):t}function lZ(t,e){return typeof t=="function"?t(e):t}function zI(t,e){const{type:n="all",exact:r,fetchStatus:i,predicate:o,queryKey:s,stale:c}=t;if(s){if(r){if(e.queryHash!==AN(s,e.options))return!1}else if(!am(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 HI(t,e){const{exact:n,status:r,predicate:i,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(sm(e.options.mutationKey)!==sm(o))return!1}else if(!am(e.options.mutationKey,o))return!1}return!(r&&e.state.status!==r||i&&!i(e))}function AN(t,e){return((e==null?void 0:e.queryKeyHashFn)||sm)(t)}function sm(t){return JSON.stringify(t,(e,n)=>NA(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function am(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?!Object.keys(e).some(n=>!am(t[n],e[n])):!1}function hB(t,e){if(t===e)return t;const n=VI(t)&&VI(e);if(n||NA(t)&&NA(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 dZ(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?hB(t,e):e}function fZ(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function hZ(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var jN=Symbol();function pB(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===jN?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Xl,_c,Ud,cF,pZ=(cF=class extends nw{constructor(){super();mn(this,Xl);mn(this,_c);mn(this,Ud);qt(this,Ud,e=>{if(!rw&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_e(this,_c)||this.setEventListener(_e(this,Ud))}onUnsubscribe(){var e;this.hasListeners()||((e=_e(this,_c))==null||e.call(this),qt(this,_c,void 0))}setEventListener(e){var n;qt(this,Ud,e),(n=_e(this,_c))==null||n.call(this),qt(this,_c,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){_e(this,Xl)!==e&&(qt(this,Xl,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof _e(this,Xl)=="boolean"?_e(this,Xl):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Xl=new WeakMap,_c=new WeakMap,Ud=new WeakMap,cF),mB=new pZ,zd,Ac,Hd,lF,mZ=(lF=class extends nw{constructor(){super();mn(this,zd,!0);mn(this,Ac);mn(this,Hd);qt(this,Hd,e=>{if(!rw&&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(){_e(this,Ac)||this.setEventListener(_e(this,Hd))}onUnsubscribe(){var e;this.hasListeners()||((e=_e(this,Ac))==null||e.call(this),qt(this,Ac,void 0))}setEventListener(e){var n;qt(this,Hd,e),(n=_e(this,Ac))==null||n.call(this),qt(this,Ac,e(this.setOnline.bind(this)))}setOnline(e){_e(this,zd)!==e&&(qt(this,zd,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return _e(this,zd)}},zd=new WeakMap,Ac=new WeakMap,Hd=new WeakMap,lF),Ax=new mZ;function gZ(){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 vZ(t){return Math.min(1e3*2**t,3e4)}function gB(t){return(t??"online")==="online"?Ax.isOnline():!0}var vB=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function xC(t){return t instanceof vB}function yB(t){let e=!1,n=0,r=!1,i;const o=gZ(),s=m=>{var y;r||(h(new vB(m)),(y=t.abort)==null||y.call(t))},c=()=>{e=!0},l=()=>{e=!1},u=()=>mB.isFocused()&&(t.networkMode==="always"||Ax.isOnline())&&t.canRun(),d=()=>gB(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)}),v=()=>{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??(rw?0:3),w=t.retryDelay??vZ,S=typeof w=="function"?w(n,b):w,C=x===!0||typeof x=="number"&&nu()?void 0:p()).then(()=>{e?h(b):v()})})};return{promise:o,cancel:s,continue:()=>(i==null||i(),o),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?v():p().then(v),o)}}function yZ(){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 mi=yZ(),Jl,uF,xB=(uF=class{constructor(){mn(this,Jl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),aZ(this.gcTime)&&qt(this,Jl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(rw?1/0:5*60*1e3))}clearGcTimeout(){_e(this,Jl)&&(clearTimeout(_e(this,Jl)),qt(this,Jl,void 0))}},Jl=new WeakMap,uF),Vd,Gd,po,Zr,Eg,Zl,Ko,va,dF,xZ=(dF=class extends xB{constructor(e){super();mn(this,Ko);mn(this,Vd);mn(this,Gd);mn(this,po);mn(this,Zr);mn(this,Eg);mn(this,Zl);qt(this,Zl,!1),qt(this,Eg,e.defaultOptions),this.setOptions(e.options),this.observers=[],qt(this,po,e.cache),this.queryKey=e.queryKey,this.queryHash=e.queryHash,qt(this,Vd,wZ(this.options)),this.state=e.state??_e(this,Vd),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=_e(this,Zr))==null?void 0:e.promise}setOptions(e){this.options={..._e(this,Eg),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_e(this,po).remove(this)}setData(e,n){const r=dZ(this.state.data,e,this.options);return Qr(this,Ko,va).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,Ko,va).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,i;const n=(r=_e(this,Zr))==null?void 0:r.promise;return(i=_e(this,Zr))==null||i.cancel(e),n?n.then(Go).catch(Go):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_e(this,Vd))}isActive(){return this.observers.some(e=>lZ(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===jN||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||!cZ(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=_e(this,Zr))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=_e(this,Zr))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),_e(this,po).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(_e(this,Zr)&&(_e(this,Zl)?_e(this,Zr).cancel({revert:!0}):_e(this,Zr).cancelRetry()),this.scheduleGc()),_e(this,po).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Qr(this,Ko,va).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(_e(this,Zr))return _e(this,Zr).continueRetry(),_e(this,Zr).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:()=>(qt(this,Zl,!0),r.signal)})},o=()=>{const f=pB(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return i(h),qt(this,Zl,!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),qt(this,Gd,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&Qr(this,Ko,va).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const c=f=>{var h,p,v,m;xC(f)&&f.silent||Qr(this,Ko,va).call(this,{type:"error",error:f}),xC(f)||((p=(h=_e(this,po).config).onError)==null||p.call(h,f,this),(m=(v=_e(this,po).config).onSettled)==null||m.call(v,this.state.data,f,this)),this.scheduleGc()};return qt(this,Zr,yB({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,v,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=_e(this,po).config).onSuccess)==null||p.call(h,f,this),(m=(v=_e(this,po).config).onSettled)==null||m.call(v,f,this.state.error,this),this.scheduleGc()},onError:c,onFail:(f,h)=>{Qr(this,Ko,va).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{Qr(this,Ko,va).call(this,{type:"pause"})},onContinue:()=>{Qr(this,Ko,va).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),_e(this,Zr).start()}},Vd=new WeakMap,Gd=new WeakMap,po=new WeakMap,Zr=new WeakMap,Eg=new WeakMap,Zl=new WeakMap,Ko=new WeakSet,va=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,...bZ(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 xC(i)&&i.revert&&_e(this,Gd)?{..._e(this,Gd),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),mi.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_e(this,po).notify({query:this,type:"updated",action:e})})},dF);function bZ(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gB(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function wZ(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 Ps,fF,SZ=(fF=class extends nw{constructor(e={}){super();mn(this,Ps);this.config=e,qt(this,Ps,new Map)}build(e,n,r){const i=n.queryKey,o=n.queryHash??AN(i,n);let s=this.get(o);return s||(s=new xZ({cache:this,queryKey:i,queryHash:o,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(s)),s}add(e){_e(this,Ps).has(e.queryHash)||(_e(this,Ps).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=_e(this,Ps).get(e.queryHash);n&&(e.destroy(),n===e&&_e(this,Ps).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){mi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return _e(this,Ps).get(e)}getAll(){return[..._e(this,Ps).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>zI(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>zI(e,r)):n}notify(e){mi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){mi.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){mi.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ps=new WeakMap,fF),Os,li,eu,Is,lc,hF,CZ=(hF=class extends xB{constructor(e){super();mn(this,Is);mn(this,Os);mn(this,li);mn(this,eu);this.mutationId=e.mutationId,qt(this,li,e.mutationCache),qt(this,Os,[]),this.state=e.state||_Z(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){_e(this,Os).includes(e)||(_e(this,Os).push(e),this.clearGcTimeout(),_e(this,li).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){qt(this,Os,_e(this,Os).filter(n=>n!==e)),this.scheduleGc(),_e(this,li).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){_e(this,Os).length||(this.state.status==="pending"?this.scheduleGc():_e(this,li).remove(this))}continue(){var e;return((e=_e(this,eu))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,s,c,l,u,d,f,h,p,v,m,y,b,x,w,S,C,_,A;qt(this,eu,yB({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(j,T)=>{Qr(this,Is,lc).call(this,{type:"failed",failureCount:j,error:T})},onPause:()=>{Qr(this,Is,lc).call(this,{type:"pause"})},onContinue:()=>{Qr(this,Is,lc).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_e(this,li).canRun(this)}));const n=this.state.status==="pending",r=!_e(this,eu).canStart();try{if(!n){Qr(this,Is,lc).call(this,{type:"pending",variables:e,isPaused:r}),await((o=(i=_e(this,li).config).onMutate)==null?void 0:o.call(i,e,this));const T=await((c=(s=this.options).onMutate)==null?void 0:c.call(s,e));T!==this.state.context&&Qr(this,Is,lc).call(this,{type:"pending",context:T,variables:e,isPaused:r})}const j=await _e(this,eu).start();return await((u=(l=_e(this,li).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=_e(this,li).config).onSettled)==null?void 0:p.call(h,j,null,this.state.variables,this.state.context,this)),await((m=(v=this.options).onSettled)==null?void 0:m.call(v,j,null,e,this.state.context)),Qr(this,Is,lc).call(this,{type:"success",data:j}),j}catch(j){try{throw await((b=(y=_e(this,li).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=_e(this,li).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,Is,lc).call(this,{type:"error",error:j})}}finally{_e(this,li).runNext(this)}}},Os=new WeakMap,li=new WeakMap,eu=new WeakMap,Is=new WeakSet,lc=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),mi.batch(()=>{_e(this,Os).forEach(r=>{r.onMutationUpdate(e)}),_e(this,li).notify({mutation:this,type:"updated",action:e})})},hF);function _Z(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Ki,Ng,pF,AZ=(pF=class extends nw{constructor(e={}){super();mn(this,Ki);mn(this,Ng);this.config=e,qt(this,Ki,new Map),qt(this,Ng,Date.now())}build(e,n,r){const i=new CZ({mutationCache:this,mutationId:++mv(this,Ng)._,options:e.defaultMutationOptions(n),state:r});return this.add(i),i}add(e){const n=$v(e),r=_e(this,Ki).get(n)??[];r.push(e),_e(this,Ki).set(n,r),this.notify({type:"added",mutation:e})}remove(e){var r;const n=$v(e);if(_e(this,Ki).has(n)){const i=(r=_e(this,Ki).get(n))==null?void 0:r.filter(o=>o!==e);i&&(i.length===0?_e(this,Ki).delete(n):_e(this,Ki).set(n,i))}this.notify({type:"removed",mutation:e})}canRun(e){var r;const n=(r=_e(this,Ki).get($v(e)))==null?void 0:r.find(i=>i.state.status==="pending");return!n||n===e}runNext(e){var r;const n=(r=_e(this,Ki).get($v(e)))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){mi.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}getAll(){return[..._e(this,Ki).values()].flat()}find(e){const n={exact:!0,...e};return this.getAll().find(r=>HI(n,r))}findAll(e={}){return this.getAll().filter(n=>HI(e,n))}notify(e){mi.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return mi.batch(()=>Promise.all(e.map(n=>n.continue().catch(Go))))}},Ki=new WeakMap,Ng=new WeakMap,pF);function $v(t){var e;return((e=t.options.scope)==null?void 0:e.id)??String(t.mutationId)}function KI(t){return{onFetch:(e,n)=>{var d,f,h,p,v;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=((v=e.state.data)==null?void 0:v.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=pB(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,T=C?hZ:fZ;return{pages:T(w.pages,A,j),pageParams:T(w.pageParams,S,j)}};if(i&&o.length){const w=i==="backward",S=w?jZ:WI,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:WI(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 WI(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 jZ(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 tr,jc,Ec,Kd,Wd,Nc,qd,Yd,mF,EZ=(mF=class{constructor(t={}){mn(this,tr);mn(this,jc);mn(this,Ec);mn(this,Kd);mn(this,Wd);mn(this,Nc);mn(this,qd);mn(this,Yd);qt(this,tr,t.queryCache||new SZ),qt(this,jc,t.mutationCache||new AZ),qt(this,Ec,t.defaultOptions||{}),qt(this,Kd,new Map),qt(this,Wd,new Map),qt(this,Nc,0)}mount(){mv(this,Nc)._++,_e(this,Nc)===1&&(qt(this,qd,mB.subscribe(async t=>{t&&(await this.resumePausedMutations(),_e(this,tr).onFocus())})),qt(this,Yd,Ax.subscribe(async t=>{t&&(await this.resumePausedMutations(),_e(this,tr).onOnline())})))}unmount(){var t,e;mv(this,Nc)._--,_e(this,Nc)===0&&((t=_e(this,qd))==null||t.call(this),qt(this,qd,void 0),(e=_e(this,Yd))==null||e.call(this),qt(this,Yd,void 0))}isFetching(t){return _e(this,tr).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return _e(this,jc).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=_e(this,tr).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=_e(this,tr).build(this,n);return t.revalidateIfStale&&r.isStaleByTime(UI(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(e)}}getQueriesData(t){return _e(this,tr).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=_e(this,tr).get(r.queryHash),o=i==null?void 0:i.state.data,s=sZ(e,o);if(s!==void 0)return _e(this,tr).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(t,e,n){return mi.batch(()=>_e(this,tr).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=_e(this,tr).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=_e(this,tr);mi.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=_e(this,tr),r={type:"active",...t};return mi.batch(()=>(n.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries(r,e)))}cancelQueries(t={},e={}){const n={revert:!0,...e},r=mi.batch(()=>_e(this,tr).findAll(t).map(i=>i.cancel(n)));return Promise.all(r).then(Go).catch(Go)}invalidateQueries(t={},e={}){return mi.batch(()=>{if(_e(this,tr).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=mi.batch(()=>_e(this,tr).findAll(t).filter(i=>!i.isDisabled()).map(i=>{let o=i.fetch(void 0,n);return n.throwOnError||(o=o.catch(Go)),i.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(r).then(Go)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=_e(this,tr).build(this,e);return n.isStaleByTime(UI(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Go).catch(Go)}fetchInfiniteQuery(t){return t.behavior=KI(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Go).catch(Go)}ensureInfiniteQueryData(t){return t.behavior=KI(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Ax.isOnline()?_e(this,jc).resumePausedMutations():Promise.resolve()}getQueryCache(){return _e(this,tr)}getMutationCache(){return _e(this,jc)}getDefaultOptions(){return _e(this,Ec)}setDefaultOptions(t){qt(this,Ec,t)}setQueryDefaults(t,e){_e(this,Kd).set(sm(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[..._e(this,Kd).values()];let n={};return e.forEach(r=>{am(t,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(t,e){_e(this,Wd).set(sm(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[..._e(this,Wd).values()];let n={};return e.forEach(r=>{am(t,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={..._e(this,Ec).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=AN(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===jN&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{..._e(this,Ec).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){_e(this,tr).clear(),_e(this,jc).clear()}},tr=new WeakMap,jc=new WeakMap,Ec=new WeakMap,Kd=new WeakMap,Wd=new WeakMap,Nc=new WeakMap,qd=new WeakMap,Yd=new WeakMap,mF),NZ=g.createContext(void 0),TZ=({client:t,children:e})=>(g.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(NZ.Provider,{value:t,children:e}));/** - * @remix-run/router v1.20.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function cm(){return cm=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function bB(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function PZ(){return Math.random().toString(36).substr(2,8)}function YI(t,e){return{usr:t.state,key:t.key,idx:e}}function TA(t,e,n,r){return n===void 0&&(n=null),cm({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Kf(e):e,{state:n,key:e&&e.key||r||PZ()})}function jx(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Kf(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function OZ(t,e,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,s=i.history,c=Pc.Pop,l=null,u=d();u==null&&(u=0,s.replaceState(cm({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){c=Pc.Pop;let y=d(),b=y==null?null:y-u;u=y,l&&l({action:c,location:m.location,delta:b})}function h(y,b){c=Pc.Push;let x=TA(m.location,y,b);u=d()+1;let w=YI(x,u),S=m.createHref(x);try{s.pushState(w,"",S)}catch(C){if(C instanceof DOMException&&C.name==="DataCloneError")throw C;i.location.assign(S)}o&&l&&l({action:c,location:m.location,delta:1})}function p(y,b){c=Pc.Replace;let x=TA(m.location,y,b);u=d();let w=YI(x,u),S=m.createHref(x);s.replaceState(w,"",S),o&&l&&l({action:c,location:m.location,delta:0})}function v(y){let b=i.location.origin!=="null"?i.location.origin:i.location.href,x=typeof y=="string"?y:jx(y);return x=x.replace(/ $/,"%20"),cr(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let m={get action(){return c},get location(){return t(i,s)},listen(y){if(l)throw new Error("A history only accepts one active listener");return i.addEventListener(qI,f),l=y,()=>{i.removeEventListener(qI,f),l=null}},createHref(y){return e(i,y)},createURL:v,encodeLocation(y){let b=v(y);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(y){return s.go(y)}};return m}var QI;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(QI||(QI={}));function IZ(t,e,n){return n===void 0&&(n="/"),RZ(t,e,n,!1)}function RZ(t,e,n,r){let i=typeof e=="string"?Kf(e):e,o=EN(i.pathname||"/",n);if(o==null)return null;let s=wB(t);MZ(s);let c=null;for(let l=0;c==null&&l{let l={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};l.relativePath.startsWith("/")&&(cr(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Vc([r,l.relativePath]),d=n.concat(l);o.children&&o.children.length>0&&(cr(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),wB(o.children,e,d,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:zZ(u,o.index),routesMeta:d})};return t.forEach((o,s)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))i(o,s);else for(let l of SB(o.path))i(o,s,l)}),e}function SB(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let s=SB(r.join("/")),c=[];return c.push(...s.map(l=>l===""?o:[o,l].join("/"))),i&&c.push(...s),c.map(l=>t.startsWith("/")&&l===""?"/":l)}function MZ(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:HZ(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const DZ=/^:[\w-]+$/,$Z=3,LZ=2,FZ=1,BZ=10,UZ=-2,XI=t=>t==="*";function zZ(t,e){let n=t.split("/"),r=n.length;return n.some(XI)&&(r+=UZ),e&&(r+=LZ),n.filter(i=>!XI(i)).reduce((i,o)=>i+(DZ.test(o)?$Z:o===""?FZ:BZ),r)}function HZ(t,e){return t.length===e.length&&t.slice(0,-1).every((r,i)=>r===e[i])?t[t.length-1]-e[e.length-1]:0}function VZ(t,e,n){let{routesMeta:r}=t,i={},o="/",s=[];for(let c=0;c{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=c[f]||"";s=o.slice(0,o.length-m.length).replace(/(.)\/+$/,"$1")}const v=c[f];return p&&!v?u[h]=void 0:u[h]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GZ(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),bB(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,c,l)=>(r.push({paramName:c,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),r]}function KZ(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return bB(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function EN(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function WZ(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:i=""}=typeof t=="string"?Kf(t):t;return{pathname:n?n.startsWith("/")?n:qZ(n,e):e,search:XZ(r),hash:JZ(i)}}function qZ(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function bC(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YZ(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function NN(t,e){let n=YZ(t);return e?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function TN(t,e,n,r){r===void 0&&(r=!1);let i;typeof t=="string"?i=Kf(t):(i=cm({},t),cr(!i.pathname||!i.pathname.includes("?"),bC("?","pathname","search",i)),cr(!i.pathname||!i.pathname.includes("#"),bC("#","pathname","hash",i)),cr(!i.search||!i.search.includes("#"),bC("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,c;if(s==null)c=n;else{let f=e.length-1;if(!r&&s.startsWith("..")){let h=s.split("/");for(;h[0]==="..";)h.shift(),f-=1;i.pathname=h.join("/")}c=f>=0?e[f]:"/"}let l=WZ(i,c),u=s&&s!=="/"&&s.endsWith("/"),d=(o||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const Vc=t=>t.join("/").replace(/\/\/+/g,"/"),QZ=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),XZ=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,JZ=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function ZZ(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const CB=["post","put","patch","delete"];new Set(CB);const eee=["get",...CB];new Set(eee);/** - * React Router v6.27.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function lm(){return lm=Object.assign?Object.assign.bind():function(t){for(var e=1;e{c.current=!0}),g.useCallback(function(u,d){if(d===void 0&&(d={}),!c.current)return;if(typeof u=="number"){r.go(u);return}let f=TN(u,JSON.parse(s),o,d.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:Vc([e,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[e,r,s,o,t])}function PN(){let{matches:t}=g.useContext(ec),e=t[t.length-1];return e?e.params:{}}function jB(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=g.useContext(vl),{matches:i}=g.useContext(ec),{pathname:o}=Ui(),s=JSON.stringify(NN(i,r.v7_relativeSplatPath));return g.useMemo(()=>TN(t,JSON.parse(s),o,n==="path"),[t,s,o,n])}function iee(t,e){return oee(t,e)}function oee(t,e,n,r){Wf()||cr(!1);let{navigator:i}=g.useContext(vl),{matches:o}=g.useContext(ec),s=o[o.length-1],c=s?s.params:{};s&&s.pathname;let l=s?s.pathnameBase:"/";s&&s.route;let u=Ui(),d;if(e){var f;let y=typeof e=="string"?Kf(e):e;l==="/"||(f=y.pathname)!=null&&f.startsWith(l)||cr(!1),d=y}else d=u;let h=d.pathname||"/",p=h;if(l!=="/"){let y=l.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let v=IZ(t,{pathname:p}),m=uee(v&&v.map(y=>Object.assign({},y,{params:Object.assign({},c,y.params),pathname:Vc([l,i.encodeLocation?i.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:Vc([l,i.encodeLocation?i.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),o,n,r);return e&&m?g.createElement(iw.Provider,{value:{location:lm({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Pc.Pop}},m):m}function see(){let t=pee(),e=ZZ(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},e),n?g.createElement("pre",{style:i},n):null,null)}const aee=g.createElement(see,null);class cee extends g.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?g.createElement(ec.Provider,{value:this.props.routeContext},g.createElement(_B.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function lee(t){let{routeContext:e,match:n,children:r}=t,i=g.useContext(kN);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),g.createElement(ec.Provider,{value:e},r)}function uee(t,e,n,r){var i;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var o;if(!n)return null;if(n.errors)t=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let s=t,c=(i=n)==null?void 0:i.errors;if(c!=null){let d=s.findIndex(f=>f.route.id&&(c==null?void 0:c[f.route.id])!==void 0);d>=0||cr(!1),s=s.slice(0,Math.min(s.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,f,h)=>{let p,v=!1,m=null,y=null;n&&(p=c&&f.route.id?c[f.route.id]:void 0,m=f.route.errorElement||aee,l&&(u<0&&h===0?(v=!0,y=null):u===h&&(v=!0,y=f.route.hydrateFallbackElement||null)));let b=e.concat(s.slice(0,h+1)),x=()=>{let w;return p?w=m:v?w=y:f.route.Component?w=g.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,g.createElement(lee,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?g.createElement(cee,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var EB=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(EB||{}),Ex=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Ex||{});function dee(t){let e=g.useContext(kN);return e||cr(!1),e}function fee(t){let e=g.useContext(tee);return e||cr(!1),e}function hee(t){let e=g.useContext(ec);return e||cr(!1),e}function NB(t){let e=hee(),n=e.matches[e.matches.length-1];return n.route.id||cr(!1),n.route.id}function pee(){var t;let e=g.useContext(_B),n=fee(Ex.UseRouteError),r=NB(Ex.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function mee(){let{router:t}=dee(EB.UseNavigateStable),e=NB(Ex.UseNavigateStable),n=g.useRef(!1);return AB(()=>{n.current=!0}),g.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,lm({fromRouteId:e},o)))},[t,e])}function TB(t){let{to:e,replace:n,state:r,relative:i}=t;Wf()||cr(!1);let{future:o,static:s}=g.useContext(vl),{matches:c}=g.useContext(ec),{pathname:l}=Ui(),u=ur(),d=TN(e,NN(c,o.v7_relativeSplatPath),l,i==="path"),f=JSON.stringify(d);return g.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:i}),[u,f,i,n,r]),null}function zo(t){cr(!1)}function gee(t){let{basename:e="/",children:n=null,location:r,navigationType:i=Pc.Pop,navigator:o,static:s=!1,future:c}=t;Wf()&&cr(!1);let l=e.replace(/^\/*/,"/"),u=g.useMemo(()=>({basename:l,navigator:o,static:s,future:lm({v7_relativeSplatPath:!1},c)}),[l,c,o,s]);typeof r=="string"&&(r=Kf(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:v="default"}=r,m=g.useMemo(()=>{let y=EN(d,l);return y==null?null:{location:{pathname:y,search:f,hash:h,state:p,key:v},navigationType:i}},[l,d,f,h,p,v,i]);return m==null?null:g.createElement(vl.Provider,{value:u},g.createElement(iw.Provider,{children:n,value:m}))}function vee(t){let{children:e,location:n}=t;return iee(kA(e),n)}new Promise(()=>{});function kA(t,e){e===void 0&&(e=[]);let n=[];return g.Children.forEach(t,(r,i)=>{if(!g.isValidElement(r))return;let o=[...e,i];if(r.type===g.Fragment){n.push.apply(n,kA(r.props.children,o));return}r.type!==zo&&cr(!1),!r.props.index||!r.props.children||cr(!1);let s={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(s.children=kA(r.props.children,o)),n.push(s)}),n}/** - * React Router DOM v6.27.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function PA(){return PA=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[i]=t[i]);return n}function xee(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function bee(t,e){return t.button===0&&(!e||e==="_self")&&!xee(t)}function OA(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(i=>[n,i]):[[n,r]])},[]))}function wee(t,e){let n=OA(t);return e&&e.forEach((r,i)=>{n.has(i)||e.getAll(i).forEach(o=>{n.append(i,o)})}),n}const See=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Cee="6";try{window.__reactRouterVersion=Cee}catch{}const _ee="startTransition",ZI=jF[_ee];function Aee(t){let{basename:e,children:n,future:r,window:i}=t,o=g.useRef();o.current==null&&(o.current=kZ({window:i,v5Compat:!0}));let s=o.current,[c,l]=g.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},d=g.useCallback(f=>{u&&ZI?ZI(()=>l(f)):l(f)},[l,u]);return g.useLayoutEffect(()=>s.listen(d),[s,d]),g.createElement(gee,{basename:e,children:n,location:c.location,navigationType:c.action,navigator:s,future:r})}const jee=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Eee=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,_o=g.forwardRef(function(e,n){let{onClick:r,relative:i,reloadDocument:o,replace:s,state:c,target:l,to:u,preventScrollReset:d,viewTransition:f}=e,h=yee(e,See),{basename:p}=g.useContext(vl),v,m=!1;if(typeof u=="string"&&Eee.test(u)&&(v=u,jee))try{let w=new URL(window.location.href),S=u.startsWith("//")?new URL(w.protocol+u):new URL(u),C=EN(S.pathname,p);S.origin===w.origin&&C!=null?u=C+S.search+S.hash:m=!0}catch{}let y=nee(u,{relative:i}),b=Nee(u,{replace:s,state:c,target:l,preventScrollReset:d,relative:i,viewTransition:f});function x(w){r&&r(w),w.defaultPrevented||b(w)}return g.createElement("a",PA({},h,{href:v||y,onClick:m||o?r:x,ref:n,target:l}))});var eR;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(eR||(eR={}));var tR;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(tR||(tR={}));function Nee(t,e){let{target:n,replace:r,state:i,preventScrollReset:o,relative:s,viewTransition:c}=e===void 0?{}:e,l=ur(),u=Ui(),d=jB(t,{relative:s});return g.useCallback(f=>{if(bee(f,n)){f.preventDefault();let h=r!==void 0?r:jx(u)===jx(d);l(t,{replace:h,state:i,preventScrollReset:o,relative:s,viewTransition:c})}},[u,l,d,r,i,n,t,o,s,c])}function Tee(t){let e=g.useRef(OA(t)),n=g.useRef(!1),r=Ui(),i=g.useMemo(()=>wee(r.search,n.current?null:e.current),[r.search]),o=ur(),s=g.useCallback((c,l)=>{const u=OA(typeof c=="function"?c(i):c);n.current=!0,o("?"+u,l)},[o,i]);return[i,s]}/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kee=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kB=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var Pee={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Oee=g.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:s,...c},l)=>g.createElement("svg",{ref:l,...Pee,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:kB("lucide",i),...c},[...s.map(([u,d])=>g.createElement(u,d)),...Array.isArray(o)?o:[o]]));/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ze=(t,e)=>{const n=g.forwardRef(({className:r,...i},o)=>g.createElement(Oee,{ref:o,iconNode:e,className:kB(`lucide-${kee(t)}`,r),...i}));return n.displayName=`${t}`,n};/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _a=ze("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nR=ze("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const um=ze("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wC=ze("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ts=ze("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mu=ze("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rR=ze("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Iee=ze("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Ree=ze("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IA=ze("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mee=ze("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Io=ze("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const yl=ze("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const mo=ze("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qf=ze("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Dee=ze("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ON=ze("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rp=ze("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const PB=ze("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $ee=ze("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lee=ze("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IN=ze("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fee=ze("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dm=ze("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Bee=ze("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Uee=ze("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const iR=ze("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ol=ze("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RA=ze("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const zee=ze("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sf=ze("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Hee=ze("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RN=ze("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OB=ze("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const go=ze("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vee=ze("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Gee=ze("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MA=ze("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Nx=ze("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Sp=ze("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Kee=ze("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Wee=ze("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DA=ze("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const qee=ze("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gu=ze("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Lv=ze("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const no=ze("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Yee=ze("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oR=ze("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const sR=ze("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qee=ze("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Xee=ze("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Rs=ze("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const na=ze("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Jee=ze("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aR=ze("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $A=ze("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Zee=ze("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ete=ze("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Vr=ze("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const tte=ze("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ru=ze("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MN=ze("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Tx=ze("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const DN=ze("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nte=ze("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rte=ze("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ite=ze("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ote=ze("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ste=ze("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kx=ze("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ate=ze("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Py=ze("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Qn=ze("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cte=ze("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lte=ze("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ute=ze("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fm=ze("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Fr=ze("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const IB=ze("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Mi=ze("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** - * @license lucide-react v0.462.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const RB=ze("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function MB(t,e){return function(){return t.apply(e,arguments)}}const{toString:dte}=Object.prototype,{getPrototypeOf:$N}=Object,{iterator:ow,toStringTag:DB}=Symbol,sw=(t=>e=>{const n=dte.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ss=t=>(t=t.toLowerCase(),e=>sw(e)===t),aw=t=>e=>typeof e===t,{isArray:Yf}=Array,hm=aw("undefined");function fte(t){return t!==null&&!hm(t)&&t.constructor!==null&&!hm(t.constructor)&&Di(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const $B=Ss("ArrayBuffer");function hte(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&$B(t.buffer),e}const pte=aw("string"),Di=aw("function"),LB=aw("number"),cw=t=>t!==null&&typeof t=="object",mte=t=>t===!0||t===!1,Oy=t=>{if(sw(t)!=="object")return!1;const e=$N(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(DB in t)&&!(ow in t)},gte=Ss("Date"),vte=Ss("File"),yte=Ss("Blob"),xte=Ss("FileList"),bte=t=>cw(t)&&Di(t.pipe),wte=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||Di(t.append)&&((e=sw(t))==="formdata"||e==="object"&&Di(t.toString)&&t.toString()==="[object FormData]"))},Ste=Ss("URLSearchParams"),[Cte,_te,Ate,jte]=["ReadableStream","Request","Response","Headers"].map(Ss),Ete=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function $g(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,i;if(typeof t!="object"&&(t=[t]),Yf(t))for(r=0,i=t.length;r0;)if(i=n[r],e===i.toLowerCase())return i;return null}const Ul=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,BB=t=>!hm(t)&&t!==Ul;function LA(){const{caseless:t}=BB(this)&&this||{},e={},n=(r,i)=>{const o=t&&FB(e,i)||i;Oy(e[o])&&Oy(r)?e[o]=LA(e[o],r):Oy(r)?e[o]=LA({},r):Yf(r)?e[o]=r.slice():e[o]=r};for(let r=0,i=arguments.length;r($g(e,(i,o)=>{n&&Di(i)?t[o]=MB(i,n):t[o]=i},{allOwnKeys:r}),t),Tte=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),kte=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},Pte=(t,e,n,r)=>{let i,o,s;const c={};if(e=e||{},t==null)return e;do{for(i=Object.getOwnPropertyNames(t),o=i.length;o-- >0;)s=i[o],(!r||r(s,t,e))&&!c[s]&&(e[s]=t[s],c[s]=!0);t=n!==!1&&$N(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},Ote=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},Ite=t=>{if(!t)return null;if(Yf(t))return t;let e=t.length;if(!LB(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},Rte=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&$N(Uint8Array)),Mte=(t,e)=>{const r=(t&&t[ow]).call(t);let i;for(;(i=r.next())&&!i.done;){const o=i.value;e.call(t,o[0],o[1])}},Dte=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},$te=Ss("HTMLFormElement"),Lte=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),cR=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),Fte=Ss("RegExp"),UB=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};$g(n,(i,o)=>{let s;(s=e(i,o,t))!==!1&&(r[o]=s||i)}),Object.defineProperties(t,r)},Bte=t=>{UB(t,(e,n)=>{if(Di(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(Di(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Ute=(t,e)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return Yf(t)?r(t):r(String(t).split(e)),n},zte=()=>{},Hte=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function Vte(t){return!!(t&&Di(t.append)&&t[DB]==="FormData"&&t[ow])}const Gte=t=>{const e=new Array(10),n=(r,i)=>{if(cw(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const o=Yf(r)?[]:{};return $g(r,(s,c)=>{const l=n(s,i+1);!hm(l)&&(o[c]=l)}),e[i]=void 0,o}}return r};return n(t,0)},Kte=Ss("AsyncFunction"),Wte=t=>t&&(cw(t)||Di(t))&&Di(t.then)&&Di(t.catch),zB=((t,e)=>t?setImmediate:e?((n,r)=>(Ul.addEventListener("message",({source:i,data:o})=>{i===Ul&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Ul.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Di(Ul.postMessage)),qte=typeof queueMicrotask<"u"?queueMicrotask.bind(Ul):typeof process<"u"&&process.nextTick||zB,Yte=t=>t!=null&&Di(t[ow]),fe={isArray:Yf,isArrayBuffer:$B,isBuffer:fte,isFormData:wte,isArrayBufferView:hte,isString:pte,isNumber:LB,isBoolean:mte,isObject:cw,isPlainObject:Oy,isReadableStream:Cte,isRequest:_te,isResponse:Ate,isHeaders:jte,isUndefined:hm,isDate:gte,isFile:vte,isBlob:yte,isRegExp:Fte,isFunction:Di,isStream:bte,isURLSearchParams:Ste,isTypedArray:Rte,isFileList:xte,forEach:$g,merge:LA,extend:Nte,trim:Ete,stripBOM:Tte,inherits:kte,toFlatObject:Pte,kindOf:sw,kindOfTest:Ss,endsWith:Ote,toArray:Ite,forEachEntry:Mte,matchAll:Dte,isHTMLForm:$te,hasOwnProperty:cR,hasOwnProp:cR,reduceDescriptors:UB,freezeMethods:Bte,toObjectSet:Ute,toCamelCase:Lte,noop:zte,toFiniteNumber:Hte,findKey:FB,global:Ul,isContextDefined:BB,isSpecCompliantForm:Vte,toJSONObject:Gte,isAsyncFn:Kte,isThenable:Wte,setImmediate:zB,asap:qte,isIterable:Yte};function Ut(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}fe.inherits(Ut,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:fe.toJSONObject(this.config),code:this.code,status:this.status}}});const HB=Ut.prototype,VB={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{VB[t]={value:t}});Object.defineProperties(Ut,VB);Object.defineProperty(HB,"isAxiosError",{value:!0});Ut.from=(t,e,n,r,i,o)=>{const s=Object.create(HB);return fe.toFlatObject(t,s,function(l){return l!==Error.prototype},c=>c!=="isAxiosError"),Ut.call(s,t.message,e,n,r,i),s.cause=t,s.name=t.name,o&&Object.assign(s,o),s};const Qte=null;function FA(t){return fe.isPlainObject(t)||fe.isArray(t)}function GB(t){return fe.endsWith(t,"[]")?t.slice(0,-2):t}function lR(t,e,n){return t?t.concat(e).map(function(i,o){return i=GB(i),!n&&o?"["+i+"]":i}).join(n?".":""):e}function Xte(t){return fe.isArray(t)&&!t.some(FA)}const Jte=fe.toFlatObject(fe,{},null,function(e){return/^is[A-Z]/.test(e)});function lw(t,e,n){if(!fe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=fe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!fe.isUndefined(y[m])});const r=n.metaTokens,i=n.visitor||d,o=n.dots,s=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&fe.isSpecCompliantForm(e);if(!fe.isFunction(i))throw new TypeError("visitor must be a function");function u(v){if(v===null)return"";if(fe.isDate(v))return v.toISOString();if(!l&&fe.isBlob(v))throw new Ut("Blob is not supported. Use a Buffer instead.");return fe.isArrayBuffer(v)||fe.isTypedArray(v)?l&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function d(v,m,y){let b=v;if(v&&!y&&typeof v=="object"){if(fe.endsWith(m,"{}"))m=r?m:m.slice(0,-2),v=JSON.stringify(v);else if(fe.isArray(v)&&Xte(v)||(fe.isFileList(v)||fe.endsWith(m,"[]"))&&(b=fe.toArray(v)))return m=GB(m),b.forEach(function(w,S){!(fe.isUndefined(w)||w===null)&&e.append(s===!0?lR([m],S,o):s===null?m:m+"[]",u(w))}),!1}return FA(v)?!0:(e.append(lR(y,m,o),u(v)),!1)}const f=[],h=Object.assign(Jte,{defaultVisitor:d,convertValue:u,isVisitable:FA});function p(v,m){if(!fe.isUndefined(v)){if(f.indexOf(v)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(v),fe.forEach(v,function(b,x){(!(fe.isUndefined(b)||b===null)&&i.call(e,b,fe.isString(x)?x.trim():x,m,h))===!0&&p(b,m?m.concat(x):[x])}),f.pop()}}if(!fe.isObject(t))throw new TypeError("data must be an object");return p(t),e}function uR(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function LN(t,e){this._pairs=[],t&&lw(t,this,e)}const KB=LN.prototype;KB.append=function(e,n){this._pairs.push([e,n])};KB.toString=function(e){const n=e?function(r){return e.call(this,r,uR)}:uR;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function Zte(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function WB(t,e,n){if(!e)return t;const r=n&&n.encode||Zte;fe.isFunction(n)&&(n={serialize:n});const i=n&&n.serialize;let o;if(i?o=i(e,n):o=fe.isURLSearchParams(e)?e.toString():new LN(e,n).toString(r),o){const s=t.indexOf("#");s!==-1&&(t=t.slice(0,s)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}class dR{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){fe.forEach(this.handlers,function(r){r!==null&&e(r)})}}const qB={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ene=typeof URLSearchParams<"u"?URLSearchParams:LN,tne=typeof FormData<"u"?FormData:null,nne=typeof Blob<"u"?Blob:null,rne={isBrowser:!0,classes:{URLSearchParams:ene,FormData:tne,Blob:nne},protocols:["http","https","file","blob","url","data"]},FN=typeof window<"u"&&typeof document<"u",BA=typeof navigator=="object"&&navigator||void 0,ine=FN&&(!BA||["ReactNative","NativeScript","NS"].indexOf(BA.product)<0),one=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",sne=FN&&window.location.href||"http://localhost",ane=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:FN,hasStandardBrowserEnv:ine,hasStandardBrowserWebWorkerEnv:one,navigator:BA,origin:sne},Symbol.toStringTag,{value:"Module"})),oi={...ane,...rne};function cne(t,e){return lw(t,new oi.classes.URLSearchParams,Object.assign({visitor:function(n,r,i,o){return oi.isNode&&fe.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},e))}function lne(t){return fe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function une(t){const e={},n=Object.keys(t);let r;const i=n.length;let o;for(r=0;r=n.length;return s=!s&&fe.isArray(i)?i.length:s,l?(fe.hasOwnProp(i,s)?i[s]=[i[s],r]:i[s]=r,!c):((!i[s]||!fe.isObject(i[s]))&&(i[s]=[]),e(n,r,i[s],o)&&fe.isArray(i[s])&&(i[s]=une(i[s])),!c)}if(fe.isFormData(t)&&fe.isFunction(t.entries)){const n={};return fe.forEachEntry(t,(r,i)=>{e(lne(r),i,n,0)}),n}return null}function dne(t,e,n){if(fe.isString(t))try{return(e||JSON.parse)(t),fe.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(t)}const Lg={transitional:qB,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=fe.isObject(e);if(o&&fe.isHTMLForm(e)&&(e=new FormData(e)),fe.isFormData(e))return i?JSON.stringify(YB(e)):e;if(fe.isArrayBuffer(e)||fe.isBuffer(e)||fe.isStream(e)||fe.isFile(e)||fe.isBlob(e)||fe.isReadableStream(e))return e;if(fe.isArrayBufferView(e))return e.buffer;if(fe.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return cne(e,this.formSerializer).toString();if((c=fe.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return lw(c?{"files[]":e}:e,l&&new l,this.formSerializer)}}return o||i?(n.setContentType("application/json",!1),dne(e)):e}],transformResponse:[function(e){const n=this.transitional||Lg.transitional,r=n&&n.forcedJSONParsing,i=this.responseType==="json";if(fe.isResponse(e)||fe.isReadableStream(e))return e;if(e&&fe.isString(e)&&(r&&!this.responseType||i)){const s=!(n&&n.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(c){if(s)throw c.name==="SyntaxError"?Ut.from(c,Ut.ERR_BAD_RESPONSE,this,null,this.response):c}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:oi.classes.FormData,Blob:oi.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};fe.forEach(["delete","get","head","post","put","patch"],t=>{Lg.headers[t]={}});const fne=fe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),hne=t=>{const e={};let n,r,i;return t&&t.split(` -`).forEach(function(s){i=s.indexOf(":"),n=s.substring(0,i).trim().toLowerCase(),r=s.substring(i+1).trim(),!(!n||e[n]&&fne[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},fR=Symbol("internals");function $h(t){return t&&String(t).trim().toLowerCase()}function Iy(t){return t===!1||t==null?t:fe.isArray(t)?t.map(Iy):String(t)}function pne(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const mne=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function SC(t,e,n,r,i){if(fe.isFunction(r))return r.call(this,e,n);if(i&&(e=n),!!fe.isString(e)){if(fe.isString(r))return e.indexOf(r)!==-1;if(fe.isRegExp(r))return r.test(e)}}function gne(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function vne(t,e){const n=fe.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(i,o,s){return this[r].call(this,e,i,o,s)},configurable:!0})})}class $i{constructor(e){e&&this.set(e)}set(e,n,r){const i=this;function o(c,l,u){const d=$h(l);if(!d)throw new Error("header name must be a non-empty string");const f=fe.findKey(i,d);(!f||i[f]===void 0||u===!0||u===void 0&&i[f]!==!1)&&(i[f||l]=Iy(c))}const s=(c,l)=>fe.forEach(c,(u,d)=>o(u,d,l));if(fe.isPlainObject(e)||e instanceof this.constructor)s(e,n);else if(fe.isString(e)&&(e=e.trim())&&!mne(e))s(hne(e),n);else if(fe.isObject(e)&&fe.isIterable(e)){let c={},l,u;for(const d of e){if(!fe.isArray(d))throw TypeError("Object iterator must return a key-value pair");c[u=d[0]]=(l=c[u])?fe.isArray(l)?[...l,d[1]]:[l,d[1]]:d[1]}s(c,n)}else e!=null&&o(n,e,r);return this}get(e,n){if(e=$h(e),e){const r=fe.findKey(this,e);if(r){const i=this[r];if(!n)return i;if(n===!0)return pne(i);if(fe.isFunction(n))return n.call(this,i,r);if(fe.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=$h(e),e){const r=fe.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||SC(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let i=!1;function o(s){if(s=$h(s),s){const c=fe.findKey(r,s);c&&(!n||SC(r,r[c],c,n))&&(delete r[c],i=!0)}}return fe.isArray(e)?e.forEach(o):o(e),i}clear(e){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!e||SC(this,this[o],o,e,!0))&&(delete this[o],i=!0)}return i}normalize(e){const n=this,r={};return fe.forEach(this,(i,o)=>{const s=fe.findKey(r,o);if(s){n[s]=Iy(i),delete n[o];return}const c=e?gne(o):String(o).trim();c!==o&&delete n[o],n[c]=Iy(i),r[c]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return fe.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=e&&fe.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` -`)}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[fR]=this[fR]={accessors:{}}).accessors,i=this.prototype;function o(s){const c=$h(s);r[c]||(vne(i,s),r[c]=!0)}return fe.isArray(e)?e.forEach(o):o(e),this}}$i.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);fe.reduceDescriptors($i.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});fe.freezeMethods($i);function CC(t,e){const n=this||Lg,r=e||n,i=$i.from(r.headers);let o=r.data;return fe.forEach(t,function(c){o=c.call(n,o,i.normalize(),e?e.status:void 0)}),i.normalize(),o}function QB(t){return!!(t&&t.__CANCEL__)}function Qf(t,e,n){Ut.call(this,t??"canceled",Ut.ERR_CANCELED,e,n),this.name="CanceledError"}fe.inherits(Qf,Ut,{__CANCEL__:!0});function XB(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Ut("Request failed with status code "+n.status,[Ut.ERR_BAD_REQUEST,Ut.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function yne(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function xne(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 Px=(t,e,n=3)=>{let r=0;const i=xne(50,250);return bne(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)},hR=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},pR=t=>(...e)=>fe.asap(()=>t(...e)),wne=oi.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,oi.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(oi.origin),oi.navigator&&/(msie|trident)/i.test(oi.navigator.userAgent)):()=>!0,Sne=oi.hasStandardBrowserEnv?{write(t,e,n,r,i,o){const s=[t+"="+encodeURIComponent(e)];fe.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),fe.isString(r)&&s.push("path="+r),fe.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 Cne(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function _ne(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function JB(t,e,n){let r=!Cne(e);return t&&(r||n==!1)?_ne(t,e):e}const mR=t=>t instanceof $i?{...t}:t;function vu(t,e){e=e||{};const n={};function r(u,d,f,h){return fe.isPlainObject(u)&&fe.isPlainObject(d)?fe.merge.call({caseless:h},u,d):fe.isPlainObject(d)?fe.merge({},d):fe.isArray(d)?d.slice():d}function i(u,d,f,h){if(fe.isUndefined(d)){if(!fe.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function o(u,d){if(!fe.isUndefined(d))return r(void 0,d)}function s(u,d){if(fe.isUndefined(d)){if(!fe.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(mR(u),mR(d),f,!0)};return fe.forEach(Object.keys(Object.assign({},t,e)),function(d){const f=l[d]||i,h=f(t[d],e[d],d);fe.isUndefined(h)&&f!==c||(n[d]=h)}),n}const ZB=t=>{const e=vu({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:c}=e;e.headers=s=$i.from(s),e.url=WB(JB(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(fe.isFormData(n)){if(oi.hasStandardBrowserEnv||oi.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(oi.hasStandardBrowserEnv&&(r&&fe.isFunction(r)&&(r=r(e)),r||r!==!1&&wne(e.url))){const u=i&&o&&Sne.read(o);u&&s.set(i,u)}return e},Ane=typeof XMLHttpRequest<"u",jne=Ane&&function(t){return new Promise(function(n,r){const i=ZB(t);let o=i.data;const s=$i.from(i.headers).normalize();let{responseType:c,onUploadProgress:l,onDownloadProgress:u}=i,d,f,h,p,v;function m(){p&&p(),v&&v(),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=$i.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};XB(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 Ut("Request aborted",Ut.ECONNABORTED,t,y)),y=null)},y.onerror=function(){r(new Ut("Network Error",Ut.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||qB;i.timeoutErrorMessage&&(S=i.timeoutErrorMessage),r(new Ut(S,C.clarifyTimeoutError?Ut.ETIMEDOUT:Ut.ECONNABORTED,t,y)),y=null},o===void 0&&s.setContentType(null),"setRequestHeader"in y&&fe.forEach(s.toJSON(),function(S,C){y.setRequestHeader(C,S)}),fe.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),c&&c!=="json"&&(y.responseType=i.responseType),u&&([h,v]=Px(u,!0),y.addEventListener("progress",h)),l&&y.upload&&([f,p]=Px(l),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",p)),(i.cancelToken||i.signal)&&(d=w=>{y&&(r(!w||w.type?new Qf(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=yne(i.url);if(x&&oi.protocols.indexOf(x)===-1){r(new Ut("Unsupported protocol "+x+":",Ut.ERR_BAD_REQUEST,t));return}y.send(o||null)})},Ene=(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 Ut?d:new Qf(d instanceof Error?d.message:d))}};let s=e&&setTimeout(()=>{s=null,o(new Ut(`timeout ${e} of ms exceeded`,Ut.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=()=>fe.asap(c),l}},Nne=function*(t,e){let n=t.byteLength;if(n{const i=Tne(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})},uw=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",eU=uw&&typeof ReadableStream=="function",Pne=uw&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),tU=(t,...e)=>{try{return!!t(...e)}catch{return!1}},One=eU&&tU(()=>{let t=!1;const e=new Request(oi.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),vR=64*1024,UA=eU&&tU(()=>fe.isReadableStream(new Response("").body)),Ox={stream:UA&&(t=>t.body)};uw&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ox[e]&&(Ox[e]=fe.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new Ut(`Response type '${e}' is not supported`,Ut.ERR_NOT_SUPPORT,r)})})})(new Response);const Ine=async t=>{if(t==null)return 0;if(fe.isBlob(t))return t.size;if(fe.isSpecCompliantForm(t))return(await new Request(oi.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(fe.isArrayBufferView(t)||fe.isArrayBuffer(t))return t.byteLength;if(fe.isURLSearchParams(t)&&(t=t+""),fe.isString(t))return(await Pne(t)).byteLength},Rne=async(t,e)=>{const n=fe.toFiniteNumber(t.getContentLength());return n??Ine(e)},Mne=uw&&(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}=ZB(t);u=u?(u+"").toLowerCase():"text";let p=Ene([i,o&&o.toAbortSignal()],s),v;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(l&&One&&n!=="get"&&n!=="head"&&(y=await Rne(d,r))!==0){let C=new Request(e,{method:"POST",body:r,duplex:"half"}),_;if(fe.isFormData(r)&&(_=C.headers.get("content-type"))&&d.setContentType(_),C.body){const[A,j]=hR(y,Px(pR(l)));r=gR(C.body,vR,A,j)}}fe.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;v=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(v);const w=UA&&(u==="stream"||u==="response");if(UA&&(c||w&&m)){const C={};["status","statusText","headers"].forEach(T=>{C[T]=x[T]});const _=fe.toFiniteNumber(x.headers.get("content-length")),[A,j]=c&&hR(_,Px(pR(c),!0))||[];x=new Response(gR(x.body,vR,A,()=>{j&&j(),m&&m()}),C)}u=u||"text";let S=await Ox[fe.findKey(Ox,u)||"text"](x,t);return!w&&m&&m(),await new Promise((C,_)=>{XB(C,_,{data:S,headers:$i.from(x.headers),status:x.status,statusText:x.statusText,config:t,request:v})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new Ut("Network Error",Ut.ERR_NETWORK,t,v),{cause:b.cause||b}):Ut.from(b,b&&b.code,t,v)}}),zA={http:Qte,xhr:jne,fetch:Mne};fe.forEach(zA,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const yR=t=>`- ${t}`,Dne=t=>fe.isFunction(t)||t===null||t===!1,nU={getAdapter:t=>{t=fe.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(yR).join(` -`):" "+yR(o[0]):"as no adapter specified";throw new Ut("There is no suitable adapter to dispatch the request "+s,"ERR_NOT_SUPPORT")}return r},adapters:zA};function _C(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Qf(null,t)}function xR(t){return _C(t),t.headers=$i.from(t.headers),t.data=CC.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),nU.getAdapter(t.adapter||Lg.adapter)(t).then(function(r){return _C(t),r.data=CC.call(t,t.transformResponse,r),r.headers=$i.from(r.headers),r},function(r){return QB(r)||(_C(t),r&&r.response&&(r.response.data=CC.call(t,t.transformResponse,r.response),r.response.headers=$i.from(r.response.headers))),Promise.reject(r)})}const rU="1.9.0",dw={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{dw[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const bR={};dw.transitional=function(e,n,r){function i(o,s){return"[Axios v"+rU+"] Transitional option '"+o+"'"+s+(r?". "+r:"")}return(o,s,c)=>{if(e===!1)throw new Ut(i(s," has been removed"+(n?" in "+n:"")),Ut.ERR_DEPRECATED);return n&&!bR[s]&&(bR[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}};dw.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function $ne(t,e,n){if(typeof t!="object")throw new Ut("options must be an object",Ut.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 Ut("option "+o+" must be "+l,Ut.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ut("Unknown option "+o,Ut.ERR_BAD_OPTION)}}const Ry={assertOptions:$ne,validators:dw},Es=Ry.validators;class iu{constructor(e){this.defaults=e||{},this.interceptors={request:new dR,response:new dR}}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=vu(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Ry.assertOptions(r,{silentJSONParsing:Es.transitional(Es.boolean),forcedJSONParsing:Es.transitional(Es.boolean),clarifyTimeoutError:Es.transitional(Es.boolean)},!1),i!=null&&(fe.isFunction(i)?n.paramsSerializer={serialize:i}:Ry.assertOptions(i,{encode:Es.function,serialize:Es.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ry.assertOptions(n,{baseUrl:Es.spelling("baseURL"),withXsrfToken:Es.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let s=o&&fe.merge(o.common,o[n.method]);o&&fe.forEach(["delete","get","head","post","put","patch","common"],v=>{delete o[v]}),n.headers=$i.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 v=[xR.bind(this),void 0];for(v.unshift.apply(v,c),v.push.apply(v,u),h=v.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 Qf(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 BN(function(i){e=i}),cancel:e}}}function Lne(t){return function(n){return t.apply(null,n)}}function Fne(t){return fe.isObject(t)&&t.isAxiosError===!0}const HA={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(HA).forEach(([t,e])=>{HA[e]=t});function iU(t){const e=new iu(t),n=MB(iu.prototype.request,e);return fe.extend(n,iu.prototype,e,{allOwnKeys:!0}),fe.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return iU(vu(t,i))},n}const yr=iU(Lg);yr.Axios=iu;yr.CanceledError=Qf;yr.CancelToken=BN;yr.isCancel=QB;yr.VERSION=rU;yr.toFormData=lw;yr.AxiosError=Ut;yr.Cancel=yr.CanceledError;yr.all=function(e){return Promise.all(e)};yr.spread=Lne;yr.isAxiosError=Fne;yr.mergeConfig=vu;yr.AxiosHeaders=$i;yr.formToJSON=t=>YB(fe.isHTMLForm(t)?new FormData(t):t);yr.getAdapter=nU.getAdapter;yr.HttpStatusCode=HA;yr.default=yr;const oU="https://ai-sandbox.oliver.solutions/semblance_back/api",qe=yr.create({baseURL:oU,headers:{"Content-Type":"application/json"},timeout:6e5});qe.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 VA="auth_error",Bne=t=>{t!=null&&t.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const e=new CustomEvent(VA,{detail:t||{}});window.dispatchEvent(e)};qe.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"):Bne({source:(s=t.config)==null?void 0:s.url,isPersonaCreation:!1})}return Promise.reject(t)});const My={login:(t,e)=>qe.post("/auth/login",{username:t,password:e}),loginWithMicrosoft:t=>qe.post("/auth/microsoft",{id_token:t}),register:(t,e,n)=>qe.post("/auth/register",{username:t,email:e,password:n}),getProfile:()=>qe.get("/auth/me")},Er={getAll:()=>qe.get("/personas/all"),getById:t=>qe.get(`/personas/${t}`),create:t=>qe.post("/personas",t),update:(t,e)=>t&&t.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",t),qe.post("/personas",e)):qe.put(`/personas/${t}`,e),modifyWithAI:(t,e)=>{const n=typeof t=="object"&&t!==null&&t._id||t;return console.log(`Modifying persona with AI, ID: ${n}`),qe.post(`/personas/${n}/modify-with-ai`,e)},delete:t=>{const e=typeof t=="object"&&t!==null&&t._id||t;return console.log(`Deleting persona with ID: ${e}`),qe.delete(`/personas/${e}`)},createBatch:t=>qe.post("/personas/batch",t),exportProfile:(t,e)=>qe.post(`/personas/${t}/export-profile`,e||{},{timeout:3e5})},ba={generate:t=>qe.post("/ai-personas/generate",t||{},{timeout:6e5}),generateAndSave:t=>qe.post("/ai-personas/generate-and-save",t||{},{timeout:6e5}),batchGenerate:t=>qe.post("/ai-personas/batch-generate",t,{timeout:6e5}),batchGenerateAndSave:t=>qe.post("/ai-personas/batch-generate-and-save",t,{timeout:6e5}),generateBasicProfiles:(t,e=5,n=.8)=>qe.post("/ai-personas/generate-basic-profiles",{audience_brief:t,count:e,temperature:n},{timeout:6e5}),completePersona:(t,e=.7)=>qe.post("/ai-personas/complete-persona",{basic_profile:t,temperature:e},{timeout:6e5}),completeAndSavePersona:(t,e=.7)=>qe.post("/ai-personas/complete-and-save-persona",{basic_profile:t,temperature:e},{timeout:6e5}),generatePersonaSummary:(t,e=.7)=>qe.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 qe.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(v=>qe.post("/ai-personas/complete-and-save-persona",{basic_profile:v,temperature:r,customer_data_session_id:i,llm_model:o||"gemini-2.5-pro"},{timeout:6e5}));if((await Promise.allSettled(h)).forEach((v,m)=>{if(v.status==="fulfilled")u.push(v.value.data.persona),d.push(v.value.data.persona_id);else{const y=l[m],b={index:m,name:y.name||`Persona ${m+1}`,error:v.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${y.name||"unnamed"}):`,v.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)=>qe.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"}`),qe.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;nqe.delete(`/ai-personas/cleanup-customer-data/${t}`)},St={getAll:()=>qe.get("/focus-groups"),getById:t=>qe.get(`/focus-groups/${t}`),create:t=>qe.post("/focus-groups",t),update:(t,e)=>qe.put(`/focus-groups/${t}`,e),delete:t=>qe.delete(`/focus-groups/${t}`),addParticipant:(t,e)=>qe.post(`/focus-groups/${t}/participants`,{persona_id:e}),removeParticipant:(t,e)=>qe.delete(`/focus-groups/${t}/participants/${e}`),sendMessage:(t,e)=>qe.post(`/focus-groups/${t}/messages`,e),getMessages:t=>qe.get(`/focus-groups/${t}/messages`),updateMessageHighlight:(t,e,n)=>qe.patch(`/focus-groups/${t}/messages/${e}`,{highlighted:n}),describeAsset:(t,e)=>qe.post(`/focus-groups/${t}/describe-asset`,{asset_filename:e},{timeout:12e4}),generateDiscussionGuide:t=>qe.post("/focus-groups/generate-discussion-guide",t,{timeout:6e5}),generateDiscussionGuideForGroup:(t,e)=>qe.post(`/focus-groups/${t}/generate-discussion-guide`,e,{timeout:6e5}),downloadDiscussionGuide:async t=>{try{const e=await qe.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)=>qe.post(`/focus-groups/${t}/notes`,e),getNotes:t=>qe.get(`/focus-groups/${t}/notes`),deleteNote:(t,e)=>qe.delete(`/focus-groups/${t}/notes/${e}`),uploadAssets:(t,e,n)=>(n===!0&&e.append("replace","true"),qe.post(`/focus-groups/${t}/assets`,e,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4})),getAssets:t=>qe.get(`/focus-groups/${t}/assets`),getAssetUrl:(t,e)=>`${oU}/focus-groups/${t}/assets/${e}`,updateAssetName:(t,e,n)=>qe.patch(`/focus-groups/${t}/assets/${e}`,{user_assigned_name:n}),deleteAsset:(t,e)=>qe.delete(`/focus-groups/${t}/assets/${e}`)},rr={generateResponse:(t,e,n,r=.7)=>qe.post("/focus-group-ai/generate-response",{focus_group_id:t,persona_id:e,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(t,e=.7)=>qe.post("/focus-group-ai/generate-key-themes",{focus_group_id:t,temperature:e},{timeout:6e5}),getKeyThemes:t=>qe.get(`/focus-group-ai/key-themes/${t}`),deleteKeyTheme:(t,e)=>qe.delete(`/focus-group-ai/key-themes/${t}/${e}`),getModeratorStatus:t=>qe.get(`/focus-group-ai/moderator/status/${t}`),advanceModeratorDiscussion:t=>qe.post(`/focus-group-ai/moderator/advance/${t}`,{},{timeout:6e5}),setModeratorPosition:(t,e,n)=>qe.put(`/focus-group-ai/moderator/position/${t}`,{section_id:e,item_id:n}),startAutonomousConversation:(t,e)=>qe.post(`/focus-group-ai/autonomous/start/${t}`,{initial_prompt:e},{timeout:6e5}),stopAutonomousConversation:(t,e)=>qe.post(`/focus-group-ai/autonomous/stop/${t}`,{reason:e}),getAutonomousConversationStatus:t=>qe.get(`/focus-group-ai/autonomous/status/${t}`),getConversationState:t=>qe.get(`/focus-group-ai/conversation/state/${t}`),getConversationAnalytics:t=>qe.get(`/focus-group-ai/conversation/analytics/${t}`),makeConversationDecision:(t,e=.7,n="ai")=>qe.post(`/focus-group-ai/conversation/decision/${t}`,{temperature:e,mode:n},{timeout:6e5}),getConversationInsights:t=>qe.get(`/focus-group-ai/conversation/insights/${t}`,{timeout:6e5}),manualIntervention:(t,e,n,r)=>qe.post(`/focus-group-ai/conversation/intervene/${t}`,{action:e,message:n,participant_id:r}),getReasoningHistory:t=>qe.get(`/focus-group-ai/conversation/reasoning-history/${t}`),endSession:(t,e)=>qe.post(`/focus-group-ai/moderator/end-session/${t}`,{reason:e||"session_ended"})},Ms={getAll:()=>qe.get("/folders"),getById:t=>qe.get(`/folders/${t}`),create:t=>qe.post("/folders",t),update:(t,e)=>qe.put(`/folders/${t}`,e),delete:t=>qe.delete(`/folders/${t}`),addPersona:(t,e)=>qe.post(`/folders/${t}/personas`,{persona_id:e}),removePersona:(t,e)=>qe.delete(`/folders/${t}/personas/${e}`),addPersonasBatch:(t,e)=>qe.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),qe.post(`/folders/${t}/personas/remove-batch`,{persona_ids:e})),addPersonaToMultipleFolders:(t,e)=>{const n=e.map(r=>qe.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 we={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"},Oc={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},zl={GET:"GET",POST:"POST"},Fg=[we.OPENID_SCOPE,we.PROFILE_SCOPE,we.OFFLINE_ACCESS_SCOPE],wR=[...Fg,we.EMAIL_SCOPE],hi={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"},SR={ACTIVE_ACCOUNT_FILTERS:"active-account-filters"},Gc={COMMON:"common",ORGANIZATIONS:"organizations",CONSUMERS:"consumers"},Fv={ACCESS_TOKEN:"access_token",XMS_CC:"xms_cc"},gi={LOGIN:"login",SELECT_ACCOUNT:"select_account",CONSENT:"consent",NONE:"none",CREATE:"create",NO_SESSION:"no_session"},UN={CODE:"code",IDTOKEN_TOKEN:"id_token token",IDTOKEN_TOKEN_REFRESHTOKEN:"id_token token refresh_token"},fw={QUERY:"query",FRAGMENT:"fragment"},Une={QUERY:"query",FRAGMENT:"fragment",FORM_POST:"form_post"},sU={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"},Bv={MSSTS_ACCOUNT_TYPE:"MSSTS",ADFS_ACCOUNT_TYPE:"ADFS",MSAV1_ACCOUNT_TYPE:"MSA",GENERIC_ACCOUNT_TYPE:"Generic"},pm={CACHE_KEY_SEPARATOR:"-",CLIENT_INFO_SEPARATOR:"."},Gr={ID_TOKEN:"IdToken",ACCESS_TOKEN:"AccessToken",ACCESS_TOKEN_WITH_AUTH_SCHEME:"AccessToken_With_AuthScheme",REFRESH_TOKEN:"RefreshToken"},zN="appmetadata",zne="client_info",Ix="1",Rx={CACHE_KEY:"authority-metadata",REFRESH_TIME_SECONDS:3600*24},Vi={CONFIG:"config",CACHE:"cache",NETWORK:"network",HARDCODED_VALUES:"hardcoded_values"},Ur={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"},xn={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"},CR={INVALID_GRANT_ERROR:"invalid_grant",CLIENT_MISMATCH_ERROR:"client_mismatch"},Hu={FAILED_AUTO_DETECTION:"1",INTERNAL_CACHE:"2",ENVIRONMENT_VARIABLE:"3",IMDS:"4"},AC={CONFIGURED_NO_AUTO_DETECTION:"2",AUTO_DETECTION_REQUESTED_SUCCESSFUL:"4",AUTO_DETECTION_REQUESTED_FAILED:"5"},Il={NOT_APPLICABLE:"0",FORCE_REFRESH_OR_CLAIMS:"1",NO_CACHED_ACCESS_TOKEN:"2",CACHED_ACCESS_TOKEN_EXPIRED:"3",PROACTIVELY_REFRESHED:"4"},Hne={Jwt:"JWT",Jwk:"JWK",Pop:"pop"},aU=300;/*! @azure/msal-common v15.10.0 2025-08-05 */const Mx="unexpected_error",Vne="post_request_failed";/*! @azure/msal-common v15.10.0 2025-08-05 */const _R={[Mx]:"Unexpected error in authentication.",[Vne]:"Post request failed from the network, could be a 4xx/5xx or a network unavailability. Please check the exact error code for details."};class En extends Error{constructor(e,n,r){const i=n?`${e}: ${n}`:e;super(i),Object.setPrototypeOf(this,En.prototype),this.errorCode=e||we.EMPTY_STRING,this.errorMessage=n||we.EMPTY_STRING,this.subError=r||we.EMPTY_STRING,this.name="AuthError"}setCorrelationId(e){this.correlationId=e}}function GA(t,e){return new En(t,e?`${_R[t]} ${e}`:_R[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */const HN="client_info_decoding_error",cU="client_info_empty_error",VN="token_parsing_error",lU="null_or_empty_token",wa="endpoints_resolution_error",uU="network_error",dU="openid_config_error",fU="hash_not_deserialized",af="invalid_state",hU="state_mismatch",KA="state_not_found",pU="nonce_mismatch",GN="auth_time_not_found",mU="max_age_transpired",Gne="multiple_matching_tokens",Kne="multiple_matching_accounts",gU="multiple_matching_appMetadata",vU="request_cannot_be_made",yU="cannot_remove_empty_scope",xU="cannot_append_scopeset",WA="empty_input_scopeset",Wne="device_code_polling_cancelled",qne="device_code_expired",Yne="device_code_unknown_error",KN="no_account_in_silent_request",bU="invalid_cache_record",WN="invalid_cache_environment",qA="no_account_found",YA="no_crypto_object",Qne="unexpected_credential_type",Xne="invalid_assertion",Jne="invalid_client_credential",Kc="token_refresh_required",Zne="user_timeout_reached",wU="token_claims_cnf_required_for_signedjwt",SU="authorization_code_missing_from_server_response",CU="binding_key_not_removed",_U="end_session_endpoint_not_supported",qN="key_id_missing",ere="no_network_connectivity",tre="user_canceled",nre="missing_tenant_id_error",Yt="method_not_implemented",rre="nested_app_auth_bridge_disabled";/*! @azure/msal-common v15.10.0 2025-08-05 */const AR={[HN]:"The client info could not be parsed/decoded correctly",[cU]:"The client info was empty",[VN]:"Token cannot be parsed",[lU]:"The token is null or empty",[wa]:"Endpoints cannot be resolved",[uU]:"Network request failed",[dU]:"Could not retrieve endpoints. Check your authority and verify the .well-known/openid-configuration endpoint returns the required endpoints.",[fU]:"The hash parameters could not be deserialized",[af]:"State was not the expected format",[hU]:"State mismatch error",[KA]:"State not found",[pU]:"Nonce mismatch error",[GN]:"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.",[mU]:"Max Age is set to 0, or too much time has elapsed since the last end-user authentication.",[Gne]:"The cache contains multiple tokens satisfying the requirements. Call AcquireToken again providing more requirements such as authority or account.",[Kne]:"The cache contains multiple accounts satisfying the given parameters. Please pass more info to obtain the correct account",[gU]:"The cache contains multiple appMetadata satisfying the given parameters. Please pass more info to obtain the correct appMetadata",[vU]:"Token request cannot be made without authorization code or refresh token.",[yU]:"Cannot remove null or empty scope from ScopeSet",[xU]:"Cannot append ScopeSet",[WA]:"Empty input ScopeSet cannot be processed",[Wne]:"Caller has cancelled token endpoint polling during device code flow by setting DeviceCodeRequest.cancel = true.",[qne]:"Device code is expired.",[Yne]:"Device code stopped polling for unknown reasons.",[KN]:"Please pass an account object, silent flow is not supported without account information",[bU]:"Cache record object was null or undefined.",[WN]:"Invalid environment when attempting to create cache entry",[qA]:"No account found in cache for given key.",[YA]:"No crypto object detected.",[Qne]:"Unexpected credential type.",[Xne]:"Client assertion must meet requirements described in https://tools.ietf.org/html/rfc7515",[Jne]:"Client credential (secret, certificate, or assertion) must not be empty when creating a confidential client. An application should at most have one credential",[Kc]:"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.",[Zne]:"User defined timeout for device code polling reached",[wU]:"Cannot generate a POP jwt if the token_claims are not populated",[SU]:"Server response does not contain an authorization code to proceed",[CU]:"Could not remove the credential's binding key from storage.",[_U]:"The provided authority does not support logout",[qN]:"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.",[ere]:"No network connectivity. Check your internet connection.",[tre]:"User cancelled the flow.",[nre]:"A tenant id - not common, organizations, or consumers - must be specified when using the client_credentials flow.",[Yt]:"This method has not been implemented",[rre]:"The nested app auth bridge is disabled"};class YN extends En{constructor(e,n){super(e,n?`${AR[e]}: ${n}`:AR[e]),this.name="ClientAuthError",Object.setPrototypeOf(this,YN.prototype)}}function Te(t,e){return new YN(t,e)}/*! @azure/msal-common v15.10.0 2025-08-05 */const Dx={createNewGuid:()=>{throw Te(Yt)},base64Decode:()=>{throw Te(Yt)},base64Encode:()=>{throw Te(Yt)},base64UrlEncode:()=>{throw Te(Yt)},encodeKid:()=>{throw Te(Yt)},async getPublicKeyThumbprint(){throw Te(Yt)},async removeTokenBindingKey(){throw Te(Yt)},async clearKeystore(){throw Te(Yt)},async signJwt(){throw Te(Yt)},async hashString(){throw Te(Yt)}};/*! @azure/msal-common v15.10.0 2025-08-05 */var zn;(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"})(zn||(zn={}));class Ka{constructor(e,n,r){this.level=zn.Info;const i=()=>{},o=e||Ka.createDefaultLoggerOptions();this.localCallback=o.loggerCallback||i,this.piiLoggingEnabled=o.piiLoggingEnabled||!1,this.level=typeof o.logLevel=="number"?o.logLevel:zn.Info,this.correlationId=o.correlationId||we.EMPTY_STRING,this.packageName=n||we.EMPTY_STRING,this.packageVersion=r||we.EMPTY_STRING}static createDefaultLoggerOptions(){return{loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:zn.Info}}clone(e,n,r){return new Ka({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} : ${zn[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:zn.Error,containsPii:!1,correlationId:n||we.EMPTY_STRING})}errorPii(e,n){this.logMessage(e,{logLevel:zn.Error,containsPii:!0,correlationId:n||we.EMPTY_STRING})}warning(e,n){this.logMessage(e,{logLevel:zn.Warning,containsPii:!1,correlationId:n||we.EMPTY_STRING})}warningPii(e,n){this.logMessage(e,{logLevel:zn.Warning,containsPii:!0,correlationId:n||we.EMPTY_STRING})}info(e,n){this.logMessage(e,{logLevel:zn.Info,containsPii:!1,correlationId:n||we.EMPTY_STRING})}infoPii(e,n){this.logMessage(e,{logLevel:zn.Info,containsPii:!0,correlationId:n||we.EMPTY_STRING})}verbose(e,n){this.logMessage(e,{logLevel:zn.Verbose,containsPii:!1,correlationId:n||we.EMPTY_STRING})}verbosePii(e,n){this.logMessage(e,{logLevel:zn.Verbose,containsPii:!0,correlationId:n||we.EMPTY_STRING})}trace(e,n){this.logMessage(e,{logLevel:zn.Trace,containsPii:!1,correlationId:n||we.EMPTY_STRING})}tracePii(e,n){this.logMessage(e,{logLevel:zn.Trace,containsPii:!0,correlationId:n||we.EMPTY_STRING})}isPiiLoggingEnabled(){return this.piiLoggingEnabled||!1}}/*! @azure/msal-common v15.10.0 2025-08-05 */const AU="@azure/msal-common",QN="15.10.0";/*! @azure/msal-common v15.10.0 2025-08-05 */const XN={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 jU="redirect_uri_empty",ire="claims_request_parsing_error",EU="authority_uri_insecure",ip="url_parse_error",NU="empty_url_error",TU="empty_input_scopes_error",JN="invalid_claims",kU="token_request_empty",PU="logout_request_empty",ore="invalid_code_challenge_method",ZN="pkce_params_missing",eT="invalid_cloud_discovery_metadata",OU="invalid_authority_metadata",IU="untrusted_authority",hw="missing_ssh_jwk",RU="missing_ssh_kid",sre="missing_nonce_authentication_header",are="invalid_authentication_header",MU="cannot_set_OIDCOptions",DU="cannot_allow_platform_broker",$U="authority_mismatch",LU="invalid_request_method_for_EAR",FU="invalid_authorize_post_body_parameters";/*! @azure/msal-common v15.10.0 2025-08-05 */const cre={[jU]:"A redirect URI is required for all calls, and none has been set.",[ire]:"Could not parse the given claims request object.",[EU]:"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",[ip]:"URL could not be parsed into appropriate segments.",[NU]:"URL was empty or null.",[TU]:"Scopes cannot be passed as null, undefined or empty array because they are required to obtain an access token.",[JN]:"Given claims parameter must be a stringified JSON object.",[kU]:"Token request was empty and not found in cache.",[PU]:"The logout request was null or undefined.",[ore]:'code_challenge_method passed is invalid. Valid values are "plain" and "S256".',[ZN]:"Both params: code_challenge and code_challenge_method are to be passed if to be sent in the request",[eT]:"Invalid cloudDiscoveryMetadata provided. Must be a stringified JSON object containing tenant_discovery_endpoint and metadata fields",[OU]:"Invalid authorityMetadata provided. Must by a stringified JSON object containing authorization_endpoint, token_endpoint, issuer fields.",[IU]:"The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter.",[hw]:"Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme.",[RU]:"Missing sshKid in SSH certificate request. A string that uniquely identifies the public SSH key is required when using the SSH authentication scheme.",[sre]:"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.",[are]:"Invalid authentication header provided",[MU]:"Cannot set OIDCOptions parameter. Please change the protocol mode to OIDC or use a non-Microsoft authority.",[DU]:"Cannot set allowPlatformBroker parameter to true when not in AAD protocol mode.",[$U]:"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.",[FU]:"Invalid authorize post body parameters provided. If you are using authorizePostBodyParameters, the request method must be POST. Please check the request method and parameters.",[LU]:"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 tT extends En{constructor(e){super(e,cre[e]),this.name="ClientConfigurationError",Object.setPrototypeOf(this,tT.prototype)}}function Pn(t){return new tT(t)}/*! @azure/msal-common v15.10.0 2025-08-05 */class Gs{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 Nr{constructor(e){const n=e?Gs.trimArrayEntries([...e]):[],r=n?Gs.removeEmptyStringsFromArray(n):[];if(!r||!r.length)throw Pn(TU);this.scopes=new Set,r.forEach(i=>this.scopes.add(i))}static fromString(e){const r=(e||we.EMPTY_STRING).split(" ");return new Nr(r)}static createSearchScopes(e){const n=new Nr(e);return n.containsOnlyOIDCScopes()?n.removeScope(we.OFFLINE_ACCESS_SCOPE):n.removeOIDCScopes(),n}containsScope(e){const n=this.printScopesLowerCase().split(" "),r=new Nr(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 wR.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 Te(xU)}}removeScope(e){if(!e)throw Te(yU);this.scopes.delete(e.trim())}removeOIDCScopes(){wR.forEach(e=>{this.scopes.delete(e)})}unionScopeSets(e){if(!e)throw Te(WA);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 Te(WA);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(" "):we.EMPTY_STRING}printScopesLowerCase(){return this.printScopes().toLowerCase()}}/*! @azure/msal-common v15.10.0 2025-08-05 */function jR(t,e){return!!t&&!!e&&t===e.split(".")[1]}function nT(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:jR(p,t)}}else return{tenantId:n,localAccountId:e,username:"",isHomeTenant:jR(n,t)}}function rT(t,e,n,r){let i=t;if(e){const{isHomeTenant:o,...s}=e;i={...t,...s}}if(n){const{isHomeTenant:o,...s}=nT(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 Xf(t,e){const n=lre(t);try{const r=e(n);return JSON.parse(r)}catch{throw Te(VN)}}function lre(t){if(!t)throw Te(lU);const n=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/.exec(t);if(!n||n.length<4)throw Te(VN);return n[2]}function BU(t,e){if(e===0||Date.now()-3e5>t+e)throw Te(mU)}/*! @azure/msal-common v15.10.0 2025-08-05 */function UU(t){return t.startsWith("#/")?t.substring(2):t.startsWith("#")||t.startsWith("?")?t.substring(1):t}function $x(t){if(!t||t.indexOf("=")<0)return null;try{const e=UU(t),n=Object.fromEntries(new URLSearchParams(e));if(n.code||n.ear_jwe||n.error||n.error_description||n.state)return n}catch{throw Te(fU)}return null}function mm(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 sn{get urlString(){return this._urlString}constructor(e){if(this._urlString=e,!this._urlString)throw Pn(NU);e.includes("#")||(this._urlString=sn.canonicalizeUri(e))}static canonicalizeUri(e){if(e){let n=e.toLowerCase();return Gs.endsWith(n,"?")?n=n.slice(0,-1):Gs.endsWith(n,"?/")&&(n=n.slice(0,-2)),Gs.endsWith(n,"/")||(n+="/"),n}return e}validateAsUri(){let e;try{e=this.getUrlComponents()}catch{throw Pn(ip)}if(!e.HostNameAndPort||!e.PathSegments)throw Pn(ip);if(!e.Protocol||e.Protocol.toLowerCase()!=="https:")throw Pn(EU)}static appendQueryString(e,n){return n?e.indexOf("?")<0?`${e}?${n}`:`${e}&${n}`:e}static removeHashFromUrl(e){return sn.canonicalizeUri(e.split("#")[0])}replaceTenantPath(e){const n=this.getUrlComponents(),r=n.PathSegments;return e&&r.length!==0&&(r[0]===Gc.COMMON||r[0]===Gc.ORGANIZATIONS)&&(r[0]=e),sn.constructAuthorityUriFromObject(n)}getUrlComponents(){const e=RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?"),n=this.urlString.match(e);if(!n)throw Pn(ip);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 Pn(ip);return r[2]}static getAbsoluteUrl(e,n){if(e[0]===we.FORWARD_SLASH){const i=new sn(n).getUrlComponents();return i.Protocol+"//"+i.HostNameAndPort+e}return e}static constructAuthorityUriFromObject(e){return new sn(e.Protocol+"//"+e.HostNameAndPort+"/"+e.PathSegments.join("/"))}static hashContainsKnownProperties(e){return!!$x(e)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const zU={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"]}]}},ER=zU.endpointMetadata,iT=zU.instanceDiscoveryMetadata,HU=new Set;iT.metadata.forEach(t=>{t.aliases.forEach(e=>{HU.add(e)})});function ure(t,e){var i;let n;const r=t.canonicalAuthority;if(r){const o=new sn(r).getUrlComponents().HostNameAndPort;n=NR(o,(i=t.cloudDiscoveryMetadata)==null?void 0:i.metadata,Vi.CONFIG,e)||NR(o,iT.metadata,Vi.HARDCODED_VALUES,e)||t.knownAuthorities}return n||[]}function NR(t,e,n,r){if(r==null||r.trace(`getAliasesFromMetadata called with source: ${n}`),t&&e){const i=Lx(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 dre(t){return Lx(iT.metadata,t)}function Lx(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=Xf(l.secret,this.cryptoImpl.base64Decode),!this.idTokenClaimsMatchTenantProfileFilter(c,o))?null:(s=rT(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 Te(bU);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 En?o:QA(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=Nr.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)&&Nr.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===Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME&&(n.tokenType&&!this.matchTokenType(e,n.tokenType)||n.tokenType===xn.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()!==Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()||r.tokenType!==xn.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:Gr.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=Nr.createSearchScopes(n.scopes),c=n.authenticationScheme||xn.BEARER,l=c&&c.toLowerCase()!==xn.BEARER.toLowerCase()?Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME:Gr.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 v=this.getAccessTokenCredential(p,o);v&&this.credentialMatchesFilter(v,u)&&f.push(v)}});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?Ix:void 0,c={homeAccountId:e.homeAccountId,environment:e.environment,credentialType:Gr.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 Te(gU);return i[0]}isAppMetadataFOCI(e){const n=this.readAppMetadataFromCache(e);return!!(n&&n.familyId===Ix)}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=ure(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!==Gr.ACCESS_TOKEN&&e.credentialType!==Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME||!e.target?!1:Nr.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(zN)!==-1}isAuthorityMetadata(e){return e.indexOf(Rx.CACHE_KEY)!==-1}generateAuthorityMetadataCacheKey(e){return`${Rx.CACHE_KEY}-${this.clientId}-${e}`}static toObject(e,n){for(const r in n)e[r]=n[r];return e}}class fre extends XA{async setAccount(){throw Te(Yt)}getAccount(){throw Te(Yt)}async setIdTokenCredential(){throw Te(Yt)}getIdTokenCredential(){throw Te(Yt)}async setAccessTokenCredential(){throw Te(Yt)}getAccessTokenCredential(){throw Te(Yt)}async setRefreshTokenCredential(){throw Te(Yt)}getRefreshTokenCredential(){throw Te(Yt)}setAppMetadata(){throw Te(Yt)}getAppMetadata(){throw Te(Yt)}setServerTelemetry(){throw Te(Yt)}getServerTelemetry(){throw Te(Yt)}setAuthorityMetadata(){throw Te(Yt)}getAuthorityMetadata(){throw Te(Yt)}getAuthorityMetadataKeys(){throw Te(Yt)}setThrottlingCache(){throw Te(Yt)}getThrottlingCache(){throw Te(Yt)}removeItem(){throw Te(Yt)}getKeys(){throw Te(Yt)}getAccountKeys(){throw Te(Yt)}getTokenKeys(){throw Te(Yt)}generateCredentialKey(){throw Te(Yt)}generateAccountKey(){throw Te(Yt)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Li={AAD:"AAD",OIDC:"OIDC",EAR:"EAR"};/*! @azure/msal-common v15.10.0 2025-08-05 */const W={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"},hre={NotStarted:0,InProgress:1,Completed:2};/*! @azure/msal-common v15.10.0 2025-08-05 */class TR{startMeasurement(){}endMeasurement(){}flushMeasurement(){return null}}class VU{generateId(){return"callback-id"}startMeasurement(e,n){return{end:()=>null,discard:()=>{},add:()=>{},increment:()=>{},event:{eventId:this.generateId(),status:hre.InProgress,authority:"",libraryName:"",libraryVersion:"",clientId:"",name:e,startTimeMs:Date.now(),correlationId:n||""},measurement:new TR}}startPerformanceMeasurement(){return new TR}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 GU={tokenRenewalOffsetSeconds:aU,preventCorsPreflight:!1},pre={loggerCallback:()=>{},piiLoggingEnabled:!1,logLevel:zn.Info,correlationId:we.EMPTY_STRING},mre={claimsBasedCachingEnabled:!1},gre={async sendGetRequestAsync(){throw Te(Yt)},async sendPostRequestAsync(){throw Te(Yt)}},vre={sku:we.SKU,version:QN,cpu:we.EMPTY_STRING,os:we.EMPTY_STRING},yre={clientSecret:we.EMPTY_STRING,clientAssertion:void 0},xre={azureCloudInstance:XN.None,tenant:`${we.DEFAULT_COMMON_TENANT}`},bre={application:{appName:"",appVersion:""}};function wre({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={...pre,...n};return{authOptions:Sre(t),systemOptions:{...GU,...e},loggerOptions:p,cacheOptions:{...mre,...r},storageInterface:i||new fre(t.clientId,Dx,new Ka(p),new VU),networkInterface:o||gre,cryptoInterface:s||Dx,clientCredentials:c||yre,libraryInfo:{...vre,...l},telemetry:{...bre,...u},serverTelemetryManager:d||null,persistencePlugin:f||null,serializableCache:h||null}}function Sre(t){return{clientCapabilities:[],azureCloudOptions:xre,skipAuthorityMetadataCache:!1,instanceAware:!1,encodeExtraQueryParams:!1,...t}}function KU(t){return t.authOptions.authority.options.protocolMode===Li.OIDC}/*! @azure/msal-common v15.10.0 2025-08-05 */const ns={HOME_ACCOUNT_ID:"home_account_id",UPN:"UPN"};/*! @azure/msal-common v15.10.0 2025-08-05 */function Bx(t,e){if(!t)throw Te(cU);try{const n=e(t);return JSON.parse(n)}catch{throw Te(HN)}}function kd(t){if(!t)throw Te(HN);const e=t.split(pm.CLIENT_INFO_SEPARATOR,2);return{uid:e[0],utid:e.length<2?we.EMPTY_STRING:e[1]}}/*! @azure/msal-common v15.10.0 2025-08-05 */const yu="client_id",WU="redirect_uri",Cre="response_type",_re="response_mode",Are="grant_type",jre="claims",Ere="scope",Nre="refresh_token",Tre="state",kre="nonce",Pre="prompt",Ore="code",Ire="code_challenge",Rre="code_challenge_method",Mre="code_verifier",Dre="client-request-id",$re="x-client-SKU",Lre="x-client-VER",Fre="x-client-OS",Bre="x-client-CPU",Ure="x-client-current-telemetry",zre="x-client-last-telemetry",Hre="x-ms-lib-capability",Vre="x-app-name",Gre="x-app-ver",Kre="post_logout_redirect_uri",Wre="id_token_hint",qre="client_secret",Yre="client_assertion",Qre="client_assertion_type",qU="token_type",YU="req_cnf",kR="return_spa_code",Xre="nativebroker",Jre="logout_hint",Zre="sid",eie="login_hint",tie="domain_hint",nie="x-client-xtra-sku",Ux="brk_client_id",zx="brk_redirect_uri",JA="instance_aware",rie="ear_jwk",iie="ear_jwe_crypto";/*! @azure/msal-common v15.10.0 2025-08-05 */function pw(t,e,n){if(!e)return;const r=t.get(yu);r&&t.has(Ux)&&(n==null||n.addFields({embeddedClientId:r,embeddedRedirectUri:t.get(WU)},e))}function sT(t,e){t.set(Cre,e)}function oie(t,e){t.set(_re,e||Une.QUERY)}function sie(t){t.set(Xre,"1")}function aT(t,e,n=!0,r=Fg){n&&!r.includes("openid")&&!e.includes("openid")&&r.push("openid");const i=n?[...e||[],...r]:e||[],o=new Nr(i);t.set(Ere,o.printScopes())}function cT(t,e){t.set(yu,e)}function lT(t,e){t.set(WU,e)}function aie(t,e){t.set(Kre,e)}function cie(t,e){t.set(Wre,e)}function lie(t,e){t.set(tie,e)}function Uv(t,e){t.set(eie,e)}function Hx(t,e){t.set(hi.CCS_HEADER,`UPN:${e}`)}function _p(t,e){t.set(hi.CCS_HEADER,`Oid:${e.uid}@${e.utid}`)}function PR(t,e){t.set(Zre,e)}function uT(t,e,n){const r=mie(e,n);try{JSON.parse(r)}catch{throw Pn(JN)}t.set(jre,r)}function dT(t,e){t.set(Dre,e)}function fT(t,e){t.set($re,e.sku),t.set(Lre,e.version),e.os&&t.set(Fre,e.os),e.cpu&&t.set(Bre,e.cpu)}function hT(t,e){e!=null&&e.appName&&t.set(Vre,e.appName),e!=null&&e.appVersion&&t.set(Gre,e.appVersion)}function uie(t,e){t.set(Pre,e)}function QU(t,e){e&&t.set(Tre,e)}function die(t,e){t.set(kre,e)}function XU(t,e,n){if(e&&n)t.set(Ire,e),t.set(Rre,n);else throw Pn(ZN)}function fie(t,e){t.set(Ore,e)}function hie(t,e){t.set(Nre,e)}function pie(t,e){t.set(Mre,e)}function JU(t,e){t.set(qre,e)}function ZU(t,e){e&&t.set(Yre,e)}function e3(t,e){e&&t.set(Qre,e)}function t3(t,e){t.set(Are,e)}function pT(t){t.set(zne,"1")}function n3(t){t.has(JA)||t.set(JA,"true")}function Wc(t,e){Object.entries(e).forEach(([n,r])=>{!t.has(n)&&r&&t.set(n,r)})}function mie(t,e){let n;if(!t)n={};else try{n=JSON.parse(t)}catch{throw Pn(JN)}return e&&e.length>0&&(n.hasOwnProperty(Fv.ACCESS_TOKEN)||(n[Fv.ACCESS_TOKEN]={}),n[Fv.ACCESS_TOKEN][Fv.XMS_CC]={values:e}),JSON.stringify(n)}function mT(t,e){e&&(t.set(qU,xn.POP),t.set(YU,e))}function r3(t,e){e&&(t.set(qU,xn.SSH),t.set(YU,e))}function i3(t,e){t.set(Ure,e.generateCurrentRequestHeaderValue()),t.set(zre,e.generateLastRequestHeaderValue())}function o3(t){t.set(Hre,Cp.X_MS_LIB_CAPABILITY_VALUE)}function gie(t,e){t.set(Jre,e)}function mw(t,e,n){t.has(Ux)||t.set(Ux,e),t.has(zx)||t.set(zx,n)}function vie(t,e){t.set(rie,encodeURIComponent(e)),t.set(iie,"eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0")}function yie(t,e){Object.entries(e).forEach(([n,r])=>{r&&t.set(n,r)})}/*! @azure/msal-common v15.10.0 2025-08-05 */const qo={Default:0,Adfs:1,Dsts:2,Ciam:3};/*! @azure/msal-common v15.10.0 2025-08-05 */function xie(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 bie(t){return t.hasOwnProperty("tenant_discovery_endpoint")&&t.hasOwnProperty("metadata")}/*! @azure/msal-common v15.10.0 2025-08-05 */function wie(t){return t.hasOwnProperty("error")&&t.hasOwnProperty("error_description")}/*! @azure/msal-common v15.10.0 2025-08-05 */const ro=(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}},be=(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 gw{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(W.RegionDiscoveryDetectRegion,this.correlationId);let r=e;if(r)n.region_source=Hu.ENVIRONMENT_VARIABLE;else{const o=gw.IMDS_OPTIONS;try{const s=await be(this.getRegionFromIMDS.bind(this),W.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(we.IMDS_VERSION,o);if(s.status===Oc.SUCCESS&&(r=s.body,n.region_source=Hu.IMDS),s.status===Oc.BAD_REQUEST){const c=await be(this.getCurrentVersion.bind(this),W.RegionDiscoveryGetCurrentVersion,this.logger,this.performanceClient,this.correlationId)(o);if(!c)return n.region_source=Hu.FAILED_AUTO_DETECTION,null;const l=await be(this.getRegionFromIMDS.bind(this),W.RegionDiscoveryGetRegionFromIMDS,this.logger,this.performanceClient,this.correlationId)(c,o);l.status===Oc.SUCCESS&&(r=l.body,n.region_source=Hu.IMDS)}}catch{return n.region_source=Hu.FAILED_AUTO_DETECTION,null}}return r||(n.region_source=Hu.FAILED_AUTO_DETECTION),r||null}async getRegionFromIMDS(e,n){var r;return(r=this.performanceClient)==null||r.addQueueMeasurement(W.RegionDiscoveryGetRegionFromIMDS,this.correlationId),this.networkInterface.sendGetRequestAsync(`${we.IMDS_ENDPOINT}?api-version=${e}&format=text`,n,we.IMDS_TIMEOUT)}async getCurrentVersion(e){var n;(n=this.performanceClient)==null||n.addQueueMeasurement(W.RegionDiscoveryGetCurrentVersion,this.correlationId);try{const r=await this.networkInterface.sendGetRequestAsync(`${we.IMDS_ENDPOINT}?format=json`,e);return r.status===Oc.BAD_REQUEST&&r.body&&r.body["newest-versions"]&&r.body["newest-versions"].length>0?r.body["newest-versions"][0]:null}catch{return null}}}gw.IMDS_OPTIONS={headers:{Metadata:"true"}};/*! @azure/msal-common v15.10.0 2025-08-05 */function Fi(){return Math.round(new Date().getTime()/1e3)}function OR(t){return t.getTime()/1e3}function Pd(t){return t?new Date(Number(t)*1e3):new Date}function Vx(t,e){const n=Number(t)||0;return Fi()+e>n}function Sie(t,e){const n=Number(t)+e*24*60*60*1e3;return Date.now()>n}function Cie(t){return Number(t)>Fi()}/*! @azure/msal-common v15.10.0 2025-08-05 */function vw(t,e,n,r,i){return{credentialType:Gr.ID_TOKEN,homeAccountId:t,environment:e,clientId:r,secret:n,realm:i,lastUpdatedAt:Date.now().toString()}}function yw(t,e,n,r,i,o,s,c,l,u,d,f,h,p,v){var y,b;const m={homeAccountId:t,credentialType:Gr.ACCESS_TOKEN,secret:n,cachedAt:Fi().toString(),expiresOn:s.toString(),extendedExpiresOn:c.toString(),environment:e,clientId:r,realm:i,target:o,tokenType:d||xn.BEARER,lastUpdatedAt:Date.now().toString()};if(f&&(m.userAssertionHash=f),u&&(m.refreshOn=u.toString()),p&&(m.requestedClaims=p,m.requestedClaimsHash=v),((y=m.tokenType)==null?void 0:y.toLowerCase())!==xn.BEARER.toLowerCase())switch(m.credentialType=Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME,m.tokenType){case xn.POP:const x=Xf(n,l);if(!((b=x==null?void 0:x.cnf)!=null&&b.kid))throw Te(wU);m.keyId=x.cnf.kid;break;case xn.SSH:m.keyId=h}return m}function s3(t,e,n,r,i,o,s){const c={credentialType:Gr.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 gT(t){return t.hasOwnProperty("homeAccountId")&&t.hasOwnProperty("environment")&&t.hasOwnProperty("credentialType")&&t.hasOwnProperty("clientId")&&t.hasOwnProperty("secret")}function IR(t){return t?gT(t)&&t.hasOwnProperty("realm")&&t.hasOwnProperty("target")&&(t.credentialType===Gr.ACCESS_TOKEN||t.credentialType===Gr.ACCESS_TOKEN_WITH_AUTH_SCHEME):!1}function _ie(t){return t?gT(t)&&t.hasOwnProperty("realm")&&t.credentialType===Gr.ID_TOKEN:!1}function RR(t){return t?gT(t)&&t.credentialType===Gr.REFRESH_TOKEN:!1}function Aie(t,e){const n=t.indexOf(Ur.CACHE_KEY)===0;let r=!0;return e&&(r=e.hasOwnProperty("failedRequests")&&e.hasOwnProperty("errors")&&e.hasOwnProperty("cacheHits")),n&&r}function jie(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 Eie({environment:t,clientId:e}){return[zN,t,e].join(pm.CACHE_KEY_SEPARATOR).toLowerCase()}function Nie(t,e){return e?t.indexOf(zN)===0&&e.hasOwnProperty("clientId")&&e.hasOwnProperty("environment"):!1}function Tie(t,e){return e?t.indexOf(Rx.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 MR(){return Fi()+Rx.REFRESH_TIME_SECONDS}function zv(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 EC(t,e,n){t.aliases=e.aliases,t.preferred_cache=e.preferred_cache,t.preferred_network=e.preferred_network,t.aliasesFromNetwork=n}function DR(t){return t.expiresAt<=Fi()}/*! @azure/msal-common v15.10.0 2025-08-05 */class ti{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 gw(n,this.logger,this.performanceClient,this.correlationId)}getAuthorityType(e){if(e.HostNameAndPort.endsWith(we.CIAM_AUTH_URL))return qo.Ciam;const n=e.PathSegments;if(n.length)switch(n[0].toLowerCase()){case we.ADFS:return qo.Adfs;case we.DSTS:return qo.Dsts}return qo.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 sn(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 Te(wa)}get tokenEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint);throw Te(wa)}get deviceCodeEndpoint(){if(this.discoveryComplete())return this.replacePath(this.metadata.token_endpoint.replace("/token","/devicecode"));throw Te(wa)}get endSessionEndpoint(){if(this.discoveryComplete()){if(!this.metadata.end_session_endpoint)throw Te(_U);return this.replacePath(this.metadata.end_session_endpoint)}else throw Te(wa)}get selfSignedJwtAudience(){if(this.discoveryComplete())return this.replacePath(this.metadata.issuer);throw Te(wa)}get jwksUri(){if(this.discoveryComplete())return this.replacePath(this.metadata.jwks_uri);throw Te(wa)}canReplaceTenant(e){return e.PathSegments.length===1&&!ti.reservedTenantDomains.has(e.PathSegments[0])&&this.getAuthorityType(e)===qo.Default&&this.protocolMode!==Li.OIDC}replaceTenant(e){return e.replace(/{tenant}|{tenantid}/g,this.tenant)}replacePath(e){let n=e;const i=new sn(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 sn(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===qo.Adfs||this.protocolMode===Li.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(W.AuthorityResolveEndpointsAsync,this.correlationId);const e=this.getCurrentMetadataEntity(),n=await be(this.updateCloudDiscoveryMetadata.bind(this),W.AuthorityUpdateCloudDiscoveryMetadata,this.logger,this.performanceClient,this.correlationId)(e);this.canonicalAuthority=this.canonicalAuthority.replace(this.hostnameAndPort,e.preferred_network);const r=await be(this.updateEndpointMetadata.bind(this),W.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:MR(),jwks_uri:""}),e}updateCachedMetadata(e,n,r){n!==Vi.CACHE&&(r==null?void 0:r.source)!==Vi.CACHE&&(e.expiresAt=MR(),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(W.AuthorityUpdateEndpointMetadata,this.correlationId);const n=this.updateEndpointMetadataFromLocalSources(e);if(n){if(n.source===Vi.HARDCODED_VALUES&&(o=this.authorityOptions.azureRegionConfiguration)!=null&&o.azureRegion&&n.metadata){const c=await be(this.updateMetadataWithRegionalInformation.bind(this),W.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(n.metadata);zv(e,c,!1),e.canonical_authority=this.canonicalAuthority}return n.source}let r=await be(this.getEndpointMetadataFromNetwork.bind(this),W.AuthorityGetEndpointMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return(s=this.authorityOptions.azureRegionConfiguration)!=null&&s.azureRegion&&(r=await be(this.updateMetadataWithRegionalInformation.bind(this),W.AuthorityUpdateMetadataWithRegionalInformation,this.logger,this.performanceClient,this.correlationId)(r)),zv(e,r,!0),Vi.NETWORK;throw Te(dU,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"),zv(e,n,!1),{source:Vi.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 zv(e,i,!1),{source:Vi.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=DR(e);return this.isAuthoritySameType(e)&&e.endpointsFromNetwork&&!r?(this.logger.verbose("Found endpoint metadata in the cache."),{source:Vi.CACHE}):(r&&this.logger.verbose("The metadata entity is expired."),null)}isAuthoritySameType(e){return new sn(e.canonical_authority).getUrlComponents().PathSegments.length===this.canonicalAuthorityUrlComponents.PathSegments.length}getEndpointMetadataFromConfig(){if(this.authorityOptions.authorityMetadata)try{return JSON.parse(this.authorityOptions.authorityMetadata)}catch{throw Pn(OU)}return null}async getEndpointMetadataFromNetwork(){var r;(r=this.performanceClient)==null||r.addQueueMeasurement(W.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 xie(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 ER?ER[this.hostnameAndPort]:null}async updateMetadataWithRegionalInformation(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(W.AuthorityUpdateMetadataWithRegionalInformation,this.correlationId);const n=(i=this.authorityOptions.azureRegionConfiguration)==null?void 0:i.azureRegion;if(n){if(n!==we.AZURE_REGION_AUTO_DISCOVER_FLAG)return this.regionDiscoveryMetadata.region_outcome=AC.CONFIGURED_NO_AUTO_DETECTION,this.regionDiscoveryMetadata.region_used=n,ti.replaceWithRegionalInformation(e,n);const s=await be(this.regionDiscovery.detectRegion.bind(this.regionDiscovery),W.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=AC.AUTO_DETECTION_REQUESTED_SUCCESSFUL,this.regionDiscoveryMetadata.region_used=s,ti.replaceWithRegionalInformation(e,s);this.regionDiscoveryMetadata.region_outcome=AC.AUTO_DETECTION_REQUESTED_FAILED}return e}async updateCloudDiscoveryMetadata(e){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(W.AuthorityUpdateCloudDiscoveryMetadata,this.correlationId);const n=this.updateCloudDiscoveryMetadataFromLocalSources(e);if(n)return n;const r=await be(this.getCloudDiscoveryMetadataFromNetwork.bind(this),W.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.logger,this.performanceClient,this.correlationId)();if(r)return EC(e,r,!0),Vi.NETWORK;throw Pn(IU)}updateCloudDiscoveryMetadataFromLocalSources(e){this.logger.verbose("Attempting to get cloud discovery metadata from authority configuration"),this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities||we.NOT_APPLICABLE}`),this.logger.verbosePii(`Authority Metadata: ${this.authorityOptions.authorityMetadata||we.NOT_APPLICABLE}`),this.logger.verbosePii(`Canonical Authority: ${e.canonical_authority||we.NOT_APPLICABLE}`);const n=this.getCloudDiscoveryMetadataFromConfig();if(n)return this.logger.verbose("Found cloud discovery metadata in authority configuration"),EC(e,n,!1),Vi.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=dre(this.hostnameAndPort);if(i)return this.logger.verbose("Found cloud discovery metadata from hardcoded values."),EC(e,i,!1),Vi.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=DR(e);return this.isAuthoritySameType(e)&&e.aliasesFromNetwork&&!r?(this.logger.verbose("Found cloud discovery metadata in the cache."),Vi.CACHE):(r&&this.logger.verbose("The metadata entity is expired."),null)}getCloudDiscoveryMetadataFromConfig(){if(this.authorityType===qo.Ciam)return this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host."),ti.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=Lx(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."),Pn(eT)}}return this.isInKnownAuthorities()?(this.logger.verbose("The host is included in knownAuthorities. Creating new cloud discovery metadata from the host."),ti.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)):null}async getCloudDiscoveryMetadataFromNetwork(){var i;(i=this.performanceClient)==null||i.addQueueMeasurement(W.AuthorityGetCloudDiscoveryMetadataFromNetwork,this.correlationId);const e=`${we.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(bie(o.body))s=o.body,c=s.metadata,this.logger.verbosePii(`tenant_discovery_endpoint is: ${s.tenant_discovery_endpoint}`);else if(wie(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===we.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=Lx(c,this.hostnameAndPort)}catch(o){if(o instanceof En)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=ti.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort)),r}isInKnownAuthorities(){return this.authorityOptions.knownAuthorities.filter(n=>n&&sn.getDomainFromUrl(n).toLowerCase()===this.hostnameAndPort).length>0}static generateAuthority(e,n){let r;if(n&&n.azureCloudInstance!==XN.None){const i=n.tenant?n.tenant:we.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 we.DEFAULT_AUTHORITY_HOST;if(this.discoveryComplete())return this.metadata.preferred_cache;throw Te(wa)}isAlias(e){return this.metadata.aliases.indexOf(e)>-1}isAliasOfKnownMicrosoftAuthority(e){return HU.has(e)}static isPublicCloudAuthority(e){return we.KNOWN_PUBLIC_CLOUDS.indexOf(e)>=0}static buildRegionalAuthorityString(e,n,r){const i=new sn(e);i.validateAsUri();const o=i.getUrlComponents();let s=`${n}.${o.HostNameAndPort}`;this.isPublicCloudAuthority(o.HostNameAndPort)&&(s=`${n}.${we.REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX}`);const c=sn.constructAuthorityUriFromObject({...i.getUrlComponents(),HostNameAndPort:s}).urlString;return r?`${c}?${r}`:c}static replaceWithRegionalInformation(e,n){const r={...e};return r.authorization_endpoint=ti.buildRegionalAuthorityString(r.authorization_endpoint,n),r.token_endpoint=ti.buildRegionalAuthorityString(r.token_endpoint,n),r.end_session_endpoint&&(r.end_session_endpoint=ti.buildRegionalAuthorityString(r.end_session_endpoint,n)),r}static transformCIAMAuthority(e){let n=e;const i=new sn(e).getUrlComponents();if(i.PathSegments.length===0&&i.HostNameAndPort.endsWith(we.CIAM_AUTH_URL)){const o=i.HostNameAndPort.split(".")[0];n=`${n}${o}${we.AAD_TENANT_DOMAIN_SUFFIX}`}return n}}ti.reservedTenantDomains=new Set(["{tenant}","{tenantid}",Gc.COMMON,Gc.CONSUMERS,Gc.ORGANIZATIONS]);function kie(t){var i;const r=(i=new sn(t).getUrlComponents().PathSegments.slice(-1)[0])==null?void 0:i.toLowerCase();switch(r){case Gc.COMMON:case Gc.ORGANIZATIONS:case Gc.CONSUMERS:return;default:return r}}function a3(t){return t.endsWith(we.FORWARD_SLASH)?t:`${t}${we.FORWARD_SLASH}`}function Pie(t){const e=t.cloudDiscoveryMetadata;let n;if(e)try{n=JSON.parse(e)}catch{throw Pn(eT)}return{canonicalAuthority:t.authority?a3(t.authority):void 0,knownAuthorities:t.knownAuthorities,cloudDiscoveryMetadata:n}}/*! @azure/msal-common v15.10.0 2025-08-05 */async function c3(t,e,n,r,i,o,s){s==null||s.addQueueMeasurement(W.AuthorityFactoryCreateDiscoveredInstance,o);const c=ti.transformCIAMAuthority(a3(t)),l=new ti(c,e,n,r,i,o,s);try{return await be(l.resolveEndpointsAsync.bind(l),W.AuthorityResolveEndpointsAsync,i,s,o)(),l}catch{throw Te(wa)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Ru extends En{constructor(e,n,r,i,o){super(e,n,r),this.name="ServerError",this.errorNo=i,this.status=o,Object.setPrototypeOf(this,Ru.prototype)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function xw(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 $s{static generateThrottlingStorageKey(e){return`${Cp.THROTTLING_PREFIX}.${JSON.stringify(e)}`}static preProcess(e,n,r){var s;const i=$s.generateThrottlingStorageKey(n),o=e.getThrottlingCache(i);if(o){if(o.throttleTime=500&&e.status<600}static checkResponseForRetryAfter(e){return e.headers?e.headers.hasOwnProperty(hi.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=xw(n,r,i),s=this.generateThrottlingStorageKey(o);e.removeItem(s,r.correlationId)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class bw extends En{constructor(e,n,r){super(e.errorCode,e.errorMessage,e.subError),Object.setPrototypeOf(this,bw.prototype),this.name="NetworkError",this.error=e,this.httpStatus=n,this.responseHeaders=r}}function op(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 bw(t,e,n)}/*! @azure/msal-common v15.10.0 2025-08-05 */class vT{constructor(e,n){this.config=wre(e),this.logger=new Ka(this.config.loggerOptions,AU,QN),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[hi.CONTENT_TYPE]=we.URL_FORM_CONTENT_TYPE,!this.config.systemOptions.preventCorsPreflight&&e)switch(e.type){case ns.HOME_ACCOUNT_ID:try{const r=kd(e.credential);n[hi.CCS_HEADER]=`Oid:${r.uid}@${r.utid}`}catch(r){this.logger.verbose("Could not parse home account ID for CCS Header: "+r)}break;case ns.UPN:n[hi.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;$s.preProcess(this.cacheManager,e,i);let o;try{o=await be(this.networkClient.sendPostRequestAsync.bind(this.networkClient),W.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[hi.X_MS_HTTP_VERSION]||"",requestId:u[hi.X_MS_REQUEST_ID]||""},i)}catch(u){if(u instanceof bw){const d=u.responseHeaders;throw d&&((l=this.performanceClient)==null||l.addFields({httpVerToken:d[hi.X_MS_HTTP_VERSION]||"",requestId:d[hi.X_MS_REQUEST_ID]||"",contentTypeHeader:d[hi.CONTENT_TYPE]||void 0,contentLengthHeader:d[hi.CONTENT_LENGTH]||void 0,httpStatus:u.httpStatus},i)),u.error}throw u instanceof En?u:Te(uU)}return $s.postProcess(this.cacheManager,e,o,i),o}async updateAuthority(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(W.UpdateTokenEndpointAuthority,n);const r=`https://${e}/${this.authority.tenant}/`,i=await c3(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&&mw(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenQueryParameters&&Wc(n,e.tokenQueryParameters),dT(n,e.correlationId),pw(n,e.correlationId,this.performanceClient),mm(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */function l3(t){return t&&(t.tid||t.tfp||t.acr)||null}/*! @azure/msal-common v15.10.0 2025-08-05 */class gs{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,v,m;const i=new gs;n.authorityType===qo.Adfs?i.authorityType=Bv.ADFS_ACCOUNT_TYPE:n.protocolMode===Li.OIDC?i.authorityType=Bv.GENERIC_ACCOUNT_TYPE:i.authorityType=Bv.MSSTS_ACCOUNT_TYPE;let o;e.clientInfo&&r&&(o=Bx(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 Te(WN);i.environment=s,i.realm=(o==null?void 0:o.utid)||l3(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=(v=e.idTokenClaims)==null?void 0:v.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=nT(e.homeAccountId,i.localAccountId,i.realm,e.idTokenClaims);i.tenantProfiles=[y]}return i}static createFromAccountInfo(e,n,r){var o;const i=new gs;return i.authorityType=e.authorityType||Bv.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===qo.Adfs||n===qo.Dsts)){if(e)try{const s=Bx(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 Gx="no_tokens_found",u3="native_account_unavailable",yT="refresh_token_expired",xT="ux_not_allowed",Oie="interaction_required",Iie="consent_required",Rie="login_required",ww="bad_token";/*! @azure/msal-common v15.10.0 2025-08-05 */const $R=[Oie,Iie,Rie,ww,xT],Mie=["message_only","additional_action","basic_action","user_password_expired","consent_required","bad_token"],Die={[Gx]:"No refresh token found in the cache. Please sign-in.",[u3]:"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.",[yT]:"Refresh token has expired.",[ww]:"Identity provider returned bad_token due to an expired or invalid refresh token. Please invoke an interactive API to resolve.",[xT]:"`canShowUI` flag in Edge was set to false. User interaction required on web page. Please invoke an interactive API to resolve."};class vs extends En{constructor(e,n,r,i,o,s,c,l){super(e,n,r),Object.setPrototypeOf(this,vs.prototype),this.timestamp=i||we.EMPTY_STRING,this.traceId=o||we.EMPTY_STRING,this.correlationId=s||we.EMPTY_STRING,this.claims=c||we.EMPTY_STRING,this.name="InteractionRequiredAuthError",this.errorNo=l}}function d3(t,e,n){const r=!!t&&$R.indexOf(t)>-1,i=!!n&&Mie.indexOf(n)>-1,o=!!e&&$R.some(s=>e.indexOf(s)>-1);return r||o||i}function Kx(t){return new vs(t,Die[t])}/*! @azure/msal-common v15.10.0 2025-08-05 */class Jf{static setRequestState(e,n,r){const i=Jf.generateLibraryState(e,r);return n?`${i}${we.RESOURCE_DELIM}${n}`:i}static generateLibraryState(e,n){if(!e)throw Te(YA);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 Te(YA);if(!n)throw Te(af);try{const r=n.split(we.RESOURCE_DELIM),i=r[0],o=r.length>1?r.slice(1).join(we.RESOURCE_DELIM):we.EMPTY_STRING,s=e.base64Decode(i),c=JSON.parse(s);return{userRequestState:o||we.EMPTY_STRING,libraryState:c}}catch{throw Te(af)}}}/*! @azure/msal-common v15.10.0 2025-08-05 */const $ie={SW:"sw"};class cf{constructor(e,n){this.cryptoUtils=e,this.performanceClient=n}async generateCnf(e,n){var o;(o=this.performanceClient)==null||o.addQueueMeasurement(W.PopTokenGenerateCnf,e.correlationId);const r=await be(this.generateKid.bind(this),W.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(W.PopTokenGenerateKid,e.correlationId),{kid:await this.cryptoUtils.getPublicKeyThumbprint(e),xms_ksl:$ie.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 sn(s):void 0,f=d==null?void 0:d.getUrlComponents();return this.cryptoUtils.signJwt({at:e,ts:Fi(),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 Lie{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 xu{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||we.NOT_AVAILABLE} - Timestamp: ${e.timestamp||we.NOT_AVAILABLE} - Description: ${e.error_description||we.NOT_AVAILABLE} - Correlation ID: ${e.correlation_id||we.NOT_AVAILABLE} - Trace ID: ${e.trace_id||we.NOT_AVAILABLE}`,o=(r=e.error_codes)!=null&&r.length?e.error_codes[0]:void 0,s=new Ru(e.error,i,e.suberror,o,e.status);if(n&&e.status&&e.status>=Oc.SERVER_ERROR_RANGE_START&&e.status<=Oc.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>=Oc.CLIENT_ERROR_RANGE_START&&e.status<=Oc.CLIENT_ERROR_RANGE_END){this.logger.warning(`executeTokenRequest:validateTokenResponse - AAD is currently available but is unable to refresh the access token. -${s}`);return}throw d3(e.error,e.error_description,e.suberror)?new vs(e.error,e.error_description,e.suberror,e.timestamp||we.EMPTY_STRING,e.trace_id||we.EMPTY_STRING,e.correlation_id||we.EMPTY_STRING,e.claims||we.EMPTY_STRING,o):s}}async handleServerTokenResponse(e,n,r,i,o,s,c,l,u){var v;(v=this.performanceClient)==null||v.addQueueMeasurement(W.HandleServerTokenResponse,e.correlation_id);let d;if(e.id_token){if(d=Xf(e.id_token||we.EMPTY_STRING,this.cryptoObj.base64Decode),o&&o.nonce&&d.nonce!==o.nonce)throw Te(pU);if(i.maxAge||i.maxAge===0){const m=d.auth_time;if(!m)throw Te(GN);BU(m,i.maxAge)}}this.homeAccountIdentifier=gs.generateHomeAccountId(e.client_info||we.EMPTY_STRING,n.authorityType,this.logger,this.cryptoObj,d);let f;o&&o.state&&(f=Jf.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 Lie(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 xu.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 xu.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 Te(WN);const u=l3(o);let d,f;e.id_token&&o&&(d=vw(this.homeAccountIdentifier,l,e.id_token,this.clientId,u||""),f=bT(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?Nr.fromString(e.scope):new Nr(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=yw(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=s3(this.homeAccountIdentifier,l,e.refresh_token,this.clientId,e.foci,s,m)}let v=null;return e.foci&&(v={clientId:this.clientId,environment:l,familyId:e.foci}),{account:f,idToken:d,accessToken:h,refreshToken:p,appMetadata:v}}static async generateAuthenticationResult(e,n,r,i,o,s,c,l,u){var w,S,C,_,A;let d=we.EMPTY_STRING,f=[],h=null,p,v,m=we.EMPTY_STRING;if(r.accessToken){if(r.accessToken.tokenType===xn.POP&&!o.popKid){const j=new cf(e),{secret:T,keyId:k}=r.accessToken;if(!k)throw Te(qN);d=await j.signPopToken(T,k,o)}else d=r.accessToken.secret;f=Nr.fromString(r.accessToken.target).asArray(),h=Pd(r.accessToken.expiresOn),p=Pd(r.accessToken.extendedExpiresOn),r.accessToken.refreshOn&&(v=Pd(r.accessToken.refreshOn))}r.appMetadata&&(m=r.appMetadata.familyId===Ix?Ix:"");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?rT(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:v,correlationId:o.correlationId,requestId:u||we.EMPTY_STRING,familyId:m,tokenType:((C=r.accessToken)==null?void 0:C.tokenType)||we.EMPTY_STRING,state:c?c.userRequestState:we.EMPTY_STRING,cloudGraphHostName:((_=r.account)==null?void 0:_.cloudGraphHostName)||we.EMPTY_STRING,msGraphHost:((A=r.account)==null?void 0:A.msGraphHost)||we.EMPTY_STRING,code:l==null?void 0:l.spa_code,fromNativeBroker:!1}}}function bT(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 v=null;p&&(v=t.getAccount(p,i));const m=v||gs.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=nT(n,m.localAccountId,b,o);y.push(x)}return m.tenantProfiles=y,m}/*! @azure/msal-common v15.10.0 2025-08-05 */async function f3(t,e,n){return typeof t=="string"?t:t({clientId:e,tokenEndpoint:n})}/*! @azure/msal-common v15.10.0 2025-08-05 */class h3 extends vT{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(W.AuthClientAcquireToken,e.correlationId),!e.code)throw Te(vU);const r=Fi(),i=await be(this.executeTokenRequest.bind(this),W.AuthClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(this.authority,e),o=(l=i.headers)==null?void 0:l[hi.X_MS_REQUEST_ID],s=new xu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin,this.performanceClient);return s.validateTokenResponse(i.body),be(s.handleServerTokenResponse.bind(s),W.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 Pn(PU);const n=this.createLogoutUrlQueryString(e);return sn.appendQueryString(this.authority.endSessionEndpoint,n)}async executeTokenRequest(e,n){var u;(u=this.performanceClient)==null||u.addQueueMeasurement(W.AuthClientExecuteTokenRequest,n.correlationId);const r=this.createTokenQueryParameters(n),i=sn.appendQueryString(e.tokenEndpoint,r),o=await be(this.createTokenRequestBody.bind(this),W.AuthClientCreateTokenRequestBody,this.logger,this.performanceClient,n.correlationId)(n);let s;if(n.clientInfo)try{const d=Bx(n.clientInfo,this.cryptoUtils.base64Decode);s={credential:`${d.uid}${pm.CLIENT_INFO_SEPARATOR}${d.utid}`,type:ns.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=xw(this.config.authOptions.clientId,n);return be(this.executePostToTokenEndpoint.bind(this),W.AuthorizationCodeClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,n.correlationId)(i,o,c,l,n.correlationId,W.AuthorizationCodeClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var i,o;(i=this.performanceClient)==null||i.addQueueMeasurement(W.AuthClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(cT(n,e.embeddedClientId||((o=e.tokenBodyParameters)==null?void 0:o[yu])||this.config.authOptions.clientId),this.includeRedirectUri)lT(n,e.redirectUri);else if(!e.redirectUri)throw Pn(jU);if(aT(n,e.scopes,!0,this.oidcDefaultScopes),fie(n,e.code),fT(n,this.config.libraryInfo),hT(n,this.config.telemetry.application),o3(n),this.serverTelemetryManager&&!KU(this.config)&&i3(n,this.serverTelemetryManager),e.codeVerifier&&pie(n,e.codeVerifier),this.config.clientCredentials.clientSecret&&JU(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;ZU(n,await f3(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),e3(n,s.assertionType)}if(t3(n,sU.AUTHORIZATION_CODE_GRANT),pT(n),e.authenticationScheme===xn.POP){const s=new cf(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await be(s.generateCnf.bind(s),W.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,mT(n,c)}else if(e.authenticationScheme===xn.SSH)if(e.sshJwk)r3(n,e.sshJwk);else throw Pn(hw);(!Gs.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&uT(n,e.claims,this.config.authOptions.clientCapabilities);let r;if(e.clientInfo)try{const s=Bx(e.clientInfo,this.cryptoUtils.base64Decode);r={credential:`${s.uid}${pm.CLIENT_INFO_SEPARATOR}${s.utid}`,type:ns.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 ns.HOME_ACCOUNT_ID:try{const s=kd(r.credential);_p(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case ns.UPN:Hx(n,r.credential);break}return e.embeddedClientId&&mw(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Wc(n,e.tokenBodyParameters),e.enableSpaAuthorizationCode&&(!e.tokenBodyParameters||!e.tokenBodyParameters[kR])&&Wc(n,{[kR]:"1"}),pw(n,e.correlationId,this.performanceClient),mm(n)}createLogoutUrlQueryString(e){const n=new Map;return e.postLogoutRedirectUri&&aie(n,e.postLogoutRedirectUri),e.correlationId&&dT(n,e.correlationId),e.idTokenHint&&cie(n,e.idTokenHint),e.state&&QU(n,e.state),e.logoutHint&&gie(n,e.logoutHint),e.extraQueryParameters&&Wc(n,e.extraQueryParameters),this.config.authOptions.instanceAware&&n3(n),mm(n,this.config.authOptions.encodeExtraQueryParams,e.extraQueryParameters)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const Fie=300;class Bie extends vT{constructor(e,n){super(e,n)}async acquireToken(e){var s,c;(s=this.performanceClient)==null||s.addQueueMeasurement(W.RefreshTokenClientAcquireToken,e.correlationId);const n=Fi(),r=await be(this.executeTokenRequest.bind(this),W.RefreshTokenClientExecuteTokenRequest,this.logger,this.performanceClient,e.correlationId)(e,this.authority),i=(c=r.headers)==null?void 0:c[hi.X_MS_REQUEST_ID],o=new xu(this.config.authOptions.clientId,this.cacheManager,this.cryptoUtils,this.logger,this.config.serializableCache,this.config.persistencePlugin);return o.validateTokenResponse(r.body),be(o.handleServerTokenResponse.bind(o),W.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 Pn(kU);if((r=this.performanceClient)==null||r.addQueueMeasurement(W.RefreshTokenClientAcquireTokenByRefreshToken,e.correlationId),!e.account)throw Te(KN);if(this.cacheManager.isAppMetadataFOCI(e.account.environment))try{return await be(this.acquireTokenWithCachedRefreshToken.bind(this),W.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!0)}catch(i){const o=i instanceof vs&&i.errorCode===Gx,s=i instanceof Ru&&i.errorCode===CR.INVALID_GRANT_ERROR&&i.subError===CR.CLIENT_MISMATCH_ERROR;if(o||s)return be(this.acquireTokenWithCachedRefreshToken.bind(this),W.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1);throw i}return be(this.acquireTokenWithCachedRefreshToken.bind(this),W.RefreshTokenClientAcquireTokenWithCachedRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,!1)}async acquireTokenWithCachedRefreshToken(e,n){var o,s,c;(o=this.performanceClient)==null||o.addQueueMeasurement(W.RefreshTokenClientAcquireTokenWithCachedRefreshToken,e.correlationId);const r=ro(this.cacheManager.getRefreshToken.bind(this.cacheManager),W.CacheManagerGetRefreshToken,this.logger,this.performanceClient,e.correlationId)(e.account,n,e.correlationId,void 0,this.performanceClient);if(!r)throw Kx(Gx);if(r.expiresOn&&Vx(r.expiresOn,e.refreshTokenExpirationOffsetSeconds||Fie))throw(s=this.performanceClient)==null||s.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),Kx(yT);const i={...e,refreshToken:r.secret,authenticationScheme:e.authenticationScheme||xn.BEARER,ccsCredential:{credential:e.account.homeAccountId,type:ns.HOME_ACCOUNT_ID}};try{return await be(this.acquireToken.bind(this),W.RefreshTokenClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(i)}catch(l){if(l instanceof vs&&((c=this.performanceClient)==null||c.addFields({rtExpiresOnMs:Number(r.expiresOn)},e.correlationId),l.subError===ww)){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(W.RefreshTokenClientExecuteTokenRequest,e.correlationId);const r=this.createTokenQueryParameters(e),i=sn.appendQueryString(n.tokenEndpoint,r),o=await be(this.createTokenRequestBody.bind(this),W.RefreshTokenClientCreateTokenRequestBody,this.logger,this.performanceClient,e.correlationId)(e),s=this.createTokenRequestHeaders(e.ccsCredential),c=xw(this.config.authOptions.clientId,e);return be(this.executePostToTokenEndpoint.bind(this),W.RefreshTokenClientExecutePostToTokenEndpoint,this.logger,this.performanceClient,e.correlationId)(i,o,s,c,e.correlationId,W.RefreshTokenClientExecutePostToTokenEndpoint)}async createTokenRequestBody(e){var r,i,o;(r=this.performanceClient)==null||r.addQueueMeasurement(W.RefreshTokenClientCreateTokenRequestBody,e.correlationId);const n=new Map;if(cT(n,e.embeddedClientId||((i=e.tokenBodyParameters)==null?void 0:i[yu])||this.config.authOptions.clientId),e.redirectUri&&lT(n,e.redirectUri),aT(n,e.scopes,!0,(o=this.config.authOptions.authority.options.OIDCOptions)==null?void 0:o.defaultScopes),t3(n,sU.REFRESH_TOKEN_GRANT),pT(n),fT(n,this.config.libraryInfo),hT(n,this.config.telemetry.application),o3(n),this.serverTelemetryManager&&!KU(this.config)&&i3(n,this.serverTelemetryManager),hie(n,e.refreshToken),this.config.clientCredentials.clientSecret&&JU(n,this.config.clientCredentials.clientSecret),this.config.clientCredentials.clientAssertion){const s=this.config.clientCredentials.clientAssertion;ZU(n,await f3(s.assertion,this.config.authOptions.clientId,e.resourceRequestUri)),e3(n,s.assertionType)}if(e.authenticationScheme===xn.POP){const s=new cf(this.cryptoUtils,this.performanceClient);let c;e.popKid?c=this.cryptoUtils.encodeKid(e.popKid):c=(await be(s.generateCnf.bind(s),W.PopTokenGenerateCnf,this.logger,this.performanceClient,e.correlationId)(e,this.logger)).reqCnfString,mT(n,c)}else if(e.authenticationScheme===xn.SSH)if(e.sshJwk)r3(n,e.sshJwk);else throw Pn(hw);if((!Gs.isEmptyObj(e.claims)||this.config.authOptions.clientCapabilities&&this.config.authOptions.clientCapabilities.length>0)&&uT(n,e.claims,this.config.authOptions.clientCapabilities),this.config.systemOptions.preventCorsPreflight&&e.ccsCredential)switch(e.ccsCredential.type){case ns.HOME_ACCOUNT_ID:try{const s=kd(e.ccsCredential.credential);_p(n,s)}catch(s){this.logger.verbose("Could not parse home account ID for CCS Header: "+s)}break;case ns.UPN:Hx(n,e.ccsCredential.credential);break}return e.embeddedClientId&&mw(n,this.config.authOptions.clientId,this.config.authOptions.redirectUri),e.tokenBodyParameters&&Wc(n,e.tokenBodyParameters),pw(n,e.correlationId,this.performanceClient),mm(n)}}/*! @azure/msal-common v15.10.0 2025-08-05 */class Uie extends vT{constructor(e,n){super(e,n)}async acquireCachedToken(e){var l;(l=this.performanceClient)==null||l.addQueueMeasurement(W.SilentFlowClientAcquireCachedToken,e.correlationId);let n=Il.NOT_APPLICABLE;if(e.forceRefresh||!this.config.cacheOptions.claimsBasedCachingEnabled&&!Gs.isEmptyObj(e.claims))throw this.setCacheOutcome(Il.FORCE_REFRESH_OR_CLAIMS,e.correlationId),Te(Kc);if(!e.account)throw Te(KN);const r=e.account.tenantId||kie(e.authority),i=this.cacheManager.getTokenKeys(),o=this.cacheManager.getAccessToken(e.account,e,i,r);if(o){if(Cie(o.cachedAt)||Vx(o.expiresOn,this.config.systemOptions.tokenRenewalOffsetSeconds))throw this.setCacheOutcome(Il.CACHED_ACCESS_TOKEN_EXPIRED,e.correlationId),Te(Kc);o.refreshOn&&Vx(o.refreshOn,0)&&(n=Il.PROACTIVELY_REFRESHED)}else throw this.setCacheOutcome(Il.NO_CACHED_ACCESS_TOKEN,e.correlationId),Te(Kc);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 be(this.generateResultFromCacheRecord.bind(this),W.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!==Il.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(W.SilentFlowClientGenerateResultFromCacheRecord,n.correlationId);let r;if(e.idToken&&(r=Xf(e.idToken.secret,this.config.cryptoInterface.base64Decode)),n.maxAge||n.maxAge===0){const o=r==null?void 0:r.auth_time;if(!o)throw Te(GN);BU(o,n.maxAge)}return xu.generateAuthenticationResult(this.cryptoUtils,this.authority,e,!0,n,r)}}/*! @azure/msal-common v15.10.0 2025-08-05 */const zie={sendGetRequestAsync:()=>Promise.reject(Te(Yt)),sendPostRequestAsync:()=>Promise.reject(Te(Yt))};/*! @azure/msal-common v15.10.0 2025-08-05 */function Hie(t,e,n,r){var c,l;const i=e.correlationId,o=new Map;cT(o,e.embeddedClientId||((c=e.extraQueryParameters)==null?void 0:c[yu])||t.clientId);const s=[...e.scopes||[],...e.extraScopesToConsent||[]];if(aT(o,s,!0,(l=t.authority.options.OIDCOptions)==null?void 0:l.defaultScopes),lT(o,e.redirectUri),dT(o,i),oie(o,e.responseMode),pT(o),e.prompt&&(uie(o,e.prompt),r==null||r.addFields({prompt:e.prompt},i)),e.domainHint&&(lie(o,e.domainHint),r==null||r.addFields({domainHintFromRequest:!0},i)),e.prompt!==gi.SELECT_ACCOUNT)if(e.sid&&e.prompt===gi.NONE)n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from request"),PR(o,e.sid),r==null||r.addFields({sidFromRequest:!0},i);else if(e.account){const u=Kie(e.account);let d=Wie(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"),Uv(o,d),r==null||r.addFields({loginHintFromClaim:!0},i);try{const f=kd(e.account.homeAccountId);_p(o,f)}catch{n.verbose("createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header")}}else if(u&&e.prompt===gi.NONE){n.verbose("createAuthCodeUrlQueryString: Prompt is none, adding sid from account"),PR(o,u),r==null||r.addFields({sidFromClaim:!0},i);try{const f=kd(e.account.homeAccountId);_p(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"),Uv(o,e.loginHint),Hx(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i);else if(e.account.username){n.verbose("createAuthCodeUrlQueryString: Adding login_hint from account"),Uv(o,e.account.username),r==null||r.addFields({loginHintFromUpn:!0},i);try{const f=kd(e.account.homeAccountId);_p(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"),Uv(o,e.loginHint),Hx(o,e.loginHint),r==null||r.addFields({loginHintFromRequest:!0},i));else n.verbose("createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints");return e.nonce&&die(o,e.nonce),e.state&&QU(o,e.state),(e.claims||t.clientCapabilities&&t.clientCapabilities.length>0)&&uT(o,e.claims,t.clientCapabilities),e.embeddedClientId&&mw(o,t.clientId,t.redirectUri),t.instanceAware&&(!e.extraQueryParameters||!Object.keys(e.extraQueryParameters).includes(JA))&&n3(o),o}function wT(t,e,n,r){const i=mm(e,n,r);return sn.appendQueryString(t.authorizationEndpoint,i)}function Vie(t,e){if(p3(t,e),!t.code)throw Te(SU);return t}function p3(t,e){if(!t.state||!e)throw t.state?Te(KA,"Cached State"):Te(KA,"Server State");let n,r;try{n=decodeURIComponent(t.state)}catch{throw Te(af,t.state)}try{r=decodeURIComponent(e)}catch{throw Te(af,t.state)}if(n!==r)throw Te(hU);if(t.error||t.error_description||t.suberror){const i=Gie(t);throw d3(t.error,t.error_description,t.suberror)?new vs(t.error||"",t.error_description,t.suberror,t.timestamp||"",t.trace_id||"",t.correlation_id||"",t.claims||"",i):new Ru(t.error||"",t.error_description,t.suberror,i)}}function Gie(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 Kie(t){var e;return((e=t.idTokenClaims)==null?void 0:e.sid)||null}function Wie(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 LR=",",m3="|";function qie(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(LR),c.length<4)return e}else c=Array.from({length:4},()=>m3);return s.forEach((l,u)=>{var d,f;l.length===2&&((d=l[0])!=null&&d.length)&&((f=l[1])!=null&&f.length)&&Yie({skuArr:c,index:u,skuName:l[0],skuVersion:l[1]})}),c.join(LR)}function Yie(t){const{skuArr:e,index:n,skuName:r,skuVersion:i}=t;n>=e.length||(e[n]=[r,i].join(m3))}class gm{constructor(e,n){this.cacheOutcome=Il.NOT_APPLICABLE,this.cacheManager=n,this.apiId=e.apiId,this.correlationId=e.correlationId,this.wrapperSKU=e.wrapperSKU||we.EMPTY_STRING,this.wrapperVer=e.wrapperVer||we.EMPTY_STRING,this.telemetryCacheKey=Ur.CACHE_KEY+pm.CACHE_KEY_SEPARATOR+e.clientId}generateCurrentRequestHeaderValue(){const e=`${this.apiId}${Ur.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(Ur.VALUE_SEPARATOR),o=this.getRegionDiscoveryFields(),s=[e,o].join(Ur.VALUE_SEPARATOR);return[Ur.SCHEMA_VERSION,s,i].join(Ur.CATEGORY_SEPARATOR)}generateLastRequestHeaderValue(){const e=this.getLastRequests(),n=gm.maxErrorsToSend(e),r=e.failedRequests.slice(0,2*n).join(Ur.VALUE_SEPARATOR),i=e.errors.slice(0,n).join(Ur.VALUE_SEPARATOR),o=e.errors.length,s=n=Ur.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 En?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(Ur.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=gm.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 as(t){return new TextDecoder().decode(qc(t))}function qc(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 Ze(H3)}const n=atob(e);return Uint8Array.from(n,r=>r.codePointAt(0)||0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const aoe="RSASSA-PKCS1-v1_5",Zf="AES-GCM",Y3="HKDF",kT="SHA-256",coe=2048,loe=new Uint8Array([1,0,1]),zR="0123456789abcdef",HR=new Uint32Array(1),PT="raw",Q3="encrypt",OT="decrypt",uoe="deriveKey",doe="crypto_subtle_undefined",IT={name:aoe,hash:kT,modulusLength:coe,publicExponent:loe};function foe(t){if(!window)throw Ze(_w);if(!window.crypto)throw Ze(ZA);if(!t&&!window.crypto.subtle)throw Ze(ZA,doe)}async function X3(t,e,n){e==null||e.addQueueMeasurement(W.Sha256Digest,n);const i=new TextEncoder().encode(t);return window.crypto.subtle.digest(kT,i)}function hoe(t){return window.crypto.getRandomValues(t)}function NC(){return window.crypto.getRandomValues(HR),HR[0]}function ys(){const t=Date.now(),e=NC()*1024+(NC()&1023),n=new Uint8Array(16),r=Math.trunc(e/2**30),i=e&2**30-1,o=NC();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+=zR.charAt(n[c]&15),(c===3||c===5||c===7||c===9)&&(s+="-");return s}async function poe(t,e){return window.crypto.subtle.generateKey(IT,t,e)}async function TC(t){return window.crypto.subtle.exportKey(W3,t)}async function moe(t,e,n){return window.crypto.subtle.importKey(W3,t,IT,e,n)}async function goe(t,e){return window.crypto.subtle.sign(IT,t,e)}async function RT(){const t=await J3(),n={alg:"dir",kty:"oct",k:sl(new Uint8Array(t))};return ym(JSON.stringify(n))}async function voe(t){const e=as(t),r=JSON.parse(e).k,i=qc(r);return window.crypto.subtle.importKey(PT,i,Zf,!1,[OT])}async function yoe(t,e){const n=e.split(".");if(n.length!==5)throw Ze(Dy,"jwe_length");const r=await voe(t).catch(()=>{throw Ze(Dy,"import_key")});try{const i=new TextEncoder().encode(n[0]),o=qc(n[2]),s=qc(n[3]),c=qc(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:Zf,iv:o,tagLength:l,additionalData:i},r,u);return new TextDecoder().decode(d)}catch{throw Ze(Dy,"decrypt")}}async function J3(){const t=await window.crypto.subtle.generateKey({name:Zf,length:256},!0,[Q3,OT]);return window.crypto.subtle.exportKey(PT,t)}async function VR(t){return window.crypto.subtle.importKey(PT,t,Y3,!1,[uoe])}async function Z3(t,e,n){return window.crypto.subtle.deriveKey({name:Y3,salt:e,hash:kT,info:new TextEncoder().encode(n)},t,{name:Zf,length:256},!1,[Q3,OT])}async function xoe(t,e,n){const r=new TextEncoder().encode(e),i=window.crypto.getRandomValues(new Uint8Array(16)),o=await Z3(t,i,n),s=await window.crypto.subtle.encrypt({name:Zf,iv:new Uint8Array(12)},o,r);return{data:sl(new Uint8Array(s)),nonce:sl(i)}}async function GR(t,e,n,r){const i=qc(r),o=await Z3(t,qc(e),n),s=await window.crypto.subtle.decrypt({name:Zf,iv:new Uint8Array(12)},o,i);return new TextDecoder().decode(s)}async function e6(t){const e=await X3(t),n=new Uint8Array(e);return sl(n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const xm="storage_not_supported",dr="stubbed_public_client_application_called",Yx="in_mem_redirect_unavailable";/*! @azure/msal-browser v4.19.0 2025-08-05 */const $y={[xm]:"Given storage configuration option was not supported.",[dr]:"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",[Yx]:"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."};$y[xm],$y[dr],$y[Yx];class MT extends En{constructor(e,n){super(e,n),this.name="BrowserConfigurationAuthError",Object.setPrototypeOf(this,MT.prototype)}}function fr(t){return new MT(t,$y[t])}/*! @azure/msal-browser v4.19.0 2025-08-05 */function t6(t){t.location.hash="",typeof t.history.replaceState=="function"&&t.history.replaceState(null,"",`${t.location.origin}${t.location.pathname}${t.location.search}`)}function boe(t){const e=t.split("#");e.shift(),window.location.hash=e.length>0?e.join("#"):""}function DT(){return window.parent!==window}function woe(){return typeof window<"u"&&!!window.opener&&window.opener!==window&&typeof window.name=="string"&&window.name.indexOf(`${Ti.POPUP_NAME_PREFIX}.`)===0}function Na(){return typeof window<"u"&&window.location?window.location.href.split("?")[0].split("#")[0]:""}function Soe(){const e=new sn(window.location.href).getUrlComponents();return`${e.Protocol}//${e.HostNameAndPort}/`}function Coe(){if(sn.hashContainsKnownProperties(window.location.hash)&&DT())throw Ze(N3)}function _oe(t){if(DT()&&!t)throw Ze(E3)}function Aoe(){if(woe())throw Ze(T3)}function n6(){if(typeof window>"u")throw Ze(_w)}function r6(t){if(!t)throw Ze(Ap)}function $T(t){n6(),Coe(),Aoe(),r6(t)}function KR(t,e){if($T(t),_oe(e.system.allowRedirectInIframe),e.cache.cacheLocation===Tr.MemoryStorage&&!e.cache.storeAuthStateInCookie)throw fr(Yx)}function i6(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 joe(){return ys()}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Qx{navigateInternal(e,n){return Qx.defaultNavigateWindow(e,n)}navigateExternal(e,n){return Qx.defaultNavigateWindow(e,n)}static defaultNavigateWindow(e,n){return n.noHistory?window.location.replace(e):window.location.assign(e),new Promise((r,i)=>{setTimeout(()=>{i(Ze(qx,"failed_to_redirect"))},n.timeout)})}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Eoe{async sendGetRequestAsync(e,n){let r,i={},o=0;const s=WR(n);try{r=await fetch(e,{method:BR.GET,headers:s})}catch(c){throw op(Ze(window.navigator.onLine?R3:Wx),void 0,void 0,c)}i=qR(r.headers);try{return o=r.status,{headers:i,body:await r.json(),status:o}}catch(c){throw op(Ze(e1),o,i,c)}}async sendPostRequestAsync(e,n){const r=n&&n.body||"",i=WR(n);let o,s=0,c={};try{o=await fetch(e,{method:BR.POST,headers:i,body:r})}catch(l){throw op(Ze(window.navigator.onLine?I3:Wx),void 0,void 0,l)}c=qR(o.headers);try{return s=o.status,{headers:c,body:await o.json(),status:s}}catch(l){throw op(Ze(e1),s,c,l)}}}function WR(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 op(Ze(G3),void 0,void 0,e)}}function qR(t){try{const e={};return t.forEach((n,r)=>{e[r]=n}),e}catch{throw Ze(K3)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Noe=6e4,n1=1e4,Toe=3e4,o6=2e3;function koe({auth:t,cache:e,system:n,telemetry:r},i){const o={clientId:we.EMPTY_STRING,authority:`${we.DEFAULT_AUTHORITY}`,knownAuthorities:[],cloudDiscoveryMetadata:we.EMPTY_STRING,authorityMetadata:we.EMPTY_STRING,redirectUri:typeof window<"u"?Na():"",postLogoutRedirectUri:we.EMPTY_STRING,navigateToLoginRequestUrl:!0,clientCapabilities:[],protocolMode:Li.AAD,OIDCOptions:{serverResponseType:fw.FRAGMENT,defaultScopes:[we.OPENID_SCOPE,we.PROFILE_SCOPE,we.OFFLINE_ACCESS_SCOPE]},azureCloudOptions:{azureCloudInstance:XN.None,tenant:we.EMPTY_STRING},skipAuthorityMetadataCache:!1,supportsNestedAppAuth:!1,instanceAware:!1,encodeExtraQueryParams:!1},s={cacheLocation:Tr.SessionStorage,cacheRetentionDays:5,temporaryCacheLocation:Tr.SessionStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!!(e&&e.cacheLocation===Tr.LocalStorage),claimsBasedCachingEnabled:!1},c={loggerCallback:()=>{},logLevel:zn.Info,piiLoggingEnabled:!1},u={...{...GU,loggerOptions:c,networkClient:i?new Eoe:zie,navigationClient:new Qx,loadFrameTimeout:0,windowHashTimeout:(n==null?void 0:n.loadFrameTimeout)||Noe,iframeHashTimeout:(n==null?void 0:n.loadFrameTimeout)||n1,navigateFrameWait:0,redirectNavigationTimeout:Toe,asyncPopups:!1,allowRedirectInIframe:!1,allowPlatformBroker:!1,nativeBrokerHandshakeTimeout:(n==null?void 0:n.nativeBrokerHandshakeTimeout)||o6,pollIntervalMilliseconds:Ti.DEFAULT_POLL_INTERVAL_MS},...n,loggerOptions:(n==null?void 0:n.loggerOptions)||c},d={application:{appName:we.EMPTY_STRING,appVersion:we.EMPTY_STRING},client:new VU};if((t==null?void 0:t.protocolMode)!==Li.OIDC&&(t!=null&&t.OIDCOptions)&&new Ka(u.loggerOptions).warning(JSON.stringify(Pn(MU))),t!=null&&t.protocolMode&&t.protocolMode===Li.OIDC&&(u!=null&&u.allowPlatformBroker))throw Pn(DU);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 Poe="@azure/msal-browser",bu="4.19.0";/*! @azure/msal-browser v4.19.0 2025-08-05 */const Or="msal",LT="browser",kC="-",uc=1,r1=1,Ooe=`${Or}.${LT}.log.level`,Ioe=`${Or}.${LT}.log.pii`,Roe=`${Or}.${LT}.platform.auth.dom`,YR=`${Or}.version`,QR="account.keys",XR="token.keys";function ks(t=r1){return t<1?`${Or}.${QR}`:`${Or}.${t}.${QR}`}function Hl(t,e=uc){return e<1?`${Or}.${XR}.${t}`:`${Or}.${e}.${XR}.${t}`}/*! @azure/msal-browser v4.19.0 2025-08-05 */class FT{static loggerCallback(e,n){switch(e){case zn.Error:console.error(n);return;case zn.Info:console.info(n);return;case zn.Verbose:console.debug(n);return;case zn.Warning:console.warn(n);return;default:console.log(n);return}}constructor(e){var l;this.browserEnvironment=typeof window<"u",this.config=koe(e,this.browserEnvironment);let n;try{n=window[Tr.SessionStorage]}catch{}const r=n==null?void 0:n.getItem(Ooe),i=(l=n==null?void 0:n.getItem(Ioe))==null?void 0:l.toLowerCase(),o=i==="true"?!0:i==="false"?!1:void 0,s={...this.config.system.loggerOptions},c=r&&Object.keys(zn).includes(r)?zn[r]:void 0;c&&(s.loggerCallback=FT.loggerCallback,s.logLevel=c),o!==void 0&&(s.piiLoggingEnabled=o),this.logger=new Ka(s,Poe,bu),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 wu extends FT{getModuleName(){return wu.MODULE_NAME}getId(){return wu.ID}async initialize(){return this.available=typeof window<"u",this.available}}wu.MODULE_NAME="";wu.ID="StandardOperatingContext";/*! @azure/msal-browser v4.19.0 2025-08-05 */class Moe{constructor(){this.dbName=t1,this.version=ioe,this.tableName=ooe,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(Ze(NT)))})}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(Ze(td));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(Ze(td));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(Ze(td));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(Ze(td));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(Ze(td));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(t1),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 Aw{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 Doe{constructor(e){this.inMemoryCache=new Aw,this.indexedDBCache=new Moe,this.logger=e}handleDatabaseAccessError(e){if(e instanceof Bg&&e.errorCode===NT)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 Wa{constructor(e,n,r){this.logger=e,foe(r??!1),this.cache=new Doe(this.logger),this.performanceClient=n}createNewGuid(){return ys()}base64Encode(e){return ym(e)}base64Decode(e){return as(e)}base64UrlEncode(e){return Vv(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(W.CryptoOptsGetPublicKeyThumbprint,e.correlationId),r=await poe(Wa.EXTRACTABLE,Wa.POP_KEY_USAGES),i=await TC(r.publicKey),o={e:i.e,kty:i.kty,n:i.n},s=JR(o),c=await this.hashString(s),l=await TC(r.privateKey),u=await moe(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 Te(CU)}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(W.CryptoOptsSignJwt,i),s=await this.cache.getItem(n);if(!s)throw Ze(ET);const c=await TC(s.publicKey),l=JR(c),u=Vv(JSON.stringify({kid:n})),d=CT.getShrHeaderString({...r==null?void 0:r.header,alg:c.alg,kid:u}),f=Vv(d);e.cnf={jwk:JSON.parse(l)};const h=Vv(JSON.stringify(e)),p=`${f}.${h}`,m=new TextEncoder().encode(p),y=await goe(s.privateKey,m),b=sl(new Uint8Array(y)),x=`${p}.${b}`;return o&&o.end({success:!0}),x}async hashString(e){return e6(e)}}Wa.POP_KEY_USAGES=["sign","verify"];Wa.EXTRACTABLE=!0;function JR(t){return JSON.stringify(t,Object.keys(t).sort())}/*! @azure/msal-browser v4.19.0 2025-08-05 */const $oe=24*60*60*1e3,i1={Lax:"Lax",None:"None"};class s6{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 Loe(t){const e=new Date;return new Date(e.getTime()+t*$oe).toUTCString()}/*! @azure/msal-browser v4.19.0 2025-08-05 */function jp(t,e){const n=t.getItem(ks(e));return n?JSON.parse(n):[]}function Ep(t,e,n){const r=e.getItem(Hl(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 o1(t){return t.hasOwnProperty("id")&&t.hasOwnProperty("nonce")&&t.hasOwnProperty("data")}/*! @azure/msal-browser v4.19.0 2025-08-05 */const ZR="msal.cache.encryption",Foe="msal.broadcast.cache";class Boe{constructor(e,n,r){if(!window.localStorage)throw fr(xm);this.memoryStorage=new Aw,this.initialized=!1,this.clientId=e,this.logger=n,this.performanceClient=r,this.broadcast=new BroadcastChannel(Foe)}async initialize(e){const n=new s6,r=n.getItem(ZR);let i={key:"",id:""};if(r)try{i=JSON.parse(r)}catch{}if(i.key&&i.id){const o=ro(qc,W.Base64Decode,this.logger,this.performanceClient,e)(i.key);this.encryptionCookie={id:i.id,key:await be(VR,W.GenerateHKDF,this.logger,this.performanceClient,e)(o)}}else{const o=ys(),s=await be(J3,W.GenerateBaseKey,this.logger,this.performanceClient,e)(),c=ro(sl,W.UrlEncodeArr,this.logger,this.performanceClient,e)(new Uint8Array(s));this.encryptionCookie={id:o,key:await be(VR,W.GenerateHKDF,this.logger,this.performanceClient,e)(s)};const l={id:o,key:c};n.setItem(ZR,JSON.stringify(l),0,!0,i1.None)}await be(this.importExistingCache.bind(this),W.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 Ze(Ap);return this.memoryStorage.getItem(e)}async decryptData(e,n,r){if(!this.initialized||!this.encryptionCookie)throw Ze(Ap);if(n.id!==this.encryptionCookie.id)return this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},r),null;const i=await be(GR,W.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 Ze(Ap);const{data:o,nonce:s}=await be(xoe,W.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(),jp(this).forEach(r=>this.removeItem(r));const n=Ep(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(Or)||r.indexOf(this.clientId)!==-1)&&this.removeItem(r)})}async importExistingCache(e){if(!this.encryptionCookie)return;let n=jp(this);n=await this.importArray(n,e),n.length?this.setItem(ks(),JSON.stringify(n)):this.removeItem(ks());const r=Ep(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(Hl(this.clientId),JSON.stringify(r)):this.removeItem(Hl(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 o1(i)?i.id!==this.encryptionCookie.id?(this.performanceClient.incrementFields({encryptedCacheExpiredCount:1},n),null):be(GR,W.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(W.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 Uoe{constructor(){if(!window.sessionStorage)throw fr(xm)}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 at={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 e2(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class s1 extends XA{constructor(e,n,r,i,o,s,c){super(e,r,i,o,c),this.cacheConfig=n,this.logger=i,this.internalStorage=new Aw,this.browserStorage=t2(e,n.cacheLocation,i,o),this.temporaryCacheStorage=t2(e,n.temporaryCacheLocation,i,o),this.cookieStorage=new s6,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=jp(this.browserStorage,0),r=Ep(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=jp(this.browserStorage,1),o=Ep(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(r1,n,i,e),this.updateV0ToCurrent(uc,r.idToken,o.idToken,e),this.updateV0ToCurrent(uc,r.accessToken,o.accessToken,e),this.updateV0ToCurrent(uc,r.refreshToken,o.refreshToken,e)]),n.length>0?this.browserStorage.setItem(ks(0),JSON.stringify(n)):this.browserStorage.removeItem(ks(0)),i.length>0?this.browserStorage.setItem(ks(1),JSON.stringify(i)):this.browserStorage.removeItem(ks(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){e2(n,s);continue}l.lastUpdatedAt||(l.lastUpdatedAt=Date.now().toString(),this.setItem(s,JSON.stringify(l),i));const u=o1(l)?await this.browserStorage.decryptData(s,l,i):l;let d;if(u&&(IR(u)||RR(u))&&(d=u.expiresOn),!u||Sie(l.lastUpdatedAt,this.cacheConfig.cacheRetentionDays)||d&&Vx(d,aU)){this.browserStorage.removeItem(s),e2(n,s),this.performanceClient.incrementFields({expiredCacheRemovedCount:1},i);continue}if(this.cacheConfig.cacheLocation!==Tr.LocalStorage||o1(l)){const f=`${Or}.${e}${kC}${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(YR);n&&(this.logger.info(`MSAL.js was last initialized by version: ${n}`),this.performanceClient.addFields({previousLibraryVersion:n},e)),n!==bu&&this.setItem(YR,bu,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=QA(l);if(u.errorCode===Fx&&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=QA(u);if(d.errorCode===Fx&&l-1){if(r.splice(i,1),r.length===0){this.removeItem(ks());return}else this.setItem(ks(),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===Tr.LocalStorage&&this.eventHandler.emitEvent(at.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=uc){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=uc){return Ep(this.clientId,this.browserStorage,e)}setTokenKeys(e,n,r=uc){if(e.idToken.length===0&&e.accessToken.length===0&&e.refreshToken.length===0){this.removeItem(Hl(this.clientId,r));return}else this.setItem(Hl(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||!_ie(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||!IR(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||!RR(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||!Nie(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=Eie(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||!Aie(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&&Tie(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)||we.EMPTY_STRING,n=this.internalStorage.getItem(Hv.WRAPPER_VER)||we.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(SR.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(SR.ACTIVE_ACCOUNT_FILTERS);if(e){this.logger.verbose("setActiveAccount: Active account set");const i={homeAccountId:e.homeAccountId,localAccountId:e.localAccountId,tenantId:e.tenantId,lastUpdatedAt:Fi().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(at.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||!jie(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===Tr.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(Or)!==-1||n.indexOf(this.clientId)!==-1)&&this.removeTemporaryItem(n)}),this.browserStorage.getKeys().forEach(n=>{(n.indexOf(Or)!==-1||n.indexOf(this.clientId)!==-1)&&this.browserStorage.removeItem(n)}),this.internalStorage.clear()}clearTokensAndKeysWithClaims(e){this.performanceClient.addQueueMeasurement(W.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 Gs.startsWith(e,Or)?e:`${Or}.${this.clientId}.${e}`}generateCredentialKey(e){const n=e.credentialType===Gr.REFRESH_TOKEN&&e.familyId||e.clientId,r=e.tokenType&&e.tokenType.toLowerCase()!==xn.BEARER.toLowerCase()?e.tokenType.toLowerCase():"";return[`${Or}.${uc}`,e.homeAccountId,e.environment,e.credentialType,n,e.realm||"",e.target||"",e.requestedClaimsHash||"",r].join(kC).toLowerCase()}generateAccountKey(e){const n=e.homeAccountId.split(".")[1];return[`${Or}.${r1}`,e.homeAccountId,e.environment,n||e.tenantId||""].join(kC).toLowerCase()}resetRequestCache(){this.logger.trace("BrowserCacheManager.resetRequestCache called"),this.removeTemporaryItem(this.generateCacheKey(pr.REQUEST_PARAMS)),this.removeTemporaryItem(this.generateCacheKey(pr.VERIFIER)),this.removeTemporaryItem(this.generateCacheKey(pr.ORIGIN_URI)),this.removeTemporaryItem(this.generateCacheKey(pr.URL_HASH)),this.removeTemporaryItem(this.generateCacheKey(pr.NATIVE_REQUEST)),this.setInteractionInProgress(!1)}cacheAuthorizeRequest(e,n){this.logger.trace("BrowserCacheManager.cacheAuthorizeRequest called");const r=ym(JSON.stringify(e));if(this.setTemporaryCache(pr.REQUEST_PARAMS,r,!0),n){const i=ym(n);this.setTemporaryCache(pr.VERIFIER,i,!0)}}getCachedRequest(){this.logger.trace("BrowserCacheManager.getCachedRequest called");const e=this.getTemporaryCache(pr.REQUEST_PARAMS,!0);if(!e)throw Ze(P3);const n=this.getTemporaryCache(pr.VERIFIER,!0);let r,i="";try{r=JSON.parse(as(e)),n&&(i=as(n))}catch(o){throw this.logger.errorPii(`Attempted to parse: ${e}`),this.logger.error(`Parsing cached token request threw with error: ${o}`),Ze(O3)}return[r,i]}getCachedNativeRequest(){this.logger.trace("BrowserCacheManager.getCachedNativeRequest called");const e=this.getTemporaryCache(pr.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=`${Or}.${pr.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(),t6(window),null}}setInteractionInProgress(e,n=bc.SIGNIN){var i;const r=`${Or}.${pr.INTERACTION_STATUS_KEY}`;if(e){if(this.getInteractionInProgress())throw Ze(C3);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=vw((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=yw((u=e.account)==null?void 0:u.homeAccountId,e.account.environment,e.accessToken,this.clientId,e.tenantId,e.scopes.join(" "),e.expiresOn?OR(e.expiresOn):0,e.extExpiresOn?OR(e.extExpiresOn):0,as,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 Td&&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 t2(t,e,n,r){try{switch(e){case Tr.LocalStorage:return new Boe(t,n,r);case Tr.SessionStorage:return new Uoe;case Tr.MemoryStorage:default:break}}catch(i){n.error(i)}return new Aw}const zoe=(t,e,n,r)=>{const i={cacheLocation:Tr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:Tr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};return new s1(t,i,Dx,e,n,r)};/*! @azure/msal-browser v4.19.0 2025-08-05 */function Hoe(t,e,n,r,i){return t.verbose("getAllAccounts called"),n?e.getAllAccounts(i||{},r):[]}function Voe(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 Goe(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 Koe(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 Woe(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 qoe(t,e,n){e.setActiveAccount(t,n)}function Yoe(t,e){return t.getActiveAccount(e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const Qoe="msal.broadcast.event";class Xoe{constructor(e){this.eventCallbacks=new Map,this.logger=e||new Ka({}),typeof BroadcastChannel<"u"&&(this.broadcastChannel=new BroadcastChannel(Qoe)),this.invokeCrossTabCallbacks=this.invokeCrossTabCallbacks.bind(this)}addEventCallback(e,n,r){if(typeof window<"u"){const i=r||joe();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 at.ACCOUNT_ADDED:case at.ACCOUNT_REMOVED:case at.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 a6{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||ys(),this.logger=i.clone(Ti.MSAL_SKU,bu,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 sn.getAbsoluteUrl(n,Na())}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 gm(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(W.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(sn.getDomainFromUrl(o),n.environment):o,l=ti.generateAuthority(c,e.requestAzureCloudOptions||this.config.auth.azureCloudOptions),u=await be(c3,W.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 Pn($U);return u}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function BT(t,e,n,r){n.addQueueMeasurement(W.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=xn.BEARER,r.verbose(`Authentication Scheme wasn't explicitly set in request, defaulting to "Bearer" request`);else{if(s.authenticationScheme===xn.SSH){if(!t.sshJwk)throw Pn(hw);if(!t.sshKid)throw Pn(RU)}r.verbose(`Authentication Scheme set to "${s.authenticationScheme}" as configured in Auth request`)}return e.cache.claimsBasedCachingEnabled&&t.claims&&!Gs.isEmptyObj(t.claims)&&(s.requestedClaimsHash=await e6(t.claims)),s}async function Joe(t,e,n,r,i){r.addQueueMeasurement(W.InitializeSilentRequest,t.correlationId);const o=await be(BT,W.InitializeBaseRequest,i,r,t.correlationId)(t,n,r,i);return{...t,...o,account:e,forceRefresh:t.forceRefresh||!1}}function c6(t,e){let n;const r=t.httpMethod;if(e===Li.EAR){if(n=r||zl.POST,n!==zl.POST)throw Pn(LU)}else n=r||zl.GET;if(t.authorizePostBodyParameters&&n!==zl.POST)throw Pn(FU);return n}/*! @azure/msal-browser v4.19.0 2025-08-05 */class eh extends a6{initializeLogoutRequest(e){this.logger.verbose("initializeLogoutRequest called",e==null?void 0:e.correlationId);const n={correlationId:this.correlationId||ys(),...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=sn.getAbsoluteUrl(e.postLogoutRedirectUri,Na())):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=sn.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri,Na())):(this.logger.verbose("Setting postLogoutRedirectUri to current page",n.correlationId),n.postLogoutRedirectUri=sn.getAbsoluteUrl(Na(),Na())):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(W.StandardInteractionClientCreateAuthCodeClient,this.correlationId);const n=await be(this.getClientConfiguration.bind(this),W.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)(e);return new h3(n,this.performanceClient)}async getClientConfiguration(e){const{serverTelemetryManager:n,requestAuthority:r,requestAzureCloudOptions:i,requestExtraQueryParameters:o,account:s}=e;this.performanceClient.addQueueMeasurement(W.StandardInteractionClientGetClientConfiguration,this.correlationId);const c=await be(this.getDiscoveredAuthority.bind(this),W.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:bu,cpu:we.EMPTY_STRING,os:we.EMPTY_STRING},telemetry:this.config.telemetry}}async initializeAuthorizationRequest(e,n){this.performanceClient.addQueueMeasurement(W.StandardInteractionClientInitializeAuthorizationRequest,this.correlationId);const r=this.getRedirectUri(e.redirectUri),i={interactionType:n},o=Jf.setRequestState(this.browserCrypto,e&&e.state||we.EMPTY_STRING,i),c={...await be(BT,W.InitializeBaseRequest,this.logger,this.performanceClient,this.correlationId)({...e,correlationId:this.correlationId},this.config,this.performanceClient,this.logger),redirectUri:r,state:o,nonce:e.nonce||ys(),responseMode:this.config.auth.OIDCOptions.serverResponseType},l={...c,httpMethod:c6(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 Zoe(t,e){if(!e)return null;try{return Jf.parseRequestState(t,e).libraryState.meta}catch{throw Te(af)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function Np(t,e,n){const r=$x(t);if(!r)throw UU(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}`),Ze(b3)):(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.`),Ze(x3));return r}function ese(t,e,n){if(!t.state)throw Ze(jT);const r=Zoe(e,t.state);if(!r)throw Ze(w3);if(r.interactionType!==n)throw Ze(S3)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class l6{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(W.HandleCodeResponse,n.correlationId);let r;try{r=Vie(e,n.state)}catch(i){throw i instanceof Ru&&i.subError===vm?Ze(vm):i}return be(this.handleCodeResponseFromServer.bind(this),W.HandleCodeResponseFromServer,this.logger,this.performanceClient,n.correlationId)(r,n)}async handleCodeResponseFromServer(e,n,r=!0){if(this.performanceClient.addQueueMeasurement(W.HandleCodeResponseFromServer,n.correlationId),this.logger.trace("InteractionHandler.handleCodeResponseFromServer called"),this.authCodeRequest.code=e.code,e.cloud_instance_host_name&&await be(this.authModule.updateAuthority.bind(this.authModule),W.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 be(this.authModule.acquireToken.bind(this.authModule),W.AuthClientAcquireToken,this.logger,this.performanceClient,n.correlationId)(this.authCodeRequest,e)}createCcsCredentials(e){return e.account?{credential:e.account.homeAccountId,type:ns.HOME_ACCOUNT_ID}:e.loginHint?{credential:e.loginHint,type:ns.UPN}:null}}/*! @azure/msal-browser v4.19.0 2025-08-05 */const tse="ContentError",u6="user_switch";/*! @azure/msal-browser v4.19.0 2025-08-05 */const nse="USER_INTERACTION_REQUIRED",rse="USER_CANCEL",ise="NO_NETWORK",ose="PERSISTENT_ERROR",sse="DISABLED",ase="ACCOUNT_UNAVAILABLE",cse="UX_NOT_ALLOWED";/*! @azure/msal-browser v4.19.0 2025-08-05 */const lse=-2147186943,use={[u6]:"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 Ls extends En{constructor(e,n,r){super(e,n),Object.setPrototypeOf(this,Ls.prototype),this.name="NativeAuthError",this.ext=r}}function nd(t){if(t.ext&&t.ext.status&&(t.ext.status===ose||t.ext.status===sse)||t.ext&&t.ext.error&&t.ext.error===lse)return!0;switch(t.errorCode){case tse:return!0;default:return!1}}function Xx(t,e,n){if(n&&n.status)switch(n.status){case ase:return Kx(u3);case nse:return new vs(t,e);case rse:return Ze(vm);case ise:return Ze(Wx);case cse:return Kx(xT)}return new Ls(t,use[t]||e,n)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class d6 extends eh{async acquireToken(e){this.performanceClient.addQueueMeasurement(W.SilentCacheClientAcquireToken,e.correlationId);const n=this.initializeServerTelemetryManager(_n.acquireTokenSilent_silentFlow),r=await be(this.getClientConfiguration.bind(this),W.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:n,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,account:e.account}),i=new Uie(r,this.performanceClient);this.logger.verbose("Silent auth client created");try{const s=(await be(i.acquireCachedToken.bind(i),W.SilentFlowClientAcquireCachedToken,this.logger,this.performanceClient,e.correlationId)(e))[0];return this.performanceClient.addFields({fromCache:!0},e.correlationId),s}catch(o){throw o instanceof Bg&&o.errorCode===ET&&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 Ly extends a6{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 d6(e,this.nativeStorageManager,r,i,o,s,l,u,h);const p=this.platformAuthProvider.getExtensionName();this.skus=gm.makeExtraSkuString({libraryName:Ti.MSAL_SKU,libraryVersion:bu,extensionName:p,extensionVersion:this.platformAuthProvider.getExtensionVersion()})}addRequestSKUs(e){e.extraParameters={...e.extraParameters,[nie]:this.skus}}async acquireToken(e,n){this.performanceClient.addQueueMeasurement(W.NativeInteractionClientAcquireToken,e.correlationId),this.logger.trace("NativeInteractionClient - acquireToken called.");const r=this.performanceClient.startMeasurement(W.NativeInteractionClientAcquireToken,e.correlationId),i=Fi(),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===ui.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 Ls&&o.setNativeBrokerErrorCode(s.errorCode),s}}createSilentCacheRequest(e,n){return{authority:e.authority,correlationId:this.correlationId,scopes:Nr.fromString(e.scope).asArray(),account:n,forceRefresh:!1}}async acquireTokensFromCache(e,n){if(!e)throw this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided"),Te(qA);const r=this.browserStorage.getBaseAccountInfo({nativeAccountId:e},this.correlationId);if(!r)throw Te(qA);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 Ls&&(this.initializeServerTelemetryManager(this.apiId).setNativeBrokerErrorCode(c.errorCode),nd(c)))throw c}this.browserStorage.setTemporaryCache(pr.NATIVE_REQUEST,JSON.stringify(i),!0);const o={apiId:_n.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(pr.NATIVE_REQUEST));const s=Fi();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=Xf(e.id_token,as),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 Xx(u6);const c=await this.getDiscoveredAuthority({requestAuthority:n.authority}),l=bT(this.browserStorage,c,o,as,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 gs.generateHomeAccountId(e.client_info||we.EMPTY_STRING,qo.Default,this.logger,this.browserCrypto,n)}generateScopes(e,n){return n?Nr.fromString(n):Nr.fromString(e)}async generatePopAccessToken(e,n){if(n.tokenType===xn.POP&&n.signPopToken){if(e.shr)return this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer"),e.shr;const r=new cf(this.browserCrypto),i={resourceRequestMethod:n.resourceRequestMethod,resourceRequestUri:n.resourceRequestUri,shrClaims:n.shrClaims,shrNonce:n.shrNonce};if(!n.keyId)throw Te(qN);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||we.EMPTY_STRING,f=u.TenantId||r.tid||we.EMPTY_STRING,h=rT(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),v=n.tokenType===xn.POP?xn.POP:xn.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:Pd(s+e.expires_in),tokenType:v,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=vw(r,n.authority,e.id_token||"",n.clientId,i.tid||""),u=n.tokenType===xn.POP?we.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=yw(r,n.authority,o,n.clientId,i.tid||s,f.printScopes(),d,0,as,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===xn.POP?we.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 Nr(r||[]);o.appendScopes(Fg);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 Ze(V3);if(this.handleExtraBrokerParams(s),s.extraParameters=s.extraParameters||{},s.extraParameters.telemetry=So.MATS_TELEMETRY,e.authenticationScheme===xn.POP){const c={resourceRequestUri:e.resourceRequestUri,resourceRequestMethod:e.resourceRequestMethod,shrClaims:e.shrClaims,shrNonce:e.shrNonce},l=new cf(this.browserCrypto);let u;if(s.keyId)u=this.browserCrypto.base64UrlEncode(JSON.stringify({kid:s.keyId})),s.signPopToken=!1;else{const d=await be(l.generateCnf.bind(l),W.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 sn(n);return r.validateAsUri(),r}getPrompt(e){switch(this.apiId){case _n.ssoSilent:case _n.acquireTokenSilent_silentFlow:return this.logger.trace("initializeNativeRequest: silent request sets prompt to none"),gi.NONE}if(!e){this.logger.trace("initializeNativeRequest: prompt was not provided");return}switch(e){case gi.NONE:case gi.CONSENT:case gi.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`),Ze(z3)}}handleExtraBrokerParams(e){var o;const n=e.extraParameters&&e.extraParameters.hasOwnProperty(Ux)&&e.extraParameters.hasOwnProperty(zx)&&e.extraParameters.hasOwnProperty(yu);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[zx],r=e.extraParameters[yu]),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 UT(t,e,n,r,i){const o=Hie({...t.auth,authority:e},n,r,i);if(fT(o,{sku:Ti.MSAL_SKU,version:bu,os:"",cpu:""}),t.auth.protocolMode!==Li.OIDC&&hT(o,t.telemetry.application),n.platformBroker&&(sie(o),n.authenticationScheme===xn.POP)){const s=new Wa(r,i),c=new cf(s);let l;n.popKid?l=s.encodeKid(n.popKid):l=(await be(c.generateCnf.bind(c),W.PopTokenGenerateCnf,r,i,n.correlationId)(n,r)).reqCnfString,mT(o,l)}return pw(o,n.correlationId,i),o}async function zT(t,e,n,r,i){if(!n.codeChallenge)throw Pn(ZN);const o=await be(UT,W.GetStandardParams,r,i,n.correlationId)(t,e,n,r,i);return sT(o,UN.CODE),XU(o,n.codeChallenge,we.S256_CODE_CHALLENGE_METHOD),Wc(o,n.extraQueryParameters||{}),wT(e,o,t.auth.encodeExtraQueryParams,n.extraQueryParameters)}async function HT(t,e,n,r,i,o){if(!r.earJwk)throw Ze(AT);const s=await UT(e,n,r,i,o);sT(s,UN.IDTOKEN_TOKEN_REFRESHTOKEN),vie(s,r.earJwk);const c=new Map;Wc(c,r.extraQueryParameters||{});const l=wT(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return f6(t,l,s)}async function VT(t,e,n,r,i,o){const s=await UT(e,n,r,i,o);sT(s,UN.CODE),XU(s,r.codeChallenge,r.codeChallengeMethod||we.S256_CODE_CHALLENGE_METHOD),yie(s,r.authorizePostBodyParameters||{});const c=new Map;Wc(c,r.extraQueryParameters||{});const l=wT(n,c,e.auth.encodeExtraQueryParams,r.extraQueryParameters);return f6(t,l,s)}function f6(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 h6(t,e,n,r,i,o,s,c,l,u){if(c.verbose("Account id found, calling WAM for token"),!u)throw Ze(TT);const d=new Wa(c,l),f=new Ly(r,i,d,c,s,r.system.navigationClient,n,l,u,e,o,t.correlationId),{userRequestState:h}=Jf.parseRequestState(d,t.state);return be(f.acquireToken.bind(f),W.NativeInteractionClientAcquireToken,c,l,t.correlationId)({...t,state:h,prompt:void 0})}async function Jx(t,e,n,r,i,o,s,c,l,u,d,f){if($s.removeThrottle(s,i.auth.clientId,t),e.accountId)return be(h6,W.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 l6(o,s,h,u,d);return await be(p.handleCodeResponse.bind(p),W.HandleCodeResponse,u,d,t.correlationId)(e,t)}async function GT(t,e,n,r,i,o,s,c,l,u,d){if($s.removeThrottle(o,r.auth.clientId,t),p3(e,t.state),!e.ear_jwe)throw Ze(y3);if(!t.earJwk)throw Ze(AT);const f=JSON.parse(await be(yoe,W.DecryptEarResponse,l,u,t.correlationId)(t.earJwk,e.ear_jwe));if(f.accountId)return be(h6,W.HandleResponsePlatformBroker,l,u,t.correlationId)(t,f.accountId,n,r,o,s,c,l,u,d);const h=new xu(r.auth.clientId,o,new Wa(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 be(h.handleServerTokenResponse.bind(h),W.HandleServerTokenResponse,l,u,t.correlationId)(f,i,Fi(),t,p,void 0,void 0,void 0,void 0)}/*! @azure/msal-browser v4.19.0 2025-08-05 */const dse=32;async function jw(t,e,n){t.addQueueMeasurement(W.GeneratePkceCodes,n);const r=ro(fse,W.GenerateCodeVerifier,e,t,n)(t,e,n),i=await be(hse,W.GenerateCodeChallengeFromVerifier,e,t,n)(r,t,e,n);return{verifier:r,challenge:i}}function fse(t,e,n){try{const r=new Uint8Array(dse);return ro(hoe,W.GetRandomValues,e,t,n)(r),sl(r)}catch{throw Ze(_T)}}async function hse(t,e,n,r){e.addQueueMeasurement(W.GenerateCodeChallengeFromVerifier,r);try{const i=await be(X3,W.Sha256Digest,n,e,r)(t,e,r);return sl(new Uint8Array(i))}catch{throw Ze(_T)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Zx{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(W.NativeMessageHandlerHandshake),this.platformAuthType=So.PLATFORM_EXTENSION_PROVIDER}async sendMessage(e){this.logger.trace(this.platformAuthType+" - sendMessage called.");const n={method:Lh.GetToken,request:e},r={channel:So.CHANNEL_ID,extensionId:this.extensionId,responseId:ys(),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 Zx(e,n,r,So.PREFERRED_EXTENSION_ID);return await i.sendHandshakeRequest(),i}catch{const o=new Zx(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:So.CHANNEL_ID,extensionId:this.extensionId,responseId:ys(),body:{method:Lh.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(Ze(B3)),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!==So.CHANNEL_ID)&&!(n.extensionId&&n.extensionId!==this.extensionId)&&n.body.method===Lh.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(Ze(U3))}}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===Lh.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(Xx(s.code,s.description,s.ext));else if(s.result)s.result.code&&s.result.description?r.reject(Xx(s.result.code,s.result.description,s.result.ext)):r.resolve(s.result);else throw GA(Mx,"Event does not contain result.");this.resolvers.delete(n.responseId)}else if(o===Lh.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 GA(Mx,"Response missing expected properties.")}getExtensionId(){return this.extensionId}getExtensionVersion(){return this.extensionVersion}getExtensionName(){var e;return this.getExtensionId()===So.PREFERRED_EXTENSION_ID?"chrome":(e=this.getExtensionId())!=null&&e.length?"unknown":void 0}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class KT{constructor(e,n,r){this.logger=e,this.performanceClient=n,this.correlationId=r,this.platformAuthType=So.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(So.MICROSOFT_ENTRA_BROKERID);if(o!=null&&o.includes(So.PLATFORM_DOM_APIS))return e.trace("Platform auth api available in DOM"),new KT(e,n,r)}}getExtensionId(){return So.MICROSOFT_ENTRA_BROKERID}getExtensionVersion(){return""}getExtensionName(){return So.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"),Xx(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 GA(Mx,"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 pse(t,e,n,r){t.trace("getPlatformAuthProvider called",n);const i=mse();t.trace("Has client allowed platform auth via DOM API: "+i);let o;try{i&&(o=await KT.createProvider(t,e,n)),o||(t.trace("Platform auth via DOM API not available, checking for extension"),o=await Zx.createProvider(t,r||o6,e))}catch(s){t.trace("Platform auth not available",s)}return o}function mse(){let t;try{return t=window[Tr.SessionStorage],(t==null?void 0:t.getItem(Roe))==="true"}catch{return!1}}function bm(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 xn.BEARER:case xn.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 gse extends eh{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||Fg,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:c6(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 be(this.initializeAuthorizationRequest.bind(this),W.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,_t.Popup);n.popup&&i6(i.authority);const o=bm(this.config,this.logger,this.platformAuthProvider,e.authenticationScheme);return i.platformBroker=o,this.config.auth.protocolMode===Li.EAR?this.executeEarFlow(i,n):this.executeCodeFlow(i,n,r)}async executeCodeFlow(e,n,r){var l;const i=e.correlationId,o=this.initializeServerTelemetryManager(_n.acquireTokenPopup),s=r||await be(jw,W.GeneratePkceCodes,this.logger,this.performanceClient,i)(this.performanceClient,this.logger,i),c={...e,codeChallenge:s.challenge};try{const u=await be(this.createAuthCodeClient.bind(this),W.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,i)({serverTelemetryManager:o,requestAuthority:c.authority,requestAzureCloudOptions:c.azureCloudOptions,requestExtraQueryParameters:c.extraQueryParameters,account:c.account});if(c.httpMethod===zl.POST)return await this.executeCodeFlowWithPost(c,n,u,s.verifier);{const d=await be(zT,W.GetAuthCodeUrl,this.logger,this.performanceClient,i)(this.config,u.authority,c,this.logger,this.performanceClient),f=this.initiateAuthRequest(d,n);this.eventHandler.emitEvent(at.POPUP_OPENED,_t.Popup,{popupWindow:f},null);const h=await this.monitorPopupForHash(f,n.popupWindowParent),p=ro(Np,W.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(h,this.config.auth.OIDCOptions.serverResponseType,this.logger);return await be(Jx,W.HandleResponseCode,this.logger,this.performanceClient,i)(e,p,s.verifier,_n.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 En&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),u}}async executeEarFlow(e,n){const r=e.correlationId,i=await be(this.getDiscoveredAuthority.bind(this),W.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,r)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),o=await be(RT,W.GenerateEarKey,this.logger,this.performanceClient,r)(),s={...e,earJwk:o},c=n.popup||this.openPopup("about:blank",n);(await HT(c.document,this.config,i,s,this.logger,this.performanceClient)).submit();const u=await be(this.monitorPopupForHash.bind(this),W.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(c,n.popupWindowParent),d=ro(Np,W.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return be(GT,W.HandleResponseEar,this.logger,this.performanceClient,r)(s,d,_n.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 be(this.getDiscoveredAuthority.bind(this),W.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 VT(c.document,this.config,s,e,this.logger,this.performanceClient)).submit();const u=await be(this.monitorPopupForHash.bind(this),W.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,o)(c,n.popupWindowParent),d=ro(Np,W.DeserializeResponse,this.logger,this.performanceClient,this.correlationId)(u,this.config.auth.OIDCOptions.serverResponseType,this.logger);return be(Jx,W.HandleResponseCode,this.logger,this.performanceClient,o)(e,d,i,_n.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(at.LOGOUT_START,_t.Popup,e);const o=this.initializeServerTelemetryManager(_n.logoutPopup);try{await this.clearCacheOnLogout(this.correlationId,e.account);const u=await be(this.createAuthCodeClient.bind(this),W.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===Li.OIDC){if(this.eventHandler.emitEvent(at.LOGOUT_SUCCESS,_t.Popup,e),i){const h={apiId:_n.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=sn.getAbsoluteUrl(i,Na());await this.navigationClient.navigateInternal(p,h)}(c=n.popup)==null||c.close();return}}const d=u.getLogoutUri(e);this.eventHandler.emitEvent(at.LOGOUT_SUCCESS,_t.Popup,e);const f=this.openPopup(d,n);if(this.eventHandler.emitEvent(at.POPUP_OPENED,_t.Popup,{popupWindow:f},null),await this.monitorPopupForHash(f,n.popupWindowParent).catch(()=>{}),i){const h={apiId:_n.logoutPopup,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},p=sn.getAbsoluteUrl(i,Na());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 En&&(u.setCorrelationId(this.correlationId),o.cacheFailedRequest(u)),this.eventHandler.emitEvent(at.LOGOUT_FAILURE,_t.Popup,null,u),this.eventHandler.emitEvent(at.LOGOUT_END,_t.Popup),u}this.eventHandler.emitEvent(at.LOGOUT_END,_t.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"),Ze(Sw)}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(Ze(vm));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===fw.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 Ze(A3);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),Ze(_3)}}openSizedPopup(e,{popupName:n,popupWindowAttributes:r,popupWindowParent:i}){var p,v,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=(v=r.popupSize)==null?void 0:v.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 vse(){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 yse extends eh{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 be(this.initializeAuthorizationRequest.bind(this),W.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,this.correlationId)(e,_t.Redirect);n.platformBroker=bm(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(at.RESTORE_FROM_BFCACHE,_t.Redirect))},i=this.getRedirectStartPage(e.redirectStartPage);this.logger.verbosePii(`Redirect start page: ${i}`),this.browserStorage.setTemporaryCache(pr.ORIGIN_URI,i,!0),window.addEventListener("pageshow",r);try{this.config.auth.protocolMode===Li.EAR?await this.executeEarFlow(n):await this.executeCodeFlow(n,e.onRedirectNavigate)}catch(o){throw o instanceof En&&o.setCorrelationId(this.correlationId),window.removeEventListener("pageshow",r),o}}async executeCodeFlow(e,n){const r=e.correlationId,i=this.initializeServerTelemetryManager(_n.acquireTokenRedirect),o=await be(jw,W.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===zl.POST)return await this.executeCodeFlowWithPost(s);{const c=await be(this.createAuthCodeClient.bind(this),W.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:s.authority,requestAzureCloudOptions:s.azureCloudOptions,requestExtraQueryParameters:s.extraQueryParameters,account:s.account}),l=await be(zT,W.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 En&&(c.setCorrelationId(this.correlationId),i.cacheFailedRequest(c)),c}}async executeEarFlow(e){const n=e.correlationId,r=await be(this.getDiscoveredAuthority.bind(this),W.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await be(RT,W.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i};return this.browserStorage.cacheAuthorizeRequest(o),(await HT(document,this.config,r,o,this.logger,this.performanceClient)).submit(),new Promise((c,l)=>{setTimeout(()=>{l(Ze(qx,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async executeCodeFlowWithPost(e){const n=e.correlationId,r=await be(this.getDiscoveredAuthority.bind(this),W.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return this.browserStorage.cacheAuthorizeRequest(e),(await VT(document,this.config,r,e,this.logger,this.performanceClient)).submit(),new Promise((o,s)=>{setTimeout(()=>{s(Ze(qx,"failed_to_redirect"))},this.config.system.redirectNavigationTimeout)})}async handleRedirectPromise(e="",n,r,i){const o=this.initializeServerTelemetryManager(_n.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(),vse()!=="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(pr.ORIGIN_URI,!0)||we.EMPTY_STRING,u=sn.removeHashFromUrl(l),d=sn.removeHashFromUrl(window.location.href);if(u===d&&this.config.auth.navigateToLoginRequestUrl)return this.logger.verbose("Current page is loginRequestUrl, handling response"),l.indexOf("#")>-1&&boe(l),await this.handleResponse(s,n,r,o);if(this.config.auth.navigateToLoginRequestUrl){if(!DT()||this.config.system.allowRedirectInIframe){this.browserStorage.setTemporaryCache(pr.URL_HASH,c,!0);const f={apiId:_n.handleRedirectPromise,timeout:this.config.system.redirectNavigationTimeout,noHistory:!0};let h=!0;if(!l||l==="null"){const p=Soe();this.browserStorage.setTemporaryCache(pr.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 En&&(s.setCorrelationId(this.correlationId),o.cacheFailedRequest(s)),s}}getRedirectResponse(e){this.logger.verbose("getRedirectResponseHash called");let n=e;n||(this.config.auth.OIDCOptions.serverResponseType===fw.QUERY?n=window.location.search:n=window.location.hash);let r=$x(n);if(r){try{ese(r,this.browserCrypto,_t.Redirect)}catch(o){return o instanceof En&&this.logger.error(`Interaction type validation failed due to ${o.errorCode}: ${o.errorMessage}`),[null,""]}return t6(window),this.logger.verbose("Hash contains known properties, returning response hash"),[r,n]}const i=this.browserStorage.getTemporaryCache(pr.URL_HASH,!0);return this.browserStorage.removeItem(this.browserStorage.generateCacheKey(pr.URL_HASH)),i&&(r=$x(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 Ze(jT);if(e.ear_jwe){const c=await be(this.getDiscoveredAuthority.bind(this),W.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n.correlationId)({requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account});return be(GT,W.HandleResponseEar,this.logger,this.performanceClient,n.correlationId)(n,e,_n.acquireTokenRedirect,this.config,c,this.browserStorage,this.nativeStorage,this.eventHandler,this.logger,this.performanceClient,this.platformAuthProvider)}const s=await be(this.createAuthCodeClient.bind(this),W.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:i,requestAuthority:n.authority});return be(Jx,W.HandleResponseCode,this.logger,this.performanceClient,n.correlationId)(n,e,r,_n.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:_n.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"),Ze(Sw)}async logout(e){var i;this.logger.verbose("logoutRedirect called");const n=this.initializeLogoutRequest(e),r=this.initializeServerTelemetryManager(_n.logout);try{this.eventHandler.emitEvent(at.LOGOUT_START,_t.Redirect,e),await this.clearCacheOnLogout(this.correlationId,n.account);const o={apiId:_n.logout,timeout:this.config.system.redirectNavigationTimeout,noHistory:!1},s=await be(this.createAuthCodeClient.bind(this),W.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===Li.OIDC)try{s.authority.endSessionEndpoint}catch{if((i=n.account)!=null&&i.homeAccountId){this.eventHandler.emitEvent(at.LOGOUT_SUCCESS,_t.Redirect,n);return}}const c=s.getLogoutUri(n);if(this.eventHandler.emitEvent(at.LOGOUT_SUCCESS,_t.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,bc.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,bc.SIGNOUT),await this.navigationClient.navigateExternal(c,o);return}}catch(o){throw o instanceof En&&(o.setCorrelationId(this.correlationId),r.cacheFailedRequest(o)),this.eventHandler.emitEvent(at.LOGOUT_FAILURE,_t.Redirect,null,o),this.eventHandler.emitEvent(at.LOGOUT_END,_t.Redirect),o}this.eventHandler.emitEvent(at.LOGOUT_END,_t.Redirect)}getRedirectStartPage(e){const n=e||window.location.href;return sn.getAbsoluteUrl(n,Na())}}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function xse(t,e,n,r,i){if(e.addQueueMeasurement(W.SilentHandlerInitiateAuthRequest,r),!t)throw n.info("Navigate url is empty"),Ze(Sw);return i?be(Sse,W.SilentHandlerLoadFrame,n,e,r)(t,i,e,r):ro(Cse,W.SilentHandlerLoadFrameSync,n,e,r)(t)}async function bse(t,e,n,r,i){const o=Ew();if(!o.contentDocument)throw"No document associated with iframe!";return(await VT(o.contentDocument,t,e,n,r,i)).submit(),o}async function wse(t,e,n,r,i){const o=Ew();if(!o.contentDocument)throw"No document associated with iframe!";return(await HT(o.contentDocument,t,e,n,r,i)).submit(),o}async function n2(t,e,n,r,i,o,s){return r.addQueueMeasurement(W.SilentHandlerMonitorIframeForHash,o),new Promise((c,l)=>{e{window.clearInterval(d),l(Ze(j3))},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===fw.QUERY?p=h.location.search:p=h.location.hash),window.clearTimeout(u),window.clearInterval(d),c(p)},n)}).finally(()=>{ro(_se,W.RemoveHiddenIframe,i,r,o)(t)})}function Sse(t,e,n,r){return n.addQueueMeasurement(W.SilentHandlerLoadFrame,r),new Promise((i,o)=>{const s=Ew();window.setTimeout(()=>{if(!s){o("Unable to load iframe");return}s.src=t,i(s)},e)})}function Cse(t){const e=Ew();return e.src=t,e}function Ew(){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 _se(t){document.body===t.parentNode&&document.body.removeChild(t)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ase extends eh{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(W.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!==gi.NONE&&n.prompt!==gi.NO_SESSION&&(this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${n.prompt} with ${gi.NONE}`),n.prompt=gi.NONE):n.prompt=gi.NONE;const r=await be(this.initializeAuthorizationRequest.bind(this),W.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(n,_t.Silent);return r.platformBroker=bm(this.config,this.logger,this.platformAuthProvider,r.authenticationScheme),i6(r.authority),this.config.auth.protocolMode===Li.EAR?this.executeEarFlow(r):this.executeCodeFlow(r)}async executeCodeFlow(e){let n;const r=this.initializeServerTelemetryManager(this.apiId);try{return n=await be(this.createAuthCodeClient.bind(this),W.StandardInteractionClientCreateAuthCodeClient,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),await be(this.silentTokenHelper.bind(this),W.SilentIframeClientTokenHelper,this.logger,this.performanceClient,e.correlationId)(n,e)}catch(i){if(i instanceof En&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),!n||!(i instanceof En)||i.errorCode!==Ti.INVALID_GRANT_ERROR)throw i;return this.performanceClient.addFields({retryError:i.errorCode},this.correlationId),await be(this.silentTokenHelper.bind(this),W.SilentIframeClientTokenHelper,this.logger,this.performanceClient,this.correlationId)(n,e)}}async executeEarFlow(e){const n=e.correlationId,r=await be(this.getDiscoveredAuthority.bind(this),W.StandardInteractionClientGetDiscoveredAuthority,this.logger,this.performanceClient,n)({requestAuthority:e.authority,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account}),i=await be(RT,W.GenerateEarKey,this.logger,this.performanceClient,n)(),o={...e,earJwk:i},s=await be(wse,W.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,n)(this.config,r,o,this.logger,this.performanceClient),c=this.config.auth.OIDCOptions.serverResponseType,l=await be(n2,W.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,n)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,n,c),u=ro(Np,W.DeserializeResponse,this.logger,this.performanceClient,n)(l,c,this.logger);return be(GT,W.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(Ze(Cw))}async silentTokenHelper(e,n){const r=n.correlationId;this.performanceClient.addQueueMeasurement(W.SilentIframeClientTokenHelper,r);const i=await be(jw,W.GeneratePkceCodes,this.logger,this.performanceClient,r)(this.performanceClient,this.logger,r),o={...n,codeChallenge:i.challenge};let s;if(n.httpMethod===zl.POST)s=await be(bse,W.SilentHandlerInitiateAuthRequest,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);else{const d=await be(zT,W.GetAuthCodeUrl,this.logger,this.performanceClient,r)(this.config,e.authority,o,this.logger,this.performanceClient);s=await be(xse,W.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 be(n2,W.SilentHandlerMonitorIframeForHash,this.logger,this.performanceClient,r)(s,this.config.system.iframeHashTimeout,this.config.system.pollIntervalMilliseconds,this.performanceClient,this.logger,r,c),u=ro(Np,W.DeserializeResponse,this.logger,this.performanceClient,r)(l,c,this.logger);return be(Jx,W.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 jse extends eh{async acquireToken(e){this.performanceClient.addQueueMeasurement(W.SilentRefreshClientAcquireToken,e.correlationId);const n=await be(BT,W.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(_n.acquireTokenSilent_silentFlow),o=await this.createRefreshTokenClient({serverTelemetryManager:i,authorityUrl:r.authority,azureCloudOptions:r.azureCloudOptions,account:r.account});return be(o.acquireTokenByRefreshToken.bind(o),W.RefreshTokenClientAcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(r).catch(s=>{throw s.setCorrelationId(this.correlationId),i.cacheFailedRequest(s),s})}logout(){return Promise.reject(Ze(Cw))}async createRefreshTokenClient(e){const n=await be(this.getClientConfiguration.bind(this),W.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,this.correlationId)({serverTelemetryManager:e.serverTelemetryManager,requestAuthority:e.authorityUrl,requestAzureCloudOptions:e.azureCloudOptions,requestExtraQueryParameters:e.extraQueryParameters,account:e.account});return new Bie(n,this.performanceClient)}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Ese{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 Ze(_w);const i=e.correlationId||ys(),o=n.id_token?Xf(n.id_token,as):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 ti(ti.generateAuthority(e.authority,e.azureCloudOptions),this.config.system.networkClient,this.storage,s,this.logger,e.correlationId||ys()):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=gs.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."),Ze(M3);const s=gs.generateHomeAccountId(n,o.authorityType,this.logger,this.cryptoObj,i),c=i==null?void 0:i.tid,l=bT(this.storage,o,s,as,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=vw(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?Nr.fromString(n.scope):new Nr(e.scopes),u=s.expiresOn||n.expires_in+Fi(),d=s.extendedExpiresOn||(n.ext_expires_in||n.expires_in)+Fi(),f=yw(r,i,n.access_token,this.config.auth.clientId,o,l.printScopes(),u,d,as);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=s3(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=Nr.fromString(n.accessToken.target).asArray(),c=Pd(n.accessToken.expiresOn),l=Pd(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 Nse extends h3{constructor(e){super(e),this.includeRedirectUri=!1}}/*! @azure/msal-browser v4.19.0 2025-08-05 */class Tse extends eh{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 Ze(D3);const n=await be(this.initializeAuthorizationRequest.bind(this),W.StandardInteractionClientInitializeAuthorizationRequest,this.logger,this.performanceClient,e.correlationId)(e,_t.Silent),r=this.initializeServerTelemetryManager(this.apiId);try{const i={...n,code:e.code},o=await be(this.getClientConfiguration.bind(this),W.StandardInteractionClientGetClientConfiguration,this.logger,this.performanceClient,e.correlationId)({serverTelemetryManager:r,requestAuthority:n.authority,requestAzureCloudOptions:n.azureCloudOptions,requestExtraQueryParameters:n.extraQueryParameters,account:n.account}),s=new Nse(o);this.logger.verbose("Auth code client created");const c=new l6(s,this.browserStorage,i,this.logger,this.performanceClient);return await be(c.handleCodeResponseFromServer.bind(c),W.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 En&&(i.setCorrelationId(this.correlationId),r.cacheFailedRequest(i)),i}}logout(){return Promise.reject(Ze(Cw))}}/*! @azure/msal-browser v4.19.0 2025-08-05 */function kse(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 Ns(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 Gv(t,e){try{$T(t)}catch(n){throw e.end({success:!1},n),n}}class Nw{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 Wa(this.logger,this.performanceClient):Dx,this.eventHandler=new Xoe(this.logger),this.browserStorage=this.isBrowserEnvironment?new s1(this.config.auth.clientId,this.config.cache,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler,Pie(this.config.auth)):zoe(this.config.auth.clientId,this.logger,this.performanceClient,this.eventHandler);const n={cacheLocation:Tr.MemoryStorage,cacheRetentionDays:5,temporaryCacheLocation:Tr.MemoryStorage,storeAuthStateInCookie:!1,secureCookies:!1,cacheMigrationEnabled:!1,claimsBasedCachingEnabled:!1};this.nativeInternalStorage=new s1(this.config.auth.clientId,n,this.browserCrypto,this.logger,this.performanceClient,this.eventHandler),this.tokenCache=new Ese(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 Nw(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(at.INITIALIZE_END);return}const r=(e==null?void 0:e.correlationId)||this.getRequestCorrelationId(),i=this.config.system.allowPlatformBroker,o=this.performanceClient.startMeasurement(W.InitializeClientApplication,r);if(this.eventHandler.emitEvent(at.INITIALIZE_START),!n)try{this.logMultipleInstances(o)}catch{}if(await be(this.browserStorage.initialize.bind(this.browserStorage),W.InitializeCache,this.logger,this.performanceClient,r)(r),i)try{this.platformAuthProvider=await pse(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"),ro(this.browserStorage.clearTokensAndKeysWithClaims.bind(this.browserStorage),W.ClearTokensAndKeysWithClaims,this.logger,this.performanceClient,r)(r)),this.config.system.asyncPopups&&await this.preGeneratePkceCodes(r),this.initialized=!0,this.eventHandler.emitEvent(at.INITIALIZE_END),o.end({allowPlatformBroker:i,success:!0})}async handleRedirectPromise(e){if(this.logger.verbose("handleRedirectPromise called"),r6(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)===bc.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(at.HANDLE_REDIRECT_START,_t.Redirect);let c;try{if(o&&this.platformAuthProvider){s=this.performanceClient.startMeasurement(W.AcquireTokenRedirect,(i==null?void 0:i.correlationId)||""),this.logger.trace("handleRedirectPromise - acquiring token from native platform");const u=new Ly(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,_n.handleRedirectPromise,this.performanceClient,this.platformAuthProvider,i.accountId,this.nativeInternalStorage,i.correlationId);c=be(u.handleRedirectPromise.bind(u),W.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(W.AcquireTokenRedirect,f),this.logger.trace("handleRedirectPromise - acquiring token from web flow");const h=this.createRedirectClient(f);c=be(h.handleRedirectPromise.bind(h),W.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(at.ACQUIRE_TOKEN_FAILURE,_t.Redirect,null,d):this.eventHandler.emitEvent(at.LOGIN_FAILURE,_t.Redirect,null,d),this.eventHandler.emitEvent(at.HANDLE_REDIRECT_END,_t.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(W.AcquireTokenPreRedirect,n);r.add({accountType:Ns(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{KR(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,bc.SIGNIN),o?this.eventHandler.emitEvent(at.ACQUIRE_TOKEN_START,_t.Redirect,e):this.eventHandler.emitEvent(at.LOGIN_START,_t.Redirect,e);let s;return this.platformAuthProvider&&this.canUsePlatformBroker(e)?s=new Ly(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,_n.acquireTokenRedirect,this.performanceClient,this.platformAuthProvider,this.getNativeAccountId(e),this.nativeInternalStorage,n).acquireTokenRedirect(e,r).catch(l=>{if(l instanceof Ls&&nd(l))return this.platformAuthProvider=void 0,this.createRedirectClient(n).acquireToken(e);if(l instanceof vs)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(at.ACQUIRE_TOKEN_FAILURE,_t.Redirect,null,s):this.eventHandler.emitEvent(at.LOGIN_FAILURE,_t.Redirect,null,s),s}}acquireTokenPopup(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(W.AcquireTokenPopup,n);r.add({scenarioId:e.scenarioId,accountType:Ns(e.account)});try{this.logger.verbose("acquireTokenPopup called",n),Gv(this.initialized,r),this.browserStorage.setInteractionInProgress(!0,bc.SIGNIN)}catch(c){return Promise.reject(c)}const i=this.getAllAccounts();i.length>0?this.eventHandler.emitEvent(at.ACQUIRE_TOKEN_START,_t.Popup,e):this.eventHandler.emitEvent(at.LOGIN_START,_t.Popup,e);let o;const s=this.getPreGeneratedPkceCodes(n);return this.canUsePlatformBroker(e)?o=this.acquireTokenNative({...e,correlationId:n},_n.acquireTokenPopup).then(c=>(r.end({success:!0,isNativeBroker:!0,accountType:Ns(c.account)}),c)).catch(c=>{if(c instanceof Ls&&nd(c))return this.platformAuthProvider=void 0,this.createPopupClient(n).acquireToken(e,s);if(c instanceof vs)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(at.ACQUIRE_TOKEN_FAILURE,_t.Popup,null,c):this.eventHandler.emitEvent(at.LOGIN_FAILURE,_t.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(W.SsoSilent,n),(o=this.ssoSilentMeasurement)==null||o.add({scenarioId:e.scenarioId,accountType:Ns(e.account)}),Gv(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(at.SSO_SILENT_START,_t.Silent,r);let i;return this.canUsePlatformBroker(r)?i=this.acquireTokenNative(r,_n.ssoSilent).catch(c=>{if(c instanceof Ls&&nd(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(at.SSO_SILENT_SUCCESS,_t.Silent,c),(l=this.ssoSilentMeasurement)==null||l.end({success:!0,isNativeBroker:c.fromNativeBroker,accessTokenSize:c.accessToken.length,idTokenSize:c.idToken.length,accountType:Ns(c.account)}),c}).catch(c=>{var l;throw this.eventHandler.emitEvent(at.SSO_SILENT_FAILURE,_t.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(W.AcquireTokenByCode,n);Gv(this.initialized,r),this.eventHandler.emitEvent(at.ACQUIRE_TOKEN_BY_CODE_START,_t.Silent,e),r.add({scenarioId:e.scenarioId});try{if(e.code&&e.nativeAccountId)throw Ze(L3);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(at.ACQUIRE_TOKEN_BY_CODE_SUCCESS,_t.Silent,s),this.hybridAuthCodeResponses.delete(i),r.end({success:!0,isNativeBroker:s.fromNativeBroker,accessTokenSize:s.accessToken.length,idTokenSize:s.idToken.length,accountType:Ns(s.account)}),s)).catch(s=>{throw this.hybridAuthCodeResponses.delete(i),this.eventHandler.emitEvent(at.ACQUIRE_TOKEN_BY_CODE_FAILURE,_t.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},_n.acquireTokenByCode,e.nativeAccountId).catch(o=>{throw o instanceof Ls&&nd(o)&&(this.platformAuthProvider=void 0),o});return r.end({accountType:Ns(i.account),success:!0}),i}else throw Ze(F3);else throw Ze($3)}catch(i){throw this.eventHandler.emitEvent(at.ACQUIRE_TOKEN_BY_CODE_FAILURE,_t.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(W.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(W.AcquireTokenFromCache,e.correlationId),n){case ui.Default:case ui.AccessToken:case ui.AccessTokenAndRefreshToken:const r=this.createSilentCacheClient(e.correlationId);return be(r.acquireToken.bind(r),W.SilentCacheClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Te(Kc)}}async acquireTokenByRefreshToken(e,n){switch(this.performanceClient.addQueueMeasurement(W.AcquireTokenByRefreshToken,e.correlationId),n){case ui.Default:case ui.AccessTokenAndRefreshToken:case ui.RefreshToken:case ui.RefreshTokenAndNetwork:const r=this.createSilentRefreshClient(e.correlationId);return be(r.acquireToken.bind(r),W.SilentRefreshClientAcquireToken,this.logger,this.performanceClient,e.correlationId)(e);default:throw Te(Kc)}}async acquireTokenBySilentIframe(e){this.performanceClient.addQueueMeasurement(W.AcquireTokenBySilentIframe,e.correlationId);const n=this.createSilentIframeClient(e.correlationId);return be(n.acquireToken.bind(n),W.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 KR(this.initialized,this.config),this.browserStorage.setInteractionInProgress(!0,bc.SIGNOUT),this.createRedirectClient(n).logout(e)}logoutPopup(e){try{const n=this.getRequestCorrelationId(e);return $T(this.initialized),this.browserStorage.setInteractionInProgress(!0,bc.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 Hoe(this.logger,this.browserStorage,this.isBrowserEnvironment,n,e)}getAccount(e){const n=this.getRequestCorrelationId();return Voe(e,this.logger,this.browserStorage,n)}getAccountByUsername(e){const n=this.getRequestCorrelationId();return Goe(e,this.logger,this.browserStorage,n)}getAccountByHomeId(e){const n=this.getRequestCorrelationId();return Koe(e,this.logger,this.browserStorage,n)}getAccountByLocalId(e){const n=this.getRequestCorrelationId();return Woe(e,this.logger,this.browserStorage,n)}setActiveAccount(e){const n=this.getRequestCorrelationId();qoe(e,this.browserStorage,n)}getActiveAccount(){const e=this.getRequestCorrelationId();return Yoe(this.browserStorage,e)}async hydrateCache(e,n){this.logger.verbose("hydrateCache called");const r=gs.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 Ze(TT);return new Ly(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(!bm(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 gi.NONE:case gi.CONSENT:case gi.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 gse(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createRedirectClient(e){return new yse(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentIframeClient(e){return new Ase(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,_n.ssoSilent,this.performanceClient,this.nativeInternalStorage,this.platformAuthProvider,e)}createSilentCacheClient(e){return new d6(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentRefreshClient(e){return new jse(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,this.performanceClient,this.platformAuthProvider,e)}createSilentAuthCodeClient(e){return new Tse(this.config,this.browserStorage,this.browserCrypto,this.logger,this.eventHandler,this.navigationClient,_n.acquireTokenByCode,this.performanceClient,this.platformAuthProvider,e)}addEventCallback(e,n){return this.eventHandler.addEventCallback(e,n)}removeEventCallback(e){this.eventHandler.removeEventCallback(e)}addPerformanceCallback(e){return n6(),this.performanceClient.addPerformanceCallback(e)}removePerformanceCallback(e){return this.performanceClient.removePerformanceCallback(e)}enableAccountStorageEvents(){if(this.config.cache.cacheLocation!==Tr.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!==Tr.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?ys():we.EMPTY_STRING}async loginRedirect(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginRedirect called",n),this.acquireTokenRedirect({correlationId:n,...e||UR})}loginPopup(e){const n=this.getRequestCorrelationId(e);return this.logger.verbose("loginPopup called",n),this.acquireTokenPopup({correlationId:n,...e||UR})}async acquireTokenSilent(e){const n=this.getRequestCorrelationId(e),r=this.performanceClient.startMeasurement(W.AcquireTokenSilent,n);r.add({cacheLookupPolicy:e.cacheLookupPolicy,scenarioId:e.scenarioId}),Gv(this.initialized,r),this.logger.verbose("acquireTokenSilent called",n);const i=e.account||this.getActiveAccount();if(!i)throw Ze(k3);return r.add({accountType:Ns(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 En&&o.setCorrelationId(n),r.end({success:!1},o),o})}async acquireTokenSilentDeduped(e,n,r){const i=xw(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=be(this.acquireTokenSilentAsync.bind(this),W.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(W.AcquireTokenSilentAsync,e.correlationId),this.eventHandler.emitEvent(at.ACQUIRE_TOKEN_START,_t.Silent,e),e.correlationId&&this.performanceClient.incrementFields({visibilityChangeCount:0},e.correlationId),document.addEventListener("visibilitychange",r);const i=await be(Joe,W.InitializeSilentRequest,this.logger,this.performanceClient,e.correlationId)(e,n,this.config,this.performanceClient,this.logger),o=e.cacheLookupPolicy||ui.Default;return this.acquireTokenSilentNoIframe(i,o).catch(async c=>{if(Pse(c,o))if(this.activeIframeRequest)if(o!==ui.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(W.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),be(this.acquireTokenBySilentIframe.bind(this),W.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),be(this.acquireTokenBySilentIframe.bind(this),W.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(at.ACQUIRE_TOKEN_SUCCESS,_t.Silent,c),e.correlationId&&this.performanceClient.addFields({fromCache:c.fromCache,isNativeBroker:c.fromNativeBroker},e.correlationId),c)).catch(c=>{throw this.eventHandler.emitEvent(at.ACQUIRE_TOKEN_FAILURE,_t.Silent,null,c),c}).finally(()=>{document.removeEventListener("visibilitychange",r)})}async acquireTokenSilentNoIframe(e,n){return bm(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,_n.acquireTokenSilent_silentFlow,e.account.nativeAccountId,n).catch(async r=>{throw r instanceof Ls&&nd(r)?(this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow"),this.platformAuthProvider=void 0,Te(Kc)):r})):(this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow"),n===ui.AccessToken&&this.logger.verbose("acquireTokenSilent - cache lookup policy set to AccessToken, attempting to acquire token from local cache"),be(this.acquireTokenFromCache.bind(this),W.AcquireTokenFromCache,this.logger,this.performanceClient,e.correlationId)(e,n).catch(r=>{if(n===ui.AccessToken)throw r;return this.eventHandler.emitEvent(at.ACQUIRE_TOKEN_NETWORK_START,_t.Silent,e),be(this.acquireTokenByRefreshToken.bind(this),W.AcquireTokenByRefreshToken,this.logger,this.performanceClient,e.correlationId)(e,n)}))}async preGeneratePkceCodes(e){return this.logger.verbose("Generating new PKCE codes"),this.pkceCode=await be(jw,W.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),kse(n,e,this.logger)}}function Pse(t,e){const n=!(t instanceof vs&&t.subError!==ww),r=t.errorCode===Ti.INVALID_GRANT_ERROR||t.errorCode===Kc,i=n&&r||t.errorCode===Gx||t.errorCode===yT,o=soe.includes(e);return i&&o}/*! @azure/msal-browser v4.19.0 2025-08-05 */async function Ose(t,e){const n=new wu(t);return await n.initialize(),Nw.createController(n,e)}/*! @azure/msal-browser v4.19.0 2025-08-05 */class WT{static async createPublicClientApplication(e){const n=await Ose(e);return new WT(e,n)}constructor(e,n){this.isBroker=!1,this.controller=n||new Nw(new wu(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 Ise={initialize:()=>Promise.reject(fr(dr)),acquireTokenPopup:()=>Promise.reject(fr(dr)),acquireTokenRedirect:()=>Promise.reject(fr(dr)),acquireTokenSilent:()=>Promise.reject(fr(dr)),acquireTokenByCode:()=>Promise.reject(fr(dr)),getAllAccounts:()=>[],getAccount:()=>null,getAccountByHomeId:()=>null,getAccountByUsername:()=>null,getAccountByLocalId:()=>null,handleRedirectPromise:()=>Promise.reject(fr(dr)),loginPopup:()=>Promise.reject(fr(dr)),loginRedirect:()=>Promise.reject(fr(dr)),logout:()=>Promise.reject(fr(dr)),logoutRedirect:()=>Promise.reject(fr(dr)),logoutPopup:()=>Promise.reject(fr(dr)),ssoSilent:()=>Promise.reject(fr(dr)),addEventCallback:()=>null,removeEventCallback:()=>{},addPerformanceCallback:()=>"",removePerformanceCallback:()=>!1,enableAccountStorageEvents:()=>{},disableAccountStorageEvents:()=>{},getTokenCache:()=>{throw fr(dr)},getLogger:()=>{throw fr(dr)},setLogger:()=>{},setActiveAccount:()=>{},getActiveAccount:()=>null,initializeWrapperLibrary:()=>{},setNavigationClient:()=>{},getConfiguration:()=>{throw fr(dr)},hydrateCache:()=>Promise.reject(fr(dr)),clearCache:()=>Promise.reject(fr(dr))};/*! @azure/msal-browser v4.19.0 2025-08-05 */class Rse{static getInteractionStatusFromEvent(e,n){switch(e.eventType){case at.LOGIN_START:return wr.Login;case at.SSO_SILENT_START:return wr.SsoSilent;case at.ACQUIRE_TOKEN_START:if(e.interactionType===_t.Redirect||e.interactionType===_t.Popup)return wr.AcquireToken;break;case at.HANDLE_REDIRECT_START:return wr.HandleRedirect;case at.LOGOUT_START:return wr.Logout;case at.SSO_SILENT_SUCCESS:case at.SSO_SILENT_FAILURE:if(n&&n!==wr.SsoSilent)break;return wr.None;case at.LOGOUT_END:if(n&&n!==wr.Logout)break;return wr.None;case at.HANDLE_REDIRECT_END:if(n&&n!==wr.HandleRedirect)break;return wr.None;case at.LOGIN_SUCCESS:case at.LOGIN_FAILURE:case at.ACQUIRE_TOKEN_SUCCESS:case at.ACQUIRE_TOKEN_FAILURE:case at.RESTORE_FROM_BFCACHE:if(e.interactionType===_t.Redirect||e.interactionType===_t.Popup){if(n&&n!==wr.Login&&n!==wr.AcquireToken)break;return wr.None}break}return null}}const Mse="modulepreload",Dse=function(t){return"/semblance/"+t},r2={},$se=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=Dse(l),l in r2)return;r2[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":Mse,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 Lse={instance:Ise,inProgress:wr.None,accounts:[],logger:new Ka({})},qT=g.createContext(Lse);qT.Consumer;/*! @azure/msal-react v3.0.17 2025-08-05 */function i2(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 Fse="@azure/msal-react",o2="3.0.17";/*! @azure/msal-react v3.0.17 2025-08-05 */const eb={UNBLOCK_INPROGRESS:"UNBLOCK_INPROGRESS",EVENT:"EVENT"},Bse=(t,e)=>{const{type:n,payload:r}=e;let i=t.inProgress;switch(n){case eb.UNBLOCK_INPROGRESS:t.inProgress===wr.Startup&&(i=wr.None,r.logger.info("MsalProvider - handleRedirectPromise resolved, setting inProgress to 'none'"));break;case eb.EVENT:const s=r.message,c=Rse.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===wr.Startup)return t;const o=r.instance.getAllAccounts();return i!==t.inProgress&&!i2(o,t.accounts)?{...t,inProgress:i,accounts:o}:i!==t.inProgress?{...t,inProgress:i}:i2(o,t.accounts)?t:{...t,accounts:o}};function Use({instance:t,children:e}){g.useEffect(()=>{t.initializeWrapperLibrary(roe.React,o2)},[t]);const n=g.useMemo(()=>t.getLogger().clone(Fse,o2),[t]),[r,i]=g.useReducer(Bse,void 0,()=>({inProgress:wr.Startup,accounts:[]}));g.useEffect(()=>{const s=t.addEventCallback(c=>{i({payload:{instance:t,logger:n,message:c},type:eb.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:eb.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 zse=()=>g.useContext(qT),Hse={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:zn.Verbose,piiLoggingEnabled:!1},allowNativeBroker:!1}},Vse={scopes:["openid","profile","email"],prompt:"select_account",extraQueryParameters:{code_challenge_method:"S256"}},p6=g.createContext(void 0);function Gse({children:t}){const[e,n]=g.useState(null),[r,i]=g.useState(null),[o,s]=g.useState(!0),[c,l]=g.useState(!1),u=ur(),{instance:d,accounts:f,inProgress:h}=zse();g.useEffect(()=>{const w=S=>{const _=S.detail||{};if(_.isPersonaCreation){console.log("Ignoring auth error from persona creation",_);return}i(null),n(null),ae.error("Session expired",{description:"Please log in again"}),u("/login")};return window.addEventListener(VA,w),()=>{window.removeEventListener(VA,w)}},[u]),g.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)},[]),g.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}My.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 My.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"),ae.success("Login successful!"),A.data.access_token}catch(A){throw console.error("Login failed:",A),ae.error("Login failed",{description:((_=(C=A.response)==null?void 0:C.data)==null?void 0:_.message)||"Invalid username or password"}),A}finally{s(!1)}},v=async()=>{l(!0);try{console.log("Starting Microsoft authentication...");const w=await d.loginPopup(Vse);if(w&&w.account&&w.idToken){console.log("Microsoft authentication successful",w.account);const S=await My.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"),ae.success("Successfully signed in with Microsoft!"))}}catch(w){throw console.error("Microsoft login failed:",w),w.name==="BrowserAuthError"&&w.errorCode==="popup_window_error"?ae.error("Sign-in cancelled",{description:"The sign-in popup was closed before completing authentication."}):w.name==="InteractionRequiredAuthError"?ae.error("Authentication required",{description:"Please complete the authentication process."}):ae.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)}ae.info("You have been logged out")},y=!!localStorage.getItem("auth_token"),x={user:e,token:r,isLoading:o,login:p,loginWithMicrosoft:v,logout:m,isAuthenticated:!!r||y,isMsalLoading:c};return a.jsx(p6.Provider,{value:x,children:t})}function la(){const t=g.useContext(p6);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t}function Ra(){const[t,e]=g.useState(!1),n=Ui(),r=ur(),{isAuthenticated:i,logout:o}=la(),s=[{name:"Home",href:"/",icon:Nx},{name:"Synthetic Personas",href:"/synthetic-users",icon:Fr},{name:"Focus Groups",href:"/focus-groups",icon:na},{name:"Dashboard",href:"/dashboard",icon:DA}],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(_o,{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(_o,{to:d.href,className:Fe("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:Fe("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(sR,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(_o,{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(oR,{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(Mi,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(Xee,{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(_o,{to:d.href,className:Fe("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:Fe("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(sR,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(_o,{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(oR,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const s2=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,a2=Mt,YT=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return a2(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=s2(d)||s2(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(v=>{let[m,y]=v;return Array.isArray(y)?y.includes({...o,...c}[m]):{...o,...c}[m]===y})?[...u,f,h]:u},[]);return a2(t,s,l,n==null?void 0:n.class,n==null?void 0:n.className)},QT=YT("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"}}),ie=g.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...i},o)=>{const s=r?ea:"button";return a.jsx(s,{className:Fe(QT({variant:e,size:n,className:t})),ref:o,...i})});ie.displayName="Button";function Kse(){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(_o,{to:"/synthetic-users",children:a.jsxs(ie,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(mo,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(_o,{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 Vu({title:t,description:e,icon:n,className:r}){return a.jsxs("div",{className:Fe("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 Wse=()=>(la(),ur(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(Ra,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(Kse,{}),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(Vu,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:Fr}),a.jsx(Vu,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:na}),a.jsx(Vu,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:DA}),a.jsx(Vu,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:Fr}),a.jsx(Vu,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:ite}),a.jsx(Vu,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:DA})]})]})}),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(_o,{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(_o,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(_o,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(_o,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(_o,{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."]})})]})]})})]})),qse=()=>{const t=Ui(),e=ur();g.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(ie,{onClick:()=>e("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(ie,{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(ie,{variant:"outline",onClick:()=>e("/"),className:"w-full",children:"Return to Home"})]})})},m6=g.createContext(void 0),PC="synthetic-society-navigation-state",Yse=({children:t})=>{const[e,n]=g.useState(()=>{try{const o=localStorage.getItem(PC);return o?JSON.parse(o):{}}catch{return{}}});g.useEffect(()=>{localStorage.setItem(PC,JSON.stringify(e))},[e]);const r=(o,s)=>{n({...e,previousRoute:o,...s})},i=()=>{n({}),localStorage.removeItem(PC)};return a.jsx(m6.Provider,{value:{navigationState:e,setNavigationState:n,clearNavigationState:i,setPreviousRoute:r},children:t})},Ug=()=>{const t=g.useContext(m6);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t};function Qse(t,e=[]){let n=[];function r(o,s){const c=g.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...v}=f,m=(h==null?void 0:h[t][l])||c,y=g.useMemo(()=>v,Object.values(v));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,v=g.useContext(p);if(v)return v;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=>g.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return g.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Xse(i,...e)]}function Xse(...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 g.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var XT="Progress",JT=100,[Jse,YBe]=Qse(XT),[Zse,eae]=Jse(XT),g6=g.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:i,getValueLabel:o=tae,...s}=t;(i||i===0)&&!c2(i)&&console.error(nae(`${i}`,"Progress"));const c=c2(i)?i:JT;r!==null&&!l2(r,c)&&console.error(rae(`${r}`,"Progress"));const l=l2(r,c)?r:null,u=tb(l)?o(l,c):void 0;return a.jsx(Zse,{scope:n,value:l,max:c,children:a.jsx(ht.div,{"aria-valuemax":c,"aria-valuemin":0,"aria-valuenow":tb(l)?l:void 0,"aria-valuetext":u,role:"progressbar","data-state":x6(l,c),"data-value":l??void 0,"data-max":c,...s,ref:e})})});g6.displayName=XT;var v6="ProgressIndicator",y6=g.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,i=eae(v6,n);return a.jsx(ht.div,{"data-state":x6(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...r,ref:e})});y6.displayName=v6;function tae(t,e){return`${Math.round(t/e*100)}%`}function x6(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function tb(t){return typeof t=="number"}function c2(t){return tb(t)&&!isNaN(t)&&t>0}function l2(t,e){return tb(t)&&!isNaN(t)&&t<=e&&t>=0}function nae(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${JT}\`.`}function rae(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 ${JT} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var b6=g6,iae=y6;const Ic=g.forwardRef(({className:t,value:e,...n},r)=>a.jsx(b6,{ref:r,className:Fe("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(iae,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Ic.displayName=b6.displayName;var zg=t=>t.type==="checkbox",Vl=t=>t instanceof Date,pi=t=>t==null;const w6=t=>typeof t=="object";var lr=t=>!pi(t)&&!Array.isArray(t)&&w6(t)&&!Vl(t),S6=t=>lr(t)&&t.target?zg(t.target)?t.target.checked:t.target.value:t,oae=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,C6=(t,e)=>t.has(oae(e)),sae=t=>{const e=t.constructor&&t.constructor.prototype;return lr(e)&&e.hasOwnProperty("isPrototypeOf")},ZT=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ai(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(!(ZT&&(t instanceof Blob||t instanceof FileList))&&(n||lr(t)))if(e=n?[]:{},!n&&!sae(t))e=t;else for(const r in t)t.hasOwnProperty(r)&&(e[r]=Ai(t[r]));else return t;return e}var Tw=t=>Array.isArray(t)?t.filter(Boolean):[],ir=t=>t===void 0,He=(t,e,n)=>{if(!e||!lr(t))return n;const r=Tw(e.split(/[,[\].]+?/)).reduce((i,o)=>pi(i)?i:i[o],t);return ir(r)||r===t?ir(t[e])?n:t[e]:r},vo=t=>typeof t=="boolean",ek=t=>/^\w*$/.test(t),_6=t=>Tw(t.replace(/["|']|\]/g,"").split(/\.|\[/)),gn=(t,e,n)=>{let r=-1;const i=ek(e)?[e]:_6(e),o=i.length,s=o-1;for(;++rN.useContext(A6),aae=t=>{const{children:e,...n}=t;return N.createElement(A6.Provider,{value:n},e)};var j6=(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]!==Jo.all&&(e._proxyFormState[s]=!r||Jo.all),n&&(n[s]=!0),t[s]}});return i},ji=t=>lr(t)&&!Object.keys(t).length,E6=(t,e,n,r)=>{n(t);const{name:i,...o}=t;return ji(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(s=>e[s]===(!r||Jo.all))},Tp=t=>Array.isArray(t)?t:[t],N6=(t,e,n)=>!t||!e||t===e||Tp(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function tk(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 cae(t){const e=kw(),{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,tk({disabled:r,next:f=>l.current&&N6(d.current,f.name,o)&&E6(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]),j6(s,n,u.current,!1)}var Bs=t=>typeof t=="string",T6=(t,e,n,r,i)=>Bs(t)?(r&&e.watch.add(t),He(n,t,i)):Array.isArray(t)?t.map(o=>(r&&e.watch.add(o),He(n,o))):(r&&(e.watchAll=!0),n);function lae(t){const e=kw(),{control:n=e.control,name:r,defaultValue:i,disabled:o,exact:s}=t||{},c=N.useRef(r);c.current=r,tk({disabled:o,subject:n._subjects.values,next:d=>{N6(c.current,d.name,s)&&u(Ai(T6(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 uae(t){const e=kw(),{name:n,disabled:r,control:i=e.control,shouldUnregister:o}=t,s=C6(i._names.array,n),c=lae({control:i,name:n,defaultValue:He(i._formValues,n,He(i._defaultValues,n,t.defaultValue)),exact:!0}),l=cae({control:i,name:n,exact:!0}),u=N.useRef(i.register(n,{...t.rules,value:c,...vo(t.disabled)?{disabled:t.disabled}:{}}));return N.useEffect(()=>{const d=i._options.shouldUnregister||o,f=(h,p)=>{const v=He(i._fields,h);v&&v._f&&(v._f.mount=p)};if(f(n,!0),d){const h=Ai(He(i._options.defaultValues,n));gn(i._defaultValues,n,h),ir(He(i._formValues,n))&&gn(i._formValues,n,h)}return()=>{(s?d&&!i._state.action:d)?i.unregister(n):f(n,!1)}},[n,i,s,o]),N.useEffect(()=>{He(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:He(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:c,...vo(r)||l.disabled?{disabled:l.disabled||r}:{},onChange:N.useCallback(d=>u.current.onChange({target:{value:S6(d),name:n},type:nb.CHANGE}),[n]),onBlur:N.useCallback(()=>u.current.onBlur({target:{value:He(i._formValues,n),name:n},type:nb.BLUR}),[n,i]),ref:N.useCallback(d=>{const f=He(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:()=>!!He(l.errors,n)},isDirty:{enumerable:!0,get:()=>!!He(l.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!He(l.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!He(l.validatingFields,n)},error:{enumerable:!0,get:()=>He(l.errors,n)}})}}const dae=t=>t.render(uae(t));var k6=(t,e,n,r,i)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:i||!0}}:{},u2=t=>({isOnSubmit:!t||t===Jo.onSubmit,isOnBlur:t===Jo.onBlur,isOnChange:t===Jo.onChange,isOnAll:t===Jo.all,isOnTouch:t===Jo.onTouched}),d2=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const kp=(t,e,n,r)=>{for(const i of n||Object.keys(t)){const o=He(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(kp(c,e))break}else if(lr(c)&&kp(c,e))break}}};var fae=(t,e,n)=>{const r=Tp(He(t,n));return gn(r,"root",e[n]),gn(t,n,r),t},nk=t=>t.type==="file",Ta=t=>typeof t=="function",rb=t=>{if(!ZT)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Fy=t=>Bs(t),rk=t=>t.type==="radio",ib=t=>t instanceof RegExp;const f2={value:!1,isValid:!1},h2={value:!0,isValid:!0};var P6=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&&!ir(t[0].attributes.value)?ir(t[0].value)||t[0].value===""?h2:{value:t[0].value,isValid:!0}:h2:f2}return f2};const p2={isValid:!1,value:null};var O6=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,p2):p2;function m2(t,e,n="validate"){if(Fy(t)||Array.isArray(t)&&t.every(Fy)||vo(t)&&!t)return{type:n,message:Fy(t)?t:"",ref:e}}var Gu=t=>lr(t)&&!ib(t)?t:{value:t,message:""},g2=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:v,valueAsNumber:m,mount:y,disabled:b}=t._f,x=He(e,v);if(!y||b)return{};const w=s?s[0]:o,S=E=>{r&&w.reportValidity&&(w.setCustomValidity(vo(E)?"":E||""),w.reportValidity())},C={},_=rk(o),A=zg(o),j=_||A,T=(m||nk(o))&&ir(o.value)&&ir(x)||rb(o)&&o.value===""||x===""||Array.isArray(x)&&!x.length,k=k6.bind(null,v,n,C),O=(E,R,D,V=ma.maxLength,L=ma.minLength)=>{const z=E?R:D;C[v]={type:E?V:L,message:z,ref:o,...k(E?V:L,z)}};if(i?!Array.isArray(x)||!x.length:c&&(!j&&(T||pi(x))||vo(x)&&!x||A&&!P6(s).isValid||_&&!O6(s).isValid)){const{value:E,message:R}=Fy(c)?{value:!!c,message:c}:Gu(c);if(E&&(C[v]={type:ma.required,message:R,ref:w,...k(ma.required,R)},!n))return S(R),C}if(!T&&(!pi(d)||!pi(f))){let E,R;const D=Gu(f),V=Gu(d);if(!pi(x)&&!isNaN(x)){const L=o.valueAsNumber||x&&+x;pi(D.value)||(E=L>D.value),pi(V.value)||(R=Lnew Date(new Date().toDateString()+" "+Q),M=o.type=="time",$=o.type=="week";Bs(D.value)&&x&&(E=M?z(x)>z(D.value):$?x>D.value:L>new Date(D.value)),Bs(V.value)&&x&&(R=M?z(x)+E.value,V=!pi(R.value)&&x.length<+R.value;if((D||V)&&(O(D,E.message,R.message),!n))return S(C[v].message),C}if(h&&!T&&Bs(x)){const{value:E,message:R}=Gu(h);if(ib(E)&&!x.match(E)&&(C[v]={type:ma.pattern,message:R,ref:o,...k(ma.pattern,R)},!n))return S(R),C}if(p){if(Ta(p)){const E=await p(x,e),R=m2(E,w);if(R&&(C[v]={...R,...k(ma.validate,R.message)},!n))return S(R.message),C}else if(lr(p)){let E={};for(const R in p){if(!ji(E)&&!n)break;const D=m2(await p[R](x,e),w,R);D&&(E={...D,...k(R,D.message)},S(D.message),n&&(C[v]=E))}if(!ji(E)&&(C[v]={ref:w,...E},!n))return C}}return S(!0),C};function hae(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=[]}}},a1=t=>pi(t)||!w6(t);function wc(t,e){if(a1(t)||a1(e))return t===e;if(Vl(t)&&Vl(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(Vl(o)&&Vl(s)||lr(o)&&lr(s)||Array.isArray(o)&&Array.isArray(s)?!wc(o,s):o!==s)return!1}}return!0}var I6=t=>t.type==="select-multiple",mae=t=>rk(t)||zg(t),IC=t=>rb(t)&&t.isConnected,R6=t=>{for(const e in t)if(Ta(t[e]))return!0;return!1};function ob(t,e={}){const n=Array.isArray(t);if(lr(t)||n)for(const r in t)Array.isArray(t[r])||lr(t[r])&&!R6(t[r])?(e[r]=Array.isArray(t[r])?[]:{},ob(t[r],e[r])):pi(t[r])||(e[r]=!0);return e}function M6(t,e,n){const r=Array.isArray(t);if(lr(t)||r)for(const i in t)Array.isArray(t[i])||lr(t[i])&&!R6(t[i])?ir(e)||a1(n[i])?n[i]=Array.isArray(t[i])?ob(t[i],[]):{...ob(t[i])}:M6(t[i],pi(e)?{}:e[i],n[i]):n[i]=!wc(t[i],e[i]);return n}var Fh=(t,e)=>M6(t,e,ob(e)),D6=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ir(t)?t:e?t===""?NaN:t&&+t:n&&Bs(t)?new Date(t):r?r(t):t;function RC(t){const e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return nk(e)?e.files:rk(e)?O6(t.refs).value:I6(e)?[...e.selectedOptions].map(({value:n})=>n):zg(e)?P6(t.refs).value:D6(ir(e.value)?t.ref.value:e.value,t)}var gae=(t,e,n,r)=>{const i={};for(const o of t){const s=He(e,o);s&&gn(i,o,s._f)}return{criteriaMode:n,names:[...t],fields:i,shouldUseNativeValidation:r}},Bh=t=>ir(t)?t:ib(t)?t.source:lr(t)?ib(t.value)?t.value.source:t.value:t;const v2="AsyncFunction";var vae=t=>(!t||!t.validate)&&!!(Ta(t.validate)&&t.validate.constructor.name===v2||lr(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===v2)),yae=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function y2(t,e,n){const r=He(t,n);if(r||ek(n))return{error:r,name:n};const i=n.split(".");for(;i.length;){const o=i.join("."),s=He(e,o),c=He(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 xae=(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,bae=(t,e)=>!Tw(He(t,e)).length&&br(t,e);const wae={mode:Jo.onSubmit,reValidateMode:Jo.onChange,shouldFocusError:!0};function Sae(t={}){let e={...wae,...t},n={submitCount:0,isDirty:!1,isLoading:Ta(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},i=lr(e.defaultValues)||lr(e.values)?Ai(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:Ai(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:OC(),array:OC(),state:OC()},h=u2(e.mode),p=u2(e.reValidateMode),v=e.criteriaMode===Jo.all,m=F=>J=>{clearTimeout(u),u=setTimeout(F,J)},y=async F=>{if(!t.disabled&&(d.isValid||F)){const J=e.resolver?ji((await j()).errors):await k(r,!0);J!==n.isValid&&f.state.next({isValid:J})}},b=(F,J)=>{!t.disabled&&(d.isValidating||d.validatingFields)&&((F||Array.from(c.mount)).forEach(oe=>{oe&&(J?gn(n.validatingFields,oe,J):br(n.validatingFields,oe))}),f.state.next({validatingFields:n.validatingFields,isValidating:!ji(n.validatingFields)}))},x=(F,J=[],oe,ye,Ee=!0,P=!0)=>{if(ye&&oe&&!t.disabled){if(s.action=!0,P&&Array.isArray(He(r,F))){const H=oe(He(r,F),ye.argA,ye.argB);Ee&&gn(r,F,H)}if(P&&Array.isArray(He(n.errors,F))){const H=oe(He(n.errors,F),ye.argA,ye.argB);Ee&&gn(n.errors,F,H),bae(n.errors,F)}if(d.touchedFields&&P&&Array.isArray(He(n.touchedFields,F))){const H=oe(He(n.touchedFields,F),ye.argA,ye.argB);Ee&&gn(n.touchedFields,F,H)}d.dirtyFields&&(n.dirtyFields=Fh(i,o)),f.state.next({name:F,isDirty:E(F,J),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else gn(o,F,J)},w=(F,J)=>{gn(n.errors,F,J),f.state.next({errors:n.errors})},S=F=>{n.errors=F,f.state.next({errors:n.errors,isValid:!1})},C=(F,J,oe,ye)=>{const Ee=He(r,F);if(Ee){const P=He(o,F,ir(oe)?He(i,F):oe);ir(P)||ye&&ye.defaultChecked||J?gn(o,F,J?P:RC(Ee._f)):V(F,P),s.mount&&y()}},_=(F,J,oe,ye,Ee)=>{let P=!1,H=!1;const ee={name:F};if(!t.disabled){const re=!!(He(r,F)&&He(r,F)._f&&He(r,F)._f.disabled);if(!oe||ye){d.isDirty&&(H=n.isDirty,n.isDirty=ee.isDirty=E(),P=H!==ee.isDirty);const Z=re||wc(He(i,F),J);H=!!(!re&&He(n.dirtyFields,F)),Z||re?br(n.dirtyFields,F):gn(n.dirtyFields,F,!0),ee.dirtyFields=n.dirtyFields,P=P||d.dirtyFields&&H!==!Z}if(oe){const Z=He(n.touchedFields,F);Z||(gn(n.touchedFields,F,oe),ee.touchedFields=n.touchedFields,P=P||d.touchedFields&&Z!==oe)}P&&Ee&&f.state.next(ee)}return P?ee:{}},A=(F,J,oe,ye)=>{const Ee=He(n.errors,F),P=d.isValid&&vo(J)&&n.isValid!==J;if(t.delayError&&oe?(l=m(()=>w(F,oe)),l(t.delayError)):(clearTimeout(u),l=null,oe?gn(n.errors,F,oe):br(n.errors,F)),(oe?!wc(Ee,oe):Ee)||!ji(ye)||P){const H={...ye,...P&&vo(J)?{isValid:J}:{},errors:n.errors,name:F};n={...n,...H},f.state.next(H)}},j=async F=>{b(F,!0);const J=await e.resolver(o,e.context,gae(F||c.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return b(F),J},T=async F=>{const{errors:J}=await j(F);if(F)for(const oe of F){const ye=He(J,oe);ye?gn(n.errors,oe,ye):br(n.errors,oe)}else n.errors=J;return J},k=async(F,J,oe={valid:!0})=>{for(const ye in F){const Ee=F[ye];if(Ee){const{_f:P,...H}=Ee;if(P){const ee=c.array.has(P.name),re=Ee._f&&vae(Ee._f);re&&d.validatingFields&&b([ye],!0);const Z=await g2(Ee,o,v,e.shouldUseNativeValidation&&!J,ee);if(re&&d.validatingFields&&b([ye]),Z[P.name]&&(oe.valid=!1,J))break;!J&&(He(Z,P.name)?ee?fae(n.errors,Z,P.name):gn(n.errors,P.name,Z[P.name]):br(n.errors,P.name))}!ji(H)&&await k(H,J,oe)}}return oe.valid},O=()=>{for(const F of c.unMount){const J=He(r,F);J&&(J._f.refs?J._f.refs.every(oe=>!IC(oe)):!IC(J._f.ref))&&he(F)}c.unMount=new Set},E=(F,J)=>!t.disabled&&(F&&J&&gn(o,F,J),!wc(q(),i)),R=(F,J,oe)=>T6(F,c,{...s.mount?o:ir(J)?i:Bs(F)?{[F]:J}:J},oe,J),D=F=>Tw(He(s.mount?o:i,F,t.shouldUnregister?He(i,F,[]):[])),V=(F,J,oe={})=>{const ye=He(r,F);let Ee=J;if(ye){const P=ye._f;P&&(!P.disabled&&gn(o,F,D6(J,P)),Ee=rb(P.ref)&&pi(J)?"":J,I6(P.ref)?[...P.ref.options].forEach(H=>H.selected=Ee.includes(H.value)):P.refs?zg(P.ref)?P.refs.length>1?P.refs.forEach(H=>(!H.defaultChecked||!H.disabled)&&(H.checked=Array.isArray(Ee)?!!Ee.find(ee=>ee===H.value):Ee===H.value)):P.refs[0]&&(P.refs[0].checked=!!Ee):P.refs.forEach(H=>H.checked=H.value===Ee):nk(P.ref)?P.ref.value="":(P.ref.value=Ee,P.ref.type||f.values.next({name:F,values:{...o}})))}(oe.shouldDirty||oe.shouldTouch)&&_(F,Ee,oe.shouldTouch,oe.shouldDirty,!0),oe.shouldValidate&&Q(F)},L=(F,J,oe)=>{for(const ye in J){const Ee=J[ye],P=`${F}.${ye}`,H=He(r,P);(c.array.has(F)||lr(Ee)||H&&!H._f)&&!Vl(Ee)?L(P,Ee,oe):V(P,Ee,oe)}},z=(F,J,oe={})=>{const ye=He(r,F),Ee=c.array.has(F),P=Ai(J);gn(o,F,P),Ee?(f.array.next({name:F,values:{...o}}),(d.isDirty||d.dirtyFields)&&oe.shouldDirty&&f.state.next({name:F,dirtyFields:Fh(i,o),isDirty:E(F,P)})):ye&&!ye._f&&!pi(P)?L(F,P,oe):V(F,P,oe),d2(F,c)&&f.state.next({...n}),f.values.next({name:s.mount?F:void 0,values:{...o}})},M=async F=>{s.mount=!0;const J=F.target;let oe=J.name,ye=!0;const Ee=He(r,oe),P=()=>J.type?RC(Ee._f):S6(F),H=ee=>{ye=Number.isNaN(ee)||Vl(ee)&&isNaN(ee.getTime())||wc(ee,He(o,oe,ee))};if(Ee){let ee,re;const Z=P(),Se=F.type===nb.BLUR||F.type===nb.FOCUS_OUT,Ae=!yae(Ee._f)&&!e.resolver&&!He(n.errors,oe)&&!Ee._f.deps||xae(Se,He(n.touchedFields,oe),n.isSubmitted,p,h),Ie=d2(oe,c,Se);gn(o,oe,Z),Se?(Ee._f.onBlur&&Ee._f.onBlur(F),l&&l(0)):Ee._f.onChange&&Ee._f.onChange(F);const Ke=_(oe,Z,Se,!1),Ue=!ji(Ke)||Ie;if(!Se&&f.values.next({name:oe,type:F.type,values:{...o}}),Ae)return d.isValid&&(t.mode==="onBlur"?Se&&y():y()),Ue&&f.state.next({name:oe,...Ie?{}:Ke});if(!Se&&Ie&&f.state.next({...n}),e.resolver){const{errors:Be}=await j([oe]);if(H(Z),ye){const nt=y2(n.errors,r,oe),Ne=y2(Be,r,nt.name||oe);ee=Ne.error,oe=Ne.name,re=ji(Be)}}else b([oe],!0),ee=(await g2(Ee,o,v,e.shouldUseNativeValidation))[oe],b([oe]),H(Z),ye&&(ee?re=!1:d.isValid&&(re=await k(r,!0)));ye&&(Ee._f.deps&&Q(Ee._f.deps),A(oe,re,ee,Ke))}},$=(F,J)=>{if(He(n.errors,J)&&F.focus)return F.focus(),1},Q=async(F,J={})=>{let oe,ye;const Ee=Tp(F);if(e.resolver){const P=await T(ir(F)?F:Ee);oe=ji(P),ye=F?!Ee.some(H=>He(P,H)):oe}else F?(ye=(await Promise.all(Ee.map(async P=>{const H=He(r,P);return await k(H&&H._f?{[P]:H}:H)}))).every(Boolean),!(!ye&&!n.isValid)&&y()):ye=oe=await k(r);return f.state.next({...!Bs(F)||d.isValid&&oe!==n.isValid?{}:{name:F},...e.resolver||!F?{isValid:oe}:{},errors:n.errors}),J.shouldFocus&&!ye&&kp(r,$,F?Ee:c.mount),ye},q=F=>{const J={...s.mount?o:i};return ir(F)?J:Bs(F)?He(J,F):F.map(oe=>He(J,oe))},te=(F,J)=>({invalid:!!He((J||n).errors,F),isDirty:!!He((J||n).dirtyFields,F),error:He((J||n).errors,F),isValidating:!!He(n.validatingFields,F),isTouched:!!He((J||n).touchedFields,F)}),xe=F=>{F&&Tp(F).forEach(J=>br(n.errors,J)),f.state.next({errors:F?n.errors:{}})},B=(F,J,oe)=>{const ye=(He(r,F,{_f:{}})._f||{}).ref,Ee=He(n.errors,F)||{},{ref:P,message:H,type:ee,...re}=Ee;gn(n.errors,F,{...re,...J,ref:ye}),f.state.next({name:F,errors:n.errors,isValid:!1}),oe&&oe.shouldFocus&&ye&&ye.focus&&ye.focus()},ce=(F,J)=>Ta(F)?f.values.subscribe({next:oe=>F(R(void 0,J),oe)}):R(F,J,!0),he=(F,J={})=>{for(const oe of F?Tp(F):c.mount)c.mount.delete(oe),c.array.delete(oe),J.keepValue||(br(r,oe),br(o,oe)),!J.keepError&&br(n.errors,oe),!J.keepDirty&&br(n.dirtyFields,oe),!J.keepTouched&&br(n.touchedFields,oe),!J.keepIsValidating&&br(n.validatingFields,oe),!e.shouldUnregister&&!J.keepDefaultValue&&br(i,oe);f.values.next({values:{...o}}),f.state.next({...n,...J.keepDirty?{isDirty:E()}:{}}),!J.keepIsValid&&y()},U=({disabled:F,name:J,field:oe,fields:ye,value:Ee})=>{if(vo(F)&&s.mount||F){const P=F?void 0:ir(Ee)?RC(oe?oe._f:He(ye,J)._f):Ee;gn(o,J,P),_(J,P,!1,!1,!0)}},de=(F,J={})=>{let oe=He(r,F);const ye=vo(J.disabled)||vo(t.disabled);return gn(r,F,{...oe||{},_f:{...oe&&oe._f?oe._f:{ref:{name:F}},name:F,mount:!0,...J}}),c.mount.add(F),oe?U({field:oe,disabled:vo(J.disabled)?J.disabled:t.disabled,name:F,value:J.value}):C(F,!0,J.value),{...ye?{disabled:J.disabled||t.disabled}:{},...e.progressive?{required:!!J.required,min:Bh(J.min),max:Bh(J.max),minLength:Bh(J.minLength),maxLength:Bh(J.maxLength),pattern:Bh(J.pattern)}:{},name:F,onChange:M,onBlur:M,ref:Ee=>{if(Ee){de(F,J),oe=He(r,F);const P=ir(Ee.value)&&Ee.querySelectorAll&&Ee.querySelectorAll("input,select,textarea")[0]||Ee,H=mae(P),ee=oe._f.refs||[];if(H?ee.find(re=>re===P):P===oe._f.ref)return;gn(r,F,{_f:{...oe._f,...H?{refs:[...ee.filter(IC),P,...Array.isArray(He(i,F))?[{}]:[]],ref:{type:P.type,name:F}}:{ref:P}}}),C(F,!1,void 0,P)}else oe=He(r,F,{}),oe._f&&(oe._f.mount=!1),(e.shouldUnregister||J.shouldUnregister)&&!(C6(c.array,F)&&s.action)&&c.unMount.add(F)}}},se=()=>e.shouldFocusError&&kp(r,$,c.mount),ne=F=>{vo(F)&&(f.state.next({disabled:F}),kp(r,(J,oe)=>{const ye=He(r,oe);ye&&(J.disabled=ye._f.disabled||F,Array.isArray(ye._f.refs)&&ye._f.refs.forEach(Ee=>{Ee.disabled=ye._f.disabled||F}))},0,!1))},je=(F,J)=>async oe=>{let ye;oe&&(oe.preventDefault&&oe.preventDefault(),oe.persist&&oe.persist());let Ee=Ai(o);if(f.state.next({isSubmitting:!0}),e.resolver){const{errors:P,values:H}=await j();n.errors=P,Ee=H}else await k(r);if(br(n.errors,"root"),ji(n.errors)){f.state.next({errors:{}});try{await F(Ee,oe)}catch(P){ye=P}}else J&&await J({...n.errors},oe),se(),setTimeout(se);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ji(n.errors)&&!ye,submitCount:n.submitCount+1,errors:n.errors}),ye)throw ye},K=(F,J={})=>{He(r,F)&&(ir(J.defaultValue)?z(F,Ai(He(i,F))):(z(F,J.defaultValue),gn(i,F,Ai(J.defaultValue))),J.keepTouched||br(n.touchedFields,F),J.keepDirty||(br(n.dirtyFields,F),n.isDirty=J.defaultValue?E(F,Ai(He(i,F))):E()),J.keepError||(br(n.errors,F),d.isValid&&y()),f.state.next({...n}))},et=(F,J={})=>{const oe=F?Ai(F):i,ye=Ai(oe),Ee=ji(F),P=Ee?i:ye;if(J.keepDefaultValues||(i=oe),!J.keepValues){if(J.keepDirtyValues){const H=new Set([...c.mount,...Object.keys(Fh(i,o))]);for(const ee of Array.from(H))He(n.dirtyFields,ee)?gn(P,ee,He(o,ee)):z(ee,He(P,ee))}else{if(ZT&&ir(F))for(const H of c.mount){const ee=He(r,H);if(ee&&ee._f){const re=Array.isArray(ee._f.refs)?ee._f.refs[0]:ee._f.ref;if(rb(re)){const Z=re.closest("form");if(Z){Z.reset();break}}}}r={}}o=t.shouldUnregister?J.keepDefaultValues?Ai(i):{}:Ai(P),f.array.next({values:{...P}}),f.values.next({values:{...P}})}c={mount:J.keepDirtyValues?c.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!d.isValid||!!J.keepIsValid||!!J.keepDirtyValues,s.watch=!!t.shouldUnregister,f.state.next({submitCount:J.keepSubmitCount?n.submitCount:0,isDirty:Ee?!1:J.keepDirty?n.isDirty:!!(J.keepDefaultValues&&!wc(F,i)),isSubmitted:J.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Ee?{}:J.keepDirtyValues?J.keepDefaultValues&&o?Fh(i,o):n.dirtyFields:J.keepDefaultValues&&F?Fh(i,F):J.keepDirty?n.dirtyFields:{},touchedFields:J.keepTouched?n.touchedFields:{},errors:J.keepErrors?n.errors:{},isSubmitSuccessful:J.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Me=(F,J)=>et(Ta(F)?F(o):F,J);return{control:{register:de,unregister:he,getFieldState:te,handleSubmit:je,setError:B,_executeSchema:j,_getWatch:R,_getDirty:E,_updateValid:y,_removeUnmounted:O,_updateFieldArray:x,_updateDisabledField:U,_getFieldArray:D,_reset:et,_resetDefaultValues:()=>Ta(e.defaultValues)&&e.defaultValues().then(F=>{Me(F,e.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:F=>{n={...n,...F}},_disableForm:ne,_subjects:f,_proxyFormState:d,_setErrors:S,get _fields(){return r},get _formValues(){return o},get _state(){return s},set _state(F){s=F},get _defaultValues(){return i},get _names(){return c},set _names(F){c=F},get _formState(){return n},set _formState(F){n=F},get _options(){return e},set _options(F){e={...e,...F}}},trigger:Q,register:de,handleSubmit:je,watch:ce,setValue:z,getValues:q,reset:Me,resetField:K,clearErrors:xe,unregister:he,setError:B,setFocus:(F,J={})=>{const oe=He(r,F),ye=oe&&oe._f;if(ye){const Ee=ye.refs?ye.refs[0]:ye.ref;Ee.focus&&(Ee.focus(),J.shouldSelect&&Ee.select())}},getFieldState:te}}function Hg(t={}){const e=N.useRef(),n=N.useRef(),[r,i]=N.useState({isDirty:!1,isValidating:!1,isLoading:Ta(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Ta(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...Sae(t),formState:r});const o=e.current.control;return o._options=t,tk({subject:o._subjects.state,next:s=>{E6(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&&!wc(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=j6(r,o),e.current}const x2=(t,e,n)=>{if(t&&"reportValidity"in t){const r=He(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},$6=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?x2(r.ref,n,t):r.refs&&r.refs.forEach(i=>x2(i,n,t))}},Cae=(t,e)=>{e.shouldUseNativeValidation&&$6(t,e);const n={};for(const r in t){const i=He(e.fields,r),o=Object.assign(t[r]||{},{ref:i&&i.ref});if(_ae(e.names||Object.keys(t),r)){const s=Object.assign({},He(n,r));gn(s,"root",o),gn(n,r,s)}else gn(n,r,o)}return n},_ae=(t,e)=>t.some(n=>n.startsWith(e+"."));var Aae=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]=k6(s,e,n,i,u?[].concat(u,r.message):r.message)}t.shift()}return n},Vg=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&&$6({},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:Cae(Aae(s.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw s}))}catch(s){return Promise.reject(s)}}},an;(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})(an||(an={}));var c1;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(c1||(c1={}));const it=an.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Sc=t=>{switch(typeof t){case"undefined":return it.undefined;case"string":return it.string;case"number":return isNaN(t)?it.nan:it.number;case"boolean":return it.boolean;case"function":return it.function;case"bigint":return it.bigint;case"symbol":return it.symbol;case"object":return Array.isArray(t)?it.array:t===null?it.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?it.promise:typeof Map<"u"&&t instanceof Map?it.map:typeof Set<"u"&&t instanceof Set?it.set:typeof Date<"u"&&t instanceof Date?it.date:it.object;default:return it.unknown}},Re=an.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"]),jae=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class io 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()}}io.create=t=>new io(t);const lf=(t,e)=>{let n;switch(t.code){case Re.invalid_type:t.received===it.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case Re.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,an.jsonStringifyReplacer)}`;break;case Re.unrecognized_keys:n=`Unrecognized key(s) in object: ${an.joinValues(t.keys,", ")}`;break;case Re.invalid_union:n="Invalid input";break;case Re.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${an.joinValues(t.options)}`;break;case Re.invalid_enum_value:n=`Invalid enum value. Expected ${an.joinValues(t.options)}, received '${t.received}'`;break;case Re.invalid_arguments:n="Invalid function arguments";break;case Re.invalid_return_type:n="Invalid function return type";break;case Re.invalid_date:n="Invalid date";break;case Re.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}"`:an.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case Re.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 Re.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 Re.custom:n="Invalid input";break;case Re.invalid_intersection_types:n="Intersection results could not be merged";break;case Re.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case Re.not_finite:n="Number must be finite";break;default:n=e.defaultError,an.assertNever(t)}return{message:n}};let L6=lf;function Eae(t){L6=t}function sb(){return L6}const ab=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}},Nae=[];function Xe(t,e){const n=sb(),r=ab({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===lf?void 0:lf].filter(i=>!!i)});t.common.issues.push(r)}class ai{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 kt;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 ai.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 kt;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 kt=Object.freeze({status:"aborted"}),gd=t=>({status:"dirty",value:t}),wi=t=>({status:"valid",value:t}),l1=t=>t.status==="aborted",u1=t=>t.status==="dirty",wm=t=>t.status==="valid",Sm=t=>typeof Promise<"u"&&t instanceof Promise;function cb(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 F6(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 wt;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(wt||(wt={}));var sp,ap;class ra{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 b2=(t,e)=>{if(wm(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 io(t.common.issues);return this._error=n,this._error}}};function zt(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 Qt{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 Sc(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Sc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ai,ctx:{common:e.parent.common,data:e.data,parsedType:Sc(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Sm(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:Sc(e)},o=this._parseSync({data:e,path:i.path,parent:i});return b2(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:Sc(e)},i=this._parse({data:e,path:r.path,parent:r}),o=await(Sm(i)?i:Promise.resolve(i));return b2(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:Re.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 xs({schema:this,typeName:Et.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Ks.create(this,this._def)}nullable(){return ul.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cs.create(this,this._def)}promise(){return df.create(this,this._def)}or(e){return jm.create([this,e],this._def)}and(e){return Em.create(this,e,this._def)}transform(e){return new xs({...zt(this._def),schema:this,typeName:Et.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Om({...zt(this._def),innerType:this,defaultValue:n,typeName:Et.ZodDefault})}brand(){return new ik({typeName:Et.ZodBranded,type:this,...zt(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Im({...zt(this._def),innerType:this,catchValue:n,typeName:Et.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Gg.create(this,e)}readonly(){return Rm.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Tae=/^c[^\s-]{8,}$/i,kae=/^[0-9a-z]+$/,Pae=/^[0-9A-HJKMNP-TV-Z]{26}$/,Oae=/^[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,Iae=/^[a-z0-9_-]{21}$/i,Rae=/^[-+]?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)?)??$/,Mae=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Dae="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let MC;const $ae=/^(?:(?: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])$/,Lae=/^(([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})))$/,Fae=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,B6="((\\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])))",Bae=new RegExp(`^${B6}$`);function U6(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 Uae(t){return new RegExp(`^${U6(t)}$`)}function z6(t){let e=`${B6}T${U6(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 zae(t,e){return!!((e==="v4"||!e)&&$ae.test(t)||(e==="v6"||!e)&&Lae.test(t))}class rs extends Qt{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==it.string){const o=this._getOrReturnCtx(e);return Xe(o,{code:Re.invalid_type,expected:it.string,received:o.parsedType}),kt}const r=new ai;let i;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(i=this._getOrReturnCtx(e,i),Xe(i,{code:Re.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:Re.invalid_string,...wt.errToObj(r)})}_addCheck(e){return new rs({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...wt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...wt.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...wt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...wt.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...wt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...wt.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...wt.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...wt.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...wt.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...wt.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,...wt.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,...wt.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...wt.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...wt.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...wt.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...wt.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...wt.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...wt.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...wt.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...wt.errToObj(n)})}nonempty(e){return this.min(1,wt.errToObj(e))}trim(){return new rs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new rs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new rs({...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 rs({checks:[],typeName:Et.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...zt(t)})};function Hae(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 al extends Qt{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)!==it.number){const o=this._getOrReturnCtx(e);return Xe(o,{code:Re.invalid_type,expected:it.number,received:o.parsedType}),kt}let r;const i=new ai;for(const o of this._def.checks)o.kind==="int"?an.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Xe(r,{code:Re.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),Xe(r,{code:Re.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Hae(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),Xe(r,{code:Re.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Xe(r,{code:Re.not_finite,message:o.message}),i.dirty()):an.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,wt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,wt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,wt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,wt.toString(n))}setLimit(e,n,r,i){return new al({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:wt.toString(i)}]})}_addCheck(e){return new al({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:wt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:wt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:wt.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:wt.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:wt.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:wt.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"&&an.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 al({checks:[],typeName:Et.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...zt(t)});class cl extends Qt{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)!==it.bigint){const o=this._getOrReturnCtx(e);return Xe(o,{code:Re.invalid_type,expected:it.bigint,received:o.parsedType}),kt}let r;const i=new ai;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),Xe(r,{code:Re.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),Xe(r,{code:Re.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):an.assertNever(o);return{status:i.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,wt.toString(n))}gt(e,n){return this.setLimit("min",e,!1,wt.toString(n))}lte(e,n){return this.setLimit("max",e,!0,wt.toString(n))}lt(e,n){return this.setLimit("max",e,!1,wt.toString(n))}setLimit(e,n,r,i){return new cl({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:wt.toString(i)}]})}_addCheck(e){return new cl({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:wt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:wt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:wt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:wt.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:wt.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 cl({checks:[],typeName:Et.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1,...zt(t)})};class Cm extends Qt{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==it.boolean){const r=this._getOrReturnCtx(e);return Xe(r,{code:Re.invalid_type,expected:it.boolean,received:r.parsedType}),kt}return wi(e.data)}}Cm.create=t=>new Cm({typeName:Et.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...zt(t)});class Su extends Qt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==it.date){const o=this._getOrReturnCtx(e);return Xe(o,{code:Re.invalid_type,expected:it.date,received:o.parsedType}),kt}if(isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return Xe(o,{code:Re.invalid_date}),kt}const r=new ai;let i;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(i=this._getOrReturnCtx(e,i),Xe(i,{code:Re.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):an.assertNever(o);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Su({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:wt.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:wt.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 Su({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Et.ZodDate,...zt(t)});class lb extends Qt{_parse(e){if(this._getType(e)!==it.symbol){const r=this._getOrReturnCtx(e);return Xe(r,{code:Re.invalid_type,expected:it.symbol,received:r.parsedType}),kt}return wi(e.data)}}lb.create=t=>new lb({typeName:Et.ZodSymbol,...zt(t)});class _m extends Qt{_parse(e){if(this._getType(e)!==it.undefined){const r=this._getOrReturnCtx(e);return Xe(r,{code:Re.invalid_type,expected:it.undefined,received:r.parsedType}),kt}return wi(e.data)}}_m.create=t=>new _m({typeName:Et.ZodUndefined,...zt(t)});class Am extends Qt{_parse(e){if(this._getType(e)!==it.null){const r=this._getOrReturnCtx(e);return Xe(r,{code:Re.invalid_type,expected:it.null,received:r.parsedType}),kt}return wi(e.data)}}Am.create=t=>new Am({typeName:Et.ZodNull,...zt(t)});class uf extends Qt{constructor(){super(...arguments),this._any=!0}_parse(e){return wi(e.data)}}uf.create=t=>new uf({typeName:Et.ZodAny,...zt(t)});class ou extends Qt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return wi(e.data)}}ou.create=t=>new ou({typeName:Et.ZodUnknown,...zt(t)});class qa extends Qt{_parse(e){const n=this._getOrReturnCtx(e);return Xe(n,{code:Re.invalid_type,expected:it.never,received:n.parsedType}),kt}}qa.create=t=>new qa({typeName:Et.ZodNever,...zt(t)});class ub extends Qt{_parse(e){if(this._getType(e)!==it.undefined){const r=this._getOrReturnCtx(e);return Xe(r,{code:Re.invalid_type,expected:it.void,received:r.parsedType}),kt}return wi(e.data)}}ub.create=t=>new ub({typeName:Et.ZodVoid,...zt(t)});class cs extends Qt{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),i=this._def;if(n.parsedType!==it.array)return Xe(n,{code:Re.invalid_type,expected:it.array,received:n.parsedType}),kt;if(i.exactLength!==null){const s=n.data.length>i.exactLength.value,c=n.data.lengthi.maxLength.value&&(Xe(n,{code:Re.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 ra(n,s,n.path,c)))).then(s=>ai.mergeArray(r,s));const o=[...n.data].map((s,c)=>i.type._parseSync(new ra(n,s,n.path,c)));return ai.mergeArray(r,o)}get element(){return this._def.type}min(e,n){return new cs({...this._def,minLength:{value:e,message:wt.toString(n)}})}max(e,n){return new cs({...this._def,maxLength:{value:e,message:wt.toString(n)}})}length(e,n){return new cs({...this._def,exactLength:{value:e,message:wt.toString(n)}})}nonempty(e){return this.min(1,e)}}cs.create=(t,e)=>new cs({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Et.ZodArray,...zt(e)});function rd(t){if(t instanceof qn){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=Ks.create(rd(r))}return new qn({...t._def,shape:()=>e})}else return t instanceof cs?new cs({...t._def,type:rd(t.element)}):t instanceof Ks?Ks.create(rd(t.unwrap())):t instanceof ul?ul.create(rd(t.unwrap())):t instanceof ia?ia.create(t.items.map(e=>rd(e))):t}class qn extends Qt{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=an.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==it.object){const u=this._getOrReturnCtx(e);return Xe(u,{code:Re.invalid_type,expected:it.object,received:u.parsedType}),kt}const{status:r,ctx:i}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof qa&&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 ra(i,f,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof qa){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&&(Xe(i,{code:Re.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 ra(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=>ai.mergeObjectSync(r,u)):ai.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return wt.errToObj,new qn({...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=wt.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new qn({...this._def,unknownKeys:"strip"})}passthrough(){return new qn({...this._def,unknownKeys:"passthrough"})}extend(e){return new qn({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new qn({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Et.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new qn({...this._def,catchall:e})}pick(e){const n={};return an.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new qn({...this._def,shape:()=>n})}omit(e){const n={};return an.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new qn({...this._def,shape:()=>n})}deepPartial(){return rd(this)}partial(e){const n={};return an.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];e&&!e[r]?n[r]=i:n[r]=i.optional()}),new qn({...this._def,shape:()=>n})}required(e){const n={};return an.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof Ks;)o=o._def.innerType;n[r]=o}}),new qn({...this._def,shape:()=>n})}keyof(){return H6(an.objectKeys(this.shape))}}qn.create=(t,e)=>new qn({shape:()=>t,unknownKeys:"strip",catchall:qa.create(),typeName:Et.ZodObject,...zt(e)});qn.strictCreate=(t,e)=>new qn({shape:()=>t,unknownKeys:"strict",catchall:qa.create(),typeName:Et.ZodObject,...zt(e)});qn.lazycreate=(t,e)=>new qn({shape:t,unknownKeys:"strip",catchall:qa.create(),typeName:Et.ZodObject,...zt(e)});class jm extends Qt{_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 io(c.ctx.common.issues));return Xe(n,{code:Re.invalid_union,unionErrors:s}),kt}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 io(l));return Xe(n,{code:Re.invalid_union,unionErrors:c}),kt}}get options(){return this._def.options}}jm.create=(t,e)=>new jm({options:t,typeName:Et.ZodUnion,...zt(e)});const ya=t=>t instanceof Tm?ya(t.schema):t instanceof xs?ya(t.innerType()):t instanceof km?[t.value]:t instanceof ll?t.options:t instanceof Pm?an.objectValues(t.enum):t instanceof Om?ya(t._def.innerType):t instanceof _m?[void 0]:t instanceof Am?[null]:t instanceof Ks?[void 0,...ya(t.unwrap())]:t instanceof ul?[null,...ya(t.unwrap())]:t instanceof ik||t instanceof Rm?ya(t.unwrap()):t instanceof Im?ya(t._def.innerType):[];class Pw extends Qt{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==it.object)return Xe(n,{code:Re.invalid_type,expected:it.object,received:n.parsedType}),kt;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}):(Xe(n,{code:Re.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),kt)}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=ya(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 Pw({typeName:Et.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:i,...zt(r)})}}function d1(t,e){const n=Sc(t),r=Sc(e);if(t===e)return{valid:!0,data:t};if(n===it.object&&r===it.object){const i=an.objectKeys(e),o=an.objectKeys(t).filter(c=>i.indexOf(c)!==-1),s={...t,...e};for(const c of o){const l=d1(t[c],e[c]);if(!l.valid)return{valid:!1};s[c]=l.data}return{valid:!0,data:s}}else if(n===it.array&&r===it.array){if(t.length!==e.length)return{valid:!1};const i=[];for(let o=0;o{if(l1(o)||l1(s))return kt;const c=d1(o.value,s.value);return c.valid?((u1(o)||u1(s))&&n.dirty(),{status:n.value,value:c.data}):(Xe(r,{code:Re.invalid_intersection_types}),kt)};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}))}}Em.create=(t,e,n)=>new Em({left:t,right:e,typeName:Et.ZodIntersection,...zt(n)});class ia extends Qt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.array)return Xe(r,{code:Re.invalid_type,expected:it.array,received:r.parsedType}),kt;if(r.data.lengththis._def.items.length&&(Xe(r,{code:Re.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 ra(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>ai.mergeArray(n,s)):ai.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new ia({...this._def,rest:e})}}ia.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ia({items:t,typeName:Et.ZodTuple,rest:null,...zt(e)})};class Nm extends Qt{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!==it.object)return Xe(r,{code:Re.invalid_type,expected:it.object,received:r.parsedType}),kt;const i=[],o=this._def.keyType,s=this._def.valueType;for(const c in r.data)i.push({key:o._parse(new ra(r,c,r.path,c)),value:s._parse(new ra(r,r.data[c],r.path,c)),alwaysSet:c in r.data});return r.common.async?ai.mergeObjectAsync(n,i):ai.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof Qt?new Nm({keyType:e,valueType:n,typeName:Et.ZodRecord,...zt(r)}):new Nm({keyType:rs.create(),valueType:e,typeName:Et.ZodRecord,...zt(n)})}}class db extends Qt{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!==it.map)return Xe(r,{code:Re.invalid_type,expected:it.map,received:r.parsedType}),kt;const i=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([c,l],u)=>({key:i._parse(new ra(r,c,r.path,[u,"key"])),value:o._parse(new ra(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 kt;(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 kt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),c.set(u.value,d.value)}return{status:n.value,value:c}}}}db.create=(t,e,n)=>new db({valueType:e,keyType:t,typeName:Et.ZodMap,...zt(n)});class Cu extends Qt{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==it.set)return Xe(r,{code:Re.invalid_type,expected:it.set,received:r.parsedType}),kt;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(Xe(r,{code:Re.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 kt;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 ra(r,l,r.path,u)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,n){return new Cu({...this._def,minSize:{value:e,message:wt.toString(n)}})}max(e,n){return new Cu({...this._def,maxSize:{value:e,message:wt.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Cu.create=(t,e)=>new Cu({valueType:t,minSize:null,maxSize:null,typeName:Et.ZodSet,...zt(e)});class Od extends Qt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==it.function)return Xe(n,{code:Re.invalid_type,expected:it.function,received:n.parsedType}),kt;function r(c,l){return ab({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,sb(),lf].filter(u=>!!u),issueData:{code:Re.invalid_arguments,argumentsError:l}})}function i(c,l){return ab({data:c,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,sb(),lf].filter(u=>!!u),issueData:{code:Re.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},s=n.data;if(this._def.returns instanceof df){const c=this;return wi(async function(...l){const u=new io([]),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 wi(function(...l){const u=c._def.args.safeParse(l,o);if(!u.success)throw new io([r(l,u.error)]);const d=Reflect.apply(s,this,u.data),f=c._def.returns.safeParse(d,o);if(!f.success)throw new io([i(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Od({...this._def,args:ia.create(e).rest(ou.create())})}returns(e){return new Od({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new Od({args:e||ia.create([]).rest(ou.create()),returns:n||ou.create(),typeName:Et.ZodFunction,...zt(r)})}}class Tm extends Qt{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})}}Tm.create=(t,e)=>new Tm({getter:t,typeName:Et.ZodLazy,...zt(e)});class km extends Qt{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Xe(n,{received:n.data,code:Re.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:e.data}}get value(){return this._def.value}}km.create=(t,e)=>new km({value:t,typeName:Et.ZodLiteral,...zt(e)});function H6(t,e){return new ll({values:t,typeName:Et.ZodEnum,...zt(e)})}class ll extends Qt{constructor(){super(...arguments),sp.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Xe(n,{expected:an.joinValues(r),received:n.parsedType,code:Re.invalid_type}),kt}if(cb(this,sp)||F6(this,sp,new Set(this._def.values)),!cb(this,sp).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Xe(n,{received:n.data,code:Re.invalid_enum_value,options:r}),kt}return wi(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 ll.create(e,{...this._def,...n})}exclude(e,n=this._def){return ll.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}sp=new WeakMap;ll.create=H6;class Pm extends Qt{constructor(){super(...arguments),ap.set(this,void 0)}_parse(e){const n=an.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==it.string&&r.parsedType!==it.number){const i=an.objectValues(n);return Xe(r,{expected:an.joinValues(i),received:r.parsedType,code:Re.invalid_type}),kt}if(cb(this,ap)||F6(this,ap,new Set(an.getValidEnumValues(this._def.values))),!cb(this,ap).has(e.data)){const i=an.objectValues(n);return Xe(r,{received:r.data,code:Re.invalid_enum_value,options:i}),kt}return wi(e.data)}get enum(){return this._def.values}}ap=new WeakMap;Pm.create=(t,e)=>new Pm({values:t,typeName:Et.ZodNativeEnum,...zt(e)});class df extends Qt{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==it.promise&&n.common.async===!1)return Xe(n,{code:Re.invalid_type,expected:it.promise,received:n.parsedType}),kt;const r=n.parsedType===it.promise?n.data:Promise.resolve(n.data);return wi(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}df.create=(t,e)=>new df({type:t,typeName:Et.ZodPromise,...zt(e)});class xs extends Qt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Et.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=>{Xe(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 kt;const l=await this._def.schema._parseAsync({data:c,path:r.path,parent:r});return l.status==="aborted"?kt:l.status==="dirty"||n.value==="dirty"?gd(l.value):l});{if(n.value==="aborted")return kt;const c=this._def.schema._parseSync({data:s,path:r.path,parent:r});return c.status==="aborted"?kt:c.status==="dirty"||n.value==="dirty"?gd(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"?kt:(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"?kt:(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(!wm(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=>wm(s)?Promise.resolve(i.transform(s.value,o)).then(c=>({status:n.value,value:c})):s);an.assertNever(i)}}xs.create=(t,e,n)=>new xs({schema:t,typeName:Et.ZodEffects,effect:e,...zt(n)});xs.createWithPreprocess=(t,e,n)=>new xs({schema:e,effect:{type:"preprocess",transform:t},typeName:Et.ZodEffects,...zt(n)});class Ks extends Qt{_parse(e){return this._getType(e)===it.undefined?wi(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ks.create=(t,e)=>new Ks({innerType:t,typeName:Et.ZodOptional,...zt(e)});class ul extends Qt{_parse(e){return this._getType(e)===it.null?wi(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ul.create=(t,e)=>new ul({innerType:t,typeName:Et.ZodNullable,...zt(e)});class Om extends Qt{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===it.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Om.create=(t,e)=>new Om({innerType:t,typeName:Et.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...zt(e)});class Im extends Qt{_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 Sm(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new io(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new io(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Im.create=(t,e)=>new Im({innerType:t,typeName:Et.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...zt(e)});class fb extends Qt{_parse(e){if(this._getType(e)!==it.nan){const r=this._getOrReturnCtx(e);return Xe(r,{code:Re.invalid_type,expected:it.nan,received:r.parsedType}),kt}return{status:"valid",value:e.data}}}fb.create=t=>new fb({typeName:Et.ZodNaN,...zt(t)});const Vae=Symbol("zod_brand");class ik extends Qt{_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 Gg extends Qt{_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"?kt:o.status==="dirty"?(n.dirty(),gd(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"?kt: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 Gg({in:e,out:n,typeName:Et.ZodPipeline})}}class Rm extends Qt{_parse(e){const n=this._def.innerType._parse(e),r=i=>(wm(i)&&(i.value=Object.freeze(i.value)),i);return Sm(n)?n.then(i=>r(i)):r(n)}unwrap(){return this._def.innerType}}Rm.create=(t,e)=>new Rm({innerType:t,typeName:Et.ZodReadonly,...zt(e)});function V6(t,e={},n){return t?uf.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})}}):uf.create()}const Gae={object:qn.lazycreate};var Et;(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"})(Et||(Et={}));const Kae=(t,e={message:`Input not instance of ${t.name}`})=>V6(n=>n instanceof t,e),G6=rs.create,K6=al.create,Wae=fb.create,qae=cl.create,W6=Cm.create,Yae=Su.create,Qae=lb.create,Xae=_m.create,Jae=Am.create,Zae=uf.create,ece=ou.create,tce=qa.create,nce=ub.create,rce=cs.create,ice=qn.create,oce=qn.strictCreate,sce=jm.create,ace=Pw.create,cce=Em.create,lce=ia.create,uce=Nm.create,dce=db.create,fce=Cu.create,hce=Od.create,pce=Tm.create,mce=km.create,gce=ll.create,vce=Pm.create,yce=df.create,w2=xs.create,xce=Ks.create,bce=ul.create,wce=xs.createWithPreprocess,Sce=Gg.create,Cce=()=>G6().optional(),_ce=()=>K6().optional(),Ace=()=>W6().optional(),jce={string:t=>rs.create({...t,coerce:!0}),number:t=>al.create({...t,coerce:!0}),boolean:t=>Cm.create({...t,coerce:!0}),bigint:t=>cl.create({...t,coerce:!0}),date:t=>Su.create({...t,coerce:!0})},Ece=kt;var $e=Object.freeze({__proto__:null,defaultErrorMap:lf,setErrorMap:Eae,getErrorMap:sb,makeIssue:ab,EMPTY_PATH:Nae,addIssueToContext:Xe,ParseStatus:ai,INVALID:kt,DIRTY:gd,OK:wi,isAborted:l1,isDirty:u1,isValid:wm,isAsync:Sm,get util(){return an},get objectUtil(){return c1},ZodParsedType:it,getParsedType:Sc,ZodType:Qt,datetimeRegex:z6,ZodString:rs,ZodNumber:al,ZodBigInt:cl,ZodBoolean:Cm,ZodDate:Su,ZodSymbol:lb,ZodUndefined:_m,ZodNull:Am,ZodAny:uf,ZodUnknown:ou,ZodNever:qa,ZodVoid:ub,ZodArray:cs,ZodObject:qn,ZodUnion:jm,ZodDiscriminatedUnion:Pw,ZodIntersection:Em,ZodTuple:ia,ZodRecord:Nm,ZodMap:db,ZodSet:Cu,ZodFunction:Od,ZodLazy:Tm,ZodLiteral:km,ZodEnum:ll,ZodNativeEnum:Pm,ZodPromise:df,ZodEffects:xs,ZodTransformer:xs,ZodOptional:Ks,ZodNullable:ul,ZodDefault:Om,ZodCatch:Im,ZodNaN:fb,BRAND:Vae,ZodBranded:ik,ZodPipeline:Gg,ZodReadonly:Rm,custom:V6,Schema:Qt,ZodSchema:Qt,late:Gae,get ZodFirstPartyTypeKind(){return Et},coerce:jce,any:Zae,array:rce,bigint:qae,boolean:W6,date:Yae,discriminatedUnion:ace,effect:w2,enum:gce,function:hce,instanceof:Kae,intersection:cce,lazy:pce,literal:mce,map:dce,nan:Wae,nativeEnum:vce,never:tce,null:Jae,nullable:bce,number:K6,object:ice,oboolean:Ace,onumber:_ce,optional:xce,ostring:Cce,pipeline:Sce,preprocess:wce,promise:yce,record:uce,set:fce,strictObject:oce,string:G6,symbol:Qae,transformer:w2,tuple:lce,undefined:Xae,union:sce,unknown:ece,void:nce,NEVER:Ece,ZodIssueCode:Re,quotelessJson:jae,ZodError:io});const yt=g.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Fe("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));yt.displayName="Card";const Ei=g.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Fe("flex flex-col space-y-1.5 p-6",t),...e}));Ei.displayName="CardHeader";const Qi=g.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:Fe("text-2xl font-semibold leading-none tracking-tight",t),...e}));Qi.displayName="CardTitle";const ok=g.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:Fe("text-sm text-muted-foreground",t),...e}));ok.displayName="CardDescription";const Rt=g.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Fe("p-6 pt-0",t),...e}));Rt.displayName="CardContent";const sk=g.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:Fe("flex items-center p-6 pt-0",t),...e}));sk.displayName="CardFooter";const Kt=g.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:Fe("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}));Kt.displayName="Input";const Nce=YT("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 $n({className:t,variant:e,...n}){return a.jsx("div",{className:Fe(Nce({variant:e}),t),...n})}function q6({onAssetsChange:t,onUploadComplete:e,onUploadError:n,onFilesChange:r,focusGroupId:i,disabled:o=!1,maxAssets:s=10,allowedTypes:c=["image/*","application/pdf","video/*"],label:l="Upload Assets",description:u="Upload creative assets for testing",maxFileSize:d=10,enableRenaming:f=!0}){const[h,p]=g.useState([]),[v,m]=g.useState([]),[y,b]=g.useState(null),[x,w]=g.useState(""),[S,C]=g.useState(!1),_=g.useRef(null),A=g.useRef(null);g.useEffect(()=>{i&&j()},[i]),g.useEffect(()=>{if(r){const U=h.map(de=>de.file);r(U)}},[h,r]);const j=async()=>{if(i)try{const de=(await St.getAssets(i)).data.assets||[];m(de),t&&t(de)}catch(U){console.error("Error fetching backend assets:",U)}},T=U=>{if(!c.some(ne=>{if(ne.includes("*")){const je=ne.split("/")[0];return U.type.startsWith(je+"/")}return U.type===ne}))return`File "${U.name}" is not a supported file type. Supported types: ${k().join(", ")}.`;const se=d*1024*1024;return U.size>se?`File "${U.name}" is too large. Maximum file size: ${d}MB.`:null},k=()=>{const U={"image/*":"Images","application/pdf":"PDF","video/*":"Videos","text/*":"Text files","application/msword":"Word docs","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"Word docs","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"Excel files"};return c.map(de=>U[de]||de).filter((de,se,ne)=>ne.indexOf(de)===se)},O=async U=>{if(!U||U.length===0)return;if(h.length+v.length+U.length>s){ae.error(`You can only upload up to ${s} assets`);return}const se=[],ne=[];if(Array.from(U).forEach(K=>{const et=T(K);et?ne.push(et):se.push(K)}),ne.length>0&&(ne.forEach(K=>ae.error(K)),se.length===0))return;const je=se.map(K=>{const et=K.type.startsWith("image/")?URL.createObjectURL(K):void 0;return{id:`local-${Date.now()}-${Math.random().toString(36).substr(2,9)}`,file:K,previewUrl:et,status:"uploading",progress:0}});p(K=>[...K,...je]);for(const K of je){if(!i){p(Me=>Me.map(ut=>ut.id===K.id?{...ut,status:"uploaded",progress:100}:ut));continue}const et=Me=>{p(ut=>ut.map(Ye=>Ye.id===K.id?{...Ye,progress:Me}:Ye))};try{et(10);const Me=new FormData;if(Me.append("assets",K.file),et(50),(await St.uploadAssets(i,Me,!1)).data.uploaded_assets>0)et(100),setTimeout(()=>{p(Pt=>Pt.filter(F=>F.id!==K.id))},500),await j(),ae.success(`${K.file.name} uploaded successfully`);else throw new Error("Upload failed")}catch(Me){console.error(`Upload failed for ${K.file.name}:`,Me),p(ut=>ut.map(Ye=>{var Pt,F;return Ye.id===K.id?{...Ye,status:"failed",progress:0,error:((F=(Pt=Me.response)==null?void 0:Pt.data)==null?void 0:F.error)||"Upload failed"}:Ye})),n&&n(Me)}}e&&setTimeout(()=>{e(v)},500)},E=async U=>{if(i)try{await St.deleteAsset(i,U),await j(),ae.info("Asset removed")}catch(de){console.error("Error removing asset:",de),ae.error("Failed to remove asset")}},R=U=>{const de=h.find(se=>se.id===U);de!=null&&de.previewUrl&&URL.revokeObjectURL(de.previewUrl),p(se=>se.filter(ne=>ne.id!==U))},D=U=>{U.preventDefault(),U.stopPropagation(),C(!0)},V=U=>{var de;U.preventDefault(),U.stopPropagation(),(de=A.current)!=null&&de.contains(U.relatedTarget)||C(!1)},L=U=>{U.preventDefault(),U.stopPropagation()},z=U=>{if(U.preventDefault(),U.stopPropagation(),C(!1),o)return;const de=U.dataTransfer.files;de.length>0&&O(de)},M=()=>{h.length===0&&v.length===0||(h.forEach(U=>{U.previewUrl&&URL.revokeObjectURL(U.previewUrl)}),p([]),i&&v.length>0?Promise.all(v.map(U=>St.deleteAsset(i,U.filename).catch(console.error))).then(()=>{m([]),t&&t([]),ae.info("All assets cleared")}):(m([]),t&&t([])))},$=async U=>{if(i){p(de=>de.map(se=>se.id===U.id?{...se,status:"uploading",error:void 0,progress:0}:se));try{const de=new FormData;if(de.append("assets",U.file),p(je=>je.map(K=>K.id===U.id?{...K,progress:50}:K)),(await St.uploadAssets(i,de,!1)).data.uploaded_assets>0)p(je=>je.map(K=>K.id===U.id?{...K,progress:100}:K)),setTimeout(()=>{p(je=>je.filter(K=>K.id!==U.id))},500),await j(),ae.success(`${U.file.name} uploaded successfully`);else throw new Error("Upload failed")}catch(de){p(se=>se.map(ne=>{var je,K;return ne.id===U.id?{...ne,status:"failed",progress:0,error:((K=(je=de.response)==null?void 0:je.data)==null?void 0:K.error)||"Upload failed"}:ne})),ae.error(`Failed to upload ${U.file.name}`)}}},Q=U=>{b(U.filename),w(U.user_assigned_name||"")},q=async U=>{if(!i||!x.trim()){te();return}try{await St.updateAssetName(i,U,x.trim()),m(de=>de.map(se=>se.filename===U?{...se,user_assigned_name:x.trim()}:se)),t&&t(v),b(null),w(""),ae.success("Asset name updated")}catch(de){console.error("Error updating asset name:",de),ae.error("Failed to update asset name")}},te=()=>{b(null),w("")},xe=U=>U.startsWith("image/")?a.jsx(Sp,{className:"h-8 w-8 text-slate-400"}):U.startsWith("video/")?a.jsx(Hee,{className:"h-8 w-8 text-slate-400"}):U==="application/pdf"?a.jsx(sf,{className:"h-8 w-8 text-slate-400"}):a.jsx(sf,{className:"h-8 w-8 text-slate-400"}),B=(U,de)=>U.user_assigned_name||`Asset ${de+1}`,ce=h.length+v.length,he=s-ce;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h3",{className:"text-lg font-semibold text-foreground",children:l}),a.jsx("p",{className:"text-muted-foreground mt-1",children:u})]}),a.jsx("div",{ref:A,className:`relative border-2 border-dashed rounded-xl p-8 transition-all duration-200 ${o?"border-muted-foreground/20 bg-muted/30 cursor-not-allowed":S?"border-primary bg-primary/5 scale-[1.02]":"border-muted-foreground/30 bg-background hover:border-primary/50 hover:bg-muted/50 cursor-pointer"}`,onDragEnter:D,onDragLeave:V,onDragOver:L,onDrop:z,onClick:()=>{var U;return!o&&((U=_.current)==null?void 0:U.click())},children:a.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[a.jsx(Bee,{className:`h-12 w-12 mb-4 ${o?"text-muted-foreground/40":S?"text-primary":"text-muted-foreground"}`}),o?a.jsxs("div",{children:[a.jsx("p",{className:"text-lg font-medium text-muted-foreground mb-2",children:"File Upload Disabled"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Complete the required details above to enable file uploads"})]}):a.jsxs("div",{children:[a.jsx("p",{className:"text-lg font-medium text-foreground mb-2",children:S?"Drop files here":"Drag and drop files here, or click to browse"}),a.jsx("div",{className:"flex flex-wrap justify-center gap-2 mb-4",children:k().map((U,de)=>a.jsx($n,{variant:"secondary",className:"text-xs",children:U},de))}),a.jsxs("p",{className:"text-sm text-muted-foreground mb-4",children:["Maximum file size: ",d,"MB"]}),a.jsx("input",{ref:_,type:"file",accept:c.join(","),multiple:!0,onChange:U=>O(U.target.files),className:"hidden",disabled:o}),a.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-center gap-3",children:[a.jsxs(ie,{type:"button",variant:"default",size:"sm",disabled:o||he<=0,onClick:U=>{var de;U.stopPropagation(),(de=_.current)==null||de.click()},children:[a.jsx(ute,{className:"mr-2 h-4 w-4"}),"Select Files"]}),(h.length>0||v.length>0)&&a.jsxs(ie,{type:"button",variant:"outline",size:"sm",onClick:U=>{U.stopPropagation(),M()},children:[a.jsx(Qn,{className:"mr-2 h-4 w-4"}),"Clear All"]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-3",children:[he," of ",s," uploads remaining"]})]})]})})]}),(v.length>0||h.length>0)&&a.jsxs(yt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("h4",{className:"text-lg font-semibold text-foreground",children:["Uploaded Files (",h.length+v.length,")"]}),(h.length>0||v.length>0)&&a.jsxs(ie,{type:"button",variant:"ghost",size:"sm",onClick:M,className:"text-muted-foreground hover:text-destructive",children:[a.jsx(Qn,{className:"mr-2 h-4 w-4"}),"Clear All"]})]}),a.jsxs("div",{className:"space-y-3",children:[v.map((U,de)=>{var se;return a.jsxs("div",{className:"flex items-center gap-4 p-4 border rounded-lg bg-card shadow-sm",children:[a.jsx("div",{className:"w-12 h-12 bg-muted/50 rounded-md flex items-center justify-center flex-shrink-0",children:(se=U.mime_type)!=null&&se.startsWith("image/")?a.jsx("img",{src:St.getAssetUrl(i,U.filename),alt:B(U,de),className:"max-h-full max-w-full object-contain rounded-md"}):xe(U.mime_type)}),a.jsx("div",{className:"flex-grow min-w-0",children:f&&y===U.filename?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Kt,{value:x,onChange:ne=>w(ne.target.value),placeholder:`Asset ${de+1}`,className:"flex-1",autoFocus:!0,onKeyDown:ne=>{ne.key==="Enter"?(ne.preventDefault(),q(U.filename)):ne.key==="Escape"&&te()}}),a.jsx(ie,{size:"sm",variant:"outline",type:"button",onClick:()=>q(U.filename),children:a.jsx(Io,{className:"h-4 w-4"})}),a.jsx(ie,{size:"sm",variant:"outline",type:"button",onClick:te,children:a.jsx(Mi,{className:"h-4 w-4"})})]}):a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"font-medium text-sm truncate",children:B(U,de)}),f&&a.jsx(ie,{size:"sm",variant:"ghost",type:"button",onClick:()=>Q(U),className:"h-6 w-6 p-0",children:a.jsx($A,{className:"h-3 w-3"})})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["Original: ",U.original_name]}),a.jsx($n,{variant:"outline",className:"text-xs text-green-600 bg-green-50 border-green-200",children:"Complete"})]})]})}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[f&&a.jsxs("div",{className:"text-right mr-2",children:[a.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Will appear as:"}),a.jsxs("div",{className:"text-sm font-medium text-primary",children:['"',B(U,de),'"']})]}),a.jsx(ie,{size:"sm",variant:"ghost",type:"button",onClick:()=>E(U.filename),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:a.jsx(Mi,{className:"h-4 w-4"})})]})]},U.filename)}),h.map(U=>a.jsxs("div",{className:"flex items-center gap-4 p-4 border rounded-lg bg-muted/30",children:[a.jsx("div",{className:"w-12 h-12 bg-muted/50 rounded-md flex items-center justify-center flex-shrink-0",children:U.previewUrl?a.jsx("img",{src:U.previewUrl,alt:U.file.name,className:"max-h-full max-w-full object-contain rounded-md"}):xe(U.file.type)}),a.jsxs("div",{className:"flex-grow min-w-0",children:[a.jsx("p",{className:"font-medium text-sm truncate",children:U.file.name}),a.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:[(U.file.size/1024/1024).toFixed(2)," MB"]}),U.status==="uploading"&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(Ic,{value:U.progress||0,className:"h-2"}),a.jsxs("div",{className:"flex justify-between items-center text-xs text-muted-foreground",children:[a.jsx("span",{children:"Uploading..."}),a.jsxs("span",{children:[U.progress||0,"%"]})]})]}),U.error&&a.jsx("p",{className:"text-xs text-destructive truncate mt-1",children:U.error})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[U.status==="uploading"&&a.jsx("div",{className:"flex items-center gap-2",children:a.jsxs($n,{variant:"outline",className:"text-xs text-blue-600 bg-blue-50 border-blue-200",children:[a.jsx(no,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading"]})}),U.status==="uploaded"&&a.jsxs($n,{variant:"outline",className:"text-xs text-green-600 bg-green-50 border-green-200",children:[a.jsx(Io,{className:"h-3 w-3 mr-1"}),"Complete"]}),U.status==="failed"&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx($n,{variant:"outline",className:"text-xs text-destructive bg-destructive/10 border-destructive/20",children:"Failed"}),a.jsxs(ie,{size:"sm",variant:"outline",type:"button",onClick:()=>$(U),className:"h-7 text-xs",children:[a.jsx(ru,{className:"h-3 w-3 mr-1"}),"Retry"]})]}),a.jsx(ie,{size:"sm",variant:"ghost",type:"button",onClick:()=>R(U.id),className:"h-8 w-8 p-0 text-muted-foreground hover:text-destructive",children:a.jsx(Mi,{className:"h-4 w-4"})})]})]},U.id))]}),f&&v.length>0&&a.jsx("div",{className:"mt-6 p-4 bg-primary/5 border border-primary/20 rounded-lg",children:a.jsxs("p",{className:"text-sm text-foreground",children:[a.jsx("strong",{children:"Asset Names:"})," Click the edit icon to customize how assets will be referenced in the discussion guide. Leave blank to use default numbering."]})})]})]})}var Tce="Label",Y6=g.forwardRef((t,e)=>a.jsx(ht.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())}}));Y6.displayName=Tce;var Q6=Y6;const kce=YT("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),yo=g.forwardRef(({className:t,...e},n)=>a.jsx(Q6,{ref:n,className:Fe(kce(),t),...e}));yo.displayName=Q6.displayName;const Kg=aae,X6=g.createContext({}),xt=({...t})=>a.jsx(X6.Provider,{value:{name:t.name},children:a.jsx(dae,{...t})}),Ow=()=>{const t=g.useContext(X6),e=g.useContext(J6),{getFieldState:n,formState:r}=kw(),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}},J6=g.createContext({}),pt=g.forwardRef(({className:t,...e},n)=>{const r=g.useId();return a.jsx(J6.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Fe("space-y-2",t),...e})})});pt.displayName="FormItem";const mt=g.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:i}=Ow();return a.jsx(yo,{ref:n,className:Fe(r&&"text-destructive",t),htmlFor:i,...e})});mt.displayName="FormLabel";const gt=g.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:i,formMessageId:o}=Ow();return a.jsx(ea,{ref:e,id:r,"aria-describedby":n?`${i} ${o}`:`${i}`,"aria-invalid":!!n,...t})});gt.displayName="FormControl";const Sn=g.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=Ow();return a.jsx("p",{ref:n,id:r,className:Fe("text-sm text-muted-foreground",t),...e})});Sn.displayName="FormDescription";const vt=g.forwardRef(({className:t,children:e,...n},r)=>{const{error:i,formMessageId:o}=Ow(),s=i?String(i==null?void 0:i.message):e;return s?a.jsx("p",{ref:r,id:o,className:Fe("text-sm font-medium text-destructive",t),...n,children:s}):null});vt.displayName="FormMessage";const bt=g.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:Fe("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}));bt.displayName="Textarea";function Mm(t,[e,n]){return Math.min(n,Math.max(e,t))}function Pce(t,e=[]){let n=[];function r(o,s){const c=g.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...v}=f,m=(h==null?void 0:h[t][l])||c,y=g.useMemo(()=>v,Object.values(v));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,v=g.useContext(p);if(v)return v;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=>g.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return g.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Oce(i,...e)]}function Oce(...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 g.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}function Iw(t){const e=t+"CollectionProvider",[n,r]=Pce(e),[i,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:v,children:m}=p,y=N.useRef(null),b=N.useRef(new Map).current;return a.jsx(i,{scope:v,itemMap:b,collectionRef:y,children:m})};s.displayName=e;const c=t+"CollectionSlot",l=N.forwardRef((p,v)=>{const{scope:m,children:y}=p,b=o(c,m),x=It(v,b.collectionRef);return a.jsx(ea,{ref:x,children:y})});l.displayName=c;const u=t+"CollectionItemSlot",d="data-radix-collection-item",f=N.forwardRef((p,v)=>{const{scope:m,children:y,...b}=p,x=N.useRef(null),w=It(v,x),S=o(u,m);return N.useEffect(()=>(S.itemMap.set(x,{ref:x,...b}),()=>void S.itemMap.delete(x))),a.jsx(ea,{[d]:"",ref:w,children:y})});f.displayName=u;function h(p){const v=o(t+"CollectionConsumer",p);return N.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((S,C)=>b.indexOf(S.ref.current)-b.indexOf(C.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},h,r]}var Ice=g.createContext(void 0);function Mu(t){const e=g.useContext(Ice);return t||e||"ltr"}var DC=0;function ak(){g.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??S2()),document.body.insertAdjacentElement("beforeend",t[1]??S2()),DC++,()=>{DC===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),DC--}},[])}function S2(){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 $C="focusScope.autoFocusOnMount",LC="focusScope.autoFocusOnUnmount",C2={bubbles:!1,cancelable:!0},Rce="FocusScope",Rw=g.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:o,...s}=t,[c,l]=g.useState(null),u=Ar(i),d=Ar(o),f=g.useRef(null),h=It(e,m=>l(m)),p=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(r){let m=function(w){if(p.paused||!c)return;const S=w.target;c.contains(S)?f.current=S:dc(f.current,{select:!0})},y=function(w){if(p.paused||!c)return;const S=w.relatedTarget;S!==null&&(c.contains(S)||dc(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const C of w)C.removedNodes.length>0&&dc(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]),g.useEffect(()=>{if(c){A2.add(p);const m=document.activeElement;if(!c.contains(m)){const b=new CustomEvent($C,C2);c.addEventListener($C,u),c.dispatchEvent(b),b.defaultPrevented||(Mce(Bce(Z6(c)),{select:!0}),document.activeElement===m&&dc(c))}return()=>{c.removeEventListener($C,u),setTimeout(()=>{const b=new CustomEvent(LC,C2);c.addEventListener(LC,d),c.dispatchEvent(b),b.defaultPrevented||dc(m??document.body,{select:!0}),c.removeEventListener(LC,d),A2.remove(p)},0)}}},[c,u,d,p]);const v=g.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]=Dce(x);w&&S?!m.shiftKey&&b===S?(m.preventDefault(),n&&dc(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&dc(S,{select:!0})):b===x&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(ht.div,{tabIndex:-1,...s,ref:h,onKeyDown:v})});Rw.displayName=Rce;function Mce(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(dc(r,{select:e}),document.activeElement!==n)return}function Dce(t){const e=Z6(t),n=_2(e,t),r=_2(e.reverse(),t);return[n,r]}function Z6(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 _2(t,e){for(const n of t)if(!$ce(n,{upTo:e}))return n}function $ce(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 Lce(t){return t instanceof HTMLInputElement&&"select"in t}function dc(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Lce(t)&&e&&t.select()}}var A2=Fce();function Fce(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=j2(t,e),t.unshift(e)},remove(e){var n;t=j2(t,e),(n=t[0])==null||n.resume()}}}function j2(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function Bce(t){return t.filter(e=>e.tagName!=="A")}function Wg(t){const e=g.useRef({value:t,previous:t});return g.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var Uce=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Ku=new WeakMap,Kv=new WeakMap,Wv={},FC=0,ez=function(t){return t&&(t.host||ez(t.parentNode))},zce=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=ez(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})},Hce=function(t,e,n,r){var i=zce(e,Array.isArray(t)?t:[t]);Wv[n]||(Wv[n]=new WeakMap);var o=Wv[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),v=p!==null&&p!=="false",m=(Ku.get(h)||0)+1,y=(o.get(h)||0)+1;Ku.set(h,m),o.set(h,y),s.push(h),m===1&&v&&Kv.set(h,!0),y===1&&h.setAttribute(n,"true"),v||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(e),c.clear(),FC++,function(){s.forEach(function(f){var h=Ku.get(f)-1,p=o.get(f)-1;Ku.set(f,h),o.set(f,p),h||(Kv.has(f)||f.removeAttribute(r),Kv.delete(f)),p||f.removeAttribute(n)}),FC--,FC||(Ku=new WeakMap,Ku=new WeakMap,Kv=new WeakMap,Wv={})}},ck=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=Uce(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),Hce(r,i,n,"aria-hidden")):function(){return null}},Fs=function(){return Fs=Object.assign||function(e){for(var n,r=1,i=arguments.length;r"u")return sle;var e=ale(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])}},lle=iz(),Id="data-scroll-locked",ule=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(Gce,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(c,"px ").concat(r,`; - } - body[`).concat(Id,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(i,`px; - padding-top: `).concat(o,`px; - padding-right: `).concat(s,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(c,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(c,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(By,` { - right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(Uy,` { - margin-right: `).concat(c,"px ").concat(r,`; - } - - .`).concat(By," .").concat(By,` { - right: 0 `).concat(r,`; - } - - .`).concat(Uy," .").concat(Uy,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Id,`] { - `).concat(Kce,": ").concat(c,`px; - } -`)},N2=function(){var t=parseInt(document.body.getAttribute(Id)||"0",10);return isFinite(t)?t:0},dle=function(){g.useEffect(function(){return document.body.setAttribute(Id,(N2()+1).toString()),function(){var t=N2()-1;t<=0?document.body.removeAttribute(Id):document.body.setAttribute(Id,t.toString())}},[])},fle=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,i=r===void 0?"margin":r;dle();var o=g.useMemo(function(){return cle(i)},[i]);return g.createElement(lle,{styles:ule(o,!e,i,n?"":"!important")})},f1=!1;if(typeof window<"u")try{var qv=Object.defineProperty({},"passive",{get:function(){return f1=!0,!0}});window.addEventListener("test",qv,qv),window.removeEventListener("test",qv,qv)}catch{f1=!1}var Wu=f1?{passive:!1}:!1,hle=function(t){return t.tagName==="TEXTAREA"},oz=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!hle(t)&&n[e]==="visible")},ple=function(t){return oz(t,"overflowY")},mle=function(t){return oz(t,"overflowX")},T2=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var i=sz(t,r);if(i){var o=az(t,r),s=o[1],c=o[2];if(s>c)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},gle=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},vle=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},sz=function(t,e){return t==="v"?ple(e):mle(e)},az=function(t,e){return t==="v"?gle(e):vle(e)},yle=function(t,e){return t==="h"&&e==="rtl"?-1:1},xle=function(t,e,n,r,i){var o=yle(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=az(t,c),v=p[0],m=p[1],y=p[2],b=m-y-o*v;(v||b)&&sz(t,c)&&(f+=b,h+=v),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},Yv=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},k2=function(t){return[t.deltaX,t.deltaY]},P2=function(t){return t&&"current"in t?t.current:t},ble=function(t,e){return t[0]===e[0]&&t[1]===e[1]},wle=function(t){return` - .block-interactivity-`.concat(t,` {pointer-events: none;} - .allow-interactivity-`).concat(t,` {pointer-events: all;} -`)},Sle=0,qu=[];function Cle(t){var e=g.useRef([]),n=g.useRef([0,0]),r=g.useRef(),i=g.useState(Sle++)[0],o=g.useState(iz)[0],s=g.useRef(t);g.useEffect(function(){s.current=t},[t]),g.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var m=Vce([t.lockRef.current],(t.shards||[]).map(P2),!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=g.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var b=Yv(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=T2(A,_);if(!j)return!0;if(j?C=A:(C=A==="v"?"h":"v",j=T2(A,_)),!j)return!1;if(!r.current&&"changedTouches"in m&&(w||S)&&(r.current=C),!C)return!0;var T=r.current||C;return xle(T,y,m,T==="h"?w:S,!0)},[]),l=g.useCallback(function(m){var y=m;if(!(!qu.length||qu[qu.length-1]!==o)){var b="deltaY"in y?k2(y):Yv(y),x=e.current.filter(function(C){return C.name===y.type&&(C.target===y.target||y.target===C.shadowParent)&&ble(C.delta,b)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var w=(s.current.shards||[]).map(P2).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=g.useCallback(function(m,y,b,x){var w={name:m,delta:y,target:b,should:x,shadowParent:_le(b)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(S){return S!==w})},1)},[]),d=g.useCallback(function(m){n.current=Yv(m),r.current=void 0},[]),f=g.useCallback(function(m){u(m.type,k2(m),m.target,c(m,t.lockRef.current))},[]),h=g.useCallback(function(m){u(m.type,Yv(m),m.target,c(m,t.lockRef.current))},[]);g.useEffect(function(){return qu.push(o),t.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",l,Wu),document.addEventListener("touchmove",l,Wu),document.addEventListener("touchstart",d,Wu),function(){qu=qu.filter(function(m){return m!==o}),document.removeEventListener("wheel",l,Wu),document.removeEventListener("touchmove",l,Wu),document.removeEventListener("touchstart",d,Wu)}},[]);var p=t.removeScrollBar,v=t.inert;return g.createElement(g.Fragment,null,v?g.createElement(o,{styles:wle(i)}):null,p?g.createElement(fle,{gapMode:t.gapMode}):null)}function _le(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const Ale=Zce(rz,Cle);var Dw=g.forwardRef(function(t,e){return g.createElement(Mw,Fs({},t,{ref:e,sideCar:Ale}))});Dw.classNames=Mw.classNames;var jle=[" ","Enter","ArrowUp","ArrowDown"],Ele=[" ","Enter"],qg="Select",[$w,Lw,Nle]=Iw(qg),[th,QBe]=Bi(qg,[Nle,Vf]),Fw=Vf(),[Tle,xl]=th(qg),[kle,Ple]=th(qg),cz=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:v}=t,m=Fw(e),[y,b]=g.useState(null),[x,w]=g.useState(null),[S,C]=g.useState(!1),_=Mu(u),[A=!1,j]=ms({prop:r,defaultProp:i,onChange:o}),[T,k]=ms({prop:s,defaultProp:c,onChange:l}),O=g.useRef(null),E=y?v||!!y.closest("form"):!0,[R,D]=g.useState(new Set),V=Array.from(R).map(L=>L.props.value).join(";");return a.jsx(J5,{...m,children:a.jsxs(Tle,{required:p,scope:e,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:ss(),value:T,onValueChange:k,open:A,onOpenChange:j,dir:_,triggerPointerDownPosRef:O,disabled:h,children:[a.jsx($w.Provider,{scope:e,children:a.jsx(kle,{scope:t.__scopeSelect,onNativeOptionAdd:g.useCallback(L=>{D(z=>new Set(z).add(L))},[]),onNativeOptionRemove:g.useCallback(L=>{D(z=>{const M=new Set(z);return M.delete(L),M})},[]),children:n})}),E?a.jsxs(Iz,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:T,onChange:L=>k(L.target.value),disabled:h,form:v,children:[T===void 0?a.jsx("option",{value:""}):null,Array.from(R)]},V):null]})})};cz.displayName=qg;var lz="SelectTrigger",uz=g.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...i}=t,o=Fw(n),s=xl(lz,n),c=s.disabled||r,l=It(e,s.onTriggerChange),u=Lw(n),d=g.useRef("touch"),[f,h,p]=Rz(m=>{const y=u().filter(w=>!w.disabled),b=y.find(w=>w.value===s.value),x=Mz(y,m,b);x!==void 0&&s.onValueChange(x.value)}),v=m=>{c||(s.onOpenChange(!0),p()),m&&(s.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(xN,{asChild:!0,...o,children:a.jsx(ht.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":Oz(s.value)?"":void 0,...i,ref:l,onClick:Le(i.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&v(m)}),onPointerDown:Le(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"&&(v(m),m.preventDefault())}),onKeyDown:Le(i.onKeyDown,m=>{const y=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(y&&m.key===" ")&&jle.includes(m.key)&&(v(),m.preventDefault())})})})});uz.displayName=lz;var dz="SelectValue",fz=g.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,children:o,placeholder:s="",...c}=t,l=xl(dz,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=It(e,l.onValueNodeChange);return qr(()=>{u(d)},[u,d]),a.jsx(ht.span,{...c,ref:f,style:{pointerEvents:"none"},children:Oz(l.value)?a.jsx(a.Fragment,{children:s}):o})});fz.displayName=dz;var Ole="SelectIcon",hz=g.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...i}=t;return a.jsx(ht.span,{"aria-hidden":!0,...i,ref:e,children:r||"▼"})});hz.displayName=Ole;var Ile="SelectPortal",pz=t=>a.jsx(Z0,{asChild:!0,...t});pz.displayName=Ile;var _u="SelectContent",mz=g.forwardRef((t,e)=>{const n=xl(_u,t.__scopeSelect),[r,i]=g.useState();if(qr(()=>{i(new DocumentFragment)},[]),!n.open){const o=r;return o?es.createPortal(a.jsx(gz,{scope:t.__scopeSelect,children:a.jsx($w.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),o):null}return a.jsx(vz,{...t,ref:e})});mz.displayName=_u;var Ho=10,[gz,bl]=th(_u),Rle="SelectContentImpl",vz=g.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:v,hideWhenDetached:m,avoidCollisions:y,...b}=t,x=xl(_u,n),[w,S]=g.useState(null),[C,_]=g.useState(null),A=It(e,U=>S(U)),[j,T]=g.useState(null),[k,O]=g.useState(null),E=Lw(n),[R,D]=g.useState(!1),V=g.useRef(!1);g.useEffect(()=>{if(w)return ck(w)},[w]),ak();const L=g.useCallback(U=>{const[de,...se]=E().map(K=>K.ref.current),[ne]=se.slice(-1),je=document.activeElement;for(const K of U)if(K===je||(K==null||K.scrollIntoView({block:"nearest"}),K===de&&C&&(C.scrollTop=0),K===ne&&C&&(C.scrollTop=C.scrollHeight),K==null||K.focus(),document.activeElement!==je))return},[E,C]),z=g.useCallback(()=>L([j,w]),[L,j,w]);g.useEffect(()=>{R&&z()},[R,z]);const{onOpenChange:M,triggerPointerDownPosRef:$}=x;g.useEffect(()=>{if(w){let U={x:0,y:0};const de=ne=>{var je,K;U={x:Math.abs(Math.round(ne.pageX)-(((je=$.current)==null?void 0:je.x)??0)),y:Math.abs(Math.round(ne.pageY)-(((K=$.current)==null?void 0:K.y)??0))}},se=ne=>{U.x<=10&&U.y<=10?ne.preventDefault():w.contains(ne.target)||M(!1),document.removeEventListener("pointermove",de),$.current=null};return $.current!==null&&(document.addEventListener("pointermove",de),document.addEventListener("pointerup",se,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",de),document.removeEventListener("pointerup",se,{capture:!0})}}},[w,M,$]),g.useEffect(()=>{const U=()=>M(!1);return window.addEventListener("blur",U),window.addEventListener("resize",U),()=>{window.removeEventListener("blur",U),window.removeEventListener("resize",U)}},[M]);const[Q,q]=Rz(U=>{const de=E().filter(je=>!je.disabled),se=de.find(je=>je.ref.current===document.activeElement),ne=Mz(de,U,se);ne&&setTimeout(()=>ne.ref.current.focus())}),te=g.useCallback((U,de,se)=>{const ne=!V.current&&!se;(x.value!==void 0&&x.value===de||ne)&&(T(U),ne&&(V.current=!0))},[x.value]),xe=g.useCallback(()=>w==null?void 0:w.focus(),[w]),B=g.useCallback((U,de,se)=>{const ne=!V.current&&!se;(x.value!==void 0&&x.value===de||ne)&&O(U)},[x.value]),ce=r==="popper"?h1:yz,he=ce===h1?{side:c,sideOffset:l,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:v,hideWhenDetached:m,avoidCollisions:y}:{};return a.jsx(gz,{scope:n,content:w,viewport:C,onViewportChange:_,itemRefCallback:te,selectedItem:j,onItemLeave:xe,itemTextRefCallback:B,focusSelectedItem:z,selectedItemText:k,position:r,isPositioned:R,searchRef:Q,children:a.jsx(Dw,{as:ea,allowPinchZoom:!0,children:a.jsx(Rw,{asChild:!0,trapped:x.open,onMountAutoFocus:U=>{U.preventDefault()},onUnmountAutoFocus:Le(i,U=>{var de;(de=x.trigger)==null||de.focus({preventScroll:!0}),U.preventDefault()}),children:a.jsx(Rg,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:U=>U.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(ce,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:U=>U.preventDefault(),...b,...he,onPlaced:()=>D(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Le(b.onKeyDown,U=>{const de=U.ctrlKey||U.altKey||U.metaKey;if(U.key==="Tab"&&U.preventDefault(),!de&&U.key.length===1&&q(U.key),["ArrowUp","ArrowDown","Home","End"].includes(U.key)){let ne=E().filter(je=>!je.disabled).map(je=>je.ref.current);if(["ArrowUp","End"].includes(U.key)&&(ne=ne.slice().reverse()),["ArrowUp","ArrowDown"].includes(U.key)){const je=U.target,K=ne.indexOf(je);ne=ne.slice(K+1)}setTimeout(()=>L(ne)),U.preventDefault()}})})})})})})});vz.displayName=Rle;var Mle="SelectItemAlignedPosition",yz=g.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...i}=t,o=xl(_u,n),s=bl(_u,n),[c,l]=g.useState(null),[u,d]=g.useState(null),f=It(e,A=>d(A)),h=Lw(n),p=g.useRef(!1),v=g.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=s,w=g.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&m&&y&&b){const A=o.trigger.getBoundingClientRect(),j=u.getBoundingClientRect(),T=o.valueNode.getBoundingClientRect(),k=b.getBoundingClientRect();if(o.dir!=="rtl"){const je=k.left-j.left,K=T.left-je,et=A.left-K,Me=A.width+et,ut=Math.max(Me,j.width),Ye=window.innerWidth-Ho,Pt=Mm(K,[Ho,Math.max(Ho,Ye-ut)]);c.style.minWidth=Me+"px",c.style.left=Pt+"px"}else{const je=j.right-k.right,K=window.innerWidth-T.right-je,et=window.innerWidth-A.right-K,Me=A.width+et,ut=Math.max(Me,j.width),Ye=window.innerWidth-Ho,Pt=Mm(K,[Ho,Math.max(Ho,Ye-ut)]);c.style.minWidth=Me+"px",c.style.right=Pt+"px"}const O=h(),E=window.innerHeight-Ho*2,R=m.scrollHeight,D=window.getComputedStyle(u),V=parseInt(D.borderTopWidth,10),L=parseInt(D.paddingTop,10),z=parseInt(D.borderBottomWidth,10),M=parseInt(D.paddingBottom,10),$=V+L+R+M+z,Q=Math.min(y.offsetHeight*5,$),q=window.getComputedStyle(m),te=parseInt(q.paddingTop,10),xe=parseInt(q.paddingBottom,10),B=A.top+A.height/2-Ho,ce=E-B,he=y.offsetHeight/2,U=y.offsetTop+he,de=V+L+U,se=$-de;if(de<=B){const je=O.length>0&&y===O[O.length-1].ref.current;c.style.bottom="0px";const K=u.clientHeight-m.offsetTop-m.offsetHeight,et=Math.max(ce,he+(je?xe:0)+K+z),Me=de+et;c.style.height=Me+"px"}else{const je=O.length>0&&y===O[0].ref.current;c.style.top="0px";const et=Math.max(B,V+m.offsetTop+(je?te:0)+he)+se;c.style.height=et+"px",m.scrollTop=de-B+m.offsetTop}c.style.margin=`${Ho}px 0`,c.style.minHeight=Q+"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]);qr(()=>w(),[w]);const[S,C]=g.useState();qr(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]);const _=g.useCallback(A=>{A&&v.current===!0&&(w(),x==null||x(),v.current=!1)},[w,x]);return a.jsx($le,{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(ht.div,{...i,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});yz.displayName=Mle;var Dle="SelectPopperPosition",h1=g.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Ho,...o}=t,s=Fw(n);return a.jsx(bN,{...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)"}})});h1.displayName=Dle;var[$le,lk]=th(_u,{}),p1="SelectViewport",xz=g.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...i}=t,o=bl(p1,n),s=lk(p1,n),c=It(e,o.onViewportChange),l=g.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($w.Slot,{scope:n,children:a.jsx(ht.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:Le(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 v=window.innerHeight-Ho*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})})})]})});xz.displayName=p1;var bz="SelectGroup",[Lle,Fle]=th(bz),Ble=g.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=ss();return a.jsx(Lle,{scope:n,id:i,children:a.jsx(ht.div,{role:"group","aria-labelledby":i,...r,ref:e})})});Ble.displayName=bz;var wz="SelectLabel",Sz=g.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Fle(wz,n);return a.jsx(ht.div,{id:i.id,...r,ref:e})});Sz.displayName=wz;var hb="SelectItem",[Ule,Cz]=th(hb),_z=g.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:o,...s}=t,c=xl(hb,n),l=bl(hb,n),u=c.value===r,[d,f]=g.useState(o??""),[h,p]=g.useState(!1),v=It(e,x=>{var w;return(w=l.itemRefCallback)==null?void 0:w.call(l,x,r,i)}),m=ss(),y=g.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(Ule,{scope:n,value:r,disabled:i,textId:m,isSelected:u,onItemTextChange:g.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx($w.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:a.jsx(ht.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:v,onFocus:Le(s.onFocus,()=>p(!0)),onBlur:Le(s.onBlur,()=>p(!1)),onClick:Le(s.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Le(s.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Le(s.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:Le(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:Le(s.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=l.onItemLeave)==null||w.call(l))}),onKeyDown:Le(s.onKeyDown,x=>{var S;((S=l.searchRef)==null?void 0:S.current)!==""&&x.key===" "||(Ele.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});_z.displayName=hb;var cp="SelectItemText",Az=g.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:i,...o}=t,s=xl(cp,n),c=bl(cp,n),l=Cz(cp,n),u=Ple(cp,n),[d,f]=g.useState(null),h=It(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,v=g.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 qr(()=>(m(v),()=>y(v)),[m,y,v]),a.jsxs(a.Fragment,{children:[a.jsx(ht.span,{id:l.textId,...o,ref:h}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?es.createPortal(o.children,s.valueNode):null]})});Az.displayName=cp;var jz="SelectItemIndicator",Ez=g.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return Cz(jz,n).isSelected?a.jsx(ht.span,{"aria-hidden":!0,...r,ref:e}):null});Ez.displayName=jz;var m1="SelectScrollUpButton",Nz=g.forwardRef((t,e)=>{const n=bl(m1,t.__scopeSelect),r=lk(m1,t.__scopeSelect),[i,o]=g.useState(!1),s=It(e,r.onScrollButtonChange);return qr(()=>{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(kz,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop-l.offsetHeight)}}):null});Nz.displayName=m1;var g1="SelectScrollDownButton",Tz=g.forwardRef((t,e)=>{const n=bl(g1,t.__scopeSelect),r=lk(g1,t.__scopeSelect),[i,o]=g.useState(!1),s=It(e,r.onScrollButtonChange);return qr(()=>{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(kz,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:l}=n;c&&l&&(c.scrollTop=c.scrollTop+l.offsetHeight)}}):null});Tz.displayName=g1;var kz=g.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=t,o=bl("SelectScrollButton",n),s=g.useRef(null),c=Lw(n),l=g.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return g.useEffect(()=>()=>l(),[l]),qr(()=>{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(ht.div,{"aria-hidden":!0,...i,ref:e,style:{flexShrink:0,...i.style},onPointerDown:Le(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Le(i.onPointerMove,()=>{var u;(u=o.onItemLeave)==null||u.call(o),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Le(i.onPointerLeave,()=>{l()})})}),zle="SelectSeparator",Pz=g.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(ht.div,{"aria-hidden":!0,...r,ref:e})});Pz.displayName=zle;var v1="SelectArrow",Hle=g.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,i=Fw(n),o=xl(v1,n),s=bl(v1,n);return o.open&&s.position==="popper"?a.jsx(wN,{...i,...r,ref:e}):null});Hle.displayName=v1;function Oz(t){return t===""||t===void 0}var Iz=g.forwardRef((t,e)=>{const{value:n,...r}=t,i=g.useRef(null),o=It(e,i),s=Wg(n);return g.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(SN,{asChild:!0,children:a.jsx("select",{...r,ref:o,defaultValue:n})})});Iz.displayName="BubbleSelect";function Rz(t){const e=Ar(t),n=g.useRef(""),r=g.useRef(0),i=g.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=g.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,o]}function Mz(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=Vle(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 Vle(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Gle=cz,Dz=uz,Kle=fz,Wle=hz,qle=pz,$z=mz,Yle=xz,Lz=Sz,Fz=_z,Qle=Az,Xle=Ez,Bz=Nz,Uz=Tz,zz=Pz;const Tn=Gle,kn=Kle,An=g.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Dz,{ref:r,className:Fe("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(Wle,{asChild:!0,children:a.jsx(yl,{className:"h-4 w-4 opacity-50"})})]}));An.displayName=Dz.displayName;const Hz=g.forwardRef(({className:t,...e},n)=>a.jsx(Bz,{ref:n,className:Fe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(qf,{className:"h-4 w-4"})}));Hz.displayName=Bz.displayName;const Vz=g.forwardRef(({className:t,...e},n)=>a.jsx(Uz,{ref:n,className:Fe("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(yl,{className:"h-4 w-4"})}));Vz.displayName=Uz.displayName;const jn=g.forwardRef(({className:t,children:e,position:n="popper",...r},i)=>a.jsx(qle,{children:a.jsxs($z,{ref:i,className:Fe("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(Hz,{}),a.jsx(Yle,{className:Fe("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(Vz,{})]})}));jn.displayName=$z.displayName;const Jle=g.forwardRef(({className:t,...e},n)=>a.jsx(Lz,{ref:n,className:Fe("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));Jle.displayName=Lz.displayName;const le=g.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Fz,{ref:r,className:Fe("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(Xle,{children:a.jsx(Io,{className:"h-4 w-4"})})}),a.jsx(Qle,{children:e})]}));le.displayName=Fz.displayName;const Zle=g.forwardRef(({className:t,...e},n)=>a.jsx(zz,{ref:n,className:Fe("-mx-1 my-1 h-px bg-muted",t),...e}));Zle.displayName=zz.displayName;const eue=$e.object({audienceBrief:$e.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:$e.string().optional(),personaCount:$e.string().min(1,{message:"Number of personas is required."}),dataFile:$e.instanceof(FileList).optional(),llm_model:$e.string().optional()});function tue({onSubmit:t,isGenerating:e}){const[n,r]=g.useState(!1),[i,o]=g.useState(!1),[s,c]=g.useState({audience_brief:[],research_objective:[]}),[l,u]=g.useState(!1),[d,f]=g.useState(null),[h,p]=g.useState(null),[v,m]=g.useState([]),y=_=>{const A=new DataTransfer;return _.forEach(j=>A.items.add(j)),A.files},b=Hg({resolver:Vg(eue),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),x=b.watch("audienceBrief"),w=b.watch("researchObjective"),S=async()=>{var j,T,k,O,E,R,D,V,L,z,M;const _=x==null?void 0:x.trim(),A=w==null?void 0:w.trim();if(!_||_.length<10){ae.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!A||A.length<10){ae.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const $=await ba.enhanceAudienceBrief(_,A);c($.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),o(!1);const Q=(((T=(j=$.data.suggestions)==null?void 0:j.audience_brief)==null?void 0:T.length)||0)+(((O=(k=$.data.suggestions)==null?void 0:k.research_objective)==null?void 0:O.length)||0);ae.success("Enhancement suggestions generated",{description:`Generated ${Q} suggestions to improve your research inputs`})}catch($){console.error("Error enhancing audience brief:",$);let Q="Please try again or modify your brief",q="Failed to generate suggestions";if($&&typeof $=="object"){const te=$;te.code==="ECONNABORTED"||(E=te.message)!=null&&E.includes("timeout")?(q="Request timeout",Q="The AI took too long to analyze your brief. Please try again."):((R=te.response)==null?void 0:R.status)===500?(q="Server error",Q=((V=(D=te.response)==null?void 0:D.data)==null?void 0:V.message)||"The server encountered an error. Please try again later."):((L=te.response)==null?void 0:L.status)===400?(q="Invalid brief",Q=((M=(z=te.response)==null?void 0:z.data)==null?void 0:M.message)||"Please check your audience brief and try again."):te.message&&(Q=te.message)}else $ instanceof Error&&(Q=$.message);f(Q),ae.error(q,{description:Q,duration:5e3})}finally{u(!1)}},C=()=>{o(!i)};return a.jsx(Kg,{...b,children:a.jsxs("form",{onSubmit:b.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(xt,{control:b.control,name:"audienceBrief",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Audience Brief"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Describe your target audience and research goals...",className:"h-40",..._})}),a.jsx(Sn,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:b.control,name:"researchObjective",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Research Objective"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",..._})}),a.jsx(Sn,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(vt,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(ie,{type:"button",variant:"outline",size:"sm",onClick:S,disabled:!x||x.trim().length<10||!w||w.trim().length<10||l||e,className:"flex items-center gap-2 hover-transition",children:l?a.jsxs(a.Fragment,{children:[a.jsx(ru,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(gu,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(q6,{focusGroupId:void 0,disabled:e,maxAssets:5,maxFileSize:10,allowedTypes:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/*","image/*"],label:"Customer Data Upload",description:"Upload existing customer data to create more realistic and accurate synthetic personas. This helps the AI understand your target audience better.",enableRenaming:!1,onFilesChange:_=>{m(_),p(_.length>0?y(_):null)}}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Supports PDF, Word docs, Excel files, text files, and images"})]}),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(sf,{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(rp,{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(rp,{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(rp,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(rp,{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(gu,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:C,className:"h-6 w-6 p-0 hover:bg-slate-200",title:i?"Expand suggestions":"Collapse suggestions",children:i?a.jsx(yl,{className:"h-4 w-4"}):a.jsx(qf,{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(Fr,{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((_,A)=>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:_})]},A))})]}):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(sf,{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((_,A)=>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:_})]},A))})]}):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(xt,{control:b.control,name:"llm_model",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"AI Model"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select AI model"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(le,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(le,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Sn,{children:"Choose which AI model to use for generating personas"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:b.control,name:"personaCount",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Number of Personas to Generate"}),a.jsx(gt,{children:a.jsx(Kt,{type:"number",min:"1",max:"20",..._})}),a.jsx(Sn,{children:"How many synthetic users do you need for your research?"}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(ie,{type:"button",disabled:e,className:"min-w-36",onClick:()=>{const _=b.getValues();t({..._,dataFile:h})},children:e?a.jsxs(a.Fragment,{children:[a.jsx(ru,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Fr,{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 nue=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`}},Yg=t=>t.avatar||nue(t.gender);function uk({user:t,selected:e=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:i,showAddToFolderButton:o=!1,onAddToFolder:s,onViewDetails:c,folders:l=[]}){const u=ur();g.useState(!1);const[d,f]=g.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 v=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:Fe("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",e&&"selected ring-2 ring-primary"),onClick:v,children:[a.jsx("div",{className:"persona-card-overlay"}),a.jsx("div",{className:"persona-card-checkmark",children:a.jsx(Io,{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:Yg(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(ate,{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(go,{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(Vr,{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(mu,{className:"h-3 w-3"}),y]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(ie,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var dk="Collapsible",[rue,XBe]=Bi(dk),[iue,fk]=rue(dk),Gz=g.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:o,onOpenChange:s,...c}=t,[l=!1,u]=ms({prop:r,defaultProp:i,onChange:s});return a.jsx(iue,{scope:n,disabled:o,contentId:ss(),open:l,onOpenToggle:g.useCallback(()=>u(d=>!d),[u]),children:a.jsx(ht.div,{"data-state":pk(l),"data-disabled":o?"":void 0,...c,ref:e})})});Gz.displayName=dk;var Kz="CollapsibleTrigger",Wz=g.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,i=fk(Kz,n);return a.jsx(ht.button,{type:"button","aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":pk(i.open),"data-disabled":i.disabled?"":void 0,disabled:i.disabled,...r,ref:e,onClick:Le(t.onClick,i.onOpenToggle)})});Wz.displayName=Kz;var hk="CollapsibleContent",qz=g.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=fk(hk,t.__scopeCollapsible);return a.jsx(Yr,{present:n||i.open,children:({present:o})=>a.jsx(oue,{...r,ref:e,present:o})})});qz.displayName=hk;var oue=g.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:i,...o}=t,s=fk(hk,n),[c,l]=g.useState(r),u=g.useRef(null),d=It(e,u),f=g.useRef(0),h=f.current,p=g.useRef(0),v=p.current,m=s.open||c,y=g.useRef(m),b=g.useRef();return g.useEffect(()=>{const x=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(x)},[]),qr(()=>{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(ht.div,{"data-state":pk(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":v?`${v}px`:void 0,...t.style},children:m&&i})});function pk(t){return t?"open":"closed"}var sue=Gz;const Qg=sue,Xg=Wz,Jg=qz;function aue({generatedPersonas:t,selectedPersonas:e,isGenerating:n,onPersonaSelection:r,onRefinePersonas:i,onApprovePersonas:o,onBackToGenerator:s}){const c=ur(),[l,u]=g.useState(""),[d,f]=g.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(yt,{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:v=>{v.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(uk,{user:p,showDetailedDialog:!1,onClick:v=>{v.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(ie,{variant:"outline",onClick:s,children:[a.jsx(um,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(Qg,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Xg,{asChild:!0,children:a.jsxs(ie,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(ru,{className:"h-4 w-4"}),"Refine Personas",a.jsx(yl,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(ie,{onClick:o,disabled:e.length===0,children:[a.jsx(rp,{className:"mr-2 h-4 w-4"}),"Approve Selected (",e.length,")"]})]}),a.jsx(Jg,{children:a.jsx(yt,{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(bt,{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(ie,{onClick:()=>i(l),disabled:n||l.trim()==="",className:"w-full",children:[n?a.jsx(ru,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(ru,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function cue(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 ba.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 ba.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 Ms.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 ba.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 ba.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 ba.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 ba.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 ba.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 Yz(){const[t,e]=g.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 Er.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 Er.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 g.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 Er.delete(s._id);e([])}}}function lue({targetFolderId:t,targetFolderName:e}){const n=Ui(),r=ur(),{loadPersonas:i,savePersonas:o}=Yz(),[s,c]=g.useState(!1),[l,u]=g.useState([]),[d,f]=g.useState([]),[h,p]=g.useState(!1),[v,m]=g.useState(0);g.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 T=i();T.length>0&&(u(T),f(T.map(k=>k.id)),p(!0))}},[n,i]);async function y(C){var _,A,j,T,k,O,E,R,D,V;try{c(!0),m(0);const L=parseInt(C.personaCount);if(isNaN(L)||L<1||L>10){ae.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),c(!1);return}m(5);const z=setInterval(()=>{m(q=>q<90?q+Math.random()*5:q)},500),M=L<=2?"30-60 seconds":L<=4?"1-2 minutes":L<=6?"2-3 minutes":"3-5 minutes";L>4&&ae.info("Generation may take longer",{description:`Generating ${L} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),ae.info("Generating AI personas in parallel",{description:`Creating ${L} synthetic personas based on your brief. This may take ${M}. Please be patient.`,duration:1e4}),t&&e?(console.log(`Target folder for new personas: ID=${t}, Name=${e}`),ae.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 $=await cue(C.audienceBrief,C.researchObjective,L,C.dataFile,t,C.llm_model),Q=$.personas||$;if(clearInterval(z),m(100),Q&&Q.length>0)console.log(`✅ Successfully generated ${Q.length} personas using model: ${C.llm_model||"gemini-2.5-pro"}`),$.partial_success||$.errors&&$.errors.length>0?(ae.success("Some personas generated successfully",{description:`${Q.length} synthetic personas were created using ${C.llm_model||"Gemini 2.5 Pro"}. ${((_=$.errors)==null?void 0:_.length)||0} failed due to timeout or other errors.`,duration:8e3}),$.errors&&$.errors.length>0&&setTimeout(()=>{ae.error("Some personas failed to generate",{description:`${$.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)):ae.success("Personas generated and saved successfully",{description:`${Q.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(L){console.error(`❌ Error generating personas using model: ${C.llm_model||"gemini-2.5-pro"}:`,L);let z="Please try again or adjust your parameters",M="Failed to generate personas";L.code==="ECONNABORTED"||(A=L.message)!=null&&A.includes("timeout")||((j=L.response)==null?void 0:j.status)===504?(M="Generation timeout",z="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((T=L.response)==null?void 0:T.status)===500?(M="Server error",(O=(k=L.response)==null?void 0:k.data)!=null&&O.message?z=L.response.data.message:(R=(E=L.response)==null?void 0:E.data)!=null&&R.error?z=L.response.data.error:z="The server encountered an error processing your request. Please try again later."):((D=L.response)==null?void 0:D.status)===401?(M="Authentication required",z="Please log in to generate personas."):(V=L.message)!=null&&V.includes("504 Deadline Exceeded")?(M="Generation timeout",z="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):L instanceof Error&&(z=L.message),ae.error(M,{description:z,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 T={...j};if(A.includes("younger")){const k=parseInt(T.age);T.age=(k-5).toString()}else if(A.includes("older")){const k=parseInt(T.age);T.age=(k+5).toString()}if(A.includes("different locations")&&(T.location=`${T.location} (Diversified)`),A.includes("more extroverted")?T.personality=`Extroverted, ${T.personality.toLowerCase()}`:A.includes("more introverted")&&(T.personality=`Introverted, ${T.personality.toLowerCase()}`),A.includes("diverse")){const k=["tech-savvy","traditional","innovative","conservative","creative"],O=k[Math.floor(Math.random()*k.length)];T.personality=`${O}, ${T.personality}`}return T})},w=C=>{if(!C.trim()){ae.error("Please provide refinement instructions");return}c(!0),setTimeout(()=>{try{const _=l.filter(T=>d.includes(T.id)),A=x(_,C),j=l.map(T=>A.find(O=>O.id===T.id)||T);u(j),c(!1),o(j),ae.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(_){console.error("Error refining personas:",_),ae.error("Failed to refine personas",{description:"Please try different instructions"}),c(!1)}},1500)},S=()=>{const C=l.filter(_=>d.includes(_.id));ae.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(Fr,{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(v),"%"]})]}),a.jsx(Ic,{value:v,className:"h-2"})]}),h?a.jsx(aue,{generatedPersonas:l,selectedPersonas:d,isGenerating:s,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:S,onBackToGenerator:()=>p(!1)}):a.jsx(tue,{onSubmit:y,isGenerating:s})]})}const dl=new Map;function Qz(t){const{id:e,title:n,description:r,type:i="default",duration:o}=t;let s;switch(i){case"success":s=ae.success(n,{description:r,duration:o});break;case"error":s=ae.error(n,{description:r,duration:o});break;case"warning":s=ae.warning(n,{description:r,duration:o});break;case"info":s=ae.info(n,{description:r,duration:o});break;default:s=ae(n,{description:r,duration:o});break}return dl.set(e,s.toString()),e}function uue(t,e){const n=dl.get(t);if(!n)return console.warn(`Toast with ID "${t}" not found. Creating new toast instead.`),Qz({id:t,...e,title:e.title||"Updated"}),!1;const{title:r,description:i,type:o="default",duration:s}=e;ae.dismiss(n);let c;switch(o){case"success":c=ae.success(r,{description:i,duration:s});break;case"error":c=ae.error(r,{description:i,duration:s});break;case"warning":c=ae.warning(r,{description:i,duration:s});break;case"info":c=ae.info(r,{description:i,duration:s});break;default:c=ae(r,{description:i,duration:s});break}return dl.set(t,c.toString()),!0}function due(t){const e=dl.get(t);return e?(ae.dismiss(e),dl.delete(t),!0):(console.warn(`Toast with ID "${t}" not found.`),!1)}function fue(t){return dl.has(t)}function hue(){dl.forEach(t=>{ae.dismiss(t)}),dl.clear()}const Ve={success:ae.success,error:ae.error,warning:ae.warning,info:ae.info,loading:ae.loading,dismiss:ae.dismiss,createPersistent:Qz,updatePersistent:uue,dismissPersistent:due,hasPersistent:fue,dismissAllPersistent:hue};var Xz=["PageUp","PageDown"],Jz=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Zz={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},nh="Slider",[y1,pue,mue]=Iw(nh),[eH,JBe]=Bi(nh,[mue]),[gue,Bw]=eH(nh),tH=g.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:v,...m}=t,y=g.useRef(new Set),b=g.useRef(0),w=s==="horizontal"?vue:yue,[S=[],C]=ms({prop:d,defaultProp:u,onChange:O=>{var R;(R=[...y.current][b.current])==null||R.focus(),f(O)}}),_=g.useRef(S);function A(O){const E=Cue(S,O);k(O,E)}function j(O){k(O,b.current)}function T(){const O=_.current[b.current];S[b.current]!==O&&h(S)}function k(O,E,{commit:R}={commit:!1}){const D=Eue(o),V=Nue(Math.round((O-r)/o)*o+r,D),L=Mm(V,[r,i]);C((z=[])=>{const M=wue(z,L,E);if(jue(M,l*o)){b.current=M.indexOf(L);const $=String(M)!==String(z);return $&&R&&h(M),$?M:z}else return z})}return a.jsx(gue,{scope:t.__scopeSlider,name:n,disabled:c,min:r,max:i,valueIndexToChangeRef:b,thumbs:y.current,values:S,orientation:s,form:v,children:a.jsx(y1.Provider,{scope:t.__scopeSlider,children:a.jsx(y1.Slot,{scope:t.__scopeSlider,children:a.jsx(w,{"aria-disabled":c,"data-disabled":c?"":void 0,...m,ref:e,onPointerDown:Le(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:T,onHomeKeyDown:()=>!c&&k(r,0,{commit:!0}),onEndKeyDown:()=>!c&&k(i,S.length-1,{commit:!0}),onStepKeyDown:({event:O,direction:E})=>{if(!c){const V=Xz.includes(O.key)||O.shiftKey&&Jz.includes(O.key)?10:1,L=b.current,z=S[L],M=o*V*E;k(z+M,L,{commit:!0})}}})})})})});tH.displayName=nh;var[nH,rH]=eH(nh,{startEdge:"left",endEdge:"right",size:"width",direction:1}),vue=g.forwardRef((t,e)=>{const{min:n,max:r,dir:i,inverted:o,onSlideStart:s,onSlideMove:c,onSlideEnd:l,onStepKeyDown:u,...d}=t,[f,h]=g.useState(null),p=It(e,w=>h(w)),v=g.useRef(),m=Mu(i),y=m==="ltr",b=y&&!o||!y&&o;function x(w){const S=v.current||f.getBoundingClientRect(),C=[0,S.width],A=mk(C,b?[n,r]:[r,n]);return v.current=S,A(w-S.left)}return a.jsx(nH,{scope:t.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(iH,{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:()=>{v.current=void 0,l==null||l()},onStepKeyDown:w=>{const C=Zz[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:C?-1:1})}})})}),yue=g.forwardRef((t,e)=>{const{min:n,max:r,inverted:i,onSlideStart:o,onSlideMove:s,onSlideEnd:c,onStepKeyDown:l,...u}=t,d=g.useRef(null),f=It(e,d),h=g.useRef(),p=!i;function v(m){const y=h.current||d.current.getBoundingClientRect(),b=[0,y.height],w=mk(b,p?[r,n]:[n,r]);return h.current=y,w(m-y.top)}return a.jsx(nH,{scope:t.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(iH,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const y=v(m.clientY);o==null||o(y)},onSlideMove:m=>{const y=v(m.clientY);s==null||s(y)},onSlideEnd:()=>{h.current=void 0,c==null||c()},onStepKeyDown:m=>{const b=Zz[p?"from-bottom":"from-top"].includes(m.key);l==null||l({event:m,direction:b?-1:1})}})})}),iH=g.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:s,onEndKeyDown:c,onStepKeyDown:l,...u}=t,d=Bw(nh,n);return a.jsx(ht.span,{...u,ref:e,onKeyDown:Le(t.onKeyDown,f=>{f.key==="Home"?(s(f),f.preventDefault()):f.key==="End"?(c(f),f.preventDefault()):Xz.concat(Jz).includes(f.key)&&(l(f),f.preventDefault())}),onPointerDown:Le(t.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Le(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&i(f)}),onPointerUp:Le(t.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),o(f))})})}),oH="SliderTrack",sH=g.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=Bw(oH,n);return a.jsx(ht.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...r,ref:e})});sH.displayName=oH;var x1="SliderRange",aH=g.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,i=Bw(x1,n),o=rH(x1,n),s=g.useRef(null),c=It(e,s),l=i.values.length,u=i.values.map(h=>lH(h,i.min,i.max)),d=l>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(ht.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...r,ref:c,style:{...t.style,[o.startEdge]:d+"%",[o.endEdge]:f+"%"}})});aH.displayName=x1;var b1="SliderThumb",cH=g.forwardRef((t,e)=>{const n=pue(t.__scopeSlider),[r,i]=g.useState(null),o=It(e,c=>i(c)),s=g.useMemo(()=>r?n().findIndex(c=>c.ref.current===r):-1,[n,r]);return a.jsx(xue,{...t,ref:o,index:s})}),xue=g.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:i,...o}=t,s=Bw(b1,n),c=rH(b1,n),[l,u]=g.useState(null),d=It(e,x=>u(x)),f=l?s.form||!!l.closest("form"):!0,h=Dg(l),p=s.values[r],v=p===void 0?0:lH(p,s.min,s.max),m=Sue(r,s.values.length),y=h==null?void 0:h[c.size],b=y?_ue(y,v,c.direction):0;return g.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(${v}% + ${b}px)`},children:[a.jsx(y1.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(ht.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:Le(t.onFocus,()=>{s.valueIndexToChangeRef.current=r})})}),f&&a.jsx(bue,{name:i??(s.name?s.name+(s.values.length>1?"[]":""):void 0),form:s.form,value:p},r)]})});cH.displayName=b1;var bue=t=>{const{value:e,...n}=t,r=g.useRef(null),i=Wg(e);return g.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 wue(t=[],e,n){const r=[...t];return r[n]=e,r.sort((i,o)=>i-o)}function lH(t,e,n){const o=100/(n-e)*(t-e);return Mm(o,[0,100])}function Sue(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Cue(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 _ue(t,e,n){const r=t/2,o=mk([0,50],[0,r]);return(r-o(e)*n)*n}function Aue(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function jue(t,e){if(e>0){const n=Aue(t);return Math.min(...n)>=e}return!0}function mk(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 Eue(t){return(String(t).split(".")[1]||"").length}function Nue(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var uH=tH,Tue=sH,kue=aH,Pue=cH;const Sr=g.forwardRef(({className:t,...e},n)=>a.jsxs(uH,{ref:n,className:Fe("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(Tue,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(kue,{className:"absolute h-full bg-primary"})}),a.jsx(Pue,{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"})]}));Sr.displayName=uH.displayName;var gk="Switch",[Oue,ZBe]=Bi(gk),[Iue,Rue]=Oue(gk),dH=g.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]=g.useState(null),v=It(e,w=>p(w)),m=g.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=ms({prop:i,defaultProp:o,onChange:u});return a.jsxs(Iue,{scope:n,checked:b,disabled:c,children:[a.jsx(ht.button,{type:"button",role:"switch","aria-checked":b,"aria-required":s,"data-state":pH(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:v,onClick:Le(t.onClick,w=>{x(S=>!S),y&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),y&&a.jsx(Mue,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"}})]})});dH.displayName=gk;var fH="SwitchThumb",hH=g.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,i=Rue(fH,n);return a.jsx(ht.span,{"data-state":pH(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:e})});hH.displayName=fH;var Mue=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=g.useRef(null),s=Wg(n),c=Dg(e);return g.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 pH(t){return t?"checked":"unchecked"}var mH=dH,Due=hH;const Dm=g.forwardRef(({className:t,...e},n)=>a.jsx(mH,{className:Fe("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(Due,{className:Fe("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")})}));Dm.displayName=mH.displayName;function $ue(t,e=[]){let n=[];function r(o,s){const c=g.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:h,children:p,...v}=f,m=(h==null?void 0:h[t][l])||c,y=g.useMemo(()=>v,Object.values(v));return a.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[t][l])||c,v=g.useContext(p);if(v)return v;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=>g.createContext(s));return function(c){const l=(c==null?void 0:c[t])||o;return g.useMemo(()=>({[`__scope${t}`]:{...c,[t]:l}}),[c,l])}};return i.scopeName=t,[r,Lue(i,...e)]}function Lue(...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 g.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return n.scopeName=e.scopeName,n}var HC="rovingFocusGroup.onEntryFocus",Fue={bubbles:!1,cancelable:!0},Uw="RovingFocusGroup",[w1,gH,Bue]=Iw(Uw),[Uue,rh]=$ue(Uw,[Bue]),[zue,Hue]=Uue(Uw),vH=g.forwardRef((t,e)=>a.jsx(w1.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(w1.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(Vue,{...t,ref:e})})}));vH.displayName=Uw;var Vue=g.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=g.useRef(null),p=It(e,h),v=Mu(o),[m=null,y]=ms({prop:s,defaultProp:c,onChange:l}),[b,x]=g.useState(!1),w=Ar(u),S=gH(n),C=g.useRef(!1),[_,A]=g.useState(0);return g.useEffect(()=>{const j=h.current;if(j)return j.addEventListener(HC,w),()=>j.removeEventListener(HC,w)},[w]),a.jsx(zue,{scope:n,orientation:r,dir:v,loop:i,currentTabStopId:m,onItemFocus:g.useCallback(j=>y(j),[y]),onItemShiftTab:g.useCallback(()=>x(!0),[]),onFocusableItemAdd:g.useCallback(()=>A(j=>j+1),[]),onFocusableItemRemove:g.useCallback(()=>A(j=>j-1),[]),children:a.jsx(ht.div,{tabIndex:b||_===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...t.style},onMouseDown:Le(t.onMouseDown,()=>{C.current=!0}),onFocus:Le(t.onFocus,j=>{const T=!C.current;if(j.target===j.currentTarget&&T&&!b){const k=new CustomEvent(HC,Fue);if(j.currentTarget.dispatchEvent(k),!k.defaultPrevented){const O=S().filter(L=>L.focusable),E=O.find(L=>L.active),R=O.find(L=>L.id===m),V=[E,R,...O].filter(Boolean).map(L=>L.ref.current);bH(V,d)}}C.current=!1}),onBlur:Le(t.onBlur,()=>x(!1))})})}),yH="RovingFocusGroupItem",xH=g.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=t,c=ss(),l=o||c,u=Hue(yH,n),d=u.currentTabStopId===l,f=gH(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return g.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(w1.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:a.jsx(ht.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:e,onMouseDown:Le(t.onMouseDown,v=>{r?u.onItemFocus(l):v.preventDefault()}),onFocus:Le(t.onFocus,()=>u.onItemFocus(l)),onKeyDown:Le(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const m=Wue(v,u.orientation,u.dir);if(m!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.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(v.currentTarget);b=u.loop?que(b,x+1):b.slice(x+1)}setTimeout(()=>bH(b))}})})})});xH.displayName=yH;var Gue={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Kue(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Wue(t,e,n){const r=Kue(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Gue[r]}function bH(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function que(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var vk=vH,yk=xH,xk="Tabs",[Yue,eUe]=Bi(xk,[rh]),wH=rh(),[Que,bk]=Yue(xk),SH=g.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:c,activationMode:l="automatic",...u}=t,d=Mu(c),[f,h]=ms({prop:r,onChange:i,defaultProp:o});return a.jsx(Que,{scope:n,baseId:ss(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:l,children:a.jsx(ht.div,{dir:d,"data-orientation":s,...u,ref:e})})});SH.displayName=xk;var CH="TabsList",_H=g.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...i}=t,o=bk(CH,n),s=wH(n);return a.jsx(vk,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(ht.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:e})})});_H.displayName=CH;var AH="TabsTrigger",jH=g.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=t,s=bk(AH,n),c=wH(n),l=TH(s.baseId,r),u=kH(s.baseId,r),d=r===s.value;return a.jsx(yk,{asChild:!0,...c,focusable:!i,active:d,children:a.jsx(ht.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:Le(t.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Le(t.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Le(t.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});jH.displayName=AH;var EH="TabsContent",NH=g.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=t,c=bk(EH,n),l=TH(c.baseId,r),u=kH(c.baseId,r),d=r===c.value,f=g.useRef(d);return g.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(Yr,{present:i||d,children:({present:h})=>a.jsx(ht.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})})});NH.displayName=EH;function TH(t,e){return`${t}-trigger-${e}`}function kH(t,e){return`${t}-content-${e}`}var Xue=SH,PH=_H,OH=jH,IH=NH;const wl=Xue,tc=g.forwardRef(({className:t,...e},n)=>a.jsx(PH,{ref:n,className:Fe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));tc.displayName=PH.displayName;const vn=g.forwardRef(({className:t,...e},n)=>a.jsx(OH,{ref:n,className:Fe("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}));vn.displayName=OH.displayName;const yn=g.forwardRef(({className:t,...e},n)=>a.jsx(IH,{ref:n,className:Fe("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));yn.displayName=IH.displayName;const Jue=$e.object({name:$e.string().min(2,{message:"Name must be at least 2 characters."}),age:$e.string().min(1,{message:"Age is required."}),gender:$e.string().min(1,{message:"Gender is required."}),occupation:$e.string().min(2,{message:"Occupation is required."}),education:$e.string().min(1,{message:"Education is required."}),location:$e.string().min(2,{message:"Location is required."}),ethnicity:$e.string().optional(),personality:$e.string(),interests:$e.string(),hasPurchasingPower:$e.boolean().optional(),hasChildren:$e.boolean().optional(),techSavviness:$e.number().min(0).max(100),brandLoyalty:$e.number().min(0).max(100),priceConsciousness:$e.number().min(0).max(100),environmentalConcern:$e.number().min(0).max(100),socialGrade:$e.string().optional(),householdIncome:$e.string().optional(),householdComposition:$e.string().optional(),livingSituation:$e.string().optional(),goals:$e.array($e.string()).optional(),frustrations:$e.array($e.string()).optional(),motivations:$e.array($e.string()).optional(),scenarios:$e.array($e.string()).optional(),scenarioType:$e.string().optional(),oceanTraits:$e.object({openness:$e.number().min(0).max(100),conscientiousness:$e.number().min(0).max(100),extraversion:$e.number().min(0).max(100),agreeableness:$e.number().min(0).max(100),neuroticism:$e.number().min(0).max(100)}).optional(),thinkFeelDo:$e.object({thinks:$e.array($e.string()),feels:$e.array($e.string()),does:$e.array($e.string())}).optional(),mediaConsumption:$e.string().optional(),deviceUsage:$e.string().optional(),shoppingHabits:$e.string().optional(),brandPreferences:$e.string().optional(),communicationPreferences:$e.string().optional(),paymentMethods:$e.string().optional(),purchaseBehaviour:$e.string().optional(),coreValues:$e.string().optional(),lifestyleChoices:$e.string().optional(),socialActivities:$e.string().optional(),categoryKnowledge:$e.string().optional(),decisionInfluences:$e.string().optional(),painPoints:$e.string().optional(),journeyContext:$e.string().optional(),keyTouchpoints:$e.string().optional(),selfDeterminationNeeds:$e.object({autonomy:$e.string(),competence:$e.string(),relatedness:$e.string()}).optional(),fears:$e.array($e.string()).optional(),narrative:$e.string().optional(),additionalInformation:$e.string().optional()});function Zue({targetFolderId:t,targetFolderName:e}){const[n,r]=g.useState(1),[i,o]=g.useState(!1),[s,c]=g.useState(!1),[l,u]=g.useState(0),d=ur(),{isAuthenticated:f,login:h}=la();g.useEffect(()=>{u(0)},[]),g.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)+"..."),Ve.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),Ve.error("Authentication problem, token not stored"))}catch(A){console.error("Auto login failed:",A)}finally{c(!1)}}})()},[]);const p=Hg({resolver:Vg(Jue),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:""}}),v=_=>{const A=p.getValues(_)||[];p.setValue(_,[...A,""])},m=(_,A,j)=>{const k=[...p.getValues(_)||[]];k[A]=j,p.setValue(_,k)},y=(_,A)=>{const T=[...p.getValues(_)||[]];T.splice(A,1),p.setValue(_,T)},b=_=>{const A=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},j={...A,[_]:[...A[_]||[],""]};p.setValue("thinkFeelDo",j)},x=(_,A,j)=>{const T=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},k=[...T[_]||[]];k[A]=j;const O={...T,[_]:k};p.setValue("thinkFeelDo",O)},w=(_,A)=>{const j=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},T=[...j[_]||[]];T.splice(A,1);const k={...j,[_]:T};p.setValue("thinkFeelDo",k)},S=(_,A)=>{const T={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[_]:A};p.setValue("oceanTraits",T)};async function C(_,A=!1){var j,T,k,O,E;if(A&&l>=1){console.log("Max retry attempts reached, stopping retry loop"),Ve.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(R=>R+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($){console.error("Login failed before persona creation:",$),Ve.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),o(!1);return}const R=`persona-generation-${Date.now()}`,D=t&&e?` in "${e}" folder`:"",V=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${V}${D}`),Ve.createPersistent({id:R,title:`Generating ${V}...`,description:`Creating synthetic user profile${n>1?"s":""}${D}`,type:"info"});const L={..._,oceanTraits:_.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:_.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:t||void 0},z={id:`temp-${Date.now()}`,...L},M=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(M.push(z),localStorage.setItem("tempPersonas",JSON.stringify(M)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),Ve.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(q){throw console.error("Login retry failed:",q),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const Q=await Er.create(L);console.log("Persona created successfully:",Q),Ve.updatePersistent(R,{title:"Synthetic user created successfully",description:`Created profile for ${_.name}`,type:"success"})}catch($){throw console.error("Error creating persona via API:",$),$.response&&$.response.status===401&&Ve.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),$}else{const $=[];$.push(L);for(let Q=1;Q{d("/synthetic-users?mode=view")},300)}catch(R){if(console.error("Error creating personas:",R),R.response&&R.response.status===401||R.message&&R.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 My.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)+"..."),Ve.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),Ve.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else Ve.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((E=(O=R.response)==null?void 0:O.data)==null?void 0:E.message)||R.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(ie,{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(Fr,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(Kg,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(C),className:"space-y-6",children:[a.jsxs(wl,{defaultValue:"basic",children:[a.jsxs(tc,{className:"grid w-full grid-cols-6",children:[a.jsx(vn,{value:"basic",children:"Basic"}),a.jsx(vn,{value:"cooper",children:"Cooper"}),a.jsx(vn,{value:"personality",children:"Personality"}),a.jsx(vn,{value:"demographics",children:"Demographics"}),a.jsx(vn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(vn,{value:"extended",children:"Extended"})]}),a.jsx(yn,{value:"basic",className:"mt-6",children:a.jsx(yt,{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(xt,{control:p.control,name:"name",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Name"}),a.jsx(gt,{children:a.jsx(Kt,{placeholder:"Jane Smith",..._})}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(xt,{control:p.control,name:"age",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Age Range"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select age range"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"18-24",children:"18-24"}),a.jsx(le,{value:"25-34",children:"25-34"}),a.jsx(le,{value:"35-44",children:"35-44"}),a.jsx(le,{value:"45-54",children:"45-54"}),a.jsx(le,{value:"55-64",children:"55-64"}),a.jsx(le,{value:"65+",children:"65+"})]})]}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"gender",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Gender"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select gender"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"Male",children:"Male"}),a.jsx(le,{value:"Female",children:"Female"}),a.jsx(le,{value:"Non-binary",children:"Non-binary"}),a.jsx(le,{value:"Other",children:"Other"})]})]}),a.jsx(vt,{})]})})]}),a.jsx(xt,{control:p.control,name:"occupation",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Occupation"}),a.jsx(gt,{children:a.jsx(Kt,{placeholder:"Software Engineer",..._})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"education",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Education"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select education level"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"High School",children:"High School"}),a.jsx(le,{value:"Some College",children:"Some College"}),a.jsx(le,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(le,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(le,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(le,{value:"PhD",children:"PhD"})]})]}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"location",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Location"}),a.jsx(gt,{children:a.jsx(Kt,{placeholder:"New York, USA",..._})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"ethnicity",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Ethnicity (Optional)"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select ethnicity"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"white",children:"White"}),a.jsx(le,{value:"black",children:"Black"}),a.jsx(le,{value:"asian",children:"Asian"}),a.jsx(le,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(le,{value:"native-american",children:"Native American"}),a.jsx(le,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(le,{value:"mixed",children:"Mixed"}),a.jsx(le,{value:"other",children:"Other"}),a.jsx(le,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(xt,{control:p.control,name:"personality",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Personality Traits"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Curious, analytical, detail-oriented",..._,rows:3})}),a.jsx(Sn,{children:"Describe key personality traits that define this user"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"interests",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Interests"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Technology, fitness, cooking, travel",..._,rows:3})}),a.jsx(Sn,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(xt,{control:p.control,name:"techSavviness",render:({field:_})=>a.jsxs(pt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(mt,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(gt,{children:a.jsx(Sr,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"brandLoyalty",render:({field:_})=>a.jsxs(pt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(mt,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(gt,{children:a.jsx(Sr,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"priceConsciousness",render:({field:_})=>a.jsxs(pt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(mt,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(gt,{children:a.jsx(Sr,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"environmentalConcern",render:({field:_})=>a.jsxs(pt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(mt,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.value,"%"]})]}),a.jsx(gt,{children:a.jsx(Sr,{min:0,max:100,step:1,value:[_.value],onValueChange:A=>_.onChange(A[0])})}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(xt,{control:p.control,name:"hasPurchasingPower",render:({field:_})=>a.jsxs(pt,{className:"flex items-center justify-between",children:[a.jsx(mt,{children:"Purchasing Power"}),a.jsx(gt,{children:a.jsx(Dm,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"hasChildren",render:({field:_})=>a.jsxs(pt,{className:"flex items-center justify-between",children:[a.jsx(mt,{children:"Has Children"}),a.jsx(gt,{children:a.jsx(Dm,{checked:_.value,onCheckedChange:_.onChange})}),a.jsx(vt,{})]})})]})]})]})]})})})}),a.jsxs(yn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(yt,{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(Kt,{value:_,onChange:j=>m("goals",A,j.target.value),placeholder:"Enter a goal"}),a.jsx(ie,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("goals",A),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(ie,{variant:"outline",size:"sm",type:"button",onClick:()=>v("goals"),className:"mt-2",children:[a.jsx(Vr,{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(Kt,{value:_,onChange:j=>m("frustrations",A,j.target.value),placeholder:"Enter a frustration"}),a.jsx(ie,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("frustrations",A),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(ie,{variant:"outline",size:"sm",type:"button",onClick:()=>v("frustrations"),className:"mt-2",children:[a.jsx(Vr,{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(Kt,{value:_,onChange:j=>m("motivations",A,j.target.value),placeholder:"Enter a motivation"}),a.jsx(ie,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("motivations",A),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(ie,{variant:"outline",size:"sm",type:"button",onClick:()=>v("motivations"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(yt,{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(Kt,{value:_,onChange:j=>x("thinks",A,j.target.value),placeholder:"What they think"}),a.jsx(ie,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",A),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(ie,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(Vr,{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(Kt,{value:_,onChange:j=>x("feels",A,j.target.value),placeholder:"What they feel"}),a.jsx(ie,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",A),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(ie,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(Vr,{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(Kt,{value:_,onChange:j=>x("does",A,j.target.value),placeholder:"What they do"}),a.jsx(ie,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",A),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(ie,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(yt,{children:a.jsx(Rt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(xt,{control:p.control,name:"scenarioType",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Scenario Section Title"}),a.jsx(gt,{children:a.jsx(Kt,{placeholder:"Life Scenarios",..._})}),a.jsx(Sn,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(vt,{})]})}),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(bt,{value:_,onChange:j=>m("scenarios",A,j.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(ie,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("scenarios",A),className:"mt-2",children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(ie,{variant:"outline",size:"sm",type:"button",onClick:()=>v("scenarios"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(yn,{value:"personality",className:"mt-6",children:a.jsx(yt,{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(Sr,{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(Sr,{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(Sr,{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(Sr,{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(Sr,{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(yn,{value:"demographics",className:"mt-6",children:a.jsx(yt,{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(xt,{control:p.control,name:"socialGrade",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Social Grade"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select social grade"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"A",children:"A - Higher managerial"}),a.jsx(le,{value:"B",children:"B - Intermediate managerial"}),a.jsx(le,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(le,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(le,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(le,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"householdIncome",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Household Income"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select income range"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"Under $25k",children:"Under $25,000"}),a.jsx(le,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(le,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(le,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(le,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(le,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(le,{value:"Over $250k",children:"Over $250,000"}),a.jsx(le,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(xt,{control:p.control,name:"householdComposition",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Household Composition"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select household type"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"Single person",children:"Single person"}),a.jsx(le,{value:"Couple without children",children:"Couple without children"}),a.jsx(le,{value:"Couple with children",children:"Couple with children"}),a.jsx(le,{value:"Single parent",children:"Single parent"}),a.jsx(le,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(le,{value:"Shared housing",children:"Shared housing"}),a.jsx(le,{value:"Other",children:"Other"})]})]}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"livingSituation",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Living Situation"}),a.jsxs(Tn,{onValueChange:_.onChange,defaultValue:_.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select living situation"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"Own home",children:"Own home"}),a.jsx(le,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(le,{value:"Rent house",children:"Rent house"}),a.jsx(le,{value:"Live with family",children:"Live with family"}),a.jsx(le,{value:"Student housing",children:"Student housing"}),a.jsx(le,{value:"Assisted living",children:"Assisted living"}),a.jsx(le,{value:"Other",children:"Other"})]})]}),a.jsx(vt,{})]})})]})]})]})})}),a.jsx(yn,{value:"lifestyle",className:"mt-6",children:a.jsx(yt,{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(xt,{control:p.control,name:"mediaConsumption",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Media Consumption"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"TV shows, podcasts, news sources, social media platforms",..._,rows:3})}),a.jsx(Sn,{children:"Describe media consumption habits and preferences"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"deviceUsage",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Device Usage"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",..._,rows:3})}),a.jsx(Sn,{children:"Primary devices and usage patterns"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"shoppingHabits",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Shopping Habits"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Online vs in-store, frequency, preferred retailers",..._,rows:3})}),a.jsx(Sn,{children:"Shopping behavior and preferences"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"brandPreferences",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Brand Preferences"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Favorite brands, brand values alignment",..._,rows:3})}),a.jsx(Sn,{children:"Preferred brands and reasoning"}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(xt,{control:p.control,name:"communicationPreferences",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Communication Preferences"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Email, phone, text, video calls, in-person",..._,rows:3})}),a.jsx(Sn,{children:"Preferred communication methods and channels"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"paymentMethods",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Payment Methods"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Credit cards, digital wallets, cash, BNPL",..._,rows:3})}),a.jsx(Sn,{children:"Preferred payment methods and financial tools"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"purchaseBehaviour",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Purchase Behavior"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Research habits, decision factors, impulse vs planned buying",..._,rows:3})}),a.jsx(Sn,{children:"How they approach making purchase decisions"}),a.jsx(vt,{})]})})]})]})]})})}),a.jsxs(yn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(yt,{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(xt,{control:p.control,name:"coreValues",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Core Values"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Key principles and values that guide decisions",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"lifestyleChoices",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Lifestyle Choices"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Health, fitness, diet, work-life balance preferences",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"socialActivities",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Social Activities"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Social hobbies, community involvement, networking",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"categoryKnowledge",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Category Knowledge"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Expertise in specific product/service categories",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"decisionInfluences",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Decision Influences"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"What factors most influence their decisions",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"painPoints",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Pain Points"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Common challenges and friction points",..._,rows:3})}),a.jsx(vt,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(xt,{control:p.control,name:"journeyContext",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Journey Context"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Current life stage and contextual factors",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"keyTouchpoints",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Key Touchpoints"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Important interaction points and channels",..._,rows:3})}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(xt,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Autonomy"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Need for independence and self-direction",..._,rows:2})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Competence"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Need to feel capable and effective",..._,rows:2})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Relatedness"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Need for connection and belonging",..._,rows:2})}),a.jsx(vt,{})]})})]})]})]})]})}),a.jsx(yt,{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(Kt,{value:_,onChange:j=>m("fears",A,j.target.value),placeholder:"Enter a fear or concern"}),a.jsx(ie,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("fears",A),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},A)),a.jsxs(ie,{variant:"outline",size:"sm",type:"button",onClick:()=>v("fears"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(xt,{control:p.control,name:"narrative",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Personal Narrative"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Personal story, background, key life experiences",..._,rows:4})}),a.jsx(Sn,{children:"A brief narrative that captures their personal story"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:p.control,name:"additionalInformation",render:({field:_})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Additional Information"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Any other relevant details or context",..._,rows:4})}),a.jsx(Sn,{children:"Additional context or details not covered elsewhere"}),a.jsx(vt,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(ie,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(ie,{type:"submit",disabled:i,children:[i?a.jsx(Yee,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(MN,{className:"mr-2 h-4 w-4"}),i?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var S1=["Enter"," "],ede=["ArrowDown","PageUp","Home"],RH=["ArrowUp","PageDown","End"],tde=[...ede,...RH],nde={ltr:[...S1,"ArrowRight"],rtl:[...S1,"ArrowLeft"]},rde={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Zg="Menu",[$m,ide,ode]=Iw(Zg),[Du,MH]=Bi(Zg,[ode,Vf,rh]),zw=Vf(),DH=rh(),[sde,$u]=Du(Zg),[ade,ev]=Du(Zg),$H=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:i,onOpenChange:o,modal:s=!0}=t,c=zw(e),[l,u]=g.useState(null),d=g.useRef(!1),f=Ar(o),h=Mu(i);return g.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),a.jsx(J5,{...c,children:a.jsx(sde,{scope:e,open:n,onOpenChange:f,content:l,onContentChange:u,children:a.jsx(ade,{scope:e,onClose:g.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:s,children:r})})})};$H.displayName=Zg;var cde="MenuAnchor",wk=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=zw(n);return a.jsx(xN,{...i,...r,ref:e})});wk.displayName=cde;var Sk="MenuPortal",[lde,LH]=Du(Sk,{forceMount:void 0}),FH=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:i}=t,o=$u(Sk,e);return a.jsx(lde,{scope:e,forceMount:n,children:a.jsx(Yr,{present:n||o.open,children:a.jsx(Z0,{asChild:!0,container:i,children:r})})})};FH.displayName=Sk;var To="MenuContent",[ude,Ck]=Du(To),BH=g.forwardRef((t,e)=>{const n=LH(To,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=$u(To,t.__scopeMenu),s=ev(To,t.__scopeMenu);return a.jsx($m.Provider,{scope:t.__scopeMenu,children:a.jsx(Yr,{present:r||o.open,children:a.jsx($m.Slot,{scope:t.__scopeMenu,children:s.modal?a.jsx(dde,{...i,ref:e}):a.jsx(fde,{...i,ref:e})})})})}),dde=g.forwardRef((t,e)=>{const n=$u(To,t.__scopeMenu),r=g.useRef(null),i=It(e,r);return g.useEffect(()=>{const o=r.current;if(o)return ck(o)},[]),a.jsx(_k,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Le(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),fde=g.forwardRef((t,e)=>{const n=$u(To,t.__scopeMenu);return a.jsx(_k,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),_k=g.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:v,...m}=t,y=$u(To,n),b=ev(To,n),x=zw(n),w=DH(n),S=ide(n),[C,_]=g.useState(null),A=g.useRef(null),j=It(e,A,y.onContentChange),T=g.useRef(0),k=g.useRef(""),O=g.useRef(0),E=g.useRef(null),R=g.useRef("right"),D=g.useRef(0),V=v?Dw:g.Fragment,L=v?{as:ea,allowPinchZoom:!0}:void 0,z=$=>{var U,de;const Q=k.current+$,q=S().filter(se=>!se.disabled),te=document.activeElement,xe=(U=q.find(se=>se.ref.current===te))==null?void 0:U.textValue,B=q.map(se=>se.textValue),ce=_de(B,Q,xe),he=(de=q.find(se=>se.textValue===ce))==null?void 0:de.ref.current;(function se(ne){k.current=ne,window.clearTimeout(T.current),ne!==""&&(T.current=window.setTimeout(()=>se(""),1e3))})(Q),he&&setTimeout(()=>he.focus())};g.useEffect(()=>()=>window.clearTimeout(T.current),[]),ak();const M=g.useCallback($=>{var q,te;return R.current===((q=E.current)==null?void 0:q.side)&&jde($,(te=E.current)==null?void 0:te.area)},[]);return a.jsx(ude,{scope:n,searchRef:k,onItemEnter:g.useCallback($=>{M($)&&$.preventDefault()},[M]),onItemLeave:g.useCallback($=>{var Q;M($)||((Q=A.current)==null||Q.focus(),_(null))},[M]),onTriggerLeave:g.useCallback($=>{M($)&&$.preventDefault()},[M]),pointerGraceTimerRef:O,onPointerGraceIntentChange:g.useCallback($=>{E.current=$},[]),children:a.jsx(V,{...L,children:a.jsx(Rw,{asChild:!0,trapped:i,onMountAutoFocus:Le(o,$=>{var Q;$.preventDefault(),(Q=A.current)==null||Q.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:a.jsx(Rg,{asChild:!0,disableOutsidePointerEvents:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(vk,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:C,onCurrentTabStopIdChange:_,onEntryFocus:Le(l,$=>{b.isUsingKeyboardRef.current||$.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(bN,{role:"menu","aria-orientation":"vertical","data-state":nV(y.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:j,style:{outline:"none",...m.style},onKeyDown:Le(m.onKeyDown,$=>{const q=$.target.closest("[data-radix-menu-content]")===$.currentTarget,te=$.ctrlKey||$.altKey||$.metaKey,xe=$.key.length===1;q&&($.key==="Tab"&&$.preventDefault(),!te&&xe&&z($.key));const B=A.current;if($.target!==B||!tde.includes($.key))return;$.preventDefault();const he=S().filter(U=>!U.disabled).map(U=>U.ref.current);RH.includes($.key)&&he.reverse(),Sde(he)}),onBlur:Le(t.onBlur,$=>{$.currentTarget.contains($.target)||(window.clearTimeout(T.current),k.current="")}),onPointerMove:Le(t.onPointerMove,Lm($=>{const Q=$.target,q=D.current!==$.clientX;if($.currentTarget.contains(Q)&&q){const te=$.clientX>D.current?"right":"left";R.current=te,D.current=$.clientX}}))})})})})})})});BH.displayName=To;var hde="MenuGroup",Ak=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(ht.div,{role:"group",...r,ref:e})});Ak.displayName=hde;var pde="MenuLabel",UH=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(ht.div,{...r,ref:e})});UH.displayName=pde;var pb="MenuItem",O2="menu.itemSelect",Hw=g.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...i}=t,o=g.useRef(null),s=ev(pb,t.__scopeMenu),c=Ck(pb,t.__scopeMenu),l=It(e,o),u=g.useRef(!1),d=()=>{const f=o.current;if(!n&&f){const h=new CustomEvent(O2,{bubbles:!0,cancelable:!0});f.addEventListener(O2,p=>r==null?void 0:r(p),{once:!0}),P5(f,h),h.defaultPrevented?u.current=!1:s.onClose()}};return a.jsx(zH,{...i,ref:l,disabled:n,onClick:Le(t.onClick,d),onPointerDown:f=>{var h;(h=t.onPointerDown)==null||h.call(t,f),u.current=!0},onPointerUp:Le(t.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Le(t.onKeyDown,f=>{const h=c.searchRef.current!=="";n||h&&f.key===" "||S1.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Hw.displayName=pb;var zH=g.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:i,...o}=t,s=Ck(pb,n),c=DH(n),l=g.useRef(null),u=It(e,l),[d,f]=g.useState(!1),[h,p]=g.useState("");return g.useEffect(()=>{const v=l.current;v&&p((v.textContent??"").trim())},[o.children]),a.jsx($m.ItemSlot,{scope:n,disabled:r,textValue:i??h,children:a.jsx(yk,{asChild:!0,...c,focusable:!r,children:a.jsx(ht.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...o,ref:u,onPointerMove:Le(t.onPointerMove,Lm(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Le(t.onPointerLeave,Lm(v=>s.onItemLeave(v))),onFocus:Le(t.onFocus,()=>f(!0)),onBlur:Le(t.onBlur,()=>f(!1))})})})}),mde="MenuCheckboxItem",HH=g.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...i}=t;return a.jsx(qH,{scope:t.__scopeMenu,checked:n,children:a.jsx(Hw,{role:"menuitemcheckbox","aria-checked":mb(n)?"mixed":n,...i,ref:e,"data-state":Ek(n),onSelect:Le(i.onSelect,()=>r==null?void 0:r(mb(n)?!0:!n),{checkForDefaultPrevented:!1})})})});HH.displayName=mde;var VH="MenuRadioGroup",[gde,vde]=Du(VH,{value:void 0,onValueChange:()=>{}}),GH=g.forwardRef((t,e)=>{const{value:n,onValueChange:r,...i}=t,o=Ar(r);return a.jsx(gde,{scope:t.__scopeMenu,value:n,onValueChange:o,children:a.jsx(Ak,{...i,ref:e})})});GH.displayName=VH;var KH="MenuRadioItem",WH=g.forwardRef((t,e)=>{const{value:n,...r}=t,i=vde(KH,t.__scopeMenu),o=n===i.value;return a.jsx(qH,{scope:t.__scopeMenu,checked:o,children:a.jsx(Hw,{role:"menuitemradio","aria-checked":o,...r,ref:e,"data-state":Ek(o),onSelect:Le(r.onSelect,()=>{var s;return(s=i.onValueChange)==null?void 0:s.call(i,n)},{checkForDefaultPrevented:!1})})})});WH.displayName=KH;var jk="MenuItemIndicator",[qH,yde]=Du(jk,{checked:!1}),YH=g.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...i}=t,o=yde(jk,n);return a.jsx(Yr,{present:r||mb(o.checked)||o.checked===!0,children:a.jsx(ht.span,{...i,ref:e,"data-state":Ek(o.checked)})})});YH.displayName=jk;var xde="MenuSeparator",QH=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(ht.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});QH.displayName=xde;var bde="MenuArrow",XH=g.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,i=zw(n);return a.jsx(wN,{...i,...r,ref:e})});XH.displayName=bde;var wde="MenuSub",[tUe,JH]=Du(wde),lp="MenuSubTrigger",ZH=g.forwardRef((t,e)=>{const n=$u(lp,t.__scopeMenu),r=ev(lp,t.__scopeMenu),i=JH(lp,t.__scopeMenu),o=Ck(lp,t.__scopeMenu),s=g.useRef(null),{pointerGraceTimerRef:c,onPointerGraceIntentChange:l}=o,u={__scopeMenu:t.__scopeMenu},d=g.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return g.useEffect(()=>d,[d]),g.useEffect(()=>{const f=c.current;return()=>{window.clearTimeout(f),l(null)}},[c,l]),a.jsx(wk,{asChild:!0,...u,children:a.jsx(zH,{id:i.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":i.contentId,"data-state":nV(n.open),...t,ref:Y0(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:Le(t.onPointerMove,Lm(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:Le(t.onPointerLeave,Lm(f=>{var p,v;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(v=n.content)==null?void 0:v.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:Le(t.onKeyDown,f=>{var p;const h=o.searchRef.current!=="";t.disabled||h&&f.key===" "||nde[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});ZH.displayName=lp;var eV="MenuSubContent",tV=g.forwardRef((t,e)=>{const n=LH(To,t.__scopeMenu),{forceMount:r=n.forceMount,...i}=t,o=$u(To,t.__scopeMenu),s=ev(To,t.__scopeMenu),c=JH(eV,t.__scopeMenu),l=g.useRef(null),u=It(e,l);return a.jsx($m.Provider,{scope:t.__scopeMenu,children:a.jsx(Yr,{present:r||o.open,children:a.jsx($m.Slot,{scope:t.__scopeMenu,children:a.jsx(_k,{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:Le(t.onFocusOutside,d=>{d.target!==c.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Le(t.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:Le(t.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=rde[s.dir].includes(d.key);f&&h&&(o.onOpenChange(!1),(p=c.trigger)==null||p.focus(),d.preventDefault())})})})})})});tV.displayName=eV;function nV(t){return t?"open":"closed"}function mb(t){return t==="indeterminate"}function Ek(t){return mb(t)?"indeterminate":t?"checked":"unchecked"}function Sde(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Cde(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function _de(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=Cde(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 Ade(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 jde(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Ade(n,e)}function Lm(t){return e=>e.pointerType==="mouse"?t(e):void 0}var Ede=$H,Nde=wk,Tde=FH,kde=BH,Pde=Ak,Ode=UH,Ide=Hw,Rde=HH,Mde=GH,Dde=WH,$de=YH,Lde=QH,Fde=XH,Bde=ZH,Ude=tV,Nk="DropdownMenu",[zde,nUe]=Bi(Nk,[MH]),_i=MH(),[Hde,rV]=zde(Nk),iV=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:i,defaultOpen:o,onOpenChange:s,modal:c=!0}=t,l=_i(e),u=g.useRef(null),[d=!1,f]=ms({prop:i,defaultProp:o,onChange:s});return a.jsx(Hde,{scope:e,triggerId:ss(),triggerRef:u,contentId:ss(),open:d,onOpenChange:f,onOpenToggle:g.useCallback(()=>f(h=>!h),[f]),modal:c,children:a.jsx(Ede,{...l,open:d,onOpenChange:f,dir:r,modal:c,children:n})})};iV.displayName=Nk;var oV="DropdownMenuTrigger",sV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...i}=t,o=rV(oV,n),s=_i(n);return a.jsx(Nde,{asChild:!0,...s,children:a.jsx(ht.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:Y0(e,o.triggerRef),onPointerDown:Le(t.onPointerDown,c=>{!r&&c.button===0&&c.ctrlKey===!1&&(o.onOpenToggle(),o.open||c.preventDefault())}),onKeyDown:Le(t.onKeyDown,c=>{r||(["Enter"," "].includes(c.key)&&o.onOpenToggle(),c.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})});sV.displayName=oV;var Vde="DropdownMenuPortal",aV=t=>{const{__scopeDropdownMenu:e,...n}=t,r=_i(e);return a.jsx(Tde,{...r,...n})};aV.displayName=Vde;var cV="DropdownMenuContent",lV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=rV(cV,n),o=_i(n),s=g.useRef(!1);return a.jsx(kde,{id:i.contentId,"aria-labelledby":i.triggerId,...o,...r,ref:e,onCloseAutoFocus:Le(t.onCloseAutoFocus,c=>{var l;s.current||(l=i.triggerRef.current)==null||l.focus(),s.current=!1,c.preventDefault()}),onInteractOutside:Le(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)"}})});lV.displayName=cV;var Gde="DropdownMenuGroup",Kde=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Pde,{...i,...r,ref:e})});Kde.displayName=Gde;var Wde="DropdownMenuLabel",uV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Ode,{...i,...r,ref:e})});uV.displayName=Wde;var qde="DropdownMenuItem",dV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Ide,{...i,...r,ref:e})});dV.displayName=qde;var Yde="DropdownMenuCheckboxItem",fV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Rde,{...i,...r,ref:e})});fV.displayName=Yde;var Qde="DropdownMenuRadioGroup",Xde=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Mde,{...i,...r,ref:e})});Xde.displayName=Qde;var Jde="DropdownMenuRadioItem",hV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Dde,{...i,...r,ref:e})});hV.displayName=Jde;var Zde="DropdownMenuItemIndicator",pV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx($de,{...i,...r,ref:e})});pV.displayName=Zde;var efe="DropdownMenuSeparator",mV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Lde,{...i,...r,ref:e})});mV.displayName=efe;var tfe="DropdownMenuArrow",nfe=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Fde,{...i,...r,ref:e})});nfe.displayName=tfe;var rfe="DropdownMenuSubTrigger",gV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Bde,{...i,...r,ref:e})});gV.displayName=rfe;var ife="DropdownMenuSubContent",vV=g.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,i=_i(n);return a.jsx(Ude,{...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)"}})});vV.displayName=ife;var ofe=iV,sfe=sV,afe=aV,yV=lV,xV=uV,bV=dV,wV=fV,SV=hV,CV=pV,_V=mV,AV=gV,jV=vV;const C1=ofe,_1=sfe,cfe=g.forwardRef(({className:t,inset:e,children:n,...r},i)=>a.jsxs(AV,{ref:i,className:Fe("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(mo,{className:"ml-auto h-4 w-4"})]}));cfe.displayName=AV.displayName;const lfe=g.forwardRef(({className:t,...e},n)=>a.jsx(jV,{ref:n,className:Fe("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}));lfe.displayName=jV.displayName;const gb=g.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(afe,{children:a.jsx(yV,{ref:r,sideOffset:e,className:Fe("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})}));gb.displayName=yV.displayName;const mc=g.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(bV,{ref:r,className:Fe("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}));mc.displayName=bV.displayName;const ufe=g.forwardRef(({className:t,children:e,checked:n,...r},i)=>a.jsxs(wV,{ref:i,className:Fe("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(CV,{children:a.jsx(Io,{className:"h-4 w-4"})})}),e]}));ufe.displayName=wV.displayName;const dfe=g.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(SV,{ref:r,className:Fe("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(CV,{children:a.jsx(IN,{className:"h-2 w-2 fill-current"})})}),e]}));dfe.displayName=SV.displayName;const ffe=g.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(xV,{ref:r,className:Fe("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));ffe.displayName=xV.displayName;const hfe=g.forwardRef(({className:t,...e},n)=>a.jsx(_V,{ref:n,className:Fe("-mx-1 my-1 h-px bg-muted",t),...e}));hfe.displayName=_V.displayName;var Tk="Dialog",[EV,NV]=Bi(Tk),[pfe,Cs]=EV(Tk),TV=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:i,onOpenChange:o,modal:s=!0}=t,c=g.useRef(null),l=g.useRef(null),[u=!1,d]=ms({prop:r,defaultProp:i,onChange:o});return a.jsx(pfe,{scope:e,triggerRef:c,contentRef:l,contentId:ss(),titleId:ss(),descriptionId:ss(),open:u,onOpenChange:d,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),modal:s,children:n})};TV.displayName=Tk;var kV="DialogTrigger",PV=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cs(kV,n),o=It(e,i.triggerRef);return a.jsx(ht.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Ok(i.open),...r,ref:o,onClick:Le(t.onClick,i.onOpenToggle)})});PV.displayName=kV;var kk="DialogPortal",[mfe,OV]=EV(kk,{forceMount:void 0}),IV=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:i}=t,o=Cs(kk,e);return a.jsx(mfe,{scope:e,forceMount:n,children:g.Children.map(r,s=>a.jsx(Yr,{present:n||o.open,children:a.jsx(Z0,{asChild:!0,container:i,children:s})}))})};IV.displayName=kk;var vb="DialogOverlay",RV=g.forwardRef((t,e)=>{const n=OV(vb,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=Cs(vb,t.__scopeDialog);return o.modal?a.jsx(Yr,{present:r||o.open,children:a.jsx(gfe,{...i,ref:e})}):null});RV.displayName=vb;var gfe=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cs(vb,n);return a.jsx(Dw,{as:ea,allowPinchZoom:!0,shards:[i.contentRef],children:a.jsx(ht.div,{"data-state":Ok(i.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),Au="DialogContent",MV=g.forwardRef((t,e)=>{const n=OV(Au,t.__scopeDialog),{forceMount:r=n.forceMount,...i}=t,o=Cs(Au,t.__scopeDialog);return a.jsx(Yr,{present:r||o.open,children:o.modal?a.jsx(vfe,{...i,ref:e}):a.jsx(yfe,{...i,ref:e})})});MV.displayName=Au;var vfe=g.forwardRef((t,e)=>{const n=Cs(Au,t.__scopeDialog),r=g.useRef(null),i=It(e,n.contentRef,r);return g.useEffect(()=>{const o=r.current;if(o)return ck(o)},[]),a.jsx(DV,{...t,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Le(t.onCloseAutoFocus,o=>{var s;o.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:Le(t.onPointerDownOutside,o=>{const s=o.detail.originalEvent,c=s.button===0&&s.ctrlKey===!0;(s.button===2||c)&&o.preventDefault()}),onFocusOutside:Le(t.onFocusOutside,o=>o.preventDefault())})}),yfe=g.forwardRef((t,e)=>{const n=Cs(Au,t.__scopeDialog),r=g.useRef(!1),i=g.useRef(!1);return a.jsx(DV,{...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()}})}),DV=g.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:o,...s}=t,c=Cs(Au,n),l=g.useRef(null),u=It(e,l);return ak(),a.jsxs(a.Fragment,{children:[a.jsx(Rw,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:o,children:a.jsx(Rg,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Ok(c.open),...s,ref:u,onDismiss:()=>c.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(bfe,{titleId:c.titleId}),a.jsx(Sfe,{contentRef:l,descriptionId:c.descriptionId})]})]})}),Pk="DialogTitle",$V=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cs(Pk,n);return a.jsx(ht.h2,{id:i.titleId,...r,ref:e})});$V.displayName=Pk;var LV="DialogDescription",FV=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cs(LV,n);return a.jsx(ht.p,{id:i.descriptionId,...r,ref:e})});FV.displayName=LV;var BV="DialogClose",UV=g.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,i=Cs(BV,n);return a.jsx(ht.button,{type:"button",...r,ref:e,onClick:Le(t.onClick,()=>i.onOpenChange(!1))})});UV.displayName=BV;function Ok(t){return t?"open":"closed"}var zV="DialogTitleWarning",[xfe,HV]=RQ(zV,{contentName:Au,titleName:Pk,docsSlug:"dialog"}),bfe=({titleId:t})=>{const e=HV(zV),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. - -For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return g.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},wfe="DialogDescriptionWarning",Sfe=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${HV(wfe).contentName}}.`;return g.useEffect(()=>{var o;const i=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&i&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},VV=TV,Cfe=PV,GV=IV,Ik=RV,Rk=MV,Mk=$V,Dk=FV,$k=UV,KV="AlertDialog",[_fe,rUe]=Bi(KV,[NV]),nc=NV(),WV=t=>{const{__scopeAlertDialog:e,...n}=t,r=nc(e);return a.jsx(VV,{...r,...n,modal:!0})};WV.displayName=KV;var Afe="AlertDialogTrigger",jfe=g.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=nc(n);return a.jsx(Cfe,{...i,...r,ref:e})});jfe.displayName=Afe;var Efe="AlertDialogPortal",qV=t=>{const{__scopeAlertDialog:e,...n}=t,r=nc(e);return a.jsx(GV,{...r,...n})};qV.displayName=Efe;var Nfe="AlertDialogOverlay",YV=g.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=nc(n);return a.jsx(Ik,{...i,...r,ref:e})});YV.displayName=Nfe;var Rd="AlertDialogContent",[Tfe,kfe]=_fe(Rd),QV=g.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...i}=t,o=nc(n),s=g.useRef(null),c=It(e,s),l=g.useRef(null);return a.jsx(xfe,{contentName:Rd,titleName:XV,docsSlug:"alert-dialog",children:a.jsx(Tfe,{scope:n,cancelRef:l,children:a.jsxs(Rk,{role:"alertdialog",...o,...i,ref:c,onOpenAutoFocus:Le(i.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(uN,{children:r}),a.jsx(Ofe,{contentRef:s})]})})})});QV.displayName=Rd;var XV="AlertDialogTitle",JV=g.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=nc(n);return a.jsx(Mk,{...i,...r,ref:e})});JV.displayName=XV;var ZV="AlertDialogDescription",eG=g.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=nc(n);return a.jsx(Dk,{...i,...r,ref:e})});eG.displayName=ZV;var Pfe="AlertDialogAction",tG=g.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,i=nc(n);return a.jsx($k,{...i,...r,ref:e})});tG.displayName=Pfe;var nG="AlertDialogCancel",rG=g.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:i}=kfe(nG,n),o=nc(n),s=It(e,i);return a.jsx($k,{...o,...r,ref:s})});rG.displayName=nG;var Ofe=({contentRef:t})=>{const e=`\`${Rd}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${Rd}\` by passing a \`${ZV}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -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 \`${Rd}\`. 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 g.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Ife=WV,Rfe=qV,iG=YV,oG=QV,sG=tG,aG=rG,cG=JV,lG=eG;const A1=Ife,Mfe=Rfe,uG=g.forwardRef(({className:t,...e},n)=>a.jsx(iG,{className:Fe("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}));uG.displayName=iG.displayName;const yb=g.forwardRef(({className:t,...e},n)=>a.jsxs(Mfe,{children:[a.jsx(uG,{}),a.jsx(oG,{ref:n,className:Fe("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})]}));yb.displayName=oG.displayName;const xb=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col space-y-2 text-center sm:text-left",t),...e});xb.displayName="AlertDialogHeader";const bb=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});bb.displayName="AlertDialogFooter";const wb=g.forwardRef(({className:t,...e},n)=>a.jsx(cG,{ref:n,className:Fe("text-lg font-semibold",t),...e}));wb.displayName=cG.displayName;const Sb=g.forwardRef(({className:t,...e},n)=>a.jsx(lG,{ref:n,className:Fe("text-sm text-muted-foreground",t),...e}));Sb.displayName=lG.displayName;const Cb=g.forwardRef(({className:t,...e},n)=>a.jsx(sG,{ref:n,className:Fe(QT(),t),...e}));Cb.displayName=sG.displayName;const _b=g.forwardRef(({className:t,...e},n)=>a.jsx(aG,{ref:n,className:Fe(QT({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));_b.displayName=aG.displayName;const Ma=VV,Dfe=GV,dG=g.forwardRef(({className:t,...e},n)=>a.jsx(Ik,{ref:n,className:Fe("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}));dG.displayName=Ik.displayName;const Ws=g.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(Dfe,{children:[a.jsx(dG,{}),a.jsxs(Rk,{ref:r,className:Fe("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($k,{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(Mi,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ws.displayName=Rk.displayName;const qs=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});qs.displayName="DialogHeader";const Ys=({className:t,...e})=>a.jsx("div",{className:Fe("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ys.displayName="DialogFooter";const Qs=g.forwardRef(({className:t,...e},n)=>a.jsx(Mk,{ref:n,className:Fe("text-lg font-semibold leading-none tracking-tight",t),...e}));Qs.displayName=Mk.displayName;const Da=g.forwardRef(({className:t,...e},n)=>a.jsx(Dk,{ref:n,className:Fe("text-sm text-muted-foreground",t),...e}));Da.displayName=Dk.displayName;var Lk="Radio",[$fe,fG]=Bi(Lk),[Lfe,Ffe]=$fe(Lk),hG=g.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]=g.useState(null),p=It(e,y=>h(y)),v=g.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(Lfe,{scope:n,checked:i,disabled:s,children:[a.jsx(ht.button,{type:"button",role:"radio","aria-checked":i,"data-state":gG(i),"data-disabled":s?"":void 0,disabled:s,value:c,...d,ref:p,onClick:Le(t.onClick,y=>{i||l==null||l(),m&&(v.current=y.isPropagationStopped(),v.current||y.stopPropagation())})}),m&&a.jsx(Bfe,{control:f,bubbles:!v.current,name:r,value:c,checked:i,required:o,disabled:s,form:u,style:{transform:"translateX(-100%)"}})]})});hG.displayName=Lk;var pG="RadioIndicator",mG=g.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...i}=t,o=Ffe(pG,n);return a.jsx(Yr,{present:r||o.checked,children:a.jsx(ht.span,{"data-state":gG(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:e})})});mG.displayName=pG;var Bfe=t=>{const{control:e,checked:n,bubbles:r=!0,...i}=t,o=g.useRef(null),s=Wg(n),c=Dg(e);return g.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 gG(t){return t?"checked":"unchecked"}var Ufe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Fk="RadioGroup",[zfe,iUe]=Bi(Fk,[rh,fG]),vG=rh(),yG=fG(),[Hfe,Vfe]=zfe(Fk),xG=g.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=vG(n),v=Mu(u),[m,y]=ms({prop:o,defaultProp:i,onChange:f});return a.jsx(Hfe,{scope:n,name:r,required:s,disabled:c,value:m,onValueChange:y,children:a.jsx(vk,{asChild:!0,...p,orientation:l,dir:v,loop:d,children:a.jsx(ht.div,{role:"radiogroup","aria-required":s,"aria-orientation":l,"data-disabled":c?"":void 0,dir:v,...h,ref:e})})})});xG.displayName=Fk;var bG="RadioGroupItem",wG=g.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...i}=t,o=Vfe(bG,n),s=o.disabled||r,c=vG(n),l=yG(n),u=g.useRef(null),d=It(e,u),f=o.value===i.value,h=g.useRef(!1);return g.useEffect(()=>{const p=m=>{Ufe.includes(m.key)&&(h.current=!0)},v=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",v),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",v)}},[]),a.jsx(yk,{asChild:!0,...c,focusable:!s,active:f,children:a.jsx(hG,{disabled:s,required:o.required,checked:f,...l,...i,name:o.name,ref:d,onCheck:()=>o.onValueChange(i.value),onKeyDown:Le(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Le(i.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});wG.displayName=bG;var Gfe="RadioGroupIndicator",SG=g.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,i=yG(n);return a.jsx(mG,{...i,...r,ref:e})});SG.displayName=Gfe;var CG=xG,_G=wG,Kfe=SG;const j1=g.forwardRef(({className:t,...e},n)=>a.jsx(CG,{className:Fe("grid gap-2",t),...e,ref:n}));j1.displayName=CG.displayName;const up=g.forwardRef(({className:t,...e},n)=>a.jsx(_G,{ref:n,className:Fe("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(Kfe,{className:"flex items-center justify-center",children:a.jsx(IN,{className:"h-2.5 w-2.5 fill-current text-current"})})}));up.displayName=_G.displayName;var Bk="Checkbox",[Wfe,oUe]=Bi(Bk),[qfe,Yfe]=Wfe(Bk),AG=g.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]=g.useState(null),v=It(e,S=>p(S)),m=g.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=ms({prop:i,defaultProp:o,onChange:u}),w=g.useRef(b);return g.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(qfe,{scope:n,state:b,disabled:c,children:[a.jsx(ht.button,{type:"button",role:"checkbox","aria-checked":Yc(b)?"mixed":b,"aria-required":s,"data-state":NG(b),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:v,onKeyDown:Le(t.onKeyDown,S=>{S.key==="Enter"&&S.preventDefault()}),onClick:Le(t.onClick,S=>{x(C=>Yc(C)?!0:!C),y&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),y&&a.jsx(Qfe,{control:h,bubbles:!m.current,name:r,value:l,checked:b,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Yc(o)?!1:o})]})});AG.displayName=Bk;var jG="CheckboxIndicator",EG=g.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...i}=t,o=Yfe(jG,n);return a.jsx(Yr,{present:r||Yc(o.state)||o.state===!0,children:a.jsx(ht.span,{"data-state":NG(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:e,style:{pointerEvents:"none",...t.style}})})});EG.displayName=jG;var Qfe=t=>{const{control:e,checked:n,bubbles:r=!0,defaultChecked:i,...o}=t,s=g.useRef(null),c=Wg(n),l=Dg(e);g.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const v=new Event("click",{bubbles:r});d.indeterminate=Yc(n),p.call(d,Yc(n)?!1:n),d.dispatchEvent(v)}},[c,n,r]);const u=g.useRef(Yc(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 Yc(t){return t==="indeterminate"}function NG(t){return Yc(t)?"indeterminate":t?"checked":"unchecked"}var TG=AG,Xfe=EG;const Gl=g.forwardRef(({className:t,...e},n)=>a.jsx(TG,{ref:n,className:Fe("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(Xfe,{className:Fe("flex items-center justify-center text-current"),children:a.jsx(Io,{className:"h-4 w-4"})})}));Gl.displayName=TG.displayName;const Uk=({isActive:t,isComplete:e,hasError:n,label:r,onComplete:i,className:o})=>{const[s,c]=g.useState(0),[l,u]=g.useState("progressing"),[d,f]=g.useState(!1),h=g.useRef(null),p=g.useRef(null),v=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{v(),c(0),u("progressing"),f(!1)},y=S=>{v(),u("completing");const C=100-S,_=50,A=500/_,j=C/A;let T=0;h.current=setInterval(()=>{T++;const k=S+j*T;k>=100||T>=A?(c(100),u("completed"),v(),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=()=>{v()};return g.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"),v()):c(C)},100)}return e&&l==="progressing"&&b(),e&&l==="waiting"&&x(),n&&(l==="progressing"||l==="waiting")&&w(),!t&&d&&m(),()=>{t||v()}},[t,e,n,l,d]),g.useEffect(()=>()=>{v()},[]),d?a.jsxs("div",{className:Fe("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(Ic,{value:s,className:Fe("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},Wn="all",Jfe=()=>{var Jt,en,In,cn;const t=g.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),e=ur(),[n]=Tee(),{loadPersonas:r}=Yz(),{clearNavigationState:i}=Ug(),[o,s]=g.useState("view"),[c,l]=g.useState("ai"),[u,d]=g.useState("");g.useState(null);const[f,h]=g.useState(Wn),[p,v]=g.useState(!1),[m,y]=g.useState("");g.useEffect(()=>{const G=n.get("mode");(G==="view"||G==="create")&&s(G)},[n]);const[b,x]=g.useState([]),[w,S]=g.useState([]),[C,_]=g.useState(!0);g.useState(null);const[A,j]=g.useState(new Set),[T,k]=g.useState(!1),[O,E]=g.useState(null),[R,D]=g.useState(""),[V,L]=g.useState(!1),[z,M]=g.useState(null),[$,Q]=g.useState(!1),[q,te]=g.useState(null),[xe,B]=g.useState(!1),[ce,he]=g.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[U,de]=g.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[se,ne]=g.useState(!1),[je,K]=g.useState(!1),[et,Me]=g.useState(!1),[ut,Ye]=g.useState(!1),[Pt,F]=g.useState("gemini-2.5-pro"),J=()=>{ne(!1),K(!1),Me(!1)},oe=G=>{i(),e(`/synthetic-users/${G._id||G.id}`)},ye=G=>{const ke={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return G.forEach(Ce=>{if(Ce.age&&ke.age.add(Ce.age),Ce.gender&&ke.gender.add(Ce.gender),Ce.occupation&&ke.occupation.add(Ce.occupation),Ce.location&&ke.location.add(Ce.location),Ce.techSavviness!==void 0){const We=Ce.techSavviness<30?"Low (0-30)":Ce.techSavviness<70?"Medium (31-70)":"High (71-100)";ke.techSavviness.add(We)}Ce.ethnicity&&ke.ethnicity.add(Ce.ethnicity)}),{age:Array.from(ke.age).sort(),gender:Array.from(ke.gender).sort(),occupation:Array.from(ke.occupation).sort(),location:Array.from(ke.location).sort(),techSavviness:Array.from(ke.techSavviness).sort((Ce,We)=>{const Qe=["Low (0-30)","Medium (31-70)","High (71-100)"];return Qe.indexOf(Ce)-Qe.indexOf(We)}),ethnicity:Array.from(ke.ethnicity).sort()}},Ee=()=>{B(!1),setTimeout(()=>{he({...U})},0)},P=()=>{de({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]})},H=(G,ke)=>{de(Ce=>{const We={...Ce};return We[G].includes(ke)?We[G]=We[G].filter(Qe=>Qe!==ke):We[G]=[...We[G],ke],We})},ee=async()=>{try{const Ce=(await Ms.getAll()).data.map(We=>({...We,id:We._id}));return S(Ce),Ce}catch(G){return console.error("Error fetching folders:",G),Ve.error("Failed to load folders"),S([]),[]}},re=async()=>{_(!0);try{const Ce=(await Er.getAll()).data;{const Qe=[...Ce.map(ot=>({...ot,id:ot.id||ot._id}))];try{(async()=>{const Ft=await r();console.log("Loaded stored personas (for debugging only):",Ft?Ft.length:0)})()}catch(ot){console.warn("Error loading stored personas:",ot)}x(Qe)}}catch(ke){console.error("Error fetching personas:",ke),Ve.error("Failed to load personas"),x([])}finally{_(!1)}};g.useEffect(()=>((async()=>{try{const[,]=await Promise.all([ee(),re()])}catch(ke){console.error("Error loading data:",ke)}})(),()=>{}),[t]),g.useEffect(()=>{var G;if(o==="view")re();else if(o==="create"&&(console.log(`Switching to create mode with folder: ${f}, ${f!==Wn?"NOT default":"IS default"}`),f!==Wn)){const ke=(G=w.find(Ce=>Ce.id===f))==null?void 0:G.name;console.log(`Selected folder for creation: ${f} (${ke})`)}},[o]),g.useEffect(()=>{re();const G=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),re())},ke=()=>{console.log("Synthetic users navigation event detected, refreshing data"),re()};console.log("Setting up MutationObserver for body style");const Ce=new MutationObserver(We=>{We.forEach(Qe=>{Qe.type==="attributes"&&Qe.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),t())})});return Ce.observe(document.body,{attributes:!0,attributeFilter:["style"]}),t(),window.addEventListener("popstate",G),window.addEventListener("syntheticUsersNavigation",ke),()=>{window.removeEventListener("popstate",G),window.removeEventListener("syntheticUsersNavigation",ke),console.log("Disconnecting MutationObserver"),Ce.disconnect()}},[]);const Z=async()=>{if(!m.trim()){Ve.error("Please enter a folder name");return}try{const G=await Ms.create({name:m.trim(),persona_ids:[]});await ee(),y(""),v(!1),Ve.success(`Folder "${m}" created`)}catch(G){console.error("Error creating folder:",G),Ve.error("Failed to create folder")}},Se=()=>{y(""),v(!1)},Ae=G=>{E(G),D(G.name)},Ie=async()=>{if(!O||!R.trim()){E(null);return}try{await Ms.update(O._id,{name:R.trim()}),await ee(),E(null),Ve.success(`Folder renamed to "${R}"`)}catch(G){console.error("Error renaming folder:",G),Ve.error("Failed to rename folder"),E(null)}},Ke=()=>{E(null),D("")},Ue=G=>{M(G),L(!0)},Be=async()=>{if(z)try{await Ms.delete(z._id),await ee(),(f===z._id||f===z.id)&&h(Wn),L(!1),M(null),Ve.success(`Folder "${z.name}" deleted`)}catch(G){console.error("Error deleting folder:",G),Ve.error("Failed to delete folder")}},nt=async(G,ke)=>{var Ft;const Ce=G||A,We=ke||q;if(!We||Ce.size===0)return;const Qe=Array.from(Ce),ot=Qe.map(tt=>{const Zt=b.find($t=>$t.id===tt);return(Zt==null?void 0:Zt._id)||(Zt==null?void 0:Zt.id)||tt}).filter(Boolean);try{const tt=[],Zt=[];if(We!==Wn)try{await Ms.addPersonasBatch(We,ot),tt.push(...Qe)}catch(Xt){console.error("Error adding personas to folder:",Xt),Zt.push(...Qe)}else tt.push(...Qe);await Promise.all([ee(),re()]);const $t=We===Wn?"All Personas":((Ft=w.find(Xt=>Xt._id===We||Xt.id===We))==null?void 0:Ft.name)||"folder";return tt.length>0&&Ve.success(`Added ${tt.length} persona${tt.length!==1?"s":""} to ${$t}`),Zt.length>0&&Ve.error(`Failed to add ${Zt.length} persona${Zt.length!==1?"s":""} to ${$t}.`),G||j(new Set),{success:tt.length>0,successCount:tt.length,failureCount:Zt.length}}catch(tt){return console.error("Error moving personas to folder:",tt),Ve.error("An unexpected error occurred while adding personas to folder."),{success:!1,error:tt}}},Ne=async()=>{var Ce,We,Qe;if(A.size===0||f===Wn)return;const G=Array.from(A),ke=G.map(ot=>{const Ft=b.find(tt=>tt.id===ot);return(Ft==null?void 0:Ft._id)||(Ft==null?void 0:Ft.id)||ot}).filter(Boolean);console.log("Removing personas from folder:",{selectedFolder:f,selectedIds:G,mongoIds:ke,folderName:(Ce=w.find(ot=>ot._id===f))==null?void 0:Ce.name});try{await Ms.removePersonasBatch(f,ke),await Promise.all([ee(),re()]);const ot=((We=w.find(Ft=>Ft._id===f))==null?void 0:We.name)||"folder";Ve.success(`Removed ${G.length} persona${G.length!==1?"s":""} from ${ot}`),j(new Set)}catch(ot){console.error("Error removing personas from folder:",ot),console.error("Error details:",((Qe=ot.response)==null?void 0:Qe.data)||ot.message),Ve.error("Failed to remove personas from folder")}},Nt=G=>{j(ke=>{const Ce=new Set(ke);return Ce.has(G)?Ce.delete(G):Ce.add(G),Ce})},pn=()=>{A.size===rt.length?j(new Set):j(new Set(rt.map(G=>G.id)))},Je=async()=>{if(A.size===0)return;const G=Array.from(A);j(new Set),k(!1),_(!0);const ke=[],Ce=[];for(const We of G)try{const Qe=b.find(Ft=>Ft.id===We);if(!Qe){console.error(`Could not find persona with id: ${We}`),Ce.push(We);continue}let ot=We;Qe._id&&(ot=Qe._id.toString()),console.log(`Attempting to delete persona: ${ot}`),await Er.delete(ot),ke.push(We)}catch(Qe){console.error(`Failed to delete persona ${We}:`,Qe),Ce.push(We)}x(We=>We.filter(Qe=>!ke.includes(Qe.id))),await ee(),_(!1),setTimeout(()=>{ke.length>0&&Ve.success(`Successfully deleted ${ke.length} persona${ke.length!==1?"s":""}`),Ce.length>0&&Ve.error(`Failed to delete ${Ce.length} persona${Ce.length!==1?"s":""}`),(ke.length>0||Ce.length>0)&&re()},50)},rt=b.filter(G=>{const ke=G.name.toLowerCase().includes(u.toLowerCase())||G.occupation.toLowerCase().includes(u.toLowerCase())||G.location.toLowerCase().includes(u.toLowerCase()),Ce=(ce.age.length===0||ce.age.includes(G.age))&&(ce.gender.length===0||ce.gender.includes(G.gender))&&(ce.occupation.length===0||ce.occupation.includes(G.occupation))&&(ce.location.length===0||ce.location.includes(G.location))&&(ce.ethnicity.length===0||G.ethnicity&&ce.ethnicity.includes(G.ethnicity))&&(ce.techSavviness.length===0||G.techSavviness!==void 0&&ce.techSavviness.includes(G.techSavviness<30?"Low (0-30)":G.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&(ce.folderStatus.length===0||ce.folderStatus.includes("hasFolder")&&ce.folderStatus.includes("noFolder")||ce.folderStatus.includes("hasFolder")&&!ce.folderStatus.includes("noFolder")&&(G.folder_ids&&G.folder_ids.length>0||G.folder_id&&G.folder_id!==Wn||G.folderId&&G.folderId!==Wn)||ce.folderStatus.includes("noFolder")&&!ce.folderStatus.includes("hasFolder")&&(!G.folder_ids||G.folder_ids.length===0)&&(!G.folder_id||G.folder_id===Wn)&&(!G.folderId||G.folderId===Wn));return f===Wn||G.folder_ids&&Array.isArray(G.folder_ids)&&G.folder_ids.includes(f)||G.folder_id===f||G.folderId===f?ke&&Ce:!1}),jt=(G,ke)=>{const Ce=new Date().toISOString().split("T")[0],We=G.length;let Qe=`# Persona Summary Report - -`;return Qe+=`**Folder:** ${ke} -`,Qe+=`**Date:** ${Ce} -`,Qe+=`**Total Personas:** ${We} - -`,We===0?(Qe+=`No personas found in this folder. -`,Qe):(G.forEach((ot,Ft)=>{Qe+=`## ${ot.name} - -`,Qe+=`### Demographics -`,Qe+=`- **Age:** ${ot.age} -`,Qe+=`- **Gender:** ${ot.gender} -`,Qe+=`- **Occupation:** ${ot.occupation} -`,Qe+=`- **Location:** ${ot.location} - -`,ot.aiSynthesizedBio&&(Qe+=`### AI-Synthesized Bio -`,Qe+=`${ot.aiSynthesizedBio} - -`),ot.qualitativeAttributes&&ot.qualitativeAttributes.length>0&&(Qe+=`### Key Attributes -`,ot.qualitativeAttributes.forEach(tt=>{Qe+=`- 🏷️ ${tt} -`}),Qe+=` -`),ot.topPersonalityTraits&&ot.topPersonalityTraits.length>0&&(Qe+=`### Top Personality Traits -`,ot.topPersonalityTraits.forEach(tt=>{Qe+=`- 🧠 ${tt} -`}),Qe+=` -`),Ft{if(rt.length===0){Ve.error("No personas to download");return}Ye(!0)},Dt=async()=>{var Ce,We,Qe,ot,Ft;const G=f===Wn?"All Personas":((Ce=w.find(tt=>tt.id===f))==null?void 0:Ce.name)||"Unknown Folder",ke=rt.map(tt=>tt._id||tt.id);console.log(`🤖 Frontend: User selected ${Pt} for persona summary download`),Ye(!1),ne(!0),K(!1),Me(!1),_(!0);try{Ve.info("Generating persona summaries...",{description:`Processing ${rt.length} persona${rt.length!==1?"s":""} with AI`});const tt=await ba.batchGenerateSummaries(ke,.7,Pt),{summaries:Zt,summary_stats:$t,errors:Xt}=tt.data,Rn=new Date().toISOString().split("T")[0],Lo=`persona-summary-${G.toLowerCase().replace(/\s+/g,"-")}-${Rn}.md`;let Zn=`# Persona Summary Report - -`;Zn+=`**Folder:** ${G} -`,Zn+=`**Date:** ${Rn} -`,Zn+=`**Total Personas:** ${$t.total_requested} -`,Zn+=`**Successfully Processed:** ${$t.total_successful} -`,$t.total_failed>0&&(Zn+=`**Failed to Process:** ${$t.total_failed} -`),Zn+=` ---- - -`,Zt.length===0?Zn+=`No persona summaries could be generated. -`:Zt.forEach((lo,jh)=>{Zn+=`# ${lo.persona_name} - -`,Zn+=`${lo.summary} - -`,jh0||((Qe=Xt.missing_personas)==null?void 0:Qe.length)>0)&&(Zn+=` ---- - -## Processing Errors - -`,((ot=Xt.failed_summaries)==null?void 0:ot.length)>0&&(Zn+=`### Failed to Generate Summaries -`,Xt.failed_summaries.forEach(lo=>{Zn+=`- **${lo.persona_name}** (ID: ${lo.persona_id}): ${lo.error} -`}),Zn+=` -`),((Ft=Xt.missing_personas)==null?void 0:Ft.length)>0&&(Zn+=`### Missing Personas -`,Xt.missing_personas.forEach(lo=>{Zn+=`- ID: ${lo} -`})));const Fo=document.createElement("a"),Ah=new Blob([Zn],{type:"text/markdown"});Fo.href=URL.createObjectURL(Ah),Fo.download=Lo,document.body.appendChild(Fo),Fo.click(),document.body.removeChild(Fo),K(!0);const Uu=Pt==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";$t.total_successful===$t.total_requested?Ve.success("Persona summary downloaded",{description:`Successfully processed all ${$t.total_successful} persona${$t.total_successful!==1?"s":""} from "${G}" using ${Uu}`}):Ve.success("Persona summary downloaded with warnings",{description:`Processed ${$t.total_successful} of ${$t.total_requested} personas from "${G}" using ${Uu}`})}catch(tt){console.error("Error generating persona summaries:",tt),tt.response?(console.error("Error response data:",tt.response.data),console.error("Error response status:",tt.response.status),console.error("Error response headers:",tt.response.headers)):tt.request?console.error("Error request:",tt.request):console.error("Error message:",tt.message),Me(!0),Ve.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const Zt=new Date().toISOString().split("T")[0],$t=`persona-summary-basic-${G.toLowerCase().replace(/\s+/g,"-")}-${Zt}.md`,Xt=jt(rt,G),Rn=document.createElement("a"),Lo=new Blob([Xt],{type:"text/markdown"});Rn.href=URL.createObjectURL(Lo),Rn.download=$t,document.body.appendChild(Rn),Rn.click(),document.body.removeChild(Rn)}catch{Ve.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{_(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Ra,{}),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:[o==="view"&&rt.length>0&&a.jsxs(ie,{variant:"outline",onClick:Bt,disabled:se,className:"flex items-center gap-2 hover-transition",children:[a.jsx(ol,{className:"h-4 w-4"}),se?"Generating Summary...":"Download Persona Summary"]}),a.jsx(ie,{onClick:()=>s(o==="view"?"create":"view"),className:"hover-transition",children:o==="view"?"Create New Personas":"View All Personas"})]})})]}),o==="view"&&rt.length>0&&se&&a.jsx("div",{className:"mb-6",children:a.jsx(Uk,{isActive:se,isComplete:je,hasError:et,label:"Generating comprehensive persona summaries",onComplete:J,className:"max-w-4xl mx-auto"})}),o==="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(ie,{variant:"ghost",size:"sm",onClick:()=>v(!0),className:"h-7 w-7 p-0",children:a.jsx(OB,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>h(Wn),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${f===Wn?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(go,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),w.map(G=>a.jsx("div",{className:"flex items-center justify-between group",children:O&&O._id===G._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(go,{className:"h-4 w-4"}),a.jsx(Kt,{value:R,onChange:ke=>D(ke.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:ke=>{ke.key==="Enter"?Ie():ke.key==="Escape"&&Ke()}}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:Ie,className:"h-7 w-7 p-0",children:a.jsx(Io,{className:"h-4 w-4"})}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:Ke,className:"h-7 w-7 p-0",children:a.jsx(Mi,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>h(G._id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${f===G._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(go,{className:"h-4 w-4"}),a.jsx("span",{children:G.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:b.filter(ke=>ke.folder_ids&&ke.folder_ids.includes(G._id)).length})]}),a.jsxs(C1,{children:[a.jsx(_1,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(RA,{className:"h-4 w-4"})})}),a.jsxs(gb,{align:"end",children:[a.jsx(mc,{onClick:()=>Ae(G),children:"Rename"}),a.jsx(mc,{className:"text-red-600",onClick:()=>Ue(G),children:"Delete"})]})]})]})},G._id)),p&&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(go,{className:"h-4 w-4"}),a.jsx(Kt,{value:m,onChange:G=>y(G.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:G=>{G.key==="Enter"?Z():G.key==="Escape"&&Se()}})]}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:Z,className:"h-7 w-7 p-0",children:a.jsx(Io,{className:"h-4 w-4"})}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:Se,className:"h-7 w-7 p-0",children:a.jsx(Mi,{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(Tx,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Kt,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:u,onChange:G=>d(G.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[A.size>0&&a.jsxs(C1,{children:[a.jsx(_1,{asChild:!0,children:a.jsxs(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:G=>{G.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",A.size,")"]}),a.jsx(RA,{className:"h-4 w-4"})]})}),a.jsxs(gb,{align:"end",onCloseAutoFocus:G=>{G.preventDefault()},children:[a.jsxs(mc,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.preventDefault(),G.stopPropagation();const ke=Array.from(A);e("/focus-groups",{state:{mode:"create",preSelectedParticipants:ke}})},children:[a.jsx(na,{className:"h-4 w-4"}),"Create Focus Group with selected Personas"]}),a.jsxs(mc,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.preventDefault(),G.stopPropagation(),k(!0)},children:[a.jsx(Qn,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(mc,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.preventDefault(),G.stopPropagation(),Q(!0)},children:[a.jsx(go,{className:"h-4 w-4"}),"Move to folder"]}),f!==Wn&&a.jsxs(mc,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.preventDefault(),G.stopPropagation(),Ne()},children:[a.jsx(Mi,{className:"h-4 w-4"}),"Remove from ",((Jt=w.find(G=>G._id===f))==null?void 0:Jt.name)||"folder"]})]})]}),a.jsxs(ie,{variant:"outline",className:"flex items-center gap-2",onClick:()=>B(!0),children:[a.jsx(RN,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(ce).some(G=>G.length>0)?` (${Object.values(ce).reduce((G,ke)=>G+ke.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(Fr,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:f===Wn?"Your Synthetic Persona Library":((en=w.find(G=>G._id===f))==null?void 0:en.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",rt.length,")"]})]}),rt.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(Gl,{id:"select-all",checked:rt.length>0&&A.size===rt.length,onCheckedChange:pn,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),rt.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:rt.map(G=>a.jsx("div",{className:"relative group",children:a.jsx(uk,{user:G,selected:A.has(G.id),onClick:()=>oe(G),onSelectionToggle:ke=>{ke.stopPropagation(),Nt(G.id)},showAddToFolderButton:!1,folders:w})},G.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(A1,{open:T,onOpenChange:G=>{k(G||!1)},children:a.jsxs(yb,{onInteractOutside:G=>{G.preventDefault()},children:[a.jsxs(xb,{children:[a.jsx(wb,{children:"Delete Personas"}),a.jsxs(Sb,{children:["Are you sure you want to delete ",A.size," selected persona",A.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(bb,{children:[a.jsx(_b,{onClick:()=>{setTimeout(()=>j(new Set),50)},children:"Cancel"}),a.jsx(Cb,{onClick:Je,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(A1,{open:V,onOpenChange:G=>{L(G||!1)},children:a.jsxs(yb,{children:[a.jsxs(xb,{children:[a.jsx(wb,{children:"Delete Folder"}),a.jsxs(Sb,{children:['Are you sure you want to delete the folder "',z==null?void 0:z.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(bb,{children:[a.jsx(_b,{children:"Cancel"}),a.jsx(Cb,{onClick:Be,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(Ma,{open:$,onOpenChange:G=>{Q(G||!1)},children:a.jsxs(Ws,{className:"z-50",children:[a.jsxs(qs,{children:[a.jsx(Qs,{children:"Move to Folder"}),a.jsxs(Da,{children:["Choose a folder to move ",A.size," selected persona",A.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(j1,{value:q||"",onValueChange:te,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(up,{value:Wn,id:"folder-all"}),a.jsxs(yo,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(go,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),w.map(G=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(up,{value:G._id,id:`folder-${G._id}`}),a.jsxs(yo,{htmlFor:`folder-${G._id}`,className:"flex items-center gap-2",children:[a.jsx(go,{className:"h-4 w-4"}),a.jsx("span",{children:G.name})]})]},G._id))]})}),a.jsxs(Ys,{children:[a.jsx(ie,{variant:"outline",onClick:G=>{G.preventDefault(),G.stopPropagation(),Q(!1),te(null)},children:"Cancel"}),a.jsx(ie,{onClick:async G=>{if(G.preventDefault(),G.stopPropagation(),!q)return;const ke=new Set(A),Ce=q;if(Q(!1),te(null),Ce&&ke.size>0){_(!0);try{await nt(ke,Ce)}finally{_(!1),j(new Set)}}},disabled:!q,children:"Move"})]})]})}),a.jsx(Ma,{open:xe,onOpenChange:G=>{G?(B(G),de({...ce})):(A.size>0&&j(new Set),B(!1))},children:a.jsxs(Ws,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:G=>{G.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(qs,{children:[a.jsx(Qs,{children:"Filter Personas"}),a.jsx(Da,{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(U).some(G=>G.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(U).reduce((G,ke)=>G+ke.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const G=Qe=>{const ot={...U};ot[Qe]=[];const Ft=b.filter(tt=>Object.entries(ot).every(([Zt,$t])=>{if($t.length===0)return!0;const Xt=Zt;if(Xt==="techSavviness"&&tt.techSavviness!==void 0){const Rn=tt.techSavviness<30?"Low (0-30)":tt.techSavviness<70?"Medium (31-70)":"High (71-100)";return $t.includes(Rn)}else{if(Xt==="age"&&tt.age)return $t.includes(tt.age);if(Xt==="gender"&&tt.gender)return $t.includes(tt.gender);if(Xt==="occupation"&&tt.occupation)return $t.includes(tt.occupation);if(Xt==="location"&&tt.location)return $t.includes(tt.location);if(Xt==="ethnicity"&&tt.ethnicity)return $t.includes(tt.ethnicity)}return!0}));return ye(Ft)},ke=Object.values(U).every(Qe=>Qe.length===0),Ce=ye(b),We=(Qe,ot,Ft,tt=1)=>{const Zt=U[ot],$t=[...new Set([...Ft,...Zt])].sort();return $t.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:Qe}),a.jsx("div",{className:`grid grid-cols-1 ${tt===2?"sm:grid-cols-2":tt===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:$t.map(Xt=>{const Rn=U[ot].includes(Xt),Lo=Ft.includes(Xt);return a.jsxs("div",{className:`flex items-center space-x-2 ${!Lo&&!Rn?"opacity-50":""}`,children:[a.jsx(Gl,{id:`${ot}-${Xt}`,checked:Rn,onCheckedChange:()=>H(ot,Xt),disabled:!Lo&&!Rn}),a.jsxs(yo,{htmlFor:`${ot}-${Xt}`,className:"truncate overflow-hidden",children:[Xt,Rn&&!Lo&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},Xt)})})]})};return a.jsxs(a.Fragment,{children:[We("Gender","gender",ke?Ce.gender:G("gender").gender,3),We("Age","age",ke?Ce.age:G("age").age,3),We("Ethnicity","ethnicity",ke?Ce.ethnicity:G("ethnicity").ethnicity,2),We("Location","location",ke?Ce.location:G("location").location,2),We("Occupation","occupation",ke?Ce.occupation:G("occupation").occupation,2),We("Tech Savviness","techSavviness",ke?Ce.techSavviness:G("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(Gl,{id:"folderStatus-hasFolder",checked:U.folderStatus.includes("hasFolder"),onCheckedChange:()=>H("folderStatus","hasFolder")}),a.jsx(yo,{htmlFor:"folderStatus-hasFolder",className:"truncate overflow-hidden",children:"Has folder assignment"})]}),a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(Gl,{id:"folderStatus-noFolder",checked:U.folderStatus.includes("noFolder"),onCheckedChange:()=>H("folderStatus","noFolder")}),a.jsx(yo,{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(Ys,{children:[a.jsx(ie,{variant:"outline",onClick:P,children:"Reset"}),a.jsx(ie,{onClick:Ee,children:"Apply Filters"})]})})]})}),a.jsx(Ma,{open:ut,onOpenChange:Ye,children:a.jsxs(Ws,{children:[a.jsxs(qs,{children:[a.jsx(Qs,{children:"Select AI Model for Summary Generation"}),a.jsx(Da,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(j1,{value:Pt,onValueChange:F,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(up,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(yo,{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(up,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(yo,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(Ys,{children:[a.jsx(ie,{variant:"outline",onClick:()=>Ye(!1),children:"Cancel"}),a.jsx(ie,{onClick:Dt,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(wl,{defaultValue:"ai",onValueChange:G=>l(G),children:[a.jsxs(tc,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(vn,{value:"ai",children:"AI Recruiter"}),a.jsx(vn,{value:"manual",children:"Manual Creation"})]}),a.jsxs(yn,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${f!==Wn?f:"null"}`),console.log("Current folders:",w.map(G=>({id:G.id,name:G.name}))),a.jsx(lue,{targetFolderId:f!==Wn?f:null,targetFolderName:f!==Wn?(In=w.find(G=>G.id===f))==null?void 0:In.name:null})]}),a.jsx(yn,{value:"manual",children:a.jsx(Zue,{targetFolderId:f!==Wn?f:null,targetFolderName:f!==Wn?(cn=w.find(G=>G.id===f))==null?void 0:cn.name:null})})]})]})]})};function Zfe(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(i=>i(r))},e)}const Vw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function ih(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function zk(t){return"nodeType"in t}function zi(t){var e,n;return t?ih(t)?t:zk(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function Hk(t){const{Document:e}=zi(t);return t instanceof e}function tv(t){return ih(t)?!1:t instanceof zi(t).HTMLElement}function kG(t){return t instanceof zi(t).SVGElement}function oh(t){return t?ih(t)?t.document:zk(t)?Hk(t)?t:tv(t)||kG(t)?t.ownerDocument:document:document:document}const oa=Vw?g.useLayoutEffect:g.useEffect;function Vk(t){const e=g.useRef(t);return oa(()=>{e.current=t}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{t.current=setInterval(r,i)},[]),n=g.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Fm(t,e){e===void 0&&(e=[t]);const n=g.useRef(t);return oa(()=>{n.current!==t&&(n.current=t)},e),n}function nv(t,e){const n=g.useRef();return g.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function Ab(t){const e=Vk(t),n=g.useRef(null),r=g.useCallback(i=>{i!==n.current&&(e==null||e(i,n.current)),n.current=i},[]);return[n,r]}function E1(t){const e=g.useRef();return g.useEffect(()=>{e.current=t},[t]),e.current}let VC={};function rv(t,e){return g.useMemo(()=>{if(e)return e;const n=VC[t]==null?0:VC[t]+1;return VC[t]=n,t+"-"+n},[t,e])}function PG(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const c=Object.entries(s);for(const[l,u]of c){const d=o[l];d!=null&&(o[l]=d+t*u)}return o},{...e})}}const Md=PG(1),Bm=PG(-1);function the(t){return"clientX"in t&&"clientY"in t}function Gk(t){if(!t)return!1;const{KeyboardEvent:e}=zi(t.target);return e&&t instanceof e}function nhe(t){if(!t)return!1;const{TouchEvent:e}=zi(t.target);return e&&t instanceof e}function N1(t){if(nhe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return the(t)?{x:t.clientX,y:t.clientY}:null}const Um=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Um.Translate.toString(t),Um.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),I2="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function rhe(t){return t.matches(I2)?t:t.querySelector(I2)}const ihe={display:"none"};function ohe(t){let{id:e,value:n}=t;return N.createElement("div",{id:e,style:ihe},n)}function she(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return N.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},n)}function ahe(){const[t,e]=g.useState("");return{announce:g.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const OG=g.createContext(null);function che(t){const e=g.useContext(OG);g.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function lhe(){const[t]=g.useState(()=>new Set),e=g.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[g.useCallback(r=>{let{type:i,event:o}=r;t.forEach(s=>{var c;return(c=s[i])==null?void 0:c.call(s,o)})},[t]),e]}const uhe={draggable:` - To pick up a draggable item, press the space bar. - While dragging, use the arrow keys to move the item. - Press space again to drop the item in its new position, or press escape to cancel. - `},dhe={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function fhe(t){let{announcements:e=dhe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=uhe}=t;const{announce:o,announcement:s}=ahe(),c=rv("DndLiveRegion"),[l,u]=g.useState(!1);if(g.useEffect(()=>{u(!0)},[]),che(g.useMemo(()=>({onDragStart(f){let{active:h}=f;o(e.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;e.onDragMove&&o(e.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;o(e.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;o(e.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;o(e.onDragCancel({active:h,over:p}))}}),[o,e])),!l)return null;const d=N.createElement(N.Fragment,null,N.createElement(ohe,{id:r,value:i.draggable}),N.createElement(she,{id:c,announcement:s}));return n?es.createPortal(d,n):d}var _r;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(_r||(_r={}));function jb(){}function R2(t,e){return g.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function hhe(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const bs=Object.freeze({x:0,y:0});function Kk(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Wk(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function phe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function T1(t){let{left:e,top:n,height:r,width:i}=t;return[{x:e,y:n},{x:e+i,y:n},{x:e,y:n+r},{x:e+i,y:n+r}]}function IG(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function M2(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const D2=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=M2(e,e.left,e.top),o=[];for(const s of r){const{id:c}=s,l=n.get(c);if(l){const u=Kk(M2(l),i);o.push({id:c,data:{droppableContainer:s,value:u}})}}return o.sort(Wk)},mhe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=T1(e),o=[];for(const s of r){const{id:c}=s,l=n.get(c);if(l){const u=T1(l),d=i.reduce((h,p,v)=>h+Kk(u[v],p),0),f=Number((d/4).toFixed(4));o.push({id:c,data:{droppableContainer:s,value:f}})}}return o.sort(Wk)};function ghe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),i=Math.min(e.left+e.width,t.left+t.width),o=Math.min(e.top+e.height,t.top+t.height),s=i-r,c=o-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const i=[];for(const o of r){const{id:s}=o,c=n.get(s);if(c){const l=ghe(c,e);l>0&&i.push({id:s,data:{droppableContainer:o,value:l}})}}return i.sort(phe)};function yhe(t,e){const{top:n,left:r,bottom:i,right:o}=e;return n<=t.y&&t.y<=i&&r<=t.x&&t.x<=o}const xhe=t=>{let{droppableContainers:e,droppableRects:n,pointerCoordinates:r}=t;if(!r)return[];const i=[];for(const o of e){const{id:s}=o,c=n.get(s);if(c&&yhe(r,c)){const u=T1(c).reduce((f,h)=>f+Kk(r,h),0),d=Number((u/4).toFixed(4));i.push({id:s,data:{droppableContainer:o,value:d}})}}return i.sort(Wk)};function bhe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function RG(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:bs}function whe(t){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...s,top:s.top+t*c.y,bottom:s.bottom+t*c.y,left:s.left+t*c.x,right:s.right+t*c.x}),{...n})}}const She=whe(1);function Che(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function _he(t,e,n){const r=Che(e);if(!r)return t;const{scaleX:i,scaleY:o,x:s,y:c}=r,l=t.left-s-(1-i)*parseFloat(n),u=t.top-c-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=i?t.width/i:t.width,f=o?t.height/o:t.height;return{width:d,height:f,top:u,right:l+d,bottom:u+f,left:l}}const Ahe={ignoreTransform:!1};function sh(t,e){e===void 0&&(e=Ahe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:u,transformOrigin:d}=zi(t).getComputedStyle(t);u&&(n=_he(n,u,d))}const{top:r,left:i,width:o,height:s,bottom:c,right:l}=n;return{top:r,left:i,width:o,height:s,bottom:c,right:l}}function $2(t){return sh(t,{ignoreTransform:!0})}function jhe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Ehe(t,e){return e===void 0&&(e=zi(t).getComputedStyle(t)),e.position==="fixed"}function Nhe(t,e){e===void 0&&(e=zi(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=e[i];return typeof o=="string"?n.test(o):!1})}function Gw(t,e){const n=[];function r(i){if(e!=null&&n.length>=e||!i)return n;if(Hk(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!tv(i)||kG(i)||n.includes(i))return n;const o=zi(t).getComputedStyle(i);return i!==t&&Nhe(i,o)&&n.push(i),Ehe(i,o)?n:r(i.parentNode)}return t?r(t):n}function MG(t){const[e]=Gw(t,1);return e??null}function GC(t){return!Vw||!t?null:ih(t)?t:zk(t)?Hk(t)||t===oh(t).scrollingElement?window:tv(t)?t:null:null}function DG(t){return ih(t)?t.scrollX:t.scrollLeft}function $G(t){return ih(t)?t.scrollY:t.scrollTop}function k1(t){return{x:DG(t),y:$G(t)}}var Mr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Mr||(Mr={}));function LG(t){return!Vw||!t?!1:t===document.scrollingElement}function FG(t){const e={x:0,y:0},n=LG(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},i=t.scrollTop<=e.y,o=t.scrollLeft<=e.x,s=t.scrollTop>=r.y,c=t.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:s,isRight:c,maxScroll:r,minScroll:e}}const The={x:.2,y:.2};function khe(t,e,n,r,i){let{top:o,left:s,right:c,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=The);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=FG(t),p={x:0,y:0},v={x:0,y:0},m={height:e.height*i.y,width:e.width*i.x};return!u&&o<=e.top+m.height?(p.y=Mr.Backward,v.y=r*Math.abs((e.top+m.height-o)/m.height)):!d&&l>=e.bottom-m.height&&(p.y=Mr.Forward,v.y=r*Math.abs((e.bottom-m.height-l)/m.height)),!h&&c>=e.right-m.width?(p.x=Mr.Forward,v.x=r*Math.abs((e.right-m.width-c)/m.width)):!f&&s<=e.left+m.width&&(p.x=Mr.Backward,v.x=r*Math.abs((e.left+m.width-s)/m.width)),{direction:p,speed:v}}function Phe(t){if(t===document.scrollingElement){const{innerWidth:o,innerHeight:s}=window;return{top:0,left:0,right:o,bottom:s,width:o,height:s}}const{top:e,left:n,right:r,bottom:i}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:i,width:t.clientWidth,height:t.clientHeight}}function BG(t){return t.reduce((e,n)=>Md(e,k1(n)),bs)}function Ohe(t){return t.reduce((e,n)=>e+DG(n),0)}function Ihe(t){return t.reduce((e,n)=>e+$G(n),0)}function Rhe(t,e){if(e===void 0&&(e=sh),!t)return;const{top:n,left:r,bottom:i,right:o}=e(t);MG(t)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Mhe=[["x",["left","right"],Ohe],["y",["top","bottom"],Ihe]];class qk{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=Gw(n),i=BG(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[o,s,c]of Mhe)for(const l of s)Object.defineProperty(this,l,{get:()=>{const u=c(r),d=i[o]-u;return this.rect[l]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Pp{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var i;(i=this.target)==null||i.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function Dhe(t){const{EventTarget:e}=zi(t);return t instanceof e?t:oh(t)}function KC(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var xo;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(xo||(xo={}));function L2(t){t.preventDefault()}function $he(t){t.stopPropagation()}var rn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(rn||(rn={}));const UG={start:[rn.Space,rn.Enter],cancel:[rn.Esc],end:[rn.Space,rn.Enter,rn.Tab]},Lhe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case rn.Right:return{...n,x:n.x+25};case rn.Left:return{...n,x:n.x-25};case rn.Down:return{...n,y:n.y+25};case rn.Up:return{...n,y:n.y-25}}};class Yk{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Pp(oh(n)),this.windowListeners=new Pp(zi(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(xo.Resize,this.handleCancel),this.windowListeners.add(xo.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(xo.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Rhe(r),n(bs)}handleKeyDown(e){if(Gk(e)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=UG,coordinateGetter:s=Lhe,scrollBehavior:c="smooth"}=i,{code:l}=e;if(o.end.includes(l)){this.handleEnd(e);return}if(o.cancel.includes(l)){this.handleCancel(e);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:bs;this.referenceCoordinates||(this.referenceCoordinates=d);const f=s(e,{active:n,context:r.current,currentCoordinates:d});if(f){const h=Bm(f,d),p={x:0,y:0},{scrollableAncestors:v}=r.current;for(const m of v){const y=e.code,{isTop:b,isRight:x,isLeft:w,isBottom:S,maxScroll:C,minScroll:_}=FG(m),A=Phe(m),j={x:Math.min(y===rn.Right?A.right-A.width/2:A.right,Math.max(y===rn.Right?A.left:A.left+A.width/2,f.x)),y:Math.min(y===rn.Down?A.bottom-A.height/2:A.bottom,Math.max(y===rn.Down?A.top:A.top+A.height/2,f.y))},T=y===rn.Right&&!x||y===rn.Left&&!w,k=y===rn.Down&&!S||y===rn.Up&&!b;if(T&&j.x!==f.x){const O=m.scrollLeft+h.x,E=y===rn.Right&&O<=C.x||y===rn.Left&&O>=_.x;if(E&&!h.y){m.scrollTo({left:O,behavior:c});return}E?p.x=m.scrollLeft-O:p.x=y===rn.Right?m.scrollLeft-C.x:m.scrollLeft-_.x,p.x&&m.scrollBy({left:-p.x,behavior:c});break}else if(k&&j.y!==f.y){const O=m.scrollTop+h.y,E=y===rn.Down&&O<=C.y||y===rn.Up&&O>=_.y;if(E&&!h.x){m.scrollTo({top:O,behavior:c});return}E?p.y=m.scrollTop-O:p.y=y===rn.Down?m.scrollTop-C.y:m.scrollTop-_.y,p.y&&m.scrollBy({top:-p.y,behavior:c});break}}this.handleMove(e,Md(Bm(f,this.referenceCoordinates),p))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Yk.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=UG,onActivation:i}=e,{active:o}=n;const{code:s}=t.nativeEvent;if(r.start.includes(s)){const c=o.activatorNode.current;return c&&t.target!==c?!1:(t.preventDefault(),i==null||i({event:t.nativeEvent}),!0)}return!1}}];function F2(t){return!!(t&&"distance"in t)}function B2(t){return!!(t&&"delay"in t)}class Qk{constructor(e,n,r){var i;r===void 0&&(r=Dhe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:o}=e,{target:s}=o;this.props=e,this.events=n,this.document=oh(s),this.documentListeners=new Pp(this.document),this.listeners=new Pp(r),this.windowListeners=new Pp(zi(s)),this.initialCoordinates=(i=N1(o))!=null?i:bs,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(xo.Resize,this.handleCancel),this.windowListeners.add(xo.DragStart,L2),this.windowListeners.add(xo.VisibilityChange,this.handleCancel),this.windowListeners.add(xo.ContextMenu,L2),this.documentListeners.add(xo.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(B2(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(F2(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:i}=this.props;i(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(xo.Click,$he,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(xo.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:s,options:{activationConstraint:c}}=o;if(!i)return;const l=(n=N1(e))!=null?n:bs,u=Bm(i,l);if(!r&&c){if(F2(c)){if(c.tolerance!=null&&KC(u,c.tolerance))return this.handleCancel();if(KC(u,c.distance))return this.handleStart()}if(B2(c)&&KC(u,c.tolerance))return this.handleCancel();this.handlePending(c,u);return}e.cancelable&&e.preventDefault(),s(l)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===rn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Fhe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Xk extends Qk{constructor(e){const{event:n}=e,r=oh(n.target);super(e,Fhe,r)}}Xk.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const Bhe={move:{name:"mousemove"},end:{name:"mouseup"}};var P1;(function(t){t[t.RightClick=2]="RightClick"})(P1||(P1={}));class Uhe extends Qk{constructor(e){super(e,Bhe,oh(e.event.target))}}Uhe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===P1.RightClick?!1:(r==null||r({event:n}),!0)}}];const WC={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class zhe extends Qk{constructor(e){super(e,WC)}static setup(){return window.addEventListener(WC.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(WC.move.name,e)};function e(){}}}zhe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var Op;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Op||(Op={}));var Eb;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(Eb||(Eb={}));function Hhe(t){let{acceleration:e,activator:n=Op.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:s=5,order:c=Eb.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=t;const p=Ghe({delta:f,disabled:!o}),[v,m]=ehe(),y=g.useRef({x:0,y:0}),b=g.useRef({x:0,y:0}),x=g.useMemo(()=>{switch(n){case Op.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case Op.DraggableRect:return i}},[n,i,l]),w=g.useRef(null),S=g.useCallback(()=>{const _=w.current;if(!_)return;const A=y.current.x*b.current.x,j=y.current.y*b.current.y;_.scrollBy(A,j)},[]),C=g.useMemo(()=>c===Eb.TreeOrder?[...u].reverse():u,[c,u]);g.useEffect(()=>{if(!o||!u.length||!x){m();return}for(const _ of C){if((r==null?void 0:r(_))===!1)continue;const A=u.indexOf(_),j=d[A];if(!j)continue;const{direction:T,speed:k}=khe(_,j,x,e,h);for(const O of["x","y"])p[O][T[O]]||(k[O]=0,T[O]=0);if(k.x>0||k.y>0){m(),w.current=_,v(S,s),y.current=k,b.current=T;return}}y.current={x:0,y:0},b.current={x:0,y:0},m()},[e,S,r,m,o,s,JSON.stringify(x),JSON.stringify(p),v,u,C,d,JSON.stringify(h)])}const Vhe={x:{[Mr.Backward]:!1,[Mr.Forward]:!1},y:{[Mr.Backward]:!1,[Mr.Forward]:!1}};function Ghe(t){let{delta:e,disabled:n}=t;const r=E1(e);return nv(i=>{if(n||!r||!i)return Vhe;const o={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Mr.Backward]:i.x[Mr.Backward]||o.x===-1,[Mr.Forward]:i.x[Mr.Forward]||o.x===1},y:{[Mr.Backward]:i.y[Mr.Backward]||o.y===-1,[Mr.Forward]:i.y[Mr.Forward]||o.y===1}}},[n,e,r])}function Khe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return nv(i=>{var o;return e==null?null:(o=r??i)!=null?o:null},[r,e])}function Whe(t,e){return g.useMemo(()=>t.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(s=>({eventName:s.eventName,handler:e(s.handler,r)}));return[...n,...o]},[]),[t,e])}var zm;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(zm||(zm={}));var O1;(function(t){t.Optimized="optimized"})(O1||(O1={}));const U2=new Map;function qhe(t,e){let{dragging:n,dependencies:r,config:i}=e;const[o,s]=g.useState(null),{frequency:c,measure:l,strategy:u}=i,d=g.useRef(t),f=y(),h=Fm(f),p=g.useCallback(function(b){b===void 0&&(b=[]),!h.current&&s(x=>x===null?b:x.concat(b.filter(w=>!x.includes(w))))},[h]),v=g.useRef(null),m=nv(b=>{if(f&&!n)return U2;if(!b||b===U2||d.current!==t||o!=null){const x=new Map;for(let w of t){if(!w)continue;if(o&&o.length>0&&!o.includes(w.id)&&w.rect.current){x.set(w.id,w.rect.current);continue}const S=w.node.current,C=S?new qk(l(S),S):null;w.rect.current=C,C&&x.set(w.id,C)}return x}return b},[t,o,n,f,l]);return g.useEffect(()=>{d.current=t},[t]),g.useEffect(()=>{f||p()},[n,f]),g.useEffect(()=>{o&&o.length>0&&s(null)},[JSON.stringify(o)]),g.useEffect(()=>{f||typeof c!="number"||v.current!==null||(v.current=setTimeout(()=>{p(),v.current=null},c))},[c,f,p,...r]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:o!=null};function y(){switch(u){case zm.Always:return!1;case zm.BeforeDragging:return n;default:return!n}}}function zG(t,e){return nv(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Yhe(t,e){return zG(t,e)}function Qhe(t){let{callback:e,disabled:n}=t;const r=Vk(e),i=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return g.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Kw(t){let{callback:e,disabled:n}=t;const r=Vk(e),i=g.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return g.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function Xhe(t){return new qk(sh(t),t)}function z2(t,e,n){e===void 0&&(e=Xhe);const[r,i]=g.useState(null);function o(){i(l=>{if(!t)return null;if(t.isConnected===!1){var u;return(u=l??n)!=null?u:null}const d=e(t);return JSON.stringify(l)===JSON.stringify(d)?l:d})}const s=Qhe({callback(l){if(t)for(const u of l){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(t)){o();break}}}}),c=Kw({callback:o});return oa(()=>{o(),t?(c==null||c.observe(t),s==null||s.observe(document.body,{childList:!0,subtree:!0})):(c==null||c.disconnect(),s==null||s.disconnect())},[t]),r}function Jhe(t){const e=zG(t);return RG(t,e)}const H2=[];function Zhe(t){const e=g.useRef(t),n=nv(r=>t?r&&r!==H2&&t&&e.current&&t.parentNode===e.current.parentNode?r:Gw(t):H2,[t]);return g.useEffect(()=>{e.current=t},[t]),n}function epe(t){const[e,n]=g.useState(null),r=g.useRef(t),i=g.useCallback(o=>{const s=GC(o.target);s&&n(c=>c?(c.set(s,k1(s)),new Map(c)):null)},[]);return g.useEffect(()=>{const o=r.current;if(t!==o){s(o);const c=t.map(l=>{const u=GC(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,k1(u)]):null}).filter(l=>l!=null);n(c.length?new Map(c):null),r.current=t}return()=>{s(t),s(o)};function s(c){c.forEach(l=>{const u=GC(l);u==null||u.removeEventListener("scroll",i)})}},[i,t]),g.useMemo(()=>t.length?e?Array.from(e.values()).reduce((o,s)=>Md(o,s),bs):BG(t):bs,[t,e])}function V2(t,e){e===void 0&&(e=[]);const n=g.useRef(null);return g.useEffect(()=>{n.current=null},e),g.useEffect(()=>{const r=t!==bs;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Bm(t,n.current):bs}function tpe(t){g.useEffect(()=>{if(!Vw)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n==null||n()}},t.map(e=>{let{sensor:n}=e;return n}))}function npe(t,e){return g.useMemo(()=>t.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=s=>{o(s,e)},n},{}),[t,e])}function HG(t){return g.useMemo(()=>t?jhe(t):null,[t])}const G2=[];function rpe(t,e){e===void 0&&(e=sh);const[n]=t,r=HG(n?zi(n):null),[i,o]=g.useState(G2);function s(){o(()=>t.length?t.map(l=>LG(l)?r:new qk(e(l),l)):G2)}const c=Kw({callback:s});return oa(()=>{c==null||c.disconnect(),s(),t.forEach(l=>c==null?void 0:c.observe(l))},[t]),i}function ipe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return tv(e)?e:t}function ope(t){let{measure:e}=t;const[n,r]=g.useState(null),i=g.useCallback(u=>{for(const{target:d}of u)if(tv(d)){r(f=>{const h=e(d);return f?{...f,width:h.width,height:h.height}:h});break}},[e]),o=Kw({callback:i}),s=g.useCallback(u=>{const d=ipe(u);o==null||o.disconnect(),d&&(o==null||o.observe(d)),r(d?e(d):null)},[e,o]),[c,l]=Ab(s);return g.useMemo(()=>({nodeRef:c,rect:n,setRef:l}),[n,c,l])}const spe=[{sensor:Xk,options:{}},{sensor:Yk,options:{}}],ape={current:{}},zy={draggable:{measure:$2},droppable:{measure:$2,strategy:zm.WhileDragging,frequency:O1.Optimized},dragOverlay:{measure:sh}};class Ip extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const cpe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Ip,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:jb},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:zy,measureDroppableContainers:jb,windowRect:null,measuringScheduled:!1},lpe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:jb,draggableNodes:new Map,over:null,measureDroppableContainers:jb},Ww=g.createContext(lpe),VG=g.createContext(cpe);function upe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Ip}}}function dpe(t,e){switch(e.type){case _r.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case _r.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case _r.DragEnd:case _r.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case _r.RegisterDroppable:{const{element:n}=e,{id:r}=n,i=new Ip(t.droppable.containers);return i.set(r,n),{...t,droppable:{...t.droppable,containers:i}}}case _r.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;const s=new Ip(t.droppable.containers);return s.set(n,{...o,disabled:i}),{...t,droppable:{...t.droppable,containers:s}}}case _r.UnregisterDroppable:{const{id:n,key:r}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const o=new Ip(t.droppable.containers);return o.delete(n),{...t,droppable:{...t.droppable,containers:o}}}default:return t}}function fpe(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:i}=g.useContext(Ww),o=E1(r),s=E1(n==null?void 0:n.id);return g.useEffect(()=>{if(!e&&!r&&o&&s!=null){if(!Gk(o)||document.activeElement===o.target)return;const c=i.get(s);if(!c)return;const{activatorNode:l,node:u}=c;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[l.current,u.current]){if(!d)continue;const f=rhe(d);if(f){f.focus();break}}})}},[r,e,i,s,o]),null}function hpe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((i,o)=>o({transform:i,...r}),n):n}function ppe(t){return g.useMemo(()=>({draggable:{...zy.draggable,...t==null?void 0:t.draggable},droppable:{...zy.droppable,...t==null?void 0:t.droppable},dragOverlay:{...zy.dragOverlay,...t==null?void 0:t.dragOverlay}}),[t==null?void 0:t.draggable,t==null?void 0:t.droppable,t==null?void 0:t.dragOverlay])}function mpe(t){let{activeNode:e,measure:n,initialRect:r,config:i=!0}=t;const o=g.useRef(!1),{x:s,y:c}=typeof i=="boolean"?{x:i,y:i}:i;oa(()=>{if(!s&&!c||!e){o.current=!1;return}if(o.current||!r)return;const u=e==null?void 0:e.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=RG(d,r);if(s||(f.x=0),c||(f.y=0),o.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=MG(u);h&&h.scrollBy({top:f.y,left:f.x})}},[e,s,c,r,n])}const GG=g.createContext({...bs,scaleX:1,scaleY:1});var gc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(gc||(gc={}));const gpe=g.memo(function(e){var n,r,i,o;let{id:s,accessibility:c,autoScroll:l=!0,children:u,sensors:d=spe,collisionDetection:f=vhe,measuring:h,modifiers:p,...v}=e;const m=g.useReducer(dpe,void 0,upe),[y,b]=m,[x,w]=lhe(),[S,C]=g.useState(gc.Uninitialized),_=S===gc.Initialized,{draggable:{active:A,nodes:j,translate:T},droppable:{containers:k}}=y,O=A!=null?j.get(A):null,E=g.useRef({initial:null,translated:null}),R=g.useMemo(()=>{var Dt;return A!=null?{id:A,data:(Dt=O==null?void 0:O.data)!=null?Dt:ape,rect:E}:null},[A,O]),D=g.useRef(null),[V,L]=g.useState(null),[z,M]=g.useState(null),$=Fm(v,Object.values(v)),Q=rv("DndDescribedBy",s),q=g.useMemo(()=>k.getEnabled(),[k]),te=ppe(h),{droppableRects:xe,measureDroppableContainers:B,measuringScheduled:ce}=qhe(q,{dragging:_,dependencies:[T.x,T.y],config:te.droppable}),he=Khe(j,A),U=g.useMemo(()=>z?N1(z):null,[z]),de=Bt(),se=Yhe(he,te.draggable.measure);mpe({activeNode:A!=null?j.get(A):null,config:de.layoutShiftCompensation,initialRect:se,measure:te.draggable.measure});const ne=z2(he,te.draggable.measure,se),je=z2(he?he.parentElement:null),K=g.useRef({activatorEvent:null,active:null,activeNode:he,collisionRect:null,collisions:null,droppableRects:xe,draggableNodes:j,draggingNode:null,draggingNodeRect:null,droppableContainers:k,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),et=k.getNodeFor((n=K.current.over)==null?void 0:n.id),Me=ope({measure:te.dragOverlay.measure}),ut=(r=Me.nodeRef.current)!=null?r:he,Ye=_?(i=Me.rect)!=null?i:ne:null,Pt=!!(Me.nodeRef.current&&Me.rect),F=Jhe(Pt?null:ne),J=HG(ut?zi(ut):null),oe=Zhe(_?et??he:null),ye=rpe(oe),Ee=hpe(p,{transform:{x:T.x-F.x,y:T.y-F.y,scaleX:1,scaleY:1},activatorEvent:z,active:R,activeNodeRect:ne,containerNodeRect:je,draggingNodeRect:Ye,over:K.current.over,overlayNodeRect:Me.rect,scrollableAncestors:oe,scrollableAncestorRects:ye,windowRect:J}),P=U?Md(U,T):null,H=epe(oe),ee=V2(H),re=V2(H,[ne]),Z=Md(Ee,ee),Se=Ye?She(Ye,Ee):null,Ae=R&&Se?f({active:R,collisionRect:Se,droppableRects:xe,droppableContainers:q,pointerCoordinates:P}):null,Ie=IG(Ae,"id"),[Ke,Ue]=g.useState(null),Be=Pt?Ee:Md(Ee,re),nt=bhe(Be,(o=Ke==null?void 0:Ke.rect)!=null?o:null,ne),Ne=g.useRef(null),Nt=g.useCallback((Dt,Jt)=>{let{sensor:en,options:In}=Jt;if(D.current==null)return;const cn=j.get(D.current);if(!cn)return;const G=Dt.nativeEvent,ke=new en({active:D.current,activeNode:cn,event:G,options:In,context:K,onAbort(We){if(!j.get(We))return;const{onDragAbort:ot}=$.current,Ft={id:We};ot==null||ot(Ft),x({type:"onDragAbort",event:Ft})},onPending(We,Qe,ot,Ft){if(!j.get(We))return;const{onDragPending:Zt}=$.current,$t={id:We,constraint:Qe,initialCoordinates:ot,offset:Ft};Zt==null||Zt($t),x({type:"onDragPending",event:$t})},onStart(We){const Qe=D.current;if(Qe==null)return;const ot=j.get(Qe);if(!ot)return;const{onDragStart:Ft}=$.current,tt={activatorEvent:G,active:{id:Qe,data:ot.data,rect:E}};es.unstable_batchedUpdates(()=>{Ft==null||Ft(tt),C(gc.Initializing),b({type:_r.DragStart,initialCoordinates:We,active:Qe}),x({type:"onDragStart",event:tt}),L(Ne.current),M(G)})},onMove(We){b({type:_r.DragMove,coordinates:We})},onEnd:Ce(_r.DragEnd),onCancel:Ce(_r.DragCancel)});Ne.current=ke;function Ce(We){return async function(){const{active:ot,collisions:Ft,over:tt,scrollAdjustedTranslate:Zt}=K.current;let $t=null;if(ot&&Zt){const{cancelDrop:Xt}=$.current;$t={activatorEvent:G,active:ot,collisions:Ft,delta:Zt,over:tt},We===_r.DragEnd&&typeof Xt=="function"&&await Promise.resolve(Xt($t))&&(We=_r.DragCancel)}D.current=null,es.unstable_batchedUpdates(()=>{b({type:We}),C(gc.Uninitialized),Ue(null),L(null),M(null),Ne.current=null;const Xt=We===_r.DragEnd?"onDragEnd":"onDragCancel";if($t){const Rn=$.current[Xt];Rn==null||Rn($t),x({type:Xt,event:$t})}})}}},[j]),pn=g.useCallback((Dt,Jt)=>(en,In)=>{const cn=en.nativeEvent,G=j.get(In);if(D.current!==null||!G||cn.dndKit||cn.defaultPrevented)return;const ke={active:G};Dt(en,Jt.options,ke)===!0&&(cn.dndKit={capturedBy:Jt.sensor},D.current=In,Nt(en,Jt))},[j,Nt]),Je=Whe(d,pn);tpe(d),oa(()=>{ne&&S===gc.Initializing&&C(gc.Initialized)},[ne,S]),g.useEffect(()=>{const{onDragMove:Dt}=$.current,{active:Jt,activatorEvent:en,collisions:In,over:cn}=K.current;if(!Jt||!en)return;const G={active:Jt,activatorEvent:en,collisions:In,delta:{x:Z.x,y:Z.y},over:cn};es.unstable_batchedUpdates(()=>{Dt==null||Dt(G),x({type:"onDragMove",event:G})})},[Z.x,Z.y]),g.useEffect(()=>{const{active:Dt,activatorEvent:Jt,collisions:en,droppableContainers:In,scrollAdjustedTranslate:cn}=K.current;if(!Dt||D.current==null||!Jt||!cn)return;const{onDragOver:G}=$.current,ke=In.get(Ie),Ce=ke&&ke.rect.current?{id:ke.id,rect:ke.rect.current,data:ke.data,disabled:ke.disabled}:null,We={active:Dt,activatorEvent:Jt,collisions:en,delta:{x:cn.x,y:cn.y},over:Ce};es.unstable_batchedUpdates(()=>{Ue(Ce),G==null||G(We),x({type:"onDragOver",event:We})})},[Ie]),oa(()=>{K.current={activatorEvent:z,active:R,activeNode:he,collisionRect:Se,collisions:Ae,droppableRects:xe,draggableNodes:j,draggingNode:ut,draggingNodeRect:Ye,droppableContainers:k,over:Ke,scrollableAncestors:oe,scrollAdjustedTranslate:Z},E.current={initial:Ye,translated:Se}},[R,he,Ae,Se,j,ut,Ye,xe,k,Ke,oe,Z]),Hhe({...de,delta:T,draggingRect:Se,pointerCoordinates:P,scrollableAncestors:oe,scrollableAncestorRects:ye});const rt=g.useMemo(()=>({active:R,activeNode:he,activeNodeRect:ne,activatorEvent:z,collisions:Ae,containerNodeRect:je,dragOverlay:Me,draggableNodes:j,droppableContainers:k,droppableRects:xe,over:Ke,measureDroppableContainers:B,scrollableAncestors:oe,scrollableAncestorRects:ye,measuringConfiguration:te,measuringScheduled:ce,windowRect:J}),[R,he,ne,z,Ae,je,Me,j,k,xe,Ke,B,oe,ye,te,ce,J]),jt=g.useMemo(()=>({activatorEvent:z,activators:Je,active:R,activeNodeRect:ne,ariaDescribedById:{draggable:Q},dispatch:b,draggableNodes:j,over:Ke,measureDroppableContainers:B}),[z,Je,R,ne,b,Q,j,Ke,B]);return N.createElement(OG.Provider,{value:w},N.createElement(Ww.Provider,{value:jt},N.createElement(VG.Provider,{value:rt},N.createElement(GG.Provider,{value:nt},u)),N.createElement(fpe,{disabled:(c==null?void 0:c.restoreFocus)===!1})),N.createElement(fhe,{...c,hiddenTextDescribedById:Q}));function Bt(){const Dt=(V==null?void 0:V.autoScrollEnabled)===!1,Jt=typeof l=="object"?l.enabled===!1:l===!1,en=_&&!Dt&&!Jt;return typeof l=="object"?{...l,enabled:en}:{enabled:en}}}),vpe=g.createContext(null),K2="button",ype="Draggable";function xpe(t){let{id:e,data:n,disabled:r=!1,attributes:i}=t;const o=rv(ype),{activators:s,activatorEvent:c,active:l,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=g.useContext(Ww),{role:p=K2,roleDescription:v="draggable",tabIndex:m=0}=i??{},y=(l==null?void 0:l.id)===e,b=g.useContext(y?GG:vpe),[x,w]=Ab(),[S,C]=Ab(),_=npe(s,e),A=Fm(n);oa(()=>(f.set(e,{id:e,key:o,node:x,activatorNode:S,data:A}),()=>{const T=f.get(e);T&&T.key===o&&f.delete(e)}),[f,e]);const j=g.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":r,"aria-pressed":y&&p===K2?!0:void 0,"aria-roledescription":v,"aria-describedby":d.draggable}),[r,p,m,y,v,d.draggable]);return{active:l,activatorEvent:c,activeNodeRect:u,attributes:j,isDragging:y,listeners:r?void 0:_,node:x,over:h,setNodeRef:w,setActivatorNodeRef:C,transform:b}}function bpe(){return g.useContext(VG)}const wpe="Droppable",Spe={timeout:25};function KG(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:i}=t;const o=rv(wpe),{active:s,dispatch:c,over:l,measureDroppableContainers:u}=g.useContext(Ww),d=g.useRef({disabled:n}),f=g.useRef(!1),h=g.useRef(null),p=g.useRef(null),{disabled:v,updateMeasurementsFor:m,timeout:y}={...Spe,...i},b=Fm(m??r),x=g.useCallback(()=>{if(!f.current){f.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),p.current=null},y)},[y]),w=Kw({callback:x,disabled:v||!s}),S=g.useCallback((j,T)=>{w&&(T&&(w.unobserve(T),f.current=!1),j&&w.observe(j))},[w]),[C,_]=Ab(S),A=Fm(e);return g.useEffect(()=>{!w||!C.current||(w.disconnect(),f.current=!1,w.observe(C.current))},[C,w]),g.useEffect(()=>(c({type:_r.RegisterDroppable,element:{id:r,key:o,disabled:n,node:C,rect:h,data:A}}),()=>c({type:_r.UnregisterDroppable,key:o,id:r})),[r]),g.useEffect(()=>{n!==d.current.disabled&&(c({type:_r.SetDroppableDisabled,id:r,key:o,disabled:n}),d.current.disabled=n)},[r,o,n,c]),{active:s,rect:h,isOver:(l==null?void 0:l.id)===r,node:C,over:l,setNodeRef:_}}function WG(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Cpe(t,e){return t.reduce((n,r,i)=>{const o=e.get(r);return o&&(n[i]=o),n},Array(t.length))}function Qv(t){return t!==null&&t>=0}function _pe(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{let{rects:e,activeIndex:n,overIndex:r,index:i}=t;const o=WG(e,r,n),s=e[i],c=o[i];return!c||!s?null:{x:c.left-s.left,y:c.top-s.top,scaleX:c.width/s.width,scaleY:c.height/s.height}},Xv={scaleX:1,scaleY:1},Jv=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:i,rects:o,overIndex:s}=t;const c=(e=o[n])!=null?e:r;if(!c)return null;if(i===n){const u=o[s];return u?{x:0,y:nn&&i<=s?{x:0,y:-c.height-l,...Xv}:i=s?{x:0,y:c.height+l,...Xv}:{x:0,y:0,...Xv}};function jpe(t,e,n){const r=t[e],i=t[e-1],o=t[e+1];return r?nr.map(_=>typeof _=="object"&&"id"in _?_.id:_),[r]),v=s!=null,m=s?p.indexOf(s.id):-1,y=u?p.indexOf(u.id):-1,b=g.useRef(p),x=!_pe(p,b.current),w=y!==-1&&m===-1||x,S=Ape(o);oa(()=>{x&&v&&d(p)},[x,p,v,d]),g.useEffect(()=>{b.current=p},[p]);const C=g.useMemo(()=>({activeIndex:m,containerId:f,disabled:S,disableTransforms:w,items:p,overIndex:y,useDragOverlay:h,sortedRects:Cpe(p,l),strategy:i}),[m,f,S.draggable,S.droppable,w,p,y,l,h,i]);return N.createElement(QG.Provider,{value:C},e)}const Epe=t=>{let{id:e,items:n,activeIndex:r,overIndex:i}=t;return WG(n,r,i).indexOf(e)},Npe=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:i,items:o,newIndex:s,previousItems:c,previousContainerId:l,transition:u}=t;return!u||!r||c!==o&&i===s?!1:n?!0:s!==i&&e===l},Tpe={duration:200,easing:"ease"},XG="transform",kpe=Um.Transition.toString({property:XG,duration:0,easing:"linear"}),Ppe={roleDescription:"sortable"};function Ope(t){let{disabled:e,index:n,node:r,rect:i}=t;const[o,s]=g.useState(null),c=g.useRef(n);return oa(()=>{if(!e&&n!==c.current&&r.current){const l=i.current;if(l){const u=sh(r.current,{ignoreTransform:!0}),d={x:l.left-u.left,y:l.top-u.top,scaleX:l.width/u.width,scaleY:l.height/u.height};(d.x||d.y)&&s(d)}}n!==c.current&&(c.current=n)},[e,n,r,i]),g.useEffect(()=>{o&&s(null)},[o]),o}function Ipe(t){let{animateLayoutChanges:e=Npe,attributes:n,disabled:r,data:i,getNewIndex:o=Epe,id:s,strategy:c,resizeObserverConfig:l,transition:u=Tpe}=t;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:v,sortedRects:m,overIndex:y,useDragOverlay:b,strategy:x}=g.useContext(QG),w=Rpe(r,p),S=d.indexOf(s),C=g.useMemo(()=>({sortable:{containerId:f,index:S,items:d},...i}),[f,i,S,d]),_=g.useMemo(()=>d.slice(d.indexOf(s)),[d,s]),{rect:A,node:j,isOver:T,setNodeRef:k}=KG({id:s,data:C,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:_,...l}}),{active:O,activatorEvent:E,activeNodeRect:R,attributes:D,setNodeRef:V,listeners:L,isDragging:z,over:M,setActivatorNodeRef:$,transform:Q}=xpe({id:s,data:C,attributes:{...Ppe,...n},disabled:w.draggable}),q=Zfe(k,V),te=!!O,xe=te&&!v&&Qv(h)&&Qv(y),B=!b&&z,ce=B&&xe?Q:null,U=xe?ce??(c??x)({rects:m,activeNodeRect:R,activeIndex:h,overIndex:y,index:S}):null,de=Qv(h)&&Qv(y)?o({id:s,items:d,activeIndex:h,overIndex:y}):S,se=O==null?void 0:O.id,ne=g.useRef({activeId:se,items:d,newIndex:de,containerId:f}),je=d!==ne.current.items,K=e({active:O,containerId:f,isDragging:z,isSorting:te,id:s,index:S,items:d,newIndex:ne.current.newIndex,previousItems:ne.current.items,previousContainerId:ne.current.containerId,transition:u,wasDragging:ne.current.activeId!=null}),et=Ope({disabled:!K,index:S,node:j,rect:A});return g.useEffect(()=>{te&&ne.current.newIndex!==de&&(ne.current.newIndex=de),f!==ne.current.containerId&&(ne.current.containerId=f),d!==ne.current.items&&(ne.current.items=d)},[te,de,f,d]),g.useEffect(()=>{if(se===ne.current.activeId)return;if(se!=null&&ne.current.activeId==null){ne.current.activeId=se;return}const ut=setTimeout(()=>{ne.current.activeId=se},50);return()=>clearTimeout(ut)},[se]),{active:O,activeIndex:h,attributes:D,data:C,rect:A,index:S,newIndex:de,items:d,isOver:T,isSorting:te,isDragging:z,listeners:L,node:j,overIndex:y,over:M,setNodeRef:q,setActivatorNodeRef:$,setDroppableNodeRef:k,setDraggableNodeRef:V,transform:et??U,transition:Me()};function Me(){if(et||je&&ne.current.newIndex===S)return kpe;if(!(B&&!Gk(E)||!u)&&(te||K))return Um.Transition.toString({...u,property:XG})}}function Rpe(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t==null?void 0:t.draggable)!=null?n:e.draggable,droppable:(r=t==null?void 0:t.droppable)!=null?r:e.droppable}}function Nb(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Mpe=[rn.Down,rn.Right,rn.Up,rn.Left],Dpe=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:o,over:s,scrollableAncestors:c}}=e;if(Mpe.includes(t.code)){if(t.preventDefault(),!n||!r)return;const l=[];o.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=i.get(f.id);if(h)switch(t.code){case rn.Down:r.toph.top&&l.push(f);break;case rn.Left:r.left>h.left&&l.push(f);break;case rn.Right:r.left1&&(d=u[1].id),d!=null){const f=o.get(n.id),h=o.get(d),p=h?i.get(h.id):null,v=h==null?void 0:h.node.current;if(v&&p&&f&&h){const y=Gw(v).some((_,A)=>c[A]!==_),b=JG(f,h),x=$pe(f,h),w=y||!b?{x:0,y:0}:{x:x?r.width-p.width:0,y:x?r.height-p.height:0},S={x:p.left,y:p.top};return w.x&&w.y?S:Bm(S,w)}}}};function JG(t,e){return!Nb(t)||!Nb(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function $pe(t,e){return!Nb(t)||!Nb(e)||!JG(t,e)?!1:t.data.current.sortable.index=n.top+n.height&&(r.y=n.top+n.height-e.bottom),e.left+t.x<=n.left?r.x=n.left-e.left:e.right+t.x>=n.left+n.width&&(r.x=n.left+n.width-e.right),r}const Fpe=t=>{let{containerNodeRect:e,draggingNodeRect:n,transform:r}=t;return!n||!e?r:Lpe(r,n,e)},Bpe=t=>{let{transform:e}=t;return{...e,x:0}},Yu=(t,e)=>`sec:${t}:${e}`,Qu=(t,e,n)=>`sub:${t}:${e}:${n}`,Uh=(t,e)=>`${t}::${e}`,Hy=t=>{const[e,n,r,i]=t.split(":");return e==="sec"?{scope:"sec",sectionId:n,subsectionId:null,kind:r}:{scope:"sub",sectionId:n,subsectionId:r,kind:i}},Upe=(t,e)=>!e||e.type!=="item"&&e.type!=="container"?!1:t.sectionId===e.sectionId&&t.kind===e.kind,qC=(t,e)=>{var c;const{sectionId:n,subsectionId:r,kind:i}=Hy(e);if(n!==t.id)throw new Error("Mismatched section");const o=i==="q"?"questions":"activities";if(!r)return t[o]??[];const s=(c=t.subsections)==null?void 0:c.find(l=>l.id===r);if(!s)throw new Error("Subsection not found");return s[o]??[]},zpe=(t,e,n)=>{const r=t.slice(),[i]=r.splice(e,1);return r.splice(n,0,i),r},ey={current:null},Hpe=t=>{const{active:e,droppableContainers:n}=t,r=e.data.current;if(!r)return D2(t);const i=n.filter(c=>{const l=c.data.current;return Upe(r,l)}),o=xhe({...t,droppableContainers:i});if(o.length>0)return ey.current=o[0].id,o;const s=D2({...t,droppableContainers:i});return s.length>0?(ey.current=s[0].id,s):ey.current?[{id:ey.current}]:[]},ty=({containerId:t,sectionId:e,subsectionId:n,kind:r,className:i,children:o})=>{const{setNodeRef:s,isOver:c,active:l}=KG({id:t,data:{type:"container",kind:r,sectionId:e,subsectionId:n}}),u=l==null?void 0:l.data.current,d=!!u&&u.kind===r&&u.sectionId===e;return a.jsx("div",{ref:s,className:Fe(i,c&&d&&"ring-2 ring-blue-500 bg-blue-50/50",c&&!d&&"ring-2 ring-red-400 opacity-50"),children:o})},Vpe=({id:t,disabled:e,className:n,data:r,children:i})=>{const{attributes:o,listeners:s,setNodeRef:c,setActivatorNodeRef:l,transform:u,transition:d,isDragging:f}=Ipe({id:t,disabled:e,data:r}),h={transform:Um.Transform.toString(u),transition:d,opacity:f?.6:void 0};return a.jsx("div",{ref:c,style:h,className:n,children:i({setActivatorNodeRef:l,attributes:o,listeners:s,isDragging:f})})},Jk=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,v=typeof e=="string",m=g.useMemo(()=>v?null:e,[e,v]),[y,b]=g.useState(new Set),[x,w]=g.useState(null),[S,C]=g.useState(null),[_,A]=g.useState(!1),[j,T]=g.useState(null),[k,O]=g.useState(""),[E,R]=g.useState(null),D=hhe(R2(Xk,{activationConstraint:{distance:6}}),R2(Yk,{coordinateGetter:Dpe}));g.useEffect(()=>{p&&p(!!x)},[x,p]),g.useEffect(()=>{if(x&&m){const P=m.sections.find(H=>H.id===x);P&&!S&&C({...P})}},[m,x,S]);const V=P=>{w(P.id),C({...P}),b(H=>new Set(H).add(P.id))},L=()=>{w(null),C(null)},z=g.useCallback(P=>{C(H=>H&&{...H,...P})},[]),M=g.useCallback((P,H,ee)=>{C(re=>{if(!re)return re;const Z={...re};if(ee==="question"&&Z.questions){if(Z.questions.findIndex(Ae=>Ae.id===P)!==-1)return Z.questions=Z.questions.map(Ae=>Ae.id===P?{...Ae,...H}:Ae),Z}else if(ee==="activity"&&Z.activities&&Z.activities.findIndex(Ae=>Ae.id===P)!==-1)return Z.activities=Z.activities.map(Ae=>Ae.id===P?{...Ae,...H}:Ae),Z;return Z.subsections&&(Z.subsections=Z.subsections.map(Se=>{const Ae={...Se};return ee==="question"&&Ae.questions?Ae.questions.findIndex(Ke=>Ke.id===P)!==-1&&(Ae.questions=Ae.questions.map(Ke=>Ke.id===P?{...Ke,...H}:Ke)):ee==="activity"&&Ae.activities&&Ae.activities.findIndex(Ke=>Ke.id===P)!==-1&&(Ae.activities=Ae.activities.map(Ke=>Ke.id===P?{...Ke,...H}:Ke)),Ae})),Z})},[]),$=P=>{if(!S)return;const H={id:`${P}-${Date.now()}`,content:`New ${P}`,type:P==="question"?"open_ended":"discussion",time_limit:void 0},ee={...S};P==="question"?ee.questions=[...ee.questions||[],H]:ee.activities=[...ee.activities||[],H],C(ee)},Q=(P,H)=>{if(!S||!S.subsections)return;const ee={id:`${H}-${Date.now()}`,content:`New ${H}`,type:H==="question"?"open_ended":"discussion",time_limit:void 0},re=[...S.subsections],Z={...re[P]};H==="question"?Z.questions=[...Z.questions||[],ee]:Z.activities=[...Z.activities||[],ee],re[P]=Z,C(Se=>Se&&{...Se,subsections:re})},q=()=>{if(!S)return;const P={id:`subsection-${Date.now()}`,title:"New Subsection",questions:[],activities:[]},H=[...S.subsections||[],P];C(ee=>ee&&{...ee,subsections:H})},te=P=>{if(!S||!S.subsections)return;const H=S.subsections.filter((ee,re)=>re!==P);C(ee=>ee&&{...ee,subsections:H})},xe=(P,H)=>{var re,Z;if(!S)return;const ee={...S};H==="question"?ee.questions=(re=ee.questions)==null?void 0:re.filter(Se=>Se.id!==P):ee.activities=(Z=ee.activities)==null?void 0:Z.filter(Se=>Se.id!==P),C(ee)},B=async()=>{if(!(!S||!m||!o)){A(!0);try{const P={...m,sections:m.sections.map(H=>H.id===x?S:H)};await o(P),L(),ae.success("Section updated successfully")}catch(P){console.error("Error saving section:",P),ae.error("Failed to save section")}finally{A(!1)}}},ce=P=>{b(H=>{const ee=new Set(H);return ee.has(P)?ee.delete(P):ee.add(P),ee})};g.useEffect(()=>{m&&m.sections.length>0&&b(l?new Set(m.sections.map(P=>P.id)):new Set)},[l,m]);const he=(P,H,ee,re)=>{if(!n||n.legacy_format)return null;const Z=n.moderator_position;if(Z.section_index!==P)return Z.section_index>P?"completed":null;if(re!==void 0){if(Z.subsection_index===void 0)return null;if(Z.subsection_index!==re)return Z.subsection_index>re?"completed":null}else if(Z.subsection_index!==void 0)return"completed";return Z.item_type!==ee?ee==="activity"&&Z.item_type==="question"?"completed":null:Z.item_index===H?"current":Z.item_index>H?"completed":null},U=(P,H)=>P===`New ${H}`,de=g.useCallback((P,H,ee)=>{if(H<0||H>=P.length||ee<0||ee>=P.length)return P;const re=[...P],[Z]=re.splice(H,1);return re.splice(ee,0,Z),re},[]),se=g.useCallback((P,H)=>H>0,[]),ne=g.useCallback((P,H)=>H{if(!S||!S.subsections)return;const H=S.subsections;if(se(H,P)){const ee=de(H,P,P-1);C(re=>re&&{...re,subsections:ee})}},[S,se,de]),K=g.useCallback(P=>{if(!S||!S.subsections)return;const H=S.subsections;if(ne(H,P)){const ee=de(H,P,P+1);C(re=>re&&{...re,subsections:ee})}},[S,ne,de]),et=g.useCallback((P,H)=>{T(P),O(H)},[]),Me=g.useCallback(()=>{T(null),O("")},[]),ut=g.useCallback(()=>{if(!j||!S||!S.subsections)return;const P=S.subsections.map(H=>H.id===j?{...H,title:k.trim()}:H);C(H=>H&&{...H,subsections:P}),Me()},[j,S,k,Me]);g.useCallback((P,H,ee,re)=>{if(!S)return;const Z=H==="question"?"questions":"activities";if(re!==void 0){const Se=S.subsections||[];if(re>=0&&reBe&&{...Be,subsections:Ue})}}}else{const Se=S[Z]||[];if(se(Se,ee)){const Ae=de(Se,ee,ee-1);C(Ie=>Ie&&{...Ie,[Z]:Ae})}}},[S,se,de]),g.useCallback((P,H,ee,re)=>{if(!S)return;const Z=H==="question"?"questions":"activities";if(re!==void 0){const Se=S.subsections||[];if(re>=0&&reBe&&{...Be,subsections:Ue})}}}else{const Se=S[Z]||[];if(ne(Se,ee)){const Ae=de(Se,ee,ee+1);C(Ie=>Ie&&{...Ie,[Z]:Ae})}}},[S,ne,de]);const Ye=g.useCallback(({active:P})=>{R(String(P.id))},[]),Pt=g.useCallback(P=>{if(!S)return;const{active:H,over:ee}=P;if(!ee)return;const re=H.data.current,Z=ee.data.current;if(!re||!Z)return;const Se=re.containerId,Ae=Z.type==="container"?String(ee.id):Z.containerId;Se!==Ae&&(re.kind!==Z.kind||re.sectionId!==Z.sectionId||C(Ie=>{var Ke,Ue;if(!Ie)return Ie;try{const Be=qC(Ie,Se),nt=qC(Ie,Ae),Ne=Be.findIndex(cn=>cn.id===re.itemId);if(Ne===-1)return Ie;const Nt=Z.type==="item"?nt.findIndex(cn=>cn.id===Z.itemId):nt.length,pn=Be[Ne],Je=Be.slice();Je.splice(Ne,1);const rt=nt.slice(),jt=Math.max(0,Math.min(Nt,rt.length));rt.splice(jt,0,pn);const Bt={...Ie},Dt=Hy(Se),Jt=Dt.kind==="q"?"questions":"activities";Dt.subsectionId?Bt.subsections=(Ke=Bt.subsections)==null?void 0:Ke.map(cn=>cn.id===Dt.subsectionId?{...cn,[Jt]:Je}:cn):Bt[Jt]=Je;const en=Hy(Ae),In=en.kind==="q"?"questions":"activities";return en.subsectionId?Bt.subsections=(Ue=Bt.subsections)==null?void 0:Ue.map(cn=>cn.id===en.subsectionId?{...cn,[In]:rt}:cn):Bt[In]=rt,Bt}catch(Be){return console.error("Error in drag over:",Be),Ie}}))},[S]),F=g.useCallback(P=>{R(null);const{active:H,over:ee}=P;if(!ee||!S)return;const re=H.data.current,Z=ee.data.current;if(!re||!Z)return;const Se=re.containerId,Ae=Z.type==="container"?String(ee.id):Z.containerId;Se===Ae&&Z.type==="item"&&C(Ie=>{var Ke;if(!Ie)return Ie;try{const Ue=qC(Ie,Se),Be=Ue.findIndex(rt=>rt.id===re.itemId),nt=Ue.findIndex(rt=>rt.id===Z.itemId);if(Be===-1||nt===-1||Be===nt)return Ie;const Ne=zpe(Ue,Be,nt),Nt={...Ie},pn=Hy(Se),Je=pn.kind==="q"?"questions":"activities";return pn.subsectionId?Nt.subsections=(Ke=Nt.subsections)==null?void 0:Ke.map(rt=>rt.id===pn.subsectionId?{...rt,[Je]:Ne}:rt):Nt[Je]=Ne,Nt}catch(Ue){return console.error("Error in drag end:",Ue),Ie}})},[S]),J=g.useCallback(()=>{R(null)},[]),oe=(P,H,ee,re,Z,Se)=>{var pn,Je,rt,jt,Bt,Dt;const Ae=m==null?void 0:m.sections[H],Ie=x===(Ae==null?void 0:Ae.id),Ke=he(H,ee,re,Z),Ue=Ke==="current",Be=Ke==="completed",Ne=(Jt=>{var en,In;return((In=(en=Jt.metadata)==null?void 0:en.visual_asset)==null?void 0:In.filename)||null})(P),Nt=U(P.content,re);if(Ie){const Jt=Se?Uh(Se,P.id):`item-${P.id}`,en=Se?{type:"item",containerId:Se,kind:re==="question"?"q":"a",sectionId:(Ae==null?void 0:Ae.id)||"",subsectionId:Z!==void 0&&((Je=(pn=Ae==null?void 0:Ae.subsections)==null?void 0:pn[Z])==null?void 0:Je.id)||null,itemId:P.id,index:ee}:void 0;return a.jsx(Vpe,{id:Jt,disabled:!Se,className:"mb-2",data:en,children:({setActivatorNodeRef:In,attributes:cn,listeners:G,isDragging:ke})=>{var Ce,We,Qe,ot,Ft;return a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[a.jsx("button",{ref:In,...cn,...G,className:"flex-shrink-0 h-8 w-8 inline-flex items-center justify-center rounded-md hover:bg-gray-50 cursor-grab active:cursor-grabbing","aria-label":"Drag to reorder",children:a.jsx(Gee,{className:"h-4 w-4 text-gray-500"})}),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($n,{variant:"outline",className:"text-xs",children:re==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(_a,{className:"h-3 w-3 mr-1"}),typeof P.type=="string"?P.type.replace("_"," "):String(P.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(Rs,{className:"h-3 w-3 mr-1"}),typeof P.type=="string"?P.type.replace("_"," "):String(P.type||"unknown")]})}),P.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(dm,{className:"h-3 w-3"}),a.jsx(Kt,{type:"number",value:P.time_limit,onChange:tt=>M(P.id,{time_limit:parseInt(tt.target.value)||void 0},re),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(bt,{value:Nt?"":P.content,onChange:tt=>M(P.id,{content:tt.target.value},re),placeholder:Nt?P.content:"Enter content...",className:"min-h-[60px]"}),re==="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(bt,{value:((Ce=P.probes)==null?void 0:Ce.join(` -`))||"",onChange:tt=>{const Zt=tt.target.value.trim()?tt.target.value.split(` -`).filter($t=>$t.trim()):[];M(P.id,{probes:Zt},re)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]}),(((We=P.metadata)==null?void 0:We.image_url)||((Qe=P.metadata)==null?void 0:Qe.image_id)||Ne)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sp,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(ot=P.metadata)!=null&&ot.image_url?a.jsx("img",{src:P.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Ft=P.metadata)!=null&&Ft.image_id&&h?a.jsx("img",{src:St.getAssetUrl(h,P.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):Ne&&h?a.jsx("img",{src:St.getAssetUrl(h,Ne),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(ie,{size:"sm",variant:"ghost",onClick:()=>xe(P.id,re),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(Qn,{className:"h-3 w-3"})})})]})}},`edit-item-${P.id}`)}return a.jsxs("div",{className:Fe("flex items-start gap-3 p-3 rounded-lg border transition-colors",Ue&&"bg-blue-50 border-blue-200",Be&&"bg-green-50 border-green-200",!Ue&&!Be&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(m.sections[H].id,P.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:Be?a.jsx(ON,{className:"h-4 w-4 text-green-600"}):Ue?a.jsx(PB,{className:"h-4 w-4 text-blue-600"}):a.jsx(IN,{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($n,{variant:"outline",className:"text-xs whitespace-nowrap",children:re==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(_a,{className:"h-3 w-3 mr-1"}),typeof P.type=="string"?P.type.replace("_"," "):String(P.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(Rs,{className:"h-3 w-3 mr-1"}),typeof P.type=="string"?P.type.replace("_"," "):String(P.type||"unknown")]})}),P.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(dm,{className:"h-3 w-3"}),P.time_limit," min"]}),i&&a.jsxs(ie,{size:"sm",variant:"ghost",onClick:Jt=>{Jt.stopPropagation();const en=m.sections[H],In=re==="activity"?`Activity ${ee+1}`:`Question ${ee+1}`;i(en.id,P.id,P.content,en.title,In,re,P.metadata)},className:"h-6 px-2 ml-auto",children:[a.jsx(Py,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:P.content}),P.probes&&P.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:P.probes.map((Jt,en)=>a.jsxs("li",{className:"text-xs text-slate-600",children:["• ",Jt]},en))})]}),(((rt=P.metadata)==null?void 0:rt.image_url)||((jt=P.metadata)==null?void 0:jt.image_id)||Ne)&&a.jsxs("div",{className:"mt-3",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sp,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(Bt=P.metadata)!=null&&Bt.image_url?a.jsx("img",{src:P.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Dt=P.metadata)!=null&&Dt.image_id&&h?a.jsx("img",{src:St.getAssetUrl(h,P.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):Ne&&h?a.jsx("img",{src:St.getAssetUrl(h,Ne),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},P.id)},ye=(P,H)=>{var Ae,Ie,Ke,Ue,Be,nt;const ee=y.has(P.id),re=x===P.id,Z=re?S:P,Se=(n==null?void 0:n.moderator_position.section_index)===H;return a.jsxs("div",{className:Fe("border rounded-lg overflow-hidden transition-colors",Se&&"border-blue-500 shadow-md",!Se&&"border-slate-200"),children:[a.jsxs("div",{className:Fe("px-4 py-3 flex items-center justify-between cursor-pointer hover:bg-slate-50 transition-colors",Se&&"bg-blue-50"),onClick:()=>!re&&ce(P.id),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"transition-transform",style:{transform:ee?"rotate(90deg)":"rotate(0deg)"},children:a.jsx(mo,{className:"h-5 w-5 text-slate-500"})}),a.jsx("h3",{className:"font-semibold text-slate-800",children:re?a.jsx(Kt,{value:Z.title,onChange:Ne=>z({title:Ne.target.value}),onClick:Ne=>Ne.stopPropagation(),className:"font-semibold"}):Z.title}),Se&&a.jsx($n,{variant:"default",className:"text-xs",children:"Current"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[o&&!re&&a.jsx(ie,{size:"sm",variant:"ghost",onClick:Ne=>{Ne.stopPropagation(),V(P)},className:"h-8 px-2",children:a.jsx($A,{className:"h-3 w-3"})}),re&&a.jsxs("div",{className:"flex items-center gap-2",onClick:Ne=>Ne.stopPropagation(),children:[a.jsxs(ie,{size:"sm",variant:"default",onClick:B,disabled:_,className:"h-8",children:[_?a.jsx(no,{className:"h-3 w-3 animate-spin"}):a.jsx(MN,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Save"})]}),a.jsxs(ie,{size:"sm",variant:"ghost",onClick:L,disabled:_,className:"h-8",children:[a.jsx(Mi,{className:"h-3 w-3"}),a.jsx("span",{className:"ml-1",children:"Cancel"})]})]})]})]}),ee&&a.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 space-y-4",children:[Z.content&&a.jsx("div",{className:"prose prose-sm max-w-none",children:re?a.jsx(bt,{value:Z.content,onChange:Ne=>z({content:Ne.target.value}),placeholder:"Section introduction or context...",className:"min-h-[80px] w-full"}):a.jsx("p",{className:"text-slate-700",children:Z.content})}),Z.activities&&Z.activities.length>0||re?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(_a,{className:"h-4 w-4"}),"Activities"]}),re&&a.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>$("activity"),className:"h-7",children:[a.jsx(_a,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx(ty,{containerId:Yu(Z.id,"a"),sectionId:Z.id,subsectionId:null,kind:"a",className:"min-h-[2rem]",children:a.jsx(Zv,{items:((Ae=Z.activities)==null?void 0:Ae.map(Ne=>Uh(Yu(Z.id,"a"),Ne.id)))||[],strategy:Jv,children:a.jsx("div",{className:"space-y-2",children:(Ie=Z.activities)==null?void 0:Ie.map((Ne,Nt)=>oe(Ne,H,Nt,"activity",void 0,Yu(Z.id,"a")))})})})]}):null,Z.questions&&Z.questions.length>0||re?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(Rs,{className:"h-4 w-4"}),"Questions"]}),re&&a.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>$("question"),className:"h-7",children:[a.jsx(Rs,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx(ty,{containerId:Yu(Z.id,"q"),sectionId:Z.id,subsectionId:null,kind:"q",className:"min-h-[2rem]",children:a.jsx(Zv,{items:((Ke=Z.questions)==null?void 0:Ke.map(Ne=>Uh(Yu(Z.id,"q"),Ne.id)))||[],strategy:Jv,children:a.jsx("div",{className:"space-y-2",children:(Ue=Z.questions)==null?void 0:Ue.map((Ne,Nt)=>oe(Ne,H,Nt,"question",void 0,Yu(Z.id,"q")))})})})]}):null,re&&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(Py,{className:"h-4 w-4"}),"Subsections"]}),a.jsxs(ie,{size:"sm",variant:"outline",onClick:q,className:"h-7",children:[a.jsx(Py,{className:"h-3 w-3 mr-1"}),"Add Subsection"]})]})}),Z.subsections&&Z.subsections.length>0&&a.jsx("div",{className:"space-y-3 ml-4",children:Z.subsections.map((Ne,Nt)=>{var pn,Je,rt,jt;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:[re&&a.jsxs("div",{className:"flex flex-col gap-1",children:[a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>je(Nt),disabled:!se(Z.subsections||[],Nt),className:"h-7 w-7 p-0",title:"Move subsection up",children:a.jsx(qf,{className:"h-4 w-4"})}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>K(Nt),disabled:!ne(Z.subsections||[],Nt),className:"h-7 w-7 p-0",title:"Move subsection down",children:a.jsx(yl,{className:"h-4 w-4"})})]}),re&&j===Ne.id?a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx(Kt,{value:k,onChange:Bt=>O(Bt.target.value),className:"flex-1",onKeyDown:Bt=>{Bt.key==="Enter"?ut():Bt.key==="Escape"&&Me()},autoFocus:!0}),a.jsx(ie,{size:"sm",onClick:ut,children:a.jsx(Io,{className:"h-3 w-3"})}),a.jsx(ie,{size:"sm",variant:"outline",onClick:Me,children:a.jsx(Mi,{className:"h-3 w-3"})})]}):a.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[a.jsx("h5",{className:Fe("font-medium text-slate-700",re&&"cursor-pointer hover:text-blue-600"),onClick:()=>re&&et(Ne.id,Ne.title),children:Ne.title}),re&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>et(Ne.id,Ne.title),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100",children:a.jsx($A,{className:"h-3 w-3"})}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>te(Nt),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(Qn,{className:"h-3 w-3"})})]})]})]}),Ne.questions&&Ne.questions.length>0||re?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(Rs,{className:"h-3 w-3"}),"Questions"]}),re&&a.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>Q(Nt,"question"),className:"h-6",children:[a.jsx(Rs,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx(ty,{containerId:Qu(Z.id,Ne.id,"q"),sectionId:Z.id,subsectionId:Ne.id,kind:"q",className:"min-h-[2rem]",children:a.jsx(Zv,{items:((pn=Ne.questions)==null?void 0:pn.map(Bt=>Uh(Qu(Z.id,Ne.id,"q"),Bt.id)))||[],strategy:Jv,children:a.jsx("div",{className:"space-y-2",children:(Je=Ne.questions)==null?void 0:Je.map((Bt,Dt)=>oe(Bt,H,Dt,"question",Nt,Qu(Z.id,Ne.id,"q")))})})})]}):null,Ne.activities&&Ne.activities.length>0||re?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(_a,{className:"h-3 w-3"}),"Activities"]}),re&&a.jsxs(ie,{size:"sm",variant:"outline",onClick:()=>Q(Nt,"activity"),className:"h-6",children:[a.jsx(_a,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx(ty,{containerId:Qu(Z.id,Ne.id,"a"),sectionId:Z.id,subsectionId:Ne.id,kind:"a",className:"min-h-[2rem]",children:a.jsx(Zv,{items:((rt=Ne.activities)==null?void 0:rt.map(Bt=>Uh(Qu(Z.id,Ne.id,"a"),Bt.id)))||[],strategy:Jv,children:a.jsx("div",{className:"space-y-2",children:(jt=Ne.activities)==null?void 0:jt.map((Bt,Dt)=>oe(Bt,H,Dt,"activity",Nt,Qu(Z.id,Ne.id,"a")))})})})]}):null]},Ne.id)})}),(((Be=P.metadata)==null?void 0:Be.image_url)||((nt=P.metadata)==null?void 0:nt.image_id))&&a.jsxs("div",{className:"mt-4",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sp,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),P.metadata.image_url?a.jsx("img",{src:P.metadata.image_url,alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):P.metadata.image_id&&h?a.jsx("img",{src:St.getAssetUrl(h,P.metadata.image_id),alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},P.id)};if(v)return a.jsxs("div",{className:Fe("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(ie,{size:"sm",variant:"outline",onClick:d,disabled:f,children:[f?a.jsx(no,{className:"h-4 w-4 animate-spin mr-2"}):a.jsx(ol,{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:Fe("bg-slate-50 rounded-lg p-8 text-center",u),children:a.jsx("p",{className:"text-slate-600",children:"No discussion guide available"})});const Ee=a.jsx(gpe,{sensors:D,collisionDetection:Hpe,modifiers:[Bpe,Fpe],onDragStart:Ye,onDragOver:Pt,onDragEnd:F,onDragCancel:J,autoScroll:!0,children: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((P,H)=>ye(P,H))})]})});return c?a.jsxs(Qg,{defaultOpen:l,className:u,children:[a.jsx(Xg,{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(mo,{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($n,{variant:"outline",className:"text-xs",children:[m.total_duration," min"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[n&&a.jsxs($n,{variant:n.progress===100?"success":"default",className:"text-xs",children:[Math.round(n.progress),"% Complete"]}),d&&a.jsx(ie,{size:"sm",variant:"outline",onClick:P=>{P.stopPropagation(),d()},disabled:f,children:f?a.jsx(no,{className:"h-4 w-4 animate-spin"}):a.jsx(ol,{className:"h-4 w-4"})})]})]})}),a.jsx(Jg,{className:"mt-4",children:Ee})]}):a.jsx("div",{className:u,children:Ee})});Jk.displayName="DiscussionGuideViewer";const El="all",Gpe=$e.object({researchBrief:$e.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:$e.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:$e.string().min(10,{message:"Discussion topics are required."}),duration:$e.string().min(1,{message:"Duration is required."}),llm_model:$e.string().optional(),reasoning_effort:$e.string().optional(),verbosity:$e.string().optional()});function Kpe({draftToEdit:t,onDraftSaved:e,preSelectedParticipants:n=[]}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",t);const r=ur();Ui();const{setPreviousRoute:i,navigationState:o,clearNavigationState:s}=Ug(),[c,l]=g.useState("setup"),[u,d]=g.useState(!1),[f,h]=g.useState(!1),[p,v]=g.useState(!1),[m,y]=g.useState(null),[b,x]=g.useState(null),[w,S]=g.useState(!1),C=g.useRef(m);C.current=m;const _=g.useRef(!1),A=I=>I&&typeof I=="object"&&I.title&&I.sections,[j,T]=g.useState([]),[k,O]=g.useState([]),[E,R]=g.useState(!1),[D,V]=g.useState([]),[L,z]=g.useState(!1),[M,$]=g.useState(!1),[Q,q]=g.useState(!1),[te,xe]=g.useState([]),[B,ce]=g.useState(!1),[he,U]=g.useState("");N.useEffect(()=>{console.log("isCopyGuideModalOpen state changed to:",Q)},[Q]),N.useEffect(()=>{console.log("FocusGroupModerator rendered - Modal state:",Q,"Available focus groups:",te.length)});const[de,se]=g.useState([]),[ne,je]=g.useState(El),[K,et]=g.useState(!1),[Me,ut]=g.useState(""),[Ye,Pt]=g.useState(null),[F,J]=g.useState(""),[oe,ye]=g.useState(""),[Ee,P]=g.useState(!1),[H,ee]=g.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[re,Z]=g.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[Se,Ae]=g.useState("idle"),[Ie,Ke]=g.useState(null),[Ue,Be]=g.useState(0),nt=g.useRef(null),Ne=g.useRef(!1),Nt=g.useRef(!1),pn=I=>{i("/focus-groups",{focusGroupId:b,focusGroupTab:"participants",isNewFocusGroup:!t,focusGroupData:{name:Ce.getValues("name"),description:Ce.getValues("description"),selectedParticipants:j,discussionGuide:m}}),r(`/synthetic-users/${I.id}`)},Je=I=>{const X={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return I.forEach(Y=>{if(Y.age&&X.age.add(Y.age),Y.gender&&X.gender.add(Y.gender),Y.occupation&&X.occupation.add(Y.occupation),Y.location&&X.location.add(Y.location),Y.techSavviness!==void 0){const pe=Y.techSavviness<30?"Low (0-30)":Y.techSavviness<70?"Medium (31-70)":"High (71-100)";X.techSavviness.add(pe)}Y.ethnicity&&X.ethnicity.add(Y.ethnicity)}),{age:Array.from(X.age).sort(),gender:Array.from(X.gender).sort(),occupation:Array.from(X.occupation).sort(),location:Array.from(X.location).sort(),techSavviness:Array.from(X.techSavviness).sort((Y,pe)=>{const Pe=["Low (0-30)","Medium (31-70)","High (71-100)"];return Pe.indexOf(Y)-Pe.indexOf(pe)}),ethnicity:Array.from(X.ethnicity).sort()}},rt=I=>{const X={...re};X[I]=[];const Y=D.filter(pe=>{let Pe=!0;return ne!==El&&(Pe=!1,pe.folder_ids&&Array.isArray(pe.folder_ids)&&(Pe=pe.folder_ids.includes(ne)),!Pe&&(pe.folder_id===ne||pe.folderId===ne)&&(Pe=!0)),Pe?Object.entries(X).every(([me,dt])=>{if(dt.length===0)return!0;const st=me;if(st==="techSavviness"&&pe.techSavviness!==void 0){const Wt=pe.techSavviness<30?"Low (0-30)":pe.techSavviness<70?"Medium (31-70)":"High (71-100)";return dt.includes(Wt)}else{if(st==="age"&&pe.age)return dt.includes(pe.age);if(st==="gender"&&pe.gender)return dt.includes(pe.gender);if(st==="occupation"&&pe.occupation)return dt.includes(pe.occupation);if(st==="location"&&pe.location)return dt.includes(pe.location);if(st==="ethnicity"&&pe.ethnicity)return dt.includes(pe.ethnicity)}return!0}):!1});return Je(Y)},jt=()=>{P(!1),setTimeout(()=>{ee({...re})},0)},Bt=()=>{Z({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},Dt=(I,X)=>{Z(Y=>{const pe={...Y};return pe[I].includes(X)?pe[I]=pe[I].filter(Pe=>Pe!==X):pe[I]=[...pe[I],X],pe})},Jt=async()=>{try{const Y=(await Ms.getAll()).data.map(pe=>({...pe,id:pe._id}));return se(Y),Y}catch(I){return console.error("Error fetching folders:",I),ae.error("Failed to load folders"),se([]),[]}},en=async()=>{if(!Me.trim()){ae.error("Please enter a folder name");return}try{const I=await Ms.create({name:Me.trim()});await Jt(),ut(""),et(!1),ae.success(`Folder "${Me}" created`)}catch(I){console.error("Error creating folder:",I),ae.error("Failed to create folder")}},In=()=>{ut(""),et(!1)},cn=I=>{Pt(I),J(I.name)},G=async()=>{if(!Ye||!F.trim()){Pt(null);return}try{await Ms.update(Ye._id,{name:F.trim()}),await Jt(),Pt(null),ae.success(`Folder renamed to "${F}"`)}catch(I){console.error("Error renaming folder:",I),ae.error("Failed to rename folder"),Pt(null)}},ke=()=>{Pt(null),J("")};g.useEffect(()=>{const I=async()=>{z(!0);try{const Y=await Er.getAll();console.log("Fetched personas for FocusGroupModerator:",Y.data),Array.isArray(Y.data)&&Y.data.length>0?V(Y.data):(console.warn("No personas returned from API or invalid format",Y.data),ae.warning("No participants available"))}catch(Y){console.error("Error fetching personas:",Y),ae.error("Failed to load participants")}finally{z(!1)}};(async()=>{await Promise.all([Jt(),I()])})()},[]),console.log("About to initialize form with useForm hook");const Ce=Hg({resolver:Vg(Gpe),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro",reasoning_effort:"medium",verbosity:"medium"}});console.log("Form initialized successfully");const We=()=>{c!=="setup"||Nt.current||(nt.current&&clearTimeout(nt.current),nt.current=setTimeout(async()=>{if(Ne.current)return;const I=Ce.getValues(),X={name:I.focusGroupName||"",description:I.researchBrief||"",objective:I.researchBrief||"",topic:I.discussionTopics||"",duration:I.duration?parseInt(I.duration):60,llm_model:I.llm_model||"gemini-2.5-pro",reasoning_effort:I.reasoning_effort||"medium",verbosity:I.verbosity||"medium",participants:j,participants_count:j.length,status:"draft",date:new Date().toISOString(),uploadedAssets:k.map(Y=>Y.filename||Y.original_name||"unknown")};if(!(Ie&&JSON.stringify(X)===JSON.stringify(Ie))&&!(!X.name&&!X.description&&!X.topic)){Ne.current=!0,Ae("saving");try{let Y=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 =",Y),console.log("Auto-save: llm_model in currentData =",X.llm_model),console.log("Auto-save: duration in currentData =",X.duration),Y)console.log("Auto-save: Updating existing focus group:",Y),await St.update(Y,X),console.log("Auto-save: Updated existing draft:",Y);else{console.log("Auto-save: Creating NEW focus group (no existing ID)");const pe=await St.create(X);Y=pe.data.focus_group_id||pe.data.id||pe.data._id,x(Y),console.log("Auto-save: Created new draft with ID:",Y)}Ke(X),Ae("saved"),Be(0),setTimeout(()=>{Ae("idle")},2e3)}catch(Y){if(console.error("Auto-save failed:",Y),Ae("error"),Be(pe=>pe+1),Ue<3){const pe=Math.pow(2,Ue)*2e3;setTimeout(()=>{We()},pe)}else ae.error("Auto-save failed",{description:"Your changes may not be saved. Please check your connection."})}finally{Ne.current=!1}}},2e3))},Qe=async I=>{try{R(!0);const X=await St.getAssets(I);O(X.data.assets||[])}catch(X){console.error("Error fetching backend assets:",X),ae.error("Failed to load asset information")}finally{R(!1)}},ot=async()=>{console.log("fetchAvailableFocusGroups called");try{ce(!0);const I=await St.getAll();console.log("Fetched focus groups:",I.data);const X=I.data.filter(Y=>Y.discussionGuide&&Y.discussionGuide!==null&&Y.discussionGuide!==""&&Y._id!==b);console.log("Focus groups with guides:",X),xe(X)}catch(I){console.error("Error fetching focus groups:",I),ae.error("Failed to load available focus groups")}finally{ce(!1)}},Ft=async I=>{try{const X=te.find(Y=>Y._id===I);if(!X||!X.discussionGuide){ae.error("Selected focus group does not have a discussion guide");return}if(y(X.discussionGuide),b)try{const Y=Ce.getValues(),pe={name:Y.focusGroupName,status:"draft",participants:j,participants_count:j.length,duration:parseInt(Y.duration||"60"),topic:Y.discussionTopics||"",description:Y.researchBrief||"",objective:Y.researchBrief||"",llm_model:Y.llm_model||"gemini-2.5-pro",reasoning_effort:Y.reasoning_effort||"medium",verbosity:Y.verbosity||"medium",discussionGuide:X.discussionGuide};await St.update(b,pe),console.log("Draft focus group updated with copied discussion guide")}catch(Y){console.error("Failed to update focus group with copied discussion guide:",Y),ae.error("Failed to save copied discussion guide",{description:"Discussion guide copied, but draft save failed"})}q(!1),l("review"),ae.success("Discussion guide copied successfully",{description:`Copied from "${X.name}"`})}catch(X){console.error("Error copying discussion guide:",X),ae.error("Failed to copy discussion guide",{description:"An error occurred while copying the discussion guide"})}},tt=Ce.watch(),Zt=g.useRef(""),$t=g.useRef("");g.useEffect(()=>{const I=JSON.stringify(tt);c==="setup"&&I!==Zt.current&&(Zt.current=I,We())},[tt,c]),g.useEffect(()=>{const I=JSON.stringify(j);c==="setup"&&I!==$t.current&&($t.current=I,We())},[j,c]),g.useEffect(()=>(c!=="setup"&&nt.current&&clearTimeout(nt.current),()=>{nt.current&&clearTimeout(nt.current)}),[c]),g.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),Nt.current=!0,_.current=!0;const I=t.id||t._id;x(I),console.log("Setting draft ID from draftToEdit:",I),I&&Qe(I),t.name&&Ce.setValue("focusGroupName",t.name),(t.description||t.objective)&&Ce.setValue("researchBrief",t.description||t.objective||""),t.topic&&Ce.setValue("discussionTopics",t.topic),t.duration&&Ce.setValue("duration",t.duration.toString()),t.llm_model&&Ce.setValue("llm_model",t.llm_model),t.reasoning_effort&&Ce.setValue("reasoning_effort",t.reasoning_effort),t.verbosity&&Ce.setValue("verbosity",t.verbosity),t.discussionGuide&&(y(t.discussionGuide),(!o.focusGroupTab||o.previousRoute!=="/focus-groups")&&l("review")),t.participants&&Array.isArray(t.participants)&&T(t.participants);const X={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:k.map(Y=>Y.filename||Y.original_name||"unknown")};Ke(X),console.log("Set lastSavedData to current draft:",X),ae.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}),setTimeout(()=>{Nt.current=!1;const Y=JSON.stringify(Ce.getValues());Zt.current=Y},1e3)}},[t,Ce]),g.useEffect(()=>{n.length>0&&(console.log("Pre-selected participants received:",n),T(n),l("participants"))},[n]),g.useEffect(()=>{o.focusGroupTab&&o.previousRoute==="/focus-groups"&&setTimeout(()=>{l(o.focusGroupTab),s()},0)},[o.focusGroupTab,t,s]),g.useEffect(()=>{t||setTimeout(()=>{Nt.current=!1;const I=JSON.stringify(Ce.getValues());Zt.current=I},500)},[t,Ce]);const Xt=()=>{if(Se==="idle")return null;const X={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"}}[Se];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 ${X.className}`,children:X.text})},Rn=async(I,X)=>{var Y,pe;d(!0),h(!1),v(!1);try{const Pe={name:I.focusGroupName,description:I.researchBrief,objective:I.researchBrief,topic:I.discussionTopics,duration:parseInt(I.duration),llm_model:I.llm_model,reasoning_effort:I.reasoning_effort,verbosity:I.verbosity},me=X?await St.generateDiscussionGuideForGroup(X,Pe):await St.generateDiscussionGuide(Pe);if(me.data&&me.data.discussionGuide)return h(!0),me.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(Pe){console.error("Error generating discussion guide:",Pe),v(!0);let me="Unknown error occurred";throw(pe=(Y=Pe==null?void 0:Pe.response)==null?void 0:Y.data)!=null&&pe.error?me=Pe.response.data.error:Pe!=null&&Pe.message&&(me=Pe.message),me.includes("500")||me.includes("internal error")||me.includes("Internal Server Error")?ae.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>Rn(I)}}):ae.error("Failed to generate discussion guide",{description:me,action:{label:"Retry",onClick:()=>Rn(I)}}),Pe}},Lo=()=>{d(!1),h(!1),v(!1)};async function Zn(I){try{let X=b;if(!X){const Y={name:I.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(I.duration),topic:I.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:I.researchBrief,objective:I.researchBrief,llm_model:I.llm_model,reasoning_effort:I.reasoning_effort,verbosity:I.verbosity},pe=await St.create(Y);X=pe.data.focus_group_id||pe.data.id||pe.data._id,x(X),console.log("Draft focus group created for discussion guide generation:",pe,"with ID:",X)}if(X)try{const Y={name:I.focusGroupName,participants:j,participants_count:j.length,duration:parseInt(I.duration),topic:I.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:I.researchBrief,objective:I.researchBrief,llm_model:I.llm_model,reasoning_effort:I.reasoning_effort,verbosity:I.verbosity};await St.update(X,Y),console.log("Focus group updated with latest form values before guide generation"),console.log(`🔄 Updated focus group ${X} with model: ${I.llm_model}`)}catch(Y){console.error("Failed to update focus group before guide generation:",Y)}try{const Y=await Rn(I,X);y(Y);try{const pe={name:I.focusGroupName,status:"draft",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(I.duration),topic:I.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:I.researchBrief,objective:I.researchBrief,llm_model:I.llm_model,reasoning_effort:I.reasoning_effort,verbosity:I.verbosity,discussionGuide:Y};await St.update(X,pe),console.log("Focus group updated with discussion guide"),ae.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(pe){console.error("Failed to update focus group with discussion guide:",pe),ae.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}l("review"),ae.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(Y){console.error("Discussion guide generation failed:",Y),ae.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(X){console.error("Error in focus group creation flow:",X),ae.error("Focus group creation failed",{description:X.message||"An unexpected error occurred"})}}const Fo=(()=>{var X;const I=D.filter(Y=>{const pe=Y.name.toLowerCase().includes(oe.toLowerCase())||Y.occupation&&Y.occupation.toLowerCase().includes(oe.toLowerCase())||Y.location&&Y.location.toLowerCase().includes(oe.toLowerCase()),Pe=(H.age.length===0||H.age.includes(Y.age))&&(H.gender.length===0||H.gender.includes(Y.gender))&&(H.occupation.length===0||H.occupation.includes(Y.occupation))&&(H.location.length===0||H.location.includes(Y.location))&&(H.ethnicity.length===0||Y.ethnicity&&H.ethnicity.includes(Y.ethnicity))&&(H.techSavviness.length===0||Y.techSavviness!==void 0&&H.techSavviness.includes(Y.techSavviness<30?"Low (0-30)":Y.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let me=!0;return ne!==El&&(me=!1,Y.folder_ids&&Array.isArray(Y.folder_ids)&&(me=Y.folder_ids.includes(ne)),me||(Y.folder_id===ne||Y.folderId===ne)&&(me=!0)),pe&&Pe&&me});if(console.log(`Filtered personas: ${I.length}/${D.length}`),console.log(`Selected folder: ${ne===El?"All Personas":((X=de.find(Y=>Y._id===ne||Y.id===ne))==null?void 0:X.name)||ne}`),ne!==El){const Y=de.find(pe=>pe._id===ne||pe.id===ne);if(Y){const pe=D.filter(Pe=>Pe.folder_ids&&Array.isArray(Pe.folder_ids)?Pe.folder_ids.includes(ne):Pe.folder_id===ne||Pe.folderId===ne);console.log(`Folder details: ${Y.name}, ID: ${Y._id}, Contains: ${pe.length} personas`),console.log("Personas in this folder:",pe.map(Pe=>Pe.name))}}return I})(),Ah=I=>{console.log("Toggling selection for participant ID:",I),T(X=>{const Y=X.includes(I);console.log("Current selection:",{id:I,isCurrentlySelected:Y,currentSelections:[...X]});const pe=Y?X.filter(Pe=>Pe!==I):[...X,I];return console.log("New selection:",pe),pe})},Uu=async()=>{try{const I=Ce.getValues(),X={name:I.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(I.duration),topic:I.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:m},pe=(await St.create(X)).data;return console.log("Focus group created successfully:",pe),pe.focus_group_id}catch(I){throw console.error("Error saving focus group:",I),I}},lo=g.useCallback(async()=>{if(!C.current){ae.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}$(!0);try{const{downloadDiscussionGuideAsMarkdown:I}=await $se(async()=>{const{downloadDiscussionGuideAsMarkdown:Y}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:Y}},[]),X=Ce.getValues();I(C.current,X.focusGroupName),ae.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(I){console.error("Error downloading discussion guide:",I),ae.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{$(!1)}},[Ce]),jh=g.useCallback(async I=>{console.log("📝 handleSaveDiscussionGuide called with:",I),w?(C.current=I,console.log("📝 Skipping discussionGuide state update during editing to preserve focus")):(y(I),ae.success("Discussion guide updated",{description:"Your changes have been saved."}))},[w]),ue=g.useCallback(I=>{console.log("📝 Discussion guide editing state changed:",I),S(I),!I&&C.current&&(console.log("📝 Updating discussionGuide state after editing ended"),y(C.current))},[]),ge=g.useCallback(()=>{},[]),Ge=async()=>{if(!Ce.getValues().focusGroupName){ae.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!m){ae.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(j.length<1){ae.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{ae.loading("Creating focus group...");let I;if(b){const X=Ce.getValues(),Y={name:X.focusGroupName,status:"in-progress",participants:j,participants_count:j.length,date:new Date().toISOString(),duration:parseInt(X.duration),topic:X.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:X.researchBrief,objective:X.researchBrief,discussionGuide:m},pe=await St.update(b,Y);I=b,console.log("Draft focus group updated to in-progress:",pe),e&&e()}else I=await Uu();ae.dismiss(),ae.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),r(`/focus-groups/${I}`)}catch(I){ae.dismiss(),I!=null&&I.message,console.error("Failed to start focus group:",I),ae.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return a.jsxs(a.Fragment,{children:[a.jsx(Xt,{}),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(na,{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(Uk,{isActive:u,isComplete:f,hasError:p,label:"Generating discussion guide",onComplete:Lo})}),a.jsxs(wl,{value:c,onValueChange:l,children:[a.jsxs(tc,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(vn,{value:"setup",children:"Setup"}),a.jsx(vn,{value:"review",children:"Review & Edit"}),a.jsx(vn,{value:"participants",children:"Participants"})]}),a.jsxs(yn,{value:"setup",children:[a.jsx(Kg,{...Ce,children:a.jsxs("form",{onSubmit:Ce.handleSubmit(Zn),className:"space-y-6",children:[a.jsx(xt,{control:Ce.control,name:"focusGroupName",render:({field:I})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Focus Group Name"}),a.jsx(gt,{children:a.jsx(Kt,{placeholder:"e.g., Mobile App UX Evaluation",...I})}),a.jsx(Sn,{children:"Give your focus group a descriptive name"}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(xt,{control:Ce.control,name:"researchBrief",render:({field:I})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Research Brief"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"Describe your research objectives...",className:"h-36",...I})}),a.jsx(Sn,{children:"Provide context about what you want to learn"}),a.jsx(vt,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(xt,{control:Ce.control,name:"discussionTopics",render:({field:I})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Discussion Topics"}),a.jsx(gt,{children:a.jsx(bt,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...I})}),a.jsx(Sn,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:Ce.control,name:"duration",render:({field:I})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Duration (minutes)"}),a.jsxs(Tn,{onValueChange:I.onChange,value:I.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select duration"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"30",children:"30 minutes"}),a.jsx(le,{value:"45",children:"45 minutes"}),a.jsx(le,{value:"60",children:"60 minutes"}),a.jsx(le,{value:"90",children:"90 minutes"}),a.jsx(le,{value:"120",children:"120 minutes"})]})]}),a.jsx(Sn,{children:"How long should the focus group session last?"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:Ce.control,name:"llm_model",render:({field:I})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"AI Model"}),a.jsxs(Tn,{onValueChange:I.onChange,value:I.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select AI model"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(le,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(le,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Sn,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(vt,{})]})}),Ce.watch("llm_model")==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsx(xt,{control:Ce.control,name:"reasoning_effort",render:({field:I})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Reasoning Effort"}),a.jsxs(Tn,{onValueChange:I.onChange,value:I.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select reasoning effort"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(le,{value:"low",children:"Low - Quick thinking"}),a.jsx(le,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(le,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx(Sn,{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(vt,{})]})}),a.jsx(xt,{control:Ce.control,name:"verbosity",render:({field:I})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Response Verbosity"}),a.jsxs(Tn,{onValueChange:I.onChange,value:I.value,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select verbosity level"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"low",children:"Low - Concise responses"}),a.jsx(le,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(le,{value:"high",children:"High - Detailed responses"})]})]}),a.jsx(Sn,{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(vt,{})]})})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 mb-2 block",children:"Creative Assets (Optional)"}),a.jsx(q6,{focusGroupId:b,disabled:!b,onUploadComplete:I=>{O(I)},onUploadError:I=>{console.error("Asset upload error:",I)},onAssetsChange:I=>{O(I)},maxAssets:10,maxFileSize:10,allowedTypes:["image/*","application/pdf","video/*","text/*","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],label:"Asset Upload",description:"Provide any files you wish the moderator to use in the focus group session. This could include mockups, designs, documents, or other materials for discussion.",enableRenaming:!0}),a.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Upload visuals that you want feedback on during the session"})]})]})}),a.jsxs("div",{className:"flex justify-end gap-3 mt-6",children:[a.jsxs(ie,{type:"button",variant:"outline",onClick:I=>{I.preventDefault(),I.stopPropagation(),console.log("Copy Discussion Guide button clicked"),q(!0),ot()},disabled:u,className:"min-w-32",children:[a.jsx(Uee,{className:"mr-2 h-4 w-4"}),"Copy Discussion Guide"]}),a.jsxs(ie,{type:"button",onClick:I=>{I.preventDefault(),console.log("Generate Discussion Guide button clicked"),Ce.getValues(),Ce.handleSubmit(Zn)(I)},disabled:u,className:"min-w-32",children:[a.jsx(na,{className:"mr-2 h-4 w-4"}),u?"Generating...":"Generate Discussion Guide"]})]})]}),a.jsx(yn,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(yt,{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($n,{variant:"outline",className:"text-xs",children:A(m)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:m?a.jsx(Jk,{discussionGuide:m,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:jh,onDownload:lo,onSectionSelect:ge,isDownloading:M,focusGroupId:b,onEditingChange:ue}):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(yt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Creative Assets"}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-sm text-slate-600",children:"Assets that will be referenced in the discussion guide:"}),a.jsx("div",{className:"space-y-2",children:k.map((I,X)=>{var pe;const Y=I.user_assigned_name||`Asset ${X+1}`;return a.jsxs("div",{className:"flex items-center gap-3 p-3 border rounded-lg bg-slate-50",children:[a.jsx("div",{className:"w-10 h-10 bg-slate-200 rounded flex items-center justify-center flex-shrink-0",children:(pe=I.mime_type)!=null&&pe.startsWith("image/")?a.jsx("img",{src:St.getAssetUrl(b,I.filename),alt:Y,className:"max-h-full max-w-full object-contain rounded"}):a.jsx(sf,{className:"h-6 w-6 text-slate-600"})}),a.jsxs("div",{className:"flex-grow",children:[a.jsxs("p",{className:"font-medium text-sm",children:['"',Y,'"']}),a.jsx("p",{className:"text-xs text-slate-500",children:"Will appear in discussion guide"})]})]},I.filename)})}),a.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3",children:a.jsxs("p",{className:"text-sm text-blue-700",children:[a.jsx("strong",{children:"Note:"})," To rename assets, go back to the Setup tab and click the edit icon next to each asset."]})})]})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(ie,{variant:"outline",onClick:()=>l("setup"),children:"Back to Setup"}),a.jsxs(ie,{onClick:()=>l("participants"),children:["Select Participants",a.jsx(Fr,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(yn,{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(ie,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),et(!0)},className:"h-7 w-7 p-0",children:a.jsx(OB,{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:",D.length),je(El),setTimeout(()=>{console.log(`Will show all ${D.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${ne===El?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(go,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),de.map(I=>a.jsx("div",{className:"flex items-center justify-between group",children:Ye&&Ye._id===I._id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(go,{className:"h-4 w-4"}),a.jsx(Kt,{value:F,onChange:X=>J(X.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:X=>{X.key==="Enter"?G():X.key==="Escape"&&ke()}}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${Ye==null?void 0:Ye.name}" to "${F}"`),G()},className:"h-7 w-7 p-0",children:a.jsx(Io,{className:"h-4 w-4"})}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${Ye==null?void 0:Ye.name}"`),ke()},className:"h-7 w-7 p-0",children:a.jsx(Mi,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${I.name} (ID: ${I._id})`);const X=D.filter(Y=>Y.folder_ids&&Array.isArray(Y.folder_ids)?Y.folder_ids.includes(I._id):Y.folder_id===I._id||Y.folderId===I._id);console.log(`Current persona count in folder: ${X.length}`),console.log("All personas count:",D.length),je(I._id),setTimeout(()=>{console.log(`Will show ${X.length} personas after filtering`),console.log("Filtered personas:",X.map(Y=>Y.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${ne===I._id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(go,{className:"h-4 w-4"}),a.jsx("span",{children:I.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:D.filter(X=>X.folder_ids&&Array.isArray(X.folder_ids)?X.folder_ids.includes(I._id):X.folder_id===I._id||X.folderId===I._id).length})]}),a.jsxs(C1,{children:[a.jsx(_1,{asChild:!0,children:a.jsx(ie,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(RA,{className:"h-4 w-4"})})}),a.jsx(gb,{align:"end",children:a.jsx(mc,{onClick:()=>{console.log(`Initiating rename for folder: ${I.name} (ID: ${I.id})`),cn(I)},children:"Rename"})})]})]})},I._id)),K&&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(go,{className:"h-4 w-4"}),a.jsx(Kt,{value:Me,onChange:I=>ut(I.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:I=>{I.key==="Enter"?en():I.key==="Escape"&&In()}})]}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${Me}"`),en()},className:"h-7 w-7 p-0",children:a.jsx(Io,{className:"h-4 w-4"})}),a.jsx(ie,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),In()},className:"h-7 w-7 p-0",children:a.jsx(Mi,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(yt,{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(Fr,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[j.length," of ",Fo.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(Tx,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Kt,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:oe,onChange:I=>ye(I.target.value)})]}),a.jsxs(ie,{variant:"outline",className:"flex items-center gap-2",onClick:()=>P(!0),children:[a.jsx(RN,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(H).some(I=>I.length>0)?` (${Object.values(H).reduce((I,X)=>I+X.length,0)})`:""]})]})]}),L?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(no,{className:"h-8 w-8 animate-spin text-primary"})}):Fo.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Fo.map(I=>{const X=I._id||I.id;return a.jsx(uk,{user:{id:X,_id:I._id,name:I.name,age:I.age,gender:I.gender,occupation:I.occupation,location:I.location||"Unknown",techSavviness:I.techSavviness||50,personality:I.personality||"No description available",oceanTraits:I.oceanTraits,qualitativeAttributes:I.qualitativeAttributes,topPersonalityTraits:I.topPersonalityTraits,aiSynthesizedBio:I.aiSynthesizedBio},selected:j.includes(X),onSelectionToggle:()=>Ah(X),onViewDetails:pn},X)})}):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(ie,{variant:"outline",onClick:()=>l("review"),children:"Back to Review"}),a.jsxs(ie,{onClick:Ge,disabled:j.length<1||!m,children:[a.jsx(ete,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(Ma,{open:Ee,onOpenChange:I=>{I?(P(I),Z({...H})):P(!1)},children:a.jsxs(Ws,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(qs,{children:[a.jsx(Qs,{children:"Filter Personas"}),a.jsx(Da,{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(re).some(I=>I.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(re).reduce((I,X)=>I+X.length,0)," active filters"]})}),(()=>{const I=Je(D),X=Object.values(re).every(pe=>pe.length===0),Y=(pe,Pe,me=1)=>{const dt=X?I[Pe]:rt(Pe)[Pe],st=re[Pe],Wt=[...new Set([...dt,...st])].sort();return Wt.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:pe}),a.jsx("div",{className:`grid grid-cols-1 ${me===2?"sm:grid-cols-2":me===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Wt.map(Ct=>{const er=re[Pe].includes(Ct),ln=dt.includes(Ct);return a.jsxs("div",{className:`flex items-center space-x-2 ${!ln&&!er?"opacity-50":""}`,children:[a.jsx(Gl,{id:`${Pe}-${Ct}`,checked:er,onCheckedChange:()=>Dt(Pe,Ct),disabled:!ln&&!er}),a.jsxs(yo,{htmlFor:`${Pe}-${Ct}`,className:"truncate overflow-hidden",children:[Ct,er&&!ln&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},Ct)})})]})};return a.jsxs(a.Fragment,{children:[Y("Gender","gender",3),Y("Age","age",3),Y("Ethnicity","ethnicity",2),Y("Location","location",2),Y("Occupation","occupation",2),Y("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(Ys,{children:[a.jsx(ie,{variant:"outline",onClick:Bt,children:"Reset"}),a.jsx(ie,{onClick:jt,children:"Apply Filters"})]})]})})]})]}),console.log("About to render Dialog OUTSIDE tabs - isCopyGuideModalOpen:",Q),a.jsx(Ma,{open:Q,onOpenChange:I=>{console.log("Dialog onOpenChange called with:",I),q(I)},children:a.jsxs(Ws,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(qs,{children:[a.jsx(Qs,{children:"Copy Discussion Guide"}),a.jsx(Da,{children:"Select a focus group to copy its discussion guide from. Only focus groups with existing discussion guides are shown."})]}),a.jsxs("div",{className:"py-4 space-y-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Tx,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Kt,{placeholder:"Search focus groups by name...",className:"pl-10",value:he,onChange:I=>U(I.target.value)})]}),B&&a.jsxs("div",{className:"flex justify-center items-center py-8",children:[a.jsx(no,{className:"h-8 w-8 animate-spin text-primary"}),a.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading focus groups..."})]}),!B&&a.jsx("div",{className:"space-y-3 max-h-96 overflow-y-auto",children:te.filter(I=>!he||I.name.toLowerCase().includes(he.toLowerCase())).length>0?te.filter(I=>!he||I.name.toLowerCase().includes(he.toLowerCase())).map(I=>{var X;return a.jsx(yt,{className:"p-4 cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>Ft(I._id),children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-medium text-sm",children:I.name}),a.jsxs($n,{variant:"outline",className:"text-xs",children:[I.participants_count||((X=I.participants)==null?void 0:X.length)||0," participants"]})]}),I.description&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:I.description}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[I.created_at&&a.jsxs("span",{children:["Created ",new Date(I.created_at).toLocaleDateString()]}),I.duration&&a.jsxs("span",{children:[I.duration," minutes"]}),I.status&&a.jsx($n,{variant:"secondary",className:"text-xs",children:I.status})]})]})},I._id)}):a.jsxs("div",{className:"text-center py-8",children:[a.jsx(sf,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),a.jsx("p",{className:"text-muted-foreground",children:he?"No focus groups match your search criteria.":"No focus groups with discussion guides found."}),he&&a.jsx(ie,{variant:"link",size:"sm",onClick:()=>U(""),className:"mt-2",children:"Clear search"})]})})]}),a.jsx(Ys,{children:a.jsx(ie,{variant:"outline",onClick:()=>q(!1),children:"Cancel"})})]})})]})]})}const Wpe=[{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"}],qpe={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"},Ype=()=>{console.log("FocusGroups component rendering");const[t,e]=g.useState("view"),[n,r]=g.useState(""),[i,o]=g.useState([]),[s,c]=g.useState(!0),[l,u]=g.useState([]),[d,f]=g.useState(!1),[h,p]=g.useState(!1),[v,m]=g.useState(null),y=ur(),b=Ui(),[x,w]=g.useState([]),S=g.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 R=await St.getAll();if(console.log("API response received:",R),!E||S.current){const D=R.data.map(V=>({...V,id:V.id||V._id,participants_count:Array.isArray(V.participants)?V.participants.length:typeof V.participants=="number"?V.participants:0}));o(D)}}catch(R){console.error("Error fetching focus groups:",R),(!E||S.current)&&(Ve.error("Failed to load focus groups"),o(Wpe))}finally{(!E||S.current)&&c(!1)}},_=async E=>{try{const R=await St.getById(E);R&&R.data&&(m(R.data),e("create"))}catch(R){console.error("Error fetching focus group for edit:",R),Ve.error("Failed to load focus group for editing")}};g.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),C(),()=>{console.log("useEffect cleanup - setting isMounted to false"),S.current=!1}),[]),g.useEffect(()=>{console.log("Mode change useEffect running, mode:",t),t==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),C())},[t]),g.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]),g.useEffect(()=>{const E=new URLSearchParams(b.search),R=E.get("mode"),D=E.get("id"),V=E.get("tab");if(R==="create")e("create"),m(null);else if(R==="edit"&&D){const L=i.find(z=>(z._id||z.id)===D);L?(m(L),e("create")):_(D)}if(R||D||V){const L=b.pathname;y(L,{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"}),T=E=>new Date(E).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),k=E=>{u(R=>R.includes(E)?R.filter(D=>D!==E):[...R,E])},O=async()=>{if(l.length!==0){p(!0);try{const E=l.map(R=>St.delete(R));await Promise.all(E),o(R=>R.filter(D=>!l.includes(D.id||D._id||""))),u([]),Ve.success(`${l.length} focus group${l.length>1?"s":""} deleted successfully`)}catch(E){console.error("Error deleting focus groups:",E),Ve.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(Ra,{}),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(ie,{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(Tx,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(Kt,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:E=>r(E.target.value)})]}),a.jsxs(ie,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(RN,{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(na,{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(ie,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(Qn,{className:"h-4 w-4"}),"Delete Selected (",l.length,")"]})]}),s?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(no,{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(Gl,{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(Iee,{className:"h-4 w-4 mr-1"}),j(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(dm,{className:"h-4 w-4 mr-1"}),T(E.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(Fr,{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(dm,{className:"h-4 w-4 mr-1"}),E.duration," min"]})]})]})]}),a.jsxs("div",{className:Fe("px-3 py-1 rounded-full text-xs font-medium border",qpe[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(ie,{variant:E.status==="in-progress"||E.status==="active"||E.status==="ai_mode"?"default":E.status==="new"||E.status==="draft"?"outline":"default",className:Fe("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 R=E.id||E._id;console.log("Navigating to focus group:",R),y(`/focus-groups/${R}`)}},children:E.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(mo,{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(mo,{className:"ml-2 h-4 w-4"})]}):E.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(mo,{className:"ml-2 h-4 w-4"})]}):E.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(mo,{className:"ml-2 h-4 w-4"})]}):E.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(mo,{className:"ml-2 h-4 w-4"})]}):E.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(mo,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(mo,{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(Kpe,{draftToEdit:v,preSelectedParticipants:x,onDraftSaved:()=>{m(null),e("view"),w([]),C()}})]}),a.jsx(A1,{open:d,onOpenChange:f,children:a.jsxs(yb,{children:[a.jsxs(xb,{children:[a.jsxs(wb,{children:["Delete ",l.length," Focus Group",l.length!==1?"s":"","?"]}),a.jsxs(Sb,{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(bb,{children:[a.jsx(_b,{disabled:h,children:"Cancel"}),a.jsx(Cb,{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(no,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},Qpe=({participants:t,selectedParticipantIds:e,onToggleParticipantFilter:n})=>{const r=ur(),{id:i}=PN(),{setPreviousRoute:o}=Ug(),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(Fr,{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(ts,{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:Yg(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(Io,{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 Xpe(t,e){return g.useReducer((n,r)=>e[n][r]??n,t)}var Zk="ScrollArea",[ZG,sUe]=Bi(Zk),[Jpe,Mo]=ZG(Zk),e8=g.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:i,scrollHideDelay:o=600,...s}=t,[c,l]=g.useState(null),[u,d]=g.useState(null),[f,h]=g.useState(null),[p,v]=g.useState(null),[m,y]=g.useState(null),[b,x]=g.useState(0),[w,S]=g.useState(0),[C,_]=g.useState(!1),[A,j]=g.useState(!1),T=It(e,O=>l(O)),k=Mu(i);return a.jsx(Jpe,{scope:n,type:r,dir:k,scrollHideDelay:o,scrollArea:c,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:v,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:A,onScrollbarYEnabledChange:j,onCornerWidthChange:x,onCornerHeightChange:S,children:a.jsx(ht.div,{dir:k,...s,ref:T,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});e8.displayName=Zk;var t8="ScrollAreaViewport",n8=g.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,asChild:i,nonce:o,...s}=t,c=Mo(t8,n),l=g.useRef(null),u=It(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; - -webkit-overflow-scrolling: touch; -} -[data-radix-scroll-area-viewport]::-webkit-scrollbar { - display: none; -} -:where([data-radix-scroll-area-viewport]) { - display: flex; - flex-direction: column; - align-items: stretch; -} -:where([data-radix-scroll-area-content]) { - flex-grow: 1; -} -`},nonce:o}),a.jsx(ht.div,{"data-radix-scroll-area-viewport":"",...s,asChild:i,ref:u,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...t.style},children:cme({asChild:i,children:r},d=>a.jsx("div",{"data-radix-scroll-area-content":"",ref:c.onContentChange,style:{minWidth:c.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});n8.displayName=t8;var ua="ScrollAreaScrollbar",eP=g.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Mo(ua,t.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:s}=i,c=t.orientation==="horizontal";return g.useEffect(()=>(c?o(!0):s(!0),()=>{c?o(!1):s(!1)}),[c,o,s]),i.type==="hover"?a.jsx(Zpe,{...r,ref:e,forceMount:n}):i.type==="scroll"?a.jsx(eme,{...r,ref:e,forceMount:n}):i.type==="auto"?a.jsx(r8,{...r,ref:e,forceMount:n}):i.type==="always"?a.jsx(tP,{...r,ref:e}):null});eP.displayName=ua;var Zpe=g.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Mo(ua,t.__scopeScrollArea),[o,s]=g.useState(!1);return g.useEffect(()=>{const c=i.scrollArea;let l=0;if(c){const u=()=>{window.clearTimeout(l),s(!0)},d=()=>{l=window.setTimeout(()=>s(!1),i.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",d),()=>{window.clearTimeout(l),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",d)}}},[i.scrollArea,i.scrollHideDelay]),a.jsx(Yr,{present:n||o,children:a.jsx(r8,{"data-state":o?"visible":"hidden",...r,ref:e})})}),eme=g.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=Mo(ua,t.__scopeScrollArea),o=t.orientation==="horizontal",s=Yw(()=>l("SCROLL_END"),100),[c,l]=Xpe("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return g.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>l("HIDE"),i.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,i.scrollHideDelay,l]),g.useEffect(()=>{const u=i.viewport,d=o?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(l("SCROLL"),s()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[i.viewport,o,l,s]),a.jsx(Yr,{present:n||c!=="hidden",children:a.jsx(tP,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Le(t.onPointerEnter,()=>l("POINTER_ENTER")),onPointerLeave:Le(t.onPointerLeave,()=>l("POINTER_LEAVE"))})})}),r8=g.forwardRef((t,e)=>{const n=Mo(ua,t.__scopeScrollArea),{forceMount:r,...i}=t,[o,s]=g.useState(!1),c=t.orientation==="horizontal",l=Yw(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,i=Mo(ua,t.__scopeScrollArea),o=g.useRef(null),s=g.useRef(0),[c,l]=g.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=c8(c.viewport,c.content),d={...r,sizes:c,onSizesChange:l,hasThumb:u>0&&u<1,onThumbChange:h=>o.current=h,onThumbPointerUp:()=>s.current=0,onThumbPointerDown:h=>s.current=h};function f(h,p){return sme(h,s.current,c,p)}return n==="horizontal"?a.jsx(tme,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const h=i.viewport.scrollLeft,p=W2(h,c,i.dir);o.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollLeft=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollLeft=f(h,i.dir))}}):n==="vertical"?a.jsx(nme,{...d,ref:e,onThumbPositionChange:()=>{if(i.viewport&&o.current){const h=i.viewport.scrollTop,p=W2(h,c);o.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{i.viewport&&(i.viewport.scrollTop=h)},onDragScroll:h=>{i.viewport&&(i.viewport.scrollTop=f(h))}}):null}),tme=g.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,o=Mo(ua,t.__scopeScrollArea),[s,c]=g.useState(),l=g.useRef(null),u=It(e,l,o.onScrollbarXChange);return g.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),a.jsx(o8,{"data-orientation":"horizontal",...i,ref:u,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":qw(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.x),onDragScroll:d=>t.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollLeft+d.deltaX;t.onWheelScroll(h),u8(h,f)&&d.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&r({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:l.current.clientWidth,paddingStart:kb(s.paddingLeft),paddingEnd:kb(s.paddingRight)}})}})}),nme=g.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...i}=t,o=Mo(ua,t.__scopeScrollArea),[s,c]=g.useState(),l=g.useRef(null),u=It(e,l,o.onScrollbarYChange);return g.useEffect(()=>{l.current&&c(getComputedStyle(l.current))},[l]),a.jsx(o8,{"data-orientation":"vertical",...i,ref:u,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":qw(n)+"px",...t.style},onThumbPointerDown:d=>t.onThumbPointerDown(d.y),onDragScroll:d=>t.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(o.viewport){const h=o.viewport.scrollTop+d.deltaY;t.onWheelScroll(h),u8(h,f)&&d.preventDefault()}},onResize:()=>{l.current&&o.viewport&&s&&r({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:l.current.clientHeight,paddingStart:kb(s.paddingTop),paddingEnd:kb(s.paddingBottom)}})}})}),[rme,i8]=ZG(ua),o8=g.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:l,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=t,p=Mo(ua,n),[v,m]=g.useState(null),y=It(e,T=>m(T)),b=g.useRef(null),x=g.useRef(""),w=p.viewport,S=r.content-r.viewport,C=Ar(d),_=Ar(l),A=Yw(f,10);function j(T){if(b.current){const k=T.clientX-b.current.left,O=T.clientY-b.current.top;u({x:k,y:O})}}return g.useEffect(()=>{const T=k=>{const O=k.target;(v==null?void 0:v.contains(O))&&C(k,S)};return document.addEventListener("wheel",T,{passive:!1}),()=>document.removeEventListener("wheel",T,{passive:!1})},[w,v,S,C]),g.useEffect(_,[r,_]),ff(v,A),ff(p.content,A),a.jsx(rme,{scope:n,scrollbar:v,hasThumb:i,onThumbChange:Ar(o),onThumbPointerUp:Ar(s),onThumbPositionChange:_,onThumbPointerDown:Ar(c),children:a.jsx(ht.div,{...h,ref:y,style:{position:"absolute",...h.style},onPointerDown:Le(t.onPointerDown,T=>{T.button===0&&(T.target.setPointerCapture(T.pointerId),b.current=v.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),j(T))}),onPointerMove:Le(t.onPointerMove,j),onPointerUp:Le(t.onPointerUp,T=>{const k=T.target;k.hasPointerCapture(T.pointerId)&&k.releasePointerCapture(T.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Tb="ScrollAreaThumb",s8=g.forwardRef((t,e)=>{const{forceMount:n,...r}=t,i=i8(Tb,t.__scopeScrollArea);return a.jsx(Yr,{present:n||i.hasThumb,children:a.jsx(ime,{ref:e,...r})})}),ime=g.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...i}=t,o=Mo(Tb,n),s=i8(Tb,n),{onThumbPositionChange:c}=s,l=It(e,f=>s.onThumbChange(f)),u=g.useRef(),d=Yw(()=>{u.current&&(u.current(),u.current=void 0)},100);return g.useEffect(()=>{const f=o.viewport;if(f){const h=()=>{if(d(),!u.current){const p=ame(f,c);u.current=p,c()}};return c(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[o.viewport,d,c]),a.jsx(ht.div,{"data-state":s.hasThumb?"visible":"hidden",...i,ref:l,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Le(t.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),v=f.clientX-p.left,m=f.clientY-p.top;s.onThumbPointerDown({x:v,y:m})}),onPointerUp:Le(t.onPointerUp,s.onThumbPointerUp)})});s8.displayName=Tb;var nP="ScrollAreaCorner",a8=g.forwardRef((t,e)=>{const n=Mo(nP,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(ome,{...t,ref:e}):null});a8.displayName=nP;var ome=g.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,i=Mo(nP,n),[o,s]=g.useState(0),[c,l]=g.useState(0),u=!!(o&&c);return ff(i.scrollbarX,()=>{var f;const d=((f=i.scrollbarX)==null?void 0:f.offsetHeight)||0;i.onCornerHeightChange(d),l(d)}),ff(i.scrollbarY,()=>{var f;const d=((f=i.scrollbarY)==null?void 0:f.offsetWidth)||0;i.onCornerWidthChange(d),s(d)}),u?a.jsx(ht.div,{...r,ref:e,style:{width:o,height:c,position:"absolute",right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function kb(t){return t?parseInt(t,10):0}function c8(t,e){const n=t/e;return isNaN(n)?0:n}function qw(t){const e=c8(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function sme(t,e,n,r="ltr"){const i=qw(n),o=i/2,s=e||o,c=i-s,l=n.scrollbar.paddingStart+s,u=n.scrollbar.size-n.scrollbar.paddingEnd-c,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return l8([l,u],f)(t)}function W2(t,e,n="ltr"){const r=qw(e),i=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-i,s=e.content-e.viewport,c=o-r,l=n==="ltr"?[0,s]:[s*-1,0],u=Mm(t,l);return l8([0,s],[0,c])(u)}function l8(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 u8(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function i(){const o={left:t.scrollLeft,top:t.scrollTop},s=n.left!==o.left,c=n.top!==o.top;(s||c)&&e(),n=o,r=window.requestAnimationFrame(i)}(),()=>window.cancelAnimationFrame(r)};function Yw(t,e){const n=Ar(t),r=g.useRef(0);return g.useEffect(()=>()=>window.clearTimeout(r.current),[]),g.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function ff(t,e){const n=Ar(e);qr(()=>{let r=0;if(t){const i=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return i.observe(t),()=>{window.cancelAnimationFrame(r),i.unobserve(t)}}},[t,n])}function cme(t,e){const{asChild:n,children:r}=t;if(!n)return typeof e=="function"?e(r):e;const i=g.Children.only(r);return g.cloneElement(i,{children:typeof e=="function"?e(i.props.children):e})}var d8=e8,lme=n8,ume=a8;const Qw=g.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(d8,{ref:r,className:Fe("relative overflow-hidden",t),...n,children:[a.jsx(lme,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(f8,{}),a.jsx(ume,{})]}));Qw.displayName=d8.displayName;const f8=g.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(eP,{ref:r,orientation:e,className:Fe("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:a.jsx(s8,{className:"relative flex-1 rounded-full bg-border"})}));f8.displayName=eP.displayName;const dme=({participants:t,isVisible:e,selectedIndex:n,onSelect:r,onClose:i,position:o})=>{const s=g.useRef(null);return g.useEffect(()=>{const c=l=>{s.current&&!s.current.contains(l.target)&&i()};if(e)return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[e,i]),g.useEffect(()=>{if(e&&n>=0&&s.current){const c=s.current.children[n];c&&c.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,e]),!e||t.length===0?null:a.jsxs("div",{ref:s,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:o.top,left:o.left},children:[t.map((c,l)=>{const u=c.id||c._id,d=l===n;return a.jsxs("div",{className:`flex items-center p-3 cursor-pointer transition-colors ${d?"bg-blue-50 border-l-4 border-blue-500":"hover:bg-slate-50"}`,onClick:()=>r(c),children:[a.jsx("img",{src:Yg(c),alt:c.name,className:"h-8 w-8 rounded-full object-cover mr-3 flex-shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:`font-medium truncate ${d?"text-blue-900":"text-slate-900"}`,children:c.name}),a.jsx("p",{className:`text-sm truncate ${d?"text-blue-600":"text-slate-500"}`,children:c.occupation})]})]},u)}),t.length===0&&a.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function I1(t,e){const n=[],r=[],i=/@(\w+(?:\s+\w+)*?)(?=\s+and\s|\s+or\s|\s*[^\w\s]|\s*$)/g;let o;for(;(o=i.exec(t))!==null;){const s=o[1],c=o.index,l=o.index+o[0].length,u=e.find(d=>d.name.toLowerCase()===s.toLowerCase());if(u){const d=u.id||u._id;d&&(n.push({id:d,name:u.name,startIndex:c,endIndex:l}),r.includes(d)||r.push(d))}}return{text:t,mentions:n,mentionedParticipantIds:r}}function fme(t,e){if(e.length===0)return[t];const n=[];let r=0;return[...e].sort((o,s)=>o.startIndex-s.startIndex).forEach((o,s)=>{o.startIndex>r&&n.push(t.slice(r,o.startIndex)),n.push(N.createElement("span",{key:`mention-${s}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${o.name}`)),r=o.endIndex}),r=0;n--){const r=t[n];if(r==="@"){if(n===0||/\s/.test(t[n-1]))return n}else if(/\s/.test(r))break}return null}function mme(t,e,n){return t.slice(e+1,n).toLowerCase()}function gme(t,e){return e?t.filter(n=>n.name.toLowerCase().includes(e)):t}const h8=g.forwardRef(({value:t,onChange:e,participants:n,placeholder:r="Ask a question or provide guidance...",className:i="",disabled:o=!1},s)=>{const[c,l]=g.useState(!1),[u,d]=g.useState(0),[f,h]=g.useState({top:0,left:0}),[p,v]=g.useState(null),[m,y]=g.useState([]),b=g.useRef(null),x=g.useRef(null);g.useEffect(()=>{s&&b.current&&(typeof s=="function"?s(b.current):s.current=b.current)},[s]);const w=()=>{if(b.current&&x.current&&p!==null){const j=b.current,T=x.current,k=document.createElement("div");k.style.position="absolute",k.style.visibility="hidden",k.style.whiteSpace="pre",k.style.font=window.getComputedStyle(j).font,k.textContent=t.slice(0,p),document.body.appendChild(k);const O=k.offsetWidth;document.body.removeChild(k);const E=T.getBoundingClientRect(),R=j.getBoundingClientRect();h({top:R.height+4,left:Math.min(O,E.width-280)})}},S=j=>{const T=j.target.value,k=j.target.selectionStart||0,O=pme(T,k);if(O!==null&&n.length>0){const R=mme(T,O,k),D=gme(n,R);v(O),y(D),d(0),l(!0)}else l(!1),v(null);const E=I1(T,n);e(T,E)},C=j=>{if(c&&m.length>0)switch(j.key){case"ArrowDown":j.preventDefault(),d(T=>TT>0?T-1:m.length-1);break;case"Enter":case"Tab":j.preventDefault(),m[u]&&_(m[u]);break;case"Escape":j.preventDefault(),l(!1);break}},_=j=>{if(p!==null&&b.current){const T=b.current.selectionStart||0,{newText:k,newCursorPosition:O}=hme(t,T,j,p),E=I1(k,n);e(k,E),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange(O,O))},0),l(!1),v(null)}},A=()=>{l(!1),v(null)};return g.useEffect(()=>{c&&p!==null&&w()},[c,p,t]),a.jsxs("div",{ref:x,className:`relative ${i}`,children:[a.jsx("input",{ref:b,type:"text",value:t,onChange:S,onKeyDown:C,placeholder:r,disabled:o,className:"flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx(dme,{participants:m,isVisible:c,selectedIndex:u,onSelect:_,onClose:A,position:f})]})});h8.displayName="MentionInput";const vme=({message:t,persona:e,toggleHighlight:n,participants:r=[],focusGroupId:i})=>{const[o,s]=g.useState(!1),c=t.senderId==="moderator",l=t.senderId==="facilitator",u=I1(t.text,r),d=fme(t.text,u.mentions),f=(c||l)&&(t.visualAsset||v(t.text))&&i,p=(()=>{if(t.visualAsset)return{filename:t.visualAsset.filename,displayReference:t.visualAsset.displayReference};{const y=v(t.text);return y?{filename:y,displayReference:y}:null}})();function v(y){const b=[/titled\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i];for(const x of b){const w=y.match(x);if(w)return w[1]}return null}const m=()=>{n()};return a.jsxs("div",{id:`message-${t.id}`,className:Fe("flex items-start p-3 rounded-lg transition-colors",t.highlighted?"bg-amber-50 border border-amber-200":"hover:bg-slate-50",c?"border-l-4 border-l-primary pl-4":"",l?"border-l-4 border-l-green-500 pl-4":""),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),"data-highlighted":t.highlighted?"true":"false",children:[a.jsx("div",{className:"flex-shrink-0 mr-3",children:c?a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(ts,{className:"h-6 w-6 text-primary"})}):l?a.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:a.jsx(fm,{className:"h-6 w-6 text-green-600"})}):e?a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx("img",{src:Yg(e),alt:`${e.name} avatar`,className:"h-6 w-6 rounded-full object-cover"})}):a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx($ee,{className:"h-6 w-6 text-slate-600"})})}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center mb-1",children:[a.jsx("span",{className:"font-medium mr-2",children:c?"AI Moderator":l?"Human Facilitator":(e==null?void 0:e.name)||"Unknown"}),!c&&!l&&e&&a.jsx($n,{variant:"outline",className:"text-xs font-normal",children:e.occupation}),a.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:t.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"text-slate-700",children:!t.text||t.text.trim()===""||t.text==="..."?a.jsx("span",{className:"text-red-500 italic",children:"[No response content - AI generation may have failed]"}):d}),f&&p&&a.jsxs("div",{className:"mt-3 p-3 border rounded-lg bg-slate-50",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Sp,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"}),p.displayReference!==p.filename&&a.jsxs("span",{className:"text-xs text-slate-500",children:["(",p.displayReference,")"]})]}),a.jsx("img",{src:St.getAssetUrl(i,p.filename),alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:y=>{var x;console.error("Failed to load creative asset:",St.getAssetUrl(i,p.filename)),y.currentTarget.style.display="none";const b=document.createElement("div");b.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",b.textContent=`Creative asset not found: ${p.displayReference}`,(x=y.currentTarget.parentNode)==null||x.appendChild(b)}})]}),a.jsx("div",{className:Fe("flex mt-2 space-x-2",!o&&!t.highlighted&&"hidden"),children:a.jsxs(ie,{variant:"ghost",size:"sm",onClick:m,className:"h-8 px-2 text-xs",children:[a.jsx(ste,{className:Fe("h-3 w-3 mr-1",t.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),t.highlighted?"Highlighted":"Highlight"]})})]})]})},yme=({action:t})=>{switch(t){case"moderator_speak":return a.jsx(na,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return a.jsx(Fr,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return a.jsx(Fr,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return a.jsx(RB,{className:"h-4 w-4 text-orange-500"});case"end_session":return a.jsx(lte,{className:"h-4 w-4 text-red-500"});default:return a.jsx(mu,{className:"h-4 w-4 text-gray-500"})}},xme=({status:t})=>{switch(t){case"success":return a.jsx(ON,{className:"h-3 w-3 text-green-500"});case"error":return a.jsx(Lee,{className:"h-3 w-3 text-red-500"});case"pending":return a.jsx(dm,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},bme=({action:t})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[t]||t,wme=t=>{try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return t}},Sme=({entry:t,isLatest:e})=>{const[n,r]=g.useState(e);return a.jsx(yt,{className:`mb-2 ${e?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:a.jsxs(Qg,{open:n,onOpenChange:r,children:[a.jsx(Xg,{asChild:!0,children:a.jsx(Ei,{className:"pb-2 cursor-pointer hover:bg-gray-50/50 transition-colors",children:a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(yme,{action:t.action}),a.jsxs("div",{className:"flex flex-col",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-sm",children:a.jsx(bme,{action:t.action})}),a.jsx(xme,{status:t.execution_status})]}),a.jsx("span",{className:"text-xs text-gray-500",children:wme(t.timestamp)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[e&&a.jsx($n,{variant:"secondary",className:"text-xs",children:"Latest"}),n?a.jsx(qf,{className:"h-4 w-4 text-gray-400"}):a.jsx(yl,{className:"h-4 w-4 text-gray-400"})]})]})})}),a.jsx(Jg,{children:a.jsx(Rt,{className:"pt-0",children:a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"AI Reasoning:"}),a.jsxs("p",{className:"text-sm text-gray-600 bg-gray-50 p-2 rounded italic",children:['"',t.reasoning,'"']})]}),t.details&&Object.keys(t.details).length>0&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Details:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded font-mono",children:JSON.stringify(t.details,null,2)})]}),t.execution_result&&a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Execution Result:"}),a.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded",children:t.execution_result.error?a.jsxs("span",{className:"text-red-600",children:["Error: ",t.execution_result.error]}):a.jsx("span",{className:"text-green-600",children:t.execution_result.message||"Success"})})]})]})})})]})})},Cme=({reasoningHistory:t,isVisible:e,onToggle:n,isAiMode:r=!1})=>{const[i,o]=g.useState(!0);return g.useEffect(()=>{if(i&&t.length>0){const s=document.getElementById("reasoning-panel-content");s&&(s.scrollTop=0)}},[t.length,i]),a.jsx("div",{className:"border-t border-gray-200 bg-white",children:a.jsxs(Qg,{open:e,onOpenChange:n,children:[a.jsx(Xg,{asChild:!0,children:a.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-gray-50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(mu,{className:"h-4 w-4 text-purple-600"}),a.jsx("span",{className:"font-medium text-sm",children:r?"AI Decision Reasoning":"AI Moderator Logic"}),r&&t.length>0&&a.jsx($n,{variant:"outline",className:"text-xs",children:t.length}),!r&&a.jsx($n,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),e?a.jsx(qf,{className:"h-4 w-4 text-gray-400"}):a.jsx(yl,{className:"h-4 w-4 text-gray-400"})]})}),a.jsx(Jg,{children:a.jsx("div",{className:"border-t border-gray-100",children:r?t.length===0?a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(mu,{className:"h-8 w-8 mx-auto mb-2 text-gray-300"}),a.jsx("p",{className:"text-sm",children:"No AI decisions yet"}),a.jsx("p",{className:"text-xs text-gray-400",children:"Reasoning will appear here when the AI makes decisions"})]}):a.jsx(Qw,{id:"reasoning-panel-content",className:"h-[25vh] p-3",children:a.jsx("div",{className:"space-y-2",children:t.map((s,c)=>a.jsx(Sme,{entry:s,isLatest:c===0},`${s.timestamp}-${c}`))})}):a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(DN,{className:"h-8 w-8 mx-auto mb-2 text-gray-400"}),a.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Manual Moderation Mode"}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"You are currently moderating the discussion manually."}),a.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Switch to AI Mode to see automated reasoning and decisions."})]})})})]})})},_me=({modeEvent:t})=>{const e=i=>i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=i=>{switch(i){case"ai_mode_started":return"AI Mode Started";case"manual_mode_started":return"Manual Moderation Enabled";case"ai_session_concluded":return"AI Discussion Concluded";default:return"Mode Changed"}},r=i=>{switch(i){case"ai_mode_started":return"text-blue-600";case"manual_mode_started":return"text-slate-600";case"ai_session_concluded":return"text-green-600";default:return"text-gray-600"}};return a.jsxs("div",{className:"flex items-center my-6 px-4",children:[a.jsx("div",{className:"flex-1 border-t border-gray-200"}),a.jsx("div",{className:`mx-4 px-3 py-1 bg-white border border-gray-200 rounded-full ${r(t.event_type)}`,children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[a.jsx("span",{children:n(t.event_type)}),a.jsx("span",{className:"text-gray-400",children:"at"}),a.jsx("span",{children:e(t.timestamp)})]})}),a.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},Ame=({messages:t,modeEvents:e,personas:n,isSpeaking:r,focusGroupId:i,isAiModeActive:o=!1,selectedParticipantIds:s,onToggleHighlight:c,onAdvanceDiscussion:l,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=g.useState(""),[v,m]=g.useState(null),[y,b]=g.useState(!1),[x,w]=g.useState(null),S=g.useRef(null),[C,_]=g.useState(-1),[A,j]=g.useState(!1),T=g.useRef(0),k=g.useRef(null),O=g.useRef(1e4),E=g.useRef(null),[R,D]=g.useState(!1),[V,L]=g.useState(!1),[z,M]=g.useState(!1),[$,Q]=g.useState(null),q=$!==null?$:o,[te,xe]=g.useState([]),[B,ce]=g.useState(!1),he=B;g.useEffect(()=>{o&&i&&U()},[o,i]);const U=async()=>{if(i)try{o&&de()}catch(P){console.error("Error checking autonomous status:",P)}},de=async()=>{if(i)try{const P=await rr.getReasoningHistory(i);xe(P.data.reasoning_history||[])}catch(P){console.error("Error fetching reasoning history:",P)}};g.useEffect(()=>{R&&K()},[t,R]),g.useEffect(()=>{let P;return o&&i&&(P=setInterval(()=>{de(),U()},5e3)),()=>{P&&clearInterval(P)}},[o,i]),g.useEffect(()=>{T.current=t.length},[]),g.useEffect(()=>{const P=t.length,H=T.current;if(A&&P>H){const ee=Date.now(),re=k.current;if(re&&ee-re>=O.current)b(!1),j(!1),k.current=null;else if(re){const Z=O.current-(ee-re);setTimeout(()=>{b(!1),j(!1),k.current=null},Math.max(0,Z))}else b(!1),j(!1)}T.current=P},[t.length,A]);const se=P=>n.find(H=>H.id===P||H._id===P),ne=s.length===0?t:t.filter(P=>P.senderId==="moderator"||P.senderId==="facilitator"||s.includes(P.senderId)),je=()=>{const P=[];return ne.forEach(H=>{P.push({type:"message",data:H,timestamp:H.timestamp})}),e.forEach(H=>{P.push({type:"mode_event",data:H,timestamp:H.timestamp})}),P.sort((H,ee)=>H.timestamp.getTime()-ee.timestamp.getTime())},K=()=>{if(!f&&E.current){const P=E.current.closest("[data-radix-scroll-area-viewport]");if(P){const H=E.current.offsetTop-P.clientHeight+50,ee=P.scrollTop,re=H-ee,Z=300;let Se=null;const Ae=Ie=>{Se||(Se=Ie);const Ke=Ie-Se,Ue=Math.min(Ke/Z,1),Be=1-Math.pow(1-Ue,3);P.scrollTop=ee+re*Be,Ue<1&&window.requestAnimationFrame(Ae)};window.requestAnimationFrame(Ae)}else E.current.scrollIntoView({behavior:"smooth",block:"end"})}},et=async P=>{var Se,Ae;if(P.preventDefault(),!h.trim())return;let H=h,ee=null,re=null;const Z=v;p(""),m(null),b(!0),j(!0),k.current=Date.now();try{if(x){try{ae.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const Ue=new FormData;Ue.append("assets",x);const Be=await St.uploadAssets(i,Ue);console.log("Upload response:",Be==null?void 0:Be.data);const nt=Be==null?void 0:Be.data;if(nt&&nt.assets&&nt.assets.length>0?(ee=nt.assets[0].filename,console.log("Successfully got filename from upload response:",ee)):console.error("Invalid upload response structure:",nt),ee){try{const Ne=await St.getAssets(i),Nt=((Se=Ne==null?void 0:Ne.data)==null?void 0:Se.assets)||[],pn=Nt.find(rt=>rt.filename===ee);let Je="the uploaded asset";pn&&(pn.user_assigned_name?Je=pn.user_assigned_name:Je=`Asset ${Nt.findIndex(jt=>jt.filename===ee)+1}`),re={filename:ee,displayReference:Je},H=`Please review ${Je}. ${h}`,console.log("Using display reference in message:",Je)}catch(Ne){console.error("Error fetching asset metadata:",Ne),H=`Please review the uploaded asset. ${h}`,re={filename:ee,displayReference:"the uploaded asset"}}ae.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."})}}catch(Ue){console.error("Error uploading file:",Ue),console.error("Upload error details:",(Ae=Ue.response)==null?void 0:Ae.data),ae.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}oe()}const Ie={text:H,type:"question",senderId:"facilitator"};ee&&(Ie.attached_assets=[ee],Ie.activates_visual_context=!0,re&&(Ie.visualAsset=re));const Ke=await St.sendMessage(i,Ie);console.log("Message sent to API:",Ke),setTimeout(()=>{K()},100),Z&&Z.mentionedParticipantIds.length>0?setTimeout(()=>{ye(Z.mentionedParticipantIds,H)},500):(b(!1),j(!1),k.current=null)}catch(Ie){console.error("Error sending message:",Ie),b(!1),j(!1),k.current=null;const Ke={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(Ke),setTimeout(()=>{K()},100),ae.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},Me=()=>{for(let P=t.length-1;P>=0;P--)if(t[P].senderId==="moderator"&&t[P].type==="question")return t[P].text;for(let P=t.length-1;P>=0;P--)if(t[P].senderId==="moderator")return t[P].text;return"What are your thoughts on this topic?"},ut=(P,H)=>{if(!P||!P.sections||!H)return null;const{section_index:ee,subsection_index:re,item_index:Z,item_type:Se}=H,Ae=P.sections,Ie=Ue=>{const Be=[];return Ue.questions&&Ue.questions.forEach((nt,Ne)=>{Be.push({...nt,type:"question",index:Ne})}),Ue.activities&&Ue.activities.forEach((nt,Ne)=>{Be.push({...nt,type:"activity",index:Ne})}),Be.sort((nt,Ne)=>nt.type!==Ne.type?nt.type==="question"?-1:1:nt.index-Ne.index)};if(ee>=Ae.length)return{completed:!0};const Ke=Ae[ee];if(re!==void 0&&Ke.subsections){if(re>=Ke.subsections.length)return ut(P,{section_index:ee+1,subsection_index:void 0,item_index:0,item_type:"question"});const Ue=Ke.subsections[re],Be=Ie(Ue),nt=Be.findIndex(Ne=>Ne.type===Se&&Ne.index===Z);if(nt0){const Be=Ue.findIndex(nt=>nt.type===Se&&nt.index===Z);if(Be0?ut(P,{section_index:ee,subsection_index:0,item_index:0,item_type:"question"}):ut(P,{section_index:ee+1,subsection_index:void 0,item_index:0,item_type:"question"})}},Ye=async()=>{var P,H,ee;if(i)try{b(!0),j(!0),k.current=Date.now(),ae.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[re,Z]=await Promise.all([rr.getModeratorStatus(i),St.getById(i)]);if(!((P=re==null?void 0:re.data)!=null&&P.status)||!((H=Z==null?void 0:Z.data)!=null&&H.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const Se=re.data.status,Ae=Z.data.discussionGuide;if(!Ae.sections)throw new Error("Discussion guide does not have a structured format");const Ie=ut(Ae,Se.moderator_position);if(!Ie)throw new Error("Could not determine next discussion item");if(Ie.completed){ae.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const Ue={id:`msg-${Date.now()}`,senderId:"moderator",text:"We have covered all the questions in our discussion guide. Thank you all for your valuable insights and participation in this focus group session.",timestamp:new Date,type:"system"};u(Ue),b(!1),j(!1),k.current=null;return}await rr.setModeratorPosition(i,Ie.sectionId,Ie.itemId);const Ke={id:`msg-${Date.now()}`,senderId:"moderator",text:Ie.content,timestamp:new Date,type:"question"};try{const Ue=await St.sendMessage(i,{senderId:"moderator",text:Ke.text,type:"question"});(ee=Ue==null?void 0:Ue.data)!=null&&ee.message_id&&(Ke.id=Ue.data.message_id)}catch(Ue){console.warn("Failed to save message to API, showing locally:",Ue)}u(Ke),b(!1),j(!1),k.current=null,setTimeout(()=>{K()},100),ae.success("Discussion advanced",{description:`Moved to: ${Ie.section.title}${Ie.subsection?` > ${Ie.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(re){console.error("Error advancing discussion:",re),ae.error("Failed to advance discussion",{description:re.message||"There was a problem advancing to the next question."}),b(!1),j(!1),k.current=null}},Pt=async()=>{var P,H,ee,re;if(i){console.log("Starting AI Mode: setting autonomousLoading to true"),M(!0);try{console.log("Starting AI Mode: calling API...");const Se=await Promise.race([rr.startAutonomousConversation(i),new Promise((Ae,Ie)=>setTimeout(()=>Ie(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",Se),Se.data.error){ae.error("Failed to start autonomous conversation",{description:Se.data.error}),M(!1);return}ae.success("Autonomous conversation started",{description:"The AI is now managing the focus group conversation"}),Q(!0);try{console.log("Starting AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Starting AI Mode: onStatusChange completed successfully"))}catch(Ae){console.error("Starting AI Mode: onStatusChange failed:",Ae)}console.log("Starting AI Mode: resetting autonomousLoading to false"),M(!1),de()}catch(Z){console.error("Error starting autonomous conversation:",Z),Z.response&&Z.response.data&&console.error("Backend error details:",Z.response.data);const Se=((H=(P=Z.response)==null?void 0:P.data)==null?void 0:H.message)||((re=(ee=Z.response)==null?void 0:ee.data)==null?void 0:re.error)||"Please check your connection and try again";ae.error("Failed to start autonomous conversation",{description:Se}),M(!1)}}},F=async()=>{if(i){console.log("Stopping AI Mode: setting autonomousLoading to true"),M(!0);try{const P=await rr.stopAutonomousConversation(i,"manual_stop");if(P.data.error){ae.error("Failed to stop autonomous conversation",{description:P.data.error}),M(!1);return}xe([]),ae.success("Autonomous conversation stopped",{description:"You can now moderate the discussion manually"}),Q(!1);try{console.log("Stopping AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Stopping AI Mode: onStatusChange completed successfully"))}catch(H){console.error("Stopping AI Mode: onStatusChange failed:",H)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),M(!1)}catch(P){console.error("Error stopping autonomous conversation:",P),ae.error("Failed to stop autonomous conversation"),M(!1)}}},J=P=>{var ee;const H=(ee=P.target.files)==null?void 0:ee[0];if(H){if(!H.type.startsWith("image/")){ae.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(H.size>10*1024*1024){ae.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(H),ae.success(`Image selected: ${H.name}`,{description:"The image will be attached to your next message."})}},oe=()=>{w(null),S.current&&(S.current.value="")},ye=async(P,H)=>{var ee;if(!(!i||P.length===0))try{b(!0),j(!0),k.current=Date.now(),ae.info("Generating responses from mentioned participants...",{description:`Generating responses from ${P.length} mentioned participant(s).`});for(const re of P){const Z=n.find(Se=>(Se._id||Se.id)===re);if(!Z){console.warn(`Mentioned participant ${re} not found in focus group`);continue}try{const Se=await rr.generateResponse(i,re,H||"Continue the conversation based on the latest moderator message.");if((ee=Se==null?void 0:Se.data)!=null&&ee.response){console.log("Generated response from mentioned participant:",Se.data);const Ae={id:Se.data.message_id||`msg-${Date.now()}-${re}`,senderId:re,text:Se.data.response,timestamp:new Date(Se.data.timestamp||Se.data.created_at||new Date),type:"response"};u(Ae),ae.success(`Response generated from ${Z.name}`,{description:Se.data.response.substring(0,100)+"..."})}}catch(Se){console.error(`Error generating response from ${Z.name}:`,Se),ae.error(`Failed to generate response from ${Z.name}`)}}b(!1),j(!1),k.current=null}catch(re){console.error("Error generating mentioned responses:",re),ae.error("Failed to generate responses from mentioned participants"),b(!1),j(!1),k.current=null}},Ee=async()=>{var P,H,ee,re;if(i){if(n.length===0){ae.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),j(!0),k.current=Date.now(),ae.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const Z=await rr.makeConversationDecision(i,.7,"manual");if(!Z||!Z.data||!Z.data.decision)throw new Error("Empty decision response from AI");const Se=Z.data.decision;if(Se.action==="participant_respond"){const Ae=Se.details.participant_id,Ie=Se.details.topic_context,Ke=Se.reasoning,Ue=n.find(nt=>(nt._id||nt.id)===Ae);if(!Ue)throw new Error(`Selected participant ${Ae} not found in focus group`);ae.info("Generating response...",{description:`AI selected ${Ue.name}: ${Ke.substring(0,100)}${Ke.length>100?"...":""}`});const Be=await rr.generateResponse(i,Ae,Ie);if(!Be||!Be.data)throw new Error("Empty response from API");if((P=Be==null?void 0:Be.data)!=null&&P.message_id&&((H=Be==null?void 0:Be.data)!=null&&H.response)){const nt={id:Be.data.message_id,senderId:Ae,text:Be.data.response,timestamp:new Date(Be.data.timestamp||Be.data.created_at||new Date),type:"response",highlighted:!1};u(nt),b(!1),j(!1),k.current=null,setTimeout(()=>{K()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",Se.action),Se.action==="moderator_speak"){ae.info("AI suggests moderator intervention",{description:`AI reasoning: ${Se.reasoning.substring(0,100)}${Se.reasoning.length>100?"...":""}`}),b(!1),j(!1),k.current=null;return}ae.warning("Using fallback participant selection",{description:`AI suggested "${Se.action}" but generating participant response anyway.`});const Ae=(C+1)%n.length,Ie=n[Ae],Ke=Me(),Ue=Ie._id||Ie.id,Be=await rr.generateResponse(i,Ue,Ke);if((ee=Be==null?void 0:Be.data)!=null&&ee.message_id&&((re=Be==null?void 0:Be.data)!=null&&re.response)){const nt={id:Be.data.message_id,senderId:Ue,text:Be.data.response,timestamp:new Date(Be.data.timestamp||Be.data.created_at||new Date),type:"response",highlighted:!1};u(nt),b(!1),j(!1),k.current=null,setTimeout(()=>{K()},100),_(Ae)}}}catch(Z){console.error("Error generating AI response:",Z),ae.error("Failed to generate AI response",{description:"There was a problem connecting to the server."}),b(!1),j(!1),k.current=null}}};return a.jsxs("div",{className:"glass-panel rounded-xl p-4 flex flex-col h-full",children:[a.jsx("div",{className:"flex-1 min-h-0 mb-4",children:a.jsxs(Qw,{className:"h-full pr-4",children:[a.jsxs("div",{className:"space-y-4",children:[je().map(P=>P.type==="message"?a.jsx(vme,{message:P.data,persona:P.data.senderId!=="moderator"&&P.data.senderId!=="facilitator"?se(P.data.senderId):null,toggleHighlight:()=>c(P.data.id),participants:n,focusGroupId:i},P.data.id):a.jsx(_me,{modeEvent:P.data},P.data.id)),(y||o)&&a.jsxs("div",{className:"flex items-center space-x-2 text-sm text-slate-500 animate-pulse",children:[a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:o?a.jsx(ts,{className:"h-4 w-4 text-primary animate-spin"}):a.jsx(Rs,{className:"h-4 w-4 text-primary"})}),a.jsx("span",{children:o?"AI is generating next response...":"Generating AI response..."})]}),a.jsx("div",{className:"h-8"}),a.jsx("div",{ref:E,className:"h-1"})]}),!R&&ne.length>6&&a.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:a.jsx(ie,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:K,title:"Scroll to bottom",children:a.jsx(nR,{className:"h-4 w-4"})})})]})}),a.jsx(Cme,{reasoningHistory:te,isVisible:he,onToggle:()=>ce(!B),isAiMode:o}),a.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[x&&a.jsxs("div",{className:"mb-2 p-2 bg-blue-50 border border-blue-200 rounded-md flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(aR,{className:"h-4 w-4 text-blue-600"}),a.jsx("span",{className:"text-sm text-blue-700",children:x.name}),a.jsxs("span",{className:"text-xs text-blue-500",children:["(",(x.size/1024/1024).toFixed(1)," MB)"]})]}),a.jsx(ie,{type:"button",variant:"ghost",size:"sm",onClick:oe,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"×"})]}),a.jsxs("form",{onSubmit:et,className:"flex items-center gap-2 w-full",children:[a.jsx("input",{ref:S,type:"file",accept:"image/*",onChange:J,className:"hidden"}),a.jsx(h8,{value:h,onChange:(P,H)=>{p(P),m(H||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),a.jsx(ie,{type:"button",variant:"outline",size:"sm",onClick:()=>{var P;return(P=S.current)==null?void 0:P.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:a.jsx(aR,{className:"h-4 w-4"})}),a.jsxs(ie,{type:"submit",variant:"default",className:"hover-transition shrink-0",disabled:!1,children:[a.jsx(na,{className:"mr-2 h-4 w-4"}),"Send"]})]}),a.jsxs("div",{className:"flex justify-between items-center mt-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx("p",{className:"text-sm text-slate-500",children:r?"Speaking...":o?"AI mode active":"Manual moderation mode"}),a.jsx(ie,{variant:"outline",size:"sm",onClick:q?F:Pt,disabled:z,className:`hover-transition ${q?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:q?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:z?a.jsxs(a.Fragment,{children:[a.jsx(ts,{className:"mr-1 h-3 w-3 animate-spin"}),o?"Stopping...":"Starting..."]}):q?a.jsxs(a.Fragment,{children:[a.jsx(ts,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):a.jsxs(a.Fragment,{children:[a.jsx(ts,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{D(!R),R||K()},className:`hover-transition ${R?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:R?"Disable auto-scroll":"Enable auto-scroll",children:[a.jsx(nR,{className:"h-3 w-3 mr-1"}),"Auto-scroll"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!o&&a.jsxs(a.Fragment,{children:[a.jsxs(ie,{variant:"outline",onClick:Ye,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:y,title:n.length===0?"Add participants to the focus group first":"Advance to the next part of the discussion guide",children:[a.jsx(na,{className:"mr-2 h-4 w-4"}),n.length===0?"No Participants":"Advance Discussion"]}),a.jsxs(ie,{variant:"ghost",size:"sm",onClick:Ee,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:y||n.length===0,title:"Generate a participant response to the current topic",children:[a.jsx(Rs,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),o&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[a.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),a.jsx("span",{children:"AI Active"})]}),a.jsx(ie,{variant:"outline",size:"sm",onClick:()=>L(!V),className:"hover-transition",title:"Show autonomous conversation controls",children:a.jsx(DN,{className:"h-3 w-3"})})]})]})]})]})]})},jme=({themes:t,messages:e,personas:n=[],onThemeDelete:r,onQuoteClick:i})=>{const o=(d,f)=>{d.stopPropagation(),r&&(r(f),ae.success("Theme deleted successfully"))},s=d=>n.find(f=>f.id===d||f._id===d),c=d=>{let f=d;const h=d.match(/^\[MSG_ID:[^\]]+\]\s*(.*)$/);h&&(f=h[1]);const p=f.match(/^\[([^\]]+)\]:\s*(.*)$/);if(p)return{persona:p[1],text:p[2]};const v=f.match(/^([^:]+):\s*(.*)$/);return v&&v[1].trim()!==f.trim()?{persona:v[1].trim(),text:v[2]}:{persona:null,text:f}},l=t.filter(d=>"source"in d?d.source==="highlight":!0),u=t.filter(d=>"source"in d&&d.source==="generated");return a.jsxs("div",{className:"glass-panel rounded-xl p-6 h-[70vh] flex flex-col overflow-hidden",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(gu,{className:"h-5 w-5 text-primary mr-2"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Key Themes"})]}),a.jsxs("div",{className:"overflow-auto",children:[u.length>0&&a.jsxs("div",{className:"mb-8",children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(mu,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"AI-Generated Themes"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:u.map(d=>a.jsxs(yt,{className:"hover:shadow-md transition-shadow relative group",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity",onClick:f=>o(f,d.id),children:a.jsx(Mi,{className:"h-3 w-3 text-slate-700"})}),a.jsx(Ei,{className:"pb-2",children:a.jsx(Qi,{className:"text-base",children:d.title})}),a.jsxs(Rt,{children:[a.jsx("p",{className:"text-sm text-slate-600 mb-2",children:d.description}),d.quotes&&d.quotes.length>0&&a.jsxs("div",{className:"mt-3",children:[a.jsx("h4",{className:"text-xs font-medium text-slate-700 mb-2",children:"Supporting Quotes:"}),a.jsx("div",{className:"space-y-2",children:d.quotes.map((f,h)=>{const p=typeof f=="object"&&f!==null,v=p?f.text:f,m=p?f.speaker:c(f).persona,y=p?f.message_id:void 0,b=p?f.original:f;return a.jsxs("div",{className:"bg-slate-50 p-2 rounded text-xs text-slate-600 border-l-2 border-slate-200 cursor-pointer hover:bg-slate-100 transition-colors",onClick:x=>{x.stopPropagation(),i&&i(p?f:b,y)},title:y?`Message ID: ${y}`:"Click to find original message",children:[m&&a.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',v,'"',y&&a.jsx("span",{className:"ml-2 text-xs text-green-600 opacity-70",children:"✓"})]},h)})})]})]})]},d.id))})]}),l.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(Zee,{className:"h-4 w-4 text-primary mr-2"}),a.jsx("h3",{className:"font-medium",children:"Highlighted Comments"})]}),a.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:l.map(d=>{const f=d.messages.length>0?e.find(y=>y.id===d.messages[0]):null,h=(f==null?void 0:f.text)||d.text,p=h.length>200?h.substring(0,200)+"...":h,v=f==null?void 0:f.senderId;let m="";if(v==="moderator")m="AI Moderator";else if(v==="facilitator")m="Human Facilitator";else if(v){const y=s(v);m=(y==null?void 0:y.name)||"Unknown Participant"}return a.jsxs(yt,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:y=>{y.stopPropagation(),i&&f&&i(f.text,f.id)},title:"Click to view in discussion",children:[r&&a.jsx("button",{className:"absolute top-2 right-2 p-1 rounded-full bg-slate-200 opacity-0 group-hover:opacity-100 transition-opacity z-10",onClick:y=>o(y,d.id),children:a.jsx(Mi,{className:"h-3 w-3 text-slate-700"})}),a.jsx(Ei,{className:"pb-2",children:a.jsx(Qi,{className:"text-sm font-medium text-slate-800 line-clamp-2",children:m&&a.jsx("span",{className:"text-primary font-semibold",children:m})})}),a.jsxs(Rt,{className:"pt-0",children:[a.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed",children:['"',p,'"']}),a.jsxs("div",{className:"mt-2 flex items-center text-xs text-slate-400",children:[a.jsx(Rs,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),t.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(gu,{className:"h-8 w-8 text-slate-400 mb-3"}),a.jsx("p",{className:"text-slate-600",children:"No themes have been identified yet."}),a.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Highlight important messages in the discussion or generate themes automatically."})]})]})]})},Eme=({themes:t,messages:e,personas:n,focusGroupId:r,onThemesGenerated:i,onThemeDelete:o,onQuoteClick:s,onGenerateKeyThemes:c})=>{const l=()=>{if(!t||t.length===0){ae.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis - -`;const d=t.filter(v=>"source"in v&&v.source==="generated");if(d.length===0){ae.warning("No AI-generated themes to export",{description:"Only AI-generated themes are included in the export."});return}d.forEach((v,m)=>{u+=`## ${m+1}. ${v.title} - -`,u+=`${v.description} - -`,v.quotes&&v.quotes.length>0&&(u+=`**Supporting Quotes:** - -`,v.quotes.forEach(y=>{if(typeof y=="string")u+=`> ${y} - -`;else{let b="";y.speaker&&(b+=`**${y.speaker}:** `),b+=y.text,u+=`> ${b} - -`}})),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),ae.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(ie,{onClick:c,className:"w-full",children:[a.jsx(IB,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),a.jsxs(ie,{onClick:l,disabled:!t||t.length===0,variant:"outline",className:"w-full",children:[a.jsx(ol,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),a.jsx("div",{className:"flex-grow overflow-hidden",children:a.jsx(jme,{themes:t,messages:e,personas:n,onThemeDelete:o,focusGroupId:r,onQuoteClick:s})})]})};var Nme=Array.isArray,Hi=Nme,Tme=typeof gv=="object"&&gv&&gv.Object===Object&&gv,p8=Tme,kme=p8,Pme=typeof self=="object"&&self&&self.Object===Object&&self,Ome=kme||Pme||Function("return this")(),da=Ome,Ime=da,Rme=Ime.Symbol,iv=Rme,q2=iv,m8=Object.prototype,Mme=m8.hasOwnProperty,Dme=m8.toString,zh=q2?q2.toStringTag:void 0;function $me(t){var e=Mme.call(t,zh),n=t[zh];try{t[zh]=void 0;var r=!0}catch{}var i=Dme.call(t);return r&&(e?t[zh]=n:delete t[zh]),i}var Lme=$me,Fme=Object.prototype,Bme=Fme.toString;function Ume(t){return Bme.call(t)}var zme=Ume,Y2=iv,Hme=Lme,Vme=zme,Gme="[object Null]",Kme="[object Undefined]",Q2=Y2?Y2.toStringTag:void 0;function Wme(t){return t==null?t===void 0?Kme:Gme:Q2&&Q2 in Object(t)?Hme(t):Vme(t)}var rc=Wme;function qme(t){return t!=null&&typeof t=="object"}var ic=qme,Yme=rc,Qme=ic,Xme="[object Symbol]";function Jme(t){return typeof t=="symbol"||Qme(t)&&Yme(t)==Xme}var ah=Jme,Zme=Hi,ege=ah,tge=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,nge=/^\w*$/;function rge(t,e){if(Zme(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||ege(t)?!0:nge.test(t)||!tge.test(t)||e!=null&&t in Object(e)}var rP=rge;function ige(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Sl=ige;const ch=hn(Sl);var oge=rc,sge=Sl,age="[object AsyncFunction]",cge="[object Function]",lge="[object GeneratorFunction]",uge="[object Proxy]";function dge(t){if(!sge(t))return!1;var e=oge(t);return e==cge||e==lge||e==age||e==uge}var iP=dge;const At=hn(iP);var fge=da,hge=fge["__core-js_shared__"],pge=hge,YC=pge,X2=function(){var t=/[^.]+$/.exec(YC&&YC.keys&&YC.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function mge(t){return!!X2&&X2 in t}var gge=mge,vge=Function.prototype,yge=vge.toString;function xge(t){if(t!=null){try{return yge.call(t)}catch{}try{return t+""}catch{}}return""}var g8=xge,bge=iP,wge=gge,Sge=Sl,Cge=g8,_ge=/[\\^$.*+?()[\]{}|]/g,Age=/^\[object .+?Constructor\]$/,jge=Function.prototype,Ege=Object.prototype,Nge=jge.toString,Tge=Ege.hasOwnProperty,kge=RegExp("^"+Nge.call(Tge).replace(_ge,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Pge(t){if(!Sge(t)||wge(t))return!1;var e=bge(t)?kge:Age;return e.test(Cge(t))}var Oge=Pge;function Ige(t,e){return t==null?void 0:t[e]}var Rge=Ige,Mge=Oge,Dge=Rge;function $ge(t,e){var n=Dge(t,e);return Mge(n)?n:void 0}var Lu=$ge,Lge=Lu,Fge=Lge(Object,"create"),Xw=Fge,J2=Xw;function Bge(){this.__data__=J2?J2(null):{},this.size=0}var Uge=Bge;function zge(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var Hge=zge,Vge=Xw,Gge="__lodash_hash_undefined__",Kge=Object.prototype,Wge=Kge.hasOwnProperty;function qge(t){var e=this.__data__;if(Vge){var n=e[t];return n===Gge?void 0:n}return Wge.call(e,t)?e[t]:void 0}var Yge=qge,Qge=Xw,Xge=Object.prototype,Jge=Xge.hasOwnProperty;function Zge(t){var e=this.__data__;return Qge?e[t]!==void 0:Jge.call(e,t)}var eve=Zge,tve=Xw,nve="__lodash_hash_undefined__";function rve(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=tve&&e===void 0?nve:e,this}var ive=rve,ove=Uge,sve=Hge,ave=Yge,cve=eve,lve=ive;function lh(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var jve=Ave,Eve=Jw;function Nve(t,e){var n=this.__data__,r=Eve(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var Tve=Nve,kve=fve,Pve=bve,Ove=Cve,Ive=jve,Rve=Tve;function uh(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},Kl=function(e){return ov(e)&&e.indexOf("%")===e.length-1},De=function(e){return txe(e)&&!fh(e)},kr=function(e){return De(e)||ov(e)},oxe=0,hh=function(e){var n=++oxe;return"".concat(e||"").concat(n)},yi=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(!De(e)&&!ov(e))return r;var o;if(Kl(e)){var s=e.indexOf("%");o=n*parseFloat(e.slice(0,s))/100}else o=+e;return fh(o)&&(o=r),i&&o>n&&(o=n),o},Cc=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},sxe=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 fxe(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 M1(t){"@babel/helpers - typeof";return M1=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},M1(t)}var oM={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},$a=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},sM=null,XC=null,pP=function t(e){if(e===sM&&Array.isArray(XC))return XC;var n=[];return g.Children.forEach(e,function(r){Lt(r)||(A8.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),XC=n,sM=e,n};function ko(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(i){return $a(i)}):r=[$a(e)],pP(t).forEach(function(i){var o=oo(i,"type.displayName")||oo(i,"type.name");r.indexOf(o)!==-1&&n.push(i)}),n}function Yi(t,e){var n=ko(t,e);return n&&n[0]}var aM=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,i=n.height;return!(!De(r)||r<=0||!De(i)||i<=0)},hxe=["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"],pxe=function(e){return e&&e.type&&ov(e.type)&&hxe.indexOf(e.type)>=0},mxe=function(e){return e&&M1(e)==="object"&&"clipDot"in e},gxe=function(e,n,r,i){var o,s=(o=QC==null?void 0:QC[i])!==null&&o!==void 0?o:[];return!At(e)&&(i&&s.includes(n)||cxe.includes(n))||r&&hP.includes(n)},ft=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var i=e;if(g.isValidElement(e)&&(i=e.props),!ch(i))return null;var o={};return Object.keys(i).forEach(function(s){var c;gxe((c=i)===null||c===void 0?void 0:c[s],s,n,r)&&(o[s]=i[s])}),o},D1=function t(e,n){if(e===n)return!0;var r=g.Children.count(e);if(r!==g.Children.count(n))return!1;if(r===0)return!0;if(r===1)return cM(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 wxe(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 L1(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=bxe(t,xxe),d=i||{width:n,height:r,x:0,y:0},f=Mt("recharts-surface",o);return N.createElement("svg",$1({},ft(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 Sxe=["children","className"];function F1(){return F1=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 _xe(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 tn=N.forwardRef(function(t,e){var n=t.children,r=t.className,i=Cxe(t,Sxe),o=Mt("recharts-layer",r);return N.createElement("g",F1({className:o},ft(i,!0),{ref:e}),n)}),ls=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:Exe(t,e,n)}var Txe=Nxe,kxe="\\ud800-\\udfff",Pxe="\\u0300-\\u036f",Oxe="\\ufe20-\\ufe2f",Ixe="\\u20d0-\\u20ff",Rxe=Pxe+Oxe+Ixe,Mxe="\\ufe0e\\ufe0f",Dxe="\\u200d",$xe=RegExp("["+Dxe+kxe+Rxe+Mxe+"]");function Lxe(t){return $xe.test(t)}var E8=Lxe;function Fxe(t){return t.split("")}var Bxe=Fxe,N8="\\ud800-\\udfff",Uxe="\\u0300-\\u036f",zxe="\\ufe20-\\ufe2f",Hxe="\\u20d0-\\u20ff",Vxe=Uxe+zxe+Hxe,Gxe="\\ufe0e\\ufe0f",Kxe="["+N8+"]",B1="["+Vxe+"]",U1="\\ud83c[\\udffb-\\udfff]",Wxe="(?:"+B1+"|"+U1+")",T8="[^"+N8+"]",k8="(?:\\ud83c[\\udde6-\\uddff]){2}",P8="[\\ud800-\\udbff][\\udc00-\\udfff]",qxe="\\u200d",O8=Wxe+"?",I8="["+Gxe+"]?",Yxe="(?:"+qxe+"(?:"+[T8,k8,P8].join("|")+")"+I8+O8+")*",Qxe=I8+O8+Yxe,Xxe="(?:"+[T8+B1+"?",B1,k8,P8,Kxe].join("|")+")",Jxe=RegExp(U1+"(?="+U1+")|"+Xxe+Qxe,"g");function Zxe(t){return t.match(Jxe)||[]}var ebe=Zxe,tbe=Bxe,nbe=E8,rbe=ebe;function ibe(t){return nbe(t)?rbe(t):tbe(t)}var obe=ibe,sbe=Txe,abe=E8,cbe=obe,lbe=b8;function ube(t){return function(e){e=lbe(e);var n=abe(e)?cbe(e):void 0,r=n?n[0]:e.charAt(0),i=n?sbe(n,1).join(""):e.slice(1);return r[t]()+i}}var dbe=ube,fbe=dbe,hbe=fbe("toUpperCase"),pbe=hbe;const fS=hn(pbe);function Dn(t){return function(){return t}}const R8=Math.cos,Ib=Math.sin,_s=Math.sqrt,Rb=Math.PI,hS=2*Rb,z1=Math.PI,H1=2*z1,Rl=1e-6,mbe=H1-Rl;function M8(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return M8;const n=10**e;return function(r){this._+=r[0];for(let i=1,o=r.length;iRl)if(!(Math.abs(f*l-u*d)>Rl)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let p=r-s,v=i-c,m=l*l+u*u,y=p*p+v*v,b=Math.sqrt(m),x=Math.sqrt(h),w=o*Math.tan((z1-Math.acos((m+h-y)/(2*b*x)))/2),S=w/x,C=w/b;Math.abs(S-1)>Rl&&this._append`L${e+S*d},${n+S*f}`,this._append`A${o},${o},0,0,${+(f*p>d*v)},${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)>Rl||Math.abs(this._y1-d)>Rl)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%H1+H1),h>mbe?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>Rl&&this._append`A${r},${r},0,${+(h>=z1)},${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 mP(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 vbe(e)}function gP(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function D8(t){this._context=t}D8.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 pS(t){return new D8(t)}function $8(t){return t[0]}function L8(t){return t[1]}function F8(t,e){var n=Dn(!0),r=null,i=pS,o=null,s=mP(c);t=typeof t=="function"?t:t===void 0?$8:Dn(t),e=typeof e=="function"?e:e===void 0?L8:Dn(e);function c(l){var u,d=(l=gP(l)).length,f,h=!1,p;for(r==null&&(o=i(p=s())),u=0;u<=d;++u)!(u=p;--v)c.point(w[v],S[v]);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 F8().defined(i).curve(s).context(o)}return u.x=function(f){return arguments.length?(t=typeof f=="function"?f:Dn(+f),r=null,u):t},u.x0=function(f){return arguments.length?(t=typeof f=="function"?f:Dn(+f),u):t},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Dn(+f),u):r},u.y=function(f){return arguments.length?(e=typeof f=="function"?f:Dn(+f),n=null,u):e},u.y0=function(f){return arguments.length?(e=typeof f=="function"?f:Dn(+f),u):e},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Dn(+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:Dn(!!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 B8{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 ybe(t){return new B8(t,!0)}function xbe(t){return new B8(t,!1)}const vP={draw(t,e){const n=_s(e/Rb);t.moveTo(n,0),t.arc(0,0,n,0,hS)}},bbe={draw(t,e){const n=_s(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()}},U8=_s(1/3),wbe=U8*2,Sbe={draw(t,e){const n=_s(e/wbe),r=n*U8;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},Cbe={draw(t,e){const n=_s(e),r=-n/2;t.rect(r,r,n,n)}},_be=.8908130915292852,z8=Ib(Rb/10)/Ib(7*Rb/10),Abe=Ib(hS/10)*z8,jbe=-R8(hS/10)*z8,Ebe={draw(t,e){const n=_s(e*_be),r=Abe*n,i=jbe*n;t.moveTo(0,-n),t.lineTo(r,i);for(let o=1;o<5;++o){const s=hS*o/5,c=R8(s),l=Ib(s);t.lineTo(l*n,-c*n),t.lineTo(c*r-l*i,l*r+c*i)}t.closePath()}},JC=_s(3),Nbe={draw(t,e){const n=-_s(e/(JC*3));t.moveTo(0,n*2),t.lineTo(-JC*n,-n),t.lineTo(JC*n,-n),t.closePath()}},uo=-.5,fo=_s(3)/2,V1=1/_s(12),Tbe=(V1/2+1)*3,kbe={draw(t,e){const n=_s(e/Tbe),r=n/2,i=n*V1,o=r,s=n*V1+n,c=-o,l=s;t.moveTo(r,i),t.lineTo(o,s),t.lineTo(c,l),t.lineTo(uo*r-fo*i,fo*r+uo*i),t.lineTo(uo*o-fo*s,fo*o+uo*s),t.lineTo(uo*c-fo*l,fo*c+uo*l),t.lineTo(uo*r+fo*i,uo*i-fo*r),t.lineTo(uo*o+fo*s,uo*s-fo*o),t.lineTo(uo*c+fo*l,uo*l-fo*c),t.closePath()}};function Pbe(t,e){let n=null,r=mP(i);t=typeof t=="function"?t:Dn(t||vP),e=typeof e=="function"?e:Dn(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:Dn(o),i):t},i.size=function(o){return arguments.length?(e=typeof o=="function"?o:Dn(+o),i):e},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function Mb(){}function Db(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 H8(t){this._context=t}H8.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:Db(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:Db(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Obe(t){return new H8(t)}function V8(t){this._context=t}V8.prototype={areaStart:Mb,areaEnd:Mb,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:Db(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Ibe(t){return new V8(t)}function G8(t){this._context=t}G8.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:Db(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function Rbe(t){return new G8(t)}function K8(t){this._context=t}K8.prototype={areaStart:Mb,areaEnd:Mb,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 Mbe(t){return new K8(t)}function uM(t){return t<0?-1:1}function dM(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(uM(o)+uM(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(c))||0}function fM(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function ZC(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 $b(t){this._context=t}$b.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:ZC(this,this._t0,fM(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,ZC(this,fM(this,n=dM(this,t,e)),n);break;default:ZC(this,this._t0,n=dM(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function W8(t){this._context=new q8(t)}(W8.prototype=Object.create($b.prototype)).point=function(t,e){$b.prototype.point.call(this,e,t)};function q8(t){this._context=t}q8.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 Dbe(t){return new $b(t)}function $be(t){return new W8(t)}function Y8(t){this._context=t}Y8.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=hM(t),i=hM(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 Fbe(t){return new mS(t,.5)}function Bbe(t){return new mS(t,0)}function Ube(t){return new mS(t,1)}function hf(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 zbe(t,e){return t[e]}function Hbe(t){const e=[];return e.key=t,e}function Vbe(){var t=Dn([]),e=G1,n=hf,r=zbe;function i(o){var s=Array.from(t.apply(this,arguments),Hbe),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 Zbe(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 Q8={symbolCircle:vP,symbolCross:bbe,symbolDiamond:Sbe,symbolSquare:Cbe,symbolStar:Ebe,symbolTriangle:Nbe,symbolWye:kbe},e0e=Math.PI/180,t0e=function(e){var n="symbol".concat(fS(e));return Q8[n]||vP},n0e=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*e0e;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}},r0e=function(e,n){Q8["symbol".concat(fS(e))]=n},yP=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=Jbe(e,qbe),u=mM(mM({},l),{},{type:r,size:o,sizeType:c}),d=function(){var y=t0e(r),b=Pbe().type(y).size(n0e(o,c,r));return b()},f=u.className,h=u.cx,p=u.cy,v=ft(u,!0);return h===+h&&p===+p&&o===+o?N.createElement("path",K1({},v,{className:Mt("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};yP.registerSymbol=r0e;function pf(t){"@babel/helpers - typeof";return pf=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},pf(t)}function W1(){return W1=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var x=p.inactive?u:p.color;return N.createElement("li",W1({className:y,style:f,key:"legend-item-".concat(v)},ju(r.props,p,v)),N.createElement(L1,{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,v):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())}}])}(g.PureComponent);Vm(xP,"displayName","Legend");Vm(xP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var h0e=Zw;function p0e(){this.__data__=new h0e,this.size=0}var m0e=p0e;function g0e(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var v0e=g0e;function y0e(t){return this.__data__.get(t)}var x0e=y0e;function b0e(t){return this.__data__.has(t)}var w0e=b0e,S0e=Zw,C0e=sP,_0e=aP,A0e=200;function j0e(t,e){var n=this.__data__;if(n instanceof S0e){var r=n.__data__;if(!C0e||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&q0e?new V0e:void 0;for(o.set(t,e),o.set(e,t);++f-1&&t%1==0&&t-1&&t%1==0&&t<=Jwe}var CP=Zwe,eSe=rc,tSe=CP,nSe=ic,rSe="[object Arguments]",iSe="[object Array]",oSe="[object Boolean]",sSe="[object Date]",aSe="[object Error]",cSe="[object Function]",lSe="[object Map]",uSe="[object Number]",dSe="[object Object]",fSe="[object RegExp]",hSe="[object Set]",pSe="[object String]",mSe="[object WeakMap]",gSe="[object ArrayBuffer]",vSe="[object DataView]",ySe="[object Float32Array]",xSe="[object Float64Array]",bSe="[object Int8Array]",wSe="[object Int16Array]",SSe="[object Int32Array]",CSe="[object Uint8Array]",_Se="[object Uint8ClampedArray]",ASe="[object Uint16Array]",jSe="[object Uint32Array]",Un={};Un[ySe]=Un[xSe]=Un[bSe]=Un[wSe]=Un[SSe]=Un[CSe]=Un[_Se]=Un[ASe]=Un[jSe]=!0;Un[rSe]=Un[iSe]=Un[gSe]=Un[oSe]=Un[vSe]=Un[sSe]=Un[aSe]=Un[cSe]=Un[lSe]=Un[uSe]=Un[dSe]=Un[fSe]=Un[hSe]=Un[pSe]=Un[mSe]=!1;function ESe(t){return nSe(t)&&tSe(t.length)&&!!Un[eSe(t)]}var NSe=ESe;function TSe(t){return function(e){return t(e)}}var aK=TSe,Ub={exports:{}};Ub.exports;(function(t,e){var n=p8,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})(Ub,Ub.exports);var kSe=Ub.exports,PSe=NSe,OSe=aK,SM=kSe,CM=SM&&SM.isTypedArray,ISe=CM?OSe(CM):PSe,cK=ISe,RSe=$we,MSe=wP,DSe=Hi,$Se=sK,LSe=SP,FSe=cK,BSe=Object.prototype,USe=BSe.hasOwnProperty;function zSe(t,e){var n=DSe(t),r=!n&&MSe(t),i=!n&&!r&&$Se(t),o=!n&&!r&&!i&&FSe(t),s=n||r||i||o,c=s?RSe(t.length,String):[],l=c.length;for(var u in t)(e||USe.call(t,u))&&!(s&&(u=="length"||i&&(u=="offset"||u=="parent")||o&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||LSe(u,l)))&&c.push(u);return c}var HSe=zSe,VSe=Object.prototype;function GSe(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||VSe;return t===n}var KSe=GSe;function WSe(t,e){return function(n){return t(e(n))}}var lK=WSe,qSe=lK,YSe=qSe(Object.keys,Object),QSe=YSe,XSe=KSe,JSe=QSe,ZSe=Object.prototype,eCe=ZSe.hasOwnProperty;function tCe(t){if(!XSe(t))return JSe(t);var e=[];for(var n in Object(t))eCe.call(t,n)&&n!="constructor"&&e.push(n);return e}var nCe=tCe,rCe=iP,iCe=CP;function oCe(t){return t!=null&&iCe(t.length)&&!rCe(t)}var sv=oCe,sCe=HSe,aCe=nCe,cCe=sv;function lCe(t){return cCe(t)?sCe(t):aCe(t)}var gS=lCe,uCe=Awe,dCe=Mwe,fCe=gS;function hCe(t){return uCe(t,fCe,dCe)}var pCe=hCe,_M=pCe,mCe=1,gCe=Object.prototype,vCe=gCe.hasOwnProperty;function yCe(t,e,n,r,i,o){var s=n&mCe,c=_M(t),l=c.length,u=_M(e),d=u.length;if(l!=d&&!s)return!1;for(var f=l;f--;){var h=c[f];if(!(s?h in e:vCe.call(e,h)))return!1}var p=o.get(t),v=o.get(e);if(p&&v)return p==e&&v==t;var m=!0;o.set(t,e),o.set(e,t);for(var y=s;++f-1}var gAe=mAe;function vAe(t,e,n){for(var r=-1,i=t==null?0:t.length;++r=OAe){var u=e?null:kAe(t);if(u)return PAe(u);s=!1,i=TAe,l=new jAe}else l=e?[]:c;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function qAe(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 YAe(t){return t.value}function QAe(t,e){if(N.isValidElement(t))return N.cloneElement(t,e);if(typeof t=="function")return N.createElement(t,e);e.ref;var n=WAe(e,FAe);return N.createElement(xP,n)}var BM=1,La=function(t){function e(){var n;BAe(this,e);for(var r=arguments.length,i=new Array(r),o=0;oBM||Math.abs(i.height-this.lastBoundingBox.height)>BM)&&(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?ga({},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 v=this.getBBoxSnapshot();h={top:((d||0)-v.height)/2}}else h=c==="bottom"?{bottom:l&&l.bottom||0}:{top:l&&l.top||0};return ga(ga({},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=ga(ga({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}},QAe(o,ga(ga({},this.props),{},{payload:gK(d,u,YAe)})))}}],[{key:"getWithHeight",value:function(r,i){var o=ga(ga({},this.defaultProps),r.props),s=o.layout;return s==="vertical"&&De(r.props.height)?{height:r.props.height}:s==="horizontal"?{width:r.props.width||i}:null}}])}(g.PureComponent);vS(La,"displayName","Legend");vS(La,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var UM=iv,XAe=wP,JAe=Hi,zM=UM?UM.isConcatSpreadable:void 0;function ZAe(t){return JAe(t)||XAe(t)||!!(zM&&t&&t[zM])}var e1e=ZAe,t1e=iK,n1e=e1e;function xK(t,e,n,r,i){var o=-1,s=t.length;for(n||(n=n1e),i||(i=[]);++o0&&n(c)?e>1?xK(c,e-1,n,r,i):t1e(i,c):r||(i[i.length]=c)}return i}var bK=xK;function r1e(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 i1e=r1e,o1e=i1e,s1e=o1e(),a1e=s1e,c1e=a1e,l1e=gS;function u1e(t,e){return t&&c1e(t,e,l1e)}var wK=u1e,d1e=sv;function f1e(t,e){return function(n,r){if(n==null)return n;if(!d1e(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 j1e=A1e,r_=lP,E1e=uP,N1e=fa,T1e=SK,k1e=w1e,P1e=aK,O1e=j1e,I1e=gh,R1e=Hi;function M1e(t,e,n){e.length?e=r_(e,function(o){return R1e(o)?function(s){return E1e(s,o.length===1?o[0]:o)}:o}):e=[I1e];var r=-1;e=r_(e,P1e(N1e));var i=T1e(t,function(o,s,c){var l=r_(e,function(u){return u(o)});return{criteria:l,index:++r,value:o}});return k1e(i,function(o,s){return O1e(o,s,n)})}var D1e=M1e;function $1e(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 L1e=$1e,F1e=L1e,VM=Math.max;function B1e(t,e,n){return e=VM(e===void 0?t.length-1:e,0),function(){for(var r=arguments,i=-1,o=VM(r.length-e,0),s=Array(o);++i0){if(++e>=Q1e)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var eje=Z1e,tje=Y1e,nje=eje,rje=nje(tje),ije=rje,oje=gh,sje=U1e,aje=ije;function cje(t,e){return aje(sje(t,e,oje),t+"")}var lje=cje,uje=oP,dje=sv,fje=SP,hje=Sl;function pje(t,e,n){if(!hje(n))return!1;var r=typeof e;return(r=="number"?dje(n)&&fje(e,n.length):r=="string"&&e in n)?uje(n[e],t):!1}var yS=pje,mje=bK,gje=D1e,vje=lje,KM=yS,yje=vje(function(t,e){if(t==null)return[];var n=e.length;return n>1&&KM(t,e[0],e[1])?e=[]:n>2&&KM(e[0],e[1],e[2])&&(e=[e[0]]),gje(t,mje(e,1),[])}),xje=yje;const jP=hn(xje);function Gm(t){"@babel/helpers - typeof";return Gm=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},Gm(t)}function tj(){return tj=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(Hh,"-left"),De(n)&&e&&De(e.x)&&n=e.y),"".concat(Hh,"-top"),De(r)&&e&&De(e.y)&&rm?Math.max(d,l[r]):Math.max(f,l[r])}function Rje(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 Mje(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=YM({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.width,viewBox:l,viewBoxDimension:l.width}),f=YM({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:s.height,viewBox:l,viewBoxDimension:l.height}),u=Rje({translateX:d,translateY:f,useTranslate3d:c})):u=Oje,{cssProperties:u,cssClasses:Ije({translateX:d,translateY:f,coordinate:n})}}function gf(t){"@babel/helpers - typeof";return gf=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},gf(t)}function QM(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 XM(t){for(var e=1;eJM||Math.abs(r.height-this.state.lastBoundingBox.height)>JM)&&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,v=i.position,m=i.reverseDirection,y=i.useTranslate3d,b=i.viewBox,x=i.wrapperStyle,w=Mje({allowEscapeViewBox:s,coordinate:d,offsetTopLeft:p,position:v,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:b}),S=w.cssClasses,C=w.cssProperties,_=XM(XM({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)}}])}(g.PureComponent),Gje=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},us={isSsr:Gje(),get:function(e){return us[e]},set:function(e,n){if(typeof e=="string")us[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(i){us[i]=e[i]})}}};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 ZM(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 eD(t){for(var e=1;e0;return N.createElement(Vje,{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},tEe(u,eD(eD({},this.props),{},{payload:C})))}}])}(g.PureComponent);EP(ni,"displayName","Tooltip");EP(ni,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!us.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 nEe=da,rEe=function(){return nEe.Date.now()},iEe=rEe,oEe=/\s/;function sEe(t){for(var e=t.length;e--&&oEe.test(t.charAt(e)););return e}var aEe=sEe,cEe=aEe,lEe=/^\s+/;function uEe(t){return t&&t.slice(0,cEe(t)+1).replace(lEe,"")}var dEe=uEe,fEe=dEe,tD=Sl,hEe=ah,nD=NaN,pEe=/^[-+]0x[0-9a-f]+$/i,mEe=/^0b[01]+$/i,gEe=/^0o[0-7]+$/i,vEe=parseInt;function yEe(t){if(typeof t=="number")return t;if(hEe(t))return nD;if(tD(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=tD(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=fEe(t);var n=mEe.test(t);return n||gEe.test(t)?vEe(t.slice(2),n?2:8):pEe.test(t)?nD:+t}var NK=yEe,xEe=Sl,o_=iEe,rD=NK,bEe="Expected a function",wEe=Math.max,SEe=Math.min;function CEe(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(bEe);e=rD(e)||0,xEe(n)&&(d=!!n.leading,f="maxWait"in n,o=f?wEe(rD(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 v(_){return u=_,c=setTimeout(b,e),d?p(_):s}function m(_){var A=_-l,j=_-u,T=e-A;return f?SEe(T,o-j):T}function y(_){var A=_-l,j=_-u;return l===void 0||A>=e||A<0||f&&j>=o}function b(){var _=o_();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(o_())}function C(){var _=o_(),A=y(_);if(r=arguments,i=this,l=_,A){if(c===void 0)return v(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 _Ee=CEe,AEe=_Ee,jEe=Sl,EEe="Expected a function";function NEe(t,e,n){var r=!0,i=!0;if(typeof t!="function")throw new TypeError(EEe);return jEe(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),AEe(t,e,{leading:r,maxWait:e,trailing:i})}var TEe=NEe;const TK=hn(TEe);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 iD(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 oy(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&(R=TK(R,m,{trailing:!0,leading:!1}));var D=new ResizeObserver(R),V=C.current.getBoundingClientRect(),L=V.width,z=V.height;return O(L,z),D.observe(C.current),function(){D.disconnect()}},[O,m]);var E=g.useMemo(function(){var R=T.containerWidth,D=T.containerHeight;if(R<0||D<0)return null;ls(Kl(s)||Kl(l),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,s,l),ls(!n||n>0,"The aspect(%s) must be greater than zero.",n);var V=Kl(s)?R:s,L=Kl(l)?D:l;n&&n>0&&(V?L=V/n:L&&(V=L*n),h&&L>h&&(L=h)),ls(V>0||L>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.`,V,L,s,l,d,f,n);var z=!Array.isArray(p)&&$a(p.type).endsWith("Chart");return N.Children.map(p,function(M){return A8.isElement(M)?g.cloneElement(M,oy({width:V,height:L},z?{style:oy({height:"100%",width:"100%",maxHeight:L,maxWidth:V},M.props.style)}:{})):M})},[n,p,l,h,f,d,T,s]);return N.createElement("div",{id:y?"".concat(y):void 0,className:Mt("recharts-responsive-container",b),style:oy(oy({},S),{},{width:s,height:l,minWidth:d,minHeight:f,maxHeight:h}),ref:C},E)}),av=function(e){return null};av.displayName="Cell";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 sD(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 oj(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||us.isSsr)return{width:0,height:0};var r=HEe(n),i=JSON.stringify({text:e,copyStyle:r});if(Xu.widthCache[i])return Xu.widthCache[i];try{var o=document.getElementById(aD);o||(o=document.createElement("span"),o.setAttribute("id",aD),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var s=oj(oj({},zEe),r);Object.assign(o.style,s),o.textContent="".concat(e);var c=o.getBoundingClientRect(),l={width:c.width,height:c.height};return Xu.widthCache[i]=l,++Xu.cacheCount>UEe&&(Xu.cacheCount=0,Xu.widthCache={}),l}catch{return{width:0,height:0}}},VEe=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};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 Gb(t,e){return qEe(t)||WEe(t,e)||KEe(t,e)||GEe()}function GEe(){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 KEe(t,e){if(t){if(typeof t=="string")return cD(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 cD(t,e)}}function cD(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 cNe(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 pD(t,e){return fNe(t)||dNe(t,e)||uNe(t,e)||lNe()}function lNe(){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 uNe(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);n0&&arguments[0]!==void 0?arguments[0]:[];return V.reduce(function(L,z){var M=z.word,$=z.width,Q=L[L.length-1];if(Q&&(i==null||o||Q.width+$+rz.width?L:z})};if(!d)return p;for(var m="…",y=function(V){var L=f.slice(0,V),z=IK({breakAll:u,style:l,children:L+m}).wordsWithComputedWidth,M=h(z),$=M.length>s||v(M).width>Number(i);return[$,M]},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=pD(A,2),T=j[0],k=j[1],O=y(C),E=pD(O,1),R=E[0];if(!T&&!R&&(b=C+1),T&&R&&(x=C-1),!T&&R){S=k;break}w++}return S||p},gD=function(e){var n=Lt(e)?[]:e.toString().split(OK);return[{words:n}]},pNe=function(e){var n=e.width,r=e.scaleToFit,i=e.children,o=e.style,s=e.breakAll,c=e.maxLines;if((n||r)&&!us.isSsr){var l,u,d=IK({breakAll:s,children:i,style:o});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;l=f,u=h}else return gD(i);return hNe({breakAll:s,children:i,maxLines:c,style:o},l,u,n,r)}return gD(i)},vD="#808080",Eu=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,v=e.verticalAnchor,m=v===void 0?"end":v,y=e.fill,b=y===void 0?vD:y,x=hD(e,sNe),w=g.useMemo(function(){return pNe({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,T=hD(x,aNe);if(!kr(r)||!kr(o))return null;var k=r+(De(S)?S:0),O=o+(De(C)?C:0),E;switch(m){case"start":E=s_("calc(".concat(u,")"));break;case"middle":E=s_("calc(".concat((w.length-1)/2," * -").concat(c," + (").concat(u," / 2))"));break;default:E=s_("calc(".concat(w.length-1," * -").concat(c,")"));break}var R=[];if(f){var D=w[0].width,V=x.width;R.push("scale(".concat((De(V)?V/D:1)/D,")"))}return _&&R.push("rotate(".concat(_,", ").concat(k,", ").concat(O,")")),R.length&&(T.transform=R.join(" ")),N.createElement("text",sj({},ft(T,!0),{x:k,y:O,className:Mt("recharts-text",A),textAnchor:p,fill:b.includes("url")?vD:b}),w.map(function(L,z){var M=L.words.join(j?"":" ");return N.createElement("tspan",{x:k,dy:z===0?E:c,key:"".concat(M,"-").concat(z)},M)}))};function Xc(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function mNe(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function NP(t){let e,n,r;t.length!==2?(e=Xc,n=(c,l)=>Xc(t(c),l),r=(c,l)=>t(c)-l):(e=t===Xc||t===mNe?t:gNe,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 gNe(){return 0}function RK(t){return t===null?NaN:+t}function*vNe(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const yNe=NP(Xc),cv=yNe.right;NP(RK).center;class yD extends Map{constructor(e,n=wNe){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(xD(this,e))}has(e){return super.has(xD(this,e))}set(e,n){return super.set(xNe(this,e),n)}delete(e){return super.delete(bNe(this,e))}}function xD({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function xNe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function bNe({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function wNe(t){return t!==null&&typeof t=="object"?t.valueOf():t}function SNe(t=Xc){if(t===Xc)return MK;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 MK(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const CNe=Math.sqrt(50),_Ne=Math.sqrt(10),ANe=Math.sqrt(2);function Kb(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>=CNe?10:o>=_Ne?5:o>=ANe?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 wD(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function DK(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?MK:SNe(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)),v=Math.min(r,Math.floor(e+(l-u)*f/l+h));DK(t,e,p,v,i)}const o=t[e];let s=n,c=r;for(Vh(t,n,e),i(t[r],o)>0&&Vh(t,n,r);s0;)--c}i(t[n],o)===0?Vh(t,n,c):(++c,Vh(t,c,r)),c<=e&&(n=c+1),e<=c&&(r=c-1)}return t}function Vh(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function jNe(t,e,n){if(t=Float64Array.from(vNe(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return wD(t);if(e>=1)return bD(t);var r,i=(r-1)*e,o=Math.floor(i),s=bD(DK(t,o).subarray(0,o+1)),c=wD(t.subarray(o+1));return s+(c-s)*(i-o)}}function ENe(t,e,n=RK){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 NNe(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?ay(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?ay(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=kNe.exec(t))?new Pi(e[1],e[2],e[3],1):(e=PNe.exec(t))?new Pi(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ONe.exec(t))?ay(e[1],e[2],e[3],e[4]):(e=INe.exec(t))?ay(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=RNe.exec(t))?ND(e[1],e[2]/100,e[3]/100,1):(e=MNe.exec(t))?ND(e[1],e[2]/100,e[3]/100,e[4]):SD.hasOwnProperty(t)?AD(SD[t]):t==="transparent"?new Pi(NaN,NaN,NaN,0):null}function AD(t){return new Pi(t>>16&255,t>>8&255,t&255,1)}function ay(t,e,n,r){return r<=0&&(t=e=n=NaN),new Pi(t,e,n,r)}function LNe(t){return t instanceof lv||(t=Zm(t)),t?(t=t.rgb(),new Pi(t.r,t.g,t.b,t.opacity)):new Pi}function dj(t,e,n,r){return arguments.length===1?LNe(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}kP(Pi,dj,LK(lv,{brighter(t){return t=t==null?Wb:Math.pow(Wb,t),new Pi(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Xm:Math.pow(Xm,t),new Pi(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Pi(su(this.r),su(this.g),su(this.b),qb(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:jD,formatHex:jD,formatHex8:FNe,formatRgb:ED,toString:ED}));function jD(){return`#${Wl(this.r)}${Wl(this.g)}${Wl(this.b)}`}function FNe(){return`#${Wl(this.r)}${Wl(this.g)}${Wl(this.b)}${Wl((isNaN(this.opacity)?1:this.opacity)*255)}`}function ED(){const t=qb(this.opacity);return`${t===1?"rgb(":"rgba("}${su(this.r)}, ${su(this.g)}, ${su(this.b)}${t===1?")":`, ${t})`}`}function qb(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function su(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Wl(t){return t=su(t),(t<16?"0":"")+t.toString(16)}function ND(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Zo(t,e,n,r)}function FK(t){if(t instanceof Zo)return new Zo(t.h,t.s,t.l,t.opacity);if(t instanceof lv||(t=Zm(t)),!t)return new Zo;if(t instanceof Zo)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 Zo(s,c,l,t.opacity)}function BNe(t,e,n,r){return arguments.length===1?FK(t):new Zo(t,e,n,r??1)}function Zo(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}kP(Zo,BNe,LK(lv,{brighter(t){return t=t==null?Wb:Math.pow(Wb,t),new Zo(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Xm:Math.pow(Xm,t),new Zo(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(a_(t>=240?t-240:t+120,i,r),a_(t,i,r),a_(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Zo(TD(this.h),cy(this.s),cy(this.l),qb(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=qb(this.opacity);return`${t===1?"hsl(":"hsla("}${TD(this.h)}, ${cy(this.s)*100}%, ${cy(this.l)*100}%${t===1?")":`, ${t})`}`}}));function TD(t){return t=(t||0)%360,t<0?t+360:t}function cy(t){return Math.max(0,Math.min(1,t||0))}function a_(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 PP=t=>()=>t;function UNe(t,e){return function(n){return t+n*e}}function zNe(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 HNe(t){return(t=+t)==1?BK:function(e,n){return n-e?zNe(e,n,t):PP(isNaN(e)?n:e)}}function BK(t,e){var n=e-t;return n?UNe(t,n):PP(isNaN(t)?e:t)}const kD=function t(e){var n=HNe(e);function r(i,o){var s=n((i=dj(i)).r,(o=dj(o)).r),c=n(i.g,o.g),l=n(i.b,o.b),u=BK(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 VNe(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:Yb(r,i)})),n=c_.lastIndex;return ne&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function tTe(t,e,n){var r=t[0],i=t[1],o=e[0],s=e[1];return i2?nTe:tTe,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),Yb)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,Qb),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=OP,d()},f.clamp=function(h){return arguments.length?(s=h?!0:xi,d()):s!==xi},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 IP(){return xS()(xi,xi)}function rTe(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Xb(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 yf(t){return t=Xb(Math.abs(t)),t?t[1]:NaN}function iTe(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 oTe(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var sTe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function eg(t){if(!(e=sTe.exec(t)))throw new Error("invalid format: "+t);var e;return new RP({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]})}eg.prototype=RP.prototype;function RP(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+""}RP.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 aTe(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 UK;function cTe(t,e){var n=Xb(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(UK=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")+Xb(t,Math.max(0,e+o-1))[0]}function OD(t,e){var n=Xb(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 ID={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:rTe,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)=>OD(t*100,e),r:OD,s:cTe,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function RD(t){return t}var MD=Array.prototype.map,DD=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function lTe(t){var e=t.grouping===void 0||t.thousands===void 0?RD:iTe(MD.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?RD:oTe(MD.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=eg(f);var h=f.fill,p=f.align,v=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"):ID[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=ID[C],T=/[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=_,R=A,D,V,L;if(C==="c")R=j(O)+R,O="";else{O=+O;var z=O<0||1/O<0;if(O=isNaN(O)?l:j(Math.abs(O),w),S&&(O=aTe(O)),z&&+O==0&&v!=="+"&&(z=!1),E=(z?v==="("?v:c:v==="-"||v==="("?"":v)+E,R=(C==="s"?DD[8+UK/3]:"")+R+(z&&v==="("?")":""),T){for(D=-1,V=O.length;++DL||L>57){R=(L===46?i+O.slice(D+1):O.slice(D))+R,O=O.slice(0,D);break}}}x&&!y&&(O=e(O,1/0));var M=E.length+O.length+R.length,$=M>1)+E+O+R+$.slice(M);break;default:O=$+E+O+R;break}return o(O)}return k.toString=function(){return f+""},k}function d(f,h){var p=u((f=eg(f),f.type="f",f)),v=Math.max(-8,Math.min(8,Math.floor(yf(h)/3)))*3,m=Math.pow(10,-v),y=DD[8+v/3];return function(b){return p(m*b)+y}}return{format:u,formatPrefix:d}}var ly,MP,zK;uTe({thousands:",",grouping:[3],currency:["$",""]});function uTe(t){return ly=lTe(t),MP=ly.format,zK=ly.formatPrefix,ly}function dTe(t){return Math.max(0,-yf(Math.abs(t)))}function fTe(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(yf(e)/3)))*3-yf(Math.abs(t)))}function hTe(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,yf(e)-yf(t))+1}function HK(t,e,n,r){var i=lj(t,e,n),o;switch(r=eg(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(o=fTe(i,s))&&(r.precision=o),zK(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=hTe(i,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=dTe(i))&&(r.precision=o-(r.type==="%")*2);break}}return MP(r)}function Cl(t){var e=t.domain;return t.ticks=function(n){var r=e();return aj(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var i=e();return HK(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=cj(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 Jb(){var t=IP();return t.copy=function(){return uv(t,Jb())},$o.apply(t,arguments),Cl(t)}function VK(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,Qb),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return VK(t).unknown(e)},t=arguments.length?Array.from(t,Qb):[0,1],Cl(n)}function GK(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 yTe(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 FD(t){return(e,n)=>-t(-e,n)}function DP(t){const e=t($D,LD),n=e.domain;let r=10,i,o;function s(){return i=yTe(r),o=vTe(r),n()[0]<0?(i=FD(i),o=FD(o),t(pTe,mTe)):t($D,LD),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(v=1;vd)break;b.push(m)}}else for(;h<=p;++h)for(v=r-1;v>=1;--v)if(m=h>0?v/o(-h):v*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=eg(l)).precision==null&&(l.trim=!0),l=MP(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(GK(n(),{floor:c=>o(Math.floor(i(c))),ceil:c=>o(Math.ceil(i(c)))})),e}function KK(){const t=DP(xS()).domain([1,10]);return t.copy=()=>uv(t,KK()).base(t.base()),$o.apply(t,arguments),t}function BD(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function UD(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function $P(t){var e=1,n=t(BD(e),UD(e));return n.constant=function(r){return arguments.length?t(BD(e=+r),UD(e)):e},Cl(n)}function WK(){var t=$P(xS());return t.copy=function(){return uv(t,WK()).constant(t.constant())},$o.apply(t,arguments)}function zD(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function xTe(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function bTe(t){return t<0?-t*t:t*t}function LP(t){var e=t(xi,xi),n=1;function r(){return n===1?t(xi,xi):n===.5?t(xTe,bTe):t(zD(n),zD(1/n))}return e.exponent=function(i){return arguments.length?(n=+i,r()):n},Cl(e)}function FP(){var t=LP(xS());return t.copy=function(){return uv(t,FP()).exponent(t.exponent())},$o.apply(t,arguments),t}function wTe(){return FP.apply(null,arguments).exponent(.5)}function HD(t){return Math.sign(t)*t*t}function STe(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function qK(){var t=IP(),e=[0,1],n=!1,r;function i(o){var s=STe(t(o));return isNaN(s)?r:n?Math.round(s):s}return i.invert=function(o){return t.invert(HD(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,Qb)).map(HD)),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 qK(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},$o.apply(i,arguments),Cl(i)}function YK(){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 QK().domain([t,e]).range(i).unknown(o)},$o.apply(Cl(s),arguments)}function XK(){var t=[.5],e=[0,1],n,r=1;function i(o){return o!=null&&o<=o?e[cv(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 XK().domain(t).range(e).unknown(n)},$o.apply(i,arguments)}const l_=new Date,u_=new Date;function Pr(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(uPr(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)=>(l_.setTime(+o),u_.setTime(+s),t(l_),t(u_),Math.floor(n(l_,u_))),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 Zb=Pr(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Zb.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Pr(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Zb);Zb.range;const ka=1e3,Eo=ka*60,Pa=Eo*60,Ya=Pa*24,BP=Ya*7,VD=Ya*30,d_=Ya*365,ql=Pr(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*ka)},(t,e)=>(e-t)/ka,t=>t.getUTCSeconds());ql.range;const UP=Pr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ka)},(t,e)=>{t.setTime(+t+e*Eo)},(t,e)=>(e-t)/Eo,t=>t.getMinutes());UP.range;const zP=Pr(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Eo)},(t,e)=>(e-t)/Eo,t=>t.getUTCMinutes());zP.range;const HP=Pr(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*ka-t.getMinutes()*Eo)},(t,e)=>{t.setTime(+t+e*Pa)},(t,e)=>(e-t)/Pa,t=>t.getHours());HP.range;const VP=Pr(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Pa)},(t,e)=>(e-t)/Pa,t=>t.getUTCHours());VP.range;const dv=Pr(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Eo)/Ya,t=>t.getDate()-1);dv.range;const bS=Pr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Ya,t=>t.getUTCDate()-1);bS.range;const JK=Pr(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/Ya,t=>Math.floor(t/Ya));JK.range;function Fu(t){return Pr(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())*Eo)/BP)}const wS=Fu(0),e0=Fu(1),CTe=Fu(2),_Te=Fu(3),xf=Fu(4),ATe=Fu(5),jTe=Fu(6);wS.range;e0.range;CTe.range;_Te.range;xf.range;ATe.range;jTe.range;function Bu(t){return Pr(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)/BP)}const SS=Bu(0),t0=Bu(1),ETe=Bu(2),NTe=Bu(3),bf=Bu(4),TTe=Bu(5),kTe=Bu(6);SS.range;t0.range;ETe.range;NTe.range;bf.range;TTe.range;kTe.range;const GP=Pr(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());GP.range;const KP=Pr(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());KP.range;const Qa=Pr(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());Qa.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Pr(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)});Qa.range;const Xa=Pr(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());Xa.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Pr(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)});Xa.range;function ZK(t,e,n,r,i,o){const s=[[ql,1,ka],[ql,5,5*ka],[ql,15,15*ka],[ql,30,30*ka],[o,1,Eo],[o,5,5*Eo],[o,15,15*Eo],[o,30,30*Eo],[i,1,Pa],[i,3,3*Pa],[i,6,6*Pa],[i,12,12*Pa],[r,1,Ya],[r,2,2*Ya],[n,1,BP],[e,1,VD],[e,3,3*VD],[t,1,d_]];function c(u,d,f){const h=dy).right(s,h);if(p===s.length)return t.every(lj(u/d_,d/d_,f));if(p===0)return Zb.every(Math.max(lj(u,d,f),1));const[v,m]=s[h/s[p-1][2]53)return null;"w"in K||(K.w=1),"Z"in K?(Me=h_(Gh(K.y,0,1)),ut=Me.getUTCDay(),Me=ut>4||ut===0?t0.ceil(Me):t0(Me),Me=bS.offset(Me,(K.V-1)*7),K.y=Me.getUTCFullYear(),K.m=Me.getUTCMonth(),K.d=Me.getUTCDate()+(K.w+6)%7):(Me=f_(Gh(K.y,0,1)),ut=Me.getDay(),Me=ut>4||ut===0?e0.ceil(Me):e0(Me),Me=dv.offset(Me,(K.V-1)*7),K.y=Me.getFullYear(),K.m=Me.getMonth(),K.d=Me.getDate()+(K.w+6)%7)}else("W"in K||"U"in K)&&("w"in K||(K.w="u"in K?K.u%7:"W"in K?1:0),ut="Z"in K?h_(Gh(K.y,0,1)).getUTCDay():f_(Gh(K.y,0,1)).getDay(),K.m=0,K.d="W"in K?(K.w+6)%7+K.W*7-(ut+5)%7:K.w+K.U*7-(ut+6)%7);return"Z"in K?(K.H+=K.Z/100|0,K.M+=K.Z%100,h_(K)):f_(K)}}function j(se,ne,je,K){for(var et=0,Me=ne.length,ut=je.length,Ye,Pt;et=ut)return-1;if(Ye=ne.charCodeAt(et++),Ye===37){if(Ye=ne.charAt(et++),Pt=C[Ye in GD?ne.charAt(et++):Ye],!Pt||(K=Pt(se,je,K))<0)return-1}else if(Ye!=je.charCodeAt(K++))return-1}return K}function T(se,ne,je){var K=u.exec(ne.slice(je));return K?(se.p=d.get(K[0].toLowerCase()),je+K[0].length):-1}function k(se,ne,je){var K=p.exec(ne.slice(je));return K?(se.w=v.get(K[0].toLowerCase()),je+K[0].length):-1}function O(se,ne,je){var K=f.exec(ne.slice(je));return K?(se.w=h.get(K[0].toLowerCase()),je+K[0].length):-1}function E(se,ne,je){var K=b.exec(ne.slice(je));return K?(se.m=x.get(K[0].toLowerCase()),je+K[0].length):-1}function R(se,ne,je){var K=m.exec(ne.slice(je));return K?(se.m=y.get(K[0].toLowerCase()),je+K[0].length):-1}function D(se,ne,je){return j(se,e,ne,je)}function V(se,ne,je){return j(se,n,ne,je)}function L(se,ne,je){return j(se,r,ne,je)}function z(se){return s[se.getDay()]}function M(se){return o[se.getDay()]}function $(se){return l[se.getMonth()]}function Q(se){return c[se.getMonth()]}function q(se){return i[+(se.getHours()>=12)]}function te(se){return 1+~~(se.getMonth()/3)}function xe(se){return s[se.getUTCDay()]}function B(se){return o[se.getUTCDay()]}function ce(se){return l[se.getUTCMonth()]}function he(se){return c[se.getUTCMonth()]}function U(se){return i[+(se.getUTCHours()>=12)]}function de(se){return 1+~~(se.getUTCMonth()/3)}return{format:function(se){var ne=_(se+="",w);return ne.toString=function(){return se},ne},parse:function(se){var ne=A(se+="",!1);return ne.toString=function(){return se},ne},utcFormat:function(se){var ne=_(se+="",S);return ne.toString=function(){return se},ne},utcParse:function(se){var ne=A(se+="",!0);return ne.toString=function(){return se},ne}}}var GD={"-":"",_:" ",0:"0"},Br=/^\s*\d+/,DTe=/^%/,$Te=/[\\^$*+?|[\]().{}]/g;function dn(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o[e.toLowerCase(),n]))}function FTe(t,e,n){var r=Br.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function BTe(t,e,n){var r=Br.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function UTe(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function zTe(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function HTe(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function KD(t,e,n){var r=Br.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function WD(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function VTe(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 GTe(t,e,n){var r=Br.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function KTe(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function qD(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function WTe(t,e,n){var r=Br.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function YD(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function qTe(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function YTe(t,e,n){var r=Br.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function QTe(t,e,n){var r=Br.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function XTe(t,e,n){var r=Br.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function JTe(t,e,n){var r=DTe.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function ZTe(t,e,n){var r=Br.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function eke(t,e,n){var r=Br.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function QD(t,e){return dn(t.getDate(),e,2)}function tke(t,e){return dn(t.getHours(),e,2)}function nke(t,e){return dn(t.getHours()%12||12,e,2)}function rke(t,e){return dn(1+dv.count(Qa(t),t),e,3)}function eW(t,e){return dn(t.getMilliseconds(),e,3)}function ike(t,e){return eW(t,e)+"000"}function oke(t,e){return dn(t.getMonth()+1,e,2)}function ske(t,e){return dn(t.getMinutes(),e,2)}function ake(t,e){return dn(t.getSeconds(),e,2)}function cke(t){var e=t.getDay();return e===0?7:e}function lke(t,e){return dn(wS.count(Qa(t)-1,t),e,2)}function tW(t){var e=t.getDay();return e>=4||e===0?xf(t):xf.ceil(t)}function uke(t,e){return t=tW(t),dn(xf.count(Qa(t),t)+(Qa(t).getDay()===4),e,2)}function dke(t){return t.getDay()}function fke(t,e){return dn(e0.count(Qa(t)-1,t),e,2)}function hke(t,e){return dn(t.getFullYear()%100,e,2)}function pke(t,e){return t=tW(t),dn(t.getFullYear()%100,e,2)}function mke(t,e){return dn(t.getFullYear()%1e4,e,4)}function gke(t,e){var n=t.getDay();return t=n>=4||n===0?xf(t):xf.ceil(t),dn(t.getFullYear()%1e4,e,4)}function vke(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+dn(e/60|0,"0",2)+dn(e%60,"0",2)}function XD(t,e){return dn(t.getUTCDate(),e,2)}function yke(t,e){return dn(t.getUTCHours(),e,2)}function xke(t,e){return dn(t.getUTCHours()%12||12,e,2)}function bke(t,e){return dn(1+bS.count(Xa(t),t),e,3)}function nW(t,e){return dn(t.getUTCMilliseconds(),e,3)}function wke(t,e){return nW(t,e)+"000"}function Ske(t,e){return dn(t.getUTCMonth()+1,e,2)}function Cke(t,e){return dn(t.getUTCMinutes(),e,2)}function _ke(t,e){return dn(t.getUTCSeconds(),e,2)}function Ake(t){var e=t.getUTCDay();return e===0?7:e}function jke(t,e){return dn(SS.count(Xa(t)-1,t),e,2)}function rW(t){var e=t.getUTCDay();return e>=4||e===0?bf(t):bf.ceil(t)}function Eke(t,e){return t=rW(t),dn(bf.count(Xa(t),t)+(Xa(t).getUTCDay()===4),e,2)}function Nke(t){return t.getUTCDay()}function Tke(t,e){return dn(t0.count(Xa(t)-1,t),e,2)}function kke(t,e){return dn(t.getUTCFullYear()%100,e,2)}function Pke(t,e){return t=rW(t),dn(t.getUTCFullYear()%100,e,2)}function Oke(t,e){return dn(t.getUTCFullYear()%1e4,e,4)}function Ike(t,e){var n=t.getUTCDay();return t=n>=4||n===0?bf(t):bf.ceil(t),dn(t.getUTCFullYear()%1e4,e,4)}function Rke(){return"+0000"}function JD(){return"%"}function ZD(t){return+t}function e$(t){return Math.floor(+t/1e3)}var Ju,iW,oW;Mke({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 Mke(t){return Ju=MTe(t),iW=Ju.format,Ju.parse,oW=Ju.utcFormat,Ju.utcParse,Ju}function Dke(t){return new Date(t)}function $ke(t){return t instanceof Date?+t:+new Date(+t)}function WP(t,e,n,r,i,o,s,c,l,u){var d=IP(),f=d.invert,h=d.domain,p=u(".%L"),v=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(_)<_?v: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(_,$ke)):h().map(Dke)},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(GK(A,_)):d},d.copy=function(){return uv(d,WP(t,e,n,r,i,o,s,c,l,u))},d}function Lke(){return $o.apply(WP(ITe,RTe,Qa,GP,wS,dv,HP,UP,ql,iW).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Fke(){return $o.apply(WP(PTe,OTe,Xa,KP,SS,bS,VP,zP,ql,oW).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function CS(){var t=0,e=1,n,r,i,o,s=xi,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,v;return arguments.length?([p,v]=h,s=f(p,v),u):[s(0),s(1)]}}return u.range=d(vh),u.rangeRound=d(OP),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 _l(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function sW(){var t=Cl(CS()(xi));return t.copy=function(){return _l(t,sW())},oc.apply(t,arguments)}function aW(){var t=DP(CS()).domain([1,10]);return t.copy=function(){return _l(t,aW()).base(t.base())},oc.apply(t,arguments)}function cW(){var t=$P(CS());return t.copy=function(){return _l(t,cW()).constant(t.constant())},oc.apply(t,arguments)}function qP(){var t=LP(CS());return t.copy=function(){return _l(t,qP()).exponent(t.exponent())},oc.apply(t,arguments)}function Bke(){return qP.apply(null,arguments).exponent(.5)}function lW(){var t=[],e=xi;function n(r){if(r!=null&&!isNaN(r=+r))return e((cv(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(Xc),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)=>jNe(t,o/r))},n.copy=function(){return lW(e).domain(t)},oc.apply(n,arguments)}function _S(){var t=0,e=.5,n=1,r=1,i,o,s,c,l,u=xi,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-o)*(r*me}var hW=Vke,Gke=AS,Kke=hW,Wke=gh;function qke(t){return t&&t.length?Gke(t,Wke,Kke):void 0}var Yke=qke;const Rc=hn(Yke);function Qke(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};lt.decimalPlaces=lt.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Hn;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};lt.dividedBy=lt.div=function(t){return Fa(this,new this.constructor(t))};lt.dividedToIntegerBy=lt.idiv=function(t){var e=this,n=e.constructor;return On(Fa(e,new n(t),0,1),n.precision)};lt.equals=lt.eq=function(t){return!this.cmp(t)};lt.exponent=function(){return vr(this)};lt.greaterThan=lt.gt=function(t){return this.cmp(t)>0};lt.greaterThanOrEqualTo=lt.gte=function(t){return this.cmp(t)>=0};lt.isInteger=lt.isint=function(){return this.e>this.d.length-2};lt.isNegative=lt.isneg=function(){return this.s<0};lt.isPositive=lt.ispos=function(){return this.s>0};lt.isZero=function(){return this.s===0};lt.lessThan=lt.lt=function(t){return this.cmp(t)<0};lt.lessThanOrEqualTo=lt.lte=function(t){return this.cmp(t)<1};lt.logarithm=lt.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(Ji))throw Error(Ro+"NaN");if(n.s<1)throw Error(Ro+(n.s?"NaN":"-Infinity"));return n.eq(Ji)?new r(0):(Kn=!1,e=Fa(tg(n,o),tg(t,o),o),Kn=!0,On(e,i))};lt.minus=lt.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?yW(e,t):gW(e,(t.s=-t.s,t))};lt.modulo=lt.mod=function(t){var e,n=this,r=n.constructor,i=r.precision;if(t=new r(t),!t.s)throw Error(Ro+"NaN");return n.s?(Kn=!1,e=Fa(n,t,0,1).times(t),Kn=!0,n.minus(e)):On(new r(n),i)};lt.naturalExponential=lt.exp=function(){return vW(this)};lt.naturalLogarithm=lt.ln=function(){return tg(this)};lt.negated=lt.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};lt.plus=lt.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?gW(e,t):yW(e,(t.s=-t.s,t))};lt.precision=lt.sd=function(t){var e,n,r,i=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(au+t);if(e=vr(i)+1,r=i.d.length-1,n=r*Hn+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};lt.squareRoot=lt.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(Ro+"NaN")}for(t=vr(c),Kn=!1,i=Math.sqrt(+c),i==0||i==1/0?(e=Us(c.d),(e.length+t)%2==0&&(e+="0"),i=Math.sqrt(e),t=xh((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(Fa(c,o,s+2)).times(.5),Us(o.d).slice(0,s)===(e=Us(r.d)).slice(0,s)){if(e=e.slice(s-3,s+1),i==s&&e=="4999"){if(On(o,n+1,0),o.times(o).eq(c)){r=o;break}}else if(e!="9999")break;s+=4}return Kn=!0,On(r,n)};lt.times=lt.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%Ir|0,e=c/Ir|0;o[i]=(o[i]+e)%Ir|0}for(;!o[--s];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,Kn?On(t,f.precision):t};lt.toDecimalPlaces=lt.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(sa(t,0,yh),e===void 0?e=r.rounding:sa(e,0,8),On(n,t+vr(n)+1,e))};lt.toExponential=function(t,e){var n,r=this,i=r.constructor;return t===void 0?n=Tu(r,!0):(sa(t,0,yh),e===void 0?e=i.rounding:sa(e,0,8),r=On(new i(r),t+1,e),n=Tu(r,!0,t+1)),n};lt.toFixed=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?Tu(i):(sa(t,0,yh),e===void 0?e=o.rounding:sa(e,0,8),r=On(new o(i),t+vr(i)+1,e),n=Tu(r.abs(),!1,t+vr(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};lt.toInteger=lt.toint=function(){var t=this,e=t.constructor;return On(new e(t),vr(t)+1,e.rounding)};lt.toNumber=function(){return+this};lt.toPower=lt.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(Ji);if(c=new l(c),!c.s){if(t.s<1)throw Error(Ro+"Infinity");return c}if(c.eq(Ji))return c;if(r=l.precision,t.eq(Ji))return On(c,r);if(e=t.e,n=t.d.length-1,s=e>=n,o=c.s,s){if((n=d<0?-d:d)<=mW){for(i=new l(Ji),e=Math.ceil(r/Hn+4),Kn=!1;n%2&&(i=i.times(c),r$(i.d,e)),n=xh(n/2),n!==0;)c=c.times(c),r$(c.d,e);return Kn=!0,t.s<0?new l(Ji).div(i):On(i,r)}}else if(o<0)throw Error(Ro+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,c.s=1,Kn=!1,i=t.times(tg(c,r+u)),Kn=!0,i=vW(i),i.s=o,i};lt.toPrecision=function(t,e){var n,r,i=this,o=i.constructor;return t===void 0?(n=vr(i),r=Tu(i,n<=o.toExpNeg||n>=o.toExpPos)):(sa(t,1,yh),e===void 0?e=o.rounding:sa(e,0,8),i=On(new o(i),t,e),n=vr(i),r=Tu(i,t<=n||n<=o.toExpNeg,t)),r};lt.toSignificantDigits=lt.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(sa(t,1,yh),e===void 0?e=r.rounding:sa(e,0,8)),On(new r(n),t,e)};lt.toString=lt.valueOf=lt.val=lt.toJSON=lt[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=vr(t),n=t.constructor;return Tu(t,e<=n.toExpNeg||e>=n.toExpPos)};function gW(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)),Kn?On(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/Hn),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)/Ir|0,l[o]%=Ir;for(n&&(l.unshift(n),++i),c=l.length;l[--c]==0;)l.pop();return e.d=l,e.e=i,Kn?On(e,f):e}function sa(t,e,n){if(t!==~~t||tn)throw Error(au+t)}function Us(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,v,m,y,b,x,w,S,C,_,A,j,T=r.constructor,k=r.s==i.s?1:-1,O=r.d,E=i.d;if(!r.s)return new T(r);if(!i.s)throw Error(Ro+"Division by zero");for(l=r.e-i.e,A=E.length,C=O.length,p=new T(k),v=p.d=[],u=0;E[u]==(O[u]||0);)++u;if(E[u]>(O[u]||0)&&--l,o==null?x=o=T.precision:s?x=o+(vr(r)-vr(i))+1:x=o,x<0)return new T(0);if(x=x/Hn+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=Ir/2&&++_;do d=0,c=e(E,m,A,y),c<0?(b=m[0],A!=y&&(b=b*Ir+(m[1]||0)),d=b/_|0,d>1?(d>=Ir&&(d=Ir-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(QP+vr(t));if(!t.s)return new d(Ji);for(e==null?(Kn=!1,c=f):c=e,s=new d(.03125);t.abs().gte(.1);)t=t.times(s),u+=5;for(r=Math.log(Dl(2,u))/Math.LN10*2+5|0,c+=r,n=i=o=new d(Ji),d.precision=c;;){if(i=On(i.times(t),c),n=n.times(++l),s=o.plus(Fa(i,n,c)),Us(s.d).slice(0,c)===Us(o.d).slice(0,c)){for(;u--;)o=On(o.times(o),c);return d.precision=f,e==null?(Kn=!0,On(o,f)):o}o=s}}function vr(t){for(var e=t.e*Hn,n=t.d[0];n>=10;n/=10)e++;return e}function p_(t,e,n){if(e>t.LN10.sd())throw Kn=!0,n&&(t.precision=n),Error(Ro+"LN10 precision limit exceeded");return On(new t(t.LN10),e)}function vc(t){for(var e="";t--;)e+="0";return e}function tg(t,e){var n,r,i,o,s,c,l,u,d,f=1,h=10,p=t,v=p.d,m=p.constructor,y=m.precision;if(p.s<1)throw Error(Ro+(p.s?"NaN":"-Infinity"));if(p.eq(Ji))return new m(0);if(e==null?(Kn=!1,u=y):u=e,p.eq(10))return e==null&&(Kn=!0),p_(m,u);if(u+=h,m.precision=u,n=Us(v),r=n.charAt(0),o=vr(p),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(t),n=Us(p.d),r=n.charAt(0),f++;o=vr(p),r>1?(p=new m("0."+n),o++):p=new m(r+"."+n.slice(1))}else return l=p_(m,u+2,y).times(o+""),p=tg(new m(r+"."+n.slice(1)),u-h).plus(l),m.precision=y,e==null?(Kn=!0,On(p,y)):p;for(c=s=p=Fa(p.minus(Ji),p.plus(Ji),u),d=On(p.times(p),u),i=3;;){if(s=On(s.times(d),u),l=c.plus(Fa(s,new m(i),u)),Us(l.d).slice(0,u)===Us(c.d).slice(0,u))return c=c.times(2),o!==0&&(c=c.plus(p_(m,u+2,y).times(o+""))),c=Fa(c,new m(f),u),m.precision=y,e==null?(Kn=!0,On(c,y)):c;c=l,i+=2}}function n$(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=xh(n/Hn),t.d=[],r=(n+1)%Hn,n<0&&(r+=Hn),rn0||t.e<-n0))throw Error(QP+n)}else t.s=0,t.e=0,t.d=[0];return t}function On(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+=Hn,i=e,u=f[d=0];else{if(d=Math.ceil((r+1)/Hn),o=f.length,d>=o)return t;for(u=o=f[d],s=1;o>=10;o/=10)s++;r%=Hn,i=r-Hn+s}if(n!==void 0&&(o=Dl(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/Dl(10,s-i):0:f[d-1])%10&1||n==(t.s<0?8:7))),e<1||!f[0])return l?(o=vr(t),f.length=1,e=e-o-1,f[0]=Dl(10,(Hn-e%Hn)%Hn),t.e=xh(-e/Hn)||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=Dl(10,Hn-r),f[d]=i>0?(u/Dl(10,s-i)%Dl(10,i)|0)*o:0),l)for(;;)if(d==0){(f[0]+=o)==Ir&&(f[0]=1,++t.e);break}else{if(f[d]+=o,f[d]!=Ir)break;f[d--]=0,o=1}for(r=f.length;f[--r]===0;)f.pop();if(Kn&&(t.e>n0||t.e<-n0))throw Error(QP+vr(t));return t}function yW(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),Kn?On(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/Hn),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)+vc(r):s>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+vc(-i-1)+o,n&&(r=n-s)>0&&(o+=vc(r))):i>=s?(o+=vc(i+1-s),n&&(r=n-i-1)>0&&(o=o+"."+vc(r))):((r=i+1)0&&(i+1===s&&(o+="."),o+=vc(r))),t.s<0?"-"+o:o}function r$(t,e){if(t.length>e)return t.length=e,!0}function xW(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(au+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 n$(s,o.toString())}else if(typeof o!="string")throw Error(au+o);if(o.charCodeAt(0)===45?(o=o.slice(1),s.s=-1):s.s=1,vPe.test(o))n$(s,o);else throw Error(au+o)}if(i.prototype=lt,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=xW,i.config=i.set=yPe,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(au+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(au+n+": "+r);return this}var XP=xW(gPe);Ji=new XP(1);const Cn=XP;function xPe(t){return CPe(t)||SPe(t)||wPe(t)||bPe()}function bPe(){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 wPe(t,e){if(t){if(typeof t=="string")return pj(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 pj(t,e)}}function SPe(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function CPe(t){if(Array.isArray(t))return pj(t)}function pj(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,i$(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 LPe(t){if(Array.isArray(t))return t}function _W(t){var e=ng(t,2),n=e[0],r=e[1],i=n,o=r;return n>r&&(i=r,o=n),[i,o]}function AW(t,e,n){if(t.lte(0))return new Cn(0);var r=NS.getDigitCount(t.toNumber()),i=new Cn(10).pow(r),o=t.div(i),s=r!==1?.05:.1,c=new Cn(Math.ceil(o.div(s).toNumber())).add(n).mul(s),l=c.mul(i);return e?l:new Cn(Math.ceil(l))}function FPe(t,e,n){var r=1,i=new Cn(t);if(!i.isint()&&n){var o=Math.abs(t);o<1?(r=new Cn(10).pow(NS.getDigitCount(t)-1),i=new Cn(Math.floor(i.div(r).toNumber())).mul(r)):o>1&&(i=new Cn(Math.floor(t)))}else t===0?i=new Cn(Math.floor((e-1)/2)):n||(i=new Cn(Math.floor(t)));var s=Math.floor((e-1)/2),c=EPe(jPe(function(l){return i.add(new Cn(l-s).mul(r)).toNumber()}),mj);return c(0,e)}function jW(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 Cn(0),tickMin:new Cn(0),tickMax:new Cn(0)};var o=AW(new Cn(e).sub(t).div(n-1),r,i),s;t<=0&&e>=0?s=new Cn(0):(s=new Cn(t).add(e).div(2),s=s.sub(new Cn(s).mod(o)));var c=Math.ceil(s.sub(t).div(o).toNumber()),l=Math.ceil(new Cn(e).sub(s).div(o).toNumber()),u=c+l+1;return u>n?jW(t,e,n,r,i+1):(u0?l+(n-u):l,c=e>0?c:c+(n-u)),{step:o,tickMin:s.sub(new Cn(c).mul(o)),tickMax:s.add(new Cn(l).mul(o))})}function BPe(t){var e=ng(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=_W([n,r]),l=ng(c,2),u=l[0],d=l[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(vj(mj(0,i-1).map(function(){return 1/0}))):[].concat(vj(mj(0,i-1).map(function(){return-1/0})),[d]);return n>r?gj(f):f}if(u===d)return FPe(u,i,o);var h=jW(u,d,s,o),p=h.step,v=h.tickMin,m=h.tickMax,y=NS.rangeStep(v,m.add(new Cn(.1).mul(p)),p);return n>r?gj(y):y}function UPe(t,e){var n=ng(t,2),r=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=_W([r,i]),c=ng(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=AW(new Cn(u).sub(l).div(d-1),o,0),h=[].concat(vj(NS.rangeStep(new Cn(l),new Cn(u).sub(new Cn(.99).mul(f)),f)),[u]);return r>i?gj(h):h}var zPe=SW(BPe),HPe=SW(UPe),VPe="Invariant failed";function ku(t,e){throw new Error(VPe)}var GPe=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];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 r0(){return r0=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 JPe(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 ZPe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function eOe(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(vi(f-d)!==vi(h-f)){var v=[];if(vi(h-f)===vi(l[1]-l[0])){p=h;var m=f+l[1]-l[0];v[0]=Math.min(m,(m+d)/2),v[1]=Math.max(m,(m+d)/2)}else{p=d;var y=h+l[1]-l[0];v[0]=Math.min(f,(y+f)/2),v[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>=v[0]&&e<=v[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},JP=function(e){var n,r=e,i=r.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?or(or({},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},vOe=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?or(or({},x),b[0].props):b[0].props,S=w.barSize,C=w[y];s[C]||(s[C]=[]);var _=Lt(S)?n:S;s[C].push({item:b[0],stackList:b.slice(1),barSize:Lt(_)?void 0:yi(_,r,0)})}}return s},yOe=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=yi(n,i,0,!0),d,f=[];if(s[0].barSize===+s[0].barSize){var h=!1,p=i/l,v=s.reduce(function(S,C){return S+C.barSize||0},0);v+=(l-1)*u,v>=i&&(v-=(l-1)*u,u=0),v>=i&&p>0&&(h=!0,p*=.9,v=l*p);var m=(i-v)/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(a$(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=yi(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(a$(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},xOe=function(e,n,r,i){var o=r.children,s=r.width,c=r.margin,l=s-(c.left||0)-(c.right||0),u=kW({children:o,legendWidth:l});if(u){var d=i||{},f=d.width,h=d.height,p=u.align,v=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&v==="middle")&&p!=="center"&&De(e[p]))return or(or({},e),{},Ld({},p,e[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&v!=="middle"&&De(e[v]))return or(or({},e),{},Ld({},v,e[v]+(h||0)))}return e},bOe=function(e,n,r){return Lt(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},PW=function(e,n,r,i,o){var s=n.props.children,c=ko(s,TS).filter(function(u){return bOe(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=ar(d,r);if(Lt(f))return u;var h=Array.isArray(f)?[jS(f),Rc(f)]:[f,f],p=l.reduce(function(v,m){var y=ar(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,v[0]),Math.max(x,v[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},wOe=function(e,n,r,i,o){var s=n.map(function(c){return PW(e,c,r,o,i)}).filter(function(c){return!Lt(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},OW=function(e,n,r,i,o){var s=n.map(function(l){var u=l.props.dataKey;return r==="number"&&u&&PW(e,l,u,i)||Dp(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?vi(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!fh(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}})},m_=new WeakMap,uy=function(e,n){if(typeof n!="function")return e;m_.has(e)||m_.set(e,new WeakMap);var r=m_.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},MW=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:Qm(),realScaleType:"band"}:s==="radial"&&c==="angleAxis"?{scale:Jb(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Mp(),realScaleType:"point"}:o==="category"?{scale:Qm(),realScaleType:"band"}:{scale:Jb(),realScaleType:"linear"};if(ov(i)){var l="scale".concat(fS(i));return{scale:(t$[l]||Mp)(),realScaleType:t$[l]?l:"point"}}return At(i)?{scale:i}:{scale:Mp(),realScaleType:"point"}},l$=1e-4,DW=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])-l$,s=Math.max(i[0],i[1])+l$,c=e(n[0]),l=e(n[r-1]);(cs||ls)&&e.domain([n[0],n[r-1]])}},SOe=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])}},AOe=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)}},jOe={sign:_Oe,expand:Gbe,none:hf,silhouette:Kbe,wiggle:Wbe,positive:AOe},EOe=function(e,n,r){var i=n.map(function(c){return c.props.dataKey}),o=jOe[r],s=Vbe().keys(i).value(function(c,l){return+ar(c,l,0)}).order(G1).offset(o);return s(e)},NOe=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,v=(p=h.type)!==null&&p!==void 0&&p.defaultProps?or(or({},h.type.defaultProps),h.props):h.props,m=v.stackId,y=v.hide;if(y)return f;var b=v[r],x=f[b]||{hasStack:!1,stackGroups:{}};if(kr(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[hh("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[h]};return or(or({},f),{},Ld({},b,x))},l),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var v={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,y){var b=p.stackGroups[y];return or(or({},m),{},Ld({},y,{numericAxisId:r,cateAxisId:i,items:b.items,stackedData:EOe(e,b.items,o)}))},v)}return or(or({},f),{},Ld({},h,p))},d)},$W=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=zPe(u,o,c);return e.domain([jS(d),Rc(d)]),{niceTicks:d}}if(o&&i==="number"){var f=e.domain(),h=HPe(f,o,c);return{niceTicks:h}}return null};function u$(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&&!Lt(i[e.dataKey])){var c=Pb(n,"value",i[e.dataKey]);if(c)return c.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var l=ar(i,Lt(s)?e.dataKey:s);return Lt(l)?null:e.scale(l)}var d$=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=ar(s,n.dataKey,n.domain[c]);return Lt(l)?null:n.scale(l)-o/2+i},TOe=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]},kOe=function(e,n){var r,i=(r=e.type)!==null&&r!==void 0&&r.defaultProps?or(or({},e.type.defaultProps),e.props):e.props,o=i.stackId;if(kr(o)){var s=n[o];if(s){var c=s.items.indexOf(e);return c>=0?s.stackedData[c]:null}}return null},POe=function(e){return e.reduce(function(n,r){return[jS(r.concat([n[0]]).filter(De)),Rc(r.concat([n[1]]).filter(De))]},[1/0,-1/0])},LW=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=POe(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})},f$=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,h$=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,wj=function(e,n,r){if(At(e))return e(n,r);if(!Array.isArray(e))return n;var i=[];if(De(e[0]))i[0]=r?e[0]:Math.min(e[0],n[0]);else if(f$.test(e[0])){var o=+f$.exec(e[0])[1];i[0]=n[0]-o}else At(e[0])?i[0]=e[0](n[0]):i[0]=n[0];if(De(e[1]))i[1]=r?e[1]:Math.max(e[1],n[1]);else if(h$.test(e[1])){var s=+h$.exec(e[1])[1];i[1]=n[1]+s}else At(e[1])?i[1]=e[1](n[1]):i[1]=n[1];return i},o0=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=jP(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},zW=function(e,n,r,i,o){var s=e.width,c=e.height,l=e.startAngle,u=e.endAngle,d=yi(e.cx,s,s/2),f=yi(e.cy,c,c/2),h=UW(s,c,r),p=yi(e.innerRadius,h,0),v=yi(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(Lt(x.range))i==="angleAxis"?C=[l,u]:i==="radiusAxis"&&(C=[p,v]),S&&(C=[C[1],C[0]]);else{C=x.range;var _=C,A=ROe(_,2);l=A[0],u=A[1]}var j=MW(x,o),T=j.realScaleType,k=j.scale;k.domain(w).range(C),DW(k);var O=$W(k,Sa(Sa({},x),{},{realScaleType:T})),E=Sa(Sa(Sa({},x),O),{},{range:C,radius:v,realScaleType:T,scale:k,cx:d,cy:f,innerRadius:p,outerRadius:v,startAngle:l,endAngle:u});return Sa(Sa({},y),{},BW({},b,E))},{})},BOe=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))},UOe=function(e,n){var r=e.x,i=e.y,o=n.cx,s=n.cy,c=BOe({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:FOe(u),angleInRadian:u}},zOe=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}},HOe=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},v$=function(e,n){var r=e.x,i=e.y,o=UOe({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=zOe(n),f=d.startAngle,h=d.endAngle,p=c,v;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 v?Sa(Sa({},n),{},{radius:s,angle:HOe(p,n)}):null},HW=function(e){return!g.isValidElement(e)&&!At(e)&&typeof e!="boolean"?e.className:""};function sg(t){"@babel/helpers - typeof";return sg=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},sg(t)}var VOe=["offset"];function GOe(t){return YOe(t)||qOe(t)||WOe(t)||KOe()}function KOe(){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 WOe(t,e){if(t){if(typeof t=="string")return Sj(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 Sj(t,e)}}function qOe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function YOe(t){if(Array.isArray(t))return Sj(t)}function Sj(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 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 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 xr(t){for(var e=1;e=0?1:-1,w,S;i==="insideStart"?(w=p+x*s,S=m):i==="insideEnd"?(w=v-x*s,S=!m):i==="end"&&(w=v+x*s,S=m),S=b<=0?S:!S;var C=fn(u,d,y,w),_=fn(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=Lt(e.id)?hh("recharts-radial-line-"):e.id;return N.createElement("text",ag({},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))},iIe=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=fn(s,c,u+r,h),v=p.x,m=p.y;return{x:v,y:m,textAnchor:v>=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=fn(s,c,y,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},oIe=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",v=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 xr(xr({},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:v};return xr(xr({},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 xr(xr({},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 xr(xr({},_),r?{width:Math.max(r.x+r.width-_.x,0),height:d}:{})}var A=r?{width:u,height:d}:{};return o==="insideLeft"?xr({x:c+y,y:l+d/2,textAnchor:x,verticalAnchor:"middle"},A):o==="insideRight"?xr({x:c+u-y,y:l+d/2,textAnchor:b,verticalAnchor:"middle"},A):o==="insideTop"?xr({x:c+u/2,y:l+h,textAnchor:"middle",verticalAnchor:v},A):o==="insideBottom"?xr({x:c+u/2,y:l+d-h,textAnchor:"middle",verticalAnchor:p},A):o==="insideTopLeft"?xr({x:c+y,y:l+h,textAnchor:x,verticalAnchor:v},A):o==="insideTopRight"?xr({x:c+u-y,y:l+h,textAnchor:b,verticalAnchor:v},A):o==="insideBottomLeft"?xr({x:c+y,y:l+d-h,textAnchor:x,verticalAnchor:p},A):o==="insideBottomRight"?xr({x:c+u-y,y:l+d-h,textAnchor:b,verticalAnchor:p},A):ch(o)&&(De(o.x)||Kl(o.x))&&(De(o.y)||Kl(o.y))?xr({x:c+yi(o.x,u),y:l+yi(o.y,d),textAnchor:"end",verticalAnchor:"end"},A):xr({x:c+u/2,y:l+d/2,textAnchor:"middle",verticalAnchor:"middle"},A)},sIe=function(e){return"cx"in e&&De(e.cx)};function $r(t){var e=t.offset,n=e===void 0?5:e,r=QOe(t,VOe),i=xr({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||Lt(c)&&Lt(l)&&!g.isValidElement(u)&&!At(u))return null;if(g.isValidElement(u))return g.cloneElement(u,i);var p;if(At(u)){if(p=g.createElement(u,i),g.isValidElement(p))return p}else p=tIe(i);var v=sIe(o),m=ft(i,!0);if(v&&(s==="insideStart"||s==="insideEnd"||s==="end"))return rIe(i,p,m);var y=v?iIe(i):oIe(i);return N.createElement(Eu,ag({className:Mt("recharts-label",f)},m,y,{breakAll:h}),p)}$r.displayName="Label";var VW=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,v=e.left,m=e.width,y=e.height,b=e.clockWise,x=e.labelViewBox;if(x)return x;if(De(m)&&De(y)){if(De(f)&&De(h))return{x:f,y:h,width:m,height:y};if(De(p)&&De(v))return{x:p,y:v,width:m,height:y}}return De(f)&&De(h)?{x:f,y:h,width:0,height:0}:De(n)&&De(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:{}},aIe=function(e,n){return e?e===!0?N.createElement($r,{key:"label-implicit",viewBox:n}):kr(e)?N.createElement($r,{key:"label-implicit",viewBox:n,value:e}):g.isValidElement(e)?e.type===$r?g.cloneElement(e,{key:"label-implicit",viewBox:n}):N.createElement($r,{key:"label-implicit",content:e,viewBox:n}):At(e)?N.createElement($r,{key:"label-implicit",content:e,viewBox:n}):ch(e)?N.createElement($r,ag({viewBox:n},e,{key:"label-implicit"})):null:null},cIe=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=VW(e),s=ko(i,$r).map(function(l,u){return g.cloneElement(l,{viewBox:n||o,key:"label-".concat(u)})});if(!r)return s;var c=aIe(e.label,n||o);return[c].concat(GOe(s))};$r.parseViewBox=VW;$r.renderCallByParent=cIe;function lIe(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var uIe=lIe;const GW=hn(uIe);function cg(t){"@babel/helpers - typeof";return cg=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},cg(t)}var dIe=["valueAccessor"],fIe=["data","dataKey","clockWise","id","textBreakAll"];function hIe(t){return vIe(t)||gIe(t)||mIe(t)||pIe()}function pIe(){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 mIe(t,e){if(t){if(typeof t=="string")return Cj(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 Cj(t,e)}}function gIe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function vIe(t){if(Array.isArray(t))return Cj(t)}function Cj(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 wIe(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 SIe=function(e){return Array.isArray(e.value)?GW(e.value):e.value};function Js(t){var e=t.valueAccessor,n=e===void 0?SIe:e,r=w$(t,dIe),i=r.data,o=r.dataKey,s=r.clockWise,c=r.id,l=r.textBreakAll,u=w$(r,fIe);return!i||!i.length?null:N.createElement(tn,{className:"recharts-label-list"},i.map(function(d,f){var h=Lt(o)?n(d,f):ar(d&&d.payload,o),p=Lt(c)?{}:{id:"".concat(c,"-").concat(f)};return N.createElement($r,a0({},ft(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:l,viewBox:$r.parseViewBox(Lt(s)?d:b$(b$({},d),{},{clockWise:s})),key:"label-".concat(f),index:f}))}))}Js.displayName="LabelList";function CIe(t,e){return t?t===!0?N.createElement(Js,{key:"labelList-implicit",data:e}):N.isValidElement(t)||At(t)?N.createElement(Js,{key:"labelList-implicit",data:e,content:t}):ch(t)?N.createElement(Js,a0({data:e},t,{key:"labelList-implicit"})):null:null}function _Ie(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=ko(r,Js).map(function(s,c){return g.cloneElement(s,{data:e,key:"labelList-".concat(c)})});if(!n)return i;var o=CIe(t.label,e);return[o].concat(hIe(i))}Js.renderCallByParent=_Ie;function lg(t){"@babel/helpers - typeof";return lg=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},lg(t)}function _j(){return _j=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=fn(n,r,i,s),v=fn(n,r,i,u);h+="L ".concat(v.x,",").concat(v.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},TIe=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=vi(d-u),h=dy({cx:n,cy:r,radius:o,angle:u,sign:f,cornerRadius:s,cornerIsExternal:l}),p=h.circleTangency,v=h.lineTangency,m=h.theta,y=dy({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(v.x,",").concat(v.y,` - a`).concat(s,",").concat(s,",0,0,1,").concat(s*2,`,0 - a`).concat(s,",").concat(s,",0,0,1,").concat(-s*2,`,0 - `):KW({cx:n,cy:r,innerRadius:i,outerRadius:o,startAngle:u,endAngle:d});var C="M ".concat(v.x,",").concat(v.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` - A`).concat(o,",").concat(o,",0,").concat(+(S>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` - A`).concat(s,",").concat(s,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,` - `);if(i>0){var _=dy({cx:n,cy:r,radius:i,angle:u,sign:f,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),A=_.circleTangency,j=_.lineTangency,T=_.theta,k=dy({cx:n,cy:r,radius:i,angle:d,sign:-f,isExternal:!0,cornerRadius:s,cornerIsExternal:l}),O=k.circleTangency,E=k.lineTangency,R=k.theta,D=l?Math.abs(u-d):Math.abs(u-d)-T-R;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},kIe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},WW=function(e){var n=C$(C$({},kIe),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=TIe({cx:r,cy:i,innerRadius:o,outerRadius:s,cornerRadius:Math.min(m,v/2),forceCornerRadius:l,cornerIsExternal:u,startAngle:d,endAngle:f}):y=KW({cx:r,cy:i,innerRadius:o,outerRadius:s,startAngle:d,endAngle:f}),N.createElement("path",_j({},ft(n,!0),{className:p,d:y,role:"img"}))};function ug(t){"@babel/helpers - typeof";return ug=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},ug(t)}function Aj(){return Aj=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 GIe(t,e){return bh(t.getTime(),e.getTime())}function P$(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],v=c.value,m=v[0],y=v[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 KIe(t,e,n){var r=k$(t),i=r.length;if(k$(e).length!==i)return!1;for(var o;i-- >0;)if(o=r[i],o===JW&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!XW(e,o)||!n.equals(t[o],e[o],o,o,t,e,n))return!1;return!0}function Qh(t,e,n){var r=N$(t),i=r.length;if(N$(e).length!==i)return!1;for(var o,s,c;i-- >0;)if(o=r[i],o===JW&&(t.$$typeof||e.$$typeof)&&t.$$typeof!==e.$$typeof||!XW(e,o)||!n.equals(t[o],e[o],o,o,t,e,n)||(s=T$(t,o),c=T$(e,o),(s||c)&&(!s||!c||s.configurable!==c.configurable||s.enumerable!==c.enumerable||s.writable!==c.writable)))return!1;return!0}function WIe(t,e){return bh(t.valueOf(),e.valueOf())}function qIe(t,e){return t.source===e.source&&t.flags===e.flags}function O$(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 YIe(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 QIe="[object Arguments]",XIe="[object Boolean]",JIe="[object Date]",ZIe="[object Map]",eRe="[object Number]",tRe="[object Object]",nRe="[object RegExp]",rRe="[object Set]",iRe="[object String]",oRe=Array.isArray,I$=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,R$=Object.assign,sRe=Object.prototype.toString.call.bind(Object.prototype.toString);function aRe(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(oRe(d))return e(d,f,h);if(I$!=null&&I$(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 v=sRe(d);return v===JIe?n(d,f,h):v===nRe?s(d,f,h):v===ZIe?r(d,f,h):v===rRe?c(d,f,h):v===tRe?typeof d.then!="function"&&typeof f.then!="function"&&i(d,f,h):v===QIe?i(d,f,h):v===XIe||v===eRe||v===iRe?o(d,f,h):!1}}function cRe(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,i={areArraysEqual:r?Qh:VIe,areDatesEqual:GIe,areMapsEqual:r?E$(P$,Qh):P$,areObjectsEqual:r?Qh:KIe,arePrimitiveWrappersEqual:WIe,areRegExpsEqual:qIe,areSetsEqual:r?E$(O$,Qh):O$,areTypedArraysEqual:r?Qh:YIe};if(n&&(i=R$({},i,n(i))),e){var o=hy(i.areArraysEqual),s=hy(i.areMapsEqual),c=hy(i.areObjectsEqual),l=hy(i.areSetsEqual);i=R$({},i,{areArraysEqual:o,areMapsEqual:s,areObjectsEqual:c,areSetsEqual:l})}return i}function lRe(t){return function(e,n,r,i,o,s,c){return t(e,n,c)}}function uRe(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 dRe=Al();Al({strict:!0});Al({circular:!0});Al({circular:!0,strict:!0});Al({createInternalComparator:function(){return bh}});Al({strict:!0,createInternalComparator:function(){return bh}});Al({circular:!0,createInternalComparator:function(){return bh}});Al({circular:!0,createInternalComparator:function(){return bh},strict:!0});function Al(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=cRe(t),l=aRe(c),u=r?r(l):lRe(l);return uRe({circular:n,comparator:l,createState:i,equals:u,strict:s})}function fRe(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function M$(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):fRe(i)};requestAnimationFrame(r)}function jj(t){"@babel/helpers - typeof";return jj=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},jj(t)}function hRe(t){return vRe(t)||gRe(t)||mRe(t)||pRe()}function pRe(){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 mRe(t,e){if(t){if(typeof t=="string")return D$(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 D$(t,e)}}function D$(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,v=h*o,m=h+(p-v)*c/1e3,y=h*c/1e3+d;return Math.abs(y-f)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 qRe(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o=0)&&(n[i]=t[i]);return n}function g_(t){return JRe(t)||XRe(t)||QRe(t)||YRe()}function YRe(){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 QRe(t,e){if(t){if(typeof t=="string")return Pj(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 Pj(t,e)}}function XRe(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function JRe(t){if(Array.isArray(t))return Pj(t)}function Pj(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function u0(t){return u0=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},u0(t)}var ws=function(t){r2e(n,t);var e=i2e(n);function n(r,i){var o;ZRe(this,n),o=e.call(this,r,i);var s=o.props,c=s.isActive,l=s.attributeName,u=s.from,d=s.to,f=s.steps,h=s.children,p=s.duration;if(o.handleStyleChange=o.handleStyleChange.bind(Rj(o)),o.changeStyle=o.changeStyle.bind(Rj(o)),!c||p<=0)return o.state={style:{}},typeof h=="function"&&(o.state={style:d}),Ij(o);if(f&&f.length)o.state={style:f[0].style};else if(u){if(typeof h=="function")return o.state={style:u},Ij(o);o.state={style:l?dp({},l,u):u}}else o.state={style:{}};return o}return t2e(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,s=i.canBegin;this.mounted=!0,!(!o||!s)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,s=o.isActive,c=o.canBegin,l=o.attributeName,u=o.shouldReAnimate,d=o.to,f=o.from,h=this.state.style;if(c){if(!s){var p={style:l?dp({},l,d):d};this.state&&h&&(l&&h[l]!==d||!l&&h!==d)&&this.setState(p);return}if(!(dRe(i.to,d)&&i.canBegin&&i.isActive)){var v=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=v||u?f:i.to;if(this.state&&h){var y={style:l?dp({},l,m):m};(l&&h[l]!==m||!l&&h!==m)&&this.setState(y)}this.runAnimation(Uo(Uo({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,s=i.from,c=i.to,l=i.duration,u=i.easing,d=i.begin,f=i.onAnimationEnd,h=i.onAnimationStart,p=GRe(s,c,RRe(u),l,this.changeStyle),v=function(){o.stopJSAnimation=p()};this.manager.start([h,d,v,l,f])}},{key:"runStepAnimation",value:function(i){var o=this,s=i.steps,c=i.begin,l=i.onAnimationStart,u=s[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,y,b){if(b===0)return m;var x=y.duration,w=y.easing,S=w===void 0?"ease":w,C=y.style,_=y.properties,A=y.onAnimationEnd,j=b>0?s[b-1]:y,T=_||Object.keys(C);if(typeof S=="function"||S==="spring")return[].concat(g_(m),[o.runJSAnimation.bind(o,{from:j.style,to:C,duration:x,easing:S}),x]);var k=F$(T,x,S),O=Uo(Uo(Uo({},j.style),C),{},{transition:k});return[].concat(g_(m),[O,x,A]).filter(SRe)};return this.manager.start([l].concat(g_(s.reduce(p,[d,Math.max(h,c)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=yRe());var o=i.begin,s=i.duration,c=i.attributeName,l=i.to,u=i.easing,d=i.onAnimationStart,f=i.onAnimationEnd,h=i.steps,p=i.children,v=this.manager;if(this.unSubscribe=v.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(i);return}if(h.length>1){this.runStepAnimation(i);return}var m=c?dp({},c,l):l,y=F$(Object.keys(m),s,u);v.start([d,o,Uo(Uo({},m),{},{transition:y}),s,f])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var s=i.duration;i.attributeName,i.easing;var c=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var l=WRe(i,KRe),u=g.Children.count(o),d=this.state.style;if(typeof o=="function")return o(d);if(!c||u===0||s<=0)return o;var f=function(p){var v=p.props,m=v.style,y=m===void 0?{}:m,b=v.className,x=g.cloneElement(p,Uo(Uo({},l),{},{style:Uo(Uo({},y),d),className:b}));return x};return u===1?f(g.Children.only(o)):N.createElement("div",null,g.Children.map(o,function(h){return f(h)}))}}]),n}(g.PureComponent);ws.displayName="Animate";ws.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};ws.propTypes={from:Gt.oneOfType([Gt.object,Gt.string]),to:Gt.oneOfType([Gt.object,Gt.string]),attributeName:Gt.string,duration:Gt.number,begin:Gt.number,easing:Gt.oneOfType([Gt.string,Gt.func]),steps:Gt.arrayOf(Gt.shape({duration:Gt.number.isRequired,style:Gt.object.isRequired,easing:Gt.oneOfType([Gt.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Gt.func]),properties:Gt.arrayOf("string"),onAnimationEnd:Gt.func})),children:Gt.oneOfType([Gt.node,Gt.func]),isActive:Gt.bool,canBegin:Gt.bool,onAnimationEnd:Gt.func,shouldReAnimate:Gt.bool,onAnimationStart:Gt.func,onAnimationReStart:Gt.func};Gt.object,Gt.object,Gt.object,Gt.element;Gt.object,Gt.object,Gt.object,Gt.oneOfType([Gt.array,Gt.element]),Gt.any;function hg(t){"@babel/helpers - typeof";return hg=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},hg(t)}function d0(){return d0=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?1:-1,l=r>=0?1:-1,u=i>=0&&r>=0||i<0&&r<0?1:0,d;if(s>0&&o instanceof Array){for(var f=[0,0,0,0],h=0,p=4;hs?s:o[h];d="M".concat(e,",").concat(n+c*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(e+l*f[0],",").concat(n)),d+="L ".concat(e+r-l*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, - `).concat(e+r,",").concat(n+c*f[1])),d+="L ".concat(e+r,",").concat(n+i-c*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, - `).concat(e+r-l*f[2],",").concat(n+i)),d+="L ".concat(e+l*f[3],",").concat(n+i),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, - `).concat(e,",").concat(n+i-c*f[3])),d+="Z"}else if(s>0&&o===+o&&o>0){var v=Math.min(s,o);d="M ".concat(e,",").concat(n+c*v,` - A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(e+l*v,",").concat(n,` - L `).concat(e+r-l*v,",").concat(n,` - A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(e+r,",").concat(n+c*v,` - L `).concat(e+r,",").concat(n+i-c*v,` - A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(e+r-l*v,",").concat(n+i,` - L `).concat(e+l*v,",").concat(n+i,` - A `).concat(v,",").concat(v,",0,0,").concat(u,",").concat(e,",").concat(n+i-c*v," Z")}else d="M ".concat(e,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return d},p2e=function(e,n){if(!e||!n)return!1;var r=e.x,i=e.y,o=n.x,s=n.y,c=n.width,l=n.height;if(Math.abs(c)>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},m2e={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},ZP=function(e){var n=W$(W$({},m2e),e),r=g.useRef(),i=g.useState(-1),o=s2e(i,2),s=o[0],c=o[1];g.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,v=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(ws,{canBegin:s>0,from:{width:d,height:f,x:l,y:u},to:{width:d,height:f,x:l,y:u},duration:m,animationEasing:v,isActive:x},function(S){var C=S.width,_=S.height,A=S.x,j=S.y;return N.createElement(ws,{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:v},N.createElement("path",d0({},ft(n,!0),{className:w,d:q$(A,j,C,_,h),ref:r})))}):N.createElement("path",d0({},ft(n,!0),{className:w,d:q$(l,u,d,f,h)}))},g2e=["points","className","baseLinePoints","connectNulls"];function yd(){return yd=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 y2e(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 Y$(t){return S2e(t)||w2e(t)||b2e(t)||x2e()}function x2e(){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 b2e(t,e){if(t){if(typeof t=="string")return Mj(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 Mj(t,e)}}function w2e(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function S2e(t){if(Array.isArray(t))return Mj(t)}function Mj(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){Q$(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),Q$(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Lp=function(e,n){var r=C2e(e);n&&(r=[r.reduce(function(o,s){return[].concat(Y$(o),Y$(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},_2e=function(e,n,r){var i=Lp(e,r);return"".concat(i.slice(-1)==="Z"?i.slice(0,-1):i,"L").concat(Lp(n.reverse(),r).slice(1))},oq=function(e){var n=e.points,r=e.className,i=e.baseLinePoints,o=e.connectNulls,s=v2e(e,g2e);if(!n||!n.length)return null;var c=Mt("recharts-polygon",r);if(i&&i.length){var l=s.stroke&&s.stroke!=="none",u=_2e(n,i,o);return N.createElement("g",{className:c},N.createElement("path",yd({},ft(s,!0),{fill:u.slice(-1)==="Z"?s.fill:"none",stroke:"none",d:u})),l?N.createElement("path",yd({},ft(s,!0),{fill:"none",d:Lp(n,o)})):null,l?N.createElement("path",yd({},ft(s,!0),{fill:"none",d:Lp(i,o)})):null)}var d=Lp(n,o);return N.createElement("path",yd({},ft(s,!0),{fill:d.slice(-1)==="Z"?s.fill:"none",className:c,d}))};function Dj(){return Dj=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 P2e(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 O2e=function(e,n,r,i,o,s){return"M".concat(e,",").concat(o,"v").concat(i,"M").concat(s,",").concat(n,"h").concat(r)},I2e=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,v=e.className,m=k2e(e,A2e),y=j2e({x:r,y:o,top:c,left:u,width:f,height:p},m);return!De(r)||!De(o)||!De(f)||!De(p)||!De(c)||!De(u)?null:N.createElement("path",$j({},ft(y,!0),{className:Mt("recharts-cross",v),d:O2e(r,o,f,p,c,u)}))},R2e=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function mg(t){"@babel/helpers - typeof";return mg=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},mg(t)}function M2e(t,e){if(t==null)return{};var n=D2e(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 D2e(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 Ja(){return Ja=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 oMe(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 sMe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tL(t,e){for(var n=0;niL?s=i==="outer"?"start":"end":o<-iL?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=kl(kl({},ft(this.props,!1)),{},{fill:"none"},ft(c,!1));if(l==="circle")return N.createElement(fv,$l({className:"recharts-polar-angle-axis-line"},u,{cx:i,cy:o,r:s}));var d=this.props.ticks,f=d.map(function(h){return fn(i,o,s,h.coordinate)});return N.createElement(oq,$l({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=ft(this.props,!1),f=ft(s,!1),h=kl(kl({},d),{},{fill:"none"},ft(c,!1)),p=o.map(function(v,m){var y=r.getTickLineCoord(v),b=r.getTickTextAnchor(v),x=kl(kl(kl({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:v,x:y.x2,y:y.y2});return N.createElement(tn,$l({className:Mt("recharts-polar-angle-axis-tick",HW(s)),key:"tick-".concat(v.coordinate)},ju(r.props,v,m)),c&&N.createElement("line",$l({className:"recharts-polar-angle-axis-tick-line"},h,y)),s&&e.renderTickItem(s,x,l?l(v.value,m):v.value))});return N.createElement(tn,{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(tn,{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):At(r)?s=r(i):s=N.createElement(Eu,$l({},i,{className:"recharts-polar-angle-axis-tick-value"}),o),s}}])}(g.PureComponent);PS(Sh,"displayName","PolarAngleAxis");PS(Sh,"axisType","angleAxis");PS(Sh,"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 wMe=lK,SMe=wMe(Object.getPrototypeOf,Object),CMe=SMe,_Me=rc,AMe=CMe,jMe=ic,EMe="[object Object]",NMe=Function.prototype,TMe=Object.prototype,dq=NMe.toString,kMe=TMe.hasOwnProperty,PMe=dq.call(Object);function OMe(t){if(!jMe(t)||_Me(t)!=EMe)return!1;var e=AMe(t);if(e===null)return!0;var n=kMe.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&dq.call(n)==PMe}var IMe=OMe;const RMe=hn(IMe);var MMe=rc,DMe=ic,$Me="[object Boolean]";function LMe(t){return t===!0||t===!1||DMe(t)&&MMe(t)==$Me}var FMe=LMe;const BMe=hn(FMe);function vg(t){"@babel/helpers - typeof";return vg=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},vg(t)}function p0(){return p0=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:v,isActive:b},function(w){var S=w.upperWidth,C=w.lowerWidth,_=w.height,A=w.x,j=w.y;return N.createElement(ws,{canBegin:s>0,from:"0px ".concat(s===-1?1:s,"px"),to:"".concat(s,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:m,easing:v},N.createElement("path",p0({},ft(n,!0),{className:x,d:cL(A,j,S,C,_),ref:r})))}):N.createElement("g",null,N.createElement("path",p0({},ft(n,!0),{className:x,d:cL(l,u,d,f,h)})))},XMe=["option","shapeType","propTransformer","activeClassName","isActive"];function yg(t){"@babel/helpers - typeof";return yg=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},yg(t)}function JMe(t,e){if(t==null)return{};var n=ZMe(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 ZMe(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 lL(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 m0(t){for(var e=1;e0?oo(w,"paddingAngle",0):0;if(C){var A=Dr(C.endAngle-C.startAngle,w.endAngle-w.startAngle),j=Mn(Mn({},w),{},{startAngle:x+_,endAngle:x+A(m)+_});y.push(j),x=j.endAngle}else{var T=w.endAngle,k=w.startAngle,O=Dr(0,T-k),E=O(m),R=Mn(Mn({},w),{},{startAngle:x+_,endAngle:x+E+_});y.push(R),x=R.endAngle}}),N.createElement(tn,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||!Nu(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,v=this.state.isAnimationFinished;if(o||!s||!s.length||!De(u)||!De(d)||!De(f)||!De(h))return null;var m=Mt("recharts-pie",c);return N.createElement(tn,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),l&&this.renderLabels(s),$r.renderCallByParent(this.props,null,!1),(!p||v)&&Js.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,T){var k=ar(T,b,0);return j+(De(k)?k:0)},0),_;if(C>0){var A;_=i.map(function(j,T){var k=ar(j,b,0),O=ar(j,d,T),E=(De(k)?k:0)/C,R;T?R=A.endAngle+vi(m)*l*(k!==0?1:0):R=s;var D=R+vi(m)*((k!==0?p:0)+E*S),V=(R+D)/2,L=(v.innerRadius+v.outerRadius)/2,z=[{name:O,value:k,payload:j,dataKey:b,type:h}],M=fn(v.cx,v.cy,L,V);return A=Mn(Mn(Mn({percent:E,cornerRadius:o,name:O,tooltipPayload:z,midAngle:V,middleRadius:L,tooltipPosition:M},j),v),{},{value:ar(j,b),startAngle:R,endAngle:D,payload:j,paddingAngle:vi(m)*l}),A})}return Mn(Mn({},v),{},{sectors:_,data:i})});function bDe(t){return t&&t.length?t[0]:void 0}var wDe=bDe,SDe=wDe;const CDe=hn(SDe);var _De=["key"];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 ADe(t,e){if(t==null)return{};var n=jDe(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 jDe(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 v0(){return v0=Object.assign?Object.assign.bind():function(t){for(var e=1;e=2&&(l=!0),u.push(di(di({},fn(s,c,x,y)),{},{name:v,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=CDe(h.value),v=Lt(p)?void 0:e.scale(p);f.push(di(di({},h),{},{radius:v},fn(s,c,v,h.angle)))}else f.push(h)}),{points:u,isRange:l,baseLinePoints:f}});var RDe=Math.ceil,MDe=Math.max;function DDe(t,e,n,r){for(var i=-1,o=MDe(RDe((e-t)/(n||1)),0),s=Array(o);o--;)s[r?o:++i]=t,t+=n;return s}var $De=DDe,LDe=NK,mL=1/0,FDe=17976931348623157e292;function BDe(t){if(!t)return t===0?t:0;if(t=LDe(t),t===mL||t===-mL){var e=t<0?-1:1;return e*FDe}return t===t?t:0}var vq=BDe,UDe=$De,zDe=yS,v_=vq;function HDe(t){return function(e,n,r){return r&&typeof r!="number"&&zDe(e,n,r)&&(n=r=void 0),e=v_(e),n===void 0?(n=e,e=0):n=v_(n),r=r===void 0?e0&&r.handleDrag(i.changedTouches[0])}),Gi(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()}),Gi(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Gi(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Gi(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Gi(r,"handleSlideDragStart",function(i){var o=bL(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 r$e(e,t),ZDe(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),v=e.getIndexInRange(s,h);return{startIndex:p-p%l,endIndex:v===d?d:v-v%l}}},{key:"getTextOfTick",value:function(r){var i=this.props,o=i.data,s=i.tickFormatter,c=i.dataKey,l=ar(o[r],c,r);return At(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,v=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)&&v&&v(y),this.setState({startX:s+m,endX:c+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var o=bL(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,v=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(Gi(Gi({},s,u+x),"brushMoveStartX",r.pageX),function(){v&&_()&&v(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(Gi({},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=g.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,v=l.data,m=l.startIndex,y=l.endIndex,b=Math.max(r,this.props.x),x=y_(y_({},ft(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((o=v[m])===null||o===void 0?void 0:o.name,", Max value: ").concat((s=v[y])===null||s===void 0?void 0:s.name);return N.createElement(tn,{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,v={pointerEvents:"none",fill:u};return N.createElement(tn,{className:"recharts-brush-texts"},N.createElement(Eu,b0({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:s+c/2},v),this.getTextOfTick(i)),N.createElement(Eu,b0({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+l+p,y:s+c/2},v),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,v=h.endX,m=h.isTextActive,y=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!i||!i.length||!De(c)||!De(l)||!De(u)||!De(d)||u<=0||d<=0)return null;var w=Mt("recharts-brush",o),S=N.Children.count(s)===1,C=XDe("userSelect","none");return N.createElement(tn,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:C},this.renderBackground(),S&&this.renderPanorama(),this.renderSlide(p,v),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(v,"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):At(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 y_({prevData:o,prevTravellerWidth:l,prevUpdateId:u,prevX:c,prevWidth:s},o&&o.length?o$e({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}}])}(g.PureComponent);Gi(Nf,"displayName","Brush");Gi(Nf,"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 s$e=AP;function a$e(t,e){var n;return s$e(t,function(r,i,o){return n=e(r,i,o),!n}),!!n}var c$e=a$e,l$e=tK,u$e=fa,d$e=c$e,f$e=Hi,h$e=yS;function p$e(t,e,n){var r=f$e(t)?l$e:d$e;return n&&h$e(t,e,n)&&(e=void 0),r(t,u$e(e))}var m$e=p$e;const g$e=hn(m$e);var Zs=function(e,n){var r=e.alwaysShow,i=e.ifOverflow;return r&&(i="extendDomain"),i===n},wL=CK;function v$e(t,e,n){e=="__proto__"&&wL?wL(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var y$e=v$e,x$e=y$e,b$e=wK,w$e=fa;function S$e(t,e){var n={};return e=w$e(e),b$e(t,function(r,i,o){x$e(n,i,e(r,i,o))}),n}var C$e=S$e;const _$e=hn(C$e);function A$e(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 z$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 H$e(t,e){var n=t.x,r=t.y,i=U$e(t,$$e),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 Xh(Xh(Xh(Xh(Xh({},e),i),s?{x:s}:{}),l?{y:l}:{}),{},{height:d,width:h,name:e.name,radius:e.radius})}function CL(t){return N.createElement(fq,Hj({shapeType:"rectangle",propTransformer:H$e,activeClassName:"recharts-active-bar"},t))}var V$e=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||ku(),n)}},G$e=["value","background"],Sq;function Tf(t){"@babel/helpers - typeof";return Tf=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},Tf(t)}function K$e(t,e){if(t==null)return{};var n=W$e(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 W$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 S0(){return S0=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(V)0&&Math.abs(D)0&&(R=Math.min((B||0)-(D[ce-1]||0),R))}),Number.isFinite(R)){var V=R/E,L=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(A=V*L/2),m.padding==="no-gap"){var z=yi(e.barCategoryGap,V*L),M=V*L/2;A=M-z-(M-z)/L*z}}}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 $=MW(m,o,h),Q=$.scale,q=$.realScaleType;Q.domain(b).range(j),DW(Q);var te=$W(Q,Yo(Yo({},m),{},{realScaleType:q}));i==="xAxis"?(O=y==="top"&&!S||y==="bottom"&&S,T=r.left,k=f[_]-O*m.height):i==="yAxis"&&(O=y==="left"&&!S||y==="right"&&S,T=f[_]-O*m.width,k=r.top);var xe=Yo(Yo(Yo({},m),te),{},{realScaleType:q,x:T,y:k,scale:Q,width:i==="xAxis"?r.width:m.width,height:i==="yAxis"?r.height:m.height});return xe.bandSize=o0(xe,te),!m.hide&&i==="xAxis"?f[_]+=(O?-1:1)*xe.height:m.hide||(f[_]+=(O?-1:1)*xe.width),Yo(Yo({},p),{},RS({},v,xe))},{})},Eq=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)}},iLe=function(e){var n=e.x1,r=e.y1,i=e.x2,o=e.y2;return Eq({x:n,y:r},{x:i,y:o})},Nq=function(){function t(e){tLe(this,t),this.scale=e}return nLe(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)}}])}();RS(Nq,"EPS",1e-4);var eO=function(e){var n=Object.keys(e).reduce(function(r,i){return Yo(Yo({},r),{},RS({},i,Nq.create(e[i])))},{});return Yo(Yo({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=o.bandAware,c=o.position;return _$e(i,function(l,u){return n[u].apply(l,{bandAware:s,position:c})})},isInRange:function(i){return wq(i,function(o,s){return n[s].isInRange(o)})}})};function oLe(t){return(t%180+180)%180}var sLe=function(e){var n=e.width,r=e.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=oLe(i),s=o*Math.PI/180,c=Math.atan(r/n),l=s>c&&s-1?i[o?e[s]:s]:void 0}}var dLe=uLe,fLe=vq;function hLe(t){var e=fLe(t),n=e%1;return e===e?n?e-n:e:0}var pLe=hLe,mLe=mK,gLe=fa,vLe=pLe,yLe=Math.max;function xLe(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var i=n==null?0:vLe(n);return i<0&&(i=yLe(r+i,0)),mLe(t,gLe(e),i)}var bLe=xLe,wLe=dLe,SLe=bLe,CLe=wLe(SLe),_Le=CLe;const ALe=hn(_Le);var jLe=uye(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("")}),tO=g.createContext(void 0),nO=g.createContext(void 0),Tq=g.createContext(void 0),kq=g.createContext({}),Pq=g.createContext(void 0),Oq=g.createContext(0),Iq=g.createContext(0),NL=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=jLe(o);return N.createElement(tO.Provider,{value:r},N.createElement(nO.Provider,{value:i},N.createElement(kq.Provider,{value:o},N.createElement(Tq.Provider,{value:d},N.createElement(Pq.Provider,{value:s},N.createElement(Oq.Provider,{value:u},N.createElement(Iq.Provider,{value:l},c)))))))},ELe=function(){return g.useContext(Pq)},Rq=function(e){var n=g.useContext(tO);n==null&&ku();var r=n[e];return r==null&&ku(),r},NLe=function(){var e=g.useContext(tO);return Cc(e)},TLe=function(){var e=g.useContext(nO),n=ALe(e,function(r){return wq(r.domain,Number.isFinite)});return n||Cc(e)},Mq=function(e){var n=g.useContext(nO);n==null&&ku();var r=n[e];return r==null&&ku(),r},kLe=function(){var e=g.useContext(Tq);return e},PLe=function(){return g.useContext(kq)},rO=function(){return g.useContext(Iq)},iO=function(){return g.useContext(Oq)};function kf(t){"@babel/helpers - typeof";return kf=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},kf(t)}function OLe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ILe(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 pFe(t,e){return zq(t,e+1)}function mFe(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 v=r==null?void 0:r[l];if(v===void 0)return{v:zq(r,u)};var m=l,y,b=function(){return y===void 0&&(y=n(v,m)),y},x=v.coordinate,w=l===0||E0(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 Cg(t){"@babel/helpers - typeof";return Cg=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},Cg(t)}function DL(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 ei(t){for(var e=1;e0?p.coordinate-y*t:p.coordinate})}else o[h]=p=ei(ei({},p),{},{tickCoord:p.coordinate});var b=E0(t,p.tickCoord,m,c,l);b&&(l=p.tickCoord-t*(m()/2+i),o[h]=ei(ei({},p),{},{isShow:!0}))},d=s-1;d>=0;d--)u(d);return o}function bFe(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=ei(ei({},d),{},{tickCoord:h>0?d.coordinate-h*t:d.coordinate});var p=E0(t,d.tickCoord,function(){return f},l,u);p&&(u=d.tickCoord-t*(f/2+i),s[c-1]=ei(ei({},d),{},{isShow:!0}))}for(var v=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=ei(ei({},w),{},{tickCoord:_<0?w.coordinate-_*t:w.coordinate})}else s[x]=w=ei(ei({},w),{},{tickCoord:w.coordinate});var A=E0(t,w.tickCoord,C,l,u);A&&(l=w.tickCoord+t*(C()/2+i),s[x]=ei(ei({},w),{},{isShow:!0}))},y=0;y=2?vi(i[1].coordinate-i[0].coordinate):1,b=hFe(o,y,p);return l==="equidistantPreserveStart"?mFe(y,b,m,i,s):(l==="preserveStart"||l==="preserveStartEnd"?h=bFe(y,b,m,i,s,l==="preserveStartEnd"):h=xFe(y,b,m,i,s),h.filter(function(x){return x.isShow}))}var wFe=["viewBox"],SFe=["viewBox"],CFe=["ticks"];function If(t){"@babel/helpers - typeof";return If=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},If(t)}function bd(){return bd=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 _Fe(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 AFe(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function LL(t,e){for(var n=0;n0?l(this.props):l(p)),s<=0||c<=0||!v||!v.length?null:N.createElement(tn,{className:Mt("recharts-cartesian-axis",u),ref:function(y){r.layerReference=y}},o&&this.renderAxisLine(),this.renderTicks(v,this.state.fontSize,this.state.letterSpacing),$r.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,o){var s;return N.isValidElement(r)?s=N.cloneElement(r,i):At(r)?s=r(i):s=N.createElement(Eu,bd({},i,{className:"recharts-cartesian-axis-tick-value"}),o),s}}])}(g.Component);cO(Ch,"displayName","CartesianAxis");cO(Ch,"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 OFe=["x1","y1","x2","y2","key"],IFe=["offset"];function Pu(t){"@babel/helpers - typeof";return Pu=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},Pu(t)}function FL(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 ii(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $Fe(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 LFe=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 Gq(t,e){var n;if(N.isValidElement(t))n=N.cloneElement(t,e);else if(At(t))n=t(e);else{var r=e.x1,i=e.y1,o=e.x2,s=e.y2,c=e.key,l=BL(e,OFe),u=ft(l,!1);u.offset;var d=BL(u,IFe);n=N.createElement("line",Yl({},d,{x1:r,y1:i,x2:o,y2:s,fill:"none",key:c}))}return n}function FFe(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=ii(ii({},t),{},{x1:e,y1:c,x2:e+n,y2:c,key:"line-".concat(l),index:l});return Gq(i,u)});return N.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function BFe(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=ii(ii({},t),{},{x1:c,y1:e,x2:c,y2:e+n,key:"line-".concat(l),index:l});return Gq(i,u)});return N.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function UFe(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 v=!d[p+1],m=v?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 zFe(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 v=!d[p+1],m=v?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 HFe=function(e,n){var r=e.xAxis,i=e.width,o=e.height,s=e.offset;return RW(aO(ii(ii(ii({},Ch.defaultProps),r),{},{ticks:Oa(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.left,s.left+s.width,n)},VFe=function(e,n){var r=e.yAxis,i=e.width,o=e.height,s=e.offset;return RW(aO(ii(ii(ii({},Ch.defaultProps),r),{},{ticks:Oa(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),s.top,s.top+s.height,n)},Zu={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function _g(t){var e,n,r,i,o,s,c=rO(),l=iO(),u=PLe(),d=ii(ii({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:Zu.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:Zu.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:Zu.horizontal,horizontalFill:(i=t.horizontalFill)!==null&&i!==void 0?i:Zu.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:Zu.vertical,verticalFill:(s=t.verticalFill)!==null&&s!==void 0?s:Zu.verticalFill,x:De(t.x)?t.x:u.left,y:De(t.y)?t.y:u.top,width:De(t.width)?t.width:u.width,height:De(t.height)?t.height:u.height}),f=d.x,h=d.y,p=d.width,v=d.height,m=d.syncWithTicks,y=d.horizontalValues,b=d.verticalValues,x=NLe(),w=TLe();if(!De(p)||p<=0||!De(v)||v<=0||!De(f)||f!==+f||!De(h)||h!==+h)return null;var S=d.verticalCoordinatesGenerator||HFe,C=d.horizontalCoordinatesGenerator||VFe,_=d.horizontalPoints,A=d.verticalPoints;if((!_||!_.length)&&At(C)){var j=y&&y.length,T=C({yAxis:w?ii(ii({},w),{},{ticks:j?y:w.ticks}):void 0,width:c,height:l,offset:u},j?!0:m);ls(Array.isArray(T),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Pu(T),"]")),Array.isArray(T)&&(_=T)}if((!A||!A.length)&&At(S)){var k=b&&b.length,O=S({xAxis:x?ii(ii({},x),{},{ticks:k?b:x.ticks}):void 0,width:c,height:l,offset:u},k?!0:m);ls(Array.isArray(O),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Pu(O),"]")),Array.isArray(O)&&(A=O)}return N.createElement("g",{className:"recharts-cartesian-grid"},N.createElement(LFe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),N.createElement(FFe,Yl({},d,{offset:u,horizontalPoints:_,xAxis:x,yAxis:w})),N.createElement(BFe,Yl({},d,{offset:u,verticalPoints:A,xAxis:x,yAxis:w})),N.createElement(UFe,Yl({},d,{horizontalPoints:_})),N.createElement(zFe,Yl({},d,{verticalPoints:A})))}_g.displayName="CartesianGrid";var GFe=["layout","type","stroke","connectNulls","isRange","ref"],KFe=["key"],Kq;function Rf(t){"@babel/helpers - typeof";return Rf=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},Rf(t)}function Wq(t,e){if(t==null)return{};var n=WFe(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 WFe(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 Ql(){return Ql=Object.assign?Object.assign.bind():function(t){for(var e=1;e0||!Nu(d,s)||!Nu(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,v=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=Lt(y)?this.id:y,j=(r=ft(s,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},T=j.r,k=T===void 0?3:T,O=j.strokeWidth,E=O===void 0?2:O,R=mxe(s)?s:{},D=R.clipDot,V=D===void 0?!0:D,L=k*2+E;return N.createElement(tn,{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-v/2,width:S?p:p*2,height:C?v:v*2})),!V&&N.createElement("clipPath",{id:"clipPath-dots-".concat(A)},N.createElement("rect",{x:d-L/2,y:u-L/2,width:p+L,height:v+L}))):null,x?null:this.renderArea(_,A),(s||x)&&this.renderDots(_,V,A),(!m||b)&&Js.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}}])}(g.PureComponent);Kq=ds;zs(ds,"displayName","Area");zs(ds,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!us.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});zs(ds,"getBaseValue",function(t,e,n,r){var i=t.layout,o=t.baseValue,s=e.props.baseValue,c=s??o;if(De(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]});zs(ds,"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,v=u&&u.length,m=Kq.getBaseValue(e,n,r,i),y=p==="horizontal",b=!1,x=f.map(function(S,C){var _;v?_=u[d+C]:(_=ar(S,l),Array.isArray(_)?b=!0:_=[m,_]);var A=_[1]==null||v&&ar(S,l)==null;return y?{x:u$({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:u$({axis:i,ticks:s,bandSize:c,entry:S,index:C}),value:_,payload:S}}),w;return v||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),fc({points:x,baseLine:w,layout:p,isRange:b},h)});zs(ds,"renderDotItem",function(t,e){var n;if(N.isValidElement(t))n=N.cloneElement(t,e);else if(At(t))n=t(e);else{var r=Mt("recharts-area-dot",typeof t!="boolean"?t.className:""),i=e.key,o=Wq(e,KFe);n=N.createElement(fv,Ql({},o,{key:i,className:r}))}return n});function Mf(t){"@babel/helpers - typeof";return Mf=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},Mf(t)}function t4e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n4e(t,e){for(var n=0;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 z4e(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 H4e(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function V4e(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,r=new Array(e);n0?s:e&&e.length&&De(i)&&De(o)?e.slice(i,o+1):[]};function l7(t){return t==="number"?[0,"auto"]:void 0}var aE=function(e,n,r,i){var o=e.graphicalItems,s=e.tooltipAxis,c=FS(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=Pb(p,s.dataKey,i)}else h=f&&f[r]||c[r];return h?[].concat(Lf(l),[FW(u,h)]):l},[])},qL=function(e,n,r,i){var o=i||{x:e.chartX,y:e.chartY},s=n5e(o,r),c=e.orderedTooltipTicks,l=e.tooltipAxis,u=e.tooltipTicks,d=gOe(s,c,u,l);if(d>=0&&u){var f=u[d]&&u[d].value,h=aE(e,n,d,f),p=r5e(r,c,d,o);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},i5e=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=IW(d,o);return r.reduce(function(v,m){var y,b=m.type.defaultProps!==void 0?ve(ve({},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,T=b[s];if(v[T])return v;var k=FS(e.data,{graphicalItems:i.filter(function(te){var xe,B=s in te.props?te.props[s]:(xe=te.type.defaultProps)===null||xe===void 0?void 0:xe[s];return B===T}),dataStartIndex:l,dataEndIndex:u}),O=k.length,E,R,D;k4e(b.domain,S,x)&&(E=wj(b.domain,null,S),p&&(x==="number"||_!=="auto")&&(D=Dp(k,w,"category")));var V=l7(x);if(!E||E.length===0){var L,z=(L=b.domain)!==null&&L!==void 0?L:V;if(w){if(E=Dp(k,w,x),x==="category"&&p){var M=sxe(E);C&&M?(R=E,E=x0(0,O)):C||(E=p$(z,E,m).reduce(function(te,xe){return te.indexOf(xe)>=0?te:[].concat(Lf(te),[xe])},[]))}else if(x==="category")C?E=E.filter(function(te){return te!==""&&!Lt(te)}):E=p$(z,E,m).reduce(function(te,xe){return te.indexOf(xe)>=0||xe===""||Lt(xe)?te:[].concat(Lf(te),[xe])},[]);else if(x==="number"){var $=wOe(k,i.filter(function(te){var xe,B,ce=s in te.props?te.props[s]:(xe=te.type.defaultProps)===null||xe===void 0?void 0:xe[s],he="hide"in te.props?te.props.hide:(B=te.type.defaultProps)===null||B===void 0?void 0:B.hide;return ce===T&&(j||!he)}),w,o,d);$&&(E=$)}p&&(x==="number"||_!=="auto")&&(D=Dp(k,w,"category"))}else p?E=x0(0,O):c&&c[T]&&c[T].hasStack&&x==="number"?E=h==="expand"?[0,1]:LW(c[T].stackGroups,l,u):E=OW(k,i.filter(function(te){var xe=s in te.props?te.props[s]:te.type.defaultProps[s],B="hide"in te.props?te.props.hide:te.type.defaultProps.hide;return xe===T&&(j||!B)}),x,d,!0);if(x==="number")E=iE(f,E,T,o,A),z&&(E=wj(z,E,S));else if(x==="category"&&z){var Q=z,q=E.every(function(te){return Q.indexOf(te)>=0});q&&(E=Q)}}return ve(ve({},v),{},Tt({},T,ve(ve({},b),{},{axisType:o,domain:E,categoricalDomain:D,duplicateDomain:R,originalDomain:(y=b.domain)!==null&&y!==void 0?y:V,isCategorical:p,layout:d})))},{})},o5e=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=FS(e.data,{graphicalItems:r,dataStartIndex:l,dataEndIndex:u}),p=h.length,v=IW(d,o),m=-1;return r.reduce(function(y,b){var x=b.type.defaultProps!==void 0?ve(ve({},b.type.defaultProps),b.props):b.props,w=x[s],S=l7("number");if(!y[w]){m++;var C;return v?C=x0(0,p):c&&c[w]&&c[w].hasStack?(C=LW(c[w].stackGroups,l,u),C=iE(f,C,w,o)):(C=wj(S,OW(h,r.filter(function(_){var A,j,T=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 T===w&&!k}),"number",d),i.defaultProps.allowDataOverflow),C=iE(f,C,w,o)),ve(ve({},y),{},Tt({},w,ve(ve({axisType:o},i.defaultProps),{},{hide:!0,orientation:oo(e5e,"".concat(o,".").concat(m%2),null),domain:C,originalDomain:S,isCategorical:v,layout:d})))}return y},{})},s5e=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=ko(d,o),p={};return h&&h.length?p=i5e(e,{axes:h,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u}):s&&s.length&&(p=o5e(e,{Axis:o,graphicalItems:s,axisType:i,axisIdKey:f,stackGroups:c,dataStartIndex:l,dataEndIndex:u})),p},a5e=function(e){var n=Cc(e),r=Oa(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:jP(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:o0(n,r)}},YL=function(e){var n=e.children,r=e.defaultShowTooltip,i=Yi(n,Nf),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}},c5e=function(e){return!e||!e.length?!1:e.some(function(n){var r=$a(n&&n.type);return r&&r.indexOf("Bar")>=0})},QL=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"}},l5e=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=Yi(f,Nf),v=Yi(f,La),m=Object.keys(l).reduce(function(C,_){var A=l[_],j=A.orientation;return!A.mirror&&!A.hide?ve(ve({},C),{},Tt({},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?ve(ve({},C),{},Tt({},j,oo(C,"".concat(j))+A.height)):C},{top:h.top||0,bottom:h.bottom||0}),b=ve(ve({},y),m),x=b.bottom;p&&(b.bottom+=p.props.height||Nf.defaultProps.height),v&&n&&(b=xOe(b,i,r,n));var w=u-b.left-b.right,S=d-b.top-b.bottom;return ve(ve({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(S,0)})},u5e=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},BS=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,T=y.layout,k=y.barGap,O=y.barCategoryGap,E=y.maxBarSize,R=QL(T),D=R.numericAxisName,V=R.cateAxisName,L=c5e(x),z=[];return x.forEach(function(M,$){var Q=FS(y.data,{graphicalItems:[M],dataStartIndex:_,dataEndIndex:A}),q=M.type.defaultProps!==void 0?ve(ve({},M.type.defaultProps),M.props):M.props,te=q.dataKey,xe=q.maxBarSize,B=q["".concat(D,"Id")],ce=q["".concat(V,"Id")],he={},U=l.reduce(function(oe,ye){var Ee=b["".concat(ye.axisType,"Map")],P=q["".concat(ye.axisType,"Id")];Ee&&Ee[P]||ye.axisType==="zAxis"||ku();var H=Ee[P];return ve(ve({},oe),{},Tt(Tt({},ye.axisType,H),"".concat(ye.axisType,"Ticks"),Oa(H)))},he),de=U[V],se=U["".concat(V,"Ticks")],ne=w&&w[B]&&w[B].hasStack&&kOe(M,w[B].stackGroups),je=$a(M.type).indexOf("Bar")>=0,K=o0(de,se),et=[],Me=L&&vOe({barSize:j,stackGroups:w,totalSize:u5e(U,V)});if(je){var ut,Ye,Pt=Lt(xe)?E:xe,F=(ut=(Ye=o0(de,se,!0))!==null&&Ye!==void 0?Ye:Pt)!==null&&ut!==void 0?ut:0;et=yOe({barGap:k,barCategoryGap:O,bandSize:F!==K?F:K,sizeList:Me[ce],maxBarSize:Pt}),F!==K&&(et=et.map(function(oe){return ve(ve({},oe),{},{position:ve(ve({},oe.position),{},{offset:oe.position.offset-F/2})})}))}var J=M&&M.type&&M.type.getComposedData;J&&z.push({props:ve(ve({},J(ve(ve({},U),{},{displayedData:Q,props:y,dataKey:te,item:M,bandSize:K,barPosition:et,offset:S,stackedData:ne,layout:T,dataStartIndex:_,dataEndIndex:A}))),{},Tt(Tt(Tt({key:M.key||"item-".concat($)},D,U[D]),V,U[V]),"animationId",C)),childIndex:yxe(M,y.children),item:M})}),z},p=function(y,b){var x=y.props,w=y.dataStartIndex,S=y.dataEndIndex,C=y.updateId;if(!aM({props:x}))return null;var _=x.children,A=x.layout,j=x.stackOffset,T=x.data,k=x.reverseStackOrder,O=QL(A),E=O.numericAxisName,R=O.cateAxisName,D=ko(_,r),V=NOe(T,D,"".concat(E,"Id"),"".concat(R,"Id"),j,k),L=l.reduce(function(q,te){var xe="".concat(te.axisType,"Map");return ve(ve({},q),{},Tt({},xe,s5e(x,ve(ve({},te),{},{graphicalItems:D,stackGroups:te.axisType===E&&V,dataStartIndex:w,dataEndIndex:S}))))},{}),z=l5e(ve(ve({},L),{},{props:x,graphicalItems:D}),b==null?void 0:b.legendBBox);Object.keys(L).forEach(function(q){L[q]=d(x,L[q],z,q.replace("Map",""),n)});var M=L["".concat(R,"Map")],$=a5e(M),Q=h(x,ve(ve({},L),{},{dataStartIndex:w,dataEndIndex:S,updateId:C,graphicalItems:D,stackGroups:V,offset:z}));return ve(ve({formattedGraphicalItems:Q,graphicalItems:D,offset:z,stackGroups:V},$),L)},v=function(m){function y(b){var x,w,S;return H4e(this,y),S=K4e(this,y,[b]),Tt(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Tt(S,"accessibilityManager",new T4e),Tt(S,"handleLegendBBoxUpdate",function(C){if(C){var _=S.state,A=_.dataStartIndex,j=_.dataEndIndex,T=_.updateId;S.setState(ve({legendBBox:C},p({props:S.props,dataStartIndex:A,dataEndIndex:j,updateId:T},ve(ve({},S.state),{},{legendBBox:C}))))}}),Tt(S,"handleReceiveSyncEvent",function(C,_,A){if(S.props.syncId===C){if(A===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(_)}}),Tt(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 ve({dataStartIndex:_,dataEndIndex:A},p({props:S.props,dataStartIndex:_,dataEndIndex:A,updateId:j},S.state))}),S.triggerSyncEvent({dataStartIndex:_,dataEndIndex:A})}}),Tt(S,"handleMouseEnter",function(C){var _=S.getMouseInfo(C);if(_){var A=ve(ve({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseEnter;At(j)&&j(A,C)}}),Tt(S,"triggeredAfterMouseMove",function(C){var _=S.getMouseInfo(C),A=_?ve(ve({},_),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(A),S.triggerSyncEvent(A);var j=S.props.onMouseMove;At(j)&&j(A,C)}),Tt(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),Tt(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),Tt(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),Tt(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var _={isTooltipActive:!1};S.setState(_),S.triggerSyncEvent(_);var A=S.props.onMouseLeave;At(A)&&A(_,C)}),Tt(S,"handleOuterEvent",function(C){var _=vxe(C),A=oo(S.props,"".concat(_));if(_&&At(A)){var j,T;/.*touch.*/i.test(_)?T=S.getMouseInfo(C.changedTouches[0]):T=S.getMouseInfo(C),A((j=T)!==null&&j!==void 0?j:{},C)}}),Tt(S,"handleClick",function(C){var _=S.getMouseInfo(C);if(_){var A=ve(ve({},_),{},{isTooltipActive:!0});S.setState(A),S.triggerSyncEvent(A);var j=S.props.onClick;At(j)&&j(A,C)}}),Tt(S,"handleMouseDown",function(C){var _=S.props.onMouseDown;if(At(_)){var A=S.getMouseInfo(C);_(A,C)}}),Tt(S,"handleMouseUp",function(C){var _=S.props.onMouseUp;if(At(_)){var A=S.getMouseInfo(C);_(A,C)}}),Tt(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),Tt(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),Tt(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),Tt(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&b_.emit(w_,S.props.syncId,C,S.eventEmitterSymbol)}),Tt(S,"applySyncEvent",function(C){var _=S.props,A=_.layout,j=_.syncMethod,T=S.state.updateId,k=C.dataStartIndex,O=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(ve({dataStartIndex:k,dataEndIndex:O},p({props:S.props,dataStartIndex:k,dataEndIndex:O,updateId:T},S.state)));else if(C.activeTooltipIndex!==void 0){var E=C.chartX,R=C.chartY,D=C.activeTooltipIndex,V=S.state,L=V.offset,z=V.tooltipTicks;if(!L)return;if(typeof j=="function")D=j(z,C);else if(j==="value"){D=-1;for(var M=0;M=0){var ne,je;if(E.dataKey&&!E.allowDuplicatedCategory){var K=typeof E.dataKey=="function"?se:"payload.".concat(E.dataKey.toString());ne=Pb(M,K,D),je=$&&Q&&Pb(Q,K,D)}else ne=M==null?void 0:M[R],je=$&&Q&&Q[R];if(ce||B){var et=C.props.activeIndex!==void 0?C.props.activeIndex:R;return[g.cloneElement(C,ve(ve(ve({},j.props),U),{},{activeIndex:et})),null,null]}if(!Lt(ne))return[de].concat(Lf(S.renderActivePoints({item:j,activePoint:ne,basePoint:je,childIndex:R,isRange:$})))}else{var Me,ut=(Me=S.getItemByXY(S.state.activeCoordinate))!==null&&Me!==void 0?Me:{graphicalItem:de},Ye=ut.graphicalItem,Pt=Ye.item,F=Pt===void 0?C:Pt,J=Ye.childIndex,oe=ve(ve(ve({},j.props),U),{},{activeIndex:J});return[g.cloneElement(F,oe),null,null]}return $?[de,null,null]:[de,null]}),Tt(S,"renderCustomized",function(C,_,A){return g.cloneElement(C,ve(ve({key:"recharts-customized-".concat(A)},S.props),S.state))}),Tt(S,"renderMap",{CartesianGrid:{handler:my,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:my},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:my},YAxis:{handler:my},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:hh("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=TK(S.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),S.state={},S}return Y4e(y,m),G4e(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=Yi(w,ni);if(A){var j=A.props.defaultIndex;if(!(typeof j!="number"||j<0||j>this.state.tooltipTicks.length-1)){var T=this.state.tooltipTicks[j]&&this.state.tooltipTicks[j].value,k=aE(this.state,S,j,T),O=this.state.tooltipTicks[j].coordinate,E=(this.state.offset.top+C)/2,R=_==="horizontal",D=R?{x:O,y:E}:{y:O,x:E},V=this.state.formattedGraphicalItems.find(function(z){var M=z.item;return M.type.name==="Scatter"});V&&(D=ve(ve({},D),V.props.points[j].tooltipPosition),k=V.props.points[j].tooltipPayload);var L={activeTooltipIndex:j,isTooltipActive:!0,activeLabel:T,activePayload:k,activeCoordinate:D};this.setState(L),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){D1([Yi(x.children,ni)],[Yi(this.props.children,ni)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=Yi(this.props.children,ni);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=VEe(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 T=this.state,k=T.xAxisMap,O=T.yAxisMap,E=this.getTooltipEventType();if(E!=="axis"&&k&&O){var R=Cc(k).scale,D=Cc(O).scale,V=R&&R.invert?R.invert(_.chartX):null,L=D&&D.invert?D.invert(_.chartY):null;return ve(ve({},_),{},{xValue:V,yValue:L})}var z=qL(this.state,this.props.data,this.props.layout,j);return z?ve(ve({},_),z):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,T=_>=j.left&&_<=j.left+j.width&&A>=j.top&&A<=j.top+j.height;return T?{x:_,y:A}:null}var k=this.state,O=k.angleAxisMap,E=k.radiusAxisMap;if(O&&E){var R=Cc(O);return v$({x:_,y:A},R)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,w=this.getTooltipEventType(),S=Yi(x,ni),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 _=Ob(this.props,this.handleOuterEvent);return ve(ve({},_),C)}},{key:"addListener",value:function(){b_.on(w_,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){b_.removeListener(w_,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,w,S){for(var C=this.state.formattedGraphicalItems,_=0,A=C.length;_{var v;const[r,i]=g.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]=g.useState([]),[c,l]=g.useState({}),[u,d]=g.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const y=n.find(b=>b.id===m);return y?y.name:`Participant ${m}`};g.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((z,M)=>z+M,0)/Object.keys(m).length,w=Object.values(m).map(z=>Math.abs(z-x)/x),S=w.reduce((z,M)=>z+M,0)/w.length,C=Object.values(y).map(z=>Object.values(z).filter(M=>M>0).length),_=C.reduce((z,M)=>z+M,0)/C.length,A=["Very Positive","Positive","Neutral","Negative","Very Negative"],j=Object.values(y).map(z=>{const M=Math.max(...Object.values(z));return A.find($=>z[$]===M)||"Neutral"}),T=new Set(j).size,k=T/A.length,O=Math.max(0,100-S*100),E=_/5*100,R=k*100,D=Math.round(O*.6+E*.2+R*.2);let V="";const L=D>=70;S>.3&&(V+="Participation is uneven among participants. "),_<2&&(V+="Limited range of sentiments expressed. "),T<=1?V+="Participants show similar sentiment patterns, suggesting potential group-think. ":T>=4&&(V+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),V===""&&(V=L?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:L,score:D,reason:V})},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(wl,{defaultValue:"sentiment",children:[a.jsxs(tc,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(vn,{value:"sentiment",className:"flex items-center",children:[a.jsx(Mee,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(vn,{value:"participation",className:"flex items-center",children:[a.jsx(IA,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(yn,{value:"sentiment",children:a.jsx(yt,{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(Qc,{width:"100%",height:"100%",children:a.jsxs(lO,{children:[a.jsx(ni,{}),a.jsx(As,{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(av,{fill:m.color},`cell-${y}`))}),a.jsx(La,{})]})})}),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(fm,{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(yn,{value:"participation",children:a.jsx(yt,{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(Qc,{width:"100%",height:"100%",children:a.jsxs(u7,{data:o,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(_g,{strokeDasharray:"3 3"}),a.jsx(fl,{type:"number"}),a.jsx(hl,{dataKey:"name",type:"category",width:100}),a.jsx(ni,{}),a.jsx(jl,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:o.length>0?`Most active: ${(v=o.sort((m,y)=>y.messages-m.messages)[0])==null?void 0:v.name}`:"No participation data available"})]})})})]})})};function h5e(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,visualAsset:t.visualAsset};return console.log("🔍 [GPT-5 CONVERTER] Output converted:",JSON.stringify(e,null,2)),e}function p5e(t){return{id:t.id,title:t.title,description:t.description,quotes:t.quotes,source:t.source,created_at:t.created_at}}function f7(){return!0}const m5e=({focusGroupId:t,personas:e,isVisible:n,onToggle:r})=>{const[i,o]=g.useState(null),[s,c]=g.useState(null),[l,u]=g.useState(null),[d,f]=g.useState(null),[h,p]=g.useState(!1),[v,m]=g.useState(null),[y,b]=g.useState(null);la();const x=f7();g.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[T,k,O,E]=await Promise.allSettled([rr.getConversationAnalytics(t),rr.getConversationState(t),rr.getAutonomousConversationStatus(t),rr.getConversationInsights(t)]);T.status==="fulfilled"&&o(T.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(T){console.error("Error fetching dashboard data:",T),m("Failed to load dashboard data")}finally{p(!1)}},C=()=>{S()},_=T=>{switch(T){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=T=>{switch(T){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},j=T=>{switch(T){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(ts,{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(ie,{variant:"ghost",size:"sm",onClick:C,disabled:h,className:"p-1",children:a.jsx(ru,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(ie,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(zee,{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:[v&&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(Dee,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:v})]})}),l&&a.jsxs(yt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Qi,{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($n,{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(yt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Qi,{className:"text-sm flex items-center gap-2",children:[a.jsx(_a,{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($n,{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(Ic,{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((T,k)=>a.jsx($n,{variant:"outline",className:"text-xs",children:T.replace("_"," ")},k))})]})]})})]}),i&&a.jsxs(yt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Qi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Fr,{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($n,{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(yt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Qi,{className:"text-sm flex items-center gap-2",children:[a.jsx(cte,{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($n,{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(yt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Qi,{className:"text-sm flex items-center gap-2",children:[a.jsx(Ree,{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(Ic,{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(Ic,{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(Ic,{value:i.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(yt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Qi,{className:"text-sm flex items-center gap-2",children:[a.jsx(gu,{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($n,{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($n,{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(yt,{children:[a.jsx(Ei,{className:"pb-3",children:a.jsxs(Qi,{className:"text-sm flex items-center gap-2",children:[a.jsx(ON,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(Rt,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:i.recommendations.map((T,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:T})},k))})})]})]})]}):null},g5e=({discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,focusGroupId:o,isOpen:s,onToggle:c,className:l,onEditingChange:u})=>{const d=g.useRef(!1),f=g.useCallback(y=>{d.current=y,u==null||u(y)},[u]),[h,p]=g.useState(!1),v=async()=>{if(!t){ae.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}p(!0);try{await St.downloadDiscussionGuide(o),ae.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(y){console.error("Error downloading discussion guide:",y),ae.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:Fe("w-full border-b bg-white shadow-sm",l),children:a.jsxs(Qg,{open:s,onOpenChange:c,children:[a.jsx(Xg,{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(Fee,{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(ie,{variant:"ghost",size:"sm",onClick:y=>{y.stopPropagation(),v()},disabled:!t||h,className:"h-8",children:h?a.jsx(no,{className:"h-4 w-4 animate-spin"}):a.jsx(ol,{className:"h-4 w-4"})}),s?a.jsx(qf,{className:"h-4 w-4 text-slate-500"}):a.jsx(yl,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(Jg,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(yt,{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(Jk,{discussionGuide:t,moderatorStatus:e,onSectionSelect:n,onSetPosition:r,onSave:i,showProgress:!0,collapsible:!0,defaultExpanded:!0,focusGroupId:o,onEditingChange:f})})})})})})]})})},v5e=({focusGroupId:t,focusGroupName:e="Focus Group",onNoteClick:n})=>{const[r,i]=g.useState([]),[o,s]=g.useState(!0),[c,l]=g.useState(null);g.useEffect(()=>{u()},[t]);const u=async()=>{try{s(!0);const x=await St.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),ae.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{s(!1)}},d=async x=>{l(x);try{await St.deleteNote(t,x),i(r.filter(w=>w.id!==x)),ae.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),ae.error("Failed to delete note",{description:"Please try again."})}finally{l(null)}},f=x=>{x.associatedMessageId&&n?n(x.associatedMessageId):ae.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){ae.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),ae.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:** ${v(w.elapsedTime)}`),x.push(""),x.push("**Content:**"),x.push(w.content),x.push(""),x.push("---"),x.push("")}),x.join(` -`)},v=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 g.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(kx,{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(ie,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(ol,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(Qw,{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(kx,{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(yt,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(x),children:[a.jsx(Ei,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(Qi,{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(ie,{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(tte,{className:"h-3 w-3"})}),a.jsx(ie,{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(Qn,{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)})})})]})},y5e=({isOpen:t,onClose:e,focusGroupId:n,associatedMessageId:r,sectionInfo:i,messageTimestamp:o,onNoteSaved:s})=>{const[c,l]=g.useState(""),[u,d]=g.useState(!1),f=async()=>{if(!c.trim()){ae.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()},v=await St.createNote(n,p);if(v.data){const m={...v.data,timestamp:new Date(v.data.timestamp),createdAt:new Date(v.data.createdAt)},y=i!=null&&i.sectionTitle?`'${i.sectionTitle}'`:"current section",b=o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});ae.success("Quick note saved",{description:`Note linked to ${y} at ${b}`}),s&&s(m),l(""),e()}}catch(p){console.error("Error saving note:",p),ae.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{l(""),e()};return a.jsx(Ma,{open:t,onOpenChange:h,children:a.jsxs(Ws,{className:"sm:max-w-md",children:[a.jsx(qs,{children:a.jsx(Qs,{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(bt,{placeholder:"Enter your note here...",value:c,onChange:p=>l(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(Ys,{children:[a.jsx(ie,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(ie,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},aa=Object.create(null);aa.open="0";aa.close="1";aa.ping="2";aa.pong="3";aa.message="4";aa.upgrade="5";aa.noop="6";const Gy=Object.create(null);Object.keys(aa).forEach(t=>{Gy[aa[t]]=t});const cE={type:"error",data:"parser error"},h7=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",p7=typeof ArrayBuffer=="function",m7=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,uO=({type:t,data:e},n,r)=>h7&&e instanceof Blob?n?r(e):XL(e,r):p7&&(e instanceof ArrayBuffer||m7(e))?n?r(e):XL(new Blob([e]),r):r(aa[t]+(e||"")),XL=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function JL(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let C_;function x5e(t,e){if(h7&&t.data instanceof Blob)return t.data.arrayBuffer().then(JL).then(e);if(p7&&(t.data instanceof ArrayBuffer||m7(t.data)))return e(JL(t.data));uO(t,!1,n=>{C_||(C_=new TextEncoder),e(C_.encode(n))})}const ZL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fp=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},w5e=typeof ArrayBuffer=="function",dO=(t,e)=>{if(typeof t!="string")return{type:"message",data:g7(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:S5e(t.substring(1),e)}:Gy[n]?t.length>1?{type:Gy[n],data:t.substring(1)}:{type:Gy[n]}:cE},S5e=(t,e)=>{if(w5e){const n=b5e(t);return g7(n,e)}else return{base64:!0,data:t}},g7=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},v7="",C5e=(t,e)=>{const n=t.length,r=new Array(n);let i=0;t.forEach((o,s)=>{uO(o,!1,c=>{r[s]=c,++i===n&&e(r.join(v7))})})},_5e=(t,e)=>{const n=t.split(v7),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 __;function gy(t){return t.reduce((e,n)=>e+n.length,0)}function vy(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(cE);break}i=d*Math.pow(2,32)+u.getUint32(4),r=3}else{if(gy(n)t){c.enqueue(cE);break}}}})}const y7=4;function gr(t){if(t)return E5e(t)}function E5e(t){for(var e in gr.prototype)t[e]=gr.prototype[e];return t}gr.prototype.on=gr.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};gr.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};gr.prototype.off=gr.prototype.removeListener=gr.prototype.removeAllListeners=gr.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),Co=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),N5e="arraybuffer";function x7(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const T5e=Co.setTimeout,k5e=Co.clearTimeout;function zS(t,e){e.useNativeTimers?(t.setTimeoutFn=T5e.bind(Co),t.clearTimeoutFn=k5e.bind(Co)):(t.setTimeoutFn=Co.setTimeout.bind(Co),t.clearTimeoutFn=Co.clearTimeout.bind(Co))}const P5e=1.33;function O5e(t){return typeof t=="string"?I5e(t):Math.ceil((t.byteLength||t.size)*P5e)}function I5e(t){let e=0,n=0;for(let r=0,i=t.length;r=57344?n+=3:(r++,n+=4);return n}function b7(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function R5e(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function M5e(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)};_5e(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,C5e(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]=b7()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let w7=!1;try{w7=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const L5e=w7;function F5e(){}class B5e extends $5e{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 Bd=class Ky extends gr{constructor(e,n,r){super(),this.createRequest=e,zS(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=x7(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=Ky.requestsCount++,Ky.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=F5e,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Ky.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()}};Bd.requestsCount=0;Bd.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",eF);else if(typeof addEventListener=="function"){const t="onpagehide"in Co?"pagehide":"unload";addEventListener(t,eF,!1)}}function eF(){for(let t in Bd.requests)Bd.requests.hasOwnProperty(t)&&Bd.requests[t].abort()}const U5e=function(){const t=S7({xdomain:!1});return t&&t.responseType!==null}();class z5e extends B5e{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=U5e&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Bd(S7,this.uri(),e)}}function S7(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||L5e))return new XMLHttpRequest}catch{}if(!e)try{return new Co[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const C7=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class H5e extends fO{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=C7?{}:x7(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&&US(()=>{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]=b7()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const A_=Co.WebSocket||Co.MozWebSocket;class V5e extends H5e{createSocket(e,n,r){return C7?new A_(e,n,r):n?new A_(e,n):new A_(e)}doWrite(e,n){this.ws.send(n)}}class G5e extends fO{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=j5e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),i=A5e();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&&US(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const K5e={websocket:V5e,webtransport:G5e,polling:z5e},W5e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,q5e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function lE(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=W5e.exec(t||""),o={},s=14;for(;s--;)o[q5e[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=Y5e(o,o.path),o.queryKey=Q5e(o,o.query),o}function Y5e(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 Q5e(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const uE=typeof addEventListener=="function"&&typeof removeEventListener=="function",Wy=[];uE&&addEventListener("offline",()=>{Wy.forEach(t=>t())},!1);class Jc extends gr{constructor(e,n){if(super(),this.binaryType=N5e,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=lE(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=lE(n.host).host);zS(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=M5e(this.opts.query)),uE&&(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"})},Wy.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=y7,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&&Jc.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",Jc.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,US(()=>{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(Jc.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(),uE&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Wy.indexOf(this._offlineEventListener);r!==-1&&Wy.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Jc.protocol=y7;class X5e extends Jc{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;Jc.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;rK5e[i]).filter(i=>!!i)),super(e,r)}};function Z5e(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=lE(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 eBe=typeof ArrayBuffer=="function",tBe=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,_7=Object.prototype.toString,nBe=typeof Blob=="function"||typeof Blob<"u"&&_7.call(Blob)==="[object BlobConstructor]",rBe=typeof File=="function"||typeof File<"u"&&_7.call(File)==="[object FileConstructor]";function hO(t){return eBe&&(t instanceof ArrayBuffer||tBe(t))||nBe&&t instanceof Blob||rBe&&t instanceof File}function qy(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:on.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 on.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 on.EVENT:case on.BINARY_EVENT:this.onevent(e);break;case on.ACK:case on.BINARY_ACK:this.onack(e);break;case on.DISCONNECT:this.ondisconnect();break;case on.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:on.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:on.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}_h.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};_h.prototype.reset=function(){this.attempts=0};_h.prototype.setMin=function(t){this.ms=t};_h.prototype.setMax=function(t){this.max=t};_h.prototype.setJitter=function(t){this.jitter=t};class hE extends gr{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,zS(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 _h({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||uBe;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 J5e(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Qo(n,"open",function(){r.onopen(),e&&e()}),o=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},s=Qo(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(Qo(e,"ping",this.onping.bind(this)),Qo(e,"data",this.ondata.bind(this)),Qo(e,"error",this.onerror.bind(this)),Qo(e,"close",this.onclose.bind(this)),Qo(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){US(()=>{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 A7(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 Jh={};function Yy(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=Z5e(t,e.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=Jh[i]&&o in Jh[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||s;let l;return c?l=new hE(r,e):(Jh[i]||(Jh[i]=new hE(r,e)),l=Jh[i]),n.query&&!e.query&&(e.query=n.queryKey),l.socket(n.path,e)}Object.assign(Yy,{Manager:hE,Socket:A7,io:Yy,connect:Yy});const nF=window.location.origin,rF="/semblance_back/socket.io/";let Ot=null,cu=null,iF=!1;function j7(t){if(Ot)return Ot.io.opts.auth={token:t()},Ot;console.log("🔧 [GPT-5] Creating singleton socket:",nF,rF),Ot=Yy(nF,{path:rF,transports:["websocket"],reconnection:!0,autoConnect:!1,timeout:6e4,pingInterval:45e3,pingTimeout:12e4,auth:n=>n({token:t()})}),Ot.io.on("reconnect_attempt",()=>{console.log("🔧 [GPT-5] Reconnect attempt - refreshing token"),Ot.io.opts.auth={token:t()}});const e=()=>{console.log("🔧 [GPT-5] Socket connected, rebinding listeners and rejoining room"),mBe(),cu&&pBe()};return Ot.on("connect",e),Ot.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"mode_event_update":console.log("🔧 [GPT-5] *** ROUTING mode_event_update from onAny ***"),window.dispatchEvent(new CustomEvent("ws:mode_event_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}}),Ot.on("connect_error",n=>{console.error("🔧 [GPT-5] Connect error:",n)}),Ot.on("disconnect",n=>{console.log("🔧 [GPT-5] Disconnected:",n)}),Ot}function E7(){Ot&&!Ot.connected&&(console.log("🔧 [GPT-5] Connecting socket"),Ot.connect())}function fBe(t,e){if(console.log("🔧 [GPT-5] Joining focus group:",t),cu=t,!(Ot!=null&&Ot.connected)){console.log("🔧 [GPT-5] Socket not connected, will auto-rejoin on connect"),E7(),setTimeout(()=>{Ot!=null&&Ot.connected?(console.log("🔧 [GPT-5] Retrying join after connection established"),Ot.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}Ot.emit("join_focus_group",{focus_group_id:t},n=>{console.log("🔧 [GPT-5] join_focus_group ACK:",n)})}function hBe(t){console.log("🔧 [GPT-5] Leaving focus group:",t),cu===t&&(cu=null),Ot!=null&&Ot.connected&&Ot.emit("leave_focus_group",{focus_group_id:t})}function pBe(){!(Ot!=null&&Ot.connected)||!cu||(console.log("🔧 [GPT-5] Auto-rejoining room after reconnect:",cu),Ot.emit("join_focus_group",{focus_group_id:cu}))}function mBe(){if(!Ot){console.log("🔧 [GPT-5] bindCoreListeners called but socket is null!");return}iF&&console.log("🔧 [GPT-5] Listeners already bound, but rebinding anyway for safety"),console.log("🔧 [GPT-5] bindCoreListeners called - socket exists, binding listeners");const t=l=>{console.log("🔧 [GPT-5] joined_focus_group:",l),window.dispatchEvent(new CustomEvent("ws:joined_focus_group",{detail:l}))},e=l=>{console.log("🔧 [GPT-5] left_focus_group:",l),window.dispatchEvent(new CustomEvent("ws:left_focus_group",{detail:l}))},n=l=>{console.log("🔧 [GPT-5] *** MESSAGE_UPDATE LISTENER FIRED! ***"),console.log("🔧 [GPT-5] message_update payload:",l),console.log("🔧 [GPT-5] DISPATCHING window event ws:message_update");try{window.dispatchEvent(new CustomEvent("ws:message_update",{detail:l})),console.log("🔧 [GPT-5] DISPATCHED window event ws:message_update SUCCESS")}catch(u){console.error("🔧 [GPT-5] ERROR dispatching window event:",u)}},r=l=>{console.log("🔧 [GPT-5] ai_status_update:",l),console.log("🔧 [GPT-5] DISPATCHING window event ws:ai_status_update"),window.dispatchEvent(new CustomEvent("ws:ai_status_update",{detail:l})),console.log("🔧 [GPT-5] DISPATCHED window event ws:ai_status_update")},i=l=>{console.log("🔧 [GPT-5] moderator_status_update:",l),window.dispatchEvent(new CustomEvent("ws:moderator_status_update",{detail:l}))},o=l=>{console.log("🔧 [GPT-5] theme_update:",l),window.dispatchEvent(new CustomEvent("ws:theme_update",{detail:l}))},s=l=>{console.log("🔧 [GPT-5] focus_group_update:",l),window.dispatchEvent(new CustomEvent("ws:focus_group_update",{detail:l}))},c=l=>{console.log("🔧 [GPT-5] mode_event_update:",l),window.dispatchEvent(new CustomEvent("ws:mode_event_update",{detail:l}))};console.log("🔧 [GPT-5] BINDING specific listeners to socket"),Ot.on("joined_focus_group",t),Ot.on("left_focus_group",e),Ot.on("message_update",n),Ot.on("ai_status_update",r),Ot.on("moderator_status_update",i),Ot.on("theme_update",o),Ot.on("focus_group_update",s),Ot.on("mode_event_update",c),console.log("🔧 [GPT-5] BOUND specific listeners to socket"),console.log("🔧 [GPT-5] Socket listeners after binding:",Ot.listeners("message_update").length),console.log("🔧 [GPT-5] Socket hasListeners message_update:",Ot.hasListeners("message_update")),setTimeout(()=>{Ot!=null&&Ot.connected&&(console.log("🔧 [GPT-5] SELF-TEST: Emitting test event"),Ot.emit("message_update",{test:"self-emit-test"}))},1e3),Ot.on("connected",l=>{console.log("🔧 [GPT-5] connected:",l)}),Ot.on("error",l=>{console.error("🔧 [GPT-5] socket error:",l)}),iF=!0}const gBe=()=>{const{id:t}=PN(),e=ur(),{token:n}=la(),[r,i]=g.useState([]),[o,s]=g.useState([]),[c,l]=g.useState([]),[u,d]=g.useState(null),[f,h]=g.useState([]),[p,v]=g.useState("chat"),[m,y]=g.useState(null),[b,x]=g.useState(!1),[w,S]=g.useState(!1),[C,_]=g.useState(!0),[A,j]=g.useState(!1),[T,k]=g.useState(!1),O=g.useRef(!1),[E,R]=g.useState(!1),D=g.useRef(u);D.current=u;const[V,L]=g.useState([]),[z,M]=g.useState(!1),[$,Q]=g.useState(""),[q,te]=g.useState("medium"),[xe,B]=g.useState("medium"),[ce,he]=g.useState(!1),[U,de]=g.useState(!1),[se,ne]=g.useState(null),[je,K]=g.useState([]),[et,Me]=g.useState(!1),[ut,Ye]=g.useState(!1),[Pt,F]=g.useState(!1),[J,oe]=g.useState(!0),[ye,Ee]=g.useState({isOpen:!1}),P=g.useRef(!1),[H,ee]=g.useState(""),re=g.useRef(""),Z=g.useRef(!1),Se=g.useRef({wasConnected:!1,wasConnecting:!1,initialConnection:!0,hasShownFallbackNotification:!1}),Ae=f7(),[Ie,Ke]=g.useState(!1),[Ue,Be]=g.useState(!1),[nt,Ne]=g.useState(null),Nt=g.useCallback(()=>n||"",[n]);g.useEffect(()=>{console.log("🔧 [GPT-5 Session] Initializing WebSocket"),j7(Nt)},[Ae,Nt]),g.useEffect(()=>{if(!t)return;(()=>{console.log("🔧 [GPT-5 Session] Joining focus group:",t),fBe(t)})()},[t,Ae]),g.useEffect(()=>{Be(!0),Ke(!1),Ne(null);const ue=setTimeout(()=>{Ke(!0),Be(!1)},1e3);return()=>{clearTimeout(ue)}},[Ae]),g.useEffect(()=>{console.log("🔧 [GPT-5 Session] Setting up window event listeners");const ue=Pe=>{const me=Pe.detail;console.log("🔧 [GPT-5 Session] message_update:",me),me.focus_group_id&&(console.log("🔧 [GPT-5] Message focus_group_id:",me.focus_group_id),console.log("🔧 [GPT-5] Current focus group from URL:",t));const dt=h5e(me.message);if(!dt){console.error("🔧 [GPT-5] convertWebSocketMessage returned null");return}i(st=>st.find(Ct=>Ct.id===dt.id)?(console.log("🔧 [GPT-5] Message already exists, skipping"),st):(console.log("🔧 [GPT-5] Adding new message, count:",st.length+1),[...st,dt]))},ge=Pe=>{const me=Pe.detail;console.log("🔧 [GPT-5 Session] ai_status_update:",me),S(dt=>me.status.status==="ai_mode"),ee(dt=>me.status.status)},Ge=Pe=>{const me=Pe.detail;console.log("🔧 [GPT-5 Session] moderator_status_update:",me),y(me.moderator_status)},I=Pe=>{const me=Pe.detail;console.log("🔧 [GPT-5 Session] theme_update:",me);const dt=p5e(me.theme);l(st=>{const Wt=[...st],Ct=Wt.findIndex(er=>er.id===dt.id);return Ct>=0?Wt[Ct]=dt:Wt.push(dt),Wt})},X=Pe=>{const me=Pe.detail;console.log("🔧 [GPT-5 Session] focus_group_update:",me),d(dt=>dt?{...dt,...me}:null)},Y=Pe=>{const me=Pe.detail;console.log("🔧 [GPT-5 Session] mode_event_update:",me);const dt={...me,timestamp:new Date(me.timestamp),created_at:new Date(me.created_at)};s(st=>st.findIndex(Ct=>Ct.id===dt.id)>=0?(console.log("🔧 [GPT-5 Session] Mode event already exists, skipping:",dt.id),st):(console.log("🔧 [GPT-5 Session] Adding new mode event:",dt.id),[...st,dt]))},pe=Pe=>{const me=Pe.detail;console.log("🔧 [GPT-5 Session] joined_focus_group:",me)};return console.log("🔧 [GPT-5 Session] ADDING window event listeners"),window.addEventListener("ws:message_update",ue),window.addEventListener("ws:ai_status_update",ge),window.addEventListener("ws:moderator_status_update",Ge),window.addEventListener("ws:theme_update",I),window.addEventListener("ws:focus_group_update",X),window.addEventListener("ws:mode_event_update",Y),window.addEventListener("ws:joined_focus_group",pe),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",ue),window.removeEventListener("ws:ai_status_update",ge),window.removeEventListener("ws:moderator_status_update",Ge),window.removeEventListener("ws:theme_update",I),window.removeEventListener("ws:focus_group_update",X),window.removeEventListener("ws:mode_event_update",Y),window.removeEventListener("ws:joined_focus_group",pe),t&&hBe(t)}},[Ae,t]),g.useEffect(()=>{if(!t)return;const ue=Se.current;Ie&&!ue.wasConnected&&(ue.initialConnection?Ve.success("Live updates enabled",{description:"Connected to real-time updates. Changes will appear instantly.",duration:3e3}):Ve.success("Real-time updates restored",{description:"WebSocket connection re-established. You'll now receive instant updates.",duration:4e3}),ue.wasConnected=!0,ue.initialConnection=!1),!Ie&&!Ue&&ue.wasConnected&&!ue.initialConnection&&(Ve.warning("Connection lost",{description:"Real-time updates unavailable. Attempting to reconnect...",duration:5e3}),ue.wasConnected=!1,oe(!0)),nt&&!Ue&&!Ie&&!ue.initialConnection&&(Ve.error("Connection failed",{description:"Unable to establish real-time connection. Using periodic updates instead.",duration:6e3}),oe(!0)),ue.wasConnecting=Ue},[Ie,Ue,nt,Ae,t]),g.useEffect(()=>{},[Ae,t,u]);const pn=async()=>{var ue;if(t)try{const ge=await rr.getModeratorStatus(t);if((ue=ge==null?void 0:ge.data)!=null&&ue.status){const Ge=ge.data.status;if(m){const I=m.current_section_id!==Ge.current_section_id||m.current_item_id!==Ge.current_item_id||m.progress!==Ge.progress}O.current||y(Ge)}}catch(ge){console.error("Error fetching moderator status:",ge)}},Je=async()=>{if(!t)return{aiActive:!1,sessionStatus:""};try{if(typeof(St==null?void 0:St.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(St==null?void 0:St.getById)),{aiActive:w,sessionStatus:H};const ue=await St.getById(t);if(!ue||typeof ue!="object")return console.error("Invalid response object received:",ue),{aiActive:w,sessionStatus:H};if(!ue.data||typeof ue.data!="object")return console.warn("Focus group response missing data property:",ue),{aiActive:w,sessionStatus:H};const ge=ue.data.status;if(typeof ge>"u")return console.warn("Focus group response missing status field:",ue.data),{aiActive:w,sessionStatus:H};const Ge=ge==="ai_mode";return ge==="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(ge)||console.warn("Unexpected focus group status value:",ge),{aiActive:Ge,sessionStatus:ge}}catch(ue){console.error("Error checking AI mode status:",ue);const ge={focusGroupId:t,currentAiModeStatus:w,errorType:"unknown",timestamp:new Date().toISOString()};return ue.response?(ge.errorType="api_error",ge.status=ue.response.status,ge.data=ue.response.data,console.error("API error response:",ue.response.status,ue.response.data),ue.response.status===404?console.warn("Focus group not found - may have been deleted"):ue.response.status===500&&console.error("Server error during status check - backend issue")):ue.request?(ge.errorType="network_error",console.error("Network error - no response received, check connectivity")):(ge.errorType="request_setup",ge.message=ue.message,console.error("Request setup error:",ue.message)),console.debug("Status check error details:",ge),{aiActive:w,sessionStatus:H,isGenerating:!1}}},rt=async(ue,ge)=>{if(!t||Z.current)return;const Ge=["completed","paused"],X=["ai_mode","autonomous_active","active","in-progress"].includes(ge),Y=Ge.includes(ue);if(X&&Y){Z.current=!0;try{let pe="session_ended";ue==="completed"?pe="auto_complete":ue==="paused"&&(pe="manual_stop");const Pe=await rr.endSession(t,pe);Pe!=null&&Pe.data&&(Ve.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{jt()},1e3))}catch(pe){console.error("❌ Error ending session with concluding statement:",pe),Ve.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},jt=async()=>{var ue;if(t)try{const ge=await St.getMessages(t);console.log("🔍 [FetchMessages] Raw API response:",ge==null?void 0:ge.data);let Ge=[],I=[];ge&&ge.data&&(Array.isArray(ge.data)?(Ge=ge.data,I=[]):ge.data.messages||ge.data.mode_events?(Ge=ge.data.messages||[],I=ge.data.mode_events||[]):(Ge=Array.isArray(ge.data)?ge.data:[],I=[]));const X=Ge.map(me=>({id:me._id||me.id||`msg-${Date.now()}`,senderId:me.senderId,text:me.text,timestamp:new Date(me.timestamp||me.created_at),type:me.type||"response",highlighted:me.highlighted||!1,visualAsset:me.visualAsset}));console.log("🔍 [FetchMessages] Formatted messages with visual assets:",X.filter(me=>me.visualAsset).map(me=>({id:me.id,senderId:me.senderId,hasVisualAsset:!!me.visualAsset,visualAsset:me.visualAsset})));const Y=I.map(me=>({id:me._id||me.id||`event-${Date.now()}`,focus_group_id:me.focus_group_id,event_type:me.event_type,timestamp:new Date(me.timestamp||me.created_at),user_id:me.user_id,created_at:new Date(me.created_at)}));s(Y),X.length>0?i(me=>{if(me.length===0)return X;{const dt=new Map;me.forEach(ln=>dt.set(ln.id,ln));const st=X.map(ln=>{if(dt.has(ln.id)){const Nn=dt.get(ln.id);return{...ln,highlighted:Nn.highlighted}}return ln}),Wt=new Set(st.map(ln=>ln.id)),Ct=me.filter(ln=>!Wt.has(ln.id));return[...st,...Ct].sort((ln,Nn)=>ln.timestamp.getTime()-Nn.timestamp.getTime())}}):X.length===0&&i(me=>me.length===0?[]:me);const pe=X.filter(me=>me.highlighted),Pe=pe.length>0?pe.map(me=>({id:`theme-${me.id}`,text:me.text.substring(0,40)+(me.text.length>40?"...":""),count:1,messages:[me.id],source:"highlight"})):[];try{const me=await rr.getKeyThemes(t);if((ue=me==null?void 0:me.data)!=null&&ue.themes&&Array.isArray(me.data.themes)){const dt=me.data.themes;l([...Pe,...dt])}else l(Pe)}catch(me){console.error("Error fetching AI-generated themes:",me),l(Pe)}}catch(ge){console.error("Error fetching messages:",ge),r.length===0&&Ve.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},Bt=async()=>{if(!t)return!1;try{const ge=(await Er.getAll()).data||[],Ge=await St.getById(t);if(Ge&&Ge.data){const I=Ge.data;console.log("Focus group data from API:",I);const X={id:I._id||I.id,name:I.name,status:I.status||"in-progress",participants:I.participants||[],date:I.date||new Date().toISOString(),duration:I.duration||60,topic:I.topic||"general",discussionGuide:I.discussionGuide||"",llm_model:I.llm_model||"gemini-2.5-pro"};if(d(X),Q(X.llm_model||"gemini-2.5-pro"),te(X.reasoning_effort||"medium"),B(X.verbosity||"medium"),I.participants_data&&Array.isArray(I.participants_data))h(I.participants_data.map(pe=>({...pe,id:pe._id||pe.id})));else if(X.participants&&Array.isArray(X.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:X.participants,allPersonas:ge.map(Pe=>({id:Pe._id||Pe.id,name:Pe.name}))});const pe=ge.filter(Pe=>{const me=Pe._id||Pe.id;return X.participants.includes(me)});console.log("Matched participants:",pe.map(Pe=>Pe.name)),h(pe)}await jt(),await pn();const Y=await Je();return S(Y.aiActive),ee(Y.sessionStatus),P.current=Y.aiActive,re.current=Y.sessionStatus,!0}return!1}catch(ue){return console.error("Error fetching focus group:",ue),!1}},Dt=async(ue,ge,Ge)=>{if(console.log("🔧 updateFocusGroupModel called with:",{id:t,focusGroup:!!u,newModel:ue,reasoningEffort:ge,verbosity:Ge}),!t||!u){console.log("❌ updateFocusGroupModel: Missing id or focusGroup",{id:t,focusGroup:!!u});return}he(!0);try{const I={llm_model:ue};ue==="gpt-5"&&(I.reasoning_effort=ge||q,I.verbosity=Ge||xe),console.log("🔧 Making API call to update focus group model:",{id:t,updateData:I});const X=await St.update(t,I);console.log("🔧 API response:",X),X&&X.data?(d(Y=>Y?{...Y,llm_model:ue,reasoning_effort:ue==="gpt-5"?ge||q:Y==null?void 0:Y.reasoning_effort,verbosity:ue==="gpt-5"?Ge||xe:Y==null?void 0:Y.verbosity}:null),Ve.success("AI Model Updated",{description:`Focus group will now use ${ue==="gemini-2.5-pro"?"Gemini 2.5 Pro":ue==="gpt-4.1"?"GPT-4.1":ue==="gpt-5"?"GPT-5":ue} for AI responses`}),M(!1),console.log("✅ Model update successful")):console.log("❌ API response missing data:",X)}catch(I){console.error("❌ Error updating focus group model:",I),Ve.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{he(!1)}};g.useEffect(()=>{console.log("Looking for focus group with ID:",t);const ue=async()=>{try{return(await Er.getAll()).data||[]}catch(X){return console.error("Error fetching personas:",X),[]}},ge=async X=>{try{const Y=await St.getById(t);if(Y&&Y.data){const pe=Y.data;console.log("Focus group data from API:",pe);const Pe={id:pe._id||pe.id,name:pe.name,status:pe.status||"in-progress",participants:pe.participants||[],date:pe.date||new Date().toISOString(),duration:pe.duration||60,topic:pe.topic||"general",discussionGuide:pe.discussionGuide||"",llm_model:pe.llm_model||"gemini-2.5-pro"};if(d(Pe),Q(Pe.llm_model||"gemini-2.5-pro"),te(Pe.reasoning_effort||"medium"),B(Pe.verbosity||"medium"),pe.participants_data&&Array.isArray(pe.participants_data))h(pe.participants_data.map(me=>({...me,id:me._id||me.id})));else if(Pe.participants&&Array.isArray(Pe.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:Pe.participants,allPersonas:X.map(dt=>({id:dt._id||dt.id,name:dt.name}))});const me=X.filter(dt=>{const st=dt._id||dt.id;return Pe.participants.includes(st)});console.log("Matched participants:",me.map(dt=>dt.name)),h(me)}return jt(),pn(),_(!1),!0}return!1}catch(Y){return console.error("Error fetching focus group:",Y),!1}};let Ge,I;return ue().then(X=>{ge(X).then(Y=>{Y?nt&&(nt.includes("unavailable")||nt.includes("websocket error"))?(console.log("📡 WebSocket connection failed, falling back to polling"),(()=>{jt(),pn(),Ge&&window.clearInterval(Ge);const st=w?3e3:1e4;console.log("📡 Setting up message polling:",{aiModeActive:w,pollInterval:st,timestamp:new Date().toISOString()}),Ge=window.setInterval(()=>{O.current?console.log("📡 Skipping poll - editing discussion guide"):(console.log("📡 Polling for messages...",new Date().toISOString()),jt(),pn())},st)})(),I=window.setInterval(async()=>{const st=P.current,Wt=re.current,Ct=await Je();if(P.current=Ct.aiActive,re.current=Ct.sessionStatus,S(Ct.aiActive),ee(Ct.sessionStatus),Wt&&Wt!==Ct.sessionStatus&&await rt(Ct.sessionStatus,Wt),st!==Ct.aiActive&&Ge){window.clearInterval(Ge);const er=Ct.aiActive?3e3:1e4;Ge=window.setInterval(()=>{O.current||(jt(),pn())},er)}},15e3)):console.log("📡 WebSocket enabled, skipping polling setup"):(console.error("Focus group not found with ID:",t),_(!1),Ve.error("Focus group not found",{description:`Could not find focus group with ID: ${t}`}))})}),()=>{Ge&&window.clearInterval(Ge),I&&window.clearInterval(I)}},[t,e,Ae,nt]);const Jt=ue=>{if(!ue||!ue.sections||!Array.isArray(ue.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ge=ue.sections[0];if(!ge)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const Ge=X=>X.questions&&Array.isArray(X.questions)&&X.questions.length>0?{content:X.questions[0].content,itemId:X.questions[0].id,type:"question"}:X.activities&&Array.isArray(X.activities)&&X.activities.length>0?{content:X.activities[0].content,itemId:X.activities[0].id,type:"activity"}:null;let I=Ge(ge);if(!I&&ge.subsections&&Array.isArray(ge.subsections)){for(const X of ge.subsections)if(I=Ge(X),I)break}return I?{content:I.content,sectionId:ge.id,itemId:I.itemId}:{content:`Welcome to our focus group session on "${ge.title||"our topic"}". Let's begin our discussion.`,sectionId:ge.id,itemId:"section-intro"}},en=async()=>{var ue,ge,Ge,I,X;if(t)try{Ve.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const Y=await rr.getModeratorStatus(t),pe=(ge=(ue=Y==null?void 0:Y.data)==null?void 0:ue.status)==null?void 0:ge.moderator_position;pe?console.log("📍 Preserving existing moderator position:",pe):(await rr.setModeratorPosition(t,((X=(I=(Ge=u==null?void 0:u.discussionGuide)==null?void 0:Ge.sections)==null?void 0:I[0])==null?void 0:X.id)||"welcome"),console.log("🚀 Moderator position initialized to start of discussion guide (first time)"))}catch(Y){console.warn("Failed to check/initialize moderator position:",Y)}await St.update(t,{status:"active"});try{const Y=Jt(u==null?void 0:u.discussionGuide),pe=await St.sendMessage(t,{senderId:"moderator",text:Y.content,type:"question"});console.log("🚀 Initial moderator message created:",{content:Y.content,sectionId:Y.sectionId,itemId:Y.itemId})}catch(Y){console.warn("Failed to create initial moderator message:",Y)}Ve.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(Y){console.error("Error starting session:",Y),Ve.error("Error starting session",{description:"There was a problem connecting to the server."})}},In=ue=>{i(ge=>ge.find(I=>I.id===ue.id)?(console.log("🔧 [handleNewMessage] Message already exists, skipping:",ue.id),ge):(console.log("🔧 [handleNewMessage] Adding new message:",ue.id),[...ge,ue]))},cn=async ue=>{const ge=[...r],Ge=ge.findIndex(I=>I.id===ue);if(Ge!==-1){const I=ge[Ge],X=!I.highlighted;if(ge[Ge]={...I,highlighted:X},i(ge),t)try{!ue.startsWith("local-")&&!ue.startsWith("msg-")?await St.updateMessageHighlight(t,ue,X):console.log("Skipping database update for local message:",ue)}catch(Y){console.error("Error updating message highlight state:",Y),Ve.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},G=ue=>f.find(ge=>ge.id===ue||ge._id===ue),ke=()=>{const ue=r.map(I=>{var pe;let X;return I.senderId==="moderator"?X="AI Moderator":I.senderId==="facilitator"?X="Human Facilitator":X=((pe=G(I.senderId))==null?void 0:pe.name)||"Unknown",`[${I.timestamp.toLocaleTimeString()}] ${X}: ${I.text}`}).join(` - -`),ge=document.createElement("a"),Ge=new Blob([ue],{type:"text/plain"});ge.href=URL.createObjectURL(Ge),ge.download=`focus-group-${t}-transcript.txt`,document.body.appendChild(ge),ge.click(),document.body.removeChild(ge),Ve.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},Ce=(ue,ge)=>{const Ge=st=>{const Wt=st.match(/^\[([^\]]+)\]:\s*(.*)$/);return Wt?Wt[2].trim():st.trim()},I=st=>st.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),X=(st,Wt)=>{const Ct=I(st),er=I(Wt);if(Ct===er)return 1;if(Ct.includes(er)||er.includes(Ct))return Math.min(Ct.length,er.length)/Math.max(Ct.length,er.length);const ln=Ct.split(" "),Nn=er.split(" "),pv=ln.filter(mO=>Nn.includes(mO)&&mO.length>2);return ln.length===0||Nn.length===0?0:pv.length/Math.max(ln.length,Nn.length)},Y=typeof ue=="object"&&ue!==null,pe=Y?ue.text:Ge(ue),Pe=Y?ue.original:ue;let me=null,dt="";if(ge&&(me=r.find(st=>st.id===ge),me?dt="direct_message_id_match":console.warn(`Message ID ${ge} not found in current messages array`)),me||(me=r.find(st=>st.text.includes(Pe)),me&&(dt="exact_full_match")),me||(me=r.find(st=>st.text.includes(pe)),me&&(dt="exact_text_match")),me||(me=r.find(st=>pe.includes(st.text.trim())),me&&(dt="reverse_exact_match")),!me){const st=pe.toLowerCase();me=r.find(Wt=>Wt.text.toLowerCase().includes(st)||st.includes(Wt.text.toLowerCase())),me&&(dt="case_insensitive_match")}if(!me){const st=r.map(Wt=>({message:Wt,similarity:X(pe,Wt.text)})).filter(Wt=>Wt.similarity>.7).sort((Wt,Ct)=>Ct.similarity-Wt.similarity);st.length>0&&(me=st[0].message,dt=`fuzzy_match_${Math.round(st[0].similarity*100)}%`)}if(!me){const Wt=I(pe).split(" ").filter(Ct=>Ct.length>3);Wt.length>0&&(me=r.find(Ct=>{const er=I(Ct.text);return Wt.every(ln=>er.includes(ln))}),me&&(dt="partial_word_match"))}me?(console.log(`Quote match found using strategy: ${dt}`,{quoteType:Y?"QuoteData":"string",providedMessageId:ge,extractedText:pe,matchedMessage:me.text.substring(0,100),matchedMessageId:me.id,originalQuote:Pe.substring(0,100)}),v("chat"),setTimeout(()=>{const st=document.getElementById(`message-${me.id}`);st&&(T||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:Y?"QuoteData":"string",providedMessageId:ge,originalQuote:Pe.substring(0,100),extractedText:pe.substring(0,100),totalMessages:r.length,messageSample:r.slice(0,3).map(st=>({id:st.id,text:st.text.substring(0,50)}))}),Ve.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},We=ue=>{l(ge=>{const Ge=new Set(ge.map(X=>X.id)),I=ue.filter(X=>!Ge.has(X.id));return[...ge,...I]})},Qe=async ue=>{if(!t)return;const ge=c.find(Ge=>Ge.id===ue);if(ge)try{"source"in ge&&ge.source==="generated"&&await rr.deleteKeyTheme(t,ue),l(c.filter(Ge=>Ge.id!==ue))}catch(Ge){console.error("Error deleting theme:",Ge),Ve.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},ot=g.useCallback(async(ue,ge)=>{if(t)try{await rr.setModeratorPosition(t,ue,ge),Ve.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(Ge){console.error("Error setting moderator position:",Ge),Ve.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[t]),Ft=g.useCallback(async ue=>{if(console.log("💾 handleDiscussionGuideSave called:",{hasId:!!t,isEditingGuideContent:E,timestamp:new Date().toISOString()}),!!t)try{await St.update(t,{discussionGuide:ue}),E?(D.current&&(D.current={...D.current,discussionGuide:ue}),console.log("⚠️ Skipping focus group state update during editing to preserve focus")):(console.log("🔄 Updating focus group state (not editing)"),d(ge=>ge?{...ge,discussionGuide:ue}:null))}catch(ge){throw console.error("Error saving discussion guide:",ge),ge}},[t,E]),tt=g.useCallback(ue=>{console.log("🔄 handleGuideEditingStateChange called:",{editing:ue,timestamp:new Date().toISOString(),currentIsEditingGuideContent:E}),k(ue),R(ue),!ue&&D.current&&(console.log("📝 Updating focus group state after editing ended"),d(D.current))},[E]),Zt=g.useCallback(()=>{j(ue=>!ue)},[]),$t=g.useCallback((ue,ge,Ge,I,X,Y,pe)=>{Ee({isOpen:!0,sectionId:ue,itemId:ge,content:Ge,sectionTitle:I,itemTitle:X,itemType:Y,metadata:pe})},[]),Xt=()=>{if(m)return{sectionId:m.current_section_id,sectionTitle:m.current_section,itemId:m.current_item_id,itemTitle:m.current_item}},Rn=()=>{if(r.length!==0)return r[r.length-1].id},Lo=()=>{const ue=Rn();if(ue&&r.length>0){const ge=r.find(Ge=>Ge.id===ue);if(ge)return ge.timestamp}return u!=null&&u.date?new Date(u.date):se||new Date},Zn=async()=>{if(t){Me(!0),Ye(!1),F(!1),Ve.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const ue=await rr.generateKeyThemes(t);ue.data&&ue.data.themes?(Ye(!0),Ve.success(`Generated ${ue.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(ge=>[...ge,...ue.data.themes])):(Ye(!0),Ve.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(ue){console.error("Error generating key themes:",ue),F(!0),Ve.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},Fo=()=>{Me(!1),Ye(!1),F(!1)},Ah=()=>{se||ne(new Date),de(!0)},Uu=ue=>{L(ge=>[...ge,ue].sort((Ge,I)=>I.createdAt.getTime()-Ge.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(ue)},lo=ue=>{const ge=r.find(Ge=>Ge.id===ue);ge?(v("chat"),setTimeout(()=>{const Ge=document.getElementById(`message-${ge.id}`);Ge&&(T||Ge.scrollIntoView({behavior:"smooth",block:"center"}),Ge.style.backgroundColor="#fbbf24",Ge.style.transition="background-color 0.3s ease",setTimeout(()=>{Ge.style.backgroundColor=""},2e3))},100)):Ve.info("Message not found",{description:"Could not locate the original message for this note."})};g.useEffect(()=>{r.length>0&&!se&&ne(new Date)},[r.length,se]),g.useEffect(()=>{O.current=T,T||pn()},[T]);const jh=ue=>{K(ge=>ge.includes(ue)?ge.filter(Ge=>Ge!==ue):[...ge,ue])};return C?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(Ra,{}),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(Ra,{}),J&&a.jsx("div",{className:`w-full transition-all duration-300 ${Ie?"bg-green-500":Ue?"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 ${Ie?"bg-white animate-pulse":Ue?"bg-white animate-spin":"bg-white"}`}),a.jsx("span",{children:Ie?"Real-time updates active - Changes appear instantly":Ue?"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:()=>oe(!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"})})})]})})}),!J&&a.jsx("div",{className:"fixed top-20 right-4 z-40",children:a.jsx("button",{onClick:()=>oe(!0),className:`px-3 py-1 rounded-full text-white text-xs font-medium shadow-lg transition-all duration-200 hover:shadow-xl ${Ie?"bg-green-500 hover:bg-green-600":Ue?"bg-yellow-500 hover:bg-yellow-600":"bg-red-500 hover:bg-red-600"}`,title:Ie?"WebSocket connected - Show status bar":Ue?"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 ${Ie?"animate-pulse":""}`}),a.jsx("span",{children:Ie?"Live":Ue?"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(ie,{variant:"ghost",onClick:()=>e("/focus-groups"),className:"mr-2",children:a.jsx(um,{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(ts,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx($n,{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(ie,{variant:"outline",onClick:()=>x(!b),className:b?"bg-blue-50 text-blue-600":"",children:[a.jsx(IA,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(ie,{variant:"outline",onClick:()=>M(!0),children:[a.jsx(DN,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(ie,{variant:"outline",onClick:ke,children:[a.jsx(ol,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),et&&a.jsx("div",{className:"mb-6",children:a.jsx(Uk,{isActive:et,isComplete:ut,hasError:Pt,label:"Analyzing discussion for key themes",onComplete:Fo,className:"max-w-4xl mx-auto"})}),a.jsx(g5e,{discussionGuide:u.discussionGuide,moderatorStatus:m,onSectionSelect:ot,onSetPosition:$t,onSave:Ft,focusGroupId:t||"",isOpen:A,onToggle:Zt,onEditingChange:tt}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(Qpe,{participants:f,selectedParticipantIds:je,onToggleParticipantFilter:jh}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(wl,{defaultValue:"chat",value:p,onValueChange:v,className:"w-full h-full flex flex-col",children:[a.jsxs(tc,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(vn,{value:"chat",className:"flex items-center",children:[a.jsx(Rs,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(vn,{value:"themes",className:"flex items-center",children:[a.jsx(gu,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(vn,{value:"notes",className:"flex items-center",children:[a.jsx(kx,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(vn,{value:"analytics",className:"flex items-center",children:[a.jsx(IA,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(yn,{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(ie,{onClick:en,size:"lg",className:"flex items-center gap-2",children:[a.jsx(PB,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(Ame,{messages:r,modeEvents:o,personas:f,isSpeaking:!1,focusGroupId:t||"",isAiModeActive:w,selectedParticipantIds:je,onToggleHighlight:cn,onAdvanceDiscussion:()=>null,onNewMessage:In,onStatusChange:Bt,isEditingDiscussionGuide:T})}),a.jsx(yn,{value:"themes",className:"m-0",children:a.jsx(Eme,{themes:c,messages:r,personas:f,focusGroupId:t||"",onThemesGenerated:We,onThemeDelete:Qe,onQuoteClick:Ce,onGenerateKeyThemes:Zn})}),a.jsx(yn,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(v5e,{focusGroupId:t||"",focusGroupName:u==null?void 0:u.name,onNoteClick:lo})})}),a.jsx(yn,{value:"analytics",className:"m-0",children:a.jsx(f5e,{messages:r,themes:c,personas:f})})]})})]})]}),r.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(ie,{onClick:Ah,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(kx,{className:"h-5 w-5"})})}),a.jsx(y5e,{isOpen:U,onClose:()=>de(!1),focusGroupId:t||"",associatedMessageId:Rn(),sectionInfo:Xt(),messageTimestamp:Lo(),onNoteSaved:Uu}),a.jsx(Ma,{open:ye.isOpen,onOpenChange:ue=>Ee(ge=>({...ge,isOpen:ue})),children:a.jsxs(Ws,{children:[a.jsxs(qs,{children:[a.jsx(Qs,{children:"Set Moderator Position"}),a.jsxs(Da,{children:['Are you sure you want to set the moderator position to "',ye.itemTitle,'" in section "',ye.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(Ys,{children:[a.jsx(ie,{variant:"outline",disabled:ye.isLoading,onClick:()=>Ee({isOpen:!1}),children:"Cancel"}),a.jsxs(ie,{disabled:ye.isLoading,onClick:async()=>{var ue,ge,Ge,I,X,Y,pe,Pe,me;if(!(!t||!ye.sectionId||!ye.itemId||!ye.content)){Ee(dt=>({...dt,isLoading:!0}));try{await rr.setModeratorPosition(t,ye.sectionId,ye.itemId);let dt=[],st=!1,Wt=ye.content;const Ct=(ue=ye.metadata)==null?void 0:ue.visual_asset,er=!!(Ct!=null&&Ct.filename),ln=Ct==null?void 0:Ct.filename;if(console.log("🔍 MANUAL POSITION DEBUG:",{itemType:ye.itemType,hasImageAttached:er,visualAsset:Ct,assetFilename:ln,content:ye.content,sectionTitle:ye.sectionTitle,itemTitle:ye.itemTitle,contentLength:(ge=ye.content)==null?void 0:ge.length}),er&&ye.content&&ln)if(console.log("🔍 VISUAL ASSET DEBUG:",{originalContent:ye.content,visualAsset:Ct,displayReference:Ct==null?void 0:Ct.display_reference,filename:ln,contentLength:ye.content.length}),ln){dt=[ln],st=!0,console.log("🎨 MANUAL POSITION: Creative review detected, will activate visual context for:",ln);try{console.log("🎨 MANUAL MODE: Requesting AI description for",ln);const Nn=await St.describeAsset(t,ln);if(Nn.data.description){const pv=(Ct==null?void 0:Ct.display_reference)||"the asset";Wt=ye.content.replace(pv,`${pv} - ${Nn.data.description}`),console.log("✅ MANUAL MODE: Enhanced question with AI description"),console.log("🔍 Original:",ye.content),console.log("🔍 Enhanced:",Wt)}}catch(Nn){console.error("⚠️ MANUAL MODE: Failed to generate AI description:",Nn),console.error("⚠️ Error response data:",(Ge=Nn.response)==null?void 0:Ge.data),console.error("⚠️ Error status:",(I=Nn.response)==null?void 0:I.status),console.error("⚠️ Error headers:",(X=Nn.response)==null?void 0:X.headers),console.error("⚠️ Full axios error:",{message:Nn.message,code:Nn.code,status:(Y=Nn.response)==null?void 0:Y.status,statusText:(pe=Nn.response)==null?void 0:pe.statusText,url:(Pe=Nn.config)==null?void 0:Pe.url,method:(me=Nn.config)==null?void 0:me.method}),Ve.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");console.log("📤 Sending moderator message to API:",{text:Wt,attachedAssets:dt,activatesVisualContext:st});try{const Nn=await St.sendMessage(t,{senderId:"moderator",text:Wt,type:"question",attached_assets:dt,activates_visual_context:st,visualAsset:er&&Ct?{filename:ln,displayReference:Ct.display_reference}:void 0});console.log("✅ Message API call successful:",Nn==null?void 0:Nn.data)}catch(Nn){console.error("❌ Failed to save message to API:",Nn),Ve.warning("Message not saved",{description:"Failed to save the moderator message to the server."})}Ee({isOpen:!1}),console.log("✅ Set position complete, moderator message added to UI"),Ve.success("Moderator position set",{description:`Position set to "${ye.itemTitle}" in "${ye.sectionTitle}"`})}catch(dt){console.error("Error setting moderator position:",dt),Ee(st=>({...st,isLoading:!1})),Ve.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[ye.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),ye.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(Ma,{open:z,onOpenChange:M,children:a.jsxs(Ws,{children:[a.jsxs(qs,{children:[a.jsx(Qs,{children:"AI Model Settings"}),a.jsx(Da,{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(ts,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx($n,{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(Tn,{value:$,onValueChange:ue=>{console.log("🔧 Model selection changed:",{from:$,to:ue}),Q(ue)},children:[a.jsx(An,{className:"mt-1",children:a.jsx(kn,{placeholder:"Select AI model"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(le,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(le,{value:"gpt-5",children:"GPT-5"})]})]})]}),$==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Reasoning Effort:"}),a.jsxs(Tn,{value:q,onValueChange:te,children:[a.jsx(An,{className:"mt-1",children:a.jsx(kn,{placeholder:"Select reasoning effort"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(le,{value:"low",children:"Low - Quick thinking"}),a.jsx(le,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(le,{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(Tn,{value:xe,onValueChange:B,children:[a.jsx(An,{className:"mt-1",children:a.jsx(kn,{placeholder:"Select verbosity level"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"low",children:"Low - Concise responses"}),a.jsx(le,{value:"medium",children:"Medium - Balanced length (default)"}),a.jsx(le,{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(Ys,{children:[a.jsx(ie,{variant:"outline",onClick:()=>M(!1),disabled:ce,children:"Cancel"}),a.jsxs(ie,{onClick:()=>{console.log("🔧 Update button clicked:",{selectedModel:$,selectedReasoningEffort:q,selectedVerbosity:xe,currentModel:u==null?void 0:u.llm_model,isDisabled:ce||$===(u==null?void 0:u.llm_model)&&($!=="gpt-5"||q===(u==null?void 0:u.reasoning_effort)&&xe===(u==null?void 0:u.verbosity))}),Dt($,q,xe)},disabled:ce||$===(u==null?void 0:u.llm_model)&&($!=="gpt-5"||q===((u==null?void 0:u.reasoning_effort)||"medium")&&xe===((u==null?void 0:u.verbosity)||"medium")),children:[ce&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),ce?"Updating...":"Update Model"]})]})]})}),a.jsx(m5e,{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(Ra,{}),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(ie,{onClick:()=>e("/focus-groups"),className:"mt-4",children:[a.jsx(um,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},vBe=({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(ie,{variant:"outline",children:"Export Data"}),a.jsx(ie,{children:"Generate Report"})]})]}),j_=({title:t,value:e,changePercentage:n,icon:r})=>a.jsx(yt,{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"})})]})}),yBe=[{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}],xBe=[{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"}],bBe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(yt,{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(Qc,{width:"100%",height:"100%",children:a.jsxs(d7,{data:yBe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(_g,{strokeDasharray:"3 3"}),a.jsx(fl,{dataKey:"name"}),a.jsx(hl,{}),a.jsx(ni,{}),a.jsx(ds,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(ds,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(ds,{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(yt,{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:[xBe.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(mu,{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(ie,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(yt,{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(Lv,{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(Lv,{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(Lv,{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(Lv,{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(ie,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),wBe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],SBe=()=>a.jsxs(yt,{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(ie,{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(Qc,{width:"100%",height:"100%",children:a.jsxs(lO,{children:[a.jsx(ni,{}),a.jsx(As,{data:wBe,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(ie,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),CBe=[{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}],oF=[{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"}],_Be=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],ABe=()=>{const t=ur();return a.jsxs(yt,{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(ie,{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(Qc,{width:"100%",height:"100%",children:a.jsxs(d7,{data:CBe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(_g,{strokeDasharray:"3 3"}),a.jsx(fl,{dataKey:"name"}),a.jsx(hl,{}),a.jsx(ni,{}),a.jsx(ds,{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(Qc,{width:"100%",height:"100%",children:a.jsxs(lO,{children:[a.jsx(ni,{}),a.jsx(As,{data:oF,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:e,percent:n})=>`${e} ${(n*100).toFixed(0)}%`,children:oF.map((e,n)=>a.jsx(av,{fill:e.color},`cell-${n}`))}),a.jsx(La,{})]})})})]})]}),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(Qc,{width:"100%",height:"100%",children:a.jsxs(u7,{data:_Be,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(_g,{strokeDasharray:"3 3"}),a.jsx(fl,{dataKey:"name"}),a.jsx(hl,{}),a.jsx(ni,{}),a.jsx(La,{}),a.jsx(jl,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(ie,{onClick:()=>t("/focus-groups"),children:"Manage Focus Groups"})})]})},jBe=()=>{const[t,e]=g.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Ra,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(vBe,{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(j_,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:Fr}),a.jsx(j_,{title:"Active Focus Groups",value:7,changePercentage:5,icon:na}),a.jsx(j_,{title:"Research Insights",value:124,changePercentage:18,icon:gu})]}),a.jsxs(wl,{value:t,onValueChange:e,className:"glass-panel rounded-xl p-6",children:[a.jsxs(tc,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(vn,{value:"overview",children:"Overview"}),a.jsx(vn,{value:"users",children:"Synthetic Users"}),a.jsx(vn,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(yn,{value:"overview",children:a.jsx(bBe,{})}),a.jsx(yn,{value:"users",children:a.jsx(SBe,{})}),a.jsx(yn,{value:"focus-groups",children:a.jsx(ABe,{})})]})]})]})},N7=g.forwardRef(({...t},e)=>a.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));N7.displayName="Breadcrumb";const T7=g.forwardRef(({className:t,...e},n)=>a.jsx("ol",{ref:n,className:Fe("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));T7.displayName="BreadcrumbList";const Qy=g.forwardRef(({className:t,...e},n)=>a.jsx("li",{ref:n,className:Fe("inline-flex items-center gap-1.5",t),...e}));Qy.displayName="BreadcrumbItem";const pE=g.forwardRef(({asChild:t,className:e,...n},r)=>{const i=t?ea:"a";return a.jsx(i,{ref:r,className:Fe("transition-colors hover:text-foreground",e),...n})});pE.displayName="BreadcrumbLink";const k7=g.forwardRef(({className:t,...e},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Fe("font-normal text-foreground",t),...e}));k7.displayName="BreadcrumbPage";const mE=({children:t,className:e,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:Fe("[&>svg]:size-3.5",e),...n,children:t??a.jsx(mo,{})});mE.displayName="BreadcrumbSeparator";function EBe({persona:t}){const e=t.id==="0",n=t.id==="1";return a.jsxs(yt,{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:Yg(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(Fr,{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(Qee,{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(MA,{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(wC,{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(MA,{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(fm,{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(Jee,{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(nte,{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(Kee,{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(rR,{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(Nx,{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(wC,{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(iR,{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(wC,{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(Nx,{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(iR,{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(rR,{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(fm,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function NBe({persona:t}){var e,n,r,i,o,s,c,l,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(yt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Py,{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(yt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(RB,{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(yt,{children:a.jsxs(Rt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(_a,{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(yt,{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(mu,{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(MA,{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(_a,{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 TBe({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(yt,{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(Qc,{width:"100%",height:"100%",children:a.jsxs(d5e,{outerRadius:90,data:e,children:[a.jsx(sq,{}),a.jsx(Sh,{dataKey:"trait"}),a.jsx(wh,{domain:[0,100]}),a.jsx(hv,{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 kBe({persona:t}){var r;const e=(i,o)=>{const s=[a.jsx(qee,{className:"sidebar-icon"},"grid"),a.jsx(rte,{className:"sidebar-icon"},"smartphone"),a.jsx(Wee,{className:"sidebar-icon"},"laptop"),a.jsx(Vee,{className:"sidebar-icon"},"grid2x2")];return s[o%s.length]},n=()=>t.scenarioType?t.scenarioType:"Life Scenarios";return a.jsx(yt,{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 PBe(){const t=ur();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(yt,{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(ie,{onClick:()=>t("/synthetic-users"),children:"Return to Personas"})]})})}function Vt({className:t,...e}){return a.jsx("div",{className:Fe("animate-pulse rounded-md bg-muted",t),...e})}function OBe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Ra,{}),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(Vt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(Vt,{className:"h-8 w-48 mx-auto"}),a.jsx(Vt,{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(yt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(Vt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Vt,{className:"h-6 w-32 mb-2"}),a.jsx(Vt,{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(Vt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Vt,{className:"h-4 w-20 mb-2"}),a.jsx(Vt,{className:"h-3 w-40 mb-1"}),a.jsx(Vt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Vt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Vt,{className:"h-4 w-16 mb-2"}),a.jsx(Vt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Vt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Vt,{className:"h-4 w-16 mb-2"}),a.jsx(Vt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(Vt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Vt,{className:"h-4 w-12 mb-2"}),a.jsx(Vt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Vt,{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(Vt,{className:"h-3 w-24"}),a.jsx(Vt,{className:"h-3 w-8"})]}),a.jsx(Vt,{className:"h-1.5 w-full rounded-full"})]},e))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(Vt,{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(Vt,{className:"h-4 w-4 mr-2"}),a.jsx(Vt,{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(Vt,{className:"h-10 w-full"}),a.jsx(Vt,{className:"h-10 w-full"}),a.jsx(Vt,{className:"h-10 w-full"})]}),a.jsx(yt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(Vt,{className:"h-6 w-48"}),a.jsx(Vt,{className:"h-4 w-full"}),a.jsx(Vt,{className:"h-4 w-full"}),a.jsx(Vt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Vt,{className:"h-6 w-32"}),a.jsx(Vt,{className:"h-4 w-full"}),a.jsx(Vt,{className:"h-4 w-full"}),a.jsx(Vt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(Vt,{className:"h-6 w-40"}),a.jsx(Vt,{className:"h-4 w-full"}),a.jsx(Vt,{className:"h-4 w-full"}),a.jsx(Vt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function IBe({message:t,onLoginSuccess:e,onCancel:n}){const{login:r}=la(),i=ur(),[o,s]=g.useState("user"),[c,l]=g.useState("pass"),[u,d]=g.useState(!1),f=async()=>{if(!o||!c){ae.error("Please enter username and password");return}d(!0);try{await r(o,c),ae.success("Login successful"),e&&e()}catch(p){console.error("Login error:",p),ae.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():i("/synthetic-users")};return a.jsxs(yt,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(Ei,{children:[a.jsx(Qi,{children:"Login Required"}),a.jsx(ok,{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(yo,{htmlFor:"username",children:"Username"}),a.jsx(Kt,{id:"username",placeholder:"Username",value:o,onChange:p=>s(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(yo,{htmlFor:"password",children:"Password"}),a.jsx(Kt,{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(sk,{className:"flex justify-between",children:[a.jsx(ie,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(ie,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(no,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function RBe({persona:t,onSave:e,onCancel:n}){var j,T,k,O,E,R,D,V,L,z,M,$,Q,q,te,xe;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]=g.useState(r),[s,c]=g.useState(!1),[l,u]=g.useState(!1),[d,f]=g.useState(null);g.useState(!1);const{isAuthenticated:h,token:p}=la();g.useEffect(()=>{(async()=>{l&&h&&p&&(u(!1),d&&await A())})()},[h,p,l]);const v=(B,ce)=>{o(he=>({...he,[B]:ce}))},m=(B,ce)=>{o(he=>({...he,oceanTraits:{...he.oceanTraits,[B]:ce}}))},y=B=>{o(ce=>({...ce,[B]:[...ce[B]||[],""]}))},b=(B,ce,he)=>{o(U=>{const de=[...U[B]||[]];return de[ce]=he,{...U,[B]:de}})},x=(B,ce)=>{o(he=>{const U=[...he[B]||[]];return U.splice(ce,1),{...he,[B]:U}})},w=(B,ce,he)=>{o(U=>{const de={...U.thinkFeelDo},se=[...de[B]||[]];return se[ce]=he,de[B]=se,{...U,thinkFeelDo:de}})},S=B=>{o(ce=>{var U;const he={...ce.thinkFeelDo,[B]:[...((U=ce.thinkFeelDo)==null?void 0:U[B])||[],""]};return{...ce,thinkFeelDo:he}})},C=(B,ce)=>{o(he=>{const U={...he.thinkFeelDo},de=[...U[B]||[]];return de.splice(ce,1),U[B]=de,{...he,thinkFeelDo:U}})},_=()=>{d&&(ae.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},A=async()=>{if(d){c(!0);try{const B={...d};delete B._id,delete B.isDbPersona;const ce=await Er.create(B),he={...d,id:ce.data._id||ce.data.id,_id:ce.data._id||ce.data.id,isDbPersona:!0};ae.success("Persona saved to database successfully"),u(!1),f(null),e(he)}catch(B){console.error("Error saving after login:",B),ae.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(IBe,{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(ie,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(um,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(ie,{onClick:async()=>{c(!0);try{const B=i._id||i.id,ce={...i};ce._id&&delete ce._id,delete ce.isDbPersona;let he;if(B&&typeof B=="string"&&B.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),he=await Er.create(ce),ae.success("Persona saved to database");const U={...i,id:he.data._id||he.data.id,_id:he.data._id||he.data.id,isDbPersona:!0};e(U)}else if(B){he=await Er.update(B,ce),ae.success("Persona updated successfully");const U={...i,isDbPersona:!0};e(U)}else{he=await Er.create(ce);const U={...i,id:he.data._id||he.data.id,_id:he.data._id||he.data.id,isDbPersona:!0};ae.success("Persona created successfully"),e(U)}}catch(B){console.error("Error saving persona:",B),B.response&&B.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),ae.error("Authentication error - saving locally instead"),e(i)):(f(i),u(!0)):(ae.error("Failed to save persona"),e(i))}finally{c(!1)}},disabled:s,children:[s?a.jsx(no,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(MN,{className:"h-4 w-4 mr-2"}),s?"Saving...":"Save Changes"]})]}),a.jsxs(wl,{defaultValue:"basic",children:[a.jsxs(tc,{className:"grid w-full grid-cols-6",children:[a.jsx(vn,{value:"basic",children:"Basic"}),a.jsx(vn,{value:"cooper",children:"Cooper"}),a.jsx(vn,{value:"personality",children:"Personality"}),a.jsx(vn,{value:"demographics",children:"Demographics"}),a.jsx(vn,{value:"lifestyle",children:"Lifestyle"}),a.jsx(vn,{value:"extended",children:"Extended"})]}),a.jsx(yn,{value:"basic",className:"mt-6",children:a.jsx(yt,{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(Kt,{value:i.name||"",onChange:B=>v("name",B.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(Tn,{value:i.age||"",onValueChange:B=>v("age",B),children:[a.jsx(An,{children:a.jsx(kn,{placeholder:"Select age range"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"18-24",children:"18-24"}),a.jsx(le,{value:"25-34",children:"25-34"}),a.jsx(le,{value:"35-44",children:"35-44"}),a.jsx(le,{value:"45-54",children:"45-54"}),a.jsx(le,{value:"55-64",children:"55-64"}),a.jsx(le,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(Tn,{value:i.gender||"",onValueChange:B=>v("gender",B),children:[a.jsx(An,{children:a.jsx(kn,{placeholder:"Select gender"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"Male",children:"Male"}),a.jsx(le,{value:"Female",children:"Female"}),a.jsx(le,{value:"Non-binary",children:"Non-binary"}),a.jsx(le,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(Kt,{value:i.occupation||"",onChange:B=>v("occupation",B.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(Tn,{value:i.education||"",onValueChange:B=>v("education",B),children:[a.jsx(An,{children:a.jsx(kn,{placeholder:"Select education level"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"High School",children:"High School"}),a.jsx(le,{value:"Some College",children:"Some College"}),a.jsx(le,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(le,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(le,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(le,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(Kt,{value:i.location||"",onChange:B=>v("location",B.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(Tn,{value:i.ethnicity||"",onValueChange:B=>v("ethnicity",B),children:[a.jsx(An,{children:a.jsx(kn,{placeholder:"Select ethnicity"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"white",children:"White"}),a.jsx(le,{value:"black",children:"Black"}),a.jsx(le,{value:"asian",children:"Asian"}),a.jsx(le,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(le,{value:"native-american",children:"Native American"}),a.jsx(le,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(le,{value:"mixed",children:"Mixed"}),a.jsx(le,{value:"other",children:"Other"}),a.jsx(le,{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(bt,{value:i.personality||"",onChange:B=>v("personality",B.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(bt,{value:i.interests||"",onChange:B=>v("interests",B.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(Sr,{value:[i.techSavviness],onValueChange:B=>v("techSavviness",B[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(Sr,{value:[i.brandLoyalty||0],onValueChange:B=>v("brandLoyalty",B[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(Sr,{value:[i.priceConsciousness||0],onValueChange:B=>v("priceConsciousness",B[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(Sr,{value:[i.environmentalConcern||0],onValueChange:B=>v("environmentalConcern",B[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(Dm,{checked:i.hasPurchasingPower||!1,onCheckedChange:B=>v("hasPurchasingPower",B)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(Dm,{checked:i.hasChildren||!1,onCheckedChange:B=>v("hasChildren",B)})]})]})]})]})})})}),a.jsxs(yn,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(yt,{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((B,ce)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Kt,{value:B||"",onChange:he=>b("goals",ce,he.target.value)}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>x("goals",ce),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},ce)),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>y("goals"),className:"mt-2",children:[a.jsx(Vr,{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((B,ce)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Kt,{value:B||"",onChange:he=>b("frustrations",ce,he.target.value)}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>x("frustrations",ce),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},ce)),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>y("frustrations"),className:"mt-2",children:[a.jsx(Vr,{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((B,ce)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Kt,{value:B||"",onChange:he=>b("motivations",ce,he.target.value)}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>x("motivations",ce),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},ce)),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>y("motivations"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(yt,{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((B,ce)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Kt,{value:B||"",onChange:he=>w("thinks",ce,he.target.value)}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>C("thinks",ce),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},ce)),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>S("thinks"),className:"mt-2",children:[a.jsx(Vr,{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"}),(((T=i.thinkFeelDo)==null?void 0:T.feels)||[]).map((B,ce)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Kt,{value:B||"",onChange:he=>w("feels",ce,he.target.value)}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>C("feels",ce),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},ce)),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>S("feels"),className:"mt-2",children:[a.jsx(Vr,{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((B,ce)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Kt,{value:B||"",onChange:he=>w("does",ce,he.target.value)}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>C("does",ce),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},ce)),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>S("does"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(yt,{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(Kt,{value:i.scenarioType||"",onChange:B=>v("scenarioType",B.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((B,ce)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(bt,{value:B||"",onChange:he=>b("scenarios",ce,he.target.value),rows:2}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>x("scenarios",ce),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},ce)),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>y("scenarios"),className:"mt-2",children:[a.jsx(Vr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(yn,{value:"personality",className:"mt-6",children:a.jsx(yt,{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(Sr,{value:[((E=i.oceanTraits)==null?void 0:E.openness)||50],onValueChange:B=>m("openness",B[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:[((R=i.oceanTraits)==null?void 0:R.conscientiousness)||50,"%"]})]}),a.jsx(Sr,{value:[((D=i.oceanTraits)==null?void 0:D.conscientiousness)||50],onValueChange:B=>m("conscientiousness",B[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:[((V=i.oceanTraits)==null?void 0:V.extraversion)||50,"%"]})]}),a.jsx(Sr,{value:[((L=i.oceanTraits)==null?void 0:L.extraversion)||50],onValueChange:B=>m("extraversion",B[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:[((z=i.oceanTraits)==null?void 0:z.agreeableness)||50,"%"]})]}),a.jsx(Sr,{value:[((M=i.oceanTraits)==null?void 0:M.agreeableness)||50],onValueChange:B=>m("agreeableness",B[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:[(($=i.oceanTraits)==null?void 0:$.neuroticism)||50,"%"]})]}),a.jsx(Sr,{value:[((Q=i.oceanTraits)==null?void 0:Q.neuroticism)||50],onValueChange:B=>m("neuroticism",B[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(yn,{value:"demographics",className:"mt-6",children:a.jsx(yt,{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(Tn,{value:i.socialGrade||"",onValueChange:B=>v("socialGrade",B),children:[a.jsx(An,{children:a.jsx(kn,{placeholder:"Select social grade"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"A",children:"A - Higher managerial"}),a.jsx(le,{value:"B",children:"B - Intermediate managerial"}),a.jsx(le,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(le,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(le,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(le,{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(Tn,{value:i.householdIncome||"",onValueChange:B=>v("householdIncome",B),children:[a.jsx(An,{children:a.jsx(kn,{placeholder:"Select income range"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"Under $25k",children:"Under $25,000"}),a.jsx(le,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(le,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(le,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(le,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(le,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(le,{value:"Over $250k",children:"Over $250,000"}),a.jsx(le,{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(Tn,{value:i.householdComposition||"",onValueChange:B=>v("householdComposition",B),children:[a.jsx(An,{children:a.jsx(kn,{placeholder:"Select household type"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"Single person",children:"Single person"}),a.jsx(le,{value:"Couple without children",children:"Couple without children"}),a.jsx(le,{value:"Couple with children",children:"Couple with children"}),a.jsx(le,{value:"Single parent",children:"Single parent"}),a.jsx(le,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(le,{value:"Shared housing",children:"Shared housing"}),a.jsx(le,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(Tn,{value:i.livingSituation||"",onValueChange:B=>v("livingSituation",B),children:[a.jsx(An,{children:a.jsx(kn,{placeholder:"Select living situation"})}),a.jsxs(jn,{children:[a.jsx(le,{value:"Own home",children:"Own home"}),a.jsx(le,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(le,{value:"Rent house",children:"Rent house"}),a.jsx(le,{value:"Live with family",children:"Live with family"}),a.jsx(le,{value:"Student housing",children:"Student housing"}),a.jsx(le,{value:"Assisted living",children:"Assisted living"}),a.jsx(le,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(yn,{value:"lifestyle",className:"mt-6",children:a.jsx(yt,{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(bt,{value:i.mediaConsumption||"",onChange:B=>v("mediaConsumption",B.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(bt,{value:i.deviceUsage||"",onChange:B=>v("deviceUsage",B.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(bt,{value:i.shoppingHabits||"",onChange:B=>v("shoppingHabits",B.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(bt,{value:i.brandPreferences||"",onChange:B=>v("brandPreferences",B.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(bt,{value:i.communicationPreferences||"",onChange:B=>v("communicationPreferences",B.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(bt,{value:i.paymentMethods||"",onChange:B=>v("paymentMethods",B.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(bt,{value:i.purchaseBehaviour||"",onChange:B=>v("purchaseBehaviour",B.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(yn,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(yt,{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(bt,{value:i.coreValues||"",onChange:B=>v("coreValues",B.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(bt,{value:i.lifestyleChoices||"",onChange:B=>v("lifestyleChoices",B.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(bt,{value:i.socialActivities||"",onChange:B=>v("socialActivities",B.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(bt,{value:i.categoryKnowledge||"",onChange:B=>v("categoryKnowledge",B.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(bt,{value:i.decisionInfluences||"",onChange:B=>v("decisionInfluences",B.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(bt,{value:i.painPoints||"",onChange:B=>v("painPoints",B.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(bt,{value:i.journeyContext||"",onChange:B=>v("journeyContext",B.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(bt,{value:i.keyTouchpoints||"",onChange:B=>v("keyTouchpoints",B.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(bt,{value:((q=i.selfDeterminationNeeds)==null?void 0:q.autonomy)||"",onChange:B=>v("selfDeterminationNeeds",{...i.selfDeterminationNeeds,autonomy:B.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(bt,{value:((te=i.selfDeterminationNeeds)==null?void 0:te.competence)||"",onChange:B=>v("selfDeterminationNeeds",{...i.selfDeterminationNeeds,competence:B.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(bt,{value:((xe=i.selfDeterminationNeeds)==null?void 0:xe.relatedness)||"",onChange:B=>v("selfDeterminationNeeds",{...i.selfDeterminationNeeds,relatedness:B.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(yt,{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((B,ce)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(Kt,{value:B,onChange:he=>b("fears",ce,he.target.value),placeholder:"Enter a fear or concern"}),a.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>x("fears",ce),children:a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"})})]},ce)),a.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>y("fears"),className:"mt-2",children:[a.jsx(Vr,{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(bt,{value:i.narrative||"",onChange:B=>v("narrative",B.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(bt,{value:i.additionalInformation||"",onChange:B=>v("additionalInformation",B.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"})]})]})})})]})]})]})}const MBe=$e.object({modificationPrompt:$e.string().min(10,{message:"Modification prompt must be at least 10 characters long."}),llm_model:$e.string().min(1,{message:"Please select an AI model."}),reasoning_effort:$e.string().optional(),verbosity:$e.string().optional()});function DBe({persona:t,isOpen:e,onClose:n,onPersonaModified:r}){const[i,o]=g.useState(!1),s=Hg({resolver:Vg(MBe),defaultValues:{modificationPrompt:"",llm_model:"gemini-2.5-pro",reasoning_effort:"medium",verbosity:"medium"}}),c=()=>{i||(s.reset(),n())},l=async u=>{var d;o(!0);try{Ve.info("Modifying persona with AI...",{description:`Using ${u.llm_model} to process your modification request`});const f=t._id||t.id,h=await Er.modifyWithAI(f,{modification_prompt:u.modificationPrompt,llm_model:u.llm_model,reasoning_effort:u.reasoning_effort||"medium",verbosity:u.verbosity||"medium"});if(h.data&&h.data.persona)Ve.success("Persona modified successfully!",{description:`${t.name} has been updated with AI modifications`}),r(h.data.persona),c();else throw new Error("Invalid response from server")}catch(f){if(console.error("Error modifying persona:",f),f.response){const h=((d=f.response.data)==null?void 0:d.error)||"Server error occurred";Ve.error("Failed to modify persona",{description:h})}else f.request?Ve.error("Network error",{description:"Unable to connect to the server"}):Ve.error("Modification failed",{description:f.message||"An unexpected error occurred"})}finally{o(!1)}};return a.jsx(Ma,{open:e,onOpenChange:c,children:a.jsxs(Ws,{className:"max-w-2xl",children:[a.jsxs(qs,{children:[a.jsxs(Qs,{className:"flex items-center gap-3",children:[a.jsx(ts,{className:"h-5 w-5 text-primary"}),"Modify Persona with Natural Language"]}),a.jsxs(Da,{children:["Describe the changes you'd like to make to ",a.jsx("strong",{children:t.name}),", and AI will modify the persona data accordingly."]})]}),a.jsx(Kg,{...s,children:a.jsxs("form",{onSubmit:s.handleSubmit(l),className:"space-y-6",children:[a.jsx(xt,{control:s.control,name:"modificationPrompt",render:({field:u})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Modification Instructions"}),a.jsx(gt,{children:a.jsx(bt,{...u,placeholder:"E.g., 'Make this person more tech-savvy and interested in sustainable products' or 'Increase their income level and add marketing experience'",className:"min-h-[120px]",disabled:i})}),a.jsx(Sn,{children:"Describe what aspects of the persona you'd like to modify or enhance"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:s.control,name:"llm_model",render:({field:u})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"AI Model"}),a.jsxs(Tn,{onValueChange:u.onChange,value:u.value,disabled:i,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select AI model"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(le,{value:"gpt-4.1",children:"GPT-4.1"}),a.jsx(le,{value:"gpt-5",children:"GPT-5"})]})]}),a.jsx(Sn,{children:"Choose which AI model to use for modifying the persona"}),a.jsx(vt,{})]})}),s.watch("llm_model")==="gpt-5"&&a.jsxs(a.Fragment,{children:[a.jsx(xt,{control:s.control,name:"reasoning_effort",render:({field:u})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Reasoning Effort"}),a.jsxs(Tn,{onValueChange:u.onChange,value:u.value,disabled:i,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select reasoning effort"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"minimal",children:"Minimal - Fast responses"}),a.jsx(le,{value:"low",children:"Low - Quick thinking"}),a.jsx(le,{value:"medium",children:"Medium - Balanced (default)"}),a.jsx(le,{value:"high",children:"High - Deep reasoning"})]})]}),a.jsx(Sn,{children:"Controls how much the AI thinks through the modification"}),a.jsx(vt,{})]})}),a.jsx(xt,{control:s.control,name:"verbosity",render:({field:u})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Response Detail"}),a.jsxs(Tn,{onValueChange:u.onChange,value:u.value,disabled:i,children:[a.jsx(gt,{children:a.jsx(An,{children:a.jsx(kn,{placeholder:"Select verbosity level"})})}),a.jsxs(jn,{children:[a.jsx(le,{value:"low",children:"Concise"}),a.jsx(le,{value:"medium",children:"Balanced (default)"}),a.jsx(le,{value:"high",children:"Detailed"})]})]}),a.jsx(Sn,{children:"Controls how detailed the AI's modifications will be"}),a.jsx(vt,{})]})})]}),a.jsxs(Ys,{children:[a.jsx(ie,{type:"button",variant:"outline",onClick:c,disabled:i,children:"Cancel"}),a.jsx(ie,{type:"submit",disabled:i,className:"flex items-center gap-2",children:i?a.jsxs(a.Fragment,{children:[a.jsx(no,{className:"h-4 w-4 animate-spin"}),"Processing..."]}):a.jsxs(a.Fragment,{children:[a.jsx(IB,{className:"h-4 w-4"}),"Process Persona Modification"]})})]})]})})]})})}function $Be(){const{id:t}=PN(),e=Ui(),n=ur(),{navigationState:r,clearNavigationState:i}=Ug(),[o,s]=g.useState(void 0),[c,l]=g.useState(!1),[u,d]=g.useState(!1),[f,h]=g.useState(!0);return g.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 Er.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),ae.error("Persona not found"))}catch(w){console.error("Error fetching persona:",w),m&&(s(void 0),h(!1),ae.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}`),i()):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"),i()):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 Er.update(t,b);console.log("Updated persona in database:",x);const w={...m,isDbPersona:!0};s(w),ae.success("Persona updated in database successfully")}else{const x=await Er.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),ae.success("Persona saved to database successfully")}}catch(y){return console.error("Error saving persona:",y),y.response&&y.response.status===401?ae.error("Authentication error - Please log in to save personas"):y.response&&y.response.status===404?ae.error("API endpoint not found - Database service may be unavailable"):ae.error("Failed to save persona to database: "+(y.message||"Unknown error")),!1}return!0}}}function sF(){var y;const{currentPersona:t,isEditing:e,isFromReview:n,isLoading:r,setIsEditing:i,handleGoBack:o,handleSaveEdit:s}=$Be(),{navigationState:c}=Ug(),[l,u]=g.useState(""),[d,f]=g.useState(!1),[h,p]=g.useState(!1);g.useEffect(()=>{var b;c.focusGroupId&&((b=c.previousRoute)!=null&&b.startsWith("/focus-groups/"))&&(async()=>{var w;try{const S=await St.getById(c.focusGroupId);(w=S==null?void 0:S.data)!=null&&w.name&&u(S.data.name)}catch(S){console.error("Error fetching focus group name:",S)}})()},[c.focusGroupId,c.previousRoute]);const v=((y=c.previousRoute)==null?void 0:y.startsWith("/focus-groups/"))&&c.focusGroupId&&Object.keys(c).length>0,m=async()=>{var b;if(t){f(!0);try{Ve.info("Generating persona profile...",{description:"Using GPT-4.1 to create a beautifully formatted markdown profile"});const x=t._id||t.id;console.log(`🔽 Frontend: Exporting profile for persona ${t.name} (ID: ${x})`);const w=await Er.exportProfile(x,{llm_model:"gpt-4.1",temperature:.3}),{markdown_content:S,persona_name:C,model_used:_,warning:A}=w.data;if(S){const j=new Date().toISOString().split("T")[0],k=`${C.replace(/[^a-zA-Z0-9\-\s]/g,"").replace(/\s+/g,"-").toLowerCase()}-profile-${j}.md`,O=document.createElement("a"),E=new Blob([S],{type:"text/markdown"});if(O.href=URL.createObjectURL(E),O.download=k,document.body.appendChild(O),O.click(),document.body.removeChild(O),A)Ve.success("Profile downloaded with fallback formatting",{description:`${C} profile saved as ${k}`});else{const R=_==="gpt-4.1"?"GPT-4.1":_;Ve.success("Profile downloaded successfully",{description:`${C} profile processed with ${R} and saved as ${k}`})}}else throw new Error("No markdown content received")}catch(x){console.error("Error exporting persona profile:",x),x.response?Ve.error("Failed to export profile",{description:((b=x.response.data)==null?void 0:b.error)||"Server error occurred"}):x.request?Ve.error("Network error",{description:"Unable to connect to the server"}):Ve.error("Export failed",{description:x.message||"An unexpected error occurred"})}finally{f(!1)}}};return r?a.jsx(OBe,{}):t?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(Ra,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[e?a.jsx(RBe,{persona:t,onSave:s,onCancel:()=>i(!1)}):a.jsxs(a.Fragment,{children:[v&&a.jsx("div",{className:"mb-4",children:a.jsx(N7,{children:a.jsxs(T7,{children:[a.jsx(Qy,{children:a.jsxs(pE,{href:"/focus-groups",className:"flex items-center",children:[a.jsx(Nx,{className:"h-4 w-4 mr-1"}),"Focus Groups"]})}),a.jsx(mE,{}),a.jsx(Qy,{children:a.jsxs(pE,{href:`/focus-groups/${c.focusGroupId}`,className:"flex items-center",children:[a.jsx(Fr,{className:"h-4 w-4 mr-1"}),l||"Focus Group Session"]})}),a.jsx(mE,{}),a.jsx(Qy,{children:a.jsxs(k7,{className:"flex items-center",children:[a.jsx(fm,{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(ie,{variant:"ghost",onClick:o,className:"absolute left-0 top-0 flex items-center",children:a.jsx(um,{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("div",{className:"absolute right-0 top-0 flex items-center gap-3",children:[a.jsxs(ie,{variant:"outline",onClick:m,disabled:d,className:"hover-transition",children:[a.jsx(ol,{className:"h-4 w-4 mr-2"}),d?"Generating...":"Download Profile"]}),a.jsxs(ie,{variant:"outline",onClick:()=>p(!0),className:"hover-transition",children:[a.jsx(ts,{className:"h-4 w-4 mr-2"}),"Modify with AI"]}),a.jsxs(ie,{onClick:()=>i(!0),children:[a.jsx(ote,{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(EBe,{persona:t})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(wl,{defaultValue:"cooper-profile",children:[a.jsxs(tc,{className:"grid w-full grid-cols-3",children:[a.jsx(vn,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(vn,{value:"personality",children:"Personality"}),a.jsx(vn,{value:"scenarios",children:"Scenarios"})]}),a.jsx(yn,{value:"cooper-profile",className:"mt-6",children:a.jsx(NBe,{persona:t})}),a.jsx(yn,{value:"personality",className:"mt-6",children:a.jsx(TBe,{persona:t})}),a.jsx(yn,{value:"scenarios",className:"mt-6",children:a.jsx(kBe,{persona:t})})]})})]})]}),t&&a.jsx(DBe,{persona:t,isOpen:h,onClose:()=>p(!1),onPersonaModified:b=>{window.location.reload()}})]})]}):a.jsx(PBe,{})}const LBe=$e.object({username:$e.string().min(3,"Username must be at least 3 characters"),password:$e.string().min(4,"Password must be at least 4 characters")});function FBe(){var h;const t=ur(),e=Ui(),{login:n,loginWithMicrosoft:r,isAuthenticated:i,isMsalLoading:o}=la(),[s,c]=g.useState(!1),l=((h=e.state)==null?void 0:h.from)||"/";console.log("Login page - destination path:",l),g.useEffect(()=>{i&&(console.log("User already authenticated, redirecting from login page"),t("/",{replace:!0}))},[i,t]);const u=Hg({resolver:Vg(LBe),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(v){console.error("Login error in form handler:",v),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(yt,{className:"w-full max-w-md",children:[a.jsxs(Ei,{className:"space-y-1",children:[a.jsx(Qi,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(ok,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsxs(Rt,{children:[a.jsx("div",{className:"mb-6",children:a.jsx(ie,{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(no,{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(Kg,{...u,children:a.jsxs("form",{onSubmit:u.handleSubmit(d),className:"space-y-4",children:[a.jsx(xt,{control:u.control,name:"username",render:({field:p})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Username"}),a.jsx(gt,{children:a.jsx(Kt,{placeholder:"Enter your username",...p,disabled:s,autoComplete:"username"})}),a.jsx(vt,{})]})}),a.jsx(xt,{control:u.control,name:"password",render:({field:p})=>a.jsxs(pt,{children:[a.jsx(mt,{children:"Password"}),a.jsx(gt,{children:a.jsx(Kt,{placeholder:"Enter your password",type:"password",...p,disabled:s,autoComplete:"current-password"})}),a.jsx(vt,{})]})}),a.jsx(ie,{type:"submit",className:"w-full",disabled:s||o,children:s?"Signing in...":"Sign In"})]})})]}),a.jsxs(sk,{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(ie,{variant:"outline",onClick:()=>t("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(ie,{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)),Ve.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 ed({children:t}){const{isAuthenticated:e,isLoading:n}=la(),r=Ui();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(TB,{to:"/login",state:{from:r.pathname},replace:!0}))}const BBe=g.createContext({});let aF=!1;function UBe({children:t}){const{token:e}=la(),n=()=>{const i=e||localStorage.getItem("auth_token");return console.log("🔧 [GPT-5 Context] Getting token:",i?"Found":"Missing"),i||""};g.useEffect(()=>(aF||(console.log("🔧 [GPT-5 Context] Initializing singleton socket"),j7(n),aF=!0),console.log("🔧 [GPT-5 Context] Connecting socket"),E7(),()=>{}),[e]);const r={};return a.jsx(BBe.Provider,{value:r,children:t})}const P7=new WT(Hse);P7.initialize().catch(t=>{console.error("MSAL initialization error:",t)});function zBe({children:t}){return a.jsx(Use,{instance:P7,children:t})}const HBe=new EZ,VBe=()=>a.jsx(TZ,{client:HBe,children:a.jsx(Aee,{basename:"/semblance/",children:a.jsx(zBe,{children:a.jsx(Gse,{children:a.jsx(UBe,{children:a.jsx(Yse,{children:a.jsxs(iZ,{children:[a.jsx(OQ,{}),a.jsxs(vee,{children:[a.jsx(zo,{path:"/",element:a.jsx(Wse,{})}),a.jsx(zo,{path:"/login",element:a.jsx(FBe,{})}),a.jsx(zo,{path:"/synthetic-users",element:a.jsx(ed,{children:a.jsx(Jfe,{})})}),a.jsx(zo,{path:"/synthetic-users/:id",element:a.jsx(ed,{children:a.jsx(sF,{})})}),a.jsx(zo,{path:"/personas/:id",element:a.jsx(ed,{children:a.jsx(sF,{})})}),a.jsx(zo,{path:"/focus-groups",element:a.jsx(ed,{children:a.jsx(Ype,{})})}),a.jsx(zo,{path:"/focus-groups/:id",element:a.jsx(ed,{children:a.jsx(gBe,{})})}),a.jsx(zo,{path:"/dashboard",element:a.jsx(ed,{children:a.jsx(jBe,{})})}),a.jsx(zo,{path:"/old-path",element:a.jsx(TB,{to:"/",replace:!0})}),a.jsx(zo,{path:"*",element:a.jsx(qse,{})})]})]})})})})})})});k5(document.getElementById("root")).render(a.jsx(VBe,{})); diff --git a/dist/assets/index-QYazl09u.css b/dist/assets/index-QYazl09u.css deleted file mode 100644 index c5bb4ece..00000000 --- a/dist/assets/index-QYazl09u.css +++ /dev/null @@ -1 +0,0 @@ -@import"https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap";.back-button{position:absolute;top:1.25rem;left:1.25rem;z-index:10;display:flex;align-items:center;justify-content:center;width:2.5rem;height:2.5rem;border-radius:9999px;background-color:#fffc;border:1px solid rgba(0,0,0,.1);-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);transition:all .15s ease}.back-button:hover{background-color:#ffffffe6;transform:translateY(-1px);box-shadow:0 2px 4px #0000000d}.back-button:active{transform:translateY(0)}.back-button-content{display:flex;align-items:center;gap:.25rem}.page-header-with-back{display:flex;align-items:center;gap:.75rem;padding-left:2.5rem;position:relative}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Inter,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 350 30% 98%;--foreground: 345 30% 15%;--card: 0 0% 100%;--card-foreground: 345 30% 15%;--popover: 0 0% 100%;--popover-foreground: 345 30% 15%;--primary: 350 85% 80%;--primary-foreground: 350 30% 20%;--secondary: 350 30% 96.1%;--secondary-foreground: 345 30% 15%;--muted: 350 30% 96.1%;--muted-foreground: 350 10% 50%;--accent: 350 30% 96.1%;--accent-foreground: 345 30% 15%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 350 30% 98%;--border: 350 30% 91.4%;--input: 350 30% 91.4%;--ring: 350 85% 80%;--radius: .5rem;--sidebar-background: 0 0% 100%;--sidebar-foreground: 345 30% 15%;--sidebar-primary: 350 85% 80%;--sidebar-primary-foreground: 350 30% 20%;--sidebar-accent: 350 30% 96.1%;--sidebar-accent-foreground: 345 30% 15%;--sidebar-border: 350 30% 91.4%;--sidebar-ring: 350 85% 80%}.dark{--background: 345 30% 10%;--foreground: 350 30% 98%;--card: 345 30% 10%;--card-foreground: 350 30% 98%;--popover: 345 30% 10%;--popover-foreground: 350 30% 98%;--primary: 350 85% 80%;--primary-foreground: 345 30% 15%;--secondary: 342 20% 17.5%;--secondary-foreground: 350 30% 98%;--muted: 342 20% 17.5%;--muted-foreground: 350 10% 70%;--accent: 342 20% 17.5%;--accent-foreground: 350 30% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 350 30% 98%;--border: 342 20% 17.5%;--input: 342 20% 17.5%;--ring: 350 70% 85%;--sidebar-background: 345 30% 10%;--sidebar-foreground: 350 30% 98%;--sidebar-primary: 350 85% 80%;--sidebar-primary-foreground: 350 30% 98%;--sidebar-accent: 342 20% 17.5%;--sidebar-accent-foreground: 350 30% 98%;--sidebar-border: 342 20% 17.5%;--sidebar-ring: 350 70% 85%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));font-family:Inter,system-ui,sans-serif;color:hsl(var(--foreground));font-feature-settings:"rlig" 1,"calt" 1}::-webkit-scrollbar{width:8px;height:8px}::-webkit-scrollbar-track{background-color:transparent}::-webkit-scrollbar-thumb{border-radius:9999px;background-color:hsl(var(--muted-foreground) / .4)}::-webkit-scrollbar-thumb:hover{background-color:hsl(var(--muted-foreground) / .6)}@font-face{font-family:SF Pro Display;src:local("SF Pro Display"),local("SFProDisplay"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-regular-webfont.woff) format("woff");font-weight:400;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Medium"),local("SFProDisplay-Medium"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-medium-webfont.woff) format("woff");font-weight:500;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Semibold"),local("SFProDisplay-Semibold"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-semibold-webfont.woff) format("woff");font-weight:600;font-style:normal}@font-face{font-family:SF Pro Display;src:local("SF Pro Display Bold"),local("SFProDisplay-Bold"),url(https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-bold-webfont.woff) format("woff");font-weight:700;font-style:normal}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.glass-card{border-width:1px;border-color:#fff3;background-color:#fffc;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.glass-panel{border-width:1px;border-color:#fff6;background-color:#ffffffe6;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow);--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.text-gradient{background-image:linear-gradient(to right,var(--tw-gradient-stops));--tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);--tw-gradient-to: #f9a8d4 var(--tw-gradient-to-position);-webkit-background-clip:text;background-clip:text;color:transparent}.hover-transition{transition-property:all;transition-duration:.3s;transition-timing-function:cubic-bezier(.4,0,.2,1);animation-duration:.3s;animation-timing-function:cubic-bezier(.4,0,.2,1)}.button-transition{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1)}.sidebar-icon{margin-right:.75rem;margin-top:.125rem;height:1rem;width:1rem;flex-shrink:0;--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.sidebar-section{display:flex;align-items:flex-start}.sidebar-sub-item{font-size:.875rem;line-height:1.25rem;color:hsl(var(--muted-foreground))}.persona-card{position:relative;overflow:hidden;min-height:360px}.persona-card-overlay{pointer-events:none;position:absolute;top:0;right:0;bottom:0;left:0;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1)}.persona-card:hover .persona-card-overlay,.persona-card.selected .persona-card-overlay{background-color:#ecd1de4d}.persona-card-checkmark{position:absolute;top:.75rem;left:.75rem;z-index:20;opacity:0;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.2s;transition-timing-function:cubic-bezier(0,0,.2,1);animation-duration:.2s;animation-timing-function:cubic-bezier(0,0,.2,1);border-radius:9999px;border-width:1px;border-color:#fff6;background-color:#ffffffe6;padding:.25rem;--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.persona-card.selected .persona-card-checkmark{opacity:1}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-bottom-12{bottom:-3rem}.-left-12{left:-3rem}.-right-12{right:-3rem}.-top-12{top:-3rem}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.bottom-5{bottom:1.25rem}.bottom-6{bottom:1.5rem}.bottom-\[-10rem\]{bottom:-10rem}.bottom-full{bottom:100%}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-3{left:.75rem}.left-4{left:1rem}.left-\[50\%\]{left:50%}.left-\[calc\(50\%\+11rem\)\]{left:calc(50% + 11rem)}.left-\[calc\(50\%-11rem\)\]{left:calc(50% - 11rem)}.right-0{right:0}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-16{top:4rem}.top-2{top:.5rem}.top-20{top:5rem}.top-3\.5{top:.875rem}.top-4{top:1rem}.top-\[-10rem\]{top:-10rem}.top-\[1px\]{top:1px}.top-\[50\%\]{top:50%}.top-\[60\%\]{top:60%}.top-full{top:100%}.isolate{isolation:isolate}.-z-10{z-index:-10}.z-10{z-index:10}.z-20{z-index:20}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[1\]{z-index:1}.col-span-full{grid-column:1 / -1}.m-0{margin:0}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.mx-3\.5{margin-left:.875rem;margin-right:.875rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.-ml-4{margin-left:-1rem}.-mt-4{margin-top:-1rem}.mb-1{margin-bottom:.25rem}.mb-16{margin-bottom:4rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mr-5{margin-right:1.25rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-10{margin-top:2.5rem}.mt-12{margin-top:3rem}.mt-16{margin-top:4rem}.mt-2{margin-top:.5rem}.mt-24{margin-top:6rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-\[1155\/678\]{aspect-ratio:1155/678}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.h-0{height:0px}.h-1{height:.25rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-36{height:9rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-80{height:20rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[25vh\]{height:25vh}.h-\[450px\]{height:450px}.h-\[70vh\]{height:70vh}.h-\[calc\(100vh-12rem\)\]{height:calc(100vh - 12rem)}.h-\[var\(--radix-navigation-menu-viewport-height\)\]{height:var(--radix-navigation-menu-viewport-height)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-svh{height:100svh}.max-h-48{max-height:12rem}.max-h-60{max-height:15rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[400px\]{max-height:400px}.max-h-\[70vh\]{max-height:70vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-full{max-height:100%}.min-h-0{min-height:0px}.min-h-\[100px\]{min-height:100px}.min-h-\[120px\]{min-height:120px}.min-h-\[2rem\]{min-height:2rem}.min-h-\[40px\]{min-height:40px}.min-h-\[60px\]{min-height:60px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.min-h-svh{min-height:100svh}.w-0{width:0px}.w-1{width:.25rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-2\/3{width:66.666667%}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-36{width:9rem}.w-4{width:1rem}.w-40{width:10rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-5\/6{width:83.333333%}.w-6{width:1.5rem}.w-64{width:16rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--sidebar-width\]{width:var(--sidebar-width)}.w-\[100px\]{width:100px}.w-\[1px\]{width:1px}.w-\[350px\]{width:350px}.w-\[36\.125rem\]{width:36.125rem}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-max{width:-moz-max-content;width:max-content}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-32{min-width:8rem}.min-w-36{min-width:9rem}.min-w-5{min-width:1.25rem}.min-w-\[12rem\]{min-width:12rem}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[--skeleton-width\]{max-width:var(--skeleton-width)}.max-w-\[400px\]{max-width:400px}.max-w-\[70\%\]{max-width:70%}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-max{max-width:-moz-max-content;max-width:max-content}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.grow-0{flex-grow:0}.basis-full{flex-basis:100%}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-px{--tw-translate-x: -1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-px{--tw-translate-x: 1px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-45{--tw-rotate: 45deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-90{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-\[30deg\]{--tw-rotate: 30deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[1\.02\]{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform-gpu{transform:translate3d(var(--tw-translate-x),var(--tw-translate-y),0) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.animate-fade-in{animation:fade-in .5s ease-out}@keyframes float{0%,to{transform:translateY(0)}50%{transform:translateY(-5px)}}.animate-float{animation:float 3s ease-in-out infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize-none{resize:none}.resize-y{resize:vertical}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-4{-moz-column-gap:1rem;column-gap:1rem}.gap-x-6{-moz-column-gap:1.5rem;column-gap:1.5rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-8>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(2rem * var(--tw-space-x-reverse));margin-left:calc(2rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-\[10px\]{border-top-left-radius:10px;border-top-right-radius:10px}.rounded-tl-sm{border-top-left-radius:calc(var(--radius) - 4px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-\[1\.5px\]{border-width:1.5px}.border-y{border-top-width:1px;border-bottom-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-t-2{border-top-width:2px}.border-dashed{border-style:dashed}.border-\[\#0078d4\]{--tw-border-opacity: 1;border-color:rgb(0 120 212 / var(--tw-border-opacity, 1))}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-500{--tw-border-opacity: 1;border-color:rgb(59 130 246 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-destructive\/20{border-color:hsl(var(--destructive) / .2)}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted-foreground\/20{border-color:hsl(var(--muted-foreground) / .2)}.border-muted-foreground\/30{border-color:hsl(var(--muted-foreground) / .3)}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-purple-200{--tw-border-opacity: 1;border-color:rgb(233 213 255 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-sidebar-border{border-color:hsl(var(--sidebar-border))}.border-slate-100{--tw-border-opacity: 1;border-color:rgb(241 245 249 / var(--tw-border-opacity, 1))}.border-slate-200{--tw-border-opacity: 1;border-color:rgb(226 232 240 / var(--tw-border-opacity, 1))}.border-slate-200\/80{border-color:#e2e8f0cc}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.border-l-green-500{--tw-border-opacity: 1;border-left-color:rgb(34 197 94 / var(--tw-border-opacity, 1))}.border-l-primary{border-left-color:hsl(var(--primary))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[\#0078d4\]{--tw-bg-opacity: 1;background-color:rgb(0 120 212 / var(--tw-bg-opacity, 1))}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-amber-500{--tw-bg-opacity: 1;background-color:rgb(245 158 11 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-50\/50{background-color:#eff6ff80}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-destructive\/10{background-color:hsl(var(--destructive) / .1)}.bg-foreground{background-color:hsl(var(--foreground))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-500{--tw-bg-opacity: 1;background-color:rgb(107 114 128 / var(--tw-bg-opacity, 1))}.bg-gray-900\/10{background-color:#1118271a}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-400{--tw-bg-opacity: 1;background-color:rgb(74 222 128 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-pink-200{--tw-bg-opacity: 1;background-color:rgb(251 207 232 / var(--tw-bg-opacity, 1))}.bg-pink-300{--tw-bg-opacity: 1;background-color:rgb(249 168 212 / var(--tw-bg-opacity, 1))}.bg-pink-400{--tw-bg-opacity: 1;background-color:rgb(244 114 182 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-100{--tw-bg-opacity: 1;background-color:rgb(243 232 255 / var(--tw-bg-opacity, 1))}.bg-purple-50{--tw-bg-opacity: 1;background-color:rgb(250 245 255 / var(--tw-bg-opacity, 1))}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-400{--tw-bg-opacity: 1;background-color:rgb(248 113 113 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-sidebar{background-color:hsl(var(--sidebar-background))}.bg-sidebar-border{background-color:hsl(var(--sidebar-border))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-50{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/70{background-color:#ffffffb3}.bg-white\/80{background-color:#fffc}.bg-yellow-400{--tw-bg-opacity: 1;background-color:rgb(250 204 21 / var(--tw-bg-opacity, 1))}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-gradient-to-b{background-image:linear-gradient(to bottom,var(--tw-gradient-stops))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-tr{background-image:linear-gradient(to top right,var(--tw-gradient-stops))}.from-blue-400{--tw-gradient-from: #60a5fa var(--tw-gradient-from-position);--tw-gradient-to: rgb(96 165 250 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-100{--tw-gradient-from: #f3f4f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(243 244 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary{--tw-gradient-from: hsl(var(--primary)) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-white{--tw-gradient-from: #fff var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-blue-400{--tw-gradient-to: #60a5fa var(--tw-gradient-to-position)}.to-blue-400\/5{--tw-gradient-to: rgb(96 165 250 / .05) var(--tw-gradient-to-position)}.to-gray-200{--tw-gradient-to: #e5e7eb var(--tw-gradient-to-position)}.to-primary{--tw-gradient-to: hsl(var(--primary)) var(--tw-gradient-to-position)}.to-slate-50{--tw-gradient-to: #f8fafc var(--tw-gradient-to-position)}.fill-amber-400{fill:#fbbf24}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-2\.5{padding-left:.625rem}.pl-4{padding-left:1rem}.pl-8{padding-left:2rem}.pr-2{padding-right:.5rem}.pr-2\.5{padding-right:.625rem}.pr-4{padding-right:1rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-16{padding-top:4rem}.pt-2{padding-top:.5rem}.pt-20{padding-top:5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.font-sans{font-family:Inter,system-ui,sans-serif}.font-sf{font-family:SF Pro Display,system-ui,sans-serif}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[0\.8rem\]{font-size:.8rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-6{line-height:1.5rem}.leading-8{line-height:2rem}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-400{--tw-text-opacity: 1;color:rgb(251 191 36 / var(--tw-text-opacity, 1))}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-amber-800{--tw-text-opacity: 1;color:rgb(146 64 14 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-800{--tw-text-opacity: 1;color:rgb(31 41 55 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-green-800{--tw-text-opacity: 1;color:rgb(22 101 52 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/40{color:hsl(var(--muted-foreground) / .4)}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-purple-600{--tw-text-opacity: 1;color:rgb(147 51 234 / var(--tw-text-opacity, 1))}.text-purple-700{--tw-text-opacity: 1;color:rgb(126 34 206 / var(--tw-text-opacity, 1))}.text-purple-800{--tw-text-opacity: 1;color:rgb(107 33 168 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-800{--tw-text-opacity: 1;color:rgb(153 27 27 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sidebar-foreground{color:hsl(var(--sidebar-foreground))}.text-sidebar-foreground\/70{color:hsl(var(--sidebar-foreground) / .7)}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity, 1))}.text-slate-500{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.text-slate-600{--tw-text-opacity: 1;color:rgb(71 85 105 / var(--tw-text-opacity, 1))}.text-slate-700{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.text-slate-800{--tw-text-opacity: 1;color:rgb(30 41 59 / var(--tw-text-opacity, 1))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.shadow-\[0_-2px_4px_rgba\(0\,0\,0\,0\.05\)\]{--tw-shadow: 0 -2px 4px rgba(0,0,0,.05);--tw-shadow-colored: 0 -2px 4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_0_1px_hsl\(var\(--sidebar-border\)\)\]{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-border));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-blue-200{--tw-ring-opacity: 1;--tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity, 1))}.ring-blue-500{--tw-ring-opacity: 1;--tw-ring-color: rgb(59 130 246 / var(--tw-ring-opacity, 1))}.ring-gray-900\/10{--tw-ring-color: rgb(17 24 39 / .1)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-red-400{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.ring-ring{--tw-ring-color: hsl(var(--ring))}.ring-sidebar-ring{--tw-ring-color: hsl(var(--sidebar-ring))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.ring-offset-white{--tw-ring-offset-color: #fff}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[left\,right\,width\]{transition-property:left,right,width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[margin\,opa\]{transition-property:margin,opa;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\,height\,padding\]{transition-property:width,height,padding;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\[width\]{transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{transition-timing-function:linear}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.fade-in-80{--tw-enter-opacity: .8}.zoom-in-95{--tw-enter-scale: .95}.duration-1000{animation-duration:1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.ease-linear{animation-timing-function:linear}.running{animation-play-state:running}.paused{animation-play-state:paused}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::-moz-placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity: 1;color:rgb(100 116 139 / var(--tw-text-opacity, 1))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:-inset-2:after{content:var(--tw-content);top:-.5rem;right:-.5rem;bottom:-.5rem;left:-.5rem}.after\:inset-y-0:after{content:var(--tw-content);top:0;bottom:0}.after\:left-1\/2:after{content:var(--tw-content);left:50%}.after\:w-1:after{content:var(--tw-content);width:.25rem}.after\:w-\[2px\]:after{content:var(--tw-content);width:2px}.after\:-translate-x-1\/2:after{content:var(--tw-content);--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.first\:rounded-l-md:first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.first\:border-l:first-child{border-left-width:1px}.last\:rounded-r-md:last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.last\:border-b-0:last-child{border-bottom-width:0px}.last\:pb-0:last-child{padding-bottom:0}.focus-within\:relative:focus-within{position:relative}.focus-within\:z-20:focus-within{z-index:20}.hover\:translate-y-\[-2px\]:hover{--tw-translate-y: -2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:translate-y-\[-4px\]:hover{--tw-translate-y: -4px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[\#106ebe\]:hover{--tw-border-opacity: 1;border-color:rgb(16 110 190 / var(--tw-border-opacity, 1))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:border-slate-300:hover{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity, 1))}.hover\:bg-\[\#106ebe\]:hover{--tw-bg-opacity: 1;background-color:rgb(16 110 190 / var(--tw-bg-opacity, 1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-blue-100:hover{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50\/50:hover{background-color:#f9fafb80}.hover\:bg-green-600:hover{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.hover\:bg-muted:hover{background-color:hsl(var(--muted))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary:hover{background-color:hsl(var(--primary))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-100:hover{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-sidebar-accent:hover{background-color:hsl(var(--sidebar-accent))}.hover\:bg-slate-100:hover{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-200:hover{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-300:hover{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.hover\:bg-slate-50:hover{--tw-bg-opacity: 1;background-color:rgb(248 250 252 / var(--tw-bg-opacity, 1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity: 1;background-color:rgb(202 138 4 / var(--tw-bg-opacity, 1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-blue-800:hover{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.hover\:text-destructive:hover{color:hsl(var(--destructive))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.hover\:text-muted-foreground:hover{color:hsl(var(--muted-foreground))}.hover\:text-primary:hover{color:hsl(var(--primary))}.hover\:text-primary-foreground:hover{color:hsl(var(--primary-foreground))}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-sidebar-accent-foreground:hover{color:hsl(var(--sidebar-accent-foreground))}.hover\:text-slate-900:hover{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-\[0_0_0_1px_hsl\(var\(--sidebar-accent\)\)\]:hover{--tw-shadow: 0 0 0 1px hsl(var(--sidebar-accent));--tw-shadow-colored: 0 0 0 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-gray-900\/20:hover{--tw-ring-color: rgb(17 24 39 / .2)}.hover\:after\:bg-sidebar-border:hover:after{content:var(--tw-content);background-color:hsl(var(--sidebar-border))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-primary:focus{background-color:hsl(var(--primary))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-primary-foreground:focus{color:hsl(var(--primary-foreground))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-primary:focus{--tw-ring-color: hsl(var(--primary))}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-sidebar-ring:focus-visible{--tw-ring-color: hsl(var(--sidebar-ring))}.focus-visible\:ring-slate-950:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(2 6 23 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:bg-sidebar-accent:active{background-color:hsl(var(--sidebar-accent))}.active\:text-sidebar-accent-foreground:active{color:hsl(var(--sidebar-accent-foreground))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group\/menu-item:focus-within .group-focus-within\/menu-item\:opacity-100{opacity:1}.group\/menu-item:hover .group-hover\/menu-item\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.group.toast .group-\[\.toast\]\:absolute{position:absolute}.group.toast .group-\[\.toast\]\:left-3{left:.75rem}.group.toast .group-\[\.toast\]\:top-3{top:.75rem}.group.toast .group-\[\.toast\]\:h-5{height:1.25rem}.group.toast .group-\[\.toast\]\:w-5{width:1.25rem}.group.toast .group-\[\.toast\]\:rounded-md{border-radius:calc(var(--radius) - 2px)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.toast .group-\[\.toast\]\:p-1{padding:.25rem}.group.toaster .group-\[\.toaster\]\:pr-8{padding-right:2rem}.group.toast .group-\[\.toast\]\:text-foreground\/70{color:hsl(var(--foreground) / .7)}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toast .group-\[\.toast\]\:opacity-100{opacity:1}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group.toast .group-\[\.toast\]\:transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.group.toast .hover\:group-\[\.toast\]\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.group.toast .hover\:group-\[\.toast\]\:text-foreground:hover{color:hsl(var(--foreground))}.group.toast .focus\:group-\[\.toast\]\:opacity-100:focus{opacity:1}.group.toast .focus\:group-\[\.toast\]\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.group.toast .focus\:group-\[\.toast\]\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group.toast .focus\:group-\[\.toast\]\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.peer\/menu-button:hover~.peer-hover\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.has-\[\[data-variant\=inset\]\]\:bg-sidebar:has([data-variant=inset]){background-color:hsl(var(--sidebar-background))}.has-\[\:disabled\]\:opacity-50:has(:disabled){opacity:.5}.group\/menu-item:has([data-sidebar=menu-action]) .group-has-\[\[data-sidebar\=menu-action\]\]\/menu-item\:pr-8{padding-right:2rem}.aria-disabled\:pointer-events-none[aria-disabled=true]{pointer-events:none}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:bg-accent[aria-selected=true]{background-color:hsl(var(--accent))}.aria-selected\:bg-accent\/50[aria-selected=true]{background-color:hsl(var(--accent) / .5)}.aria-selected\:text-accent-foreground[aria-selected=true]{color:hsl(var(--accent-foreground))}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.aria-selected\:opacity-100[aria-selected=true]{opacity:1}.aria-selected\:opacity-30[aria-selected=true]{opacity:.3}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[panel-group-direction\=vertical\]\:h-px[data-panel-group-direction=vertical]{height:1px}.data-\[panel-group-direction\=vertical\]\:w-full[data-panel-group-direction=vertical]{width:100%}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x: 1.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=open\]\:rotate-90[data-state=open]{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes accordion-up{0%{height:var(--radix-accordion-content-height)}to{height:0}}.data-\[state\=closed\]\:animate-accordion-up[data-state=closed]{animation:accordion-up .2s ease-out}@keyframes accordion-down{0%{height:0}to{height:var(--radix-accordion-content-height)}}.data-\[state\=open\]\:animate-accordion-down[data-state=open]{animation:accordion-down .2s ease-out}.data-\[panel-group-direction\=vertical\]\:flex-col[data-panel-group-direction=vertical]{flex-direction:column}.data-\[active\=true\]\:bg-sidebar-accent[data-active=true]{background-color:hsl(var(--sidebar-accent))}.data-\[active\]\:bg-accent\/50[data-active]{background-color:hsl(var(--accent) / .5)}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=on\]\:bg-accent[data-state=on],.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=open\]\:bg-accent\/50[data-state=open]{background-color:hsl(var(--accent) / .5)}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[active\=true\]\:font-medium[data-active=true]{font-weight:500}.data-\[active\=true\]\:text-sidebar-accent-foreground[data-active=true]{color:hsl(var(--sidebar-accent-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=on\]\:text-accent-foreground[data-state=on],.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=open\]\:opacity-100[data-state=open]{opacity:1}.data-\[state\=active\]\:shadow-sm[data-state=active]{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[motion\^\=from-\]\:animate-in[data-motion^=from-],.data-\[state\=open\]\:animate-in[data-state=open],.data-\[state\=visible\]\:animate-in[data-state=visible]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[motion\^\=to-\]\:animate-out[data-motion^=to-],.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[state\=hidden\]\:animate-out[data-state=hidden]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[motion\^\=from-\]\:fade-in[data-motion^=from-]{--tw-enter-opacity: 0}.data-\[motion\^\=to-\]\:fade-out[data-motion^=to-],.data-\[state\=closed\]\:fade-out-0[data-state=closed],.data-\[state\=hidden\]\:fade-out[data-state=hidden]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open],.data-\[state\=visible\]\:fade-in[data-state=visible]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[state\=open\]\:zoom-in-90[data-state=open]{--tw-enter-scale: .9}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale: .95}.data-\[motion\=from-end\]\:slide-in-from-right-52[data-motion=from-end]{--tw-enter-translate-x: 13rem}.data-\[motion\=from-start\]\:slide-in-from-left-52[data-motion=from-start]{--tw-enter-translate-x: -13rem}.data-\[motion\=to-end\]\:slide-out-to-right-52[data-motion=to-end]{--tw-exit-translate-x: 13rem}.data-\[motion\=to-start\]\:slide-out-to-left-52[data-motion=to-start]{--tw-exit-translate-x: -13rem}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x: -50%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y: -48%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x: -50%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y: -48%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}.data-\[panel-group-direction\=vertical\]\:after\:left-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);left:0}.data-\[panel-group-direction\=vertical\]\:after\:h-1[data-panel-group-direction=vertical]:after{content:var(--tw-content);height:.25rem}.data-\[panel-group-direction\=vertical\]\:after\:w-full[data-panel-group-direction=vertical]:after{content:var(--tw-content);width:100%}.data-\[panel-group-direction\=vertical\]\:after\:-translate-y-1\/2[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[panel-group-direction\=vertical\]\:after\:translate-x-0[data-panel-group-direction=vertical]:after{content:var(--tw-content);--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=open\]\:hover\:bg-sidebar-accent:hover[data-state=open]{background-color:hsl(var(--sidebar-accent))}.data-\[state\=open\]\:hover\:text-sidebar-accent-foreground:hover[data-state=open]{color:hsl(var(--sidebar-accent-foreground))}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:left-\[calc\(var\(--sidebar-width\)\*-1\)\]{left:calc(var(--sidebar-width) * -1)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:right-\[calc\(var\(--sidebar-width\)\*-1\)\]{right:calc(var(--sidebar-width) * -1)}.group[data-side=left] .group-data-\[side\=left\]\:-right-4{right:-1rem}.group[data-side=right] .group-data-\[side\=right\]\:left-0{left:0}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:-mt-8{margin-top:-2rem}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:hidden{display:none}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!size-8{width:2rem!important;height:2rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[--sidebar-width-icon\]{width:var(--sidebar-width-icon)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)\)\]{width:calc(var(--sidebar-width-icon) + 1rem)}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:w-\[calc\(var\(--sidebar-width-icon\)_\+_theme\(spacing\.4\)_\+2px\)\]{width:calc(var(--sidebar-width-icon) + 1rem + 2px)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:w-0{width:0px}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-side=right] .group-data-\[side\=right\]\:rotate-180,.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:overflow-hidden{overflow:hidden}.group[data-variant=floating] .group-data-\[variant\=floating\]\:rounded-lg{border-radius:var(--radius)}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border{border-width:1px}.group[data-side=left] .group-data-\[side\=left\]\:border-r{border-right-width:1px}.group[data-side=right] .group-data-\[side\=right\]\:border-l{border-left-width:1px}.group[data-variant=floating] .group-data-\[variant\=floating\]\:border-sidebar-border{border-color:hsl(var(--sidebar-border))}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-0{padding:0!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:\!p-2{padding:.5rem!important}.group[data-collapsible=icon] .group-data-\[collapsible\=icon\]\:opacity-0{opacity:0}.group[data-variant=floating] .group-data-\[variant\=floating\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:after\:left-full:after{content:var(--tw-content);left:100%}.group[data-collapsible=offcanvas] .group-data-\[collapsible\=offcanvas\]\:hover\:bg-sidebar:hover{background-color:hsl(var(--sidebar-background))}.peer\/menu-button[data-size=default]~.peer-data-\[size\=default\]\/menu-button\:top-1\.5{top:.375rem}.peer\/menu-button[data-size=lg]~.peer-data-\[size\=lg\]\/menu-button\:top-2\.5{top:.625rem}.peer\/menu-button[data-size=sm]~.peer-data-\[size\=sm\]\/menu-button\:top-1{top:.25rem}.peer[data-variant=inset]~.peer-data-\[variant\=inset\]\:min-h-\[calc\(100svh-theme\(spacing\.4\)\)\]{min-height:calc(100svh - 1rem)}.peer\/menu-button[data-active=true]~.peer-data-\[active\=true\]\/menu-button\:text-sidebar-accent-foreground{color:hsl(var(--sidebar-accent-foreground))}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:from-gray-900:is(.dark *){--tw-gradient-from: #111827 var(--tw-gradient-from-position);--tw-gradient-to: rgb(17 24 39 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-gray-800:is(.dark *){--tw-gradient-to: #1f2937 var(--tw-gradient-to-position)}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.sm\:bottom-\[-20rem\]{bottom:-20rem}.sm\:left-\[calc\(50\%\+30rem\)\]{left:calc(50% + 30rem)}.sm\:left-\[calc\(50\%-30rem\)\]{left:calc(50% - 30rem)}.sm\:top-\[-20rem\]{top:-20rem}.sm\:mt-0{margin-top:0}.sm\:mt-24{margin-top:6rem}.sm\:flex{display:flex}.sm\:w-\[72\.1875rem\]{width:72.1875rem}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:gap-2\.5{gap:.625rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:px-6{padding-left:1.5rem;padding-right:1.5rem}.sm\:py-32{padding-top:8rem;padding-bottom:8rem}.sm\:text-left{text-align:left}.sm\:text-4xl{font-size:2.25rem;line-height:2.5rem}.sm\:text-6xl{font-size:3.75rem;line-height:1}}@media (min-width: 768px){.md\:absolute{position:absolute}.md\:mb-0{margin-bottom:0}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:w-64{width:16rem}.md\:w-\[var\(--radix-navigation-menu-viewport-width\)\]{width:var(--radix-navigation-menu-viewport-width)}.md\:w-auto{width:auto}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:border-l{border-left-width:1px}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:opacity-0{opacity:0}.after\:md\:hidden:after{content:var(--tw-content);display:none}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:m-2{margin:.5rem}.peer[data-state=collapsed][data-variant=inset]~.md\:peer-data-\[state\=collapsed\]\:peer-data-\[variant\=inset\]\:ml-2{margin-left:.5rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:ml-0{margin-left:0}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:rounded-xl{border-radius:.75rem}.peer[data-variant=inset]~.md\:peer-data-\[variant\=inset\]\:shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}}@media (min-width: 1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:mx-0{margin-left:0;margin-right:0}.lg\:mt-0{margin-top:0}.lg\:flex{display:flex}.lg\:w-64{width:16rem}.lg\:flex-auto{flex:1 1 auto}.lg\:flex-shrink-0{flex-shrink:0}.lg\:flex-grow{flex-grow:1}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:flex-row{flex-direction:row}.lg\:items-center{align-items:center}.lg\:gap-x-10{-moz-column-gap:2.5rem;column-gap:2.5rem}.lg\:px-8{padding-left:2rem;padding-right:2rem}.lg\:py-40{padding-top:10rem;padding-bottom:10rem}}@media (min-width: 1280px){.xl\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\[\&\:has\(\[aria-selected\]\)\]\:bg-accent:has([aria-selected]){background-color:hsl(var(--accent))}.first\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-l-md:has([aria-selected]):first-child{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.last\:\[\&\:has\(\[aria-selected\]\)\]\:rounded-r-md:has([aria-selected]):last-child{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[aria-selected\]\.day-outside\)\]\:bg-accent\/50:has([aria-selected].day-outside){background-color:hsl(var(--accent) / .5)}.\[\&\:has\(\[aria-selected\]\.day-range-end\)\]\:rounded-r-md:has([aria-selected].day-range-end){border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>button\]\:hidden>button{display:none}.\[\&\>span\:last-child\]\:truncate>span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:size-4>svg{width:1rem;height:1rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:shrink-0>svg{flex-shrink:0}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\]\:text-sidebar-accent-foreground>svg{color:hsl(var(--sidebar-accent-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&\[data-panel-group-direction\=vertical\]\>div\]\:rotate-90[data-panel-group-direction=vertical]>div{--tw-rotate: 90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open]>svg{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-side=left][data-collapsible=offcanvas] .\[\[data-side\=left\]\[data-collapsible\=offcanvas\]_\&\]\:-right-2{right:-.5rem}[data-side=left][data-state=collapsed] .\[\[data-side\=left\]\[data-state\=collapsed\]_\&\]\:cursor-e-resize{cursor:e-resize}[data-side=left] .\[\[data-side\=left\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right][data-collapsible=offcanvas] .\[\[data-side\=right\]\[data-collapsible\=offcanvas\]_\&\]\:-left-2{left:-.5rem}[data-side=right][data-state=collapsed] .\[\[data-side\=right\]\[data-state\=collapsed\]_\&\]\:cursor-w-resize{cursor:w-resize}[data-side=right] .\[\[data-side\=right\]_\&\]\:cursor-e-resize{cursor:e-resize} diff --git a/dist/index.html b/dist/index.html index 28b08502..6c1eb4a8 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,8 +7,8 @@ - - + + diff --git a/src/components/persona/PersonaGenerationPrompts.tsx b/src/components/persona/PersonaGenerationPrompts.tsx new file mode 100644 index 00000000..dd2c44bb --- /dev/null +++ b/src/components/persona/PersonaGenerationPrompts.tsx @@ -0,0 +1,62 @@ +import { FileText, Target } from 'lucide-react'; +import { Card, CardContent } from '@/components/ui/card'; +import { Persona } from '@/types/persona'; + +interface PersonaGenerationPromptsProps { + persona: Persona; +} + +export function PersonaGenerationPrompts({ persona }: PersonaGenerationPromptsProps) { + // Check if generation prompts are available + const hasPrompts = persona.audience_brief || persona.research_objective; + + if (!hasPrompts) { + return ( +
+
+ +

Generation prompts not available

+

Generation prompts are not available for this persona.

+
+
+ ); + } + + return ( +
+ {persona.audience_brief && ( + + +
+ +

Audience Brief

+
+ +
+

+ {persona.audience_brief} +

+
+
+
+ )} + + {persona.research_objective && ( + + +
+ +

Research Objective

+
+ +
+

+ {persona.research_objective} +

+
+
+
+ )} +
+ ); +} \ No newline at end of file diff --git a/src/components/persona/PersonaProfile.tsx b/src/components/persona/PersonaProfile.tsx index 8e253de7..e195cc9f 100644 --- a/src/components/persona/PersonaProfile.tsx +++ b/src/components/persona/PersonaProfile.tsx @@ -20,6 +20,7 @@ import { PersonaSidebar } from './PersonaSidebar'; import { PersonaCooperProfile } from './PersonaCooperProfile'; import { PersonaPersonality } from './PersonaPersonality'; import { PersonaScenarios } from './PersonaScenarios'; +import { PersonaGenerationPrompts } from './PersonaGenerationPrompts'; import { PersonaNotFound } from './PersonaNotFound'; import { PersonaProfileSkeleton } from './PersonaProfileSkeleton'; import PersonaEditor from './PersonaEditor'; @@ -203,7 +204,7 @@ export default function PersonaProfile() { > -

Persona Profile

+

Persona Profile

diff --git a/src/lib/api.ts b/src/lib/api.ts index 8af53872..731daf19 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -221,10 +221,21 @@ export const aiPersonasApi = { }), // Second stage: Complete a single persona and save to database - completeAndSavePersona: (basicProfile: any, temperature: number = 0.7) => + completeAndSavePersona: ( + basicProfile: any, + temperature: number = 0.7, + audienceBrief?: string, + researchObjective?: string, + customerDataSessionId?: string, + llmModel?: string + ) => api.post('/ai-personas/complete-and-save-persona', { basic_profile: basicProfile, - temperature + temperature, + audience_brief: audienceBrief, + research_objective: researchObjective, + customer_data_session_id: customerDataSessionId, + llm_model: llmModel }, { timeout: 600000 // 10 minutes for detailed persona generation and saving }), @@ -276,6 +287,8 @@ export const aiPersonasApi = { api.post('/ai-personas/complete-and-save-persona', { basic_profile: profile, temperature, + audience_brief: audienceBrief, + research_objective: researchObjective, customer_data_session_id: customerDataSessionId, llm_model: llmModel || 'gemini-2.5-pro' }, { diff --git a/src/types/persona.ts b/src/types/persona.ts index ab5217c1..a06eb524 100644 --- a/src/types/persona.ts +++ b/src/types/persona.ts @@ -78,4 +78,8 @@ export interface Persona { folder_ids?: string[]; // Array of folder IDs this persona belongs to folderId?: string; // Legacy: single folder ID (kept for backwards compatibility) folder_id?: string; // Alternative single folder field + + // Generation prompts (for personas created after this feature) + audience_brief?: string; // The audience brief used to generate this persona + research_objective?: string; // The research objective used to generate this persona }