From 8dcbe7efee70dc44fd349bf6edb8f3b5cb558195 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 6 Aug 2025 19:29:27 -0500 Subject: [PATCH] various bug fixes and feature additions per Alec's requests --- .../__pycache__/focus_group.cpython-313.pyc | Bin 40222 -> 40222 bytes backend/app/models/focus_group.py | 2 +- .../ai_moderator_service.cpython-313.pyc | Bin 27807 -> 28219 bytes backend/app/services/ai_moderator_service.py | 12 + dist/assets/index-ByQ3S_f0.css | 1 + dist/assets/index-CMEVr6tk.css | 1 - dist/assets/index-Dod4tGHl.js | 732 ------ dist/assets/index-ImyDGn9B.js | 723 ++++++ dist/index.html | 4 +- src/App.tsx | 7 +- src/components/AIRecruiter.tsx | 4 +- src/components/FocusGroupModerator.tsx | 375 +++- src/components/UserCard.tsx | 10 +- src/components/UserCreator.tsx | 2 +- .../ai-recruiter/AIRecruiterForm.tsx | 85 +- .../CollapsibleDiscussionGuide.tsx | 52 +- .../DiscussionGuideEditor.tsx | 954 -------- .../DiscussionGuideViewer.tsx | 1988 ++++++++--------- .../focus-group-session/DiscussionPanel.tsx | 75 +- .../focus-group-session/ModeSwitchMarker.tsx | 4 + src/components/focus-group-session/types.ts | 2 +- src/contexts/NavigationContext.tsx | 69 + src/hooks/usePersonaDetails.ts | 19 +- src/index.css | 5 + src/pages/FocusGroupSession.tsx | 56 +- src/pages/FocusGroups.tsx | 64 +- src/pages/SyntheticUsers.tsx | 80 +- 27 files changed, 2384 insertions(+), 2942 deletions(-) create mode 100644 dist/assets/index-ByQ3S_f0.css delete mode 100644 dist/assets/index-CMEVr6tk.css delete mode 100644 dist/assets/index-Dod4tGHl.js create mode 100644 dist/assets/index-ImyDGn9B.js delete mode 100644 src/components/focus-group-session/DiscussionGuideEditor.tsx create mode 100644 src/contexts/NavigationContext.tsx diff --git a/backend/app/models/__pycache__/focus_group.cpython-313.pyc b/backend/app/models/__pycache__/focus_group.cpython-313.pyc index 070616a1360cf29bae670c8c9bbac93c70be6490..20d524d3f47055ff2f4c3cc3052e5d612c3f8286 100644 GIT binary patch delta 24 ecmbQYi)r32Cf?7yyj%=GFt>1WhRH@=!MOlp$_Ih~ delta 24 ecmbQYi)r32Cf?7yyj%=GFx_NQhV({W!MOlnC!kr%3pep(YJQRFh(kMOM!NCNRS%wxzh^keRz=1D;KKkU0RGU~h|LN6980sFuuXPy z&NeGf7Vjel&)yyYwwePB2-$kz9)rLrb4d06s~*xAOJjW;BzgNmo~_|14sw8Vux^&C zJ>_fxO(0QI8R!Ch007y=LbfhZUtu{{rGa&rPN>;}fUTEZQCG`;6`=_FsUQ$xyMO83 zSOLxzy}Y3-skD-x$qBkp^z%|m6EsayWJ1d6oRJYS?KZWS3@OsWtRU+t{q~GtoFzo5 zF#jAyGsJM(cHBW?D^rKn(FR*f78I< zwB%1S|6@xYpg$v>cT*cqTr=C|tQx`2*#t*X%aBb;j_9WFe;246h(* delta 504 zcmdmehjIQ*M!wIyyj%=GaNA;1#@FtRd|Kg5ZH$xoJq#zy$MZ}s4?kHS%?*+Vfnd&1 z20n&hu24ok24faeMu?~aLojzJb0}jdLnv!7M=*~bn+k&>Lo^>mmVtqtAyJBfA&)JX zF_<@65GESR2Gb8Ti^+hom`R=?m@kjb5vUtNr!l56*fPtrGNdtT@^5yEoXrK z&dHuJZahUHK!b|HfrKXew;(6AB=r`1NoH`TK z_|&|V)Rdw_lkcW0Gwzwpm|?;6pJ}pnh6m%J$t@Yn)i(i+EdrTcv: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-\[--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\/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-primary{border-color:hsl(var(--primary))}.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-\[--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\/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-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-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}.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}.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-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-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-gray-900\/10{--tw-ring-color: rgb(17 24 39 / .1)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.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-slate-300:hover{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-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-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-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\: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-foreground:hover{color:hsl(var(--foreground))}.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\: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\: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\: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)}@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\:grid-cols-3{grid-template-columns:repeat(3,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/assets/index-CMEVr6tk.css b/dist/assets/index-CMEVr6tk.css deleted file mode 100644 index 8499a472..00000000 --- a/dist/assets/index-CMEVr6tk.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{margin-left:1.75rem;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{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.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-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-\[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-\[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-\[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-\[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))}.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-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-line{white-space:pre-line}.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-\[--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\/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-primary{border-color:hsl(var(--primary))}.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-\[--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\/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-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-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-1\.5{padding:.375rem}.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}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.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-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-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-gray-900\/10{--tw-ring-color: rgb(17 24 39 / .1)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.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\:cursor-grab:hover{cursor:grab}.hover\:border-slate-300:hover{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-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-blue-50:hover{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / 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-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-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\: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-foreground:hover{color:hsl(var(--foreground))}.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-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.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-700:hover{--tw-text-opacity: 1;color:rgb(51 65 85 / var(--tw-text-opacity, 1))}.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\: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))}@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\: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)}@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\:grid-cols-3{grid-template-columns:repeat(3,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/assets/index-Dod4tGHl.js b/dist/assets/index-Dod4tGHl.js deleted file mode 100644 index 01ea4a49..00000000 --- a/dist/assets/index-Dod4tGHl.js +++ /dev/null @@ -1,732 +0,0 @@ -var tC=e=>{throw TypeError(e)};var m0=(e,t,n)=>t.has(e)||tC("Cannot "+n);var je=(e,t,n)=>(m0(e,t,"read from private field"),n?n.call(e):t.get(e)),Ut=(e,t,n)=>t.has(e)?tC("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Nt=(e,t,n,r)=>(m0(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),cr=(e,t,n)=>(m0(e,t,"access private method"),n);var Gp=(e,t,n,r)=>({set _(s){Nt(e,t,s,n)},get _(){return je(e,t,r)}});function h8(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var qp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d$={exports:{}},by={},f$={exports:{}},Ot={};/** - * @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 hp=Symbol.for("react.element"),p8=Symbol.for("react.portal"),m8=Symbol.for("react.fragment"),g8=Symbol.for("react.strict_mode"),v8=Symbol.for("react.profiler"),y8=Symbol.for("react.provider"),x8=Symbol.for("react.context"),b8=Symbol.for("react.forward_ref"),w8=Symbol.for("react.suspense"),j8=Symbol.for("react.memo"),S8=Symbol.for("react.lazy"),nC=Symbol.iterator;function N8(e){return e===null||typeof e!="object"?null:(e=nC&&e[nC]||e["@@iterator"],typeof e=="function"?e:null)}var h$={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p$=Object.assign,m$={};function Hu(e,t,n){this.props=e,this.context=t,this.refs=m$,this.updater=n||h$}Hu.prototype.isReactComponent={};Hu.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Hu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function g$(){}g$.prototype=Hu.prototype;function dS(e,t,n){this.props=e,this.context=t,this.refs=m$,this.updater=n||h$}var fS=dS.prototype=new g$;fS.constructor=dS;p$(fS,Hu.prototype);fS.isPureReactComponent=!0;var rC=Array.isArray,v$=Object.prototype.hasOwnProperty,hS={current:null},y$={key:!0,ref:!0,__self:!0,__source:!0};function x$(e,t,n){var r,s={},i=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(i=""+t.key),t)v$.call(t,r)&&!y$.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1>>1,ee=$[Q];if(0>>1;Qs(he,Y))pes(ue,he)?($[Q]=ue,$[pe]=Y,Q=pe):($[Q]=he,$[W]=Y,Q=W);else if(pes(ue,Y))$[Q]=ue,$[pe]=Y,Q=pe;else break e}}return L}function s($,L){var Y=$.sortIndex-L.sortIndex;return Y!==0?Y:$.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!1,m=!1,x=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,y=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($){for(var L=n(u);L!==null;){if(L.callback===null)r(u);else if(L.startTime<=$)r(u),L.sortIndex=L.expirationTime,t(c,L);else break;L=n(u)}}function j($){if(m=!1,w($),!g)if(n(c)!==null)g=!0,F(S);else{var L=n(u);L!==null&&V(j,L.startTime-$)}}function S($,L){g=!1,m&&(m=!1,b(_),_=-1),p=!0;var Y=h;try{for(w(L),f=n(c);f!==null&&(!(f.expirationTime>L)||$&&!T());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,h=f.priorityLevel;var ee=Q(f.expirationTime<=L);L=e.unstable_now(),typeof ee=="function"?f.callback=ee:f===n(c)&&r(c),w(L)}else r(c);f=n(c)}if(f!==null)var fe=!0;else{var W=n(u);W!==null&&V(j,W.startTime-L),fe=!1}return fe}finally{f=null,h=Y,p=!1}}var N=!1,P=null,_=-1,A=5,O=-1;function T(){return!(e.unstable_now()-O$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):A=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return h},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(h){case 1:case 2:case 3:var L=3;break;default:L=h}var Y=h;h=L;try{return $()}finally{h=Y}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,L){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var Y=h;h=$;try{return L()}finally{h=Y}},e.unstable_scheduleCallback=function($,L,Y){var Q=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0Q?($.sortIndex=Y,t(u,$),n(c)===null&&$===n(u)&&(m?(b(_),_=-1):m=!0,V(j,Y-Q))):($.sortIndex=ee,t(c,$),g||p||(g=!0,F(S))),$},e.unstable_shouldYield=T,e.unstable_wrapCallback=function($){var L=h;return function(){var Y=h;h=L;try{return $.apply(this,arguments)}finally{h=Y}}}})(_$);N$.exports=_$;var M8=N$.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 R8=v,cs=M8;function Ee(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ub=Object.prototype.hasOwnProperty,D8=/^[: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]*$/,iC={},aC={};function L8(e){return Ub.call(aC,e)?!0:Ub.call(iC,e)?!1:D8.test(e)?aC[e]=!0:(iC[e]=!0,!1)}function F8(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function B8(e,t,n,r){if(t===null||typeof t>"u"||F8(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function $r(e,t,n,r,s,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var ar={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ar[e]=new $r(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ar[t]=new $r(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ar[e]=new $r(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ar[e]=new $r(e,2,!1,e,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(e){ar[e]=new $r(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ar[e]=new $r(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ar[e]=new $r(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ar[e]=new $r(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ar[e]=new $r(e,5,!1,e.toLowerCase(),null,!1,!1)});var mS=/[\-:]([a-z])/g;function gS(e){return e[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(e){var t=e.replace(mS,gS);ar[t]=new $r(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(mS,gS);ar[t]=new $r(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(mS,gS);ar[t]=new $r(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ar[e]=new $r(e,1,!1,e.toLowerCase(),null,!1,!1)});ar.xlinkHref=new $r("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ar[e]=new $r(e,1,!1,e.toLowerCase(),null,!0,!0)});function vS(e,t,n,r){var s=ar.hasOwnProperty(t)?ar[t]:null;(s!==null?s.type!==0:r||!(2l||s[o]!==i[l]){var c=` -`+s[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{y0=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Jd(e):""}function z8(e){switch(e.tag){case 5:return Jd(e.type);case 16:return Jd("Lazy");case 13:return Jd("Suspense");case 19:return Jd("SuspenseList");case 0:case 2:case 15:return e=x0(e.type,!1),e;case 11:return e=x0(e.type.render,!1),e;case 1:return e=x0(e.type,!0),e;default:return""}}function Gb(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case vc:return"Fragment";case gc:return"Portal";case Vb:return"Profiler";case yS:return"StrictMode";case Wb:return"Suspense";case Hb:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case A$:return(e.displayName||"Context")+".Consumer";case C$:return(e._context.displayName||"Context")+".Provider";case xS:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case bS:return t=e.displayName||null,t!==null?t:Gb(e.type)||"Memo";case Ha:t=e._payload,e=e._init;try{return Gb(e(t))}catch{}}return null}function U8(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Gb(t);case 8:return t===yS?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function _o(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function O$(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function V8(e){var t=O$(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yp(e){e._valueTracker||(e._valueTracker=V8(e))}function k$(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=O$(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function rg(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function qb(e,t){var n=t.checked;return hn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function lC(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=_o(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function T$(e,t){t=t.checked,t!=null&&vS(e,"checked",t,!1)}function Kb(e,t){T$(e,t);var n=_o(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Xb(e,t.type,n):t.hasOwnProperty("defaultValue")&&Xb(e,t.type,_o(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function cC(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Xb(e,t,n){(t!=="number"||rg(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ef=Array.isArray;function $c(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Zp.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function If(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var df={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},W8=["Webkit","ms","Moz","O"];Object.keys(df).forEach(function(e){W8.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),df[t]=df[e]})});function R$(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||df.hasOwnProperty(e)&&df[e]?(""+t).trim():t+"px"}function D$(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=R$(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var H8=hn({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 Qb(e,t){if(t){if(H8[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ee(62))}}function Jb(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 ew=null;function wS(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var tw=null,Ic=null,Mc=null;function fC(e){if(e=gp(e)){if(typeof tw!="function")throw Error(Ee(280));var t=e.stateNode;t&&(t=_y(t),tw(e.stateNode,e.type,t))}}function L$(e){Ic?Mc?Mc.push(e):Mc=[e]:Ic=e}function F$(){if(Ic){var e=Ic,t=Mc;if(Mc=Ic=null,fC(e),t)for(e=0;e>>=0,e===0?32:31-(nU(e)/rU|0)|0}var Qp=64,Jp=4194304;function tf(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function og(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=tf(l):(i&=o,i!==0&&(r=tf(i)))}else o=n&~s,o!==0?r=tf(o):i!==0&&(r=tf(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function pp(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Zs(t),e[t]=n}function oU(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=hf),wC=" ",jC=!1;function iI(e,t){switch(e){case"keyup":return MU.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function aI(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var yc=!1;function DU(e,t){switch(e){case"compositionend":return aI(t);case"keypress":return t.which!==32?null:(jC=!0,wC);case"textInput":return e=t.data,e===wC&&jC?null:e;default:return null}}function LU(e,t){if(yc)return e==="compositionend"||!ES&&iI(e,t)?(e=rI(),Fm=PS=io=null,yc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=PC(n)}}function uI(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?uI(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function dI(){for(var e=window,t=rg();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=rg(e.document)}return t}function OS(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function qU(e){var t=dI(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&uI(n.ownerDocument.documentElement,n)){if(r!==null&&OS(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=CC(n,i);var o=CC(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,xc=null,ow=null,mf=null,lw=!1;function AC(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;lw||xc==null||xc!==rg(r)||(r=xc,"selectionStart"in r&&OS(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}),mf&&Bf(mf,r)||(mf=r,r=ug(ow,"onSelect"),0jc||(e.current=pw[jc],pw[jc]=null,jc--)}function en(e,t){jc++,pw[jc]=e.current,e.current=t}var Po={},xr=Fo(Po),Vr=Fo(!1),Ol=Po;function au(e,t){var n=e.type.contextTypes;if(!n)return Po;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Wr(e){return e=e.childContextTypes,e!=null}function fg(){an(Vr),an(xr)}function MC(e,t,n){if(xr.current!==Po)throw Error(Ee(168));en(xr,t),en(Vr,n)}function bI(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(Ee(108,U8(e)||"Unknown",s));return hn({},n,r)}function hg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Po,Ol=xr.current,en(xr,e),en(Vr,Vr.current),!0}function RC(e,t,n){var r=e.stateNode;if(!r)throw Error(Ee(169));n?(e=bI(e,t,Ol),r.__reactInternalMemoizedMergedChildContext=e,an(Vr),an(xr),en(xr,e)):an(Vr),en(Vr,n)}var Zi=null,Py=!1,$0=!1;function wI(e){Zi===null?Zi=[e]:Zi.push(e)}function iV(e){Py=!0,wI(e)}function Bo(){if(!$0&&Zi!==null){$0=!0;var e=0,t=Gt;try{var n=Zi;for(Gt=1;e>=o,s-=o,ea=1<<32-Zs(t)+s|n<_?(A=P,P=null):A=P.sibling;var O=h(b,P,w[_],j);if(O===null){P===null&&(P=A);break}e&&P&&O.alternate===null&&t(b,P),y=i(O,y,_),N===null?S=O:N.sibling=O,N=O,P=A}if(_===w.length)return n(b,P),ln&&tl(b,_),S;if(P===null){for(;__?(A=P,P=null):A=P.sibling;var T=h(b,P,O.value,j);if(T===null){P===null&&(P=A);break}e&&P&&T.alternate===null&&t(b,P),y=i(T,y,_),N===null?S=T:N.sibling=T,N=T,P=A}if(O.done)return n(b,P),ln&&tl(b,_),S;if(P===null){for(;!O.done;_++,O=w.next())O=f(b,O.value,j),O!==null&&(y=i(O,y,_),N===null?S=O:N.sibling=O,N=O);return ln&&tl(b,_),S}for(P=r(b,P);!O.done;_++,O=w.next())O=p(P,b,_,O.value,j),O!==null&&(e&&O.alternate!==null&&P.delete(O.key===null?_:O.key),y=i(O,y,_),N===null?S=O:N.sibling=O,N=O);return e&&P.forEach(function(k){return t(b,k)}),ln&&tl(b,_),S}function x(b,y,w,j){if(typeof w=="object"&&w!==null&&w.type===vc&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Xp:e:{for(var S=w.key,N=y;N!==null;){if(N.key===S){if(S=w.type,S===vc){if(N.tag===7){n(b,N.sibling),y=s(N,w.props.children),y.return=b,b=y;break e}}else if(N.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Ha&&FC(S)===N.type){n(b,N.sibling),y=s(N,w.props),y.ref=Td(b,N,w),y.return=b,b=y;break e}n(b,N);break}else t(b,N);N=N.sibling}w.type===vc?(y=Nl(w.props.children,b.mode,j,w.key),y.return=b,b=y):(j=qm(w.type,w.key,w.props,null,b.mode,j),j.ref=Td(b,y,w),j.return=b,b=j)}return o(b);case gc:e:{for(N=w.key;y!==null;){if(y.key===N)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){n(b,y.sibling),y=s(y,w.children||[]),y.return=b,b=y;break e}else{n(b,y);break}else t(b,y);y=y.sibling}y=z0(w,b.mode,j),y.return=b,b=y}return o(b);case Ha:return N=w._init,x(b,y,N(w._payload),j)}if(ef(w))return g(b,y,w,j);if(Cd(w))return m(b,y,w,j);am(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(n(b,y.sibling),y=s(y,w),y.return=b,b=y):(n(b,y),y=B0(w,b.mode,j),y.return=b,b=y),o(b)):n(b,y)}return x}var lu=_I(!0),PI=_I(!1),gg=Fo(null),vg=null,_c=null,IS=null;function MS(){IS=_c=vg=null}function RS(e){var t=gg.current;an(gg),e._currentValue=t}function vw(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Dc(e,t){vg=e,IS=_c=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(zr=!0),e.firstContext=null)}function Os(e){var t=e._currentValue;if(IS!==e)if(e={context:e,memoizedValue:t,next:null},_c===null){if(vg===null)throw Error(Ee(308));_c=e,vg.dependencies={lanes:0,firstContext:e}}else _c=_c.next=e;return t}var cl=null;function DS(e){cl===null?cl=[e]:cl.push(e)}function CI(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,DS(t)):(n.next=s.next,s.next=n),t.interleaved=n,va(e,r)}function va(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Ga=!1;function LS(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function AI(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function aa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Rt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,va(e,n)}return s=r.interleaved,s===null?(t.next=t,DS(r)):(t.next=s.next,s.next=t),r.interleaved=t,va(e,n)}function zm(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,SS(e,n)}}function BC(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yg(e,t,n,r){var s=e.updateQueue;Ga=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?i=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;o=0,d=u=c=null,l=i;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,m=l;switch(h=t,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=hn({},f,h);break e;case 2:Ga=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);$l|=o,e.lanes=o,e.memoizedState=f}}function zC(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=M0.transition;M0.transition={};try{e(!1),t()}finally{Gt=n,M0.transition=r}}function HI(){return ks().memoizedState}function cV(e,t,n){var r=vo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},GI(e))qI(t,n);else if(n=CI(e,t,n,r),n!==null){var s=Or();Qs(n,e,r,s),KI(n,t,r)}}function uV(e,t,n){var r=vo(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(GI(e))qI(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,ri(l,o)){var c=t.interleaved;c===null?(s.next=s,DS(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=CI(e,t,s,r),n!==null&&(s=Or(),Qs(n,e,r,s),KI(n,t,r))}}function GI(e){var t=e.alternate;return e===fn||t!==null&&t===fn}function qI(e,t){gf=bg=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function KI(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,SS(e,n)}}var wg={readContext:Os,useCallback:ur,useContext:ur,useEffect:ur,useImperativeHandle:ur,useInsertionEffect:ur,useLayoutEffect:ur,useMemo:ur,useReducer:ur,useRef:ur,useState:ur,useDebugValue:ur,useDeferredValue:ur,useTransition:ur,useMutableSource:ur,useSyncExternalStore:ur,useId:ur,unstable_isNewReconciler:!1},dV={readContext:Os,useCallback:function(e,t){return gi().memoizedState=[e,t===void 0?null:t],e},useContext:Os,useEffect:VC,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Vm(4194308,4,BI.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Vm(4194308,4,e,t)},useInsertionEffect:function(e,t){return Vm(4,2,e,t)},useMemo:function(e,t){var n=gi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=gi();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=cV.bind(null,fn,e),[r.memoizedState,e]},useRef:function(e){var t=gi();return e={current:e},t.memoizedState=e},useState:UC,useDebugValue:GS,useDeferredValue:function(e){return gi().memoizedState=e},useTransition:function(){var e=UC(!1),t=e[0];return e=lV.bind(null,e[1]),gi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=fn,s=gi();if(ln){if(n===void 0)throw Error(Ee(407));n=n()}else{if(n=t(),Jn===null)throw Error(Ee(349));Tl&30||TI(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,VC(II.bind(null,r,i,e),[e]),r.flags|=2048,Kf(9,$I.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=gi(),t=Jn.identifierPrefix;if(ln){var n=ta,r=ea;n=(r&~(1<<32-Zs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Gf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[wi]=t,e[Vf]=r,sM(e,t,!1,!1),t.stateNode=e;e:{switch(o=Jb(n,r),n){case"dialog":nn("cancel",e),nn("close",e),s=r;break;case"iframe":case"object":case"embed":nn("load",e),s=r;break;case"video":case"audio":for(s=0;sdu&&(t.flags|=128,r=!0,$d(i,!1),t.lanes=4194304)}else{if(!r)if(e=xg(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),$d(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!ln)return dr(t),null}else 2*Nn()-i.renderingStartTime>du&&n!==1073741824&&(t.flags|=128,r=!0,$d(i,!1),t.lanes=4194304);i.isBackwards?(o.sibling=t.child,t.child=o):(n=i.last,n!==null?n.sibling=o:t.child=o,i.last=o)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Nn(),t.sibling=null,n=dn.current,en(dn,r?n&1|2:n&1),t):(dr(t),null);case 22:case 23:return QS(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jr&1073741824&&(dr(t),t.subtreeFlags&6&&(t.flags|=8192)):dr(t),null;case 24:return null;case 25:return null}throw Error(Ee(156,t.tag))}function xV(e,t){switch(TS(t),t.tag){case 1:return Wr(t.type)&&fg(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cu(),an(Vr),an(xr),zS(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return BS(t),null;case 13:if(an(dn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ee(340));ou()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return an(dn),null;case 4:return cu(),null;case 10:return RS(t.type._context),null;case 22:case 23:return QS(),null;case 24:return null;default:return null}}var lm=!1,gr=!1,bV=typeof WeakSet=="function"?WeakSet:Set,He=null;function Pc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){gn(e,t,r)}else n.current=null}function Pw(e,t,n){try{n()}catch(r){gn(e,t,r)}}var eA=!1;function wV(e,t){if(cw=lg,e=dI(),OS(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==i||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(l=o),h===i&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(uw={focusedElem:e,selectionRange:n},lg=!1,He=t;He!==null;)if(t=He,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,He=e;else for(;He!==null;){t=He;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,x=g.memoizedState,b=t.stateNode,y=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:Bs(t.type,m),x);b.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var w=t.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(Ee(163))}}catch(j){gn(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,He=e;break}He=t.return}return g=eA,eA=!1,g}function vf(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&Pw(t,n,i)}s=s.next}while(s!==r)}}function Ey(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Cw(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function oM(e){var t=e.alternate;t!==null&&(e.alternate=null,oM(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[wi],delete t[Vf],delete t[hw],delete t[rV],delete t[sV])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function lM(e){return e.tag===5||e.tag===3||e.tag===4}function tA(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||lM(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Aw(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=dg));else if(r!==4&&(e=e.child,e!==null))for(Aw(e,t,n),e=e.sibling;e!==null;)Aw(e,t,n),e=e.sibling}function Ew(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Ew(e,t,n),e=e.sibling;e!==null;)Ew(e,t,n),e=e.sibling}var sr=null,Vs=!1;function Fa(e,t,n){for(n=n.child;n!==null;)cM(e,t,n),n=n.sibling}function cM(e,t,n){if(Ci&&typeof Ci.onCommitFiberUnmount=="function")try{Ci.onCommitFiberUnmount(wy,n)}catch{}switch(n.tag){case 5:gr||Pc(n,t);case 6:var r=sr,s=Vs;sr=null,Fa(e,t,n),sr=r,Vs=s,sr!==null&&(Vs?(e=sr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):sr.removeChild(n.stateNode));break;case 18:sr!==null&&(Vs?(e=sr,n=n.stateNode,e.nodeType===8?T0(e.parentNode,n):e.nodeType===1&&T0(e,n),Lf(e)):T0(sr,n.stateNode));break;case 4:r=sr,s=Vs,sr=n.stateNode.containerInfo,Vs=!0,Fa(e,t,n),sr=r,Vs=s;break;case 0:case 11:case 14:case 15:if(!gr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Pw(n,t,o),s=s.next}while(s!==r)}Fa(e,t,n);break;case 1:if(!gr&&(Pc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){gn(n,t,l)}Fa(e,t,n);break;case 21:Fa(e,t,n);break;case 22:n.mode&1?(gr=(r=gr)||n.memoizedState!==null,Fa(e,t,n),gr=r):Fa(e,t,n);break;default:Fa(e,t,n)}}function nA(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new bV),t.forEach(function(r){var s=OV.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Rs(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~i}if(r=s,r=Nn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*SV(r/1960))-r,10e?16:e,ao===null)var r=!1;else{if(e=ao,ao=null,Ng=0,Rt&6)throw Error(Ee(331));var s=Rt;for(Rt|=4,He=e.current;He!==null;){var i=He,o=i.child;if(He.flags&16){var l=i.deletions;if(l!==null){for(var c=0;cNn()-YS?Sl(e,0):XS|=n),Hr(e,t)}function vM(e,t){t===0&&(e.mode&1?(t=Jp,Jp<<=1,!(Jp&130023424)&&(Jp=4194304)):t=1);var n=Or();e=va(e,t),e!==null&&(pp(e,t,n),Hr(e,n))}function EV(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vM(e,n)}function OV(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Ee(314))}r!==null&&r.delete(t),vM(e,n)}var yM;yM=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Vr.current)zr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return zr=!1,vV(e,t,n);zr=!!(e.flags&131072)}else zr=!1,ln&&t.flags&1048576&&jI(t,mg,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wm(e,t),e=t.pendingProps;var s=au(t,xr.current);Dc(t,n),s=VS(null,t,r,e,s,n);var i=WS();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Wr(r)?(i=!0,hg(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,LS(t),s.updater=Ay,t.stateNode=s,s._reactInternals=t,xw(t,r,e,n),t=jw(null,t,r,!0,i,n)):(t.tag=0,ln&&i&&kS(t),Nr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wm(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=TV(r),e=Bs(r,e),s){case 0:t=ww(null,t,r,e,n);break e;case 1:t=ZC(null,t,r,e,n);break e;case 11:t=XC(null,t,r,e,n);break e;case 14:t=YC(null,t,r,Bs(r.type,e),n);break e}throw Error(Ee(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),ww(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),ZC(e,t,r,s,n);case 3:e:{if(tM(t),e===null)throw Error(Ee(387));r=t.pendingProps,i=t.memoizedState,s=i.element,AI(e,t),yg(t,r,null,n);var o=t.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=uu(Error(Ee(423)),t),t=QC(e,t,r,n,s);break e}else if(r!==s){s=uu(Error(Ee(424)),t),t=QC(e,t,r,n,s);break e}else for(ss=po(t.stateNode.containerInfo.firstChild),is=t,ln=!0,Gs=null,n=PI(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ou(),r===s){t=ya(e,t,n);break e}Nr(e,t,r,n)}t=t.child}return t;case 5:return EI(t),e===null&&gw(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,o=s.children,dw(r,s)?o=null:i!==null&&dw(r,i)&&(t.flags|=32),eM(e,t),Nr(e,t,o,n),t.child;case 6:return e===null&&gw(t),null;case 13:return nM(e,t,n);case 4:return FS(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=lu(t,null,r,n):Nr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),XC(e,t,r,s,n);case 7:return Nr(e,t,t.pendingProps,n),t.child;case 8:return Nr(e,t,t.pendingProps.children,n),t.child;case 12:return Nr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,o=s.value,en(gg,r._currentValue),r._currentValue=o,i!==null)if(ri(i.value,o)){if(i.children===s.children&&!Vr.current){t=ya(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=aa(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),vw(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===t.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(Ee(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),vw(o,n,t),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===t){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}Nr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Dc(t,n),s=Os(s),r=r(s),t.flags|=1,Nr(e,t,r,n),t.child;case 14:return r=t.type,s=Bs(r,t.pendingProps),s=Bs(r.type,s),YC(e,t,r,s,n);case 15:return QI(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Bs(r,s),Wm(e,t),t.tag=1,Wr(r)?(e=!0,hg(t)):e=!1,Dc(t,n),XI(t,r,s),xw(t,r,s,n),jw(null,t,r,!0,e,n);case 19:return rM(e,t,n);case 22:return JI(e,t,n)}throw Error(Ee(156,t.tag))};function xM(e,t){return G$(e,t)}function kV(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 Ns(e,t,n,r){return new kV(e,t,n,r)}function eN(e){return e=e.prototype,!(!e||!e.isReactComponent)}function TV(e){if(typeof e=="function")return eN(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xS)return 11;if(e===bS)return 14}return 2}function yo(e,t){var n=e.alternate;return n===null?(n=Ns(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function qm(e,t,n,r,s,i){var o=2;if(r=e,typeof e=="function")eN(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case vc:return Nl(n.children,s,i,t);case yS:o=8,s|=8;break;case Vb:return e=Ns(12,n,t,s|2),e.elementType=Vb,e.lanes=i,e;case Wb:return e=Ns(13,n,t,s),e.elementType=Wb,e.lanes=i,e;case Hb:return e=Ns(19,n,t,s),e.elementType=Hb,e.lanes=i,e;case E$:return ky(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case C$:o=10;break e;case A$:o=9;break e;case xS:o=11;break e;case bS:o=14;break e;case Ha:o=16,r=null;break e}throw Error(Ee(130,e==null?e:typeof e,""))}return t=Ns(o,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Nl(e,t,n,r){return e=Ns(7,e,r,t),e.lanes=n,e}function ky(e,t,n,r){return e=Ns(22,e,r,t),e.elementType=E$,e.lanes=n,e.stateNode={isHidden:!1},e}function B0(e,t,n){return e=Ns(6,e,null,t),e.lanes=n,e}function z0(e,t,n){return t=Ns(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function $V(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=w0(0),this.expirationTimes=w0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=w0(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function tN(e,t,n,r,s,i,o,l,c){return e=new $V(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Ns(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},LS(i),e}function IV(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(SM)}catch(e){console.error(e)}}SM(),S$.exports=ds;var Xs=S$.exports;const NM=Bt(Xs);var _M,uA=Xs;_M=uA.createRoot,uA.hydrateRoot;var dA=["light","dark"],FV="(prefers-color-scheme: dark)",BV=v.createContext(void 0),zV={setTheme:e=>{},themes:[]},UV=()=>{var e;return(e=v.useContext(BV))!=null?e:zV};v.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let u=i==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=s?dA.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,x=!0)=>{let b=o?o[g]:g,y=m?g+"|| ''":`'${b}'`,w="";return s&&x&&!m&&dA.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${y})`:w+="null":b&&(w+=`d[s](n,${y})`),w},p=e?`!function(){${d}${h(e)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${FV}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}${u?"":"else{"+h(i,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}else{${h(i,!1,!1)};}${f}}catch(t){}}();`;return v.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var VV=e=>{switch(e){case"success":return GV;case"info":return KV;case"warning":return qV;case"error":return XV;default:return null}},WV=Array(12).fill(0),HV=({visible:e})=>C.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},C.createElement("div",{className:"sonner-spinner"},WV.map((t,n)=>C.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),GV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.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"})),qV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},C.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"})),KV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.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"})),XV=C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},C.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"})),YV=()=>{let[e,t]=C.useState(document.hidden);return C.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Iw=1,ZV=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Iw++,i=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:n}),{...l,...e,id:s,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:s}),s},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0;return r.then(async i=>{if(JV(i)&&!i.ok){s=!1;let o=typeof t.error=="function"?await t.error(`HTTP error! status: ${i.status}`):t.error,l=typeof t.description=="function"?await t.description(`HTTP error! status: ${i.status}`):t.description;this.create({id:n,type:"error",message:o,description:l})}else if(t.success!==void 0){s=!1;let o=typeof t.success=="function"?await t.success(i):t.success,l=typeof t.description=="function"?await t.description(i):t.description;this.create({id:n,type:"success",message:o,description:l})}}).catch(async i=>{if(t.error!==void 0){s=!1;let o=typeof t.error=="function"?await t.error(i):t.error,l=typeof t.description=="function"?await t.description(i):t.description;this.create({id:n,type:"error",message:o,description:l})}}).finally(()=>{var i;s&&(this.dismiss(n),n=void 0),(i=t.finally)==null||i.call(t)}),n},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Iw++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},Qr=new ZV,QV=(e,t)=>{let n=(t==null?void 0:t.id)||Iw++;return Qr.addToast({title:e,...t,id:n}),n},JV=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",e7=QV,t7=()=>Qr.toasts,ce=Object.assign(e7,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:t7});function n7(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}n7(`: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 dm(e){return e.label!==void 0}var r7=3,s7="32px",i7=4e3,a7=356,o7=14,l7=20,c7=200;function u7(...e){return e.filter(Boolean).join(" ")}var d7=e=>{var t,n,r,s,i,o,l,c,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:x,heights:b,index:y,toasts:w,expanded:j,removeToast:S,defaultRichColors:N,closeButton:P,style:_,cancelButtonStyle:A,actionButtonStyle:O,className:T="",descriptionClassName:k="",duration:M,position:R,gap:H,loadingIcon:F,expandByDefault:V,classNames:$,icons:L,closeButtonAriaLabel:Y="Close toast",pauseWhenPageIsHidden:Q,cn:ee}=e,[fe,W]=C.useState(!1),[he,pe]=C.useState(!1),[ue,Ae]=C.useState(!1),[de,oe]=C.useState(!1),[xe,te]=C.useState(0),[Ye,G]=C.useState(0),ve=C.useRef(null),Pe=C.useRef(null),Ie=y===0,E=y+1<=x,D=h.type,U=h.dismissible!==!1,K=h.className||"",J=h.descriptionClassName||"",X=C.useMemo(()=>b.findIndex(tt=>tt.toastId===h.id)||0,[b,h.id]),be=C.useMemo(()=>{var tt;return(tt=h.closeButton)!=null?tt:P},[h.closeButton,P]),_e=C.useMemo(()=>h.duration||M||i7,[h.duration,M]),Fe=C.useRef(0),ie=C.useRef(0),Te=C.useRef(0),Be=C.useRef(null),[gt,At]=R.split("-"),pn=C.useMemo(()=>b.reduce((tt,It,kt)=>kt>=X?tt:tt+It.height,0),[b,X]),Zt=YV(),bn=h.invert||f,Xt=D==="loading";ie.current=C.useMemo(()=>X*H+pn,[X,pn]),C.useEffect(()=>{W(!0)},[]),C.useLayoutEffect(()=>{if(!fe)return;let tt=Pe.current,It=tt.style.height;tt.style.height="auto";let kt=tt.getBoundingClientRect().height;tt.style.height=It,G(kt),m(Dn=>Dn.find(q=>q.toastId===h.id)?Dn.map(q=>q.toastId===h.id?{...q,height:kt}:q):[{toastId:h.id,height:kt,position:h.position},...Dn])},[fe,h.title,h.description,m,h.id]);let yt=C.useCallback(()=>{pe(!0),te(ie.current),m(tt=>tt.filter(It=>It.toastId!==h.id)),setTimeout(()=>{S(h)},c7)},[h,S,m,ie]);C.useEffect(()=>{if(h.promise&&D==="loading"||h.duration===1/0||h.type==="loading")return;let tt,It=_e;return j||g||Q&&Zt?(()=>{if(Te.current{var kt;(kt=h.onAutoClose)==null||kt.call(h,h),yt()},It)),()=>clearTimeout(tt)},[j,g,V,h,_e,yt,h.promise,D,Q,Zt]),C.useEffect(()=>{let tt=Pe.current;if(tt){let It=tt.getBoundingClientRect().height;return G(It),m(kt=>[{toastId:h.id,height:It,position:h.position},...kt]),()=>m(kt=>kt.filter(Dn=>Dn.toastId!==h.id))}},[m,h.id]),C.useEffect(()=>{h.delete&&yt()},[yt,h.delete]);function Rr(){return L!=null&&L.loading?C.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},L.loading):F?C.createElement("div",{className:"sonner-loader","data-visible":D==="loading"},F):C.createElement(HV,{visible:D==="loading"})}return C.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:Pe,className:ee(T,K,$==null?void 0:$.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,$==null?void 0:$.default,$==null?void 0:$[D],(n=h==null?void 0:h.classNames)==null?void 0:n[D]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:N,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":fe,"data-promise":!!h.promise,"data-removed":he,"data-visible":E,"data-y-position":gt,"data-x-position":At,"data-index":y,"data-front":Ie,"data-swiping":ue,"data-dismissible":U,"data-type":D,"data-invert":bn,"data-swipe-out":de,"data-expanded":!!(j||V&&fe),style:{"--index":y,"--toasts-before":y,"--z-index":w.length-y,"--offset":`${he?xe:ie.current}px`,"--initial-height":V?"auto":`${Ye}px`,..._,...h.style},onPointerDown:tt=>{Xt||!U||(ve.current=new Date,te(ie.current),tt.target.setPointerCapture(tt.pointerId),tt.target.tagName!=="BUTTON"&&(Ae(!0),Be.current={x:tt.clientX,y:tt.clientY}))},onPointerUp:()=>{var tt,It,kt,Dn;if(de||!U)return;Be.current=null;let q=Number(((tt=Pe.current)==null?void 0:tt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),we=new Date().getTime()-((It=ve.current)==null?void 0:It.getTime()),I=Math.abs(q)/we;if(Math.abs(q)>=l7||I>.11){te(ie.current),(kt=h.onDismiss)==null||kt.call(h,h),yt(),oe(!0);return}(Dn=Pe.current)==null||Dn.style.setProperty("--swipe-amount","0px"),Ae(!1)},onPointerMove:tt=>{var It;if(!Be.current||!U)return;let kt=tt.clientY-Be.current.y,Dn=tt.clientX-Be.current.x,q=(gt==="top"?Math.min:Math.max)(0,kt),we=tt.pointerType==="touch"?10:2;Math.abs(q)>we?(It=Pe.current)==null||It.style.setProperty("--swipe-amount",`${kt}px`):Math.abs(Dn)>we&&(Be.current=null)}},be&&!h.jsx?C.createElement("button",{"aria-label":Y,"data-disabled":Xt,"data-close-button":!0,onClick:Xt||!U?()=>{}:()=>{var tt;yt(),(tt=h.onDismiss)==null||tt.call(h,h)},className:ee($==null?void 0:$.closeButton,(s=h==null?void 0:h.classNames)==null?void 0:s.closeButton)},C.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"},C.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),C.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||C.isValidElement(h.title)?h.jsx||h.title:C.createElement(C.Fragment,null,D||h.icon||h.promise?C.createElement("div",{"data-icon":"",className:ee($==null?void 0:$.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||Rr():null,h.type!=="loading"?h.icon||(L==null?void 0:L[D])||VV(D):null):null,C.createElement("div",{"data-content":"",className:ee($==null?void 0:$.content,(o=h==null?void 0:h.classNames)==null?void 0:o.content)},C.createElement("div",{"data-title":"",className:ee($==null?void 0:$.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},h.title),h.description?C.createElement("div",{"data-description":"",className:ee(k,J,$==null?void 0:$.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},h.description):null),C.isValidElement(h.cancel)?h.cancel:h.cancel&&dm(h.cancel)?C.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||A,onClick:tt=>{var It,kt;dm(h.cancel)&&U&&((kt=(It=h.cancel).onClick)==null||kt.call(It,tt),yt())},className:ee($==null?void 0:$.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,C.isValidElement(h.action)?h.action:h.action&&dm(h.action)?C.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||O,onClick:tt=>{var It,kt;dm(h.action)&&(tt.defaultPrevented||((kt=(It=h.action).onClick)==null||kt.call(It,tt),yt()))},className:ee($==null?void 0:$.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function fA(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var f7=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:i,className:o,offset:l,theme:c="light",richColors:u,duration:d,style:f,visibleToasts:h=r7,toastOptions:p,dir:g=fA(),gap:m=o7,loadingIcon:x,icons:b,containerAriaLabel:y="Notifications",pauseWhenPageIsHidden:w,cn:j=u7}=e,[S,N]=C.useState([]),P=C.useMemo(()=>Array.from(new Set([n].concat(S.filter(Q=>Q.position).map(Q=>Q.position)))),[S,n]),[_,A]=C.useState([]),[O,T]=C.useState(!1),[k,M]=C.useState(!1),[R,H]=C.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),F=C.useRef(null),V=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),$=C.useRef(null),L=C.useRef(!1),Y=C.useCallback(Q=>{var ee;(ee=S.find(fe=>fe.id===Q.id))!=null&&ee.delete||Qr.dismiss(Q.id),N(fe=>fe.filter(({id:W})=>W!==Q.id))},[S]);return C.useEffect(()=>Qr.subscribe(Q=>{if(Q.dismiss){N(ee=>ee.map(fe=>fe.id===Q.id?{...fe,delete:!0}:fe));return}setTimeout(()=>{NM.flushSync(()=>{N(ee=>{let fe=ee.findIndex(W=>W.id===Q.id);return fe!==-1?[...ee.slice(0,fe),{...ee[fe],...Q},...ee.slice(fe+1)]:[Q,...ee]})})})}),[]),C.useEffect(()=>{if(c!=="system"){H(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:Q})=>{H(Q?"dark":"light")})},[c]),C.useEffect(()=>{S.length<=1&&T(!1)},[S]),C.useEffect(()=>{let Q=ee=>{var fe,W;r.every(he=>ee[he]||ee.code===he)&&(T(!0),(fe=F.current)==null||fe.focus()),ee.code==="Escape"&&(document.activeElement===F.current||(W=F.current)!=null&&W.contains(document.activeElement))&&T(!1)};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[r]),C.useEffect(()=>{if(F.current)return()=>{$.current&&($.current.focus({preventScroll:!0}),$.current=null,L.current=!1)}},[F.current]),S.length?C.createElement("section",{"aria-label":`${y} ${V}`,tabIndex:-1},P.map((Q,ee)=>{var fe;let[W,he]=Q.split("-");return C.createElement("ol",{key:Q,dir:g==="auto"?fA():g,tabIndex:-1,ref:F,className:o,"data-sonner-toaster":!0,"data-theme":R,"data-y-position":W,"data-x-position":he,style:{"--front-toast-height":`${((fe=_[0])==null?void 0:fe.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||s7,"--width":`${a7}px`,"--gap":`${m}px`,...f},onBlur:pe=>{L.current&&!pe.currentTarget.contains(pe.relatedTarget)&&(L.current=!1,$.current&&($.current.focus({preventScroll:!0}),$.current=null))},onFocus:pe=>{pe.target instanceof HTMLElement&&pe.target.dataset.dismissible==="false"||L.current||(L.current=!0,$.current=pe.relatedTarget)},onMouseEnter:()=>T(!0),onMouseMove:()=>T(!0),onMouseLeave:()=>{k||T(!1)},onPointerDown:pe=>{pe.target instanceof HTMLElement&&pe.target.dataset.dismissible==="false"||M(!0)},onPointerUp:()=>M(!1)},S.filter(pe=>!pe.position&&ee===0||pe.position===Q).map((pe,ue)=>{var Ae,de;return C.createElement(d7,{key:pe.id,icons:b,index:ue,toast:pe,defaultRichColors:u,duration:(Ae=p==null?void 0:p.duration)!=null?Ae:d,className:p==null?void 0:p.className,descriptionClassName:p==null?void 0:p.descriptionClassName,invert:t,visibleToasts:h,closeButton:(de=p==null?void 0:p.closeButton)!=null?de:i,interacting:k,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:Y,toasts:S.filter(oe=>oe.position==pe.position),heights:_.filter(oe=>oe.position==pe.position),setHeights:A,expandByDefault:s,gap:m,loadingIcon:x,expanded:O,pauseWhenPageIsHidden:w,cn:j})}))})):null};const h7=({...e})=>{const{theme:t="system"}=UV();return a.jsx(f7,{theme:t,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"}},...e})};function $e(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function p7(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ry(...e){return t=>e.forEach(n=>p7(n,t))}function pt(...e){return v.useCallback(Ry(...e),e)}function m7(e,t){const n=v.createContext(t),r=i=>{const{children:o,...l}=i,c=v.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function s(i){const o=v.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,s]}function Ir(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[e])==null?void 0:b[c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})};u.displayName=i+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,g7(s,...t)]}function g7(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var xa=v.forwardRef((e,t)=>{const{children:n,...r}=e,s=v.Children.toArray(n),i=s.find(v7);if(i){const o=i.props.children,l=s.map(c=>c===i?v.Children.count(o)>1?v.Children.only(null):v.isValidElement(o)?o.props.children:null:c);return a.jsx(Mw,{...r,ref:t,children:v.isValidElement(o)?v.cloneElement(o,void 0,l):null})}return a.jsx(Mw,{...r,ref:t,children:n})});xa.displayName="Slot";var Mw=v.forwardRef((e,t)=>{const{children:n,...r}=e;if(v.isValidElement(n)){const s=x7(n);return v.cloneElement(n,{...y7(r,n.props),ref:t?Ry(t,s):s})}return v.Children.count(n)>1?v.Children.only(null):null});Mw.displayName="SlotClone";var iN=({children:e})=>a.jsx(a.Fragment,{children:e});function v7(e){return v.isValidElement(e)&&e.type===iN}function y7(e,t){const n={...t};for(const r in t){const s=e[r],i=t[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{i(...l),s(...l)}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...e,...n}}function x7(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var b7=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Xe=b7.reduce((e,t)=>{const n=v.forwardRef((r,s)=>{const{asChild:i,...o}=r,l=i?xa:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(l,{...o,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function PM(e,t){e&&Xs.flushSync(()=>e.dispatchEvent(t))}function Vn(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function w7(e,t=globalThis==null?void 0:globalThis.document){const n=Vn(e);v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var j7="DismissableLayer",Rw="dismissableLayer.update",S7="dismissableLayer.pointerDownOutside",N7="dismissableLayer.focusOutside",hA,CM=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),yp=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=e,u=v.useContext(CM),[d,f]=v.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=pt(t,P=>f(P)),m=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),b=m.indexOf(x),y=d?m.indexOf(d):-1,w=u.layersWithOutsidePointerEventsDisabled.size>0,j=y>=b,S=C7(P=>{const _=P.target,A=[...u.branches].some(O=>O.contains(_));!j||A||(s==null||s(P),o==null||o(P),P.defaultPrevented||l==null||l())},h),N=A7(P=>{const _=P.target;[...u.branches].some(O=>O.contains(_))||(i==null||i(P),o==null||o(P),P.defaultPrevented||l==null||l())},h);return w7(P=>{y===u.layers.size-1&&(r==null||r(P),!P.defaultPrevented&&l&&(P.preventDefault(),l()))},h),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(hA=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),pA(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=hA)}},[d,h,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),pA())},[d,u]),v.useEffect(()=>{const P=()=>p({});return document.addEventListener(Rw,P),()=>document.removeEventListener(Rw,P)},[]),a.jsx(Xe.div,{...c,ref:g,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:$e(e.onFocusCapture,N.onFocusCapture),onBlurCapture:$e(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:$e(e.onPointerDownCapture,S.onPointerDownCapture)})});yp.displayName=j7;var _7="DismissableLayerBranch",P7=v.forwardRef((e,t)=>{const n=v.useContext(CM),r=v.useRef(null),s=pt(t,r);return v.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(Xe.div,{...e,ref:s})});P7.displayName=_7;function C7(e,t=globalThis==null?void 0:globalThis.document){const n=Vn(e),r=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){AM(S7,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",i),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function A7(e,t=globalThis==null?void 0:globalThis.document){const n=Vn(e),r=v.useRef(!1);return v.useEffect(()=>{const s=i=>{i.target&&!r.current&&AM(N7,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function pA(){const e=new CustomEvent(Rw);document.dispatchEvent(e)}function AM(e,t,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?PM(s,i):s.dispatchEvent(i)}var or=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},E7=w$.useId||(()=>{}),O7=0;function Cs(e){const[t,n]=v.useState(E7());return or(()=>{n(r=>r??String(O7++))},[e]),t?`radix-${t}`:""}const k7=["top","right","bottom","left"],Co=Math.min,ns=Math.max,Cg=Math.round,fm=Math.floor,Ao=e=>({x:e,y:e}),T7={left:"right",right:"left",bottom:"top",top:"bottom"},$7={start:"end",end:"start"};function Dw(e,t,n){return ns(e,Co(t,n))}function ba(e,t){return typeof e=="function"?e(t):e}function wa(e){return e.split("-")[0]}function Ku(e){return e.split("-")[1]}function aN(e){return e==="x"?"y":"x"}function oN(e){return e==="y"?"height":"width"}function Eo(e){return["top","bottom"].includes(wa(e))?"y":"x"}function lN(e){return aN(Eo(e))}function I7(e,t,n){n===void 0&&(n=!1);const r=Ku(e),s=lN(e),i=oN(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=Ag(o)),[o,Ag(o)]}function M7(e){const t=Ag(e);return[Lw(e),t,Lw(t)]}function Lw(e){return e.replace(/start|end/g,t=>$7[t])}function R7(e,t,n){const r=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?s:r:t?r:s;case"left":case"right":return t?i:o;default:return[]}}function D7(e,t,n,r){const s=Ku(e);let i=R7(wa(e),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),t&&(i=i.concat(i.map(Lw)))),i}function Ag(e){return e.replace(/left|right|bottom|top/g,t=>T7[t])}function L7(e){return{top:0,right:0,bottom:0,left:0,...e}}function EM(e){return typeof e!="number"?L7(e):{top:e,right:e,bottom:e,left:e}}function Eg(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function mA(e,t,n){let{reference:r,floating:s}=e;const i=Eo(t),o=lN(t),l=oN(o),c=wa(t),u=i==="y",d=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-s.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-s.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Ku(t)){case"start":p[o]-=h*(n&&u?-1:1);break;case"end":p[o]+=h*(n&&u?-1:1);break}return p}const F7=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=mA(u,r,c),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=ba(e,t)||{};if(u==null)return{};const f=EM(d),h={x:n,y:r},p=lN(s),g=oN(p),m=await o.getDimensions(u),x=p==="y",b=x?"top":"left",y=x?"bottom":"right",w=x?"clientHeight":"clientWidth",j=i.reference[g]+i.reference[p]-h[p]-i.floating[g],S=h[p]-i.reference[p],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let P=N?N[w]:0;(!P||!await(o.isElement==null?void 0:o.isElement(N)))&&(P=l.floating[w]||i.floating[g]);const _=j/2-S/2,A=P/2-m[g]/2-1,O=Co(f[b],A),T=Co(f[y],A),k=O,M=P-m[g]-T,R=P/2-m[g]/2+_,H=Dw(k,R,M),F=!c.arrow&&Ku(s)!=null&&R!==H&&i.reference[g]/2-(RR<=0)){var T,k;const R=(((T=i.flip)==null?void 0:T.index)||0)+1,H=P[R];if(H)return{data:{index:R,overflows:O},reset:{placement:H}};let F=(k=O.filter(V=>V.overflows[0]<=0).sort((V,$)=>V.overflows[1]-$.overflows[1])[0])==null?void 0:k.placement;if(!F)switch(p){case"bestFit":{var M;const V=(M=O.filter($=>{if(N){const L=Eo($.placement);return L===y||L==="y"}return!0}).map($=>[$.placement,$.overflows.filter(L=>L>0).reduce((L,Y)=>L+Y,0)]).sort(($,L)=>$[1]-L[1])[0])==null?void 0:M[0];V&&(F=V);break}case"initialPlacement":F=l;break}if(s!==F)return{reset:{placement:F}}}return{}}}};function gA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function vA(e){return k7.some(t=>e[t]>=0)}const U7=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=ba(e,t);switch(r){case"referenceHidden":{const i=await Yf(t,{...s,elementContext:"reference"}),o=gA(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:vA(o)}}}case"escaped":{const i=await Yf(t,{...s,altBoundary:!0}),o=gA(i,n.floating);return{data:{escapedOffsets:o,escaped:vA(o)}}}default:return{}}}}};async function V7(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=wa(n),l=Ku(n),c=Eo(n)==="y",u=["left","top"].includes(o)?-1:1,d=i&&c?-1:1,f=ba(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const W7=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=t,c=await V7(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},H7=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:l={fn:x=>{let{x:b,y}=x;return{x:b,y}}},...c}=ba(e,t),u={x:n,y:r},d=await Yf(t,c),f=Eo(wa(s)),h=aN(f);let p=u[h],g=u[f];if(i){const x=h==="y"?"top":"left",b=h==="y"?"bottom":"right",y=p+d[x],w=p-d[b];p=Dw(y,p,w)}if(o){const x=f==="y"?"top":"left",b=f==="y"?"bottom":"right",y=g+d[x],w=g-d[b];g=Dw(y,g,w)}const m=l.fn({...t,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:i,[f]:o}}}}}},G7=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=ba(e,t),d={x:n,y:r},f=Eo(s),h=aN(f);let p=d[h],g=d[f];const m=ba(l,t),x=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const w=h==="y"?"height":"width",j=i.reference[h]-i.floating[w]+x.mainAxis,S=i.reference[h]+i.reference[w]-x.mainAxis;pS&&(p=S)}if(u){var b,y;const w=h==="y"?"width":"height",j=["top","left"].includes(wa(s)),S=i.reference[f]-i.floating[w]+(j&&((b=o.offset)==null?void 0:b[f])||0)+(j?0:x.crossAxis),N=i.reference[f]+i.reference[w]+(j?0:((y=o.offset)==null?void 0:y[f])||0)-(j?x.crossAxis:0);gN&&(g=N)}return{[h]:p,[f]:g}}}},q7=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:i,platform:o,elements:l}=t,{apply:c=()=>{},...u}=ba(e,t),d=await Yf(t,u),f=wa(s),h=Ku(s),p=Eo(s)==="y",{width:g,height:m}=i.floating;let x,b;f==="top"||f==="bottom"?(x=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,x=h==="end"?"top":"bottom");const y=m-d.top-d.bottom,w=g-d.left-d.right,j=Co(m-d[x],y),S=Co(g-d[b],w),N=!t.middlewareData.shift;let P=j,_=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(_=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(P=y),N&&!h){const O=ns(d.left,0),T=ns(d.right,0),k=ns(d.top,0),M=ns(d.bottom,0);p?_=g-2*(O!==0||T!==0?O+T:ns(d.left,d.right)):P=m-2*(k!==0||M!==0?k+M:ns(d.top,d.bottom))}await c({...t,availableWidth:_,availableHeight:P});const A=await o.getDimensions(l.floating);return g!==A.width||m!==A.height?{reset:{rects:!0}}:{}}}};function Dy(){return typeof window<"u"}function Xu(e){return OM(e)?(e.nodeName||"").toLowerCase():"#document"}function as(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Fi(e){var t;return(t=(OM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function OM(e){return Dy()?e instanceof Node||e instanceof as(e).Node:!1}function si(e){return Dy()?e instanceof Element||e instanceof as(e).Element:!1}function Ii(e){return Dy()?e instanceof HTMLElement||e instanceof as(e).HTMLElement:!1}function yA(e){return!Dy()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof as(e).ShadowRoot}function xp(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=ii(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(s)}function K7(e){return["table","td","th"].includes(Xu(e))}function Ly(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function cN(e){const t=uN(),n=si(e)?ii(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(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 X7(e){let t=Oo(e);for(;Ii(t)&&!fu(t);){if(cN(t))return t;if(Ly(t))return null;t=Oo(t)}return null}function uN(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function fu(e){return["html","body","#document"].includes(Xu(e))}function ii(e){return as(e).getComputedStyle(e)}function Fy(e){return si(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Oo(e){if(Xu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||yA(e)&&e.host||Fi(e);return yA(t)?t.host:t}function kM(e){const t=Oo(e);return fu(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ii(t)&&xp(t)?t:kM(t)}function Zf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=kM(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),o=as(s);if(i){const l=Fw(o);return t.concat(o,o.visualViewport||[],xp(s)?s:[],l&&n?Zf(l):[])}return t.concat(s,Zf(s,[],n))}function Fw(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function TM(e){const t=ii(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Ii(e),i=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=Cg(n)!==i||Cg(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function dN(e){return si(e)?e:e.contextElement}function Fc(e){const t=dN(e);if(!Ii(t))return Ao(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=TM(t);let o=(i?Cg(n.width):n.width)/r,l=(i?Cg(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Y7=Ao(0);function $M(e){const t=as(e);return!uN()||!t.visualViewport?Y7:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Z7(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==as(e)?!1:t}function Ml(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=dN(e);let o=Ao(1);t&&(r?si(r)&&(o=Fc(r)):o=Fc(e));const l=Z7(i,n,r)?$M(i):Ao(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(i){const h=as(i),p=r&&si(r)?as(r):r;let g=h,m=Fw(g);for(;m&&r&&p!==g;){const x=Fc(m),b=m.getBoundingClientRect(),y=ii(m),w=b.left+(m.clientLeft+parseFloat(y.paddingLeft))*x.x,j=b.top+(m.clientTop+parseFloat(y.paddingTop))*x.y;c*=x.x,u*=x.y,d*=x.x,f*=x.y,c+=w,u+=j,g=as(m),m=Fw(g)}}return Eg({width:d,height:f,x:c,y:u})}function Q7(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=Fi(r),l=t?Ly(t.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Ao(1);const d=Ao(0),f=Ii(r);if((f||!f&&!i)&&((Xu(r)!=="body"||xp(o))&&(c=Fy(r)),Ii(r))){const h=Ml(r);u=Fc(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-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function J7(e){return Array.from(e.getClientRects())}function Bw(e,t){const n=Fy(e).scrollLeft;return t?t.left+n:Ml(Fi(e)).left+n}function e9(e){const t=Fi(e),n=Fy(e),r=e.ownerDocument.body,s=ns(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ns(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+Bw(e);const l=-n.scrollTop;return ii(r).direction==="rtl"&&(o+=ns(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}function t9(e,t){const n=as(e),r=Fi(e),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const u=uN();(!u||u&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:l,y:c}}function n9(e,t){const n=Ml(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Ii(e)?Fc(e):Ao(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:l,x:c,y:u}}function xA(e,t,n){let r;if(t==="viewport")r=t9(e,n);else if(t==="document")r=e9(Fi(e));else if(si(t))r=n9(t,n);else{const s=$M(e);r={...t,x:t.x-s.x,y:t.y-s.y}}return Eg(r)}function IM(e,t){const n=Oo(e);return n===t||!si(n)||fu(n)?!1:ii(n).position==="fixed"||IM(n,t)}function r9(e,t){const n=t.get(e);if(n)return n;let r=Zf(e,[],!1).filter(l=>si(l)&&Xu(l)!=="body"),s=null;const i=ii(e).position==="fixed";let o=i?Oo(e):e;for(;si(o)&&!fu(o);){const l=ii(o),c=cN(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||xp(o)&&!c&&IM(e,o))?r=r.filter(d=>d!==o):s=l,o=Oo(o)}return t.set(e,r),r}function s9(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?Ly(t)?[]:r9(t,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=xA(t,d,s);return u.top=ns(f.top,u.top),u.right=Co(f.right,u.right),u.bottom=Co(f.bottom,u.bottom),u.left=ns(f.left,u.left),u},xA(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function i9(e){const{width:t,height:n}=TM(e);return{width:t,height:n}}function a9(e,t,n){const r=Ii(t),s=Fi(t),i=n==="fixed",o=Ml(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=Ao(0);if(r||!r&&!i)if((Xu(t)!=="body"||xp(s))&&(l=Fy(t)),r){const p=Ml(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&(c.x=Bw(s));let u=0,d=0;if(s&&!r&&!i){const p=s.getBoundingClientRect();d=p.top+l.scrollTop,u=p.left+l.scrollLeft-Bw(s,p)}const f=o.left+l.scrollLeft-c.x-u,h=o.top+l.scrollTop-c.y-d;return{x:f,y:h,width:o.width,height:o.height}}function U0(e){return ii(e).position==="static"}function bA(e,t){if(!Ii(e)||ii(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Fi(e)===n&&(n=n.ownerDocument.body),n}function MM(e,t){const n=as(e);if(Ly(e))return n;if(!Ii(e)){let s=Oo(e);for(;s&&!fu(s);){if(si(s)&&!U0(s))return s;s=Oo(s)}return n}let r=bA(e,t);for(;r&&K7(r)&&U0(r);)r=bA(r,t);return r&&fu(r)&&U0(r)&&!cN(r)?n:r||X7(e)||n}const o9=async function(e){const t=this.getOffsetParent||MM,n=this.getDimensions,r=await n(e.floating);return{reference:a9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function l9(e){return ii(e).direction==="rtl"}const c9={convertOffsetParentRelativeRectToViewportRelativeRect:Q7,getDocumentElement:Fi,getClippingRect:s9,getOffsetParent:MM,getElementRects:o9,getClientRects:J7,getDimensions:i9,getScale:Fc,isElement:si,isRTL:l9};function u9(e,t){let n=null,r;const s=Fi(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(l||t(),!f||!h)return;const p=fm(d),g=fm(s.clientWidth-(u+f)),m=fm(s.clientHeight-(d+h)),x=fm(u),y={rootMargin:-p+"px "+-g+"px "+-m+"px "+-x+"px",threshold:ns(0,Co(1,c))||1};let w=!0;function j(S){const N=S[0].intersectionRatio;if(N!==c){if(!w)return o();N?o(!1,N):r=setTimeout(()=>{o(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(j,{...y,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,y)}n.observe(e)}return o(!0),i}function d9(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=dN(e),d=s||i?[...u?Zf(u):[],...Zf(t)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const f=u&&l?u9(u,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(b=>{let[y]=b;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,m=c?Ml(e):null;c&&x();function x(){const b=Ml(e);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(x)}return n(),()=>{var b;d.forEach(y=>{s&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const f9=W7,h9=H7,p9=z7,m9=q7,g9=U7,wA=B7,v9=G7,y9=(e,t,n)=>{const r=new Map,s={platform:c9,...n},i={...s.platform,_c:r};return F7(e,t,{...s,platform:i})};var Km=typeof document<"u"?v.useLayoutEffect:v.useEffect;function Og(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Og(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Og(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function RM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jA(e,t){const n=RM(e);return Math.round(t*n)/n}function V0(e){const t=v.useRef(e);return Km(()=>{t.current=e}),t}function x9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=v.useState(r);Og(h,r)||p(r);const[g,m]=v.useState(null),[x,b]=v.useState(null),y=v.useCallback($=>{$!==N.current&&(N.current=$,m($))},[]),w=v.useCallback($=>{$!==P.current&&(P.current=$,b($))},[]),j=i||g,S=o||x,N=v.useRef(null),P=v.useRef(null),_=v.useRef(d),A=c!=null,O=V0(c),T=V0(s),k=V0(u),M=v.useCallback(()=>{if(!N.current||!P.current)return;const $={placement:t,strategy:n,middleware:h};T.current&&($.platform=T.current),y9(N.current,P.current,$).then(L=>{const Y={...L,isPositioned:k.current!==!1};R.current&&!Og(_.current,Y)&&(_.current=Y,Xs.flushSync(()=>{f(Y)}))})},[h,t,n,T,k]);Km(()=>{u===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const R=v.useRef(!1);Km(()=>(R.current=!0,()=>{R.current=!1}),[]),Km(()=>{if(j&&(N.current=j),S&&(P.current=S),j&&S){if(O.current)return O.current(j,S,M);M()}},[j,S,M,O,A]);const H=v.useMemo(()=>({reference:N,floating:P,setReference:y,setFloating:w}),[y,w]),F=v.useMemo(()=>({reference:j,floating:S}),[j,S]),V=v.useMemo(()=>{const $={position:n,left:0,top:0};if(!F.floating)return $;const L=jA(F.floating,d.x),Y=jA(F.floating,d.y);return l?{...$,transform:"translate("+L+"px, "+Y+"px)",...RM(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:Y}},[n,l,F.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:M,refs:H,elements:F,floatingStyles:V}),[d,M,H,F,V])}const b9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?wA({element:r.current,padding:s}).fn(n):{}:r?wA({element:r,padding:s}).fn(n):{}}}},w9=(e,t)=>({...f9(e),options:[e,t]}),j9=(e,t)=>({...h9(e),options:[e,t]}),S9=(e,t)=>({...v9(e),options:[e,t]}),N9=(e,t)=>({...p9(e),options:[e,t]}),_9=(e,t)=>({...m9(e),options:[e,t]}),P9=(e,t)=>({...g9(e),options:[e,t]}),C9=(e,t)=>({...b9(e),options:[e,t]});var A9="Arrow",DM=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...i}=e;return a.jsx(Xe.svg,{...i,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});DM.displayName=A9;var E9=DM;function O9(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,k9(s,...t)]}function k9(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function bp(e){const[t,n]=v.useState(void 0);return or(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var fN="Popper",[LM,Yu]=O9(fN),[T9,FM]=LM(fN),BM=e=>{const{__scopePopper:t,children:n}=e,[r,s]=v.useState(null);return a.jsx(T9,{scope:t,anchor:r,onAnchorChange:s,children:n})};BM.displayName=fN;var zM="PopperAnchor",UM=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,i=FM(zM,n),o=v.useRef(null),l=pt(t,o);return v.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:a.jsx(Xe.div,{...s,ref:l})});UM.displayName=zM;var hN="PopperContent",[$9,I9]=LM(hN),VM=v.forwardRef((e,t)=>{var ue,Ae,de,oe,xe,te;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=e,x=FM(hN,n),[b,y]=v.useState(null),w=pt(t,Ye=>y(Ye)),[j,S]=v.useState(null),N=bp(j),P=(N==null?void 0:N.width)??0,_=(N==null?void 0:N.height)??0,A=r+(i!=="center"?"-"+i:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},T=Array.isArray(u)?u:[u],k=T.length>0,M={padding:O,boundary:T.filter(R9),altBoundary:k},{refs:R,floatingStyles:H,placement:F,isPositioned:V,middlewareData:$}=x9({strategy:"fixed",placement:A,whileElementsMounted:(...Ye)=>d9(...Ye,{animationFrame:p==="always"}),elements:{reference:x.anchor},middleware:[w9({mainAxis:s+_,alignmentAxis:o}),c&&j9({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?S9():void 0,...M}),c&&N9({...M}),_9({...M,apply:({elements:Ye,rects:G,availableWidth:ve,availableHeight:Pe})=>{const{width:Ie,height:E}=G.reference,D=Ye.floating.style;D.setProperty("--radix-popper-available-width",`${ve}px`),D.setProperty("--radix-popper-available-height",`${Pe}px`),D.setProperty("--radix-popper-anchor-width",`${Ie}px`),D.setProperty("--radix-popper-anchor-height",`${E}px`)}}),j&&C9({element:j,padding:l}),D9({arrowWidth:P,arrowHeight:_}),h&&P9({strategy:"referenceHidden",...M})]}),[L,Y]=GM(F),Q=Vn(g);or(()=>{V&&(Q==null||Q())},[V,Q]);const ee=(ue=$.arrow)==null?void 0:ue.x,fe=(Ae=$.arrow)==null?void 0:Ae.y,W=((de=$.arrow)==null?void 0:de.centerOffset)!==0,[he,pe]=v.useState();return or(()=>{b&&pe(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:V?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(oe=$.transformOrigin)==null?void 0:oe.x,(xe=$.transformOrigin)==null?void 0:xe.y].join(" "),...((te=$.hide)==null?void 0:te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx($9,{scope:n,placedSide:L,onArrowChange:S,arrowX:ee,arrowY:fe,shouldHideArrow:W,children:a.jsx(Xe.div,{"data-side":L,"data-align":Y,...m,ref:w,style:{...m.style,animation:V?void 0:"none"}})})})});VM.displayName=hN;var WM="PopperArrow",M9={top:"bottom",right:"left",bottom:"top",left:"right"},HM=v.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,i=I9(WM,r),o=M9[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(E9,{...s,ref:n,style:{...s.style,display:"block"}})})});HM.displayName=WM;function R9(e){return e!==null}var D9=e=>({name:"transformOrigin",options:e,fn(t){var x,b,y;const{placement:n,rects:r,middlewareData:s}=t,o=((x=s.arrow)==null?void 0:x.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=GM(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=s.arrow)==null?void 0:b.x)??0)+l/2,p=(((y=s.arrow)==null?void 0:y.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=o?f:`${h}px`,m=`${-c}px`):u==="top"?(g=o?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=o?f:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=o?f:`${p}px`),{data:{x:g,y:m}}}});function GM(e){const[t,n="center"]=e.split("-");return[t,n]}var qM=BM,pN=UM,mN=VM,gN=HM,L9="Portal",By=v.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,i]=v.useState(!1);or(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?NM.createPortal(a.jsx(Xe.div,{...r,ref:t}),o):null});By.displayName=L9;function F9(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var lr=e=>{const{present:t,children:n}=e,r=B9(t),s=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),i=pt(r.ref,z9(s));return typeof n=="function"||r.isPresent?v.cloneElement(s,{ref:i}):null};lr.displayName="Presence";function B9(e){const[t,n]=v.useState(),r=v.useRef({}),s=v.useRef(e),i=v.useRef("none"),o=e?"mounted":"unmounted",[l,c]=F9(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=hm(r.current);i.current=l==="mounted"?u:"none"},[l]),or(()=>{const u=r.current,d=s.current;if(d!==e){const h=i.current,p=hm(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),or(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=hm(r.current).includes(p.animationName);if(p.target===t&&m&&(c("ANIMATION_END"),!s.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},h=p=>{p.target===t&&(i.current=hm(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function hm(e){return(e==null?void 0:e.animationName)||"none"}function z9(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function us({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=U9({defaultProp:t,onChange:n}),i=e!==void 0,o=i?e:r,l=Vn(n),c=v.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else s(u)},[i,e,s,l]);return[o,c]}function U9({defaultProp:e,onChange:t}){const n=v.useState(e),[r]=n,s=v.useRef(r),i=Vn(t);return v.useEffect(()=>{s.current!==r&&(i(r),s.current=r)},[r,s,i]),n}var V9="VisuallyHidden",vN=v.forwardRef((e,t)=>a.jsx(Xe.span,{...e,ref:t,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",...e.style}}));vN.displayName=V9;var W9=vN,[zy,wOe]=Ir("Tooltip",[Yu]),yN=Yu(),KM="TooltipProvider",H9=700,SA="tooltip.open",[G9,XM]=zy(KM),YM=e=>{const{__scopeTooltip:t,delayDuration:n=H9,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,[o,l]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),a.jsx(G9,{scope:t,isOpenDelayed:o,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),l(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:i})};YM.displayName=KM;var ZM="Tooltip",[jOe,Uy]=zy(ZM),zw="TooltipTrigger",q9=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Uy(zw,n),i=XM(zw,n),o=yN(n),l=v.useRef(null),c=pt(t,l,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),a.jsx(pN,{asChild:!0,...o,children:a.jsx(Xe.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:$e(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:$e(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:$e(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:$e(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:$e(e.onBlur,s.onClose),onClick:$e(e.onClick,s.onClose)})})});q9.displayName=zw;var K9="TooltipPortal",[SOe,X9]=zy(K9,{forceMount:void 0}),hu="TooltipContent",QM=v.forwardRef((e,t)=>{const n=X9(hu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=Uy(hu,e.__scopeTooltip);return a.jsx(lr,{present:r||o.open,children:o.disableHoverableContent?a.jsx(JM,{side:s,...i,ref:t}):a.jsx(Y9,{side:s,...i,ref:t})})}),Y9=v.forwardRef((e,t)=>{const n=Uy(hu,e.__scopeTooltip),r=XM(hu,e.__scopeTooltip),s=v.useRef(null),i=pt(t,s),[o,l]=v.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{l(null),f(!1)},[f]),p=v.useCallback((g,m)=>{const x=g.currentTarget,b={x:g.clientX,y:g.clientY},y=eW(b,x.getBoundingClientRect()),w=tW(b,y),j=nW(m.getBoundingClientRect()),S=sW([...w,...j]);l(S),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(c&&d){const g=x=>p(x,d),m=x=>p(x,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),v.useEffect(()=>{if(o){const g=m=>{const x=m.target,b={x:m.clientX,y:m.clientY},y=(c==null?void 0:c.contains(x))||(d==null?void 0:d.contains(x)),w=!rW(b,o);y?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,h]),a.jsx(JM,{...e,ref:i})}),[Z9,Q9]=zy(ZM,{isInside:!1}),JM=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=e,c=Uy(hu,n),u=yN(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(SA,d),()=>document.removeEventListener(SA,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),a.jsx(yp,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:a.jsxs(mN,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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(iN,{children:r}),a.jsx(Z9,{scope:n,isInside:!0,children:a.jsx(W9,{id:c.contentId,role:"tooltip",children:s||r})})]})})});QM.displayName=hu;var eR="TooltipArrow",J9=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=yN(n);return Q9(eR,n).isInside?null:a.jsx(gN,{...s,...r,ref:t})});J9.displayName=eR;function eW(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function tW(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function nW(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function rW(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;ir!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function sW(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),iW(t)}function iW(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var aW=YM,tR=QM;function nR(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const t=cW(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(xN);return l[0]===""&&l.length!==1&&l.shift(),rR(l,t)||lW(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},rR=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?rR(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(xN);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},NA=/^\[(.+)\]$/,lW=e=>{if(NA.test(e)){const t=NA.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},cW=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return dW(Object.entries(e.classGroups),n).forEach(([i,o])=>{Uw(o,r,i,t)}),r},Uw=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:_A(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(uW(s)){Uw(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{Uw(o,_A(t,i),n,r)})})},_A=(e,t)=>{let n=e;return t.split(xN).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},uW=e=>e.isThemeGetter,dW=(e,t)=>t?e.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[n,s]}):e,fW=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},sR="!",hW=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let u=0,d=0,f;for(let x=0;xd?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:o}):o},pW=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},mW=e=>({cache:fW(e.cacheSize),parseClassName:hW(e),...oW(e)}),gW=/\s+/,vW=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(gW);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){l=u+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=u+(l.length>0?" "+l:l);continue}g=!1}const x=pW(d).join(":"),b=f?x+sR:x,y=b+m;if(i.includes(y))continue;i.push(y);const w=s(m,g);for(let j=0;j0?" "+l:l)}return l};function yW(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rf(d),e());return n=mW(u),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=vW(c,n);return s(c,d),d}return function(){return i(yW.apply(null,arguments))}}const tn=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},aR=/^\[(?:([a-z-]+):)?(.+)\]$/i,bW=/^\d+\/\d+$/,wW=new Set(["px","full","screen"]),jW=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,SW=/\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$/,NW=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,_W=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,PW=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Vi=e=>Bc(e)||wW.has(e)||bW.test(e),Ba=e=>Zu(e,"length",IW),Bc=e=>!!e&&!Number.isNaN(Number(e)),W0=e=>Zu(e,"number",Bc),Md=e=>!!e&&Number.isInteger(Number(e)),CW=e=>e.endsWith("%")&&Bc(e.slice(0,-1)),wt=e=>aR.test(e),za=e=>jW.test(e),AW=new Set(["length","size","percentage"]),EW=e=>Zu(e,AW,oR),OW=e=>Zu(e,"position",oR),kW=new Set(["image","url"]),TW=e=>Zu(e,kW,RW),$W=e=>Zu(e,"",MW),Rd=()=>!0,Zu=(e,t,n)=>{const r=aR.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},IW=e=>SW.test(e)&&!NW.test(e),oR=()=>!1,MW=e=>_W.test(e),RW=e=>PW.test(e),DW=()=>{const e=tn("colors"),t=tn("spacing"),n=tn("blur"),r=tn("brightness"),s=tn("borderColor"),i=tn("borderRadius"),o=tn("borderSpacing"),l=tn("borderWidth"),c=tn("contrast"),u=tn("grayscale"),d=tn("hueRotate"),f=tn("invert"),h=tn("gap"),p=tn("gradientColorStops"),g=tn("gradientColorStopPositions"),m=tn("inset"),x=tn("margin"),b=tn("opacity"),y=tn("padding"),w=tn("saturate"),j=tn("scale"),S=tn("sepia"),N=tn("skew"),P=tn("space"),_=tn("translate"),A=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto",wt,t],k=()=>[wt,t],M=()=>["",Vi,Ba],R=()=>["auto",Bc,wt],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],F=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],$=()=>["start","end","center","between","around","evenly","stretch"],L=()=>["","0",wt],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[Bc,wt];return{cacheSize:500,separator:":",theme:{colors:[Rd],spacing:[Vi,Ba],blur:["none","",za,wt],brightness:Q(),borderColor:[e],borderRadius:["none","","full",za,wt],borderSpacing:k(),borderWidth:M(),contrast:Q(),grayscale:L(),hueRotate:Q(),invert:L(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[CW,Ba],inset:T(),margin:T(),opacity:Q(),padding:k(),saturate:Q(),scale:Q(),sepia:L(),skew:Q(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",wt]}],container:["container"],columns:[{columns:[za]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"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:[...H(),wt]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:A()}],"overscroll-x":[{"overscroll-x":A()}],"overscroll-y":[{"overscroll-y":A()}],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",Md,wt]}],basis:[{basis:T()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",wt]}],grow:[{grow:L()}],shrink:[{shrink:L()}],order:[{order:["first","last","none",Md,wt]}],"grid-cols":[{"grid-cols":[Rd]}],"col-start-end":[{col:["auto",{span:["full",Md,wt]},wt]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Rd]}],"row-start-end":[{row:["auto",{span:[Md,wt]},wt]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",wt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",wt]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...$()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...$(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...$(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[y]}],px:[{px:[y]}],py:[{py:[y]}],ps:[{ps:[y]}],pe:[{pe:[y]}],pt:[{pt:[y]}],pr:[{pr:[y]}],pb:[{pb:[y]}],pl:[{pl:[y]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",wt,t]}],"min-w":[{"min-w":[wt,t,"min","max","fit"]}],"max-w":[{"max-w":[wt,t,"none","full","min","max","fit","prose",{screen:[za]},za]}],h:[{h:[wt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[wt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[wt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[wt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",za,Ba]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",W0]}],"font-family":[{font:[Rd]}],"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",wt]}],"line-clamp":[{"line-clamp":["none",Bc,W0]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Vi,wt]}],"list-image":[{"list-image":["none",wt]}],"list-style-type":[{list:["none","disc","decimal",wt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...F(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Vi,Ba]}],"underline-offset":[{"underline-offset":["auto",Vi,wt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",wt]}],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",wt]}],"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:[...H(),OW]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",EW]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},TW]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...F(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:F()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...F()]}],"outline-offset":[{"outline-offset":[Vi,wt]}],"outline-w":[{outline:[Vi,Ba]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:M()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Vi,Ba]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",za,$W]}],"shadow-color":[{shadow:[Rd]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",za,wt]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"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":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",wt]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",wt]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",wt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Md,wt]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",wt]}],accent:[{accent:["auto",e]}],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",wt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",wt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Vi,Ba,W0]}],stroke:[{stroke:[e,"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"]}}},LW=xW(DW);function Me(...e){return LW(mt(e))}const FW=aW,BW=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(tR,{ref:r,sideOffset:t,className:Me("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",e),...n}));BW.displayName=tR.displayName;var Vy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Wy=typeof window>"u"||"Deno"in globalThis;function zs(){}function zW(e,t){return typeof e=="function"?e(t):e}function UW(e){return typeof e=="number"&&e>=0&&e!==1/0}function VW(e,t){return Math.max(e+(t||0)-Date.now(),0)}function PA(e,t){return typeof e=="function"?e(t):e}function WW(e,t){return typeof e=="function"?e(t):e}function CA(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==bN(o,t.options))return!1}else if(!Jf(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||i&&!i(t))}function AA(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Qf(t.options.mutationKey)!==Qf(i))return!1}else if(!Jf(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function bN(e,t){return((t==null?void 0:t.queryKeyHashFn)||Qf)(e)}function Qf(e){return JSON.stringify(e,(t,n)=>Vw(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Jf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Jf(e[n],t[n])):!1}function lR(e,t){if(e===t)return e;const n=EA(e)&&EA(t);if(n||Vw(e)&&Vw(t)){const r=n?e:Object.keys(e),s=r.length,i=n?t:Object.keys(t),o=i.length,l=n?[]:{};let c=0;for(let u=0;u{setTimeout(t,e)})}function GW(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?lR(e,t):t}function qW(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function KW(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var wN=Symbol();function cR(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===wN?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var xl,eo,Yc,r$,XW=(r$=class extends Vy{constructor(){super();Ut(this,xl);Ut(this,eo);Ut(this,Yc);Nt(this,Yc,t=>{if(!Wy&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){je(this,eo)||this.setEventListener(je(this,Yc))}onUnsubscribe(){var t;this.hasListeners()||((t=je(this,eo))==null||t.call(this),Nt(this,eo,void 0))}setEventListener(t){var n;Nt(this,Yc,t),(n=je(this,eo))==null||n.call(this),Nt(this,eo,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){je(this,xl)!==t&&(Nt(this,xl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof je(this,xl)=="boolean"?je(this,xl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},xl=new WeakMap,eo=new WeakMap,Yc=new WeakMap,r$),uR=new XW,Zc,to,Qc,s$,YW=(s$=class extends Vy{constructor(){super();Ut(this,Zc,!0);Ut(this,to);Ut(this,Qc);Nt(this,Qc,t=>{if(!Wy&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){je(this,to)||this.setEventListener(je(this,Qc))}onUnsubscribe(){var t;this.hasListeners()||((t=je(this,to))==null||t.call(this),Nt(this,to,void 0))}setEventListener(t){var n;Nt(this,Qc,t),(n=je(this,to))==null||n.call(this),Nt(this,to,t(this.setOnline.bind(this)))}setOnline(t){je(this,Zc)!==t&&(Nt(this,Zc,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return je(this,Zc)}},Zc=new WeakMap,to=new WeakMap,Qc=new WeakMap,s$),kg=new YW;function ZW(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}function QW(e){return Math.min(1e3*2**e,3e4)}function dR(e){return(e??"online")==="online"?kg.isOnline():!0}var fR=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function H0(e){return e instanceof fR}function hR(e){let t=!1,n=0,r=!1,s;const i=ZW(),o=m=>{var x;r||(h(new fR(m)),(x=e.abort)==null||x.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>uR.isFocused()&&(e.networkMode==="always"||kg.isOnline())&&e.canRun(),d=()=>dR(e.networkMode)&&e.canRun(),f=m=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,m),s==null||s(),i.resolve(m))},h=m=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,m),s==null||s(),i.reject(m))},p=()=>new Promise(m=>{var x;s=b=>{(r||u())&&m(b)},(x=e.onPause)==null||x.call(e)}).then(()=>{var m;s=void 0,r||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(r)return;let m;const x=n===0?e.initialPromise:void 0;try{m=x??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var N;if(r)return;const y=e.retry??(Wy?0:3),w=e.retryDelay??QW,j=typeof w=="function"?w(n,b):w,S=y===!0||typeof y=="number"&&nu()?void 0:p()).then(()=>{t?h(b):g()})})};return{promise:i,cancel:o,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),i)}}function JW(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=l=>setTimeout(l,0);const i=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var Pr=JW(),bl,i$,pR=(i$=class{constructor(){Ut(this,bl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),UW(this.gcTime)&&Nt(this,bl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wy?1/0:5*60*1e3))}clearGcTimeout(){je(this,bl)&&(clearTimeout(je(this,bl)),Nt(this,bl,void 0))}},bl=new WeakMap,i$),Jc,eu,gs,fr,dp,wl,Us,Gi,a$,eH=(a$=class extends pR{constructor(t){super();Ut(this,Us);Ut(this,Jc);Ut(this,eu);Ut(this,gs);Ut(this,fr);Ut(this,dp);Ut(this,wl);Nt(this,wl,!1),Nt(this,dp,t.defaultOptions),this.setOptions(t.options),this.observers=[],Nt(this,gs,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Nt(this,Jc,nH(this.options)),this.state=t.state??je(this,Jc),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=je(this,fr))==null?void 0:t.promise}setOptions(t){this.options={...je(this,dp),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&je(this,gs).remove(this)}setData(t,n){const r=GW(this.state.data,t,this.options);return cr(this,Us,Gi).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){cr(this,Us,Gi).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=je(this,fr))==null?void 0:r.promise;return(s=je(this,fr))==null||s.cancel(t),n?n.then(zs).catch(zs):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(je(this,Jc))}isActive(){return this.observers.some(t=>WW(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===wN||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!VW(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=je(this,fr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=je(this,fr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),je(this,gs).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(je(this,fr)&&(je(this,wl)?je(this,fr).cancel({revert:!0}):je(this,fr).cancelRetry()),this.scheduleGc()),je(this,gs).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||cr(this,Us,Gi).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(je(this,fr))return je(this,fr).continueRetry(),je(this,fr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Nt(this,wl,!0),r.signal)})},i=()=>{const f=cR(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return s(h),Nt(this,wl,!1),this.options.persister?this.options.persister(f,h,this):f(h)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};s(o),(c=this.options.behavior)==null||c.onFetch(o,this),Nt(this,eu,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&cr(this,Us,Gi).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var h,p,g,m;H0(f)&&f.silent||cr(this,Us,Gi).call(this,{type:"error",error:f}),H0(f)||((p=(h=je(this,gs).config).onError)==null||p.call(h,f,this),(m=(g=je(this,gs).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return Nt(this,fr,hR({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,m;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(x){l(x);return}(p=(h=je(this,gs).config).onSuccess)==null||p.call(h,f,this),(m=(g=je(this,gs).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,h)=>{cr(this,Us,Gi).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{cr(this,Us,Gi).call(this,{type:"pause"})},onContinue:()=>{cr(this,Us,Gi).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),je(this,fr).start()}},Jc=new WeakMap,eu=new WeakMap,gs=new WeakMap,fr=new WeakMap,dp=new WeakMap,wl=new WeakMap,Us=new WeakSet,Gi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...tH(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return H0(s)&&s.revert&&je(this,eu)?{...je(this,eu),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Pr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),je(this,gs).notify({query:this,type:"updated",action:t})})},a$);function tH(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dR(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function nH(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,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 yi,o$,rH=(o$=class extends Vy{constructor(t={}){super();Ut(this,yi);this.config=t,Nt(this,yi,new Map)}build(t,n,r){const s=n.queryKey,i=n.queryHash??bN(s,n);let o=this.get(i);return o||(o=new eH({cache:this,queryKey:s,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){je(this,yi).has(t.queryHash)||(je(this,yi).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=je(this,yi).get(t.queryHash);n&&(t.destroy(),n===t&&je(this,yi).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Pr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return je(this,yi).get(t)}getAll(){return[...je(this,yi).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>CA(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>CA(t,r)):n}notify(t){Pr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Pr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Pr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},yi=new WeakMap,o$),xi,jr,jl,bi,Ua,l$,sH=(l$=class extends pR{constructor(t){super();Ut(this,bi);Ut(this,xi);Ut(this,jr);Ut(this,jl);this.mutationId=t.mutationId,Nt(this,jr,t.mutationCache),Nt(this,xi,[]),this.state=t.state||iH(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){je(this,xi).includes(t)||(je(this,xi).push(t),this.clearGcTimeout(),je(this,jr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Nt(this,xi,je(this,xi).filter(n=>n!==t)),this.scheduleGc(),je(this,jr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){je(this,xi).length||(this.state.status==="pending"?this.scheduleGc():je(this,jr).remove(this))}continue(){var t;return((t=je(this,jl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,i,o,l,c,u,d,f,h,p,g,m,x,b,y,w,j,S,N,P;Nt(this,jl,hR({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(_,A)=>{cr(this,bi,Ua).call(this,{type:"failed",failureCount:_,error:A})},onPause:()=>{cr(this,bi,Ua).call(this,{type:"pause"})},onContinue:()=>{cr(this,bi,Ua).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>je(this,jr).canRun(this)}));const n=this.state.status==="pending",r=!je(this,jl).canStart();try{if(!n){cr(this,bi,Ua).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(s=je(this,jr).config).onMutate)==null?void 0:i.call(s,t,this));const A=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));A!==this.state.context&&cr(this,bi,Ua).call(this,{type:"pending",context:A,variables:t,isPaused:r})}const _=await je(this,jl).start();return await((u=(c=je(this,jr).config).onSuccess)==null?void 0:u.call(c,_,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,_,t,this.state.context)),await((p=(h=je(this,jr).config).onSettled)==null?void 0:p.call(h,_,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,_,null,t,this.state.context)),cr(this,bi,Ua).call(this,{type:"success",data:_}),_}catch(_){try{throw await((b=(x=je(this,jr).config).onError)==null?void 0:b.call(x,_,t,this.state.context,this)),await((w=(y=this.options).onError)==null?void 0:w.call(y,_,t,this.state.context)),await((S=(j=je(this,jr).config).onSettled)==null?void 0:S.call(j,void 0,_,this.state.variables,this.state.context,this)),await((P=(N=this.options).onSettled)==null?void 0:P.call(N,void 0,_,t,this.state.context)),_}finally{cr(this,bi,Ua).call(this,{type:"error",error:_})}}finally{je(this,jr).runNext(this)}}},xi=new WeakMap,jr=new WeakMap,jl=new WeakMap,bi=new WeakSet,Ua=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Pr.batch(()=>{je(this,xi).forEach(r=>{r.onMutationUpdate(t)}),je(this,jr).notify({mutation:this,type:"updated",action:t})})},l$);function iH(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Zr,fp,c$,aH=(c$=class extends Vy{constructor(t={}){super();Ut(this,Zr);Ut(this,fp);this.config=t,Nt(this,Zr,new Map),Nt(this,fp,Date.now())}build(t,n,r){const s=new sH({mutationCache:this,mutationId:++Gp(this,fp)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){const n=pm(t),r=je(this,Zr).get(n)??[];r.push(t),je(this,Zr).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=pm(t);if(je(this,Zr).has(n)){const s=(r=je(this,Zr).get(n))==null?void 0:r.filter(i=>i!==t);s&&(s.length===0?je(this,Zr).delete(n):je(this,Zr).set(n,s))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=je(this,Zr).get(pm(t)))==null?void 0:r.find(s=>s.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=je(this,Zr).get(pm(t)))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){Pr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...je(this,Zr).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>AA(n,r))}findAll(t={}){return this.getAll().filter(n=>AA(t,n))}notify(t){Pr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Pr.batch(()=>Promise.all(t.map(n=>n.continue().catch(zs))))}},Zr=new WeakMap,fp=new WeakMap,c$);function pm(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function kA(e){return{onFetch:(t,n)=>{var d,f,h,p,g;const r=t.options,s=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const x=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},b=cR(t.options,t.fetchOptions),y=async(w,j,S)=>{if(m)return Promise.reject();if(j==null&&w.pages.length)return Promise.resolve(w);const N={queryKey:t.queryKey,pageParam:j,direction:S?"backward":"forward",meta:t.options.meta};x(N);const P=await b(N),{maxPages:_}=t.options,A=S?KW:qW;return{pages:A(w.pages,P,_),pageParams:A(w.pageParams,j,_)}};if(s&&i.length){const w=s==="backward",j=w?oH:TA,S={pages:i,pageParams:o},N=j(r,S);l=await y(S,N,w)}else{const w=e??i.length;do{const j=c===0?o[0]??r.initialPageParam:TA(r,l);if(c>0&&j==null)break;l=await y(l,j),c++}while(c{var m,x;return(x=(m=t.options).persister)==null?void 0:x.call(m,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function TA(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function oH(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var mn,no,ro,tu,nu,so,ru,su,u$,lH=(u$=class{constructor(e={}){Ut(this,mn);Ut(this,no);Ut(this,ro);Ut(this,tu);Ut(this,nu);Ut(this,so);Ut(this,ru);Ut(this,su);Nt(this,mn,e.queryCache||new rH),Nt(this,no,e.mutationCache||new aH),Nt(this,ro,e.defaultOptions||{}),Nt(this,tu,new Map),Nt(this,nu,new Map),Nt(this,so,0)}mount(){Gp(this,so)._++,je(this,so)===1&&(Nt(this,ru,uR.subscribe(async e=>{e&&(await this.resumePausedMutations(),je(this,mn).onFocus())})),Nt(this,su,kg.subscribe(async e=>{e&&(await this.resumePausedMutations(),je(this,mn).onOnline())})))}unmount(){var e,t;Gp(this,so)._--,je(this,so)===0&&((e=je(this,ru))==null||e.call(this),Nt(this,ru,void 0),(t=je(this,su))==null||t.call(this),Nt(this,su,void 0))}isFetching(e){return je(this,mn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return je(this,no).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=je(this,mn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=je(this,mn).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(PA(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return je(this,mn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=je(this,mn).get(r.queryHash),i=s==null?void 0:s.state.data,o=zW(t,i);if(o!==void 0)return je(this,mn).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Pr.batch(()=>je(this,mn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=je(this,mn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=je(this,mn);Pr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=je(this,mn),r={type:"active",...e};return Pr.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Pr.batch(()=>je(this,mn).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(zs).catch(zs)}invalidateQueries(e={},t={}){return Pr.batch(()=>{if(je(this,mn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=Pr.batch(()=>je(this,mn).findAll(e).filter(s=>!s.isDisabled()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(zs)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(zs)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=je(this,mn).build(this,t);return n.isStaleByTime(PA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(zs).catch(zs)}fetchInfiniteQuery(e){return e.behavior=kA(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(zs).catch(zs)}ensureInfiniteQueryData(e){return e.behavior=kA(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return kg.isOnline()?je(this,no).resumePausedMutations():Promise.resolve()}getQueryCache(){return je(this,mn)}getMutationCache(){return je(this,no)}getDefaultOptions(){return je(this,ro)}setDefaultOptions(e){Nt(this,ro,e)}setQueryDefaults(e,t){je(this,tu).set(Qf(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...je(this,tu).values()];let n={};return t.forEach(r=>{Jf(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){je(this,nu).set(Qf(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...je(this,nu).values()];let n={};return t.forEach(r=>{Jf(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...je(this,ro).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=bN(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===wN&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...je(this,ro).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){je(this,mn).clear(),je(this,no).clear()}},mn=new WeakMap,no=new WeakMap,ro=new WeakMap,tu=new WeakMap,nu=new WeakMap,so=new WeakMap,ru=new WeakMap,su=new WeakMap,u$),cH=v.createContext(void 0),uH=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),a.jsx(cH.Provider,{value:e,children:t}));/** - * @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 eh(){return eh=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function mR(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function fH(){return Math.random().toString(36).substr(2,8)}function IA(e,t){return{usr:e.state,key:e.key,idx:t}}function Ww(e,t,n,r){return n===void 0&&(n=null),eh({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Qu(t):t,{state:n,key:t&&t.key||r||fH()})}function Tg(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Qu(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function hH(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=oo.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(eh({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=oo.Pop;let x=d(),b=x==null?null:x-u;u=x,c&&c({action:l,location:m.location,delta:b})}function h(x,b){l=oo.Push;let y=Ww(m.location,x,b);u=d()+1;let w=IA(y,u),j=m.createHref(y);try{o.pushState(w,"",j)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(j)}i&&c&&c({action:l,location:m.location,delta:1})}function p(x,b){l=oo.Replace;let y=Ww(m.location,x,b);u=d();let w=IA(y,u),j=m.createHref(y);o.replaceState(w,"",j),i&&c&&c({action:l,location:m.location,delta:0})}function g(x){let b=s.location.origin!=="null"?s.location.origin:s.location.href,y=typeof x=="string"?x:Tg(x);return y=y.replace(/ $/,"%20"),Pn(b,"No window.location.(origin|href) available to create URL for href: "+y),new URL(y,b)}let m={get action(){return l},get location(){return e(s,o)},listen(x){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener($A,f),c=x,()=>{s.removeEventListener($A,f),c=null}},createHref(x){return t(s,x)},createURL:g,encodeLocation(x){let b=g(x);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(x){return o.go(x)}};return m}var MA;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(MA||(MA={}));function pH(e,t,n){return n===void 0&&(n="/"),mH(e,t,n,!1)}function mH(e,t,n,r){let s=typeof t=="string"?Qu(t):t,i=jN(s.pathname||"/",n);if(i==null)return null;let o=gR(e);gH(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(Pn(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=xo([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(Pn(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),gR(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:SH(u,i.index),routesMeta:d})};return e.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of vR(i.path))s(i,o,c)}),t}function vR(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=vR(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function gH(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:NH(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const vH=/^:[\w-]+$/,yH=3,xH=2,bH=1,wH=10,jH=-2,RA=e=>e==="*";function SH(e,t){let n=e.split("/"),r=n.length;return n.some(RA)&&(r+=jH),t&&(r+=xH),n.filter(s=>!RA(s)).reduce((s,i)=>s+(vH.test(i)?yH:i===""?bH:wH),r)}function NH(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function _H(e,t,n){let{routesMeta:r}=e,s={},i="/",o=[];for(let l=0;l{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=l[f]||"";o=i.slice(0,i.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[f];return p&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:o,pattern:e}}function PH(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),mR(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function CH(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return mR(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function jN(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function AH(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Qu(e):e;return{pathname:n?n.startsWith("/")?n:EH(n,t):t,search:TH(r),hash:$H(s)}}function EH(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function G0(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` 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 OH(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function SN(e,t){let n=OH(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function NN(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Qu(e):(s=eh({},e),Pn(!s.pathname||!s.pathname.includes("?"),G0("?","pathname","search",s)),Pn(!s.pathname||!s.pathname.includes("#"),G0("#","pathname","hash",s)),Pn(!s.search||!s.search.includes("#"),G0("#","search","hash",s)));let i=e===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=AH(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const xo=e=>e.join("/").replace(/\/\/+/g,"/"),kH=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),TH=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,$H=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function IH(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const yR=["post","put","patch","delete"];new Set(yR);const MH=["get",...yR];new Set(MH);/** - * 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 th(){return th=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=NN(u,JSON.parse(o),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:xo([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,i,e])}function wR(){let{matches:e}=v.useContext(ka),t=e[e.length-1];return t?t.params:{}}function jR(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=v.useContext(zo),{matches:s}=v.useContext(ka),{pathname:i}=ci(),o=JSON.stringify(SN(s,r.v7_relativeSplatPath));return v.useMemo(()=>NN(e,JSON.parse(o),i,n==="path"),[e,o,i,n])}function FH(e,t){return BH(e,t)}function BH(e,t,n,r){Ju()||Pn(!1);let{navigator:s}=v.useContext(zo),{matches:i}=v.useContext(ka),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=ci(),d;if(t){var f;let x=typeof t=="string"?Qu(t):t;c==="/"||(f=x.pathname)!=null&&f.startsWith(c)||Pn(!1),d=x}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let x=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(x.length).join("/")}let g=pH(e,{pathname:p}),m=HH(g&&g.map(x=>Object.assign({},x,{params:Object.assign({},l,x.params),pathname:xo([c,s.encodeLocation?s.encodeLocation(x.pathname).pathname:x.pathname]),pathnameBase:x.pathnameBase==="/"?c:xo([c,s.encodeLocation?s.encodeLocation(x.pathnameBase).pathname:x.pathnameBase])})),i,n,r);return t&&m?v.createElement(Hy.Provider,{value:{location:th({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:oo.Pop}},m):m}function zH(){let e=XH(),t=IH(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:s},n):null,null)}const UH=v.createElement(zH,null);class VH extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?v.createElement(ka.Provider,{value:this.props.routeContext},v.createElement(xR.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function WH(e){let{routeContext:t,match:n,children:r}=e,s=v.useContext(_N);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(ka.Provider,{value:t},r)}function HH(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||Pn(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,g=!1,m=null,x=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||UH,c&&(u<0&&h===0?(g=!0,x=null):u===h&&(g=!0,x=f.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,h+1)),y=()=>{let w;return p?w=m:g?w=x:f.route.Component?w=v.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,v.createElement(WH,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?v.createElement(VH,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:y(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):y()},null)}var SR=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(SR||{}),$g=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}($g||{});function GH(e){let t=v.useContext(_N);return t||Pn(!1),t}function qH(e){let t=v.useContext(RH);return t||Pn(!1),t}function KH(e){let t=v.useContext(ka);return t||Pn(!1),t}function NR(e){let t=KH(),n=t.matches[t.matches.length-1];return n.route.id||Pn(!1),n.route.id}function XH(){var e;let t=v.useContext(xR),n=qH($g.UseRouteError),r=NR($g.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function YH(){let{router:e}=GH(SR.UseNavigateStable),t=NR($g.UseNavigateStable),n=v.useRef(!1);return bR(()=>{n.current=!0}),v.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,th({fromRouteId:t},i)))},[e,t])}function _R(e){let{to:t,replace:n,state:r,relative:s}=e;Ju()||Pn(!1);let{future:i,static:o}=v.useContext(zo),{matches:l}=v.useContext(ka),{pathname:c}=ci(),u=Rn(),d=NN(t,SN(l,i.v7_relativeSplatPath),c,s==="path"),f=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:s}),[u,f,s,n,r]),null}function Ls(e){Pn(!1)}function ZH(e){let{basename:t="/",children:n=null,location:r,navigationType:s=oo.Pop,navigator:i,static:o=!1,future:l}=e;Ju()&&Pn(!1);let c=t.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:c,navigator:i,static:o,future:th({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=Qu(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:g="default"}=r,m=v.useMemo(()=>{let x=jN(d,c);return x==null?null:{location:{pathname:x,search:f,hash:h,state:p,key:g},navigationType:s}},[c,d,f,h,p,g,s]);return m==null?null:v.createElement(zo.Provider,{value:u},v.createElement(Hy.Provider,{children:n,value:m}))}function QH(e){let{children:t,location:n}=e;return FH(Hw(t),n)}new Promise(()=>{});function Hw(e,t){t===void 0&&(t=[]);let n=[];return v.Children.forEach(e,(r,s)=>{if(!v.isValidElement(r))return;let i=[...t,s];if(r.type===v.Fragment){n.push.apply(n,Hw(r.props.children,i));return}r.type!==Ls&&Pn(!1),!r.props.index||!r.props.children||Pn(!1);let o={id:r.props.id||i.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&&(o.children=Hw(r.props.children,i)),n.push(o)}),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 Gw(){return Gw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function eG(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function tG(e,t){return e.button===0&&(!t||t==="_self")&&!eG(e)}const nG=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],rG="6";try{window.__reactRouterVersion=rG}catch{}const sG="startTransition",LA=w$[sG];function iG(e){let{basename:t,children:n,future:r,window:s}=e,i=v.useRef();i.current==null&&(i.current=dH({window:s,v5Compat:!0}));let o=i.current,[l,c]=v.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=v.useCallback(f=>{u&&LA?LA(()=>c(f)):c(f)},[c,u]);return v.useLayoutEffect(()=>o.listen(d),[o,d]),v.createElement(ZH,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const aG=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",oG=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,js=v.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,h=JH(t,nG),{basename:p}=v.useContext(zo),g,m=!1;if(typeof u=="string"&&oG.test(u)&&(g=u,aG))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),S=jN(j.pathname,p);j.origin===w.origin&&S!=null?u=S+j.search+j.hash:m=!0}catch{}let x=DH(u,{relative:s}),b=lG(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:f});function y(w){r&&r(w),w.defaultPrevented||b(w)}return v.createElement("a",Gw({},h,{href:g||x,onClick:m||i?r:y,ref:n,target:c}))});var FA;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(FA||(FA={}));var BA;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(BA||(BA={}));function lG(e,t){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=t===void 0?{}:t,c=Rn(),u=ci(),d=jR(e,{relative:o});return v.useCallback(f=>{if(tG(f,n)){f.preventDefault();let h=r!==void 0?r:Tg(u)===Tg(d);c(e,{replace:h,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[u,c,d,r,s,n,e,i,o,l])}/** - * @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 cG=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),PR=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===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 uG={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 dG=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>v.createElement("svg",{ref:c,...uG,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:PR("lucide",s),...l},[...o.map(([u,d])=>v.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** - * @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 Le=(e,t)=>{const n=v.forwardRef(({className:r,...s},i)=>v.createElement(dG,{ref:i,iconNode:t,className:PR(`lucide-${cG(e)}`,r),...s}));return n.displayName=`${e}`,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 Qi=Le("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 zA=Le("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 nh=Le("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 q0=Le("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 bo=Le("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 ja=Le("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 UA=Le("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 fG=Le("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 hG=Le("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 qw=Le("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 pG=Le("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 Sa=Le("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 Ta=Le("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 vi=Le("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 wp=Le("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 mG=Le("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 Ig=Le("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 rf=Le("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 Kw=Le("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 gG=Le("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 vG=Le("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 bf=Le("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 yG=Le("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 rh=Le("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 CR=Le("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 VA=Le("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 ed=Le("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 Xw=Le("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 xG=Le("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 Yw=Le("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 PN=Le("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 AR=Le("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 Ws=Le("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 bG=Le("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 WA=Le("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 Mg=Le("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 Zw=Le("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 ER=Le("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 wG=Le("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 jG=Le("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 Qw=Le("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 SG=Le("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 Rl=Le("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 mm=Le("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 Dl=Le("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 NG=Le("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 HA=Le("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 GA=Le("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 OR=Le("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 _G=Le("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 vs=Le("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=Le("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 PG=Le("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 qA=Le("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 KA=Le("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 CG=Le("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 AG=Le("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 pr=Le("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 EG=Le("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 zc=Le("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 CN=Le("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 AN=Le("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 EN=Le("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 OG=Le("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 kG=Le("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 TG=Le("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 $G=Le("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 IG=Le("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 Rg=Le("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 MG=Le("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 ON=Le("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 wn=Le("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 RG=Le("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 DG=Le("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 kR=Le("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 Dg=Le("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 er=Le("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 LG=Le("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 Ei=Le("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 kN=Le("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 TR(e,t){return function(){return e.apply(t,arguments)}}const{toString:FG}=Object.prototype,{getPrototypeOf:TN}=Object,{iterator:Gy,toStringTag:$R}=Symbol,qy=(e=>t=>{const n=FG.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),ui=e=>(e=e.toLowerCase(),t=>qy(t)===e),Ky=e=>t=>typeof t===e,{isArray:td}=Array,sh=Ky("undefined");function BG(e){return e!==null&&!sh(e)&&e.constructor!==null&&!sh(e.constructor)&&Gr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const IR=ui("ArrayBuffer");function zG(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&IR(e.buffer),t}const UG=Ky("string"),Gr=Ky("function"),MR=Ky("number"),Xy=e=>e!==null&&typeof e=="object",VG=e=>e===!0||e===!1,Xm=e=>{if(qy(e)!=="object")return!1;const t=TN(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!($R in e)&&!(Gy in e)},WG=ui("Date"),HG=ui("File"),GG=ui("Blob"),qG=ui("FileList"),KG=e=>Xy(e)&&Gr(e.pipe),XG=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Gr(e.append)&&((t=qy(e))==="formdata"||t==="object"&&Gr(e.toString)&&e.toString()==="[object FormData]"))},YG=ui("URLSearchParams"),[ZG,QG,JG,eq]=["ReadableStream","Request","Response","Headers"].map(ui),tq=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jp(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),td(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const dl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,DR=e=>!sh(e)&&e!==dl;function Jw(){const{caseless:e}=DR(this)&&this||{},t={},n=(r,s)=>{const i=e&&RR(t,s)||s;Xm(t[i])&&Xm(r)?t[i]=Jw(t[i],r):Xm(r)?t[i]=Jw({},r):td(r)?t[i]=r.slice():t[i]=r};for(let r=0,s=arguments.length;r(jp(t,(s,i)=>{n&&Gr(s)?e[i]=TR(s,n):e[i]=s},{allOwnKeys:r}),e),rq=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),sq=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},iq=(e,t,n,r)=>{let s,i,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&TN(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},aq=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},oq=e=>{if(!e)return null;if(td(e))return e;let t=e.length;if(!MR(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},lq=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&TN(Uint8Array)),cq=(e,t)=>{const r=(e&&e[Gy]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},uq=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},dq=ui("HTMLFormElement"),fq=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),XA=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),hq=ui("RegExp"),LR=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};jp(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},pq=e=>{LR(e,(t,n)=>{if(Gr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Gr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},mq=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return td(e)?r(e):r(String(e).split(t)),n},gq=()=>{},vq=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function yq(e){return!!(e&&Gr(e.append)&&e[$R]==="FormData"&&e[Gy])}const xq=e=>{const t=new Array(10),n=(r,s)=>{if(Xy(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const i=td(r)?[]:{};return jp(r,(o,l)=>{const c=n(o,s+1);!sh(c)&&(i[l]=c)}),t[s]=void 0,i}}return r};return n(e,0)},bq=ui("AsyncFunction"),wq=e=>e&&(Xy(e)||Gr(e))&&Gr(e.then)&&Gr(e.catch),FR=((e,t)=>e?setImmediate:t?((n,r)=>(dl.addEventListener("message",({source:s,data:i})=>{s===dl&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),dl.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Gr(dl.postMessage)),jq=typeof queueMicrotask<"u"?queueMicrotask.bind(dl):typeof process<"u"&&process.nextTick||FR,Sq=e=>e!=null&&Gr(e[Gy]),ae={isArray:td,isArrayBuffer:IR,isBuffer:BG,isFormData:XG,isArrayBufferView:zG,isString:UG,isNumber:MR,isBoolean:VG,isObject:Xy,isPlainObject:Xm,isReadableStream:ZG,isRequest:QG,isResponse:JG,isHeaders:eq,isUndefined:sh,isDate:WG,isFile:HG,isBlob:GG,isRegExp:hq,isFunction:Gr,isStream:KG,isURLSearchParams:YG,isTypedArray:lq,isFileList:qG,forEach:jp,merge:Jw,extend:nq,trim:tq,stripBOM:rq,inherits:sq,toFlatObject:iq,kindOf:qy,kindOfTest:ui,endsWith:aq,toArray:oq,forEachEntry:cq,matchAll:uq,isHTMLForm:dq,hasOwnProperty:XA,hasOwnProp:XA,reduceDescriptors:LR,freezeMethods:pq,toObjectSet:mq,toCamelCase:fq,noop:gq,toFiniteNumber:vq,findKey:RR,global:dl,isContextDefined:DR,isSpecCompliantForm:yq,toJSONObject:xq,isAsyncFn:bq,isThenable:wq,setImmediate:FR,asap:jq,isIterable:Sq};function xt(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}ae.inherits(xt,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:ae.toJSONObject(this.config),code:this.code,status:this.status}}});const BR=xt.prototype,zR={};["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(e=>{zR[e]={value:e}});Object.defineProperties(xt,zR);Object.defineProperty(BR,"isAxiosError",{value:!0});xt.from=(e,t,n,r,s,i)=>{const o=Object.create(BR);return ae.toFlatObject(e,o,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),xt.call(o,e.message,t,n,r,s),o.cause=e,o.name=e.name,i&&Object.assign(o,i),o};const Nq=null;function e1(e){return ae.isPlainObject(e)||ae.isArray(e)}function UR(e){return ae.endsWith(e,"[]")?e.slice(0,-2):e}function YA(e,t,n){return e?e.concat(t).map(function(s,i){return s=UR(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function _q(e){return ae.isArray(e)&&!e.some(e1)}const Pq=ae.toFlatObject(ae,{},null,function(t){return/^is[A-Z]/.test(t)});function Yy(e,t,n){if(!ae.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ae.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,x){return!ae.isUndefined(x[m])});const r=n.metaTokens,s=n.visitor||d,i=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ae.isSpecCompliantForm(t);if(!ae.isFunction(s))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(ae.isDate(g))return g.toISOString();if(!c&&ae.isBlob(g))throw new xt("Blob is not supported. Use a Buffer instead.");return ae.isArrayBuffer(g)||ae.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,x){let b=g;if(g&&!x&&typeof g=="object"){if(ae.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(ae.isArray(g)&&_q(g)||(ae.isFileList(g)||ae.endsWith(m,"[]"))&&(b=ae.toArray(g)))return m=UR(m),b.forEach(function(w,j){!(ae.isUndefined(w)||w===null)&&t.append(o===!0?YA([m],j,i):o===null?m:m+"[]",u(w))}),!1}return e1(g)?!0:(t.append(YA(x,m,i),u(g)),!1)}const f=[],h=Object.assign(Pq,{defaultVisitor:d,convertValue:u,isVisitable:e1});function p(g,m){if(!ae.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(g),ae.forEach(g,function(b,y){(!(ae.isUndefined(b)||b===null)&&s.call(t,b,ae.isString(y)?y.trim():y,m,h))===!0&&p(b,m?m.concat(y):[y])}),f.pop()}}if(!ae.isObject(e))throw new TypeError("data must be an object");return p(e),t}function ZA(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function $N(e,t){this._pairs=[],e&&Yy(e,this,t)}const VR=$N.prototype;VR.append=function(t,n){this._pairs.push([t,n])};VR.toString=function(t){const n=t?function(r){return t.call(this,r,ZA)}:ZA;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function Cq(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function WR(e,t,n){if(!t)return e;const r=n&&n.encode||Cq;ae.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=ae.isURLSearchParams(t)?t.toString():new $N(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class QA{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ae.forEach(this.handlers,function(r){r!==null&&t(r)})}}const HR={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Aq=typeof URLSearchParams<"u"?URLSearchParams:$N,Eq=typeof FormData<"u"?FormData:null,Oq=typeof Blob<"u"?Blob:null,kq={isBrowser:!0,classes:{URLSearchParams:Aq,FormData:Eq,Blob:Oq},protocols:["http","https","file","blob","url","data"]},IN=typeof window<"u"&&typeof document<"u",t1=typeof navigator=="object"&&navigator||void 0,Tq=IN&&(!t1||["ReactNative","NativeScript","NS"].indexOf(t1.product)<0),$q=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Iq=IN&&window.location.href||"http://localhost",Mq=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:IN,hasStandardBrowserEnv:Tq,hasStandardBrowserWebWorkerEnv:$q,navigator:t1,origin:Iq},Symbol.toStringTag,{value:"Module"})),yr={...Mq,...kq};function Rq(e,t){return Yy(e,new yr.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,i){return yr.isNode&&ae.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}function Dq(e){return ae.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Lq(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r=n.length;return o=!o&&ae.isArray(s)?s.length:o,c?(ae.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!ae.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&ae.isArray(s[o])&&(s[o]=Lq(s[o])),!l)}if(ae.isFormData(e)&&ae.isFunction(e.entries)){const n={};return ae.forEachEntry(e,(r,s)=>{t(Dq(r),s,n,0)}),n}return null}function Fq(e,t,n){if(ae.isString(e))try{return(t||JSON.parse)(e),ae.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(e)}const Sp={transitional:HR,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=ae.isObject(t);if(i&&ae.isHTMLForm(t)&&(t=new FormData(t)),ae.isFormData(t))return s?JSON.stringify(GR(t)):t;if(ae.isArrayBuffer(t)||ae.isBuffer(t)||ae.isStream(t)||ae.isFile(t)||ae.isBlob(t)||ae.isReadableStream(t))return t;if(ae.isArrayBufferView(t))return t.buffer;if(ae.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Rq(t,this.formSerializer).toString();if((l=ae.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Yy(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),Fq(t)):t}],transformResponse:[function(t){const n=this.transitional||Sp.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(ae.isResponse(t)||ae.isReadableStream(t))return t;if(t&&ae.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(l){if(o)throw l.name==="SyntaxError"?xt.from(l,xt.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:yr.classes.FormData,Blob:yr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],e=>{Sp.headers[e]={}});const Bq=ae.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"]),zq=e=>{const t={};let n,r,s;return e&&e.split(` -`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&Bq[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},JA=Symbol("internals");function Dd(e){return e&&String(e).trim().toLowerCase()}function Ym(e){return e===!1||e==null?e:ae.isArray(e)?e.map(Ym):String(e)}function Uq(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const Vq=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function K0(e,t,n,r,s){if(ae.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!ae.isString(t)){if(ae.isString(r))return t.indexOf(r)!==-1;if(ae.isRegExp(r))return r.test(t)}}function Wq(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Hq(e,t){const n=ae.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}class qr{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(l,c,u){const d=Dd(c);if(!d)throw new Error("header name must be a non-empty string");const f=ae.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=Ym(l))}const o=(l,c)=>ae.forEach(l,(u,d)=>i(u,d,c));if(ae.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(ae.isString(t)&&(t=t.trim())&&!Vq(t))o(zq(t),n);else if(ae.isObject(t)&&ae.isIterable(t)){let l={},c,u;for(const d of t){if(!ae.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(c=l[u])?ae.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}o(l,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Dd(t),t){const r=ae.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return Uq(s);if(ae.isFunction(n))return n.call(this,s,r);if(ae.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Dd(t),t){const r=ae.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||K0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Dd(o),o){const l=ae.findKey(r,o);l&&(!n||K0(r,r[l],l,n))&&(delete r[l],s=!0)}}return ae.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||K0(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return ae.forEach(this,(s,i)=>{const o=ae.findKey(r,i);if(o){n[o]=Ym(s),delete n[i];return}const l=t?Wq(i):String(i).trim();l!==i&&delete n[i],n[l]=Ym(s),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ae.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&ae.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[JA]=this[JA]={accessors:{}}).accessors,s=this.prototype;function i(o){const l=Dd(o);r[l]||(Hq(s,o),r[l]=!0)}return ae.isArray(t)?t.forEach(i):i(t),this}}qr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ae.reduceDescriptors(qr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});ae.freezeMethods(qr);function X0(e,t){const n=this||Sp,r=t||n,s=qr.from(r.headers);let i=r.data;return ae.forEach(e,function(l){i=l.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function qR(e){return!!(e&&e.__CANCEL__)}function nd(e,t,n){xt.call(this,e??"canceled",xt.ERR_CANCELED,t,n),this.name="CanceledError"}ae.inherits(nd,xt,{__CANCEL__:!0});function KR(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new xt("Request failed with status code "+n.status,[xt.ERR_BAD_REQUEST,xt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function Gq(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function qq(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[i];o||(o=u),n[s]=c,r[s]=u;let f=i,h=0;for(;f!==s;)h+=n[f++],f=f%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),u-o{n=d,s=null,i&&(clearTimeout(i),i=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(s=u,i||(i=setTimeout(()=>{i=null,o(s)},r-f)))},()=>s&&o(s)]}const Lg=(e,t,n=3)=>{let r=0;const s=qq(50,250);return Kq(i=>{const o=i.loaded,l=i.lengthComputable?i.total:void 0,c=o-r,u=s(c),d=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-o)/u:void 0,event:i,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},eE=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},tE=e=>(...t)=>ae.asap(()=>e(...t)),Xq=yr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,yr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(yr.origin),yr.navigator&&/(msie|trident)/i.test(yr.navigator.userAgent)):()=>!0,Yq=yr.hasStandardBrowserEnv?{write(e,t,n,r,s,i){const o=[e+"="+encodeURIComponent(t)];ae.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),ae.isString(r)&&o.push("path="+r),ae.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Zq(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qq(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function XR(e,t,n){let r=!Zq(t);return e&&(r||n==!1)?Qq(e,t):t}const nE=e=>e instanceof qr?{...e}:e;function Ll(e,t){t=t||{};const n={};function r(u,d,f,h){return ae.isPlainObject(u)&&ae.isPlainObject(d)?ae.merge.call({caseless:h},u,d):ae.isPlainObject(d)?ae.merge({},d):ae.isArray(d)?d.slice():d}function s(u,d,f,h){if(ae.isUndefined(d)){if(!ae.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function i(u,d){if(!ae.isUndefined(d))return r(void 0,d)}function o(u,d){if(ae.isUndefined(d)){if(!ae.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>s(nE(u),nE(d),f,!0)};return ae.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||s,h=f(e[d],t[d],d);ae.isUndefined(h)&&f!==l||(n[d]=h)}),n}const YR=e=>{const t=Ll({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:l}=t;t.headers=o=qr.from(o),t.url=WR(XR(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(ae.isFormData(n)){if(yr.hasStandardBrowserEnv||yr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...d].join("; "))}}if(yr.hasStandardBrowserEnv&&(r&&ae.isFunction(r)&&(r=r(t)),r||r!==!1&&Xq(t.url))){const u=s&&i&&Yq.read(i);u&&o.set(s,u)}return t},Jq=typeof XMLHttpRequest<"u",eK=Jq&&function(e){return new Promise(function(n,r){const s=YR(e);let i=s.data;const o=qr.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=s,d,f,h,p,g;function m(){p&&p(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let x=new XMLHttpRequest;x.open(s.method.toUpperCase(),s.url,!0),x.timeout=s.timeout;function b(){if(!x)return;const w=qr.from("getAllResponseHeaders"in x&&x.getAllResponseHeaders()),S={data:!l||l==="text"||l==="json"?x.responseText:x.response,status:x.status,statusText:x.statusText,headers:w,config:e,request:x};KR(function(P){n(P),m()},function(P){r(P),m()},S),x=null}"onloadend"in x?x.onloadend=b:x.onreadystatechange=function(){!x||x.readyState!==4||x.status===0&&!(x.responseURL&&x.responseURL.indexOf("file:")===0)||setTimeout(b)},x.onabort=function(){x&&(r(new xt("Request aborted",xt.ECONNABORTED,e,x)),x=null)},x.onerror=function(){r(new xt("Network Error",xt.ERR_NETWORK,e,x)),x=null},x.ontimeout=function(){let j=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||HR;s.timeoutErrorMessage&&(j=s.timeoutErrorMessage),r(new xt(j,S.clarifyTimeoutError?xt.ETIMEDOUT:xt.ECONNABORTED,e,x)),x=null},i===void 0&&o.setContentType(null),"setRequestHeader"in x&&ae.forEach(o.toJSON(),function(j,S){x.setRequestHeader(S,j)}),ae.isUndefined(s.withCredentials)||(x.withCredentials=!!s.withCredentials),l&&l!=="json"&&(x.responseType=s.responseType),u&&([h,g]=Lg(u,!0),x.addEventListener("progress",h)),c&&x.upload&&([f,p]=Lg(c),x.upload.addEventListener("progress",f),x.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(d=w=>{x&&(r(!w||w.type?new nd(null,e,x):w),x.abort(),x=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const y=Gq(s.url);if(y&&yr.protocols.indexOf(y)===-1){r(new xt("Unsupported protocol "+y+":",xt.ERR_BAD_REQUEST,e));return}x.send(i||null)})},tK=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(u){if(!s){s=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof xt?d:new nd(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,i(new xt(`timeout ${t} of ms exceeded`,xt.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(i):u.removeEventListener("abort",i)}),e=null)};e.forEach(u=>u.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>ae.asap(l),c}},nK=function*(e,t){let n=e.byteLength;if(n{const s=rK(e,t);let i=0,o,l=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let h=i+=f;n(h)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},Zy=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",ZR=Zy&&typeof ReadableStream=="function",iK=Zy&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),QR=(e,...t)=>{try{return!!e(...t)}catch{return!1}},aK=ZR&&QR(()=>{let e=!1;const t=new Request(yr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),sE=64*1024,n1=ZR&&QR(()=>ae.isReadableStream(new Response("").body)),Fg={stream:n1&&(e=>e.body)};Zy&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Fg[t]&&(Fg[t]=ae.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new xt(`Response type '${t}' is not supported`,xt.ERR_NOT_SUPPORT,r)})})})(new Response);const oK=async e=>{if(e==null)return 0;if(ae.isBlob(e))return e.size;if(ae.isSpecCompliantForm(e))return(await new Request(yr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ae.isArrayBufferView(e)||ae.isArrayBuffer(e))return e.byteLength;if(ae.isURLSearchParams(e)&&(e=e+""),ae.isString(e))return(await iK(e)).byteLength},lK=async(e,t)=>{const n=ae.toFiniteNumber(e.getContentLength());return n??oK(t)},cK=Zy&&(async e=>{let{url:t,method:n,data:r,signal:s,cancelToken:i,timeout:o,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=YR(e);u=u?(u+"").toLowerCase():"text";let p=tK([s,i&&i.toAbortSignal()],o),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let x;try{if(c&&aK&&n!=="get"&&n!=="head"&&(x=await lK(d,r))!==0){let S=new Request(t,{method:"POST",body:r,duplex:"half"}),N;if(ae.isFormData(r)&&(N=S.headers.get("content-type"))&&d.setContentType(N),S.body){const[P,_]=eE(x,Lg(tE(c)));r=rE(S.body,sE,P,_)}}ae.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(t,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let y=await fetch(g);const w=n1&&(u==="stream"||u==="response");if(n1&&(l||w&&m)){const S={};["status","statusText","headers"].forEach(A=>{S[A]=y[A]});const N=ae.toFiniteNumber(y.headers.get("content-length")),[P,_]=l&&eE(N,Lg(tE(l),!0))||[];y=new Response(rE(y.body,sE,P,()=>{_&&_(),m&&m()}),S)}u=u||"text";let j=await Fg[ae.findKey(Fg,u)||"text"](y,e);return!w&&m&&m(),await new Promise((S,N)=>{KR(S,N,{data:j,headers:qr.from(y.headers),status:y.status,statusText:y.statusText,config:e,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new xt("Network Error",xt.ERR_NETWORK,e,g),{cause:b.cause||b}):xt.from(b,b&&b.code,e,g)}}),r1={http:Nq,xhr:eK,fetch:cK};ae.forEach(r1,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const iE=e=>`- ${e}`,uK=e=>ae.isFunction(e)||e===null||e===!1,JR={getAdapter:e=>{e=ae.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let i=0;i`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?i.length>1?`since : -`+i.map(iE).join(` -`):" "+iE(i[0]):"as no adapter specified";throw new xt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:r1};function Y0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nd(null,e)}function aE(e){return Y0(e),e.headers=qr.from(e.headers),e.data=X0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),JR.getAdapter(e.adapter||Sp.adapter)(e).then(function(r){return Y0(e),r.data=X0.call(e,e.transformResponse,r),r.headers=qr.from(r.headers),r},function(r){return qR(r)||(Y0(e),r&&r.response&&(r.response.data=X0.call(e,e.transformResponse,r.response),r.response.headers=qr.from(r.response.headers))),Promise.reject(r)})}const eD="1.9.0",Qy={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Qy[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const oE={};Qy.transitional=function(t,n,r){function s(i,o){return"[Axios v"+eD+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,l)=>{if(t===!1)throw new xt(s(o," has been removed"+(n?" in "+n:"")),xt.ERR_DEPRECATED);return n&&!oE[o]&&(oE[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,l):!0}};Qy.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function dK(e,t,n){if(typeof e!="object")throw new xt("options must be an object",xt.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const l=e[i],c=l===void 0||o(l,i,e);if(c!==!0)throw new xt("option "+i+" must be "+c,xt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new xt("Unknown option "+i,xt.ERR_BAD_OPTION)}}const Zm={assertOptions:dK,validators:Qy},mi=Zm.validators;class _l{constructor(t){this.defaults=t||{},this.interceptors={request:new QA,response:new QA}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ll(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Zm.assertOptions(r,{silentJSONParsing:mi.transitional(mi.boolean),forcedJSONParsing:mi.transitional(mi.boolean),clarifyTimeoutError:mi.transitional(mi.boolean)},!1),s!=null&&(ae.isFunction(s)?n.paramsSerializer={serialize:s}:Zm.assertOptions(s,{encode:mi.function,serialize:mi.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Zm.assertOptions(n,{baseUrl:mi.spelling("baseURL"),withXsrfToken:mi.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&ae.merge(i.common,i[n.method]);i&&ae.forEach(["delete","get","head","post","put","patch","common"],g=>{delete i[g]}),n.headers=qr.concat(o,i);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.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(!c){const g=[aE.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),h=g.length,d=Promise.resolve(n);f{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(l=>{r.subscribe(l),i=l}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,l){r.reason||(r.reason=new nd(i,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new MN(function(s){t=s}),cancel:t}}}function fK(e){return function(n){return e.apply(null,n)}}function hK(e){return ae.isObject(e)&&e.isAxiosError===!0}const s1={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(s1).forEach(([e,t])=>{s1[t]=e});function tD(e){const t=new _l(e),n=TR(_l.prototype.request,t);return ae.extend(n,_l.prototype,t,{allOwnKeys:!0}),ae.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return tD(Ll(e,s))},n}const Mn=tD(Sp);Mn.Axios=_l;Mn.CanceledError=nd;Mn.CancelToken=MN;Mn.isCancel=qR;Mn.VERSION=eD;Mn.toFormData=Yy;Mn.AxiosError=xt;Mn.Cancel=Mn.CanceledError;Mn.all=function(t){return Promise.all(t)};Mn.spread=fK;Mn.isAxiosError=hK;Mn.mergeConfig=Ll;Mn.AxiosHeaders=qr;Mn.formToJSON=e=>GR(ae.isHTMLForm(e)?new FormData(e):e);Mn.getAdapter=JR.getAdapter;Mn.HttpStatusCode=s1;Mn.default=Mn;const nD="https://ai-sandbox.oliver.solutions/semblance_back/api",qe=Mn.create({baseURL:nD,headers:{"Content-Type":"application/json"},timeout:6e5});qe.interceptors.request.use(e=>{var n;const t=localStorage.getItem("auth_token");return t&&(e.headers.Authorization=`Bearer ${t}`),e.method==="put"&&((n=e.url)!=null&&n.includes("/focus-groups/"))&&console.log("🌐 API Request:",{method:e.method,url:e.url,baseURL:e.baseURL,fullURL:`${e.baseURL}${e.url}`,data:e.data}),e},e=>Promise.reject(e));const i1="auth_error",pK=e=>{e!=null&&e.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const t=new CustomEvent(i1,{detail:e||{}});window.dispatchEvent(t)};qe.interceptors.response.use(e=>e,e=>{var t,n,r,s,i,o;if(e.response&&e.response.status===401){const l=e.config&&(((t=e.config.url)==null?void 0:t.includes("/personas"))||((n=e.config.url)==null?void 0:n.includes("/personas/batch"))||e.config.method&&((r=e.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(s=e.config)==null?void 0:s.url,method:(i=e.config)==null?void 0:i.method,isPersonaRequest:l}),l?console.warn("Authentication error in persona request, letting component handle it"):pK({source:(o=e.config)==null?void 0:o.url,isPersonaCreation:!1})}return Promise.reject(e)});const a1={login:(e,t)=>qe.post("/auth/login",{username:e,password:t}),register:(e,t,n)=>qe.post("/auth/register",{username:e,email:t,password:n}),getProfile:()=>qe.get("/auth/me")},$n={getAll:()=>qe.get("/personas/all"),getById:e=>qe.get(`/personas/${e}`),create:e=>qe.post("/personas",e),update:(e,t)=>e&&e.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",e),qe.post("/personas",t)):qe.put(`/personas/${e}`,t),delete:e=>{const t=typeof e=="object"&&e!==null&&e._id||e;return console.log(`Deleting persona with ID: ${t}`),qe.delete(`/personas/${t}`)},createBatch:e=>qe.post("/personas/batch",e)},Xi={generate:e=>qe.post("/ai-personas/generate",e||{},{timeout:6e5}),generateAndSave:e=>qe.post("/ai-personas/generate-and-save",e||{},{timeout:6e5}),batchGenerate:e=>qe.post("/ai-personas/batch-generate",e,{timeout:6e5}),batchGenerateAndSave:e=>qe.post("/ai-personas/batch-generate-and-save",e,{timeout:6e5}),generateBasicProfiles:(e,t=5,n=.8)=>qe.post("/ai-personas/generate-basic-profiles",{audience_brief:e,count:t,temperature:n},{timeout:6e5}),completePersona:(e,t=.7)=>qe.post("/ai-personas/complete-persona",{basic_profile:e,temperature:t},{timeout:6e5}),completeAndSavePersona:(e,t=.7)=>qe.post("/ai-personas/complete-and-save-persona",{basic_profile:e,temperature:t},{timeout:6e5}),generatePersonaSummary:(e,t=.7)=>qe.post("/ai-personas/generate-persona-summary",{persona_data:e,temperature:t},{timeout:6e5}),batchGenerateWithStages:async(e,t,n=5,r=.7,s,i)=>{var o;try{console.log(`📡 API call to generate-basic-profiles with model: ${i||"gemini-2.5-pro"}`);const c=(await qe.post("/ai-personas/generate-basic-profiles",{audience_brief:e,research_objective:t,count:n,temperature:.7,customer_data_session_id:s,llm_model:i||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`📡 API call to complete-and-save-persona with model: ${i||"gemini-2.5-pro"}`);const h=c.map(g=>qe.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:s,llm_model:i||"gemini-2.5-pro"},{timeout:6e5}));if((await Promise.allSettled(h)).forEach((g,m)=>{if(g.status==="fulfilled")u.push(g.value.data.persona),d.push(g.value.data.persona_id);else{const x=c[m],b={index:m,name:x.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${x.name||"unnamed"}):`,g.reason)}}),u.length===0&&f.length>0)throw new Error(`Failed to generate any personas. ${f.length} profile(s) failed.`);return{data:{message:`Generated and saved ${u.length} personas${f.length>0?` (${f.length} failed)`:""}`,personas:u,persona_ids:d,errors:f.length>0?f:void 0,partial_success:f.length>0&&u.length>0}}}catch(l){throw((o=l.response)==null?void 0:o.status)===504||l.code==="ECONNABORTED"?new Error("Timeout error: The server took too long to generate personas. Please try with fewer personas or try again later."):l}},enhanceAudienceBrief:(e,t,n=.7)=>qe.post("/ai-personas/enhance-audience-brief",{audience_brief:e,research_objective:t,temperature:n},{timeout:6e5}),batchGenerateSummaries:(e,t=.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:e,temperature:t,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:e=>{const t=new FormData;for(let n=0;nqe.delete(`/ai-personas/cleanup-customer-data/${e}`)},Ct={getAll:()=>qe.get("/focus-groups"),getById:e=>qe.get(`/focus-groups/${e}`),create:e=>qe.post("/focus-groups",e),update:(e,t)=>qe.put(`/focus-groups/${e}`,t),delete:e=>qe.delete(`/focus-groups/${e}`),addParticipant:(e,t)=>qe.post(`/focus-groups/${e}/participants`,{persona_id:t}),removeParticipant:(e,t)=>qe.delete(`/focus-groups/${e}/participants/${t}`),sendMessage:(e,t)=>qe.post(`/focus-groups/${e}/messages`,t),getMessages:e=>qe.get(`/focus-groups/${e}/messages`),updateMessageHighlight:(e,t,n)=>qe.patch(`/focus-groups/${e}/messages/${t}`,{highlighted:n}),describeAsset:(e,t)=>qe.post(`/focus-groups/${e}/describe-asset`,{asset_filename:t},{timeout:12e4}),generateDiscussionGuide:e=>qe.post("/focus-groups/generate-discussion-guide",e,{timeout:6e5}),generateDiscussionGuideForGroup:(e,t)=>qe.post(`/focus-groups/${e}/generate-discussion-guide`,t,{timeout:6e5}),downloadDiscussionGuide:async e=>{try{const t=await qe.get(`/focus-groups/${e}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=t.headers["content-disposition"];let r="discussion-guide.md";if(n){const l=n.match(/filename="([^"]+)"/);l&&(r=l[1])}const s=new Blob([t.data],{type:"text/markdown"}),i=URL.createObjectURL(s),o=document.createElement("a");return o.href=i,o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(i),{success:!0,filename:r}}catch(t){throw console.error("Error downloading discussion guide:",t),new Error("Failed to download discussion guide")}},createNote:(e,t)=>qe.post(`/focus-groups/${e}/notes`,t),getNotes:e=>qe.get(`/focus-groups/${e}/notes`),deleteNote:(e,t)=>qe.delete(`/focus-groups/${e}/notes/${t}`),uploadAssets:(e,t)=>qe.post(`/focus-groups/${e}/assets`,t,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4}),getAssets:e=>qe.get(`/focus-groups/${e}/assets`),getAssetUrl:(e,t)=>`${nD}/focus-groups/${e}/assets/${t}`,deleteAsset:(e,t)=>qe.delete(`/focus-groups/${e}/assets/${t}`)},vn={generateResponse:(e,t,n,r=.7)=>qe.post("/focus-group-ai/generate-response",{focus_group_id:e,persona_id:t,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(e,t=.7)=>qe.post("/focus-group-ai/generate-key-themes",{focus_group_id:e,temperature:t},{timeout:6e5}),getKeyThemes:e=>qe.get(`/focus-group-ai/key-themes/${e}`),deleteKeyTheme:(e,t)=>qe.delete(`/focus-group-ai/key-themes/${e}/${t}`),getModeratorStatus:e=>qe.get(`/focus-group-ai/moderator/status/${e}`),advanceModeratorDiscussion:e=>qe.post(`/focus-group-ai/moderator/advance/${e}`,{},{timeout:6e5}),setModeratorPosition:(e,t,n)=>qe.put(`/focus-group-ai/moderator/position/${e}`,{section_id:t,item_id:n}),startAutonomousConversation:(e,t)=>qe.post(`/focus-group-ai/autonomous/start/${e}`,{initial_prompt:t},{timeout:6e5}),stopAutonomousConversation:(e,t)=>qe.post(`/focus-group-ai/autonomous/stop/${e}`,{reason:t}),getAutonomousConversationStatus:e=>qe.get(`/focus-group-ai/autonomous/status/${e}`),getConversationState:e=>qe.get(`/focus-group-ai/conversation/state/${e}`),getConversationAnalytics:e=>qe.get(`/focus-group-ai/conversation/analytics/${e}`),makeConversationDecision:(e,t=.7,n="ai")=>qe.post(`/focus-group-ai/conversation/decision/${e}`,{temperature:t,mode:n},{timeout:6e5}),getConversationInsights:e=>qe.get(`/focus-group-ai/conversation/insights/${e}`,{timeout:6e5}),manualIntervention:(e,t,n,r)=>qe.post(`/focus-group-ai/conversation/intervene/${e}`,{action:t,message:n,participant_id:r}),getReasoningHistory:e=>qe.get(`/focus-group-ai/conversation/reasoning-history/${e}`),endSession:(e,t)=>qe.post(`/focus-group-ai/moderator/end-session/${e}`,{reason:t||"session_ended"})},rD=v.createContext(void 0);function mK({children:e}){const[t,n]=v.useState(null),[r,s]=v.useState(null),[i,o]=v.useState(!0),l=Rn();v.useEffect(()=>{const p=g=>{const x=g.detail||{};if(x.isPersonaCreation){console.log("Ignoring auth error from persona creation",x);return}s(null),n(null),ce.error("Session expired",{description:"Please log in again"}),l("/login")};return window.addEventListener(i1,p),()=>{window.removeEventListener(i1,p)}},[l]),v.useEffect(()=>{const p=localStorage.getItem("auth_token"),g=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!p,hasUser:!!g}),p&&g)try{s(p),n(JSON.parse(g)),console.log("User session restored from localStorage")}catch(m){console.error("Failed to parse stored user data:",m),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");o(!1)},[]),v.useEffect(()=>{if(r){console.log("Verifying token...");const p=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(p)==="true"&&t){console.log("Token already validated this session, skipping validation");return}a1.getProfile().then(m=>{m&&"data"in m&&(console.log("Profile verified successfully"),n(m.data),sessionStorage.setItem(p,"true"))}).catch(m=>{m.response&&m.response.status===401?(console.error("Token invalid (401):",m),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),s(null),n(null)):(console.warn("Profile validation error (not clearing token):",m),sessionStorage.setItem(p,"true"))})}else console.log("No token available, not validating profile")},[r,t]);const c=async(p,g)=>{var m,x;o(!0),console.log("Attempting login for user:",p);try{const b=await a1.login(p,g);if(console.log("Login API response received"),!b.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",b.data.access_token),localStorage.setItem("user",JSON.stringify(b.data.user)),s(b.data.access_token),n(b.data.user),console.log("Authentication state updated"),ce.success("Login successful!"),b.data.access_token}catch(b){throw console.error("Login failed:",b),ce.error("Login failed",{description:((x=(m=b.response)==null?void 0:m.data)==null?void 0:x.message)||"Invalid username or password"}),b}finally{o(!1)}},u=()=>{localStorage.removeItem("auth_token"),localStorage.removeItem("user"),s(null),n(null),ce.info("You have been logged out")},d=!!localStorage.getItem("auth_token"),h={user:t,token:r,isLoading:i,login:c,logout:u,isAuthenticated:!!r||d};return a.jsx(rD.Provider,{value:h,children:e})}function Zl(){const e=v.useContext(rD);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function oa(){const[e,t]=v.useState(!1),n=ci(),r=Rn(),{isAuthenticated:s,logout:i}=Zl(),o=[{name:"Home",href:"/",icon:Zw},{name:"Synthetic Personas",href:"/synthetic-users",icon:er},{name:"Focus Groups",href:"/focus-groups",icon:Na},{name:"Dashboard",href:"/dashboard",icon:Qw}],l=()=>{t(!e)},c=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(js,{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:[o.map(d=>a.jsx("li",{children:d.href==="/"?a.jsxs(js,{to:d.href,className:Me("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",c(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:Me("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",c(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:s?a.jsxs("button",{onClick:()=>{i(),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(GA,{className:"mr-1 h-4 w-4"}),"Logout"]}):a.jsxs(js,{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(HA,{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:l,children:[a.jsx("span",{className:"sr-only",children:"Open main menu"}),e?a.jsx(Ei,{className:"block h-6 w-6","aria-hidden":"true"}):a.jsx(_G,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),e&&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:[o.map(d=>a.jsx("div",{children:d.href==="/"?a.jsxs(js,{to:d.href,className:Me("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition",c(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>t(!1),children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):a.jsxs("button",{className:Me("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition w-full text-left",c(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>{t(!1),u(d.href)},children:[a.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]})},d.name)),s?a.jsxs("button",{onClick:()=>{i(),t(!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(GA,{className:"mr-3 h-5 w-5"}),"Logout"]}):a.jsxs(js,{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:()=>t(!1),children:[a.jsx(HA,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const lE=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,cE=mt,RN=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return cE(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],f=i==null?void 0:i[u];if(d===null)return null;const h=lE(d)||lE(f);return s[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,x]=g;return Array.isArray(x)?x.includes({...i,...l}[m]):{...i,...l}[m]===x})?[...u,f,h]:u},[]);return cE(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},DN=RN("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"}}),se=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const o=r?xa:"button";return a.jsx(o,{className:Me(DN({variant:t,size:n,className:e})),ref:i,...s})});se.displayName="Button";function gK(){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(js,{to:"/synthetic-users",children:a.jsxs(se,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",a.jsx(vi,{className:"ml-2 h-4 w-4"})]})}),a.jsxs(js,{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(e=>a.jsx("div",{className:`flex ${e%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 ${e%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[e===1&&"What qualities do you look for in a premium shampoo brand?",e===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",e===3&&"How important is fragrance in your shampoo selection?",e===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},e))})]})})]}),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 ac({title:e,description:t,icon:n,className:r}){return a.jsxs("div",{className:Me("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:e}),a.jsx("p",{className:"text-gray-600 text-sm",children:t})]})]})}const vK=()=>(Zl(),Rn(),a.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[a.jsx(oa,{}),a.jsx("main",{children:a.jsxs("div",{className:"pt-16",children:[a.jsx(gK,{}),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(ac,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:er}),a.jsx(ac,{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(ac,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:Qw}),a.jsx(ac,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:er}),a.jsx(ac,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:TG}),a.jsx(ac,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:Qw})]})]})}),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(js,{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(js,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),a.jsx("li",{children:a.jsx(js,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),a.jsx("li",{children:a.jsx(js,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),a.jsx("li",{children:a.jsx(js,{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."]})})]})]})})]})),yK=()=>{const e=ci(),t=Rn();v.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]);const n=e.pathname.startsWith("/synthetic-users/"),s=new URLSearchParams(e.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."}),s?a.jsx(se,{onClick:()=>t("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):a.jsx(se,{onClick:()=>t("/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(se,{variant:"outline",onClick:()=>t("/"),className:"w-full",children:"Return to Home"})]})})};function xK(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,bK(s,...t)]}function bK(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var LN="Progress",FN=100,[wK,NOe]=xK(LN),[jK,SK]=wK(LN),sD=v.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=NK,...o}=e;(s||s===0)&&!uE(s)&&console.error(_K(`${s}`,"Progress"));const l=uE(s)?s:FN;r!==null&&!dE(r,l)&&console.error(PK(`${r}`,"Progress"));const c=dE(r,l)?r:null,u=Bg(c)?i(c,l):void 0;return a.jsx(jK,{scope:n,value:c,max:l,children:a.jsx(Xe.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":Bg(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":oD(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});sD.displayName=LN;var iD="ProgressIndicator",aD=v.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,s=SK(iD,n);return a.jsx(Xe.div,{"data-state":oD(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:t})});aD.displayName=iD;function NK(e,t){return`${Math.round(e/t*100)}%`}function oD(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function Bg(e){return typeof e=="number"}function uE(e){return Bg(e)&&!isNaN(e)&&e>0}function dE(e,t){return Bg(e)&&!isNaN(e)&&e<=t&&e>=0}function _K(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${FN}\`.`}function PK(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - - a positive number - - less than the value passed to \`max\` (or ${FN} if no \`max\` prop is set) - - \`null\` or \`undefined\` if the progress is indeterminate. - -Defaulting to \`null\`.`}var lD=sD,CK=aD;const fl=v.forwardRef(({className:e,value:t,...n},r)=>a.jsx(lD,{ref:r,className:Me("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:a.jsx(CK,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));fl.displayName=lD.displayName;var Np=e=>e.type==="checkbox",hl=e=>e instanceof Date,_r=e=>e==null;const cD=e=>typeof e=="object";var Cn=e=>!_r(e)&&!Array.isArray(e)&&cD(e)&&!hl(e),uD=e=>Cn(e)&&e.target?Np(e.target)?e.target.checked:e.target.value:e,AK=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,dD=(e,t)=>e.has(AK(t)),EK=e=>{const t=e.constructor&&e.constructor.prototype;return Cn(t)&&t.hasOwnProperty("isPrototypeOf")},BN=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Dr(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(BN&&(e instanceof Blob||e instanceof FileList))&&(n||Cn(e)))if(t=n?[]:{},!n&&!EK(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Dr(e[r]));else return e;return t}var Jy=e=>Array.isArray(e)?e.filter(Boolean):[],yn=e=>e===void 0,De=(e,t,n)=>{if(!t||!Cn(e))return n;const r=Jy(t.split(/[,[\].]+?/)).reduce((s,i)=>_r(s)?s:s[i],e);return yn(r)||r===e?yn(e[t])?n:e[t]:r},ys=e=>typeof e=="boolean",zN=e=>/^\w*$/.test(e),fD=e=>Jy(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Vt=(e,t,n)=>{let r=-1;const s=zN(t)?[t]:fD(t),i=s.length,o=i-1;for(;++rC.useContext(hD),OK=e=>{const{children:t,...n}=e;return C.createElement(hD.Provider,{value:n},t)};var pD=(e,t,n,r=!0)=>{const s={defaultValues:t._defaultValues};for(const i in e)Object.defineProperty(s,i,{get:()=>{const o=i;return t._proxyFormState[o]!==qs.all&&(t._proxyFormState[o]=!r||qs.all),n&&(n[o]=!0),e[o]}});return s},Lr=e=>Cn(e)&&!Object.keys(e).length,mD=(e,t,n,r)=>{n(e);const{name:s,...i}=e;return Lr(i)||Object.keys(i).length>=Object.keys(t).length||Object.keys(i).find(o=>t[o]===(!r||qs.all))},wf=e=>Array.isArray(e)?e:[e],gD=(e,t,n)=>!e||!t||e===t||wf(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function UN(e){const t=C.useRef(e);t.current=e,C.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function kK(e){const t=ex(),{control:n=t.control,disabled:r,name:s,exact:i}=e||{},[o,l]=C.useState(n._formState),c=C.useRef(!0),u=C.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=C.useRef(s);return d.current=s,UN({disabled:r,next:f=>c.current&&gD(d.current,f.name,i)&&mD(f,u.current,n._updateFormState)&&l({...n._formState,...f}),subject:n._subjects.state}),C.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),pD(o,n,u.current,!1)}var Ni=e=>typeof e=="string",vD=(e,t,n,r,s)=>Ni(e)?(r&&t.watch.add(e),De(n,e,s)):Array.isArray(e)?e.map(i=>(r&&t.watch.add(i),De(n,i))):(r&&(t.watchAll=!0),n);function TK(e){const t=ex(),{control:n=t.control,name:r,defaultValue:s,disabled:i,exact:o}=e||{},l=C.useRef(r);l.current=r,UN({disabled:i,subject:n._subjects.values,next:d=>{gD(l.current,d.name,o)&&u(Dr(vD(l.current,n._names,d.values||n._formValues,!1,s)))}});const[c,u]=C.useState(n._getWatch(r,s));return C.useEffect(()=>n._removeUnmounted()),c}function $K(e){const t=ex(),{name:n,disabled:r,control:s=t.control,shouldUnregister:i}=e,o=dD(s._names.array,n),l=TK({control:s,name:n,defaultValue:De(s._formValues,n,De(s._defaultValues,n,e.defaultValue)),exact:!0}),c=kK({control:s,name:n,exact:!0}),u=C.useRef(s.register(n,{...e.rules,value:l,...ys(e.disabled)?{disabled:e.disabled}:{}}));return C.useEffect(()=>{const d=s._options.shouldUnregister||i,f=(h,p)=>{const g=De(s._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=Dr(De(s._options.defaultValues,n));Vt(s._defaultValues,n,h),yn(De(s._formValues,n))&&Vt(s._formValues,n,h)}return()=>{(o?d&&!s._state.action:d)?s.unregister(n):f(n,!1)}},[n,s,o,i]),C.useEffect(()=>{De(s._fields,n)&&s._updateDisabledField({disabled:r,fields:s._fields,name:n,value:De(s._fields,n)._f.value})},[r,n,s]),{field:{name:n,value:l,...ys(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:C.useCallback(d=>u.current.onChange({target:{value:uD(d),name:n},type:zg.CHANGE}),[n]),onBlur:C.useCallback(()=>u.current.onBlur({target:{value:De(s._formValues,n),name:n},type:zg.BLUR}),[n,s]),ref:C.useCallback(d=>{const f=De(s._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})},[s._fields,n])},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!De(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!De(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!De(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!De(c.validatingFields,n)},error:{enumerable:!0,get:()=>De(c.errors,n)}})}}const IK=e=>e.render($K(e));var yD=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},fE=e=>({isOnSubmit:!e||e===qs.onSubmit,isOnBlur:e===qs.onBlur,isOnChange:e===qs.onChange,isOnAll:e===qs.all,isOnTouch:e===qs.onTouched}),hE=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const jf=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const i=De(e,s);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(jf(l,t))break}else if(Cn(l)&&jf(l,t))break}}};var MK=(e,t,n)=>{const r=wf(De(e,n));return Vt(r,"root",t[n]),Vt(e,n,r),e},VN=e=>e.type==="file",na=e=>typeof e=="function",Ug=e=>{if(!BN)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Qm=e=>Ni(e),WN=e=>e.type==="radio",Vg=e=>e instanceof RegExp;const pE={value:!1,isValid:!1},mE={value:!0,isValid:!0};var xD=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!yn(e[0].attributes.value)?yn(e[0].value)||e[0].value===""?mE:{value:e[0].value,isValid:!0}:mE:pE}return pE};const gE={isValid:!1,value:null};var bD=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,gE):gE;function vE(e,t,n="validate"){if(Qm(e)||Array.isArray(e)&&e.every(Qm)||ys(e)&&!e)return{type:n,message:Qm(e)?e:"",ref:t}}var oc=e=>Cn(e)&&!Vg(e)?e:{value:e,message:""},yE=async(e,t,n,r,s)=>{const{ref:i,refs:o,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:x,disabled:b}=e._f,y=De(t,g);if(!x||b)return{};const w=o?o[0]:i,j=k=>{r&&w.reportValidity&&(w.setCustomValidity(ys(k)?"":k||""),w.reportValidity())},S={},N=WN(i),P=Np(i),_=N||P,A=(m||VN(i))&&yn(i.value)&&yn(y)||Ug(i)&&i.value===""||y===""||Array.isArray(y)&&!y.length,O=yD.bind(null,g,n,S),T=(k,M,R,H=Wi.maxLength,F=Wi.minLength)=>{const V=k?M:R;S[g]={type:k?H:F,message:V,ref:i,...O(k?H:F,V)}};if(s?!Array.isArray(y)||!y.length:l&&(!_&&(A||_r(y))||ys(y)&&!y||P&&!xD(o).isValid||N&&!bD(o).isValid)){const{value:k,message:M}=Qm(l)?{value:!!l,message:l}:oc(l);if(k&&(S[g]={type:Wi.required,message:M,ref:w,...O(Wi.required,M)},!n))return j(M),S}if(!A&&(!_r(d)||!_r(f))){let k,M;const R=oc(f),H=oc(d);if(!_r(y)&&!isNaN(y)){const F=i.valueAsNumber||y&&+y;_r(R.value)||(k=F>R.value),_r(H.value)||(M=Fnew Date(new Date().toDateString()+" "+Y),$=i.type=="time",L=i.type=="week";Ni(R.value)&&y&&(k=$?V(y)>V(R.value):L?y>R.value:F>new Date(R.value)),Ni(H.value)&&y&&(M=$?V(y)+k.value,H=!_r(M.value)&&y.length<+M.value;if((R||H)&&(T(R,k.message,M.message),!n))return j(S[g].message),S}if(h&&!A&&Ni(y)){const{value:k,message:M}=oc(h);if(Vg(k)&&!y.match(k)&&(S[g]={type:Wi.pattern,message:M,ref:i,...O(Wi.pattern,M)},!n))return j(M),S}if(p){if(na(p)){const k=await p(y,t),M=vE(k,w);if(M&&(S[g]={...M,...O(Wi.validate,M.message)},!n))return j(M.message),S}else if(Cn(p)){let k={};for(const M in p){if(!Lr(k)&&!n)break;const R=vE(await p[M](y,t),w,M);R&&(k={...R,...O(M,R.message)},j(R.message),n&&(S[g]=k))}if(!Lr(k)&&(S[g]={ref:w,...k},!n))return S}}return j(!0),S};function RK(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:s=>{for(const i of e)i.next&&i.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(i=>i!==s)}}),unsubscribe:()=>{e=[]}}},o1=e=>_r(e)||!cD(e);function Za(e,t){if(o1(e)||o1(t))return e===t;if(hl(e)&&hl(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const i=e[s];if(!r.includes(s))return!1;if(s!=="ref"){const o=t[s];if(hl(i)&&hl(o)||Cn(i)&&Cn(o)||Array.isArray(i)&&Array.isArray(o)?!Za(i,o):i!==o)return!1}}return!0}var wD=e=>e.type==="select-multiple",LK=e=>WN(e)||Np(e),Q0=e=>Ug(e)&&e.isConnected,jD=e=>{for(const t in e)if(na(e[t]))return!0;return!1};function Wg(e,t={}){const n=Array.isArray(e);if(Cn(e)||n)for(const r in e)Array.isArray(e[r])||Cn(e[r])&&!jD(e[r])?(t[r]=Array.isArray(e[r])?[]:{},Wg(e[r],t[r])):_r(e[r])||(t[r]=!0);return t}function SD(e,t,n){const r=Array.isArray(e);if(Cn(e)||r)for(const s in e)Array.isArray(e[s])||Cn(e[s])&&!jD(e[s])?yn(t)||o1(n[s])?n[s]=Array.isArray(e[s])?Wg(e[s],[]):{...Wg(e[s])}:SD(e[s],_r(t)?{}:t[s],n[s]):n[s]=!Za(e[s],t[s]);return n}var Ld=(e,t)=>SD(e,t,Wg(t)),ND=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>yn(e)?e:t?e===""?NaN:e&&+e:n&&Ni(e)?new Date(e):r?r(e):e;function J0(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return VN(t)?t.files:WN(t)?bD(e.refs).value:wD(t)?[...t.selectedOptions].map(({value:n})=>n):Np(t)?xD(e.refs).value:ND(yn(t.value)?e.ref.value:t.value,e)}var FK=(e,t,n,r)=>{const s={};for(const i of e){const o=De(t,i);o&&Vt(s,i,o._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},Fd=e=>yn(e)?e:Vg(e)?e.source:Cn(e)?Vg(e.value)?e.value.source:e.value:e;const xE="AsyncFunction";var BK=e=>(!e||!e.validate)&&!!(na(e.validate)&&e.validate.constructor.name===xE||Cn(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===xE)),zK=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function bE(e,t,n){const r=De(e,n);if(r||zN(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=De(t,i),l=De(e,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};s.pop()}return{name:n}}var UK=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,VK=(e,t)=>!Jy(De(e,t)).length&&Fn(e,t);const WK={mode:qs.onSubmit,reValidateMode:qs.onChange,shouldFocusError:!0};function HK(e={}){let t={...WK,...e},n={submitCount:0,isDirty:!1,isLoading:na(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},s=Cn(t.defaultValues)||Cn(t.values)?Dr(t.defaultValues||t.values)||{}:{},i=t.shouldUnregister?{}:Dr(s),o={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:Z0(),array:Z0(),state:Z0()},h=fE(t.mode),p=fE(t.reValidateMode),g=t.criteriaMode===qs.all,m=E=>D=>{clearTimeout(u),u=setTimeout(E,D)},x=async E=>{if(!e.disabled&&(d.isValid||E)){const D=t.resolver?Lr((await _()).errors):await O(r,!0);D!==n.isValid&&f.state.next({isValid:D})}},b=(E,D)=>{!e.disabled&&(d.isValidating||d.validatingFields)&&((E||Array.from(l.mount)).forEach(U=>{U&&(D?Vt(n.validatingFields,U,D):Fn(n.validatingFields,U))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Lr(n.validatingFields)}))},y=(E,D=[],U,K,J=!0,X=!0)=>{if(K&&U&&!e.disabled){if(o.action=!0,X&&Array.isArray(De(r,E))){const be=U(De(r,E),K.argA,K.argB);J&&Vt(r,E,be)}if(X&&Array.isArray(De(n.errors,E))){const be=U(De(n.errors,E),K.argA,K.argB);J&&Vt(n.errors,E,be),VK(n.errors,E)}if(d.touchedFields&&X&&Array.isArray(De(n.touchedFields,E))){const be=U(De(n.touchedFields,E),K.argA,K.argB);J&&Vt(n.touchedFields,E,be)}d.dirtyFields&&(n.dirtyFields=Ld(s,i)),f.state.next({name:E,isDirty:k(E,D),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Vt(i,E,D)},w=(E,D)=>{Vt(n.errors,E,D),f.state.next({errors:n.errors})},j=E=>{n.errors=E,f.state.next({errors:n.errors,isValid:!1})},S=(E,D,U,K)=>{const J=De(r,E);if(J){const X=De(i,E,yn(U)?De(s,E):U);yn(X)||K&&K.defaultChecked||D?Vt(i,E,D?X:J0(J._f)):H(E,X),o.mount&&x()}},N=(E,D,U,K,J)=>{let X=!1,be=!1;const _e={name:E};if(!e.disabled){const Fe=!!(De(r,E)&&De(r,E)._f&&De(r,E)._f.disabled);if(!U||K){d.isDirty&&(be=n.isDirty,n.isDirty=_e.isDirty=k(),X=be!==_e.isDirty);const ie=Fe||Za(De(s,E),D);be=!!(!Fe&&De(n.dirtyFields,E)),ie||Fe?Fn(n.dirtyFields,E):Vt(n.dirtyFields,E,!0),_e.dirtyFields=n.dirtyFields,X=X||d.dirtyFields&&be!==!ie}if(U){const ie=De(n.touchedFields,E);ie||(Vt(n.touchedFields,E,U),_e.touchedFields=n.touchedFields,X=X||d.touchedFields&&ie!==U)}X&&J&&f.state.next(_e)}return X?_e:{}},P=(E,D,U,K)=>{const J=De(n.errors,E),X=d.isValid&&ys(D)&&n.isValid!==D;if(e.delayError&&U?(c=m(()=>w(E,U)),c(e.delayError)):(clearTimeout(u),c=null,U?Vt(n.errors,E,U):Fn(n.errors,E)),(U?!Za(J,U):J)||!Lr(K)||X){const be={...K,...X&&ys(D)?{isValid:D}:{},errors:n.errors,name:E};n={...n,...be},f.state.next(be)}},_=async E=>{b(E,!0);const D=await t.resolver(i,t.context,FK(E||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return b(E),D},A=async E=>{const{errors:D}=await _(E);if(E)for(const U of E){const K=De(D,U);K?Vt(n.errors,U,K):Fn(n.errors,U)}else n.errors=D;return D},O=async(E,D,U={valid:!0})=>{for(const K in E){const J=E[K];if(J){const{_f:X,...be}=J;if(X){const _e=l.array.has(X.name),Fe=J._f&&BK(J._f);Fe&&d.validatingFields&&b([K],!0);const ie=await yE(J,i,g,t.shouldUseNativeValidation&&!D,_e);if(Fe&&d.validatingFields&&b([K]),ie[X.name]&&(U.valid=!1,D))break;!D&&(De(ie,X.name)?_e?MK(n.errors,ie,X.name):Vt(n.errors,X.name,ie[X.name]):Fn(n.errors,X.name))}!Lr(be)&&await O(be,D,U)}}return U.valid},T=()=>{for(const E of l.unMount){const D=De(r,E);D&&(D._f.refs?D._f.refs.every(U=>!Q0(U)):!Q0(D._f.ref))&&pe(E)}l.unMount=new Set},k=(E,D)=>!e.disabled&&(E&&D&&Vt(i,E,D),!Za(Q(),s)),M=(E,D,U)=>vD(E,l,{...o.mount?i:yn(D)?s:Ni(E)?{[E]:D}:D},U,D),R=E=>Jy(De(o.mount?i:s,E,e.shouldUnregister?De(s,E,[]):[])),H=(E,D,U={})=>{const K=De(r,E);let J=D;if(K){const X=K._f;X&&(!X.disabled&&Vt(i,E,ND(D,X)),J=Ug(X.ref)&&_r(D)?"":D,wD(X.ref)?[...X.ref.options].forEach(be=>be.selected=J.includes(be.value)):X.refs?Np(X.ref)?X.refs.length>1?X.refs.forEach(be=>(!be.defaultChecked||!be.disabled)&&(be.checked=Array.isArray(J)?!!J.find(_e=>_e===be.value):J===be.value)):X.refs[0]&&(X.refs[0].checked=!!J):X.refs.forEach(be=>be.checked=be.value===J):VN(X.ref)?X.ref.value="":(X.ref.value=J,X.ref.type||f.values.next({name:E,values:{...i}})))}(U.shouldDirty||U.shouldTouch)&&N(E,J,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&Y(E)},F=(E,D,U)=>{for(const K in D){const J=D[K],X=`${E}.${K}`,be=De(r,X);(l.array.has(E)||Cn(J)||be&&!be._f)&&!hl(J)?F(X,J,U):H(X,J,U)}},V=(E,D,U={})=>{const K=De(r,E),J=l.array.has(E),X=Dr(D);Vt(i,E,X),J?(f.array.next({name:E,values:{...i}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&f.state.next({name:E,dirtyFields:Ld(s,i),isDirty:k(E,X)})):K&&!K._f&&!_r(X)?F(E,X,U):H(E,X,U),hE(E,l)&&f.state.next({...n}),f.values.next({name:o.mount?E:void 0,values:{...i}})},$=async E=>{o.mount=!0;const D=E.target;let U=D.name,K=!0;const J=De(r,U),X=()=>D.type?J0(J._f):uD(E),be=_e=>{K=Number.isNaN(_e)||hl(_e)&&isNaN(_e.getTime())||Za(_e,De(i,U,_e))};if(J){let _e,Fe;const ie=X(),Te=E.type===zg.BLUR||E.type===zg.FOCUS_OUT,Be=!zK(J._f)&&!t.resolver&&!De(n.errors,U)&&!J._f.deps||UK(Te,De(n.touchedFields,U),n.isSubmitted,p,h),gt=hE(U,l,Te);Vt(i,U,ie),Te?(J._f.onBlur&&J._f.onBlur(E),c&&c(0)):J._f.onChange&&J._f.onChange(E);const At=N(U,ie,Te,!1),pn=!Lr(At)||gt;if(!Te&&f.values.next({name:U,type:E.type,values:{...i}}),Be)return d.isValid&&(e.mode==="onBlur"?Te&&x():x()),pn&&f.state.next({name:U,...gt?{}:At});if(!Te&>&&f.state.next({...n}),t.resolver){const{errors:Zt}=await _([U]);if(be(ie),K){const bn=bE(n.errors,r,U),Xt=bE(Zt,r,bn.name||U);_e=Xt.error,U=Xt.name,Fe=Lr(Zt)}}else b([U],!0),_e=(await yE(J,i,g,t.shouldUseNativeValidation))[U],b([U]),be(ie),K&&(_e?Fe=!1:d.isValid&&(Fe=await O(r,!0)));K&&(J._f.deps&&Y(J._f.deps),P(U,Fe,_e,At))}},L=(E,D)=>{if(De(n.errors,D)&&E.focus)return E.focus(),1},Y=async(E,D={})=>{let U,K;const J=wf(E);if(t.resolver){const X=await A(yn(E)?E:J);U=Lr(X),K=E?!J.some(be=>De(X,be)):U}else E?(K=(await Promise.all(J.map(async X=>{const be=De(r,X);return await O(be&&be._f?{[X]:be}:be)}))).every(Boolean),!(!K&&!n.isValid)&&x()):K=U=await O(r);return f.state.next({...!Ni(E)||d.isValid&&U!==n.isValid?{}:{name:E},...t.resolver||!E?{isValid:U}:{},errors:n.errors}),D.shouldFocus&&!K&&jf(r,L,E?J:l.mount),K},Q=E=>{const D={...o.mount?i:s};return yn(E)?D:Ni(E)?De(D,E):E.map(U=>De(D,U))},ee=(E,D)=>({invalid:!!De((D||n).errors,E),isDirty:!!De((D||n).dirtyFields,E),error:De((D||n).errors,E),isValidating:!!De(n.validatingFields,E),isTouched:!!De((D||n).touchedFields,E)}),fe=E=>{E&&wf(E).forEach(D=>Fn(n.errors,D)),f.state.next({errors:E?n.errors:{}})},W=(E,D,U)=>{const K=(De(r,E,{_f:{}})._f||{}).ref,J=De(n.errors,E)||{},{ref:X,message:be,type:_e,...Fe}=J;Vt(n.errors,E,{...Fe,...D,ref:K}),f.state.next({name:E,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&K&&K.focus&&K.focus()},he=(E,D)=>na(E)?f.values.subscribe({next:U=>E(M(void 0,D),U)}):M(E,D,!0),pe=(E,D={})=>{for(const U of E?wf(E):l.mount)l.mount.delete(U),l.array.delete(U),D.keepValue||(Fn(r,U),Fn(i,U)),!D.keepError&&Fn(n.errors,U),!D.keepDirty&&Fn(n.dirtyFields,U),!D.keepTouched&&Fn(n.touchedFields,U),!D.keepIsValidating&&Fn(n.validatingFields,U),!t.shouldUnregister&&!D.keepDefaultValue&&Fn(s,U);f.values.next({values:{...i}}),f.state.next({...n,...D.keepDirty?{isDirty:k()}:{}}),!D.keepIsValid&&x()},ue=({disabled:E,name:D,field:U,fields:K,value:J})=>{if(ys(E)&&o.mount||E){const X=E?void 0:yn(J)?J0(U?U._f:De(K,D)._f):J;Vt(i,D,X),N(D,X,!1,!1,!0)}},Ae=(E,D={})=>{let U=De(r,E);const K=ys(D.disabled)||ys(e.disabled);return Vt(r,E,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:E}},name:E,mount:!0,...D}}),l.mount.add(E),U?ue({field:U,disabled:ys(D.disabled)?D.disabled:e.disabled,name:E,value:D.value}):S(E,!0,D.value),{...K?{disabled:D.disabled||e.disabled}:{},...t.progressive?{required:!!D.required,min:Fd(D.min),max:Fd(D.max),minLength:Fd(D.minLength),maxLength:Fd(D.maxLength),pattern:Fd(D.pattern)}:{},name:E,onChange:$,onBlur:$,ref:J=>{if(J){Ae(E,D),U=De(r,E);const X=yn(J.value)&&J.querySelectorAll&&J.querySelectorAll("input,select,textarea")[0]||J,be=LK(X),_e=U._f.refs||[];if(be?_e.find(Fe=>Fe===X):X===U._f.ref)return;Vt(r,E,{_f:{...U._f,...be?{refs:[..._e.filter(Q0),X,...Array.isArray(De(s,E))?[{}]:[]],ref:{type:X.type,name:E}}:{ref:X}}}),S(E,!1,void 0,X)}else U=De(r,E,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||D.shouldUnregister)&&!(dD(l.array,E)&&o.action)&&l.unMount.add(E)}}},de=()=>t.shouldFocusError&&jf(r,L,l.mount),oe=E=>{ys(E)&&(f.state.next({disabled:E}),jf(r,(D,U)=>{const K=De(r,U);K&&(D.disabled=K._f.disabled||E,Array.isArray(K._f.refs)&&K._f.refs.forEach(J=>{J.disabled=K._f.disabled||E}))},0,!1))},xe=(E,D)=>async U=>{let K;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let J=Dr(i);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:X,values:be}=await _();n.errors=X,J=be}else await O(r);if(Fn(n.errors,"root"),Lr(n.errors)){f.state.next({errors:{}});try{await E(J,U)}catch(X){K=X}}else D&&await D({...n.errors},U),de(),setTimeout(de);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Lr(n.errors)&&!K,submitCount:n.submitCount+1,errors:n.errors}),K)throw K},te=(E,D={})=>{De(r,E)&&(yn(D.defaultValue)?V(E,Dr(De(s,E))):(V(E,D.defaultValue),Vt(s,E,Dr(D.defaultValue))),D.keepTouched||Fn(n.touchedFields,E),D.keepDirty||(Fn(n.dirtyFields,E),n.isDirty=D.defaultValue?k(E,Dr(De(s,E))):k()),D.keepError||(Fn(n.errors,E),d.isValid&&x()),f.state.next({...n}))},Ye=(E,D={})=>{const U=E?Dr(E):s,K=Dr(U),J=Lr(E),X=J?s:K;if(D.keepDefaultValues||(s=U),!D.keepValues){if(D.keepDirtyValues){const be=new Set([...l.mount,...Object.keys(Ld(s,i))]);for(const _e of Array.from(be))De(n.dirtyFields,_e)?Vt(X,_e,De(i,_e)):V(_e,De(X,_e))}else{if(BN&&yn(E))for(const be of l.mount){const _e=De(r,be);if(_e&&_e._f){const Fe=Array.isArray(_e._f.refs)?_e._f.refs[0]:_e._f.ref;if(Ug(Fe)){const ie=Fe.closest("form");if(ie){ie.reset();break}}}}r={}}i=e.shouldUnregister?D.keepDefaultValues?Dr(s):{}:Dr(X),f.array.next({values:{...X}}),f.values.next({values:{...X}})}l={mount:D.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!d.isValid||!!D.keepIsValid||!!D.keepDirtyValues,o.watch=!!e.shouldUnregister,f.state.next({submitCount:D.keepSubmitCount?n.submitCount:0,isDirty:J?!1:D.keepDirty?n.isDirty:!!(D.keepDefaultValues&&!Za(E,s)),isSubmitted:D.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:J?{}:D.keepDirtyValues?D.keepDefaultValues&&i?Ld(s,i):n.dirtyFields:D.keepDefaultValues&&E?Ld(s,E):D.keepDirty?n.dirtyFields:{},touchedFields:D.keepTouched?n.touchedFields:{},errors:D.keepErrors?n.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},G=(E,D)=>Ye(na(E)?E(i):E,D);return{control:{register:Ae,unregister:pe,getFieldState:ee,handleSubmit:xe,setError:W,_executeSchema:_,_getWatch:M,_getDirty:k,_updateValid:x,_removeUnmounted:T,_updateFieldArray:y,_updateDisabledField:ue,_getFieldArray:R,_reset:Ye,_resetDefaultValues:()=>na(t.defaultValues)&&t.defaultValues().then(E=>{G(E,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:E=>{n={...n,...E}},_disableForm:oe,_subjects:f,_proxyFormState:d,_setErrors:j,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(E){o=E},get _defaultValues(){return s},get _names(){return l},set _names(E){l=E},get _formState(){return n},set _formState(E){n=E},get _options(){return t},set _options(E){t={...t,...E}}},trigger:Y,register:Ae,handleSubmit:xe,watch:he,setValue:V,getValues:Q,reset:G,resetField:te,clearErrors:fe,unregister:pe,setError:W,setFocus:(E,D={})=>{const U=De(r,E),K=U&&U._f;if(K){const J=K.refs?K.refs[0]:K.ref;J.focus&&(J.focus(),D.shouldSelect&&J.select())}},getFieldState:ee}}function tx(e={}){const t=C.useRef(),n=C.useRef(),[r,s]=C.useState({isDirty:!1,isValidating:!1,isLoading:na(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:na(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...HK(e),formState:r});const i=t.current.control;return i._options=e,UN({subject:i._subjects.state,next:o=>{mD(o,i._proxyFormState,i._updateFormState,!0)&&s({...i._formState})}}),C.useEffect(()=>i._disableForm(e.disabled),[i,e.disabled]),C.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==r.isDirty&&i._subjects.state.next({isDirty:o})}},[i,r.isDirty]),C.useEffect(()=>{e.values&&!Za(e.values,n.current)?(i._reset(e.values,i._options.resetOptions),n.current=e.values,s(o=>({...o}))):i._resetDefaultValues()},[e.values,i]),C.useEffect(()=>{e.errors&&i._setErrors(e.errors)},[e.errors,i]),C.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),C.useEffect(()=>{e.shouldUnregister&&i._subjects.values.next({values:i._getWatch()})},[e.shouldUnregister,i]),C.useEffect(()=>{t.current&&(t.current.watch=t.current.watch.bind({}))},[r]),t.current.formState=pD(r,i),t.current}const wE=(e,t,n)=>{if(e&&"reportValidity"in e){const r=De(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},_D=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?wE(r.ref,n,e):r.refs&&r.refs.forEach(s=>wE(s,n,e))}},GK=(e,t)=>{t.shouldUseNativeValidation&&_D(e,t);const n={};for(const r in e){const s=De(t.fields,r),i=Object.assign(e[r]||{},{ref:s&&s.ref});if(qK(t.names||Object.keys(e),r)){const o=Object.assign({},De(n,r));Vt(o,"root",i),Vt(n,r,o)}else Vt(n,r,i)}return n},qK=(e,t)=>e.some(n=>n.startsWith(t+"."));var KK=function(e,t){for(var n={};e.length;){var r=e[0],s=r.code,i=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:i,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=n[o].types,u=c&&c[r.code];n[o]=yD(o,t,n,s,u?[].concat(u,r.message):r.message)}e.shift()}return n},nx=function(e,t,n){return n===void 0&&(n={}),function(r,s,i){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return i.shouldUseNativeValidation&&_D({},i),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:GK(KK(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}}},Mt;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Mt||(Mt={}));var l1;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(l1||(l1={}));const We=Mt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qa=e=>{switch(typeof e){case"undefined":return We.undefined;case"string":return We.string;case"number":return isNaN(e)?We.nan:We.number;case"boolean":return We.boolean;case"function":return We.function;case"bigint":return We.bigint;case"symbol":return We.symbol;case"object":return Array.isArray(e)?We.array:e===null?We.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?We.promise:typeof Map<"u"&&e instanceof Map?We.map:typeof Set<"u"&&e instanceof Set?We.set:typeof Date<"u"&&e instanceof Date?We.date:We.object;default:return We.unknown}},Oe=Mt.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"]),XK=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class os extends Error{constructor(t){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=t}get errors(){return this.issues}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;cn.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}os.create=e=>new os(e);const pu=(e,t)=>{let n;switch(e.code){case Oe.invalid_type:e.received===We.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Oe.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Mt.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:n=`Unrecognized key(s) in object: ${Mt.joinValues(e.keys,", ")}`;break;case Oe.invalid_union:n="Invalid input";break;case Oe.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Mt.joinValues(e.options)}`;break;case Oe.invalid_enum_value:n=`Invalid enum value. Expected ${Mt.joinValues(e.options)}, received '${e.received}'`;break;case Oe.invalid_arguments:n="Invalid function arguments";break;case Oe.invalid_return_type:n="Invalid function return type";break;case Oe.invalid_date:n="Invalid date";break;case Oe.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Mt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Oe.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Oe.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Oe.custom:n="Invalid input";break;case Oe.invalid_intersection_types:n="Intersection results could not be merged";break;case Oe.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Oe.not_finite:n="Number must be finite";break;default:n=t.defaultError,Mt.assertNever(e)}return{message:n}};let PD=pu;function YK(e){PD=e}function Hg(){return PD}const Gg=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...s,path:i,message:l}},ZK=[];function Ve(e,t){const n=Hg(),r=Gg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===pu?void 0:pu].filter(s=>!!s)});e.common.issues.push(r)}class br{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return ht;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return br.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ht;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const ht=Object.freeze({status:"aborted"}),Ac=e=>({status:"dirty",value:e}),kr=e=>({status:"valid",value:e}),c1=e=>e.status==="aborted",u1=e=>e.status==="dirty",ih=e=>e.status==="valid",ah=e=>typeof Promise<"u"&&e instanceof Promise;function qg(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function CD(e,t,n,r,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var Je;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Je||(Je={}));var sf,af;class Mi{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}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 jE=(e,t)=>{if(ih(t))return{success:!0,data:t.value};if(!e.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 os(e.common.issues);return this._error=n,this._error}}};function bt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,l)=>{var c,u;const{message:d}=e;return o.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:s}}class Pt{constructor(t){this.spa=this.safeParseAsync,this._def=t,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(t){return Qa(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Qa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new br,ctx:{common:t.parent.common,data:t.data,parsedType:Qa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(ah(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const s={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:t,parsedType:Qa(t)},i=this._parseSync({data:t,path:s.path,parent:s});return jE(s,i)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,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:t,parsedType:Qa(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(ah(s)?s:Promise.resolve(s));return jE(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),l=()=>i.addIssue({code:Oe.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new ai({schema:this,typeName:dt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Oi.create(this,this._def)}nullable(){return Io.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Js.create(this,this._def)}promise(){return gu.create(this,this._def)}or(t){return uh.create([this,t],this._def)}and(t){return dh.create(this,t,this._def)}transform(t){return new ai({...bt(this._def),schema:this,typeName:dt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new gh({...bt(this._def),innerType:this,defaultValue:n,typeName:dt.ZodDefault})}brand(){return new HN({typeName:dt.ZodBranded,type:this,...bt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new vh({...bt(this._def),innerType:this,catchValue:n,typeName:dt.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return _p.create(this,t)}readonly(){return yh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const QK=/^c[^\s-]{8,}$/i,JK=/^[0-9a-z]+$/,eX=/^[0-9A-HJKMNP-TV-Z]{26}$/,tX=/^[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,nX=/^[a-z0-9_-]{21}$/i,rX=/^[-+]?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)?)??$/,sX=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iX="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let eb;const aX=/^(?:(?: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])$/,oX=/^(([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})))$/,lX=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,AD="((\\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])))",cX=new RegExp(`^${AD}$`);function ED(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function uX(e){return new RegExp(`^${ED(e)}$`)}function OD(e){let t=`${AD}T${ED(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function dX(e,t){return!!((t==="v4"||!t)&&aX.test(e)||(t==="v6"||!t)&&oX.test(e))}class Ys extends Pt{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==We.string){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_type,expected:We.string,received:i.parsedType}),ht}const r=new br;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.lengthi.value&&(s=this._getOrReturnCtx(t,s),Ve(s,{code:Oe.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,l=t.data.lengtht.test(s),{validation:n,code:Oe.invalid_string,...Je.errToObj(r)})}_addCheck(t){return new Ys({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Je.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Je.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Je.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Je.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Je.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Je.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Je.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Je.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Je.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Je.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...Je.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Je.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Je.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Je.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Je.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Je.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Je.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Je.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Je.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Je.errToObj(n)})}nonempty(t){return this.min(1,Je.errToObj(t))}trim(){return new Ys({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ys({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ys({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ys({checks:[],typeName:dt.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...bt(e)})};function fX(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=parseInt(e.toFixed(s).replace(".","")),o=parseInt(t.toFixed(s).replace(".",""));return i%o/Math.pow(10,s)}class ko extends Pt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==We.number){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_type,expected:We.number,received:i.parsedType}),ht}let r;const s=new br;for(const i of this._def.checks)i.kind==="int"?Mt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?fX(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.not_finite,message:i.message}),s.dirty()):Mt.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Je.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Je.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Je.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Je.toString(n))}setLimit(t,n,r,s){return new ko({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Je.toString(s)}]})}_addCheck(t){return new ko({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Je.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Je.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Je.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Je.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Je.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Je.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Je.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Je.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Je.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Mt.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||r.valuenew ko({checks:[],typeName:dt.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...bt(e)});class To extends Pt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==We.bigint){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_type,expected:We.bigint,received:i.parsedType}),ht}let r;const s=new br;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.datai.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Ve(r,{code:Oe.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Mt.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Je.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Je.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Je.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Je.toString(n))}setLimit(t,n,r,s){return new To({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:Je.toString(s)}]})}_addCheck(t){return new To({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Je.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Je.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Je.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Je.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Je.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new To({checks:[],typeName:dt.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...bt(e)})};class oh extends Pt{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==We.boolean){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.boolean,received:r.parsedType}),ht}return kr(t.data)}}oh.create=e=>new oh({typeName:dt.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...bt(e)});class Fl extends Pt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==We.date){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_type,expected:We.date,received:i.parsedType}),ht}if(isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return Ve(i,{code:Oe.invalid_date}),ht}const r=new br;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()i.value&&(s=this._getOrReturnCtx(t,s),Ve(s,{code:Oe.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Mt.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Fl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Je.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Je.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Fl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:dt.ZodDate,...bt(e)});class Kg extends Pt{_parse(t){if(this._getType(t)!==We.symbol){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.symbol,received:r.parsedType}),ht}return kr(t.data)}}Kg.create=e=>new Kg({typeName:dt.ZodSymbol,...bt(e)});class lh extends Pt{_parse(t){if(this._getType(t)!==We.undefined){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.undefined,received:r.parsedType}),ht}return kr(t.data)}}lh.create=e=>new lh({typeName:dt.ZodUndefined,...bt(e)});class ch extends Pt{_parse(t){if(this._getType(t)!==We.null){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.null,received:r.parsedType}),ht}return kr(t.data)}}ch.create=e=>new ch({typeName:dt.ZodNull,...bt(e)});class mu extends Pt{constructor(){super(...arguments),this._any=!0}_parse(t){return kr(t.data)}}mu.create=e=>new mu({typeName:dt.ZodAny,...bt(e)});class Pl extends Pt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return kr(t.data)}}Pl.create=e=>new Pl({typeName:dt.ZodUnknown,...bt(e)});class _a extends Pt{_parse(t){const n=this._getOrReturnCtx(t);return Ve(n,{code:Oe.invalid_type,expected:We.never,received:n.parsedType}),ht}}_a.create=e=>new _a({typeName:dt.ZodNever,...bt(e)});class Xg extends Pt{_parse(t){if(this._getType(t)!==We.undefined){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.void,received:r.parsedType}),ht}return kr(t.data)}}Xg.create=e=>new Xg({typeName:dt.ZodVoid,...bt(e)});class Js extends Pt{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==We.array)return Ve(n,{code:Oe.invalid_type,expected:We.array,received:n.parsedType}),ht;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.lengths.maxLength.value&&(Ve(n,{code:Oe.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new Mi(n,o,n.path,l)))).then(o=>br.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new Mi(n,o,n.path,l)));return br.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Js({...this._def,minLength:{value:t,message:Je.toString(n)}})}max(t,n){return new Js({...this._def,maxLength:{value:t,message:Je.toString(n)}})}length(t,n){return new Js({...this._def,exactLength:{value:t,message:Je.toString(n)}})}nonempty(t){return this.min(1,t)}}Js.create=(e,t)=>new Js({type:e,minLength:null,maxLength:null,exactLength:null,typeName:dt.ZodArray,...bt(t)});function mc(e){if(e instanceof un){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Oi.create(mc(r))}return new un({...e._def,shape:()=>t})}else return e instanceof Js?new Js({...e._def,type:mc(e.element)}):e instanceof Oi?Oi.create(mc(e.unwrap())):e instanceof Io?Io.create(mc(e.unwrap())):e instanceof Ri?Ri.create(e.items.map(t=>mc(t))):e}class un extends Pt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Mt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==We.object){const u=this._getOrReturnCtx(t);return Ve(u,{code:Oe.invalid_type,expected:We.object,received:u.parsedType}),ht}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof _a&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=i[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Mi(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof _a){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(Ve(s,{code:Oe.unrecognized_keys,keys:l}),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 l){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Mi(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>br.mergeObjectSync(r,u)):br.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return Je.errToObj,new un({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,i,o,l;const c=(o=(i=(s=this._def).errorMap)===null||i===void 0?void 0:i.call(s,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=Je.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new un({...this._def,unknownKeys:"strip"})}passthrough(){return new un({...this._def,unknownKeys:"passthrough"})}extend(t){return new un({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new un({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:dt.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new un({...this._def,catchall:t})}pick(t){const n={};return Mt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new un({...this._def,shape:()=>n})}omit(t){const n={};return Mt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new un({...this._def,shape:()=>n})}deepPartial(){return mc(this)}partial(t){const n={};return Mt.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}),new un({...this._def,shape:()=>n})}required(t){const n={};return Mt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Oi;)i=i._def.innerType;n[r]=i}}),new un({...this._def,shape:()=>n})}keyof(){return kD(Mt.objectKeys(this.shape))}}un.create=(e,t)=>new un({shape:()=>e,unknownKeys:"strip",catchall:_a.create(),typeName:dt.ZodObject,...bt(t)});un.strictCreate=(e,t)=>new un({shape:()=>e,unknownKeys:"strict",catchall:_a.create(),typeName:dt.ZodObject,...bt(t)});un.lazycreate=(e,t)=>new un({shape:e,unknownKeys:"strip",catchall:_a.create(),typeName:dt.ZodObject,...bt(t)});class uh extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new os(l.ctx.common.issues));return Ve(n,{code:Oe.invalid_union,unionErrors:o}),ht}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(c=>new os(c));return Ve(n,{code:Oe.invalid_union,unionErrors:l}),ht}}get options(){return this._def.options}}uh.create=(e,t)=>new uh({options:e,typeName:dt.ZodUnion,...bt(t)});const qi=e=>e instanceof hh?qi(e.schema):e instanceof ai?qi(e.innerType()):e instanceof ph?[e.value]:e instanceof $o?e.options:e instanceof mh?Mt.objectValues(e.enum):e instanceof gh?qi(e._def.innerType):e instanceof lh?[void 0]:e instanceof ch?[null]:e instanceof Oi?[void 0,...qi(e.unwrap())]:e instanceof Io?[null,...qi(e.unwrap())]:e instanceof HN||e instanceof yh?qi(e.unwrap()):e instanceof vh?qi(e._def.innerType):[];class rx extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==We.object)return Ve(n,{code:Oe.invalid_type,expected:We.object,received:n.parsedType}),ht;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(Ve(n,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const s=new Map;for(const i of n){const o=qi(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of o){if(s.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);s.set(l,i)}}return new rx({typeName:dt.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...bt(r)})}}function d1(e,t){const n=Qa(e),r=Qa(t);if(e===t)return{valid:!0,data:e};if(n===We.object&&r===We.object){const s=Mt.objectKeys(t),i=Mt.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of i){const c=d1(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===We.array&&r===We.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i{if(c1(i)||c1(o))return ht;const l=d1(i.value,o.value);return l.valid?((u1(i)||u1(o))&&n.dirty(),{status:n.value,value:l.data}):(Ve(r,{code:Oe.invalid_intersection_types}),ht)};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(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}dh.create=(e,t,n)=>new dh({left:e,right:t,typeName:dt.ZodIntersection,...bt(n)});class Ri extends Pt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.array)return Ve(r,{code:Oe.invalid_type,expected:We.array,received:r.parsedType}),ht;if(r.data.lengththis._def.items.length&&(Ve(r,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new Mi(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>br.mergeArray(n,o)):br.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Ri({...this._def,rest:t})}}Ri.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ri({items:e,typeName:dt.ZodTuple,rest:null,...bt(t)})};class fh extends Pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.object)return Ve(r,{code:Oe.invalid_type,expected:We.object,received:r.parsedType}),ht;const s=[],i=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:i._parse(new Mi(r,l,r.path,l)),value:o._parse(new Mi(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?br.mergeObjectAsync(n,s):br.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Pt?new fh({keyType:t,valueType:n,typeName:dt.ZodRecord,...bt(r)}):new fh({keyType:Ys.create(),valueType:t,typeName:dt.ZodRecord,...bt(n)})}}class Yg extends Pt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.map)return Ve(r,{code:Oe.invalid_type,expected:We.map,received:r.parsedType}),ht;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>({key:s._parse(new Mi(r,l,r.path,[u,"key"])),value:i._parse(new Mi(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return ht;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return ht;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}Yg.create=(e,t,n)=>new Yg({valueType:t,keyType:e,typeName:dt.ZodMap,...bt(n)});class Bl extends Pt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==We.set)return Ve(r,{code:Oe.invalid_type,expected:We.set,received:r.parsedType}),ht;const s=this._def;s.minSize!==null&&r.data.sizes.maxSize.value&&(Ve(r,{code:Oe.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return ht;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>i._parse(new Mi(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,n){return new Bl({...this._def,minSize:{value:t,message:Je.toString(n)}})}max(t,n){return new Bl({...this._def,maxSize:{value:t,message:Je.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Bl.create=(e,t)=>new Bl({valueType:e,minSize:null,maxSize:null,typeName:dt.ZodSet,...bt(t)});class Uc extends Pt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==We.function)return Ve(n,{code:Oe.invalid_type,expected:We.function,received:n.parsedType}),ht;function r(l,c){return Gg({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hg(),pu].filter(u=>!!u),issueData:{code:Oe.invalid_arguments,argumentsError:c}})}function s(l,c){return Gg({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Hg(),pu].filter(u=>!!u),issueData:{code:Oe.invalid_return_type,returnTypeError:c}})}const i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof gu){const l=this;return kr(async function(...c){const u=new os([]),d=await l._def.args.parseAsync(c,i).catch(p=>{throw u.addIssue(r(c,p)),u}),f=await Reflect.apply(o,this,d);return await l._def.returns._def.type.parseAsync(f,i).catch(p=>{throw u.addIssue(s(f,p)),u})})}else{const l=this;return kr(function(...c){const u=l._def.args.safeParse(c,i);if(!u.success)throw new os([r(c,u.error)]);const d=Reflect.apply(o,this,u.data),f=l._def.returns.safeParse(d,i);if(!f.success)throw new os([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Uc({...this._def,args:Ri.create(t).rest(Pl.create())})}returns(t){return new Uc({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Uc({args:t||Ri.create([]).rest(Pl.create()),returns:n||Pl.create(),typeName:dt.ZodFunction,...bt(r)})}}class hh extends Pt{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}hh.create=(e,t)=>new hh({getter:e,typeName:dt.ZodLazy,...bt(t)});class ph extends Pt{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Ve(n,{received:n.data,code:Oe.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:t.data}}get value(){return this._def.value}}ph.create=(e,t)=>new ph({value:e,typeName:dt.ZodLiteral,...bt(t)});function kD(e,t){return new $o({values:e,typeName:dt.ZodEnum,...bt(t)})}class $o extends Pt{constructor(){super(...arguments),sf.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Ve(n,{expected:Mt.joinValues(r),received:n.parsedType,code:Oe.invalid_type}),ht}if(qg(this,sf)||CD(this,sf,new Set(this._def.values)),!qg(this,sf).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Ve(n,{received:n.data,code:Oe.invalid_enum_value,options:r}),ht}return kr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return $o.create(t,{...this._def,...n})}exclude(t,n=this._def){return $o.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}sf=new WeakMap;$o.create=kD;class mh extends Pt{constructor(){super(...arguments),af.set(this,void 0)}_parse(t){const n=Mt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==We.string&&r.parsedType!==We.number){const s=Mt.objectValues(n);return Ve(r,{expected:Mt.joinValues(s),received:r.parsedType,code:Oe.invalid_type}),ht}if(qg(this,af)||CD(this,af,new Set(Mt.getValidEnumValues(this._def.values))),!qg(this,af).has(t.data)){const s=Mt.objectValues(n);return Ve(r,{received:r.data,code:Oe.invalid_enum_value,options:s}),ht}return kr(t.data)}get enum(){return this._def.values}}af=new WeakMap;mh.create=(e,t)=>new mh({values:e,typeName:dt.ZodNativeEnum,...bt(t)});class gu extends Pt{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==We.promise&&n.common.async===!1)return Ve(n,{code:Oe.invalid_type,expected:We.promise,received:n.parsedType}),ht;const r=n.parsedType===We.promise?n.data:Promise.resolve(n.data);return kr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}gu.create=(e,t)=>new gu({type:e,typeName:dt.ZodPromise,...bt(t)});class ai extends Pt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===dt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{Ve(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return ht;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?ht:c.status==="dirty"||n.value==="dirty"?Ac(c.value):c});{if(n.value==="aborted")return ht;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?ht:l.status==="dirty"||n.value==="dirty"?Ac(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?ht:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?ht:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!ih(o))return o;const l=s.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>ih(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):o);Mt.assertNever(s)}}ai.create=(e,t,n)=>new ai({schema:e,typeName:dt.ZodEffects,effect:t,...bt(n)});ai.createWithPreprocess=(e,t,n)=>new ai({schema:t,effect:{type:"preprocess",transform:e},typeName:dt.ZodEffects,...bt(n)});class Oi extends Pt{_parse(t){return this._getType(t)===We.undefined?kr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Oi.create=(e,t)=>new Oi({innerType:e,typeName:dt.ZodOptional,...bt(t)});class Io extends Pt{_parse(t){return this._getType(t)===We.null?kr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Io.create=(e,t)=>new Io({innerType:e,typeName:dt.ZodNullable,...bt(t)});class gh extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===We.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}gh.create=(e,t)=>new gh({innerType:e,typeName:dt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...bt(t)});class vh extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return ah(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new os(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new os(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}vh.create=(e,t)=>new vh({innerType:e,typeName:dt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...bt(t)});class Zg extends Pt{_parse(t){if(this._getType(t)!==We.nan){const r=this._getOrReturnCtx(t);return Ve(r,{code:Oe.invalid_type,expected:We.nan,received:r.parsedType}),ht}return{status:"valid",value:t.data}}}Zg.create=e=>new Zg({typeName:dt.ZodNaN,...bt(e)});const hX=Symbol("zod_brand");class HN extends Pt{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class _p extends Pt{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ht:i.status==="dirty"?(n.dirty(),Ac(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ht:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new _p({in:t,out:n,typeName:dt.ZodPipeline})}}class yh extends Pt{_parse(t){const n=this._def.innerType._parse(t),r=s=>(ih(s)&&(s.value=Object.freeze(s.value)),s);return ah(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}yh.create=(e,t)=>new yh({innerType:e,typeName:dt.ZodReadonly,...bt(t)});function TD(e,t={},n){return e?mu.create().superRefine((r,s)=>{var i,o;if(!e(r)){const l=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(o=(i=l.fatal)!==null&&i!==void 0?i:n)!==null&&o!==void 0?o:!0,u=typeof l=="string"?{message:l}:l;s.addIssue({code:"custom",...u,fatal:c})}}):mu.create()}const pX={object:un.lazycreate};var dt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(dt||(dt={}));const mX=(e,t={message:`Input not instance of ${e.name}`})=>TD(n=>n instanceof e,t),$D=Ys.create,ID=ko.create,gX=Zg.create,vX=To.create,MD=oh.create,yX=Fl.create,xX=Kg.create,bX=lh.create,wX=ch.create,jX=mu.create,SX=Pl.create,NX=_a.create,_X=Xg.create,PX=Js.create,CX=un.create,AX=un.strictCreate,EX=uh.create,OX=rx.create,kX=dh.create,TX=Ri.create,$X=fh.create,IX=Yg.create,MX=Bl.create,RX=Uc.create,DX=hh.create,LX=ph.create,FX=$o.create,BX=mh.create,zX=gu.create,SE=ai.create,UX=Oi.create,VX=Io.create,WX=ai.createWithPreprocess,HX=_p.create,GX=()=>$D().optional(),qX=()=>ID().optional(),KX=()=>MD().optional(),XX={string:e=>Ys.create({...e,coerce:!0}),number:e=>ko.create({...e,coerce:!0}),boolean:e=>oh.create({...e,coerce:!0}),bigint:e=>To.create({...e,coerce:!0}),date:e=>Fl.create({...e,coerce:!0})},YX=ht;var Re=Object.freeze({__proto__:null,defaultErrorMap:pu,setErrorMap:YK,getErrorMap:Hg,makeIssue:Gg,EMPTY_PATH:ZK,addIssueToContext:Ve,ParseStatus:br,INVALID:ht,DIRTY:Ac,OK:kr,isAborted:c1,isDirty:u1,isValid:ih,isAsync:ah,get util(){return Mt},get objectUtil(){return l1},ZodParsedType:We,getParsedType:Qa,ZodType:Pt,datetimeRegex:OD,ZodString:Ys,ZodNumber:ko,ZodBigInt:To,ZodBoolean:oh,ZodDate:Fl,ZodSymbol:Kg,ZodUndefined:lh,ZodNull:ch,ZodAny:mu,ZodUnknown:Pl,ZodNever:_a,ZodVoid:Xg,ZodArray:Js,ZodObject:un,ZodUnion:uh,ZodDiscriminatedUnion:rx,ZodIntersection:dh,ZodTuple:Ri,ZodRecord:fh,ZodMap:Yg,ZodSet:Bl,ZodFunction:Uc,ZodLazy:hh,ZodLiteral:ph,ZodEnum:$o,ZodNativeEnum:mh,ZodPromise:gu,ZodEffects:ai,ZodTransformer:ai,ZodOptional:Oi,ZodNullable:Io,ZodDefault:gh,ZodCatch:vh,ZodNaN:Zg,BRAND:hX,ZodBranded:HN,ZodPipeline:_p,ZodReadonly:yh,custom:TD,Schema:Pt,ZodSchema:Pt,late:pX,get ZodFirstPartyTypeKind(){return dt},coerce:XX,any:jX,array:PX,bigint:vX,boolean:MD,date:yX,discriminatedUnion:OX,effect:SE,enum:FX,function:RX,instanceof:mX,intersection:kX,lazy:DX,literal:LX,map:IX,nan:gX,nativeEnum:BX,never:NX,null:wX,nullable:VX,number:ID,object:CX,oboolean:KX,onumber:qX,optional:UX,ostring:GX,pipeline:HX,preprocess:WX,promise:zX,record:$X,set:MX,strictObject:AX,string:$D,symbol:xX,transformer:SE,tuple:TX,undefined:bX,union:EX,unknown:SX,void:_X,NEVER:YX,ZodIssueCode:Oe,quotelessJson:XK,ZodError:os}),ZX="Label",RD=v.forwardRef((e,t)=>a.jsx(Xe.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));RD.displayName=ZX;var DD=RD;const QX=RN("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),ji=v.forwardRef(({className:e,...t},n)=>a.jsx(DD,{ref:n,className:Me(QX(),e),...t}));ji.displayName=DD.displayName;const sx=OK,LD=v.createContext({}),ot=({...e})=>a.jsx(LD.Provider,{value:{name:e.name},children:a.jsx(IK,{...e})}),ix=()=>{const e=v.useContext(LD),t=v.useContext(FD),{getFieldState:n,formState:r}=ex(),s=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:i}=t;return{id:i,name:e.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},FD=v.createContext({}),nt=v.forwardRef(({className:e,...t},n)=>{const r=v.useId();return a.jsx(FD.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:Me("space-y-2",e),...t})})});nt.displayName="FormItem";const rt=v.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:s}=ix();return a.jsx(ji,{ref:n,className:Me(r&&"text-destructive",e),htmlFor:s,...t})});rt.displayName="FormLabel";const st=v.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:s,formMessageId:i}=ix();return a.jsx(xa,{ref:t,id:r,"aria-describedby":n?`${s} ${i}`:`${s}`,"aria-invalid":!!n,...e})});st.displayName="FormControl";const on=v.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=ix();return a.jsx("p",{ref:n,id:r,className:Me("text-sm text-muted-foreground",e),...t})});on.displayName="FormDescription";const it=v.forwardRef(({className:e,children:t,...n},r)=>{const{error:s,formMessageId:i}=ix(),o=s?String(s==null?void 0:s.message):t;return o?a.jsx("p",{ref:r,id:i,className:Me("text-sm font-medium text-destructive",e),...n,children:o}):null});it.displayName="FormMessage";const _t=v.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:Me("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",e),ref:r,...n}));_t.displayName="Input";const et=v.forwardRef(({className:e,...t},n)=>a.jsx("textarea",{className:Me("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",e),ref:n,...t}));et.displayName="Textarea";function xh(e,[t,n]){return Math.min(n,Math.max(t,e))}function JX(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,eY(s,...t)]}function eY(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Pp(e){const t=e+"CollectionProvider",[n,r]=JX(t),[s,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:m}=p,x=C.useRef(null),b=C.useRef(new Map).current;return a.jsx(s,{scope:g,itemMap:b,collectionRef:x,children:m})};o.displayName=t;const l=e+"CollectionSlot",c=C.forwardRef((p,g)=>{const{scope:m,children:x}=p,b=i(l,m),y=pt(g,b.collectionRef);return a.jsx(xa,{ref:y,children:x})});c.displayName=l;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=C.forwardRef((p,g)=>{const{scope:m,children:x,...b}=p,y=C.useRef(null),w=pt(g,y),j=i(u,m);return C.useEffect(()=>(j.itemMap.set(y,{ref:y,...b}),()=>void j.itemMap.delete(y))),a.jsx(xa,{[d]:"",ref:w,children:x})});f.displayName=u;function h(p){const g=i(e+"CollectionConsumer",p);return C.useCallback(()=>{const x=g.collectionRef.current;if(!x)return[];const b=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((j,S)=>b.indexOf(j.ref.current)-b.indexOf(S.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,r]}var tY=v.createContext(void 0);function Uo(e){const t=v.useContext(tY);return e||t||"ltr"}var tb=0;function GN(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??NE()),document.body.insertAdjacentElement("beforeend",e[1]??NE()),tb++,()=>{tb===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),tb--}},[])}function NE(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var nb="focusScope.autoFocusOnMount",rb="focusScope.autoFocusOnUnmount",_E={bubbles:!1,cancelable:!0},nY="FocusScope",ax=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=e,[l,c]=v.useState(null),u=Vn(s),d=Vn(i),f=v.useRef(null),h=pt(t,m=>c(m)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const j=w.target;l.contains(j)?f.current=j:Va(f.current,{select:!0})},x=function(w){if(p.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||Va(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&Va(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",x);const y=new MutationObserver(b);return l&&y.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",x),y.disconnect()}}},[r,l,p.paused]),v.useEffect(()=>{if(l){CE.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(nb,_E);l.addEventListener(nb,u),l.dispatchEvent(b),b.defaultPrevented||(rY(lY(BD(l)),{select:!0}),document.activeElement===m&&Va(l))}return()=>{l.removeEventListener(nb,u),setTimeout(()=>{const b=new CustomEvent(rb,_E);l.addEventListener(rb,d),l.dispatchEvent(b),b.defaultPrevented||Va(m??document.body,{select:!0}),l.removeEventListener(rb,d),CE.remove(p)},0)}}},[l,u,d,p]);const g=v.useCallback(m=>{if(!n&&!r||p.paused)return;const x=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(x&&b){const y=m.currentTarget,[w,j]=sY(y);w&&j?!m.shiftKey&&b===j?(m.preventDefault(),n&&Va(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&Va(j,{select:!0})):b===y&&m.preventDefault()}},[n,r,p.paused]);return a.jsx(Xe.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});ax.displayName=nY;function rY(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Va(r,{select:t}),document.activeElement!==n)return}function sY(e){const t=BD(e),n=PE(t,e),r=PE(t.reverse(),e);return[n,r]}function BD(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function PE(e,t){for(const n of e)if(!iY(n,{upTo:t}))return n}function iY(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function aY(e){return e instanceof HTMLInputElement&&"select"in e}function Va(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&aY(e)&&t&&e.select()}}var CE=oY();function oY(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=AE(e,t),e.unshift(t)},remove(t){var n;e=AE(e,t),(n=e[0])==null||n.resume()}}}function AE(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function lY(e){return e.filter(t=>t.tagName!=="A")}function Cp(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var cY=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},lc=new WeakMap,gm=new WeakMap,vm={},sb=0,zD=function(e){return e&&(e.host||zD(e.parentNode))},uY=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=zD(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},dY=function(e,t,n,r){var s=uY(t,Array.isArray(e)?e:[e]);vm[n]||(vm[n]=new WeakMap);var i=vm[n],o=[],l=new Set,c=new Set(s),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",m=(lc.get(h)||0)+1,x=(i.get(h)||0)+1;lc.set(h,m),i.set(h,x),o.push(h),m===1&&g&&gm.set(h,!0),x===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),sb++,function(){o.forEach(function(f){var h=lc.get(f)-1,p=i.get(f)-1;lc.set(f,h),i.set(f,p),h||(gm.has(f)||f.removeAttribute(r),gm.delete(f)),p||f.removeAttribute(n)}),sb--,sb||(lc=new WeakMap,lc=new WeakMap,gm=new WeakMap,vm={})}},qN=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=cY(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),dY(r,s,n,"aria-hidden")):function(){return null}},Si=function(){return Si=Object.assign||function(t){for(var n,r=1,s=arguments.length;r"u")return AY;var t=EY(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},kY=HD(),Vc="data-scroll-locked",TY=function(e,t,n,r){var s=e.left,i=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),` - .`.concat(hY,` { - overflow: hidden `).concat(r,`; - padding-right: `).concat(l,"px ").concat(r,`; - } - body[`).concat(Vc,`] { - overflow: hidden `).concat(r,`; - overscroll-behavior: contain; - `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` - padding-left: `.concat(s,`px; - padding-top: `).concat(i,`px; - padding-right: `).concat(o,`px; - margin-left:0; - margin-top:0; - margin-right: `).concat(l,"px ").concat(r,`; - `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` - } - - .`).concat(Jm,` { - right: `).concat(l,"px ").concat(r,`; - } - - .`).concat(eg,` { - margin-right: `).concat(l,"px ").concat(r,`; - } - - .`).concat(Jm," .").concat(Jm,` { - right: 0 `).concat(r,`; - } - - .`).concat(eg," .").concat(eg,` { - margin-right: 0 `).concat(r,`; - } - - body[`).concat(Vc,`] { - `).concat(pY,": ").concat(l,`px; - } -`)},OE=function(){var e=parseInt(document.body.getAttribute(Vc)||"0",10);return isFinite(e)?e:0},$Y=function(){v.useEffect(function(){return document.body.setAttribute(Vc,(OE()+1).toString()),function(){var e=OE()-1;e<=0?document.body.removeAttribute(Vc):document.body.setAttribute(Vc,e.toString())}},[])},IY=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;$Y();var i=v.useMemo(function(){return OY(s)},[s]);return v.createElement(kY,{styles:TY(i,!t,s,n?"":"!important")})},f1=!1;if(typeof window<"u")try{var ym=Object.defineProperty({},"passive",{get:function(){return f1=!0,!0}});window.addEventListener("test",ym,ym),window.removeEventListener("test",ym,ym)}catch{f1=!1}var cc=f1?{passive:!1}:!1,MY=function(e){return e.tagName==="TEXTAREA"},GD=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!MY(e)&&n[t]==="visible")},RY=function(e){return GD(e,"overflowY")},DY=function(e){return GD(e,"overflowX")},kE=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=qD(e,r);if(s){var i=KD(e,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},LY=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},FY=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},qD=function(e,t){return e==="v"?RY(t):DY(t)},KD=function(e,t){return e==="v"?LY(t):FY(t)},BY=function(e,t){return e==="h"&&t==="rtl"?-1:1},zY=function(e,t,n,r,s){var i=BY(e,window.getComputedStyle(t).direction),o=i*r,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,h=0;do{var p=KD(e,l),g=p[0],m=p[1],x=p[2],b=m-x-i*g;(g||b)&&qD(e,l)&&(f+=b,h+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(f)<1||!s)||!d&&(Math.abs(h)<1||!s))&&(u=!0),u},xm=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},TE=function(e){return[e.deltaX,e.deltaY]},$E=function(e){return e&&"current"in e?e.current:e},UY=function(e,t){return e[0]===t[0]&&e[1]===t[1]},VY=function(e){return` - .block-interactivity-`.concat(e,` {pointer-events: none;} - .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},WY=0,uc=[];function HY(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),s=v.useState(WY++)[0],i=v.useState(HD)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=fY([e.lockRef.current],(e.shards||[]).map($E),!0).filter(Boolean);return m.forEach(function(x){return x.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(m,x){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var b=xm(m),y=n.current,w="deltaX"in m?m.deltaX:y[0]-b[0],j="deltaY"in m?m.deltaY:y[1]-b[1],S,N=m.target,P=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in m&&P==="h"&&N.type==="range")return!1;var _=kE(P,N);if(!_)return!0;if(_?S=P:(S=P==="v"?"h":"v",_=kE(P,N)),!_)return!1;if(!r.current&&"changedTouches"in m&&(w||j)&&(r.current=S),!S)return!0;var A=r.current||S;return zY(A,x,m,A==="h"?w:j,!0)},[]),c=v.useCallback(function(m){var x=m;if(!(!uc.length||uc[uc.length-1]!==i)){var b="deltaY"in x?TE(x):xm(x),y=t.current.filter(function(S){return S.name===x.type&&(S.target===x.target||x.target===S.shadowParent)&&UY(S.delta,b)})[0];if(y&&y.should){x.cancelable&&x.preventDefault();return}if(!y){var w=(o.current.shards||[]).map($E).filter(Boolean).filter(function(S){return S.contains(x.target)}),j=w.length>0?l(x,w[0]):!o.current.noIsolation;j&&x.cancelable&&x.preventDefault()}}},[]),u=v.useCallback(function(m,x,b,y){var w={name:m,delta:x,target:b,should:y,shadowParent:GY(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),d=v.useCallback(function(m){n.current=xm(m),r.current=void 0},[]),f=v.useCallback(function(m){u(m.type,TE(m),m.target,l(m,e.lockRef.current))},[]),h=v.useCallback(function(m){u(m.type,xm(m),m.target,l(m,e.lockRef.current))},[]);v.useEffect(function(){return uc.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,cc),document.addEventListener("touchmove",c,cc),document.addEventListener("touchstart",d,cc),function(){uc=uc.filter(function(m){return m!==i}),document.removeEventListener("wheel",c,cc),document.removeEventListener("touchmove",c,cc),document.removeEventListener("touchstart",d,cc)}},[]);var p=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(i,{styles:VY(s)}):null,p?v.createElement(IY,{gapMode:e.gapMode}):null)}function GY(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const qY=wY(WD,HY);var lx=v.forwardRef(function(e,t){return v.createElement(ox,Si({},e,{ref:t,sideCar:qY}))});lx.classNames=ox.classNames;var KY=[" ","Enter","ArrowUp","ArrowDown"],XY=[" ","Enter"],Ap="Select",[cx,ux,YY]=Pp(Ap),[rd,_Oe]=Ir(Ap,[YY,Yu]),dx=Yu(),[ZY,Vo]=rd(Ap),[QY,JY]=rd(Ap),XD=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=e,m=dx(t),[x,b]=v.useState(null),[y,w]=v.useState(null),[j,S]=v.useState(!1),N=Uo(u),[P=!1,_]=us({prop:r,defaultProp:s,onChange:i}),[A,O]=us({prop:o,defaultProp:l,onChange:c}),T=v.useRef(null),k=x?g||!!x.closest("form"):!0,[M,R]=v.useState(new Set),H=Array.from(M).map(F=>F.props.value).join(";");return a.jsx(qM,{...m,children:a.jsxs(ZY,{required:p,scope:t,trigger:x,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:S,contentId:Cs(),value:A,onValueChange:O,open:P,onOpenChange:_,dir:N,triggerPointerDownPosRef:T,disabled:h,children:[a.jsx(cx.Provider,{scope:t,children:a.jsx(QY,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(F=>{R(V=>new Set(V).add(F))},[]),onNativeOptionRemove:v.useCallback(F=>{R(V=>{const $=new Set(V);return $.delete(F),$})},[]),children:n})}),k?a.jsxs(b4,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:A,onChange:F=>O(F.target.value),disabled:h,form:g,children:[A===void 0?a.jsx("option",{value:""}):null,Array.from(M)]},H):null]})})};XD.displayName=Ap;var YD="SelectTrigger",ZD=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=dx(n),o=Vo(YD,n),l=o.disabled||r,c=pt(t,o.onTriggerChange),u=ux(n),d=v.useRef("touch"),[f,h,p]=w4(m=>{const x=u().filter(w=>!w.disabled),b=x.find(w=>w.value===o.value),y=j4(x,m,b);y!==void 0&&o.onValueChange(y.value)}),g=m=>{l||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return a.jsx(pN,{asChild:!0,...i,children:a.jsx(Xe.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":x4(o.value)?"":void 0,...s,ref:c,onClick:$e(s.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:$e(s.onPointerDown,m=>{d.current=m.pointerType;const x=m.target;x.hasPointerCapture(m.pointerId)&&x.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:$e(s.onKeyDown,m=>{const x=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(x&&m.key===" ")&&KY.includes(m.key)&&(g(),m.preventDefault())})})})});ZD.displayName=YD;var QD="SelectValue",JD=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...l}=e,c=Vo(QD,n),{onValueNodeHasChildrenChange:u}=c,d=i!==void 0,f=pt(t,c.onValueNodeChange);return or(()=>{u(d)},[u,d]),a.jsx(Xe.span,{...l,ref:f,style:{pointerEvents:"none"},children:x4(c.value)?a.jsx(a.Fragment,{children:o}):i})});JD.displayName=QD;var eZ="SelectIcon",e4=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return a.jsx(Xe.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});e4.displayName=eZ;var tZ="SelectPortal",t4=e=>a.jsx(By,{asChild:!0,...e});t4.displayName=tZ;var zl="SelectContent",n4=v.forwardRef((e,t)=>{const n=Vo(zl,e.__scopeSelect),[r,s]=v.useState();if(or(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?Xs.createPortal(a.jsx(r4,{scope:e.__scopeSelect,children:a.jsx(cx.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),i):null}return a.jsx(s4,{...e,ref:t})});n4.displayName=zl;var Fs=10,[r4,Wo]=rd(zl),nZ="SelectContentImpl",s4=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:x,...b}=e,y=Vo(zl,n),[w,j]=v.useState(null),[S,N]=v.useState(null),P=pt(t,ue=>j(ue)),[_,A]=v.useState(null),[O,T]=v.useState(null),k=ux(n),[M,R]=v.useState(!1),H=v.useRef(!1);v.useEffect(()=>{if(w)return qN(w)},[w]),GN();const F=v.useCallback(ue=>{const[Ae,...de]=k().map(te=>te.ref.current),[oe]=de.slice(-1),xe=document.activeElement;for(const te of ue)if(te===xe||(te==null||te.scrollIntoView({block:"nearest"}),te===Ae&&S&&(S.scrollTop=0),te===oe&&S&&(S.scrollTop=S.scrollHeight),te==null||te.focus(),document.activeElement!==xe))return},[k,S]),V=v.useCallback(()=>F([_,w]),[F,_,w]);v.useEffect(()=>{M&&V()},[M,V]);const{onOpenChange:$,triggerPointerDownPosRef:L}=y;v.useEffect(()=>{if(w){let ue={x:0,y:0};const Ae=oe=>{var xe,te;ue={x:Math.abs(Math.round(oe.pageX)-(((xe=L.current)==null?void 0:xe.x)??0)),y:Math.abs(Math.round(oe.pageY)-(((te=L.current)==null?void 0:te.y)??0))}},de=oe=>{ue.x<=10&&ue.y<=10?oe.preventDefault():w.contains(oe.target)||$(!1),document.removeEventListener("pointermove",Ae),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",Ae),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ae),document.removeEventListener("pointerup",de,{capture:!0})}}},[w,$,L]),v.useEffect(()=>{const ue=()=>$(!1);return window.addEventListener("blur",ue),window.addEventListener("resize",ue),()=>{window.removeEventListener("blur",ue),window.removeEventListener("resize",ue)}},[$]);const[Y,Q]=w4(ue=>{const Ae=k().filter(xe=>!xe.disabled),de=Ae.find(xe=>xe.ref.current===document.activeElement),oe=j4(Ae,ue,de);oe&&setTimeout(()=>oe.ref.current.focus())}),ee=v.useCallback((ue,Ae,de)=>{const oe=!H.current&&!de;(y.value!==void 0&&y.value===Ae||oe)&&(A(ue),oe&&(H.current=!0))},[y.value]),fe=v.useCallback(()=>w==null?void 0:w.focus(),[w]),W=v.useCallback((ue,Ae,de)=>{const oe=!H.current&&!de;(y.value!==void 0&&y.value===Ae||oe)&&T(ue)},[y.value]),he=r==="popper"?h1:i4,pe=he===h1?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:x}:{};return a.jsx(r4,{scope:n,content:w,viewport:S,onViewportChange:N,itemRefCallback:ee,selectedItem:_,onItemLeave:fe,itemTextRefCallback:W,focusSelectedItem:V,selectedItemText:O,position:r,isPositioned:M,searchRef:Y,children:a.jsx(lx,{as:xa,allowPinchZoom:!0,children:a.jsx(ax,{asChild:!0,trapped:y.open,onMountAutoFocus:ue=>{ue.preventDefault()},onUnmountAutoFocus:$e(s,ue=>{var Ae;(Ae=y.trigger)==null||Ae.focus({preventScroll:!0}),ue.preventDefault()}),children:a.jsx(yp,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:ue=>ue.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:a.jsx(he,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:ue=>ue.preventDefault(),...b,...pe,onPlaced:()=>R(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:$e(b.onKeyDown,ue=>{const Ae=ue.ctrlKey||ue.altKey||ue.metaKey;if(ue.key==="Tab"&&ue.preventDefault(),!Ae&&ue.key.length===1&&Q(ue.key),["ArrowUp","ArrowDown","Home","End"].includes(ue.key)){let oe=k().filter(xe=>!xe.disabled).map(xe=>xe.ref.current);if(["ArrowUp","End"].includes(ue.key)&&(oe=oe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ue.key)){const xe=ue.target,te=oe.indexOf(xe);oe=oe.slice(te+1)}setTimeout(()=>F(oe)),ue.preventDefault()}})})})})})})});s4.displayName=nZ;var rZ="SelectItemAlignedPosition",i4=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=Vo(zl,n),o=Wo(zl,n),[l,c]=v.useState(null),[u,d]=v.useState(null),f=pt(t,P=>d(P)),h=ux(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:x,selectedItemText:b,focusSelectedItem:y}=o,w=v.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&u&&m&&x&&b){const P=i.trigger.getBoundingClientRect(),_=u.getBoundingClientRect(),A=i.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(i.dir!=="rtl"){const xe=O.left-_.left,te=A.left-xe,Ye=P.left-te,G=P.width+Ye,ve=Math.max(G,_.width),Pe=window.innerWidth-Fs,Ie=xh(te,[Fs,Math.max(Fs,Pe-ve)]);l.style.minWidth=G+"px",l.style.left=Ie+"px"}else{const xe=_.right-O.right,te=window.innerWidth-A.right-xe,Ye=window.innerWidth-P.right-te,G=P.width+Ye,ve=Math.max(G,_.width),Pe=window.innerWidth-Fs,Ie=xh(te,[Fs,Math.max(Fs,Pe-ve)]);l.style.minWidth=G+"px",l.style.right=Ie+"px"}const T=h(),k=window.innerHeight-Fs*2,M=m.scrollHeight,R=window.getComputedStyle(u),H=parseInt(R.borderTopWidth,10),F=parseInt(R.paddingTop,10),V=parseInt(R.borderBottomWidth,10),$=parseInt(R.paddingBottom,10),L=H+F+M+$+V,Y=Math.min(x.offsetHeight*5,L),Q=window.getComputedStyle(m),ee=parseInt(Q.paddingTop,10),fe=parseInt(Q.paddingBottom,10),W=P.top+P.height/2-Fs,he=k-W,pe=x.offsetHeight/2,ue=x.offsetTop+pe,Ae=H+F+ue,de=L-Ae;if(Ae<=W){const xe=T.length>0&&x===T[T.length-1].ref.current;l.style.bottom="0px";const te=u.clientHeight-m.offsetTop-m.offsetHeight,Ye=Math.max(he,pe+(xe?fe:0)+te+V),G=Ae+Ye;l.style.height=G+"px"}else{const xe=T.length>0&&x===T[0].ref.current;l.style.top="0px";const Ye=Math.max(W,H+m.offsetTop+(xe?ee:0)+pe)+de;l.style.height=Ye+"px",m.scrollTop=Ae-W+m.offsetTop}l.style.margin=`${Fs}px 0`,l.style.minHeight=Y+"px",l.style.maxHeight=k+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,i.trigger,i.valueNode,l,u,m,x,b,i.dir,r]);or(()=>w(),[w]);const[j,S]=v.useState();or(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const N=v.useCallback(P=>{P&&g.current===!0&&(w(),y==null||y(),g.current=!1)},[w,y]);return a.jsx(iZ,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:N,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:a.jsx(Xe.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});i4.displayName=rZ;var sZ="SelectPopperPosition",h1=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Fs,...i}=e,o=dx(n);return a.jsx(mN,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.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=sZ;var[iZ,KN]=rd(zl,{}),p1="SelectViewport",a4=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=Wo(p1,n),o=KN(p1,n),l=pt(t,i.onViewportChange),c=v.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(cx.Slot,{scope:n,children:a.jsx(Xe.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:$e(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Fs*2,m=parseFloat(f.style.minHeight),x=parseFloat(f.style.height),b=Math.max(m,x);if(b0?j:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});a4.displayName=p1;var o4="SelectGroup",[aZ,oZ]=rd(o4),lZ=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Cs();return a.jsx(aZ,{scope:n,id:s,children:a.jsx(Xe.div,{role:"group","aria-labelledby":s,...r,ref:t})})});lZ.displayName=o4;var l4="SelectLabel",c4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=oZ(l4,n);return a.jsx(Xe.div,{id:s.id,...r,ref:t})});c4.displayName=l4;var Qg="SelectItem",[cZ,u4]=rd(Qg),d4=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,l=Vo(Qg,n),c=Wo(Qg,n),u=l.value===r,[d,f]=v.useState(i??""),[h,p]=v.useState(!1),g=pt(t,y=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,y,r,s)}),m=Cs(),x=v.useRef("touch"),b=()=>{s||(l.onValueChange(r),l.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(cZ,{scope:n,value:r,disabled:s,textId:m,isSelected:u,onItemTextChange:v.useCallback(y=>{f(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:a.jsx(cx.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:a.jsx(Xe.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:$e(o.onFocus,()=>p(!0)),onBlur:$e(o.onBlur,()=>p(!1)),onClick:$e(o.onClick,()=>{x.current!=="mouse"&&b()}),onPointerUp:$e(o.onPointerUp,()=>{x.current==="mouse"&&b()}),onPointerDown:$e(o.onPointerDown,y=>{x.current=y.pointerType}),onPointerMove:$e(o.onPointerMove,y=>{var w;x.current=y.pointerType,s?(w=c.onItemLeave)==null||w.call(c):x.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:$e(o.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:$e(o.onKeyDown,y=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&y.key===" "||(XY.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});d4.displayName=Qg;var of="SelectItemText",f4=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=Vo(of,n),l=Wo(of,n),c=u4(of,n),u=JY(of,n),[d,f]=v.useState(null),h=pt(t,b=>f(b),c.onItemTextChange,b=>{var y;return(y=l.itemTextRefCallback)==null?void 0:y.call(l,b,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=v.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:x}=u;return or(()=>(m(g),()=>x(g)),[m,x,g]),a.jsxs(a.Fragment,{children:[a.jsx(Xe.span,{id:c.textId,...i,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Xs.createPortal(i.children,o.valueNode):null]})});f4.displayName=of;var h4="SelectItemIndicator",p4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return u4(h4,n).isSelected?a.jsx(Xe.span,{"aria-hidden":!0,...r,ref:t}):null});p4.displayName=h4;var m1="SelectScrollUpButton",m4=v.forwardRef((e,t)=>{const n=Wo(m1,e.__scopeSelect),r=KN(m1,e.__scopeSelect),[s,i]=v.useState(!1),o=pt(t,r.onScrollButtonChange);return or(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(v4,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});m4.displayName=m1;var g1="SelectScrollDownButton",g4=v.forwardRef((e,t)=>{const n=Wo(g1,e.__scopeSelect),r=KN(g1,e.__scopeSelect),[s,i]=v.useState(!1),o=pt(t,r.onScrollButtonChange);return or(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(v4,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});g4.displayName=g1;var v4=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=Wo("SelectScrollButton",n),o=v.useRef(null),l=ux(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),or(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),a.jsx(Xe.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:$e(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:$e(s.onPointerMove,()=>{var u;(u=i.onItemLeave)==null||u.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:$e(s.onPointerLeave,()=>{c()})})}),uZ="SelectSeparator",y4=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return a.jsx(Xe.div,{"aria-hidden":!0,...r,ref:t})});y4.displayName=uZ;var v1="SelectArrow",dZ=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=dx(n),i=Vo(v1,n),o=Wo(v1,n);return i.open&&o.position==="popper"?a.jsx(gN,{...s,...r,ref:t}):null});dZ.displayName=v1;function x4(e){return e===""||e===void 0}var b4=v.forwardRef((e,t)=>{const{value:n,...r}=e,s=v.useRef(null),i=pt(t,s),o=Cp(n);return v.useEffect(()=>{const l=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==n&&d){const f=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(f)}},[o,n]),a.jsx(vN,{asChild:!0,children:a.jsx("select",{...r,ref:i,defaultValue:n})})});b4.displayName="BubbleSelect";function w4(e){const t=Vn(e),n=v.useRef(""),r=v.useRef(0),s=v.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),i=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function j4(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=fZ(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function fZ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var hZ=XD,S4=ZD,pZ=JD,mZ=e4,gZ=t4,N4=n4,vZ=a4,_4=c4,P4=d4,yZ=f4,xZ=p4,C4=m4,A4=g4,E4=y4;const On=hZ,kn=pZ,jn=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(S4,{ref:r,className:Me("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",e),...n,children:[t,a.jsx(mZ,{asChild:!0,children:a.jsx(Ta,{className:"h-4 w-4 opacity-50"})})]}));jn.displayName=S4.displayName;const O4=v.forwardRef(({className:e,...t},n)=>a.jsx(C4,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(wp,{className:"h-4 w-4"})}));O4.displayName=C4.displayName;const k4=v.forwardRef(({className:e,...t},n)=>a.jsx(A4,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Ta,{className:"h-4 w-4"})}));k4.displayName=A4.displayName;const Sn=v.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>a.jsx(gZ,{children:a.jsxs(N4,{ref:s,className:Me("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",e),position:n,...r,children:[a.jsx(O4,{}),a.jsx(vZ,{className:Me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(k4,{})]})}));Sn.displayName=N4.displayName;const bZ=v.forwardRef(({className:e,...t},n)=>a.jsx(_4,{ref:n,className:Me("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));bZ.displayName=_4.displayName;const ye=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(P4,{ref:r,className:Me("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",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(xZ,{children:a.jsx(Sa,{className:"h-4 w-4"})})}),a.jsx(yZ,{children:t})]}));ye.displayName=P4.displayName;const wZ=v.forwardRef(({className:e,...t},n)=>a.jsx(E4,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));wZ.displayName=E4.displayName;const jZ=Re.object({audienceBrief:Re.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Re.string().optional(),personaCount:Re.string().min(1,{message:"Number of personas is required."}),dataFile:Re.instanceof(FileList).optional(),llm_model:Re.string().optional()});function SZ({onSubmit:e,isGenerating:t}){const[n,r]=v.useState(!1),[s,i]=v.useState(!1),[o,l]=v.useState({audience_brief:[],research_objective:[]}),[c,u]=v.useState(!1),[d,f]=v.useState(null),h=tx({resolver:nx(jZ),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,j,S,N,P,_,A,O,T,k,M;const b=p==null?void 0:p.trim(),y=g==null?void 0:g.trim();if(!b||b.length<10){ce.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!y||y.length<10){ce.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const R=await Xi.enhanceAudienceBrief(b,y);l(R.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),i(!1);const H=(((j=(w=R.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:j.length)||0)+(((N=(S=R.data.suggestions)==null?void 0:S.research_objective)==null?void 0:N.length)||0);ce.success("Enhancement suggestions generated",{description:`Generated ${H} suggestions to improve your research inputs`})}catch(R){console.error("Error enhancing audience brief:",R);let H="Please try again or modify your brief",F="Failed to generate suggestions";if(R&&typeof R=="object"){const V=R;V.code==="ECONNABORTED"||(P=V.message)!=null&&P.includes("timeout")?(F="Request timeout",H="The AI took too long to analyze your brief. Please try again."):((_=V.response)==null?void 0:_.status)===500?(F="Server error",H=((O=(A=V.response)==null?void 0:A.data)==null?void 0:O.message)||"The server encountered an error. Please try again later."):((T=V.response)==null?void 0:T.status)===400?(F="Invalid brief",H=((M=(k=V.response)==null?void 0:k.data)==null?void 0:M.message)||"Please check your audience brief and try again."):V.message&&(H=V.message)}else R instanceof Error&&(H=R.message);f(H),ce.error(F,{description:H,duration:5e3})}finally{u(!1)}},x=()=>{i(!s)};return a.jsx(sx,{...h,children:a.jsxs("form",{onSubmit:h.handleSubmit(e),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(ot,{control:h.control,name:"audienceBrief",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Audience Brief"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),a.jsx(on,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),a.jsx(it,{})]})}),a.jsx(ot,{control:h.control,name:"researchObjective",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Research Objective"}),a.jsx(st,{children:a.jsx(et,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),a.jsx(on,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),a.jsx(it,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||c||t,className:"flex items-center gap-2 hover-transition",children:c?a.jsxs(a.Fragment,{children:[a.jsx(zc,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):a.jsxs(a.Fragment,{children:[a.jsx(Rl,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(ot,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:y,...w}})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Customer Data (Optional)"}),a.jsx(st,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(CR,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload customer data for more accurate personas"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Supports PDF, Office docs, images, and more"}),a.jsx(_t,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:j=>{y(j.target.files)},className:"hidden",id:"data-file-input"}),a.jsxs(se,{type:"button",variant:"outline",size:"sm",onClick:()=>{var j;return(j=document.getElementById("data-file-input"))==null?void 0:j.click()},children:[a.jsx(kR,{className:"mr-2 h-4 w-4"}),"Select Files"]}),b&&b.length>0&&a.jsx("p",{className:"text-xs text-primary mt-2",children:b.length===1?b[0].name:`${b.length} files selected`})]})}),a.jsx(on,{children:"Upload existing customer data to create more realistic personas"}),a.jsx(it,{})]})}),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(Yw,{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(rf,{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(rf,{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(rf,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),a.jsxs("li",{className:"flex items-center",children:[a.jsx(rf,{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(Rl,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),a.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:x,className:"h-6 w-6 p-0 hover:bg-slate-200",title:s?"Expand suggestions":"Collapse suggestions",children:s?a.jsx(Ta,{className:"h-4 w-4"}):a.jsx(wp,{className:"h-4 w-4"})})]}),!s&&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:o.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(er,{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:o.audience_brief.map((b,y)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-blue-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},y))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),a.jsx("div",{children:o.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(Yw,{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:o.research_objective.map((b,y)=>a.jsxs("li",{className:"flex items-start gap-2",children:[a.jsx("span",{className:"text-green-600 mt-1.5 text-xs",children:"•"}),a.jsx("span",{className:"flex-1",children:b})]},y))})]}):a.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),o.audience_brief.length===0&&o.research_objective.length===0&&a.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),a.jsx(ot,{control:h.control,name:"llm_model",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"AI Model"}),a.jsxs(On,{onValueChange:b.onChange,defaultValue:b.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select AI model"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ye,{value:"gpt-4.1",children:"GPT-4.1"})]})]}),a.jsx(on,{children:"Choose which AI model to use for generating personas"}),a.jsx(it,{})]})}),a.jsx(ot,{control:h.control,name:"personaCount",render:({field:b})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Number of Personas to Generate"}),a.jsx(st,{children:a.jsx(_t,{type:"number",min:"1",max:"20",...b})}),a.jsx(on,{children:"How many synthetic users do you need for your research?"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"flex flex-col items-end",children:[a.jsx(se,{type:"submit",disabled:t,className:"min-w-36",children:t?a.jsxs(a.Fragment,{children:[a.jsx(zc,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):a.jsxs(a.Fragment,{children:[a.jsx(er,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),t&&a.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const Ke=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ke.displayName="Card";const Fr=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("flex flex-col space-y-1.5 p-6",e),...t}));Fr.displayName="CardHeader";const ts=v.forwardRef(({className:e,...t},n)=>a.jsx("h3",{ref:n,className:Me("text-2xl font-semibold leading-none tracking-tight",e),...t}));ts.displayName="CardTitle";const XN=v.forwardRef(({className:e,...t},n)=>a.jsx("p",{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));XN.displayName="CardDescription";const lt=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("p-6 pt-0",e),...t}));lt.displayName="CardContent";const YN=v.forwardRef(({className:e,...t},n)=>a.jsx("div",{ref:n,className:Me("flex items-center p-6 pt-0",e),...t}));YN.displayName="CardFooter";const NZ=e=>{const t=e==null?void 0:e.toLowerCase(),n="/semblance/";switch(t){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`}},sd=e=>e.avatar||NZ(e.gender);function ZN({user:e,selected:t=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:s,showAddToFolderButton:i=!1,onAddToFolder:o,showModalInsteadOfNavigate:l=!1,onOpenPersonaModal:c}){const u=Rn();v.useState(!1);const[d,f]=v.useState(e),h=e._id||e.id,p=x=>{x.stopPropagation(),u(`/synthetic-users/${h}`)};d.oceanTraits&&(d.oceanTraits.openness,d.oceanTraits.conscientiousness,d.oceanTraits.extraversion,d.oceanTraits.agreeableness,d.oceanTraits.neuroticism);const g=x=>{var w,j;const b=x.target;b.closest("button")&&((j=(w=b.closest("button"))==null?void 0:w.textContent)!=null&&j.includes("View Details"))||(s?s(x):n&&n(x))},m=x=>{x.stopPropagation(),l&&c?c(d):p(x)};return a.jsxs("div",{className:Me("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",t&&"selected ring-2 ring-primary"),onClick:g,children:[a.jsx("div",{className:"persona-card-overlay"}),a.jsx("div",{className:"persona-card-checkmark",children:a.jsx(Sa,{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:sd(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((x,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(MG,{className:"h-3 w-3"}),x]},b))})}),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((x,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(ja,{className:"h-3 w-3"}),x]},b))})}),a.jsx("div",{className:"mt-3 flex justify-end",children:a.jsx(se,{variant:"ghost",size:"sm",onClick:m,children:"View Details"})})]})]})})]})}var QN="Collapsible",[_Z,T4]=Ir(QN),[PZ,JN]=_Z(QN),$4=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...l}=e,[c=!1,u]=us({prop:r,defaultProp:s,onChange:o});return a.jsx(PZ,{scope:n,disabled:i,contentId:Cs(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:a.jsx(Xe.div,{"data-state":r_(c),"data-disabled":i?"":void 0,...l,ref:t})})});$4.displayName=QN;var I4="CollapsibleTrigger",e_=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=JN(I4,n);return a.jsx(Xe.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":r_(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:$e(e.onClick,s.onOpenToggle)})});e_.displayName=I4;var t_="CollapsibleContent",n_=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=JN(t_,e.__scopeCollapsible);return a.jsx(lr,{present:n||s.open,children:({present:i})=>a.jsx(CZ,{...r,ref:t,present:i})})});n_.displayName=t_;var CZ=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=e,o=JN(t_,n),[l,c]=v.useState(r),u=v.useRef(null),d=pt(t,u),f=v.useRef(0),h=f.current,p=v.useRef(0),g=p.current,m=o.open||l,x=v.useRef(m),b=v.useRef();return v.useEffect(()=>{const y=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(y)},[]),or(()=>{const y=u.current;if(y){b.current=b.current||{transitionDuration:y.style.transitionDuration,animationName:y.style.animationName},y.style.transitionDuration="0s",y.style.animationName="none";const w=y.getBoundingClientRect();f.current=w.height,p.current=w.width,x.current||(y.style.transitionDuration=b.current.transitionDuration,y.style.animationName=b.current.animationName),c(r)}},[o.open,r]),a.jsx(Xe.div,{"data-state":r_(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&s})});function r_(e){return e?"open":"closed"}var M4=$4,AZ=e_,EZ=n_;const Ep=M4,Op=e_,kp=n_;function OZ({generatedPersonas:e,selectedPersonas:t,isGenerating:n,onPersonaSelection:r,onRefinePersonas:s,onApprovePersonas:i,onBackToGenerator:o}){const l=Rn(),[c,u]=v.useState(""),[d,f]=v.useState(!1),h=p=>{l(`/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:[t.length," of ",e.length," selected"]})]}),a.jsx("div",{className:"space-y-4",children:e.map(p=>a.jsx(Ke,{className:`border ${t.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:a.jsx(lt,{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:t.includes(p.id),onChange:g=>{g.stopPropagation(),r(p.id)},className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),a.jsxs("div",{children:[a.jsx("h4",{className:"font-medium",children:p.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.age," • ",p.gender," • ",p.occupation]})]})]})}),a.jsx(ZN,{user:p,showDetailedDialog:!1,onClick:g=>{g.stopPropagation(),h(p.id)}})]})})},p.id))}),a.jsx("div",{className:"space-y-4 pt-4 border-t",children:a.jsxs("div",{children:[a.jsx("div",{className:"flex justify-between items-start mb-4",children:a.jsxs(se,{variant:"outline",onClick:o,children:[a.jsx(nh,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),a.jsxs(Ep,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[a.jsxs("div",{className:"flex justify-between items-center",children:[a.jsx(Op,{asChild:!0,children:a.jsxs(se,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(zc,{className:"h-4 w-4"}),"Refine Personas",a.jsx(Ta,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),a.jsxs(se,{onClick:i,disabled:t.length===0,children:[a.jsx(rf,{className:"mr-2 h-4 w-4"}),"Approve Selected (",t.length,")"]})]}),a.jsx(kp,{children:a.jsx(Ke,{className:"border shadow-sm w-full mt-4",children:a.jsx(lt,{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(et,{id:"refinement-prompt",placeholder:"Example: Make all personas 5 years younger, or ensure everyone is from different locations...",value:c,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(se,{onClick:()=>s(c),disabled:n||c.trim()==="",className:"w-full",children:[n?a.jsx(zc,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(zc,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function kZ(e,t,n,r,s,i){console.log(`generateSyntheticPersonas called with targetFolderId: ${s||"none"}`),console.log(`🔄 generateSyntheticPersonas using model: ${i||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),e.trim().length<10)throw new Error("Audience brief is too short. Please provide more context for better persona generation.");let o;if(r&&r.length>0){console.log(`Uploading ${r.length} customer data files...`);try{o=(await Xi.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${o}`)}catch(c){throw console.error("Failed to upload customer data:",c),new Error("Failed to upload customer data files. Please try again.")}}const l=await Xi.batchGenerateWithStages(e,t,n,.8,o,i);if(l.data){const c=l.data.partial_success===!0,u=l.data.personas&&l.data.personas.length>0,d=l.data.errors&&l.data.errors.length>0;if(u){if(console.log(`Generated ${l.data.personas.length} personas with two-stage process${d?` (${l.data.errors.length} failed)`:""}`),s){const h=l.data.personas.map(p=>({...p,folderId:s}));try{const p=h.map(g=>{if(g.id||g._id){const m=g._id||g.id;return console.log(`Updating persona ${g.name||m} with folder ID: ${s}`),$n.update(m,{...g,folderId:s}).catch(x=>(console.error(`Error updating folder ID for persona ${g.name||m}:`,x),null))}return Promise.resolve(null)});await Promise.allSettled(p),console.log(`Added ${h.length} personas to folder ID: ${s}`)}catch(p){console.error("Error updating personas with folder ID:",p)}if(o)try{await Xi.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return c||d?{...l.data,personas:h,length:h.length}:{...l.data,personas:h}}if(o)try{await Xi.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}if(c||d)return{...l.data.personas,length:l.data.personas.length,partial_success:c,errors:l.data.errors};if(o)try{await Xi.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return l.data.personas}else if(d){if(o)try{await Xi.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}throw new Error(`Failed to generate personas: ${l.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(o){if(customerDataSessionId)try{await Xi.cleanupCustomerData(customerDataSessionId),console.log(`Cleaned up customer data for session: ${customerDataSessionId}`)}catch(l){console.warn("Failed to cleanup customer data:",l)}throw console.error("Error generating AI personas:",o),o}}function R4(){const[e,t]=v.useState([]),n=async i=>{const o=[];for(const l of i){const c={...l};c._id&&typeof c._id=="string"&&c._id.startsWith("local-")&&delete c._id;const u=await $n.create(c);console.log("Persona saved to database:",u.data),o.push({...l,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}t(o)},r=async()=>{const i=await $n.getAll();return i&&i.data&&Array.isArray(i.data)?(console.log("Personas loaded from database:",i.data.length),i.data.map(o=>({...o,id:o._id||o.id,isDbPersona:!0}))):[]};return v.useEffect(()=>{(async()=>{const o=await r();t(o)})()},[]),{storedPersonas:e,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const i=await r();for(const o of i)o._id&&await $n.delete(o._id);t([])}}}function TZ({targetFolderId:e,targetFolderName:t}){const n=ci(),r=Rn(),{loadPersonas:s,savePersonas:i}=R4(),[o,l]=v.useState(!1),[c,u]=v.useState([]),[d,f]=v.useState([]),[h,p]=v.useState(!1),[g,m]=v.useState(0);v.useEffect(()=>{const S=new URLSearchParams(n.search),N=S.get("mode"),P=S.get("tab"),_=S.get("step");if(N==="create"&&P==="ai"&&_==="review"){const A=s();A.length>0&&(u(A),f(A.map(O=>O.id)),p(!0))}},[n,s]);async function x(S){var N,P,_,A,O,T,k,M,R,H;try{l(!0),m(0);const F=parseInt(S.personaCount);if(isNaN(F)||F<1||F>10){ce.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),l(!1);return}m(5);const V=setInterval(()=>{m(Q=>Q<90?Q+Math.random()*5:Q)},500),$=F<=2?"30-60 seconds":F<=4?"1-2 minutes":F<=6?"2-3 minutes":"3-5 minutes";F>4&&ce.info("Generation may take longer",{description:`Generating ${F} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),ce.info("Generating AI personas in parallel",{description:`Creating ${F} synthetic personas based on your brief. This may take ${$}. Please be patient.`,duration:1e4}),e&&t?(console.log(`Target folder for new personas: ID=${e}, Name=${t}`),ce.info(`Creating personas in "${t}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`🤖 Starting persona generation with model: ${S.llm_model||"gemini-2.5-pro"}`);const L=await kZ(S.audienceBrief,S.researchObjective,F,S.dataFile,e,S.llm_model),Y=L.personas||L;if(clearInterval(V),m(100),Y&&Y.length>0)console.log(`✅ Successfully generated ${Y.length} personas using model: ${S.llm_model||"gemini-2.5-pro"}`),L.partial_success||L.errors&&L.errors.length>0?(ce.success("Some personas generated successfully",{description:`${Y.length} synthetic personas were created using ${S.llm_model||"Gemini 2.5 Pro"}. ${((N=L.errors)==null?void 0:N.length)||0} failed due to timeout or other errors.`,duration:8e3}),L.errors&&L.errors.length>0&&setTimeout(()=>{ce.error("Some personas failed to generate",{description:`${L.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${e?" in the selected folder":""}.`,duration:1e4})},1e3)):ce.success("Personas generated and saved successfully",{description:`${Y.length} synthetic personas have been created using ${S.llm_model||"Gemini 2.5 Pro"} and saved ${e?`to the "${t}" folder`:"to the database"}.`}),r("/synthetic-users");else throw new Error("No personas were generated")}catch(F){console.error(`❌ Error generating personas using model: ${S.llm_model||"gemini-2.5-pro"}:`,F);let V="Please try again or adjust your parameters",$="Failed to generate personas";F.code==="ECONNABORTED"||(P=F.message)!=null&&P.includes("timeout")||((_=F.response)==null?void 0:_.status)===504?($="Generation timeout",V="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((A=F.response)==null?void 0:A.status)===500?($="Server error",(T=(O=F.response)==null?void 0:O.data)!=null&&T.message?V=F.response.data.message:(M=(k=F.response)==null?void 0:k.data)!=null&&M.error?V=F.response.data.error:V="The server encountered an error processing your request. Please try again later."):((R=F.response)==null?void 0:R.status)===401?($="Authentication required",V="Please log in to generate personas."):(H=F.message)!=null&&H.includes("504 Deadline Exceeded")?($="Generation timeout",V="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):F instanceof Error&&(V=F.message),ce.error($,{description:V,duration:6e3})}finally{setTimeout(()=>{l(!1),m(0)},500)}}const b=S=>{f(N=>N.includes(S)?N.filter(P=>P!==S):[...N,S])},y=(S,N)=>{const P=N.toLowerCase();return S.map(_=>{const A={..._};if(P.includes("younger")){const O=parseInt(A.age);A.age=(O-5).toString()}else if(P.includes("older")){const O=parseInt(A.age);A.age=(O+5).toString()}if(P.includes("different locations")&&(A.location=`${A.location} (Diversified)`),P.includes("more extroverted")?A.personality=`Extroverted, ${A.personality.toLowerCase()}`:P.includes("more introverted")&&(A.personality=`Introverted, ${A.personality.toLowerCase()}`),P.includes("diverse")){const O=["tech-savvy","traditional","innovative","conservative","creative"],T=O[Math.floor(Math.random()*O.length)];A.personality=`${T}, ${A.personality}`}return A})},w=S=>{if(!S.trim()){ce.error("Please provide refinement instructions");return}l(!0),setTimeout(()=>{try{const N=c.filter(A=>d.includes(A.id)),P=y(N,S),_=c.map(A=>P.find(T=>T.id===A.id)||A);u(_),l(!1),i(_),ce.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(N){console.error("Error refining personas:",N),ce.error("Failed to refine personas",{description:"Please try different instructions"}),l(!1)}},1500)},j=()=>{const S=c.filter(N=>d.includes(N.id));ce.success(`${S.length} personas approved`,{description:"Added to your synthetic persona library"}),i(S),r("/synthetic-users")};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(er,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),o&&a.jsxs("div",{className:"mb-6",children:[a.jsxs("div",{className:"flex justify-between items-center mb-2",children:[a.jsx("span",{className:"text-sm font-medium",children:"Generating personas in parallel..."}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(g),"%"]})]}),a.jsx(fl,{value:g,className:"h-2"})]}),h?a.jsx(OZ,{generatedPersonas:c,selectedPersonas:d,isGenerating:o,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:j,onBackToGenerator:()=>p(!1)}):a.jsx(SZ,{onSubmit:x,isGenerating:o})]})}const Mo=new Map;function D4(e){const{id:t,title:n,description:r,type:s="default",duration:i}=e;let o;switch(s){case"success":o=ce.success(n,{description:r,duration:i});break;case"error":o=ce.error(n,{description:r,duration:i});break;case"warning":o=ce.warning(n,{description:r,duration:i});break;case"info":o=ce.info(n,{description:r,duration:i});break;default:o=ce(n,{description:r,duration:i});break}return Mo.set(t,o.toString()),t}function $Z(e,t){const n=Mo.get(e);if(!n)return console.warn(`Toast with ID "${e}" not found. Creating new toast instead.`),D4({id:e,...t,title:t.title||"Updated"}),!1;const{title:r,description:s,type:i="default",duration:o}=t;ce.dismiss(n);let l;switch(i){case"success":l=ce.success(r,{description:s,duration:o});break;case"error":l=ce.error(r,{description:s,duration:o});break;case"warning":l=ce.warning(r,{description:s,duration:o});break;case"info":l=ce.info(r,{description:s,duration:o});break;default:l=ce(r,{description:s,duration:o});break}return Mo.set(e,l.toString()),!0}function IZ(e){const t=Mo.get(e);return t?(ce.dismiss(t),Mo.delete(e),!0):(console.warn(`Toast with ID "${e}" not found.`),!1)}function MZ(e){return Mo.has(e)}function RZ(){Mo.forEach(e=>{ce.dismiss(e)}),Mo.clear()}const Qe={success:ce.success,error:ce.error,warning:ce.warning,info:ce.info,loading:ce.loading,dismiss:ce.dismiss,createPersistent:D4,updatePersistent:$Z,dismissPersistent:IZ,hasPersistent:MZ,dismissAllPersistent:RZ};var L4=["PageUp","PageDown"],F4=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],B4={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},id="Slider",[y1,DZ,LZ]=Pp(id),[z4,POe]=Ir(id,[LZ]),[FZ,fx]=z4(id),U4=v.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=e,x=v.useRef(new Set),b=v.useRef(0),w=o==="horizontal"?BZ:zZ,[j=[],S]=us({prop:d,defaultProp:u,onChange:T=>{var M;(M=[...x.current][b.current])==null||M.focus(),f(T)}}),N=v.useRef(j);function P(T){const k=GZ(j,T);O(T,k)}function _(T){O(T,b.current)}function A(){const T=N.current[b.current];j[b.current]!==T&&h(j)}function O(T,k,{commit:M}={commit:!1}){const R=YZ(i),H=ZZ(Math.round((T-r)/i)*i+r,R),F=xh(H,[r,s]);S((V=[])=>{const $=WZ(V,F,k);if(XZ($,c*i)){b.current=$.indexOf(F);const L=String($)!==String(V);return L&&M&&h($),L?$:V}else return V})}return a.jsx(FZ,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:b,thumbs:x.current,values:j,orientation:o,form:g,children:a.jsx(y1.Provider,{scope:e.__scopeSlider,children:a.jsx(y1.Slot,{scope:e.__scopeSlider,children:a.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...m,ref:t,onPointerDown:$e(m.onPointerDown,()=>{l||(N.current=j)}),min:r,max:s,inverted:p,onSlideStart:l?void 0:P,onSlideMove:l?void 0:_,onSlideEnd:l?void 0:A,onHomeKeyDown:()=>!l&&O(r,0,{commit:!0}),onEndKeyDown:()=>!l&&O(s,j.length-1,{commit:!0}),onStepKeyDown:({event:T,direction:k})=>{if(!l){const H=L4.includes(T.key)||T.shiftKey&&F4.includes(T.key)?10:1,F=b.current,V=j[F],$=i*H*k;O(V+$,F,{commit:!0})}}})})})})});U4.displayName=id;var[V4,W4]=z4(id,{startEdge:"left",endEdge:"right",size:"width",direction:1}),BZ=v.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=v.useState(null),p=pt(t,w=>h(w)),g=v.useRef(),m=Uo(s),x=m==="ltr",b=x&&!i||!x&&i;function y(w){const j=g.current||f.getBoundingClientRect(),S=[0,j.width],P=s_(S,b?[n,r]:[r,n]);return g.current=j,P(w-j.left)}return a.jsx(V4,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(H4,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const j=y(w.clientX);o==null||o(j)},onSlideMove:w=>{const j=y(w.clientX);l==null||l(j)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const S=B4[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:S?-1:1})}})})}),zZ=v.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=e,d=v.useRef(null),f=pt(t,d),h=v.useRef(),p=!s;function g(m){const x=h.current||d.current.getBoundingClientRect(),b=[0,x.height],w=s_(b,p?[r,n]:[n,r]);return h.current=x,w(m-x.top)}return a.jsx(V4,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(H4,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const x=g(m.clientY);i==null||i(x)},onSlideMove:m=>{const x=g(m.clientY);o==null||o(x)},onSlideEnd:()=>{h.current=void 0,l==null||l()},onStepKeyDown:m=>{const b=B4[p?"from-bottom":"from-top"].includes(m.key);c==null||c({event:m,direction:b?-1:1})}})})}),H4=v.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...u}=e,d=fx(id,n);return a.jsx(Xe.span,{...u,ref:t,onKeyDown:$e(e.onKeyDown,f=>{f.key==="Home"?(o(f),f.preventDefault()):f.key==="End"?(l(f),f.preventDefault()):L4.concat(F4).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:$e(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:$e(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&s(f)}),onPointerUp:$e(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),i(f))})})}),G4="SliderTrack",q4=v.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=fx(G4,n);return a.jsx(Xe.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});q4.displayName=G4;var x1="SliderRange",K4=v.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=fx(x1,n),i=W4(x1,n),o=v.useRef(null),l=pt(t,o),c=s.values.length,u=s.values.map(h=>Y4(h,s.min,s.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return a.jsx(Xe.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...e.style,[i.startEdge]:d+"%",[i.endEdge]:f+"%"}})});K4.displayName=x1;var b1="SliderThumb",X4=v.forwardRef((e,t)=>{const n=DZ(e.__scopeSlider),[r,s]=v.useState(null),i=pt(t,l=>s(l)),o=v.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return a.jsx(UZ,{...e,ref:i,index:o})}),UZ=v.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...i}=e,o=fx(b1,n),l=W4(b1,n),[c,u]=v.useState(null),d=pt(t,y=>u(y)),f=c?o.form||!!c.closest("form"):!0,h=bp(c),p=o.values[r],g=p===void 0?0:Y4(p,o.min,o.max),m=HZ(r,o.values.length),x=h==null?void 0:h[l.size],b=x?qZ(x,g,l.direction):0;return v.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[a.jsx(y1.ItemSlot,{scope:e.__scopeSlider,children:a.jsx(Xe.span,{role:"slider","aria-label":e["aria-label"]||m,"aria-valuemin":o.min,"aria-valuenow":p,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:d,style:p===void 0?{display:"none"}:e.style,onFocus:$e(e.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),f&&a.jsx(VZ,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:p},r)]})});X4.displayName=b1;var VZ=e=>{const{value:t,...n}=e,r=v.useRef(null),s=Cp(t);return v.useEffect(()=>{const i=r.current,o=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(o,"value").set;if(s!==t&&c){const u=new Event("input",{bubbles:!0});c.call(i,t),i.dispatchEvent(u)}},[s,t]),a.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:t})};function WZ(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,i)=>s-i)}function Y4(e,t,n){const i=100/(n-t)*(e-t);return xh(i,[0,100])}function HZ(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function GZ(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function qZ(e,t,n){const r=e/2,i=s_([0,50],[0,r]);return(r-i(t)*n)*n}function KZ(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function XZ(e,t){if(t>0){const n=KZ(e);return Math.min(...n)>=t}return!0}function s_(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function YZ(e){return(String(e).split(".")[1]||"").length}function ZZ(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var Z4=U4,QZ=q4,JZ=K4,eQ=X4;const Bn=v.forwardRef(({className:e,...t},n)=>a.jsxs(Z4,{ref:n,className:Me("relative flex w-full touch-none select-none items-center",e),...t,children:[a.jsx(QZ,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(JZ,{className:"absolute h-full bg-primary"})}),a.jsx(eQ,{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"})]}));Bn.displayName=Z4.displayName;var i_="Switch",[tQ,COe]=Ir(i_),[nQ,rQ]=tQ(i_),Q4=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=v.useState(null),g=pt(t,w=>p(w)),m=v.useRef(!1),x=h?d||!!h.closest("form"):!0,[b=!1,y]=us({prop:s,defaultProp:i,onChange:u});return a.jsxs(nQ,{scope:n,checked:b,disabled:l,children:[a.jsx(Xe.button,{type:"button",role:"switch","aria-checked":b,"aria-required":o,"data-state":tL(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onClick:$e(e.onClick,w=>{y(j=>!j),x&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),x&&a.jsx(sQ,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Q4.displayName=i_;var J4="SwitchThumb",eL=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=rQ(J4,n);return a.jsx(Xe.span,{"data-state":tL(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});eL.displayName=J4;var sQ=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,i=v.useRef(null),o=Cp(n),l=bp(t);return v.useEffect(()=>{const c=i.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[o,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function tL(e){return e?"checked":"unchecked"}var nL=Q4,iQ=eL;const bh=v.forwardRef(({className:e,...t},n)=>a.jsx(nL,{className:Me("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",e),...t,ref:n,children:a.jsx(iQ,{className:Me("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")})}));bh.displayName=nL.displayName;function aQ(e,t=[]){let n=[];function r(i,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,x=v.useMemo(()=>g,Object.values(g));return a.jsx(m.Provider,{value:x,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const s=()=>{const i=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,oQ(s,...t)]}function oQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var lb="rovingFocusGroup.onEntryFocus",lQ={bubbles:!1,cancelable:!0},hx="RovingFocusGroup",[w1,rL,cQ]=Pp(hx),[uQ,ad]=aQ(hx,[cQ]),[dQ,fQ]=uQ(hx),sL=v.forwardRef((e,t)=>a.jsx(w1.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(w1.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(hQ,{...e,ref:t})})}));sL.displayName=hx;var hQ=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=v.useRef(null),p=pt(t,h),g=Uo(i),[m=null,x]=us({prop:o,defaultProp:l,onChange:c}),[b,y]=v.useState(!1),w=Vn(u),j=rL(n),S=v.useRef(!1),[N,P]=v.useState(0);return v.useEffect(()=>{const _=h.current;if(_)return _.addEventListener(lb,w),()=>_.removeEventListener(lb,w)},[w]),a.jsx(dQ,{scope:n,orientation:r,dir:g,loop:s,currentTabStopId:m,onItemFocus:v.useCallback(_=>x(_),[x]),onItemShiftTab:v.useCallback(()=>y(!0),[]),onFocusableItemAdd:v.useCallback(()=>P(_=>_+1),[]),onFocusableItemRemove:v.useCallback(()=>P(_=>_-1),[]),children:a.jsx(Xe.div,{tabIndex:b||N===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:$e(e.onMouseDown,()=>{S.current=!0}),onFocus:$e(e.onFocus,_=>{const A=!S.current;if(_.target===_.currentTarget&&A&&!b){const O=new CustomEvent(lb,lQ);if(_.currentTarget.dispatchEvent(O),!O.defaultPrevented){const T=j().filter(F=>F.focusable),k=T.find(F=>F.active),M=T.find(F=>F.id===m),H=[k,M,...T].filter(Boolean).map(F=>F.ref.current);oL(H,d)}}S.current=!1}),onBlur:$e(e.onBlur,()=>y(!1))})})}),iL="RovingFocusGroupItem",aL=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,...o}=e,l=Cs(),c=i||l,u=fQ(iL,n),d=u.currentTabStopId===c,f=rL(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),a.jsx(w1.ItemSlot,{scope:n,id:c,focusable:r,active:s,children:a.jsx(Xe.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:$e(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:$e(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:$e(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=gQ(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=f().filter(y=>y.focusable).map(y=>y.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const y=b.indexOf(g.currentTarget);b=u.loop?vQ(b,y+1):b.slice(y+1)}setTimeout(()=>oL(b))}})})})});aL.displayName=iL;var pQ={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mQ(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function gQ(e,t,n){const r=mQ(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return pQ[r]}function oL(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function vQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var a_=sL,o_=aL,l_="Tabs",[yQ,AOe]=Ir(l_,[ad]),lL=ad(),[xQ,c_]=yQ(l_),cL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Uo(l),[f,h]=us({prop:r,onChange:s,defaultProp:i});return a.jsx(xQ,{scope:n,baseId:Cs(),value:f,onValueChange:h,orientation:o,dir:d,activationMode:c,children:a.jsx(Xe.div,{dir:d,"data-orientation":o,...u,ref:t})})});cL.displayName=l_;var uL="TabsList",dL=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,i=c_(uL,n),o=lL(n);return a.jsx(a_,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Xe.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:t})})});dL.displayName=uL;var fL="TabsTrigger",hL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=e,o=c_(fL,n),l=lL(n),c=gL(o.baseId,r),u=vL(o.baseId,r),d=r===o.value;return a.jsx(o_,{asChild:!0,...l,focusable:!s,active:d,children:a.jsx(Xe.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:t,onMouseDown:$e(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:$e(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:$e(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!s&&f&&o.onValueChange(r)})})})});hL.displayName=fL;var pL="TabsContent",mL=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=e,l=c_(pL,n),c=gL(l.baseId,r),u=vL(l.baseId,r),d=r===l.value,f=v.useRef(d);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),a.jsx(lr,{present:s||d,children:({present:h})=>a.jsx(Xe.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});mL.displayName=pL;function gL(e,t){return`${e}-trigger-${t}`}function vL(e,t){return`${e}-content-${t}`}var bQ=cL,yL=dL,xL=hL,bL=mL;const Ho=bQ,$a=v.forwardRef(({className:e,...t},n)=>a.jsx(yL,{ref:n,className:Me("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));$a.displayName=yL.displayName;const Wt=v.forwardRef(({className:e,...t},n)=>a.jsx(xL,{ref:n,className:Me("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",e),...t}));Wt.displayName=xL.displayName;const Ht=v.forwardRef(({className:e,...t},n)=>a.jsx(bL,{ref:n,className:Me("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Ht.displayName=bL.displayName;const wQ=Re.object({name:Re.string().min(2,{message:"Name must be at least 2 characters."}),age:Re.string().min(1,{message:"Age is required."}),gender:Re.string().min(1,{message:"Gender is required."}),occupation:Re.string().min(2,{message:"Occupation is required."}),education:Re.string().min(1,{message:"Education is required."}),location:Re.string().min(2,{message:"Location is required."}),ethnicity:Re.string().optional(),personality:Re.string(),interests:Re.string(),hasPurchasingPower:Re.boolean().optional(),hasChildren:Re.boolean().optional(),techSavviness:Re.number().min(0).max(100),brandLoyalty:Re.number().min(0).max(100),priceConsciousness:Re.number().min(0).max(100),environmentalConcern:Re.number().min(0).max(100),socialGrade:Re.string().optional(),householdIncome:Re.string().optional(),householdComposition:Re.string().optional(),livingSituation:Re.string().optional(),goals:Re.array(Re.string()).optional(),frustrations:Re.array(Re.string()).optional(),motivations:Re.array(Re.string()).optional(),scenarios:Re.array(Re.string()).optional(),scenarioType:Re.string().optional(),oceanTraits:Re.object({openness:Re.number().min(0).max(100),conscientiousness:Re.number().min(0).max(100),extraversion:Re.number().min(0).max(100),agreeableness:Re.number().min(0).max(100),neuroticism:Re.number().min(0).max(100)}).optional(),thinkFeelDo:Re.object({thinks:Re.array(Re.string()),feels:Re.array(Re.string()),does:Re.array(Re.string())}).optional(),mediaConsumption:Re.string().optional(),deviceUsage:Re.string().optional(),shoppingHabits:Re.string().optional(),brandPreferences:Re.string().optional(),communicationPreferences:Re.string().optional(),paymentMethods:Re.string().optional(),purchaseBehaviour:Re.string().optional(),coreValues:Re.string().optional(),lifestyleChoices:Re.string().optional(),socialActivities:Re.string().optional(),categoryKnowledge:Re.string().optional(),decisionInfluences:Re.string().optional(),painPoints:Re.string().optional(),journeyContext:Re.string().optional(),keyTouchpoints:Re.string().optional(),selfDeterminationNeeds:Re.object({autonomy:Re.string(),competence:Re.string(),relatedness:Re.string()}).optional(),fears:Re.array(Re.string()).optional(),narrative:Re.string().optional(),additionalInformation:Re.string().optional()});function jQ({targetFolderId:e,targetFolderName:t}){const[n,r]=v.useState(1),[s,i]=v.useState(!1),[o,l]=v.useState(!1),[c,u]=v.useState(0),d=Rn(),{isAuthenticated:f,login:h}=Zl();v.useEffect(()=>{u(0)},[]),v.useEffect(()=>{(async()=>{if(!f&&!o){l(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const P=localStorage.getItem("auth_token");P?(console.log("Token successfully stored:",P.substring(0,10)+"..."),Qe.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),Qe.error("Authentication problem, token not stored"))}catch(P){console.error("Auto login failed:",P)}finally{l(!1)}}})()},[]);const p=tx({resolver:nx(wQ),defaultValues:{name:"",age:"",gender:"",occupation:"",education:"",location:"",ethnicity:"",personality:"",interests:"",hasPurchasingPower:!1,hasChildren:!1,techSavviness:50,brandLoyalty:50,priceConsciousness:50,environmentalConcern:50,socialGrade:"",householdIncome:"",householdComposition:"",livingSituation:"",goals:[],frustrations:[],motivations:[],scenarios:[],scenarioType:"",oceanTraits:{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:{thinks:[],feels:[],does:[]},mediaConsumption:"",deviceUsage:"",shoppingHabits:"",brandPreferences:"",communicationPreferences:"",paymentMethods:"",purchaseBehaviour:"",coreValues:"",lifestyleChoices:"",socialActivities:"",categoryKnowledge:"",decisionInfluences:"",painPoints:"",journeyContext:"",keyTouchpoints:"",selfDeterminationNeeds:{autonomy:"",competence:"",relatedness:""},fears:[],narrative:"",additionalInformation:""}}),g=N=>{const P=p.getValues(N)||[];p.setValue(N,[...P,""])},m=(N,P,_)=>{const O=[...p.getValues(N)||[]];O[P]=_,p.setValue(N,O)},x=(N,P)=>{const A=[...p.getValues(N)||[]];A.splice(P,1),p.setValue(N,A)},b=N=>{const P=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},_={...P,[N]:[...P[N]||[],""]};p.setValue("thinkFeelDo",_)},y=(N,P,_)=>{const A=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},O=[...A[N]||[]];O[P]=_;const T={...A,[N]:O};p.setValue("thinkFeelDo",T)},w=(N,P)=>{const _=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},A=[..._[N]||[]];A.splice(P,1);const O={..._,[N]:A};p.setValue("thinkFeelDo",O)},j=(N,P)=>{const A={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[N]:P};p.setValue("oceanTraits",A)};async function S(N,P=!1){var _,A,O,T,k;if(P&&c>=1){console.log("Max retry attempts reached, stopping retry loop"),Qe.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),i(!1);return}P?(u(M=>M+1),console.log(`Retry attempt ${c+1}`)):u(0),i(!0);try{if(!f)try{console.log("Not authenticated, attempting login with default credentials before submission"),await h("user","pass"),console.log("Login successful before persona creation")}catch(L){console.error("Login failed before persona creation:",L),Qe.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),i(!1);return}const M=`persona-generation-${Date.now()}`,R=e&&t?` in "${t}" folder`:"",H=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${H}${R}`),Qe.createPersistent({id:M,title:`Generating ${H}...`,description:`Creating synthetic user profile${n>1?"s":""}${R}`,type:"info"});const F={...N,oceanTraits:N.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:N.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:e||void 0},V={id:`temp-${Date.now()}`,...F},$=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if($.push(V),localStorage.setItem("tempPersonas",JSON.stringify($)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),Qe.error("Authentication required",{description:"No valid token found. Please log in again."});try{console.log("No token found, attempting new login"),await h("user","pass"),console.log("Login successful, token:",((_=localStorage.getItem("auth_token"))==null?void 0:_.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 Y=await $n.create(F);console.log("Persona created successfully:",Y),Qe.updatePersistent(M,{title:"Synthetic user created successfully",description:`Created profile for ${N.name}`,type:"success"})}catch(L){throw console.error("Error creating persona via API:",L),L.response&&L.response.status===401&&Qe.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),L}else{const L=[];L.push(F);for(let Y=1;Y{d("/synthetic-users")},300)}catch(M){if(console.error("Error creating personas:",M),M.response&&M.response.status===401||M.message&&M.message.includes("Authentication failed")&&c<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const R=await a1.login("user","pass");if((O=R==null?void 0:R.data)!=null&&O.access_token){localStorage.setItem("auth_token",R.data.access_token),localStorage.setItem("user",JSON.stringify(R.data.user)),console.log("Manual login successful, got new token:",R.data.access_token.substring(0,10)+"..."),Qe.info("Logged in with default account, retrying submission..."),setTimeout(()=>{S(N,!0)},500);return}else throw new Error("No access token received")}catch(R){console.error("Login retry failed:",R),Qe.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else Qe.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((k=(T=M.response)==null?void 0:T.data)==null?void 0:k.message)||M.message||"An unexpected error occurred",type:"error"})}finally{i(!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(se,{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(er,{size:16,className:"text-muted-foreground"}),a.jsx("span",{className:"text-sm font-medium",children:n})]}),a.jsx(se,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),a.jsx(sx,{...p,children:a.jsxs("form",{onSubmit:p.handleSubmit(S),className:"space-y-6",children:[a.jsxs(Ho,{defaultValue:"basic",children:[a.jsxs($a,{className:"grid w-full grid-cols-6",children:[a.jsx(Wt,{value:"basic",children:"Basic"}),a.jsx(Wt,{value:"cooper",children:"Cooper"}),a.jsx(Wt,{value:"personality",children:"Personality"}),a.jsx(Wt,{value:"demographics",children:"Demographics"}),a.jsx(Wt,{value:"lifestyle",children:"Lifestyle"}),a.jsx(Wt,{value:"extended",children:"Extended"})]}),a.jsx(Ht,{value:"basic",className:"mt-6",children:a.jsx(Ke,{children:a.jsx(lt,{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(ot,{control:p.control,name:"name",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Name"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Jane Smith",...N})}),a.jsx(it,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsx(ot,{control:p.control,name:"age",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Age Range"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select age range"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"18-24",children:"18-24"}),a.jsx(ye,{value:"25-34",children:"25-34"}),a.jsx(ye,{value:"35-44",children:"35-44"}),a.jsx(ye,{value:"45-54",children:"45-54"}),a.jsx(ye,{value:"55-64",children:"55-64"}),a.jsx(ye,{value:"65+",children:"65+"})]})]}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"gender",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Gender"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select gender"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Male",children:"Male"}),a.jsx(ye,{value:"Female",children:"Female"}),a.jsx(ye,{value:"Non-binary",children:"Non-binary"}),a.jsx(ye,{value:"Other",children:"Other"})]})]}),a.jsx(it,{})]})})]}),a.jsx(ot,{control:p.control,name:"occupation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Occupation"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Software Engineer",...N})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"education",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Education"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select education level"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"High School",children:"High School"}),a.jsx(ye,{value:"Some College",children:"Some College"}),a.jsx(ye,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(ye,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(ye,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(ye,{value:"PhD",children:"PhD"})]})]}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"location",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Location"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"New York, USA",...N})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"ethnicity",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Ethnicity (Optional)"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select ethnicity"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"white",children:"White"}),a.jsx(ye,{value:"black",children:"Black"}),a.jsx(ye,{value:"asian",children:"Asian"}),a.jsx(ye,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(ye,{value:"native-american",children:"Native American"}),a.jsx(ye,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(ye,{value:"mixed",children:"Mixed"}),a.jsx(ye,{value:"other",children:"Other"}),a.jsx(ye,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),a.jsx(it,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"personality",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Personality Traits"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Curious, analytical, detail-oriented",...N,rows:3})}),a.jsx(on,{children:"Describe key personality traits that define this user"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"interests",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Interests"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Technology, fitness, cooking, travel",...N,rows:3})}),a.jsx(on,{children:"List interests, hobbies and activities this user enjoys"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),a.jsx(ot,{control:p.control,name:"techSavviness",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Tech Savviness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(st,{children:a.jsx(Bn,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"brandLoyalty",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Brand Loyalty"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(st,{children:a.jsx(Bn,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"priceConsciousness",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Price Consciousness"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(st,{children:a.jsx(Bn,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"environmentalConcern",render:({field:N})=>a.jsxs(nt,{children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx(rt,{children:"Environmental Concern"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),a.jsx(st,{children:a.jsx(Bn,{min:0,max:100,step:1,value:[N.value],onValueChange:P=>N.onChange(P[0])})}),a.jsx(it,{})]})}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[a.jsx(ot,{control:p.control,name:"hasPurchasingPower",render:({field:N})=>a.jsxs(nt,{className:"flex items-center justify-between",children:[a.jsx(rt,{children:"Purchasing Power"}),a.jsx(st,{children:a.jsx(bh,{checked:N.value,onCheckedChange:N.onChange})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"hasChildren",render:({field:N})=>a.jsxs(nt,{className:"flex items-center justify-between",children:[a.jsx(rt,{children:"Has Children"}),a.jsx(st,{children:a.jsx(bh,{checked:N.value,onCheckedChange:N.onChange})}),a.jsx(it,{})]})})]})]})]})]})})})}),a.jsxs(Ht,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{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((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>m("goals",P,_.target.value),placeholder:"Enter a goal"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("goals",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[a.jsx(pr,{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((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>m("frustrations",P,_.target.value),placeholder:"Enter a frustration"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("frustrations",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[a.jsx(pr,{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((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>m("motivations",P,_.target.value),placeholder:"Enter a motivation"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("motivations",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(Ke,{children:a.jsxs(lt,{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((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>y("thinks",P,_.target.value),placeholder:"What they think"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[a.jsx(pr,{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((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>y("feels",P,_.target.value),placeholder:"What they feel"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[a.jsx(pr,{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((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>y("does",P,_.target.value),placeholder:"What they do"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(Ke,{children:a.jsx(lt,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"scenarioType",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Scenario Section Title"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Life Scenarios",...N})}),a.jsx(on,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),a.jsx(it,{})]})}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((N,P)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(et,{value:N,onChange:_=>m("scenarios",P,_.target.value),rows:2,placeholder:"Describe a usage scenario"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("scenarios",P),className:"mt-2",children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),a.jsx(Ht,{value:"personality",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{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(Bn,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:N=>j("openness",N[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(Bn,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:N=>j("conscientiousness",N[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(Bn,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:N=>j("extraversion",N[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(Bn,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:N=>j("agreeableness",N[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(Bn,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:N=>j("neuroticism",N[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(Ht,{value:"demographics",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{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(ot,{control:p.control,name:"socialGrade",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Social Grade"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select social grade"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"A",children:"A - Higher managerial"}),a.jsx(ye,{value:"B",children:"B - Intermediate managerial"}),a.jsx(ye,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(ye,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(ye,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(ye,{value:"E",children:"E - State pensioners, unemployed"})]})]}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"householdIncome",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Household Income"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select income range"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Under $25k",children:"Under $25,000"}),a.jsx(ye,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(ye,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(ye,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(ye,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(ye,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(ye,{value:"Over $250k",children:"Over $250,000"}),a.jsx(ye,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),a.jsx(it,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"householdComposition",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Household Composition"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select household type"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Single person",children:"Single person"}),a.jsx(ye,{value:"Couple without children",children:"Couple without children"}),a.jsx(ye,{value:"Couple with children",children:"Couple with children"}),a.jsx(ye,{value:"Single parent",children:"Single parent"}),a.jsx(ye,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(ye,{value:"Shared housing",children:"Shared housing"}),a.jsx(ye,{value:"Other",children:"Other"})]})]}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"livingSituation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Living Situation"}),a.jsxs(On,{onValueChange:N.onChange,defaultValue:N.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select living situation"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Own home",children:"Own home"}),a.jsx(ye,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(ye,{value:"Rent house",children:"Rent house"}),a.jsx(ye,{value:"Live with family",children:"Live with family"}),a.jsx(ye,{value:"Student housing",children:"Student housing"}),a.jsx(ye,{value:"Assisted living",children:"Assisted living"}),a.jsx(ye,{value:"Other",children:"Other"})]})]}),a.jsx(it,{})]})})]})]})]})})}),a.jsx(Ht,{value:"lifestyle",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{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(ot,{control:p.control,name:"mediaConsumption",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Media Consumption"}),a.jsx(st,{children:a.jsx(et,{placeholder:"TV shows, podcasts, news sources, social media platforms",...N,rows:3})}),a.jsx(on,{children:"Describe media consumption habits and preferences"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"deviceUsage",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Device Usage"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",...N,rows:3})}),a.jsx(on,{children:"Primary devices and usage patterns"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"shoppingHabits",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Shopping Habits"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Online vs in-store, frequency, preferred retailers",...N,rows:3})}),a.jsx(on,{children:"Shopping behavior and preferences"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"brandPreferences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Brand Preferences"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Favorite brands, brand values alignment",...N,rows:3})}),a.jsx(on,{children:"Preferred brands and reasoning"}),a.jsx(it,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"communicationPreferences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Communication Preferences"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Email, phone, text, video calls, in-person",...N,rows:3})}),a.jsx(on,{children:"Preferred communication methods and channels"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"paymentMethods",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Payment Methods"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Credit cards, digital wallets, cash, BNPL",...N,rows:3})}),a.jsx(on,{children:"Preferred payment methods and financial tools"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"purchaseBehaviour",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Purchase Behavior"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Research habits, decision factors, impulse vs planned buying",...N,rows:3})}),a.jsx(on,{children:"How they approach making purchase decisions"}),a.jsx(it,{})]})})]})]})]})})}),a.jsxs(Ht,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{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(ot,{control:p.control,name:"coreValues",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Core Values"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Key principles and values that guide decisions",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"lifestyleChoices",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Lifestyle Choices"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Health, fitness, diet, work-life balance preferences",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"socialActivities",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Social Activities"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Social hobbies, community involvement, networking",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"categoryKnowledge",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Category Knowledge"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Expertise in specific product/service categories",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"decisionInfluences",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Decision Influences"}),a.jsx(st,{children:a.jsx(et,{placeholder:"What factors most influence their decisions",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"painPoints",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Pain Points"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Common challenges and friction points",...N,rows:3})}),a.jsx(it,{})]})})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(ot,{control:p.control,name:"journeyContext",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Journey Context"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Current life stage and contextual factors",...N,rows:3})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"keyTouchpoints",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Key Touchpoints"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Important interaction points and channels",...N,rows:3})}),a.jsx(it,{})]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),a.jsx(ot,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Autonomy"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Need for independence and self-direction",...N,rows:2})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Competence"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Need to feel capable and effective",...N,rows:2})}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Relatedness"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Need for connection and belonging",...N,rows:2})}),a.jsx(it,{})]})})]})]})]})]})}),a.jsx(Ke,{children:a.jsx(lt,{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((N,P)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:N,onChange:_=>m("fears",P,_.target.value),placeholder:"Enter a fear or concern"}),a.jsx(se,{variant:"ghost",size:"icon",type:"button",onClick:()=>x("fears",P),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},P)),a.jsxs(se,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),a.jsx(ot,{control:p.control,name:"narrative",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Personal Narrative"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Personal story, background, key life experiences",...N,rows:4})}),a.jsx(on,{children:"A brief narrative that captures their personal story"}),a.jsx(it,{})]})}),a.jsx(ot,{control:p.control,name:"additionalInformation",render:({field:N})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Additional Information"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Any other relevant details or context",...N,rows:4})}),a.jsx(on,{children:"Additional context or details not covered elsewhere"}),a.jsx(it,{})]})})]})})})]})]}),a.jsxs("div",{className:"flex justify-end space-x-2",children:[a.jsx(se,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),a.jsxs(se,{type:"submit",disabled:s,children:[s?a.jsx(NG,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(CN,{className:"mr-2 h-4 w-4"}),s?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var j1=["Enter"," "],SQ=["ArrowDown","PageUp","Home"],wL=["ArrowUp","PageDown","End"],NQ=[...SQ,...wL],_Q={ltr:[...j1,"ArrowRight"],rtl:[...j1,"ArrowLeft"]},PQ={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Tp="Menu",[wh,CQ,AQ]=Pp(Tp),[Ql,jL]=Ir(Tp,[AQ,Yu,ad]),px=Yu(),SL=ad(),[EQ,Jl]=Ql(Tp),[OQ,$p]=Ql(Tp),NL=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=e,l=px(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Vn(i),h=Uo(s);return v.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),a.jsx(qM,{...l,children:a.jsx(EQ,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:a.jsx(OQ,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:o,children:r})})})};NL.displayName=Tp;var kQ="MenuAnchor",u_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=px(n);return a.jsx(pN,{...s,...r,ref:t})});u_.displayName=kQ;var d_="MenuPortal",[TQ,_L]=Ql(d_,{forceMount:void 0}),PL=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,i=Jl(d_,t);return a.jsx(TQ,{scope:t,forceMount:n,children:a.jsx(lr,{present:n||i.open,children:a.jsx(By,{asChild:!0,container:s,children:r})})})};PL.displayName=d_;var As="MenuContent",[$Q,f_]=Ql(As),CL=v.forwardRef((e,t)=>{const n=_L(As,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=Jl(As,e.__scopeMenu),o=$p(As,e.__scopeMenu);return a.jsx(wh.Provider,{scope:e.__scopeMenu,children:a.jsx(lr,{present:r||i.open,children:a.jsx(wh.Slot,{scope:e.__scopeMenu,children:o.modal?a.jsx(IQ,{...s,ref:t}):a.jsx(MQ,{...s,ref:t})})})})}),IQ=v.forwardRef((e,t)=>{const n=Jl(As,e.__scopeMenu),r=v.useRef(null),s=pt(t,r);return v.useEffect(()=>{const i=r.current;if(i)return qN(i)},[]),a.jsx(h_,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:$e(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),MQ=v.forwardRef((e,t)=>{const n=Jl(As,e.__scopeMenu);return a.jsx(h_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),h_=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=e,x=Jl(As,n),b=$p(As,n),y=px(n),w=SL(n),j=CQ(n),[S,N]=v.useState(null),P=v.useRef(null),_=pt(t,P,x.onContentChange),A=v.useRef(0),O=v.useRef(""),T=v.useRef(0),k=v.useRef(null),M=v.useRef("right"),R=v.useRef(0),H=g?lx:v.Fragment,F=g?{as:xa,allowPinchZoom:!0}:void 0,V=L=>{var ue,Ae;const Y=O.current+L,Q=j().filter(de=>!de.disabled),ee=document.activeElement,fe=(ue=Q.find(de=>de.ref.current===ee))==null?void 0:ue.textValue,W=Q.map(de=>de.textValue),he=qQ(W,Y,fe),pe=(Ae=Q.find(de=>de.textValue===he))==null?void 0:Ae.ref.current;(function de(oe){O.current=oe,window.clearTimeout(A.current),oe!==""&&(A.current=window.setTimeout(()=>de(""),1e3))})(Y),pe&&setTimeout(()=>pe.focus())};v.useEffect(()=>()=>window.clearTimeout(A.current),[]),GN();const $=v.useCallback(L=>{var Q,ee;return M.current===((Q=k.current)==null?void 0:Q.side)&&XQ(L,(ee=k.current)==null?void 0:ee.area)},[]);return a.jsx($Q,{scope:n,searchRef:O,onItemEnter:v.useCallback(L=>{$(L)&&L.preventDefault()},[$]),onItemLeave:v.useCallback(L=>{var Y;$(L)||((Y=P.current)==null||Y.focus(),N(null))},[$]),onTriggerLeave:v.useCallback(L=>{$(L)&&L.preventDefault()},[$]),pointerGraceTimerRef:T,onPointerGraceIntentChange:v.useCallback(L=>{k.current=L},[]),children:a.jsx(H,{...F,children:a.jsx(ax,{asChild:!0,trapped:s,onMountAutoFocus:$e(i,L=>{var Y;L.preventDefault(),(Y=P.current)==null||Y.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(yp,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:a.jsx(a_,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:N,onEntryFocus:$e(c,L=>{b.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(mN,{role:"menu","aria-orientation":"vertical","data-state":VL(x.open),"data-radix-menu-content":"",dir:b.dir,...y,...m,ref:_,style:{outline:"none",...m.style},onKeyDown:$e(m.onKeyDown,L=>{const Q=L.target.closest("[data-radix-menu-content]")===L.currentTarget,ee=L.ctrlKey||L.altKey||L.metaKey,fe=L.key.length===1;Q&&(L.key==="Tab"&&L.preventDefault(),!ee&&fe&&V(L.key));const W=P.current;if(L.target!==W||!NQ.includes(L.key))return;L.preventDefault();const pe=j().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);wL.includes(L.key)&&pe.reverse(),HQ(pe)}),onBlur:$e(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(A.current),O.current="")}),onPointerMove:$e(e.onPointerMove,jh(L=>{const Y=L.target,Q=R.current!==L.clientX;if(L.currentTarget.contains(Y)&&Q){const ee=L.clientX>R.current?"right":"left";M.current=ee,R.current=L.clientX}}))})})})})})})});CL.displayName=As;var RQ="MenuGroup",p_=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(Xe.div,{role:"group",...r,ref:t})});p_.displayName=RQ;var DQ="MenuLabel",AL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(Xe.div,{...r,ref:t})});AL.displayName=DQ;var Jg="MenuItem",IE="menu.itemSelect",mx=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,i=v.useRef(null),o=$p(Jg,e.__scopeMenu),l=f_(Jg,e.__scopeMenu),c=pt(t,i),u=v.useRef(!1),d=()=>{const f=i.current;if(!n&&f){const h=new CustomEvent(IE,{bubbles:!0,cancelable:!0});f.addEventListener(IE,p=>r==null?void 0:r(p),{once:!0}),PM(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return a.jsx(EL,{...s,ref:c,disabled:n,onClick:$e(e.onClick,d),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:$e(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:$e(e.onKeyDown,f=>{const h=l.searchRef.current!=="";n||h&&f.key===" "||j1.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});mx.displayName=Jg;var EL=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=e,o=f_(Jg,n),l=SL(n),c=v.useRef(null),u=pt(t,c),[d,f]=v.useState(!1),[h,p]=v.useState("");return v.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[i.children]),a.jsx(wh.ItemSlot,{scope:n,disabled:r,textValue:s??h,children:a.jsx(o_,{asChild:!0,...l,focusable:!r,children:a.jsx(Xe.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:$e(e.onPointerMove,jh(g=>{r?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:$e(e.onPointerLeave,jh(g=>o.onItemLeave(g))),onFocus:$e(e.onFocus,()=>f(!0)),onBlur:$e(e.onBlur,()=>f(!1))})})})}),LQ="MenuCheckboxItem",OL=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return a.jsx(ML,{scope:e.__scopeMenu,checked:n,children:a.jsx(mx,{role:"menuitemcheckbox","aria-checked":ev(n)?"mixed":n,...s,ref:t,"data-state":g_(n),onSelect:$e(s.onSelect,()=>r==null?void 0:r(ev(n)?!0:!n),{checkForDefaultPrevented:!1})})})});OL.displayName=LQ;var kL="MenuRadioGroup",[FQ,BQ]=Ql(kL,{value:void 0,onValueChange:()=>{}}),TL=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,i=Vn(r);return a.jsx(FQ,{scope:e.__scopeMenu,value:n,onValueChange:i,children:a.jsx(p_,{...s,ref:t})})});TL.displayName=kL;var $L="MenuRadioItem",IL=v.forwardRef((e,t)=>{const{value:n,...r}=e,s=BQ($L,e.__scopeMenu),i=n===s.value;return a.jsx(ML,{scope:e.__scopeMenu,checked:i,children:a.jsx(mx,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":g_(i),onSelect:$e(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});IL.displayName=$L;var m_="MenuItemIndicator",[ML,zQ]=Ql(m_,{checked:!1}),RL=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,i=zQ(m_,n);return a.jsx(lr,{present:r||ev(i.checked)||i.checked===!0,children:a.jsx(Xe.span,{...s,ref:t,"data-state":g_(i.checked)})})});RL.displayName=m_;var UQ="MenuSeparator",DL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return a.jsx(Xe.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});DL.displayName=UQ;var VQ="MenuArrow",LL=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=px(n);return a.jsx(gN,{...s,...r,ref:t})});LL.displayName=VQ;var WQ="MenuSub",[EOe,FL]=Ql(WQ),lf="MenuSubTrigger",BL=v.forwardRef((e,t)=>{const n=Jl(lf,e.__scopeMenu),r=$p(lf,e.__scopeMenu),s=FL(lf,e.__scopeMenu),i=f_(lf,e.__scopeMenu),o=v.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),a.jsx(u_,{asChild:!0,...u,children:a.jsx(EL,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":VL(n.open),...e,ref:Ry(t,s.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:$e(e.onPointerMove,jh(f=>{i.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:$e(e.onPointerLeave,jh(f=>{var p,g;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,x=m==="right",b=x?-5:5,y=h[x?"left":"right"],w=h[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:f.clientX+b,y:f.clientY},{x:y,y:h.top},{x:w,y:h.top},{x:w,y:h.bottom},{x:y,y:h.bottom}],side:m}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(f),f.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:$e(e.onKeyDown,f=>{var p;const h=i.searchRef.current!=="";e.disabled||h&&f.key===" "||_Q[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});BL.displayName=lf;var zL="MenuSubContent",UL=v.forwardRef((e,t)=>{const n=_L(As,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,i=Jl(As,e.__scopeMenu),o=$p(As,e.__scopeMenu),l=FL(zL,e.__scopeMenu),c=v.useRef(null),u=pt(t,c);return a.jsx(wh.Provider,{scope:e.__scopeMenu,children:a.jsx(lr,{present:r||i.open,children:a.jsx(wh.Slot,{scope:e.__scopeMenu,children:a.jsx(h_,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:$e(e.onFocusOutside,d=>{d.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:$e(e.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:$e(e.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=PQ[o.dir].includes(d.key);f&&h&&(i.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});UL.displayName=zL;function VL(e){return e?"open":"closed"}function ev(e){return e==="indeterminate"}function g_(e){return ev(e)?"indeterminate":e?"checked":"unchecked"}function HQ(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function GQ(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function qQ(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=GQ(e,Math.max(i,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function KQ(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;ir!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function XQ(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return KQ(n,t)}function jh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var YQ=NL,ZQ=u_,QQ=PL,JQ=CL,eJ=p_,tJ=AL,nJ=mx,rJ=OL,sJ=TL,iJ=IL,aJ=RL,oJ=DL,lJ=LL,cJ=BL,uJ=UL,v_="DropdownMenu",[dJ,OOe]=Ir(v_,[jL]),Mr=jL(),[fJ,WL]=dJ(v_),HL=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=e,c=Mr(t),u=v.useRef(null),[d=!1,f]=us({prop:s,defaultProp:i,onChange:o});return a.jsx(fJ,{scope:t,triggerId:Cs(),triggerRef:u,contentId:Cs(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:l,children:a.jsx(YQ,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};HL.displayName=v_;var GL="DropdownMenuTrigger",qL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,i=WL(GL,n),o=Mr(n);return a.jsx(ZQ,{asChild:!0,...o,children:a.jsx(Xe.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Ry(t,i.triggerRef),onPointerDown:$e(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:$e(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});qL.displayName=GL;var hJ="DropdownMenuPortal",KL=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Mr(t);return a.jsx(QQ,{...r,...n})};KL.displayName=hJ;var XL="DropdownMenuContent",YL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=WL(XL,n),i=Mr(n),o=v.useRef(!1);return a.jsx(JQ,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:t,onCloseAutoFocus:$e(e.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:$e(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...e.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)"}})});YL.displayName=XL;var pJ="DropdownMenuGroup",mJ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(eJ,{...s,...r,ref:t})});mJ.displayName=pJ;var gJ="DropdownMenuLabel",ZL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(tJ,{...s,...r,ref:t})});ZL.displayName=gJ;var vJ="DropdownMenuItem",QL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(nJ,{...s,...r,ref:t})});QL.displayName=vJ;var yJ="DropdownMenuCheckboxItem",JL=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(rJ,{...s,...r,ref:t})});JL.displayName=yJ;var xJ="DropdownMenuRadioGroup",bJ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(sJ,{...s,...r,ref:t})});bJ.displayName=xJ;var wJ="DropdownMenuRadioItem",e3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(iJ,{...s,...r,ref:t})});e3.displayName=wJ;var jJ="DropdownMenuItemIndicator",t3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(aJ,{...s,...r,ref:t})});t3.displayName=jJ;var SJ="DropdownMenuSeparator",n3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(oJ,{...s,...r,ref:t})});n3.displayName=SJ;var NJ="DropdownMenuArrow",_J=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(lJ,{...s,...r,ref:t})});_J.displayName=NJ;var PJ="DropdownMenuSubTrigger",r3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(cJ,{...s,...r,ref:t})});r3.displayName=PJ;var CJ="DropdownMenuSubContent",s3=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return a.jsx(uJ,{...s,...r,ref:t,style:{...e.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)"}})});s3.displayName=CJ;var AJ=HL,EJ=qL,OJ=KL,i3=YL,a3=ZL,o3=QL,l3=JL,c3=e3,u3=t3,d3=n3,f3=r3,h3=s3;const S1=AJ,N1=EJ,kJ=v.forwardRef(({className:e,inset:t,children:n,...r},s)=>a.jsxs(f3,{ref:s,className:Me("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",t&&"pl-8",e),...r,children:[n,a.jsx(vi,{className:"ml-auto h-4 w-4"})]}));kJ.displayName=f3.displayName;const TJ=v.forwardRef(({className:e,...t},n)=>a.jsx(h3,{ref:n,className:Me("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",e),...t}));TJ.displayName=h3.displayName;const tv=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(OJ,{children:a.jsx(i3,{ref:r,sideOffset:t,className:Me("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",e),...n})}));tv.displayName=i3.displayName;const al=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(o3,{ref:r,className:Me("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",t&&"pl-8",e),...n}));al.displayName=o3.displayName;const $J=v.forwardRef(({className:e,children:t,checked:n,...r},s)=>a.jsxs(l3,{ref:s,className:Me("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",e),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(u3,{children:a.jsx(Sa,{className:"h-4 w-4"})})}),t]}));$J.displayName=l3.displayName;const IJ=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(c3,{ref:r,className:Me("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",e),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(u3,{children:a.jsx(bf,{className:"h-2 w-2 fill-current"})})}),t]}));IJ.displayName=c3.displayName;const MJ=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(a3,{ref:r,className:Me("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));MJ.displayName=a3.displayName;const RJ=v.forwardRef(({className:e,...t},n)=>a.jsx(d3,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));RJ.displayName=d3.displayName;var y_="Dialog",[p3,m3]=Ir(y_),[DJ,di]=p3(y_),g3=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=e,l=v.useRef(null),c=v.useRef(null),[u=!1,d]=us({prop:r,defaultProp:s,onChange:i});return a.jsx(DJ,{scope:t,triggerRef:l,contentRef:c,contentId:Cs(),titleId:Cs(),descriptionId:Cs(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};g3.displayName=y_;var v3="DialogTrigger",y3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(v3,n),i=pt(t,s.triggerRef);return a.jsx(Xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":w_(s.open),...r,ref:i,onClick:$e(e.onClick,s.onOpenToggle)})});y3.displayName=v3;var x_="DialogPortal",[LJ,x3]=p3(x_,{forceMount:void 0}),b3=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,i=di(x_,t);return a.jsx(LJ,{scope:t,forceMount:n,children:v.Children.map(r,o=>a.jsx(lr,{present:n||i.open,children:a.jsx(By,{asChild:!0,container:s,children:o})}))})};b3.displayName=x_;var nv="DialogOverlay",w3=v.forwardRef((e,t)=>{const n=x3(nv,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=di(nv,e.__scopeDialog);return i.modal?a.jsx(lr,{present:r||i.open,children:a.jsx(FJ,{...s,ref:t})}):null});w3.displayName=nv;var FJ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(nv,n);return a.jsx(lx,{as:xa,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(Xe.div,{"data-state":w_(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Ul="DialogContent",j3=v.forwardRef((e,t)=>{const n=x3(Ul,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,i=di(Ul,e.__scopeDialog);return a.jsx(lr,{present:r||i.open,children:i.modal?a.jsx(BJ,{...s,ref:t}):a.jsx(zJ,{...s,ref:t})})});j3.displayName=Ul;var BJ=v.forwardRef((e,t)=>{const n=di(Ul,e.__scopeDialog),r=v.useRef(null),s=pt(t,n.contentRef,r);return v.useEffect(()=>{const i=r.current;if(i)return qN(i)},[]),a.jsx(S3,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:$e(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:$e(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:$e(e.onFocusOutside,i=>i.preventDefault())})}),zJ=v.forwardRef((e,t)=>{const n=di(Ul,e.__scopeDialog),r=v.useRef(!1),s=v.useRef(!1);return a.jsx(S3,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),S3=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=e,l=di(Ul,n),c=v.useRef(null),u=pt(t,c);return GN(),a.jsxs(a.Fragment,{children:[a.jsx(ax,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(yp,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":w_(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(VJ,{titleId:l.titleId}),a.jsx(HJ,{contentRef:c,descriptionId:l.descriptionId})]})]})}),b_="DialogTitle",N3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(b_,n);return a.jsx(Xe.h2,{id:s.titleId,...r,ref:t})});N3.displayName=b_;var _3="DialogDescription",P3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(_3,n);return a.jsx(Xe.p,{id:s.descriptionId,...r,ref:t})});P3.displayName=_3;var C3="DialogClose",A3=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=di(C3,n);return a.jsx(Xe.button,{type:"button",...r,ref:t,onClick:$e(e.onClick,()=>s.onOpenChange(!1))})});A3.displayName=C3;function w_(e){return e?"open":"closed"}var E3="DialogTitleWarning",[UJ,O3]=m7(E3,{contentName:Ul,titleName:b_,docsSlug:"dialog"}),VJ=({titleId:e})=>{const t=O3(E3),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},WJ="DialogDescriptionWarning",HJ=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${O3(WJ).contentName}}.`;return v.useEffect(()=>{var i;const s=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},k3=g3,GJ=y3,T3=b3,j_=w3,S_=j3,N_=N3,__=P3,P_=A3,$3="AlertDialog",[qJ,kOe]=Ir($3,[m3]),Ia=m3(),I3=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ia(t);return a.jsx(k3,{...r,...n,modal:!0})};I3.displayName=$3;var KJ="AlertDialogTrigger",XJ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(GJ,{...s,...r,ref:t})});XJ.displayName=KJ;var YJ="AlertDialogPortal",M3=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ia(t);return a.jsx(T3,{...r,...n})};M3.displayName=YJ;var ZJ="AlertDialogOverlay",R3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(j_,{...s,...r,ref:t})});R3.displayName=ZJ;var Wc="AlertDialogContent",[QJ,JJ]=qJ(Wc),D3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,i=Ia(n),o=v.useRef(null),l=pt(t,o),c=v.useRef(null);return a.jsx(UJ,{contentName:Wc,titleName:L3,docsSlug:"alert-dialog",children:a.jsx(QJ,{scope:n,cancelRef:c,children:a.jsxs(S_,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:$e(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[a.jsx(iN,{children:r}),a.jsx(tee,{contentRef:o})]})})})});D3.displayName=Wc;var L3="AlertDialogTitle",F3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(N_,{...s,...r,ref:t})});F3.displayName=L3;var B3="AlertDialogDescription",z3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(__,{...s,...r,ref:t})});z3.displayName=B3;var eee="AlertDialogAction",U3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ia(n);return a.jsx(P_,{...s,...r,ref:t})});U3.displayName=eee;var V3="AlertDialogCancel",W3=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=JJ(V3,n),i=Ia(n),o=pt(t,s);return a.jsx(P_,{...i,...r,ref:o})});W3.displayName=V3;var tee=({contentRef:e})=>{const t=`\`${Wc}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${Wc}\` by passing a \`${B3}\` 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 \`${Wc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},nee=I3,ree=M3,H3=R3,G3=D3,q3=U3,K3=W3,X3=F3,Y3=z3;const _1=nee,see=ree,Z3=v.forwardRef(({className:e,...t},n)=>a.jsx(H3,{className:Me("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",e),...t,ref:n}));Z3.displayName=H3.displayName;const rv=v.forwardRef(({className:e,...t},n)=>a.jsxs(see,{children:[a.jsx(Z3,{}),a.jsx(G3,{ref:n,className:Me("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",e),...t})]}));rv.displayName=G3.displayName;const sv=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col space-y-2 text-center sm:text-left",e),...t});sv.displayName="AlertDialogHeader";const iv=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});iv.displayName="AlertDialogFooter";const av=v.forwardRef(({className:e,...t},n)=>a.jsx(X3,{ref:n,className:Me("text-lg font-semibold",e),...t}));av.displayName=X3.displayName;const ov=v.forwardRef(({className:e,...t},n)=>a.jsx(Y3,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));ov.displayName=Y3.displayName;const lv=v.forwardRef(({className:e,...t},n)=>a.jsx(q3,{ref:n,className:Me(DN(),e),...t}));lv.displayName=q3.displayName;const cv=v.forwardRef(({className:e,...t},n)=>a.jsx(K3,{ref:n,className:Me(DN({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));cv.displayName=K3.displayName;const wo=k3,iee=T3,Q3=v.forwardRef(({className:e,...t},n)=>a.jsx(j_,{ref:n,className:Me("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",e),...t}));Q3.displayName=j_.displayName;const la=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(iee,{children:[a.jsx(Q3,{}),a.jsxs(S_,{ref:r,className:Me("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",e),...n,children:[t,a.jsxs(P_,{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(Ei,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));la.displayName=S_.displayName;const ca=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});ca.displayName="DialogHeader";const jo=({className:e,...t})=>a.jsx("div",{className:Me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});jo.displayName="DialogFooter";const ua=v.forwardRef(({className:e,...t},n)=>a.jsx(N_,{ref:n,className:Me("text-lg font-semibold leading-none tracking-tight",e),...t}));ua.displayName=N_.displayName;const Cl=v.forwardRef(({className:e,...t},n)=>a.jsx(__,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));Cl.displayName=__.displayName;var C_="Radio",[aee,J3]=Ir(C_),[oee,lee]=aee(C_),e5=v.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s=!1,required:i,disabled:o,value:l="on",onCheck:c,form:u,...d}=e,[f,h]=v.useState(null),p=pt(t,x=>h(x)),g=v.useRef(!1),m=f?u||!!f.closest("form"):!0;return a.jsxs(oee,{scope:n,checked:s,disabled:o,children:[a.jsx(Xe.button,{type:"button",role:"radio","aria-checked":s,"data-state":r5(s),"data-disabled":o?"":void 0,disabled:o,value:l,...d,ref:p,onClick:$e(e.onClick,x=>{s||c==null||c(),m&&(g.current=x.isPropagationStopped(),g.current||x.stopPropagation())})}),m&&a.jsx(cee,{control:f,bubbles:!g.current,name:r,value:l,checked:s,required:i,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});e5.displayName=C_;var t5="RadioIndicator",n5=v.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,i=lee(t5,n);return a.jsx(lr,{present:r||i.checked,children:a.jsx(Xe.span,{"data-state":r5(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:t})})});n5.displayName=t5;var cee=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,i=v.useRef(null),o=Cp(n),l=bp(t);return v.useEffect(()=>{const c=i.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[o,n,r]),a.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:i,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function r5(e){return e?"checked":"unchecked"}var uee=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],A_="RadioGroup",[dee,TOe]=Ir(A_,[ad,J3]),s5=ad(),i5=J3(),[fee,hee]=dee(A_),a5=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:s,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=e,p=s5(n),g=Uo(u),[m,x]=us({prop:i,defaultProp:s,onChange:f});return a.jsx(fee,{scope:n,name:r,required:o,disabled:l,value:m,onValueChange:x,children:a.jsx(a_,{asChild:!0,...p,orientation:c,dir:g,loop:d,children:a.jsx(Xe.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:g,...h,ref:t})})})});a5.displayName=A_;var o5="RadioGroupItem",l5=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...s}=e,i=hee(o5,n),o=i.disabled||r,l=s5(n),c=i5(n),u=v.useRef(null),d=pt(t,u),f=i.value===s.value,h=v.useRef(!1);return v.useEffect(()=>{const p=m=>{uee.includes(m.key)&&(h.current=!0)},g=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",g)}},[]),a.jsx(o_,{asChild:!0,...l,focusable:!o,active:f,children:a.jsx(e5,{disabled:o,required:i.required,checked:f,...c,...s,name:i.name,ref:d,onCheck:()=>i.onValueChange(s.value),onKeyDown:$e(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:$e(s.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});l5.displayName=o5;var pee="RadioGroupIndicator",c5=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=i5(n);return a.jsx(n5,{...s,...r,ref:t})});c5.displayName=pee;var u5=a5,d5=l5,mee=c5;const P1=v.forwardRef(({className:e,...t},n)=>a.jsx(u5,{className:Me("grid gap-2",e),...t,ref:n}));P1.displayName=u5.displayName;const cf=v.forwardRef(({className:e,...t},n)=>a.jsx(d5,{ref:n,className:Me("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",e),...t,children:a.jsx(mee,{className:"flex items-center justify-center",children:a.jsx(bf,{className:"h-2.5 w-2.5 fill-current text-current"})})}));cf.displayName=d5.displayName;var E_="Checkbox",[gee,$Oe]=Ir(E_),[vee,yee]=gee(E_),f5=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=v.useState(null),g=pt(t,j=>p(j)),m=v.useRef(!1),x=h?d||!!h.closest("form"):!0,[b=!1,y]=us({prop:s,defaultProp:i,onChange:u}),w=v.useRef(b);return v.useEffect(()=>{const j=h==null?void 0:h.form;if(j){const S=()=>y(w.current);return j.addEventListener("reset",S),()=>j.removeEventListener("reset",S)}},[h,y]),a.jsxs(vee,{scope:n,state:b,disabled:l,children:[a.jsx(Xe.button,{type:"button",role:"checkbox","aria-checked":So(b)?"mixed":b,"aria-required":o,"data-state":m5(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onKeyDown:$e(e.onKeyDown,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:$e(e.onClick,j=>{y(S=>So(S)?!0:!S),x&&(m.current=j.isPropagationStopped(),m.current||j.stopPropagation())})}),x&&a.jsx(xee,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"},defaultChecked:So(i)?!1:i})]})});f5.displayName=E_;var h5="CheckboxIndicator",p5=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,i=yee(h5,n);return a.jsx(lr,{present:r||So(i.state)||i.state===!0,children:a.jsx(Xe.span,{"data-state":m5(i.state),"data-disabled":i.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});p5.displayName=h5;var xee=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:s,...i}=e,o=v.useRef(null),l=Cp(n),c=bp(t);v.useEffect(()=>{const d=o.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=So(n),p.call(d,So(n)?!1:n),d.dispatchEvent(g)}},[l,n,r]);const u=v.useRef(So(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s??u.current,...i,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function So(e){return e==="indeterminate"}function m5(e){return So(e)?"indeterminate":e?"checked":"unchecked"}var g5=f5,bee=p5;const Sh=v.forwardRef(({className:e,...t},n)=>a.jsx(g5,{ref:n,className:Me("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",e),...t,children:a.jsx(bee,{className:Me("flex items-center justify-center text-current"),children:a.jsx(Sa,{className:"h-4 w-4"})})}));Sh.displayName=g5.displayName;const O_=({isActive:e,isComplete:t,hasError:n,label:r,onComplete:s,className:i})=>{const[o,l]=v.useState(0),[c,u]=v.useState("progressing"),[d,f]=v.useState(!1),h=v.useRef(null),p=v.useRef(null),g=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{g(),l(0),u("progressing"),f(!1)},x=j=>{g(),u("completing");const S=100-j,N=50,P=500/N,_=S/P;let A=0;h.current=setInterval(()=>{A++;const O=j+_*A;O>=100||A>=P?(l(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),s==null||s()},300)},2e3)):l(O)},N)},b=()=>{c==="progressing"&&x(o)},y=()=>{c==="waiting"&&x(90)},w=()=>{g()};return v.useEffect(()=>{if(e&&!d){f(!0),l(0),u("progressing");const j=90/540;let S=0;h.current=setInterval(()=>{S+=j,S>=90?(l(90),u("waiting"),g()):l(S)},100)}return t&&c==="progressing"&&b(),t&&c==="waiting"&&y(),n&&(c==="progressing"||c==="waiting")&&w(),!e&&d&&m(),()=>{e||g()}},[e,t,n,c,d]),v.useEffect(()=>()=>{g()},[]),d?a.jsxs("div",{className:Me("w-full space-y-2",i),children:[r&&a.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[a.jsx("span",{children:c==="waiting"?`${r} - finalizing...`:r}),a.jsxs("span",{children:[Math.round(o),"%"]})]}),a.jsx(fl,{value:o,className:Me("w-full transition-all duration-200",n&&"opacity-75",c==="completed"&&"bg-green-100")}),n&&a.jsx("div",{className:"text-sm text-red-600",children:"Generation failed. Please try again."}),c==="completed"&&!n&&a.jsx("div",{className:"text-sm text-green-600",children:"Generation completed successfully!"})]}):null},An="all",wee=()=>{var kt,Dn,q,we;const e=v.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),t=Rn(),{loadPersonas:n}=R4(),[r,s]=v.useState("view"),[i,o]=v.useState("ai"),[l,c]=v.useState("");v.useState(null);const[u,d]=v.useState(An),[f,h]=v.useState(!1),[p,g]=v.useState(""),[m,x]=v.useState([]),[b,y]=v.useState([]),[w,j]=v.useState(!0);v.useState(null);const[S,N]=v.useState(new Set),[P,_]=v.useState(!1),[A,O]=v.useState(null),[T,k]=v.useState(""),[M,R]=v.useState(!1),[H,F]=v.useState(null),[V,$]=v.useState(!1),[L,Y]=v.useState(null),[Q,ee]=v.useState(!1),[fe,W]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[he,pe]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[ue,Ae]=v.useState(!1),[de,oe]=v.useState(!1),[xe,te]=v.useState(!1),[Ye,G]=v.useState(!1),[ve,Pe]=v.useState("gemini-2.5-pro"),Ie=()=>{Ae(!1),oe(!1),te(!1)},E=I=>{const Z={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return I.forEach(ne=>{if(ne.age&&Z.age.add(ne.age),ne.gender&&Z.gender.add(ne.gender),ne.occupation&&Z.occupation.add(ne.occupation),ne.location&&Z.location.add(ne.location),ne.techSavviness!==void 0){const B=ne.techSavviness<30?"Low (0-30)":ne.techSavviness<70?"Medium (31-70)":"High (71-100)";Z.techSavviness.add(B)}ne.ethnicity&&Z.ethnicity.add(ne.ethnicity)}),{age:Array.from(Z.age).sort(),gender:Array.from(Z.gender).sort(),occupation:Array.from(Z.occupation).sort(),location:Array.from(Z.location).sort(),techSavviness:Array.from(Z.techSavviness).sort((ne,B)=>{const z=["Low (0-30)","Medium (31-70)","High (71-100)"];return z.indexOf(ne)-z.indexOf(B)}),ethnicity:Array.from(Z.ethnicity).sort()}},D=()=>{ee(!1),setTimeout(()=>{W({...he})},0)},U=()=>{pe({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},K=(I,Z)=>{pe(ne=>{const B={...ne};return B[I].includes(Z)?B[I]=B[I].filter(z=>z!==Z):B[I]=[...B[I],Z],B})},J=async()=>{j(!0);try{const ne=(await $n.getAll()).data;{const z=[...ne.map(re=>({...re,id:re.id||re._id}))];try{(async()=>{const me=await n();console.log("Loaded stored personas (for debugging only):",me?me.length:0)})()}catch(re){console.warn("Error loading stored personas:",re)}x(z)}}catch(Z){console.error("Error fetching personas:",Z),Qe.error("Failed to load personas"),x([])}finally{j(!1)}},X=(I,Z)=>(I.forEach(ne=>{if(ne.folderId){const B=Z.find(z=>z.id===ne.folderId);B&&!B.personaIds.includes(ne.id)&&B.personaIds.push(ne.id)}}),Z.forEach(ne=>{ne.personaIds=ne.personaIds.filter(B=>{const z=I.find(re=>re.id===B);return z&&(!z.folderId||z.folderId===ne.id)})}),Z);v.useEffect(()=>{let I=!0;const Z=localStorage.getItem("persona-folders");let ne=[];if(Z)try{ne=JSON.parse(Z),y(ne)}catch(z){console.error("Failed to parse stored folders:",z)}return(async()=>{if(await J(),I&&m.length>0){const z=X(m,ne);y(z)}})(),()=>{I=!1}},[e]),v.useEffect(()=>{var I;if(r==="view")J();else if(r==="create"&&(console.log(`Switching to create mode with folder: ${u}, ${u!==An?"NOT default":"IS default"}`),u!==An)){const Z=(I=b.find(ne=>ne.id===u))==null?void 0:I.name;console.log(`Selected folder for creation: ${u} (${Z})`)}},[r]),v.useEffect(()=>{if(m.length>0){const I=b.map(ne=>({...ne,personaIds:[...ne.personaIds]})),Z=X(m,I);y(Z)}},[m]),v.useEffect(()=>{J();const I=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),J())},Z=()=>{console.log("Synthetic users navigation event detected, refreshing data"),J()};console.log("Setting up MutationObserver for body style");const ne=new MutationObserver(B=>{B.forEach(z=>{z.type==="attributes"&&z.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),e())})});return ne.observe(document.body,{attributes:!0,attributeFilter:["style"]}),e(),window.addEventListener("popstate",I),window.addEventListener("syntheticUsersNavigation",Z),()=>{window.removeEventListener("popstate",I),window.removeEventListener("syntheticUsersNavigation",Z),console.log("Disconnecting MutationObserver"),ne.disconnect()}},[]),v.useEffect(()=>{b.length>0&&localStorage.setItem("persona-folders",JSON.stringify(b))},[b]),v.useEffect(()=>{if(m.length>0&&b.length>0){const I=X(m,[...b]);JSON.stringify(I)!==JSON.stringify(b)&&y(I)}},[m,b.length]);const be=()=>{if(!p.trim()){Qe.error("Please enter a folder name");return}const I={id:`folder-${Date.now()}`,name:p.trim(),personaIds:[]};y([...b,I]),g(""),h(!1),Qe.success(`Folder "${p}" created`)},_e=()=>{g(""),h(!1)},Fe=I=>{O(I),k(I.name)},ie=()=>{if(!A||!T.trim()){O(null);return}const I=b.map(Z=>Z.id===A.id?{...Z,name:T.trim()}:Z);y(I),O(null),Qe.success(`Folder renamed to "${T}"`)},Te=()=>{O(null),k("")},Be=I=>{F(I),R(!0)},gt=()=>{H&&(y(b.filter(I=>I.id!==H.id)),u===H.id&&d(An),R(!1),F(null),Qe.success(`Folder "${H.name}" deleted`))},At=async(I,Z)=>{var re;const ne=I||S,B=Z||L;if(!B||ne.size===0)return;const z=Array.from(ne);try{const me=b.map(Ce=>{if(Ce.id===B){const ut=[...Ce.personaIds];return z.forEach(Tt=>{ut.includes(Tt)||ut.push(Tt)}),{...Ce,personaIds:ut}}else return{...Ce,personaIds:Ce.personaIds.filter(ut=>!z.includes(ut))}});y(me),localStorage.setItem("persona-folders",JSON.stringify(me));const le=z.map(async Ce=>{try{const ut=m.find(Tt=>Tt.id===Ce);if(ut){const Tt={...ut,folderId:B===An?null:B},nr=ut._id||ut.id;return await $n.update(nr,Tt),{success:!0,id:Ce}}return{success:!1,id:Ce,error:"Persona not found locally"}}catch(ut){return console.error(`Failed to update folder for persona ${Ce}:`,ut),{success:!1,id:Ce,error:ut}}}),Ue=await Promise.all(le),Ne=Ue.filter(Ce=>Ce.success).map(Ce=>Ce.id),ze=Ue.filter(Ce=>!Ce.success),Se=m.map(Ce=>Ne.includes(Ce.id)?{...Ce,folderId:B===An?null:B}:Ce);x(Se);const at=B===An?"All Personas":((re=b.find(Ce=>Ce.id===B))==null?void 0:re.name)||"folder";return Ne.length>0&&Qe.success(`Moved ${Ne.length} persona${Ne.length!==1?"s":""} to ${at}`),ze.length>0&&(Qe.error(`Failed to move ${ze.length} persona${ze.length!==1?"s":""}.`),console.error("Failed updates:",ze)),I||N(new Set),{success:Ne.length>0,successCount:Ne.length,failureCount:ze.length}}catch(me){return console.error("Error moving personas to folder:",me),Qe.error("An unexpected error occurred while moving personas."),{success:!1,error:me}}},pn=async()=>{var re;if(S.size===0||u===An)return;const I=Array.from(S),Z=b.map(me=>me.id===u?{...me,personaIds:me.personaIds.filter(le=>!I.includes(le))}:me);y(Z);const ne=[],B=[];for(const me of I)try{const le=m.find(Ue=>Ue.id===me);if(le){const Ue={...le,folderId:null},Ne=le._id||le.id;await $n.update(Ne,Ue),ne.push(me)}}catch(le){console.error(`Failed to update persona ${me}:`,le),B.push(me)}x(me=>me.map(le=>ne.includes(le.id)?{...le,folderId:null}:le)),N(new Set);const z=((re=b.find(me=>me.id===u))==null?void 0:re.name)||"folder";ne.length>0&&Qe.success(`Removed ${ne.length} persona${ne.length!==1?"s":""} from ${z}`),B.length>0&&Qe.error(`Failed to remove ${B.length} persona${B.length!==1?"s":""} from ${z}`)},Zt=I=>{N(Z=>{const ne=new Set(Z);return ne.has(I)?ne.delete(I):ne.add(I),ne})},bn=()=>{S.size===yt.length?N(new Set):N(new Set(yt.map(I=>I.id)))},Xt=async()=>{if(S.size===0)return;const I=Array.from(S);N(new Set),_(!1),j(!0);const Z=[],ne=[];for(const B of I)try{const z=m.find(me=>me.id===B);if(!z){console.error(`Could not find persona with id: ${B}`),ne.push(B);continue}let re=B;z._id&&(re=z._id.toString()),console.log(`Attempting to delete persona: ${re}`),await $n.delete(re),Z.push(B)}catch(z){console.error(`Failed to delete persona ${B}:`,z),ne.push(B)}x(B=>B.filter(z=>!Z.includes(z.id))),y(B=>{const z=B.map(re=>({...re,personaIds:re.personaIds.filter(me=>!Z.includes(me))}));return localStorage.setItem("persona-folders",JSON.stringify(z)),z}),j(!1),setTimeout(()=>{Z.length>0&&Qe.success(`Successfully deleted ${Z.length} persona${Z.length!==1?"s":""}`),ne.length>0&&Qe.error(`Failed to delete ${ne.length} persona${ne.length!==1?"s":""}`),(Z.length>0||ne.length>0)&&J()},50)},yt=m.filter(I=>{const Z=I.name.toLowerCase().includes(l.toLowerCase())||I.occupation.toLowerCase().includes(l.toLowerCase())||I.location.toLowerCase().includes(l.toLowerCase()),ne=(fe.age.length===0||fe.age.includes(I.age))&&(fe.gender.length===0||fe.gender.includes(I.gender))&&(fe.occupation.length===0||fe.occupation.includes(I.occupation))&&(fe.location.length===0||fe.location.includes(I.location))&&(fe.ethnicity.length===0||I.ethnicity&&fe.ethnicity.includes(I.ethnicity))&&(fe.techSavviness.length===0||I.techSavviness!==void 0&&fe.techSavviness.includes(I.techSavviness<30?"Low (0-30)":I.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;if(u===An||I.folderId===u)return Z&≠const B=b.find(z=>z.id===u);return B&&B.personaIds.includes(I.id)&&Z&&ne}),Rr=(I,Z)=>{const ne=new Date().toISOString().split("T")[0],B=I.length;let z=`# Persona Summary Report - -`;return z+=`**Folder:** ${Z} -`,z+=`**Date:** ${ne} -`,z+=`**Total Personas:** ${B} - -`,B===0?(z+=`No personas found in this folder. -`,z):(I.forEach((re,me)=>{z+=`## ${re.name} - -`,z+=`### Demographics -`,z+=`- **Age:** ${re.age} -`,z+=`- **Gender:** ${re.gender} -`,z+=`- **Occupation:** ${re.occupation} -`,z+=`- **Location:** ${re.location} - -`,re.aiSynthesizedBio&&(z+=`### AI-Synthesized Bio -`,z+=`${re.aiSynthesizedBio} - -`),re.qualitativeAttributes&&re.qualitativeAttributes.length>0&&(z+=`### Key Attributes -`,re.qualitativeAttributes.forEach(le=>{z+=`- 🏷️ ${le} -`}),z+=` -`),re.topPersonalityTraits&&re.topPersonalityTraits.length>0&&(z+=`### Top Personality Traits -`,re.topPersonalityTraits.forEach(le=>{z+=`- 🧠 ${le} -`}),z+=` -`),me{if(yt.length===0){Qe.error("No personas to download");return}G(!0)},It=async()=>{var ne,B,z,re,me;const I=u===An?"All Personas":((ne=b.find(le=>le.id===u))==null?void 0:ne.name)||"Unknown Folder",Z=yt.map(le=>le._id||le.id);console.log(`🤖 Frontend: User selected ${ve} for persona summary download`),G(!1),Ae(!0),oe(!1),te(!1),j(!0);try{Qe.info("Generating persona summaries...",{description:`Processing ${yt.length} persona${yt.length!==1?"s":""} with AI`});const le=await Xi.batchGenerateSummaries(Z,.7,ve),{summaries:Ue,summary_stats:Ne,errors:ze}=le.data,Se=new Date().toISOString().split("T")[0],at=`persona-summary-${I.toLowerCase().replace(/\s+/g,"-")}-${Se}.md`;let Ce=`# Persona Summary Report - -`;Ce+=`**Folder:** ${I} -`,Ce+=`**Date:** ${Se} -`,Ce+=`**Total Personas:** ${Ne.total_requested} -`,Ce+=`**Successfully Processed:** ${Ne.total_successful} -`,Ne.total_failed>0&&(Ce+=`**Failed to Process:** ${Ne.total_failed} -`),Ce+=` ---- - -`,Ue.length===0?Ce+=`No persona summaries could be generated. -`:Ue.forEach((Lt,zt)=>{Ce+=`# ${Lt.persona_name} - -`,Ce+=`${Lt.summary} - -`,zt0||((z=ze.missing_personas)==null?void 0:z.length)>0)&&(Ce+=` ---- - -## Processing Errors - -`,((re=ze.failed_summaries)==null?void 0:re.length)>0&&(Ce+=`### Failed to Generate Summaries -`,ze.failed_summaries.forEach(Lt=>{Ce+=`- **${Lt.persona_name}** (ID: ${Lt.persona_id}): ${Lt.error} -`}),Ce+=` -`),((me=ze.missing_personas)==null?void 0:me.length)>0&&(Ce+=`### Missing Personas -`,ze.missing_personas.forEach(Lt=>{Ce+=`- ID: ${Lt} -`})));const ut=document.createElement("a"),Tt=new Blob([Ce],{type:"text/markdown"});ut.href=URL.createObjectURL(Tt),ut.download=at,document.body.appendChild(ut),ut.click(),document.body.removeChild(ut),oe(!0);const nr=ve==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";Ne.total_successful===Ne.total_requested?Qe.success("Persona summary downloaded",{description:`Successfully processed all ${Ne.total_successful} persona${Ne.total_successful!==1?"s":""} from "${I}" using ${nr}`}):Qe.success("Persona summary downloaded with warnings",{description:`Processed ${Ne.total_successful} of ${Ne.total_requested} personas from "${I}" using ${nr}`})}catch(le){console.error("Error generating persona summaries:",le),le.response?(console.error("Error response data:",le.response.data),console.error("Error response status:",le.response.status),console.error("Error response headers:",le.response.headers)):le.request?console.error("Error request:",le.request):console.error("Error message:",le.message),te(!0),Qe.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const Ue=new Date().toISOString().split("T")[0],Ne=`persona-summary-basic-${I.toLowerCase().replace(/\s+/g,"-")}-${Ue}.md`,ze=Rr(yt,I),Se=document.createElement("a"),at=new Blob([ze],{type:"text/markdown"});Se.href=URL.createObjectURL(at),Se.download=Ne,document.body.appendChild(Se),Se.click(),document.body.removeChild(Se)}catch{Qe.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{j(!1)}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),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:[r==="view"&&yt.length>0&&a.jsxs(se,{variant:"outline",onClick:tt,disabled:ue,className:"flex items-center gap-2 hover-transition",children:[a.jsx(ed,{className:"h-4 w-4"}),ue?"Generating Summary...":"Download Persona Summary"]}),a.jsx(se,{onClick:()=>s(r==="view"?"create":"view"),className:"hover-transition",children:r==="view"?"Create New Personas":"View All Personas"})]})})]}),r==="view"&&yt.length>0&&ue&&a.jsx("div",{className:"mb-6",children:a.jsx(O_,{isActive:ue,isComplete:de,hasError:xe,label:"Generating comprehensive persona summaries",onComplete:Ie,className:"max-w-4xl mx-auto"})}),r==="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(se,{variant:"ghost",size:"sm",onClick:()=>h(!0),className:"h-7 w-7 p-0",children:a.jsx(AR,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("button",{onClick:()=>d(An),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${u===An?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),b.map(I=>a.jsx("div",{className:"flex items-center justify-between group",children:A&&A.id===I.id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx(_t,{value:T,onChange:Z=>k(Z.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Z=>{Z.key==="Enter"?ie():Z.key==="Escape"&&Te()}}),a.jsx(se,{size:"sm",variant:"ghost",onClick:ie,className:"h-7 w-7 p-0",children:a.jsx(Sa,{className:"h-4 w-4"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:Te,className:"h-7 w-7 p-0",children:a.jsx(Ei,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>d(I.id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${u===I.id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:I.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:I.personaIds.length})]}),a.jsxs(S1,{children:[a.jsx(N1,{asChild:!0,children:a.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(Xw,{className:"h-4 w-4"})})}),a.jsxs(tv,{align:"end",children:[a.jsx(al,{onClick:()=>Fe(I),children:"Rename"}),a.jsx(al,{className:"text-red-600",onClick:()=>Be(I),children:"Delete"})]})]})]})},I.id)),f&&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(Ws,{className:"h-4 w-4"}),a.jsx(_t,{value:p,onChange:I=>g(I.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:I=>{I.key==="Enter"?be():I.key==="Escape"&&_e()}})]}),a.jsx(se,{size:"sm",variant:"ghost",onClick:be,className:"h-7 w-7 p-0",children:a.jsx(Sa,{className:"h-4 w-4"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:_e,className:"h-7 w-7 p-0",children:a.jsx(Ei,{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(AN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(_t,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:l,onChange:I=>c(I.target.value)})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[S.size>0&&a.jsxs(S1,{children:[a.jsx(N1,{asChild:!0,children:a.jsxs(se,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:I=>{I.stopPropagation()},children:[a.jsxs("span",{children:["Actions (",S.size,")"]}),a.jsx(Xw,{className:"h-4 w-4"})]})}),a.jsxs(tv,{align:"end",onCloseAutoFocus:I=>{I.preventDefault()},children:[a.jsxs(al,{className:"flex items-center gap-2 cursor-pointer",onClick:I=>{I.preventDefault(),I.stopPropagation(),_(!0)},children:[a.jsx(wn,{className:"h-4 w-4"}),"Delete"]}),a.jsxs(al,{className:"flex items-center gap-2 cursor-pointer",onClick:I=>{I.preventDefault(),I.stopPropagation(),$(!0)},children:[a.jsx(Ws,{className:"h-4 w-4"}),"Move to folder"]}),u!==An&&a.jsxs(al,{className:"flex items-center gap-2 cursor-pointer",onClick:I=>{I.preventDefault(),I.stopPropagation(),pn()},children:[a.jsx(Ei,{className:"h-4 w-4"}),"Remove from ",((kt=b.find(I=>I.id===u))==null?void 0:kt.name)||"folder"]})]})]}),a.jsxs(se,{variant:"outline",className:"flex items-center gap-2",onClick:()=>ee(!0),children:[a.jsx(PN,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(fe).some(I=>I.length>0)?` (${Object.values(fe).reduce((I,Z)=>I+Z.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(er,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:u===An?"Your Synthetic Persona Library":((Dn=b.find(I=>I.id===u))==null?void 0:Dn.name)||"Personas"}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",yt.length,")"]})]}),yt.length>0&&a.jsxs("div",{className:"flex items-center",children:[a.jsx(Sh,{id:"select-all",checked:yt.length>0&&S.size===yt.length,onCheckedChange:bn,className:"mr-2"}),a.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),yt.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:yt.map(I=>a.jsx("div",{className:"relative group",children:a.jsx(ZN,{user:I,selected:S.has(I.id),onClick:()=>t(`/synthetic-users/${I._id||I.id}`),onSelectionToggle:Z=>{Z.stopPropagation(),Zt(I.id)},showAddToFolderButton:!1})},I.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(_1,{open:P,onOpenChange:I=>{_(I||!1)},children:a.jsxs(rv,{onInteractOutside:I=>{I.preventDefault()},children:[a.jsxs(sv,{children:[a.jsx(av,{children:"Delete Personas"}),a.jsxs(ov,{children:["Are you sure you want to delete ",S.size," selected persona",S.size!==1?"s":"","? This action cannot be undone."]})]}),a.jsxs(iv,{children:[a.jsx(cv,{onClick:()=>{setTimeout(()=>N(new Set),50)},children:"Cancel"}),a.jsx(lv,{onClick:Xt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(_1,{open:M,onOpenChange:I=>{R(I||!1)},children:a.jsxs(rv,{children:[a.jsxs(sv,{children:[a.jsx(av,{children:"Delete Folder"}),a.jsxs(ov,{children:['Are you sure you want to delete the folder "',H==null?void 0:H.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(iv,{children:[a.jsx(cv,{children:"Cancel"}),a.jsx(lv,{onClick:gt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),a.jsx(wo,{open:V,onOpenChange:I=>{$(I||!1)},children:a.jsxs(la,{className:"z-50",children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"Move to Folder"}),a.jsxs(Cl,{children:["Choose a folder to move ",S.size," selected persona",S.size!==1?"s":""," to."]})]}),a.jsx("div",{className:"py-4",children:a.jsxs(P1,{value:L||"",onValueChange:Y,className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(cf,{value:An,id:"folder-all"}),a.jsxs(ji,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),b.map(I=>a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(cf,{value:I.id,id:`folder-${I.id}`}),a.jsxs(ji,{htmlFor:`folder-${I.id}`,className:"flex items-center gap-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:I.name})]})]},I.id))]})}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:I=>{I.preventDefault(),I.stopPropagation(),$(!1),Y(null)},children:"Cancel"}),a.jsx(se,{onClick:async I=>{if(I.preventDefault(),I.stopPropagation(),!L)return;const Z=new Set(S),ne=L;if($(!1),Y(null),ne&&Z.size>0){j(!0);try{await At(Z,ne)}finally{j(!1),N(new Set)}}},disabled:!L,children:"Move"})]})]})}),a.jsx(wo,{open:Q,onOpenChange:I=>{I?(ee(I),pe({...fe})):(S.size>0&&N(new Set),ee(!1))},children:a.jsxs(la,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:I=>{I.preventDefault()},children:[a.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:a.jsxs(ca,{children:[a.jsx(ua,{children:"Filter Personas"}),a.jsx(Cl,{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(he).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(he).reduce((I,Z)=>I+Z.length,0)," active filters"]})}),a.jsx("div",{className:"space-y-4",children:(()=>{const I=z=>{const re={...he};re[z]=[];const me=m.filter(le=>Object.entries(re).every(([Ue,Ne])=>{if(Ne.length===0)return!0;const ze=Ue;if(ze==="techSavviness"&&le.techSavviness!==void 0){const Se=le.techSavviness<30?"Low (0-30)":le.techSavviness<70?"Medium (31-70)":"High (71-100)";return Ne.includes(Se)}else{if(ze==="age"&&le.age)return Ne.includes(le.age);if(ze==="gender"&&le.gender)return Ne.includes(le.gender);if(ze==="occupation"&&le.occupation)return Ne.includes(le.occupation);if(ze==="location"&&le.location)return Ne.includes(le.location);if(ze==="ethnicity"&&le.ethnicity)return Ne.includes(le.ethnicity)}return!0}));return E(me)},Z=Object.values(he).every(z=>z.length===0),ne=E(m),B=(z,re,me,le=1)=>{const Ue=he[re],Ne=[...new Set([...me,...Ue])].sort();return Ne.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:z}),a.jsx("div",{className:`grid grid-cols-1 ${le===2?"sm:grid-cols-2":le===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Ne.map(ze=>{const Se=he[re].includes(ze),at=me.includes(ze);return a.jsxs("div",{className:`flex items-center space-x-2 ${!at&&!Se?"opacity-50":""}`,children:[a.jsx(Sh,{id:`${re}-${ze}`,checked:Se,onCheckedChange:()=>K(re,ze),disabled:!at&&!Se}),a.jsxs(ji,{htmlFor:`${re}-${ze}`,className:"truncate overflow-hidden",children:[ze,Se&&!at&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},ze)})})]})};return a.jsxs(a.Fragment,{children:[B("Gender","gender",Z?ne.gender:I("gender").gender,3),B("Age","age",Z?ne.age:I("age").age,3),B("Ethnicity","ethnicity",Z?ne.ethnicity:I("ethnicity").ethnicity,2),B("Location","location",Z?ne.location:I("location").location,2),B("Occupation","occupation",Z?ne.occupation:I("occupation").occupation,2),B("Tech Savviness","techSavviness",Z?ne.techSavviness:I("techSavviness").techSavviness,3),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(jo,{children:[a.jsx(se,{variant:"outline",onClick:U,children:"Reset"}),a.jsx(se,{onClick:D,children:"Apply Filters"})]})})]})}),a.jsx(wo,{open:Ye,onOpenChange:G,children:a.jsxs(la,{children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"Select AI Model for Summary Generation"}),a.jsx(Cl,{children:"Choose which AI model to use for generating persona summaries"})]}),a.jsx("div",{className:"py-4",children:a.jsxs(P1,{value:ve,onValueChange:Pe,className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center space-x-2",children:[a.jsx(cf,{value:"gemini-2.5-pro",id:"download-gemini"}),a.jsx(ji,{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(cf,{value:"gpt-4.1",id:"download-gpt"}),a.jsx(ji,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:()=>G(!1),children:"Cancel"}),a.jsx(se,{onClick:It,children:"Generate Summary"})]})]})})]})]})}):a.jsxs(Ho,{defaultValue:"ai",onValueChange:I=>o(I),children:[a.jsxs($a,{className:"grid w-full grid-cols-2 mb-6",children:[a.jsx(Wt,{value:"ai",children:"AI Recruiter"}),a.jsx(Wt,{value:"manual",children:"Manual Creation"})]}),a.jsxs(Ht,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${u!==An?u:"null"}`),console.log("Current folders:",b.map(I=>({id:I.id,name:I.name}))),a.jsx(TZ,{targetFolderId:u!==An?u:null,targetFolderName:u!==An?(q=b.find(I=>I.id===u))==null?void 0:q.name:null})]}),a.jsx(Ht,{value:"manual",children:a.jsx(jQ,{targetFolderId:u!==An?u:null,targetFolderName:u!==An?(we=b.find(I=>I.id===u))==null?void 0:we.name:null})})]})]})]})},jee="modulepreload",See=function(e){return"/semblance/"+e},ME={},Nee=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=See(c),c in ME)return;ME[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":jee,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),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 ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function _ee(){for(var e=arguments.length,t=new Array(e),n=0;nr=>{t.forEach(s=>s(r))},t)}const gx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function od(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function k_(e){return"nodeType"in e}function Kr(e){var t,n;return e?od(e)?e:k_(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function T_(e){const{Document:t}=Kr(e);return e instanceof t}function Ip(e){return od(e)?!1:e instanceof Kr(e).HTMLElement}function v5(e){return e instanceof Kr(e).SVGElement}function ld(e){return e?od(e)?e.document:k_(e)?T_(e)?e:Ip(e)||v5(e)?e.ownerDocument:document:document:document}const Di=gx?v.useLayoutEffect:v.useEffect;function $_(e){const t=v.useRef(e);return Di(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{e.current=setInterval(r,s)},[]),n=v.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Nh(e,t){t===void 0&&(t=[e]);const n=v.useRef(e);return Di(()=>{n.current!==e&&(n.current=e)},t),n}function Mp(e,t){const n=v.useRef();return v.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function uv(e){const t=$_(e),n=v.useRef(null),r=v.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}function C1(e){const t=v.useRef();return v.useEffect(()=>{t.current=e},[e]),t.current}let cb={};function Rp(e,t){return v.useMemo(()=>{if(t)return t;const n=cb[e]==null?0:cb[e]+1;return cb[e]=n,e+"-"+n},[e,t])}function y5(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const l=Object.entries(o);for(const[c,u]of l){const d=i[c];d!=null&&(i[c]=d+e*u)}return i},{...t})}}const Hc=y5(1),_h=y5(-1);function Cee(e){return"clientX"in e&&"clientY"in e}function I_(e){if(!e)return!1;const{KeyboardEvent:t}=Kr(e.target);return t&&e instanceof t}function Aee(e){if(!e)return!1;const{TouchEvent:t}=Kr(e.target);return t&&e instanceof t}function A1(e){if(Aee(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Cee(e)?{x:e.clientX,y:e.clientY}:null}const vu=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[vu.Translate.toString(e),vu.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),RE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Eee(e){return e.matches(RE)?e:e.querySelector(RE)}const Oee={display:"none"};function kee(e){let{id:t,value:n}=e;return C.createElement("div",{id:t,style:Oee},n)}function Tee(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={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 C.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function $ee(){const[e,t]=v.useState("");return{announce:v.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const x5=v.createContext(null);function Iee(e){const t=v.useContext(x5);v.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Mee(){const[e]=v.useState(()=>new Set),t=v.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[v.useCallback(r=>{let{type:s,event:i}=r;e.forEach(o=>{var l;return(l=o[s])==null?void 0:l.call(o,i)})},[e]),t]}const Ree={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. - `},Dee={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function Lee(e){let{announcements:t=Dee,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=Ree}=e;const{announce:i,announcement:o}=$ee(),l=Rp("DndLiveRegion"),[c,u]=v.useState(!1);if(v.useEffect(()=>{u(!0)},[]),Iee(v.useMemo(()=>({onDragStart(f){let{active:h}=f;i(t.onDragStart({active:h}))},onDragMove(f){let{active:h,over:p}=f;t.onDragMove&&i(t.onDragMove({active:h,over:p}))},onDragOver(f){let{active:h,over:p}=f;i(t.onDragOver({active:h,over:p}))},onDragEnd(f){let{active:h,over:p}=f;i(t.onDragEnd({active:h,over:p}))},onDragCancel(f){let{active:h,over:p}=f;i(t.onDragCancel({active:h,over:p}))}}),[i,t])),!c)return null;const d=C.createElement(C.Fragment,null,C.createElement(kee,{id:r,value:s.draggable}),C.createElement(Tee,{id:l,announcement:o}));return n?Xs.createPortal(d,n):d}var Un;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Un||(Un={}));function dv(){}function DE(e,t){return v.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Fee(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const oi=Object.freeze({x:0,y:0});function b5(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function w5(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Bee(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function LE(e){let{left:t,top:n,height:r,width:s}=e;return[{x:t,y:n},{x:t+s,y:n},{x:t,y:n+r},{x:t+s,y:n+r}]}function j5(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function FE(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const zee=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=FE(t,t.left,t.top),i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=b5(FE(c),s);i.push({id:l,data:{droppableContainer:o,value:u}})}}return i.sort(w5)},Uee=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=LE(t),i=[];for(const o of r){const{id:l}=o,c=n.get(l);if(c){const u=LE(c),d=s.reduce((h,p,g)=>h+b5(u[g],p),0),f=Number((d/4).toFixed(4));i.push({id:l,data:{droppableContainer:o,value:f}})}}return i.sort(w5)};function Vee(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,l=i-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const i of r){const{id:o}=i,l=n.get(o);if(l){const c=Vee(l,t);c>0&&s.push({id:o,data:{droppableContainer:i,value:c}})}}return s.sort(Bee)};function Hee(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function S5(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:oi}function Gee(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i({...o,top:o.top+e*l.y,bottom:o.bottom+e*l.y,left:o.left+e*l.x,right:o.right+e*l.x}),{...n})}}const qee=Gee(1);function Kee(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Xee(e,t,n){const r=Kee(t);if(!r)return e;const{scaleX:s,scaleY:i,x:o,y:l}=r,c=e.left-o-(1-s)*parseFloat(n),u=e.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),d=s?e.width/s:e.width,f=i?e.height/i:e.height;return{width:d,height:f,top:u,right:c+d,bottom:u+f,left:c}}const Yee={ignoreTransform:!1};function cd(e,t){t===void 0&&(t=Yee);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:d}=Kr(e).getComputedStyle(e);u&&(n=Xee(n,u,d))}const{top:r,left:s,width:i,height:o,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:o,bottom:l,right:c}}function BE(e){return cd(e,{ignoreTransform:!0})}function Zee(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Qee(e,t){return t===void 0&&(t=Kr(e).getComputedStyle(e)),t.position==="fixed"}function Jee(e,t){t===void 0&&(t=Kr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function vx(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(T_(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!Ip(s)||v5(s)||n.includes(s))return n;const i=Kr(e).getComputedStyle(s);return s!==e&&Jee(s,i)&&n.push(s),Qee(s,i)?n:r(s.parentNode)}return e?r(e):n}function N5(e){const[t]=vx(e,1);return t??null}function ub(e){return!gx||!e?null:od(e)?e:k_(e)?T_(e)||e===ld(e).scrollingElement?window:Ip(e)?e:null:null}function _5(e){return od(e)?e.scrollX:e.scrollLeft}function P5(e){return od(e)?e.scrollY:e.scrollTop}function E1(e){return{x:_5(e),y:P5(e)}}var Xn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Xn||(Xn={}));function C5(e){return!gx||!e?!1:e===document.scrollingElement}function A5(e){const t={x:0,y:0},n=C5(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,l=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:l,maxScroll:r,minScroll:t}}const ete={x:.2,y:.2};function tte(e,t,n,r,s){let{top:i,left:o,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=ete);const{isTop:u,isBottom:d,isLeft:f,isRight:h}=A5(e),p={x:0,y:0},g={x:0,y:0},m={height:t.height*s.y,width:t.width*s.x};return!u&&i<=t.top+m.height?(p.y=Xn.Backward,g.y=r*Math.abs((t.top+m.height-i)/m.height)):!d&&c>=t.bottom-m.height&&(p.y=Xn.Forward,g.y=r*Math.abs((t.bottom-m.height-c)/m.height)),!h&&l>=t.right-m.width?(p.x=Xn.Forward,g.x=r*Math.abs((t.right-m.width-l)/m.width)):!f&&o<=t.left+m.width&&(p.x=Xn.Backward,g.x=r*Math.abs((t.left+m.width-o)/m.width)),{direction:p,speed:g}}function nte(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function E5(e){return e.reduce((t,n)=>Hc(t,E1(n)),oi)}function rte(e){return e.reduce((t,n)=>t+_5(n),0)}function ste(e){return e.reduce((t,n)=>t+P5(n),0)}function ite(e,t){if(t===void 0&&(t=cd),!e)return;const{top:n,left:r,bottom:s,right:i}=t(e);N5(e)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ate=[["x",["left","right"],rte],["y",["top","bottom"],ste]];class M_{constructor(t,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=vx(n),s=E5(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,l]of ate)for(const c of o)Object.defineProperty(this,c,{get:()=>{const u=l(r),d=s[i]-u;return this.rect[c]+d},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Sf{constructor(t){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=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ote(e){const{EventTarget:t}=Kr(e);return e instanceof t?e:ld(e)}function db(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var xs;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(xs||(xs={}));function zE(e){e.preventDefault()}function lte(e){e.stopPropagation()}var $t;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})($t||($t={}));const O5={start:[$t.Space,$t.Enter],cancel:[$t.Esc],end:[$t.Space,$t.Enter,$t.Tab]},cte=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case $t.Right:return{...n,x:n.x+25};case $t.Left:return{...n,x:n.x-25};case $t.Down:return{...n,y:n.y+25};case $t.Up:return{...n,y:n.y-25}}};class R_{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new Sf(ld(n)),this.windowListeners=new Sf(Kr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(xs.Resize,this.handleCancel),this.windowListeners.add(xs.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(xs.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&ite(r),n(oi)}handleKeyDown(t){if(I_(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=O5,coordinateGetter:o=cte,scrollBehavior:l="smooth"}=s,{code:c}=t;if(i.end.includes(c)){this.handleEnd(t);return}if(i.cancel.includes(c)){this.handleCancel(t);return}const{collisionRect:u}=r.current,d=u?{x:u.left,y:u.top}:oi;this.referenceCoordinates||(this.referenceCoordinates=d);const f=o(t,{active:n,context:r.current,currentCoordinates:d});if(f){const h=_h(f,d),p={x:0,y:0},{scrollableAncestors:g}=r.current;for(const m of g){const x=t.code,{isTop:b,isRight:y,isLeft:w,isBottom:j,maxScroll:S,minScroll:N}=A5(m),P=nte(m),_={x:Math.min(x===$t.Right?P.right-P.width/2:P.right,Math.max(x===$t.Right?P.left:P.left+P.width/2,f.x)),y:Math.min(x===$t.Down?P.bottom-P.height/2:P.bottom,Math.max(x===$t.Down?P.top:P.top+P.height/2,f.y))},A=x===$t.Right&&!y||x===$t.Left&&!w,O=x===$t.Down&&!j||x===$t.Up&&!b;if(A&&_.x!==f.x){const T=m.scrollLeft+h.x,k=x===$t.Right&&T<=S.x||x===$t.Left&&T>=N.x;if(k&&!h.y){m.scrollTo({left:T,behavior:l});return}k?p.x=m.scrollLeft-T:p.x=x===$t.Right?m.scrollLeft-S.x:m.scrollLeft-N.x,p.x&&m.scrollBy({left:-p.x,behavior:l});break}else if(O&&_.y!==f.y){const T=m.scrollTop+h.y,k=x===$t.Down&&T<=S.y||x===$t.Up&&T>=N.y;if(k&&!h.x){m.scrollTo({top:T,behavior:l});return}k?p.y=m.scrollTop-T:p.y=x===$t.Down?m.scrollTop-S.y:m.scrollTop-N.y,p.y&&m.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,Hc(_h(f,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}R_.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=O5,onActivation:s}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const l=i.activatorNode.current;return l&&e.target!==l?!1:(e.preventDefault(),s==null||s({event:e.nativeEvent}),!0)}return!1}}];function UE(e){return!!(e&&"distance"in e)}function VE(e){return!!(e&&"delay"in e)}class D_{constructor(t,n,r){var s;r===void 0&&(r=ote(t.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=t,this.events=n;const{event:i}=t,{target:o}=i;this.props=t,this.events=n,this.document=ld(o),this.documentListeners=new Sf(this.document),this.listeners=new Sf(r),this.windowListeners=new Sf(Kr(o)),this.initialCoordinates=(s=A1(i))!=null?s:oi,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:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(xs.Resize,this.handleCancel),this.windowListeners.add(xs.DragStart,zE),this.windowListeners.add(xs.VisibilityChange,this.handleCancel),this.windowListeners.add(xs.ContextMenu,zE),this.documentListeners.add(xs.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(VE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(UE(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(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(xs.Click,lte,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(xs.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=A1(t))!=null?n:oi,u=_h(s,c);if(!r&&l){if(UE(l)){if(l.tolerance!=null&&db(u,l.tolerance))return this.handleCancel();if(db(u,l.distance))return this.handleStart()}if(VE(l)&&db(u,l.tolerance))return this.handleCancel();this.handlePending(l,u);return}t.cancelable&&t.preventDefault(),o(c)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===$t.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const ute={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class L_ extends D_{constructor(t){const{event:n}=t,r=ld(n.target);super(t,ute,r)}}L_.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const dte={move:{name:"mousemove"},end:{name:"mouseup"}};var O1;(function(e){e[e.RightClick=2]="RightClick"})(O1||(O1={}));class fte extends D_{constructor(t){super(t,dte,ld(t.event.target))}}fte.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===O1.RightClick?!1:(r==null||r({event:n}),!0)}}];const fb={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class hte extends D_{constructor(t){super(t,fb)}static setup(){return window.addEventListener(fb.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(fb.move.name,t)};function t(){}}}hte.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r==null||r({event:n}),!0)}}];var Nf;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Nf||(Nf={}));var fv;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(fv||(fv={}));function pte(e){let{acceleration:t,activator:n=Nf.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:l=fv.TreeOrder,pointerCoordinates:c,scrollableAncestors:u,scrollableAncestorRects:d,delta:f,threshold:h}=e;const p=gte({delta:f,disabled:!i}),[g,m]=Pee(),x=v.useRef({x:0,y:0}),b=v.useRef({x:0,y:0}),y=v.useMemo(()=>{switch(n){case Nf.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Nf.DraggableRect:return s}},[n,s,c]),w=v.useRef(null),j=v.useCallback(()=>{const N=w.current;if(!N)return;const P=x.current.x*b.current.x,_=x.current.y*b.current.y;N.scrollBy(P,_)},[]),S=v.useMemo(()=>l===fv.TreeOrder?[...u].reverse():u,[l,u]);v.useEffect(()=>{if(!i||!u.length||!y){m();return}for(const N of S){if((r==null?void 0:r(N))===!1)continue;const P=u.indexOf(N),_=d[P];if(!_)continue;const{direction:A,speed:O}=tte(N,_,y,t,h);for(const T of["x","y"])p[T][A[T]]||(O[T]=0,A[T]=0);if(O.x>0||O.y>0){m(),w.current=N,g(j,o),x.current=O,b.current=A;return}}x.current={x:0,y:0},b.current={x:0,y:0},m()},[t,j,r,m,i,o,JSON.stringify(y),JSON.stringify(p),g,u,S,d,JSON.stringify(h)])}const mte={x:{[Xn.Backward]:!1,[Xn.Forward]:!1},y:{[Xn.Backward]:!1,[Xn.Forward]:!1}};function gte(e){let{delta:t,disabled:n}=e;const r=C1(t);return Mp(s=>{if(n||!r||!s)return mte;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Xn.Backward]:s.x[Xn.Backward]||i.x===-1,[Xn.Forward]:s.x[Xn.Forward]||i.x===1},y:{[Xn.Backward]:s.y[Xn.Backward]||i.y===-1,[Xn.Forward]:s.y[Xn.Forward]||i.y===1}}},[n,t,r])}function vte(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return Mp(s=>{var i;return t==null?null:(i=r??s)!=null?i:null},[r,t])}function yte(e,t){return v.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...i]},[]),[e,t])}var Ph;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ph||(Ph={}));var k1;(function(e){e.Optimized="optimized"})(k1||(k1={}));const WE=new Map;function xte(e,t){let{dragging:n,dependencies:r,config:s}=t;const[i,o]=v.useState(null),{frequency:l,measure:c,strategy:u}=s,d=v.useRef(e),f=x(),h=Nh(f),p=v.useCallback(function(b){b===void 0&&(b=[]),!h.current&&o(y=>y===null?b:y.concat(b.filter(w=>!y.includes(w))))},[h]),g=v.useRef(null),m=Mp(b=>{if(f&&!n)return WE;if(!b||b===WE||d.current!==e||i!=null){const y=new Map;for(let w of e){if(!w)continue;if(i&&i.length>0&&!i.includes(w.id)&&w.rect.current){y.set(w.id,w.rect.current);continue}const j=w.node.current,S=j?new M_(c(j),j):null;w.rect.current=S,S&&y.set(w.id,S)}return y}return b},[e,i,n,f,c]);return v.useEffect(()=>{d.current=e},[e]),v.useEffect(()=>{f||p()},[n,f]),v.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),v.useEffect(()=>{f||typeof l!="number"||g.current!==null||(g.current=setTimeout(()=>{p(),g.current=null},l))},[l,f,p,...r]),{droppableRects:m,measureDroppableContainers:p,measuringScheduled:i!=null};function x(){switch(u){case Ph.Always:return!1;case Ph.BeforeDragging:return n;default:return!n}}}function k5(e,t){return Mp(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function bte(e,t){return k5(e,t)}function wte(e){let{callback:t,disabled:n}=e;const r=$_(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return v.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function yx(e){let{callback:t,disabled:n}=e;const r=$_(t),s=v.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return v.useEffect(()=>()=>s==null?void 0:s.disconnect(),[s]),s}function jte(e){return new M_(cd(e),e)}function HE(e,t,n){t===void 0&&(t=jte);const[r,s]=v.useState(null);function i(){s(c=>{if(!e)return null;if(e.isConnected===!1){var u;return(u=c??n)!=null?u:null}const d=t(e);return JSON.stringify(c)===JSON.stringify(d)?c:d})}const o=wte({callback(c){if(e)for(const u of c){const{type:d,target:f}=u;if(d==="childList"&&f instanceof HTMLElement&&f.contains(e)){i();break}}}}),l=yx({callback:i});return Di(()=>{i(),e?(l==null||l.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(l==null||l.disconnect(),o==null||o.disconnect())},[e]),r}function Ste(e){const t=k5(e);return S5(e,t)}const GE=[];function Nte(e){const t=v.useRef(e),n=Mp(r=>e?r&&r!==GE&&e&&t.current&&e.parentNode===t.current.parentNode?r:vx(e):GE,[e]);return v.useEffect(()=>{t.current=e},[e]),n}function _te(e){const[t,n]=v.useState(null),r=v.useRef(e),s=v.useCallback(i=>{const o=ub(i.target);o&&n(l=>l?(l.set(o,E1(o)),new Map(l)):null)},[]);return v.useEffect(()=>{const i=r.current;if(e!==i){o(i);const l=e.map(c=>{const u=ub(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,E1(u)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=e}return()=>{o(e),o(i)};function o(l){l.forEach(c=>{const u=ub(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),v.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>Hc(i,o),oi):E5(e):oi,[e,t])}function qE(e,t){t===void 0&&(t=[]);const n=v.useRef(null);return v.useEffect(()=>{n.current=null},t),v.useEffect(()=>{const r=e!==oi;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?_h(e,n.current):oi}function Pte(e){v.useEffect(()=>{if(!gx)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function Cte(e,t){return v.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,t)},n},{}),[e,t])}function T5(e){return v.useMemo(()=>e?Zee(e):null,[e])}const KE=[];function Ate(e,t){t===void 0&&(t=cd);const[n]=e,r=T5(n?Kr(n):null),[s,i]=v.useState(KE);function o(){i(()=>e.length?e.map(c=>C5(c)?r:new M_(t(c),c)):KE)}const l=yx({callback:o});return Di(()=>{l==null||l.disconnect(),o(),e.forEach(c=>l==null?void 0:l.observe(c))},[e]),s}function Ete(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ip(t)?t:e}function Ote(e){let{measure:t}=e;const[n,r]=v.useState(null),s=v.useCallback(u=>{for(const{target:d}of u)if(Ip(d)){r(f=>{const h=t(d);return f?{...f,width:h.width,height:h.height}:h});break}},[t]),i=yx({callback:s}),o=v.useCallback(u=>{const d=Ete(u);i==null||i.disconnect(),d&&(i==null||i.observe(d)),r(d?t(d):null)},[t,i]),[l,c]=uv(o);return v.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const kte=[{sensor:L_,options:{}},{sensor:R_,options:{}}],Tte={current:{}},tg={draggable:{measure:BE},droppable:{measure:BE,strategy:Ph.WhileDragging,frequency:k1.Optimized},dragOverlay:{measure:cd}};class _f extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const $te={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new _f,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:dv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:tg,measureDroppableContainers:dv,windowRect:null,measuringScheduled:!1},Ite={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:dv,draggableNodes:new Map,over:null,measureDroppableContainers:dv},xx=v.createContext(Ite),$5=v.createContext($te);function Mte(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new _f}}}function Rte(e,t){switch(t.type){case Un.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Un.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Un.DragEnd:case Un.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Un.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new _f(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case Un.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new _f(e.droppable.containers);return o.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Un.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new _f(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function Dte(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=v.useContext(xx),i=C1(r),o=C1(n==null?void 0:n.id);return v.useEffect(()=>{if(!t&&!r&&i&&o!=null){if(!I_(i)||document.activeElement===i.target)return;const l=s.get(o);if(!l)return;const{activatorNode:c,node:u}=l;if(!c.current&&!u.current)return;requestAnimationFrame(()=>{for(const d of[c.current,u.current]){if(!d)continue;const f=Eee(d);if(f){f.focus();break}}})}},[r,t,s,o,i]),null}function Lte(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),n):n}function Fte(e){return v.useMemo(()=>({draggable:{...tg.draggable,...e==null?void 0:e.draggable},droppable:{...tg.droppable,...e==null?void 0:e.droppable},dragOverlay:{...tg.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function Bte(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const i=v.useRef(!1),{x:o,y:l}=typeof s=="boolean"?{x:s,y:s}:s;Di(()=>{if(!o&&!l||!t){i.current=!1;return}if(i.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const d=n(u),f=S5(d,r);if(o||(f.x=0),l||(f.y=0),i.current=!0,Math.abs(f.x)>0||Math.abs(f.y)>0){const h=N5(u);h&&h.scrollBy({top:f.y,left:f.x})}},[t,o,l,r,n])}const I5=v.createContext({...oi,scaleX:1,scaleY:1});var qa;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(qa||(qa={}));const zte=v.memo(function(t){var n,r,s,i;let{id:o,accessibility:l,autoScroll:c=!0,children:u,sensors:d=kte,collisionDetection:f=Wee,measuring:h,modifiers:p,...g}=t;const m=v.useReducer(Rte,void 0,Mte),[x,b]=m,[y,w]=Mee(),[j,S]=v.useState(qa.Uninitialized),N=j===qa.Initialized,{draggable:{active:P,nodes:_,translate:A},droppable:{containers:O}}=x,T=P!=null?_.get(P):null,k=v.useRef({initial:null,translated:null}),M=v.useMemo(()=>{var q;return P!=null?{id:P,data:(q=T==null?void 0:T.data)!=null?q:Tte,rect:k}:null},[P,T]),R=v.useRef(null),[H,F]=v.useState(null),[V,$]=v.useState(null),L=Nh(g,Object.values(g)),Y=Rp("DndDescribedBy",o),Q=v.useMemo(()=>O.getEnabled(),[O]),ee=Fte(h),{droppableRects:fe,measureDroppableContainers:W,measuringScheduled:he}=xte(Q,{dragging:N,dependencies:[A.x,A.y],config:ee.droppable}),pe=vte(_,P),ue=v.useMemo(()=>V?A1(V):null,[V]),Ae=Dn(),de=bte(pe,ee.draggable.measure);Bte({activeNode:P!=null?_.get(P):null,config:Ae.layoutShiftCompensation,initialRect:de,measure:ee.draggable.measure});const oe=HE(pe,ee.draggable.measure,de),xe=HE(pe?pe.parentElement:null),te=v.useRef({activatorEvent:null,active:null,activeNode:pe,collisionRect:null,collisions:null,droppableRects:fe,draggableNodes:_,draggingNode:null,draggingNodeRect:null,droppableContainers:O,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Ye=O.getNodeFor((n=te.current.over)==null?void 0:n.id),G=Ote({measure:ee.dragOverlay.measure}),ve=(r=G.nodeRef.current)!=null?r:pe,Pe=N?(s=G.rect)!=null?s:oe:null,Ie=!!(G.nodeRef.current&&G.rect),E=Ste(Ie?null:oe),D=T5(ve?Kr(ve):null),U=Nte(N?Ye??pe:null),K=Ate(U),J=Lte(p,{transform:{x:A.x-E.x,y:A.y-E.y,scaleX:1,scaleY:1},activatorEvent:V,active:M,activeNodeRect:oe,containerNodeRect:xe,draggingNodeRect:Pe,over:te.current.over,overlayNodeRect:G.rect,scrollableAncestors:U,scrollableAncestorRects:K,windowRect:D}),X=ue?Hc(ue,A):null,be=_te(U),_e=qE(be),Fe=qE(be,[oe]),ie=Hc(J,_e),Te=Pe?qee(Pe,J):null,Be=M&&Te?f({active:M,collisionRect:Te,droppableRects:fe,droppableContainers:Q,pointerCoordinates:X}):null,gt=j5(Be,"id"),[At,pn]=v.useState(null),Zt=Ie?J:Hc(J,Fe),bn=Hee(Zt,(i=At==null?void 0:At.rect)!=null?i:null,oe),Xt=v.useRef(null),yt=v.useCallback((q,we)=>{let{sensor:I,options:Z}=we;if(R.current==null)return;const ne=_.get(R.current);if(!ne)return;const B=q.nativeEvent,z=new I({active:R.current,activeNode:ne,event:B,options:Z,context:te,onAbort(me){if(!_.get(me))return;const{onDragAbort:Ue}=L.current,Ne={id:me};Ue==null||Ue(Ne),y({type:"onDragAbort",event:Ne})},onPending(me,le,Ue,Ne){if(!_.get(me))return;const{onDragPending:Se}=L.current,at={id:me,constraint:le,initialCoordinates:Ue,offset:Ne};Se==null||Se(at),y({type:"onDragPending",event:at})},onStart(me){const le=R.current;if(le==null)return;const Ue=_.get(le);if(!Ue)return;const{onDragStart:Ne}=L.current,ze={activatorEvent:B,active:{id:le,data:Ue.data,rect:k}};Xs.unstable_batchedUpdates(()=>{Ne==null||Ne(ze),S(qa.Initializing),b({type:Un.DragStart,initialCoordinates:me,active:le}),y({type:"onDragStart",event:ze}),F(Xt.current),$(B)})},onMove(me){b({type:Un.DragMove,coordinates:me})},onEnd:re(Un.DragEnd),onCancel:re(Un.DragCancel)});Xt.current=z;function re(me){return async function(){const{active:Ue,collisions:Ne,over:ze,scrollAdjustedTranslate:Se}=te.current;let at=null;if(Ue&&Se){const{cancelDrop:Ce}=L.current;at={activatorEvent:B,active:Ue,collisions:Ne,delta:Se,over:ze},me===Un.DragEnd&&typeof Ce=="function"&&await Promise.resolve(Ce(at))&&(me=Un.DragCancel)}R.current=null,Xs.unstable_batchedUpdates(()=>{b({type:me}),S(qa.Uninitialized),pn(null),F(null),$(null),Xt.current=null;const Ce=me===Un.DragEnd?"onDragEnd":"onDragCancel";if(at){const ut=L.current[Ce];ut==null||ut(at),y({type:Ce,event:at})}})}}},[_]),Rr=v.useCallback((q,we)=>(I,Z)=>{const ne=I.nativeEvent,B=_.get(Z);if(R.current!==null||!B||ne.dndKit||ne.defaultPrevented)return;const z={active:B};q(I,we.options,z)===!0&&(ne.dndKit={capturedBy:we.sensor},R.current=Z,yt(I,we))},[_,yt]),tt=yte(d,Rr);Pte(d),Di(()=>{oe&&j===qa.Initializing&&S(qa.Initialized)},[oe,j]),v.useEffect(()=>{const{onDragMove:q}=L.current,{active:we,activatorEvent:I,collisions:Z,over:ne}=te.current;if(!we||!I)return;const B={active:we,activatorEvent:I,collisions:Z,delta:{x:ie.x,y:ie.y},over:ne};Xs.unstable_batchedUpdates(()=>{q==null||q(B),y({type:"onDragMove",event:B})})},[ie.x,ie.y]),v.useEffect(()=>{const{active:q,activatorEvent:we,collisions:I,droppableContainers:Z,scrollAdjustedTranslate:ne}=te.current;if(!q||R.current==null||!we||!ne)return;const{onDragOver:B}=L.current,z=Z.get(gt),re=z&&z.rect.current?{id:z.id,rect:z.rect.current,data:z.data,disabled:z.disabled}:null,me={active:q,activatorEvent:we,collisions:I,delta:{x:ne.x,y:ne.y},over:re};Xs.unstable_batchedUpdates(()=>{pn(re),B==null||B(me),y({type:"onDragOver",event:me})})},[gt]),Di(()=>{te.current={activatorEvent:V,active:M,activeNode:pe,collisionRect:Te,collisions:Be,droppableRects:fe,draggableNodes:_,draggingNode:ve,draggingNodeRect:Pe,droppableContainers:O,over:At,scrollableAncestors:U,scrollAdjustedTranslate:ie},k.current={initial:Pe,translated:Te}},[M,pe,Be,Te,_,ve,Pe,fe,O,At,U,ie]),pte({...Ae,delta:A,draggingRect:Te,pointerCoordinates:X,scrollableAncestors:U,scrollableAncestorRects:K});const It=v.useMemo(()=>({active:M,activeNode:pe,activeNodeRect:oe,activatorEvent:V,collisions:Be,containerNodeRect:xe,dragOverlay:G,draggableNodes:_,droppableContainers:O,droppableRects:fe,over:At,measureDroppableContainers:W,scrollableAncestors:U,scrollableAncestorRects:K,measuringConfiguration:ee,measuringScheduled:he,windowRect:D}),[M,pe,oe,V,Be,xe,G,_,O,fe,At,W,U,K,ee,he,D]),kt=v.useMemo(()=>({activatorEvent:V,activators:tt,active:M,activeNodeRect:oe,ariaDescribedById:{draggable:Y},dispatch:b,draggableNodes:_,over:At,measureDroppableContainers:W}),[V,tt,M,oe,b,Y,_,At,W]);return C.createElement(x5.Provider,{value:w},C.createElement(xx.Provider,{value:kt},C.createElement($5.Provider,{value:It},C.createElement(I5.Provider,{value:bn},u)),C.createElement(Dte,{disabled:(l==null?void 0:l.restoreFocus)===!1})),C.createElement(Lee,{...l,hiddenTextDescribedById:Y}));function Dn(){const q=(H==null?void 0:H.autoScrollEnabled)===!1,we=typeof c=="object"?c.enabled===!1:c===!1,I=N&&!q&&!we;return typeof c=="object"?{...c,enabled:I}:{enabled:I}}}),Ute=v.createContext(null),XE="button",Vte="Draggable";function Wte(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const i=Rp(Vte),{activators:o,activatorEvent:l,active:c,activeNodeRect:u,ariaDescribedById:d,draggableNodes:f,over:h}=v.useContext(xx),{role:p=XE,roleDescription:g="draggable",tabIndex:m=0}=s??{},x=(c==null?void 0:c.id)===t,b=v.useContext(x?I5:Ute),[y,w]=uv(),[j,S]=uv(),N=Cte(o,t),P=Nh(n);Di(()=>(f.set(t,{id:t,key:i,node:y,activatorNode:j,data:P}),()=>{const A=f.get(t);A&&A.key===i&&f.delete(t)}),[f,t]);const _=v.useMemo(()=>({role:p,tabIndex:m,"aria-disabled":r,"aria-pressed":x&&p===XE?!0:void 0,"aria-roledescription":g,"aria-describedby":d.draggable}),[r,p,m,x,g,d.draggable]);return{active:c,activatorEvent:l,activeNodeRect:u,attributes:_,isDragging:x,listeners:r?void 0:N,node:y,over:h,setNodeRef:w,setActivatorNodeRef:S,transform:b}}function Hte(){return v.useContext($5)}const Gte="Droppable",qte={timeout:25};function Kte(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const i=Rp(Gte),{active:o,dispatch:l,over:c,measureDroppableContainers:u}=v.useContext(xx),d=v.useRef({disabled:n}),f=v.useRef(!1),h=v.useRef(null),p=v.useRef(null),{disabled:g,updateMeasurementsFor:m,timeout:x}={...qte,...s},b=Nh(m??r),y=v.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},x)},[x]),w=yx({callback:y,disabled:g||!o}),j=v.useCallback((_,A)=>{w&&(A&&(w.unobserve(A),f.current=!1),_&&w.observe(_))},[w]),[S,N]=uv(j),P=Nh(t);return v.useEffect(()=>{!w||!S.current||(w.disconnect(),f.current=!1,w.observe(S.current))},[S,w]),v.useEffect(()=>(l({type:Un.RegisterDroppable,element:{id:r,key:i,disabled:n,node:S,rect:h,data:P}}),()=>l({type:Un.UnregisterDroppable,key:i,id:r})),[r]),v.useEffect(()=>{n!==d.current.disabled&&(l({type:Un.SetDroppableDisabled,id:r,key:i,disabled:n}),d.current.disabled=n)},[r,i,n,l]),{active:o,rect:h,isOver:(c==null?void 0:c.id)===r,node:S,over:c,setNodeRef:N}}function hv(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function Xte(e,t){return e.reduce((n,r,s)=>{const i=t.get(r);return i&&(n[s]=i),n},Array(e.length))}function bm(e){return e!==null&&e>=0}function Yte(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeIndex:n,overIndex:r,index:s}=e;const i=hv(t,r,n),o=t[s],l=i[s];return!l||!o?null:{x:l.left-o.left,y:l.top-o.top,scaleX:l.width/o.width,scaleY:l.height/o.height}},wm={scaleX:1,scaleY:1},Bd=e=>{var t;let{activeIndex:n,activeNodeRect:r,index:s,rects:i,overIndex:o}=e;const l=(t=i[n])!=null?t:r;if(!l)return null;if(s===n){const u=i[o];return u?{x:0,y:nn&&s<=o?{x:0,y:-l.height-c,...wm}:s=o?{x:0,y:l.height+c,...wm}:{x:0,y:0,...wm}};function Qte(e,t,n){const r=e[t],s=e[t-1],i=e[t+1];return r?nr.map(N=>typeof N=="object"&&"id"in N?N.id:N),[r]),g=o!=null,m=o?p.indexOf(o.id):-1,x=u?p.indexOf(u.id):-1,b=v.useRef(p),y=!Yte(p,b.current),w=x!==-1&&m===-1||y,j=Zte(i);Di(()=>{y&&g&&d(p)},[y,p,g,d]),v.useEffect(()=>{b.current=p},[p]);const S=v.useMemo(()=>({activeIndex:m,containerId:f,disabled:j,disableTransforms:w,items:p,overIndex:x,useDragOverlay:h,sortedRects:Xte(p,c),strategy:s}),[m,f,j.draggable,j.droppable,w,p,x,c,h,s]);return C.createElement(D5.Provider,{value:S},t)}const Jte=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return hv(n,r,s).indexOf(t)},ene=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:i,newIndex:o,previousItems:l,previousContainerId:c,transition:u}=e;return!u||!r||l!==i&&s===o?!1:n?!0:o!==s&&t===c},tne={duration:200,easing:"ease"},L5="transform",nne=vu.Transition.toString({property:L5,duration:0,easing:"linear"}),rne={roleDescription:"sortable"};function sne(e){let{disabled:t,index:n,node:r,rect:s}=e;const[i,o]=v.useState(null),l=v.useRef(n);return Di(()=>{if(!t&&n!==l.current&&r.current){const c=s.current;if(c){const u=cd(r.current,{ignoreTransform:!0}),d={x:c.left-u.left,y:c.top-u.top,scaleX:c.width/u.width,scaleY:c.height/u.height};(d.x||d.y)&&o(d)}}n!==l.current&&(l.current=n)},[t,n,r,s]),v.useEffect(()=>{i&&o(null)},[i]),i}function YE(e){let{animateLayoutChanges:t=ene,attributes:n,disabled:r,data:s,getNewIndex:i=Jte,id:o,strategy:l,resizeObserverConfig:c,transition:u=tne}=e;const{items:d,containerId:f,activeIndex:h,disabled:p,disableTransforms:g,sortedRects:m,overIndex:x,useDragOverlay:b,strategy:y}=v.useContext(D5),w=ine(r,p),j=d.indexOf(o),S=v.useMemo(()=>({sortable:{containerId:f,index:j,items:d},...s}),[f,s,j,d]),N=v.useMemo(()=>d.slice(d.indexOf(o)),[d,o]),{rect:P,node:_,isOver:A,setNodeRef:O}=Kte({id:o,data:S,disabled:w.droppable,resizeObserverConfig:{updateMeasurementsFor:N,...c}}),{active:T,activatorEvent:k,activeNodeRect:M,attributes:R,setNodeRef:H,listeners:F,isDragging:V,over:$,setActivatorNodeRef:L,transform:Y}=Wte({id:o,data:S,attributes:{...rne,...n},disabled:w.draggable}),Q=_ee(O,H),ee=!!T,fe=ee&&!g&&bm(h)&&bm(x),W=!b&&V,he=W&&fe?Y:null,ue=fe?he??(l??y)({rects:m,activeNodeRect:M,activeIndex:h,overIndex:x,index:j}):null,Ae=bm(h)&&bm(x)?i({id:o,items:d,activeIndex:h,overIndex:x}):j,de=T==null?void 0:T.id,oe=v.useRef({activeId:de,items:d,newIndex:Ae,containerId:f}),xe=d!==oe.current.items,te=t({active:T,containerId:f,isDragging:V,isSorting:ee,id:o,index:j,items:d,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:u,wasDragging:oe.current.activeId!=null}),Ye=sne({disabled:!te,index:j,node:_,rect:P});return v.useEffect(()=>{ee&&oe.current.newIndex!==Ae&&(oe.current.newIndex=Ae),f!==oe.current.containerId&&(oe.current.containerId=f),d!==oe.current.items&&(oe.current.items=d)},[ee,Ae,f,d]),v.useEffect(()=>{if(de===oe.current.activeId)return;if(de!=null&&oe.current.activeId==null){oe.current.activeId=de;return}const ve=setTimeout(()=>{oe.current.activeId=de},50);return()=>clearTimeout(ve)},[de]),{active:T,activeIndex:h,attributes:R,data:S,rect:P,index:j,newIndex:Ae,items:d,isOver:A,isSorting:ee,isDragging:V,listeners:F,node:_,overIndex:x,over:$,setNodeRef:Q,setActivatorNodeRef:L,setDroppableNodeRef:O,setDraggableNodeRef:H,transform:Ye??ue,transition:G()};function G(){if(Ye||xe&&oe.current.newIndex===j)return nne;if(!(W&&!I_(k)||!u)&&(ee||te))return vu.Transition.toString({...u,property:L5})}}function ine(e,t){var n,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(r=e==null?void 0:e.droppable)!=null?r:t.droppable}}function pv(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const ane=[$t.Down,$t.Right,$t.Up,$t.Left],one=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:o,scrollableAncestors:l}}=t;if(ane.includes(e.code)){if(e.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(f=>{if(!f||f!=null&&f.disabled)return;const h=s.get(f.id);if(h)switch(e.code){case $t.Down:r.toph.top&&c.push(f);break;case $t.Left:r.left>h.left&&c.push(f);break;case $t.Right:r.left1&&(d=u[1].id),d!=null){const f=i.get(n.id),h=i.get(d),p=h?s.get(h.id):null,g=h==null?void 0:h.node.current;if(g&&p&&f&&h){const x=vx(g).some((N,P)=>l[P]!==N),b=F5(f,h),y=lne(f,h),w=x||!b?{x:0,y:0}:{x:y?r.width-p.width:0,y:y?r.height-p.height:0},j={x:p.left,y:p.top};return w.x&&w.y?j:_h(j,w)}}}};function F5(e,t){return!pv(e)||!pv(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function lne(e,t){return!pv(e)||!pv(t)||!F5(e,t)?!1:e.data.current.sortable.index{const{discussionGuide:t,moderatorStatus:n,onSectionSelect:r,onSetPosition:s,onSave:i,showProgress:o=!0,collapsible:l=!0,defaultExpanded:c=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h}=e;console.log("DiscussionGuideViewer props received ["+(e.key||"no-key")+"]:",{defaultExpanded:c,showProgress:o,collapsible:l,discussionGuideType:typeof t,propDefaultExpanded:e.defaultExpanded,allProps:e});const p=typeof t=="string",[g,m]=v.useState(null),[x,b]=v.useState(!1),y=v.useMemo(()=>p?null:x&&g?(console.log("🔄 Using pending updates for display"),g):t,[t,p,g,x]);v.useEffect(()=>{if(!x||!g)return;const G=t;G&&JSON.stringify(G)===JSON.stringify(g)&&(console.log("✅ Props updated to match pending changes, clearing pending updates"),m(null),b(!1))},[t,g,x]);const[w,j]=v.useState(new Set),[S,N]=v.useState(null),[P,_]=v.useState(null),[A,O]=v.useState(!1),T=Fee(DE(L_,{activationConstraint:{distance:8}}),DE(R_,{coordinateGetter:one}));v.useEffect(()=>{var G,ve,Pe,Ie;if(S&&y){const E=y.sections.find(D=>D.id===S);if(E&&P){const D=((G=P.activities)==null?void 0:G.map(X=>X.id).join(","))||"",U=((ve=E.activities)==null?void 0:ve.map(X=>X.id).join(","))||"",K=((Pe=P.questions)==null?void 0:Pe.map(X=>X.id).join(","))||"",J=((Ie=E.questions)==null?void 0:Ie.map(X=>X.id).join(","))||"";(D!==U||K!==J)&&(console.log("📝 Syncing editing section with updated guide structure"),_({...E}))}}},[y,S,P]);const k=G=>{N(G.id),_({...G}),j(ve=>new Set(ve).add(G.id))},M=()=>{N(null),_(null)},R=G=>{P&&_({...P,...G})},H=(G,ve,Pe)=>{var D;if(!P)return;const Ie=Pe==="question"?"questions":"activities",E=((D=P[Ie])==null?void 0:D.map(U=>U.id===G?{...U,...ve}:U))||[];_({...P,[Ie]:E})},F=async(G,ve)=>{var D;if(!P||!y||!i)return;const Pe=ve==="question"?"questions":"activities",Ie=((D=P[Pe])==null?void 0:D.filter(U=>U.id!==G))||[],E={...P,[Pe]:Ie};_(E);try{const U={...y,sections:y.sections.map(K=>K.id===P.id?E:K)};await i(U),ce.success("Item deleted successfully")}catch(U){console.error("Error deleting item:",U),ce.error("Failed to delete item"),_(P)}},V=G=>{if(!P)return;const ve={id:`${G}_${Date.now()}`,type:G==="question"?"open_question":"moderator_statement",content:`New ${G}`,probes:G==="question"?[]:void 0},Pe=G==="question"?"questions":"activities",Ie=P[Pe]||[];_({...P,[Pe]:[...Ie,ve]})},$=async()=>{if(!(!P||!y||!i)){O(!0);try{const G={...y,sections:y.sections.map(ve=>ve.id===P.id?P:ve)};await i(G),N(null),_(null),ce.success("Section updated successfully")}catch(G){console.error("Failed to save section:",G),ce.error("Failed to save section changes")}finally{O(!1)}}},L=async G=>{if(!(!y||!i))try{const ve={...y,sections:y.sections.filter(Pe=>Pe.id!==G)};await i(ve),S===G&&(N(null),_(null)),ce.success("Section deleted successfully")}catch(ve){console.error("Failed to delete section:",ve),ce.error("Failed to delete section")}},Y=v.useCallback(async(G,ve)=>{if(!y||!i)return;const Pe=[...y.sections],[Ie]=Pe.splice(G,1);Pe.splice(ve,0,Ie);const E={...y,sections:Pe};m(E),b(!0),console.log("💾 Calling onSave with updated guide (section move)..."),console.log("📊 Section order before:",y.sections.map(D=>D.id)),console.log("📊 Section order after:",E.sections.map(D=>D.id));try{await i(E),console.log("✅ onSave completed successfully (section move)")}catch(D){console.error("❌ onSave failed (section move), reverting:",D),m(null),b(!1)}},[y,i]),Q=v.useCallback(async(G,ve,Pe,Ie)=>{if(!y||!i)return;console.log("💾 moveItem called:",{sectionId:G,itemType:ve,fromIndex:Pe,toIndex:Ie});const E={...y,sections:y.sections.map(D=>{if(D.id===G){const U=ve==="question"?"questions":"activities",K=D[U]||[],J=hv(K,Pe,Ie);return console.log("📝 Section items reordered:",{sectionId:G,itemsKey:U,beforeIds:K.map(X=>X.id),afterIds:J.map(X=>X.id)}),{...D,[U]:J}}return D})};m(E),b(!0),console.log("💾 Calling onSave with updated guide..."),console.log("📊 Passing guide to onSave:",E);try{await i(E),console.log("✅ onSave completed successfully")}catch(D){console.error("❌ onSave failed, reverting optimistic update:",D),m(null),b(!1)}},[y,i]),ee=v.useCallback(async(G,ve,Pe,Ie,E)=>{if(!y||!i)return;console.log("💾 moveSubsectionItem called:",{sectionId:G,subsectionIndex:ve,itemType:Pe,fromIndex:Ie,toIndex:E});const D={...y,sections:y.sections.map(U=>{if(U.id===G&&U.subsections){const K=[...U.subsections],J=K[ve];if(J){const X=Pe==="question"?"questions":"activities",be=J[X]||[],_e=hv(be,Ie,E);console.log("📝 Subsection items reordered:",{sectionId:G,subsectionIndex:ve,itemsKey:X,beforeIds:be.map(Fe=>Fe.id),afterIds:_e.map(Fe=>Fe.id)}),K[ve]={...J,[X]:_e}}return{...U,subsections:K}}return U})};m(D),b(!0),console.log("💾 Calling onSave with updated guide (subsection)...");try{await i(D),console.log("✅ onSave completed successfully (subsection)")}catch(U){console.error("❌ onSave failed (subsection), reverting:",U),m(null),b(!1)}},[y,i]),fe=v.useCallback(async G=>{var D,U,K,J;const{active:ve,over:Pe}=G;if(console.log("🎯 Drag END:",{activeId:ve.id,overId:Pe==null?void 0:Pe.id,hasOver:!!Pe,sameId:ve.id===(Pe==null?void 0:Pe.id),hasGuide:!!y,timestamp:new Date().toISOString()}),!Pe||ve.id===Pe.id||!y){console.log("❌ Drag end early return");return}const Ie=String(ve.id),E=String(Pe.id);if(Ie.startsWith("section-")&&E.startsWith("section-")){const X=y.sections.findIndex(_e=>`section-${_e.id}`===Ie),be=y.sections.findIndex(_e=>`section-${_e.id}`===E);X!==-1&&be!==-1&&await Y(X,be)}else if(Ie.includes("-item-")&&E.includes("-item-")){const X=Ie.match(/^(.*?)-(subsection-\d+-)?(question|activity)-item-(.*)$/),be=E.match(/^(.*?)-(subsection-\d+-)?(question|activity)-item-(.*)$/);if(X&&be){const[,_e,Fe,ie]=X,[,Te,Be,gt]=be;if(console.log("🔍 Item drag match:",{activeId:Ie,overId:E,activeSectionId:_e,activeSubsection:Fe,activeItemType:ie,overSectionId:Te,overSubsection:Be,overItemType:gt}),_e===Te&&Fe===Be&&ie===gt){const At=y.sections.find(pn=>pn.id===_e);if(At){const pn=ie==="question"?"questions":"activities";if(Fe){const Zt=parseInt(((D=Fe.match(/subsection-(\d+)-/))==null?void 0:D[1])||"0"),bn=(U=At.subsections)==null?void 0:U[Zt];if(bn){const Xt=bn[pn]||[],yt=Xt.findIndex(tt=>Ie.endsWith(`-item-${tt.id}`)),Rr=Xt.findIndex(tt=>E.endsWith(`-item-${tt.id}`));console.log("📦 Subsection item reorder:",{subsectionIndex:Zt,oldIndex:yt,newIndex:Rr,itemsLength:Xt.length}),yt!==-1&&Rr!==-1?(console.log("🚀 About to call moveSubsectionItem..."),await ee(_e,Zt,ie,yt,Rr)):console.log("❌ Not calling moveSubsectionItem - invalid indexes:",{oldIndex:yt,newIndex:Rr})}}else{const Zt=At[pn]||[],bn=Zt.findIndex(yt=>`${_e}-${ie}-item-${yt.id}`===Ie),Xt=Zt.findIndex(yt=>`${Te}-${gt}-item-${yt.id}`===E);console.log("📦 Section item reorder:",{oldIndex:bn,newIndex:Xt,itemsLength:Zt.length,activeId:Ie,overId:E,itemIds:Zt.map(yt=>yt.id),expectedActiveId:`${_e}-${ie}-item-${(K=Zt[bn])==null?void 0:K.id}`,expectedOverId:`${Te}-${gt}-item-${(J=Zt[Xt])==null?void 0:J.id}`,oldIndexValid:bn!==-1,newIndexValid:Xt!==-1,willCallMoveItem:bn!==-1&&Xt!==-1}),bn!==-1&&Xt!==-1?(console.log("🚀 About to call moveItem..."),await Q(_e,ie,bn,Xt)):console.log("❌ Not calling moveItem - invalid indexes")}}}}}},[y,Y,Q,ee]);v.useEffect(()=>{var G;if(console.log("DiscussionGuideViewer useEffect:",{defaultExpanded:c,isLegacyFormat:p,hasStructuredGuide:!!y,sectionsCount:((G=y==null?void 0:y.sections)==null?void 0:G.length)||0,discussionGuideType:typeof t,discussionGuide:t}),c&&y&&y.sections){const ve=y.sections.map(Pe=>Pe.id);console.log("Pre-expanding sections:",ve),j(new Set(ve))}else c||j(new Set)},[c,y,t,p]);const W=G=>{const ve=new Set(w);ve.has(G)?ve.delete(G):ve.add(G),j(ve)},he=G=>{if(!n||n.legacy_format)return"pending";const ve=n.moderator_position.section_index;return(n.progress||0)>=100||G{if(!n||n.legacy_format)return"pending";const{section_index:E,subsection_index:D,item_index:U,item_type:K}=n.moderator_position;if(Ga.jsxs("div",{className:Me("space-y-4",u),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(vs,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),a.jsx(Yn,{variant:"outline",className:"text-xs",children:"Legacy Format"})]}),a.jsx("div",{className:"whitespace-pre-line bg-slate-50 p-4 rounded-lg text-sm border",children:t})]}),Ae=(G,ve)=>G===`New ${ve}`,de=({id:G,item:ve,sectionIndex:Pe,itemIndex:Ie,itemType:E,subsectionIndex:D,disabled:U=!1})=>{const{attributes:K,listeners:J,setNodeRef:X,transform:be,transition:_e,isDragging:Fe}=YE({id:G,disabled:U}),ie={transform:vu.Transform.toString(be),transition:_e,opacity:Fe?.5:1,zIndex:Fe?1e3:"auto"},Te=U?{}:{...K,...J};return a.jsx("div",{ref:X,style:ie,children:xe(ve,Pe,Ie,E,D,Te)})},oe=({id:G,section:ve,sectionIndex:Pe,disabled:Ie=!1})=>{const{attributes:E,listeners:D,setNodeRef:U,transform:K,transition:J,isDragging:X}=YE({id:G,disabled:Ie}),be={transform:vu.Transform.toString(K),transition:J,opacity:X?.5:1,zIndex:X?1e3:"auto"};return a.jsx("div",{ref:U,style:be,children:te(ve,Pe,Ie?{}:{...E,...D})})},xe=(G,ve,Pe,Ie,E,D)=>{var Fe;const U=y==null?void 0:y.sections[ve],K=S===(U==null?void 0:U.id),J=pe(ve,Pe,Ie,E),X=J==="current",be=J==="completed",_e=Ae(G.content,Ie);return K?a.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[i&&a.jsx("div",{className:"flex-shrink-0 cursor-grab hover:cursor-grab active:cursor-grabbing hover:text-slate-700 transition-colors p-1.5 rounded hover:bg-slate-200 border border-transparent hover:border-slate-300",...D,title:"Drag to reorder this item",children:a.jsx(WA,{className:"h-4 w-4 text-slate-500 hover:text-slate-700"})}),a.jsx("div",{className:"flex-shrink-0 mt-1",children:a.jsx(bf,{className:"h-4 w-4 text-slate-400"})}),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(Yn,{variant:"outline",className:"text-xs",children:Ie==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Qi,{className:"h-3 w-3 mr-1"}),typeof G.type=="string"?G.type.replace("_"," "):String(G.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(vs,{className:"h-3 w-3 mr-1"}),typeof G.type=="string"?G.type.replace("_"," "):String(G.type||"unknown")]})}),G.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[a.jsx(rh,{className:"h-3 w-3"}),a.jsx(_t,{type:"number",value:G.time_limit,onChange:ie=>H(G.id,{time_limit:parseInt(ie.target.value)||void 0},Ie),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),a.jsx(et,{value:_e?"":G.content,onChange:ie=>H(G.id,{content:ie.target.value},Ie),placeholder:_e?G.content:"Enter content...",className:"min-h-[60px]"}),Ie==="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(et,{value:((Fe=G.probes)==null?void 0:Fe.join(` -`))||"",onChange:ie=>{const Te=ie.target.value.trim()?ie.target.value.split(` -`).filter(Be=>Be.trim()):[];H(G.id,{probes:Te},Ie)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]})]}),a.jsx("div",{className:"flex-shrink-0",children:a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>F(G.id,Ie),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:a.jsx(wn,{className:"h-3 w-3"})})})]},G.id):a.jsxs("div",{className:Me("flex items-start gap-3 p-3 rounded-lg border transition-colors",X&&"bg-blue-50 border-blue-200",be&&"bg-green-50 border-green-200",!X&&!be&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(y.sections[ve].id,G.id),children:[a.jsx("div",{className:"flex-shrink-0 mt-1",children:be?a.jsx(Ig,{className:"h-4 w-4 text-green-600"}):X?a.jsx(Kw,{className:"h-4 w-4 text-blue-600"}):a.jsx(bf,{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(Yn,{variant:"outline",className:"text-xs whitespace-nowrap",children:Ie==="activity"?a.jsxs(a.Fragment,{children:[a.jsx(Qi,{className:"h-3 w-3 mr-1"}),typeof G.type=="string"?G.type.replace("_"," "):String(G.type||"unknown")]}):a.jsxs(a.Fragment,{children:[a.jsx(vs,{className:"h-3 w-3 mr-1"}),typeof G.type=="string"?G.type.replace("_"," "):String(G.type||"unknown")]})}),G.time_limit&&a.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[a.jsx(rh,{className:"h-3 w-3"}),G.time_limit," min"]}),s&&a.jsxs(se,{size:"sm",variant:"ghost",onClick:ie=>{ie.stopPropagation(),s(y.sections[ve].id,G.id,G.content,y.sections[ve].title,`${Ie==="activity"?"Activity":"Question"}: ${G.type.replace("_"," ")}`,G.type)},className:"h-6 px-2 text-xs text-slate-600 hover:text-blue-600 hover:bg-blue-50",title:"Set moderator position to this item",children:[a.jsx(ON,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),a.jsxs("div",{className:"text-sm text-slate-700 mb-2 break-words",children:[a.jsx("p",{children:typeof G.content=="string"?G.content:String(G.content||"")}),G.type==="creative_review"&&h&&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(ER,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"})]}),(()=>{const ie=typeof G.content=="string"?G.content:String(G.content||""),Te=ie.match(/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i)||ie.match(/([a-f0-9]{32}\.(jpg|jpeg|png))/i);if(Te){const Be=Te[1],gt=Ct.getAssetUrl(h,Be);return a.jsx("img",{src:gt,alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:At=>{console.error("Failed to load creative asset:",gt),At.currentTarget.style.display="none"}})}else return a.jsx("div",{className:"text-xs text-slate-500 italic",children:"Creative asset not found or filename not detected"})})()]})]}),G.probes&&G.probes.length>0&&a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium text-slate-600",children:"Probe Questions:"}),a.jsx("ul",{className:"text-xs text-slate-600 space-y-1",children:G.probes.map((ie,Te)=>a.jsxs("li",{className:"flex items-start gap-1",children:[a.jsx("span",{className:"text-slate-400",children:"•"}),a.jsx("span",{children:typeof ie=="string"?ie:String(ie||"")})]},Te))})]})]})]},G.id)},te=(G,ve,Pe)=>{var X,be,_e,Fe;const Ie=he(ve),E=w.has(G.id),D=Ie==="current",U=Ie==="completed",K=S===G.id,J=K?P:G;return console.log("renderSection:",{sectionId:G.id,sectionTitle:G.title,defaultExpanded:c,openSectionsHasId:w.has(G.id),finalIsOpen:E,openSectionsSize:w.size,isEditing:K}),a.jsx("div",{className:"border rounded-lg overflow-hidden",children:a.jsxs(Ep,{open:!l||E||K,onOpenChange:()=>l&&!K&&W(G.id),children:[a.jsx(Op,{asChild:!0,disabled:K,children:a.jsxs("div",{className:Me("w-full p-4 flex items-center justify-between transition-colors min-w-0",K&&"bg-blue-50 border-blue-200",!K&&D&&"bg-blue-50 border-blue-200",!K&&U&&"bg-green-50 border-green-200",!K&&!D&&!U&&"bg-slate-50",l&&!K&&"cursor-pointer hover:bg-slate-100"),children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[i&&a.jsx("div",{className:"cursor-grab hover:cursor-grab active:cursor-grabbing hover:text-slate-700 transition-colors p-1.5 rounded hover:bg-slate-200 border border-transparent hover:border-slate-300",...Pe,title:"Drag to reorder section",children:a.jsx(WA,{className:"h-5 w-5 text-slate-500 hover:text-slate-700"})}),a.jsx("div",{className:"flex-shrink-0",children:K?a.jsx(KA,{className:"h-5 w-5 text-blue-600"}):U?a.jsx(Ig,{className:"h-5 w-5 text-green-600"}):D?a.jsx(Kw,{className:"h-5 w-5 text-blue-600"}):a.jsx(bf,{className:"h-5 w-5 text-slate-400"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:K?a.jsx(_t,{value:J.title,onChange:ie=>R({title:ie.target.value}),className:"font-semibold",onClick:ie=>ie.stopPropagation()}):a.jsx("h4",{className:"font-semibold text-slate-900 break-words",children:typeof J.title=="string"?J.title:String(J.title||"")})}),a.jsxs("div",{className:"flex items-center gap-3 text-sm text-slate-600 flex-wrap",children:[J.questions&&a.jsxs("div",{className:"flex items-center gap-1 whitespace-nowrap",children:[a.jsx(vs,{className:"h-3 w-3"}),J.questions.length," questions"]}),J.activities&&a.jsxs("div",{className:"flex items-center gap-1 whitespace-nowrap",children:[a.jsx(Qi,{className:"h-3 w-3"}),J.activities.length," activities"]})]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[K?a.jsxs("div",{className:"flex gap-2",onClick:ie=>ie.stopPropagation(),children:[a.jsxs(se,{size:"sm",onClick:$,disabled:A,className:"h-8",children:[a.jsx(CN,{className:"h-3 w-3 mr-1"}),A?"Saving...":"Save"]}),a.jsxs(se,{size:"sm",variant:"outline",onClick:M,disabled:A,className:"h-8",children:[a.jsx(Ei,{className:"h-3 w-3 mr-1"}),"Cancel"]})]}):i&&a.jsxs("div",{className:"flex gap-1",onClick:ie=>ie.stopPropagation(),children:[a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>k(G),className:"h-8 w-8 p-0 text-slate-600 hover:text-blue-600",title:"Edit section",children:a.jsx(KA,{className:"h-3 w-3"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>L(G.id),className:"h-8 w-8 p-0 text-slate-600 hover:text-red-600",title:"Delete section",children:a.jsx(wn,{className:"h-3 w-3"})})]}),l&&!K&&a.jsx("div",{className:"flex-shrink-0",children:E?a.jsx(Ta,{className:"h-4 w-4 text-slate-400"}):a.jsx(vi,{className:"h-4 w-4 text-slate-400"})})]})]})}),a.jsx(kp,{children:a.jsxs("div",{className:"p-4 border-t bg-white space-y-3",children:[(J.content||K)&&a.jsx("div",{children:K?a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Section Description"}),a.jsx(et,{value:J.content||"",onChange:ie=>R({content:ie.target.value}),placeholder:"Enter section description...",className:"min-h-[60px]"})]}):a.jsx("div",{className:"text-sm text-slate-600 p-3 bg-slate-50 rounded-lg",children:typeof J.content=="string"?J.content:String(J.content||"")})}),J.activities&&J.activities.length>0||K?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(Qi,{className:"h-4 w-4"}),"Activities"]}),K&&a.jsxs(se,{size:"sm",variant:"outline",onClick:()=>V("activity"),className:"h-7",children:[a.jsx(Qi,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),a.jsx(zd,{items:((X=J.activities)==null?void 0:X.map(ie=>`${G.id}-activity-item-${ie.id}`))||[],strategy:Bd,children:a.jsx("div",{className:"space-y-2",children:(be=J.activities)==null?void 0:be.map((ie,Te)=>a.jsx(de,{id:`${G.id}-activity-item-${ie.id}`,item:ie,sectionIndex:ve,itemIndex:Te,itemType:"activity",disabled:!K||!i},ie.id))})})]}):null,J.questions&&J.questions.length>0||K?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(vs,{className:"h-4 w-4"}),"Questions"]}),K&&a.jsxs(se,{size:"sm",variant:"outline",onClick:()=>V("question"),className:"h-7",children:[a.jsx(vs,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),a.jsx(zd,{items:((_e=J.questions)==null?void 0:_e.map(ie=>`${G.id}-question-item-${ie.id}`))||[],strategy:Bd,children:a.jsx("div",{className:"space-y-2",children:(Fe=J.questions)==null?void 0:Fe.map((ie,Te)=>a.jsx(de,{id:`${G.id}-question-item-${ie.id}`,item:ie,sectionIndex:ve,itemIndex:Te,itemType:"question",disabled:!K||!i},ie.id))})})]}):null,G.subsections&&G.subsections.length>0&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("h5",{className:"font-medium text-slate-700",children:"Subsections"}),a.jsx("div",{className:"space-y-3",children:G.subsections.map((ie,Te)=>{var Be,gt;return a.jsxs("div",{className:"border rounded-lg p-3 bg-slate-50",children:[a.jsx("div",{className:"flex items-center justify-between mb-2 gap-2",children:a.jsx("h6",{className:"font-medium text-slate-800 break-words min-w-0",children:typeof ie.title=="string"?ie.title:String(ie.title||"")})}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(zd,{items:((Be=ie.questions)==null?void 0:Be.map(At=>`${G.id}-subsection-${Te}-question-item-${At.id}`))||[],strategy:Bd,children:ie.questions.map((At,pn)=>a.jsx(de,{id:`${G.id}-subsection-${Te}-question-item-${At.id}`,item:At,sectionIndex:ve,itemIndex:pn,itemType:"question",subsectionIndex:Te,disabled:!K||!i},At.id))}),ie.activities&&a.jsx(zd,{items:((gt=ie.activities)==null?void 0:gt.map(At=>`${G.id}-subsection-${Te}-activity-item-${At.id}`))||[],strategy:Bd,children:ie.activities.map((At,pn)=>a.jsx(de,{id:`${G.id}-subsection-${Te}-activity-item-${At.id}`,item:At,sectionIndex:ve,itemIndex:pn,itemType:"activity",subsectionIndex:Te,disabled:!K||!i},At.id))})]})]},ie.id)})})]})]})})]})},G.id)},Ye=()=>{if(!o||!n||!y)return null;const G=n.legacy_format?0:n.progress;return a.jsxs("div",{className:"mb-4 p-3 bg-slate-50 rounded-lg",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Session Progress"}),a.jsxs("span",{className:"text-sm text-slate-600",children:[Math.round(G),"%"]})]}),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 duration-300",style:{width:`${G}%`}})}),!n.legacy_format&&a.jsxs("div",{className:"mt-2 text-xs text-slate-600 break-words",children:["Currently in: ",a.jsx("span",{className:"font-medium",children:n.current_section})]})]})};return p?ue():y?a.jsxs("div",{className:Me("space-y-4",u),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(vs,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:typeof y.title=="string"?y.title:String(y.title||"Discussion Guide")}),a.jsxs(Yn,{variant:"outline",className:"text-xs",children:[y.total_duration," min"]})]}),d&&a.jsx(se,{variant:"ghost",size:"sm",onClick:d,disabled:f,className:"h-8",title:"Download Discussion Guide",children:f?a.jsx(Dl,{className:"h-4 w-4 animate-spin"}):a.jsx(ed,{className:"h-4 w-4"})})]}),Ye(),a.jsx(zte,{sensors:T,collisionDetection:zee,onDragStart:G=>{console.log("🚀 Drag START:",{activeId:G.active.id,timestamp:new Date().toISOString()})},onDragEnd:fe,children:a.jsx(zd,{items:y.sections.map(G=>`section-${G.id}`),strategy:Bd,children:a.jsx("div",{className:"space-y-3",children:y.sections.map((G,ve)=>a.jsx(oe,{id:`section-${G.id}`,section:G,sectionIndex:ve,disabled:!i},G.id))})})})]}):a.jsxs("div",{className:Me("space-y-4",u),children:[a.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[a.jsx(vs,{className:"h-5 w-5 text-slate-600"}),a.jsx("h3",{className:"font-semibold text-slate-900",children:"Discussion Guide"})]}),a.jsx("div",{className:"text-center py-8 text-slate-500",children:a.jsx("p",{children:"No discussion guide available"})})]})},(e,t)=>{if(e.defaultExpanded!==t.defaultExpanded||e.showProgress!==t.showProgress||e.collapsible!==t.collapsible||e.className!==t.className||e.isDownloading!==t.isDownloading)return console.log("🔄 DiscussionGuideViewer re-render: prop changes detected"),!1;if(e.onSectionSelect!==t.onSectionSelect)return console.log("🔄 DiscussionGuideViewer re-render: onSectionSelect changed"),!1;if(e.onSetPosition!==t.onSetPosition)return console.log("🔄 DiscussionGuideViewer re-render: onSetPosition changed"),!1;if(e.onSave!==t.onSave)return console.log("🔄 DiscussionGuideViewer re-render: onSave changed"),!1;if(e.onDownload!==t.onDownload)return console.log("🔄 DiscussionGuideViewer re-render: onDownload changed"),!1;const n=JSON.stringify(e.discussionGuide)!==JSON.stringify(t.discussionGuide),r=JSON.stringify(e.moderatorStatus)!==JSON.stringify(t.moderatorStatus);return n?(console.log("🔄 DiscussionGuideViewer re-render: discussionGuide content changed"),!1):r?(console.log("🔄 DiscussionGuideViewer re-render: moderatorStatus changed"),!1):(console.log("⏭️ DiscussionGuideViewer skipping re-render: no meaningful changes"),!0)});var Ma="Accordion",une=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[F_,dne,fne]=Pp(Ma),[bx,IOe]=Ir(Ma,[fne,T4]),B_=T4(),z5=C.forwardRef((e,t)=>{const{type:n,...r}=e,s=r,i=r;return a.jsx(F_.Provider,{scope:e.__scopeAccordion,children:n==="multiple"?a.jsx(gne,{...i,ref:t}):a.jsx(mne,{...s,ref:t})})});z5.displayName=Ma;var[U5,hne]=bx(Ma),[V5,pne]=bx(Ma,{collapsible:!1}),mne=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=e,[l,c]=us({prop:n,defaultProp:r,onChange:s});return a.jsx(U5,{scope:e.__scopeAccordion,value:l?[l]:[],onItemOpen:c,onItemClose:C.useCallback(()=>i&&c(""),[i,c]),children:a.jsx(V5,{scope:e.__scopeAccordion,collapsible:i,children:a.jsx(W5,{...o,ref:t})})})}),gne=C.forwardRef((e,t)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=e,[o=[],l]=us({prop:n,defaultProp:r,onChange:s}),c=C.useCallback(d=>l((f=[])=>[...f,d]),[l]),u=C.useCallback(d=>l((f=[])=>f.filter(h=>h!==d)),[l]);return a.jsx(U5,{scope:e.__scopeAccordion,value:o,onItemOpen:c,onItemClose:u,children:a.jsx(V5,{scope:e.__scopeAccordion,collapsible:!0,children:a.jsx(W5,{...i,ref:t})})})}),[vne,wx]=bx(Ma),W5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=e,l=C.useRef(null),c=pt(l,t),u=dne(n),f=Uo(s)==="ltr",h=$e(e.onKeyDown,p=>{var _;if(!une.includes(p.key))return;const g=p.target,m=u().filter(A=>{var O;return!((O=A.ref.current)!=null&&O.disabled)}),x=m.findIndex(A=>A.ref.current===g),b=m.length;if(x===-1)return;p.preventDefault();let y=x;const w=0,j=b-1,S=()=>{y=x+1,y>j&&(y=w)},N=()=>{y=x-1,y{const{__scopeAccordion:n,value:r,...s}=e,i=wx(mv,n),o=hne(mv,n),l=B_(n),c=Cs(),u=r&&o.value.includes(r)||!1,d=i.disabled||e.disabled;return a.jsx(yne,{scope:n,open:u,disabled:d,triggerId:c,children:a.jsx(M4,{"data-orientation":i.orientation,"data-state":Z5(u),...l,...s,ref:t,disabled:d,open:u,onOpenChange:f=>{f?o.onItemOpen(r):o.onItemClose(r)}})})});H5.displayName=mv;var G5="AccordionHeader",q5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=wx(Ma,n),i=z_(G5,n);return a.jsx(Xe.h3,{"data-orientation":s.orientation,"data-state":Z5(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});q5.displayName=G5;var T1="AccordionTrigger",K5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=wx(Ma,n),i=z_(T1,n),o=pne(T1,n),l=B_(n);return a.jsx(F_.ItemSlot,{scope:n,children:a.jsx(AZ,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...l,...r,ref:t})})});K5.displayName=T1;var X5="AccordionContent",Y5=C.forwardRef((e,t)=>{const{__scopeAccordion:n,...r}=e,s=wx(Ma,n),i=z_(X5,n),o=B_(n);return a.jsx(EZ,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Y5.displayName=X5;function Z5(e){return e?"open":"closed"}var xne=z5,bne=H5,wne=q5,Q5=K5,J5=Y5;const jne=xne,$1=v.forwardRef(({className:e,...t},n)=>a.jsx(bne,{ref:n,className:Me("border-b",e),...t}));$1.displayName="AccordionItem";const I1=v.forwardRef(({className:e,children:t,...n},r)=>a.jsx(wne,{className:"flex",children:a.jsxs(Q5,{ref:r,className:Me("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,a.jsx(Ta,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));I1.displayName=Q5.displayName;const M1=v.forwardRef(({className:e,children:t,...n},r)=>a.jsx(J5,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:a.jsx("div",{className:Me("pb-4 pt-0",e),children:t})}));M1.displayName=J5.displayName;var Sne=Array.isArray,Xr=Sne,Nne=typeof qp=="object"&&qp&&qp.Object===Object&&qp,eF=Nne,_ne=eF,Pne=typeof self=="object"&&self&&self.Object===Object&&self,Cne=_ne||Pne||Function("return this")(),Bi=Cne,Ane=Bi,Ene=Ane.Symbol,Dp=Ene,ZE=Dp,tF=Object.prototype,One=tF.hasOwnProperty,kne=tF.toString,Ud=ZE?ZE.toStringTag:void 0;function Tne(e){var t=One.call(e,Ud),n=e[Ud];try{e[Ud]=void 0;var r=!0}catch{}var s=kne.call(e);return r&&(t?e[Ud]=n:delete e[Ud]),s}var $ne=Tne,Ine=Object.prototype,Mne=Ine.toString;function Rne(e){return Mne.call(e)}var Dne=Rne,QE=Dp,Lne=$ne,Fne=Dne,Bne="[object Null]",zne="[object Undefined]",JE=QE?QE.toStringTag:void 0;function Une(e){return e==null?e===void 0?zne:Bne:JE&&JE in Object(e)?Lne(e):Fne(e)}var Ra=Une;function Vne(e){return e!=null&&typeof e=="object"}var Da=Vne,Wne=Ra,Hne=Da,Gne="[object Symbol]";function qne(e){return typeof e=="symbol"||Hne(e)&&Wne(e)==Gne}var ud=qne,Kne=Xr,Xne=ud,Yne=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Zne=/^\w*$/;function Qne(e,t){if(Kne(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||Xne(e)?!0:Zne.test(e)||!Yne.test(e)||t!=null&&e in Object(t)}var U_=Qne;function Jne(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Go=Jne;const dd=Bt(Go);var ere=Ra,tre=Go,nre="[object AsyncFunction]",rre="[object Function]",sre="[object GeneratorFunction]",ire="[object Proxy]";function are(e){if(!tre(e))return!1;var t=ere(e);return t==rre||t==sre||t==nre||t==ire}var V_=are;const ct=Bt(V_);var ore=Bi,lre=ore["__core-js_shared__"],cre=lre,hb=cre,eO=function(){var e=/[^.]+$/.exec(hb&&hb.keys&&hb.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function ure(e){return!!eO&&eO in e}var dre=ure,fre=Function.prototype,hre=fre.toString;function pre(e){if(e!=null){try{return hre.call(e)}catch{}try{return e+""}catch{}}return""}var nF=pre,mre=V_,gre=dre,vre=Go,yre=nF,xre=/[\\^$.*+?()[\]{}|]/g,bre=/^\[object .+?Constructor\]$/,wre=Function.prototype,jre=Object.prototype,Sre=wre.toString,Nre=jre.hasOwnProperty,_re=RegExp("^"+Sre.call(Nre).replace(xre,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Pre(e){if(!vre(e)||gre(e))return!1;var t=mre(e)?_re:bre;return t.test(yre(e))}var Cre=Pre;function Are(e,t){return e==null?void 0:e[t]}var Ere=Are,Ore=Cre,kre=Ere;function Tre(e,t){var n=kre(e,t);return Ore(n)?n:void 0}var ec=Tre,$re=ec,Ire=$re(Object,"create"),jx=Ire,tO=jx;function Mre(){this.__data__=tO?tO(null):{},this.size=0}var Rre=Mre;function Dre(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var Lre=Dre,Fre=jx,Bre="__lodash_hash_undefined__",zre=Object.prototype,Ure=zre.hasOwnProperty;function Vre(e){var t=this.__data__;if(Fre){var n=t[e];return n===Bre?void 0:n}return Ure.call(t,e)?t[e]:void 0}var Wre=Vre,Hre=jx,Gre=Object.prototype,qre=Gre.hasOwnProperty;function Kre(e){var t=this.__data__;return Hre?t[e]!==void 0:qre.call(t,e)}var Xre=Kre,Yre=jx,Zre="__lodash_hash_undefined__";function Qre(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Yre&&t===void 0?Zre:t,this}var Jre=Qre,ese=Rre,tse=Lre,nse=Wre,rse=Xre,sse=Jre;function fd(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var wse=bse,jse=Sx;function Sse(e,t){var n=this.__data__,r=jse(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var Nse=Sse,_se=ose,Pse=mse,Cse=yse,Ase=wse,Ese=Nse;function hd(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},pl=function(t){return Lp(t)&&t.indexOf("%")===t.length-1},ke=function(t){return Yie(t)&&!md(t)},Hn=function(t){return ke(t)||Lp(t)},eae=0,gd=function(t){var n=++eae;return"".concat(t||"").concat(n)},Ar=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ke(t)&&!Lp(t))return r;var i;if(pl(t)){var o=t.indexOf("%");i=n*parseFloat(t.slice(0,o))/100}else i=+t;return md(i)&&(i=r),s&&i>n&&(i=n),i},Ja=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},tae=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function D1(e){"@babel/helpers - typeof";return D1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},D1(e)}var lO={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},da=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},cO=null,mb=null,J_=function e(t){if(t===cO&&Array.isArray(mb))return mb;var n=[];return v.Children.forEach(t,function(r){vt(r)||(dF.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),mb=n,cO=t,n};function Es(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(s){return da(s)}):r=[da(t)],J_(e).forEach(function(s){var i=ls(s,"type.displayName")||ls(s,"type.name");r.indexOf(i)!==-1&&n.push(s)}),n}function es(e,t){var n=Es(e,t);return n&&n[0]}var uO=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,s=n.height;return!(!ke(r)||r<=0||!ke(s)||s<=0)},lae=["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"],cae=function(t){return t&&t.type&&Lp(t.type)&&lae.indexOf(t.type)>=0},uae=function(t){return t&&D1(t)==="object"&&"clipDot"in t},dae=function(t,n,r,s){var i,o=(i=pb==null?void 0:pb[s])!==null&&i!==void 0?i:[];return!ct(t)&&(s&&o.includes(n)||rae.includes(n))||r&&Q_.includes(n)},Ze=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(v.isValidElement(t)&&(s=t.props),!dd(s))return null;var i={};return Object.keys(s).forEach(function(o){var l;dae((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(i[o]=s[o])}),i},L1=function e(t,n){if(t===n)return!0;var r=v.Children.count(t);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return dO(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function B1(e){var t=e.children,n=e.width,r=e.height,s=e.viewBox,i=e.className,o=e.style,l=e.title,c=e.desc,u=mae(e,pae),d=s||{width:n,height:r,x:0,y:0},f=mt("recharts-surface",i);return C.createElement("svg",F1({},Ze(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),C.createElement("title",null,l),C.createElement("desc",null,c),t)}var vae=["children","className"];function z1(){return z1=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xae(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Et=C.forwardRef(function(e,t){var n=e.children,r=e.className,s=yae(e,vae),i=mt("recharts-layer",r);return C.createElement("g",z1({className:i},Ze(s,!0),{ref:t}),n)}),ei=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;is?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(s);++r=r?e:jae(e,t,n)}var Nae=Sae,_ae="\\ud800-\\udfff",Pae="\\u0300-\\u036f",Cae="\\ufe20-\\ufe2f",Aae="\\u20d0-\\u20ff",Eae=Pae+Cae+Aae,Oae="\\ufe0e\\ufe0f",kae="\\u200d",Tae=RegExp("["+kae+_ae+Eae+Oae+"]");function $ae(e){return Tae.test(e)}var hF=$ae;function Iae(e){return e.split("")}var Mae=Iae,pF="\\ud800-\\udfff",Rae="\\u0300-\\u036f",Dae="\\ufe20-\\ufe2f",Lae="\\u20d0-\\u20ff",Fae=Rae+Dae+Lae,Bae="\\ufe0e\\ufe0f",zae="["+pF+"]",U1="["+Fae+"]",V1="\\ud83c[\\udffb-\\udfff]",Uae="(?:"+U1+"|"+V1+")",mF="[^"+pF+"]",gF="(?:\\ud83c[\\udde6-\\uddff]){2}",vF="[\\ud800-\\udbff][\\udc00-\\udfff]",Vae="\\u200d",yF=Uae+"?",xF="["+Bae+"]?",Wae="(?:"+Vae+"(?:"+[mF,gF,vF].join("|")+")"+xF+yF+")*",Hae=xF+yF+Wae,Gae="(?:"+[mF+U1+"?",U1,gF,vF,zae].join("|")+")",qae=RegExp(V1+"(?="+V1+")|"+Gae+Hae,"g");function Kae(e){return e.match(qae)||[]}var Xae=Kae,Yae=Mae,Zae=hF,Qae=Xae;function Jae(e){return Zae(e)?Qae(e):Yae(e)}var eoe=Jae,toe=Nae,noe=hF,roe=eoe,soe=aF;function ioe(e){return function(t){t=soe(t);var n=noe(t)?roe(t):void 0,r=n?n[0]:t.charAt(0),s=n?toe(n,1).join(""):t.slice(1);return r[e]()+s}}var aoe=ioe,ooe=aoe,loe=ooe("toUpperCase"),coe=loe;const Dx=Bt(coe);function Jt(e){return function(){return e}}const bF=Math.cos,yv=Math.sin,fi=Math.sqrt,xv=Math.PI,Lx=2*xv,W1=Math.PI,H1=2*W1,rl=1e-6,uoe=H1-rl;function wF(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return wF;const n=10**t;return function(r){this._+=r[0];for(let s=1,i=r.length;srl)if(!(Math.abs(f*c-u*d)>rl)||!i)this._append`L${this._x1=t},${this._y1=n}`;else{let p=r-o,g=s-l,m=c*c+u*u,x=p*p+g*g,b=Math.sqrt(m),y=Math.sqrt(h),w=i*Math.tan((W1-Math.acos((m+h-x)/(2*b*y)))/2),j=w/y,S=w/b;Math.abs(j-1)>rl&&this._append`L${t+j*d},${n+j*f}`,this._append`A${i},${i},0,0,${+(f*p>d*g)},${this._x1=t+S*c},${this._y1=n+S*u}`}}arc(t,n,r,s,i,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),u=t+l,d=n+c,f=1^o,h=o?s-i:i-s;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>uoe?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>rl&&this._append`A${r},${r},0,${+(h>=W1)},${f},${this._x1=t+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(t,n,r,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function eP(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new foe(t)}function tP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function jF(e){this._context=e}jF.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Fx(e){return new jF(e)}function SF(e){return e[0]}function NF(e){return e[1]}function _F(e,t){var n=Jt(!0),r=null,s=Fx,i=null,o=eP(l);e=typeof e=="function"?e:e===void 0?SF:Jt(e),t=typeof t=="function"?t:t===void 0?NF:Jt(t);function l(c){var u,d=(c=tP(c)).length,f,h=!1,p;for(r==null&&(i=s(p=o())),u=0;u<=d;++u)!(u=p;--g)l.point(w[g],j[g]);l.lineEnd(),l.areaEnd()}b&&(w[h]=+e(x,h,f),j[h]=+t(x,h,f),l.point(r?+r(x,h,f):w[h],n?+n(x,h,f):j[h]))}if(y)return l=null,y+""||null}function d(){return _F().defined(s).curve(o).context(i)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:Jt(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Jt(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Jt(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:Jt(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Jt(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Jt(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(s=typeof f=="function"?f:Jt(!!f),u):s},u.curve=function(f){return arguments.length?(o=f,i!=null&&(l=o(i)),u):o},u.context=function(f){return arguments.length?(f==null?i=l=null:l=o(i=f),u):i},u}class PF{constructor(t,n){this._context=t,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(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function hoe(e){return new PF(e,!0)}function poe(e){return new PF(e,!1)}const nP={draw(e,t){const n=fi(t/xv);e.moveTo(n,0),e.arc(0,0,n,0,Lx)}},moe={draw(e,t){const n=fi(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},CF=fi(1/3),goe=CF*2,voe={draw(e,t){const n=fi(t/goe),r=n*CF;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},yoe={draw(e,t){const n=fi(t),r=-n/2;e.rect(r,r,n,n)}},xoe=.8908130915292852,AF=yv(xv/10)/yv(7*xv/10),boe=yv(Lx/10)*AF,woe=-bF(Lx/10)*AF,joe={draw(e,t){const n=fi(t*xoe),r=boe*n,s=woe*n;e.moveTo(0,-n),e.lineTo(r,s);for(let i=1;i<5;++i){const o=Lx*i/5,l=bF(o),c=yv(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*s,c*r+l*s)}e.closePath()}},gb=fi(3),Soe={draw(e,t){const n=-fi(t/(gb*3));e.moveTo(0,n*2),e.lineTo(-gb*n,-n),e.lineTo(gb*n,-n),e.closePath()}},hs=-.5,ps=fi(3)/2,G1=1/fi(12),Noe=(G1/2+1)*3,_oe={draw(e,t){const n=fi(t/Noe),r=n/2,s=n*G1,i=r,o=n*G1+n,l=-i,c=o;e.moveTo(r,s),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(hs*r-ps*s,ps*r+hs*s),e.lineTo(hs*i-ps*o,ps*i+hs*o),e.lineTo(hs*l-ps*c,ps*l+hs*c),e.lineTo(hs*r+ps*s,hs*s-ps*r),e.lineTo(hs*i+ps*o,hs*o-ps*i),e.lineTo(hs*l+ps*c,hs*c-ps*l),e.closePath()}};function Poe(e,t){let n=null,r=eP(s);e=typeof e=="function"?e:Jt(e||nP),t=typeof t=="function"?t:Jt(t===void 0?64:+t);function s(){let i;if(n||(n=i=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+""||null}return s.type=function(i){return arguments.length?(e=typeof i=="function"?i:Jt(i),s):e},s.size=function(i){return arguments.length?(t=typeof i=="function"?i:Jt(+i),s):t},s.context=function(i){return arguments.length?(n=i??null,s):n},s}function bv(){}function wv(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function EF(e){this._context=e}EF.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:wv(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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:wv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Coe(e){return new EF(e)}function OF(e){this._context=e}OF.prototype={areaStart:bv,areaEnd:bv,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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:wv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Aoe(e){return new OF(e)}function kF(e){this._context=e}kF.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(e,t){switch(e=+e,t=+t,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+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:wv(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Eoe(e){return new kF(e)}function TF(e){this._context=e}TF.prototype={areaStart:bv,areaEnd:bv,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Ooe(e){return new TF(e)}function hO(e){return e<0?-1:1}function pO(e,t,n){var r=e._x1-e._x0,s=t-e._x1,i=(e._y1-e._y0)/(r||s<0&&-0),o=(n-e._y1)/(s||r<0&&-0),l=(i*s+o*r)/(r+s);return(hO(i)+hO(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function mO(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function vb(e,t,n){var r=e._x0,s=e._y0,i=e._x1,o=e._y1,l=(i-r)/3;e._context.bezierCurveTo(r+l,s+l*t,i-l,o-l*n,i,o)}function jv(e){this._context=e}jv.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:vb(this,this._t0,mO(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,vb(this,mO(this,n=pO(this,e,t)),n);break;default:vb(this,this._t0,n=pO(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function $F(e){this._context=new IF(e)}($F.prototype=Object.create(jv.prototype)).point=function(e,t){jv.prototype.point.call(this,t,e)};function IF(e){this._context=e}IF.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,s,i){this._context.bezierCurveTo(t,e,r,n,i,s)}};function koe(e){return new jv(e)}function Toe(e){return new $F(e)}function MF(e){this._context=e}MF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=gO(e),s=gO(t),i=0,o=1;o=0;--t)s[t]=(o[t]-s[t+1])/i[t];for(i[n-1]=(e[n]+s[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function Ioe(e){return new Bx(e,.5)}function Moe(e){return new Bx(e,0)}function Roe(e){return new Bx(e,1)}function yu(e,t){if((o=e.length)>1)for(var n=1,r,s,i=e[t[0]],o,l=i.length;n=0;)n[t]=t;return n}function Doe(e,t){return e[t]}function Loe(e){const t=[];return t.key=e,t}function Foe(){var e=Jt([]),t=q1,n=yu,r=Doe;function s(i){var o=Array.from(e.apply(this,arguments),Loe),l,c=o.length,u=-1,d;for(const f of i)for(l=0,++u;l0){for(var n,r,s=0,i=e[0].length,o;s0){for(var n=0,r=e[t[0]],s,i=r.length;n0)||!((i=(s=e[t[0]]).length)>0))){for(var n=0,r=1,s,i,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Koe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var RF={symbolCircle:nP,symbolCross:moe,symbolDiamond:voe,symbolSquare:yoe,symbolStar:joe,symbolTriangle:Soe,symbolWye:_oe},Xoe=Math.PI/180,Yoe=function(t){var n="symbol".concat(Dx(t));return RF[n]||nP},Zoe=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var s=18*Xoe;return 1.25*t*t*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Qoe=function(t,n){RF["symbol".concat(Dx(t))]=n},rP=function(t){var n=t.type,r=n===void 0?"circle":n,s=t.size,i=s===void 0?64:s,o=t.sizeType,l=o===void 0?"area":o,c=qoe(t,Voe),u=yO(yO({},c),{},{type:r,size:i,sizeType:l}),d=function(){var x=Yoe(r),b=Poe().type(x).size(Zoe(i,l,r));return b()},f=u.className,h=u.cx,p=u.cy,g=Ze(u,!0);return h===+h&&p===+p&&i===+i?C.createElement("path",K1({},g,{className:mt("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};rP.registerSymbol=Qoe;function xu(e){"@babel/helpers - typeof";return xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xu(e)}function X1(){return X1=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var y=p.inactive?u:p.color;return C.createElement("li",X1({className:x,style:f,key:"legend-item-".concat(g)},Vl(r.props,p,g)),C.createElement(B1,{width:o,height:o,viewBox:d,style:h},r.renderIcon(p)),C.createElement("span",{className:"recharts-legend-item-text",style:{color:y}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,s=r.payload,i=r.layout,o=r.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return C.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(v.PureComponent);Ah(sP,"displayName","Legend");Ah(sP,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var lle=Nx;function cle(){this.__data__=new lle,this.size=0}var ule=cle;function dle(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var fle=dle;function hle(e){return this.__data__.get(e)}var ple=hle;function mle(e){return this.__data__.has(e)}var gle=mle,vle=Nx,yle=H_,xle=G_,ble=200;function wle(e,t){var n=this.__data__;if(n instanceof vle){var r=n.__data__;if(!yle||r.lengthl))return!1;var u=i.get(e),d=i.get(t);if(u&&d)return u==t&&d==e;var f=-1,h=!0,p=n&Vle?new Fle:void 0;for(i.set(e,t),i.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=qce}var lP=Kce,Xce=Ra,Yce=lP,Zce=Da,Qce="[object Arguments]",Jce="[object Array]",eue="[object Boolean]",tue="[object Date]",nue="[object Error]",rue="[object Function]",sue="[object Map]",iue="[object Number]",aue="[object Object]",oue="[object RegExp]",lue="[object Set]",cue="[object String]",uue="[object WeakMap]",due="[object ArrayBuffer]",fue="[object DataView]",hue="[object Float32Array]",pue="[object Float64Array]",mue="[object Int8Array]",gue="[object Int16Array]",vue="[object Int32Array]",yue="[object Uint8Array]",xue="[object Uint8ClampedArray]",bue="[object Uint16Array]",wue="[object Uint32Array]",rn={};rn[hue]=rn[pue]=rn[mue]=rn[gue]=rn[vue]=rn[yue]=rn[xue]=rn[bue]=rn[wue]=!0;rn[Qce]=rn[Jce]=rn[due]=rn[eue]=rn[fue]=rn[tue]=rn[nue]=rn[rue]=rn[sue]=rn[iue]=rn[aue]=rn[oue]=rn[lue]=rn[cue]=rn[uue]=!1;function jue(e){return Zce(e)&&Yce(e.length)&&!!rn[Xce(e)]}var Sue=jue;function Nue(e){return function(t){return e(t)}}var qF=Nue,Pv={exports:{}};Pv.exports;(function(e,t){var n=eF,r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,i=s&&s.exports===r,o=i&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(Pv,Pv.exports);var _ue=Pv.exports,Pue=Sue,Cue=qF,_O=_ue,PO=_O&&_O.isTypedArray,Aue=PO?Cue(PO):Pue,KF=Aue,Eue=Tce,Oue=aP,kue=Xr,Tue=GF,$ue=oP,Iue=KF,Mue=Object.prototype,Rue=Mue.hasOwnProperty;function Due(e,t){var n=kue(e),r=!n&&Oue(e),s=!n&&!r&&Tue(e),i=!n&&!r&&!s&&Iue(e),o=n||r||s||i,l=o?Eue(e.length,String):[],c=l.length;for(var u in e)(t||Rue.call(e,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||i&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||$ue(u,c)))&&l.push(u);return l}var Lue=Due,Fue=Object.prototype;function Bue(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Fue;return e===n}var zue=Bue;function Uue(e,t){return function(n){return e(t(n))}}var XF=Uue,Vue=XF,Wue=Vue(Object.keys,Object),Hue=Wue,Gue=zue,que=Hue,Kue=Object.prototype,Xue=Kue.hasOwnProperty;function Yue(e){if(!Gue(e))return que(e);var t=[];for(var n in Object(e))Xue.call(e,n)&&n!="constructor"&&t.push(n);return t}var Zue=Yue,Que=V_,Jue=lP;function ede(e){return e!=null&&Jue(e.length)&&!Que(e)}var Fp=ede,tde=Lue,nde=Zue,rde=Fp;function sde(e){return rde(e)?tde(e):nde(e)}var zx=sde,ide=bce,ade=Oce,ode=zx;function lde(e){return ide(e,ode,ade)}var cde=lde,CO=cde,ude=1,dde=Object.prototype,fde=dde.hasOwnProperty;function hde(e,t,n,r,s,i){var o=n&ude,l=CO(e),c=l.length,u=CO(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var h=l[f];if(!(o?h in t:fde.call(t,h)))return!1}var p=i.get(e),g=i.get(t);if(p&&g)return p==t&&g==e;var m=!0;i.set(e,t),i.set(t,e);for(var x=o;++f-1}var dhe=uhe;function fhe(e,t,n){for(var r=-1,s=e==null?0:e.length;++r=Che){var u=t?null:_he(e);if(u)return Phe(u);o=!1,s=Nhe,c=new whe}else c=t?[]:l;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Vhe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Whe(e){return e.value}function Hhe(e,t){if(C.isValidElement(e))return C.cloneElement(e,t);if(typeof e=="function")return C.createElement(e,t);t.ref;var n=Uhe(t,Ihe);return C.createElement(sP,n)}var VO=1,fa=function(e){function t(){var n;Mhe(this,t);for(var r=arguments.length,s=new Array(r),i=0;iVO||Math.abs(s.height-this.lastBoundingBox.height)>VO)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(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?Hi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,i=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&i==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();h={top:((d||0)-g.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Hi(Hi({},f),h)}},{key:"render",value:function(){var r=this,s=this.props,i=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,f=Hi(Hi({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return C.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},Hhe(i,Hi(Hi({},this.props),{},{payload:n6(d,u,Whe)})))}}],[{key:"getWithHeight",value:function(r,s){var i=Hi(Hi({},this.defaultProps),r.props),o=i.layout;return o==="vertical"&&ke(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(v.PureComponent);Ux(fa,"displayName","Legend");Ux(fa,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var WO=Dp,Ghe=aP,qhe=Xr,HO=WO?WO.isConcatSpreadable:void 0;function Khe(e){return qhe(e)||Ghe(e)||!!(HO&&e&&e[HO])}var Xhe=Khe,Yhe=WF,Zhe=Xhe;function i6(e,t,n,r,s){var i=-1,o=e.length;for(n||(n=Zhe),s||(s=[]);++i0&&n(l)?t>1?i6(l,t-1,n,r,s):Yhe(s,l):r||(s[s.length]=l)}return s}var a6=i6;function Qhe(e){return function(t,n,r){for(var s=-1,i=Object(t),o=r(t),l=o.length;l--;){var c=o[e?l:++s];if(n(i[c],c,i)===!1)break}return t}}var Jhe=Qhe,epe=Jhe,tpe=epe(),npe=tpe,rpe=npe,spe=zx;function ipe(e,t){return e&&rpe(e,t,spe)}var o6=ipe,ape=Fp;function ope(e,t){return function(n,r){if(n==null)return n;if(!ape(n))return e(n,r);for(var s=n.length,i=t?s:-1,o=Object(n);(t?i--:++it||i&&o&&c&&!l&&!u||r&&o&&c||!n&&c||!s)return 1;if(!r&&!i&&!u&&e=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return e.index-t.index}var wpe=bpe,wb=K_,jpe=X_,Spe=zi,Npe=l6,_pe=gpe,Ppe=qF,Cpe=wpe,Ape=xd,Epe=Xr;function Ope(e,t,n){t.length?t=wb(t,function(i){return Epe(i)?function(o){return jpe(o,i.length===1?i[0]:i)}:i}):t=[Ape];var r=-1;t=wb(t,Ppe(Spe));var s=Npe(e,function(i,o,l){var c=wb(t,function(u){return u(i)});return{criteria:c,index:++r,value:i}});return _pe(s,function(i,o){return Cpe(i,o,n)})}var kpe=Ope;function Tpe(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var $pe=Tpe,Ipe=$pe,qO=Math.max;function Mpe(e,t,n){return t=qO(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,i=qO(r.length-t,0),o=Array(i);++s0){if(++t>=Hpe)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Xpe=Kpe,Ype=Wpe,Zpe=Xpe,Qpe=Zpe(Ype),Jpe=Qpe,eme=xd,tme=Rpe,nme=Jpe;function rme(e,t){return nme(tme(e,t,eme),e+"")}var sme=rme,ime=W_,ame=Fp,ome=oP,lme=Go;function cme(e,t,n){if(!lme(n))return!1;var r=typeof t;return(r=="number"?ame(n)&&ome(t,n.length):r=="string"&&t in n)?ime(n[t],e):!1}var Vx=cme,ume=a6,dme=kpe,fme=sme,XO=Vx,hme=fme(function(e,t){if(e==null)return[];var n=t.length;return n>1&&XO(e,t[0],t[1])?t=[]:n>2&&XO(t[0],t[1],t[2])&&(t=[t[0]]),dme(e,ume(t,1),[])}),pme=hme;const dP=Bt(pme);function Eh(e){"@babel/helpers - typeof";return Eh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eh(e)}function rj(){return rj=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat(Vd,"-left"),ke(n)&&t&&ke(t.x)&&n=t.y),"".concat(Vd,"-top"),ke(r)&&t&&ke(t.y)&&rm?Math.max(d,c[r]):Math.max(f,c[r])}function Eme(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function Ome(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,s=e.position,i=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=QO({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=QO({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=Eme({translateX:d,translateY:f,useTranslate3d:l})):u=Cme,{cssProperties:u,cssClasses:Ame({translateX:d,translateY:f,coordinate:n})}}function wu(e){"@babel/helpers - typeof";return wu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wu(e)}function JO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function e2(e){for(var t=1;tt2||Math.abs(r.height-this.state.lastBoundingBox.height)>t2)&&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,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,f=s.hasPayload,h=s.isAnimationActive,p=s.offset,g=s.position,m=s.reverseDirection,x=s.useTranslate3d,b=s.viewBox,y=s.wrapperStyle,w=Ome({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:x,viewBox:b}),j=w.cssClasses,S=w.cssProperties,N=e2(e2({transition:h&&i?"transform ".concat(l,"ms ").concat(c):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&f?"visible":"hidden",position:"absolute",top:0,left:0},y);return C.createElement("div",{tabIndex:-1,className:j,style:N,ref:function(_){r.wrapperNode=_}},u)}}])}(v.PureComponent),Bme=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ti={isSsr:Bme(),get:function(t){return ti[t]},set:function(t,n){if(typeof t=="string")ti[t]=n;else{var r=Object.keys(t);r&&r.length&&r.forEach(function(s){ti[s]=t[s]})}}};function ju(e){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ju(e)}function n2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function r2(e){for(var t=1;t0;return C.createElement(Fme,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:h,active:i,coordinate:d,hasPayload:N,offset:p,position:x,reverseDirection:b,useTranslate3d:y,viewBox:w,wrapperStyle:j},Yme(u,r2(r2({},this.props),{},{payload:S})))}}])}(v.PureComponent);fP(mr,"displayName","Tooltip");fP(mr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ti.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 Zme=Bi,Qme=function(){return Zme.Date.now()},Jme=Qme,ege=/\s/;function tge(e){for(var t=e.length;t--&&ege.test(e.charAt(t)););return t}var nge=tge,rge=nge,sge=/^\s+/;function ige(e){return e&&e.slice(0,rge(e)+1).replace(sge,"")}var age=ige,oge=age,s2=Go,lge=ud,i2=NaN,cge=/^[-+]0x[0-9a-f]+$/i,uge=/^0b[01]+$/i,dge=/^0o[0-7]+$/i,fge=parseInt;function hge(e){if(typeof e=="number")return e;if(lge(e))return i2;if(s2(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=s2(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=oge(e);var n=uge.test(e);return n||dge.test(e)?fge(e.slice(2),n?2:8):cge.test(e)?i2:+e}var p6=hge,pge=Go,Sb=Jme,a2=p6,mge="Expected a function",gge=Math.max,vge=Math.min;function yge(e,t,n){var r,s,i,o,l,c,u=0,d=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(mge);t=a2(t)||0,pge(n)&&(d=!!n.leading,f="maxWait"in n,i=f?gge(a2(n.maxWait)||0,t):i,h="trailing"in n?!!n.trailing:h);function p(N){var P=r,_=s;return r=s=void 0,u=N,o=e.apply(_,P),o}function g(N){return u=N,l=setTimeout(b,t),d?p(N):o}function m(N){var P=N-c,_=N-u,A=t-P;return f?vge(A,i-_):A}function x(N){var P=N-c,_=N-u;return c===void 0||P>=t||P<0||f&&_>=i}function b(){var N=Sb();if(x(N))return y(N);l=setTimeout(b,m(N))}function y(N){return l=void 0,h&&r?p(N):(r=s=void 0,o)}function w(){l!==void 0&&clearTimeout(l),u=0,r=c=s=l=void 0}function j(){return l===void 0?o:y(Sb())}function S(){var N=Sb(),P=x(N);if(r=arguments,s=this,c=N,P){if(l===void 0)return g(c);if(f)return clearTimeout(l),l=setTimeout(b,t),p(c)}return l===void 0&&(l=setTimeout(b,t)),o}return S.cancel=w,S.flush=j,S}var xge=yge,bge=xge,wge=Go,jge="Expected a function";function Sge(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new TypeError(jge);return wge(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),bge(e,t,{leading:r,maxWait:t,trailing:s})}var Nge=Sge;const m6=Bt(Nge);function kh(e){"@babel/helpers - typeof";return kh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kh(e)}function o2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function _m(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(M=m6(M,m,{trailing:!0,leading:!1}));var R=new ResizeObserver(M),H=S.current.getBoundingClientRect(),F=H.width,V=H.height;return T(F,V),R.observe(S.current),function(){R.disconnect()}},[T,m]);var k=v.useMemo(function(){var M=A.containerWidth,R=A.containerHeight;if(M<0||R<0)return null;ei(pl(o)||pl(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,o,c),ei(!n||n>0,"The aspect(%s) must be greater than zero.",n);var H=pl(o)?M:o,F=pl(c)?R:c;n&&n>0&&(H?F=H/n:F&&(H=F*n),h&&F>h&&(F=h)),ei(H>0||F>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.`,H,F,o,c,d,f,n);var V=!Array.isArray(p)&&da(p.type).endsWith("Chart");return C.Children.map(p,function($){return dF.isElement($)?v.cloneElement($,_m({width:H,height:F},V?{style:_m({height:"100%",width:"100%",maxHeight:F,maxWidth:H},$.props.style)}:{})):$})},[n,p,c,h,f,d,A,o]);return C.createElement("div",{id:x?"".concat(x):void 0,className:mt("recharts-responsive-container",b),style:_m(_m({},j),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:S},k)}),Bp=function(t){return null};Bp.displayName="Cell";function Th(e){"@babel/helpers - typeof";return Th=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Th(e)}function c2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function oj(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ti.isSsr)return{width:0,height:0};var r=Lge(n),s=JSON.stringify({text:t,copyStyle:r});if(dc.widthCache[s])return dc.widthCache[s];try{var i=document.getElementById(u2);i||(i=document.createElement("span"),i.setAttribute("id",u2),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=oj(oj({},Dge),r);Object.assign(i.style,o),i.textContent="".concat(t);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return dc.widthCache[s]=c,++dc.cacheCount>Rge&&(dc.cacheCount=0,dc.widthCache={}),c}catch{return{width:0,height:0}}},Fge=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function $h(e){"@babel/helpers - typeof";return $h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$h(e)}function Ov(e,t){return Vge(e)||Uge(e,t)||zge(e,t)||Bge()}function Bge(){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 zge(e,t){if(e){if(typeof e=="string")return d2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d2(e,t)}}function d2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function rve(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function v2(e,t){return ove(e)||ave(e,t)||ive(e,t)||sve()}function sve(){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 ive(e,t){if(e){if(typeof e=="string")return y2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y2(e,t)}}function y2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return H.reduce(function(F,V){var $=V.word,L=V.width,Y=F[F.length-1];if(Y&&(s==null||i||Y.width+L+rV.width?F:V})};if(!d)return p;for(var m="…",x=function(H){var F=f.slice(0,H),V=x6({breakAll:u,style:c,children:F+m}).wordsWithComputedWidth,$=h(V),L=$.length>o||g($).width>Number(s);return[L,$]},b=0,y=f.length-1,w=0,j;b<=y&&w<=f.length-1;){var S=Math.floor((b+y)/2),N=S-1,P=x(N),_=v2(P,2),A=_[0],O=_[1],T=x(S),k=v2(T,1),M=k[0];if(!A&&!M&&(b=S+1),A&&M&&(y=S-1),!A&&M){j=O;break}w++}return j||p},x2=function(t){var n=vt(t)?[]:t.toString().split(y6);return[{words:n}]},cve=function(t){var n=t.width,r=t.scaleToFit,s=t.children,i=t.style,o=t.breakAll,l=t.maxLines;if((n||r)&&!ti.isSsr){var c,u,d=x6({breakAll:o,children:s,style:i});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return x2(s);return lve({breakAll:o,children:s,maxLines:l,style:i},c,u,n,r)}return x2(s)},b2="#808080",Wl=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,h=t.textAnchor,p=h===void 0?"start":h,g=t.verticalAnchor,m=g===void 0?"end":g,x=t.fill,b=x===void 0?b2:x,y=g2(t,tve),w=v.useMemo(function(){return cve({breakAll:y.breakAll,children:y.children,maxLines:y.maxLines,scaleToFit:f,style:y.style,width:y.width})},[y.breakAll,y.children,y.maxLines,f,y.style,y.width]),j=y.dx,S=y.dy,N=y.angle,P=y.className,_=y.breakAll,A=g2(y,nve);if(!Hn(r)||!Hn(i))return null;var O=r+(ke(j)?j:0),T=i+(ke(S)?S:0),k;switch(m){case"start":k=Nb("calc(".concat(u,")"));break;case"middle":k=Nb("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:k=Nb("calc(".concat(w.length-1," * -").concat(l,")"));break}var M=[];if(f){var R=w[0].width,H=y.width;M.push("scale(".concat((ke(H)?H/R:1)/R,")"))}return N&&M.push("rotate(".concat(N,", ").concat(O,", ").concat(T,")")),M.length&&(A.transform=M.join(" ")),C.createElement("text",lj({},Ze(A,!0),{x:O,y:T,className:mt("recharts-text",P),textAnchor:p,fill:b.includes("url")?b2:b}),w.map(function(F,V){var $=F.words.join(_?"":" ");return C.createElement("tspan",{x:O,dy:V===0?k:l,key:"".concat($,"-").concat(V)},$)}))};function No(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function uve(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function hP(e){let t,n,r;e.length!==2?(t=No,n=(l,c)=>No(e(l),c),r=(l,c)=>e(l)-c):(t=e===No||e===uve?e:dve,n=e,r=e);function s(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:s,center:o,right:i}}function dve(){return 0}function b6(e){return e===null?NaN:+e}function*fve(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const hve=hP(No),zp=hve.right;hP(b6).center;class w2 extends Map{constructor(t,n=gve){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,s]of t)this.set(r,s)}get(t){return super.get(j2(this,t))}has(t){return super.has(j2(this,t))}set(t,n){return super.set(pve(this,t),n)}delete(t){return super.delete(mve(this,t))}}function j2({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function pve({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function mve({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function gve(e){return e!==null&&typeof e=="object"?e.valueOf():e}function vve(e=No){if(e===No)return w6;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function w6(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const yve=Math.sqrt(50),xve=Math.sqrt(10),bve=Math.sqrt(2);function kv(e,t,n){const r=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(r)),i=r/Math.pow(10,s),o=i>=yve?10:i>=xve?5:i>=bve?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=s))return[];const l=i-s+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function N2(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function j6(e,t,n=0,r=1/0,s){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(s=s===void 0?w6:vve(s);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(n,Math.floor(t-u*f/c+h)),g=Math.min(r,Math.floor(t+(c-u)*f/c+h));j6(e,t,p,g,s)}const i=e[t];let o=n,l=r;for(Wd(e,n,t),s(e[r],i)>0&&Wd(e,n,r);o0;)--l}s(e[n],i)===0?Wd(e,n,l):(++l,Wd(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Wd(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function wve(e,t,n){if(e=Float64Array.from(fve(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return N2(e);if(t>=1)return S2(e);var r,s=(r-1)*t,i=Math.floor(s),o=S2(j6(e,i).subarray(0,i+1)),l=N2(e.subarray(i+1));return o+(l-o)*(s-i)}}function jve(e,t,n=b6){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,s=(r-1)*t,i=Math.floor(s),o=+n(e[i],i,e),l=+n(e[i+1],i+1,e);return o+(l-o)*(s-i)}}function Sve(e,t,n){e=+e,t=+t,n=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((t-e)/n))|0,i=new Array(s);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Cm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Cm(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_ve.exec(e))?new Ur(t[1],t[2],t[3],1):(t=Pve.exec(e))?new Ur(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Cve.exec(e))?Cm(t[1],t[2],t[3],t[4]):(t=Ave.exec(e))?Cm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Eve.exec(e))?k2(t[1],t[2]/100,t[3]/100,1):(t=Ove.exec(e))?k2(t[1],t[2]/100,t[3]/100,t[4]):_2.hasOwnProperty(e)?A2(_2[e]):e==="transparent"?new Ur(NaN,NaN,NaN,0):null}function A2(e){return new Ur(e>>16&255,e>>8&255,e&255,1)}function Cm(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ur(e,t,n,r)}function $ve(e){return e instanceof Up||(e=Dh(e)),e?(e=e.rgb(),new Ur(e.r,e.g,e.b,e.opacity)):new Ur}function hj(e,t,n,r){return arguments.length===1?$ve(e):new Ur(e,t,n,r??1)}function Ur(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}mP(Ur,hj,N6(Up,{brighter(e){return e=e==null?Tv:Math.pow(Tv,e),new Ur(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Mh:Math.pow(Mh,e),new Ur(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ur(Al(this.r),Al(this.g),Al(this.b),$v(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:E2,formatHex:E2,formatHex8:Ive,formatRgb:O2,toString:O2}));function E2(){return`#${ml(this.r)}${ml(this.g)}${ml(this.b)}`}function Ive(){return`#${ml(this.r)}${ml(this.g)}${ml(this.b)}${ml((isNaN(this.opacity)?1:this.opacity)*255)}`}function O2(){const e=$v(this.opacity);return`${e===1?"rgb(":"rgba("}${Al(this.r)}, ${Al(this.g)}, ${Al(this.b)}${e===1?")":`, ${e})`}`}function $v(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Al(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ml(e){return e=Al(e),(e<16?"0":"")+e.toString(16)}function k2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ks(e,t,n,r)}function _6(e){if(e instanceof Ks)return new Ks(e.h,e.s,e.l,e.opacity);if(e instanceof Up||(e=Dh(e)),!e)return new Ks;if(e instanceof Ks)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(t===i?o=(n-r)/l+(n0&&c<1?0:o,new Ks(o,l,c,e.opacity)}function Mve(e,t,n,r){return arguments.length===1?_6(e):new Ks(e,t,n,r??1)}function Ks(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}mP(Ks,Mve,N6(Up,{brighter(e){return e=e==null?Tv:Math.pow(Tv,e),new Ks(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Mh:Math.pow(Mh,e),new Ks(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Ur(_b(e>=240?e-240:e+120,s,r),_b(e,s,r),_b(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Ks(T2(this.h),Am(this.s),Am(this.l),$v(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 e=$v(this.opacity);return`${e===1?"hsl(":"hsla("}${T2(this.h)}, ${Am(this.s)*100}%, ${Am(this.l)*100}%${e===1?")":`, ${e})`}`}}));function T2(e){return e=(e||0)%360,e<0?e+360:e}function Am(e){return Math.max(0,Math.min(1,e||0))}function _b(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const gP=e=>()=>e;function Rve(e,t){return function(n){return e+n*t}}function Dve(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Lve(e){return(e=+e)==1?P6:function(t,n){return n-t?Dve(t,n,e):gP(isNaN(t)?n:t)}}function P6(e,t){var n=t-e;return n?Rve(e,n):gP(isNaN(e)?t:e)}const $2=function e(t){var n=Lve(t);function r(s,i){var o=n((s=hj(s)).r,(i=hj(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=P6(s.opacity,i.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function Fve(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;sn&&(i=t.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:Iv(r,s)})),n=Pb.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Yve(e,t,n){var r=e[0],s=e[1],i=t[0],o=t[1];return s2?Zve:Yve,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?i:(c||(c=l(e.map(r),t,n)))(r(o(h)))}return f.invert=function(h){return o(s((u||(u=l(t,e.map(r),Iv)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,Mv),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=vP,d()},f.clamp=function(h){return arguments.length?(o=h?!0:Er,d()):o!==Er},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(i=h,f):i},function(h,p){return r=h,s=p,d()}}function yP(){return Wx()(Er,Er)}function Qve(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Rv(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Su(e){return e=Rv(Math.abs(e)),e?e[1]:NaN}function Jve(e,t){return function(n,r){for(var s=n.length,i=[],o=0,l=e[0],c=0;s>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),i.push(n.substring(s-=l,s+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function eye(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var tye=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Lh(e){if(!(t=tye.exec(e)))throw new Error("invalid format: "+e);var t;return new xP({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Lh.prototype=xP.prototype;function xP(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}xP.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 nye(e){e:for(var t=e.length,n=1,r=-1,s;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var C6;function rye(e,t){var n=Rv(e,t);if(!n)return e+"";var r=n[0],s=n[1],i=s-(C6=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+Rv(e,Math.max(0,t+i-1))[0]}function M2(e,t){var n=Rv(e,t);if(!n)return e+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const R2={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Qve,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>M2(e*100,t),r:M2,s:rye,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function D2(e){return e}var L2=Array.prototype.map,F2=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function sye(e){var t=e.grouping===void 0||e.thousands===void 0?D2:Jve(L2.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?D2:eye(L2.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f){f=Lh(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,x=f.zero,b=f.width,y=f.comma,w=f.precision,j=f.trim,S=f.type;S==="n"?(y=!0,S="g"):R2[S]||(w===void 0&&(w=12),j=!0,S="g"),(x||h==="0"&&p==="=")&&(x=!0,h="0",p="=");var N=m==="$"?n:m==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",P=m==="$"?r:/[%p]/.test(S)?o:"",_=R2[S],A=/[defgprs%]/.test(S);w=w===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function O(T){var k=N,M=P,R,H,F;if(S==="c")M=_(T)+M,T="";else{T=+T;var V=T<0||1/T<0;if(T=isNaN(T)?c:_(Math.abs(T),w),j&&(T=nye(T)),V&&+T==0&&g!=="+"&&(V=!1),k=(V?g==="("?g:l:g==="-"||g==="("?"":g)+k,M=(S==="s"?F2[8+C6/3]:"")+M+(V&&g==="("?")":""),A){for(R=-1,H=T.length;++RF||F>57){M=(F===46?s+T.slice(R+1):T.slice(R))+M,T=T.slice(0,R);break}}}y&&!x&&(T=t(T,1/0));var $=k.length+T.length+M.length,L=$>1)+k+T+M+L.slice($);break;default:T=L+k+T+M;break}return i(T)}return O.toString=function(){return f+""},O}function d(f,h){var p=u((f=Lh(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(Su(h)/3)))*3,m=Math.pow(10,-g),x=F2[8+g/3];return function(b){return p(m*b)+x}}return{format:u,formatPrefix:d}}var Em,bP,A6;iye({thousands:",",grouping:[3],currency:["$",""]});function iye(e){return Em=sye(e),bP=Em.format,A6=Em.formatPrefix,Em}function aye(e){return Math.max(0,-Su(Math.abs(e)))}function oye(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Su(t)/3)))*3-Su(Math.abs(e)))}function lye(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Su(t)-Su(e))+1}function E6(e,t,n,r){var s=dj(e,t,n),i;switch(r=Lh(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(i=oye(s,o))&&(r.precision=i),A6(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=lye(s,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=aye(s))&&(r.precision=i-(r.type==="%")*2);break}}return bP(r)}function qo(e){var t=e.domain;return e.ticks=function(n){var r=t();return cj(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var s=t();return E6(s[0],s[s.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),s=0,i=r.length-1,o=r[s],l=r[i],c,u,d=10;for(l0;){if(u=uj(o,l,n),u===c)return r[s]=o,r[i]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function Dv(){var e=yP();return e.copy=function(){return Vp(e,Dv())},Is.apply(e,arguments),qo(e)}function O6(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Mv),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return O6(e).unknown(t)},e=arguments.length?Array.from(e,Mv):[0,1],qo(n)}function k6(e,t){e=e.slice();var n=0,r=e.length-1,s=e[n],i=e[r],o;return iMath.pow(e,t)}function hye(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function U2(e){return(t,n)=>-e(-t,n)}function wP(e){const t=e(B2,z2),n=t.domain;let r=10,s,i;function o(){return s=hye(r),i=fye(r),n()[0]<0?(s=U2(s),i=U2(i),e(cye,uye)):e(B2,z2),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;h<=p;++h)for(g=1;gd)break;b.push(m)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(m=h>0?g/i(-h):g*i(h),!(md)break;b.push(m)}b.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=Lh(c)).precision==null&&(c.trim=!0),c=bP(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/i(Math.round(s(d)));return f*rn(k6(n(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),t}function T6(){const e=wP(Wx()).domain([1,10]);return e.copy=()=>Vp(e,T6()).base(e.base()),Is.apply(e,arguments),e}function V2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function W2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function jP(e){var t=1,n=e(V2(t),W2(t));return n.constant=function(r){return arguments.length?e(V2(t=+r),W2(t)):t},qo(n)}function $6(){var e=jP(Wx());return e.copy=function(){return Vp(e,$6()).constant(e.constant())},Is.apply(e,arguments)}function H2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function pye(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function mye(e){return e<0?-e*e:e*e}function SP(e){var t=e(Er,Er),n=1;function r(){return n===1?e(Er,Er):n===.5?e(pye,mye):e(H2(n),H2(1/n))}return t.exponent=function(s){return arguments.length?(n=+s,r()):n},qo(t)}function NP(){var e=SP(Wx());return e.copy=function(){return Vp(e,NP()).exponent(e.exponent())},Is.apply(e,arguments),e}function gye(){return NP.apply(null,arguments).exponent(.5)}function G2(e){return Math.sign(e)*e*e}function vye(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function I6(){var e=yP(),t=[0,1],n=!1,r;function s(i){var o=vye(e(i));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(i){return e.invert(G2(i))},s.domain=function(i){return arguments.length?(e.domain(i),s):e.domain()},s.range=function(i){return arguments.length?(e.range((t=Array.from(i,Mv)).map(G2)),s):t.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(n=!!i,s):n},s.clamp=function(i){return arguments.length?(e.clamp(i),s):e.clamp()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return I6(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Is.apply(s,arguments),qo(s)}function M6(){var e=[],t=[],n=[],r;function s(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return R6().domain([e,t]).range(s).unknown(i)},Is.apply(qo(o),arguments)}function D6(){var e=[.5],t=[0,1],n,r=1;function s(i){return i!=null&&i<=i?t[zp(e,i,0,r)]:n}return s.domain=function(i){return arguments.length?(e=Array.from(i),r=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(i){return arguments.length?(t=Array.from(i),r=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return D6().domain(e).range(t).unknown(n)},Is.apply(s,arguments)}const Cb=new Date,Ab=new Date;function Gn(e,t,n,r){function s(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(e(i=new Date(+i)),i),s.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o(t(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i0))return c;let u;do c.push(u=new Date(+i)),t(i,l),e(i);while(uGn(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),n&&(s.count=(i,o)=>(Cb.setTime(+i),Ab.setTime(+o),e(Cb),e(Ab),Math.floor(n(Cb,Ab))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(r?o=>r(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const Lv=Gn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Lv.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Gn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Lv);Lv.range;const ra=1e3,_s=ra*60,sa=_s*60,Pa=sa*24,_P=Pa*7,q2=Pa*30,Eb=Pa*365,gl=Gn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ra)},(e,t)=>(t-e)/ra,e=>e.getUTCSeconds());gl.range;const PP=Gn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ra)},(e,t)=>{e.setTime(+e+t*_s)},(e,t)=>(t-e)/_s,e=>e.getMinutes());PP.range;const CP=Gn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*_s)},(e,t)=>(t-e)/_s,e=>e.getUTCMinutes());CP.range;const AP=Gn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ra-e.getMinutes()*_s)},(e,t)=>{e.setTime(+e+t*sa)},(e,t)=>(t-e)/sa,e=>e.getHours());AP.range;const EP=Gn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*sa)},(e,t)=>(t-e)/sa,e=>e.getUTCHours());EP.range;const Wp=Gn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*_s)/Pa,e=>e.getDate()-1);Wp.range;const Hx=Gn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Pa,e=>e.getUTCDate()-1);Hx.range;const L6=Gn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Pa,e=>Math.floor(e/Pa));L6.range;function tc(e){return Gn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*_s)/_P)}const Gx=tc(0),Fv=tc(1),yye=tc(2),xye=tc(3),Nu=tc(4),bye=tc(5),wye=tc(6);Gx.range;Fv.range;yye.range;xye.range;Nu.range;bye.range;wye.range;function nc(e){return Gn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/_P)}const qx=nc(0),Bv=nc(1),jye=nc(2),Sye=nc(3),_u=nc(4),Nye=nc(5),_ye=nc(6);qx.range;Bv.range;jye.range;Sye.range;_u.range;Nye.range;_ye.range;const OP=Gn(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());OP.range;const kP=Gn(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());kP.range;const Ca=Gn(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Ca.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Ca.range;const Aa=Gn(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Aa.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Gn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Aa.range;function F6(e,t,n,r,s,i){const o=[[gl,1,ra],[gl,5,5*ra],[gl,15,15*ra],[gl,30,30*ra],[i,1,_s],[i,5,5*_s],[i,15,15*_s],[i,30,30*_s],[s,1,sa],[s,3,3*sa],[s,6,6*sa],[s,12,12*sa],[r,1,Pa],[r,2,2*Pa],[n,1,_P],[t,1,q2],[t,3,3*q2],[e,1,Eb]];function l(u,d,f){const h=dx).right(o,h);if(p===o.length)return e.every(dj(u/Eb,d/Eb,f));if(p===0)return Lv.every(Math.max(dj(u,d,f),1));const[g,m]=o[h/o[p-1][2]53)return null;"w"in te||(te.w=1),"Z"in te?(G=kb(Hd(te.y,0,1)),ve=G.getUTCDay(),G=ve>4||ve===0?Bv.ceil(G):Bv(G),G=Hx.offset(G,(te.V-1)*7),te.y=G.getUTCFullYear(),te.m=G.getUTCMonth(),te.d=G.getUTCDate()+(te.w+6)%7):(G=Ob(Hd(te.y,0,1)),ve=G.getDay(),G=ve>4||ve===0?Fv.ceil(G):Fv(G),G=Wp.offset(G,(te.V-1)*7),te.y=G.getFullYear(),te.m=G.getMonth(),te.d=G.getDate()+(te.w+6)%7)}else("W"in te||"U"in te)&&("w"in te||(te.w="u"in te?te.u%7:"W"in te?1:0),ve="Z"in te?kb(Hd(te.y,0,1)).getUTCDay():Ob(Hd(te.y,0,1)).getDay(),te.m=0,te.d="W"in te?(te.w+6)%7+te.W*7-(ve+5)%7:te.w+te.U*7-(ve+6)%7);return"Z"in te?(te.H+=te.Z/100|0,te.M+=te.Z%100,kb(te)):Ob(te)}}function _(de,oe,xe,te){for(var Ye=0,G=oe.length,ve=xe.length,Pe,Ie;Ye=ve)return-1;if(Pe=oe.charCodeAt(Ye++),Pe===37){if(Pe=oe.charAt(Ye++),Ie=S[Pe in K2?oe.charAt(Ye++):Pe],!Ie||(te=Ie(de,xe,te))<0)return-1}else if(Pe!=xe.charCodeAt(te++))return-1}return te}function A(de,oe,xe){var te=u.exec(oe.slice(xe));return te?(de.p=d.get(te[0].toLowerCase()),xe+te[0].length):-1}function O(de,oe,xe){var te=p.exec(oe.slice(xe));return te?(de.w=g.get(te[0].toLowerCase()),xe+te[0].length):-1}function T(de,oe,xe){var te=f.exec(oe.slice(xe));return te?(de.w=h.get(te[0].toLowerCase()),xe+te[0].length):-1}function k(de,oe,xe){var te=b.exec(oe.slice(xe));return te?(de.m=y.get(te[0].toLowerCase()),xe+te[0].length):-1}function M(de,oe,xe){var te=m.exec(oe.slice(xe));return te?(de.m=x.get(te[0].toLowerCase()),xe+te[0].length):-1}function R(de,oe,xe){return _(de,t,oe,xe)}function H(de,oe,xe){return _(de,n,oe,xe)}function F(de,oe,xe){return _(de,r,oe,xe)}function V(de){return o[de.getDay()]}function $(de){return i[de.getDay()]}function L(de){return c[de.getMonth()]}function Y(de){return l[de.getMonth()]}function Q(de){return s[+(de.getHours()>=12)]}function ee(de){return 1+~~(de.getMonth()/3)}function fe(de){return o[de.getUTCDay()]}function W(de){return i[de.getUTCDay()]}function he(de){return c[de.getUTCMonth()]}function pe(de){return l[de.getUTCMonth()]}function ue(de){return s[+(de.getUTCHours()>=12)]}function Ae(de){return 1+~~(de.getUTCMonth()/3)}return{format:function(de){var oe=N(de+="",w);return oe.toString=function(){return de},oe},parse:function(de){var oe=P(de+="",!1);return oe.toString=function(){return de},oe},utcFormat:function(de){var oe=N(de+="",j);return oe.toString=function(){return de},oe},utcParse:function(de){var oe=P(de+="",!0);return oe.toString=function(){return de},oe}}}var K2={"-":"",_:" ",0:"0"},tr=/^\s*\d+/,kye=/^%/,Tye=/[\\^$*+?|[\]().{}]/g;function Dt(e,t,n){var r=e<0?"-":"",s=(r?-e:e)+"",i=s.length;return r+(i[t.toLowerCase(),n]))}function Iye(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Mye(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Rye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Dye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Lye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function X2(e,t,n){var r=tr.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Y2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Fye(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Bye(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function zye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Z2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Uye(e,t,n){var r=tr.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Q2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Vye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Wye(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Hye(e,t,n){var r=tr.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function Gye(e,t,n){var r=tr.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function qye(e,t,n){var r=kye.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Kye(e,t,n){var r=tr.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Xye(e,t,n){var r=tr.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function J2(e,t){return Dt(e.getDate(),t,2)}function Yye(e,t){return Dt(e.getHours(),t,2)}function Zye(e,t){return Dt(e.getHours()%12||12,t,2)}function Qye(e,t){return Dt(1+Wp.count(Ca(e),e),t,3)}function B6(e,t){return Dt(e.getMilliseconds(),t,3)}function Jye(e,t){return B6(e,t)+"000"}function exe(e,t){return Dt(e.getMonth()+1,t,2)}function txe(e,t){return Dt(e.getMinutes(),t,2)}function nxe(e,t){return Dt(e.getSeconds(),t,2)}function rxe(e){var t=e.getDay();return t===0?7:t}function sxe(e,t){return Dt(Gx.count(Ca(e)-1,e),t,2)}function z6(e){var t=e.getDay();return t>=4||t===0?Nu(e):Nu.ceil(e)}function ixe(e,t){return e=z6(e),Dt(Nu.count(Ca(e),e)+(Ca(e).getDay()===4),t,2)}function axe(e){return e.getDay()}function oxe(e,t){return Dt(Fv.count(Ca(e)-1,e),t,2)}function lxe(e,t){return Dt(e.getFullYear()%100,t,2)}function cxe(e,t){return e=z6(e),Dt(e.getFullYear()%100,t,2)}function uxe(e,t){return Dt(e.getFullYear()%1e4,t,4)}function dxe(e,t){var n=e.getDay();return e=n>=4||n===0?Nu(e):Nu.ceil(e),Dt(e.getFullYear()%1e4,t,4)}function fxe(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Dt(t/60|0,"0",2)+Dt(t%60,"0",2)}function ek(e,t){return Dt(e.getUTCDate(),t,2)}function hxe(e,t){return Dt(e.getUTCHours(),t,2)}function pxe(e,t){return Dt(e.getUTCHours()%12||12,t,2)}function mxe(e,t){return Dt(1+Hx.count(Aa(e),e),t,3)}function U6(e,t){return Dt(e.getUTCMilliseconds(),t,3)}function gxe(e,t){return U6(e,t)+"000"}function vxe(e,t){return Dt(e.getUTCMonth()+1,t,2)}function yxe(e,t){return Dt(e.getUTCMinutes(),t,2)}function xxe(e,t){return Dt(e.getUTCSeconds(),t,2)}function bxe(e){var t=e.getUTCDay();return t===0?7:t}function wxe(e,t){return Dt(qx.count(Aa(e)-1,e),t,2)}function V6(e){var t=e.getUTCDay();return t>=4||t===0?_u(e):_u.ceil(e)}function jxe(e,t){return e=V6(e),Dt(_u.count(Aa(e),e)+(Aa(e).getUTCDay()===4),t,2)}function Sxe(e){return e.getUTCDay()}function Nxe(e,t){return Dt(Bv.count(Aa(e)-1,e),t,2)}function _xe(e,t){return Dt(e.getUTCFullYear()%100,t,2)}function Pxe(e,t){return e=V6(e),Dt(e.getUTCFullYear()%100,t,2)}function Cxe(e,t){return Dt(e.getUTCFullYear()%1e4,t,4)}function Axe(e,t){var n=e.getUTCDay();return e=n>=4||n===0?_u(e):_u.ceil(e),Dt(e.getUTCFullYear()%1e4,t,4)}function Exe(){return"+0000"}function tk(){return"%"}function nk(e){return+e}function rk(e){return Math.floor(+e/1e3)}var fc,W6,H6;Oxe({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 Oxe(e){return fc=Oye(e),W6=fc.format,fc.parse,H6=fc.utcFormat,fc.utcParse,fc}function kxe(e){return new Date(e)}function Txe(e){return e instanceof Date?+e:+new Date(+e)}function TP(e,t,n,r,s,i,o,l,c,u){var d=yP(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),x=u("%I %p"),b=u("%a %d"),y=u("%b %d"),w=u("%B"),j=u("%Y");function S(N){return(c(N)t(s/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,i)=>wve(e,i/r))},n.copy=function(){return X6(t).domain(e)},La.apply(n,arguments)}function Xx(){var e=0,t=.5,n=1,r=1,s,i,o,l,c,u=Er,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-i)*(r*mt}var J6=Fxe,Bxe=Yx,zxe=J6,Uxe=xd;function Vxe(e){return e&&e.length?Bxe(e,Uxe,zxe):void 0}var Wxe=Vxe;const lo=Bt(Wxe);function Hxe(e,t){return ee.e^i.s<0?1:-1;for(r=i.d.length,s=e.d.length,t=0,n=re.d[t]^i.s<0?1:-1;return r===s?0:r>s^i.s<0?1:-1};Ge.decimalPlaces=Ge.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*sn;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Ge.dividedBy=Ge.div=function(e){return pa(this,new this.constructor(e))};Ge.dividedToIntegerBy=Ge.idiv=function(e){var t=this,n=t.constructor;return Yt(pa(t,new n(e),0,1),n.precision)};Ge.equals=Ge.eq=function(e){return!this.cmp(e)};Ge.exponent=function(){return In(this)};Ge.greaterThan=Ge.gt=function(e){return this.cmp(e)>0};Ge.greaterThanOrEqualTo=Ge.gte=function(e){return this.cmp(e)>=0};Ge.isInteger=Ge.isint=function(){return this.e>this.d.length-2};Ge.isNegative=Ge.isneg=function(){return this.s<0};Ge.isPositive=Ge.ispos=function(){return this.s>0};Ge.isZero=function(){return this.s===0};Ge.lessThan=Ge.lt=function(e){return this.cmp(e)<0};Ge.lessThanOrEqualTo=Ge.lte=function(e){return this.cmp(e)<1};Ge.logarithm=Ge.log=function(e){var t,n=this,r=n.constructor,s=r.precision,i=s+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(rs))throw Error(Ts+"NaN");if(n.s<1)throw Error(Ts+(n.s?"NaN":"-Infinity"));return n.eq(rs)?new r(0):(cn=!1,t=pa(Fh(n,i),Fh(e,i),i),cn=!0,Yt(t,s))};Ge.minus=Ge.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?sB(t,e):nB(t,(e.s=-e.s,e))};Ge.modulo=Ge.mod=function(e){var t,n=this,r=n.constructor,s=r.precision;if(e=new r(e),!e.s)throw Error(Ts+"NaN");return n.s?(cn=!1,t=pa(n,e,0,1).times(e),cn=!0,n.minus(t)):Yt(new r(n),s)};Ge.naturalExponential=Ge.exp=function(){return rB(this)};Ge.naturalLogarithm=Ge.ln=function(){return Fh(this)};Ge.negated=Ge.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Ge.plus=Ge.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?nB(t,e):sB(t,(e.s=-e.s,e))};Ge.precision=Ge.sd=function(e){var t,n,r,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(El+e);if(t=In(s)+1,r=s.d.length-1,n=r*sn+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Ge.squareRoot=Ge.sqrt=function(){var e,t,n,r,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Ts+"NaN")}for(e=In(l),cn=!1,s=Math.sqrt(+l),s==0||s==1/0?(t=_i(l.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=jd((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(i=r,r=i.plus(pa(l,i,o+2)).times(.5),_i(i.d).slice(0,o)===(t=_i(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),s==o&&t=="4999"){if(Yt(i,n+1,0),i.times(i).eq(l)){r=i;break}}else if(t!="9999")break;o+=4}return cn=!0,Yt(r,n)};Ge.times=Ge.mul=function(e){var t,n,r,s,i,o,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=h.length,u=p.length,c=0;){for(t=0,s=c+r;s>r;)l=i[s]+p[r]*h[s-r-1]+t,i[s--]=l%qn|0,t=l/qn|0;i[s]=(i[s]+t)%qn|0}for(;!i[--o];)i.pop();return t?++n:i.shift(),e.d=i,e.e=n,cn?Yt(e,f.precision):e};Ge.toDecimalPlaces=Ge.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Li(e,0,wd),t===void 0?t=r.rounding:Li(t,0,8),Yt(n,e+In(n)+1,t))};Ge.toExponential=function(e,t){var n,r=this,s=r.constructor;return e===void 0?n=Gl(r,!0):(Li(e,0,wd),t===void 0?t=s.rounding:Li(t,0,8),r=Yt(new s(r),e+1,t),n=Gl(r,!0,e+1)),n};Ge.toFixed=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?Gl(s):(Li(e,0,wd),t===void 0?t=i.rounding:Li(t,0,8),r=Yt(new i(s),e+In(s)+1,t),n=Gl(r.abs(),!1,e+In(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};Ge.toInteger=Ge.toint=function(){var e=this,t=e.constructor;return Yt(new t(e),In(e)+1,t.rounding)};Ge.toNumber=function(){return+this};Ge.toPower=Ge.pow=function(e){var t,n,r,s,i,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(rs);if(l=new c(l),!l.s){if(e.s<1)throw Error(Ts+"Infinity");return l}if(l.eq(rs))return l;if(r=c.precision,e.eq(rs))return Yt(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,i=l.s,o){if((n=d<0?-d:d)<=tB){for(s=new c(rs),t=Math.ceil(r/sn+4),cn=!1;n%2&&(s=s.times(l),ak(s.d,t)),n=jd(n/2),n!==0;)l=l.times(l),ak(l.d,t);return cn=!0,e.s<0?new c(rs).div(s):Yt(s,r)}}else if(i<0)throw Error(Ts+"NaN");return i=i<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,cn=!1,s=e.times(Fh(l,r+u)),cn=!0,s=rB(s),s.s=i,s};Ge.toPrecision=function(e,t){var n,r,s=this,i=s.constructor;return e===void 0?(n=In(s),r=Gl(s,n<=i.toExpNeg||n>=i.toExpPos)):(Li(e,1,wd),t===void 0?t=i.rounding:Li(t,0,8),s=Yt(new i(s),e,t),n=In(s),r=Gl(s,e<=n||n<=i.toExpNeg,e)),r};Ge.toSignificantDigits=Ge.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Li(e,1,wd),t===void 0?t=r.rounding:Li(t,0,8)),Yt(new r(n),e,t)};Ge.toString=Ge.valueOf=Ge.val=Ge.toJSON=Ge[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=In(e),n=e.constructor;return Gl(e,t<=n.toExpNeg||t>=n.toExpPos)};function nB(e,t){var n,r,s,i,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),cn?Yt(t,f):t;if(c=e.d,u=t.d,o=e.e,s=t.e,c=c.slice(),i=o-s,i){for(i<0?(r=c,i=-i,l=u.length):(r=u,s=o,l=c.length),o=Math.ceil(f/sn),l=o>l?o+1:l+1,i>l&&(i=l,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(l=c.length,i=u.length,l-i<0&&(i=l,r=u,u=c,c=r),n=0;i;)n=(c[--i]=c[i]+u[i]+n)/qn|0,c[i]%=qn;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=s,cn?Yt(t,f):t}function Li(e,t,n){if(e!==~~e||en)throw Error(El+e)}function _i(e){var t,n,r,s=e.length-1,i="",o=e[0];if(s>0){for(i+=o,t=1;to?1:-1;else for(l=c=0;ls[l]?1:-1;break}return c}function n(r,s,i){for(var o=0;i--;)r[i]-=o,o=r[i]1;)r.shift()}return function(r,s,i,o){var l,c,u,d,f,h,p,g,m,x,b,y,w,j,S,N,P,_,A=r.constructor,O=r.s==s.s?1:-1,T=r.d,k=s.d;if(!r.s)return new A(r);if(!s.s)throw Error(Ts+"Division by zero");for(c=r.e-s.e,P=k.length,S=T.length,p=new A(O),g=p.d=[],u=0;k[u]==(T[u]||0);)++u;if(k[u]>(T[u]||0)&&--c,i==null?y=i=A.precision:o?y=i+(In(r)-In(s))+1:y=i,y<0)return new A(0);if(y=y/sn+2|0,u=0,P==1)for(d=0,k=k[0],y++;(u1&&(k=e(k,d),T=e(T,d),P=k.length,S=T.length),j=P,m=T.slice(0,P),x=m.length;x=qn/2&&++N;do d=0,l=t(k,m,P,x),l<0?(b=m[0],P!=x&&(b=b*qn+(m[1]||0)),d=b/N|0,d>1?(d>=qn&&(d=qn-1),f=e(k,d),h=f.length,x=m.length,l=t(f,m,h,x),l==1&&(d--,n(f,P16)throw Error(MP+In(e));if(!e.s)return new d(rs);for(t==null?(cn=!1,l=f):l=t,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(il(2,u))/Math.LN10*2+5|0,l+=r,n=s=i=new d(rs),d.precision=l;;){if(s=Yt(s.times(e),l),n=n.times(++c),o=i.plus(pa(s,n,l)),_i(o.d).slice(0,l)===_i(i.d).slice(0,l)){for(;u--;)i=Yt(i.times(i),l);return d.precision=f,t==null?(cn=!0,Yt(i,f)):i}i=o}}function In(e){for(var t=e.e*sn,n=e.d[0];n>=10;n/=10)t++;return t}function Tb(e,t,n){if(t>e.LN10.sd())throw cn=!0,n&&(e.precision=n),Error(Ts+"LN10 precision limit exceeded");return Yt(new e(e.LN10),t)}function Ka(e){for(var t="";e--;)t+="0";return t}function Fh(e,t){var n,r,s,i,o,l,c,u,d,f=1,h=10,p=e,g=p.d,m=p.constructor,x=m.precision;if(p.s<1)throw Error(Ts+(p.s?"NaN":"-Infinity"));if(p.eq(rs))return new m(0);if(t==null?(cn=!1,u=x):u=t,p.eq(10))return t==null&&(cn=!0),Tb(m,u);if(u+=h,m.precision=u,n=_i(g),r=n.charAt(0),i=In(p),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(e),n=_i(p.d),r=n.charAt(0),f++;i=In(p),r>1?(p=new m("0."+n),i++):p=new m(r+"."+n.slice(1))}else return c=Tb(m,u+2,x).times(i+""),p=Fh(new m(r+"."+n.slice(1)),u-h).plus(c),m.precision=x,t==null?(cn=!0,Yt(p,x)):p;for(l=o=p=pa(p.minus(rs),p.plus(rs),u),d=Yt(p.times(p),u),s=3;;){if(o=Yt(o.times(d),u),c=l.plus(pa(o,new m(s),u)),_i(c.d).slice(0,u)===_i(l.d).slice(0,u))return l=l.times(2),i!==0&&(l=l.plus(Tb(m,u+2,x).times(i+""))),l=pa(l,new m(f),u),m.precision=x,t==null?(cn=!0,Yt(l,x)):l;l=c,s+=2}}function ik(e,t){var n,r,s;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(r,s),t){if(s-=r,n=n-r-1,e.e=jd(n/sn),e.d=[],r=(n+1)%sn,n<0&&(r+=sn),rzv||e.e<-zv))throw Error(MP+n)}else e.s=0,e.e=0,e.d=[0];return e}function Yt(e,t,n){var r,s,i,o,l,c,u,d,f=e.d;for(o=1,i=f[0];i>=10;i/=10)o++;if(r=t-o,r<0)r+=sn,s=t,u=f[d=0];else{if(d=Math.ceil((r+1)/sn),i=f.length,d>=i)return e;for(u=i=f[d],o=1;i>=10;i/=10)o++;r%=sn,s=r-sn+o}if(n!==void 0&&(i=il(10,o-s-1),l=u/i%10|0,c=t<0||f[d+1]!==void 0||u%i,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?u/il(10,o-s):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(i=In(e),f.length=1,t=t-i-1,f[0]=il(10,(sn-t%sn)%sn),e.e=jd(-t/sn)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,i=1,d--):(f.length=d+1,i=il(10,sn-r),f[d]=s>0?(u/il(10,o-s)%il(10,s)|0)*i:0),c)for(;;)if(d==0){(f[0]+=i)==qn&&(f[0]=1,++e.e);break}else{if(f[d]+=i,f[d]!=qn)break;f[d--]=0,i=1}for(r=f.length;f[--r]===0;)f.pop();if(cn&&(e.e>zv||e.e<-zv))throw Error(MP+In(e));return e}function sB(e,t){var n,r,s,i,o,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),cn?Yt(t,p):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),s=Math.max(Math.ceil(p/sn),l)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,l=f.length,d=s0;--s)c[l++]=0;for(s=f.length;s>o;){if(c[--s]0?i=i.charAt(0)+"."+i.slice(1)+Ka(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+Ka(-s-1)+i,n&&(r=n-o)>0&&(i+=Ka(r))):s>=o?(i+=Ka(s+1-o),n&&(r=n-s-1)>0&&(i=i+"."+Ka(r))):((r=s+1)0&&(s+1===o&&(i+="."),i+=Ka(r))),e.s<0?"-"+i:i}function ak(e,t){if(e.length>t)return e.length=t,!0}function iB(e){var t,n,r;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(El+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return ik(o,i.toString())}else if(typeof i!="string")throw Error(El+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,f0e.test(i))ik(o,i);else throw Error(El+i)}if(s.prototype=Ge,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=iB,s.config=s.set=h0e,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(El+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(El+n+": "+r);return this}var RP=iB(d0e);rs=new RP(1);const Kt=RP;function p0e(e){return y0e(e)||v0e(e)||g0e(e)||m0e()}function m0e(){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 g0e(e,t){if(e){if(typeof e=="string")return gj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gj(e,t)}}function v0e(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function y0e(e){if(Array.isArray(e))return gj(e)}function gj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,s):e(t-o,ok(function(){for(var l=arguments.length,c=new Array(l),u=0;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,s=!1,i=void 0;try{for(var o=e[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){s=!0,i=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(s)throw i}}return n}}function $0e(e){if(Array.isArray(e))return e}function uB(e){var t=Bh(e,2),n=t[0],r=t[1],s=n,i=r;return n>r&&(s=r,i=n),[s,i]}function dB(e,t,n){if(e.lte(0))return new Kt(0);var r=Jx.getDigitCount(e.toNumber()),s=new Kt(10).pow(r),i=e.div(s),o=r!==1?.05:.1,l=new Kt(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return t?c:new Kt(Math.ceil(c))}function I0e(e,t,n){var r=1,s=new Kt(e);if(!s.isint()&&n){var i=Math.abs(e);i<1?(r=new Kt(10).pow(Jx.getDigitCount(e)-1),s=new Kt(Math.floor(s.div(r).toNumber())).mul(r)):i>1&&(s=new Kt(Math.floor(e)))}else e===0?s=new Kt(Math.floor((t-1)/2)):n||(s=new Kt(Math.floor(e)));var o=Math.floor((t-1)/2),l=j0e(w0e(function(c){return s.add(new Kt(c-o).mul(r)).toNumber()}),vj);return l(0,t)}function fB(e,t,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Kt(0),tickMin:new Kt(0),tickMax:new Kt(0)};var i=dB(new Kt(t).sub(e).div(n-1),r,s),o;e<=0&&t>=0?o=new Kt(0):(o=new Kt(e).add(t).div(2),o=o.sub(new Kt(o).mod(i)));var l=Math.ceil(o.sub(e).div(i).toNumber()),c=Math.ceil(new Kt(t).sub(o).div(i).toNumber()),u=l+c+1;return u>n?fB(e,t,n,r,s+1):(u0?c+(n-u):c,l=t>0?l:l+(n-u)),{step:i,tickMin:o.sub(new Kt(l).mul(i)),tickMax:o.add(new Kt(c).mul(i))})}function M0e(e){var t=Bh(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=uB([n,r]),c=Bh(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(xj(vj(0,s-1).map(function(){return 1/0}))):[].concat(xj(vj(0,s-1).map(function(){return-1/0})),[d]);return n>r?yj(f):f}if(u===d)return I0e(u,s,i);var h=fB(u,d,o,i),p=h.step,g=h.tickMin,m=h.tickMax,x=Jx.rangeStep(g,m.add(new Kt(.1).mul(p)),p);return n>r?yj(x):x}function R0e(e,t){var n=Bh(e,2),r=n[0],s=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=uB([r,s]),l=Bh(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,s];if(c===u)return[c];var d=Math.max(t,2),f=dB(new Kt(u).sub(c).div(d-1),i,0),h=[].concat(xj(Jx.rangeStep(new Kt(c),new Kt(u).sub(new Kt(.99).mul(f)),f)),[u]);return r>s?yj(h):h}var D0e=lB(M0e),L0e=lB(R0e),F0e="Invariant failed";function ql(e,t){throw new Error(F0e)}var B0e=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function Pu(e){"@babel/helpers - typeof";return Pu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pu(e)}function Uv(){return Uv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function q0e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function K0e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function X0e(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,u=0;u0?s[u-1].coordinate:s[l-1].coordinate,f=s[u].coordinate,h=u>=l-1?s[0].coordinate:s[u+1].coordinate,p=void 0;if(Cr(f-d)!==Cr(h-f)){var g=[];if(Cr(h-f)===Cr(c[1]-c[0])){p=h;var m=f+c[1]-c[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var x=h+c[1]-c[0];g[0]=Math.min(f,(x+f)/2),g[1]=Math.max(f,(x+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>b[0]&&t<=b[1]||t>=g[0]&&t<=g[1]){o=s[u].index;break}}else{var y=Math.min(d,h),w=Math.max(d,h);if(t>(y+f)/2&&t<=(w+f)/2){o=s[u].index;break}}}else for(var j=0;j0&&j(r[j].coordinate+r[j-1].coordinate)/2&&t<=(r[j].coordinate+r[j+1].coordinate)/2||j===l-1&&t>(r[j].coordinate+r[j-1].coordinate)/2){o=r[j].index;break}return o},DP=function(t){var n,r=t,s=r.type.displayName,i=(n=t.type)!==null&&n!==void 0&&n.defaultProps?xn(xn({},t.type.defaultProps),t.props):t.props,o=i.stroke,l=i.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},fbe=function(t){var n=t.barSize,r=t.totalSize,s=t.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var o={},l=Object.keys(i),c=0,u=l.length;c=0});if(b&&b.length){var y=b[0].type.defaultProps,w=y!==void 0?xn(xn({},y),b[0].props):b[0].props,j=w.barSize,S=w[x];o[S]||(o[S]=[]);var N=vt(j)?n:j;o[S].push({item:b[0],stackList:b.slice(1),barSize:vt(N)?void 0:Ar(N,r,0)})}}return o},hbe=function(t){var n=t.barGap,r=t.barCategoryGap,s=t.bandSize,i=t.sizeList,o=i===void 0?[]:i,l=t.maxBarSize,c=o.length;if(c<1)return null;var u=Ar(n,s,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=s/c,g=o.reduce(function(j,S){return j+S.barSize||0},0);g+=(c-1)*u,g>=s&&(g-=(c-1)*u,u=0),g>=s&&p>0&&(h=!0,p*=.9,g=c*p);var m=(s-g)/2>>0,x={offset:m-u,size:0};d=o.reduce(function(j,S){var N={item:S.item,position:{offset:x.offset+x.size+u,size:h?p:S.barSize}},P=[].concat(uk(j),[N]);return x=P[P.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(_){P.push({item:_,position:x})}),P},f)}else{var b=Ar(r,s,0,!0);s-2*b-(c-1)*u<=0&&(u=0);var y=(s-2*b-(c-1)*u)/c;y>1&&(y>>=0);var w=l===+l?Math.min(y,l):y;d=o.reduce(function(j,S,N){var P=[].concat(uk(j),[{item:S.item,position:{offset:b+(y+u)*N+(y-w)/2,size:w}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(_){P.push({item:_,position:P[P.length-1].position})}),P},f)}return d},pbe=function(t,n,r,s){var i=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=gB({children:i,legendWidth:c});if(u){var d=s||{},f=d.width,h=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&ke(t[p]))return xn(xn({},t),{},Kc({},p,t[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&ke(t[g]))return xn(xn({},t),{},Kc({},g,t[g]+(h||0)))}return t},mbe=function(t,n,r){return vt(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},vB=function(t,n,r,s,i){var o=n.props.children,l=Es(o,e0).filter(function(u){return mbe(s,i,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=_n(d,r);if(vt(f))return u;var h=Array.isArray(f)?[Zx(f),lo(f)]:[f,f],p=c.reduce(function(g,m){var x=_n(d,m,0),b=h[0]-Math.abs(Array.isArray(x)?x[0]:x),y=h[1]+Math.abs(Array.isArray(x)?x[1]:x);return[Math.min(b,g[0]),Math.max(y,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},gbe=function(t,n,r,s,i){var o=n.map(function(l){return vB(t,l,r,i,s)}).filter(function(l){return!vt(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},yB=function(t,n,r,s,i){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&vB(t,c,u,s)||Af(t,u,r,i)});if(r==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d=2?Cr(l[0]-l[1])*2*u:u,n&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var h=i?i.indexOf(f):f;return{coordinate:s(h)+u,value:f,offset:u}});return d.filter(function(f){return!md(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,h){return{coordinate:s(f)+u,value:f,index:h,offset:u}}):s.ticks&&!r?s.ticks(t.tickCount).map(function(f){return{coordinate:s(f)+u,value:f,offset:u}}):s.domain().map(function(f,h){return{coordinate:s(f)+u,value:i?i[f]:f,index:h,offset:u}})},$b=new WeakMap,Om=function(t,n){if(typeof n!="function")return t;$b.has(t)||$b.set(t,new WeakMap);var r=$b.get(t);if(r.has(n))return r.get(n);var s=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},wB=function(t,n,r){var s=t.scale,i=t.type,o=t.layout,l=t.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:Ih(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:Dv(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:Cf(),realScaleType:"point"}:i==="category"?{scale:Ih(),realScaleType:"band"}:{scale:Dv(),realScaleType:"linear"};if(Lp(s)){var c="scale".concat(Dx(s));return{scale:(sk[c]||Cf)(),realScaleType:sk[c]?c:"point"}}return ct(s)?{scale:s}:{scale:Cf(),realScaleType:"point"}},fk=1e-4,jB=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,s=t.range(),i=Math.min(s[0],s[1])-fk,o=Math.max(s[0],s[1])+fk,l=t(n[0]),c=t(n[r-1]);(lo||co)&&t.domain([n[0],n[r-1]])}},vbe=function(t,n){if(!t)return null;for(var r=0,s=t.length;rs)&&(i[1]=s),i[0]>s&&(i[0]=s),i[1]=0?(t[l][r][0]=i,t[l][r][1]=i+c,i=t[l][r][1]):(t[l][r][0]=o,t[l][r][1]=o+c,o=t[l][r][1])}},bbe=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r=0?(t[o][r][0]=i,t[o][r][1]=i+l,i=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},wbe={sign:xbe,expand:Boe,none:yu,silhouette:zoe,wiggle:Uoe,positive:bbe},jbe=function(t,n,r){var s=n.map(function(l){return l.props.dataKey}),i=wbe[r],o=Foe().keys(s).value(function(l,c){return+_n(l,c,0)}).order(q1).offset(i);return o(t)},Sbe=function(t,n,r,s,i,o){if(!t)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?xn(xn({},h.type.defaultProps),h.props):h.props,m=g.stackId,x=g.hide;if(x)return f;var b=g[r],y=f[b]||{hasStack:!1,stackGroups:{}};if(Hn(m)){var w=y.stackGroups[m]||{numericAxisId:r,cateAxisId:s,items:[]};w.items.push(h),y.hasStack=!0,y.stackGroups[m]=w}else y.stackGroups[gd("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[h]};return xn(xn({},f),{},Kc({},b,y))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,x){var b=p.stackGroups[x];return xn(xn({},m),{},Kc({},x,{numericAxisId:r,cateAxisId:s,items:b.items,stackedData:jbe(t,b.items,i)}))},g)}return xn(xn({},f),{},Kc({},h,p))},d)},SB=function(t,n){var r=n.realScaleType,s=n.type,i=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=D0e(u,i,l);return t.domain([Zx(d),lo(d)]),{niceTicks:d}}if(i&&s==="number"){var f=t.domain(),h=L0e(f,i,l);return{niceTicks:h}}return null};function hk(e){var t=e.axis,n=e.ticks,r=e.bandSize,s=e.entry,i=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!vt(s[t.dataKey])){var l=gv(n,"value",s[t.dataKey]);if(l)return l.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var c=_n(s,vt(o)?t.dataKey:o);return vt(c)?null:t.scale(c)}var pk=function(t){var n=t.axis,r=t.ticks,s=t.offset,i=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return r[l]?r[l].coordinate+s:null;var c=_n(o,n.dataKey,n.domain[l]);return vt(c)?null:n.scale(c)-i/2+s},Nbe=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return s<=0&&i>=0?0:i<0?i:s}return r[0]},_be=function(t,n){var r,s=(r=t.type)!==null&&r!==void 0&&r.defaultProps?xn(xn({},t.type.defaultProps),t.props):t.props,i=s.stackId;if(Hn(i)){var o=n[i];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},Pbe=function(t){return t.reduce(function(n,r){return[Zx(r.concat([n[0]]).filter(ke)),lo(r.concat([n[1]]).filter(ke))]},[1/0,-1/0])},NB=function(t,n,r){return Object.keys(t).reduce(function(s,i){var o=t[i],l=o.stackedData,c=l.reduce(function(u,d){var f=Pbe(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(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},mk=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,gk=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Sj=function(t,n,r){if(ct(t))return t(n,r);if(!Array.isArray(t))return n;var s=[];if(ke(t[0]))s[0]=r?t[0]:Math.min(t[0],n[0]);else if(mk.test(t[0])){var i=+mk.exec(t[0])[1];s[0]=n[0]-i}else ct(t[0])?s[0]=t[0](n[0]):s[0]=n[0];if(ke(t[1]))s[1]=r?t[1]:Math.max(t[1],n[1]);else if(gk.test(t[1])){var o=+gk.exec(t[1])[1];s[1]=n[1]+o}else ct(t[1])?s[1]=t[1](n[1]):s[1]=n[1];return s},Wv=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var s=t.scale.bandwidth();if(!r||s>0)return s}if(t&&n&&n.length>=2){for(var i=dP(n,function(f){return f.coordinate}),o=1/0,l=1,c=i.length;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},AB=function(t,n,r,s,i){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Ar(t.cx,o,o/2),f=Ar(t.cy,l,l/2),h=CB(o,l,r),p=Ar(t.innerRadius,h,0),g=Ar(t.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(x,b){var y=n[b],w=y.domain,j=y.reversed,S;if(vt(y.range))s==="angleAxis"?S=[c,u]:s==="radiusAxis"&&(S=[p,g]),j&&(S=[S[1],S[0]]);else{S=y.range;var N=S,P=Ebe(N,2);c=P[0],u=P[1]}var _=wB(y,i),A=_.realScaleType,O=_.scale;O.domain(w).range(S),jB(O);var T=SB(O,Yi(Yi({},y),{},{realScaleType:A})),k=Yi(Yi(Yi({},y),T),{},{range:S,radius:g,realScaleType:A,scale:O,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:c,endAngle:u});return Yi(Yi({},x),{},PB({},b,k))},{})},Mbe=function(t,n){var r=t.x,s=t.y,i=n.x,o=n.y;return Math.sqrt(Math.pow(r-i,2)+Math.pow(s-o,2))},Rbe=function(t,n){var r=t.x,s=t.y,i=n.cx,o=n.cy,l=Mbe({x:r,y:s},{x:i,y:o});if(l<=0)return{radius:l};var c=(r-i)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:Ibe(u),angleInRadian:u}},Dbe=function(t){var n=t.startAngle,r=t.endAngle,s=Math.floor(n/360),i=Math.floor(r/360),o=Math.min(s,i);return{startAngle:n-o*360,endAngle:r-o*360}},Lbe=function(t,n){var r=n.startAngle,s=n.endAngle,i=Math.floor(r/360),o=Math.floor(s/360),l=Math.min(i,o);return t+l*360},bk=function(t,n){var r=t.x,s=t.y,i=Rbe({x:r,y:s},n),o=i.radius,l=i.angle,c=n.innerRadius,u=n.outerRadius;if(ou)return!1;if(o===0)return!0;var d=Dbe(n),f=d.startAngle,h=d.endAngle,p=l,g;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return g?Yi(Yi({},n),{},{radius:o,angle:Lbe(p,n)}):null},EB=function(t){return!v.isValidElement(t)&&!ct(t)&&typeof t!="boolean"?t.className:""};function Wh(e){"@babel/helpers - typeof";return Wh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wh(e)}var Fbe=["offset"];function Bbe(e){return Wbe(e)||Vbe(e)||Ube(e)||zbe()}function zbe(){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 Ube(e,t){if(e){if(typeof e=="string")return Nj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Nj(e,t)}}function Vbe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wbe(e){if(Array.isArray(e))return Nj(e)}function Nj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gbe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function wk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Ln(e){for(var t=1;t=0?1:-1,w,j;s==="insideStart"?(w=p+y*o,j=m):s==="insideEnd"?(w=g-y*o,j=!m):s==="end"&&(w=g+y*o,j=m),j=b<=0?j:!j;var S=Ft(u,d,x,w),N=Ft(u,d,x,w+(j?1:-1)*359),P="M".concat(S.x,",").concat(S.y,` - A`).concat(x,",").concat(x,",0,1,").concat(j?0:1,`, - `).concat(N.x,",").concat(N.y),_=vt(t.id)?gd("recharts-radial-line-"):t.id;return C.createElement("text",Hh({},r,{dominantBaseline:"central",className:mt("recharts-radial-bar-label",l)}),C.createElement("defs",null,C.createElement("path",{id:_,d:P})),C.createElement("textPath",{xlinkHref:"#".concat(_)},n))},Jbe=function(t){var n=t.viewBox,r=t.offset,s=t.position,i=n,o=i.cx,l=i.cy,c=i.innerRadius,u=i.outerRadius,d=i.startAngle,f=i.endAngle,h=(d+f)/2;if(s==="outside"){var p=Ft(o,l,u+r,h),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var x=(c+u)/2,b=Ft(o,l,x,h),y=b.x,w=b.y;return{x:y,y:w,textAnchor:"middle",verticalAnchor:"middle"}},ewe=function(t){var n=t.viewBox,r=t.parentViewBox,s=t.offset,i=t.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,h=f*s,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,x=m*s,b=m>0?"end":"start",y=m>0?"start":"end";if(i==="top"){var w={x:l+u/2,y:c-f*s,textAnchor:"middle",verticalAnchor:p};return Ln(Ln({},w),r?{height:Math.max(c-r.y,0),width:u}:{})}if(i==="bottom"){var j={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:g};return Ln(Ln({},j),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(i==="left"){var S={x:l-x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return Ln(Ln({},S),r?{width:Math.max(S.x-r.x,0),height:d}:{})}if(i==="right"){var N={x:l+u+x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"};return Ln(Ln({},N),r?{width:Math.max(r.x+r.width-N.x,0),height:d}:{})}var P=r?{width:u,height:d}:{};return i==="insideLeft"?Ln({x:l+x,y:c+d/2,textAnchor:y,verticalAnchor:"middle"},P):i==="insideRight"?Ln({x:l+u-x,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},P):i==="insideTop"?Ln({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:g},P):i==="insideBottom"?Ln({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},P):i==="insideTopLeft"?Ln({x:l+x,y:c+h,textAnchor:y,verticalAnchor:g},P):i==="insideTopRight"?Ln({x:l+u-x,y:c+h,textAnchor:b,verticalAnchor:g},P):i==="insideBottomLeft"?Ln({x:l+x,y:c+d-h,textAnchor:y,verticalAnchor:p},P):i==="insideBottomRight"?Ln({x:l+u-x,y:c+d-h,textAnchor:b,verticalAnchor:p},P):dd(i)&&(ke(i.x)||pl(i.x))&&(ke(i.y)||pl(i.y))?Ln({x:l+Ar(i.x,u),y:c+Ar(i.y,d),textAnchor:"end",verticalAnchor:"end"},P):Ln({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},P)},twe=function(t){return"cx"in t&&ke(t.cx)};function Qn(e){var t=e.offset,n=t===void 0?5:t,r=Hbe(e,Fbe),s=Ln({offset:n},r),i=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,d=s.className,f=d===void 0?"":d,h=s.textBreakAll;if(!i||vt(l)&&vt(c)&&!v.isValidElement(u)&&!ct(u))return null;if(v.isValidElement(u))return v.cloneElement(u,s);var p;if(ct(u)){if(p=v.createElement(u,s),v.isValidElement(p))return p}else p=Ybe(s);var g=twe(i),m=Ze(s,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return Qbe(s,p,m);var x=g?Jbe(s):ewe(s);return C.createElement(Wl,Hh({className:mt("recharts-label",f)},m,x,{breakAll:h}),p)}Qn.displayName="Label";var OB=function(t){var n=t.cx,r=t.cy,s=t.angle,i=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,h=t.y,p=t.top,g=t.left,m=t.width,x=t.height,b=t.clockWise,y=t.labelViewBox;if(y)return y;if(ke(m)&&ke(x)){if(ke(f)&&ke(h))return{x:f,y:h,width:m,height:x};if(ke(p)&&ke(g))return{x:p,y:g,width:m,height:x}}return ke(f)&&ke(h)?{x:f,y:h,width:0,height:0}:ke(n)&&ke(r)?{cx:n,cy:r,startAngle:i||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:b}:t.viewBox?t.viewBox:{}},nwe=function(t,n){return t?t===!0?C.createElement(Qn,{key:"label-implicit",viewBox:n}):Hn(t)?C.createElement(Qn,{key:"label-implicit",viewBox:n,value:t}):v.isValidElement(t)?t.type===Qn?v.cloneElement(t,{key:"label-implicit",viewBox:n}):C.createElement(Qn,{key:"label-implicit",content:t,viewBox:n}):ct(t)?C.createElement(Qn,{key:"label-implicit",content:t,viewBox:n}):dd(t)?C.createElement(Qn,Hh({viewBox:n},t,{key:"label-implicit"})):null:null},rwe=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var s=t.children,i=OB(t),o=Es(s,Qn).map(function(c,u){return v.cloneElement(c,{viewBox:n||i,key:"label-".concat(u)})});if(!r)return o;var l=nwe(t.label,n||i);return[l].concat(Bbe(o))};Qn.parseViewBox=OB;Qn.renderCallByParent=rwe;function swe(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var iwe=swe;const kB=Bt(iwe);function Gh(e){"@babel/helpers - typeof";return Gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gh(e)}var awe=["valueAccessor"],owe=["data","dataKey","clockWise","id","textBreakAll"];function lwe(e){return fwe(e)||dwe(e)||uwe(e)||cwe()}function cwe(){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 uwe(e,t){if(e){if(typeof e=="string")return _j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _j(e,t)}}function dwe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function fwe(e){if(Array.isArray(e))return _j(e)}function _j(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gwe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var vwe=function(t){return Array.isArray(t.value)?kB(t.value):t.value};function Ti(e){var t=e.valueAccessor,n=t===void 0?vwe:t,r=Nk(e,awe),s=r.data,i=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=Nk(r,owe);return!s||!s.length?null:C.createElement(Et,{className:"recharts-label-list"},s.map(function(d,f){var h=vt(i)?n(d,f):_n(d&&d.payload,i),p=vt(l)?{}:{id:"".concat(l,"-").concat(f)};return C.createElement(Qn,Gv({},Ze(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:Qn.parseViewBox(vt(o)?d:Sk(Sk({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}Ti.displayName="LabelList";function ywe(e,t){return e?e===!0?C.createElement(Ti,{key:"labelList-implicit",data:t}):C.isValidElement(e)||ct(e)?C.createElement(Ti,{key:"labelList-implicit",data:t,content:e}):dd(e)?C.createElement(Ti,Gv({data:t},e,{key:"labelList-implicit"})):null:null}function xwe(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,s=Es(r,Ti).map(function(o,l){return v.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return s;var i=ywe(e.label,t);return[i].concat(lwe(s))}Ti.renderCallByParent=xwe;function qh(e){"@babel/helpers - typeof";return qh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qh(e)}function Pj(){return Pj=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>u),`, - `).concat(f.x,",").concat(f.y,` - `);if(s>0){var p=Ft(n,r,s,o),g=Ft(n,r,s,u);h+="L ".concat(g.x,",").concat(g.y,` - A `).concat(s,",").concat(s,`,0, - `).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`, - `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},Nwe=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,i=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=Cr(d-u),h=km({cx:n,cy:r,radius:i,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),p=h.circleTangency,g=h.lineTangency,m=h.theta,x=km({cx:n,cy:r,radius:i,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),b=x.circleTangency,y=x.lineTangency,w=x.theta,j=c?Math.abs(u-d):Math.abs(u-d)-m-w;if(j<0)return l?"M ".concat(g.x,",").concat(g.y,` - a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 - a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 - `):TB({cx:n,cy:r,innerRadius:s,outerRadius:i,startAngle:u,endAngle:d});var S="M ".concat(g.x,",").concat(g.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` - A`).concat(i,",").concat(i,",0,").concat(+(j>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(y.x,",").concat(y.y,` - `);if(s>0){var N=km({cx:n,cy:r,radius:s,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),P=N.circleTangency,_=N.lineTangency,A=N.theta,O=km({cx:n,cy:r,radius:s,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),T=O.circleTangency,k=O.lineTangency,M=O.theta,R=c?Math.abs(u-d):Math.abs(u-d)-A-M;if(R<0&&o===0)return"".concat(S,"L").concat(n,",").concat(r,"Z");S+="L".concat(k.x,",").concat(k.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(T.x,",").concat(T.y,` - A`).concat(s,",").concat(s,",0,").concat(+(R>180),",").concat(+(f>0),",").concat(P.x,",").concat(P.y,` - A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(_.x,",").concat(_.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},_we={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},$B=function(t){var n=Pk(Pk({},_we),t),r=n.cx,s=n.cy,i=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(o0&&Math.abs(d-f)<360?x=Nwe({cx:r,cy:s,innerRadius:i,outerRadius:o,cornerRadius:Math.min(m,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):x=TB({cx:r,cy:s,innerRadius:i,outerRadius:o,startAngle:d,endAngle:f}),C.createElement("path",Pj({},Ze(n,!0),{className:p,d:x,role:"img"}))};function Kh(e){"@babel/helpers - typeof";return Kh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kh(e)}function Cj(){return Cj=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function Bwe(e,t){return Sd(e.getTime(),t.getTime())}function Ik(e,t,n){if(e.size!==t.size)return!1;for(var r={},s=e.entries(),i=0,o,l;(o=s.next())&&!o.done;){for(var c=t.entries(),u=!1,d=0;(l=c.next())&&!l.done;){var f=o.value,h=f[0],p=f[1],g=l.value,m=g[0],x=g[1];!u&&!r[d]&&(u=n.equals(h,m,i,d,e,t,n)&&n.equals(p,x,h,m,e,t,n))&&(r[d]=!0),d++}if(!u)return!1;i++}return!0}function zwe(e,t,n){var r=$k(e),s=r.length;if($k(t).length!==s)return!1;for(var i;s-- >0;)if(i=r[s],i===LB&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!DB(t,i)||!n.equals(e[i],t[i],i,i,e,t,n))return!1;return!0}function Yd(e,t,n){var r=kk(e),s=r.length;if(kk(t).length!==s)return!1;for(var i,o,l;s-- >0;)if(i=r[s],i===LB&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!DB(t,i)||!n.equals(e[i],t[i],i,i,e,t,n)||(o=Tk(e,i),l=Tk(t,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function Uwe(e,t){return Sd(e.valueOf(),t.valueOf())}function Vwe(e,t){return e.source===t.source&&e.flags===t.flags}function Mk(e,t,n){if(e.size!==t.size)return!1;for(var r={},s=e.values(),i,o;(i=s.next())&&!i.done;){for(var l=t.values(),c=!1,u=0;(o=l.next())&&!o.done;)!c&&!r[u]&&(c=n.equals(i.value,o.value,i.value,o.value,e,t,n))&&(r[u]=!0),u++;if(!c)return!1}return!0}function Wwe(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}var Hwe="[object Arguments]",Gwe="[object Boolean]",qwe="[object Date]",Kwe="[object Map]",Xwe="[object Number]",Ywe="[object Object]",Zwe="[object RegExp]",Qwe="[object Set]",Jwe="[object String]",e1e=Array.isArray,Rk=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,Dk=Object.assign,t1e=Object.prototype.toString.call.bind(Object.prototype.toString);function n1e(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,s=e.areObjectsEqual,i=e.arePrimitiveWrappersEqual,o=e.areRegExpsEqual,l=e.areSetsEqual,c=e.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 s(d,f,h);if(e1e(d))return t(d,f,h);if(Rk!=null&&Rk(d))return c(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return o(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return l(d,f,h);var g=t1e(d);return g===qwe?n(d,f,h):g===Zwe?o(d,f,h):g===Kwe?r(d,f,h):g===Qwe?l(d,f,h):g===Ywe?typeof d.then!="function"&&typeof f.then!="function"&&s(d,f,h):g===Hwe?s(d,f,h):g===Gwe||g===Xwe||g===Jwe?i(d,f,h):!1}}function r1e(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,s={areArraysEqual:r?Yd:Fwe,areDatesEqual:Bwe,areMapsEqual:r?Ok(Ik,Yd):Ik,areObjectsEqual:r?Yd:zwe,arePrimitiveWrappersEqual:Uwe,areRegExpsEqual:Vwe,areSetsEqual:r?Ok(Mk,Yd):Mk,areTypedArraysEqual:r?Yd:Wwe};if(n&&(s=Dk({},s,n(s))),t){var i=$m(s.areArraysEqual),o=$m(s.areMapsEqual),l=$m(s.areObjectsEqual),c=$m(s.areSetsEqual);s=Dk({},s,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function s1e(e){return function(t,n,r,s,i,o,l){return e(t,n,l)}}function i1e(e){var t=e.circular,n=e.comparator,r=e.createState,s=e.equals,i=e.strict;if(r)return function(c,u){var d=r(),f=d.cache,h=f===void 0?t?new WeakMap:void 0:f,p=d.meta;return n(c,u,{cache:h,equals:s,meta:p,strict:i})};if(t)return function(c,u){return n(c,u,{cache:new WeakMap,equals:s,meta:void 0,strict:i})};var o={cache:void 0,equals:s,meta:void 0,strict:i};return function(c,u){return n(c,u,o)}}var a1e=Xo();Xo({strict:!0});Xo({circular:!0});Xo({circular:!0,strict:!0});Xo({createInternalComparator:function(){return Sd}});Xo({strict:!0,createInternalComparator:function(){return Sd}});Xo({circular:!0,createInternalComparator:function(){return Sd}});Xo({circular:!0,createInternalComparator:function(){return Sd},strict:!0});function Xo(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,r=e.createInternalComparator,s=e.createState,i=e.strict,o=i===void 0?!1:i,l=r1e(e),c=n1e(l),u=r?r(c):s1e(c);return i1e({circular:n,comparator:c,createState:s,equals:u,strict:o})}function o1e(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function Lk(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(i){n<0&&(n=i),i-n>t?(e(i),n=-1):o1e(s)};requestAnimationFrame(r)}function Aj(e){"@babel/helpers - typeof";return Aj=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Aj(e)}function l1e(e){return f1e(e)||d1e(e)||u1e(e)||c1e()}function c1e(){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 u1e(e,t){if(e){if(typeof e=="string")return Fk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Fk(e,t)}}function Fk(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:b<0?0:b},m=function(b){for(var y=b>1?1:b,w=y,j=0;j<8;++j){var S=f(w)-y,N=p(w);if(Math.abs(S-y)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,s=t.damping,i=s===void 0?8:s,o=t.dt,l=o===void 0?17:o,c=function(d,f,h){var p=-(d-f)*r,g=h*i,m=h+(p-g)*l/1e3,x=h*l/1e3+d;return Math.abs(x-f)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function V1e(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,i;for(i=0;i=0)&&(n[s]=e[s]);return n}function Ib(e){return q1e(e)||G1e(e)||H1e(e)||W1e()}function W1e(){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 H1e(e,t){if(e){if(typeof e=="string")return $j(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $j(e,t)}}function G1e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function q1e(e){if(Array.isArray(e))return $j(e)}function $j(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);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 Xv(e){return Xv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Xv(e)}var li=function(e){Q1e(n,e);var t=J1e(n);function n(r,s){var i;K1e(this,n),i=t.call(this,r,s);var o=i.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,h=o.children,p=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(Rj(i)),i.changeStyle=i.changeStyle.bind(Rj(i)),!l||p<=0)return i.state={style:{}},typeof h=="function"&&(i.state={style:d}),Mj(i);if(f&&f.length)i.state={style:f[0].style};else if(u){if(typeof h=="function")return i.state={style:u},Mj(i);i.state={style:c?uf({},c,u):u}}else i.state={style:{}};return i}return Y1e(n,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,o=s.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,u=i.shouldReAnimate,d=i.to,f=i.from,h=this.state.style;if(l){if(!o){var p={style:c?uf({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(a1e(s.to,d)&&s.canBegin&&s.isActive)){var g=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=g||u?f:s.to;if(this.state&&h){var x={style:c?uf({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(x)}this.runAnimation(Ds(Ds({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,o=s.from,l=s.to,c=s.duration,u=s.easing,d=s.begin,f=s.onAnimationEnd,h=s.onAnimationStart,p=B1e(o,l,E1e(u),c,this.changeStyle),g=function(){i.stopJSAnimation=p()};this.manager.start([h,d,g,c,f])}},{key:"runStepAnimation",value:function(s){var i=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[0],d=u.style,f=u.duration,h=f===void 0?0:f,p=function(m,x,b){if(b===0)return m;var y=x.duration,w=x.easing,j=w===void 0?"ease":w,S=x.style,N=x.properties,P=x.onAnimationEnd,_=b>0?o[b-1]:x,A=N||Object.keys(S);if(typeof j=="function"||j==="spring")return[].concat(Ib(m),[i.runJSAnimation.bind(i,{from:_.style,to:S,duration:y,easing:j}),y]);var O=Uk(A,y,j),T=Ds(Ds(Ds({},_.style),S),{},{transition:O});return[].concat(Ib(m),[T,y,P]).filter(v1e)};return this.manager.start([c].concat(Ib(o.reduce(p,[d,Math.max(h,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=h1e());var i=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,d=s.onAnimationStart,f=s.onAnimationEnd,h=s.steps,p=s.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(s);return}if(h.length>1){this.runStepAnimation(s);return}var m=l?uf({},l,c):c,x=Uk(Object.keys(m),o,u);g.start([d,i,Ds(Ds({},m),{},{transition:x}),o,f])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=U1e(s,z1e),u=v.Children.count(i),d=this.state.style;if(typeof i=="function")return i(d);if(!l||u===0||o<=0)return i;var f=function(p){var g=p.props,m=g.style,x=m===void 0?{}:m,b=g.className,y=v.cloneElement(p,Ds(Ds({},c),{},{style:Ds(Ds({},x),d),className:b}));return y};return u===1?f(v.Children.only(i)):C.createElement("div",null,v.Children.map(i,function(h){return f(h)}))}}]),n}(v.PureComponent);li.displayName="Animate";li.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};li.propTypes={from:St.oneOfType([St.object,St.string]),to:St.oneOfType([St.object,St.string]),attributeName:St.string,duration:St.number,begin:St.number,easing:St.oneOfType([St.string,St.func]),steps:St.arrayOf(St.shape({duration:St.number.isRequired,style:St.object.isRequired,easing:St.oneOfType([St.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),St.func]),properties:St.arrayOf("string"),onAnimationEnd:St.func})),children:St.oneOfType([St.node,St.func]),isActive:St.bool,canBegin:St.bool,onAnimationEnd:St.func,shouldReAnimate:St.bool,onAnimationStart:St.func,onAnimationReStart:St.func};St.object,St.object,St.object,St.element;St.object,St.object,St.object,St.oneOfType([St.array,St.element]),St.any;function Zh(e){"@babel/helpers - typeof";return Zh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zh(e)}function Yv(){return Yv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,c=r>=0?1:-1,u=s>=0&&r>=0||s<0&&r<0?1:0,d;if(o>0&&i instanceof Array){for(var f=[0,0,0,0],h=0,p=4;ho?o:i[h];d="M".concat(t,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(n)),d+="L ".concat(t+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, - `).concat(t+r,",").concat(n+l*f[1])),d+="L ".concat(t+r,",").concat(n+s-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, - `).concat(t+r-c*f[2],",").concat(n+s)),d+="L ".concat(t+c*f[3],",").concat(n+s),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, - `).concat(t,",").concat(n+s-l*f[3])),d+="Z"}else if(o>0&&i===+i&&i>0){var g=Math.min(o,i);d="M ".concat(t,",").concat(n+l*g,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+c*g,",").concat(n,` - L `).concat(t+r-c*g,",").concat(n,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+r,",").concat(n+l*g,` - L `).concat(t+r,",").concat(n+s-l*g,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+r-c*g,",").concat(n+s,` - L `).concat(t+c*g,",").concat(n+s,` - A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t,",").concat(n+s-l*g," Z")}else d="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return d},cje=function(t,n){if(!t||!n)return!1;var r=t.x,s=t.y,i=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(i,i+l),d=Math.max(i,i+l),f=Math.min(o,o+c),h=Math.max(o,o+c);return r>=u&&r<=d&&s>=f&&s<=h}return!1},uje={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},LP=function(t){var n=Yk(Yk({},uje),t),r=v.useRef(),s=v.useState(-1),i=tje(s,2),o=i[0],l=i[1];v.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var j=r.current.getTotalLength();j&&l(j)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,g=n.animationEasing,m=n.animationDuration,x=n.animationBegin,b=n.isAnimationActive,y=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=mt("recharts-rectangle",p);return y?C.createElement(li,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:g,isActive:y},function(j){var S=j.width,N=j.height,P=j.x,_=j.y;return C.createElement(li,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,isActive:b,easing:g},C.createElement("path",Yv({},Ze(n,!0),{className:w,d:Zk(P,_,S,N,h),ref:r})))}):C.createElement("path",Yv({},Ze(n,!0),{className:w,d:Zk(c,u,d,f,h)}))},dje=["points","className","baseLinePoints","connectNulls"];function Oc(){return Oc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Qk(e){return vje(e)||gje(e)||mje(e)||pje()}function pje(){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 mje(e,t){if(e){if(typeof e=="string")return Dj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Dj(e,t)}}function gje(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vje(e){if(Array.isArray(e))return Dj(e)}function Dj(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){Jk(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),Jk(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},Of=function(t,n){var r=yje(t);n&&(r=[r.reduce(function(i,o){return[].concat(Qk(i),Qk(o))},[])]);var s=r.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(s,"Z"):s},xje=function(t,n,r){var s=Of(t,r);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(Of(n.reverse(),r).slice(1))},HB=function(t){var n=t.points,r=t.className,s=t.baseLinePoints,i=t.connectNulls,o=fje(t,dje);if(!n||!n.length)return null;var l=mt("recharts-polygon",r);if(s&&s.length){var c=o.stroke&&o.stroke!=="none",u=xje(n,s,i);return C.createElement("g",{className:l},C.createElement("path",Oc({},Ze(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?C.createElement("path",Oc({},Ze(o,!0),{fill:"none",d:Of(n,i)})):null,c?C.createElement("path",Oc({},Ze(o,!0),{fill:"none",d:Of(s,i)})):null)}var d=Of(n,i);return C.createElement("path",Oc({},Ze(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function Lj(){return Lj=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Pje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Cje=function(t,n,r,s,i,o){return"M".concat(t,",").concat(i,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},Aje=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,i=s===void 0?0:s,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,h=t.height,p=h===void 0?0:h,g=t.className,m=_je(t,bje),x=wje({x:r,y:i,top:l,left:u,width:f,height:p},m);return!ke(r)||!ke(i)||!ke(f)||!ke(p)||!ke(l)||!ke(u)?null:C.createElement("path",Fj({},Ze(x,!0),{className:mt("recharts-cross",g),d:Cje(r,i,f,p,l,u)}))},Eje=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Jh(e){"@babel/helpers - typeof";return Jh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jh(e)}function Oje(e,t){if(e==null)return{};var n=kje(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Ea(){return Ea=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function eSe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function tSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sT(e,t){for(var n=0;noT?o=s==="outer"?"start":"end":i<-oT?o=s==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.radius,l=r.axisLine,c=r.axisLineType,u=Jo(Jo({},Ze(this.props,!1)),{},{fill:"none"},Ze(l,!1));if(c==="circle")return C.createElement(Hp,ol({className:"recharts-polar-angle-axis-line"},u,{cx:s,cy:i,r:o}));var d=this.props.ticks,f=d.map(function(h){return Ft(s,i,o,h.coordinate)});return C.createElement(HB,ol({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,s=this.props,i=s.ticks,o=s.tick,l=s.tickLine,c=s.tickFormatter,u=s.stroke,d=Ze(this.props,!1),f=Ze(o,!1),h=Jo(Jo({},d),{},{fill:"none"},Ze(l,!1)),p=i.map(function(g,m){var x=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),y=Jo(Jo(Jo({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:x.x2,y:x.y2});return C.createElement(Et,ol({className:mt("recharts-polar-angle-axis-tick",EB(o)),key:"tick-".concat(g.coordinate)},Vl(r.props,g,m)),l&&C.createElement("line",ol({className:"recharts-polar-angle-axis-tick-line"},h,x)),o&&t.renderTickItem(o,y,c?c(g.value,m):g.value))});return C.createElement(Et,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,s=r.ticks,i=r.radius,o=r.axisLine;return i<=0||!s||!s.length?null:C.createElement(Et,{className:mt("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,s,i){var o;return C.isValidElement(r)?o=C.cloneElement(r,s):ct(r)?o=r(s):o=C.createElement(Wl,ol({},s,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(v.PureComponent);n0(sc,"displayName","PolarAngleAxis");n0(sc,"axisType","angleAxis");n0(sc,"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 gSe=XF,vSe=gSe(Object.getPrototypeOf,Object),ySe=vSe,xSe=Ra,bSe=ySe,wSe=Da,jSe="[object Object]",SSe=Function.prototype,NSe=Object.prototype,YB=SSe.toString,_Se=NSe.hasOwnProperty,PSe=YB.call(Object);function CSe(e){if(!wSe(e)||xSe(e)!=jSe)return!1;var t=bSe(e);if(t===null)return!0;var n=_Se.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&YB.call(n)==PSe}var ASe=CSe;const ESe=Bt(ASe);var OSe=Ra,kSe=Da,TSe="[object Boolean]";function $Se(e){return e===!0||e===!1||kSe(e)&&OSe(e)==TSe}var ISe=$Se;const MSe=Bt(ISe);function tp(e){"@babel/helpers - typeof";return tp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tp(e)}function Jv(){return Jv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:m,animationEasing:g,isActive:b},function(w){var j=w.upperWidth,S=w.lowerWidth,N=w.height,P=w.x,_=w.y;return C.createElement(li,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:x,duration:m,easing:g},C.createElement("path",Jv({},Ze(n,!0),{className:y,d:dT(P,_,j,S,N),ref:r})))}):C.createElement("g",null,C.createElement("path",Jv({},Ze(n,!0),{className:y,d:dT(c,u,d,f,h)})))},GSe=["option","shapeType","propTransformer","activeClassName","isActive"];function np(e){"@babel/helpers - typeof";return np=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},np(e)}function qSe(e,t){if(e==null)return{};var n=KSe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function KSe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function ey(e){for(var t=1;t0?ls(w,"paddingAngle",0):0;if(S){var P=Zn(S.endAngle-S.startAngle,w.endAngle-w.startAngle),_=Qt(Qt({},w),{},{startAngle:y+N,endAngle:y+P(m)+N});x.push(_),y=_.endAngle}else{var A=w.endAngle,O=w.startAngle,T=Zn(0,A-O),k=T(m),M=Qt(Qt({},w),{},{startAngle:y+N,endAngle:y+k+N});x.push(M),y=M.endAngle}}),C.createElement(Et,null,r.renderSectorsStatically(x))})}},{key:"attachKeyboardHandlers",value:function(r){var s=this;r.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[o].focus(),s.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[l].focus(),s.setState({sectorToFocus:l});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,s=r.sectors,i=r.isAnimationActive,o=this.state.prevSectors;return i&&s&&s.length&&(!o||!Hl(o,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,s=this.props,i=s.hide,o=s.sectors,l=s.className,c=s.label,u=s.cx,d=s.cy,f=s.innerRadius,h=s.outerRadius,p=s.isAnimationActive,g=this.state.isAnimationFinished;if(i||!o||!o.length||!ke(u)||!ke(d)||!ke(f)||!ke(h))return null;var m=mt("recharts-pie",l);return C.createElement(Et,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),c&&this.renderLabels(o),Qn.renderCallByParent(this.props,null,!1),(!p||g)&&Ti.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return s.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:r.sectors!==s.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,s){return r>s?"start":r=360?y:y-1)*c,j=x-y*p-w,S=s.reduce(function(_,A){var O=_n(A,b,0);return _+(ke(O)?O:0)},0),N;if(S>0){var P;N=s.map(function(_,A){var O=_n(_,b,0),T=_n(_,d,A),k=(ke(O)?O:0)/S,M;A?M=P.endAngle+Cr(m)*c*(O!==0?1:0):M=o;var R=M+Cr(m)*((O!==0?p:0)+k*j),H=(M+R)/2,F=(g.innerRadius+g.outerRadius)/2,V=[{name:T,value:O,payload:_,dataKey:b,type:h}],$=Ft(g.cx,g.cy,F,H);return P=Qt(Qt(Qt({percent:k,cornerRadius:i,name:T,tooltipPayload:V,midAngle:H,middleRadius:F,tooltipPosition:$},_),g),{},{value:_n(_,b),startAngle:M,endAngle:R,payload:_,paddingAngle:Cr(m)*c}),P})}return Qt(Qt({},g),{},{sectors:N,data:s})});function mNe(e){return e&&e.length?e[0]:void 0}var gNe=mNe,vNe=gNe;const yNe=Bt(vNe);var xNe=["key"];function ku(e){"@babel/helpers - typeof";return ku=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ku(e)}function bNe(e,t){if(e==null)return{};var n=wNe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function ny(){return ny=Object.assign?Object.assign.bind():function(e){for(var t=1;t=2&&(c=!0),u.push(Sr(Sr({},Ft(o,l,y,x)),{},{name:g,value:m,cx:o,cy:l,radius:y,angle:x,payload:h}))});var f=[];return c&&u.forEach(function(h){if(Array.isArray(h.value)){var p=yNe(h.value),g=vt(p)?void 0:t.scale(p);f.push(Sr(Sr({},h),{},{radius:g},Ft(o,l,g,h.angle)))}else f.push(h)}),{points:u,isRange:c,baseLinePoints:f}});var ENe=Math.ceil,ONe=Math.max;function kNe(e,t,n,r){for(var s=-1,i=ONe(ENe((t-e)/(n||1)),0),o=Array(i);i--;)o[r?i:++s]=e,e+=n;return o}var TNe=kNe,$Ne=p6,yT=1/0,INe=17976931348623157e292;function MNe(e){if(!e)return e===0?e:0;if(e=$Ne(e),e===yT||e===-yT){var t=e<0?-1:1;return t*INe}return e===e?e:0}var nz=MNe,RNe=TNe,DNe=Vx,Mb=nz;function LNe(e){return function(t,n,r){return r&&typeof r!="number"&&DNe(t,n,r)&&(n=r=void 0),t=Mb(t),n===void 0?(n=t,t=0):n=Mb(n),r=r===void 0?t0&&r.handleDrag(s.changedTouches[0])}),Yr(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,i=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:i,startIndex:l})}),r.detachDragEndListener()}),Yr(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Yr(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Yr(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Yr(r,"handleSlideDragStart",function(s){var i=ST(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return QNe(t,e),KNe(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,i=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(s,i),h=Math.max(s,i),p=t.getIndexInRange(o,f),g=t.getIndexInRange(o,h);return{startIndex:p-p%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(r){var s=this.props,i=s.data,o=s.tickFormatter,l=s.dataKey,c=_n(i[r],l,r);return ct(o)?o(c,r):c}},{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 s=this.state,i=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,g=c.onChange,m=r.pageX-i;m>0?m=Math.min(m,u+d-f-l,u+d-f-o):m<0&&(m=Math.max(m,u-o,u-l));var x=this.getIndex({startX:o+m,endX:l+m});(x.startIndex!==h||x.endIndex!==p)&&g&&g(x),this.setState({startX:o+m,endX:l+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var i=ST(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,i=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,x=d.data,b={startX:this.state.startX,endX:this.state.endX},y=r.pageX-i;y>0?y=Math.min(y,f+h-p-u):y<0&&(y=Math.max(y,f-u)),b[o]=u+y;var w=this.getIndex(b),j=w.startIndex,S=w.endIndex,N=function(){var _=x.length-1;return o==="startX"&&(l>c?j%m===0:S%m===0)||lc?S%m===0:j%m===0)||l>c&&S===_};this.setState(Yr(Yr({},o,u+y),"brushMoveStartX",r.pageX),function(){g&&N()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var i=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[s],f=l.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=l.length)){var p=l[h];s==="startX"&&p>=u||s==="endX"&&p<=c||this.setState(Yr({},s,p),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.fill,u=r.stroke;return C.createElement("rect",{stroke:u,fill:c,x:s,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=v.Children.only(u);return f?C.cloneElement(f,{x:s,y:i,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,s){var i,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,g=c.data,m=c.startIndex,x=c.endIndex,b=Math.max(r,this.props.x),y=Rb(Rb({},Ze(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((i=g[m])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=g[x])===null||o===void 0?void 0:o.name);return C.createElement(Et,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,y))}},{key:"renderSlide",value:function(r,s){var i=this.props,o=i.y,l=i.height,c=i.stroke,u=i.travellerWidth,d=Math.min(r,s)+u,f=Math.max(Math.abs(s-r)-u,0);return C.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,i=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,g={pointerEvents:"none",fill:u};return C.createElement(Et,{className:"recharts-brush-texts"},C.createElement(Wl,iy({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:o+l/2},g),this.getTextOfTick(s)),C.createElement(Wl,iy({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:o+l/2},g),this.getTextOfTick(i)))}},{key:"render",value:function(){var r=this.props,s=r.data,i=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,g=h.endX,m=h.isTextActive,x=h.isSlideMoving,b=h.isTravellerMoving,y=h.isTravellerFocused;if(!s||!s.length||!ke(l)||!ke(c)||!ke(u)||!ke(d)||u<=0||d<=0)return null;var w=mt("recharts-brush",i),j=C.Children.count(o)===1,S=GNe("userSelect","none");return C.createElement(Et,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||x||b||y||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,i=r.y,o=r.width,l=r.height,c=r.stroke,u=Math.floor(i+l/2)-1;return C.createElement(C.Fragment,null,C.createElement("rect",{x:s,y:i,width:o,height:l,fill:c,stroke:"none"}),C.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),C.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var i;return C.isValidElement(r)?i=C.cloneElement(r,s):ct(r)?i=r(s):i=t.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(r,s){var i=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(i!==s.prevData||u!==s.prevUpdateId)return Rb({prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},i&&i.length?e_e({data:i,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var h=s.scale.domain().map(function(p){return s.scale(p)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,s){for(var i=r.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>s?l=c:o=c}return s>=r[l]?l:o}}])}(v.PureComponent);Yr($u,"displayName","Brush");Yr($u,"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 t_e=uP;function n_e(e,t){var n;return t_e(e,function(r,s,i){return n=t(r,s,i),!n}),!!n}var r_e=n_e,s_e=zF,i_e=zi,a_e=r_e,o_e=Xr,l_e=Vx;function c_e(e,t,n){var r=o_e(e)?s_e:a_e;return n&&l_e(e,t,n)&&(t=void 0),r(e,i_e(t))}var u_e=c_e;const d_e=Bt(u_e);var $i=function(t,n){var r=t.alwaysShow,s=t.ifOverflow;return r&&(s="extendDomain"),s===n},NT=c6;function f_e(e,t,n){t=="__proto__"&&NT?NT(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var h_e=f_e,p_e=h_e,m_e=o6,g_e=zi;function v_e(e,t){var n={};return t=g_e(t),m_e(e,function(r,s,i){p_e(n,s,t(r,s,i))}),n}var y_e=v_e;const x_e=Bt(y_e);function b_e(e,t){for(var n=-1,r=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function D_e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function L_e(e,t){var n=e.x,r=e.y,s=R_e(e,T_e),i="".concat(n),o=parseInt(i,10),l="".concat(r),c=parseInt(l,10),u="".concat(t.height||s.height),d=parseInt(u,10),f="".concat(t.width||s.width),h=parseInt(f,10);return Zd(Zd(Zd(Zd(Zd({},t),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function PT(e){return C.createElement(ZB,Hj({shapeType:"rectangle",propTransformer:L_e,activeClassName:"recharts-active-bar"},e))}var F_e=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof t=="number")return t;var i=typeof r=="number";return i?t(r,s):(i||ql(),n)}},B_e=["value","background"],oz;function Iu(e){"@babel/helpers - typeof";return Iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(e)}function z_e(e,t){if(e==null)return{};var n=U_e(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function U_e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function oy(){return oy=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(H)0&&Math.abs(R)0&&(M=Math.min((W||0)-(R[he-1]||0),M))}),Number.isFinite(M)){var H=M/k,F=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(P=H*F/2),m.padding==="no-gap"){var V=Ar(t.barCategoryGap,H*F),$=H*F/2;P=$-V-($-V)/F*V}}}s==="xAxis"?_=[r.left+(w.left||0)+(P||0),r.left+r.width-(w.right||0)-(P||0)]:s==="yAxis"?_=c==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(P||0),r.top+r.height-(w.bottom||0)-(P||0)]:_=m.range,S&&(_=[_[1],_[0]]);var L=wB(m,i,h),Y=L.scale,Q=L.realScaleType;Y.domain(b).range(_),jB(Y);var ee=SB(Y,Hs(Hs({},m),{},{realScaleType:Q}));s==="xAxis"?(T=x==="top"&&!j||x==="bottom"&&j,A=r.left,O=f[N]-T*m.height):s==="yAxis"&&(T=x==="left"&&!j||x==="right"&&j,A=f[N]-T*m.width,O=r.top);var fe=Hs(Hs(Hs({},m),ee),{},{realScaleType:Q,x:A,y:O,scale:Y,width:s==="xAxis"?r.width:m.width,height:s==="yAxis"?r.height:m.height});return fe.bandSize=Wv(fe,ee),!m.hide&&s==="xAxis"?f[N]+=(T?-1:1)*fe.height:m.hide||(f[N]+=(T?-1:1)*fe.width),Hs(Hs({},p),{},i0({},g,fe))},{})},fz=function(t,n){var r=t.x,s=t.y,i=n.x,o=n.y;return{x:Math.min(r,i),y:Math.min(s,o),width:Math.abs(i-r),height:Math.abs(o-s)}},J_e=function(t){var n=t.x1,r=t.y1,s=t.x2,i=t.y2;return fz({x:n,y:r},{x:s,y:i})},hz=function(){function e(t){Y_e(this,e),this.scale=t}return Z_e(e,[{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]:{},s=r.bandAware,i=r.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],i=r[r.length-1];return s<=i?n>=s&&n<=i:n>=i&&n<=s}}],[{key:"create",value:function(n){return new e(n)}}])}();i0(hz,"EPS",1e-4);var BP=function(t){var n=Object.keys(t).reduce(function(r,s){return Hs(Hs({},r),{},i0({},s,hz.create(t[s])))},{});return Hs(Hs({},n),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return x_e(s,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return az(s,function(i,o){return n[o].isInRange(i)})}})};function ePe(e){return(e%180+180)%180}var tPe=function(t){var n=t.width,r=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=ePe(s),o=i*Math.PI/180,l=Math.atan(r/n),c=o>l&&o-1?s[i?t[o]:o]:void 0}}var aPe=iPe,oPe=nz;function lPe(e){var t=oPe(e),n=t%1;return t===t?n?t-n:t:0}var cPe=lPe,uPe=t6,dPe=zi,fPe=cPe,hPe=Math.max;function pPe(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:fPe(n);return s<0&&(s=hPe(r+s,0)),uPe(e,dPe(t),s)}var mPe=pPe,gPe=aPe,vPe=mPe,yPe=gPe(vPe),xPe=yPe;const bPe=Bt(xPe);var wPe=iie(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),zP=v.createContext(void 0),UP=v.createContext(void 0),pz=v.createContext(void 0),mz=v.createContext({}),gz=v.createContext(void 0),vz=v.createContext(0),yz=v.createContext(0),kT=function(t){var n=t.state,r=n.xAxisMap,s=n.yAxisMap,i=n.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,d=wPe(i);return C.createElement(zP.Provider,{value:r},C.createElement(UP.Provider,{value:s},C.createElement(mz.Provider,{value:i},C.createElement(pz.Provider,{value:d},C.createElement(gz.Provider,{value:o},C.createElement(vz.Provider,{value:u},C.createElement(yz.Provider,{value:c},l)))))))},jPe=function(){return v.useContext(gz)},xz=function(t){var n=v.useContext(zP);n==null&&ql();var r=n[t];return r==null&&ql(),r},SPe=function(){var t=v.useContext(zP);return Ja(t)},NPe=function(){var t=v.useContext(UP),n=bPe(t,function(r){return az(r.domain,Number.isFinite)});return n||Ja(t)},bz=function(t){var n=v.useContext(UP);n==null&&ql();var r=n[t];return r==null&&ql(),r},_Pe=function(){var t=v.useContext(pz);return t},PPe=function(){return v.useContext(mz)},VP=function(){return v.useContext(yz)},WP=function(){return v.useContext(vz)};function Mu(e){"@babel/helpers - typeof";return Mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(e)}function CPe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function APe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*s)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-s)<=0}function cCe(e,t){return Cz(e,t+1)}function uCe(e,t,n,r,s){for(var i=(r||[]).slice(),o=t.start,l=t.end,c=0,u=1,d=o,f=function(){var g=r==null?void 0:r[c];if(g===void 0)return{v:Cz(r,u)};var m=c,x,b=function(){return x===void 0&&(x=n(g,m)),x},y=g.coordinate,w=c===0||fy(e,y,b,d,l);w||(c=0,d=o,u+=1),w&&(d=y+e*(b()/2+s),c+=u)},h;u<=i.length;)if(h=f(),h)return h.v;return[]}function op(e){"@babel/helpers - typeof";return op=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},op(e)}function FT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function hr(e){for(var t=1;t0?p.coordinate-x*e:p.coordinate})}else i[h]=p=hr(hr({},p),{},{tickCoord:p.coordinate});var b=fy(e,p.tickCoord,m,l,c);b&&(c=p.tickCoord-e*(m()/2+s),i[h]=hr(hr({},p),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return i}function mCe(e,t,n,r,s,i){var o=(r||[]).slice(),l=o.length,c=t.start,u=t.end;if(i){var d=r[l-1],f=n(d,l-1),h=e*(d.coordinate+e*f/2-u);o[l-1]=d=hr(hr({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=fy(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+s),o[l-1]=hr(hr({},d),{},{isShow:!0}))}for(var g=i?l-1:l,m=function(y){var w=o[y],j,S=function(){return j===void 0&&(j=n(w,y)),j};if(y===0){var N=e*(w.coordinate-e*S()/2-c);o[y]=w=hr(hr({},w),{},{tickCoord:N<0?w.coordinate-N*e:w.coordinate})}else o[y]=w=hr(hr({},w),{},{tickCoord:w.coordinate});var P=fy(e,w.tickCoord,S,c,u);P&&(c=w.tickCoord+e*(S()/2+s),o[y]=hr(hr({},w),{},{isShow:!0}))},x=0;x=2?Cr(s[1].coordinate-s[0].coordinate):1,b=lCe(i,x,p);return c==="equidistantPreserveStart"?uCe(x,b,m,s,o):(c==="preserveStart"||c==="preserveStartEnd"?h=mCe(x,b,m,s,o,c==="preserveStartEnd"):h=pCe(x,b,m,s,o),h.filter(function(y){return y.isShow}))}var gCe=["viewBox"],vCe=["viewBox"],yCe=["ticks"];function Lu(e){"@babel/helpers - typeof";return Lu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lu(e)}function Tc(){return Tc=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function bCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zT(e,t){for(var n=0;n0?c(this.props):c(p)),o<=0||l<=0||!g||!g.length?null:C.createElement(Et,{className:mt("recharts-cartesian-axis",u),ref:function(x){r.layerReference=x}},i&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Qn.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,i){var o;return C.isValidElement(r)?o=C.cloneElement(r,s):ct(r)?o=r(s):o=C.createElement(Wl,Tc({},s,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(v.Component);KP(_d,"displayName","CartesianAxis");KP(_d,"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 CCe=["x1","y1","x2","y2","key"],ACe=["offset"];function Kl(e){"@babel/helpers - typeof";return Kl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kl(e)}function UT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function vr(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function TCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var $Ce=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,s=t.x,i=t.y,o=t.width,l=t.height,c=t.ry;return C.createElement("rect",{x:s,y:i,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function Oz(e,t){var n;if(C.isValidElement(e))n=C.cloneElement(e,t);else if(ct(e))n=e(t);else{var r=t.x1,s=t.y1,i=t.x2,o=t.y2,l=t.key,c=VT(t,CCe),u=Ze(c,!1);u.offset;var d=VT(u,ACe);n=C.createElement("line",vl({},d,{x1:r,y1:s,x2:i,y2:o,fill:"none",key:l}))}return n}function ICe(e){var t=e.x,n=e.width,r=e.horizontal,s=r===void 0?!0:r,i=e.horizontalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=vr(vr({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(c),index:c});return Oz(s,u)});return C.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function MCe(e){var t=e.y,n=e.height,r=e.vertical,s=r===void 0?!0:r,i=e.verticalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var u=vr(vr({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(c),index:c});return Oz(s,u)});return C.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function RCe(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,s=e.y,i=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(h){return Math.round(h+s-s)}).sort(function(h,p){return h-p});s!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?s+o-h:d[p+1]-h;if(m<=0)return null;var x=p%t.length;return C.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:i,stroke:"none",fill:t[x],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function DCe(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,s=e.fillOpacity,i=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+i-i)}).sort(function(h,p){return h-p});i!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?i+l-h:d[p+1]-h;if(m<=0)return null;var x=p%r.length;return C.createElement("rect",{key:"react-".concat(p),x:h,y:o,width:m,height:c,stroke:"none",fill:r[x],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return C.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var LCe=function(t,n){var r=t.xAxis,s=t.width,i=t.height,o=t.offset;return bB(qP(vr(vr(vr({},_d.defaultProps),r),{},{ticks:ia(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.left,o.left+o.width,n)},FCe=function(t,n){var r=t.yAxis,s=t.width,i=t.height,o=t.offset;return bB(qP(vr(vr(vr({},_d.defaultProps),r),{},{ticks:ia(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.top,o.top+o.height,n)},hc={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function lp(e){var t,n,r,s,i,o,l=VP(),c=WP(),u=PPe(),d=vr(vr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:hc.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:hc.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:hc.horizontal,horizontalFill:(s=e.horizontalFill)!==null&&s!==void 0?s:hc.horizontalFill,vertical:(i=e.vertical)!==null&&i!==void 0?i:hc.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:hc.verticalFill,x:ke(e.x)?e.x:u.left,y:ke(e.y)?e.y:u.top,width:ke(e.width)?e.width:u.width,height:ke(e.height)?e.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,x=d.horizontalValues,b=d.verticalValues,y=SPe(),w=NPe();if(!ke(p)||p<=0||!ke(g)||g<=0||!ke(f)||f!==+f||!ke(h)||h!==+h)return null;var j=d.verticalCoordinatesGenerator||LCe,S=d.horizontalCoordinatesGenerator||FCe,N=d.horizontalPoints,P=d.verticalPoints;if((!N||!N.length)&&ct(S)){var _=x&&x.length,A=S({yAxis:w?vr(vr({},w),{},{ticks:_?x:w.ticks}):void 0,width:l,height:c,offset:u},_?!0:m);ei(Array.isArray(A),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Kl(A),"]")),Array.isArray(A)&&(N=A)}if((!P||!P.length)&&ct(j)){var O=b&&b.length,T=j({xAxis:y?vr(vr({},y),{},{ticks:O?b:y.ticks}):void 0,width:l,height:c,offset:u},O?!0:m);ei(Array.isArray(T),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Kl(T),"]")),Array.isArray(T)&&(P=T)}return C.createElement("g",{className:"recharts-cartesian-grid"},C.createElement($Ce,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),C.createElement(ICe,vl({},d,{offset:u,horizontalPoints:N,xAxis:y,yAxis:w})),C.createElement(MCe,vl({},d,{offset:u,verticalPoints:P,xAxis:y,yAxis:w})),C.createElement(RCe,vl({},d,{horizontalPoints:N})),C.createElement(DCe,vl({},d,{verticalPoints:P})))}lp.displayName="CartesianGrid";var BCe=["layout","type","stroke","connectNulls","isRange","ref"],zCe=["key"],kz;function Fu(e){"@babel/helpers - typeof";return Fu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fu(e)}function Tz(e,t){if(e==null)return{};var n=UCe(e,t),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function UCe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function yl(){return yl=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!Hl(d,o)||!Hl(f,l))?this.renderAreaWithAnimation(r,s):this.renderAreaStatically(o,l,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,u=s.top,d=s.left,f=s.xAxis,h=s.yAxis,p=s.width,g=s.height,m=s.isAnimationActive,x=s.id;if(i||!l||!l.length)return null;var b=this.state.isAnimationFinished,y=l.length===1,w=mt("recharts-area",c),j=f&&f.allowDataOverflow,S=h&&h.allowDataOverflow,N=j||S,P=vt(x)?this.id:x,_=(r=Ze(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},A=_.r,O=A===void 0?3:A,T=_.strokeWidth,k=T===void 0?2:T,M=uae(o)?o:{},R=M.clipDot,H=R===void 0?!0:R,F=O*2+k;return C.createElement(Et,{className:w},j||S?C.createElement("defs",null,C.createElement("clipPath",{id:"clipPath-".concat(P)},C.createElement("rect",{x:j?d:d-p/2,y:S?u:u-g/2,width:j?p:p*2,height:S?g:g*2})),!H&&C.createElement("clipPath",{id:"clipPath-dots-".concat(P)},C.createElement("rect",{x:d-F/2,y:u-F/2,width:p+F,height:g+F}))):null,y?null:this.renderArea(N,P),(o||y)&&this.renderDots(N,H,P),(!m||b)&&Ti.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:s.curPoints,prevBaseLine:s.curBaseLine}:r.points!==s.curPoints||r.baseLine!==s.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(v.PureComponent);kz=ni;Pi(ni,"displayName","Area");Pi(ni,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ti.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Pi(ni,"getBaseValue",function(e,t,n,r){var s=e.layout,i=e.baseValue,o=t.props.baseValue,l=o??i;if(ke(l)&&typeof l=="number")return l;var c=s==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});Pi(ni,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,s=e.yAxis,i=e.xAxisTicks,o=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=t.layout,g=u&&u.length,m=kz.getBaseValue(t,n,r,s),x=p==="horizontal",b=!1,y=f.map(function(j,S){var N;g?N=u[d+S]:(N=_n(j,c),Array.isArray(N)?b=!0:N=[m,N]);var P=N[1]==null||g&&_n(j,c)==null;return x?{x:hk({axis:r,ticks:i,bandSize:l,entry:j,index:S}),y:P?null:s.scale(N[1]),value:N,payload:j}:{x:P?null:r.scale(N[1]),y:hk({axis:s,ticks:o,bandSize:l,entry:j,index:S}),value:N,payload:j}}),w;return g||b?w=y.map(function(j){var S=Array.isArray(j.value)?j.value[0]:null;return x?{x:j.x,y:S!=null&&j.y!=null?s.scale(S):null}:{x:S!=null?r.scale(S):null,y:j.y}}):w=x?s.scale(m):r.scale(m),Wa({points:y,baseLine:w,layout:p,isRange:b},h)});Pi(ni,"renderDotItem",function(e,t){var n;if(C.isValidElement(e))n=C.cloneElement(e,t);else if(ct(e))n=e(t);else{var r=mt("recharts-area-dot",typeof e!="boolean"?e.className:""),s=t.key,i=Tz(t,zCe);n=C.createElement(Hp,yl({},i,{key:s,className:r}))}return n});function Bu(e){"@babel/helpers - typeof";return Bu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bu(e)}function YCe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ZCe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function DAe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function LAe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function FAe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?o:t&&t.length&&ke(s)&&ke(i)?t.slice(s,i+1):[]};function Kz(e){return e==="number"?[0,"auto"]:void 0}var cS=function(t,n,r,s){var i=t.graphicalItems,o=t.tooltipAxis,l=u0(n,t);return r<0||!i||!i.length||r>=l.length?null:i.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=f===void 0?l:f;h=gv(p,o.dataKey,s)}else h=f&&f[r]||l[r];return h?[].concat(Vu(c),[_B(u,h)]):c},[])},ZT=function(t,n,r,s){var i=s||{x:t.chartX,y:t.chartY},o=ZAe(i,r),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=dbe(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=cS(t,n,d,f),p=QAe(r,l,d,i);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},JAe=function(t,n){var r=n.axes,s=n.graphicalItems,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=t.stackOffset,p=xB(d,i);return r.reduce(function(g,m){var x,b=m.type.defaultProps!==void 0?ge(ge({},m.type.defaultProps),m.props):m.props,y=b.type,w=b.dataKey,j=b.allowDataOverflow,S=b.allowDuplicatedCategory,N=b.scale,P=b.ticks,_=b.includeHidden,A=b[o];if(g[A])return g;var O=u0(t.data,{graphicalItems:s.filter(function(ee){var fe,W=o in ee.props?ee.props[o]:(fe=ee.type.defaultProps)===null||fe===void 0?void 0:fe[o];return W===A}),dataStartIndex:c,dataEndIndex:u}),T=O.length,k,M,R;_Ae(b.domain,j,y)&&(k=Sj(b.domain,null,j),p&&(y==="number"||N!=="auto")&&(R=Af(O,w,"category")));var H=Kz(y);if(!k||k.length===0){var F,V=(F=b.domain)!==null&&F!==void 0?F:H;if(w){if(k=Af(O,w,y),y==="category"&&p){var $=tae(k);S&&$?(M=k,k=sy(0,T)):S||(k=vk(V,k,m).reduce(function(ee,fe){return ee.indexOf(fe)>=0?ee:[].concat(Vu(ee),[fe])},[]))}else if(y==="category")S?k=k.filter(function(ee){return ee!==""&&!vt(ee)}):k=vk(V,k,m).reduce(function(ee,fe){return ee.indexOf(fe)>=0||fe===""||vt(fe)?ee:[].concat(Vu(ee),[fe])},[]);else if(y==="number"){var L=gbe(O,s.filter(function(ee){var fe,W,he=o in ee.props?ee.props[o]:(fe=ee.type.defaultProps)===null||fe===void 0?void 0:fe[o],pe="hide"in ee.props?ee.props.hide:(W=ee.type.defaultProps)===null||W===void 0?void 0:W.hide;return he===A&&(_||!pe)}),w,i,d);L&&(k=L)}p&&(y==="number"||N!=="auto")&&(R=Af(O,w,"category"))}else p?k=sy(0,T):l&&l[A]&&l[A].hasStack&&y==="number"?k=h==="expand"?[0,1]:NB(l[A].stackGroups,c,u):k=yB(O,s.filter(function(ee){var fe=o in ee.props?ee.props[o]:ee.type.defaultProps[o],W="hide"in ee.props?ee.props.hide:ee.type.defaultProps.hide;return fe===A&&(_||!W)}),y,d,!0);if(y==="number")k=aS(f,k,A,i,P),V&&(k=Sj(V,k,j));else if(y==="category"&&V){var Y=V,Q=k.every(function(ee){return Y.indexOf(ee)>=0});Q&&(k=Y)}}return ge(ge({},g),{},ft({},A,ge(ge({},b),{},{axisType:i,domain:k,categoricalDomain:R,duplicateDomain:M,originalDomain:(x=b.domain)!==null&&x!==void 0?x:H,isCategorical:p,layout:d})))},{})},eEe=function(t,n){var r=n.graphicalItems,s=n.Axis,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=u0(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=h.length,g=xB(d,i),m=-1;return r.reduce(function(x,b){var y=b.type.defaultProps!==void 0?ge(ge({},b.type.defaultProps),b.props):b.props,w=y[o],j=Kz("number");if(!x[w]){m++;var S;return g?S=sy(0,p):l&&l[w]&&l[w].hasStack?(S=NB(l[w].stackGroups,c,u),S=aS(f,S,w,i)):(S=Sj(j,yB(h,r.filter(function(N){var P,_,A=o in N.props?N.props[o]:(P=N.type.defaultProps)===null||P===void 0?void 0:P[o],O="hide"in N.props?N.props.hide:(_=N.type.defaultProps)===null||_===void 0?void 0:_.hide;return A===w&&!O}),"number",d),s.defaultProps.allowDataOverflow),S=aS(f,S,w,i)),ge(ge({},x),{},ft({},w,ge(ge({axisType:i},s.defaultProps),{},{hide:!0,orientation:ls(XAe,"".concat(i,".").concat(m%2),null),domain:S,originalDomain:j,isCategorical:g,layout:d})))}return x},{})},tEe=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,i=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.children,f="".concat(s,"Id"),h=Es(d,i),p={};return h&&h.length?p=JAe(t,{axes:h,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(p=eEe(t,{Axis:i,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},nEe=function(t){var n=Ja(t),r=ia(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:dP(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Wv(n,r)}},QT=function(t){var n=t.children,r=t.defaultShowTooltip,s=es(n,$u),i=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},rEe=function(t){return!t||!t.length?!1:t.some(function(n){var r=da(n&&n.type);return r&&r.indexOf("Bar")>=0})},JT=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},sEe=function(t,n){var r=t.props,s=t.graphicalItems,i=t.xAxisMap,o=i===void 0?{}:i,l=t.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=es(f,$u),g=es(f,fa),m=Object.keys(c).reduce(function(S,N){var P=c[N],_=P.orientation;return!P.mirror&&!P.hide?ge(ge({},S),{},ft({},_,S[_]+P.width)):S},{left:h.left||0,right:h.right||0}),x=Object.keys(o).reduce(function(S,N){var P=o[N],_=P.orientation;return!P.mirror&&!P.hide?ge(ge({},S),{},ft({},_,ls(S,"".concat(_))+P.height)):S},{top:h.top||0,bottom:h.bottom||0}),b=ge(ge({},x),m),y=b.bottom;p&&(b.bottom+=p.props.height||$u.defaultProps.height),g&&n&&(b=pbe(b,s,r,n));var w=u-b.left-b.right,j=d-b.top-b.bottom;return ge(ge({brushBottom:y},b),{},{width:Math.max(w,0),height:Math.max(j,0)})},iEe=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},d0=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,i=s===void 0?"axis":s,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,h=function(x,b){var y=b.graphicalItems,w=b.stackGroups,j=b.offset,S=b.updateId,N=b.dataStartIndex,P=b.dataEndIndex,_=x.barSize,A=x.layout,O=x.barGap,T=x.barCategoryGap,k=x.maxBarSize,M=JT(A),R=M.numericAxisName,H=M.cateAxisName,F=rEe(y),V=[];return y.forEach(function($,L){var Y=u0(x.data,{graphicalItems:[$],dataStartIndex:N,dataEndIndex:P}),Q=$.type.defaultProps!==void 0?ge(ge({},$.type.defaultProps),$.props):$.props,ee=Q.dataKey,fe=Q.maxBarSize,W=Q["".concat(R,"Id")],he=Q["".concat(H,"Id")],pe={},ue=c.reduce(function(U,K){var J=b["".concat(K.axisType,"Map")],X=Q["".concat(K.axisType,"Id")];J&&J[X]||K.axisType==="zAxis"||ql();var be=J[X];return ge(ge({},U),{},ft(ft({},K.axisType,be),"".concat(K.axisType,"Ticks"),ia(be)))},pe),Ae=ue[H],de=ue["".concat(H,"Ticks")],oe=w&&w[W]&&w[W].hasStack&&_be($,w[W].stackGroups),xe=da($.type).indexOf("Bar")>=0,te=Wv(Ae,de),Ye=[],G=F&&fbe({barSize:_,stackGroups:w,totalSize:iEe(ue,H)});if(xe){var ve,Pe,Ie=vt(fe)?k:fe,E=(ve=(Pe=Wv(Ae,de,!0))!==null&&Pe!==void 0?Pe:Ie)!==null&&ve!==void 0?ve:0;Ye=hbe({barGap:O,barCategoryGap:T,bandSize:E!==te?E:te,sizeList:G[he],maxBarSize:Ie}),E!==te&&(Ye=Ye.map(function(U){return ge(ge({},U),{},{position:ge(ge({},U.position),{},{offset:U.position.offset-E/2})})}))}var D=$&&$.type&&$.type.getComposedData;D&&V.push({props:ge(ge({},D(ge(ge({},ue),{},{displayedData:Y,props:x,dataKey:ee,item:$,bandSize:te,barPosition:Ye,offset:j,stackedData:oe,layout:A,dataStartIndex:N,dataEndIndex:P}))),{},ft(ft(ft({key:$.key||"item-".concat(L)},R,ue[R]),H,ue[H]),"animationId",S)),childIndex:hae($,x.children),item:$})}),V},p=function(x,b){var y=x.props,w=x.dataStartIndex,j=x.dataEndIndex,S=x.updateId;if(!uO({props:y}))return null;var N=y.children,P=y.layout,_=y.stackOffset,A=y.data,O=y.reverseStackOrder,T=JT(P),k=T.numericAxisName,M=T.cateAxisName,R=Es(N,r),H=Sbe(A,R,"".concat(k,"Id"),"".concat(M,"Id"),_,O),F=c.reduce(function(Q,ee){var fe="".concat(ee.axisType,"Map");return ge(ge({},Q),{},ft({},fe,tEe(y,ge(ge({},ee),{},{graphicalItems:R,stackGroups:ee.axisType===k&&H,dataStartIndex:w,dataEndIndex:j}))))},{}),V=sEe(ge(ge({},F),{},{props:y,graphicalItems:R}),b==null?void 0:b.legendBBox);Object.keys(F).forEach(function(Q){F[Q]=d(y,F[Q],V,Q.replace("Map",""),n)});var $=F["".concat(M,"Map")],L=nEe($),Y=h(y,ge(ge({},F),{},{dataStartIndex:w,dataEndIndex:j,updateId:S,graphicalItems:R,stackGroups:H,offset:V}));return ge(ge({formattedGraphicalItems:Y,graphicalItems:R,offset:V,stackGroups:H},L),F)},g=function(m){function x(b){var y,w,j;return LAe(this,x),j=zAe(this,x,[b]),ft(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ft(j,"accessibilityManager",new NAe),ft(j,"handleLegendBBoxUpdate",function(S){if(S){var N=j.state,P=N.dataStartIndex,_=N.dataEndIndex,A=N.updateId;j.setState(ge({legendBBox:S},p({props:j.props,dataStartIndex:P,dataEndIndex:_,updateId:A},ge(ge({},j.state),{},{legendBBox:S}))))}}),ft(j,"handleReceiveSyncEvent",function(S,N,P){if(j.props.syncId===S){if(P===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(N)}}),ft(j,"handleBrushChange",function(S){var N=S.startIndex,P=S.endIndex;if(N!==j.state.dataStartIndex||P!==j.state.dataEndIndex){var _=j.state.updateId;j.setState(function(){return ge({dataStartIndex:N,dataEndIndex:P},p({props:j.props,dataStartIndex:N,dataEndIndex:P,updateId:_},j.state))}),j.triggerSyncEvent({dataStartIndex:N,dataEndIndex:P})}}),ft(j,"handleMouseEnter",function(S){var N=j.getMouseInfo(S);if(N){var P=ge(ge({},N),{},{isTooltipActive:!0});j.setState(P),j.triggerSyncEvent(P);var _=j.props.onMouseEnter;ct(_)&&_(P,S)}}),ft(j,"triggeredAfterMouseMove",function(S){var N=j.getMouseInfo(S),P=N?ge(ge({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(P),j.triggerSyncEvent(P);var _=j.props.onMouseMove;ct(_)&&_(P,S)}),ft(j,"handleItemMouseEnter",function(S){j.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),ft(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),ft(j,"handleMouseMove",function(S){S.persist(),j.throttleTriggeredAfterMouseMove(S)}),ft(j,"handleMouseLeave",function(S){j.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};j.setState(N),j.triggerSyncEvent(N);var P=j.props.onMouseLeave;ct(P)&&P(N,S)}),ft(j,"handleOuterEvent",function(S){var N=fae(S),P=ls(j.props,"".concat(N));if(N&&ct(P)){var _,A;/.*touch.*/i.test(N)?A=j.getMouseInfo(S.changedTouches[0]):A=j.getMouseInfo(S),P((_=A)!==null&&_!==void 0?_:{},S)}}),ft(j,"handleClick",function(S){var N=j.getMouseInfo(S);if(N){var P=ge(ge({},N),{},{isTooltipActive:!0});j.setState(P),j.triggerSyncEvent(P);var _=j.props.onClick;ct(_)&&_(P,S)}}),ft(j,"handleMouseDown",function(S){var N=j.props.onMouseDown;if(ct(N)){var P=j.getMouseInfo(S);N(P,S)}}),ft(j,"handleMouseUp",function(S){var N=j.props.onMouseUp;if(ct(N)){var P=j.getMouseInfo(S);N(P,S)}}),ft(j,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),ft(j,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseDown(S.changedTouches[0])}),ft(j,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseUp(S.changedTouches[0])}),ft(j,"triggerSyncEvent",function(S){j.props.syncId!==void 0&&Lb.emit(Fb,j.props.syncId,S,j.eventEmitterSymbol)}),ft(j,"applySyncEvent",function(S){var N=j.props,P=N.layout,_=N.syncMethod,A=j.state.updateId,O=S.dataStartIndex,T=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)j.setState(ge({dataStartIndex:O,dataEndIndex:T},p({props:j.props,dataStartIndex:O,dataEndIndex:T,updateId:A},j.state)));else if(S.activeTooltipIndex!==void 0){var k=S.chartX,M=S.chartY,R=S.activeTooltipIndex,H=j.state,F=H.offset,V=H.tooltipTicks;if(!F)return;if(typeof _=="function")R=_(V,S);else if(_==="value"){R=-1;for(var $=0;$=0){var oe,xe;if(k.dataKey&&!k.allowDuplicatedCategory){var te=typeof k.dataKey=="function"?de:"payload.".concat(k.dataKey.toString());oe=gv($,te,R),xe=L&&Y&&gv(Y,te,R)}else oe=$==null?void 0:$[M],xe=L&&Y&&Y[M];if(he||W){var Ye=S.props.activeIndex!==void 0?S.props.activeIndex:M;return[v.cloneElement(S,ge(ge(ge({},_.props),ue),{},{activeIndex:Ye})),null,null]}if(!vt(oe))return[Ae].concat(Vu(j.renderActivePoints({item:_,activePoint:oe,basePoint:xe,childIndex:M,isRange:L})))}else{var G,ve=(G=j.getItemByXY(j.state.activeCoordinate))!==null&&G!==void 0?G:{graphicalItem:Ae},Pe=ve.graphicalItem,Ie=Pe.item,E=Ie===void 0?S:Ie,D=Pe.childIndex,U=ge(ge(ge({},_.props),ue),{},{activeIndex:D});return[v.cloneElement(E,U),null,null]}return L?[Ae,null,null]:[Ae,null]}),ft(j,"renderCustomized",function(S,N,P){return v.cloneElement(S,ge(ge({key:"recharts-customized-".concat(P)},j.props),j.state))}),ft(j,"renderMap",{CartesianGrid:{handler:Mm,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:Mm},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:Mm},YAxis:{handler:Mm},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((y=b.id)!==null&&y!==void 0?y:gd("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=m6(j.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),j.state={},j}return WAe(x,m),BAe(x,[{key:"componentDidMount",value:function(){var y,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(y=this.props.margin.left)!==null&&y!==void 0?y: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 y=this.props,w=y.children,j=y.data,S=y.height,N=y.layout,P=es(w,mr);if(P){var _=P.props.defaultIndex;if(!(typeof _!="number"||_<0||_>this.state.tooltipTicks.length-1)){var A=this.state.tooltipTicks[_]&&this.state.tooltipTicks[_].value,O=cS(this.state,j,_,A),T=this.state.tooltipTicks[_].coordinate,k=(this.state.offset.top+S)/2,M=N==="horizontal",R=M?{x:T,y:k}:{y:T,x:k},H=this.state.formattedGraphicalItems.find(function(V){var $=V.item;return $.type.name==="Scatter"});H&&(R=ge(ge({},R),H.props.points[_].tooltipPosition),O=H.props.points[_].tooltipPayload);var F={activeTooltipIndex:_,isTooltipActive:!0,activeLabel:A,activePayload:O,activeCoordinate:R};this.setState(F),this.renderCursor(P),this.accessibilityManager.setIndex(_)}}}},{key:"getSnapshotBeforeUpdate",value:function(y,w){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==w.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==y.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==y.margin){var j,S;this.accessibilityManager.setDetails({offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(y){L1([es(y.children,mr)],[es(this.props.children,mr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var y=es(this.props.children,mr);if(y&&typeof y.props.shared=="boolean"){var w=y.props.shared?"axis":"item";return l.indexOf(w)>=0?w:i}return i}},{key:"getMouseInfo",value:function(y){if(!this.container)return null;var w=this.container,j=w.getBoundingClientRect(),S=Fge(j),N={chartX:Math.round(y.pageX-S.left),chartY:Math.round(y.pageY-S.top)},P=j.width/w.offsetWidth||1,_=this.inRange(N.chartX,N.chartY,P);if(!_)return null;var A=this.state,O=A.xAxisMap,T=A.yAxisMap,k=this.getTooltipEventType();if(k!=="axis"&&O&&T){var M=Ja(O).scale,R=Ja(T).scale,H=M&&M.invert?M.invert(N.chartX):null,F=R&&R.invert?R.invert(N.chartY):null;return ge(ge({},N),{},{xValue:H,yValue:F})}var V=ZT(this.state,this.props.data,this.props.layout,_);return V?ge(ge({},N),V):null}},{key:"inRange",value:function(y,w){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,N=y/j,P=w/j;if(S==="horizontal"||S==="vertical"){var _=this.state.offset,A=N>=_.left&&N<=_.left+_.width&&P>=_.top&&P<=_.top+_.height;return A?{x:N,y:P}:null}var O=this.state,T=O.angleAxisMap,k=O.radiusAxisMap;if(T&&k){var M=Ja(T);return bk({x:N,y:P},M)}return null}},{key:"parseEventsOfWrapper",value:function(){var y=this.props.children,w=this.getTooltipEventType(),j=es(y,mr),S={};j&&w==="axis"&&(j.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var N=vv(this.props,this.handleOuterEvent);return ge(ge({},N),S)}},{key:"addListener",value:function(){Lb.on(Fb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){Lb.removeListener(Fb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(y,w,j){for(var S=this.state.formattedGraphicalItems,N=0,P=S.length;Ni<30?"Low":i<70?"Medium":"High";return a.jsx(wo,{open:t,onOpenChange:n,children:a.jsxs(la,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[a.jsx(ca,{children:a.jsxs(ua,{className:"flex items-center gap-3",children:[a.jsx("img",{src:sd(e),alt:`${e.name} avatar`,className:"h-10 w-10 rounded-full object-cover"}),e.name]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(er,{className:"h-4 w-4"}),"Demographics"]}),a.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Age:"}),a.jsx("p",{className:"font-medium",children:e.age})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Gender:"}),a.jsx("p",{className:"font-medium",children:e.gender})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Occupation:"}),a.jsx("p",{className:"font-medium",children:e.occupation})]}),a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Location:"}),a.jsxs("p",{className:"font-medium flex items-center gap-1",children:[a.jsx(OR,{className:"h-3 w-3"}),e.location]})]})]})]})}),e.aiSynthesizedBio&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(ja,{className:"h-4 w-4"}),"AI-Synthesized Bio"]}),a.jsx("p",{className:"text-sm leading-relaxed",children:e.aiSynthesizedBio})]})}),e.personality&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(Mg,{className:"h-4 w-4"}),"Personality Overview"]}),a.jsxs("p",{className:"text-sm leading-relaxed italic",children:['"',e.personality,'"']})]})}),e.techSavviness!==void 0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(kN,{className:"h-4 w-4"}),"Tech Savviness"]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex-1 bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${e.techSavviness}%`}})}),a.jsxs("span",{className:"text-sm font-medium min-w-0",children:[s(e.techSavviness)," (",e.techSavviness,"/100)"]})]})]})}),e.qualitativeAttributes&&e.qualitativeAttributes.length>0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(ON,{className:"h-4 w-4"}),"Key Attributes"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.qualitativeAttributes.map((i,o)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-blue-50 text-blue-700 text-sm rounded-full",children:["🏷️ ",i]},o))})]})}),e.topPersonalityTraits&&e.topPersonalityTraits.length>0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(ja,{className:"h-4 w-4"}),"Top Personality Traits"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.topPersonalityTraits.map((i,o)=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-3 py-1 bg-purple-50 text-purple-700 text-sm rounded-full",children:["🧠 ",i]},o))})]})}),r.length>0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-4",children:[a.jsxs("h3",{className:"font-medium mb-3 flex items-center gap-2",children:[a.jsx(Qi,{className:"h-4 w-4"}),"OCEAN Personality Traits"]}),a.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[a.jsx("div",{className:"h-64",children:a.jsx(ha,{width:"100%",height:"100%",children:a.jsxs(Yz,{data:r,children:[a.jsx(FP,{stroke:"#e2e8f0"}),a.jsx(sc,{dataKey:"trait",tick:{fill:"#64748b",fontSize:12}}),a.jsx(rc,{angle:90,domain:[0,100],tick:{fill:"#64748b",fontSize:10}}),a.jsx(Nd,{name:"OCEAN Traits",dataKey:"value",stroke:"#3b82f6",fill:"#3b82f6",fillOpacity:.1,strokeWidth:2})]})})}),a.jsx("div",{className:"space-y-4",children:r.map(i=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between items-center mb-1",children:[a.jsx("span",{className:"text-sm font-medium",children:i.trait}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[i.value,"/100"]})]}),a.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:a.jsx("div",{className:"bg-primary h-2 rounded-full transition-all duration-300",style:{width:`${i.value}%`}})})]},i.trait))})]})]})}),(e.ethnicity||e.additionalNotes)&&a.jsxs(jne,{type:"single",collapsible:!0,className:"w-full",children:[e.ethnicity&&a.jsxs($1,{value:"demographics",children:[a.jsx(I1,{children:"Additional Demographics"}),a.jsx(M1,{children:a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{children:[a.jsx("span",{className:"text-muted-foreground",children:"Ethnicity:"}),a.jsx("p",{className:"font-medium",children:e.ethnicity})]})})})]}),e.additionalNotes&&a.jsxs($1,{value:"notes",children:[a.jsx(I1,{children:"Additional Notes"}),a.jsx(M1,{children:a.jsx("p",{className:"text-sm leading-relaxed",children:e.additionalNotes})})]})]})]})]})})}const el="all",oEe=Re.object({researchBrief:Re.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Re.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Re.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Re.instanceof(FileList).optional(),duration:Re.string().min(1,{message:"Duration is required."}),llm_model:Re.string().optional()}),Qd={introduction:"Welcome to our focus group discussion. Today we'll be exploring your experiences and opinions on [product/service]. There are no right or wrong answers, we're just interested in your honest thoughts.",warmup:"Let's start by introducing ourselves and sharing a bit about your background and daily routines relevant to this topic.",exploration:"Now, let's dive deeper into your experiences with similar products. What features do you find most valuable? What frustrations have you encountered?",creative:"We'll now show you some concepts and get your feedback. Please be honest and specific in your reactions.",conclusion:"To wrap up, I'd like to hear your final thoughts on what we've discussed today and any additional insights you'd like to share."};function lEe({draftToEdit:e,onDraftSaved:t}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",e);const n=Rn(),[r,s]=v.useState("setup"),[i,o]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(null),[p,g]=v.useState(null),m=v.useRef(f);m.current=f;const x=v.useRef(!1),b=q=>q&&typeof q=="object"&&q.title&&q.sections,[y,w]=v.useState([]),[j,S]=v.useState([]),[N,P]=v.useState([]),[_,A]=v.useState(!1),[O,T]=v.useState(!1),[k,M]=v.useState([]),[R,H]=v.useState(el),[F,V]=v.useState(!1),[$,L]=v.useState(""),[Y,Q]=v.useState(null),[ee,fe]=v.useState(""),[W,he]=v.useState(""),[pe,ue]=v.useState(!1),[Ae,de]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[oe,xe]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[te,Ye]=v.useState(!1),[G,ve]=v.useState(null),Pe=q=>{ve(q),Ye(!0)},Ie=()=>{Ye(!1),ve(null)},E=q=>{const we={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return q.forEach(I=>{if(I.age&&we.age.add(I.age),I.gender&&we.gender.add(I.gender),I.occupation&&we.occupation.add(I.occupation),I.location&&we.location.add(I.location),I.techSavviness!==void 0){const Z=I.techSavviness<30?"Low (0-30)":I.techSavviness<70?"Medium (31-70)":"High (71-100)";we.techSavviness.add(Z)}I.ethnicity&&we.ethnicity.add(I.ethnicity)}),{age:Array.from(we.age).sort(),gender:Array.from(we.gender).sort(),occupation:Array.from(we.occupation).sort(),location:Array.from(we.location).sort(),techSavviness:Array.from(we.techSavviness).sort((I,Z)=>{const ne=["Low (0-30)","Medium (31-70)","High (71-100)"];return ne.indexOf(I)-ne.indexOf(Z)}),ethnicity:Array.from(we.ethnicity).sort()}},D=q=>{const we={...oe};we[q]=[];const I=N.filter(Z=>{let ne=!0;if(R!==el)if(ne=!1,Z.folderId===R)ne=!0;else{const B=k.find(z=>z.id===R);B&&B.personaIds.includes(Z.id)&&(ne=!0)}return ne?Object.entries(we).every(([B,z])=>{if(z.length===0)return!0;const re=B;if(re==="techSavviness"&&Z.techSavviness!==void 0){const me=Z.techSavviness<30?"Low (0-30)":Z.techSavviness<70?"Medium (31-70)":"High (71-100)";return z.includes(me)}else{if(re==="age"&&Z.age)return z.includes(Z.age);if(re==="gender"&&Z.gender)return z.includes(Z.gender);if(re==="occupation"&&Z.occupation)return z.includes(Z.occupation);if(re==="location"&&Z.location)return z.includes(Z.location);if(re==="ethnicity"&&Z.ethnicity)return z.includes(Z.ethnicity)}return!0}):!1});return E(I)},U=()=>{ue(!1),setTimeout(()=>{de({...oe})},0)},K=()=>{xe({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},J=(q,we)=>{xe(I=>{const Z={...I};return Z[q].includes(we)?Z[q]=Z[q].filter(ne=>ne!==we):Z[q]=[...Z[q],we],Z})},X=()=>{if(!$.trim()){ce.error("Please enter a folder name");return}const q={id:`folder-${Date.now()}`,name:$.trim(),personaIds:[]};M([...k,q]),L(""),V(!1),ce.success(`Folder "${$}" created`)},be=()=>{L(""),V(!1)},_e=q=>{Q(q),fe(q.name)},Fe=()=>{if(!Y||!ee.trim()){Q(null);return}const q=k.map(we=>we.id===Y.id?{...we,name:ee.trim()}:we);M(q),Q(null),ce.success(`Folder renamed to "${ee}"`)},ie=()=>{Q(null),fe("")},Te=(q,we)=>(q.forEach(I=>{if(I.folderId){const Z=we.find(ne=>ne.id===I.folderId);Z&&!Z.personaIds.includes(I.id)&&Z.personaIds.push(I.id)}}),we.forEach(I=>{I.personaIds=I.personaIds.filter(Z=>{if(!Z)return console.log(`Removing invalid personaId (${Z}) from folder ${I.name}`),!1;const ne=q.find(B=>B.id===Z||B._id===Z);return ne||console.log(`Removing non-existent personaId ${Z} from folder ${I.name}`),!!ne})}),we);v.useEffect(()=>{const q=async()=>{A(!0);try{const Z=await $n.getAll();console.log("Fetched personas for FocusGroupModerator:",Z.data),Array.isArray(Z.data)&&Z.data.length>0?P(Z.data):(console.warn("No personas returned from API or invalid format",Z.data),ce.warning("No participants available"))}catch(Z){console.error("Error fetching personas:",Z),ce.error("Failed to load participants")}finally{A(!1)}},we=localStorage.getItem("persona-folders");let I=[];if(we)try{I=JSON.parse(we),M(I)}catch(Z){console.error("Failed to parse stored folders:",Z)}q()},[]),v.useEffect(()=>{k.length>0&&(console.log("Saving folders to localStorage:",k),localStorage.setItem("persona-folders",JSON.stringify(k)))},[k]),v.useEffect(()=>{if(N.length>0&&k.length>0){console.log("Running folder sync with personas:",N.length,"and folders:",k.length);const q=Te(N,[...k]);JSON.stringify(q)!==JSON.stringify(k)?(console.log("Updating folders after sync"),M(q)):console.log("No folder changes after sync")}},[N,k.length]),console.log("About to initialize form with useForm hook");const Be=tx({resolver:nx(oEe),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro"}});console.log("Form initialized successfully"),v.useEffect(()=>{e&&!x.current&&(console.log("Loading draft focus group:",e),x.current=!0,g(e.id||e._id),e.name&&Be.setValue("focusGroupName",e.name),(e.description||e.objective)&&Be.setValue("researchBrief",e.description||e.objective||""),e.topic&&Be.setValue("discussionTopics",e.topic),e.duration&&Be.setValue("duration",e.duration.toString()),e.discussionGuide&&(h(e.discussionGuide),s("review")),e.participants&&Array.isArray(e.participants)&&w(e.participants),ce.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}))},[e,Be]);const gt=async(q,we)=>{var I,Z;o(!0),c(!1),d(!1);try{const ne={name:q.focusGroupName,description:q.researchBrief,objective:q.researchBrief,topic:q.discussionTopics,duration:parseInt(q.duration),llm_model:q.llm_model},B=we?await Ct.generateDiscussionGuideForGroup(we,ne):await Ct.generateDiscussionGuide(ne);if(B.data&&B.data.discussionGuide)return c(!0),B.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(ne){console.error("Error generating discussion guide:",ne),d(!0);let B="Unknown error occurred";return(Z=(I=ne==null?void 0:ne.response)==null?void 0:I.data)!=null&&Z.error?B=ne.response.data.error:ne!=null&&ne.message&&(B=ne.message),B.includes("500")||B.includes("internal error")||B.includes("Internal Server Error")?ce.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>gt(q)}}):ce.error("Failed to generate discussion guide",{description:B,action:{label:"Retry",onClick:()=>gt(q)}}),` -# Discussion Guide: ${q.focusGroupName} - -## Introduction (5 minutes) -${Qd.introduction} - -## Warm-up Questions (10 minutes) -${Qd.warmup} - -## ${q.discussionTopics.split(",")[0]} Exploration (15 minutes) -${Qd.exploration} - -## Creative Testing (20 minutes) -${Qd.creative} -${q.creativeAssets&&q.creativeAssets.length>0?`We'll be reviewing ${q.creativeAssets.length} creative assets.`:""} - -## Conclusion (10 minutes) -${Qd.conclusion} - -## Research Brief Context -${q.researchBrief} - `}},At=()=>{o(!1),c(!1),d(!1)};async function pn(q){var we;try{let I=p;if(!I){const ne={name:q.focusGroupName,status:"draft",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(q.duration),topic:q.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:q.researchBrief,objective:q.researchBrief,llm_model:q.llm_model},B=await Ct.create(ne);I=B.data.focus_group_id||B.data.id||B.data._id,g(I),console.log("Draft focus group created for asset upload:",B,"with ID:",I)}if(q.creativeAssets&&q.creativeAssets.length>0&&I)try{const ne=new FormData;Array.from(q.creativeAssets).forEach(me=>{ne.append("assets",me)});const z=(await Ct.uploadAssets(I,ne)).data;console.log("Assets uploaded successfully:",z),ce.success(`${z.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const re=Array.from(q.creativeAssets);S(re)}catch(ne){console.error("Asset upload failed:",ne);const B=(we=ne.response)==null?void 0:we.data;let z="Asset upload failed",re="Some assets could not be uploaded";(B==null?void 0:B.code)==="TEMP_DIR_ERROR"?(z="Upload temporarily unavailable",re="Server storage issue. Please try again in a moment."):(B==null?void 0:B.code)==="UPLOAD_SYSTEM_FAILURE"?(z="Upload system unavailable",re="Critical server issue. Please contact support."):B!=null&&B.can_retry&&(z="Upload failed - can retry",re=(B==null?void 0:B.details)||"Please try uploading again."),ce.error(z,{description:re}),console.log("Continuing without assets due to upload failure")}if(I)try{const ne={name:q.focusGroupName,participants:y,participants_count:y.length,duration:parseInt(q.duration),topic:q.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:q.researchBrief,objective:q.researchBrief,llm_model:q.llm_model};await Ct.update(I,ne),console.log("Focus group updated with latest form values before guide generation"),console.log(`🔄 Updated focus group ${I} with model: ${q.llm_model}`)}catch(ne){console.error("Failed to update focus group before guide generation:",ne)}const Z=await gt(q,I);h(Z);try{const ne={name:q.focusGroupName,status:"draft",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(q.duration),topic:q.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:q.researchBrief,objective:q.researchBrief,llm_model:q.llm_model,discussionGuide:Z};await Ct.update(I,ne),console.log("Focus group updated with discussion guide"),ce.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(ne){console.error("Failed to update focus group with discussion guide:",ne),ce.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}s("review"),ce.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(I){console.error("Error in focus group creation flow:",I),ce.error("Focus group creation failed",{description:I.message||"An unexpected error occurred"})}}const Zt=(()=>{var we;const q=N.filter(I=>{const Z=I.name.toLowerCase().includes(W.toLowerCase())||I.occupation&&I.occupation.toLowerCase().includes(W.toLowerCase())||I.location&&I.location.toLowerCase().includes(W.toLowerCase()),ne=(Ae.age.length===0||Ae.age.includes(I.age))&&(Ae.gender.length===0||Ae.gender.includes(I.gender))&&(Ae.occupation.length===0||Ae.occupation.includes(I.occupation))&&(Ae.location.length===0||Ae.location.includes(I.location))&&(Ae.ethnicity.length===0||I.ethnicity&&Ae.ethnicity.includes(I.ethnicity))&&(Ae.techSavviness.length===0||I.techSavviness!==void 0&&Ae.techSavviness.includes(I.techSavviness<30?"Low (0-30)":I.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let B=!0;if(R!==el)if(B=!1,I.folderId===R)B=!0;else{const z=k.find(re=>re.id===R);if(z){const re=z.personaIds.filter(le=>!!le),me=I.id||I._id;re.includes(me)&&(B=!0)}}return Z&&ne&&B});if(console.log(`Filtered personas: ${q.length}/${N.length}`),console.log(`Selected folder: ${R===el?"All Personas":((we=k.find(I=>I.id===R))==null?void 0:we.name)||R}`),R!==el){const I=k.find(Z=>Z.id===R);if(I){const Z=I.personaIds.filter(z=>!!z);console.log(`Folder details: ${I.name}, ID: ${I.id}, Contains: ${Z.length} valid personas`),console.log("Folder personaIds (valid only):",Z);const ne=N.filter(z=>z.folderId===R);console.log(`Personas with folderId matching this folder: ${ne.length}`);const B=N.filter(z=>{const re=z.id||z._id;return I.personaIds.includes(re)});console.log(`Personas in folder's personaIds array: ${B.length}`)}}return q})(),bn=q=>{console.log("Toggling selection for participant ID:",q),w(we=>{const I=we.includes(q);console.log("Current selection:",{id:q,isCurrentlySelected:I,currentSelections:[...we]});const Z=I?we.filter(ne=>ne!==q):[...we,q];return console.log("New selection:",Z),p&&f&&Xt(Z),Z})},Xt=async q=>{if(p)try{const we=Be.getValues(),I={name:we.focusGroupName,status:"draft",participants:q,participants_count:q.length,date:new Date().toISOString(),duration:parseInt(we.duration),topic:we.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:we.researchBrief,objective:we.researchBrief,discussionGuide:f};await Ct.update(p,I),console.log("Participant selection auto-saved to draft")}catch(we){console.error("Failed to auto-save participant selection:",we)}},yt=async()=>{try{const q=Be.getValues(),we={name:q.focusGroupName,status:"in-progress",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(q.duration),topic:q.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:f},Z=(await Ct.create(we)).data;return console.log("Focus group created successfully:",Z),Z.focus_group_id}catch(q){throw console.error("Error saving focus group:",q),q}},Rr=v.useCallback(async()=>{if(!m.current){ce.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}T(!0);try{const{downloadDiscussionGuideAsMarkdown:q}=await Nee(async()=>{const{downloadDiscussionGuideAsMarkdown:I}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:I}},[]),we=Be.getValues();q(m.current,we.focusGroupName),ce.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(q){console.error("Error downloading discussion guide:",q),ce.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{T(!1)}},[Be]),tt=v.useCallback(async q=>{console.log("📝 handleSaveDiscussionGuide called with:",q),h(q),ce.success("Discussion guide updated",{description:"Your changes have been saved."})},[]),It=v.useCallback(()=>{},[]),kt=v.useCallback(()=>{},[]),Dn=async()=>{if(!Be.getValues().focusGroupName){ce.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!f){ce.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(y.length<1){ce.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",y);try{ce.loading("Creating focus group...");let q;if(p){const we=Be.getValues(),I={name:we.focusGroupName,status:"in-progress",participants:y,participants_count:y.length,date:new Date().toISOString(),duration:parseInt(we.duration),topic:we.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:we.researchBrief,objective:we.researchBrief,discussionGuide:f},Z=await Ct.update(p,I);q=p,console.log("Draft focus group updated to in-progress:",Z),t&&t()}else q=await yt();ce.dismiss(),ce.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),n(`/focus-groups/${q}`)}catch(q){ce.dismiss(),q!=null&&q.message,console.error("Failed to start focus group:",q),ce.error("Failed to create focus group",{description:"Please try again or check your connection"})}};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(Na,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),i&&a.jsx("div",{className:"mb-6",children:a.jsx(O_,{isActive:i,isComplete:l,hasError:u,label:"Generating discussion guide",onComplete:At})}),a.jsxs(Ho,{value:r,onValueChange:s,children:[a.jsxs($a,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(Wt,{value:"setup",children:"Setup"}),a.jsx(Wt,{value:"review",children:"Review & Edit"}),a.jsx(Wt,{value:"participants",children:"Participants"})]}),a.jsx(Ht,{value:"setup",children:a.jsx(sx,{...Be,children:a.jsxs("form",{onSubmit:Be.handleSubmit(pn),className:"space-y-6",children:[a.jsx(ot,{control:Be.control,name:"focusGroupName",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Focus Group Name"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"e.g., Mobile App UX Evaluation",...q})}),a.jsx(on,{children:"Give your focus group a descriptive name"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[a.jsx(ot,{control:Be.control,name:"researchBrief",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Research Brief"}),a.jsx(st,{children:a.jsx(et,{placeholder:"Describe your research objectives...",className:"h-36",...q})}),a.jsx(on,{children:"Provide context about what you want to learn"}),a.jsx(it,{})]})}),a.jsxs("div",{className:"space-y-6",children:[a.jsx(ot,{control:Be.control,name:"discussionTopics",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Discussion Topics"}),a.jsx(st,{children:a.jsx(et,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...q})}),a.jsx(on,{children:"E.g., User experience, feature preferences, pain points"}),a.jsx(it,{})]})}),a.jsx(ot,{control:Be.control,name:"duration",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Duration (minutes)"}),a.jsxs(On,{onValueChange:q.onChange,defaultValue:q.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select duration"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"30",children:"30 minutes"}),a.jsx(ye,{value:"45",children:"45 minutes"}),a.jsx(ye,{value:"60",children:"60 minutes"}),a.jsx(ye,{value:"90",children:"90 minutes"}),a.jsx(ye,{value:"120",children:"120 minutes"})]})]}),a.jsx(on,{children:"How long should the focus group session last?"}),a.jsx(it,{})]})}),a.jsx(ot,{control:Be.control,name:"llm_model",render:({field:q})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"AI Model"}),a.jsxs(On,{onValueChange:q.onChange,defaultValue:q.value,children:[a.jsx(st,{children:a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select AI model"})})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ye,{value:"gpt-4.1",children:"GPT-4.1"})]})]}),a.jsx(on,{children:"Choose which AI model to use for generating responses and discussion guides"}),a.jsx(it,{})]})})]})]}),a.jsx(ot,{control:Be.control,name:"creativeAssets",render:({field:{value:q,onChange:we,...I}})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Creative Assets (Optional)"}),a.jsx(st,{children:a.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[a.jsx(CR,{className:"h-10 w-10 text-slate-400 mb-2"}),a.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload creative assets for testing"}),a.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Images, mockups, or product designs"}),a.jsx(_t,{...I,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:Z=>{we(Z.target.files)},className:"hidden",id:"assets-file-input"}),a.jsxs(se,{type:"button",variant:"outline",size:"sm",onClick:()=>{var Z;return(Z=document.getElementById("assets-file-input"))==null?void 0:Z.click()},children:[a.jsx(kR,{className:"mr-2 h-4 w-4"}),"Select Files"]}),q&&q.length>0&&a.jsxs("p",{className:"text-xs text-primary mt-2",children:[q.length," file(s) selected"]})]})}),a.jsx(on,{children:"Upload visuals that you want feedback on during the session"}),a.jsx(it,{})]})}),a.jsx("div",{className:"space-y-3",children:a.jsx("div",{className:"flex justify-end",children:a.jsxs(se,{type:"submit",disabled:i,className:"min-w-32",children:[a.jsx(Na,{className:"mr-2 h-4 w-4"}),i?"Generating...":"Generate Discussion Guide"]})})})]})})}),a.jsx(Ht,{value:"review",children:a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{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"}),f&&a.jsx(Yn,{variant:"outline",className:"text-xs",children:b(f)?"Structured JSON":"Legacy Text"})]})}),a.jsx("div",{className:"prose max-w-none",children:f?a.jsx(B5,{discussionGuide:f,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:tt,onDownload:Rr,onSectionSelect:It,onSetPosition:kt,isDownloading:O,focusGroupId:p}):a.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})]})}),j.length>0&&a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Uploaded Creative Assets"}),a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:j.map((q,we)=>a.jsxs("div",{className:"border rounded-md p-2",children:[a.jsx("div",{className:"aspect-square bg-slate-100 rounded flex items-center justify-center mb-2",children:q.type.startsWith("image/")?a.jsx("img",{src:URL.createObjectURL(q),alt:`Asset ${we+1}`,className:"max-h-full max-w-full object-contain"}):a.jsx(Yw,{className:"h-10 w-10 text-slate-400"})}),a.jsx("p",{className:"text-xs truncate",children:q.name})]},we))})]})}),a.jsxs("div",{className:"flex justify-between",children:[a.jsx(se,{variant:"outline",onClick:()=>s("setup"),children:"Back to Setup"}),a.jsxs(se,{onClick:()=>s("participants"),children:["Select Participants",a.jsx(er,{className:"ml-2 h-4 w-4"})]})]})]})}),a.jsxs(Ht,{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(se,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),V(!0)},className:"h-7 w-7 p-0",children:a.jsx(AR,{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:",N.length),H(el),setTimeout(()=>{console.log(`Will show all ${N.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${R===el?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:"All Personas"})]}),k.map(q=>a.jsx("div",{className:"flex items-center justify-between group",children:Y&&Y.id===q.id?a.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx(_t,{value:ee,onChange:we=>fe(we.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:we=>{we.key==="Enter"?Fe():we.key==="Escape"&&ie()}}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${Y==null?void 0:Y.name}" to "${ee}"`),Fe()},className:"h-7 w-7 p-0",children:a.jsx(Sa,{className:"h-4 w-4"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${Y==null?void 0:Y.name}"`),ie()},className:"h-7 w-7 p-0",children:a.jsx(Ei,{className:"h-4 w-4"})})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${q.name} (ID: ${q.id})`);const we=q.personaIds.filter(I=>!!I);console.log(`Current persona count in folder: ${we.length}`),console.log("Folder personaIds:",we),console.log("All personas count:",N.length),H(q.id),setTimeout(()=>{const I=N.filter(Z=>{if(Z.folderId===q.id)return!0;const ne=Z.id||Z._id;return we.includes(ne)});console.log(`Will show ${I.length} personas after filtering`),console.log("Filtered personas:",I.map(Z=>Z.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${R===q.id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[a.jsx(Ws,{className:"h-4 w-4"}),a.jsx("span",{children:q.name}),a.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:q.personaIds.filter(we=>!!we).length})]}),a.jsxs(S1,{children:[a.jsx(N1,{asChild:!0,children:a.jsx(se,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:a.jsx(Xw,{className:"h-4 w-4"})})}),a.jsx(tv,{align:"end",children:a.jsx(al,{onClick:()=>{console.log(`Initiating rename for folder: ${q.name} (ID: ${q.id})`),_e(q)},children:"Rename"})})]})]})},q.id)),F&&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(Ws,{className:"h-4 w-4"}),a.jsx(_t,{value:$,onChange:q=>L(q.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:q=>{q.key==="Enter"?X():q.key==="Escape"&&be()}})]}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${$}"`),X()},className:"h-7 w-7 p-0",children:a.jsx(Sa,{className:"h-4 w-4"})}),a.jsx(se,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),be()},className:"h-7 w-7 p-0",children:a.jsx(Ei,{className:"h-4 w-4"})})]})]})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(Ke,{className:"mb-4",children:a.jsx(lt,{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(er,{className:"h-5 w-5 mr-2 text-muted-foreground"}),a.jsxs("span",{className:"text-sm font-medium",children:[y.length," of ",Zt.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(AN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(_t,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:W,onChange:q=>he(q.target.value)})]}),a.jsxs(se,{variant:"outline",className:"flex items-center gap-2",onClick:()=>ue(!0),children:[a.jsx(PN,{className:"h-4 w-4"}),a.jsxs("span",{children:["Filter",Object.values(Ae).some(q=>q.length>0)?` (${Object.values(Ae).reduce((q,we)=>q+we.length,0)})`:""]})]})]}),_?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Dl,{className:"h-8 w-8 animate-spin text-primary"})}):Zt.length>0?a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Zt.map(q=>{const we=q._id||q.id;return a.jsx(ZN,{user:{id:we,_id:q._id,name:q.name,age:q.age,gender:q.gender,occupation:q.occupation,location:q.location||"Unknown",techSavviness:q.techSavviness||50,personality:q.personality||"No description available",oceanTraits:q.oceanTraits,qualitativeAttributes:q.qualitativeAttributes,topPersonalityTraits:q.topPersonalityTraits,aiSynthesizedBio:q.aiSynthesizedBio},selected:y.includes(we),onSelectionToggle:()=>bn(we),showModalInsteadOfNavigate:!0,onOpenPersonaModal:Pe},we)})}):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(se,{variant:"outline",onClick:()=>s("review"),children:"Back to Review"}),a.jsxs(se,{onClick:Dn,disabled:y.length<1||!f,children:[a.jsx(AG,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),a.jsx(wo,{open:pe,onOpenChange:q=>{q?(ue(q),xe({...Ae})):ue(!1)},children:a.jsxs(la,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"Filter Personas"}),a.jsx(Cl,{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(oe).some(q=>q.length>0)&&a.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:a.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(oe).reduce((q,we)=>q+we.length,0)," active filters"]})}),(()=>{const q=E(N),we=Object.values(oe).every(Z=>Z.length===0),I=(Z,ne,B=1)=>{const z=we?q[ne]:D(ne)[ne],re=oe[ne],me=[...new Set([...z,...re])].sort();return me.length===0?null:a.jsxs("div",{className:"mb-6",children:[a.jsx("h3",{className:"text-sm font-medium mb-3",children:Z}),a.jsx("div",{className:`grid grid-cols-1 ${B===2?"sm:grid-cols-2":B===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:me.map(le=>{const Ue=oe[ne].includes(le),Ne=z.includes(le);return a.jsxs("div",{className:`flex items-center space-x-2 ${!Ne&&!Ue?"opacity-50":""}`,children:[a.jsx(Sh,{id:`${ne}-${le}`,checked:Ue,onCheckedChange:()=>J(ne,le),disabled:!Ne&&!Ue}),a.jsxs(ji,{htmlFor:`${ne}-${le}`,className:"truncate overflow-hidden",children:[le,Ue&&!Ne&&a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},le)})})]})};return a.jsxs(a.Fragment,{children:[I("Gender","gender",3),I("Age","age",3),I("Ethnicity","ethnicity",2),I("Location","location",2),I("Occupation","occupation",2),I("Tech Savviness","techSavviness",3),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:K,children:"Reset"}),a.jsx(se,{onClick:U,children:"Apply Filters"})]})]})})]})]}),a.jsx(aEe,{persona:G,isOpen:te,onClose:Ie})]})}const cEe=[{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"}],uEe={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"},dEe=()=>{console.log("FocusGroups component rendering");const[e,t]=v.useState("view"),[n,r]=v.useState(""),[s,i]=v.useState([]),[o,l]=v.useState(!0),[c,u]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),[g,m]=v.useState(null),x=Rn(),b=v.useRef(!0),y=async(_=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",_),console.log("isMounted.current:",b.current),_&&!b.current){console.log("Exiting early: component not mounted");return}console.log("Setting loading to true and making API call"),l(!0);try{console.log("Calling focusGroupsApi.getAll()");const A=await Ct.getAll();if(console.log("API response received:",A),!_||b.current){const O=A.data.map(T=>({...T,id:T.id||T._id,participants_count:Array.isArray(T.participants)?T.participants.length:typeof T.participants=="number"?T.participants:0}));i(O)}}catch(A){console.error("Error fetching focus groups:",A),(!_||b.current)&&(Qe.error("Failed to load focus groups"),i(cEe))}finally{(!_||b.current)&&l(!1)}};v.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),y(),()=>{console.log("useEffect cleanup - setting isMounted to false"),b.current=!1}),[]),v.useEffect(()=>{console.log("Mode change useEffect running, mode:",e),e==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),y())},[e]);const w=s.filter(_=>_.name.toLowerCase().includes(n.toLowerCase())||_.topic.toLowerCase().includes(n.toLowerCase())),j=_=>new Date(_).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),S=_=>new Date(_).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),N=_=>{u(A=>A.includes(_)?A.filter(O=>O!==_):[...A,_])},P=async()=>{if(c.length!==0){p(!0);try{const _=c.map(A=>Ct.delete(A));await Promise.all(_),i(A=>A.filter(O=>!c.includes(O.id||O._id||""))),u([]),Qe.success(`${c.length} focus group${c.length>1?"s":""} deleted successfully`)}catch(_){console.error("Error deleting focus groups:",_),Qe.error("Failed to delete focus groups")}finally{p(!1),f(!1)}}};return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),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(se,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",e);try{e==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),t("create")):(console.log("Switching back to view mode"),t("view"))}catch(_){console.error("Error in Create New Focus Group onClick:",_)}},className:"hover-transition",children:e==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),e==="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(AN,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),a.jsx(_t,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:_=>r(_.target.value)})]}),a.jsxs(se,{variant:"outline",className:"flex items-center gap-2",children:[a.jsx(PN,{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"})]}),c.length>0&&a.jsxs(se,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[a.jsx(wn,{className:"h-4 w-4"}),"Delete Selected (",c.length,")"]})]}),o?a.jsx("div",{className:"flex justify-center items-center py-12",children:a.jsx(Dl,{className:"h-8 w-8 animate-spin text-primary"})}):w.length>0?a.jsx("div",{className:"space-y-4",children:w.map(_=>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(Sh,{id:`select-${_.id||_._id}`,checked:c.includes(_.id||_._id||""),onCheckedChange:()=>N(_.id||_._id||""),className:"mt-1"}),a.jsxs("div",{children:[a.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:_.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(fG,{className:"h-4 w-4 mr-1"}),j(_.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(rh,{className:"h-4 w-4 mr-1"}),S(_.date)]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(er,{className:"h-4 w-4 mr-1"}),_.participants_count||(Array.isArray(_.participants)?_.participants.length:0)," participant",_.participants_count>1||Array.isArray(_.participants)&&_.participants.length>1?"s":""]}),a.jsxs("div",{className:"flex items-center",children:[a.jsx(rh,{className:"h-4 w-4 mr-1"}),_.duration," min"]})]})]})]}),a.jsxs("div",{className:Me("px-3 py-1 rounded-full text-xs font-medium border",uEe[_.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[_.status==="completed"&&"Completed",_.status==="scheduled"&&"Scheduled",_.status==="in-progress"&&"In Progress",_.status==="active"&&"In Progress",_.status==="ai_mode"&&"In Progress",_.status==="paused"&&"Paused",_.status==="new"&&"Not Started",_.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(_.status)&&_.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:[_.topic==="user-experience"&&"User Experience",_.topic==="product-feedback"&&"Product Feedback",_.topic==="creative-testing"&&"Creative Testing",_.topic==="messaging-evaluation"&&"Messaging Evaluation",_.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(_.topic)&&_.topic.charAt(0).toUpperCase()+_.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(se,{variant:_.status==="in-progress"||_.status==="active"||_.status==="ai_mode"?"default":_.status==="new"||_.status==="draft"?"outline":"default",className:Me("w-full hover-transition",_.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",_.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(_.status==="draft")m(_),t("create");else{const A=_.id||_._id;console.log("Navigating to focus group:",A),x(`/focus-groups/${A}`)}},children:_.status==="completed"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="in-progress"||_.status==="active"||_.status==="ai_mode"?a.jsxs(a.Fragment,{children:["Join Session",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="paused"?a.jsxs(a.Fragment,{children:["Session Details",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="scheduled"?a.jsxs(a.Fragment,{children:["View Details",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="new"?a.jsxs(a.Fragment,{children:["View Session",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):_.status==="draft"?a.jsxs(a.Fragment,{children:["Edit",a.jsx(vi,{className:"ml-2 h-4 w-4"})]}):a.jsxs(a.Fragment,{children:["View Session",a.jsx(vi,{className:"ml-2 h-4 w-4"})]})})})]})},_.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(lEe,{draftToEdit:g,onDraftSaved:()=>{m(null),t("view"),y()}})]}),a.jsx(_1,{open:d,onOpenChange:f,children:a.jsxs(rv,{children:[a.jsxs(sv,{children:[a.jsxs(av,{children:["Delete ",c.length," Focus Group",c.length!==1?"s":"","?"]}),a.jsxs(ov,{children:["This action cannot be undone. This will permanently delete the selected focus group",c.length!==1?"s":""," and remove all data associated with ",c.length!==1?"them":"it","."]})]}),a.jsxs(iv,{children:[a.jsx(cv,{disabled:h,children:"Cancel"}),a.jsx(lv,{onClick:_=>{_.preventDefault(),P()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?a.jsxs(a.Fragment,{children:[a.jsx(Dl,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):a.jsx(a.Fragment,{children:"Delete"})})]})]})})]})},fEe=({participants:e,selectedParticipantIds:t,onToggleParticipantFilter:n})=>{const r=Rn(),s=o=>{const l=o.id||o._id;l&&r(`/personas/${l}`)},i=o=>{const l=o.id||o._id;l&&n(l)};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(er,{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(bo,{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"})]})]}),e.map(o=>{const l=o.id||o._id,c=t.includes(l);return a.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${c?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[a.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>s(o),title:`View ${o.name}'s profile`,children:a.jsx("img",{src:sd(o),alt:o.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:()=>i(o),title:`Filter to show only ${o.name}'s messages`,children:o.name}),c&&a.jsx(Sa,{className:"h-4 w-4 text-blue-600 ml-2"})]}),a.jsx("p",{className:"text-xs text-slate-500",children:o.occupation})]})]},o.id)})]})]})})};function hEe(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var YP="ScrollArea",[Qz,MOe]=Ir(YP),[pEe,Ms]=Qz(YP),Jz=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...o}=e,[l,c]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,g]=v.useState(null),[m,x]=v.useState(null),[b,y]=v.useState(0),[w,j]=v.useState(0),[S,N]=v.useState(!1),[P,_]=v.useState(!1),A=pt(t,T=>c(T)),O=Uo(s);return a.jsx(pEe,{scope:n,type:r,dir:O,scrollHideDelay:i,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:S,onScrollbarXEnabledChange:N,scrollbarY:m,onScrollbarYChange:x,scrollbarYEnabled:P,onScrollbarYEnabledChange:_,onCornerWidthChange:y,onCornerHeightChange:j,children:a.jsx(Xe.div,{dir:O,...o,ref:A,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});Jz.displayName=YP;var e8="ScrollAreaViewport",t8=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,asChild:s,nonce:i,...o}=e,l=Ms(e8,n),c=v.useRef(null),u=pt(t,c,l.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:i}),a.jsx(Xe.div,{"data-radix-scroll-area-viewport":"",...o,asChild:s,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:NEe({asChild:s,children:r},d=>a.jsx("div",{"data-radix-scroll-area-content":"",ref:l.onContentChange,style:{minWidth:l.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});t8.displayName=e8;var Ui="ScrollAreaScrollbar",ZP=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Ms(Ui,e.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,l=e.orientation==="horizontal";return v.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),s.type==="hover"?a.jsx(mEe,{...r,ref:t,forceMount:n}):s.type==="scroll"?a.jsx(gEe,{...r,ref:t,forceMount:n}):s.type==="auto"?a.jsx(n8,{...r,ref:t,forceMount:n}):s.type==="always"?a.jsx(QP,{...r,ref:t}):null});ZP.displayName=Ui;var mEe=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Ms(Ui,e.__scopeScrollArea),[i,o]=v.useState(!1);return v.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(lr,{present:n||i,children:a.jsx(n8,{"data-state":i?"visible":"hidden",...r,ref:t})})}),gEe=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Ms(Ui,e.__scopeScrollArea),i=e.orientation==="horizontal",o=h0(()=>c("SCROLL_END"),100),[l,c]=hEe("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 v.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),o()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[s.viewport,i,c,o]),a.jsx(lr,{present:n||l!=="hidden",children:a.jsx(QP,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:$e(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:$e(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),n8=v.forwardRef((e,t)=>{const n=Ms(Ui,e.__scopeScrollArea),{forceMount:r,...s}=e,[i,o]=v.useState(!1),l=e.orientation==="horizontal",c=h0(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,s=Ms(Ui,e.__scopeScrollArea),i=v.useRef(null),o=v.useRef(0),[l,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=o8(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>i.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return jEe(h,o.current,l,p)}return n==="horizontal"?a.jsx(vEe,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const h=s.viewport.scrollLeft,p=e$(h,l,s.dir);i.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=f(h,s.dir))}}):n==="vertical"?a.jsx(yEe,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&i.current){const h=s.viewport.scrollTop,p=e$(h,l);i.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=f(h))}}):null}),vEe=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=Ms(Ui,e.__scopeScrollArea),[o,l]=v.useState(),c=v.useRef(null),u=pt(t,c,i.onScrollbarXChange);return v.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(s8,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":f0(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(i.viewport){const h=i.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),c8(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:xy(o.paddingLeft),paddingEnd:xy(o.paddingRight)}})}})}),yEe=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,i=Ms(Ui,e.__scopeScrollArea),[o,l]=v.useState(),c=v.useRef(null),u=pt(t,c,i.onScrollbarYChange);return v.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(s8,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":f0(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(i.viewport){const h=i.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),c8(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:xy(o.paddingTop),paddingEnd:xy(o.paddingBottom)}})}})}),[xEe,r8]=Qz(Ui),s8=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=Ms(Ui,n),[g,m]=v.useState(null),x=pt(t,A=>m(A)),b=v.useRef(null),y=v.useRef(""),w=p.viewport,j=r.content-r.viewport,S=Vn(d),N=Vn(c),P=h0(f,10);function _(A){if(b.current){const O=A.clientX-b.current.left,T=A.clientY-b.current.top;u({x:O,y:T})}}return v.useEffect(()=>{const A=O=>{const T=O.target;(g==null?void 0:g.contains(T))&&S(O,j)};return document.addEventListener("wheel",A,{passive:!1}),()=>document.removeEventListener("wheel",A,{passive:!1})},[w,g,j,S]),v.useEffect(N,[r,N]),Wu(g,P),Wu(p.content,P),a.jsx(xEe,{scope:n,scrollbar:g,hasThumb:s,onThumbChange:Vn(i),onThumbPointerUp:Vn(o),onThumbPositionChange:N,onThumbPointerDown:Vn(l),children:a.jsx(Xe.div,{...h,ref:x,style:{position:"absolute",...h.style},onPointerDown:$e(e.onPointerDown,A=>{A.button===0&&(A.target.setPointerCapture(A.pointerId),b.current=g.getBoundingClientRect(),y.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),_(A))}),onPointerMove:$e(e.onPointerMove,_),onPointerUp:$e(e.onPointerUp,A=>{const O=A.target;O.hasPointerCapture(A.pointerId)&&O.releasePointerCapture(A.pointerId),document.body.style.webkitUserSelect=y.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),yy="ScrollAreaThumb",i8=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=r8(yy,e.__scopeScrollArea);return a.jsx(lr,{present:n||s.hasThumb,children:a.jsx(bEe,{ref:t,...r})})}),bEe=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,i=Ms(yy,n),o=r8(yy,n),{onThumbPositionChange:l}=o,c=pt(t,f=>o.onThumbChange(f)),u=v.useRef(),d=h0(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=i.viewport;if(f){const h=()=>{if(d(),!u.current){const p=SEe(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[i.viewport,d,l]),a.jsx(Xe.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:$e(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,m=f.clientY-p.top;o.onThumbPointerDown({x:g,y:m})}),onPointerUp:$e(e.onPointerUp,o.onThumbPointerUp)})});i8.displayName=yy;var JP="ScrollAreaCorner",a8=v.forwardRef((e,t)=>{const n=Ms(JP,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(wEe,{...e,ref:t}):null});a8.displayName=JP;var wEe=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=Ms(JP,n),[i,o]=v.useState(0),[l,c]=v.useState(0),u=!!(i&&l);return Wu(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),Wu(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),o(d)}),u?a.jsx(Xe.div,{...r,ref:t,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function xy(e){return e?parseInt(e,10):0}function o8(e,t){const n=e/t;return isNaN(n)?0:n}function f0(e){const t=o8(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function jEe(e,t,n,r="ltr"){const s=f0(n),i=s/2,o=t||i,l=s-o,c=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return l8([c,u],f)(e)}function e$(e,t,n="ltr"){const r=f0(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,i=t.scrollbar.size-s,o=t.content-t.viewport,l=i-r,c=n==="ltr"?[0,o]:[o*-1,0],u=xh(e,c);return l8([0,o],[0,l])(u)}function l8(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function c8(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const i={left:e.scrollLeft,top:e.scrollTop},o=n.left!==i.left,l=n.top!==i.top;(o||l)&&t(),n=i,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function h0(e,t){const n=Vn(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Wu(e,t){const n=Vn(t);or(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}function NEe(e,t){const{asChild:n,children:r}=e;if(!n)return typeof t=="function"?t(r):t;const s=v.Children.only(r);return v.cloneElement(s,{children:typeof t=="function"?t(s.props.children):t})}var u8=Jz,_Ee=t8,PEe=a8;const p0=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(u8,{ref:r,className:Me("relative overflow-hidden",e),...n,children:[a.jsx(_Ee,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(d8,{}),a.jsx(PEe,{})]}));p0.displayName=u8.displayName;const d8=v.forwardRef(({className:e,orientation:t="vertical",...n},r)=>a.jsx(ZP,{ref:r,orientation:t,className:Me("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:a.jsx(i8,{className:"relative flex-1 rounded-full bg-border"})}));d8.displayName=ZP.displayName;const CEe=({participants:e,isVisible:t,selectedIndex:n,onSelect:r,onClose:s,position:i})=>{const o=v.useRef(null);return v.useEffect(()=>{const l=c=>{o.current&&!o.current.contains(c.target)&&s()};if(t)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[t,s]),v.useEffect(()=>{if(t&&n>=0&&o.current){const l=o.current.children[n];l&&l.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,t]),!t||e.length===0?null:a.jsxs("div",{ref:o,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:i.top,left:i.left},children:[e.map((l,c)=>{const u=l.id||l._id,d=c===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(l),children:[a.jsx("img",{src:sd(l),alt:l.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:l.name}),a.jsx("p",{className:`text-sm truncate ${d?"text-blue-600":"text-slate-500"}`,children:l.occupation})]})]},u)}),e.length===0&&a.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function uS(e,t){const n=[],r=[],s=/@(\w+(?:\s+\w+)*)/g;let i;for(;(i=s.exec(e))!==null;){const o=i[1],l=i.index,c=i.index+i[0].length,u=t.find(d=>d.name.toLowerCase()===o.toLowerCase());if(u){const d=u.id||u._id;d&&(n.push({id:d,name:u.name,startIndex:l,endIndex:c}),r.includes(d)||r.push(d))}}return{text:e,mentions:n,mentionedParticipantIds:r}}function AEe(e,t){if(t.length===0)return[e];const n=[];let r=0;return[...t].sort((i,o)=>i.startIndex-o.startIndex).forEach((i,o)=>{i.startIndex>r&&n.push(e.slice(r,i.startIndex)),n.push(C.createElement("span",{key:`mention-${o}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${i.name}`)),r=i.endIndex}),r=0;n--){const r=e[n];if(r==="@"){if(n===0||/\s/.test(e[n-1]))return n}else if(/\s/.test(r))break}return null}function kEe(e,t,n){return e.slice(t+1,n).toLowerCase()}function TEe(e,t){return t?e.filter(n=>n.name.toLowerCase().includes(t)):e}const f8=v.forwardRef(({value:e,onChange:t,participants:n,placeholder:r="Ask a question or provide guidance...",className:s="",disabled:i=!1},o)=>{const[l,c]=v.useState(!1),[u,d]=v.useState(0),[f,h]=v.useState({top:0,left:0}),[p,g]=v.useState(null),[m,x]=v.useState([]),b=v.useRef(null),y=v.useRef(null);v.useEffect(()=>{o&&b.current&&(typeof o=="function"?o(b.current):o.current=b.current)},[o]);const w=()=>{if(b.current&&y.current&&p!==null){const _=b.current,A=y.current,O=document.createElement("div");O.style.position="absolute",O.style.visibility="hidden",O.style.whiteSpace="pre",O.style.font=window.getComputedStyle(_).font,O.textContent=e.slice(0,p),document.body.appendChild(O);const T=O.offsetWidth;document.body.removeChild(O);const k=A.getBoundingClientRect(),M=_.getBoundingClientRect();h({top:M.height+4,left:Math.min(T,k.width-280)})}},j=_=>{const A=_.target.value,O=_.target.selectionStart||0,T=OEe(A,O);if(T!==null&&n.length>0){const M=kEe(A,T,O),R=TEe(n,M);g(T),x(R),d(0),c(!0)}else c(!1),g(null);const k=uS(A,n);t(A,k)},S=_=>{if(l&&m.length>0)switch(_.key){case"ArrowDown":_.preventDefault(),d(A=>AA>0?A-1:m.length-1);break;case"Enter":case"Tab":_.preventDefault(),m[u]&&N(m[u]);break;case"Escape":_.preventDefault(),c(!1);break}},N=_=>{if(p!==null&&b.current){const A=b.current.selectionStart||0,{newText:O,newCursorPosition:T}=EEe(e,A,_,p),k=uS(O,n);t(O,k),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange(T,T))},0),c(!1),g(null)}},P=()=>{c(!1),g(null)};return v.useEffect(()=>{l&&p!==null&&w()},[l,p,e]),a.jsxs("div",{ref:y,className:`relative ${s}`,children:[a.jsx("input",{ref:b,type:"text",value:e,onChange:j,onKeyDown:S,placeholder:r,disabled:i,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(CEe,{participants:m,isVisible:l,selectedIndex:u,onSelect:N,onClose:P,position:f})]})});f8.displayName="MentionInput";const $Ee=({message:e,persona:t,toggleHighlight:n,participants:r=[],focusGroupId:s})=>{const[i,o]=v.useState(!1),l=e.senderId==="moderator",c=e.senderId==="facilitator",u=uS(e.text,r),d=AEe(e.text,u.mentions),h=(m=>{const x=[/titled\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/image\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/['"]([a-zA-Z0-9_\-]+\.(jpg|jpeg|png))['\"]/i,/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i];for(const b of x){const y=m.match(b);if(y)return y[1]}return null})(e.text),p=(l||c)&&h&&s,g=()=>{n()};return a.jsxs("div",{id:`message-${e.id}`,className:Me("flex items-start p-3 rounded-lg transition-colors",e.highlighted?"bg-amber-50 border border-amber-200":"hover:bg-slate-50",l?"border-l-4 border-l-primary pl-4":"",c?"border-l-4 border-l-green-500 pl-4":""),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"data-highlighted":e.highlighted?"true":"false",children:[a.jsx("div",{className:"flex-shrink-0 mr-3",children:l?a.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:a.jsx(bo,{className:"h-6 w-6 text-primary"})}):c?a.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:a.jsx(Dg,{className:"h-6 w-6 text-green-600"})}):t?a.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:a.jsx("img",{src:sd(t),alt:`${t.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(gG,{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:l?"AI Moderator":c?"Human Facilitator":(t==null?void 0:t.name)||"Unknown"}),!l&&!c&&t&&a.jsx(Yn,{variant:"outline",className:"text-xs font-normal",children:t.occupation}),a.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:e.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),a.jsx("p",{className:"text-slate-700",children:d}),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(ER,{className:"h-4 w-4 text-slate-600"}),a.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"})]}),a.jsx("img",{src:Ct.getAssetUrl(s,h),alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:m=>{var b;console.error("Failed to load creative asset:",Ct.getAssetUrl(s,h)),m.currentTarget.style.display="none";const x=document.createElement("div");x.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",x.textContent=`Creative asset not found: ${h}`,(b=m.currentTarget.parentNode)==null||b.appendChild(x)}})]}),a.jsx("div",{className:Me("flex mt-2 space-x-2",!i&&!e.highlighted&&"hidden"),children:a.jsxs(se,{variant:"ghost",size:"sm",onClick:g,className:"h-8 px-2 text-xs",children:[a.jsx(IG,{className:Me("h-3 w-3 mr-1",e.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),e.highlighted?"Highlighted":"Highlight"]})})]})]})},IEe=({action:e})=>{switch(e){case"moderator_speak":return a.jsx(Na,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return a.jsx(er,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return a.jsx(er,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return a.jsx(kN,{className:"h-4 w-4 text-orange-500"});case"end_session":return a.jsx(DG,{className:"h-4 w-4 text-red-500"});default:return a.jsx(ja,{className:"h-4 w-4 text-gray-500"})}},MEe=({status:e})=>{switch(e){case"success":return a.jsx(Ig,{className:"h-3 w-3 text-green-500"});case"error":return a.jsx(vG,{className:"h-3 w-3 text-red-500"});case"pending":return a.jsx(rh,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},REe=({action:e})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[e]||e,DEe=e=>{try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}},LEe=({entry:e,isLatest:t})=>{const[n,r]=v.useState(t);return a.jsx(Ke,{className:`mb-2 ${t?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:a.jsxs(Ep,{open:n,onOpenChange:r,children:[a.jsx(Op,{asChild:!0,children:a.jsx(Fr,{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(IEe,{action:e.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(REe,{action:e.action})}),a.jsx(MEe,{status:e.execution_status})]}),a.jsx("span",{className:"text-xs text-gray-500",children:DEe(e.timestamp)})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[t&&a.jsx(Yn,{variant:"secondary",className:"text-xs",children:"Latest"}),n?a.jsx(wp,{className:"h-4 w-4 text-gray-400"}):a.jsx(Ta,{className:"h-4 w-4 text-gray-400"})]})]})})}),a.jsx(kp,{children:a.jsx(lt,{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:['"',e.reasoning,'"']})]}),e.details&&Object.keys(e.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(e.details,null,2)})]}),e.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:e.execution_result.error?a.jsxs("span",{className:"text-red-600",children:["Error: ",e.execution_result.error]}):a.jsx("span",{className:"text-green-600",children:e.execution_result.message||"Success"})})]})]})})})]})})},FEe=({reasoningHistory:e,isVisible:t,onToggle:n,isAiMode:r=!1})=>{const[s,i]=v.useState(!0);return v.useEffect(()=>{if(s&&e.length>0){const o=document.getElementById("reasoning-panel-content");o&&(o.scrollTop=0)}},[e.length,s]),a.jsx("div",{className:"border-t border-gray-200 bg-white",children:a.jsxs(Ep,{open:t,onOpenChange:n,children:[a.jsx(Op,{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(ja,{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&&e.length>0&&a.jsx(Yn,{variant:"outline",className:"text-xs",children:e.length}),!r&&a.jsx(Yn,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),t?a.jsx(wp,{className:"h-4 w-4 text-gray-400"}):a.jsx(Ta,{className:"h-4 w-4 text-gray-400"})]})}),a.jsx(kp,{children:a.jsx("div",{className:"border-t border-gray-100",children:r?e.length===0?a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(ja,{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(p0,{id:"reasoning-panel-content",className:"h-[25vh] p-3",children:a.jsx("div",{className:"space-y-2",children:e.map((o,l)=>a.jsx(LEe,{entry:o,isLatest:l===0},`${o.timestamp}-${l}`))})}):a.jsxs("div",{className:"p-4 text-center text-gray-500",children:[a.jsx(EN,{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."})]})})})]})})},BEe=({modeEvent:e})=>{const t=s=>s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=s=>{switch(s){case"ai_mode_started":return"AI Mode Started";case"manual_mode_started":return"Manual Moderation Enabled";default:return"Mode Changed"}},r=s=>{switch(s){case"ai_mode_started":return"text-blue-600";case"manual_mode_started":return"text-slate-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(e.event_type)}`,children:a.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[a.jsx("span",{children:n(e.event_type)}),a.jsx("span",{className:"text-gray-400",children:"at"}),a.jsx("span",{children:t(e.timestamp)})]})}),a.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},zEe=({messages:e,modeEvents:t,personas:n,isSpeaking:r,focusGroupId:s,isAiModeActive:i=!1,selectedParticipantIds:o,onToggleHighlight:l,onAdvanceDiscussion:c,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=v.useState(""),[g,m]=v.useState(null),[x,b]=v.useState(!1),[y,w]=v.useState(null),j=v.useRef(null),[S,N]=v.useState(-1),P=v.useRef(null),[_,A]=v.useState(!1),[O,T]=v.useState(!1),[k,M]=v.useState(!1),[R,H]=v.useState(null),F=R!==null?R:i,[V,$]=v.useState([]),[L,Y]=v.useState(!1),Q=L;v.useEffect(()=>{i&&s&&ee()},[i,s]);const ee=async()=>{if(s)try{i&&fe()}catch(E){console.error("Error checking autonomous status:",E)}},fe=async()=>{if(s)try{const E=await vn.getReasoningHistory(s);$(E.data.reasoning_history||[])}catch(E){console.error("Error fetching reasoning history:",E)}};v.useEffect(()=>{_&&ue()},[e,_]),v.useEffect(()=>{let E;return i&&s&&(E=setInterval(()=>{fe(),ee()},5e3)),()=>{E&&clearInterval(E)}},[i,s]);const W=E=>n.find(D=>D.id===E||D._id===E),he=o.length===0?e:e.filter(E=>E.senderId==="moderator"||E.senderId==="facilitator"||o.includes(E.senderId)),pe=()=>{const E=[];return he.forEach(D=>{E.push({type:"message",data:D,timestamp:D.timestamp})}),t.forEach(D=>{E.push({type:"mode_event",data:D,timestamp:D.timestamp})}),E.sort((D,U)=>D.timestamp.getTime()-U.timestamp.getTime())},ue=()=>{if(!f&&P.current){const E=P.current.closest("[data-radix-scroll-area-viewport]");if(E){const D=P.current.offsetTop-E.clientHeight+50,U=E.scrollTop,K=D-U,J=300;let X=null;const be=_e=>{X||(X=_e);const Fe=_e-X,ie=Math.min(Fe/J,1),Te=1-Math.pow(1-ie,3);E.scrollTop=U+K*Te,ie<1&&window.requestAnimationFrame(be)};window.requestAnimationFrame(be)}else P.current.scrollIntoView({behavior:"smooth",block:"end"})}},Ae=async E=>{var J,X;if(E.preventDefault(),!h.trim())return;let D=h,U=null;const K=g;p(""),m(null),b(!0);try{if(y){try{ce.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const Fe=new FormData;Fe.append("assets",y);const ie=await Ct.uploadAssets(s,Fe);console.log("Upload response:",ie==null?void 0:ie.data);const Te=ie==null?void 0:ie.data;Te&&Te.assets&&Te.assets.length>0?(U=Te.assets[0].filename,console.log("Successfully got filename from upload response:",U)):console.error("Invalid upload response structure:",Te),U&&(D=`Please review this creative asset titled '${U}'. ${h}`,ce.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."}))}catch(Fe){console.error("Error uploading file:",Fe),console.error("Upload error details:",(J=Fe.response)==null?void 0:J.data),ce.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}ve()}const be={id:`msg-${Date.now()}`,senderId:"facilitator",text:D,timestamp:new Date,type:"question"},_e=await Ct.sendMessage(s,{text:D,type:"question",senderId:"facilitator"});console.log("Message sent to API:",_e),(X=_e==null?void 0:_e.data)!=null&&X.message_id&&(be.id=_e.data.message_id),u(be),setTimeout(()=>{ue()},100),K&&K.mentionedParticipantIds.length>0?setTimeout(()=>{Pe(K.mentionedParticipantIds,be.text)},500):setTimeout(()=>{b(!1)},1e3)}catch(be){console.error("Error sending message:",be),b(!1);const _e={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(_e),setTimeout(()=>{ue()},100),ce.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},de=()=>{for(let E=e.length-1;E>=0;E--)if(e[E].senderId==="moderator"&&e[E].type==="question")return e[E].text;for(let E=e.length-1;E>=0;E--)if(e[E].senderId==="moderator")return e[E].text;return"What are your thoughts on this topic?"},oe=(E,D)=>{if(!E||!E.sections||!D)return null;const{section_index:U,subsection_index:K,item_index:J,item_type:X}=D,be=E.sections,_e=ie=>{const Te=[];return ie.questions&&ie.questions.forEach((Be,gt)=>{Te.push({...Be,type:"question",index:gt})}),ie.activities&&ie.activities.forEach((Be,gt)=>{Te.push({...Be,type:"activity",index:gt})}),Te.sort((Be,gt)=>Be.type!==gt.type?Be.type==="question"?-1:1:Be.index-gt.index)};if(U>=be.length)return{completed:!0};const Fe=be[U];if(K!==void 0&&Fe.subsections){if(K>=Fe.subsections.length)return oe(E,{section_index:U+1,subsection_index:void 0,item_index:0,item_type:"question"});const ie=Fe.subsections[K],Te=_e(ie),Be=Te.findIndex(gt=>gt.type===X&>.index===J);if(Be0){const Te=ie.findIndex(Be=>Be.type===X&&Be.index===J);if(Te0?oe(E,{section_index:U,subsection_index:0,item_index:0,item_type:"question"}):oe(E,{section_index:U+1,subsection_index:void 0,item_index:0,item_type:"question"})}},xe=async()=>{var E,D,U;if(s)try{b(!0),ce.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[K,J]=await Promise.all([vn.getModeratorStatus(s),Ct.getById(s)]);if(!((E=K==null?void 0:K.data)!=null&&E.status)||!((D=J==null?void 0:J.data)!=null&&D.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const X=K.data.status,be=J.data.discussionGuide;if(!be.sections)throw new Error("Discussion guide does not have a structured format");const _e=oe(be,X.moderator_position);if(!_e)throw new Error("Could not determine next discussion item");if(_e.completed){ce.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const ie={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(ie);return}await vn.setModeratorPosition(s,_e.sectionId,_e.itemId);const Fe={id:`msg-${Date.now()}`,senderId:"moderator",text:_e.content,timestamp:new Date,type:"question"};try{const ie=await Ct.sendMessage(s,{senderId:"moderator",text:Fe.text,type:"question"});(U=ie==null?void 0:ie.data)!=null&&U.message_id&&(Fe.id=ie.data.message_id)}catch(ie){console.warn("Failed to save message to API, showing locally:",ie)}u(Fe),setTimeout(()=>{ue()},100),ce.success("Discussion advanced",{description:`Moved to: ${_e.section.title}${_e.subsection?` > ${_e.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(K){console.error("Error advancing discussion:",K),ce.error("Failed to advance discussion",{description:K.message||"There was a problem advancing to the next question."})}finally{b(!1)}},te=async()=>{var E,D,U,K;if(s){console.log("Starting AI Mode: setting autonomousLoading to true"),M(!0);try{console.log("Starting AI Mode: calling API...");const X=await Promise.race([vn.startAutonomousConversation(s),new Promise((be,_e)=>setTimeout(()=>_e(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",X),X.data.error){ce.error("Failed to start autonomous conversation",{description:X.data.error}),M(!1);return}ce.success("Autonomous conversation started",{description:"The AI is now managing the focus group conversation"}),H(!0);try{console.log("Starting AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Starting AI Mode: onStatusChange completed successfully"))}catch(be){console.error("Starting AI Mode: onStatusChange failed:",be)}console.log("Starting AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Starting AI Mode: clearing local AI mode state"),H(null)},1e3),fe()}catch(J){console.error("Error starting autonomous conversation:",J),J.response&&J.response.data&&console.error("Backend error details:",J.response.data);const X=((D=(E=J.response)==null?void 0:E.data)==null?void 0:D.message)||((K=(U=J.response)==null?void 0:U.data)==null?void 0:K.error)||"Please check your connection and try again";ce.error("Failed to start autonomous conversation",{description:X}),M(!1)}}},Ye=async()=>{if(s){console.log("Stopping AI Mode: setting autonomousLoading to true"),M(!0);try{const E=await vn.stopAutonomousConversation(s,"manual_stop");if(E.data.error){ce.error("Failed to stop autonomous conversation",{description:E.data.error}),M(!1);return}$([]),ce.success("Autonomous conversation stopped",{description:"You can now moderate the discussion manually"}),H(!1);try{console.log("Stopping AI Mode: calling onStatusChange..."),d&&(await d(),console.log("Stopping AI Mode: onStatusChange completed successfully"))}catch(D){console.error("Stopping AI Mode: onStatusChange failed:",D)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),M(!1),setTimeout(()=>{console.log("Stopping AI Mode: clearing local AI mode state"),H(null)},1e3)}catch(E){console.error("Error stopping autonomous conversation:",E),ce.error("Failed to stop autonomous conversation"),M(!1)}}},G=E=>{var U;const D=(U=E.target.files)==null?void 0:U[0];if(D){if(!D.type.startsWith("image/")){ce.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(D.size>10*1024*1024){ce.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(D),ce.success(`Image selected: ${D.name}`,{description:"The image will be attached to your next message."})}},ve=()=>{w(null),j.current&&(j.current.value="")},Pe=async(E,D)=>{var U;if(!(!s||E.length===0))try{b(!0),ce.info("Generating responses from mentioned participants...",{description:`Generating responses from ${E.length} mentioned participant(s).`});for(const K of E){const J=n.find(X=>(X._id||X.id)===K);if(!J){console.warn(`Mentioned participant ${K} not found in focus group`);continue}try{const X=await vn.generateResponse(s,K,D||"Continue the conversation based on the latest moderator message.");if((U=X==null?void 0:X.data)!=null&&U.response){console.log("Generated response from mentioned participant:",X.data);const be={id:X.data.message_id||`msg-${Date.now()}-${K}`,senderId:K,text:X.data.response,timestamp:new Date,type:"response"};u(be),ce.success(`Response generated from ${J.name}`,{description:X.data.response.substring(0,100)+"..."})}}catch(X){console.error(`Error generating response from ${J.name}:`,X),ce.error(`Failed to generate response from ${J.name}`)}}}catch(K){console.error("Error generating mentioned responses:",K),ce.error("Failed to generate responses from mentioned participants")}finally{b(!1)}},Ie=async()=>{var E,D,U,K;if(s){if(n.length===0){ce.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),ce.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const J=await vn.makeConversationDecision(s,.7,"manual");if(!J||!J.data||!J.data.decision)throw new Error("Empty decision response from AI");const X=J.data.decision;if(X.action==="participant_respond"){const be=X.details.participant_id,_e=X.details.topic_context,Fe=X.reasoning,ie=n.find(Be=>(Be._id||Be.id)===be);if(!ie)throw new Error(`Selected participant ${be} not found in focus group`);ce.info("Generating response...",{description:`AI selected ${ie.name}: ${Fe.substring(0,100)}${Fe.length>100?"...":""}`});const Te=await vn.generateResponse(s,be,_e);if(!Te||!Te.data)throw new Error("Empty response from API");if((E=Te==null?void 0:Te.data)!=null&&E.message_id&&((D=Te==null?void 0:Te.data)!=null&&D.response)){const Be={id:Te.data.message_id,senderId:be,text:Te.data.response,timestamp:new Date,type:"response",highlighted:!1};u(Be),setTimeout(()=>{ue()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",X.action),X.action==="moderator_speak"){ce.info("AI suggests moderator intervention",{description:`AI reasoning: ${X.reasoning.substring(0,100)}${X.reasoning.length>100?"...":""}`});return}ce.warning("Using fallback participant selection",{description:`AI suggested "${X.action}" but generating participant response anyway.`});const be=(S+1)%n.length,_e=n[be],Fe=de(),ie=_e._id||_e.id,Te=await vn.generateResponse(s,ie,Fe);if((U=Te==null?void 0:Te.data)!=null&&U.message_id&&((K=Te==null?void 0:Te.data)!=null&&K.response)){const Be={id:Te.data.message_id,senderId:ie,text:Te.data.response,timestamp:new Date,type:"response",highlighted:!1};u(Be),setTimeout(()=>{ue()},100),N(be)}}}catch(J){console.error("Error generating AI response:",J),ce.error("Failed to generate AI response",{description:"There was a problem connecting to the server."})}finally{b(!1)}}};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(p0,{className:"h-full pr-4",children:[a.jsxs("div",{className:"space-y-4",children:[pe().map(E=>E.type==="message"?a.jsx($Ee,{message:E.data,persona:E.data.senderId!=="moderator"&&E.data.senderId!=="facilitator"?W(E.data.senderId):null,toggleHighlight:()=>l(E.data.id),participants:n,focusGroupId:s},E.data.id):a.jsx(BEe,{modeEvent:E.data},E.data.id)),x&&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:a.jsx(vs,{className:"h-4 w-4 text-primary"})}),a.jsx("span",{children:"Generating AI response..."})]}),a.jsx("div",{className:"h-8"}),a.jsx("div",{ref:P,className:"h-1"})]}),!_&&he.length>6&&a.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:a.jsx(se,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:ue,title:"Scroll to bottom",children:a.jsx(zA,{className:"h-4 w-4"})})})]})}),a.jsx(FEe,{reasoningHistory:V,isVisible:Q,onToggle:()=>Y(!L),isAiMode:i}),a.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[y&&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(qA,{className:"h-4 w-4 text-blue-600"}),a.jsx("span",{className:"text-sm text-blue-700",children:y.name}),a.jsxs("span",{className:"text-xs text-blue-500",children:["(",(y.size/1024/1024).toFixed(1)," MB)"]})]}),a.jsx(se,{type:"button",variant:"ghost",size:"sm",onClick:ve,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"×"})]}),a.jsxs("form",{onSubmit:Ae,className:"flex items-center gap-2 w-full",children:[a.jsx("input",{ref:j,type:"file",accept:"image/*",onChange:G,className:"hidden"}),a.jsx(f8,{value:h,onChange:(E,D)=>{p(E),m(D||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),a.jsx(se,{type:"button",variant:"outline",size:"sm",onClick:()=>{var E;return(E=j.current)==null?void 0:E.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:a.jsx(qA,{className:"h-4 w-4"})}),a.jsxs(se,{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...":i?"AI mode active":"Manual moderation mode"}),a.jsx(se,{variant:"outline",size:"sm",onClick:F?Ye:te,disabled:k,className:`hover-transition ${F?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:F?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:k?a.jsxs(a.Fragment,{children:[a.jsx(bo,{className:"mr-1 h-3 w-3 animate-spin"}),i?"Stopping...":"Starting..."]}):F?a.jsxs(a.Fragment,{children:[a.jsx(bo,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):a.jsxs(a.Fragment,{children:[a.jsx(bo,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{A(!_),_||ue()},className:`hover-transition ${_?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:_?"Disable auto-scroll":"Enable auto-scroll",children:[a.jsx(zA,{className:`h-3 w-3 ${_?"mr-1":""}`}),_&&"Auto-scroll"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!i&&a.jsxs(a.Fragment,{children:[a.jsxs(se,{variant:"outline",onClick:xe,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:x,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(se,{variant:"ghost",size:"sm",onClick:Ie,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:x||n.length===0,title:"Generate a participant response to the current topic",children:[a.jsx(vs,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),i&&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(se,{variant:"outline",size:"sm",onClick:()=>T(!O),className:"hover-transition",title:"Show autonomous conversation controls",children:a.jsx(EN,{className:"h-3 w-3"})})]})]})]})]})]})},UEe=({themes:e,messages:t,personas:n=[],onThemeDelete:r,onQuoteClick:s})=>{const i=(d,f)=>{d.stopPropagation(),r&&(r(f),ce.success("Theme deleted successfully"))},o=d=>n.find(f=>f.id===d||f._id===d),l=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 g=f.match(/^([^:]+):\s*(.*)$/);return g&&g[1].trim()!==f.trim()?{persona:g[1].trim(),text:g[2]}:{persona:null,text:f}},c=e.filter(d=>"source"in d?d.source==="highlight":!0),u=e.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(Rl,{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(ja,{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(Ke,{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=>i(f,d.id),children:a.jsx(Ei,{className:"h-3 w-3 text-slate-700"})}),a.jsx(Fr,{className:"pb-2",children:a.jsx(ts,{className:"text-base",children:d.title})}),a.jsxs(lt,{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,g=p?f.text:f,m=p?f.speaker:l(f).persona,x=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:y=>{y.stopPropagation(),s&&s(p?f:b,x)},title:x?`Message ID: ${x}`:"Click to find original message",children:[m&&a.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',g,'"',x&&a.jsx("span",{className:"ml-2 text-xs text-green-600 opacity-70",children:"✓"})]},h)})})]})]})]},d.id))})]}),c.length>0&&a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center mb-3",children:[a.jsx(CG,{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:c.map(d=>{const f=d.messages.length>0?t.find(x=>x.id===d.messages[0]):null,h=(f==null?void 0:f.text)||d.text,p=h.length>200?h.substring(0,200)+"...":h,g=f==null?void 0:f.senderId;let m="";if(g==="moderator")m="AI Moderator";else if(g==="facilitator")m="Human Facilitator";else if(g){const x=o(g);m=(x==null?void 0:x.name)||"Unknown Participant"}return a.jsxs(Ke,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:x=>{x.stopPropagation(),s&&f&&s(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:x=>i(x,d.id),children:a.jsx(Ei,{className:"h-3 w-3 text-slate-700"})}),a.jsx(Fr,{className:"pb-2",children:a.jsx(ts,{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(lt,{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(vs,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),e.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(Rl,{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."})]})]})]})},VEe=({themes:e,messages:t,personas:n,focusGroupId:r,onThemesGenerated:s,onThemeDelete:i,onQuoteClick:o,onGenerateKeyThemes:l})=>{const c=()=>{if(!e||e.length===0){ce.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis - -`;const d=e.filter(g=>"source"in g&&g.source==="generated");if(d.length===0){ce.warning("No AI-generated themes to export",{description:"Only AI-generated themes are included in the export."});return}d.forEach((g,m)=>{u+=`## ${m+1}. ${g.title} - -`,u+=`${g.description} - -`,g.quotes&&g.quotes.length>0&&(u+=`**Supporting Quotes:** - -`,g.quotes.forEach(x=>{u+=`> ${x} - -`})),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),ce.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(se,{onClick:l,className:"w-full",children:[a.jsx(LG,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),a.jsxs(se,{onClick:c,disabled:!e||e.length===0,variant:"outline",className:"w-full",children:[a.jsx(ed,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),a.jsx("div",{className:"flex-grow overflow-hidden",children:a.jsx(UEe,{themes:e,messages:t,personas:n,onThemeDelete:i,focusGroupId:r,onQuoteClick:o})})]})},WEe=({messages:e,themes:t,personas:n=[]})=>{var g;const[r,s]=v.useState([{name:"Very Positive",value:0,color:"#4ade80"},{name:"Positive",value:0,color:"#a3e635"},{name:"Neutral",value:0,color:"#93c5fd"},{name:"Negative",value:0,color:"#fb923c"},{name:"Very Negative",value:0,color:"#f87171"}]),[i,o]=v.useState([]),[l,c]=v.useState({}),[u,d]=v.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const x=n.find(b=>b.id===m);return x?x.name:`Participant ${m}`};v.useEffect(()=>{if(e.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},x={},b={};e.forEach(j=>{if(j.senderId!=="moderator"&&j.senderId!=="facilitator"){const S=j.text.toLowerCase();let N="Neutral";S.includes("love")||S.includes("excellent")||S.includes("amazing")?N="Very Positive":S.includes("good")||S.includes("like")||S.includes("great")?N="Positive":S.includes("bad")||S.includes("issue")||S.includes("problem")?N="Negative":(S.includes("terrible")||S.includes("hate")||S.includes("awful"))&&(N="Very Negative"),m[N]++,b[j.senderId]||(b[j.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[j.senderId][N]++,x[j.senderId]=(x[j.senderId]||0)+1}}),s(j=>j.map(S=>({...S,value:m[S.name]||0})));const y=Object.entries(x).map(([j,S])=>({name:f(j),messages:S}));o(y);const w={};Object.entries(b).forEach(([j,S])=>{w[j]={name:f(j),sentiments:S}}),c(w),h(x,b)},[e,n,f]);const h=(m,x)=>{if(Object.keys(m).length===0){d({isBalanced:!1,score:0,reason:"No participant data available"});return}const y=Object.values(m).reduce((V,$)=>V+$,0)/Object.keys(m).length,w=Object.values(m).map(V=>Math.abs(V-y)/y),j=w.reduce((V,$)=>V+$,0)/w.length,S=Object.values(x).map(V=>Object.values(V).filter($=>$>0).length),N=S.reduce((V,$)=>V+$,0)/S.length,P=["Very Positive","Positive","Neutral","Negative","Very Negative"],_=Object.values(x).map(V=>{const $=Math.max(...Object.values(V));return P.find(L=>V[L]===$)||"Neutral"}),A=new Set(_).size,O=A/P.length,T=Math.max(0,100-j*100),k=N/5*100,M=O*100,R=Math.round(T*.6+k*.2+M*.2);let H="";const F=R>=70;j>.3&&(H+="Participation is uneven among participants. "),N<2&&(H+="Limited range of sentiments expressed. "),A<=1?H+="Participants show similar sentiment patterns, suggesting potential group-think. ":A>=4&&(H+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),H===""&&(H=F?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:F,score:R,reason:H})},p=m=>{const x=l[m];if(!x)return"N/A";const b=x.sentiments;let y=0,w="Neutral";return Object.entries(b).forEach(([j,S])=>{S>y&&(y=S,w=j)}),w};return a.jsx("div",{className:"glass-panel rounded-xl p-4",children:a.jsxs(Ho,{defaultValue:"sentiment",children:[a.jsxs($a,{className:"grid grid-cols-2 mb-4",children:[a.jsxs(Wt,{value:"sentiment",className:"flex items-center",children:[a.jsx(pG,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),a.jsxs(Wt,{value:"participation",className:"flex items-center",children:[a.jsx(qw,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),a.jsx(Ht,{value:"sentiment",children:a.jsx(Ke,{children:a.jsxs(lt,{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(ha,{width:"100%",height:"100%",children:a.jsxs(XP,{children:[a.jsx(mr,{}),a.jsx(hi,{data:r,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:m,percent:x})=>x>0?`${m} ${(x*100).toFixed(0)}%`:"",children:r.map((m,x)=>a.jsx(Bp,{fill:m.color},`cell-${x}`))}),a.jsx(fa,{})]})})}),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(l).map(([m,x])=>{var w;const b=p(m),y=((w=r.find(j=>j.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(Dg,{className:"h-4 w-4 text-slate-400 mr-2"}),a.jsx("span",{className:"text-sm",children:x.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:`${y}30`,color:y},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(Ht,{value:"participation",children:a.jsx(Ke,{children:a.jsxs(lt,{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(ha,{width:"100%",height:"100%",children:a.jsxs(Xz,{data:i,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(lp,{strokeDasharray:"3 3"}),a.jsx(Ro,{type:"number"}),a.jsx(Do,{dataKey:"name",type:"category",width:100}),a.jsx(mr,{}),a.jsx(Yo,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),a.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:i.length>0?`Most active: ${(g=i.sort((m,x)=>x.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})},HEe=({focusGroupId:e,personas:t,isVisible:n,onToggle:r})=>{const[s,i]=v.useState(null),[o,l]=v.useState(null),[c,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(!1),[g,m]=v.useState(null),[x,b]=v.useState(null);v.useEffect(()=>{if(n&&e){y();const P=setInterval(y,3e4);return()=>clearInterval(P)}},[n,e]);const y=async()=>{p(!0),m(null);try{const[P,_,A,O]=await Promise.allSettled([vn.getConversationAnalytics(e),vn.getConversationState(e),vn.getAutonomousConversationStatus(e),vn.getConversationInsights(e)]);P.status==="fulfilled"&&i(P.value.data.analytics),_.status==="fulfilled"&&l(_.value.data.state),A.status==="fulfilled"&&u(A.value.data.status),O.status==="fulfilled"&&f(O.value.data.insights),b(new Date)}catch(P){console.error("Error fetching dashboard data:",P),m("Failed to load dashboard data")}finally{p(!1)}},w=()=>{y()},j=P=>{switch(P){case"running":return"bg-green-500";case"paused":return"bg-amber-500";case"completed":return"bg-blue-500";case"error":return"bg-red-500";default:return"bg-gray-500"}},S=P=>{switch(P){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},N=P=>{switch(P){case"excellent":return"text-green-600";case"good":return"text-blue-600";case"fair":return"text-amber-600";case"poor":return"text-red-600";default:return"text-gray-600"}};return n?a.jsxs("div",{className:"fixed right-4 top-4 bottom-4 w-80 bg-white rounded-lg shadow-lg border border-gray-200 flex flex-col overflow-hidden z-50",children:[a.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(bo,{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(se,{variant:"ghost",size:"sm",onClick:w,disabled:h,className:"p-1",children:a.jsx(zc,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),a.jsx(se,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:a.jsx(xG,{className:"h-4 w-4"})})]})]}),x&&a.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",x.toLocaleTimeString()]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[g&&a.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(mG,{className:"h-4 w-4 text-red-600"}),a.jsx("span",{className:"text-sm text-red-800",children:g})]})}),c&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx("div",{className:`w-3 h-3 rounded-full ${j(c.conversation_state)}`}),"Autonomous Status"]})}),a.jsx(lt,{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(Yn,{variant:c.conversation_state==="running"?"default":"secondary",children:c.conversation_state})]}),a.jsxs("div",{className:"flex justify-between text-sm",children:[a.jsx("span",{children:"Actions:"}),a.jsx("span",{className:"font-medium",children:c.action_count||0})]})]})})]}),o&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(Qi,{className:"h-4 w-4"}),"Conversation Health"]})}),a.jsx(lt,{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(Yn,{className:N(o.conversation_health.status),children:o.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:[o.conversation_health.score,"/100"]})]}),a.jsx(fl,{value:o.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:o.conversation_health.indicators.map((P,_)=>a.jsx(Yn,{variant:"outline",className:"text-xs",children:P.replace("_"," ")},_))})]})]})})]}),s&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(er,{className:"h-4 w-4"}),"Participation"]})}),a.jsx(lt,{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:s.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:s.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(Yn,{variant:s.participation.participation_balance==="balanced"?"default":"secondary",children:s.participation.participation_balance.replace("_"," ")})]}),s.participation.dominant_participants.length>0&&a.jsxs("div",{className:"text-xs text-amber-600",children:["Dominant: ",s.participation.dominant_participants.length," participant(s)"]}),s.participation.quiet_participants.length>0&&a.jsxs("div",{className:"text-xs text-blue-600",children:["Quiet: ",s.participation.quiet_participants.length," participant(s)"]})]})]})})]}),s&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(RG,{className:"h-4 w-4"}),"Sentiment"]})}),a.jsx(lt,{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(Yn,{className:S(s.sentiment_analysis.overall_sentiment),children:s.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: ",s.sentiment_analysis.sentiment_distribution.positive]}),a.jsxs("span",{children:["Neutral: ",s.sentiment_analysis.sentiment_distribution.neutral]}),a.jsxs("span",{children:["Negative: ",s.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:s.sentiment_analysis.sentiment_trend})]})]})]})})]}),s&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(hG,{className:"h-4 w-4"}),"Quality Metrics"]})}),a.jsx(lt,{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(s.quality_metrics.engagement_score),"/100"]})]}),a.jsx(fl,{value:s.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(s.quality_metrics.depth_score),"/100"]})]}),a.jsx(fl,{value:s.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(s.quality_metrics.quality_score),"/100"]})]}),a.jsx(fl,{value:s.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(Rl,{className:"h-4 w-4"}),"AI Insights"]})}),a.jsx(lt,{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(Yn,{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(Yn,{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]})})]})})]}),s&&s.recommendations.length>0&&a.jsxs(Ke,{children:[a.jsx(Fr,{className:"pb-3",children:a.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[a.jsx(Ig,{className:"h-4 w-4"}),"Recommendations"]})}),a.jsx(lt,{className:"pt-0",children:a.jsx("div",{className:"space-y-2",children:s.recommendations.map((P,_)=>a.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2",children:a.jsx("div",{className:"text-xs text-amber-800",children:P})},_))})})]})]})]}):null},GEe=({discussionGuide:e,moderatorStatus:t,onSectionSelect:n,onSetPosition:r,onSave:s,focusGroupId:i,isOpen:o,onToggle:l,className:c,onEditingChange:u})=>{console.log("📋 CollapsibleDiscussionGuide render",{isOpen:o,hasModerator:!!t,guideTitle:e==null?void 0:e.title,timestamp:new Date().toISOString()});const[d,f]=v.useState(!1),h=async()=>{if(!e){ce.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}f(!0);try{await Ct.downloadDiscussionGuide(i),ce.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(g){console.error("Error downloading discussion guide:",g),ce.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{f(!1)}},p=e&&typeof e=="object"&&e.sections;return a.jsx("div",{className:Me("w-full border-b bg-white shadow-sm",c),children:a.jsxs(Ep,{open:o,onOpenChange:l,children:[a.jsx(Op,{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(yG,{className:"h-5 w-5 text-slate-600"}),a.jsxs("div",{children:[a.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),p&&a.jsxs("p",{className:"text-xs text-slate-500",children:[e.title," • ",e.total_duration," minutes"]})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(se,{variant:"ghost",size:"sm",onClick:g=>{g.stopPropagation(),h()},disabled:!e||d,className:"h-8",children:d?a.jsx(Dl,{className:"h-4 w-4 animate-spin"}):a.jsx(ed,{className:"h-4 w-4"})}),o?a.jsx(wp,{className:"h-4 w-4 text-slate-500"}):a.jsx(Ta,{className:"h-4 w-4 text-slate-500"})]})]})}),a.jsx(kp,{children:a.jsx("div",{className:"border-t bg-slate-50",children:a.jsx(Ke,{className:"mx-4 mb-4 mt-2",children:a.jsx(lt,{className:"p-4",children:a.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:a.jsx(B5,{discussionGuide:e,moderatorStatus:t,onSectionSelect:n,onSetPosition:r,onSave:s,showProgress:!0,collapsible:!0,focusGroupId:i})})})})})})]})})},qEe=C.memo(GEe,(e,t)=>{const n=["discussionGuide","onSectionSelect","onSave","focusGroupId","isOpen","onToggle","className"];let r=!1;for(const s of n)if(e[s]!==t[s]){r=!0;break}return e.moderatorStatus!==t.moderatorStatus&&!r||!r&&e.moderatorStatus===t.moderatorStatus?!0:(console.log("🔄 Will re-render (props changed)",{changedProps:n.filter(s=>e[s]!==t[s]),timestamp:new Date().toISOString()}),!1)}),KEe=({focusGroupId:e,focusGroupName:t="Focus Group",onNoteClick:n})=>{const[r,s]=v.useState([]),[i,o]=v.useState(!0),[l,c]=v.useState(null);v.useEffect(()=>{u()},[e]);const u=async()=>{try{o(!0);const y=await Ct.getNotes(e);if(y.data&&Array.isArray(y.data)){const w=y.data.map(j=>({...j,timestamp:new Date(j.timestamp),createdAt:new Date(j.createdAt)}));s(x(w))}}catch(y){console.error("Error fetching notes:",y),ce.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{o(!1)}},d=async y=>{c(y);try{await Ct.deleteNote(e,y),s(r.filter(w=>w.id!==y)),ce.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),ce.error("Failed to delete note",{description:"Please try again."})}finally{c(null)}},f=y=>{y.associatedMessageId&&n?n(y.associatedMessageId):ce.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){ce.warning("No notes to export",{description:"Create some notes first before exporting."});return}const y=p(),w=document.createElement("a"),j=new Blob([y],{type:"text/markdown"});w.href=URL.createObjectURL(j),w.download=`${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),ce.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const y=[`# Notes: ${t}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,j)=>{var S;y.push(`## Note ${j+1}`),y.push(""),y.push(`**Created:** ${w.createdAt.toLocaleString()}`),(S=w.sectionInfo)!=null&&S.sectionTitle&&y.push(`**Section:** ${w.sectionInfo.sectionTitle}`),y.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),y.push(""),y.push("**Content:**"),y.push(w.content),y.push(""),y.push("---"),y.push("")}),y.join(` -`)},g=y=>{const w=Math.floor(y/1e3),j=Math.floor(w/60),S=w%60;return`${j}:${S.toString().padStart(2,"0")}`},m=y=>y.toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),x=y=>[...y].sort((w,j)=>j.createdAt.getTime()-w.createdAt.getTime()),b=y=>{s(w=>x([...w,y]))};return v.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),i?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(Rg,{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(se,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[a.jsx(ed,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),a.jsx(p0,{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(Rg,{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(y=>{var w;return a.jsxs(Ke,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(y),children:[a.jsx(Fr,{className:"pb-2",children:a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(ts,{className:"text-sm font-medium text-slate-600",children:m(y.createdAt)}),((w=y.sectionInfo)==null?void 0:w.sectionTitle)&&a.jsx("div",{className:"text-xs text-slate-500 mt-1",children:a.jsx("span",{children:y.sectionInfo.sectionTitle})})]}),a.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[y.associatedMessageId&&a.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:j=>{j.stopPropagation(),f(y)},title:"Go to discussion point",children:a.jsx(EG,{className:"h-3 w-3"})}),a.jsx(se,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:j=>{j.stopPropagation(),d(y.id)},disabled:l===y.id,title:"Delete note",children:a.jsx(wn,{className:"h-3 w-3"})})]})]})}),a.jsx(lt,{className:"pt-0",children:a.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:y.content})})]},y.id)})})})]})},XEe=({isOpen:e,onClose:t,focusGroupId:n,associatedMessageId:r,sectionInfo:s,messageTimestamp:i,onNoteSaved:o})=>{const[l,c]=v.useState(""),[u,d]=v.useState(!1),f=async()=>{if(!l.trim()){ce.error("Note content cannot be empty");return}d(!0);try{const p={content:l.trim(),associatedMessageId:r,sectionInfo:s,elapsedTime:0,timestamp:i.toISOString(),createdAt:new Date().toISOString()},g=await Ct.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},x=s!=null&&s.sectionTitle?`'${s.sectionTitle}'`:"current section",b=i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});ce.success("Quick note saved",{description:`Note linked to ${x} at ${b}`}),o&&o(m),c(""),t()}}catch(p){console.error("Error saving note:",p),ce.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{c(""),t()};return a.jsx(wo,{open:e,onOpenChange:h,children:a.jsxs(la,{className:"sm:max-w-md",children:[a.jsx(ca,{children:a.jsx(ua,{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:"})," ",(s==null?void 0:s.sectionTitle)||"Unknown section"]}),a.jsxs("div",{children:[a.jsx("strong",{children:"Time:"})," ",i.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),a.jsx(et,{placeholder:"Enter your note here...",value:l,onChange:p=>c(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(se,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},YEe=()=>{const{id:e}=wR(),t=Rn(),[n,r]=v.useState([]),[s,i]=v.useState([]),[o,l]=v.useState([]),[c,u]=v.useState(null),[d,f]=v.useState([]),[h,p]=v.useState("chat"),[g,m]=v.useState(null),[x,b]=v.useState(!1),[y,w]=v.useState(!1),[j,S]=v.useState(!0),[N,P]=v.useState(!1),[_,A]=v.useState(!1),O=v.useRef(!1),[T,k]=v.useState([]),[M,R]=v.useState(!1),[H,F]=v.useState(""),[V,$]=v.useState(!1),[L,Y]=v.useState(!1),[Q,ee]=v.useState(null),[fe,W]=v.useState([]),[he,pe]=v.useState(!1),[ue,Ae]=v.useState(!1),[de,oe]=v.useState(!1),[xe,te]=v.useState({isOpen:!1}),Ye=v.useRef(!1),[G,ve]=v.useState(""),Pe=v.useRef(""),Ie=v.useRef(!1),E=async()=>{var B;if(e)try{const z=await vn.getModeratorStatus(e);if((B=z==null?void 0:z.data)!=null&&B.status){const re=z.data.status;if(g){const me=g.current_section_id!==re.current_section_id||g.current_item_id!==re.current_item_id||g.progress!==re.progress}O.current||m(re)}}catch(z){console.error("Error fetching moderator status:",z)}},D=async()=>{if(!e)return{aiActive:!1,sessionStatus:""};try{if(typeof(Ct==null?void 0:Ct.getById)!="function")return console.error("focusGroupsApi.getById is not a function:",typeof(Ct==null?void 0:Ct.getById)),{aiActive:y,sessionStatus:G};const B=await Ct.getById(e);if(!B||typeof B!="object")return console.error("Invalid response object received:",B),{aiActive:y,sessionStatus:G};if(!B.data||typeof B.data!="object")return console.warn("Focus group response missing data property:",B),{aiActive:y,sessionStatus:G};const z=B.data.status;if(typeof z>"u")return console.warn("Focus group response missing status field:",B.data),{aiActive:y,sessionStatus:G};const re=z==="ai_mode";return z==="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(z)||console.warn("Unexpected focus group status value:",z),{aiActive:re,sessionStatus:z}}catch(B){console.error("Error checking AI mode status:",B);const z={focusGroupId:e,currentAiModeStatus:y,errorType:"unknown",timestamp:new Date().toISOString()};return B.response?(z.errorType="api_error",z.status=B.response.status,z.data=B.response.data,console.error("API error response:",B.response.status,B.response.data),B.response.status===404?console.warn("Focus group not found - may have been deleted"):B.response.status===500&&console.error("Server error during status check - backend issue")):B.request?(z.errorType="network_error",console.error("Network error - no response received, check connectivity")):(z.errorType="request_setup",z.message=B.message,console.error("Request setup error:",B.message)),console.debug("Status check error details:",z),{aiActive:y,sessionStatus:G}}},U=async(B,z)=>{if(!e||Ie.current)return;const re=["completed","paused"],le=["ai_mode","autonomous_active","active","in-progress"].includes(z),Ue=re.includes(B);if(le&&Ue){Ie.current=!0;try{let Ne="session_ended";B==="completed"?Ne="auto_complete":B==="paused"&&(Ne="manual_stop");const ze=await vn.endSession(e,Ne);ze!=null&&ze.data&&(Qe.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{K()},1e3))}catch(Ne){console.error("❌ Error ending session with concluding statement:",Ne),Qe.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},K=async()=>{var B;if(e)try{const z=await Ct.getMessages(e);let re=[],me=[];z&&z.data&&(Array.isArray(z.data)?(re=z.data,me=[]):z.data.messages||z.data.mode_events?(re=z.data.messages||[],me=z.data.mode_events||[]):(re=Array.isArray(z.data)?z.data:[],me=[]));const le=re.map(Se=>({id:Se._id||Se.id||`msg-${Date.now()}`,senderId:Se.senderId,text:Se.text,timestamp:new Date(Se.timestamp||Se.created_at||new Date),type:Se.type||"response",highlighted:Se.highlighted||!1})),Ue=me.map(Se=>({id:Se._id||Se.id||`event-${Date.now()}`,focus_group_id:Se.focus_group_id,event_type:Se.event_type,timestamp:new Date(Se.timestamp||Se.created_at||new Date),user_id:Se.user_id,created_at:new Date(Se.created_at||new Date)}));i(Ue),le.length>0?r(Se=>{if(Se.length===0)return le;{const at=new Map;Se.forEach(Lt=>at.set(Lt.id,Lt));const Ce=le.map(Lt=>{if(at.has(Lt.id)){const zt=at.get(Lt.id);return{...Lt,highlighted:zt.highlighted}}return Lt}),ut=new Set(Ce.map(Lt=>Lt.id)),Tt=Se.filter(Lt=>!ut.has(Lt.id));return[...Ce,...Tt].sort((Lt,zt)=>Lt.timestamp.getTime()-zt.timestamp.getTime())}}):le.length===0&&r(Se=>Se.length===0?[]:Se);const Ne=le.filter(Se=>Se.highlighted),ze=Ne.length>0?Ne.map(Se=>({id:`theme-${Se.id}`,text:Se.text.substring(0,40)+(Se.text.length>40?"...":""),count:1,messages:[Se.id],source:"highlight"})):[];try{const Se=await vn.getKeyThemes(e);if((B=Se==null?void 0:Se.data)!=null&&B.themes&&Array.isArray(Se.data.themes)){const at=Se.data.themes;l([...ze,...at])}else l(ze)}catch(Se){console.error("Error fetching AI-generated themes:",Se),l(ze)}}catch(z){console.error("Error fetching messages:",z),n.length===0&&Qe.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},J=async()=>{if(!e)return!1;try{const z=(await $n.getAll()).data||[],re=await Ct.getById(e);if(re&&re.data){const me=re.data;console.log("Focus group data from API:",me);const le={id:me._id||me.id,name:me.name,status:me.status||"in-progress",participants:me.participants||[],date:me.date||new Date().toISOString(),duration:me.duration||60,topic:me.topic||"general",discussionGuide:me.discussionGuide||"",llm_model:me.llm_model||"gemini-2.5-pro"};if(u(le),F(le.llm_model||"gemini-2.5-pro"),me.participants_data&&Array.isArray(me.participants_data))f(me.participants_data.map(Ne=>({...Ne,id:Ne._id||Ne.id})));else if(le.participants&&Array.isArray(le.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:le.participants,allPersonas:z.map(ze=>({id:ze._id||ze.id,name:ze.name}))});const Ne=z.filter(ze=>{const Se=ze._id||ze.id;return le.participants.includes(Se)});console.log("Matched participants:",Ne.map(ze=>ze.name)),f(Ne)}await K(),await E();const Ue=await D();return w(Ue.aiActive),ve(Ue.sessionStatus),Ye.current=Ue.aiActive,Pe.current=Ue.sessionStatus,!0}return!1}catch(B){return console.error("Error fetching focus group:",B),!1}},X=async B=>{if(console.log("🔧 updateFocusGroupModel called with:",{id:e,focusGroup:!!c,newModel:B}),!e||!c){console.log("❌ updateFocusGroupModel: Missing id or focusGroup",{id:e,focusGroup:!!c});return}$(!0);try{console.log("🔧 Making API call to update focus group model:",{id:e,newModel:B});const z=await Ct.update(e,{llm_model:B});console.log("🔧 API response:",z),z&&z.data?(u(re=>re?{...re,llm_model:B}:null),Qe.success("AI Model Updated",{description:`Focus group will now use ${B==="gemini-2.5-pro"?"Gemini 2.5 Pro":"GPT-4.1"} for AI responses`}),R(!1),console.log("✅ Model update successful")):console.log("❌ API response missing data:",z)}catch(z){console.error("❌ Error updating focus group model:",z),Qe.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{$(!1)}};v.useEffect(()=>{console.log("Looking for focus group with ID:",e);const B=async()=>{try{return(await $n.getAll()).data||[]}catch(le){return console.error("Error fetching personas:",le),[]}},z=async le=>{try{const Ue=await Ct.getById(e);if(Ue&&Ue.data){const Ne=Ue.data;console.log("Focus group data from API:",Ne);const ze={id:Ne._id||Ne.id,name:Ne.name,status:Ne.status||"in-progress",participants:Ne.participants||[],date:Ne.date||new Date().toISOString(),duration:Ne.duration||60,topic:Ne.topic||"general",discussionGuide:Ne.discussionGuide||"",llm_model:Ne.llm_model||"gemini-2.5-pro"};if(u(ze),F(ze.llm_model||"gemini-2.5-pro"),Ne.participants_data&&Array.isArray(Ne.participants_data))f(Ne.participants_data.map(Se=>({...Se,id:Se._id||Se.id})));else if(ze.participants&&Array.isArray(ze.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:ze.participants,allPersonas:le.map(at=>({id:at._id||at.id,name:at.name}))});const Se=le.filter(at=>{const Ce=at._id||at.id;return ze.participants.includes(Ce)});console.log("Matched participants:",Se.map(at=>at.name)),f(Se)}return K(),E(),S(!1),!0}return!1}catch(Ue){return console.error("Error fetching focus group:",Ue),!1}};let re,me;return B().then(le=>{z(le).then(Ue=>{Ue?((()=>{K(),E(),re&&window.clearInterval(re);const Se=y?3e3:1e4;console.log("📡 Setting up message polling:",{aiModeActive:y,pollInterval:Se,timestamp:new Date().toISOString()}),re=window.setInterval(()=>{O.current?console.log("📡 Skipping poll - editing discussion guide"):(console.log("📡 Polling for messages...",new Date().toISOString()),K(),E())},Se)})(),me=window.setInterval(async()=>{const Se=Ye.current,at=Pe.current,Ce=await D();if(Ye.current=Ce.aiActive,Pe.current=Ce.sessionStatus,w(Ce.aiActive),ve(Ce.sessionStatus),at&&at!==Ce.sessionStatus&&await U(Ce.sessionStatus,at),Se!==Ce.aiActive&&re){window.clearInterval(re);const ut=Ce.aiActive?3e3:1e4;re=window.setInterval(()=>{O.current||(K(),E())},ut)}},15e3)):(console.error("Focus group not found with ID:",e),S(!1),Qe.error("Focus group not found",{description:`Could not find focus group with ID: ${e}`}))})}),()=>{re&&window.clearInterval(re),me&&window.clearInterval(me)}},[e,t]);const be=B=>{if(!B||!B.sections||!Array.isArray(B.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const z=B.sections[0];if(!z)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const re=le=>le.questions&&Array.isArray(le.questions)&&le.questions.length>0?{content:le.questions[0].content,itemId:le.questions[0].id,type:"question"}:le.activities&&Array.isArray(le.activities)&&le.activities.length>0?{content:le.activities[0].content,itemId:le.activities[0].id,type:"activity"}:null;let me=re(z);if(!me&&z.subsections&&Array.isArray(z.subsections)){for(const le of z.subsections)if(me=re(le),me)break}return me?{content:me.content,sectionId:z.id,itemId:me.itemId}:{content:`Welcome to our focus group session on "${z.title||"our topic"}". Let's begin our discussion.`,sectionId:z.id,itemId:"section-intro"}},_e=async()=>{var B,z,re,me,le,Ue;if(e)try{Qe.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const Ne=await vn.getModeratorStatus(e),ze=(z=(B=Ne==null?void 0:Ne.data)==null?void 0:B.status)==null?void 0:z.moderator_position;ze?console.log("📍 Preserving existing moderator position:",ze):(await vn.setModeratorPosition(e,((le=(me=(re=c==null?void 0:c.discussionGuide)==null?void 0:re.sections)==null?void 0:me[0])==null?void 0:le.id)||"welcome"),console.log("🚀 Moderator position initialized to start of discussion guide (first time)"))}catch(Ne){console.warn("Failed to check/initialize moderator position:",Ne)}await Ct.update(e,{status:"active"});try{const Ne=be(c==null?void 0:c.discussionGuide),ze={id:`msg-${Date.now()}`,senderId:"moderator",text:Ne.content,timestamp:new Date,type:"question"},Se=await Ct.sendMessage(e,{senderId:"moderator",text:ze.text,type:"question"});(Ue=Se==null?void 0:Se.data)!=null&&Ue.message_id&&(ze.id=Se.data.message_id),Fe(ze),console.log("🚀 Initial moderator message created:",{content:Ne.content,sectionId:Ne.sectionId,itemId:Ne.itemId})}catch(Ne){console.warn("Failed to create initial moderator message:",Ne)}Qe.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(Ne){console.error("Error starting session:",Ne),Qe.error("Error starting session",{description:"There was a problem connecting to the server."})}},Fe=B=>{r(z=>[...z,B])},ie=async B=>{const z=[...n],re=z.findIndex(me=>me.id===B);if(re!==-1){const me=z[re],le=!me.highlighted;if(z[re]={...me,highlighted:le},r(z),e)try{!B.startsWith("local-")&&!B.startsWith("msg-")?await Ct.updateMessageHighlight(e,B,le):console.log("Skipping database update for local message:",B)}catch(Ue){console.error("Error updating message highlight state:",Ue),Qe.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},Te=B=>d.find(z=>z.id===B||z._id===B),Be=()=>{const B=n.map(me=>{var Ne;let le;return me.senderId==="moderator"?le="AI Moderator":me.senderId==="facilitator"?le="Human Facilitator":le=((Ne=Te(me.senderId))==null?void 0:Ne.name)||"Unknown",`[${me.timestamp.toLocaleTimeString()}] ${le}: ${me.text}`}).join(` - -`),z=document.createElement("a"),re=new Blob([B],{type:"text/plain"});z.href=URL.createObjectURL(re),z.download=`focus-group-${e}-transcript.txt`,document.body.appendChild(z),z.click(),document.body.removeChild(z),Qe.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},gt=(B,z)=>{const re=Ce=>{const ut=Ce.match(/^\[([^\]]+)\]:\s*(.*)$/);return ut?ut[2].trim():Ce.trim()},me=Ce=>Ce.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),le=(Ce,ut)=>{const Tt=me(Ce),nr=me(ut);if(Tt===nr)return 1;if(Tt.includes(nr)||nr.includes(Tt))return Math.min(Tt.length,nr.length)/Math.max(Tt.length,nr.length);const Lt=Tt.split(" "),zt=nr.split(" "),Pd=Lt.filter(eC=>zt.includes(eC)&&eC.length>2);return Lt.length===0||zt.length===0?0:Pd.length/Math.max(Lt.length,zt.length)},Ue=typeof B=="object"&&B!==null,Ne=Ue?B.text:re(B),ze=Ue?B.original:B;let Se=null,at="";if(z&&(Se=n.find(Ce=>Ce.id===z),Se?at="direct_message_id_match":console.warn(`Message ID ${z} not found in current messages array`)),Se||(Se=n.find(Ce=>Ce.text.includes(ze)),Se&&(at="exact_full_match")),Se||(Se=n.find(Ce=>Ce.text.includes(Ne)),Se&&(at="exact_text_match")),Se||(Se=n.find(Ce=>Ne.includes(Ce.text.trim())),Se&&(at="reverse_exact_match")),!Se){const Ce=Ne.toLowerCase();Se=n.find(ut=>ut.text.toLowerCase().includes(Ce)||Ce.includes(ut.text.toLowerCase())),Se&&(at="case_insensitive_match")}if(!Se){const Ce=n.map(ut=>({message:ut,similarity:le(Ne,ut.text)})).filter(ut=>ut.similarity>.7).sort((ut,Tt)=>Tt.similarity-ut.similarity);Ce.length>0&&(Se=Ce[0].message,at=`fuzzy_match_${Math.round(Ce[0].similarity*100)}%`)}if(!Se){const ut=me(Ne).split(" ").filter(Tt=>Tt.length>3);ut.length>0&&(Se=n.find(Tt=>{const nr=me(Tt.text);return ut.every(Lt=>nr.includes(Lt))}),Se&&(at="partial_word_match"))}Se?(console.log(`Quote match found using strategy: ${at}`,{quoteType:Ue?"QuoteData":"string",providedMessageId:z,extractedText:Ne,matchedMessage:Se.text.substring(0,100),matchedMessageId:Se.id,originalQuote:ze.substring(0,100)}),p("chat"),setTimeout(()=>{const Ce=document.getElementById(`message-${Se.id}`);Ce&&(_||Ce.scrollIntoView({behavior:"smooth",block:"center"}),Ce.style.backgroundColor="#fbbf24",Ce.style.transition="background-color 0.3s ease",setTimeout(()=>{Ce.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:Ue?"QuoteData":"string",providedMessageId:z,originalQuote:ze.substring(0,100),extractedText:Ne.substring(0,100),totalMessages:n.length,messageSample:n.slice(0,3).map(Ce=>({id:Ce.id,text:Ce.text.substring(0,50)}))}),Qe.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},At=B=>{l(z=>{const re=new Set(z.map(le=>le.id)),me=B.filter(le=>!re.has(le.id));return[...z,...me]})},pn=async B=>{if(!e)return;const z=o.find(re=>re.id===B);if(z)try{"source"in z&&z.source==="generated"&&await vn.deleteKeyTheme(e,B),l(o.filter(re=>re.id!==B))}catch(re){console.error("Error deleting theme:",re),Qe.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},Zt=v.useCallback(async(B,z)=>{if(e)try{await vn.setModeratorPosition(e,B,z),await E(),Qe.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(re){console.error("Error setting moderator position:",re),Qe.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[e]),bn=v.useCallback(async B=>{if(e)try{await Ct.update(e,{discussionGuide:B}),u(z=>z?{...z,discussionGuide:B}:null)}catch(z){throw console.error("Error saving discussion guide:",z),z}},[e]),Xt=v.useCallback(()=>{P(B=>!B)},[]),yt=v.useCallback((B,z,re,me,le,Ue)=>{te({isOpen:!0,sectionId:B,itemId:z,content:re,sectionTitle:me,itemTitle:le,itemType:Ue})},[]),Rr=B=>{console.log("🔍 EXTRACT ASSET FILENAME DEBUG - Input content:",B);const z=[/'([^']*\.[a-zA-Z]{3,4})'/g,/"([^"]*\.[a-zA-Z]{3,4})"/g,/titled\s+['"]([^'"]*\.[a-zA-Z]{3,4})['"](?:\.|,|\s|$)/gi,/asset[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/image[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/file[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/\b([a-zA-Z0-9_-]+\.[a-zA-Z]{3,4})\b/g];for(let re=0;re0){const Ue=le[0][1];if(console.log(`🔍 Pattern ${re+1} extracted filename:`,Ue),Ue&&Ue.includes("."))return console.log("✅ EXTRACT ASSET FILENAME - Found:",Ue),Ue}}return console.warn("❌ EXTRACT ASSET FILENAME - No filename found in content"),null},tt=()=>{if(g)return{sectionId:g.current_section_id,sectionTitle:g.current_section,itemId:g.current_item_id,itemTitle:g.current_item}},It=()=>{if(n.length!==0)return n[n.length-1].id},kt=()=>{const B=It();if(!B||n.length===0)return new Date;const z=n.find(re=>re.id===B);return z?z.timestamp:new Date},Dn=async()=>{if(e){pe(!0),Ae(!1),oe(!1),Qe.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const B=await vn.generateKeyThemes(e);B.data&&B.data.themes?(Ae(!0),Qe.success(`Generated ${B.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(z=>[...z,...B.data.themes])):(Ae(!0),Qe.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(B){console.error("Error generating key themes:",B),oe(!0),Qe.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},q=()=>{pe(!1),Ae(!1),oe(!1)},we=()=>{Q||ee(new Date),Y(!0)},I=B=>{k(z=>[...z,B].sort((re,me)=>me.createdAt.getTime()-re.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(B)},Z=B=>{const z=n.find(re=>re.id===B);z?(p("chat"),setTimeout(()=>{const re=document.getElementById(`message-${z.id}`);re&&(_||re.scrollIntoView({behavior:"smooth",block:"center"}),re.style.backgroundColor="#fbbf24",re.style.transition="background-color 0.3s ease",setTimeout(()=>{re.style.backgroundColor=""},2e3))},100)):Qe.info("Message not found",{description:"Could not locate the original message for this note."})};v.useEffect(()=>{n.length>0&&!Q&&ee(new Date)},[n.length,Q]),v.useEffect(()=>{O.current=_,_||E()},[_]);const ne=B=>{W(z=>z.includes(B)?z.filter(re=>re!==B):[...z,B])};return j?a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(oa,{}),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..."})]})]}):c?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),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(se,{variant:"ghost",onClick:()=>t("/focus-groups"),className:"mr-2",children:a.jsx(nh,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"font-sf text-2xl font-bold text-slate-900",children:c.name}),a.jsx("p",{className:"text-slate-600",children:new Date(c.date).toLocaleString()}),a.jsxs("div",{className:"flex items-center mt-1",children:[a.jsx(bo,{className:"h-3 w-3 text-slate-500 mr-1"}),a.jsx(Yn,{variant:"secondary",className:"text-xs",children:c.llm_model==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro"})]})]})]}),a.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[a.jsxs(se,{variant:"outline",onClick:()=>b(!x),className:x?"bg-blue-50 text-blue-600":"",children:[a.jsx(qw,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),a.jsxs(se,{variant:"outline",onClick:()=>R(!0),children:[a.jsx(EN,{className:"mr-2 h-4 w-4"}),"AI Model"]}),a.jsxs(se,{variant:"outline",onClick:Be,children:[a.jsx(ed,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),he&&a.jsx("div",{className:"mb-6",children:a.jsx(O_,{isActive:he,isComplete:ue,hasError:de,label:"Analyzing discussion for key themes",onComplete:q,className:"max-w-4xl mx-auto"})}),a.jsx(qEe,{discussionGuide:c.discussionGuide,moderatorStatus:g,onSectionSelect:Zt,onSetPosition:yt,onSave:bn,focusGroupId:e||"",isOpen:N,onToggle:Xt,onEditingChange:A}),a.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[a.jsx(fEe,{participants:d,selectedParticipantIds:fe,onToggleParticipantFilter:ne}),a.jsx("div",{className:"flex-1 flex flex-col",children:a.jsxs(Ho,{defaultValue:"chat",value:h,onValueChange:p,className:"w-full h-full flex flex-col",children:[a.jsxs($a,{className:"grid grid-cols-4 mb-4",children:[a.jsxs(Wt,{value:"chat",className:"flex items-center",children:[a.jsx(vs,{className:"h-4 w-4 mr-2"}),"Discussion"]}),a.jsxs(Wt,{value:"themes",className:"flex items-center",children:[a.jsx(Rl,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),a.jsxs(Wt,{value:"notes",className:"flex items-center",children:[a.jsx(Rg,{className:"h-4 w-4 mr-2"}),"Notes"]}),a.jsxs(Wt,{value:"analytics",className:"flex items-center",children:[a.jsx(qw,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),a.jsx(Ht,{value:"chat",className:"m-0 flex-1 flex flex-col h-0",children:n.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(se,{onClick:_e,size:"lg",className:"flex items-center gap-2",children:[a.jsx(Kw,{className:"h-5 w-5"}),"Start Session"]})]}):a.jsx(zEe,{messages:n,modeEvents:s,personas:d,isSpeaking:!1,focusGroupId:e||"",isAiModeActive:y,selectedParticipantIds:fe,onToggleHighlight:ie,onAdvanceDiscussion:()=>null,onNewMessage:Fe,onStatusChange:J,isEditingDiscussionGuide:_})}),a.jsx(Ht,{value:"themes",className:"m-0",children:a.jsx(VEe,{themes:o,messages:n,personas:d,focusGroupId:e||"",onThemesGenerated:At,onThemeDelete:pn,onQuoteClick:gt,onGenerateKeyThemes:Dn})}),a.jsx(Ht,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:a.jsx("div",{className:"h-full",children:a.jsx(KEe,{focusGroupId:e||"",focusGroupName:c==null?void 0:c.name,onNoteClick:Z})})}),a.jsx(Ht,{value:"analytics",className:"m-0",children:a.jsx(WEe,{messages:n,themes:o,personas:d})})]})})]})]}),n.length>0&&a.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:a.jsx(se,{onClick:we,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:a.jsx(Rg,{className:"h-5 w-5"})})}),a.jsx(XEe,{isOpen:L,onClose:()=>Y(!1),focusGroupId:e||"",associatedMessageId:It(),sectionInfo:tt(),messageTimestamp:kt(),onNoteSaved:I}),a.jsx(wo,{open:xe.isOpen,onOpenChange:B=>te(z=>({...z,isOpen:B})),children:a.jsxs(la,{children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"Set Moderator Position"}),a.jsxs(Cl,{children:['Are you sure you want to set the moderator position to "',xe.itemTitle,'" in section "',xe.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),a.jsxs(jo,{children:[a.jsx(se,{variant:"outline",disabled:xe.isLoading,onClick:()=>te({isOpen:!1}),children:"Cancel"}),a.jsxs(se,{disabled:xe.isLoading,onClick:async()=>{var B,z,re,me,le,Ue,Ne,ze,Se;if(!(!e||!xe.sectionId||!xe.itemId||!xe.content)){te(at=>({...at,isLoading:!0}));try{await vn.setModeratorPosition(e,xe.sectionId,xe.itemId);let at=[],Ce=!1,ut=xe.content;const Tt=xe.content?Rr(xe.content):null,nr=!!Tt;if(console.log("🔍 MANUAL POSITION DEBUG:",{itemType:xe.itemType,hasImageAttached:nr,assetFilename:Tt,content:xe.content,sectionTitle:xe.sectionTitle,itemTitle:xe.itemTitle,contentLength:(B=xe.content)==null?void 0:B.length}),nr&&xe.content&&Tt)if(console.log("🔍 ASSET EXTRACTION DEBUG:",{originalContent:xe.content,extractedFilename:Tt,contentLength:xe.content.length}),Tt){at=[Tt],Ce=!0,console.log("🎨 MANUAL POSITION: Creative review detected, will activate visual context for:",Tt);try{console.log("🎨 MANUAL MODE: Requesting AI description for",Tt);try{console.log("🔍 TESTING: Calling test endpoint first...");const Pd=await qe.post(`/focus-groups/${e}/test-endpoint`,{test:"data"});console.log("✅ TEST: Test endpoint response:",Pd.data)}catch(Pd){console.error("❌ TEST: Test endpoint failed:",Pd)}const zt=await Ct.describeAsset(e,Tt);zt.data.description&&(ut=xe.content.replace(`'${Tt}'`,`'${Tt}' - ${zt.data.description}`),console.log("✅ MANUAL MODE: Enhanced question with AI description"),console.log("🔍 Original:",xe.content),console.log("🔍 Enhanced:",ut))}catch(zt){console.error("⚠️ MANUAL MODE: Failed to generate AI description:",zt),console.error("⚠️ Error response data:",(z=zt.response)==null?void 0:z.data),console.error("⚠️ Error status:",(re=zt.response)==null?void 0:re.status),console.error("⚠️ Error headers:",(me=zt.response)==null?void 0:me.headers),console.error("⚠️ Full axios error:",{message:zt.message,code:zt.code,status:(le=zt.response)==null?void 0:le.status,statusText:(Ue=zt.response)==null?void 0:Ue.statusText,url:(Ne=zt.config)==null?void 0:Ne.url,method:(ze=zt.config)==null?void 0:ze.method}),Qe.warning("AI description failed",{description:"Using original question text. Image will still be available to participants."})}}else console.warn("⚠️ MANUAL POSITION: Creative review detected but no asset filename extracted from content");const Lt={id:`msg-${Date.now()}`,senderId:"moderator",text:ut,timestamp:new Date,type:"question"};try{const zt=await Ct.sendMessage(e,{senderId:"moderator",text:ut,type:"question",attached_assets:at,activates_visual_context:Ce});(Se=zt==null?void 0:zt.data)!=null&&Se.message_id&&(Lt.id=zt.data.message_id)}catch(zt){console.warn("Failed to save message to API, showing locally:",zt)}Fe(Lt),te({isOpen:!1}),setTimeout(async()=>{await E(),setTimeout(()=>E(),500)},200),Qe.success("Moderator position set",{description:`Position set to "${xe.itemTitle}" in "${xe.sectionTitle}"`})}catch(at){console.error("Error setting moderator position:",at),te(Ce=>({...Ce,isLoading:!1})),Qe.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[xe.isLoading&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),xe.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),a.jsx(wo,{open:M,onOpenChange:R,children:a.jsxs(la,{children:[a.jsxs(ca,{children:[a.jsx(ua,{children:"AI Model Settings"}),a.jsx(Cl,{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(bo,{className:"h-4 w-4 text-slate-500"}),a.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),a.jsx(Yn,{variant:"secondary",children:(c==null?void 0:c.llm_model)==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),a.jsxs(On,{value:H,onValueChange:B=>{console.log("🔧 Model selection changed:",{from:H,to:B}),F(B)},children:[a.jsx(jn,{className:"mt-1",children:a.jsx(kn,{placeholder:"Select AI model"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),a.jsx(ye,{value:"gpt-4.1",children:"GPT-4.1"})]})]})]}),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(jo,{children:[a.jsx(se,{variant:"outline",onClick:()=>R(!1),disabled:V,children:"Cancel"}),a.jsxs(se,{onClick:()=>{console.log("🔧 Update button clicked:",{selectedModel:H,currentModel:c==null?void 0:c.llm_model,isDisabled:V||H===(c==null?void 0:c.llm_model)}),X(H)},disabled:V||H===(c==null?void 0:c.llm_model),children:[V&&a.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),V?"Updating...":"Update Model"]})]})]})}),a.jsx(HEe,{focusGroupId:e,personas:d,isVisible:x,onToggle:()=>b(!x)})]}):a.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[a.jsx(oa,{}),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(se,{onClick:()=>t("/focus-groups"),className:"mt-4",children:[a.jsx(nh,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},ZEe=({title:e,description:t})=>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:e}),a.jsx("p",{className:"text-slate-600 mt-1",children:t})]}),a.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[a.jsx(se,{variant:"outline",children:"Export Data"}),a.jsx(se,{children:"Generate Report"})]})]}),zb=({title:e,value:t,changePercentage:n,icon:r})=>a.jsx(Ke,{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:e}),a.jsx("h3",{className:"text-2xl font-bold mt-1",children:t}),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"})})]})}),QEe=[{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}],JEe=[{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"}],eOe=()=>a.jsxs("div",{className:"space-y-6",children:[a.jsxs(Ke,{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(ha,{width:"100%",height:"100%",children:a.jsxs(Zz,{data:QEe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(lp,{strokeDasharray:"3 3"}),a.jsx(Ro,{dataKey:"name"}),a.jsx(Do,{}),a.jsx(mr,{}),a.jsx(ni,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),a.jsx(ni,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),a.jsx(ni,{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(Ke,{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:[JEe.slice(0,3).map(e=>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 ${e.sentiment==="positive"?"bg-green-100":e.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:a.jsx(ja,{className:`h-4 w-4 ${e.sentiment==="positive"?"text-green-600":e.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),a.jsxs("div",{children:[a.jsx("h4",{className:"text-sm font-medium",children:e.title}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e.description}),a.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[a.jsx("span",{children:e.source}),a.jsx("span",{className:"mx-2",children:"•"}),a.jsx("span",{children:e.date})]})]})]})},e.id)),a.jsx(se,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),a.jsxs(Ke,{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(mm,{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(mm,{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(mm,{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(mm,{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(se,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),tOe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],nOe=()=>a.jsxs(Ke,{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(se,{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(ha,{width:"100%",height:"100%",children:a.jsxs(XP,{children:[a.jsx(mr,{}),a.jsx(hi,{data:tOe,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(se,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),rOe=[{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}],t$=[{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"}],sOe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],iOe=()=>{const e=Rn();return a.jsxs(Ke,{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(se,{variant:"outline",size:"sm",onClick:()=>e("/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(ha,{width:"100%",height:"100%",children:a.jsxs(Zz,{data:rOe,margin:{top:10,right:30,left:0,bottom:0},children:[a.jsx(lp,{strokeDasharray:"3 3"}),a.jsx(Ro,{dataKey:"name"}),a.jsx(Do,{}),a.jsx(mr,{}),a.jsx(ni,{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(ha,{width:"100%",height:"100%",children:a.jsxs(XP,{children:[a.jsx(mr,{}),a.jsx(hi,{data:t$,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:t,percent:n})=>`${t} ${(n*100).toFixed(0)}%`,children:t$.map((t,n)=>a.jsx(Bp,{fill:t.color},`cell-${n}`))}),a.jsx(fa,{})]})})})]})]}),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(ha,{width:"100%",height:"100%",children:a.jsxs(Xz,{data:sOe,margin:{top:5,right:30,left:20,bottom:5},children:[a.jsx(lp,{strokeDasharray:"3 3"}),a.jsx(Ro,{dataKey:"name"}),a.jsx(Do,{}),a.jsx(mr,{}),a.jsx(fa,{}),a.jsx(Yo,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),a.jsx("div",{className:"flex justify-center",children:a.jsx(se,{onClick:()=>e("/focus-groups"),children:"Manage Focus Groups"})})]})},aOe=()=>{const[e,t]=v.useState("overview");return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),a.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[a.jsx(ZEe,{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(zb,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:er}),a.jsx(zb,{title:"Active Focus Groups",value:7,changePercentage:5,icon:Na}),a.jsx(zb,{title:"Research Insights",value:124,changePercentage:18,icon:Rl})]}),a.jsxs(Ho,{value:e,onValueChange:t,className:"glass-panel rounded-xl p-6",children:[a.jsxs($a,{className:"grid w-full grid-cols-3 mb-6",children:[a.jsx(Wt,{value:"overview",children:"Overview"}),a.jsx(Wt,{value:"users",children:"Synthetic Users"}),a.jsx(Wt,{value:"focus-groups",children:"Focus Groups"})]}),a.jsx(Ht,{value:"overview",children:a.jsx(eOe,{})}),a.jsx(Ht,{value:"users",children:a.jsx(nOe,{})}),a.jsx(Ht,{value:"focus-groups",children:a.jsx(iOe,{})})]})]})]})};function oOe({persona:e}){const t=e.id==="0",n=e.id==="1";return a.jsxs(Ke,{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:sd(e),alt:e.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:e.name}),a.jsx("p",{className:"text-muted-foreground",children:e.occupation})]})]}),a.jsxs("div",{className:"mt-6 space-y-4",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(er,{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:[e.age," ",e.gender?a.jsxs(a.Fragment,{children:["• ",e.gender]}):null,e.ethnicity?a.jsxs(a.Fragment,{children:[" • ",e.ethnicity]}):null]}),e.education&&a.jsx("p",{className:"sidebar-sub-item",children:e.education}),e.socialGrade&&a.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",e.socialGrade]}),e.householdIncome&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",e.householdIncome]}),e.householdComposition&&a.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",e.householdComposition]})]})]}),a.jsxs("div",{className:"sidebar-section",children:[a.jsx(OR,{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:e.location}),e.livingSituation&&a.jsx("p",{className:"sidebar-sub-item",children:e.livingSituation})]})]}),e.interests&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Mg,{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:e.interests})]})]}),e.mediaConsumption&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(q0,{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:e.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:[e.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:`${e.techSavviness}%`}})})]}),e.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:[e.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:`${e.brandLoyalty}%`}})})]}),e.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:[e.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:`${e.priceConsciousness}%`}})})]}),e.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:[e.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:`${e.environmentalConcern}%`}})})]}),e.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:e.deviceUsage})]}),e.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:e.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:[e.brandPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Mg,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.brandPreferences})]}),e.communicationPreferences&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(Dg,{className:"sidebar-icon"}),a.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",e.communicationPreferences]})]}),e.deviceUsage&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(PG,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.deviceUsage})]}),e.shoppingHabits&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(OG,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:e.shoppingHabits})]}),e.additionalInformation&&typeof e.additionalInformation=="string"&&a.jsxs("div",{className:"sidebar-section",children:[a.jsx(wG,{className:"sidebar-icon"}),a.jsx("div",{className:"sidebar-sub-item",children:e.additionalInformation.split(` -`).map((r,s)=>a.jsx("div",{className:"mb-1",children:r.trim().startsWith("•")||r.trim().startsWith("-")?r.trim():`• ${r.trim()}`},s))})]}),t&&a.jsxs("div",{className:"pt-2 space-y-2",children:[a.jsxs("div",{className:"sidebar-section",children:[a.jsx(UA,{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(Zw,{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(q0,{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(VA,{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(q0,{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(Zw,{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(VA,{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(UA,{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(Dg,{className:"sidebar-icon"}),a.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function lOe({persona:e}){var t,n,r,s,i,o,l,c,u;return a.jsxs("div",{className:"space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(ON,{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:(t=e.goals)==null?void 0:t.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(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(kN,{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=e.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(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center mb-4",children:[a.jsx(Qi,{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=e.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(Ke,{children:a.jsxs(lt,{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(ja,{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:(i=(s=e.thinkFeelDo)==null?void 0:s.thinks)==null?void 0:i.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(Mg,{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:(l=(o=e.thinkFeelDo)==null?void 0:o.feels)==null?void 0:l.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(Qi,{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=(c=e.thinkFeelDo)==null?void 0:c.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 cOe({persona:e}){var n,r,s,i,o;const t=[{trait:"Openness",value:((n=e.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=e.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((s=e.oceanTraits)==null?void 0:s.extraversion)||50},{trait:"Agreeableness",value:((i=e.oceanTraits)==null?void 0:i.agreeableness)||50},{trait:"Neuroticism",value:((o=e.oceanTraits)==null?void 0:o.neuroticism)||50}];return a.jsx(Ke,{children:a.jsxs(lt,{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(ha,{width:"100%",height:"100%",children:a.jsxs(Yz,{outerRadius:90,data:t,children:[a.jsx(FP,{}),a.jsx(sc,{dataKey:"trait"}),a.jsx(rc,{domain:[0,100]}),a.jsx(Nd,{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:[t[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:`${t[0].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[0].value>75?"Highly creative and curious":t[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:[t[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:`${t[1].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[1].value>75?"Highly organized and responsible":t[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:[t[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:`${t[2].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[2].value>75?"Highly sociable and outgoing":t[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:[t[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:`${t[3].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[3].value>75?"Highly cooperative and compassionate":t[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:[t[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:`${t[4].value}%`}})}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[4].value>75?"Highly sensitive and prone to stress":t[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function uOe({persona:e}){var r;const t=(s,i)=>{const o=[a.jsx(SG,{className:"sidebar-icon"},"grid"),a.jsx(kG,{className:"sidebar-icon"},"smartphone"),a.jsx(jG,{className:"sidebar-icon"},"laptop"),a.jsx(bG,{className:"sidebar-icon"},"grid2x2")];return o[i%o.length]},n=()=>e.scenarioType?e.scenarioType:"Life Scenarios";return a.jsx(Ke,{children:a.jsxs(lt,{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=e.scenarios)==null?void 0:r.map((s,i)=>a.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:a.jsxs("div",{className:"sidebar-section",children:[t(s,i),a.jsxs("div",{children:[a.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",i+1]}),a.jsx("p",{className:"text-sm",children:s})]})]})},i))})]})})}function dOe(){const e=Rn();return a.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:a.jsxs(Ke,{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(se,{onClick:()=>e("/synthetic-users"),children:"Return to Personas"})]})})}function jt({className:e,...t}){return a.jsx("div",{className:Me("animate-pulse rounded-md bg-muted",e),...t})}function fOe(){return a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),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(jt,{className:"absolute left-0 top-0 h-10 w-20"}),a.jsx(jt,{className:"h-8 w-48 mx-auto"}),a.jsx(jt,{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(Ke,{className:"p-6",children:[a.jsxs("div",{className:"flex items-center space-x-4",children:[a.jsx(jt,{className:"h-16 w-16 rounded-full"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-6 w-32 mb-2"}),a.jsx(jt,{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(jt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-4 w-20 mb-2"}),a.jsx(jt,{className:"h-3 w-40 mb-1"}),a.jsx(jt,{className:"h-3 w-36"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(jt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-4 w-16 mb-2"}),a.jsx(jt,{className:"h-3 w-32"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(jt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-4 w-16 mb-2"}),a.jsx(jt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"flex items-start",children:[a.jsx(jt,{className:"h-5 w-5 mr-3 mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsx(jt,{className:"h-4 w-12 mb-2"}),a.jsx(jt,{className:"h-3 w-full"})]})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(jt,{className:"h-4 w-32 mb-3"}),a.jsx("div",{className:"space-y-3",children:[...Array(4)].map((e,t)=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx(jt,{className:"h-3 w-24"}),a.jsx(jt,{className:"h-3 w-8"})]}),a.jsx(jt,{className:"h-1.5 w-full rounded-full"})]},t))})]}),a.jsxs("div",{className:"pt-4 border-t",children:[a.jsx(jt,{className:"h-4 w-36 mb-3"}),a.jsx("div",{className:"space-y-2",children:[...Array(3)].map((e,t)=>a.jsxs("div",{className:"flex items-center",children:[a.jsx(jt,{className:"h-4 w-4 mr-2"}),a.jsx(jt,{className:"h-3 w-40"})]},t))})]})]})]})}),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(jt,{className:"h-10 w-full"}),a.jsx(jt,{className:"h-10 w-full"}),a.jsx(jt,{className:"h-10 w-full"})]}),a.jsx(Ke,{className:"p-6",children:a.jsxs("div",{className:"space-y-4",children:[a.jsx(jt,{className:"h-6 w-48"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-3/4"}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(jt,{className:"h-6 w-32"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-2/3"})]}),a.jsxs("div",{className:"mt-8 space-y-4",children:[a.jsx(jt,{className:"h-6 w-40"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-full"}),a.jsx(jt,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function hOe({message:e,onLoginSuccess:t,onCancel:n}){const{login:r}=Zl(),s=Rn(),[i,o]=v.useState("user"),[l,c]=v.useState("pass"),[u,d]=v.useState(!1),f=async()=>{if(!i||!l){ce.error("Please enter username and password");return}d(!0);try{await r(i,l),ce.success("Login successful"),t&&t()}catch(p){console.error("Login error:",p),ce.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():s("/synthetic-users")};return a.jsxs(Ke,{className:"max-w-md mx-auto shadow-lg",children:[a.jsxs(Fr,{children:[a.jsx(ts,{children:"Login Required"}),a.jsx(XN,{children:e||"You need to log in to save personas to the database"})]}),a.jsxs(lt,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(ji,{htmlFor:"username",children:"Username"}),a.jsx(_t,{id:"username",placeholder:"Username",value:i,onChange:p=>o(p.target.value),disabled:u})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ji,{htmlFor:"password",children:"Password"}),a.jsx(_t,{id:"password",type:"password",placeholder:"Password",value:l,onChange:p=>c(p.target.value),disabled:u})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:"Default credentials: user / pass"})]}),a.jsxs(YN,{className:"flex justify-between",children:[a.jsx(se,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),a.jsx(se,{onClick:f,disabled:u,children:u?a.jsxs(a.Fragment,{children:[a.jsx(Dl,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function pOe({persona:e,onSave:t,onCancel:n}){var _,A,O,T,k,M,R,H,F,V,$,L,Y,Q,ee,fe;const r={...e,education:e.education||"",interests:e.interests||"",brandLoyalty:e.brandLoyalty||0,priceConsciousness:e.priceConsciousness||0,environmentalConcern:e.environmentalConcern||0,hasPurchasingPower:e.hasPurchasingPower||!1,hasChildren:e.hasChildren||!1,goals:e.goals||[],frustrations:e.frustrations||[],motivations:e.motivations||[],scenarios:e.scenarios||[],oceanTraits:e.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:e.thinkFeelDo||{thinks:[],feels:[],does:[]}},[s,i]=v.useState(r),[o,l]=v.useState(!1),[c,u]=v.useState(!1),[d,f]=v.useState(null);v.useState(!1);const{isAuthenticated:h,token:p}=Zl();v.useEffect(()=>{(async()=>{c&&h&&p&&(u(!1),d&&await P())})()},[h,p,c]);const g=(W,he)=>{i(pe=>({...pe,[W]:he}))},m=(W,he)=>{i(pe=>({...pe,oceanTraits:{...pe.oceanTraits,[W]:he}}))},x=W=>{i(he=>({...he,[W]:[...he[W]||[],""]}))},b=(W,he,pe)=>{i(ue=>{const Ae=[...ue[W]||[]];return Ae[he]=pe,{...ue,[W]:Ae}})},y=(W,he)=>{i(pe=>{const ue=[...pe[W]||[]];return ue.splice(he,1),{...pe,[W]:ue}})},w=(W,he,pe)=>{i(ue=>{const Ae={...ue.thinkFeelDo},de=[...Ae[W]||[]];return de[he]=pe,Ae[W]=de,{...ue,thinkFeelDo:Ae}})},j=W=>{i(he=>{var ue;const pe={...he.thinkFeelDo,[W]:[...((ue=he.thinkFeelDo)==null?void 0:ue[W])||[],""]};return{...he,thinkFeelDo:pe}})},S=(W,he)=>{i(pe=>{const ue={...pe.thinkFeelDo},Ae=[...ue[W]||[]];return Ae.splice(he,1),ue[W]=Ae,{...pe,thinkFeelDo:ue}})},N=()=>{d&&(ce.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},P=async()=>{if(d){l(!0);try{const W={...d};delete W._id,delete W.isDbPersona;const he=await $n.create(W),pe={...d,id:he.data._id||he.data.id,_id:he.data._id||he.data.id,isDbPersona:!0};ce.success("Persona saved to database successfully"),u(!1),f(null),t(pe)}catch(W){console.error("Error saving after login:",W),ce.error("Failed to save to database after login"),u(!1),f(null)}finally{l(!1)}}};return c?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(hOe,{message:"Login is required to save your persona to the database",onLoginSuccess:P,onCancel:N})]}):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(se,{variant:"ghost",onClick:n,className:"mr-2",children:a.jsx(nh,{className:"h-5 w-5"})}),a.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),a.jsxs(se,{onClick:async()=>{l(!0);try{const W=s._id||s.id,he={...s};he._id&&delete he._id,delete he.isDbPersona;let pe;if(W&&typeof W=="string"&&W.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),pe=await $n.create(he),ce.success("Persona saved to database");const ue={...s,id:pe.data._id||pe.data.id,_id:pe.data._id||pe.data.id,isDbPersona:!0};t(ue)}else if(W){pe=await $n.update(W,he),ce.success("Persona updated successfully");const ue={...s,isDbPersona:!0};t(ue)}else{pe=await $n.create(he);const ue={...s,id:pe.data._id||pe.data.id,_id:pe.data._id||pe.data.id,isDbPersona:!0};ce.success("Persona created successfully"),t(ue)}}catch(W){console.error("Error saving persona:",W),W.response&&W.response.status===401?h&&p?(console.log("Auth error despite having token - token likely invalid"),ce.error("Authentication error - saving locally instead"),t(s)):(f(s),u(!0)):(ce.error("Failed to save persona"),t(s))}finally{l(!1)}},disabled:o,children:[o?a.jsx(Dl,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(CN,{className:"h-4 w-4 mr-2"}),o?"Saving...":"Save Changes"]})]}),a.jsxs(Ho,{defaultValue:"basic",children:[a.jsxs($a,{className:"grid w-full grid-cols-6",children:[a.jsx(Wt,{value:"basic",children:"Basic"}),a.jsx(Wt,{value:"cooper",children:"Cooper"}),a.jsx(Wt,{value:"personality",children:"Personality"}),a.jsx(Wt,{value:"demographics",children:"Demographics"}),a.jsx(Wt,{value:"lifestyle",children:"Lifestyle"}),a.jsx(Wt,{value:"extended",children:"Extended"})]}),a.jsx(Ht,{value:"basic",className:"mt-6",children:a.jsx(Ke,{children:a.jsx(lt,{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(_t,{value:s.name||"",onChange:W=>g("name",W.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(On,{value:s.age||"",onValueChange:W=>g("age",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select age range"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"18-24",children:"18-24"}),a.jsx(ye,{value:"25-34",children:"25-34"}),a.jsx(ye,{value:"35-44",children:"35-44"}),a.jsx(ye,{value:"45-54",children:"45-54"}),a.jsx(ye,{value:"55-64",children:"55-64"}),a.jsx(ye,{value:"65+",children:"65+"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),a.jsxs(On,{value:s.gender||"",onValueChange:W=>g("gender",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select gender"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Male",children:"Male"}),a.jsx(ye,{value:"Female",children:"Female"}),a.jsx(ye,{value:"Non-binary",children:"Non-binary"}),a.jsx(ye,{value:"Other",children:"Other"})]})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),a.jsx(_t,{value:s.occupation||"",onChange:W=>g("occupation",W.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),a.jsxs(On,{value:s.education||"",onValueChange:W=>g("education",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select education level"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"High School",children:"High School"}),a.jsx(ye,{value:"Some College",children:"Some College"}),a.jsx(ye,{value:"Associate's Degree",children:"Associate's Degree"}),a.jsx(ye,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),a.jsx(ye,{value:"Master's Degree",children:"Master's Degree"}),a.jsx(ye,{value:"PhD",children:"PhD"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),a.jsx(_t,{value:s.location||"",onChange:W=>g("location",W.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),a.jsxs(On,{value:s.ethnicity||"",onValueChange:W=>g("ethnicity",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select ethnicity"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"white",children:"White"}),a.jsx(ye,{value:"black",children:"Black"}),a.jsx(ye,{value:"asian",children:"Asian"}),a.jsx(ye,{value:"hispanic",children:"Hispanic/Latino"}),a.jsx(ye,{value:"native-american",children:"Native American"}),a.jsx(ye,{value:"middle-eastern",children:"Middle Eastern"}),a.jsx(ye,{value:"mixed",children:"Mixed"}),a.jsx(ye,{value:"other",children:"Other"}),a.jsx(ye,{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(et,{value:s.personality||"",onChange:W=>g("personality",W.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),a.jsx(et,{value:s.interests||"",onChange:W=>g("interests",W.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:[s.techSavviness,"%"]})]}),a.jsx(Bn,{value:[s.techSavviness],onValueChange:W=>g("techSavviness",W[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:[s.brandLoyalty||0,"%"]})]}),a.jsx(Bn,{value:[s.brandLoyalty||0],onValueChange:W=>g("brandLoyalty",W[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:[s.priceConsciousness||0,"%"]})]}),a.jsx(Bn,{value:[s.priceConsciousness||0],onValueChange:W=>g("priceConsciousness",W[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:[s.environmentalConcern||0,"%"]})]}),a.jsx(Bn,{value:[s.environmentalConcern||0],onValueChange:W=>g("environmentalConcern",W[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(bh,{checked:s.hasPurchasingPower||!1,onCheckedChange:W=>g("hasPurchasingPower",W)})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),a.jsx(bh,{checked:s.hasChildren||!1,onCheckedChange:W=>g("hasChildren",W)})]})]})]})]})})})}),a.jsxs(Ht,{value:"cooper",className:"mt-6 space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{className:"p-6",children:[a.jsxs("div",{className:"mb-4",children:[a.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(s.goals||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>b("goals",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("goals",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("goals"),className:"mt-2",children:[a.jsx(pr,{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"}),(s.frustrations||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>b("frustrations",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("frustrations",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("frustrations"),className:"mt-2",children:[a.jsx(pr,{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"}),(s.motivations||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>b("motivations",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("motivations",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("motivations"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),a.jsx(Ke,{children:a.jsxs(lt,{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"}),(((_=s.thinkFeelDo)==null?void 0:_.thinks)||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>w("thinks",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>S("thinks",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>j("thinks"),className:"mt-2",children:[a.jsx(pr,{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"}),(((A=s.thinkFeelDo)==null?void 0:A.feels)||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>w("feels",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>S("feels",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>j("feels"),className:"mt-2",children:[a.jsx(pr,{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"}),(((O=s.thinkFeelDo)==null?void 0:O.does)||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W||"",onChange:pe=>w("does",he,pe.target.value)}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>S("does",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>j("does"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),a.jsx(Ke,{children:a.jsxs(lt,{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(_t,{value:s.scenarioType||"",onChange:W=>g("scenarioType",W.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"}),(s.scenarios||[]).map((W,he)=>a.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[a.jsx(et,{value:W||"",onChange:pe=>b("scenarios",he,pe.target.value),rows:2}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("scenarios",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("scenarios"),className:"mt-2",children:[a.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),a.jsx(Ht,{value:"personality",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{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:[((T=s.oceanTraits)==null?void 0:T.openness)||50,"%"]})]}),a.jsx(Bn,{value:[((k=s.oceanTraits)==null?void 0:k.openness)||50],onValueChange:W=>m("openness",W[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:[((M=s.oceanTraits)==null?void 0:M.conscientiousness)||50,"%"]})]}),a.jsx(Bn,{value:[((R=s.oceanTraits)==null?void 0:R.conscientiousness)||50],onValueChange:W=>m("conscientiousness",W[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:[((H=s.oceanTraits)==null?void 0:H.extraversion)||50,"%"]})]}),a.jsx(Bn,{value:[((F=s.oceanTraits)==null?void 0:F.extraversion)||50],onValueChange:W=>m("extraversion",W[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:[((V=s.oceanTraits)==null?void 0:V.agreeableness)||50,"%"]})]}),a.jsx(Bn,{value:[(($=s.oceanTraits)==null?void 0:$.agreeableness)||50],onValueChange:W=>m("agreeableness",W[0]),max:100,step:1}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"flex justify-between mb-1",children:[a.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),a.jsxs("span",{className:"text-sm",children:[((L=s.oceanTraits)==null?void 0:L.neuroticism)||50,"%"]})]}),a.jsx(Bn,{value:[((Y=s.oceanTraits)==null?void 0:Y.neuroticism)||50],onValueChange:W=>m("neuroticism",W[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(Ht,{value:"demographics",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{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(On,{value:s.socialGrade||"",onValueChange:W=>g("socialGrade",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select social grade"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"A",children:"A - Higher managerial"}),a.jsx(ye,{value:"B",children:"B - Intermediate managerial"}),a.jsx(ye,{value:"C1",children:"C1 - Supervisory or clerical"}),a.jsx(ye,{value:"C2",children:"C2 - Skilled manual workers"}),a.jsx(ye,{value:"D",children:"D - Semi and unskilled manual workers"}),a.jsx(ye,{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(On,{value:s.householdIncome||"",onValueChange:W=>g("householdIncome",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select income range"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Under $25k",children:"Under $25,000"}),a.jsx(ye,{value:"$25k-$50k",children:"$25,000 - $50,000"}),a.jsx(ye,{value:"$50k-$75k",children:"$50,000 - $75,000"}),a.jsx(ye,{value:"$75k-$100k",children:"$75,000 - $100,000"}),a.jsx(ye,{value:"$100k-$150k",children:"$100,000 - $150,000"}),a.jsx(ye,{value:"$150k-$250k",children:"$150,000 - $250,000"}),a.jsx(ye,{value:"Over $250k",children:"Over $250,000"}),a.jsx(ye,{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(On,{value:s.householdComposition||"",onValueChange:W=>g("householdComposition",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select household type"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Single person",children:"Single person"}),a.jsx(ye,{value:"Couple without children",children:"Couple without children"}),a.jsx(ye,{value:"Couple with children",children:"Couple with children"}),a.jsx(ye,{value:"Single parent",children:"Single parent"}),a.jsx(ye,{value:"Multi-generational",children:"Multi-generational"}),a.jsx(ye,{value:"Shared housing",children:"Shared housing"}),a.jsx(ye,{value:"Other",children:"Other"})]})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),a.jsxs(On,{value:s.livingSituation||"",onValueChange:W=>g("livingSituation",W),children:[a.jsx(jn,{children:a.jsx(kn,{placeholder:"Select living situation"})}),a.jsxs(Sn,{children:[a.jsx(ye,{value:"Own home",children:"Own home"}),a.jsx(ye,{value:"Rent apartment",children:"Rent apartment"}),a.jsx(ye,{value:"Rent house",children:"Rent house"}),a.jsx(ye,{value:"Live with family",children:"Live with family"}),a.jsx(ye,{value:"Student housing",children:"Student housing"}),a.jsx(ye,{value:"Assisted living",children:"Assisted living"}),a.jsx(ye,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),a.jsx(Ht,{value:"lifestyle",className:"mt-6",children:a.jsx(Ke,{children:a.jsxs(lt,{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(et,{value:s.mediaConsumption||"",onChange:W=>g("mediaConsumption",W.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(et,{value:s.deviceUsage||"",onChange:W=>g("deviceUsage",W.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(et,{value:s.shoppingHabits||"",onChange:W=>g("shoppingHabits",W.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(et,{value:s.brandPreferences||"",onChange:W=>g("brandPreferences",W.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(et,{value:s.communicationPreferences||"",onChange:W=>g("communicationPreferences",W.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(et,{value:s.paymentMethods||"",onChange:W=>g("paymentMethods",W.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(et,{value:s.purchaseBehaviour||"",onChange:W=>g("purchaseBehaviour",W.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(Ht,{value:"extended",className:"mt-6 space-y-6",children:[a.jsx(Ke,{children:a.jsxs(lt,{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(et,{value:s.coreValues||"",onChange:W=>g("coreValues",W.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(et,{value:s.lifestyleChoices||"",onChange:W=>g("lifestyleChoices",W.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(et,{value:s.socialActivities||"",onChange:W=>g("socialActivities",W.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(et,{value:s.categoryKnowledge||"",onChange:W=>g("categoryKnowledge",W.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(et,{value:s.decisionInfluences||"",onChange:W=>g("decisionInfluences",W.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(et,{value:s.painPoints||"",onChange:W=>g("painPoints",W.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(et,{value:s.journeyContext||"",onChange:W=>g("journeyContext",W.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(et,{value:s.keyTouchpoints||"",onChange:W=>g("keyTouchpoints",W.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(et,{value:((Q=s.selfDeterminationNeeds)==null?void 0:Q.autonomy)||"",onChange:W=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,autonomy:W.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(et,{value:((ee=s.selfDeterminationNeeds)==null?void 0:ee.competence)||"",onChange:W=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,competence:W.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(et,{value:((fe=s.selfDeterminationNeeds)==null?void 0:fe.relatedness)||"",onChange:W=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,relatedness:W.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),a.jsx(Ke,{children:a.jsx(lt,{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"}),(s.fears||[]).map((W,he)=>a.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[a.jsx(_t,{value:W,onChange:pe=>b("fears",he,pe.target.value),placeholder:"Enter a fear or concern"}),a.jsx(se,{variant:"ghost",size:"icon",onClick:()=>y("fears",he),children:a.jsx(wn,{className:"h-4 w-4 text-muted-foreground"})})]},he)),a.jsxs(se,{variant:"outline",size:"sm",onClick:()=>x("fears"),className:"mt-2",children:[a.jsx(pr,{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(et,{value:s.narrative||"",onChange:W=>g("narrative",W.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(et,{value:s.additionalInformation||"",onChange:W=>g("additionalInformation",W.target.value),rows:4,placeholder:"Any other relevant details or context"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Additional context or details not covered elsewhere"})]})]})})})]})]})]})}function mOe(){const{id:e}=wR(),t=ci(),n=Rn(),[r,s]=v.useState(void 0),[i,o]=v.useState(!1),[l,c]=v.useState(!1),[u,d]=v.useState(!0);return v.useEffect(()=>{if(!e){d(!1);return}let p=!0;const m=new URLSearchParams(t.search).get("fromReview")==="true";return o(m),d(!0),(async()=>{try{const b=e.startsWith("local-")?e.substring(6):e,y=await $n.getById(b);if(y&&y.data){const w=y.data;if(p){console.log("Found persona in database:",w),s({...w,id:w.id||w._id,isDbPersona:!0}),d(!1);return}}console.error("Could not find persona with id:",e),p&&(s(void 0),d(!1),ce.error("Persona not found"))}catch(b){console.error("Error fetching persona:",b),p&&(s(void 0),d(!1),ce.error("Failed to load persona details"))}})(),()=>{p=!1}},[e,t.search]),{currentPersona:r,isEditing:l,isFromReview:i,isLoading:u,setIsEditing:c,handleGoBack:()=>{n(i?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async p=>{try{c(!1);const g=p.isDbPersona||e&&e.length===24&&/^[0-9a-f]{24}$/i.test(e),m={...p};if(m._id&&delete m._id,delete m.isDbPersona,g&&e&&e.length===24&&/^[0-9a-f]{24}$/i.test(e)){const x=await $n.update(e,m);console.log("Updated persona in database:",x);const b={...p,isDbPersona:!0};s(b),ce.success("Persona updated in database successfully")}else{const x=await $n.create(m);console.log("Created new persona in database:",x.data);const b={...p,id:x.data._id||x.data.id,_id:x.data._id||x.data.id,isDbPersona:!0};s(b),ce.success("Persona saved to database successfully")}}catch(g){return console.error("Error saving persona:",g),g.response&&g.response.status===401?ce.error("Authentication error - Please log in to save personas"):g.response&&g.response.status===404?ce.error("API endpoint not found - Database service may be unavailable"):ce.error("Failed to save persona to database: "+(g.message||"Unknown error")),!1}return!0}}}function n$(){const{currentPersona:e,isEditing:t,isFromReview:n,isLoading:r,setIsEditing:s,handleGoBack:i,handleSaveEdit:o}=mOe();return r?a.jsx(fOe,{}):e?a.jsxs("div",{className:"min-h-screen bg-slate-50",children:[a.jsx(oa,{}),a.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:t?a.jsx(pOe,{persona:e,onSave:o,onCancel:()=>s(!1)}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center mb-6 relative",children:[a.jsx(se,{variant:"ghost",onClick:i,className:"absolute left-0 top-0 flex items-center",children:a.jsx(nh,{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(se,{onClick:()=>s(!0),className:"absolute right-0 top-0",children:[a.jsx($G,{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(oOe,{persona:e})}),a.jsx("div",{className:"lg:col-span-2",children:a.jsxs(Ho,{defaultValue:"cooper-profile",children:[a.jsxs($a,{className:"grid w-full grid-cols-3",children:[a.jsx(Wt,{value:"cooper-profile",children:"Cooper Profile"}),a.jsx(Wt,{value:"personality",children:"Personality"}),a.jsx(Wt,{value:"scenarios",children:"Scenarios"})]}),a.jsx(Ht,{value:"cooper-profile",className:"mt-6",children:a.jsx(lOe,{persona:e})}),a.jsx(Ht,{value:"personality",className:"mt-6",children:a.jsx(cOe,{persona:e})}),a.jsx(Ht,{value:"scenarios",className:"mt-6",children:a.jsx(uOe,{persona:e})})]})})]})]})})]}):a.jsx(dOe,{})}const gOe=Re.object({username:Re.string().min(3,"Username must be at least 3 characters"),password:Re.string().min(4,"Password must be at least 4 characters")});function vOe(){var u;const e=Rn(),t=ci(),{login:n,isAuthenticated:r}=Zl(),[s,i]=v.useState(!1),o=((u=t.state)==null?void 0:u.from)||"/";console.log("Login page - destination path:",o),v.useEffect(()=>{r&&(console.log("User already authenticated, redirecting from login page"),e("/",{replace:!0}))},[r,e]);const l=tx({resolver:nx(gOe),defaultValues:{username:"",password:""}});async function c(d){i(!0);try{await n(d.username,d.password)?(console.log("Login successful, received token, navigating to:",o),e(o,{replace:!0})):(console.error("Login succeeded but no token received"),i(!1))}catch(f){console.error("Login error in form handler:",f),i(!1)}}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(Ke,{className:"w-full max-w-md",children:[a.jsxs(Fr,{className:"space-y-1",children:[a.jsx(ts,{className:"text-2xl font-bold text-center",children:"Sign In"}),a.jsx(XN,{className:"text-center",children:"Enter your credentials to access your account"})]}),a.jsx(lt,{children:a.jsx(sx,{...l,children:a.jsxs("form",{onSubmit:l.handleSubmit(c),className:"space-y-4",children:[a.jsx(ot,{control:l.control,name:"username",render:({field:d})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Username"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Enter your username",...d,disabled:s,autoComplete:"username"})}),a.jsx(it,{})]})}),a.jsx(ot,{control:l.control,name:"password",render:({field:d})=>a.jsxs(nt,{children:[a.jsx(rt,{children:"Password"}),a.jsx(st,{children:a.jsx(_t,{placeholder:"Enter your password",type:"password",...d,disabled:s,autoComplete:"current-password"})}),a.jsx(it,{})]})}),a.jsx(se,{type:"submit",className:"w-full",disabled:s,children:s?"Signing in...":"Sign In"})]})})}),a.jsxs(YN,{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&&a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[a.jsx(se,{variant:"outline",onClick:()=>e("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),a.jsx(se,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const d={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(d)),Qe.success("Offline mode activated",{description:"Using demo account with limited functionality"}),e("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function pc({children:e}){const{isAuthenticated:t,isLoading:n}=Zl(),r=ci();return console.log("ProtectedRoute check:",{isAuthenticated:t,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"})}):t?(console.log("User is authenticated, showing protected content"),a.jsx(a.Fragment,{children:e})):(console.log("Not authenticated, redirecting to login"),a.jsx(_R,{to:"/login",state:{from:r.pathname},replace:!0}))}const yOe=new lH,xOe=()=>a.jsx(uH,{client:yOe,children:a.jsx(iG,{basename:"/semblance",children:a.jsx(mK,{children:a.jsxs(FW,{children:[a.jsx(h7,{}),a.jsxs(QH,{children:[a.jsx(Ls,{path:"/",element:a.jsx(vK,{})}),a.jsx(Ls,{path:"/login",element:a.jsx(vOe,{})}),a.jsx(Ls,{path:"/synthetic-users",element:a.jsx(pc,{children:a.jsx(wee,{})})}),a.jsx(Ls,{path:"/synthetic-users/:id",element:a.jsx(pc,{children:a.jsx(n$,{})})}),a.jsx(Ls,{path:"/personas/:id",element:a.jsx(pc,{children:a.jsx(n$,{})})}),a.jsx(Ls,{path:"/focus-groups",element:a.jsx(pc,{children:a.jsx(dEe,{})})}),a.jsx(Ls,{path:"/focus-groups/:id",element:a.jsx(pc,{children:a.jsx(YEe,{})})}),a.jsx(Ls,{path:"/dashboard",element:a.jsx(pc,{children:a.jsx(aOe,{})})}),a.jsx(Ls,{path:"/old-path",element:a.jsx(_R,{to:"/",replace:!0})}),a.jsx(Ls,{path:"*",element:a.jsx(yK,{})})]})]})})})});_M(document.getElementById("root")).render(a.jsx(xOe,{})); diff --git a/dist/assets/index-ImyDGn9B.js b/dist/assets/index-ImyDGn9B.js new file mode 100644 index 00000000..22679abd --- /dev/null +++ b/dist/assets/index-ImyDGn9B.js @@ -0,0 +1,723 @@ +var K_=e=>{throw TypeError(e)};var $x=(e,t,n)=>t.has(e)||K_("Cannot "+n);var pe=(e,t,n)=>($x(e,t,"read from private field"),n?n.call(e):t.get(e)),qt=(e,t,n)=>t.has(e)?K_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Tt=(e,t,n,r)=>($x(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),cr=(e,t,n)=>($x(e,t,"access private method"),n);var Np=(e,t,n,r)=>({set _(s){Tt(e,t,s,n)},get _(){return pe(e,t,r)}});function cB(e,t){for(var n=0;nr[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();var _p=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Gt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Uk={exports:{}},Vv={},Vk={exports:{}},Dt={};/** + * @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 Kh=Symbol.for("react.element"),uB=Symbol.for("react.portal"),dB=Symbol.for("react.fragment"),fB=Symbol.for("react.strict_mode"),hB=Symbol.for("react.profiler"),pB=Symbol.for("react.provider"),mB=Symbol.for("react.context"),gB=Symbol.for("react.forward_ref"),vB=Symbol.for("react.suspense"),yB=Symbol.for("react.memo"),xB=Symbol.for("react.lazy"),X_=Symbol.iterator;function bB(e){return e===null||typeof e!="object"?null:(e=X_&&e[X_]||e["@@iterator"],typeof e=="function"?e:null)}var Wk={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Hk=Object.assign,Gk={};function Bu(e,t,n){this.props=e,this.context=t,this.refs=Gk,this.updater=n||Wk}Bu.prototype.isReactComponent={};Bu.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Bu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function qk(){}qk.prototype=Bu.prototype;function yj(e,t,n){this.props=e,this.context=t,this.refs=Gk,this.updater=n||Wk}var xj=yj.prototype=new qk;xj.constructor=yj;Hk(xj,Bu.prototype);xj.isPureReactComponent=!0;var Y_=Array.isArray,Kk=Object.prototype.hasOwnProperty,bj={current:null},Xk={key:!0,ref:!0,__self:!0,__source:!0};function Yk(e,t,n){var r,s={},a=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(a=""+t.key),t)Kk.call(t,r)&&!Xk.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1>>1,re=T[Z];if(0>>1;Zs(le,q))ses(ce,le)?(T[Z]=ce,T[se]=q,Z=se):(T[Z]=le,T[B]=q,Z=B);else if(ses(ce,q))T[Z]=ce,T[se]=q,Z=se;else break e}}return F}function s(T,F){var q=T.sortIndex-F.sortIndex;return q!==0?q:T.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],u=[],d=1,f=null,h=3,p=!1,g=!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(T){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=T)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function j(T){if(m=!1,w(T),!g)if(n(c)!==null)g=!0,D(S);else{var F=n(u);F!==null&&V(j,F.startTime-T)}}function S(T,F){g=!1,m&&(m=!1,b(P),P=-1),p=!0;var q=h;try{for(w(F),f=n(c);f!==null&&(!(f.expirationTime>F)||T&&!M());){var Z=f.callback;if(typeof Z=="function"){f.callback=null,h=f.priorityLevel;var re=Z(f.expirationTime<=F);F=e.unstable_now(),typeof re=="function"?f.callback=re:f===n(c)&&r(c),w(F)}else r(c);f=n(c)}if(f!==null)var ge=!0;else{var B=n(u);B!==null&&V(j,B.startTime-F),ge=!1}return ge}finally{f=null,h=q,p=!1}}var N=!1,_=null,P=-1,k=5,O=-1;function M(){return!(e.unstable_now()-OT||125Z?(T.sortIndex=q,t(u,T),n(c)===null&&T===n(u)&&(m?(b(P),P=-1):m=!0,V(j,q-Z))):(T.sortIndex=re,t(c,T),g||p||(g=!0,D(S))),T},e.unstable_shouldYield=M,e.unstable_wrapCallback=function(T){var F=h;return function(){var q=h;h=F;try{return T.apply(this,arguments)}finally{h=q}}}})(nT);tT.exports=nT;var kB=tT.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 TB=v,cs=kB;function Ne(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),rb=Object.prototype.hasOwnProperty,$B=/^[: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]*$/,Q_={},J_={};function MB(e){return rb.call(J_,e)?!0:rb.call(Q_,e)?!1:$B.test(e)?J_[e]=!0:(Q_[e]=!0,!1)}function IB(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function RB(e,t,n,r){if(t===null||typeof t>"u"||IB(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function $r(e,t,n,r,s,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var ar={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ar[e]=new $r(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ar[t]=new $r(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ar[e]=new $r(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ar[e]=new $r(e,2,!1,e,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(e){ar[e]=new $r(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ar[e]=new $r(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ar[e]=new $r(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ar[e]=new $r(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ar[e]=new $r(e,5,!1,e.toLowerCase(),null,!1,!1)});var jj=/[\-:]([a-z])/g;function Sj(e){return e[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(e){var t=e.replace(jj,Sj);ar[t]=new $r(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(jj,Sj);ar[t]=new $r(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(jj,Sj);ar[t]=new $r(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ar[e]=new $r(e,1,!1,e.toLowerCase(),null,!1,!1)});ar.xlinkHref=new $r("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ar[e]=new $r(e,1,!1,e.toLowerCase(),null,!0,!0)});function Nj(e,t,n,r){var s=ar.hasOwnProperty(t)?ar[t]:null;(s!==null?s.type!==0:r||!(2l||s[o]!==a[l]){var c=` +`+s[o].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Rx=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ud(e):""}function DB(e){switch(e.tag){case 5:return Ud(e.type);case 16:return Ud("Lazy");case 13:return Ud("Suspense");case 19:return Ud("SuspenseList");case 0:case 2:case 15:return e=Dx(e.type,!1),e;case 11:return e=Dx(e.type.render,!1),e;case 1:return e=Dx(e.type,!0),e;default:return""}}function ob(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case pc:return"Fragment";case hc:return"Portal";case sb:return"Profiler";case _j:return"StrictMode";case ab:return"Suspense";case ib:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case aT:return(e.displayName||"Context")+".Consumer";case sT:return(e._context.displayName||"Context")+".Provider";case Pj:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Aj:return t=e.displayName||null,t!==null?t:ob(e.type)||"Memo";case Di:t=e._payload,e=e._init;try{return ob(e(t))}catch{}}return null}function LB(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ob(t);case 8:return t===_j?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function bo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function oT(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function FB(e){var t=oT(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,a.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Cp(e){e._valueTracker||(e._valueTracker=FB(e))}function lT(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=oT(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Mm(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function lb(e,t){var n=t.checked;return yn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function tP(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=bo(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function cT(e,t){t=t.checked,t!=null&&Nj(e,"checked",t,!1)}function cb(e,t){cT(e,t);var n=bo(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ub(e,t.type,n):t.hasOwnProperty("defaultValue")&&ub(e,t.type,bo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function nP(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ub(e,t,n){(t!=="number"||Mm(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Vd=Array.isArray;function Oc(e,t,n,r){if(e=e.options,t){t={};for(var s=0;s"+t.valueOf().toString()+"",t=Ep.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xf(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jd={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},BB=["Webkit","ms","Moz","O"];Object.keys(Jd).forEach(function(e){BB.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Jd[t]=Jd[e]})});function hT(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Jd.hasOwnProperty(e)&&Jd[e]?(""+t).trim():t+"px"}function pT(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=hT(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var zB=yn({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 hb(e,t){if(t){if(zB[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ne(62))}}function pb(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 mb=null;function Cj(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var gb=null,kc=null,Tc=null;function aP(e){if(e=Zh(e)){if(typeof gb!="function")throw Error(Ne(280));var t=e.stateNode;t&&(t=Kv(t),gb(e.stateNode,e.type,t))}}function mT(e){kc?Tc?Tc.push(e):Tc=[e]:kc=e}function gT(){if(kc){var e=kc,t=Tc;if(Tc=kc=null,aP(e),t)for(e=0;e>>=0,e===0?32:31-(QB(e)/JB|0)|0}var Op=64,kp=4194304;function Wd(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Lm(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=Wd(l):(a&=o,a!==0&&(r=Wd(a)))}else o=n&~s,o!==0?r=Wd(o):a!==0&&(r=Wd(a));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,a=t&-t,s>=a||s===16&&(a&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Xh(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ks(t),e[t]=n}function rz(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=tf),pP=" ",mP=!1;function RT(e,t){switch(e){case"keyup":return kz.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function DT(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var mc=!1;function $z(e,t){switch(e){case"compositionend":return DT(t);case"keypress":return t.which!==32?null:(mP=!0,pP);case"textInput":return e=t.data,e===pP&&mP?null:e;default:return null}}function Mz(e,t){if(mc)return e==="compositionend"||!Rj&&RT(e,t)?(e=MT(),mm=$j=Zi=null,mc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=xP(n)}}function zT(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?zT(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function UT(){for(var e=window,t=Mm();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mm(e.document)}return t}function Dj(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Vz(e){var t=UT(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&zT(n.ownerDocument.documentElement,n)){if(r!==null&&Dj(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,a=Math.min(r.start,s);r=r.end===void 0?a:Math.min(r.end,s),!e.extend&&a>r&&(s=r,r=a,a=s),s=bP(n,a);var o=bP(n,r);s&&o&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,gc=null,jb=null,rf=null,Sb=!1;function wP(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sb||gc==null||gc!==Mm(r)||(r=gc,"selectionStart"in r&&Dj(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),rf&&_f(rf,r)||(rf=r,r=zm(jb,"onSelect"),0xc||(e.current=Eb[xc],Eb[xc]=null,xc--)}function sn(e,t){xc++,Eb[xc]=e.current,e.current=t}var wo={},xr=Mo(wo),zr=Mo(!1),_l=wo;function nu(e,t){var n=e.type.contextTypes;if(!n)return wo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},a;for(a in n)s[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Ur(e){return e=e.childContextTypes,e!=null}function Vm(){dn(zr),dn(xr)}function CP(e,t,n){if(xr.current!==wo)throw Error(Ne(168));sn(xr,t),sn(zr,n)}function ZT(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in t))throw Error(Ne(108,LB(e)||"Unknown",s));return yn({},n,r)}function Wm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||wo,_l=xr.current,sn(xr,e),sn(zr,zr.current),!0}function EP(e,t,n){var r=e.stateNode;if(!r)throw Error(Ne(169));n?(e=ZT(e,t,_l),r.__reactInternalMemoizedMergedChildContext=e,dn(zr),dn(xr),sn(xr,e)):dn(zr),sn(zr,n)}var Ya=null,Xv=!1,Zx=!1;function QT(e){Ya===null?Ya=[e]:Ya.push(e)}function t8(e){Xv=!0,QT(e)}function Io(){if(!Zx&&Ya!==null){Zx=!0;var e=0,t=Zt;try{var n=Ya;for(Zt=1;e>=o,s-=o,Ja=1<<32-Ks(t)+s|n<P?(k=_,_=null):k=_.sibling;var O=h(b,_,w[P],j);if(O===null){_===null&&(_=k);break}e&&_&&O.alternate===null&&t(b,_),x=a(O,x,P),N===null?S=O:N.sibling=O,N=O,_=k}if(P===w.length)return n(b,_),hn&&Xo(b,P),S;if(_===null){for(;PP?(k=_,_=null):k=_.sibling;var M=h(b,_,O.value,j);if(M===null){_===null&&(_=k);break}e&&_&&M.alternate===null&&t(b,_),x=a(M,x,P),N===null?S=M:N.sibling=M,N=M,_=k}if(O.done)return n(b,_),hn&&Xo(b,P),S;if(_===null){for(;!O.done;P++,O=w.next())O=f(b,O.value,j),O!==null&&(x=a(O,x,P),N===null?S=O:N.sibling=O,N=O);return hn&&Xo(b,P),S}for(_=r(b,_);!O.done;P++,O=w.next())O=p(_,b,P,O.value,j),O!==null&&(e&&O.alternate!==null&&_.delete(O.key===null?P:O.key),x=a(O,x,P),N===null?S=O:N.sibling=O,N=O);return e&&_.forEach(function(A){return t(b,A)}),hn&&Xo(b,P),S}function y(b,x,w,j){if(typeof w=="object"&&w!==null&&w.type===pc&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Ap:e:{for(var S=w.key,N=x;N!==null;){if(N.key===S){if(S=w.type,S===pc){if(N.tag===7){n(b,N.sibling),x=s(N,w.props.children),x.return=b,b=x;break e}}else if(N.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Di&&TP(S)===N.type){n(b,N.sibling),x=s(N,w.props),x.ref=Sd(b,N,w),x.return=b,b=x;break e}n(b,N);break}else t(b,N);N=N.sibling}w.type===pc?(x=yl(w.props.children,b.mode,j,w.key),x.return=b,b=x):(j=Sm(w.type,w.key,w.props,null,b.mode,j),j.ref=Sd(b,x,w),j.return=b,b=j)}return o(b);case hc:e:{for(N=w.key;x!==null;){if(x.key===N)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=s(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else t(b,x);x=x.sibling}x=a0(w,b.mode,j),x.return=b,b=x}return o(b);case Di:return N=w._init,y(b,x,N(w._payload),j)}if(Vd(w))return g(b,x,w,j);if(yd(w))return m(b,x,w,j);Lp(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=s(x,w),x.return=b,b=x):(n(b,x),x=s0(w,b.mode,j),x.return=b,b=x),o(b)):n(b,x)}return y}var su=n$(!0),r$=n$(!1),qm=Mo(null),Km=null,jc=null,zj=null;function Uj(){zj=jc=Km=null}function Vj(e){var t=qm.current;dn(qm),e._currentValue=t}function Tb(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Mc(e,t){Km=e,zj=jc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Fr=!0),e.firstContext=null)}function As(e){var t=e._currentValue;if(zj!==e)if(e={context:e,memoizedValue:t,next:null},jc===null){if(Km===null)throw Error(Ne(308));jc=e,Km.dependencies={lanes:0,firstContext:e}}else jc=jc.next=e;return t}var nl=null;function Wj(e){nl===null?nl=[e]:nl.push(e)}function s$(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Wj(t)):(n.next=s.next,s.next=n),t.interleaved=n,hi(e,r)}function hi(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Li=!1;function Hj(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function a$(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ai(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function io(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,zt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,hi(e,n)}return s=r.interleaved,s===null?(t.next=t,Wj(r)):(t.next=s.next,s.next=t),r.interleaved=t,hi(e,n)}function vm(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Oj(e,n)}}function $P(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?s=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?s=a=t:a=a.next=t}else s=a=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Xm(e,t,n,r){var s=e.updateQueue;Li=!1;var a=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,o===null?a=u:o.next=u,o=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==o&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(a!==null){var f=s.baseState;o=0,d=u=c=null,l=a;do{var h=l.lane,p=l.eventTime;if((r&h)===h){d!==null&&(d=d.next={eventTime:p,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,m=l;switch(h=t,p=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){f=g.call(p,f,h);break e}f=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,h=typeof g=="function"?g.call(p,f,h):g,h==null)break e;f=yn({},f,h);break e;case 2:Li=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,h=s.effects,h===null?s.effects=[l]:h.push(l))}else p={eventTime:p,lane:h,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=p,c=f):d=d.next=p,o|=h;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;h=l,l=h.next,h.next=null,s.lastBaseUpdate=h,s.shared.pending=null}}while(!0);if(d===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do o|=s.lane,s=s.next;while(s!==t)}else a===null&&(s.shared.lanes=0);Cl|=o,e.lanes=o,e.memoizedState=f}}function MP(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Jx.transition;Jx.transition={};try{e(!1),t()}finally{Zt=n,Jx.transition=r}}function j$(){return Cs().memoizedState}function a8(e,t,n){var r=lo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},S$(e))N$(t,n);else if(n=s$(e,t,n,r),n!==null){var s=Or();Xs(n,e,r,s),_$(n,t,r)}}function i8(e,t,n){var r=lo(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(S$(e))N$(t,s);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,l=a(o,n);if(s.hasEagerState=!0,s.eagerState=l,na(l,o)){var c=t.interleaved;c===null?(s.next=s,Wj(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=s$(e,t,s,r),n!==null&&(s=Or(),Xs(n,e,r,s),_$(n,t,r))}}function S$(e){var t=e.alternate;return e===vn||t!==null&&t===vn}function N$(e,t){sf=Zm=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _$(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Oj(e,n)}}var Qm={readContext:As,useCallback:ur,useContext:ur,useEffect:ur,useImperativeHandle:ur,useInsertionEffect:ur,useLayoutEffect:ur,useMemo:ur,useReducer:ur,useRef:ur,useState:ur,useDebugValue:ur,useDeferredValue:ur,useTransition:ur,useMutableSource:ur,useSyncExternalStore:ur,useId:ur,unstable_isNewReconciler:!1},o8={readContext:As,useCallback:function(e,t){return ma().memoizedState=[e,t===void 0?null:t],e},useContext:As,useEffect:RP,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,xm(4194308,4,v$.bind(null,t,e),n)},useLayoutEffect:function(e,t){return xm(4194308,4,e,t)},useInsertionEffect:function(e,t){return xm(4,2,e,t)},useMemo:function(e,t){var n=ma();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ma();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=a8.bind(null,vn,e),[r.memoizedState,e]},useRef:function(e){var t=ma();return e={current:e},t.memoizedState=e},useState:IP,useDebugValue:Jj,useDeferredValue:function(e){return ma().memoizedState=e},useTransition:function(){var e=IP(!1),t=e[0];return e=s8.bind(null,e[1]),ma().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=vn,s=ma();if(hn){if(n===void 0)throw Error(Ne(407));n=n()}else{if(n=t(),er===null)throw Error(Ne(349));Al&30||c$(r,t,n)}s.memoizedState=n;var a={value:n,getSnapshot:t};return s.queue=a,RP(d$.bind(null,r,a,e),[e]),r.flags|=2048,$f(9,u$.bind(null,r,a,n,t),void 0,null),n},useId:function(){var e=ma(),t=er.identifierPrefix;if(hn){var n=ei,r=Ja;n=(r&~(1<<32-Ks(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=kf++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[ba]=t,e[Cf]=r,I$(e,t,!1,!1),t.stateNode=e;e:{switch(o=pb(n,r),n){case"dialog":ln("cancel",e),ln("close",e),s=r;break;case"iframe":case"object":case"embed":ln("load",e),s=r;break;case"video":case"audio":for(s=0;sou&&(t.flags|=128,r=!0,Nd(a,!1),t.lanes=4194304)}else{if(!r)if(e=Ym(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Nd(a,!0),a.tail===null&&a.tailMode==="hidden"&&!o.alternate&&!hn)return dr(t),null}else 2*Cn()-a.renderingStartTime>ou&&n!==1073741824&&(t.flags|=128,r=!0,Nd(a,!1),t.lanes=4194304);a.isBackwards?(o.sibling=t.child,t.child=o):(n=a.last,n!==null?n.sibling=o:t.child=o,a.last=o)}return a.tail!==null?(t=a.tail,a.rendering=t,a.tail=t.sibling,a.renderingStartTime=Cn(),t.sibling=null,n=gn.current,sn(gn,r?n&1|2:n&1),t):(dr(t),null);case 22:case 23:return aS(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Jr&1073741824&&(dr(t),t.subtreeFlags&6&&(t.flags|=8192)):dr(t),null;case 24:return null;case 25:return null}throw Error(Ne(156,t.tag))}function m8(e,t){switch(Fj(t),t.tag){case 1:return Ur(t.type)&&Vm(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return au(),dn(zr),dn(xr),Kj(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return qj(t),null;case 13:if(dn(gn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ne(340));ru()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return dn(gn),null;case 4:return au(),null;case 10:return Vj(t.type._context),null;case 22:case 23:return aS(),null;case 24:return null;default:return null}}var Bp=!1,gr=!1,g8=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function Sc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){wn(e,t,r)}else n.current=null}function zb(e,t,n){try{n()}catch(r){wn(e,t,r)}}var qP=!1;function v8(e,t){if(Nb=Fm,e=UT(),Dj(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,u=0,d=0,f=e,h=null;t:for(;;){for(var p;f!==n||s!==0&&f.nodeType!==3||(l=o+s),f!==a||r!==0&&f.nodeType!==3||(c=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===e)break t;if(h===n&&++u===s&&(l=o),h===a&&++d===r&&(c=o),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(_b={focusedElem:e,selectionRange:n},Fm=!1,Ve=t;Ve!==null;)if(t=Ve,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ve=e;else for(;Ve!==null;){t=Ve;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,y=g.memoizedState,b=t.stateNode,x=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:Ds(t.type,m),y);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.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(Ne(163))}}catch(j){wn(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,Ve=e;break}Ve=t.return}return g=qP,qP=!1,g}function af(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var a=s.destroy;s.destroy=void 0,a!==void 0&&zb(t,n,a)}s=s.next}while(s!==r)}}function Qv(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Ub(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function L$(e){var t=e.alternate;t!==null&&(e.alternate=null,L$(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ba],delete t[Cf],delete t[Cb],delete t[Jz],delete t[e8])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function F$(e){return e.tag===5||e.tag===3||e.tag===4}function KP(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||F$(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Vb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Um));else if(r!==4&&(e=e.child,e!==null))for(Vb(e,t,n),e=e.sibling;e!==null;)Vb(e,t,n),e=e.sibling}function Wb(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Wb(e,t,n),e=e.sibling;e!==null;)Wb(e,t,n),e=e.sibling}var rr=null,Bs=!1;function ki(e,t,n){for(n=n.child;n!==null;)B$(e,t,n),n=n.sibling}function B$(e,t,n){if(_a&&typeof _a.onCommitFiberUnmount=="function")try{_a.onCommitFiberUnmount(Wv,n)}catch{}switch(n.tag){case 5:gr||Sc(n,t);case 6:var r=rr,s=Bs;rr=null,ki(e,t,n),rr=r,Bs=s,rr!==null&&(Bs?(e=rr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):rr.removeChild(n.stateNode));break;case 18:rr!==null&&(Bs?(e=rr,n=n.stateNode,e.nodeType===8?Yx(e.parentNode,n):e.nodeType===1&&Yx(e,n),Sf(e)):Yx(rr,n.stateNode));break;case 4:r=rr,s=Bs,rr=n.stateNode.containerInfo,Bs=!0,ki(e,t,n),rr=r,Bs=s;break;case 0:case 11:case 14:case 15:if(!gr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var a=s,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&zb(n,t,o),s=s.next}while(s!==r)}ki(e,t,n);break;case 1:if(!gr&&(Sc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){wn(n,t,l)}ki(e,t,n);break;case 21:ki(e,t,n);break;case 22:n.mode&1?(gr=(r=gr)||n.memoizedState!==null,ki(e,t,n),gr=r):ki(e,t,n);break;default:ki(e,t,n)}}function XP(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new g8),t.forEach(function(r){var s=P8.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function $s(e,t){var n=t.deletions;if(n!==null)for(var r=0;rs&&(s=o),r&=~a}if(r=s,r=Cn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*x8(r/1960))-r,10e?16:e,Qi===null)var r=!1;else{if(e=Qi,Qi=null,tg=0,zt&6)throw Error(Ne(331));var s=zt;for(zt|=4,Ve=e.current;Ve!==null;){var a=Ve,o=a.child;if(Ve.flags&16){var l=a.deletions;if(l!==null){for(var c=0;cCn()-rS?vl(e,0):nS|=n),Vr(e,t)}function K$(e,t){t===0&&(e.mode&1?(t=kp,kp<<=1,!(kp&130023424)&&(kp=4194304)):t=1);var n=Or();e=hi(e,t),e!==null&&(Xh(e,t,n),Vr(e,n))}function _8(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),K$(e,n)}function P8(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,s=e.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(Ne(314))}r!==null&&r.delete(t),K$(e,n)}var X$;X$=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||zr.current)Fr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Fr=!1,h8(e,t,n);Fr=!!(e.flags&131072)}else Fr=!1,hn&&t.flags&1048576&&JT(t,Gm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;bm(e,t),e=t.pendingProps;var s=nu(t,xr.current);Mc(t,n),s=Yj(null,t,r,e,s,n);var a=Zj();return t.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Ur(r)?(a=!0,Wm(t)):a=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Hj(t),s.updater=Zv,t.stateNode=s,s._reactInternals=t,Mb(t,r,e,n),t=Db(null,t,r,!0,a,n)):(t.tag=0,hn&&a&&Lj(t),Nr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(bm(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=C8(r),e=Ds(r,e),s){case 0:t=Rb(null,t,r,e,n);break e;case 1:t=WP(null,t,r,e,n);break e;case 11:t=UP(null,t,r,e,n);break e;case 14:t=VP(null,t,r,Ds(r.type,e),n);break e}throw Error(Ne(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ds(r,s),Rb(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ds(r,s),WP(e,t,r,s,n);case 3:e:{if(T$(t),e===null)throw Error(Ne(387));r=t.pendingProps,a=t.memoizedState,s=a.element,a$(e,t),Xm(t,r,null,n);var o=t.memoizedState;if(r=o.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){s=iu(Error(Ne(423)),t),t=HP(e,t,r,n,s);break e}else if(r!==s){s=iu(Error(Ne(424)),t),t=HP(e,t,r,n,s);break e}else for(ss=ao(t.stateNode.containerInfo.firstChild),as=t,hn=!0,Ws=null,n=r$(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ru(),r===s){t=pi(e,t,n);break e}Nr(e,t,r,n)}t=t.child}return t;case 5:return i$(t),e===null&&kb(t),r=t.type,s=t.pendingProps,a=e!==null?e.memoizedProps:null,o=s.children,Pb(r,s)?o=null:a!==null&&Pb(r,a)&&(t.flags|=32),k$(e,t),Nr(e,t,o,n),t.child;case 6:return e===null&&kb(t),null;case 13:return $$(e,t,n);case 4:return Gj(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=su(t,null,r,n):Nr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ds(r,s),UP(e,t,r,s,n);case 7:return Nr(e,t,t.pendingProps,n),t.child;case 8:return Nr(e,t,t.pendingProps.children,n),t.child;case 12:return Nr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,a=t.memoizedProps,o=s.value,sn(qm,r._currentValue),r._currentValue=o,a!==null)if(na(a.value,o)){if(a.children===s.children&&!zr.current){t=pi(e,t,n);break e}}else for(a=t.child,a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){o=a.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(a.tag===1){c=ai(-1,n&-n),c.tag=2;var u=a.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Tb(a.return,n,t),l.lanes|=n;break}c=c.next}}else if(a.tag===10)o=a.type===t.type?null:a.child;else if(a.tag===18){if(o=a.return,o===null)throw Error(Ne(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Tb(o,n,t),o=a.sibling}else o=a.child;if(o!==null)o.return=a;else for(o=a;o!==null;){if(o===t){o=null;break}if(a=o.sibling,a!==null){a.return=o.return,o=a;break}o=o.return}a=o}Nr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Mc(t,n),s=As(s),r=r(s),t.flags|=1,Nr(e,t,r,n),t.child;case 14:return r=t.type,s=Ds(r,t.pendingProps),s=Ds(r.type,s),VP(e,t,r,s,n);case 15:return E$(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ds(r,s),bm(e,t),t.tag=1,Ur(r)?(e=!0,Wm(t)):e=!1,Mc(t,n),P$(t,r,s),Mb(t,r,s,n),Db(null,t,r,!0,e,n);case 19:return M$(e,t,n);case 22:return O$(e,t,n)}throw Error(Ne(156,t.tag))};function Y$(e,t){return ST(e,t)}function A8(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,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 js(e,t,n,r){return new A8(e,t,n,r)}function oS(e){return e=e.prototype,!(!e||!e.isReactComponent)}function C8(e){if(typeof e=="function")return oS(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Pj)return 11;if(e===Aj)return 14}return 2}function co(e,t){var n=e.alternate;return n===null?(n=js(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Sm(e,t,n,r,s,a){var o=2;if(r=e,typeof e=="function")oS(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case pc:return yl(n.children,s,a,t);case _j:o=8,s|=8;break;case sb:return e=js(12,n,t,s|2),e.elementType=sb,e.lanes=a,e;case ab:return e=js(13,n,t,s),e.elementType=ab,e.lanes=a,e;case ib:return e=js(19,n,t,s),e.elementType=ib,e.lanes=a,e;case iT:return ey(n,s,a,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case sT:o=10;break e;case aT:o=9;break e;case Pj:o=11;break e;case Aj:o=14;break e;case Di:o=16,r=null;break e}throw Error(Ne(130,e==null?e:typeof e,""))}return t=js(o,n,t,s),t.elementType=e,t.type=r,t.lanes=a,t}function yl(e,t,n,r){return e=js(7,e,r,t),e.lanes=n,e}function ey(e,t,n,r){return e=js(22,e,r,t),e.elementType=iT,e.lanes=n,e.stateNode={isHidden:!1},e}function s0(e,t,n){return e=js(6,e,null,t),e.lanes=n,e}function a0(e,t,n){return t=js(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function E8(e,t,n,r,s){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Fx(0),this.expirationTimes=Fx(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Fx(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function lS(e,t,n,r,s,a,o,l,c){return e=new E8(e,t,n,l,c),t===1?(t=1,a===!0&&(t|=8)):t=0,a=js(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Hj(a),e}function O8(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(eM)}catch(e){console.error(e)}}eM(),eT.exports=us;var Vu=eT.exports;const tM=Gt(Vu);var nM,rA=Vu;nM=rA.createRoot,rA.hydrateRoot;var sA=["light","dark"],I8="(prefers-color-scheme: dark)",R8=v.createContext(void 0),D8={setTheme:e=>{},themes:[]},L8=()=>{var e;return(e=v.useContext(R8))!=null?e:D8};v.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:a,value:o,attrs:l,nonce:c})=>{let u=a==="system",d=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(g=>`'${g}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,f=s?sA.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",h=(g,m=!1,y=!0)=>{let b=o?o[g]:g,x=m?g+"|| ''":`'${b}'`,w="";return s&&y&&!m&&sA.includes(g)&&(w+=`d.style.colorScheme = '${g}';`),n==="class"?m||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},p=e?`!function(){${d}${h(e)}}()`:r?`!function(){try{${d}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${u})){var t='${I8}',m=window.matchMedia(t);if(m.media!==t||m.matches){${h("dark")}}else{${h("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}${u?"":"else{"+h(a,!1,!1)+"}"}${f}}catch(e){}}()`:`!function(){try{${d}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${h(o?"x[e]":"e",!0)}}else{${h(a,!1,!1)};}${f}}catch(t){}}();`;return v.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:p}})});var F8=e=>{switch(e){case"success":return U8;case"info":return W8;case"warning":return V8;case"error":return H8;default:return null}},B8=Array(12).fill(0),z8=({visible:e})=>E.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},E.createElement("div",{className:"sonner-spinner"},B8.map((t,n)=>E.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),U8=E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},E.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"})),V8=E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},E.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"})),W8=E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},E.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"})),H8=E.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},E.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"})),G8=()=>{let[e,t]=E.useState(document.hidden);return E.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Xb=1,q8=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Xb++,a=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return a?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:n}),{...l,...e,id:s,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:s}),s},this.dismiss=e=>(e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let r=e instanceof Promise?e:e(),s=n!==void 0;return r.then(async a=>{if(X8(a)&&!a.ok){s=!1;let o=typeof t.error=="function"?await t.error(`HTTP error! status: ${a.status}`):t.error,l=typeof t.description=="function"?await t.description(`HTTP error! status: ${a.status}`):t.description;this.create({id:n,type:"error",message:o,description:l})}else if(t.success!==void 0){s=!1;let o=typeof t.success=="function"?await t.success(a):t.success,l=typeof t.description=="function"?await t.description(a):t.description;this.create({id:n,type:"success",message:o,description:l})}}).catch(async a=>{if(t.error!==void 0){s=!1;let o=typeof t.error=="function"?await t.error(a):t.error,l=typeof t.description=="function"?await t.description(a):t.description;this.create({id:n,type:"error",message:o,description:l})}}).finally(()=>{var a;s&&(this.dismiss(n),n=void 0),(a=t.finally)==null||a.call(t)}),n},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||Xb++;return this.create({jsx:e(n),id:n,...t}),n},this.subscribers=[],this.toasts=[]}},Qr=new q8,K8=(e,t)=>{let n=(t==null?void 0:t.id)||Xb++;return Qr.addToast({title:e,...t,id:n}),n},X8=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Y8=K8,Z8=()=>Qr.toasts,oe=Object.assign(Y8,{success:Qr.success,info:Qr.info,warning:Qr.warning,error:Qr.error,custom:Qr.custom,message:Qr.message,promise:Qr.promise,dismiss:Qr.dismiss,loading:Qr.loading},{getHistory:Z8});function Q8(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Q8(`: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 Vp(e){return e.label!==void 0}var J8=3,eU="32px",tU=4e3,nU=356,rU=14,sU=20,aU=200;function iU(...e){return e.filter(Boolean).join(" ")}var oU=e=>{var t,n,r,s,a,o,l,c,u,d;let{invert:f,toast:h,unstyled:p,interacting:g,setHeights:m,visibleToasts:y,heights:b,index:x,toasts:w,expanded:j,removeToast:S,defaultRichColors:N,closeButton:_,style:P,cancelButtonStyle:k,actionButtonStyle:O,className:M="",descriptionClassName:A="",duration:$,position:L,gap:H,loadingIcon:D,expandByDefault:V,classNames:T,icons:F,closeButtonAriaLabel:q="Close toast",pauseWhenPageIsHidden:Z,cn:re}=e,[ge,B]=E.useState(!1),[le,se]=E.useState(!1),[ce,De]=E.useState(!1),[de,be]=E.useState(!1),[Pe,ne]=E.useState(0),[Je,ve]=E.useState(0),at=E.useRef(null),st=E.useRef(null),Mt=x===0,C=x+1<=y,R=h.type,U=h.dismissible!==!1,X=h.className||"",Q=h.descriptionClassName||"",z=E.useMemo(()=>b.findIndex(pt=>pt.toastId===h.id)||0,[b,h.id]),ee=E.useMemo(()=>{var pt;return(pt=h.closeButton)!=null?pt:_},[h.closeButton,_]),me=E.useMemo(()=>h.duration||$||tU,[h.duration,$]),Se=E.useRef(0),Ie=E.useRef(0),we=E.useRef(0),ze=E.useRef(null),[gt,jt]=L.split("-"),Ge=E.useMemo(()=>b.reduce((pt,tt,it)=>it>=z?pt:pt+tt.height,0),[b,z]),Ze=G8(),kt=h.invert||f,Vt=R==="loading";Ie.current=E.useMemo(()=>z*H+Ge,[z,Ge]),E.useEffect(()=>{B(!0)},[]),E.useLayoutEffect(()=>{if(!ge)return;let pt=st.current,tt=pt.style.height;pt.style.height="auto";let it=pt.getBoundingClientRect().height;pt.style.height=tt,ve(it),m(Lt=>Lt.find(tn=>tn.toastId===h.id)?Lt.map(tn=>tn.toastId===h.id?{...tn,height:it}:tn):[{toastId:h.id,height:it,position:h.position},...Lt])},[ge,h.title,h.description,m,h.id]);let Xn=E.useCallback(()=>{se(!0),ne(Ie.current),m(pt=>pt.filter(tt=>tt.toastId!==h.id)),setTimeout(()=>{S(h)},aU)},[h,S,m,Ie]);E.useEffect(()=>{if(h.promise&&R==="loading"||h.duration===1/0||h.type==="loading")return;let pt,tt=me;return j||g||Z&&Ze?(()=>{if(we.current{var it;(it=h.onAutoClose)==null||it.call(h,h),Xn()},tt)),()=>clearTimeout(pt)},[j,g,V,h,me,Xn,h.promise,R,Z,Ze]),E.useEffect(()=>{let pt=st.current;if(pt){let tt=pt.getBoundingClientRect().height;return ve(tt),m(it=>[{toastId:h.id,height:tt,position:h.position},...it]),()=>m(it=>it.filter(Lt=>Lt.toastId!==h.id))}},[m,h.id]),E.useEffect(()=>{h.delete&&Xn()},[Xn,h.delete]);function an(){return F!=null&&F.loading?E.createElement("div",{className:"sonner-loader","data-visible":R==="loading"},F.loading):D?E.createElement("div",{className:"sonner-loader","data-visible":R==="loading"},D):E.createElement(z8,{visible:R==="loading"})}return E.createElement("li",{"aria-live":h.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:st,className:re(M,X,T==null?void 0:T.toast,(t=h==null?void 0:h.classNames)==null?void 0:t.toast,T==null?void 0:T.default,T==null?void 0:T[R],(n=h==null?void 0:h.classNames)==null?void 0:n[R]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:N,"data-styled":!(h.jsx||h.unstyled||p),"data-mounted":ge,"data-promise":!!h.promise,"data-removed":le,"data-visible":C,"data-y-position":gt,"data-x-position":jt,"data-index":x,"data-front":Mt,"data-swiping":ce,"data-dismissible":U,"data-type":R,"data-invert":kt,"data-swipe-out":de,"data-expanded":!!(j||V&&ge),style:{"--index":x,"--toasts-before":x,"--z-index":w.length-x,"--offset":`${le?Pe:Ie.current}px`,"--initial-height":V?"auto":`${Je}px`,...P,...h.style},onPointerDown:pt=>{Vt||!U||(at.current=new Date,ne(Ie.current),pt.target.setPointerCapture(pt.pointerId),pt.target.tagName!=="BUTTON"&&(De(!0),ze.current={x:pt.clientX,y:pt.clientY}))},onPointerUp:()=>{var pt,tt,it,Lt;if(de||!U)return;ze.current=null;let tn=Number(((pt=st.current)==null?void 0:pt.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Xr=new Date().getTime()-((tt=at.current)==null?void 0:tt.getTime()),za=Math.abs(tn)/Xr;if(Math.abs(tn)>=sU||za>.11){ne(Ie.current),(it=h.onDismiss)==null||it.call(h,h),Xn(),be(!0);return}(Lt=st.current)==null||Lt.style.setProperty("--swipe-amount","0px"),De(!1)},onPointerMove:pt=>{var tt;if(!ze.current||!U)return;let it=pt.clientY-ze.current.y,Lt=pt.clientX-ze.current.x,tn=(gt==="top"?Math.min:Math.max)(0,it),Xr=pt.pointerType==="touch"?10:2;Math.abs(tn)>Xr?(tt=st.current)==null||tt.style.setProperty("--swipe-amount",`${it}px`):Math.abs(Lt)>Xr&&(ze.current=null)}},ee&&!h.jsx?E.createElement("button",{"aria-label":q,"data-disabled":Vt,"data-close-button":!0,onClick:Vt||!U?()=>{}:()=>{var pt;Xn(),(pt=h.onDismiss)==null||pt.call(h,h)},className:re(T==null?void 0:T.closeButton,(s=h==null?void 0:h.classNames)==null?void 0:s.closeButton)},E.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"},E.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),E.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,h.jsx||E.isValidElement(h.title)?h.jsx||h.title:E.createElement(E.Fragment,null,R||h.icon||h.promise?E.createElement("div",{"data-icon":"",className:re(T==null?void 0:T.icon,(a=h==null?void 0:h.classNames)==null?void 0:a.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||an():null,h.type!=="loading"?h.icon||(F==null?void 0:F[R])||F8(R):null):null,E.createElement("div",{"data-content":"",className:re(T==null?void 0:T.content,(o=h==null?void 0:h.classNames)==null?void 0:o.content)},E.createElement("div",{"data-title":"",className:re(T==null?void 0:T.title,(l=h==null?void 0:h.classNames)==null?void 0:l.title)},h.title),h.description?E.createElement("div",{"data-description":"",className:re(A,Q,T==null?void 0:T.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},h.description):null),E.isValidElement(h.cancel)?h.cancel:h.cancel&&Vp(h.cancel)?E.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||k,onClick:pt=>{var tt,it;Vp(h.cancel)&&U&&((it=(tt=h.cancel).onClick)==null||it.call(tt,pt),Xn())},className:re(T==null?void 0:T.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,E.isValidElement(h.action)?h.action:h.action&&Vp(h.action)?E.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||O,onClick:pt=>{var tt,it;Vp(h.action)&&(pt.defaultPrevented||((it=(tt=h.action).onClick)==null||it.call(tt,pt),Xn()))},className:re(T==null?void 0:T.actionButton,(d=h==null?void 0:h.classNames)==null?void 0:d.actionButton)},h.action.label):null))};function aA(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var lU=e=>{let{invert:t,position:n="bottom-right",hotkey:r=["altKey","KeyT"],expand:s,closeButton:a,className:o,offset:l,theme:c="light",richColors:u,duration:d,style:f,visibleToasts:h=J8,toastOptions:p,dir:g=aA(),gap:m=rU,loadingIcon:y,icons:b,containerAriaLabel:x="Notifications",pauseWhenPageIsHidden:w,cn:j=iU}=e,[S,N]=E.useState([]),_=E.useMemo(()=>Array.from(new Set([n].concat(S.filter(Z=>Z.position).map(Z=>Z.position)))),[S,n]),[P,k]=E.useState([]),[O,M]=E.useState(!1),[A,$]=E.useState(!1),[L,H]=E.useState(c!=="system"?c:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),D=E.useRef(null),V=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),T=E.useRef(null),F=E.useRef(!1),q=E.useCallback(Z=>{var re;(re=S.find(ge=>ge.id===Z.id))!=null&&re.delete||Qr.dismiss(Z.id),N(ge=>ge.filter(({id:B})=>B!==Z.id))},[S]);return E.useEffect(()=>Qr.subscribe(Z=>{if(Z.dismiss){N(re=>re.map(ge=>ge.id===Z.id?{...ge,delete:!0}:ge));return}setTimeout(()=>{tM.flushSync(()=>{N(re=>{let ge=re.findIndex(B=>B.id===Z.id);return ge!==-1?[...re.slice(0,ge),{...re[ge],...Z},...re.slice(ge+1)]:[Z,...re]})})})}),[]),E.useEffect(()=>{if(c!=="system"){H(c);return}c==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?H("dark"):H("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:Z})=>{H(Z?"dark":"light")})},[c]),E.useEffect(()=>{S.length<=1&&M(!1)},[S]),E.useEffect(()=>{let Z=re=>{var ge,B;r.every(le=>re[le]||re.code===le)&&(M(!0),(ge=D.current)==null||ge.focus()),re.code==="Escape"&&(document.activeElement===D.current||(B=D.current)!=null&&B.contains(document.activeElement))&&M(!1)};return document.addEventListener("keydown",Z),()=>document.removeEventListener("keydown",Z)},[r]),E.useEffect(()=>{if(D.current)return()=>{T.current&&(T.current.focus({preventScroll:!0}),T.current=null,F.current=!1)}},[D.current]),S.length?E.createElement("section",{"aria-label":`${x} ${V}`,tabIndex:-1},_.map((Z,re)=>{var ge;let[B,le]=Z.split("-");return E.createElement("ol",{key:Z,dir:g==="auto"?aA():g,tabIndex:-1,ref:D,className:o,"data-sonner-toaster":!0,"data-theme":L,"data-y-position":B,"data-x-position":le,style:{"--front-toast-height":`${((ge=P[0])==null?void 0:ge.height)||0}px`,"--offset":typeof l=="number"?`${l}px`:l||eU,"--width":`${nU}px`,"--gap":`${m}px`,...f},onBlur:se=>{F.current&&!se.currentTarget.contains(se.relatedTarget)&&(F.current=!1,T.current&&(T.current.focus({preventScroll:!0}),T.current=null))},onFocus:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||F.current||(F.current=!0,T.current=se.relatedTarget)},onMouseEnter:()=>M(!0),onMouseMove:()=>M(!0),onMouseLeave:()=>{A||M(!1)},onPointerDown:se=>{se.target instanceof HTMLElement&&se.target.dataset.dismissible==="false"||$(!0)},onPointerUp:()=>$(!1)},S.filter(se=>!se.position&&re===0||se.position===Z).map((se,ce)=>{var De,de;return E.createElement(oU,{key:se.id,icons:b,index:ce,toast:se,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:t,visibleToasts:h,closeButton:(de=p==null?void 0:p.closeButton)!=null?de:a,interacting:A,position:Z,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:S.filter(be=>be.position==se.position),heights:P.filter(be=>be.position==se.position),setHeights:k,expandByDefault:s,gap:m,loadingIcon:y,expanded:O,pauseWhenPageIsHidden:w,cn:j})}))})):null};const cU=({...e})=>{const{theme:t="system"}=L8();return i.jsx(lU,{theme:t,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"}},...e})};function Ee(e,t,{checkForDefaultPrevented:n=!0}={}){return function(s){if(e==null||e(s),n===!1||!s.defaultPrevented)return t==null?void 0:t(s)}}function uU(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function ay(...e){return t=>e.forEach(n=>uU(n,t))}function xt(...e){return v.useCallback(ay(...e),e)}function dU(e,t){const n=v.createContext(t),r=a=>{const{children:o,...l}=a,c=v.useMemo(()=>l,Object.values(l));return i.jsx(n.Provider,{value:c,children:o})};r.displayName=e+"Provider";function s(a){const o=v.useContext(n);if(o)return o;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,s]}function Gr(e,t=[]){let n=[];function r(a,o){const l=v.createContext(o),c=n.length;n=[...n,o];const u=f=>{var b;const{scope:h,children:p,...g}=f,m=((b=h==null?void 0:h[e])==null?void 0:b[c])||l,y=v.useMemo(()=>g,Object.values(g));return i.jsx(m.Provider,{value:y,children:p})};u.displayName=a+"Provider";function d(f,h){var m;const p=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const s=()=>{const a=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,fU(s,...t)]}function fU(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var mi=v.forwardRef((e,t)=>{const{children:n,...r}=e,s=v.Children.toArray(n),a=s.find(hU);if(a){const o=a.props.children,l=s.map(c=>c===a?v.Children.count(o)>1?v.Children.only(null):v.isValidElement(o)?o.props.children:null:c);return i.jsx(Yb,{...r,ref:t,children:v.isValidElement(o)?v.cloneElement(o,void 0,l):null})}return i.jsx(Yb,{...r,ref:t,children:n})});mi.displayName="Slot";var Yb=v.forwardRef((e,t)=>{const{children:n,...r}=e;if(v.isValidElement(n)){const s=mU(n);return v.cloneElement(n,{...pU(r,n.props),ref:t?ay(t,s):s})}return v.Children.count(n)>1?v.Children.only(null):null});Yb.displayName="SlotClone";var fS=({children:e})=>i.jsx(i.Fragment,{children:e});function hU(e){return v.isValidElement(e)&&e.type===fS}function pU(e,t){const n={...t};for(const r in t){const s=e[r],a=t[r];/^on[A-Z]/.test(r)?s&&a?n[r]=(...l)=>{a(...l),s(...l)}:s&&(n[r]=s):r==="style"?n[r]={...s,...a}:r==="className"&&(n[r]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function mU(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var gU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ye=gU.reduce((e,t)=>{const n=v.forwardRef((r,s)=>{const{asChild:a,...o}=r,l=a?mi:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),i.jsx(l,{...o,ref:s})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function rM(e,t){e&&Vu.flushSync(()=>e.dispatchEvent(t))}function Hn(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function vU(e,t=globalThis==null?void 0:globalThis.document){const n=Hn(e);v.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var yU="DismissableLayer",Zb="dismissableLayer.update",xU="dismissableLayer.pointerDownOutside",bU="dismissableLayer.focusOutside",iA,sM=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Jh=v.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:o,onDismiss:l,...c}=e,u=v.useContext(sM),[d,f]=v.useState(null),h=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=v.useState({}),g=xt(t,_=>f(_)),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,j=x>=b,S=SU(_=>{const P=_.target,k=[...u.branches].some(O=>O.contains(P));!j||k||(s==null||s(_),o==null||o(_),_.defaultPrevented||l==null||l())},h),N=NU(_=>{const P=_.target;[...u.branches].some(O=>O.contains(P))||(a==null||a(_),o==null||o(_),_.defaultPrevented||l==null||l())},h);return vU(_=>{x===u.layers.size-1&&(r==null||r(_),!_.defaultPrevented&&l&&(_.preventDefault(),l()))},h),v.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(iA=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),oA(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=iA)}},[d,h,n,u]),v.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),oA())},[d,u]),v.useEffect(()=>{const _=()=>p({});return document.addEventListener(Zb,_),()=>document.removeEventListener(Zb,_)},[]),i.jsx(Ye.div,{...c,ref:g,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:Ee(e.onFocusCapture,N.onFocusCapture),onBlurCapture:Ee(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:Ee(e.onPointerDownCapture,S.onPointerDownCapture)})});Jh.displayName=yU;var wU="DismissableLayerBranch",jU=v.forwardRef((e,t)=>{const n=v.useContext(sM),r=v.useRef(null),s=xt(t,r);return v.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),i.jsx(Ye.div,{...e,ref:s})});jU.displayName=wU;function SU(e,t=globalThis==null?void 0:globalThis.document){const n=Hn(e),r=v.useRef(!1),s=v.useRef(()=>{});return v.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let c=function(){aM(xU,n,u,{discrete:!0})};const u={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(o),t.removeEventListener("pointerdown",a),t.removeEventListener("click",s.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function NU(e,t=globalThis==null?void 0:globalThis.document){const n=Hn(e),r=v.useRef(!1);return v.useEffect(()=>{const s=a=>{a.target&&!r.current&&aM(bU,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function oA(){const e=new CustomEvent(Zb);document.dispatchEvent(e)}function aM(e,t,n,{discrete:r}){const s=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&s.addEventListener(e,t,{once:!0}),r?rM(s,a):s.dispatchEvent(a)}var ir=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},_U=Qk.useId||(()=>{}),PU=0;function Ys(e){const[t,n]=v.useState(_U());return ir(()=>{n(r=>r??String(PU++))},[e]),t?`radix-${t}`:""}const AU=["top","right","bottom","left"],jo=Math.min,ns=Math.max,sg=Math.round,Wp=Math.floor,So=e=>({x:e,y:e}),CU={left:"right",right:"left",bottom:"top",top:"bottom"},EU={start:"end",end:"start"};function Qb(e,t,n){return ns(e,jo(t,n))}function gi(e,t){return typeof e=="function"?e(t):e}function vi(e){return e.split("-")[0]}function Wu(e){return e.split("-")[1]}function hS(e){return e==="x"?"y":"x"}function pS(e){return e==="y"?"height":"width"}function No(e){return["top","bottom"].includes(vi(e))?"y":"x"}function mS(e){return hS(No(e))}function OU(e,t,n){n===void 0&&(n=!1);const r=Wu(e),s=mS(e),a=pS(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(o=ag(o)),[o,ag(o)]}function kU(e){const t=ag(e);return[Jb(e),t,Jb(t)]}function Jb(e){return e.replace(/start|end/g,t=>EU[t])}function TU(e,t,n){const r=["left","right"],s=["right","left"],a=["top","bottom"],o=["bottom","top"];switch(e){case"top":case"bottom":return n?t?s:r:t?r:s;case"left":case"right":return t?a:o;default:return[]}}function $U(e,t,n,r){const s=Wu(e);let a=TU(vi(e),n==="start",r);return s&&(a=a.map(o=>o+"-"+s),t&&(a=a.concat(a.map(Jb)))),a}function ag(e){return e.replace(/left|right|bottom|top/g,t=>CU[t])}function MU(e){return{top:0,right:0,bottom:0,left:0,...e}}function iM(e){return typeof e!="number"?MU(e):{top:e,right:e,bottom:e,left:e}}function ig(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function lA(e,t,n){let{reference:r,floating:s}=e;const a=No(t),o=mS(t),l=pS(o),c=vi(t),u=a==="y",d=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,h=r[l]/2-s[l]/2;let p;switch(c){case"top":p={x:d,y:r.y-s.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-s.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Wu(t)){case"start":p[o]-=h*(n&&u?-1:1);break;case"end":p[o]+=h*(n&&u?-1:1);break}return p}const IU=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=n,l=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let u=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=lA(u,r,c),h=r,p={},g=0;for(let m=0;m({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:a,platform:o,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=gi(e,t)||{};if(u==null)return{};const f=iM(d),h={x:n,y:r},p=mS(s),g=pS(p),m=await o.getDimensions(u),y=p==="y",b=y?"top":"left",x=y?"bottom":"right",w=y?"clientHeight":"clientWidth",j=a.reference[g]+a.reference[p]-h[p]-a.floating[g],S=h[p]-a.reference[p],N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u));let _=N?N[w]:0;(!_||!await(o.isElement==null?void 0:o.isElement(N)))&&(_=l.floating[w]||a.floating[g]);const P=j/2-S/2,k=_/2-m[g]/2-1,O=jo(f[b],k),M=jo(f[x],k),A=O,$=_-m[g]-M,L=_/2-m[g]/2+P,H=Qb(A,L,$),D=!c.arrow&&Wu(s)!=null&&L!==H&&a.reference[g]/2-(LL<=0)){var M,A;const L=(((M=a.flip)==null?void 0:M.index)||0)+1,H=_[L];if(H)return{data:{index:L,overflows:O},reset:{placement:H}};let D=(A=O.filter(V=>V.overflows[0]<=0).sort((V,T)=>V.overflows[1]-T.overflows[1])[0])==null?void 0:A.placement;if(!D)switch(p){case"bestFit":{var $;const V=($=O.filter(T=>{if(N){const F=No(T.placement);return F===x||F==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(F=>F>0).reduce((F,q)=>F+q,0)]).sort((T,F)=>T[1]-F[1])[0])==null?void 0:$[0];V&&(D=V);break}case"initialPlacement":D=l;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function cA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uA(e){return AU.some(t=>e[t]>=0)}const LU=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...s}=gi(e,t);switch(r){case"referenceHidden":{const a=await If(t,{...s,elementContext:"reference"}),o=cA(a,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:uA(o)}}}case"escaped":{const a=await If(t,{...s,altBoundary:!0}),o=cA(a,n.floating);return{data:{escapedOffsets:o,escaped:uA(o)}}}default:return{}}}}};async function FU(e,t){const{placement:n,platform:r,elements:s}=e,a=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=vi(n),l=Wu(n),c=No(n)==="y",u=["left","top"].includes(o)?-1:1,d=a&&c?-1:1,f=gi(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(p=l==="end"?g*-1:g),c?{x:p*d,y:h*u}:{x:h*u,y:p*d}}const BU=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:a,placement:o,middlewareData:l}=t,c=await FU(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:a+c.y,data:{...c,placement:o}}}}},zU=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:y=>{let{x:b,y:x}=y;return{x:b,y:x}}},...c}=gi(e,t),u={x:n,y:r},d=await If(t,c),f=No(vi(s)),h=hS(f);let p=u[h],g=u[f];if(a){const y=h==="y"?"top":"left",b=h==="y"?"bottom":"right",x=p+d[y],w=p-d[b];p=Qb(x,p,w)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",x=g+d[y],w=g-d[b];g=Qb(x,g,w)}const m=l.fn({...t,[h]:p,[f]:g});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[h]:a,[f]:o}}}}}},UU=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:s,rects:a,middlewareData:o}=t,{offset:l=0,mainAxis:c=!0,crossAxis:u=!0}=gi(e,t),d={x:n,y:r},f=No(s),h=hS(f);let p=d[h],g=d[f];const m=gi(l,t),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const w=h==="y"?"height":"width",j=a.reference[h]-a.floating[w]+y.mainAxis,S=a.reference[h]+a.reference[w]-y.mainAxis;pS&&(p=S)}if(u){var b,x;const w=h==="y"?"width":"height",j=["top","left"].includes(vi(s)),S=a.reference[f]-a.floating[w]+(j&&((b=o.offset)==null?void 0:b[f])||0)+(j?0:y.crossAxis),N=a.reference[f]+a.reference[w]+(j?0:((x=o.offset)==null?void 0:x[f])||0)-(j?y.crossAxis:0);gN&&(g=N)}return{[h]:p,[f]:g}}}},VU=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:s,rects:a,platform:o,elements:l}=t,{apply:c=()=>{},...u}=gi(e,t),d=await If(t,u),f=vi(s),h=Wu(s),p=No(s)==="y",{width:g,height:m}=a.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=h===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,y=h==="end"?"top":"bottom");const x=m-d.top-d.bottom,w=g-d.left-d.right,j=jo(m-d[y],x),S=jo(g-d[b],w),N=!t.middlewareData.shift;let _=j,P=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(_=x),N&&!h){const O=ns(d.left,0),M=ns(d.right,0),A=ns(d.top,0),$=ns(d.bottom,0);p?P=g-2*(O!==0||M!==0?O+M:ns(d.left,d.right)):_=m-2*(A!==0||$!==0?A+$:ns(d.top,d.bottom))}await c({...t,availableWidth:P,availableHeight:_});const k=await o.getDimensions(l.floating);return g!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}};function iy(){return typeof window<"u"}function Hu(e){return oM(e)?(e.nodeName||"").toLowerCase():"#document"}function is(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Da(e){var t;return(t=(oM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function oM(e){return iy()?e instanceof Node||e instanceof is(e).Node:!1}function ra(e){return iy()?e instanceof Element||e instanceof is(e).Element:!1}function ka(e){return iy()?e instanceof HTMLElement||e instanceof is(e).HTMLElement:!1}function dA(e){return!iy()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof is(e).ShadowRoot}function ep(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=sa(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(s)}function WU(e){return["table","td","th"].includes(Hu(e))}function oy(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function gS(e){const t=vS(),n=ra(e)?sa(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(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 HU(e){let t=_o(e);for(;ka(t)&&!lu(t);){if(gS(t))return t;if(oy(t))return null;t=_o(t)}return null}function vS(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function lu(e){return["html","body","#document"].includes(Hu(e))}function sa(e){return is(e).getComputedStyle(e)}function ly(e){return ra(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _o(e){if(Hu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||dA(e)&&e.host||Da(e);return dA(t)?t.host:t}function lM(e){const t=_o(e);return lu(t)?e.ownerDocument?e.ownerDocument.body:e.body:ka(t)&&ep(t)?t:lM(t)}function Rf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=lM(e),a=s===((r=e.ownerDocument)==null?void 0:r.body),o=is(s);if(a){const l=ew(o);return t.concat(o,o.visualViewport||[],ep(s)?s:[],l&&n?Rf(l):[])}return t.concat(s,Rf(s,[],n))}function ew(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cM(e){const t=sa(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=ka(e),a=s?e.offsetWidth:n,o=s?e.offsetHeight:r,l=sg(n)!==a||sg(r)!==o;return l&&(n=a,r=o),{width:n,height:r,$:l}}function yS(e){return ra(e)?e:e.contextElement}function Rc(e){const t=yS(e);if(!ka(t))return So(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:a}=cM(t);let o=(a?sg(n.width):n.width)/r,l=(a?sg(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const GU=So(0);function uM(e){const t=is(e);return!vS()||!t.visualViewport?GU:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qU(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==is(e)?!1:t}function Ol(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=yS(e);let o=So(1);t&&(r?ra(r)&&(o=Rc(r)):o=Rc(e));const l=qU(a,n,r)?uM(a):So(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,d=s.width/o.x,f=s.height/o.y;if(a){const h=is(a),p=r&&ra(r)?is(r):r;let g=h,m=ew(g);for(;m&&r&&p!==g;){const y=Rc(m),b=m.getBoundingClientRect(),x=sa(m),w=b.left+(m.clientLeft+parseFloat(x.paddingLeft))*y.x,j=b.top+(m.clientTop+parseFloat(x.paddingTop))*y.y;c*=y.x,u*=y.y,d*=y.x,f*=y.y,c+=w,u+=j,g=is(m),m=ew(g)}}return ig({width:d,height:f,x:c,y:u})}function KU(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const a=s==="fixed",o=Da(r),l=t?oy(t.floating):!1;if(r===o||l&&a)return n;let c={scrollLeft:0,scrollTop:0},u=So(1);const d=So(0),f=ka(r);if((f||!f&&!a)&&((Hu(r)!=="body"||ep(o))&&(c=ly(r)),ka(r))){const h=Ol(r);u=Rc(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-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function XU(e){return Array.from(e.getClientRects())}function tw(e,t){const n=ly(e).scrollLeft;return t?t.left+n:Ol(Da(e)).left+n}function YU(e){const t=Da(e),n=ly(e),r=e.ownerDocument.body,s=ns(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ns(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+tw(e);const l=-n.scrollTop;return sa(r).direction==="rtl"&&(o+=ns(t.clientWidth,r.clientWidth)-s),{width:s,height:a,x:o,y:l}}function ZU(e,t){const n=is(e),r=Da(e),s=n.visualViewport;let a=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){a=s.width,o=s.height;const u=vS();(!u||u&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:a,height:o,x:l,y:c}}function QU(e,t){const n=Ol(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,a=ka(e)?Rc(e):So(1),o=e.clientWidth*a.x,l=e.clientHeight*a.y,c=s*a.x,u=r*a.y;return{width:o,height:l,x:c,y:u}}function fA(e,t,n){let r;if(t==="viewport")r=ZU(e,n);else if(t==="document")r=YU(Da(e));else if(ra(t))r=QU(t,n);else{const s=uM(e);r={...t,x:t.x-s.x,y:t.y-s.y}}return ig(r)}function dM(e,t){const n=_o(e);return n===t||!ra(n)||lu(n)?!1:sa(n).position==="fixed"||dM(n,t)}function JU(e,t){const n=t.get(e);if(n)return n;let r=Rf(e,[],!1).filter(l=>ra(l)&&Hu(l)!=="body"),s=null;const a=sa(e).position==="fixed";let o=a?_o(e):e;for(;ra(o)&&!lu(o);){const l=sa(o),c=gS(o);!c&&l.position==="fixed"&&(s=null),(a?!c&&!s:!c&&l.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||ep(o)&&!c&&dM(e,o))?r=r.filter(d=>d!==o):s=l,o=_o(o)}return t.set(e,r),r}function eV(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const o=[...n==="clippingAncestors"?oy(t)?[]:JU(t,this._c):[].concat(n),r],l=o[0],c=o.reduce((u,d)=>{const f=fA(t,d,s);return u.top=ns(f.top,u.top),u.right=jo(f.right,u.right),u.bottom=jo(f.bottom,u.bottom),u.left=ns(f.left,u.left),u},fA(t,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function tV(e){const{width:t,height:n}=cM(e);return{width:t,height:n}}function nV(e,t,n){const r=ka(t),s=Da(t),a=n==="fixed",o=Ol(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const c=So(0);if(r||!r&&!a)if((Hu(t)!=="body"||ep(s))&&(l=ly(t)),r){const p=Ol(t,!0,a,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else s&&(c.x=tw(s));let u=0,d=0;if(s&&!r&&!a){const p=s.getBoundingClientRect();d=p.top+l.scrollTop,u=p.left+l.scrollLeft-tw(s,p)}const f=o.left+l.scrollLeft-c.x-u,h=o.top+l.scrollTop-c.y-d;return{x:f,y:h,width:o.width,height:o.height}}function i0(e){return sa(e).position==="static"}function hA(e,t){if(!ka(e)||sa(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Da(e)===n&&(n=n.ownerDocument.body),n}function fM(e,t){const n=is(e);if(oy(e))return n;if(!ka(e)){let s=_o(e);for(;s&&!lu(s);){if(ra(s)&&!i0(s))return s;s=_o(s)}return n}let r=hA(e,t);for(;r&&WU(r)&&i0(r);)r=hA(r,t);return r&&lu(r)&&i0(r)&&!gS(r)?n:r||HU(e)||n}const rV=async function(e){const t=this.getOffsetParent||fM,n=this.getDimensions,r=await n(e.floating);return{reference:nV(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function sV(e){return sa(e).direction==="rtl"}const aV={convertOffsetParentRelativeRectToViewportRelativeRect:KU,getDocumentElement:Da,getClippingRect:eV,getOffsetParent:fM,getElementRects:rV,getClientRects:XU,getDimensions:tV,getScale:Rc,isElement:ra,isRTL:sV};function iV(e,t){let n=null,r;const s=Da(e);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),a();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(l||t(),!f||!h)return;const p=Wp(d),g=Wp(s.clientWidth-(u+f)),m=Wp(s.clientHeight-(d+h)),y=Wp(u),x={rootMargin:-p+"px "+-g+"px "+-m+"px "+-y+"px",threshold:ns(0,jo(1,c))||1};let w=!0;function j(S){const N=S[0].intersectionRatio;if(N!==c){if(!w)return o();N?o(!1,N):r=setTimeout(()=>{o(!1,1e-7)},1e3)}w=!1}try{n=new IntersectionObserver(j,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(j,x)}n.observe(e)}return o(!0),a}function oV(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=yS(e),d=s||a?[...u?Rf(u):[],...Rf(t)]:[];d.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const f=u&&l?iV(u,n):null;let h=-1,p=null;o&&(p=new ResizeObserver(b=>{let[x]=b;x&&x.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,m=c?Ol(e):null;c&&y();function y(){const b=Ol(e);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&n(),m=b,g=requestAnimationFrame(y)}return n(),()=>{var b;d.forEach(x=>{s&&x.removeEventListener("scroll",n),a&&x.removeEventListener("resize",n)}),f==null||f(),(b=p)==null||b.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const lV=BU,cV=zU,uV=DU,dV=VU,fV=LU,pA=RU,hV=UU,pV=(e,t,n)=>{const r=new Map,s={platform:aV,...n},a={...s.platform,_c:r};return IU(e,t,{...s,platform:a})};var Nm=typeof document<"u"?v.useLayoutEffect:v.useEffect;function og(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!og(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const a=s[r];if(!(a==="_owner"&&e.$$typeof)&&!og(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function hM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function mA(e,t){const n=hM(e);return Math.round(t*n)/n}function o0(e){const t=v.useRef(e);return Nm(()=>{t.current=e}),t}function mV(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:a,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,f]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=v.useState(r);og(h,r)||p(r);const[g,m]=v.useState(null),[y,b]=v.useState(null),x=v.useCallback(T=>{T!==N.current&&(N.current=T,m(T))},[]),w=v.useCallback(T=>{T!==_.current&&(_.current=T,b(T))},[]),j=a||g,S=o||y,N=v.useRef(null),_=v.useRef(null),P=v.useRef(d),k=c!=null,O=o0(c),M=o0(s),A=o0(u),$=v.useCallback(()=>{if(!N.current||!_.current)return;const T={placement:t,strategy:n,middleware:h};M.current&&(T.platform=M.current),pV(N.current,_.current,T).then(F=>{const q={...F,isPositioned:A.current!==!1};L.current&&!og(P.current,q)&&(P.current=q,Vu.flushSync(()=>{f(q)}))})},[h,t,n,M,A]);Nm(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,f(T=>({...T,isPositioned:!1})))},[u]);const L=v.useRef(!1);Nm(()=>(L.current=!0,()=>{L.current=!1}),[]),Nm(()=>{if(j&&(N.current=j),S&&(_.current=S),j&&S){if(O.current)return O.current(j,S,$);$()}},[j,S,$,O,k]);const H=v.useMemo(()=>({reference:N,floating:_,setReference:x,setFloating:w}),[x,w]),D=v.useMemo(()=>({reference:j,floating:S}),[j,S]),V=v.useMemo(()=>{const T={position:n,left:0,top:0};if(!D.floating)return T;const F=mA(D.floating,d.x),q=mA(D.floating,d.y);return l?{...T,transform:"translate("+F+"px, "+q+"px)",...hM(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:q}},[n,l,D.floating,d.x,d.y]);return v.useMemo(()=>({...d,update:$,refs:H,elements:D,floatingStyles:V}),[d,$,H,D,V])}const gV=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:s}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?pA({element:r.current,padding:s}).fn(n):{}:r?pA({element:r,padding:s}).fn(n):{}}}},vV=(e,t)=>({...lV(e),options:[e,t]}),yV=(e,t)=>({...cV(e),options:[e,t]}),xV=(e,t)=>({...hV(e),options:[e,t]}),bV=(e,t)=>({...uV(e),options:[e,t]}),wV=(e,t)=>({...dV(e),options:[e,t]}),jV=(e,t)=>({...fV(e),options:[e,t]}),SV=(e,t)=>({...gV(e),options:[e,t]});var NV="Arrow",pM=v.forwardRef((e,t)=>{const{children:n,width:r=10,height:s=5,...a}=e;return i.jsx(Ye.svg,{...a,ref:t,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:i.jsx("polygon",{points:"0,0 30,0 15,10"})})});pM.displayName=NV;var _V=pM;function PV(e,t=[]){let n=[];function r(a,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,y=v.useMemo(()=>g,Object.values(g));return i.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return u.displayName=a+"Provider",[u,d]}const s=()=>{const a=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,AV(s,...t)]}function AV(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function tp(e){const[t,n]=v.useState(void 0);return ir(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let o,l;if("borderBoxSize"in a){const c=a.borderBoxSize,u=Array.isArray(c)?c[0]:c;o=u.inlineSize,l=u.blockSize}else o=e.offsetWidth,l=e.offsetHeight;n({width:o,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var xS="Popper",[mM,Gu]=PV(xS),[CV,gM]=mM(xS),vM=e=>{const{__scopePopper:t,children:n}=e,[r,s]=v.useState(null);return i.jsx(CV,{scope:t,anchor:r,onAnchorChange:s,children:n})};vM.displayName=xS;var yM="PopperAnchor",xM=v.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...s}=e,a=gM(yM,n),o=v.useRef(null),l=xt(t,o);return v.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:i.jsx(Ye.div,{...s,ref:l})});xM.displayName=yM;var bS="PopperContent",[EV,OV]=mM(bS),bM=v.forwardRef((e,t)=>{var ce,De,de,be,Pe,ne;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:a="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:p="optimized",onPlaced:g,...m}=e,y=gM(bS,n),[b,x]=v.useState(null),w=xt(t,Je=>x(Je)),[j,S]=v.useState(null),N=tp(j),_=(N==null?void 0:N.width)??0,P=(N==null?void 0:N.height)??0,k=r+(a!=="center"?"-"+a:""),O=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},M=Array.isArray(u)?u:[u],A=M.length>0,$={padding:O,boundary:M.filter(TV),altBoundary:A},{refs:L,floatingStyles:H,placement:D,isPositioned:V,middlewareData:T}=mV({strategy:"fixed",placement:k,whileElementsMounted:(...Je)=>oV(...Je,{animationFrame:p==="always"}),elements:{reference:y.anchor},middleware:[vV({mainAxis:s+P,alignmentAxis:o}),c&&yV({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?xV():void 0,...$}),c&&bV({...$}),wV({...$,apply:({elements:Je,rects:ve,availableWidth:at,availableHeight:st})=>{const{width:Mt,height:C}=ve.reference,R=Je.floating.style;R.setProperty("--radix-popper-available-width",`${at}px`),R.setProperty("--radix-popper-available-height",`${st}px`),R.setProperty("--radix-popper-anchor-width",`${Mt}px`),R.setProperty("--radix-popper-anchor-height",`${C}px`)}}),j&&SV({element:j,padding:l}),$V({arrowWidth:_,arrowHeight:P}),h&&jV({strategy:"referenceHidden",...$})]}),[F,q]=SM(D),Z=Hn(g);ir(()=>{V&&(Z==null||Z())},[V,Z]);const re=(ce=T.arrow)==null?void 0:ce.x,ge=(De=T.arrow)==null?void 0:De.y,B=((de=T.arrow)==null?void 0:de.centerOffset)!==0,[le,se]=v.useState();return ir(()=>{b&&se(window.getComputedStyle(b).zIndex)},[b]),i.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:V?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[(be=T.transformOrigin)==null?void 0:be.x,(Pe=T.transformOrigin)==null?void 0:Pe.y].join(" "),...((ne=T.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:i.jsx(EV,{scope:n,placedSide:F,onArrowChange:S,arrowX:re,arrowY:ge,shouldHideArrow:B,children:i.jsx(Ye.div,{"data-side":F,"data-align":q,...m,ref:w,style:{...m.style,animation:V?void 0:"none"}})})})});bM.displayName=bS;var wM="PopperArrow",kV={top:"bottom",right:"left",bottom:"top",left:"right"},jM=v.forwardRef(function(t,n){const{__scopePopper:r,...s}=t,a=OV(wM,r),o=kV[a.placedSide];return i.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:i.jsx(_V,{...s,ref:n,style:{...s.style,display:"block"}})})});jM.displayName=wM;function TV(e){return e!==null}var $V=e=>({name:"transformOrigin",options:e,fn(t){var y,b,x;const{placement:n,rects:r,middlewareData:s}=t,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,l=o?0:e.arrowWidth,c=o?0:e.arrowHeight,[u,d]=SM(n),f={start:"0%",center:"50%",end:"100%"}[d],h=(((b=s.arrow)==null?void 0:b.x)??0)+l/2,p=(((x=s.arrow)==null?void 0:x.y)??0)+c/2;let g="",m="";return u==="bottom"?(g=o?f:`${h}px`,m=`${-c}px`):u==="top"?(g=o?f:`${h}px`,m=`${r.floating.height+c}px`):u==="right"?(g=`${-c}px`,m=o?f:`${p}px`):u==="left"&&(g=`${r.floating.width+c}px`,m=o?f:`${p}px`),{data:{x:g,y:m}}}});function SM(e){const[t,n="center"]=e.split("-");return[t,n]}var NM=vM,wS=xM,jS=bM,SS=jM,MV="Portal",cy=v.forwardRef((e,t)=>{var l;const{container:n,...r}=e,[s,a]=v.useState(!1);ir(()=>a(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?tM.createPortal(i.jsx(Ye.div,{...r,ref:t}),o):null});cy.displayName=MV;function IV(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var lr=e=>{const{present:t,children:n}=e,r=RV(t),s=typeof n=="function"?n({present:r.isPresent}):v.Children.only(n),a=xt(r.ref,DV(s));return typeof n=="function"||r.isPresent?v.cloneElement(s,{ref:a}):null};lr.displayName="Presence";function RV(e){const[t,n]=v.useState(),r=v.useRef({}),s=v.useRef(e),a=v.useRef("none"),o=e?"mounted":"unmounted",[l,c]=IV(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{const u=Hp(r.current);a.current=l==="mounted"?u:"none"},[l]),ir(()=>{const u=r.current,d=s.current;if(d!==e){const h=a.current,p=Hp(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),ir(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const m=Hp(r.current).includes(p.animationName);if(p.target===t&&m&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},h=p=>{p.target===t&&(a.current=Hp(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:v.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Hp(e){return(e==null?void 0:e.animationName)||"none"}function DV(e){var r,s;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function aa({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,s]=LV({defaultProp:t,onChange:n}),a=e!==void 0,o=a?e:r,l=Hn(n),c=v.useCallback(u=>{if(a){const f=typeof u=="function"?u(e):u;f!==e&&l(f)}else s(u)},[a,e,s,l]);return[o,c]}function LV({defaultProp:e,onChange:t}){const n=v.useState(e),[r]=n,s=v.useRef(r),a=Hn(t);return v.useEffect(()=>{s.current!==r&&(a(r),s.current=r)},[r,s,a]),n}var FV="VisuallyHidden",NS=v.forwardRef((e,t)=>i.jsx(Ye.span,{...e,ref:t,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",...e.style}}));NS.displayName=FV;var BV=NS,[uy,jPe]=Gr("Tooltip",[Gu]),_S=Gu(),_M="TooltipProvider",zV=700,gA="tooltip.open",[UV,PM]=uy(_M),AM=e=>{const{__scopeTooltip:t,delayDuration:n=zV,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:a}=e,[o,l]=v.useState(!0),c=v.useRef(!1),u=v.useRef(0);return v.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),i.jsx(UV,{scope:t,isOpenDelayed:o,delayDuration:n,onOpen:v.useCallback(()=>{window.clearTimeout(u.current),l(!1)},[]),onClose:v.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l(!0),r)},[r]),isPointerInTransitRef:c,onPointerInTransitChange:v.useCallback(d=>{c.current=d},[]),disableHoverableContent:s,children:a})};AM.displayName=_M;var CM="Tooltip",[SPe,dy]=uy(CM),nw="TooltipTrigger",VV=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=dy(nw,n),a=PM(nw,n),o=_S(n),l=v.useRef(null),c=xt(t,l,s.onTriggerChange),u=v.useRef(!1),d=v.useRef(!1),f=v.useCallback(()=>u.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",f),[f]),i.jsx(wS,{asChild:!0,...o,children:i.jsx(Ye.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:Ee(e.onPointerMove,h=>{h.pointerType!=="touch"&&!d.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),d.current=!0)}),onPointerLeave:Ee(e.onPointerLeave,()=>{s.onTriggerLeave(),d.current=!1}),onPointerDown:Ee(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",f,{once:!0})}),onFocus:Ee(e.onFocus,()=>{u.current||s.onOpen()}),onBlur:Ee(e.onBlur,s.onClose),onClick:Ee(e.onClick,s.onClose)})})});VV.displayName=nw;var WV="TooltipPortal",[NPe,HV]=uy(WV,{forceMount:void 0}),cu="TooltipContent",EM=v.forwardRef((e,t)=>{const n=HV(cu,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...a}=e,o=dy(cu,e.__scopeTooltip);return i.jsx(lr,{present:r||o.open,children:o.disableHoverableContent?i.jsx(OM,{side:s,...a,ref:t}):i.jsx(GV,{side:s,...a,ref:t})})}),GV=v.forwardRef((e,t)=>{const n=dy(cu,e.__scopeTooltip),r=PM(cu,e.__scopeTooltip),s=v.useRef(null),a=xt(t,s),[o,l]=v.useState(null),{trigger:c,onClose:u}=n,d=s.current,{onPointerInTransitChange:f}=r,h=v.useCallback(()=>{l(null),f(!1)},[f]),p=v.useCallback((g,m)=>{const y=g.currentTarget,b={x:g.clientX,y:g.clientY},x=YV(b,y.getBoundingClientRect()),w=ZV(b,x),j=QV(m.getBoundingClientRect()),S=e7([...w,...j]);l(S),f(!0)},[f]);return v.useEffect(()=>()=>h(),[h]),v.useEffect(()=>{if(c&&d){const g=y=>p(y,d),m=y=>p(y,c);return c.addEventListener("pointerleave",g),d.addEventListener("pointerleave",m),()=>{c.removeEventListener("pointerleave",g),d.removeEventListener("pointerleave",m)}}},[c,d,p,h]),v.useEffect(()=>{if(o){const g=m=>{const y=m.target,b={x:m.clientX,y:m.clientY},x=(c==null?void 0:c.contains(y))||(d==null?void 0:d.contains(y)),w=!JV(b,o);x?h():w&&(h(),u())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,d,o,u,h]),i.jsx(OM,{...e,ref:a})}),[qV,KV]=uy(CM,{isInside:!1}),OM=v.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:o,...l}=e,c=dy(cu,n),u=_S(n),{onClose:d}=c;return v.useEffect(()=>(document.addEventListener(gA,d),()=>document.removeEventListener(gA,d)),[d]),v.useEffect(()=>{if(c.trigger){const f=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&d()};return window.addEventListener("scroll",f,{capture:!0}),()=>window.removeEventListener("scroll",f,{capture:!0})}},[c.trigger,d]),i.jsx(Jh,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:f=>f.preventDefault(),onDismiss:d,children:i.jsxs(jS,{"data-state":c.stateAttribute,...u,...l,ref:t,style:{...l.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:[i.jsx(fS,{children:r}),i.jsx(qV,{scope:n,isInside:!0,children:i.jsx(BV,{id:c.contentId,role:"tooltip",children:s||r})})]})})});EM.displayName=cu;var kM="TooltipArrow",XV=v.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=_S(n);return KV(kM,n).isInside?null:i.jsx(SS,{...s,...r,ref:t})});XV.displayName=kM;function YV(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,s,a)){case a:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function ZV(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function QV(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function JV(e,t){const{x:n,y:r}=e;let s=!1;for(let a=0,o=t.length-1;ar!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function e7(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),t7(t)}function t7(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const a=t[t.length-1],o=t[t.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const a=n[n.length-1],o=n[n.length-2];if((a.x-o.x)*(s.y-o.y)>=(a.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var n7=AM,TM=EM;function $M(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const t=a7(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const l=o.split(PS);return l[0]===""&&l.length!==1&&l.shift(),MM(l,t)||s7(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},MM=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?MM(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const a=e.join(PS);return(o=t.validators.find(({validator:l})=>l(a)))==null?void 0:o.classGroupId},vA=/^\[(.+)\]$/,s7=e=>{if(vA.test(e)){const t=vA.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},a7=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return o7(Object.entries(e.classGroups),n).forEach(([a,o])=>{rw(o,r,a,t)}),r},rw=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const a=s===""?t:yA(t,s);a.classGroupId=n;return}if(typeof s=="function"){if(i7(s)){rw(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([a,o])=>{rw(o,yA(t,a),n,r)})})},yA=(e,t)=>{let n=e;return t.split(PS).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},i7=e=>e.isThemeGetter,o7=(e,t)=>t?e.map(([n,r])=>{const s=r.map(a=>typeof a=="string"?t+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,l])=>[t+o,l])):a);return[n,s]}):e,l7=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(a,o)=>{n.set(a,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(a){let o=n.get(a);if(o!==void 0)return o;if((o=r.get(a))!==void 0)return s(a,o),o},set(a,o){n.has(a)?n.set(a,o):s(a,o)}}},IM="!",c7=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],a=t.length,o=l=>{const c=[];let u=0,d=0,f;for(let y=0;yd?f-d:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:g,maybePostfixModifierPosition:m}};return n?l=>n({className:l,parseClassName:o}):o},u7=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},d7=e=>({cache:l7(e.cacheSize),parseClassName:c7(e),...r7(e)}),f7=/\s+/,h7=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,a=[],o=e.trim().split(f7);let l="";for(let c=o.length-1;c>=0;c-=1){const u=o[c],{modifiers:d,hasImportantModifier:f,baseClassName:h,maybePostfixModifierPosition:p}=n(u);let g=!!p,m=r(g?h.substring(0,p):h);if(!m){if(!g){l=u+(l.length>0?" "+l:l);continue}if(m=r(h),!m){l=u+(l.length>0?" "+l:l);continue}g=!1}const y=u7(d).join(":"),b=f?y+IM:y,x=b+m;if(a.includes(x))continue;a.push(x);const w=s(m,g);for(let j=0;j0?" "+l:l)}return l};function p7(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rf(d),e());return n=d7(u),r=n.cache.get,s=n.cache.set,a=l,l(c)}function l(c){const u=r(c);if(u)return u;const d=h7(c,n);return s(c,d),d}return function(){return a(p7.apply(null,arguments))}}const on=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},DM=/^\[(?:([a-z-]+):)?(.+)\]$/i,g7=/^\d+\/\d+$/,v7=new Set(["px","full","screen"]),y7=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,x7=/\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$/,b7=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,w7=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,j7=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ua=e=>Dc(e)||v7.has(e)||g7.test(e),Ti=e=>qu(e,"length",O7),Dc=e=>!!e&&!Number.isNaN(Number(e)),l0=e=>qu(e,"number",Dc),Pd=e=>!!e&&Number.isInteger(Number(e)),S7=e=>e.endsWith("%")&&Dc(e.slice(0,-1)),At=e=>DM.test(e),$i=e=>y7.test(e),N7=new Set(["length","size","percentage"]),_7=e=>qu(e,N7,LM),P7=e=>qu(e,"position",LM),A7=new Set(["image","url"]),C7=e=>qu(e,A7,T7),E7=e=>qu(e,"",k7),Ad=()=>!0,qu=(e,t,n)=>{const r=DM.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},O7=e=>x7.test(e)&&!b7.test(e),LM=()=>!1,k7=e=>w7.test(e),T7=e=>j7.test(e),$7=()=>{const e=on("colors"),t=on("spacing"),n=on("blur"),r=on("brightness"),s=on("borderColor"),a=on("borderRadius"),o=on("borderSpacing"),l=on("borderWidth"),c=on("contrast"),u=on("grayscale"),d=on("hueRotate"),f=on("invert"),h=on("gap"),p=on("gradientColorStops"),g=on("gradientColorStopPositions"),m=on("inset"),y=on("margin"),b=on("opacity"),x=on("padding"),w=on("saturate"),j=on("scale"),S=on("sepia"),N=on("skew"),_=on("space"),P=on("translate"),k=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto",At,t],A=()=>[At,t],$=()=>["",Ua,Ti],L=()=>["auto",Dc,At],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],D=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],T=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",At],q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Z=()=>[Dc,At];return{cacheSize:500,separator:":",theme:{colors:[Ad],spacing:[Ua,Ti],blur:["none","",$i,At],brightness:Z(),borderColor:[e],borderRadius:["none","","full",$i,At],borderSpacing:A(),borderWidth:$(),contrast:Z(),grayscale:F(),hueRotate:Z(),invert:F(),gap:A(),gradientColorStops:[e],gradientColorStopPositions:[S7,Ti],inset:M(),margin:M(),opacity:Z(),padding:A(),saturate:Z(),scale:Z(),sepia:F(),skew:Z(),space:A(),translate:A()},classGroups:{aspect:[{aspect:["auto","square","video",At]}],container:["container"],columns:[{columns:[$i]}],"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:[...H(),At]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],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",Pd,At]}],basis:[{basis:M()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",At]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Pd,At]}],"grid-cols":[{"grid-cols":[Ad]}],"col-start-end":[{col:["auto",{span:["full",Pd,At]},At]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Ad]}],"row-start-end":[{row:["auto",{span:[Pd,At]},At]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",At]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",At]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...T()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...T(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...T(),"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":[_]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[_]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",At,t]}],"min-w":[{"min-w":[At,t,"min","max","fit"]}],"max-w":[{"max-w":[At,t,"none","full","min","max","fit","prose",{screen:[$i]},$i]}],h:[{h:[At,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[At,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[At,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[At,t,"auto","min","max","fit"]}],"font-size":[{text:["base",$i,Ti]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",l0]}],"font-family":[{font:[Ad]}],"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",At]}],"line-clamp":[{"line-clamp":["none",Dc,l0]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ua,At]}],"list-image":[{"list-image":["none",At]}],"list-style-type":[{list:["none","disc","decimal",At]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...D(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ua,Ti]}],"underline-offset":[{"underline-offset":["auto",Ua,At]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:A()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",At]}],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",At]}],"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:[...H(),P7]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",_7]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},C7]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...D(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:D()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...D()]}],"outline-offset":[{"outline-offset":[Ua,At]}],"outline-w":[{outline:[Ua,Ti]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Ua,Ti]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",$i,E7]}],"shadow-color":[{shadow:[Ad]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",$i,At]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"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":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",At]}],duration:[{duration:Z()}],ease:[{ease:["linear","in","out","in-out",At]}],delay:[{delay:Z()}],animate:[{animate:["none","spin","ping","pulse","bounce",At]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Pd,At]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[N]}],"skew-y":[{"skew-y":[N]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",At]}],accent:[{accent:["auto",e]}],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",At]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":A()}],"scroll-mx":[{"scroll-mx":A()}],"scroll-my":[{"scroll-my":A()}],"scroll-ms":[{"scroll-ms":A()}],"scroll-me":[{"scroll-me":A()}],"scroll-mt":[{"scroll-mt":A()}],"scroll-mr":[{"scroll-mr":A()}],"scroll-mb":[{"scroll-mb":A()}],"scroll-ml":[{"scroll-ml":A()}],"scroll-p":[{"scroll-p":A()}],"scroll-px":[{"scroll-px":A()}],"scroll-py":[{"scroll-py":A()}],"scroll-ps":[{"scroll-ps":A()}],"scroll-pe":[{"scroll-pe":A()}],"scroll-pt":[{"scroll-pt":A()}],"scroll-pr":[{"scroll-pr":A()}],"scroll-pb":[{"scroll-pb":A()}],"scroll-pl":[{"scroll-pl":A()}],"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",At]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ua,Ti,l0]}],stroke:[{stroke:[e,"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"]}}},M7=m7($7);function Me(...e){return M7(wt(e))}const I7=n7,R7=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>i.jsx(TM,{ref:r,sideOffset:t,className:Me("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",e),...n}));R7.displayName=TM.displayName;var fy=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},hy=typeof window>"u"||"Deno"in globalThis;function Ls(){}function D7(e,t){return typeof e=="function"?e(t):e}function L7(e){return typeof e=="number"&&e>=0&&e!==1/0}function F7(e,t){return Math.max(e+(t||0)-Date.now(),0)}function xA(e,t){return typeof e=="function"?e(t):e}function B7(e,t){return typeof e=="function"?e(t):e}function bA(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:a,queryKey:o,stale:l}=e;if(o){if(r){if(t.queryHash!==AS(o,t.options))return!1}else if(!Lf(t.queryKey,o))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&t.isStale()!==l||s&&s!==t.state.fetchStatus||a&&!a(t))}function wA(e,t){const{exact:n,status:r,predicate:s,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(Df(t.options.mutationKey)!==Df(a))return!1}else if(!Lf(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function AS(e,t){return((t==null?void 0:t.queryKeyHashFn)||Df)(e)}function Df(e){return JSON.stringify(e,(t,n)=>sw(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Lf(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Lf(e[n],t[n])):!1}function FM(e,t){if(e===t)return e;const n=jA(e)&&jA(t);if(n||sw(e)&&sw(t)){const r=n?e:Object.keys(e),s=r.length,a=n?t:Object.keys(t),o=a.length,l=n?[]:{};let c=0;for(let u=0;u{setTimeout(t,e)})}function U7(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?FM(e,t):t}function V7(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function W7(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var CS=Symbol();function BM(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===CS?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var hl,Gi,Gc,Mk,H7=(Mk=class extends fy{constructor(){super();qt(this,hl);qt(this,Gi);qt(this,Gc);Tt(this,Gc,t=>{if(!hy&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){pe(this,Gi)||this.setEventListener(pe(this,Gc))}onUnsubscribe(){var t;this.hasListeners()||((t=pe(this,Gi))==null||t.call(this),Tt(this,Gi,void 0))}setEventListener(t){var n;Tt(this,Gc,t),(n=pe(this,Gi))==null||n.call(this),Tt(this,Gi,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){pe(this,hl)!==t&&(Tt(this,hl,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof pe(this,hl)=="boolean"?pe(this,hl):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},hl=new WeakMap,Gi=new WeakMap,Gc=new WeakMap,Mk),zM=new H7,qc,qi,Kc,Ik,G7=(Ik=class extends fy{constructor(){super();qt(this,qc,!0);qt(this,qi);qt(this,Kc);Tt(this,Kc,t=>{if(!hy&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){pe(this,qi)||this.setEventListener(pe(this,Kc))}onUnsubscribe(){var t;this.hasListeners()||((t=pe(this,qi))==null||t.call(this),Tt(this,qi,void 0))}setEventListener(t){var n;Tt(this,Kc,t),(n=pe(this,qi))==null||n.call(this),Tt(this,qi,t(this.setOnline.bind(this)))}setOnline(t){pe(this,qc)!==t&&(Tt(this,qc,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return pe(this,qc)}},qc=new WeakMap,qi=new WeakMap,Kc=new WeakMap,Ik),lg=new G7;function q7(){let e,t;const n=new Promise((s,a)=>{e=s,t=a});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}function K7(e){return Math.min(1e3*2**e,3e4)}function UM(e){return(e??"online")==="online"?lg.isOnline():!0}var VM=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function c0(e){return e instanceof VM}function WM(e){let t=!1,n=0,r=!1,s;const a=q7(),o=m=>{var y;r||(h(new VM(m)),(y=e.abort)==null||y.call(e))},l=()=>{t=!0},c=()=>{t=!1},u=()=>zM.isFocused()&&(e.networkMode==="always"||lg.isOnline())&&e.canRun(),d=()=>UM(e.networkMode)&&e.canRun(),f=m=>{var y;r||(r=!0,(y=e.onSuccess)==null||y.call(e,m),s==null||s(),a.resolve(m))},h=m=>{var y;r||(r=!0,(y=e.onError)==null||y.call(e,m),s==null||s(),a.reject(m))},p=()=>new Promise(m=>{var y;s=b=>{(r||u())&&m(b)},(y=e.onPause)==null||y.call(e)}).then(()=>{var m;s=void 0,r||(m=e.onContinue)==null||m.call(e)}),g=()=>{if(r)return;let m;const y=n===0?e.initialPromise:void 0;try{m=y??e.fn()}catch(b){m=Promise.reject(b)}Promise.resolve(m).then(f).catch(b=>{var N;if(r)return;const x=e.retry??(hy?0:3),w=e.retryDelay??K7,j=typeof w=="function"?w(n,b):w,S=x===!0||typeof x=="number"&&nu()?void 0:p()).then(()=>{t?h(b):g()})})};return{promise:a,cancel:o,continue:()=>(s==null||s(),a),cancelRetry:l,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),a)}}function X7(){let e=[],t=0,n=l=>{l()},r=l=>{l()},s=l=>setTimeout(l,0);const a=l=>{t?e.push(l):s(()=>{n(l)})},o=()=>{const l=e;e=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;t++;try{c=l()}finally{t--,t||o()}return c},batchCalls:l=>(...c)=>{a(()=>{l(...c)})},schedule:a,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var Pr=X7(),pl,Rk,HM=(Rk=class{constructor(){qt(this,pl)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),L7(this.gcTime)&&Tt(this,pl,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(hy?1/0:5*60*1e3))}clearGcTimeout(){pe(this,pl)&&(clearTimeout(pe(this,pl)),Tt(this,pl,void 0))}},pl=new WeakMap,Rk),Xc,Yc,ms,fr,Gh,ml,Fs,Ha,Dk,Y7=(Dk=class extends HM{constructor(t){super();qt(this,Fs);qt(this,Xc);qt(this,Yc);qt(this,ms);qt(this,fr);qt(this,Gh);qt(this,ml);Tt(this,ml,!1),Tt(this,Gh,t.defaultOptions),this.setOptions(t.options),this.observers=[],Tt(this,ms,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Tt(this,Xc,Q7(this.options)),this.state=t.state??pe(this,Xc),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=pe(this,fr))==null?void 0:t.promise}setOptions(t){this.options={...pe(this,Gh),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&pe(this,ms).remove(this)}setData(t,n){const r=U7(this.state.data,t,this.options);return cr(this,Fs,Ha).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){cr(this,Fs,Ha).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,s;const n=(r=pe(this,fr))==null?void 0:r.promise;return(s=pe(this,fr))==null||s.cancel(t),n?n.then(Ls).catch(Ls):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(pe(this,Xc))}isActive(){return this.observers.some(t=>B7(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===CS||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!F7(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=pe(this,fr))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=pe(this,fr))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),pe(this,ms).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(pe(this,fr)&&(pe(this,ml)?pe(this,fr).cancel({revert:!0}):pe(this,fr).cancelRetry()),this.scheduleGc()),pe(this,ms).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||cr(this,Fs,Ha).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(pe(this,fr))return pe(this,fr).continueRetry(),pe(this,fr).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}const r=new AbortController,s=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Tt(this,ml,!0),r.signal)})},a=()=>{const f=BM(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return s(h),Tt(this,ml,!1),this.options.persister?this.options.persister(f,h,this):f(h)},o={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:a};s(o),(c=this.options.behavior)==null||c.onFetch(o,this),Tt(this,Yc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=o.fetchOptions)==null?void 0:u.meta))&&cr(this,Fs,Ha).call(this,{type:"fetch",meta:(d=o.fetchOptions)==null?void 0:d.meta});const l=f=>{var h,p,g,m;c0(f)&&f.silent||cr(this,Fs,Ha).call(this,{type:"error",error:f}),c0(f)||((p=(h=pe(this,ms).config).onError)==null||p.call(h,f,this),(m=(g=pe(this,ms).config).onSettled)==null||m.call(g,this.state.data,f,this)),this.scheduleGc()};return Tt(this,fr,WM({initialPromise:n==null?void 0:n.initialPromise,fn:o.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,m;if(f===void 0){l(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(y){l(y);return}(p=(h=pe(this,ms).config).onSuccess)==null||p.call(h,f,this),(m=(g=pe(this,ms).config).onSettled)==null||m.call(g,f,this.state.error,this),this.scheduleGc()},onError:l,onFail:(f,h)=>{cr(this,Fs,Ha).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{cr(this,Fs,Ha).call(this,{type:"pause"})},onContinue:()=>{cr(this,Fs,Ha).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),pe(this,fr).start()}},Xc=new WeakMap,Yc=new WeakMap,ms=new WeakMap,fr=new WeakMap,Gh=new WeakMap,ml=new WeakMap,Fs=new WeakSet,Ha=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Z7(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=t.error;return c0(s)&&s.revert&&pe(this,Yc)?{...pe(this,Yc),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),Pr.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),pe(this,ms).notify({query:this,type:"updated",action:t})})},Dk);function Z7(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:UM(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Q7(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,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 ga,Lk,J7=(Lk=class extends fy{constructor(t={}){super();qt(this,ga);this.config=t,Tt(this,ga,new Map)}build(t,n,r){const s=n.queryKey,a=n.queryHash??AS(s,n);let o=this.get(a);return o||(o=new Y7({cache:this,queryKey:s,queryHash:a,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(s)}),this.add(o)),o}add(t){pe(this,ga).has(t.queryHash)||(pe(this,ga).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=pe(this,ga).get(t.queryHash);n&&(t.destroy(),n===t&&pe(this,ga).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Pr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return pe(this,ga).get(t)}getAll(){return[...pe(this,ga).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>bA(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>bA(t,r)):n}notify(t){Pr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){Pr.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Pr.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},ga=new WeakMap,Lk),va,jr,gl,ya,Mi,Fk,e9=(Fk=class extends HM{constructor(t){super();qt(this,ya);qt(this,va);qt(this,jr);qt(this,gl);this.mutationId=t.mutationId,Tt(this,jr,t.mutationCache),Tt(this,va,[]),this.state=t.state||t9(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){pe(this,va).includes(t)||(pe(this,va).push(t),this.clearGcTimeout(),pe(this,jr).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Tt(this,va,pe(this,va).filter(n=>n!==t)),this.scheduleGc(),pe(this,jr).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){pe(this,va).length||(this.state.status==="pending"?this.scheduleGc():pe(this,jr).remove(this))}continue(){var t;return((t=pe(this,gl))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var s,a,o,l,c,u,d,f,h,p,g,m,y,b,x,w,j,S,N,_;Tt(this,gl,WM({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(P,k)=>{cr(this,ya,Mi).call(this,{type:"failed",failureCount:P,error:k})},onPause:()=>{cr(this,ya,Mi).call(this,{type:"pause"})},onContinue:()=>{cr(this,ya,Mi).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>pe(this,jr).canRun(this)}));const n=this.state.status==="pending",r=!pe(this,gl).canStart();try{if(!n){cr(this,ya,Mi).call(this,{type:"pending",variables:t,isPaused:r}),await((a=(s=pe(this,jr).config).onMutate)==null?void 0:a.call(s,t,this));const k=await((l=(o=this.options).onMutate)==null?void 0:l.call(o,t));k!==this.state.context&&cr(this,ya,Mi).call(this,{type:"pending",context:k,variables:t,isPaused:r})}const P=await pe(this,gl).start();return await((u=(c=pe(this,jr).config).onSuccess)==null?void 0:u.call(c,P,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,P,t,this.state.context)),await((p=(h=pe(this,jr).config).onSettled)==null?void 0:p.call(h,P,null,this.state.variables,this.state.context,this)),await((m=(g=this.options).onSettled)==null?void 0:m.call(g,P,null,t,this.state.context)),cr(this,ya,Mi).call(this,{type:"success",data:P}),P}catch(P){try{throw await((b=(y=pe(this,jr).config).onError)==null?void 0:b.call(y,P,t,this.state.context,this)),await((w=(x=this.options).onError)==null?void 0:w.call(x,P,t,this.state.context)),await((S=(j=pe(this,jr).config).onSettled)==null?void 0:S.call(j,void 0,P,this.state.variables,this.state.context,this)),await((_=(N=this.options).onSettled)==null?void 0:_.call(N,void 0,P,t,this.state.context)),P}finally{cr(this,ya,Mi).call(this,{type:"error",error:P})}}finally{pe(this,jr).runNext(this)}}},va=new WeakMap,jr=new WeakMap,gl=new WeakMap,ya=new WeakSet,Mi=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Pr.batch(()=>{pe(this,va).forEach(r=>{r.onMutationUpdate(t)}),pe(this,jr).notify({mutation:this,type:"updated",action:t})})},Fk);function t9(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Zr,qh,Bk,n9=(Bk=class extends fy{constructor(t={}){super();qt(this,Zr);qt(this,qh);this.config=t,Tt(this,Zr,new Map),Tt(this,qh,Date.now())}build(t,n,r){const s=new e9({mutationCache:this,mutationId:++Np(this,qh)._,options:t.defaultMutationOptions(n),state:r});return this.add(s),s}add(t){const n=Gp(t),r=pe(this,Zr).get(n)??[];r.push(t),pe(this,Zr).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=Gp(t);if(pe(this,Zr).has(n)){const s=(r=pe(this,Zr).get(n))==null?void 0:r.filter(a=>a!==t);s&&(s.length===0?pe(this,Zr).delete(n):pe(this,Zr).set(n,s))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=pe(this,Zr).get(Gp(t)))==null?void 0:r.find(s=>s.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=pe(this,Zr).get(Gp(t)))==null?void 0:r.find(s=>s!==t&&s.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){Pr.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[...pe(this,Zr).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>wA(n,r))}findAll(t={}){return this.getAll().filter(n=>wA(t,n))}notify(t){Pr.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return Pr.batch(()=>Promise.all(t.map(n=>n.continue().catch(Ls))))}},Zr=new WeakMap,qh=new WeakMap,Bk);function Gp(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function NA(e){return{onFetch:(t,n)=>{var d,f,h,p,g;const r=t.options,s=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,a=((p=t.state.data)==null?void 0:p.pages)||[],o=((g=t.state.data)==null?void 0:g.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const u=async()=>{let m=!1;const y=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(t.signal.aborted?m=!0:t.signal.addEventListener("abort",()=>{m=!0}),t.signal)})},b=BM(t.options,t.fetchOptions),x=async(w,j,S)=>{if(m)return Promise.reject();if(j==null&&w.pages.length)return Promise.resolve(w);const N={queryKey:t.queryKey,pageParam:j,direction:S?"backward":"forward",meta:t.options.meta};y(N);const _=await b(N),{maxPages:P}=t.options,k=S?W7:V7;return{pages:k(w.pages,_,P),pageParams:k(w.pageParams,j,P)}};if(s&&a.length){const w=s==="backward",j=w?r9:_A,S={pages:a,pageParams:o},N=j(r,S);l=await x(S,N,w)}else{const w=e??a.length;do{const j=c===0?o[0]??r.initialPageParam:_A(r,l);if(c>0&&j==null)break;l=await x(l,j),c++}while(c{var m,y;return(y=(m=t.options).persister)==null?void 0:y.call(m,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function _A(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function r9(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var bn,Ki,Xi,Zc,Qc,Yi,Jc,eu,zk,s9=(zk=class{constructor(e={}){qt(this,bn);qt(this,Ki);qt(this,Xi);qt(this,Zc);qt(this,Qc);qt(this,Yi);qt(this,Jc);qt(this,eu);Tt(this,bn,e.queryCache||new J7),Tt(this,Ki,e.mutationCache||new n9),Tt(this,Xi,e.defaultOptions||{}),Tt(this,Zc,new Map),Tt(this,Qc,new Map),Tt(this,Yi,0)}mount(){Np(this,Yi)._++,pe(this,Yi)===1&&(Tt(this,Jc,zM.subscribe(async e=>{e&&(await this.resumePausedMutations(),pe(this,bn).onFocus())})),Tt(this,eu,lg.subscribe(async e=>{e&&(await this.resumePausedMutations(),pe(this,bn).onOnline())})))}unmount(){var e,t;Np(this,Yi)._--,pe(this,Yi)===0&&((e=pe(this,Jc))==null||e.call(this),Tt(this,Jc,void 0),(t=pe(this,eu))==null||t.call(this),Tt(this,eu,void 0))}isFetching(e){return pe(this,bn).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return pe(this,Ki).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=pe(this,bn).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=pe(this,bn).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(xA(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return pe(this,bn).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=pe(this,bn).get(r.queryHash),a=s==null?void 0:s.state.data,o=D7(t,a);if(o!==void 0)return pe(this,bn).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return Pr.batch(()=>pe(this,bn).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=pe(this,bn).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=pe(this,bn);Pr.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=pe(this,bn),r={type:"active",...e};return Pr.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=Pr.batch(()=>pe(this,bn).findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(Ls).catch(Ls)}invalidateQueries(e={},t={}){return Pr.batch(()=>{if(pe(this,bn).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=Pr.batch(()=>pe(this,bn).findAll(e).filter(s=>!s.isDisabled()).map(s=>{let a=s.fetch(void 0,n);return n.throwOnError||(a=a.catch(Ls)),s.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(r).then(Ls)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=pe(this,bn).build(this,t);return n.isStaleByTime(xA(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ls).catch(Ls)}fetchInfiniteQuery(e){return e.behavior=NA(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ls).catch(Ls)}ensureInfiniteQueryData(e){return e.behavior=NA(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return lg.isOnline()?pe(this,Ki).resumePausedMutations():Promise.resolve()}getQueryCache(){return pe(this,bn)}getMutationCache(){return pe(this,Ki)}getDefaultOptions(){return pe(this,Xi)}setDefaultOptions(e){Tt(this,Xi,e)}setQueryDefaults(e,t){pe(this,Zc).set(Df(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...pe(this,Zc).values()];let n={};return t.forEach(r=>{Lf(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){pe(this,Qc).set(Df(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...pe(this,Qc).values()];let n={};return t.forEach(r=>{Lf(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...pe(this,Xi).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=AS(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===CS&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...pe(this,Xi).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){pe(this,bn).clear(),pe(this,Ki).clear()}},bn=new WeakMap,Ki=new WeakMap,Xi=new WeakMap,Zc=new WeakMap,Qc=new WeakMap,Yi=new WeakMap,Jc=new WeakMap,eu=new WeakMap,zk),a9=v.createContext(void 0),i9=({client:e,children:t})=>(v.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),i.jsx(a9.Provider,{value:e,children:t}));/** + * @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 Ff(){return Ff=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function GM(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function l9(){return Math.random().toString(36).substr(2,8)}function AA(e,t){return{usr:e.state,key:e.key,idx:t}}function aw(e,t,n,r){return n===void 0&&(n=null),Ff({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Ku(t):t,{state:n,key:t&&t.key||r||l9()})}function cg(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function Ku(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function c9(e,t,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:a=!1}=r,o=s.history,l=Ji.Pop,c=null,u=d();u==null&&(u=0,o.replaceState(Ff({},o.state,{idx:u}),""));function d(){return(o.state||{idx:null}).idx}function f(){l=Ji.Pop;let y=d(),b=y==null?null:y-u;u=y,c&&c({action:l,location:m.location,delta:b})}function h(y,b){l=Ji.Push;let x=aw(m.location,y,b);u=d()+1;let w=AA(x,u),j=m.createHref(x);try{o.pushState(w,"",j)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(j)}a&&c&&c({action:l,location:m.location,delta:1})}function p(y,b){l=Ji.Replace;let x=aw(m.location,y,b);u=d();let w=AA(x,u),j=m.createHref(x);o.replaceState(w,"",j),a&&c&&c({action:l,location:m.location,delta:0})}function g(y){let b=s.location.origin!=="null"?s.location.origin:s.location.href,x=typeof y=="string"?y:cg(y);return x=x.replace(/ $/,"%20"),On(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let m={get action(){return l},get location(){return e(s,o)},listen(y){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(PA,f),c=y,()=>{s.removeEventListener(PA,f),c=null}},createHref(y){return t(s,y)},createURL:g,encodeLocation(y){let b=g(y);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:h,replace:p,go(y){return o.go(y)}};return m}var CA;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(CA||(CA={}));function u9(e,t,n){return n===void 0&&(n="/"),d9(e,t,n,!1)}function d9(e,t,n,r){let s=typeof t=="string"?Ku(t):t,a=ES(s.pathname||"/",n);if(a==null)return null;let o=qM(e);f9(o);let l=null;for(let c=0;l==null&&c{let c={relativePath:l===void 0?a.path||"":l,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};c.relativePath.startsWith("/")&&(On(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let u=uo([r,c.relativePath]),d=n.concat(c);a.children&&a.children.length>0&&(On(a.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),qM(a.children,t,d,u)),!(a.path==null&&!a.index)&&t.push({path:u,score:x9(u,a.index),routesMeta:d})};return e.forEach((a,o)=>{var l;if(a.path===""||!((l=a.path)!=null&&l.includes("?")))s(a,o);else for(let c of KM(a.path))s(a,o,c)}),t}function KM(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,s=n.endsWith("?"),a=n.replace(/\?$/,"");if(r.length===0)return s?[a,""]:[a];let o=KM(r.join("/")),l=[];return l.push(...o.map(c=>c===""?a:[a,c].join("/"))),s&&l.push(...o),l.map(c=>e.startsWith("/")&&c===""?"/":c)}function f9(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:b9(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const h9=/^:[\w-]+$/,p9=3,m9=2,g9=1,v9=10,y9=-2,EA=e=>e==="*";function x9(e,t){let n=e.split("/"),r=n.length;return n.some(EA)&&(r+=y9),t&&(r+=m9),n.filter(s=>!EA(s)).reduce((s,a)=>s+(h9.test(a)?p9:a===""?g9:v9),r)}function b9(e,t){return e.length===t.length&&e.slice(0,-1).every((r,s)=>r===t[s])?e[e.length-1]-t[t.length-1]:0}function w9(e,t,n){let{routesMeta:r}=e,s={},a="/",o=[];for(let l=0;l{let{paramName:h,isOptional:p}=d;if(h==="*"){let m=l[f]||"";o=a.slice(0,a.length-m.length).replace(/(.)\/+$/,"$1")}const g=l[f];return p&&!g?u[h]=void 0:u[h]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:a,pathnameBase:o,pattern:e}}function j9(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),GM(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),r]}function S9(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return GM(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function ES(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function N9(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:s=""}=typeof e=="string"?Ku(e):e;return{pathname:n?n.startsWith("/")?n:_9(n,t):t,search:C9(r),hash:E9(s)}}function _9(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function u0(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` 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 P9(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function OS(e,t){let n=P9(e);return t?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function kS(e,t,n,r){r===void 0&&(r=!1);let s;typeof e=="string"?s=Ku(e):(s=Ff({},e),On(!s.pathname||!s.pathname.includes("?"),u0("?","pathname","search",s)),On(!s.pathname||!s.pathname.includes("#"),u0("#","pathname","hash",s)),On(!s.search||!s.search.includes("#"),u0("#","search","hash",s)));let a=e===""||s.pathname==="",o=a?"/":s.pathname,l;if(o==null)l=n;else{let f=t.length-1;if(!r&&o.startsWith("..")){let h=o.split("/");for(;h[0]==="..";)h.shift(),f-=1;s.pathname=h.join("/")}l=f>=0?t[f]:"/"}let c=N9(s,l),u=o&&o!=="/"&&o.endsWith("/"),d=(a||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const uo=e=>e.join("/").replace(/\/\/+/g,"/"),A9=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),C9=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,E9=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function O9(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const XM=["post","put","patch","delete"];new Set(XM);const k9=["get",...XM];new Set(k9);/** + * 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 Bf(){return Bf=Object.assign?Object.assign.bind():function(e){for(var t=1;t{l.current=!0}),v.useCallback(function(u,d){if(d===void 0&&(d={}),!l.current)return;if(typeof u=="number"){r.go(u);return}let f=kS(u,JSON.parse(o),a,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:uo([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,o,a,e])}function QM(){let{matches:e}=v.useContext(_i),t=e[e.length-1];return t?t.params:{}}function JM(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=v.useContext(Ro),{matches:s}=v.useContext(_i),{pathname:a}=qr(),o=JSON.stringify(OS(s,r.v7_relativeSplatPath));return v.useMemo(()=>kS(e,JSON.parse(o),a,n==="path"),[e,o,a,n])}function I9(e,t){return R9(e,t)}function R9(e,t,n,r){Xu()||On(!1);let{navigator:s}=v.useContext(Ro),{matches:a}=v.useContext(_i),o=a[a.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let u=qr(),d;if(t){var f;let y=typeof t=="string"?Ku(t):t;c==="/"||(f=y.pathname)!=null&&f.startsWith(c)||On(!1),d=y}else d=u;let h=d.pathname||"/",p=h;if(c!=="/"){let y=c.replace(/^\//,"").split("/");p="/"+h.replace(/^\//,"").split("/").slice(y.length).join("/")}let g=u9(e,{pathname:p}),m=z9(g&&g.map(y=>Object.assign({},y,{params:Object.assign({},l,y.params),pathname:uo([c,s.encodeLocation?s.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?c:uo([c,s.encodeLocation?s.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),a,n,r);return t&&m?v.createElement(py.Provider,{value:{location:Bf({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Ji.Pop}},m):m}function D9(){let e=H9(),t=O9(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:s},n):null,null)}const L9=v.createElement(D9,null);class F9 extends v.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?v.createElement(_i.Provider,{value:this.props.routeContext},v.createElement(YM.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function B9(e){let{routeContext:t,match:n,children:r}=e,s=v.useContext(TS);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),v.createElement(_i.Provider,{value:t},r)}function z9(e,t,n,r){var s;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var a;if(!n)return null;if(n.errors)e=n.matches;else if((a=r)!=null&&a.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let o=e,l=(s=n)==null?void 0:s.errors;if(l!=null){let d=o.findIndex(f=>f.route.id&&(l==null?void 0:l[f.route.id])!==void 0);d>=0||On(!1),o=o.slice(0,Math.min(o.length,d+1))}let c=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?o=o.slice(0,u+1):o=[o[0]];break}}}return o.reduceRight((d,f,h)=>{let p,g=!1,m=null,y=null;n&&(p=l&&f.route.id?l[f.route.id]:void 0,m=f.route.errorElement||L9,c&&(u<0&&h===0?(g=!0,y=null):u===h&&(g=!0,y=f.route.hydrateFallbackElement||null)));let b=t.concat(o.slice(0,h+1)),x=()=>{let w;return p?w=m:g?w=y:f.route.Component?w=v.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,v.createElement(B9,{match:f,routeContext:{outlet:d,matches:b,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?v.createElement(F9,{location:n.location,revalidation:n.revalidation,component:m,error:p,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var eI=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(eI||{}),ug=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ug||{});function U9(e){let t=v.useContext(TS);return t||On(!1),t}function V9(e){let t=v.useContext(T9);return t||On(!1),t}function W9(e){let t=v.useContext(_i);return t||On(!1),t}function tI(e){let t=W9(),n=t.matches[t.matches.length-1];return n.route.id||On(!1),n.route.id}function H9(){var e;let t=v.useContext(YM),n=V9(ug.UseRouteError),r=tI(ug.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function G9(){let{router:e}=U9(eI.UseNavigateStable),t=tI(ug.UseNavigateStable),n=v.useRef(!1);return ZM(()=>{n.current=!0}),v.useCallback(function(s,a){a===void 0&&(a={}),n.current&&(typeof s=="number"?e.navigate(s):e.navigate(s,Bf({fromRouteId:t},a)))},[e,t])}function nI(e){let{to:t,replace:n,state:r,relative:s}=e;Xu()||On(!1);let{future:a,static:o}=v.useContext(Ro),{matches:l}=v.useContext(_i),{pathname:c}=qr(),u=Tn(),d=kS(t,OS(l,a.v7_relativeSplatPath),c,s==="path"),f=JSON.stringify(d);return v.useEffect(()=>u(JSON.parse(f),{replace:n,state:r,relative:s}),[u,f,s,n,r]),null}function Is(e){On(!1)}function q9(e){let{basename:t="/",children:n=null,location:r,navigationType:s=Ji.Pop,navigator:a,static:o=!1,future:l}=e;Xu()&&On(!1);let c=t.replace(/^\/*/,"/"),u=v.useMemo(()=>({basename:c,navigator:a,static:o,future:Bf({v7_relativeSplatPath:!1},l)}),[c,l,a,o]);typeof r=="string"&&(r=Ku(r));let{pathname:d="/",search:f="",hash:h="",state:p=null,key:g="default"}=r,m=v.useMemo(()=>{let y=ES(d,c);return y==null?null:{location:{pathname:y,search:f,hash:h,state:p,key:g},navigationType:s}},[c,d,f,h,p,g,s]);return m==null?null:v.createElement(Ro.Provider,{value:u},v.createElement(py.Provider,{children:n,value:m}))}function K9(e){let{children:t,location:n}=e;return I9(iw(t),n)}new Promise(()=>{});function iw(e,t){t===void 0&&(t=[]);let n=[];return v.Children.forEach(e,(r,s)=>{if(!v.isValidElement(r))return;let a=[...t,s];if(r.type===v.Fragment){n.push.apply(n,iw(r.props.children,a));return}r.type!==Is&&On(!1),!r.props.index||!r.props.children||On(!1);let o={id:r.props.id||a.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&&(o.children=iw(r.props.children,a)),n.push(o)}),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 ow(){return ow=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[s]=e[s]);return n}function Y9(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Z9(e,t){return e.button===0&&(!t||t==="_self")&&!Y9(e)}function lw(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function Q9(e,t){let n=lw(e);return t&&t.forEach((r,s)=>{n.has(s)||t.getAll(s).forEach(a=>{n.append(s,a)})}),n}const J9=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],eW="6";try{window.__reactRouterVersion=eW}catch{}const tW="startTransition",kA=Qk[tW];function nW(e){let{basename:t,children:n,future:r,window:s}=e,a=v.useRef();a.current==null&&(a.current=o9({window:s,v5Compat:!0}));let o=a.current,[l,c]=v.useState({action:o.action,location:o.location}),{v7_startTransition:u}=r||{},d=v.useCallback(f=>{u&&kA?kA(()=>c(f)):c(f)},[c,u]);return v.useLayoutEffect(()=>o.listen(d),[o,d]),v.createElement(q9,{basename:t,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const rW=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",sW=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,bs=v.forwardRef(function(t,n){let{onClick:r,relative:s,reloadDocument:a,replace:o,state:l,target:c,to:u,preventScrollReset:d,viewTransition:f}=t,h=X9(t,J9),{basename:p}=v.useContext(Ro),g,m=!1;if(typeof u=="string"&&sW.test(u)&&(g=u,rW))try{let w=new URL(window.location.href),j=u.startsWith("//")?new URL(w.protocol+u):new URL(u),S=ES(j.pathname,p);j.origin===w.origin&&S!=null?u=S+j.search+j.hash:m=!0}catch{}let y=$9(u,{relative:s}),b=aW(u,{replace:o,state:l,target:c,preventScrollReset:d,relative:s,viewTransition:f});function x(w){r&&r(w),w.defaultPrevented||b(w)}return v.createElement("a",ow({},h,{href:g||y,onClick:m||a?r:x,ref:n,target:c}))});var TA;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(TA||(TA={}));var $A;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})($A||($A={}));function aW(e,t){let{target:n,replace:r,state:s,preventScrollReset:a,relative:o,viewTransition:l}=t===void 0?{}:t,c=Tn(),u=qr(),d=JM(e,{relative:o});return v.useCallback(f=>{if(Z9(f,n)){f.preventDefault();let h=r!==void 0?r:cg(u)===cg(d);c(e,{replace:h,state:s,preventScrollReset:a,relative:o,viewTransition:l})}},[u,c,d,r,s,n,e,a,o,l])}function iW(e){let t=v.useRef(lw(e)),n=v.useRef(!1),r=qr(),s=v.useMemo(()=>Q9(r.search,n.current?null:t.current),[r.search]),a=Tn(),o=v.useCallback((l,c)=>{const u=lw(typeof l=="function"?l(s):l);n.current=!0,a("?"+u,c)},[a,s]);return[s,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 oW=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),rI=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===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 lW={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 cW=v.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:o,...l},c)=>v.createElement("svg",{ref:c,...lW,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:rI("lucide",s),...l},[...o.map(([u,d])=>v.createElement(u,d)),...Array.isArray(a)?a:[a]]));/** + * @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 Re=(e,t)=>{const n=v.forwardRef(({className:r,...s},a)=>v.createElement(cW,{ref:a,iconNode:t,className:rI(`lucide-${oW(e)}`,r),...s}));return n.displayName=`${e}`,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 Za=Re("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 MA=Re("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 zf=Re("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 d0=Re("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 fo=Re("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 kl=Re("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 IA=Re("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 uW=Re("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 dW=Re("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 cw=Re("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 fW=Re("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 Ta=Re("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 yi=Re("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 zs=Re("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 Tl=Re("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 hW=Re("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 $S=Re("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 Gd=Re("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 sI=Re("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 pW=Re("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 mW=Re("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 MS=Re("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 gW=Re("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 Uf=Re("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 aI=Re("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 RA=Re("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 $l=Re("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 uw=Re("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 vW=Re("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 dw=Re("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 IS=Re("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 iI=Re("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 Us=Re("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 yW=Re("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 fw=Re("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 hw=Re("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 _m=Re("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 xW=Re("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 bW=Re("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 pw=Re("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 wW=Re("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 Ml=Re("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 qp=Re("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 ii=Re("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 jW=Re("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 DA=Re("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 LA=Re("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 SW=Re("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 NW=Re("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 xa=Re("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 $a=Re("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 _W=Re("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 FA=Re("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 BA=Re("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 PW=Re("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 AW=Re("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 pr=Re("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 CW=Re("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 Lc=Re("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 RS=Re("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 DS=Re("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 LS=Re("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 EW=Re("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 OW=Re("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 kW=Re("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 TW=Re("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 $W=Re("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 dg=Re("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 MW=Re("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 Pm=Re("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 _n=Re("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 IW=Re("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 RW=Re("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 oI=Re("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 fg=Re("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 or=Re("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 DW=Re("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 Zs=Re("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 lI=Re("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 cI(e,t){return function(){return e.apply(t,arguments)}}const{toString:LW}=Object.prototype,{getPrototypeOf:FS}=Object,{iterator:my,toStringTag:uI}=Symbol,gy=(e=>t=>{const n=LW.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),la=e=>(e=e.toLowerCase(),t=>gy(t)===e),vy=e=>t=>typeof t===e,{isArray:Yu}=Array,Vf=vy("undefined");function FW(e){return e!==null&&!Vf(e)&&e.constructor!==null&&!Vf(e.constructor)&&Wr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const dI=la("ArrayBuffer");function BW(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&dI(e.buffer),t}const zW=vy("string"),Wr=vy("function"),fI=vy("number"),yy=e=>e!==null&&typeof e=="object",UW=e=>e===!0||e===!1,Am=e=>{if(gy(e)!=="object")return!1;const t=FS(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(uI in e)&&!(my in e)},VW=la("Date"),WW=la("File"),HW=la("Blob"),GW=la("FileList"),qW=e=>yy(e)&&Wr(e.pipe),KW=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Wr(e.append)&&((t=gy(e))==="formdata"||t==="object"&&Wr(e.toString)&&e.toString()==="[object FormData]"))},XW=la("URLSearchParams"),[YW,ZW,QW,JW]=["ReadableStream","Request","Response","Headers"].map(la),eH=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function np(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Yu(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const sl=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,pI=e=>!Vf(e)&&e!==sl;function mw(){const{caseless:e}=pI(this)&&this||{},t={},n=(r,s)=>{const a=e&&hI(t,s)||s;Am(t[a])&&Am(r)?t[a]=mw(t[a],r):Am(r)?t[a]=mw({},r):Yu(r)?t[a]=r.slice():t[a]=r};for(let r=0,s=arguments.length;r(np(t,(s,a)=>{n&&Wr(s)?e[a]=cI(s,n):e[a]=s},{allOwnKeys:r}),e),nH=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),rH=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},sH=(e,t,n,r)=>{let s,a,o;const l={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),a=s.length;a-- >0;)o=s[a],(!r||r(o,e,t))&&!l[o]&&(t[o]=e[o],l[o]=!0);e=n!==!1&&FS(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},aH=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},iH=e=>{if(!e)return null;if(Yu(e))return e;let t=e.length;if(!fI(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},oH=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&FS(Uint8Array)),lH=(e,t)=>{const r=(e&&e[my]).call(e);let s;for(;(s=r.next())&&!s.done;){const a=s.value;t.call(e,a[0],a[1])}},cH=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},uH=la("HTMLFormElement"),dH=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),zA=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),fH=la("RegExp"),mI=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};np(n,(s,a)=>{let o;(o=t(s,a,e))!==!1&&(r[a]=o||s)}),Object.defineProperties(e,r)},hH=e=>{mI(e,(t,n)=>{if(Wr(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(Wr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},pH=(e,t)=>{const n={},r=s=>{s.forEach(a=>{n[a]=!0})};return Yu(e)?r(e):r(String(e).split(t)),n},mH=()=>{},gH=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function vH(e){return!!(e&&Wr(e.append)&&e[uI]==="FormData"&&e[my])}const yH=e=>{const t=new Array(10),n=(r,s)=>{if(yy(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const a=Yu(r)?[]:{};return np(r,(o,l)=>{const c=n(o,s+1);!Vf(c)&&(a[l]=c)}),t[s]=void 0,a}}return r};return n(e,0)},xH=la("AsyncFunction"),bH=e=>e&&(yy(e)||Wr(e))&&Wr(e.then)&&Wr(e.catch),gI=((e,t)=>e?setImmediate:t?((n,r)=>(sl.addEventListener("message",({source:s,data:a})=>{s===sl&&a===n&&r.length&&r.shift()()},!1),s=>{r.push(s),sl.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",Wr(sl.postMessage)),wH=typeof queueMicrotask<"u"?queueMicrotask.bind(sl):typeof process<"u"&&process.nextTick||gI,jH=e=>e!=null&&Wr(e[my]),ae={isArray:Yu,isArrayBuffer:dI,isBuffer:FW,isFormData:KW,isArrayBufferView:BW,isString:zW,isNumber:fI,isBoolean:UW,isObject:yy,isPlainObject:Am,isReadableStream:YW,isRequest:ZW,isResponse:QW,isHeaders:JW,isUndefined:Vf,isDate:VW,isFile:WW,isBlob:HW,isRegExp:fH,isFunction:Wr,isStream:qW,isURLSearchParams:XW,isTypedArray:oH,isFileList:GW,forEach:np,merge:mw,extend:tH,trim:eH,stripBOM:nH,inherits:rH,toFlatObject:sH,kindOf:gy,kindOfTest:la,endsWith:aH,toArray:iH,forEachEntry:lH,matchAll:cH,isHTMLForm:uH,hasOwnProperty:zA,hasOwnProp:zA,reduceDescriptors:mI,freezeMethods:hH,toObjectSet:pH,toCamelCase:dH,noop:mH,toFiniteNumber:gH,findKey:hI,global:sl,isContextDefined:pI,isSpecCompliantForm:vH,toJSONObject:yH,isAsyncFn:xH,isThenable:bH,setImmediate:gI,asap:wH,isIterable:jH};function _t(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}ae.inherits(_t,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:ae.toJSONObject(this.config),code:this.code,status:this.status}}});const vI=_t.prototype,yI={};["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(e=>{yI[e]={value:e}});Object.defineProperties(_t,yI);Object.defineProperty(vI,"isAxiosError",{value:!0});_t.from=(e,t,n,r,s,a)=>{const o=Object.create(vI);return ae.toFlatObject(e,o,function(c){return c!==Error.prototype},l=>l!=="isAxiosError"),_t.call(o,e.message,t,n,r,s),o.cause=e,o.name=e.name,a&&Object.assign(o,a),o};const SH=null;function gw(e){return ae.isPlainObject(e)||ae.isArray(e)}function xI(e){return ae.endsWith(e,"[]")?e.slice(0,-2):e}function UA(e,t,n){return e?e.concat(t).map(function(s,a){return s=xI(s),!n&&a?"["+s+"]":s}).join(n?".":""):t}function NH(e){return ae.isArray(e)&&!e.some(gw)}const _H=ae.toFlatObject(ae,{},null,function(t){return/^is[A-Z]/.test(t)});function xy(e,t,n){if(!ae.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=ae.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,y){return!ae.isUndefined(y[m])});const r=n.metaTokens,s=n.visitor||d,a=n.dots,o=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&ae.isSpecCompliantForm(t);if(!ae.isFunction(s))throw new TypeError("visitor must be a function");function u(g){if(g===null)return"";if(ae.isDate(g))return g.toISOString();if(!c&&ae.isBlob(g))throw new _t("Blob is not supported. Use a Buffer instead.");return ae.isArrayBuffer(g)||ae.isTypedArray(g)?c&&typeof Blob=="function"?new Blob([g]):Buffer.from(g):g}function d(g,m,y){let b=g;if(g&&!y&&typeof g=="object"){if(ae.endsWith(m,"{}"))m=r?m:m.slice(0,-2),g=JSON.stringify(g);else if(ae.isArray(g)&&NH(g)||(ae.isFileList(g)||ae.endsWith(m,"[]"))&&(b=ae.toArray(g)))return m=xI(m),b.forEach(function(w,j){!(ae.isUndefined(w)||w===null)&&t.append(o===!0?UA([m],j,a):o===null?m:m+"[]",u(w))}),!1}return gw(g)?!0:(t.append(UA(y,m,a),u(g)),!1)}const f=[],h=Object.assign(_H,{defaultVisitor:d,convertValue:u,isVisitable:gw});function p(g,m){if(!ae.isUndefined(g)){if(f.indexOf(g)!==-1)throw Error("Circular reference detected in "+m.join("."));f.push(g),ae.forEach(g,function(b,x){(!(ae.isUndefined(b)||b===null)&&s.call(t,b,ae.isString(x)?x.trim():x,m,h))===!0&&p(b,m?m.concat(x):[x])}),f.pop()}}if(!ae.isObject(e))throw new TypeError("data must be an object");return p(e),t}function VA(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function BS(e,t){this._pairs=[],e&&xy(e,this,t)}const bI=BS.prototype;bI.append=function(t,n){this._pairs.push([t,n])};bI.toString=function(t){const n=t?function(r){return t.call(this,r,VA)}:VA;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function PH(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function wI(e,t,n){if(!t)return e;const r=n&&n.encode||PH;ae.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let a;if(s?a=s(t,n):a=ae.isURLSearchParams(t)?t.toString():new BS(t,n).toString(r),a){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}class WA{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ae.forEach(this.handlers,function(r){r!==null&&t(r)})}}const jI={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},AH=typeof URLSearchParams<"u"?URLSearchParams:BS,CH=typeof FormData<"u"?FormData:null,EH=typeof Blob<"u"?Blob:null,OH={isBrowser:!0,classes:{URLSearchParams:AH,FormData:CH,Blob:EH},protocols:["http","https","file","blob","url","data"]},zS=typeof window<"u"&&typeof document<"u",vw=typeof navigator=="object"&&navigator||void 0,kH=zS&&(!vw||["ReactNative","NativeScript","NS"].indexOf(vw.product)<0),TH=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$H=zS&&window.location.href||"http://localhost",MH=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:zS,hasStandardBrowserEnv:kH,hasStandardBrowserWebWorkerEnv:TH,navigator:vw,origin:$H},Symbol.toStringTag,{value:"Module"})),yr={...MH,...OH};function IH(e,t){return xy(e,new yr.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,a){return yr.isNode&&ae.isBuffer(n)?(this.append(r,n.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function RH(e){return ae.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function DH(e){const t={},n=Object.keys(e);let r;const s=n.length;let a;for(r=0;r=n.length;return o=!o&&ae.isArray(s)?s.length:o,c?(ae.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!l):((!s[o]||!ae.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],a)&&ae.isArray(s[o])&&(s[o]=DH(s[o])),!l)}if(ae.isFormData(e)&&ae.isFunction(e.entries)){const n={};return ae.forEachEntry(e,(r,s)=>{t(RH(r),s,n,0)}),n}return null}function LH(e,t,n){if(ae.isString(e))try{return(t||JSON.parse)(e),ae.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(0,JSON.stringify)(e)}const rp={transitional:jI,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,a=ae.isObject(t);if(a&&ae.isHTMLForm(t)&&(t=new FormData(t)),ae.isFormData(t))return s?JSON.stringify(SI(t)):t;if(ae.isArrayBuffer(t)||ae.isBuffer(t)||ae.isStream(t)||ae.isFile(t)||ae.isBlob(t)||ae.isReadableStream(t))return t;if(ae.isArrayBufferView(t))return t.buffer;if(ae.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(r.indexOf("application/x-www-form-urlencoded")>-1)return IH(t,this.formSerializer).toString();if((l=ae.isFileList(t))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return xy(l?{"files[]":t}:t,c&&new c,this.formSerializer)}}return a||s?(n.setContentType("application/json",!1),LH(t)):t}],transformResponse:[function(t){const n=this.transitional||rp.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(ae.isResponse(t)||ae.isReadableStream(t))return t;if(t&&ae.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(l){if(o)throw l.name==="SyntaxError"?_t.from(l,_t.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:yr.classes.FormData,Blob:yr.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ae.forEach(["delete","get","head","post","put","patch"],e=>{rp.headers[e]={}});const FH=ae.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"]),BH=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&FH[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},HA=Symbol("internals");function Cd(e){return e&&String(e).trim().toLowerCase()}function Cm(e){return e===!1||e==null?e:ae.isArray(e)?e.map(Cm):String(e)}function zH(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const UH=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function f0(e,t,n,r,s){if(ae.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!ae.isString(t)){if(ae.isString(r))return t.indexOf(r)!==-1;if(ae.isRegExp(r))return r.test(t)}}function VH(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function WH(e,t){const n=ae.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,a,o){return this[r].call(this,t,s,a,o)},configurable:!0})})}class Hr{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function a(l,c,u){const d=Cd(c);if(!d)throw new Error("header name must be a non-empty string");const f=ae.findKey(s,d);(!f||s[f]===void 0||u===!0||u===void 0&&s[f]!==!1)&&(s[f||c]=Cm(l))}const o=(l,c)=>ae.forEach(l,(u,d)=>a(u,d,c));if(ae.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(ae.isString(t)&&(t=t.trim())&&!UH(t))o(BH(t),n);else if(ae.isObject(t)&&ae.isIterable(t)){let l={},c,u;for(const d of t){if(!ae.isArray(d))throw TypeError("Object iterator must return a key-value pair");l[u=d[0]]=(c=l[u])?ae.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}o(l,n)}else t!=null&&a(n,t,r);return this}get(t,n){if(t=Cd(t),t){const r=ae.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return zH(s);if(ae.isFunction(n))return n.call(this,s,r);if(ae.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Cd(t),t){const r=ae.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||f0(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function a(o){if(o=Cd(o),o){const l=ae.findKey(r,o);l&&(!n||f0(r,r[l],l,n))&&(delete r[l],s=!0)}}return ae.isArray(t)?t.forEach(a):a(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const a=n[r];(!t||f0(this,this[a],a,t,!0))&&(delete this[a],s=!0)}return s}normalize(t){const n=this,r={};return ae.forEach(this,(s,a)=>{const o=ae.findKey(r,a);if(o){n[o]=Cm(s),delete n[a];return}const l=t?VH(a):String(a).trim();l!==a&&delete n[a],n[l]=Cm(s),r[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return ae.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&ae.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[HA]=this[HA]={accessors:{}}).accessors,s=this.prototype;function a(o){const l=Cd(o);r[l]||(WH(s,o),r[l]=!0)}return ae.isArray(t)?t.forEach(a):a(t),this}}Hr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ae.reduceDescriptors(Hr.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});ae.freezeMethods(Hr);function h0(e,t){const n=this||rp,r=t||n,s=Hr.from(r.headers);let a=r.data;return ae.forEach(e,function(l){a=l.call(n,a,s.normalize(),t?t.status:void 0)}),s.normalize(),a}function NI(e){return!!(e&&e.__CANCEL__)}function Zu(e,t,n){_t.call(this,e??"canceled",_t.ERR_CANCELED,t,n),this.name="CanceledError"}ae.inherits(Zu,_t,{__CANCEL__:!0});function _I(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new _t("Request failed with status code "+n.status,[_t.ERR_BAD_REQUEST,_t.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function HH(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function GH(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,a=0,o;return t=t!==void 0?t:1e3,function(c){const u=Date.now(),d=r[a];o||(o=u),n[s]=c,r[s]=u;let f=a,h=0;for(;f!==s;)h+=n[f++],f=f%e;if(s=(s+1)%e,s===a&&(a=(a+1)%e),u-o{n=d,s=null,a&&(clearTimeout(a),a=null),e.apply(null,u)};return[(...u)=>{const d=Date.now(),f=d-n;f>=r?o(u,d):(s=u,a||(a=setTimeout(()=>{a=null,o(s)},r-f)))},()=>s&&o(s)]}const hg=(e,t,n=3)=>{let r=0;const s=GH(50,250);return qH(a=>{const o=a.loaded,l=a.lengthComputable?a.total:void 0,c=o-r,u=s(c),d=o<=l;r=o;const f={loaded:o,total:l,progress:l?o/l:void 0,bytes:c,rate:u||void 0,estimated:u&&l&&d?(l-o)/u:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(f)},n)},GA=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},qA=e=>(...t)=>ae.asap(()=>e(...t)),KH=yr.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,yr.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(yr.origin),yr.navigator&&/(msie|trident)/i.test(yr.navigator.userAgent)):()=>!0,XH=yr.hasStandardBrowserEnv?{write(e,t,n,r,s,a){const o=[e+"="+encodeURIComponent(t)];ae.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),ae.isString(r)&&o.push("path="+r),ae.isString(s)&&o.push("domain="+s),a===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function YH(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function ZH(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function PI(e,t,n){let r=!YH(t);return e&&(r||n==!1)?ZH(e,t):t}const KA=e=>e instanceof Hr?{...e}:e;function Il(e,t){t=t||{};const n={};function r(u,d,f,h){return ae.isPlainObject(u)&&ae.isPlainObject(d)?ae.merge.call({caseless:h},u,d):ae.isPlainObject(d)?ae.merge({},d):ae.isArray(d)?d.slice():d}function s(u,d,f,h){if(ae.isUndefined(d)){if(!ae.isUndefined(u))return r(void 0,u,f,h)}else return r(u,d,f,h)}function a(u,d){if(!ae.isUndefined(d))return r(void 0,d)}function o(u,d){if(ae.isUndefined(d)){if(!ae.isUndefined(u))return r(void 0,u)}else return r(void 0,d)}function l(u,d,f){if(f in t)return r(u,d);if(f in e)return r(void 0,u)}const c={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:l,headers:(u,d,f)=>s(KA(u),KA(d),f,!0)};return ae.forEach(Object.keys(Object.assign({},e,t)),function(d){const f=c[d]||s,h=f(e[d],t[d],d);ae.isUndefined(h)&&f!==l||(n[d]=h)}),n}const AI=e=>{const t=Il({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:a,headers:o,auth:l}=t;t.headers=o=Hr.from(o),t.url=wI(PI(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),l&&o.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let c;if(ae.isFormData(n)){if(yr.hasStandardBrowserEnv||yr.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((c=o.getContentType())!==!1){const[u,...d]=c?c.split(";").map(f=>f.trim()).filter(Boolean):[];o.setContentType([u||"multipart/form-data",...d].join("; "))}}if(yr.hasStandardBrowserEnv&&(r&&ae.isFunction(r)&&(r=r(t)),r||r!==!1&&KH(t.url))){const u=s&&a&&XH.read(a);u&&o.set(s,u)}return t},QH=typeof XMLHttpRequest<"u",JH=QH&&function(e){return new Promise(function(n,r){const s=AI(e);let a=s.data;const o=Hr.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:u}=s,d,f,h,p,g;function m(){p&&p(),g&&g(),s.cancelToken&&s.cancelToken.unsubscribe(d),s.signal&&s.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(s.method.toUpperCase(),s.url,!0),y.timeout=s.timeout;function b(){if(!y)return;const w=Hr.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),S={data:!l||l==="text"||l==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:w,config:e,request:y};_I(function(_){n(_),m()},function(_){r(_),m()},S),y=null}"onloadend"in y?y.onloadend=b:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(b)},y.onabort=function(){y&&(r(new _t("Request aborted",_t.ECONNABORTED,e,y)),y=null)},y.onerror=function(){r(new _t("Network Error",_t.ERR_NETWORK,e,y)),y=null},y.ontimeout=function(){let j=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const S=s.transitional||jI;s.timeoutErrorMessage&&(j=s.timeoutErrorMessage),r(new _t(j,S.clarifyTimeoutError?_t.ETIMEDOUT:_t.ECONNABORTED,e,y)),y=null},a===void 0&&o.setContentType(null),"setRequestHeader"in y&&ae.forEach(o.toJSON(),function(j,S){y.setRequestHeader(S,j)}),ae.isUndefined(s.withCredentials)||(y.withCredentials=!!s.withCredentials),l&&l!=="json"&&(y.responseType=s.responseType),u&&([h,g]=hg(u,!0),y.addEventListener("progress",h)),c&&y.upload&&([f,p]=hg(c),y.upload.addEventListener("progress",f),y.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(d=w=>{y&&(r(!w||w.type?new Zu(null,e,y):w),y.abort(),y=null)},s.cancelToken&&s.cancelToken.subscribe(d),s.signal&&(s.signal.aborted?d():s.signal.addEventListener("abort",d)));const x=HH(s.url);if(x&&yr.protocols.indexOf(x)===-1){r(new _t("Unsupported protocol "+x+":",_t.ERR_BAD_REQUEST,e));return}y.send(a||null)})},eG=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const a=function(u){if(!s){s=!0,l();const d=u instanceof Error?u:this.reason;r.abort(d instanceof _t?d:new Zu(d instanceof Error?d.message:d))}};let o=t&&setTimeout(()=>{o=null,a(new _t(`timeout ${t} of ms exceeded`,_t.ETIMEDOUT))},t);const l=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),e=null)};e.forEach(u=>u.addEventListener("abort",a));const{signal:c}=r;return c.unsubscribe=()=>ae.asap(l),c}},tG=function*(e,t){let n=e.byteLength;if(n{const s=nG(e,t);let a=0,o,l=c=>{o||(o=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await s.next();if(u){l(),c.close();return}let f=d.byteLength;if(n){let h=a+=f;n(h)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},by=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",CI=by&&typeof ReadableStream=="function",sG=by&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),EI=(e,...t)=>{try{return!!e(...t)}catch{return!1}},aG=CI&&EI(()=>{let e=!1;const t=new Request(yr.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),YA=64*1024,yw=CI&&EI(()=>ae.isReadableStream(new Response("").body)),pg={stream:yw&&(e=>e.body)};by&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!pg[t]&&(pg[t]=ae.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new _t(`Response type '${t}' is not supported`,_t.ERR_NOT_SUPPORT,r)})})})(new Response);const iG=async e=>{if(e==null)return 0;if(ae.isBlob(e))return e.size;if(ae.isSpecCompliantForm(e))return(await new Request(yr.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ae.isArrayBufferView(e)||ae.isArrayBuffer(e))return e.byteLength;if(ae.isURLSearchParams(e)&&(e=e+""),ae.isString(e))return(await sG(e)).byteLength},oG=async(e,t)=>{const n=ae.toFiniteNumber(e.getContentLength());return n??iG(t)},lG=by&&(async e=>{let{url:t,method:n,data:r,signal:s,cancelToken:a,timeout:o,onDownloadProgress:l,onUploadProgress:c,responseType:u,headers:d,withCredentials:f="same-origin",fetchOptions:h}=AI(e);u=u?(u+"").toLowerCase():"text";let p=eG([s,a&&a.toAbortSignal()],o),g;const m=p&&p.unsubscribe&&(()=>{p.unsubscribe()});let y;try{if(c&&aG&&n!=="get"&&n!=="head"&&(y=await oG(d,r))!==0){let S=new Request(t,{method:"POST",body:r,duplex:"half"}),N;if(ae.isFormData(r)&&(N=S.headers.get("content-type"))&&d.setContentType(N),S.body){const[_,P]=GA(y,hg(qA(c)));r=XA(S.body,YA,_,P)}}ae.isString(f)||(f=f?"include":"omit");const b="credentials"in Request.prototype;g=new Request(t,{...h,signal:p,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:r,duplex:"half",credentials:b?f:void 0});let x=await fetch(g);const w=yw&&(u==="stream"||u==="response");if(yw&&(l||w&&m)){const S={};["status","statusText","headers"].forEach(k=>{S[k]=x[k]});const N=ae.toFiniteNumber(x.headers.get("content-length")),[_,P]=l&&GA(N,hg(qA(l),!0))||[];x=new Response(XA(x.body,YA,_,()=>{P&&P(),m&&m()}),S)}u=u||"text";let j=await pg[ae.findKey(pg,u)||"text"](x,e);return!w&&m&&m(),await new Promise((S,N)=>{_I(S,N,{data:j,headers:Hr.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:g})})}catch(b){throw m&&m(),b&&b.name==="TypeError"&&/Load failed|fetch/i.test(b.message)?Object.assign(new _t("Network Error",_t.ERR_NETWORK,e,g),{cause:b.cause||b}):_t.from(b,b&&b.code,e,g)}}),xw={http:SH,xhr:JH,fetch:lG};ae.forEach(xw,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const ZA=e=>`- ${e}`,cG=e=>ae.isFunction(e)||e===null||e===!1,OI={getAdapter:e=>{e=ae.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let a=0;a`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let o=t?a.length>1?`since : +`+a.map(ZA).join(` +`):" "+ZA(a[0]):"as no adapter specified";throw new _t("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:xw};function p0(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Zu(null,e)}function QA(e){return p0(e),e.headers=Hr.from(e.headers),e.data=h0.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),OI.getAdapter(e.adapter||rp.adapter)(e).then(function(r){return p0(e),r.data=h0.call(e,e.transformResponse,r),r.headers=Hr.from(r.headers),r},function(r){return NI(r)||(p0(e),r&&r.response&&(r.response.data=h0.call(e,e.transformResponse,r.response),r.response.headers=Hr.from(r.response.headers))),Promise.reject(r)})}const kI="1.9.0",wy={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{wy[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const JA={};wy.transitional=function(t,n,r){function s(a,o){return"[Axios v"+kI+"] Transitional option '"+a+"'"+o+(r?". "+r:"")}return(a,o,l)=>{if(t===!1)throw new _t(s(o," has been removed"+(n?" in "+n:"")),_t.ERR_DEPRECATED);return n&&!JA[o]&&(JA[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(a,o,l):!0}};wy.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function uG(e,t,n){if(typeof e!="object")throw new _t("options must be an object",_t.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const a=r[s],o=t[a];if(o){const l=e[a],c=l===void 0||o(l,a,e);if(c!==!0)throw new _t("option "+a+" must be "+c,_t.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new _t("Unknown option "+a,_t.ERR_BAD_OPTION)}}const Em={assertOptions:uG,validators:wy},pa=Em.validators;class xl{constructor(t){this.defaults=t||{},this.interceptors={request:new WA,response:new WA}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const a=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?a&&!String(r.stack).endsWith(a.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+a):r.stack=a}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Il(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:a}=n;r!==void 0&&Em.assertOptions(r,{silentJSONParsing:pa.transitional(pa.boolean),forcedJSONParsing:pa.transitional(pa.boolean),clarifyTimeoutError:pa.transitional(pa.boolean)},!1),s!=null&&(ae.isFunction(s)?n.paramsSerializer={serialize:s}:Em.assertOptions(s,{encode:pa.function,serialize:pa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Em.assertOptions(n,{baseUrl:pa.spelling("baseURL"),withXsrfToken:pa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=a&&ae.merge(a.common,a[n.method]);a&&ae.forEach(["delete","get","head","post","put","patch","common"],g=>{delete a[g]}),n.headers=Hr.concat(o,a);const l=[];let c=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(n)===!1||(c=c&&m.synchronous,l.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(!c){const g=[QA.bind(this),void 0];for(g.unshift.apply(g,l),g.push.apply(g,u),h=g.length,d=Promise.resolve(n);f{if(!r._listeners)return;let a=r._listeners.length;for(;a-- >0;)r._listeners[a](s);r._listeners=null}),this.promise.then=s=>{let a;const o=new Promise(l=>{r.subscribe(l),a=l}).then(s);return o.cancel=function(){r.unsubscribe(a)},o},t(function(a,o,l){r.reason||(r.reason=new Zu(a,o,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new US(function(s){t=s}),cancel:t}}}function dG(e){return function(n){return e.apply(null,n)}}function fG(e){return ae.isObject(e)&&e.isAxiosError===!0}const bw={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(bw).forEach(([e,t])=>{bw[t]=e});function TI(e){const t=new xl(e),n=cI(xl.prototype.request,t);return ae.extend(n,xl.prototype,t,{allOwnKeys:!0}),ae.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return TI(Il(e,s))},n}const Fn=TI(rp);Fn.Axios=xl;Fn.CanceledError=Zu;Fn.CancelToken=US;Fn.isCancel=NI;Fn.VERSION=kI;Fn.toFormData=xy;Fn.AxiosError=_t;Fn.Cancel=Fn.CanceledError;Fn.all=function(t){return Promise.all(t)};Fn.spread=dG;Fn.isAxiosError=fG;Fn.mergeConfig=Il;Fn.AxiosHeaders=Hr;Fn.formToJSON=e=>SI(ae.isHTMLForm(e)?new FormData(e):e);Fn.getAdapter=OI.getAdapter;Fn.HttpStatusCode=bw;Fn.default=Fn;const $I="https://ai-sandbox.oliver.solutions/semblance_back/api",He=Fn.create({baseURL:$I,headers:{"Content-Type":"application/json"},timeout:6e5});He.interceptors.request.use(e=>{var n;const t=localStorage.getItem("auth_token");return t&&(e.headers.Authorization=`Bearer ${t}`),e.method==="put"&&((n=e.url)!=null&&n.includes("/focus-groups/"))&&console.log("🌐 API Request:",{method:e.method,url:e.url,baseURL:e.baseURL,fullURL:`${e.baseURL}${e.url}`,data:e.data}),e},e=>Promise.reject(e));const ww="auth_error",hG=e=>{e!=null&&e.isPersonaCreation||(localStorage.removeItem("auth_token"),localStorage.removeItem("user"));const t=new CustomEvent(ww,{detail:e||{}});window.dispatchEvent(t)};He.interceptors.response.use(e=>e,e=>{var t,n,r,s,a,o;if(e.response&&e.response.status===401){const l=e.config&&(((t=e.config.url)==null?void 0:t.includes("/personas"))||((n=e.config.url)==null?void 0:n.includes("/personas/batch"))||e.config.method&&((r=e.config.url)==null?void 0:r.startsWith("/personas")));console.log("API Error:",{url:(s=e.config)==null?void 0:s.url,method:(a=e.config)==null?void 0:a.method,isPersonaRequest:l}),l?console.warn("Authentication error in persona request, letting component handle it"):hG({source:(o=e.config)==null?void 0:o.url,isPersonaCreation:!1})}return Promise.reject(e)});const jw={login:(e,t)=>He.post("/auth/login",{username:e,password:t}),register:(e,t,n)=>He.post("/auth/register",{username:e,email:t,password:n}),getProfile:()=>He.get("/auth/me")},Dn={getAll:()=>He.get("/personas/all"),getById:e=>He.get(`/personas/${e}`),create:e=>He.post("/personas",e),update:(e,t)=>e&&e.startsWith("local-")?(console.log("Cannot update with local ID, creating new instead:",e),He.post("/personas",t)):He.put(`/personas/${e}`,t),delete:e=>{const t=typeof e=="object"&&e!==null&&e._id||e;return console.log(`Deleting persona with ID: ${t}`),He.delete(`/personas/${t}`)},createBatch:e=>He.post("/personas/batch",e)},Ka={generate:e=>He.post("/ai-personas/generate",e||{},{timeout:6e5}),generateAndSave:e=>He.post("/ai-personas/generate-and-save",e||{},{timeout:6e5}),batchGenerate:e=>He.post("/ai-personas/batch-generate",e,{timeout:6e5}),batchGenerateAndSave:e=>He.post("/ai-personas/batch-generate-and-save",e,{timeout:6e5}),generateBasicProfiles:(e,t=5,n=.8)=>He.post("/ai-personas/generate-basic-profiles",{audience_brief:e,count:t,temperature:n},{timeout:6e5}),completePersona:(e,t=.7)=>He.post("/ai-personas/complete-persona",{basic_profile:e,temperature:t},{timeout:6e5}),completeAndSavePersona:(e,t=.7)=>He.post("/ai-personas/complete-and-save-persona",{basic_profile:e,temperature:t},{timeout:6e5}),generatePersonaSummary:(e,t=.7)=>He.post("/ai-personas/generate-persona-summary",{persona_data:e,temperature:t},{timeout:6e5}),batchGenerateWithStages:async(e,t,n=5,r=.7,s,a)=>{var o;try{console.log(`📡 API call to generate-basic-profiles with model: ${a||"gemini-2.5-pro"}`);const c=(await He.post("/ai-personas/generate-basic-profiles",{audience_brief:e,research_objective:t,count:n,temperature:.7,customer_data_session_id:s,llm_model:a||"gemini-2.5-pro"},{timeout:6e5})).data.profiles,u=[],d=[],f=[];console.log(`📡 API call to complete-and-save-persona with model: ${a||"gemini-2.5-pro"}`);const h=c.map(g=>He.post("/ai-personas/complete-and-save-persona",{basic_profile:g,temperature:r,customer_data_session_id:s,llm_model:a||"gemini-2.5-pro"},{timeout:6e5}));if((await Promise.allSettled(h)).forEach((g,m)=>{if(g.status==="fulfilled")u.push(g.value.data.persona),d.push(g.value.data.persona_id);else{const y=c[m],b={index:m,name:y.name||`Persona ${m+1}`,error:g.reason};f.push(b),console.error(`Failed to complete persona ${m+1} (${y.name||"unnamed"}):`,g.reason)}}),u.length===0&&f.length>0)throw new Error(`Failed to generate any personas. ${f.length} profile(s) failed.`);return{data:{message:`Generated and saved ${u.length} personas${f.length>0?` (${f.length} failed)`:""}`,personas:u,persona_ids:d,errors:f.length>0?f:void 0,partial_success:f.length>0&&u.length>0}}}catch(l){throw((o=l.response)==null?void 0:o.status)===504||l.code==="ECONNABORTED"?new Error("Timeout error: The server took too long to generate personas. Please try with fewer personas or try again later."):l}},enhanceAudienceBrief:(e,t,n=.7)=>He.post("/ai-personas/enhance-audience-brief",{audience_brief:e,research_objective:t,temperature:n},{timeout:6e5}),batchGenerateSummaries:(e,t=.7,n)=>(console.log(`📡 Frontend: API call to batch-generate-summaries with model: ${n||"gemini-2.5-pro"}`),He.post("/ai-personas/batch-generate-summaries",{persona_ids:e,temperature:t,llm_model:n||"gemini-2.5-pro"},{timeout:9e5})),uploadCustomerData:e=>{const t=new FormData;for(let n=0;nHe.delete(`/ai-personas/cleanup-customer-data/${e}`)},St={getAll:()=>He.get("/focus-groups"),getById:e=>He.get(`/focus-groups/${e}`),create:e=>He.post("/focus-groups",e),update:(e,t)=>He.put(`/focus-groups/${e}`,t),delete:e=>He.delete(`/focus-groups/${e}`),addParticipant:(e,t)=>He.post(`/focus-groups/${e}/participants`,{persona_id:t}),removeParticipant:(e,t)=>He.delete(`/focus-groups/${e}/participants/${t}`),sendMessage:(e,t)=>He.post(`/focus-groups/${e}/messages`,t),getMessages:e=>He.get(`/focus-groups/${e}/messages`),updateMessageHighlight:(e,t,n)=>He.patch(`/focus-groups/${e}/messages/${t}`,{highlighted:n}),describeAsset:(e,t)=>He.post(`/focus-groups/${e}/describe-asset`,{asset_filename:t},{timeout:12e4}),generateDiscussionGuide:e=>He.post("/focus-groups/generate-discussion-guide",e,{timeout:6e5}),generateDiscussionGuideForGroup:(e,t)=>He.post(`/focus-groups/${e}/generate-discussion-guide`,t,{timeout:6e5}),downloadDiscussionGuide:async e=>{try{const t=await He.get(`/focus-groups/${e}/discussion-guide/download`,{responseType:"blob",timeout:3e4}),n=t.headers["content-disposition"];let r="discussion-guide.md";if(n){const l=n.match(/filename="([^"]+)"/);l&&(r=l[1])}const s=new Blob([t.data],{type:"text/markdown"}),a=URL.createObjectURL(s),o=document.createElement("a");return o.href=a,o.download=r,o.style.display="none",document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(a),{success:!0,filename:r}}catch(t){throw console.error("Error downloading discussion guide:",t),new Error("Failed to download discussion guide")}},createNote:(e,t)=>He.post(`/focus-groups/${e}/notes`,t),getNotes:e=>He.get(`/focus-groups/${e}/notes`),deleteNote:(e,t)=>He.delete(`/focus-groups/${e}/notes/${t}`),uploadAssets:(e,t)=>He.post(`/focus-groups/${e}/assets`,t,{headers:{"Content-Type":"multipart/form-data"},timeout:12e4}),getAssets:e=>He.get(`/focus-groups/${e}/assets`),getAssetUrl:(e,t)=>`${$I}/focus-groups/${e}/assets/${t}`,deleteAsset:(e,t)=>He.delete(`/focus-groups/${e}/assets/${t}`)},jn={generateResponse:(e,t,n,r=.7)=>He.post("/focus-group-ai/generate-response",{focus_group_id:e,persona_id:t,current_topic:n,temperature:r},{timeout:6e5}),generateKeyThemes:(e,t=.7)=>He.post("/focus-group-ai/generate-key-themes",{focus_group_id:e,temperature:t},{timeout:6e5}),getKeyThemes:e=>He.get(`/focus-group-ai/key-themes/${e}`),deleteKeyTheme:(e,t)=>He.delete(`/focus-group-ai/key-themes/${e}/${t}`),getModeratorStatus:e=>He.get(`/focus-group-ai/moderator/status/${e}`),advanceModeratorDiscussion:e=>He.post(`/focus-group-ai/moderator/advance/${e}`,{},{timeout:6e5}),setModeratorPosition:(e,t,n)=>He.put(`/focus-group-ai/moderator/position/${e}`,{section_id:t,item_id:n}),startAutonomousConversation:(e,t)=>He.post(`/focus-group-ai/autonomous/start/${e}`,{initial_prompt:t},{timeout:6e5}),stopAutonomousConversation:(e,t)=>He.post(`/focus-group-ai/autonomous/stop/${e}`,{reason:t}),getAutonomousConversationStatus:e=>He.get(`/focus-group-ai/autonomous/status/${e}`),getConversationState:e=>He.get(`/focus-group-ai/conversation/state/${e}`),getConversationAnalytics:e=>He.get(`/focus-group-ai/conversation/analytics/${e}`),makeConversationDecision:(e,t=.7,n="ai")=>He.post(`/focus-group-ai/conversation/decision/${e}`,{temperature:t,mode:n},{timeout:6e5}),getConversationInsights:e=>He.get(`/focus-group-ai/conversation/insights/${e}`,{timeout:6e5}),manualIntervention:(e,t,n,r)=>He.post(`/focus-group-ai/conversation/intervene/${e}`,{action:t,message:n,participant_id:r}),getReasoningHistory:e=>He.get(`/focus-group-ai/conversation/reasoning-history/${e}`),endSession:(e,t)=>He.post(`/focus-group-ai/moderator/end-session/${e}`,{reason:t||"session_ended"})},MI=v.createContext(void 0);function pG({children:e}){const[t,n]=v.useState(null),[r,s]=v.useState(null),[a,o]=v.useState(!0),l=Tn();v.useEffect(()=>{const p=g=>{const y=g.detail||{};if(y.isPersonaCreation){console.log("Ignoring auth error from persona creation",y);return}s(null),n(null),oe.error("Session expired",{description:"Please log in again"}),l("/login")};return window.addEventListener(ww,p),()=>{window.removeEventListener(ww,p)}},[l]),v.useEffect(()=>{const p=localStorage.getItem("auth_token"),g=localStorage.getItem("user");if(console.log("AuthContext initializing - stored data check:",{hasToken:!!p,hasUser:!!g}),p&&g)try{s(p),n(JSON.parse(g)),console.log("User session restored from localStorage")}catch(m){console.error("Failed to parse stored user data:",m),localStorage.removeItem("auth_token"),localStorage.removeItem("user")}else console.log("No stored authentication data found");o(!1)},[]),v.useEffect(()=>{if(r){console.log("Verifying token...");const p=`token_validated_${r.substring(0,10)}`;if(sessionStorage.getItem(p)==="true"&&t){console.log("Token already validated this session, skipping validation");return}jw.getProfile().then(m=>{m&&"data"in m&&(console.log("Profile verified successfully"),n(m.data),sessionStorage.setItem(p,"true"))}).catch(m=>{m.response&&m.response.status===401?(console.error("Token invalid (401):",m),localStorage.removeItem("auth_token"),localStorage.removeItem("user"),s(null),n(null)):(console.warn("Profile validation error (not clearing token):",m),sessionStorage.setItem(p,"true"))})}else console.log("No token available, not validating profile")},[r,t]);const c=async(p,g)=>{var m,y;o(!0),console.log("Attempting login for user:",p);try{const b=await jw.login(p,g);if(console.log("Login API response received"),!b.data.access_token)throw new Error("No access token received from server");return localStorage.setItem("auth_token",b.data.access_token),localStorage.setItem("user",JSON.stringify(b.data.user)),s(b.data.access_token),n(b.data.user),console.log("Authentication state updated"),oe.success("Login successful!"),b.data.access_token}catch(b){throw console.error("Login failed:",b),oe.error("Login failed",{description:((y=(m=b.response)==null?void 0:m.data)==null?void 0:y.message)||"Invalid username or password"}),b}finally{o(!1)}},u=()=>{localStorage.removeItem("auth_token"),localStorage.removeItem("user"),s(null),n(null),oe.info("You have been logged out")},d=!!localStorage.getItem("auth_token"),h={user:t,token:r,isLoading:a,login:c,logout:u,isAuthenticated:!!r||d};return i.jsx(MI.Provider,{value:h,children:e})}function Kl(){const e=v.useContext(MI);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e}function oi(){const[e,t]=v.useState(!1),n=qr(),r=Tn(),{isAuthenticated:s,logout:a}=Kl(),o=[{name:"Home",href:"/",icon:hw},{name:"Synthetic Personas",href:"/synthetic-users",icon:or},{name:"Focus Groups",href:"/focus-groups",icon:$a},{name:"Dashboard",href:"/dashboard",icon:pw}],l=()=>{t(!e)},c=d=>n.pathname===d,u=d=>{if(d==="/synthetic-users"){const f=new CustomEvent("syntheticUsersNavigation");window.dispatchEvent(f)}r(d)};return i.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:[i.jsx("div",{className:"px-4 sm:px-6 lg:px-8",children:i.jsxs("div",{className:"flex h-16 items-center justify-between",children:[i.jsx("div",{className:"flex items-center",children:i.jsx(bs,{to:"/",className:"flex items-center",children:i.jsx("span",{className:"font-sf text-2xl font-semibold text-gradient",children:"Semblance"})})}),i.jsx("nav",{className:"hidden md:block",children:i.jsxs("ul",{className:"flex items-center space-x-8",children:[o.map(d=>i.jsx("li",{children:d.href==="/"?i.jsxs(bs,{to:d.href,className:Me("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",c(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[i.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]}):i.jsxs("button",{onClick:()=>u(d.href),className:Me("flex items-center px-1 py-2 text-sm font-medium hover-transition border-b-2",c(d.href)?"border-primary text-primary":"border-transparent text-slate-600 hover:text-slate-900 hover:border-slate-300"),children:[i.jsx(d.icon,{className:"mr-1 h-4 w-4"}),d.name]})},d.name)),i.jsx("li",{children:s?i.jsxs("button",{onClick:()=>{a(),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:[i.jsx(LA,{className:"mr-1 h-4 w-4"}),"Logout"]}):i.jsxs(bs,{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:[i.jsx(DA,{className:"mr-1 h-4 w-4"}),"Login"]})})]})}),i.jsx("div",{className:"flex md:hidden",children:i.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:l,children:[i.jsx("span",{className:"sr-only",children:"Open main menu"}),e?i.jsx(Zs,{className:"block h-6 w-6","aria-hidden":"true"}):i.jsx(NW,{className:"block h-6 w-6","aria-hidden":"true"})]})})]})}),e&&i.jsx("div",{className:"md:hidden glass-panel animate-fade-in",children:i.jsxs("div",{className:"space-y-1 px-4 pb-3 pt-2",children:[o.map(d=>i.jsx("div",{children:d.href==="/"?i.jsxs(bs,{to:d.href,className:Me("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition",c(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>t(!1),children:[i.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]}):i.jsxs("button",{className:Me("flex items-center rounded-md px-3 py-2 text-base font-medium button-transition w-full text-left",c(d.href)?"bg-primary text-white":"text-slate-600 hover:bg-slate-50 hover:text-slate-900"),onClick:()=>{t(!1),u(d.href)},children:[i.jsx(d.icon,{className:"mr-3 h-5 w-5"}),d.name]})},d.name)),s?i.jsxs("button",{onClick:()=>{a(),t(!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:[i.jsx(LA,{className:"mr-3 h-5 w-5"}),"Logout"]}):i.jsxs(bs,{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:()=>t(!1),children:[i.jsx(DA,{className:"mr-3 h-5 w-5"}),"Login"]})]})})]})}const eC=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,tC=wt,VS=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return tC(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:a}=t,o=Object.keys(s).map(u=>{const d=n==null?void 0:n[u],f=a==null?void 0:a[u];if(d===null)return null;const h=eC(d)||eC(f);return s[u][h]}),l=n&&Object.entries(n).reduce((u,d)=>{let[f,h]=d;return h===void 0||(u[f]=h),u},{}),c=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:f,className:h,...p}=d;return Object.entries(p).every(g=>{let[m,y]=g;return Array.isArray(y)?y.includes({...a,...l}[m]):{...a,...l}[m]===y})?[...u,f,h]:u},[]);return tC(e,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},WS=VS("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"}}),te=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},a)=>{const o=r?mi:"button";return i.jsx(o,{className:Me(WS({variant:t,size:n,className:e})),ref:a,...s})});te.displayName="Button";function mG(){return i.jsxs("div",{className:"relative isolate overflow-hidden",children:[i.jsx("div",{className:"absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[-20rem]","aria-hidden":"true",children:i.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%)"}})}),i.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:[i.jsxs("div",{className:"mx-auto max-w-2xl lg:mx-0 lg:flex-auto",children:[i.jsx("div",{className:"flex",children:i.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:[i.jsx("span",{className:"font-semibold text-primary",children:"New"}),i.jsx("span",{className:"h-4 w-px bg-gray-900/10","aria-hidden":"true"}),i.jsx("span",{children:"Introducing AI-driven focus groups"})]})}),i.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 ",i.jsx("span",{className:"text-gradient",children:"synthetic personas"})]}),i.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."}),i.jsxs("div",{className:"mt-10 flex items-center gap-x-6",children:[i.jsx(bs,{to:"/synthetic-users",children:i.jsxs(te,{className:"px-6 py-6 text-base hover:shadow-lg hover:translate-y-[-2px] button-transition",children:["Create synthetic personas",i.jsx(zs,{className:"ml-2 h-4 w-4"})]})}),i.jsxs(bs,{to:"/focus-groups",className:"text-sm font-semibold leading-6 text-gray-900 hover:text-primary button-transition",children:["Set up focus groups ",i.jsx("span",{"aria-hidden":"true",children:"→"})]})]})]}),i.jsx("div",{className:"mt-16 sm:mt-24 lg:mt-0 lg:flex-shrink-0 lg:flex-grow",children:i.jsxs("div",{className:"relative glass-card mx-auto w-[350px] h-[450px] rounded-2xl shadow-xl overflow-hidden animate-float",children:[i.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:[i.jsx("div",{className:"h-3 w-3 rounded-full bg-red-400 mr-2"}),i.jsx("div",{className:"h-3 w-3 rounded-full bg-yellow-400 mr-2"}),i.jsx("div",{className:"h-3 w-3 rounded-full bg-green-400 mr-2"}),i.jsx("div",{className:"text-xs text-gray-500 ml-2",children:"Shampoo Brand Perception"})]}),i.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(e=>i.jsx("div",{className:`flex ${e%2===0?"justify-end":"justify-start"} px-3 py-2`,children:i.jsxs("div",{className:`max-w-[70%] rounded-lg px-3 py-2 text-xs ${e%2===0?"bg-primary text-white":"bg-gray-200 text-gray-800"}`,children:[e===1&&"What qualities do you look for in a premium shampoo brand?",e===2&&"I value natural ingredients and a brand that feels luxurious but still eco-friendly.",e===3&&"How important is fragrance in your shampoo selection?",e===4&&"Very important - it affects my mood and how I feel about the product throughout the day."]})},e))})]})})]}),i.jsx("div",{className:"absolute inset-x-0 bottom-[-10rem] -z-10 transform-gpu overflow-hidden blur-3xl sm:bottom-[-20rem]","aria-hidden":"true",children:i.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 rc({title:e,description:t,icon:n,className:r}){return i.jsxs("div",{className:Me("relative group glass-card rounded-xl overflow-hidden p-6 hover:shadow-lg hover:translate-y-[-4px] button-transition",r),children:[i.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"}),i.jsxs("div",{className:"relative",children:[i.jsx("div",{className:"rounded-full bg-primary/10 w-12 h-12 flex items-center justify-center mb-4",children:i.jsx(n,{className:"h-6 w-6 text-primary"})}),i.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:e}),i.jsx("p",{className:"text-gray-600 text-sm",children:t})]})]})}const gG=()=>(Kl(),Tn(),i.jsxs("div",{className:"min-h-screen overflow-hidden bg-background",children:[i.jsx(oi,{}),i.jsx("main",{children:i.jsxs("div",{className:"pt-16",children:[i.jsx(mG,{}),i.jsx("section",{className:"py-20 px-6 bg-white",children:i.jsxs("div",{className:"max-w-7xl mx-auto",children:[i.jsxs("div",{className:"text-center mb-16",children:[i.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"Why Synthetic Personas?"}),i.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."})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8",children:[i.jsx(rc,{title:"Scalable Research",description:"Create and test with thousands of synthetic personas, each with unique demographic profiles and behaviors.",icon:or}),i.jsx(rc,{title:"AI-Driven Focus Groups",description:"Run autonomous focus groups moderated by AI that adapts to participant responses in real-time.",icon:$a}),i.jsx(rc,{title:"Instant Analysis",description:"Generate comprehensive reports and visualizations that highlight key insights and patterns.",icon:pw}),i.jsx(rc,{title:"Diverse Perspectives",description:"Access synthetic personas from various backgrounds, ensuring representation across age, gender, and location.",icon:or}),i.jsx(rc,{title:"Dynamic Discussions",description:"AI moderators guide conversations naturally, following up on interesting points without bias.",icon:kW}),i.jsx(rc,{title:"Comprehensive Reporting",description:"Export detailed reports with sentiment analysis, key themes, and actionable recommendations.",icon:pw})]})]})}),i.jsx("section",{className:"py-20 px-6 bg-gradient-to-b from-white to-slate-50",children:i.jsxs("div",{className:"max-w-7xl mx-auto",children:[i.jsxs("div",{className:"text-center mb-16",children:[i.jsx("h2",{className:"text-3xl font-sf font-bold sm:text-4xl",children:"How It Works"}),i.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."})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8",children:[i.jsxs("div",{className:"text-center p-6",children:[i.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:i.jsx("span",{className:"text-2xl font-bold text-primary",children:"1"})}),i.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Create Synthetic Personas"}),i.jsx("p",{className:"text-gray-600",children:"Define your target audience with customizable demographic profiles and personality traits."})]}),i.jsxs("div",{className:"text-center p-6",children:[i.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:i.jsx("span",{className:"text-2xl font-bold text-primary",children:"2"})}),i.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Set Up Focus Groups"}),i.jsx("p",{className:"text-gray-600",children:"Configure your research objectives, topics, and parameters for the AI moderator."})]}),i.jsxs("div",{className:"text-center p-6",children:[i.jsx("div",{className:"rounded-full bg-primary/10 w-16 h-16 flex items-center justify-center mx-auto mb-4",children:i.jsx("span",{className:"text-2xl font-bold text-primary",children:"3"})}),i.jsx("h3",{className:"text-xl font-sf font-semibold mb-3",children:"Analyze Results"}),i.jsx("p",{className:"text-gray-600",children:"Review comprehensive visual reports and actionable insights from your synthetic research."})]})]}),i.jsx("div",{className:"text-center mt-12",children:i.jsx(bs,{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"})})]})}),i.jsxs("footer",{className:"bg-white py-12 px-6",children:[i.jsxs("div",{className:"max-w-7xl mx-auto flex flex-col md:flex-row justify-between items-center",children:[i.jsxs("div",{className:"mb-6 md:mb-0",children:[i.jsx("span",{className:"text-xl font-sf font-semibold text-gradient",children:"Semblance"}),i.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"AI-powered synthetic persona research"})]}),i.jsxs("div",{className:"flex flex-col md:flex-row gap-8",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Platform"}),i.jsxs("ul",{className:"space-y-2",children:[i.jsx("li",{children:i.jsx(bs,{to:"/",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Home"})}),i.jsx("li",{children:i.jsx(bs,{to:"/synthetic-users",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Synthetic Personas"})}),i.jsx("li",{children:i.jsx(bs,{to:"/focus-groups",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Focus Groups"})}),i.jsx("li",{children:i.jsx(bs,{to:"/dashboard",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Dashboard"})})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Company"}),i.jsxs("ul",{className:"space-y-2",children:[i.jsx("li",{children:i.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"About"})}),i.jsx("li",{children:i.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Blog"})}),i.jsx("li",{children:i.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Careers"})}),i.jsx("li",{children:i.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Contact"})})]})]}),i.jsxs("div",{children:[i.jsx("h3",{className:"text-sm font-semibold text-gray-900 mb-3",children:"Legal"}),i.jsxs("ul",{className:"space-y-2",children:[i.jsx("li",{children:i.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Privacy"})}),i.jsx("li",{children:i.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Terms"})}),i.jsx("li",{children:i.jsx("a",{href:"#",className:"text-sm text-gray-600 hover:text-primary button-transition",children:"Security"})})]})]})]})]}),i.jsx("div",{className:"max-w-7xl mx-auto mt-8 pt-8 border-t border-gray-200",children:i.jsxs("p",{className:"text-sm text-gray-500 text-center",children:["© ",new Date().getFullYear()," Semblance. All rights reserved."]})})]})]})})]})),vG=()=>{const e=qr(),t=Tn();v.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.pathname]);const n=e.pathname.startsWith("/synthetic-users/"),s=new URLSearchParams(e.search).get("fromReview")==="true";return i.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:i.jsxs("div",{className:"text-center p-8 max-w-md bg-white rounded-lg shadow-md",children:[i.jsx("h1",{className:"text-4xl font-bold mb-4",children:"404"}),n?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Persona Not Found"}),i.jsx("p",{className:"text-gray-500 mb-6",children:"The persona you're looking for may have been removed or doesn't exist."}),s?i.jsx(te,{onClick:()=>t("/synthetic-users?mode=create&tab=ai&step=review"),className:"mb-2 w-full",children:"Return to Review Page"}):i.jsx(te,{onClick:()=>t("/synthetic-users"),className:"mb-2 w-full",children:"View All Personas"})]}):i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"text-xl text-gray-600 mb-4",children:"Oops! Page not found"}),i.jsx("p",{className:"text-gray-500 mb-6",children:"The page you're looking for doesn't exist or has been moved."})]}),i.jsx(te,{variant:"outline",onClick:()=>t("/"),className:"w-full",children:"Return to Home"})]})})};function yG(e,t=[]){let n=[];function r(a,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,y=v.useMemo(()=>g,Object.values(g));return i.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return u.displayName=a+"Provider",[u,d]}const s=()=>{const a=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,xG(s,...t)]}function xG(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var HS="Progress",GS=100,[bG,_Pe]=yG(HS),[wG,jG]=bG(HS),II=v.forwardRef((e,t)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:a=SG,...o}=e;(s||s===0)&&!nC(s)&&console.error(NG(`${s}`,"Progress"));const l=nC(s)?s:GS;r!==null&&!rC(r,l)&&console.error(_G(`${r}`,"Progress"));const c=rC(r,l)?r:null,u=mg(c)?a(c,l):void 0;return i.jsx(wG,{scope:n,value:c,max:l,children:i.jsx(Ye.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":mg(c)?c:void 0,"aria-valuetext":u,role:"progressbar","data-state":LI(c,l),"data-value":c??void 0,"data-max":l,...o,ref:t})})});II.displayName=HS;var RI="ProgressIndicator",DI=v.forwardRef((e,t)=>{const{__scopeProgress:n,...r}=e,s=jG(RI,n);return i.jsx(Ye.div,{"data-state":LI(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:t})});DI.displayName=RI;function SG(e,t){return`${Math.round(e/t*100)}%`}function LI(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function mg(e){return typeof e=="number"}function nC(e){return mg(e)&&!isNaN(e)&&e>0}function rC(e,t){return mg(e)&&!isNaN(e)&&e<=t&&e>=0}function NG(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${GS}\`.`}function _G(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: + - a positive number + - less than the value passed to \`max\` (or ${GS} if no \`max\` prop is set) + - \`null\` or \`undefined\` if the progress is indeterminate. + +Defaulting to \`null\`.`}var FI=II,PG=DI;const al=v.forwardRef(({className:e,value:t,...n},r)=>i.jsx(FI,{ref:r,className:Me("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:i.jsx(PG,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));al.displayName=FI.displayName;var sp=e=>e.type==="checkbox",il=e=>e instanceof Date,_r=e=>e==null;const BI=e=>typeof e=="object";var kn=e=>!_r(e)&&!Array.isArray(e)&&BI(e)&&!il(e),zI=e=>kn(e)&&e.target?sp(e.target)?e.target.checked:e.target.value:e,AG=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,UI=(e,t)=>e.has(AG(t)),CG=e=>{const t=e.constructor&&e.constructor.prototype;return kn(t)&&t.hasOwnProperty("isPrototypeOf")},qS=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ir(e){let t;const n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(qS&&(e instanceof Blob||e instanceof FileList))&&(n||kn(e)))if(t=n?[]:{},!n&&!CG(e))t=e;else for(const r in e)e.hasOwnProperty(r)&&(t[r]=Ir(e[r]));else return e;return t}var jy=e=>Array.isArray(e)?e.filter(Boolean):[],Sn=e=>e===void 0,$e=(e,t,n)=>{if(!t||!kn(e))return n;const r=jy(t.split(/[,[\].]+?/)).reduce((s,a)=>_r(s)?s:s[a],e);return Sn(r)||r===e?Sn(e[t])?n:e[t]:r},gs=e=>typeof e=="boolean",KS=e=>/^\w*$/.test(e),VI=e=>jy(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Kt=(e,t,n)=>{let r=-1;const s=KS(t)?[t]:VI(t),a=s.length,o=a-1;for(;++rE.useContext(WI),EG=e=>{const{children:t,...n}=e;return E.createElement(WI.Provider,{value:n},t)};var HI=(e,t,n,r=!0)=>{const s={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(s,a,{get:()=>{const o=a;return t._proxyFormState[o]!==Hs.all&&(t._proxyFormState[o]=!r||Hs.all),n&&(n[o]=!0),e[o]}});return s},Rr=e=>kn(e)&&!Object.keys(e).length,GI=(e,t,n,r)=>{n(e);const{name:s,...a}=e;return Rr(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(o=>t[o]===(!r||Hs.all))},cf=e=>Array.isArray(e)?e:[e],qI=(e,t,n)=>!e||!t||e===t||cf(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r)));function XS(e){const t=E.useRef(e);t.current=e,E.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function OG(e){const t=Sy(),{control:n=t.control,disabled:r,name:s,exact:a}=e||{},[o,l]=E.useState(n._formState),c=E.useRef(!0),u=E.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=E.useRef(s);return d.current=s,XS({disabled:r,next:f=>c.current&&qI(d.current,f.name,a)&&GI(f,u.current,n._updateFormState)&&l({...n._formState,...f}),subject:n._subjects.state}),E.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),HI(o,n,u.current,!1)}var ja=e=>typeof e=="string",KI=(e,t,n,r,s)=>ja(e)?(r&&t.watch.add(e),$e(n,e,s)):Array.isArray(e)?e.map(a=>(r&&t.watch.add(a),$e(n,a))):(r&&(t.watchAll=!0),n);function kG(e){const t=Sy(),{control:n=t.control,name:r,defaultValue:s,disabled:a,exact:o}=e||{},l=E.useRef(r);l.current=r,XS({disabled:a,subject:n._subjects.values,next:d=>{qI(l.current,d.name,o)&&u(Ir(KI(l.current,n._names,d.values||n._formValues,!1,s)))}});const[c,u]=E.useState(n._getWatch(r,s));return E.useEffect(()=>n._removeUnmounted()),c}function TG(e){const t=Sy(),{name:n,disabled:r,control:s=t.control,shouldUnregister:a}=e,o=UI(s._names.array,n),l=kG({control:s,name:n,defaultValue:$e(s._formValues,n,$e(s._defaultValues,n,e.defaultValue)),exact:!0}),c=OG({control:s,name:n,exact:!0}),u=E.useRef(s.register(n,{...e.rules,value:l,...gs(e.disabled)?{disabled:e.disabled}:{}}));return E.useEffect(()=>{const d=s._options.shouldUnregister||a,f=(h,p)=>{const g=$e(s._fields,h);g&&g._f&&(g._f.mount=p)};if(f(n,!0),d){const h=Ir($e(s._options.defaultValues,n));Kt(s._defaultValues,n,h),Sn($e(s._formValues,n))&&Kt(s._formValues,n,h)}return()=>{(o?d&&!s._state.action:d)?s.unregister(n):f(n,!1)}},[n,s,o,a]),E.useEffect(()=>{$e(s._fields,n)&&s._updateDisabledField({disabled:r,fields:s._fields,name:n,value:$e(s._fields,n)._f.value})},[r,n,s]),{field:{name:n,value:l,...gs(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:E.useCallback(d=>u.current.onChange({target:{value:zI(d),name:n},type:gg.CHANGE}),[n]),onBlur:E.useCallback(()=>u.current.onBlur({target:{value:$e(s._formValues,n),name:n},type:gg.BLUR}),[n,s]),ref:E.useCallback(d=>{const f=$e(s._fields,n);f&&d&&(f._f.ref={focus:()=>d.focus(),select:()=>d.select(),setCustomValidity:h=>d.setCustomValidity(h),reportValidity:()=>d.reportValidity()})},[s._fields,n])},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!$e(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!$e(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!$e(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!$e(c.validatingFields,n)},error:{enumerable:!0,get:()=>$e(c.errors,n)}})}}const $G=e=>e.render(TG(e));var XI=(e,t,n,r,s)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:s||!0}}:{},sC=e=>({isOnSubmit:!e||e===Hs.onSubmit,isOnBlur:e===Hs.onBlur,isOnChange:e===Hs.onChange,isOnAll:e===Hs.all,isOnTouch:e===Hs.onTouched}),aC=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const uf=(e,t,n,r)=>{for(const s of n||Object.keys(e)){const a=$e(e,s);if(a){const{_f:o,...l}=a;if(o){if(o.refs&&o.refs[0]&&t(o.refs[0],s)&&!r)return!0;if(o.ref&&t(o.ref,o.name)&&!r)return!0;if(uf(l,t))break}else if(kn(l)&&uf(l,t))break}}};var MG=(e,t,n)=>{const r=cf($e(e,n));return Kt(r,"root",t[n]),Kt(e,n,r),e},YS=e=>e.type==="file",ti=e=>typeof e=="function",vg=e=>{if(!qS)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Om=e=>ja(e),ZS=e=>e.type==="radio",yg=e=>e instanceof RegExp;const iC={value:!1,isValid:!1},oC={value:!0,isValid:!0};var YI=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Sn(e[0].attributes.value)?Sn(e[0].value)||e[0].value===""?oC:{value:e[0].value,isValid:!0}:oC:iC}return iC};const lC={isValid:!1,value:null};var ZI=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,lC):lC;function cC(e,t,n="validate"){if(Om(e)||Array.isArray(e)&&e.every(Om)||gs(e)&&!e)return{type:n,message:Om(e)?e:"",ref:t}}var sc=e=>kn(e)&&!yg(e)?e:{value:e,message:""},uC=async(e,t,n,r,s)=>{const{ref:a,refs:o,required:l,maxLength:c,minLength:u,min:d,max:f,pattern:h,validate:p,name:g,valueAsNumber:m,mount:y,disabled:b}=e._f,x=$e(t,g);if(!y||b)return{};const w=o?o[0]:a,j=A=>{r&&w.reportValidity&&(w.setCustomValidity(gs(A)?"":A||""),w.reportValidity())},S={},N=ZS(a),_=sp(a),P=N||_,k=(m||YS(a))&&Sn(a.value)&&Sn(x)||vg(a)&&a.value===""||x===""||Array.isArray(x)&&!x.length,O=XI.bind(null,g,n,S),M=(A,$,L,H=Va.maxLength,D=Va.minLength)=>{const V=A?$:L;S[g]={type:A?H:D,message:V,ref:a,...O(A?H:D,V)}};if(s?!Array.isArray(x)||!x.length:l&&(!P&&(k||_r(x))||gs(x)&&!x||_&&!YI(o).isValid||N&&!ZI(o).isValid)){const{value:A,message:$}=Om(l)?{value:!!l,message:l}:sc(l);if(A&&(S[g]={type:Va.required,message:$,ref:w,...O(Va.required,$)},!n))return j($),S}if(!k&&(!_r(d)||!_r(f))){let A,$;const L=sc(f),H=sc(d);if(!_r(x)&&!isNaN(x)){const D=a.valueAsNumber||x&&+x;_r(L.value)||(A=D>L.value),_r(H.value)||($=Dnew Date(new Date().toDateString()+" "+q),T=a.type=="time",F=a.type=="week";ja(L.value)&&x&&(A=T?V(x)>V(L.value):F?x>L.value:D>new Date(L.value)),ja(H.value)&&x&&($=T?V(x)+A.value,H=!_r($.value)&&x.length<+$.value;if((L||H)&&(M(L,A.message,$.message),!n))return j(S[g].message),S}if(h&&!k&&ja(x)){const{value:A,message:$}=sc(h);if(yg(A)&&!x.match(A)&&(S[g]={type:Va.pattern,message:$,ref:a,...O(Va.pattern,$)},!n))return j($),S}if(p){if(ti(p)){const A=await p(x,t),$=cC(A,w);if($&&(S[g]={...$,...O(Va.validate,$.message)},!n))return j($.message),S}else if(kn(p)){let A={};for(const $ in p){if(!Rr(A)&&!n)break;const L=cC(await p[$](x,t),w,$);L&&(A={...L,...O($,L.message)},j(L.message),n&&(S[g]=A))}if(!Rr(A)&&(S[g]={ref:w,...A},!n))return S}}return j(!0),S};function IG(e,t){const n=t.slice(0,-1).length;let r=0;for(;r{let e=[];return{get observers(){return e},next:s=>{for(const a of e)a.next&&a.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(a=>a!==s)}}),unsubscribe:()=>{e=[]}}},Sw=e=>_r(e)||!BI(e);function Vi(e,t){if(Sw(e)||Sw(t))return e===t;if(il(e)&&il(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const s of n){const a=e[s];if(!r.includes(s))return!1;if(s!=="ref"){const o=t[s];if(il(a)&&il(o)||kn(a)&&kn(o)||Array.isArray(a)&&Array.isArray(o)?!Vi(a,o):a!==o)return!1}}return!0}var QI=e=>e.type==="select-multiple",DG=e=>ZS(e)||sp(e),g0=e=>vg(e)&&e.isConnected,JI=e=>{for(const t in e)if(ti(e[t]))return!0;return!1};function xg(e,t={}){const n=Array.isArray(e);if(kn(e)||n)for(const r in e)Array.isArray(e[r])||kn(e[r])&&!JI(e[r])?(t[r]=Array.isArray(e[r])?[]:{},xg(e[r],t[r])):_r(e[r])||(t[r]=!0);return t}function eR(e,t,n){const r=Array.isArray(e);if(kn(e)||r)for(const s in e)Array.isArray(e[s])||kn(e[s])&&!JI(e[s])?Sn(t)||Sw(n[s])?n[s]=Array.isArray(e[s])?xg(e[s],[]):{...xg(e[s])}:eR(e[s],_r(t)?{}:t[s],n[s]):n[s]=!Vi(e[s],t[s]);return n}var Ed=(e,t)=>eR(e,t,xg(t)),tR=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Sn(e)?e:t?e===""?NaN:e&&+e:n&&ja(e)?new Date(e):r?r(e):e;function v0(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return YS(t)?t.files:ZS(t)?ZI(e.refs).value:QI(t)?[...t.selectedOptions].map(({value:n})=>n):sp(t)?YI(e.refs).value:tR(Sn(t.value)?e.ref.value:t.value,e)}var LG=(e,t,n,r)=>{const s={};for(const a of e){const o=$e(t,a);o&&Kt(s,a,o._f)}return{criteriaMode:n,names:[...e],fields:s,shouldUseNativeValidation:r}},Od=e=>Sn(e)?e:yg(e)?e.source:kn(e)?yg(e.value)?e.value.source:e.value:e;const dC="AsyncFunction";var FG=e=>(!e||!e.validate)&&!!(ti(e.validate)&&e.validate.constructor.name===dC||kn(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===dC)),BG=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function fC(e,t,n){const r=$e(e,n);if(r||KS(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const a=s.join("."),o=$e(t,a),l=$e(e,a);if(o&&!Array.isArray(o)&&n!==a)return{name:n};if(l&&l.type)return{name:a,error:l};s.pop()}return{name:n}}var zG=(e,t,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(t||e):(n?r.isOnBlur:s.isOnBlur)?!e:(n?r.isOnChange:s.isOnChange)?e:!0,UG=(e,t)=>!jy($e(e,t)).length&&zn(e,t);const VG={mode:Hs.onSubmit,reValidateMode:Hs.onChange,shouldFocusError:!0};function WG(e={}){let t={...VG,...e},n={submitCount:0,isDirty:!1,isLoading:ti(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},s=kn(t.defaultValues)||kn(t.values)?Ir(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:Ir(s),o={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},c,u=0;const d={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},f={values:m0(),array:m0(),state:m0()},h=sC(t.mode),p=sC(t.reValidateMode),g=t.criteriaMode===Hs.all,m=C=>R=>{clearTimeout(u),u=setTimeout(C,R)},y=async C=>{if(!e.disabled&&(d.isValid||C)){const R=t.resolver?Rr((await P()).errors):await O(r,!0);R!==n.isValid&&f.state.next({isValid:R})}},b=(C,R)=>{!e.disabled&&(d.isValidating||d.validatingFields)&&((C||Array.from(l.mount)).forEach(U=>{U&&(R?Kt(n.validatingFields,U,R):zn(n.validatingFields,U))}),f.state.next({validatingFields:n.validatingFields,isValidating:!Rr(n.validatingFields)}))},x=(C,R=[],U,X,Q=!0,z=!0)=>{if(X&&U&&!e.disabled){if(o.action=!0,z&&Array.isArray($e(r,C))){const ee=U($e(r,C),X.argA,X.argB);Q&&Kt(r,C,ee)}if(z&&Array.isArray($e(n.errors,C))){const ee=U($e(n.errors,C),X.argA,X.argB);Q&&Kt(n.errors,C,ee),UG(n.errors,C)}if(d.touchedFields&&z&&Array.isArray($e(n.touchedFields,C))){const ee=U($e(n.touchedFields,C),X.argA,X.argB);Q&&Kt(n.touchedFields,C,ee)}d.dirtyFields&&(n.dirtyFields=Ed(s,a)),f.state.next({name:C,isDirty:A(C,R),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Kt(a,C,R)},w=(C,R)=>{Kt(n.errors,C,R),f.state.next({errors:n.errors})},j=C=>{n.errors=C,f.state.next({errors:n.errors,isValid:!1})},S=(C,R,U,X)=>{const Q=$e(r,C);if(Q){const z=$e(a,C,Sn(U)?$e(s,C):U);Sn(z)||X&&X.defaultChecked||R?Kt(a,C,R?z:v0(Q._f)):H(C,z),o.mount&&y()}},N=(C,R,U,X,Q)=>{let z=!1,ee=!1;const me={name:C};if(!e.disabled){const Se=!!($e(r,C)&&$e(r,C)._f&&$e(r,C)._f.disabled);if(!U||X){d.isDirty&&(ee=n.isDirty,n.isDirty=me.isDirty=A(),z=ee!==me.isDirty);const Ie=Se||Vi($e(s,C),R);ee=!!(!Se&&$e(n.dirtyFields,C)),Ie||Se?zn(n.dirtyFields,C):Kt(n.dirtyFields,C,!0),me.dirtyFields=n.dirtyFields,z=z||d.dirtyFields&&ee!==!Ie}if(U){const Ie=$e(n.touchedFields,C);Ie||(Kt(n.touchedFields,C,U),me.touchedFields=n.touchedFields,z=z||d.touchedFields&&Ie!==U)}z&&Q&&f.state.next(me)}return z?me:{}},_=(C,R,U,X)=>{const Q=$e(n.errors,C),z=d.isValid&&gs(R)&&n.isValid!==R;if(e.delayError&&U?(c=m(()=>w(C,U)),c(e.delayError)):(clearTimeout(u),c=null,U?Kt(n.errors,C,U):zn(n.errors,C)),(U?!Vi(Q,U):Q)||!Rr(X)||z){const ee={...X,...z&&gs(R)?{isValid:R}:{},errors:n.errors,name:C};n={...n,...ee},f.state.next(ee)}},P=async C=>{b(C,!0);const R=await t.resolver(a,t.context,LG(C||l.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return b(C),R},k=async C=>{const{errors:R}=await P(C);if(C)for(const U of C){const X=$e(R,U);X?Kt(n.errors,U,X):zn(n.errors,U)}else n.errors=R;return R},O=async(C,R,U={valid:!0})=>{for(const X in C){const Q=C[X];if(Q){const{_f:z,...ee}=Q;if(z){const me=l.array.has(z.name),Se=Q._f&&FG(Q._f);Se&&d.validatingFields&&b([X],!0);const Ie=await uC(Q,a,g,t.shouldUseNativeValidation&&!R,me);if(Se&&d.validatingFields&&b([X]),Ie[z.name]&&(U.valid=!1,R))break;!R&&($e(Ie,z.name)?me?MG(n.errors,Ie,z.name):Kt(n.errors,z.name,Ie[z.name]):zn(n.errors,z.name))}!Rr(ee)&&await O(ee,R,U)}}return U.valid},M=()=>{for(const C of l.unMount){const R=$e(r,C);R&&(R._f.refs?R._f.refs.every(U=>!g0(U)):!g0(R._f.ref))&&se(C)}l.unMount=new Set},A=(C,R)=>!e.disabled&&(C&&R&&Kt(a,C,R),!Vi(Z(),s)),$=(C,R,U)=>KI(C,l,{...o.mount?a:Sn(R)?s:ja(C)?{[C]:R}:R},U,R),L=C=>jy($e(o.mount?a:s,C,e.shouldUnregister?$e(s,C,[]):[])),H=(C,R,U={})=>{const X=$e(r,C);let Q=R;if(X){const z=X._f;z&&(!z.disabled&&Kt(a,C,tR(R,z)),Q=vg(z.ref)&&_r(R)?"":R,QI(z.ref)?[...z.ref.options].forEach(ee=>ee.selected=Q.includes(ee.value)):z.refs?sp(z.ref)?z.refs.length>1?z.refs.forEach(ee=>(!ee.defaultChecked||!ee.disabled)&&(ee.checked=Array.isArray(Q)?!!Q.find(me=>me===ee.value):Q===ee.value)):z.refs[0]&&(z.refs[0].checked=!!Q):z.refs.forEach(ee=>ee.checked=ee.value===Q):YS(z.ref)?z.ref.value="":(z.ref.value=Q,z.ref.type||f.values.next({name:C,values:{...a}})))}(U.shouldDirty||U.shouldTouch)&&N(C,Q,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&q(C)},D=(C,R,U)=>{for(const X in R){const Q=R[X],z=`${C}.${X}`,ee=$e(r,z);(l.array.has(C)||kn(Q)||ee&&!ee._f)&&!il(Q)?D(z,Q,U):H(z,Q,U)}},V=(C,R,U={})=>{const X=$e(r,C),Q=l.array.has(C),z=Ir(R);Kt(a,C,z),Q?(f.array.next({name:C,values:{...a}}),(d.isDirty||d.dirtyFields)&&U.shouldDirty&&f.state.next({name:C,dirtyFields:Ed(s,a),isDirty:A(C,z)})):X&&!X._f&&!_r(z)?D(C,z,U):H(C,z,U),aC(C,l)&&f.state.next({...n}),f.values.next({name:o.mount?C:void 0,values:{...a}})},T=async C=>{o.mount=!0;const R=C.target;let U=R.name,X=!0;const Q=$e(r,U),z=()=>R.type?v0(Q._f):zI(C),ee=me=>{X=Number.isNaN(me)||il(me)&&isNaN(me.getTime())||Vi(me,$e(a,U,me))};if(Q){let me,Se;const Ie=z(),we=C.type===gg.BLUR||C.type===gg.FOCUS_OUT,ze=!BG(Q._f)&&!t.resolver&&!$e(n.errors,U)&&!Q._f.deps||zG(we,$e(n.touchedFields,U),n.isSubmitted,p,h),gt=aC(U,l,we);Kt(a,U,Ie),we?(Q._f.onBlur&&Q._f.onBlur(C),c&&c(0)):Q._f.onChange&&Q._f.onChange(C);const jt=N(U,Ie,we,!1),Ge=!Rr(jt)||gt;if(!we&&f.values.next({name:U,type:C.type,values:{...a}}),ze)return d.isValid&&(e.mode==="onBlur"?we&&y():y()),Ge&&f.state.next({name:U,...gt?{}:jt});if(!we&>&&f.state.next({...n}),t.resolver){const{errors:Ze}=await P([U]);if(ee(Ie),X){const kt=fC(n.errors,r,U),Vt=fC(Ze,r,kt.name||U);me=Vt.error,U=Vt.name,Se=Rr(Ze)}}else b([U],!0),me=(await uC(Q,a,g,t.shouldUseNativeValidation))[U],b([U]),ee(Ie),X&&(me?Se=!1:d.isValid&&(Se=await O(r,!0)));X&&(Q._f.deps&&q(Q._f.deps),_(U,Se,me,jt))}},F=(C,R)=>{if($e(n.errors,R)&&C.focus)return C.focus(),1},q=async(C,R={})=>{let U,X;const Q=cf(C);if(t.resolver){const z=await k(Sn(C)?C:Q);U=Rr(z),X=C?!Q.some(ee=>$e(z,ee)):U}else C?(X=(await Promise.all(Q.map(async z=>{const ee=$e(r,z);return await O(ee&&ee._f?{[z]:ee}:ee)}))).every(Boolean),!(!X&&!n.isValid)&&y()):X=U=await O(r);return f.state.next({...!ja(C)||d.isValid&&U!==n.isValid?{}:{name:C},...t.resolver||!C?{isValid:U}:{},errors:n.errors}),R.shouldFocus&&!X&&uf(r,F,C?Q:l.mount),X},Z=C=>{const R={...o.mount?a:s};return Sn(C)?R:ja(C)?$e(R,C):C.map(U=>$e(R,U))},re=(C,R)=>({invalid:!!$e((R||n).errors,C),isDirty:!!$e((R||n).dirtyFields,C),error:$e((R||n).errors,C),isValidating:!!$e(n.validatingFields,C),isTouched:!!$e((R||n).touchedFields,C)}),ge=C=>{C&&cf(C).forEach(R=>zn(n.errors,R)),f.state.next({errors:C?n.errors:{}})},B=(C,R,U)=>{const X=($e(r,C,{_f:{}})._f||{}).ref,Q=$e(n.errors,C)||{},{ref:z,message:ee,type:me,...Se}=Q;Kt(n.errors,C,{...Se,...R,ref:X}),f.state.next({name:C,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&X&&X.focus&&X.focus()},le=(C,R)=>ti(C)?f.values.subscribe({next:U=>C($(void 0,R),U)}):$(C,R,!0),se=(C,R={})=>{for(const U of C?cf(C):l.mount)l.mount.delete(U),l.array.delete(U),R.keepValue||(zn(r,U),zn(a,U)),!R.keepError&&zn(n.errors,U),!R.keepDirty&&zn(n.dirtyFields,U),!R.keepTouched&&zn(n.touchedFields,U),!R.keepIsValidating&&zn(n.validatingFields,U),!t.shouldUnregister&&!R.keepDefaultValue&&zn(s,U);f.values.next({values:{...a}}),f.state.next({...n,...R.keepDirty?{isDirty:A()}:{}}),!R.keepIsValid&&y()},ce=({disabled:C,name:R,field:U,fields:X,value:Q})=>{if(gs(C)&&o.mount||C){const z=C?void 0:Sn(Q)?v0(U?U._f:$e(X,R)._f):Q;Kt(a,R,z),N(R,z,!1,!1,!0)}},De=(C,R={})=>{let U=$e(r,C);const X=gs(R.disabled)||gs(e.disabled);return Kt(r,C,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:C}},name:C,mount:!0,...R}}),l.mount.add(C),U?ce({field:U,disabled:gs(R.disabled)?R.disabled:e.disabled,name:C,value:R.value}):S(C,!0,R.value),{...X?{disabled:R.disabled||e.disabled}:{},...t.progressive?{required:!!R.required,min:Od(R.min),max:Od(R.max),minLength:Od(R.minLength),maxLength:Od(R.maxLength),pattern:Od(R.pattern)}:{},name:C,onChange:T,onBlur:T,ref:Q=>{if(Q){De(C,R),U=$e(r,C);const z=Sn(Q.value)&&Q.querySelectorAll&&Q.querySelectorAll("input,select,textarea")[0]||Q,ee=DG(z),me=U._f.refs||[];if(ee?me.find(Se=>Se===z):z===U._f.ref)return;Kt(r,C,{_f:{...U._f,...ee?{refs:[...me.filter(g0),z,...Array.isArray($e(s,C))?[{}]:[]],ref:{type:z.type,name:C}}:{ref:z}}}),S(C,!1,void 0,z)}else U=$e(r,C,{}),U._f&&(U._f.mount=!1),(t.shouldUnregister||R.shouldUnregister)&&!(UI(l.array,C)&&o.action)&&l.unMount.add(C)}}},de=()=>t.shouldFocusError&&uf(r,F,l.mount),be=C=>{gs(C)&&(f.state.next({disabled:C}),uf(r,(R,U)=>{const X=$e(r,U);X&&(R.disabled=X._f.disabled||C,Array.isArray(X._f.refs)&&X._f.refs.forEach(Q=>{Q.disabled=X._f.disabled||C}))},0,!1))},Pe=(C,R)=>async U=>{let X;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let Q=Ir(a);if(f.state.next({isSubmitting:!0}),t.resolver){const{errors:z,values:ee}=await P();n.errors=z,Q=ee}else await O(r);if(zn(n.errors,"root"),Rr(n.errors)){f.state.next({errors:{}});try{await C(Q,U)}catch(z){X=z}}else R&&await R({...n.errors},U),de(),setTimeout(de);if(f.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Rr(n.errors)&&!X,submitCount:n.submitCount+1,errors:n.errors}),X)throw X},ne=(C,R={})=>{$e(r,C)&&(Sn(R.defaultValue)?V(C,Ir($e(s,C))):(V(C,R.defaultValue),Kt(s,C,Ir(R.defaultValue))),R.keepTouched||zn(n.touchedFields,C),R.keepDirty||(zn(n.dirtyFields,C),n.isDirty=R.defaultValue?A(C,Ir($e(s,C))):A()),R.keepError||(zn(n.errors,C),d.isValid&&y()),f.state.next({...n}))},Je=(C,R={})=>{const U=C?Ir(C):s,X=Ir(U),Q=Rr(C),z=Q?s:X;if(R.keepDefaultValues||(s=U),!R.keepValues){if(R.keepDirtyValues){const ee=new Set([...l.mount,...Object.keys(Ed(s,a))]);for(const me of Array.from(ee))$e(n.dirtyFields,me)?Kt(z,me,$e(a,me)):V(me,$e(z,me))}else{if(qS&&Sn(C))for(const ee of l.mount){const me=$e(r,ee);if(me&&me._f){const Se=Array.isArray(me._f.refs)?me._f.refs[0]:me._f.ref;if(vg(Se)){const Ie=Se.closest("form");if(Ie){Ie.reset();break}}}}r={}}a=e.shouldUnregister?R.keepDefaultValues?Ir(s):{}:Ir(z),f.array.next({values:{...z}}),f.values.next({values:{...z}})}l={mount:R.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!d.isValid||!!R.keepIsValid||!!R.keepDirtyValues,o.watch=!!e.shouldUnregister,f.state.next({submitCount:R.keepSubmitCount?n.submitCount:0,isDirty:Q?!1:R.keepDirty?n.isDirty:!!(R.keepDefaultValues&&!Vi(C,s)),isSubmitted:R.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Q?{}:R.keepDirtyValues?R.keepDefaultValues&&a?Ed(s,a):n.dirtyFields:R.keepDefaultValues&&C?Ed(s,C):R.keepDirty?n.dirtyFields:{},touchedFields:R.keepTouched?n.touchedFields:{},errors:R.keepErrors?n.errors:{},isSubmitSuccessful:R.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},ve=(C,R)=>Je(ti(C)?C(a):C,R);return{control:{register:De,unregister:se,getFieldState:re,handleSubmit:Pe,setError:B,_executeSchema:P,_getWatch:$,_getDirty:A,_updateValid:y,_removeUnmounted:M,_updateFieldArray:x,_updateDisabledField:ce,_getFieldArray:L,_reset:Je,_resetDefaultValues:()=>ti(t.defaultValues)&&t.defaultValues().then(C=>{ve(C,t.resetOptions),f.state.next({isLoading:!1})}),_updateFormState:C=>{n={...n,...C}},_disableForm:be,_subjects:f,_proxyFormState:d,_setErrors:j,get _fields(){return r},get _formValues(){return a},get _state(){return o},set _state(C){o=C},get _defaultValues(){return s},get _names(){return l},set _names(C){l=C},get _formState(){return n},set _formState(C){n=C},get _options(){return t},set _options(C){t={...t,...C}}},trigger:q,register:De,handleSubmit:Pe,watch:le,setValue:V,getValues:Z,reset:ve,resetField:ne,clearErrors:ge,unregister:se,setError:B,setFocus:(C,R={})=>{const U=$e(r,C),X=U&&U._f;if(X){const Q=X.refs?X.refs[0]:X.ref;Q.focus&&(Q.focus(),R.shouldSelect&&Q.select())}},getFieldState:re}}function Ny(e={}){const t=E.useRef(),n=E.useRef(),[r,s]=E.useState({isDirty:!1,isValidating:!1,isLoading:ti(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:ti(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...WG(e),formState:r});const a=t.current.control;return a._options=e,XS({subject:a._subjects.state,next:o=>{GI(o,a._proxyFormState,a._updateFormState,!0)&&s({...a._formState})}}),E.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),E.useEffect(()=>{if(a._proxyFormState.isDirty){const o=a._getDirty();o!==r.isDirty&&a._subjects.state.next({isDirty:o})}},[a,r.isDirty]),E.useEffect(()=>{e.values&&!Vi(e.values,n.current)?(a._reset(e.values,a._options.resetOptions),n.current=e.values,s(o=>({...o}))):a._resetDefaultValues()},[e.values,a]),E.useEffect(()=>{e.errors&&a._setErrors(e.errors)},[e.errors,a]),E.useEffect(()=>{a._state.mount||(a._updateValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),E.useEffect(()=>{e.shouldUnregister&&a._subjects.values.next({values:a._getWatch()})},[e.shouldUnregister,a]),E.useEffect(()=>{t.current&&(t.current.watch=t.current.watch.bind({}))},[r]),t.current.formState=HI(r,a),t.current}const hC=(e,t,n)=>{if(e&&"reportValidity"in e){const r=$e(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},nR=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?hC(r.ref,n,e):r.refs&&r.refs.forEach(s=>hC(s,n,e))}},HG=(e,t)=>{t.shouldUseNativeValidation&&nR(e,t);const n={};for(const r in e){const s=$e(t.fields,r),a=Object.assign(e[r]||{},{ref:s&&s.ref});if(GG(t.names||Object.keys(e),r)){const o=Object.assign({},$e(n,r));Kt(o,"root",a),Kt(n,r,o)}else Kt(n,r,a)}return n},GG=(e,t)=>e.some(n=>n.startsWith(t+"."));var qG=function(e,t){for(var n={};e.length;){var r=e[0],s=r.code,a=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:a,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(d){return d.errors.forEach(function(f){return e.push(f)})}),t){var c=n[o].types,u=c&&c[r.code];n[o]=XI(o,t,n,s,u?[].concat(u,r.message):r.message)}e.shift()}return n},_y=function(e,t,n){return n===void 0&&(n={}),function(r,s,a){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(u){return a.shouldUseNativeValidation&&nR({},a),{errors:{},values:n.raw?r:u}})}catch(u){return l(u)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:HG(qG(o.errors,!a.shouldUseNativeValidation&&a.criteriaMode==="all"),a)};throw o}))}catch(o){return Promise.reject(o)}}},Bt;(function(e){e.assertEqual=s=>s;function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const a={};for(const o of s)a[o]=o;return a},e.getValidEnumValues=s=>{const a=e.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of a)o[l]=s[l];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(a){return s[a]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},e.find=(s,a)=>{for(const o of s)if(a(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}e.joinValues=r,e.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(Bt||(Bt={}));var Nw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Nw||(Nw={}));const Be=Bt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Wi=e=>{switch(typeof e){case"undefined":return Be.undefined;case"string":return Be.string;case"number":return isNaN(e)?Be.nan:Be.number;case"boolean":return Be.boolean;case"function":return Be.function;case"bigint":return Be.bigint;case"symbol":return Be.symbol;case"object":return Array.isArray(e)?Be.array:e===null?Be.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Be.promise:typeof Map<"u"&&e instanceof Map?Be.map:typeof Set<"u"&&e instanceof Set?Be.set:typeof Date<"u"&&e instanceof Date?Be.date:Be.object;default:return Be.unknown}},_e=Bt.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"]),KG=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class os extends Error{constructor(t){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=t}get errors(){return this.issues}format(t){const n=t||function(a){return a.message},r={_errors:[]},s=a=>{for(const o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;cn.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}os.create=e=>new os(e);const uu=(e,t)=>{let n;switch(e.code){case _e.invalid_type:e.received===Be.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case _e.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Bt.jsonStringifyReplacer)}`;break;case _e.unrecognized_keys:n=`Unrecognized key(s) in object: ${Bt.joinValues(e.keys,", ")}`;break;case _e.invalid_union:n="Invalid input";break;case _e.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Bt.joinValues(e.options)}`;break;case _e.invalid_enum_value:n=`Invalid enum value. Expected ${Bt.joinValues(e.options)}, received '${e.received}'`;break;case _e.invalid_arguments:n="Invalid function arguments";break;case _e.invalid_return_type:n="Invalid function return type";break;case _e.invalid_date:n="Invalid date";break;case _e.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Bt.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case _e.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case _e.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case _e.custom:n="Invalid input";break;case _e.invalid_intersection_types:n="Intersection results could not be merged";break;case _e.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case _e.not_finite:n="Number must be finite";break;default:n=t.defaultError,Bt.assertNever(e)}return{message:n}};let rR=uu;function XG(e){rR=e}function bg(){return rR}const wg=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,a=[...n,...s.path||[]],o={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let l="";const c=r.filter(u=>!!u).slice().reverse();for(const u of c)l=u(o,{data:t,defaultError:l}).message;return{...s,path:a,message:l}},YG=[];function Fe(e,t){const n=bg(),r=wg({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===uu?void 0:uu].filter(s=>!!s)});e.common.issues.push(r)}class br{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return yt;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const a=await s.key,o=await s.value;r.push({key:a,value:o})}return br.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return yt;a.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[a.value]=o.value)}return{status:t.value,value:r}}}const yt=Object.freeze({status:"aborted"}),_c=e=>({status:"dirty",value:e}),kr=e=>({status:"valid",value:e}),_w=e=>e.status==="aborted",Pw=e=>e.status==="dirty",Wf=e=>e.status==="valid",Hf=e=>typeof Promise<"u"&&e instanceof Promise;function jg(e,t,n,r){if(typeof t=="function"?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function sR(e,t,n,r,s){if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var et;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(et||(et={}));var qd,Kd;class Ma{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}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 pC=(e,t)=>{if(Wf(t))return{success:!0,data:t.value};if(!e.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 os(e.common.issues);return this._error=n,this._error}}};function Pt(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,l)=>{var c,u;const{message:d}=e;return o.code==="invalid_enum_value"?{message:d??l.defaultError}:typeof l.data>"u"?{message:(c=d??r)!==null&&c!==void 0?c:l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:(u=d??n)!==null&&u!==void 0?u:l.defaultError}},description:s}}class $t{constructor(t){this.spa=this.safeParseAsync,this._def=t,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(t){return Wi(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Wi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new br,ctx:{common:t.parent.common,data:t.data,parsedType:Wi(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Hf(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const s={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:t,parsedType:Wi(t)},a=this._parseSync({data:t,path:s.path,parent:s});return pC(s,a)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,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:t,parsedType:Wi(t)},s=this._parse({data:t,path:r.path,parent:r}),a=await(Hf(s)?s:Promise.resolve(s));return pC(r,a)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const o=t(s),l=()=>a.addIssue({code:_e.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new ia({schema:this,typeName:mt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return Aa.create(this,this._def)}nullable(){return Eo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Qs.create(this,this._def)}promise(){return fu.create(this,this._def)}or(t){return Xf.create([this,t],this._def)}and(t){return Yf.create(this,t,this._def)}transform(t){return new ia({...Pt(this._def),schema:this,typeName:mt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new th({...Pt(this._def),innerType:this,defaultValue:n,typeName:mt.ZodDefault})}brand(){return new QS({typeName:mt.ZodBranded,type:this,...Pt(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new nh({...Pt(this._def),innerType:this,catchValue:n,typeName:mt.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return ap.create(this,t)}readonly(){return rh.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ZG=/^c[^\s-]{8,}$/i,QG=/^[0-9a-z]+$/,JG=/^[0-9A-HJKMNP-TV-Z]{26}$/,eq=/^[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,tq=/^[a-z0-9_-]{21}$/i,nq=/^[-+]?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)?)??$/,rq=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sq="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let y0;const aq=/^(?:(?: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])$/,iq=/^(([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})))$/,oq=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,aR="((\\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])))",lq=new RegExp(`^${aR}$`);function iR(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`),t}function cq(e){return new RegExp(`^${iR(e)}$`)}function oR(e){let t=`${aR}T${iR(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function uq(e,t){return!!((t==="v4"||!t)&&aq.test(e)||(t==="v6"||!t)&&iq.test(e))}class qs extends $t{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Be.string){const a=this._getOrReturnCtx(t);return Fe(a,{code:_e.invalid_type,expected:Be.string,received:a.parsedType}),yt}const r=new br;let s;for(const a of this._def.checks)if(a.kind==="min")t.data.lengtha.value&&(s=this._getOrReturnCtx(t,s),Fe(s,{code:_e.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){const o=t.data.length>a.value,l=t.data.lengtht.test(s),{validation:n,code:_e.invalid_string,...et.errToObj(r)})}_addCheck(t){return new qs({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...et.errToObj(t)})}url(t){return this._addCheck({kind:"url",...et.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...et.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...et.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...et.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...et.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...et.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...et.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...et.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...et.errToObj(t)})}datetime(t){var n,r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,local:(r=t==null?void 0:t.local)!==null&&r!==void 0?r:!1,...et.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...et.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...et.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...et.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...et.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...et.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...et.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...et.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...et.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...et.errToObj(n)})}nonempty(t){return this.min(1,et.errToObj(t))}trim(){return new qs({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new qs({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new qs({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new qs({checks:[],typeName:mt.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Pt(e)})};function dq(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(e.toFixed(s).replace(".","")),o=parseInt(t.toFixed(s).replace(".",""));return a%o/Math.pow(10,s)}class Po extends $t{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Be.number){const a=this._getOrReturnCtx(t);return Fe(a,{code:_e.invalid_type,expected:Be.number,received:a.parsedType}),yt}let r;const s=new br;for(const a of this._def.checks)a.kind==="int"?Bt.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),Fe(r,{code:_e.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?t.dataa.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),Fe(r,{code:_e.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?dq(t.data,a.value)!==0&&(r=this._getOrReturnCtx(t,r),Fe(r,{code:_e.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),Fe(r,{code:_e.not_finite,message:a.message}),s.dirty()):Bt.assertNever(a);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,et.toString(n))}gt(t,n){return this.setLimit("min",t,!1,et.toString(n))}lte(t,n){return this.setLimit("max",t,!0,et.toString(n))}lt(t,n){return this.setLimit("max",t,!1,et.toString(n))}setLimit(t,n,r,s){return new Po({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:et.toString(s)}]})}_addCheck(t){return new Po({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:et.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:et.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:et.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&Bt.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||r.valuenew Po({checks:[],typeName:mt.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Pt(e)});class Ao extends $t{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==Be.bigint){const a=this._getOrReturnCtx(t);return Fe(a,{code:_e.invalid_type,expected:Be.bigint,received:a.parsedType}),yt}let r;const s=new br;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?t.dataa.value:t.data>=a.value)&&(r=this._getOrReturnCtx(t,r),Fe(r,{code:_e.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?t.data%a.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),Fe(r,{code:_e.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):Bt.assertNever(a);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,et.toString(n))}gt(t,n){return this.setLimit("min",t,!1,et.toString(n))}lte(t,n){return this.setLimit("max",t,!0,et.toString(n))}lt(t,n){return this.setLimit("max",t,!1,et.toString(n))}setLimit(t,n,r,s){return new Ao({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:et.toString(s)}]})}_addCheck(t){return new Ao({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:et.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Ao({checks:[],typeName:mt.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Pt(e)})};class Gf extends $t{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Be.boolean){const r=this._getOrReturnCtx(t);return Fe(r,{code:_e.invalid_type,expected:Be.boolean,received:r.parsedType}),yt}return kr(t.data)}}Gf.create=e=>new Gf({typeName:mt.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Pt(e)});class Rl extends $t{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Be.date){const a=this._getOrReturnCtx(t);return Fe(a,{code:_e.invalid_type,expected:Be.date,received:a.parsedType}),yt}if(isNaN(t.data.getTime())){const a=this._getOrReturnCtx(t);return Fe(a,{code:_e.invalid_date}),yt}const r=new br;let s;for(const a of this._def.checks)a.kind==="min"?t.data.getTime()a.value&&(s=this._getOrReturnCtx(t,s),Fe(s,{code:_e.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):Bt.assertNever(a);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Rl({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:et.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:et.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Rl({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:mt.ZodDate,...Pt(e)});class Sg extends $t{_parse(t){if(this._getType(t)!==Be.symbol){const r=this._getOrReturnCtx(t);return Fe(r,{code:_e.invalid_type,expected:Be.symbol,received:r.parsedType}),yt}return kr(t.data)}}Sg.create=e=>new Sg({typeName:mt.ZodSymbol,...Pt(e)});class qf extends $t{_parse(t){if(this._getType(t)!==Be.undefined){const r=this._getOrReturnCtx(t);return Fe(r,{code:_e.invalid_type,expected:Be.undefined,received:r.parsedType}),yt}return kr(t.data)}}qf.create=e=>new qf({typeName:mt.ZodUndefined,...Pt(e)});class Kf extends $t{_parse(t){if(this._getType(t)!==Be.null){const r=this._getOrReturnCtx(t);return Fe(r,{code:_e.invalid_type,expected:Be.null,received:r.parsedType}),yt}return kr(t.data)}}Kf.create=e=>new Kf({typeName:mt.ZodNull,...Pt(e)});class du extends $t{constructor(){super(...arguments),this._any=!0}_parse(t){return kr(t.data)}}du.create=e=>new du({typeName:mt.ZodAny,...Pt(e)});class bl extends $t{constructor(){super(...arguments),this._unknown=!0}_parse(t){return kr(t.data)}}bl.create=e=>new bl({typeName:mt.ZodUnknown,...Pt(e)});class xi extends $t{_parse(t){const n=this._getOrReturnCtx(t);return Fe(n,{code:_e.invalid_type,expected:Be.never,received:n.parsedType}),yt}}xi.create=e=>new xi({typeName:mt.ZodNever,...Pt(e)});class Ng extends $t{_parse(t){if(this._getType(t)!==Be.undefined){const r=this._getOrReturnCtx(t);return Fe(r,{code:_e.invalid_type,expected:Be.void,received:r.parsedType}),yt}return kr(t.data)}}Ng.create=e=>new Ng({typeName:mt.ZodVoid,...Pt(e)});class Qs extends $t{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==Be.array)return Fe(n,{code:_e.invalid_type,expected:Be.array,received:n.parsedType}),yt;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.lengths.maxLength.value&&(Fe(n,{code:_e.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new Ma(n,o,n.path,l)))).then(o=>br.mergeArray(r,o));const a=[...n.data].map((o,l)=>s.type._parseSync(new Ma(n,o,n.path,l)));return br.mergeArray(r,a)}get element(){return this._def.type}min(t,n){return new Qs({...this._def,minLength:{value:t,message:et.toString(n)}})}max(t,n){return new Qs({...this._def,maxLength:{value:t,message:et.toString(n)}})}length(t,n){return new Qs({...this._def,exactLength:{value:t,message:et.toString(n)}})}nonempty(t){return this.min(1,t)}}Qs.create=(e,t)=>new Qs({type:e,minLength:null,maxLength:null,exactLength:null,typeName:mt.ZodArray,...Pt(t)});function fc(e){if(e instanceof mn){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Aa.create(fc(r))}return new mn({...e._def,shape:()=>t})}else return e instanceof Qs?new Qs({...e._def,type:fc(e.element)}):e instanceof Aa?Aa.create(fc(e.unwrap())):e instanceof Eo?Eo.create(fc(e.unwrap())):e instanceof Ia?Ia.create(e.items.map(t=>fc(t))):e}class mn extends $t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Bt.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==Be.object){const u=this._getOrReturnCtx(t);return Fe(u,{code:_e.invalid_type,expected:Be.object,received:u.parsedType}),yt}const{status:r,ctx:s}=this._processInputParams(t),{shape:a,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof xi&&this._def.unknownKeys==="strip"))for(const u in s.data)o.includes(u)||l.push(u);const c=[];for(const u of o){const d=a[u],f=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new Ma(s,f,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof xi){const u=this._def.unknownKeys;if(u==="passthrough")for(const d of l)c.push({key:{status:"valid",value:d},value:{status:"valid",value:s.data[d]}});else if(u==="strict")l.length>0&&(Fe(s,{code:_e.unrecognized_keys,keys:l}),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 l){const f=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new Ma(s,f,s.path,d)),alwaysSet:d in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const d of c){const f=await d.key,h=await d.value;u.push({key:f,value:h,alwaysSet:d.alwaysSet})}return u}).then(u=>br.mergeObjectSync(r,u)):br.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(t){return et.errToObj,new mn({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var s,a,o,l;const c=(o=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&o!==void 0?o:r.defaultError;return n.code==="unrecognized_keys"?{message:(l=et.errToObj(t).message)!==null&&l!==void 0?l:c}:{message:c}}}:{}})}strip(){return new mn({...this._def,unknownKeys:"strip"})}passthrough(){return new mn({...this._def,unknownKeys:"passthrough"})}extend(t){return new mn({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new mn({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:mt.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new mn({...this._def,catchall:t})}pick(t){const n={};return Bt.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new mn({...this._def,shape:()=>n})}omit(t){const n={};return Bt.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new mn({...this._def,shape:()=>n})}deepPartial(){return fc(this)}partial(t){const n={};return Bt.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}),new mn({...this._def,shape:()=>n})}required(t){const n={};return Bt.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof Aa;)a=a._def.innerType;n[r]=a}}),new mn({...this._def,shape:()=>n})}keyof(){return lR(Bt.objectKeys(this.shape))}}mn.create=(e,t)=>new mn({shape:()=>e,unknownKeys:"strip",catchall:xi.create(),typeName:mt.ZodObject,...Pt(t)});mn.strictCreate=(e,t)=>new mn({shape:()=>e,unknownKeys:"strict",catchall:xi.create(),typeName:mt.ZodObject,...Pt(t)});mn.lazycreate=(e,t)=>new mn({shape:e,unknownKeys:"strip",catchall:xi.create(),typeName:mt.ZodObject,...Pt(t)});class Xf extends $t{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(a){for(const l of a)if(l.result.status==="valid")return l.result;for(const l of a)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=a.map(l=>new os(l.ctx.common.issues));return Fe(n,{code:_e.invalid_union,unionErrors:o}),yt}if(n.common.async)return Promise.all(r.map(async a=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await a._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let a;const o=[];for(const c of r){const u={...n,common:{...n.common,issues:[]},parent:null},d=c._parseSync({data:n.data,path:n.path,parent:u});if(d.status==="valid")return d;d.status==="dirty"&&!a&&(a={result:d,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const l=o.map(c=>new os(c));return Fe(n,{code:_e.invalid_union,unionErrors:l}),yt}}get options(){return this._def.options}}Xf.create=(e,t)=>new Xf({options:e,typeName:mt.ZodUnion,...Pt(t)});const Ga=e=>e instanceof Qf?Ga(e.schema):e instanceof ia?Ga(e.innerType()):e instanceof Jf?[e.value]:e instanceof Co?e.options:e instanceof eh?Bt.objectValues(e.enum):e instanceof th?Ga(e._def.innerType):e instanceof qf?[void 0]:e instanceof Kf?[null]:e instanceof Aa?[void 0,...Ga(e.unwrap())]:e instanceof Eo?[null,...Ga(e.unwrap())]:e instanceof QS||e instanceof rh?Ga(e.unwrap()):e instanceof nh?Ga(e._def.innerType):[];class Py extends $t{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Be.object)return Fe(n,{code:_e.invalid_type,expected:Be.object,received:n.parsedType}),yt;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(Fe(n,{code:_e.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),yt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const s=new Map;for(const a of n){const o=Ga(a.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const l of o){if(s.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);s.set(l,a)}}return new Py({typeName:mt.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...Pt(r)})}}function Aw(e,t){const n=Wi(e),r=Wi(t);if(e===t)return{valid:!0,data:e};if(n===Be.object&&r===Be.object){const s=Bt.objectKeys(t),a=Bt.objectKeys(e).filter(l=>s.indexOf(l)!==-1),o={...e,...t};for(const l of a){const c=Aw(e[l],t[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===Be.array&&r===Be.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let a=0;a{if(_w(a)||_w(o))return yt;const l=Aw(a.value,o.value);return l.valid?((Pw(a)||Pw(o))&&n.dirty(),{status:n.value,value:l.data}):(Fe(r,{code:_e.invalid_intersection_types}),yt)};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(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Yf.create=(e,t,n)=>new Yf({left:e,right:t,typeName:mt.ZodIntersection,...Pt(n)});class Ia extends $t{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Be.array)return Fe(r,{code:_e.invalid_type,expected:Be.array,received:r.parsedType}),yt;if(r.data.lengththis._def.items.length&&(Fe(r,{code:_e.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const a=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new Ma(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(a).then(o=>br.mergeArray(n,o)):br.mergeArray(n,a)}get items(){return this._def.items}rest(t){return new Ia({...this._def,rest:t})}}Ia.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ia({items:e,typeName:mt.ZodTuple,rest:null,...Pt(t)})};class Zf extends $t{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Be.object)return Fe(r,{code:_e.invalid_type,expected:Be.object,received:r.parsedType}),yt;const s=[],a=this._def.keyType,o=this._def.valueType;for(const l in r.data)s.push({key:a._parse(new Ma(r,l,r.path,l)),value:o._parse(new Ma(r,r.data[l],r.path,l)),alwaysSet:l in r.data});return r.common.async?br.mergeObjectAsync(n,s):br.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof $t?new Zf({keyType:t,valueType:n,typeName:mt.ZodRecord,...Pt(r)}):new Zf({keyType:qs.create(),valueType:t,typeName:mt.ZodRecord,...Pt(n)})}}class _g extends $t{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Be.map)return Fe(r,{code:_e.invalid_type,expected:Be.map,received:r.parsedType}),yt;const s=this._def.keyType,a=this._def.valueType,o=[...r.data.entries()].map(([l,c],u)=>({key:s._parse(new Ma(r,l,r.path,[u,"key"])),value:a._parse(new Ma(r,c,r.path,[u,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const u=await c.key,d=await c.value;if(u.status==="aborted"||d.status==="aborted")return yt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const u=c.key,d=c.value;if(u.status==="aborted"||d.status==="aborted")return yt;(u.status==="dirty"||d.status==="dirty")&&n.dirty(),l.set(u.value,d.value)}return{status:n.value,value:l}}}}_g.create=(e,t,n)=>new _g({valueType:t,keyType:e,typeName:mt.ZodMap,...Pt(n)});class Dl extends $t{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==Be.set)return Fe(r,{code:_e.invalid_type,expected:Be.set,received:r.parsedType}),yt;const s=this._def;s.minSize!==null&&r.data.sizes.maxSize.value&&(Fe(r,{code:_e.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function o(c){const u=new Set;for(const d of c){if(d.status==="aborted")return yt;d.status==="dirty"&&n.dirty(),u.add(d.value)}return{status:n.value,value:u}}const l=[...r.data.values()].map((c,u)=>a._parse(new Ma(r,c,r.path,u)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(t,n){return new Dl({...this._def,minSize:{value:t,message:et.toString(n)}})}max(t,n){return new Dl({...this._def,maxSize:{value:t,message:et.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Dl.create=(e,t)=>new Dl({valueType:e,minSize:null,maxSize:null,typeName:mt.ZodSet,...Pt(t)});class Fc extends $t{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Be.function)return Fe(n,{code:_e.invalid_type,expected:Be.function,received:n.parsedType}),yt;function r(l,c){return wg({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,bg(),uu].filter(u=>!!u),issueData:{code:_e.invalid_arguments,argumentsError:c}})}function s(l,c){return wg({data:l,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,bg(),uu].filter(u=>!!u),issueData:{code:_e.invalid_return_type,returnTypeError:c}})}const a={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof fu){const l=this;return kr(async function(...c){const u=new os([]),d=await l._def.args.parseAsync(c,a).catch(p=>{throw u.addIssue(r(c,p)),u}),f=await Reflect.apply(o,this,d);return await l._def.returns._def.type.parseAsync(f,a).catch(p=>{throw u.addIssue(s(f,p)),u})})}else{const l=this;return kr(function(...c){const u=l._def.args.safeParse(c,a);if(!u.success)throw new os([r(c,u.error)]);const d=Reflect.apply(o,this,u.data),f=l._def.returns.safeParse(d,a);if(!f.success)throw new os([s(d,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Fc({...this._def,args:Ia.create(t).rest(bl.create())})}returns(t){return new Fc({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Fc({args:t||Ia.create([]).rest(bl.create()),returns:n||bl.create(),typeName:mt.ZodFunction,...Pt(r)})}}class Qf extends $t{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Qf.create=(e,t)=>new Qf({getter:e,typeName:mt.ZodLazy,...Pt(t)});class Jf extends $t{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return Fe(n,{received:n.data,code:_e.invalid_literal,expected:this._def.value}),yt}return{status:"valid",value:t.data}}get value(){return this._def.value}}Jf.create=(e,t)=>new Jf({value:e,typeName:mt.ZodLiteral,...Pt(t)});function lR(e,t){return new Co({values:e,typeName:mt.ZodEnum,...Pt(t)})}class Co extends $t{constructor(){super(...arguments),qd.set(this,void 0)}_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return Fe(n,{expected:Bt.joinValues(r),received:n.parsedType,code:_e.invalid_type}),yt}if(jg(this,qd)||sR(this,qd,new Set(this._def.values)),!jg(this,qd).has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return Fe(n,{received:n.data,code:_e.invalid_enum_value,options:r}),yt}return kr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return Co.create(t,{...this._def,...n})}exclude(t,n=this._def){return Co.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}qd=new WeakMap;Co.create=lR;class eh extends $t{constructor(){super(...arguments),Kd.set(this,void 0)}_parse(t){const n=Bt.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==Be.string&&r.parsedType!==Be.number){const s=Bt.objectValues(n);return Fe(r,{expected:Bt.joinValues(s),received:r.parsedType,code:_e.invalid_type}),yt}if(jg(this,Kd)||sR(this,Kd,new Set(Bt.getValidEnumValues(this._def.values))),!jg(this,Kd).has(t.data)){const s=Bt.objectValues(n);return Fe(r,{received:r.data,code:_e.invalid_enum_value,options:s}),yt}return kr(t.data)}get enum(){return this._def.values}}Kd=new WeakMap;eh.create=(e,t)=>new eh({values:e,typeName:mt.ZodNativeEnum,...Pt(t)});class fu extends $t{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Be.promise&&n.common.async===!1)return Fe(n,{code:_e.invalid_type,expected:Be.promise,received:n.parsedType}),yt;const r=n.parsedType===Be.promise?n.data:Promise.resolve(n.data);return kr(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}fu.create=(e,t)=>new fu({type:e,typeName:mt.ZodPromise,...Pt(t)});class ia extends $t{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===mt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:o=>{Fe(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const o=s.transform(r.data,a);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return yt;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?yt:c.status==="dirty"||n.value==="dirty"?_c(c.value):c});{if(n.value==="aborted")return yt;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?yt:l.status==="dirty"||n.value==="dirty"?_c(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,a);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?yt:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?yt:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Wf(o))return o;const l=s.transform(o.value,a);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Wf(o)?Promise.resolve(s.transform(o.value,a)).then(l=>({status:n.value,value:l})):o);Bt.assertNever(s)}}ia.create=(e,t,n)=>new ia({schema:e,typeName:mt.ZodEffects,effect:t,...Pt(n)});ia.createWithPreprocess=(e,t,n)=>new ia({schema:t,effect:{type:"preprocess",transform:e},typeName:mt.ZodEffects,...Pt(n)});class Aa extends $t{_parse(t){return this._getType(t)===Be.undefined?kr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Aa.create=(e,t)=>new Aa({innerType:e,typeName:mt.ZodOptional,...Pt(t)});class Eo extends $t{_parse(t){return this._getType(t)===Be.null?kr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Eo.create=(e,t)=>new Eo({innerType:e,typeName:mt.ZodNullable,...Pt(t)});class th extends $t{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===Be.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}th.create=(e,t)=>new th({innerType:e,typeName:mt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Pt(t)});class nh extends $t{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Hf(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new os(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new os(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}nh.create=(e,t)=>new nh({innerType:e,typeName:mt.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Pt(t)});class Pg extends $t{_parse(t){if(this._getType(t)!==Be.nan){const r=this._getOrReturnCtx(t);return Fe(r,{code:_e.invalid_type,expected:Be.nan,received:r.parsedType}),yt}return{status:"valid",value:t.data}}}Pg.create=e=>new Pg({typeName:mt.ZodNaN,...Pt(e)});const fq=Symbol("zod_brand");class QS extends $t{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class ap extends $t{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?yt:a.status==="dirty"?(n.dirty(),_c(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?yt:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new ap({in:t,out:n,typeName:mt.ZodPipeline})}}class rh extends $t{_parse(t){const n=this._def.innerType._parse(t),r=s=>(Wf(s)&&(s.value=Object.freeze(s.value)),s);return Hf(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}rh.create=(e,t)=>new rh({innerType:e,typeName:mt.ZodReadonly,...Pt(t)});function cR(e,t={},n){return e?du.create().superRefine((r,s)=>{var a,o;if(!e(r)){const l=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,c=(o=(a=l.fatal)!==null&&a!==void 0?a:n)!==null&&o!==void 0?o:!0,u=typeof l=="string"?{message:l}:l;s.addIssue({code:"custom",...u,fatal:c})}}):du.create()}const hq={object:mn.lazycreate};var mt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(mt||(mt={}));const pq=(e,t={message:`Input not instance of ${e.name}`})=>cR(n=>n instanceof e,t),uR=qs.create,dR=Po.create,mq=Pg.create,gq=Ao.create,fR=Gf.create,vq=Rl.create,yq=Sg.create,xq=qf.create,bq=Kf.create,wq=du.create,jq=bl.create,Sq=xi.create,Nq=Ng.create,_q=Qs.create,Pq=mn.create,Aq=mn.strictCreate,Cq=Xf.create,Eq=Py.create,Oq=Yf.create,kq=Ia.create,Tq=Zf.create,$q=_g.create,Mq=Dl.create,Iq=Fc.create,Rq=Qf.create,Dq=Jf.create,Lq=Co.create,Fq=eh.create,Bq=fu.create,mC=ia.create,zq=Aa.create,Uq=Eo.create,Vq=ia.createWithPreprocess,Wq=ap.create,Hq=()=>uR().optional(),Gq=()=>dR().optional(),qq=()=>fR().optional(),Kq={string:e=>qs.create({...e,coerce:!0}),number:e=>Po.create({...e,coerce:!0}),boolean:e=>Gf.create({...e,coerce:!0}),bigint:e=>Ao.create({...e,coerce:!0}),date:e=>Rl.create({...e,coerce:!0})},Xq=yt;var Te=Object.freeze({__proto__:null,defaultErrorMap:uu,setErrorMap:XG,getErrorMap:bg,makeIssue:wg,EMPTY_PATH:YG,addIssueToContext:Fe,ParseStatus:br,INVALID:yt,DIRTY:_c,OK:kr,isAborted:_w,isDirty:Pw,isValid:Wf,isAsync:Hf,get util(){return Bt},get objectUtil(){return Nw},ZodParsedType:Be,getParsedType:Wi,ZodType:$t,datetimeRegex:oR,ZodString:qs,ZodNumber:Po,ZodBigInt:Ao,ZodBoolean:Gf,ZodDate:Rl,ZodSymbol:Sg,ZodUndefined:qf,ZodNull:Kf,ZodAny:du,ZodUnknown:bl,ZodNever:xi,ZodVoid:Ng,ZodArray:Qs,ZodObject:mn,ZodUnion:Xf,ZodDiscriminatedUnion:Py,ZodIntersection:Yf,ZodTuple:Ia,ZodRecord:Zf,ZodMap:_g,ZodSet:Dl,ZodFunction:Fc,ZodLazy:Qf,ZodLiteral:Jf,ZodEnum:Co,ZodNativeEnum:eh,ZodPromise:fu,ZodEffects:ia,ZodTransformer:ia,ZodOptional:Aa,ZodNullable:Eo,ZodDefault:th,ZodCatch:nh,ZodNaN:Pg,BRAND:fq,ZodBranded:QS,ZodPipeline:ap,ZodReadonly:rh,custom:cR,Schema:$t,ZodSchema:$t,late:hq,get ZodFirstPartyTypeKind(){return mt},coerce:Kq,any:wq,array:_q,bigint:gq,boolean:fR,date:vq,discriminatedUnion:Eq,effect:mC,enum:Lq,function:Iq,instanceof:pq,intersection:Oq,lazy:Rq,literal:Dq,map:$q,nan:mq,nativeEnum:Fq,never:Sq,null:bq,nullable:Uq,number:dR,object:Pq,oboolean:qq,onumber:Gq,optional:zq,ostring:Hq,pipeline:Wq,preprocess:Vq,promise:Bq,record:Tq,set:Mq,strictObject:Aq,string:uR,symbol:yq,transformer:mC,tuple:kq,undefined:xq,union:Cq,unknown:jq,void:Nq,NEVER:Xq,ZodIssueCode:_e,quotelessJson:KG,ZodError:os}),Yq="Label",hR=v.forwardRef((e,t)=>i.jsx(Ye.label,{...e,ref:t,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=e.onMouseDown)==null||s.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));hR.displayName=Yq;var pR=hR;const Zq=VS("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),vs=v.forwardRef(({className:e,...t},n)=>i.jsx(pR,{ref:n,className:Me(Zq(),e),...t}));vs.displayName=pR.displayName;const Ay=EG,mR=v.createContext({}),dt=({...e})=>i.jsx(mR.Provider,{value:{name:e.name},children:i.jsx($G,{...e})}),Cy=()=>{const e=v.useContext(mR),t=v.useContext(gR),{getFieldState:n,formState:r}=Sy(),s=n(e.name,r);if(!e)throw new Error("useFormField should be used within ");const{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...s}},gR=v.createContext({}),ot=v.forwardRef(({className:e,...t},n)=>{const r=v.useId();return i.jsx(gR.Provider,{value:{id:r},children:i.jsx("div",{ref:n,className:Me("space-y-2",e),...t})})});ot.displayName="FormItem";const lt=v.forwardRef(({className:e,...t},n)=>{const{error:r,formItemId:s}=Cy();return i.jsx(vs,{ref:n,className:Me(r&&"text-destructive",e),htmlFor:s,...t})});lt.displayName="FormLabel";const ct=v.forwardRef(({...e},t)=>{const{error:n,formItemId:r,formDescriptionId:s,formMessageId:a}=Cy();return i.jsx(mi,{ref:t,id:r,"aria-describedby":n?`${s} ${a}`:`${s}`,"aria-invalid":!!n,...e})});ct.displayName="FormControl";const fn=v.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:r}=Cy();return i.jsx("p",{ref:n,id:r,className:Me("text-sm text-muted-foreground",e),...t})});fn.displayName="FormDescription";const ut=v.forwardRef(({className:e,children:t,...n},r)=>{const{error:s,formMessageId:a}=Cy(),o=s?String(s==null?void 0:s.message):t;return o?i.jsx("p",{ref:r,id:a,className:Me("text-sm font-medium text-destructive",e),...n,children:o}):null});ut.displayName="FormMessage";const Ot=v.forwardRef(({className:e,type:t,...n},r)=>i.jsx("input",{type:t,className:Me("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",e),ref:r,...n}));Ot.displayName="Input";const nt=v.forwardRef(({className:e,...t},n)=>i.jsx("textarea",{className:Me("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",e),ref:n,...t}));nt.displayName="Textarea";function sh(e,[t,n]){return Math.min(n,Math.max(t,e))}function Qq(e,t=[]){let n=[];function r(a,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,y=v.useMemo(()=>g,Object.values(g));return i.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return u.displayName=a+"Provider",[u,d]}const s=()=>{const a=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,Jq(s,...t)]}function Jq(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}function Ey(e){const t=e+"CollectionProvider",[n,r]=Qq(t),[s,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=p=>{const{scope:g,children:m}=p,y=E.useRef(null),b=E.useRef(new Map).current;return i.jsx(s,{scope:g,itemMap:b,collectionRef:y,children:m})};o.displayName=t;const l=e+"CollectionSlot",c=E.forwardRef((p,g)=>{const{scope:m,children:y}=p,b=a(l,m),x=xt(g,b.collectionRef);return i.jsx(mi,{ref:x,children:y})});c.displayName=l;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=E.forwardRef((p,g)=>{const{scope:m,children:y,...b}=p,x=E.useRef(null),w=xt(g,x),j=a(u,m);return E.useEffect(()=>(j.itemMap.set(x,{ref:x,...b}),()=>void j.itemMap.delete(x))),i.jsx(mi,{[d]:"",ref:w,children:y})});f.displayName=u;function h(p){const g=a(e+"CollectionConsumer",p);return E.useCallback(()=>{const y=g.collectionRef.current;if(!y)return[];const b=Array.from(y.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((j,S)=>b.indexOf(j.ref.current)-b.indexOf(S.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},h,r]}var eK=v.createContext(void 0);function Xl(e){const t=v.useContext(eK);return e||t||"ltr"}var x0=0;function JS(){v.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??gC()),document.body.insertAdjacentElement("beforeend",e[1]??gC()),x0++,()=>{x0===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),x0--}},[])}function gC(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var b0="focusScope.autoFocusOnMount",w0="focusScope.autoFocusOnUnmount",vC={bubbles:!1,cancelable:!0},tK="FocusScope",Oy=v.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:a,...o}=e,[l,c]=v.useState(null),u=Hn(s),d=Hn(a),f=v.useRef(null),h=xt(t,m=>c(m)),p=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(r){let m=function(w){if(p.paused||!l)return;const j=w.target;l.contains(j)?f.current=j:Ii(f.current,{select:!0})},y=function(w){if(p.paused||!l)return;const j=w.relatedTarget;j!==null&&(l.contains(j)||Ii(f.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&Ii(l)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const x=new MutationObserver(b);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),x.disconnect()}}},[r,l,p.paused]),v.useEffect(()=>{if(l){xC.add(p);const m=document.activeElement;if(!l.contains(m)){const b=new CustomEvent(b0,vC);l.addEventListener(b0,u),l.dispatchEvent(b),b.defaultPrevented||(nK(oK(vR(l)),{select:!0}),document.activeElement===m&&Ii(l))}return()=>{l.removeEventListener(b0,u),setTimeout(()=>{const b=new CustomEvent(w0,vC);l.addEventListener(w0,d),l.dispatchEvent(b),b.defaultPrevented||Ii(m??document.body,{select:!0}),l.removeEventListener(w0,d),xC.remove(p)},0)}}},[l,u,d,p]);const g=v.useCallback(m=>{if(!n&&!r||p.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,b=document.activeElement;if(y&&b){const x=m.currentTarget,[w,j]=rK(x);w&&j?!m.shiftKey&&b===j?(m.preventDefault(),n&&Ii(w,{select:!0})):m.shiftKey&&b===w&&(m.preventDefault(),n&&Ii(j,{select:!0})):b===x&&m.preventDefault()}},[n,r,p.paused]);return i.jsx(Ye.div,{tabIndex:-1,...o,ref:h,onKeyDown:g})});Oy.displayName=tK;function nK(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Ii(r,{select:t}),document.activeElement!==n)return}function rK(e){const t=vR(e),n=yC(t,e),r=yC(t.reverse(),e);return[n,r]}function vR(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yC(e,t){for(const n of e)if(!sK(n,{upTo:t}))return n}function sK(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function aK(e){return e instanceof HTMLInputElement&&"select"in e}function Ii(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&aK(e)&&t&&e.select()}}var xC=iK();function iK(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=bC(e,t),e.unshift(t)},remove(t){var n;e=bC(e,t),(n=e[0])==null||n.resume()}}}function bC(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function oK(e){return e.filter(t=>t.tagName!=="A")}function ip(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var lK=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},ac=new WeakMap,Kp=new WeakMap,Xp={},j0=0,yR=function(e){return e&&(e.host||yR(e.parentNode))},cK=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=yR(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},uK=function(e,t,n,r){var s=cK(t,Array.isArray(e)?e:[e]);Xp[n]||(Xp[n]=new WeakMap);var a=Xp[n],o=[],l=new Set,c=new Set(s),u=function(f){!f||l.has(f)||(l.add(f),u(f.parentNode))};s.forEach(u);var d=function(f){!f||c.has(f)||Array.prototype.forEach.call(f.children,function(h){if(l.has(h))d(h);else try{var p=h.getAttribute(r),g=p!==null&&p!=="false",m=(ac.get(h)||0)+1,y=(a.get(h)||0)+1;ac.set(h,m),a.set(h,y),o.push(h),m===1&&g&&Kp.set(h,!0),y===1&&h.setAttribute(n,"true"),g||h.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return d(t),l.clear(),j0++,function(){o.forEach(function(f){var h=ac.get(f)-1,p=a.get(f)-1;ac.set(f,h),a.set(f,p),h||(Kp.has(f)||f.removeAttribute(r),Kp.delete(f)),p||f.removeAttribute(n)}),j0--,j0||(ac=new WeakMap,ac=new WeakMap,Kp=new WeakMap,Xp={})}},eN=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),s=lK(e);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),uK(r,s,n,"aria-hidden")):function(){return null}},wa=function(){return wa=Object.assign||function(t){for(var n,r=1,s=arguments.length;r"u")return AK;var t=CK(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},OK=jR(),Bc="data-scroll-locked",kK=function(e,t,n,r){var s=e.left,a=e.top,o=e.right,l=e.gap;return n===void 0&&(n="margin"),` + .`.concat(fK,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(l,"px ").concat(r,`; + } + body[`).concat(Bc,`] { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(s,`px; + padding-top: `).concat(a,`px; + padding-right: `).concat(o,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(l,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(km,` { + right: `).concat(l,"px ").concat(r,`; + } + + .`).concat(Tm,` { + margin-right: `).concat(l,"px ").concat(r,`; + } + + .`).concat(km," .").concat(km,` { + right: 0 `).concat(r,`; + } + + .`).concat(Tm," .").concat(Tm,` { + margin-right: 0 `).concat(r,`; + } + + body[`).concat(Bc,`] { + `).concat(hK,": ").concat(l,`px; + } +`)},jC=function(){var e=parseInt(document.body.getAttribute(Bc)||"0",10);return isFinite(e)?e:0},TK=function(){v.useEffect(function(){return document.body.setAttribute(Bc,(jC()+1).toString()),function(){var e=jC()-1;e<=0?document.body.removeAttribute(Bc):document.body.setAttribute(Bc,e.toString())}},[])},$K=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,s=r===void 0?"margin":r;TK();var a=v.useMemo(function(){return EK(s)},[s]);return v.createElement(OK,{styles:kK(a,!t,s,n?"":"!important")})},Cw=!1;if(typeof window<"u")try{var Yp=Object.defineProperty({},"passive",{get:function(){return Cw=!0,!0}});window.addEventListener("test",Yp,Yp),window.removeEventListener("test",Yp,Yp)}catch{Cw=!1}var ic=Cw?{passive:!1}:!1,MK=function(e){return e.tagName==="TEXTAREA"},SR=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!MK(e)&&n[t]==="visible")},IK=function(e){return SR(e,"overflowY")},RK=function(e){return SR(e,"overflowX")},SC=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=NR(e,r);if(s){var a=_R(e,r),o=a[1],l=a[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},DK=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},LK=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},NR=function(e,t){return e==="v"?IK(t):RK(t)},_R=function(e,t){return e==="v"?DK(t):LK(t)},FK=function(e,t){return e==="h"&&t==="rtl"?-1:1},BK=function(e,t,n,r,s){var a=FK(e,window.getComputedStyle(t).direction),o=a*r,l=n.target,c=t.contains(l),u=!1,d=o>0,f=0,h=0;do{var p=_R(e,l),g=p[0],m=p[1],y=p[2],b=m-y-a*g;(g||b)&&NR(e,l)&&(f+=b,h+=g),l instanceof ShadowRoot?l=l.host:l=l.parentNode}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(d&&(Math.abs(f)<1||!s)||!d&&(Math.abs(h)<1||!s))&&(u=!0),u},Zp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},NC=function(e){return[e.deltaX,e.deltaY]},_C=function(e){return e&&"current"in e?e.current:e},zK=function(e,t){return e[0]===t[0]&&e[1]===t[1]},UK=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},VK=0,oc=[];function WK(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),s=v.useState(VK++)[0],a=v.useState(jR)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=dK([e.lockRef.current],(e.shards||[]).map(_C),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var l=v.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!o.current.allowPinchZoom;var b=Zp(m),x=n.current,w="deltaX"in m?m.deltaX:x[0]-b[0],j="deltaY"in m?m.deltaY:x[1]-b[1],S,N=m.target,_=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in m&&_==="h"&&N.type==="range")return!1;var P=SC(_,N);if(!P)return!0;if(P?S=_:(S=_==="v"?"h":"v",P=SC(_,N)),!P)return!1;if(!r.current&&"changedTouches"in m&&(w||j)&&(r.current=S),!S)return!0;var k=r.current||S;return BK(k,y,m,k==="h"?w:j,!0)},[]),c=v.useCallback(function(m){var y=m;if(!(!oc.length||oc[oc.length-1]!==a)){var b="deltaY"in y?NC(y):Zp(y),x=t.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&zK(S.delta,b)})[0];if(x&&x.should){y.cancelable&&y.preventDefault();return}if(!x){var w=(o.current.shards||[]).map(_C).filter(Boolean).filter(function(S){return S.contains(y.target)}),j=w.length>0?l(y,w[0]):!o.current.noIsolation;j&&y.cancelable&&y.preventDefault()}}},[]),u=v.useCallback(function(m,y,b,x){var w={name:m,delta:y,target:b,should:x,shadowParent:HK(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),d=v.useCallback(function(m){n.current=Zp(m),r.current=void 0},[]),f=v.useCallback(function(m){u(m.type,NC(m),m.target,l(m,e.lockRef.current))},[]),h=v.useCallback(function(m){u(m.type,Zp(m),m.target,l(m,e.lockRef.current))},[]);v.useEffect(function(){return oc.push(a),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,ic),document.addEventListener("touchmove",c,ic),document.addEventListener("touchstart",d,ic),function(){oc=oc.filter(function(m){return m!==a}),document.removeEventListener("wheel",c,ic),document.removeEventListener("touchmove",c,ic),document.removeEventListener("touchstart",d,ic)}},[]);var p=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(a,{styles:UK(s)}):null,p?v.createElement($K,{gapMode:e.gapMode}):null)}function HK(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const GK=bK(wR,WK);var Ty=v.forwardRef(function(e,t){return v.createElement(ky,wa({},e,{ref:t,sideCar:GK}))});Ty.classNames=ky.classNames;var qK=[" ","Enter","ArrowUp","ArrowDown"],KK=[" ","Enter"],op="Select",[$y,My,XK]=Ey(op),[Qu,PPe]=Gr(op,[XK,Gu]),Iy=Gu(),[YK,Do]=Qu(op),[ZK,QK]=Qu(op),PR=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:a,value:o,defaultValue:l,onValueChange:c,dir:u,name:d,autoComplete:f,disabled:h,required:p,form:g}=e,m=Iy(t),[y,b]=v.useState(null),[x,w]=v.useState(null),[j,S]=v.useState(!1),N=Xl(u),[_=!1,P]=aa({prop:r,defaultProp:s,onChange:a}),[k,O]=aa({prop:o,defaultProp:l,onChange:c}),M=v.useRef(null),A=y?g||!!y.closest("form"):!0,[$,L]=v.useState(new Set),H=Array.from($).map(D=>D.props.value).join(";");return i.jsx(NM,{...m,children:i.jsxs(YK,{required:p,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:S,contentId:Ys(),value:k,onValueChange:O,open:_,onOpenChange:P,dir:N,triggerPointerDownPosRef:M,disabled:h,children:[i.jsx($y.Provider,{scope:t,children:i.jsx(ZK,{scope:e.__scopeSelect,onNativeOptionAdd:v.useCallback(D=>{L(V=>new Set(V).add(D))},[]),onNativeOptionRemove:v.useCallback(D=>{L(V=>{const T=new Set(V);return T.delete(D),T})},[]),children:n})}),A?i.jsxs(ZR,{"aria-hidden":!0,required:p,tabIndex:-1,name:d,autoComplete:f,value:k,onChange:D=>O(D.target.value),disabled:h,form:g,children:[k===void 0?i.jsx("option",{value:""}):null,Array.from($)]},H):null]})})};PR.displayName=op;var AR="SelectTrigger",CR=v.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,a=Iy(n),o=Do(AR,n),l=o.disabled||r,c=xt(t,o.onTriggerChange),u=My(n),d=v.useRef("touch"),[f,h,p]=QR(m=>{const y=u().filter(w=>!w.disabled),b=y.find(w=>w.value===o.value),x=JR(y,m,b);x!==void 0&&o.onValueChange(x.value)}),g=m=>{l||(o.onOpenChange(!0),p()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return i.jsx(wS,{asChild:!0,...a,children:i.jsx(Ye.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":YR(o.value)?"":void 0,...s,ref:c,onClick:Ee(s.onClick,m=>{m.currentTarget.focus(),d.current!=="mouse"&&g(m)}),onPointerDown:Ee(s.onPointerDown,m=>{d.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:Ee(s.onKeyDown,m=>{const y=f.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&h(m.key),!(y&&m.key===" ")&&qK.includes(m.key)&&(g(),m.preventDefault())})})})});CR.displayName=AR;var ER="SelectValue",OR=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:a,placeholder:o="",...l}=e,c=Do(ER,n),{onValueNodeHasChildrenChange:u}=c,d=a!==void 0,f=xt(t,c.onValueNodeChange);return ir(()=>{u(d)},[u,d]),i.jsx(Ye.span,{...l,ref:f,style:{pointerEvents:"none"},children:YR(c.value)?i.jsx(i.Fragment,{children:o}):a})});OR.displayName=ER;var JK="SelectIcon",kR=v.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return i.jsx(Ye.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});kR.displayName=JK;var eX="SelectPortal",TR=e=>i.jsx(cy,{asChild:!0,...e});TR.displayName=eX;var Ll="SelectContent",$R=v.forwardRef((e,t)=>{const n=Do(Ll,e.__scopeSelect),[r,s]=v.useState();if(ir(()=>{s(new DocumentFragment)},[]),!n.open){const a=r;return a?Vu.createPortal(i.jsx(MR,{scope:e.__scopeSelect,children:i.jsx($y.Slot,{scope:e.__scopeSelect,children:i.jsx("div",{children:e.children})})}),a):null}return i.jsx(IR,{...e,ref:t})});$R.displayName=Ll;var Rs=10,[MR,Lo]=Qu(Ll),tX="SelectContentImpl",IR=v.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:y,...b}=e,x=Do(Ll,n),[w,j]=v.useState(null),[S,N]=v.useState(null),_=xt(t,ce=>j(ce)),[P,k]=v.useState(null),[O,M]=v.useState(null),A=My(n),[$,L]=v.useState(!1),H=v.useRef(!1);v.useEffect(()=>{if(w)return eN(w)},[w]),JS();const D=v.useCallback(ce=>{const[De,...de]=A().map(ne=>ne.ref.current),[be]=de.slice(-1),Pe=document.activeElement;for(const ne of ce)if(ne===Pe||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===De&&S&&(S.scrollTop=0),ne===be&&S&&(S.scrollTop=S.scrollHeight),ne==null||ne.focus(),document.activeElement!==Pe))return},[A,S]),V=v.useCallback(()=>D([P,w]),[D,P,w]);v.useEffect(()=>{$&&V()},[$,V]);const{onOpenChange:T,triggerPointerDownPosRef:F}=x;v.useEffect(()=>{if(w){let ce={x:0,y:0};const De=be=>{var Pe,ne;ce={x:Math.abs(Math.round(be.pageX)-(((Pe=F.current)==null?void 0:Pe.x)??0)),y:Math.abs(Math.round(be.pageY)-(((ne=F.current)==null?void 0:ne.y)??0))}},de=be=>{ce.x<=10&&ce.y<=10?be.preventDefault():w.contains(be.target)||T(!1),document.removeEventListener("pointermove",De),F.current=null};return F.current!==null&&(document.addEventListener("pointermove",De),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",De),document.removeEventListener("pointerup",de,{capture:!0})}}},[w,T,F]),v.useEffect(()=>{const ce=()=>T(!1);return window.addEventListener("blur",ce),window.addEventListener("resize",ce),()=>{window.removeEventListener("blur",ce),window.removeEventListener("resize",ce)}},[T]);const[q,Z]=QR(ce=>{const De=A().filter(Pe=>!Pe.disabled),de=De.find(Pe=>Pe.ref.current===document.activeElement),be=JR(De,ce,de);be&&setTimeout(()=>be.ref.current.focus())}),re=v.useCallback((ce,De,de)=>{const be=!H.current&&!de;(x.value!==void 0&&x.value===De||be)&&(k(ce),be&&(H.current=!0))},[x.value]),ge=v.useCallback(()=>w==null?void 0:w.focus(),[w]),B=v.useCallback((ce,De,de)=>{const be=!H.current&&!de;(x.value!==void 0&&x.value===De||be)&&M(ce)},[x.value]),le=r==="popper"?Ew:RR,se=le===Ew?{side:l,sideOffset:c,align:u,alignOffset:d,arrowPadding:f,collisionBoundary:h,collisionPadding:p,sticky:g,hideWhenDetached:m,avoidCollisions:y}:{};return i.jsx(MR,{scope:n,content:w,viewport:S,onViewportChange:N,itemRefCallback:re,selectedItem:P,onItemLeave:ge,itemTextRefCallback:B,focusSelectedItem:V,selectedItemText:O,position:r,isPositioned:$,searchRef:q,children:i.jsx(Ty,{as:mi,allowPinchZoom:!0,children:i.jsx(Oy,{asChild:!0,trapped:x.open,onMountAutoFocus:ce=>{ce.preventDefault()},onUnmountAutoFocus:Ee(s,ce=>{var De;(De=x.trigger)==null||De.focus({preventScroll:!0}),ce.preventDefault()}),children:i.jsx(Jh,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:ce=>ce.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:i.jsx(le,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ce=>ce.preventDefault(),...b,...se,onPlaced:()=>L(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Ee(b.onKeyDown,ce=>{const De=ce.ctrlKey||ce.altKey||ce.metaKey;if(ce.key==="Tab"&&ce.preventDefault(),!De&&ce.key.length===1&&Z(ce.key),["ArrowUp","ArrowDown","Home","End"].includes(ce.key)){let be=A().filter(Pe=>!Pe.disabled).map(Pe=>Pe.ref.current);if(["ArrowUp","End"].includes(ce.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(ce.key)){const Pe=ce.target,ne=be.indexOf(Pe);be=be.slice(ne+1)}setTimeout(()=>D(be)),ce.preventDefault()}})})})})})})});IR.displayName=tX;var nX="SelectItemAlignedPosition",RR=v.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,a=Do(Ll,n),o=Lo(Ll,n),[l,c]=v.useState(null),[u,d]=v.useState(null),f=xt(t,_=>d(_)),h=My(n),p=v.useRef(!1),g=v.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:b,focusSelectedItem:x}=o,w=v.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&m&&y&&b){const _=a.trigger.getBoundingClientRect(),P=u.getBoundingClientRect(),k=a.valueNode.getBoundingClientRect(),O=b.getBoundingClientRect();if(a.dir!=="rtl"){const Pe=O.left-P.left,ne=k.left-Pe,Je=_.left-ne,ve=_.width+Je,at=Math.max(ve,P.width),st=window.innerWidth-Rs,Mt=sh(ne,[Rs,Math.max(Rs,st-at)]);l.style.minWidth=ve+"px",l.style.left=Mt+"px"}else{const Pe=P.right-O.right,ne=window.innerWidth-k.right-Pe,Je=window.innerWidth-_.right-ne,ve=_.width+Je,at=Math.max(ve,P.width),st=window.innerWidth-Rs,Mt=sh(ne,[Rs,Math.max(Rs,st-at)]);l.style.minWidth=ve+"px",l.style.right=Mt+"px"}const M=h(),A=window.innerHeight-Rs*2,$=m.scrollHeight,L=window.getComputedStyle(u),H=parseInt(L.borderTopWidth,10),D=parseInt(L.paddingTop,10),V=parseInt(L.borderBottomWidth,10),T=parseInt(L.paddingBottom,10),F=H+D+$+T+V,q=Math.min(y.offsetHeight*5,F),Z=window.getComputedStyle(m),re=parseInt(Z.paddingTop,10),ge=parseInt(Z.paddingBottom,10),B=_.top+_.height/2-Rs,le=A-B,se=y.offsetHeight/2,ce=y.offsetTop+se,De=H+D+ce,de=F-De;if(De<=B){const Pe=M.length>0&&y===M[M.length-1].ref.current;l.style.bottom="0px";const ne=u.clientHeight-m.offsetTop-m.offsetHeight,Je=Math.max(le,se+(Pe?ge:0)+ne+V),ve=De+Je;l.style.height=ve+"px"}else{const Pe=M.length>0&&y===M[0].ref.current;l.style.top="0px";const Je=Math.max(B,H+m.offsetTop+(Pe?re:0)+se)+de;l.style.height=Je+"px",m.scrollTop=De-B+m.offsetTop}l.style.margin=`${Rs}px 0`,l.style.minHeight=q+"px",l.style.maxHeight=A+"px",r==null||r(),requestAnimationFrame(()=>p.current=!0)}},[h,a.trigger,a.valueNode,l,u,m,y,b,a.dir,r]);ir(()=>w(),[w]);const[j,S]=v.useState();ir(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]);const N=v.useCallback(_=>{_&&g.current===!0&&(w(),x==null||x(),g.current=!1)},[w,x]);return i.jsx(sX,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:p,onScrollButtonChange:N,children:i.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:i.jsx(Ye.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});RR.displayName=nX;var rX="SelectPopperPosition",Ew=v.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Rs,...a}=e,o=Iy(n);return i.jsx(jS,{...o,...a,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...a.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)"}})});Ew.displayName=rX;var[sX,tN]=Qu(Ll,{}),Ow="SelectViewport",DR=v.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,a=Lo(Ow,n),o=tN(Ow,n),l=xt(t,a.onViewportChange),c=v.useRef(0);return i.jsxs(i.Fragment,{children:[i.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}),i.jsx($y.Slot,{scope:n,children:i.jsx(Ye.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ee(s.onScroll,u=>{const d=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:h}=o;if(h!=null&&h.current&&f){const p=Math.abs(c.current-d.scrollTop);if(p>0){const g=window.innerHeight-Rs*2,m=parseFloat(f.style.minHeight),y=parseFloat(f.style.height),b=Math.max(m,y);if(b0?j:0,f.style.justifyContent="flex-end")}}}c.current=d.scrollTop})})})]})});DR.displayName=Ow;var LR="SelectGroup",[aX,iX]=Qu(LR),oX=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Ys();return i.jsx(aX,{scope:n,id:s,children:i.jsx(Ye.div,{role:"group","aria-labelledby":s,...r,ref:t})})});oX.displayName=LR;var FR="SelectLabel",BR=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=iX(FR,n);return i.jsx(Ye.div,{id:s.id,...r,ref:t})});BR.displayName=FR;var Ag="SelectItem",[lX,zR]=Qu(Ag),UR=v.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:a,...o}=e,l=Do(Ag,n),c=Lo(Ag,n),u=l.value===r,[d,f]=v.useState(a??""),[h,p]=v.useState(!1),g=xt(t,x=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,x,r,s)}),m=Ys(),y=v.useRef("touch"),b=()=>{s||(l.onValueChange(r),l.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 i.jsx(lX,{scope:n,value:r,disabled:s,textId:m,isSelected:u,onItemTextChange:v.useCallback(x=>{f(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:i.jsx($y.ItemSlot,{scope:n,value:r,disabled:s,textValue:d,children:i.jsx(Ye.div,{role:"option","aria-labelledby":m,"data-highlighted":h?"":void 0,"aria-selected":u&&h,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:g,onFocus:Ee(o.onFocus,()=>p(!0)),onBlur:Ee(o.onBlur,()=>p(!1)),onClick:Ee(o.onClick,()=>{y.current!=="mouse"&&b()}),onPointerUp:Ee(o.onPointerUp,()=>{y.current==="mouse"&&b()}),onPointerDown:Ee(o.onPointerDown,x=>{y.current=x.pointerType}),onPointerMove:Ee(o.onPointerMove,x=>{var w;y.current=x.pointerType,s?(w=c.onItemLeave)==null||w.call(c):y.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ee(o.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:Ee(o.onKeyDown,x=>{var j;((j=c.searchRef)==null?void 0:j.current)!==""&&x.key===" "||(KK.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});UR.displayName=Ag;var Xd="SelectItemText",VR=v.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...a}=e,o=Do(Xd,n),l=Lo(Xd,n),c=zR(Xd,n),u=QK(Xd,n),[d,f]=v.useState(null),h=xt(t,b=>f(b),c.onItemTextChange,b=>{var x;return(x=l.itemTextRefCallback)==null?void 0:x.call(l,b,c.value,c.disabled)}),p=d==null?void 0:d.textContent,g=v.useMemo(()=>i.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=u;return ir(()=>(m(g),()=>y(g)),[m,y,g]),i.jsxs(i.Fragment,{children:[i.jsx(Ye.span,{id:c.textId,...a,ref:h}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Vu.createPortal(a.children,o.valueNode):null]})});VR.displayName=Xd;var WR="SelectItemIndicator",HR=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return zR(WR,n).isSelected?i.jsx(Ye.span,{"aria-hidden":!0,...r,ref:t}):null});HR.displayName=WR;var kw="SelectScrollUpButton",GR=v.forwardRef((e,t)=>{const n=Lo(kw,e.__scopeSelect),r=tN(kw,e.__scopeSelect),[s,a]=v.useState(!1),o=xt(t,r.onScrollButtonChange);return ir(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollTop>0;a(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?i.jsx(KR,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});GR.displayName=kw;var Tw="SelectScrollDownButton",qR=v.forwardRef((e,t)=>{const n=Lo(Tw,e.__scopeSelect),r=tN(Tw,e.__scopeSelect),[s,a]=v.useState(!1),o=xt(t,r.onScrollButtonChange);return ir(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=c.scrollHeight-c.clientHeight,d=Math.ceil(c.scrollTop)c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?i.jsx(KR,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});qR.displayName=Tw;var KR=v.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,a=Lo("SelectScrollButton",n),o=v.useRef(null),l=My(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),ir(()=>{var d;const u=l().find(f=>f.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),i.jsx(Ye.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Ee(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Ee(s.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Ee(s.onPointerLeave,()=>{c()})})}),cX="SelectSeparator",XR=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return i.jsx(Ye.div,{"aria-hidden":!0,...r,ref:t})});XR.displayName=cX;var $w="SelectArrow",uX=v.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=Iy(n),a=Do($w,n),o=Lo($w,n);return a.open&&o.position==="popper"?i.jsx(SS,{...s,...r,ref:t}):null});uX.displayName=$w;function YR(e){return e===""||e===void 0}var ZR=v.forwardRef((e,t)=>{const{value:n,...r}=e,s=v.useRef(null),a=xt(t,s),o=ip(n);return v.useEffect(()=>{const l=s.current,c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==n&&d){const f=new Event("change",{bubbles:!0});d.call(l,n),l.dispatchEvent(f)}},[o,n]),i.jsx(NS,{asChild:!0,children:i.jsx("select",{...r,ref:a,defaultValue:n})})});ZR.displayName="BubbleSelect";function QR(e){const t=Hn(e),n=v.useRef(""),r=v.useRef(0),s=v.useCallback(o=>{const l=n.current+o;t(l),function c(u){n.current=u,window.clearTimeout(r.current),u!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),a=v.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,a]}function JR(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let o=dX(e,Math.max(a,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function dX(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var fX=PR,eD=CR,hX=OR,pX=kR,mX=TR,tD=$R,gX=DR,nD=BR,rD=UR,vX=VR,yX=HR,sD=GR,aD=qR,iD=XR;const Mn=fX,In=hX,Pn=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(eD,{ref:r,className:Me("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",e),...n,children:[t,i.jsx(pX,{asChild:!0,children:i.jsx(yi,{className:"h-4 w-4 opacity-50"})})]}));Pn.displayName=eD.displayName;const oD=v.forwardRef(({className:e,...t},n)=>i.jsx(sD,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(Tl,{className:"h-4 w-4"})}));oD.displayName=sD.displayName;const lD=v.forwardRef(({className:e,...t},n)=>i.jsx(aD,{ref:n,className:Me("flex cursor-default items-center justify-center py-1",e),...t,children:i.jsx(yi,{className:"h-4 w-4"})}));lD.displayName=aD.displayName;const An=v.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>i.jsx(mX,{children:i.jsxs(tD,{ref:s,className:Me("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",e),position:n,...r,children:[i.jsx(oD,{}),i.jsx(gX,{className:Me("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),i.jsx(lD,{})]})}));An.displayName=tD.displayName;const xX=v.forwardRef(({className:e,...t},n)=>i.jsx(nD,{ref:n,className:Me("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));xX.displayName=nD.displayName;const fe=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(rD,{ref:r,className:Me("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",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(yX,{children:i.jsx(Ta,{className:"h-4 w-4"})})}),i.jsx(vX,{children:t})]}));fe.displayName=rD.displayName;const bX=v.forwardRef(({className:e,...t},n)=>i.jsx(iD,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));bX.displayName=iD.displayName;const wX=Te.object({audienceBrief:Te.string().min(10,{message:"Audience brief must be at least 10 characters."}),researchObjective:Te.string().optional(),personaCount:Te.string().min(1,{message:"Number of personas is required."}),dataFile:Te.instanceof(FileList).optional(),llm_model:Te.string().optional()});function jX({onSubmit:e,isGenerating:t}){const[n,r]=v.useState(!1),[s,a]=v.useState(!1),[o,l]=v.useState({audience_brief:[],research_objective:[]}),[c,u]=v.useState(!1),[d,f]=v.useState(null),h=Ny({resolver:_y(wX),defaultValues:{audienceBrief:"",researchObjective:"",personaCount:"5",llm_model:"gemini-2.5-pro"}}),p=h.watch("audienceBrief"),g=h.watch("researchObjective"),m=async()=>{var w,j,S,N,_,P,k,O,M,A,$;const b=p==null?void 0:p.trim(),x=g==null?void 0:g.trim();if(!b||b.length<10){oe.error("Audience brief too short",{description:"Please enter at least 10 characters in the audience brief"});return}if(!x||x.length<10){oe.error("Research objective too short",{description:"Please enter at least 10 characters in the research objective"});return}u(!0),f(null);try{const L=await Ka.enhanceAudienceBrief(b,x);l(L.data.suggestions||{audience_brief:[],research_objective:[]}),r(!0),a(!1);const H=(((j=(w=L.data.suggestions)==null?void 0:w.audience_brief)==null?void 0:j.length)||0)+(((N=(S=L.data.suggestions)==null?void 0:S.research_objective)==null?void 0:N.length)||0);oe.success("Enhancement suggestions generated",{description:`Generated ${H} suggestions to improve your research inputs`})}catch(L){console.error("Error enhancing audience brief:",L);let H="Please try again or modify your brief",D="Failed to generate suggestions";if(L&&typeof L=="object"){const V=L;V.code==="ECONNABORTED"||(_=V.message)!=null&&_.includes("timeout")?(D="Request timeout",H="The AI took too long to analyze your brief. Please try again."):((P=V.response)==null?void 0:P.status)===500?(D="Server error",H=((O=(k=V.response)==null?void 0:k.data)==null?void 0:O.message)||"The server encountered an error. Please try again later."):((M=V.response)==null?void 0:M.status)===400?(D="Invalid brief",H=(($=(A=V.response)==null?void 0:A.data)==null?void 0:$.message)||"Please check your audience brief and try again."):V.message&&(H=V.message)}else L instanceof Error&&(H=L.message);f(H),oe.error(D,{description:H,duration:5e3})}finally{u(!1)}},y=()=>{a(!s)};return i.jsx(Ay,{...h,children:i.jsxs("form",{onSubmit:h.handleSubmit(e),className:"space-y-6",children:[i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-6",children:[i.jsx(dt,{control:h.control,name:"audienceBrief",render:({field:b})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Audience Brief"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Describe your target audience and research goals...",className:"h-40",...b})}),i.jsx(fn,{children:"Provide details about the demographics, behaviors, and attitudes you want to explore"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:h.control,name:"researchObjective",render:({field:b})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Research Objective"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"What is the main research topic or objective you want to explore?",className:"h-32",...b})}),i.jsx(fn,{children:"Specify your research focus to generate more targeted persona goals, frustrations, and scenarios"}),i.jsx(ut,{})]})}),i.jsx("div",{className:"space-y-3",children:i.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:m,disabled:!p||p.trim().length<10||!g||g.trim().length<10||c||t,className:"flex items-center gap-2 hover-transition",children:c?i.jsxs(i.Fragment,{children:[i.jsx(Lc,{className:"h-4 w-4 animate-spin"}),"Analyzing Research Inputs..."]}):i.jsxs(i.Fragment,{children:[i.jsx(Ml,{className:"h-4 w-4"}),"Enhance Brief"]})})})]}),i.jsxs("div",{className:"space-y-6",children:[i.jsx(dt,{control:h.control,name:"dataFile",render:({field:{value:b,onChange:x,...w}})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Customer Data (Optional)"}),i.jsx(ct,{children:i.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[i.jsx(aI,{className:"h-10 w-10 text-slate-400 mb-2"}),i.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload customer data for more accurate personas"}),i.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Supports PDF, Office docs, images, and more"}),i.jsx(Ot,{...w,type:"file",multiple:!0,accept:".pdf,.docx,.pptx,.xlsx,.html,.xml,.rtf,.pages,.key,.epub,.txt,.csv,.jpg,.jpeg,.png",onChange:j=>{x(j.target.files)},className:"hidden",id:"data-file-input"}),i.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var j;return(j=document.getElementById("data-file-input"))==null?void 0:j.click()},children:[i.jsx(oI,{className:"mr-2 h-4 w-4"}),"Select Files"]}),b&&b.length>0&&i.jsx("p",{className:"text-xs text-primary mt-2",children:b.length===1?b[0].name:`${b.length} files selected`})]})}),i.jsx(fn,{children:"Upload existing customer data to create more realistic personas"}),i.jsx(ut,{})]})}),i.jsxs("div",{className:"bg-muted/30 p-4 rounded-lg border border-border",children:[i.jsxs("div",{className:"flex items-center mb-2",children:[i.jsx(dw,{className:"h-5 w-5 text-muted-foreground mr-2"}),i.jsx("h3",{className:"font-sf font-medium",children:"What's included?"})]}),i.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[i.jsxs("li",{className:"flex items-center",children:[i.jsx(Gd,{className:"h-4 w-4 text-green-500 mr-2"}),"Demographic profiles based on your brief"]}),i.jsxs("li",{className:"flex items-center",children:[i.jsx(Gd,{className:"h-4 w-4 text-green-500 mr-2"}),"Personality traits and behavioral patterns"]}),i.jsxs("li",{className:"flex items-center",children:[i.jsx(Gd,{className:"h-4 w-4 text-green-500 mr-2"}),"Consumer preferences and interests"]}),i.jsxs("li",{className:"flex items-center",children:[i.jsx(Gd,{className:"h-4 w-4 text-green-500 mr-2"}),"Review and refine capabilities"]})]})]})]})]}),n&&i.jsxs("div",{className:"glass-panel rounded-lg p-4 border border-border bg-muted/30",children:[i.jsxs("div",{className:"flex items-center justify-between mb-3",children:[i.jsxs("h3",{className:"font-sf font-medium text-sm flex items-center gap-2",children:[i.jsx(Ml,{className:"h-4 w-4 text-primary"}),"Enhancement Suggestions:"]}),i.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:y,className:"h-6 w-6 p-0 hover:bg-slate-200",title:s?"Expand suggestions":"Collapse suggestions",children:s?i.jsx(yi,{className:"h-4 w-4"}):i.jsx(Tl,{className:"h-4 w-4"})})]}),!s&&i.jsx(i.Fragment,{children:d?i.jsx("div",{className:"text-sm text-red-600 bg-red-50 p-3 rounded-md",children:d}):i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsx("div",{children:o.audience_brief.length>0?i.jsxs("div",{children:[i.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[i.jsx(or,{className:"h-4 w-4 text-blue-600"}),"Suggestions for your Audience Brief:"]}),i.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:o.audience_brief.map((b,x)=>i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-blue-600 mt-1.5 text-xs",children:"•"}),i.jsx("span",{className:"flex-1",children:b})]},x))})]}):i.jsx("div",{className:"text-sm text-muted-foreground",children:"No audience brief suggestions available"})}),i.jsx("div",{children:o.research_objective.length>0?i.jsxs("div",{children:[i.jsxs("h4",{className:"font-sf font-medium text-sm text-slate-800 mb-2 flex items-center gap-2",children:[i.jsx(dw,{className:"h-4 w-4 text-green-600"}),"Suggestions for your Research Objective:"]}),i.jsx("ul",{className:"space-y-2 text-sm text-slate-700",children:o.research_objective.map((b,x)=>i.jsxs("li",{className:"flex items-start gap-2",children:[i.jsx("span",{className:"text-green-600 mt-1.5 text-xs",children:"•"}),i.jsx("span",{className:"flex-1",children:b})]},x))})]}):i.jsx("div",{className:"text-sm text-muted-foreground",children:"No research objective suggestions available"})}),o.audience_brief.length===0&&o.research_objective.length===0&&i.jsx("div",{className:"col-span-full text-sm text-muted-foreground text-center",children:"No suggestions available"})]})})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsx(dt,{control:h.control,name:"llm_model",render:({field:b})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"AI Model"}),i.jsxs(Mn,{onValueChange:b.onChange,defaultValue:b.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select AI model"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),i.jsx(fe,{value:"gpt-4.1",children:"GPT-4.1"})]})]}),i.jsx(fn,{children:"Choose which AI model to use for generating personas"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:h.control,name:"personaCount",render:({field:b})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Number of Personas to Generate"}),i.jsx(ct,{children:i.jsx(Ot,{type:"number",min:"1",max:"20",...b})}),i.jsx(fn,{children:"How many synthetic users do you need for your research?"}),i.jsx(ut,{})]})})]}),i.jsxs("div",{className:"flex flex-col items-end",children:[i.jsx(te,{type:"submit",disabled:t,className:"min-w-36",children:t?i.jsxs(i.Fragment,{children:[i.jsx(Lc,{className:"mr-2 h-4 w-4 animate-spin"}),"AI Generating..."]}):i.jsxs(i.Fragment,{children:[i.jsx(or,{className:"mr-2 h-4 w-4"}),"Generate Personas"]})}),t&&i.jsx("div",{className:"text-xs text-muted-foreground mt-2",children:"Generating multiple personas in parallel. This may take 1-2 minutes..."})]})]})})}const rt=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Me("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));rt.displayName="Card";const Dr=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Me("flex flex-col space-y-1.5 p-6",e),...t}));Dr.displayName="CardHeader";const ts=v.forwardRef(({className:e,...t},n)=>i.jsx("h3",{ref:n,className:Me("text-2xl font-semibold leading-none tracking-tight",e),...t}));ts.displayName="CardTitle";const nN=v.forwardRef(({className:e,...t},n)=>i.jsx("p",{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));nN.displayName="CardDescription";const bt=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Me("p-6 pt-0",e),...t}));bt.displayName="CardContent";const rN=v.forwardRef(({className:e,...t},n)=>i.jsx("div",{ref:n,className:Me("flex items-center p-6 pt-0",e),...t}));rN.displayName="CardFooter";const SX=e=>{const t=e==null?void 0:e.toLowerCase(),n="/semblance/";switch(t){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`}},lp=e=>e.avatar||SX(e.gender);function sN({user:e,selected:t=!1,onClick:n,showDetailedDialog:r=!1,onSelectionToggle:s,showAddToFolderButton:a=!1,onAddToFolder:o,onViewDetails:l}){const c=Tn();v.useState(!1);const[u,d]=v.useState(e),f=e._id||e.id,h=m=>{m.stopPropagation(),c(`/synthetic-users/${f}`)};u.oceanTraits&&(u.oceanTraits.openness,u.oceanTraits.conscientiousness,u.oceanTraits.extraversion,u.oceanTraits.agreeableness,u.oceanTraits.neuroticism);const p=m=>{var x,w;const y=m.target;y.closest("button")&&((w=(x=y.closest("button"))==null?void 0:x.textContent)!=null&&w.includes("View Details"))||(s?s(m):n&&n(m))},g=m=>{m.stopPropagation(),l?l(u):h(m)};return i.jsxs("div",{className:Me("persona-card glass-card rounded-xl p-4 cursor-pointer hover:shadow-md button-transition",t&&"selected ring-2 ring-primary"),onClick:p,children:[i.jsx("div",{className:"persona-card-overlay"}),i.jsx("div",{className:"persona-card-checkmark",children:i.jsx(Ta,{className:"h-4 w-4 text-primary"})}),i.jsx("div",{className:"relative z-10",children:i.jsxs("div",{className:"flex items-start space-x-4",children:[i.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:i.jsx("img",{src:lp(u),alt:`${u.name} avatar`,className:"h-12 w-12 rounded-full object-cover"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("div",{className:"flex items-center justify-between gap-2",children:i.jsx("h3",{className:"text-sm font-medium truncate flex-1",children:u.name})}),i.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[u.age," • ",u.gender]}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:u.occupation}),i.jsx("p",{className:"text-xs text-muted-foreground",children:u.location}),i.jsx("div",{className:"mt-2",children:u.aiSynthesizedBio?i.jsxs("p",{className:"text-xs text-slate-700 line-clamp-3 leading-relaxed",children:[u.aiSynthesizedBio,u.aiSynthesizedBio.length>150&&"..."]}):i.jsxs("p",{className:"text-xs text-muted-foreground italic line-clamp-3",children:['"',u.personality,'"']})}),u.qualitativeAttributes&&u.qualitativeAttributes.length>0&&i.jsx("div",{className:"mt-3",children:i.jsx("div",{className:"flex flex-wrap gap-1",children:u.qualitativeAttributes.slice(0,3).map((m,y)=>i.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-50 text-blue-700 text-xs rounded-full",children:[i.jsx(MW,{className:"h-3 w-3"}),m]},y))})}),u.topPersonalityTraits&&u.topPersonalityTraits.length>0&&i.jsx("div",{className:"mt-2",children:i.jsx("div",{className:"flex flex-wrap gap-1",children:u.topPersonalityTraits.slice(0,3).map((m,y)=>i.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-purple-50 text-purple-700 text-xs rounded-full",children:[i.jsx(kl,{className:"h-3 w-3"}),m]},y))})}),i.jsx("div",{className:"mt-3 flex justify-end",children:i.jsx(te,{variant:"ghost",size:"sm",onClick:g,children:"View Details"})})]})]})})]})}var aN="Collapsible",[NX,APe]=Gr(aN),[_X,iN]=NX(aN),cD=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:a,onOpenChange:o,...l}=e,[c=!1,u]=aa({prop:r,defaultProp:s,onChange:o});return i.jsx(_X,{scope:n,disabled:a,contentId:Ys(),open:c,onOpenToggle:v.useCallback(()=>u(d=>!d),[u]),children:i.jsx(Ye.div,{"data-state":lN(c),"data-disabled":a?"":void 0,...l,ref:t})})});cD.displayName=aN;var uD="CollapsibleTrigger",dD=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,s=iN(uD,n);return i.jsx(Ye.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":lN(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:t,onClick:Ee(e.onClick,s.onOpenToggle)})});dD.displayName=uD;var oN="CollapsibleContent",fD=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=iN(oN,e.__scopeCollapsible);return i.jsx(lr,{present:n||s.open,children:({present:a})=>i.jsx(PX,{...r,ref:t,present:a})})});fD.displayName=oN;var PX=v.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:s,...a}=e,o=iN(oN,n),[l,c]=v.useState(r),u=v.useRef(null),d=xt(t,u),f=v.useRef(0),h=f.current,p=v.useRef(0),g=p.current,m=o.open||l,y=v.useRef(m),b=v.useRef();return v.useEffect(()=>{const x=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(x)},[]),ir(()=>{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),c(r)}},[o.open,r]),i.jsx(Ye.div,{"data-state":lN(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...a,ref:d,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":g?`${g}px`:void 0,...e.style},children:m&&s})});function lN(e){return e?"open":"closed"}var AX=cD;const cp=AX,up=dD,dp=fD;function CX({generatedPersonas:e,selectedPersonas:t,isGenerating:n,onPersonaSelection:r,onRefinePersonas:s,onApprovePersonas:a,onBackToGenerator:o}){const l=Tn(),[c,u]=v.useState(""),[d,f]=v.useState(!1),h=p=>{l(`/synthetic-users/${p}?fromReview=true`)};return i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"font-sf text-lg font-medium",children:"Review Generated Personas"}),i.jsxs("div",{className:"text-sm text-muted-foreground",children:[t.length," of ",e.length," selected"]})]}),i.jsx("div",{className:"space-y-4",children:e.map(p=>i.jsx(rt,{className:`border ${t.includes(p.id)?"border-primary/50 bg-primary/5":""} cursor-pointer`,onClick:()=>h(p.id),children:i.jsx(bt,{className:"p-4",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsx("div",{className:"flex-1",children:i.jsxs("div",{className:"flex items-center",children:[i.jsx("input",{type:"checkbox",id:`persona-${p.id}`,checked:t.includes(p.id),onChange:g=>{g.stopPropagation(),r(p.id)},className:"mr-3 h-4 w-4 rounded border-gray-300 text-primary focus:ring-primary"}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium",children:p.name}),i.jsxs("p",{className:"text-sm text-muted-foreground",children:[p.age," • ",p.gender," • ",p.occupation]})]})]})}),i.jsx(sN,{user:p,showDetailedDialog:!1,onClick:g=>{g.stopPropagation(),h(p.id)}})]})})},p.id))}),i.jsx("div",{className:"space-y-4 pt-4 border-t",children:i.jsxs("div",{children:[i.jsx("div",{className:"flex justify-between items-start mb-4",children:i.jsxs(te,{variant:"outline",onClick:o,children:[i.jsx(zf,{className:"mr-2 h-4 w-4"}),"Back to Generator"]})}),i.jsxs(cp,{open:d,onOpenChange:f,className:"w-full space-y-4",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx(up,{asChild:!0,children:i.jsxs(te,{variant:"outline",className:"flex items-center gap-2",children:[i.jsx(Lc,{className:"h-4 w-4"}),"Refine Personas",i.jsx(yi,{className:"h-4 w-4 ml-1 transition-transform duration-200",style:{transform:d?"rotate(180deg)":"rotate(0deg)"}})]})}),i.jsxs(te,{onClick:a,disabled:t.length===0,children:[i.jsx(Gd,{className:"mr-2 h-4 w-4"}),"Approve Selected (",t.length,")"]})]}),i.jsx(dp,{children:i.jsx(rt,{className:"border shadow-sm w-full mt-4",children:i.jsx(bt,{className:"p-6",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{htmlFor:"refinement-prompt",className:"text-sm font-medium block mb-2",children:"Refinement Instructions"}),i.jsx(nt,{id:"refinement-prompt",placeholder:"Example: Make all personas 5 years younger, or ensure everyone is from different locations...",value:c,onChange:p=>u(p.target.value),className:"min-h-[100px] w-full resize-y"}),i.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."})]}),i.jsxs(te,{onClick:()=>s(c),disabled:n||c.trim()==="",className:"w-full",children:[n?i.jsx(Lc,{className:"mr-2 h-4 w-4 animate-spin"}):i.jsx(Lc,{className:"mr-2 h-4 w-4"}),"Apply Refinements"]})]})})})})]})]})})]})}async function EX(e,t,n,r,s,a){console.log(`generateSyntheticPersonas called with targetFolderId: ${s||"none"}`),console.log(`🔄 generateSyntheticPersonas using model: ${a||"gemini-2.5-pro"}`);try{if(console.log(`Generating ${n} synthetic personas using two-stage approach...`),e.trim().length<10)throw new Error("Audience brief is too short. Please provide more context for better persona generation.");let o;if(r&&r.length>0){console.log(`Uploading ${r.length} customer data files...`);try{o=(await Ka.uploadCustomerData(r)).data.session_id,console.log(`Customer data uploaded with session ID: ${o}`)}catch(c){throw console.error("Failed to upload customer data:",c),new Error("Failed to upload customer data files. Please try again.")}}const l=await Ka.batchGenerateWithStages(e,t,n,.8,o,a);if(l.data){const c=l.data.partial_success===!0,u=l.data.personas&&l.data.personas.length>0,d=l.data.errors&&l.data.errors.length>0;if(u){if(console.log(`Generated ${l.data.personas.length} personas with two-stage process${d?` (${l.data.errors.length} failed)`:""}`),s){const h=l.data.personas.map(p=>({...p,folderId:s}));try{const p=h.map(g=>{if(g.id||g._id){const m=g._id||g.id;return console.log(`Updating persona ${g.name||m} with folder ID: ${s}`),Dn.update(m,{...g,folderId:s}).catch(y=>(console.error(`Error updating folder ID for persona ${g.name||m}:`,y),null))}return Promise.resolve(null)});await Promise.allSettled(p),console.log(`Added ${h.length} personas to folder ID: ${s}`)}catch(p){console.error("Error updating personas with folder ID:",p)}if(o)try{await Ka.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(p){console.warn("Failed to cleanup customer data:",p)}return c||d?{...l.data,personas:h,length:h.length}:{...l.data,personas:h}}if(o)try{await Ka.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}if(c||d)return{...l.data.personas,length:l.data.personas.length,partial_success:c,errors:l.data.errors};if(o)try{await Ka.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}return l.data.personas}else if(d){if(o)try{await Ka.cleanupCustomerData(o),console.log(`Cleaned up customer data for session: ${o}`)}catch(f){console.warn("Failed to cleanup customer data:",f)}throw new Error(`Failed to generate personas: ${l.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(o){if(customerDataSessionId)try{await Ka.cleanupCustomerData(customerDataSessionId),console.log(`Cleaned up customer data for session: ${customerDataSessionId}`)}catch(l){console.warn("Failed to cleanup customer data:",l)}throw console.error("Error generating AI personas:",o),o}}function hD(){const[e,t]=v.useState([]),n=async a=>{const o=[];for(const l of a){const c={...l};c._id&&typeof c._id=="string"&&c._id.startsWith("local-")&&delete c._id;const u=await Dn.create(c);console.log("Persona saved to database:",u.data),o.push({...l,id:u.data._id||u.data.id,_id:u.data._id||u.data.id,isDbPersona:!0})}t(o)},r=async()=>{const a=await Dn.getAll();return a&&a.data&&Array.isArray(a.data)?(console.log("Personas loaded from database:",a.data.length),a.data.map(o=>({...o,id:o._id||o.id,isDbPersona:!0}))):[]};return v.useEffect(()=>{(async()=>{const o=await r();t(o)})()},[]),{storedPersonas:e,savePersonas:n,loadPersonas:r,clearPersonas:async()=>{const a=await r();for(const o of a)o._id&&await Dn.delete(o._id);t([])}}}function OX({targetFolderId:e,targetFolderName:t}){const n=qr(),r=Tn(),{loadPersonas:s,savePersonas:a}=hD(),[o,l]=v.useState(!1),[c,u]=v.useState([]),[d,f]=v.useState([]),[h,p]=v.useState(!1),[g,m]=v.useState(0);v.useEffect(()=>{const S=new URLSearchParams(n.search),N=S.get("mode"),_=S.get("tab"),P=S.get("step");if(N==="create"&&_==="ai"&&P==="review"){const k=s();k.length>0&&(u(k),f(k.map(O=>O.id)),p(!0))}},[n,s]);async function y(S){var N,_,P,k,O,M,A,$,L,H;try{l(!0),m(0);const D=parseInt(S.personaCount);if(isNaN(D)||D<1||D>10){oe.error("Invalid number of personas",{description:"Please enter a number between 1 and 10"}),l(!1);return}m(5);const V=setInterval(()=>{m(Z=>Z<90?Z+Math.random()*5:Z)},500),T=D<=2?"30-60 seconds":D<=4?"1-2 minutes":D<=6?"2-3 minutes":"3-5 minutes";D>4&&oe.info("Generation may take longer",{description:`Generating ${D} personas at once may result in some timeouts. If this happens, the successfully created personas will still be saved.`,duration:8e3}),oe.info("Generating AI personas in parallel",{description:`Creating ${D} synthetic personas based on your brief. This may take ${T}. Please be patient.`,duration:1e4}),e&&t?(console.log(`Target folder for new personas: ID=${e}, Name=${t}`),oe.info(`Creating personas in "${t}" folder`,{duration:3e3})):console.log("No target folder specified for new personas"),console.log(`🤖 Starting persona generation with model: ${S.llm_model||"gemini-2.5-pro"}`);const F=await EX(S.audienceBrief,S.researchObjective,D,S.dataFile,e,S.llm_model),q=F.personas||F;if(clearInterval(V),m(100),q&&q.length>0)console.log(`✅ Successfully generated ${q.length} personas using model: ${S.llm_model||"gemini-2.5-pro"}`),F.partial_success||F.errors&&F.errors.length>0?(oe.success("Some personas generated successfully",{description:`${q.length} synthetic personas were created using ${S.llm_model||"Gemini 2.5 Pro"}. ${((N=F.errors)==null?void 0:N.length)||0} failed due to timeout or other errors.`,duration:8e3}),F.errors&&F.errors.length>0&&setTimeout(()=>{oe.error("Some personas failed to generate",{description:`${F.errors.length} personas timed out. The server took too long to generate them. The successfully generated personas have been saved${e?" in the selected folder":""}.`,duration:1e4})},1e3)):oe.success("Personas generated and saved successfully",{description:`${q.length} synthetic personas have been created using ${S.llm_model||"Gemini 2.5 Pro"} and saved ${e?`to the "${t}" folder`:"to the database"}.`}),r("/synthetic-users?mode=view");else throw new Error("No personas were generated")}catch(D){console.error(`❌ Error generating personas using model: ${S.llm_model||"gemini-2.5-pro"}:`,D);let V="Please try again or adjust your parameters",T="Failed to generate personas";D.code==="ECONNABORTED"||(_=D.message)!=null&&_.includes("timeout")||((P=D.response)==null?void 0:P.status)===504?(T="Generation timeout",V="AI persona generation timed out. This often happens when generating multiple complex personas. Try generating fewer personas (2-3) or try again later."):((k=D.response)==null?void 0:k.status)===500?(T="Server error",(M=(O=D.response)==null?void 0:O.data)!=null&&M.message?V=D.response.data.message:($=(A=D.response)==null?void 0:A.data)!=null&&$.error?V=D.response.data.error:V="The server encountered an error processing your request. Please try again later."):((L=D.response)==null?void 0:L.status)===401?(T="Authentication required",V="Please log in to generate personas."):(H=D.message)!=null&&H.includes("504 Deadline Exceeded")?(T="Generation timeout",V="The AI model took too long to generate personas. Try generating fewer personas or simplify your brief."):D instanceof Error&&(V=D.message),oe.error(T,{description:V,duration:6e3})}finally{setTimeout(()=>{l(!1),m(0)},500)}}const b=S=>{f(N=>N.includes(S)?N.filter(_=>_!==S):[...N,S])},x=(S,N)=>{const _=N.toLowerCase();return S.map(P=>{const k={...P};if(_.includes("younger")){const O=parseInt(k.age);k.age=(O-5).toString()}else if(_.includes("older")){const O=parseInt(k.age);k.age=(O+5).toString()}if(_.includes("different locations")&&(k.location=`${k.location} (Diversified)`),_.includes("more extroverted")?k.personality=`Extroverted, ${k.personality.toLowerCase()}`:_.includes("more introverted")&&(k.personality=`Introverted, ${k.personality.toLowerCase()}`),_.includes("diverse")){const O=["tech-savvy","traditional","innovative","conservative","creative"],M=O[Math.floor(Math.random()*O.length)];k.personality=`${M}, ${k.personality}`}return k})},w=S=>{if(!S.trim()){oe.error("Please provide refinement instructions");return}l(!0),setTimeout(()=>{try{const N=c.filter(k=>d.includes(k.id)),_=x(N,S),P=c.map(k=>_.find(M=>M.id===k.id)||k);u(P),l(!1),a(P),oe.success("Personas refined based on your instructions",{description:"Review the updated profiles"})}catch(N){console.error("Error refining personas:",N),oe.error("Failed to refine personas",{description:"Please try different instructions"}),l(!1)}},1500)},j=()=>{const S=c.filter(N=>d.includes(N.id));oe.success(`${S.length} personas approved`,{description:"Added to your synthetic persona library"}),a(S),r("/synthetic-users?mode=view")};return i.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[i.jsx(or,{className:"h-5 w-5 text-primary"}),i.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Persona Recruiter"})]}),o&&i.jsxs("div",{className:"mb-6",children:[i.jsxs("div",{className:"flex justify-between items-center mb-2",children:[i.jsx("span",{className:"text-sm font-medium",children:"Generating personas in parallel..."}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[Math.round(g),"%"]})]}),i.jsx(al,{value:g,className:"h-2"})]}),h?i.jsx(CX,{generatedPersonas:c,selectedPersonas:d,isGenerating:o,onPersonaSelection:b,onRefinePersonas:w,onApprovePersonas:j,onBackToGenerator:()=>p(!1)}):i.jsx(jX,{onSubmit:y,isGenerating:o})]})}const Oo=new Map;function pD(e){const{id:t,title:n,description:r,type:s="default",duration:a}=e;let o;switch(s){case"success":o=oe.success(n,{description:r,duration:a});break;case"error":o=oe.error(n,{description:r,duration:a});break;case"warning":o=oe.warning(n,{description:r,duration:a});break;case"info":o=oe.info(n,{description:r,duration:a});break;default:o=oe(n,{description:r,duration:a});break}return Oo.set(t,o.toString()),t}function kX(e,t){const n=Oo.get(e);if(!n)return console.warn(`Toast with ID "${e}" not found. Creating new toast instead.`),pD({id:e,...t,title:t.title||"Updated"}),!1;const{title:r,description:s,type:a="default",duration:o}=t;oe.dismiss(n);let l;switch(a){case"success":l=oe.success(r,{description:s,duration:o});break;case"error":l=oe.error(r,{description:s,duration:o});break;case"warning":l=oe.warning(r,{description:s,duration:o});break;case"info":l=oe.info(r,{description:s,duration:o});break;default:l=oe(r,{description:s,duration:o});break}return Oo.set(e,l.toString()),!0}function TX(e){const t=Oo.get(e);return t?(oe.dismiss(t),Oo.delete(e),!0):(console.warn(`Toast with ID "${e}" not found.`),!1)}function $X(e){return Oo.has(e)}function MX(){Oo.forEach(e=>{oe.dismiss(e)}),Oo.clear()}const Ke={success:oe.success,error:oe.error,warning:oe.warning,info:oe.info,loading:oe.loading,dismiss:oe.dismiss,createPersistent:pD,updatePersistent:kX,dismissPersistent:TX,hasPersistent:$X,dismissAllPersistent:MX};var mD=["PageUp","PageDown"],gD=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],vD={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ju="Slider",[Mw,IX,RX]=Ey(Ju),[yD,CPe]=Gr(Ju,[RX]),[DX,Ry]=yD(Ju),xD=v.forwardRef((e,t)=>{const{name:n,min:r=0,max:s=100,step:a=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:u=[r],value:d,onValueChange:f=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:g,...m}=e,y=v.useRef(new Set),b=v.useRef(0),w=o==="horizontal"?LX:FX,[j=[],S]=aa({prop:d,defaultProp:u,onChange:M=>{var $;($=[...y.current][b.current])==null||$.focus(),f(M)}}),N=v.useRef(j);function _(M){const A=WX(j,M);O(M,A)}function P(M){O(M,b.current)}function k(){const M=N.current[b.current];j[b.current]!==M&&h(j)}function O(M,A,{commit:$}={commit:!1}){const L=KX(a),H=XX(Math.round((M-r)/a)*a+r,L),D=sh(H,[r,s]);S((V=[])=>{const T=UX(V,D,A);if(qX(T,c*a)){b.current=T.indexOf(D);const F=String(T)!==String(V);return F&&$&&h(T),F?T:V}else return V})}return i.jsx(DX,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:b,thumbs:y.current,values:j,orientation:o,form:g,children:i.jsx(Mw.Provider,{scope:e.__scopeSlider,children:i.jsx(Mw.Slot,{scope:e.__scopeSlider,children:i.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...m,ref:t,onPointerDown:Ee(m.onPointerDown,()=>{l||(N.current=j)}),min:r,max:s,inverted:p,onSlideStart:l?void 0:_,onSlideMove:l?void 0:P,onSlideEnd:l?void 0:k,onHomeKeyDown:()=>!l&&O(r,0,{commit:!0}),onEndKeyDown:()=>!l&&O(s,j.length-1,{commit:!0}),onStepKeyDown:({event:M,direction:A})=>{if(!l){const H=mD.includes(M.key)||M.shiftKey&&gD.includes(M.key)?10:1,D=b.current,V=j[D],T=a*H*A;O(V+T,D,{commit:!0})}}})})})})});xD.displayName=Ju;var[bD,wD]=yD(Ju,{startEdge:"left",endEdge:"right",size:"width",direction:1}),LX=v.forwardRef((e,t)=>{const{min:n,max:r,dir:s,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:u,...d}=e,[f,h]=v.useState(null),p=xt(t,w=>h(w)),g=v.useRef(),m=Xl(s),y=m==="ltr",b=y&&!a||!y&&a;function x(w){const j=g.current||f.getBoundingClientRect(),S=[0,j.width],_=cN(S,b?[n,r]:[r,n]);return g.current=j,_(w-j.left)}return i.jsx(bD,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:i.jsx(jD,{dir:m,"data-orientation":"horizontal",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const j=x(w.clientX);o==null||o(j)},onSlideMove:w=>{const j=x(w.clientX);l==null||l(j)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:w=>{const S=vD[b?"from-left":"from-right"].includes(w.key);u==null||u({event:w,direction:S?-1:1})}})})}),FX=v.forwardRef((e,t)=>{const{min:n,max:r,inverted:s,onSlideStart:a,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...u}=e,d=v.useRef(null),f=xt(t,d),h=v.useRef(),p=!s;function g(m){const y=h.current||d.current.getBoundingClientRect(),b=[0,y.height],w=cN(b,p?[r,n]:[n,r]);return h.current=y,w(m-y.top)}return i.jsx(bD,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:i.jsx(jD,{"data-orientation":"vertical",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:m=>{const y=g(m.clientY);a==null||a(y)},onSlideMove:m=>{const y=g(m.clientY);o==null||o(y)},onSlideEnd:()=>{h.current=void 0,l==null||l()},onStepKeyDown:m=>{const b=vD[p?"from-bottom":"from-top"].includes(m.key);c==null||c({event:m,direction:b?-1:1})}})})}),jD=v.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:a,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...u}=e,d=Ry(Ju,n);return i.jsx(Ye.span,{...u,ref:t,onKeyDown:Ee(e.onKeyDown,f=>{f.key==="Home"?(o(f),f.preventDefault()):f.key==="End"?(l(f),f.preventDefault()):mD.concat(gD).includes(f.key)&&(c(f),f.preventDefault())}),onPointerDown:Ee(e.onPointerDown,f=>{const h=f.target;h.setPointerCapture(f.pointerId),f.preventDefault(),d.thumbs.has(h)?h.focus():r(f)}),onPointerMove:Ee(e.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&s(f)}),onPointerUp:Ee(e.onPointerUp,f=>{const h=f.target;h.hasPointerCapture(f.pointerId)&&(h.releasePointerCapture(f.pointerId),a(f))})})}),SD="SliderTrack",ND=v.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Ry(SD,n);return i.jsx(Ye.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:t})});ND.displayName=SD;var Iw="SliderRange",_D=v.forwardRef((e,t)=>{const{__scopeSlider:n,...r}=e,s=Ry(Iw,n),a=wD(Iw,n),o=v.useRef(null),l=xt(t,o),c=s.values.length,u=s.values.map(h=>AD(h,s.min,s.max)),d=c>1?Math.min(...u):0,f=100-Math.max(...u);return i.jsx(Ye.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...e.style,[a.startEdge]:d+"%",[a.endEdge]:f+"%"}})});_D.displayName=Iw;var Rw="SliderThumb",PD=v.forwardRef((e,t)=>{const n=IX(e.__scopeSlider),[r,s]=v.useState(null),a=xt(t,l=>s(l)),o=v.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return i.jsx(BX,{...e,ref:a,index:o})}),BX=v.forwardRef((e,t)=>{const{__scopeSlider:n,index:r,name:s,...a}=e,o=Ry(Rw,n),l=wD(Rw,n),[c,u]=v.useState(null),d=xt(t,x=>u(x)),f=c?o.form||!!c.closest("form"):!0,h=tp(c),p=o.values[r],g=p===void 0?0:AD(p,o.min,o.max),m=VX(r,o.values.length),y=h==null?void 0:h[l.size],b=y?HX(y,g,l.direction):0;return v.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),i.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[i.jsx(Mw.ItemSlot,{scope:e.__scopeSlider,children:i.jsx(Ye.span,{role:"slider","aria-label":e["aria-label"]||m,"aria-valuemin":o.min,"aria-valuenow":p,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...a,ref:d,style:p===void 0?{display:"none"}:e.style,onFocus:Ee(e.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),f&&i.jsx(zX,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:p},r)]})});PD.displayName=Rw;var zX=e=>{const{value:t,...n}=e,r=v.useRef(null),s=ip(t);return v.useEffect(()=>{const a=r.current,o=window.HTMLInputElement.prototype,c=Object.getOwnPropertyDescriptor(o,"value").set;if(s!==t&&c){const u=new Event("input",{bubbles:!0});c.call(a,t),a.dispatchEvent(u)}},[s,t]),i.jsx("input",{style:{display:"none"},...n,ref:r,defaultValue:t})};function UX(e=[],t,n){const r=[...e];return r[n]=t,r.sort((s,a)=>s-a)}function AD(e,t,n){const a=100/(n-t)*(e-t);return sh(a,[0,100])}function VX(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function WX(e,t){if(e.length===1)return 0;const n=e.map(s=>Math.abs(s-t)),r=Math.min(...n);return n.indexOf(r)}function HX(e,t,n){const r=e/2,a=cN([0,50],[0,r]);return(r-a(t)*n)*n}function GX(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function qX(e,t){if(t>0){const n=GX(e);return Math.min(...n)>=t}return!0}function cN(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function KX(e){return(String(e).split(".")[1]||"").length}function XX(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var CD=xD,YX=ND,ZX=_D,QX=PD;const Un=v.forwardRef(({className:e,...t},n)=>i.jsxs(CD,{ref:n,className:Me("relative flex w-full touch-none select-none items-center",e),...t,children:[i.jsx(YX,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:i.jsx(ZX,{className:"absolute h-full bg-primary"})}),i.jsx(QX,{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"})]}));Un.displayName=CD.displayName;var uN="Switch",[JX,EPe]=Gr(uN),[eY,tY]=JX(uN),ED=v.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:a,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=v.useState(null),g=xt(t,w=>p(w)),m=v.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=aa({prop:s,defaultProp:a,onChange:u});return i.jsxs(eY,{scope:n,checked:b,disabled:l,children:[i.jsx(Ye.button,{type:"button",role:"switch","aria-checked":b,"aria-required":o,"data-state":TD(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onClick:Ee(e.onClick,w=>{x(j=>!j),y&&(m.current=w.isPropagationStopped(),m.current||w.stopPropagation())})}),y&&i.jsx(nY,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});ED.displayName=uN;var OD="SwitchThumb",kD=v.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,s=tY(OD,n);return i.jsx(Ye.span,{"data-state":TD(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:t})});kD.displayName=OD;var nY=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,a=v.useRef(null),o=ip(n),l=tp(t);return v.useEffect(()=>{const c=a.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[o,n,r]),i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:a,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function TD(e){return e?"checked":"unchecked"}var $D=ED,rY=kD;const ah=v.forwardRef(({className:e,...t},n)=>i.jsx($D,{className:Me("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",e),...t,ref:n,children:i.jsx(rY,{className:Me("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")})}));ah.displayName=$D.displayName;function sY(e,t=[]){let n=[];function r(a,o){const l=v.createContext(o),c=n.length;n=[...n,o];function u(f){const{scope:h,children:p,...g}=f,m=(h==null?void 0:h[e][c])||l,y=v.useMemo(()=>g,Object.values(g));return i.jsx(m.Provider,{value:y,children:p})}function d(f,h){const p=(h==null?void 0:h[e][c])||l,g=v.useContext(p);if(g)return g;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return u.displayName=a+"Provider",[u,d]}const s=()=>{const a=n.map(o=>v.createContext(o));return function(l){const c=(l==null?void 0:l[e])||a;return v.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[r,aY(s,...t)]}function aY(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=r.reduce((l,{useScope:c,scopeName:u})=>{const f=c(a)[`__scope${u}`];return{...l,...f}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return n.scopeName=t.scopeName,n}var P0="rovingFocusGroup.onEntryFocus",iY={bubbles:!1,cancelable:!0},Dy="RovingFocusGroup",[Dw,MD,oY]=Ey(Dy),[lY,ed]=sY(Dy,[oY]),[cY,uY]=lY(Dy),ID=v.forwardRef((e,t)=>i.jsx(Dw.Provider,{scope:e.__scopeRovingFocusGroup,children:i.jsx(Dw.Slot,{scope:e.__scopeRovingFocusGroup,children:i.jsx(dY,{...e,ref:t})})}));ID.displayName=Dy;var dY=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=v.useRef(null),p=xt(t,h),g=Xl(a),[m=null,y]=aa({prop:o,defaultProp:l,onChange:c}),[b,x]=v.useState(!1),w=Hn(u),j=MD(n),S=v.useRef(!1),[N,_]=v.useState(0);return v.useEffect(()=>{const P=h.current;if(P)return P.addEventListener(P0,w),()=>P.removeEventListener(P0,w)},[w]),i.jsx(cY,{scope:n,orientation:r,dir:g,loop:s,currentTabStopId:m,onItemFocus:v.useCallback(P=>y(P),[y]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>_(P=>P+1),[]),onFocusableItemRemove:v.useCallback(()=>_(P=>P-1),[]),children:i.jsx(Ye.div,{tabIndex:b||N===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Ee(e.onMouseDown,()=>{S.current=!0}),onFocus:Ee(e.onFocus,P=>{const k=!S.current;if(P.target===P.currentTarget&&k&&!b){const O=new CustomEvent(P0,iY);if(P.currentTarget.dispatchEvent(O),!O.defaultPrevented){const M=j().filter(D=>D.focusable),A=M.find(D=>D.active),$=M.find(D=>D.id===m),H=[A,$,...M].filter(Boolean).map(D=>D.ref.current);LD(H,d)}}S.current=!1}),onBlur:Ee(e.onBlur,()=>x(!1))})})}),RD="RovingFocusGroupItem",DD=v.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:a,...o}=e,l=Ys(),c=a||l,u=uY(RD,n),d=u.currentTabStopId===c,f=MD(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return v.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),i.jsx(Dw.ItemSlot,{scope:n,id:c,focusable:r,active:s,children:i.jsx(Ye.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...o,ref:t,onMouseDown:Ee(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:Ee(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ee(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const m=pY(g,u.orientation,u.dir);if(m!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let b=f().filter(x=>x.focusable).map(x=>x.ref.current);if(m==="last")b.reverse();else if(m==="prev"||m==="next"){m==="prev"&&b.reverse();const x=b.indexOf(g.currentTarget);b=u.loop?mY(b,x+1):b.slice(x+1)}setTimeout(()=>LD(b))}})})})});DD.displayName=RD;var fY={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function hY(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function pY(e,t,n){const r=hY(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return fY[r]}function LD(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function mY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var dN=ID,fN=DD,hN="Tabs",[gY,OPe]=Gr(hN,[ed]),FD=ed(),[vY,pN]=gY(hN),BD=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:a,orientation:o="horizontal",dir:l,activationMode:c="automatic",...u}=e,d=Xl(l),[f,h]=aa({prop:r,onChange:s,defaultProp:a});return i.jsx(vY,{scope:n,baseId:Ys(),value:f,onValueChange:h,orientation:o,dir:d,activationMode:c,children:i.jsx(Ye.div,{dir:d,"data-orientation":o,...u,ref:t})})});BD.displayName=hN;var zD="TabsList",UD=v.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...s}=e,a=pN(zD,n),o=FD(n);return i.jsx(dN,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:i.jsx(Ye.div,{role:"tablist","aria-orientation":a.orientation,...s,ref:t})})});UD.displayName=zD;var VD="TabsTrigger",WD=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...a}=e,o=pN(VD,n),l=FD(n),c=qD(o.baseId,r),u=KD(o.baseId,r),d=r===o.value;return i.jsx(fN,{asChild:!0,...l,focusable:!s,active:d,children:i.jsx(Ye.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...a,ref:t,onMouseDown:Ee(e.onMouseDown,f=>{!s&&f.button===0&&f.ctrlKey===!1?o.onValueChange(r):f.preventDefault()}),onKeyDown:Ee(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(r)}),onFocus:Ee(e.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!s&&f&&o.onValueChange(r)})})})});WD.displayName=VD;var HD="TabsContent",GD=v.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:s,children:a,...o}=e,l=pN(HD,n),c=qD(l.baseId,r),u=KD(l.baseId,r),d=r===l.value,f=v.useRef(d);return v.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),i.jsx(lr,{present:s||d,children:({present:h})=>i.jsx(Ye.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&a})})});GD.displayName=HD;function qD(e,t){return`${e}-trigger-${t}`}function KD(e,t){return`${e}-content-${t}`}var yY=BD,XD=UD,YD=WD,ZD=GD;const Fo=yY,Pi=v.forwardRef(({className:e,...t},n)=>i.jsx(XD,{ref:n,className:Me("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Pi.displayName=XD.displayName;const Xt=v.forwardRef(({className:e,...t},n)=>i.jsx(YD,{ref:n,className:Me("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",e),...t}));Xt.displayName=YD.displayName;const Yt=v.forwardRef(({className:e,...t},n)=>i.jsx(ZD,{ref:n,className:Me("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Yt.displayName=ZD.displayName;const xY=Te.object({name:Te.string().min(2,{message:"Name must be at least 2 characters."}),age:Te.string().min(1,{message:"Age is required."}),gender:Te.string().min(1,{message:"Gender is required."}),occupation:Te.string().min(2,{message:"Occupation is required."}),education:Te.string().min(1,{message:"Education is required."}),location:Te.string().min(2,{message:"Location is required."}),ethnicity:Te.string().optional(),personality:Te.string(),interests:Te.string(),hasPurchasingPower:Te.boolean().optional(),hasChildren:Te.boolean().optional(),techSavviness:Te.number().min(0).max(100),brandLoyalty:Te.number().min(0).max(100),priceConsciousness:Te.number().min(0).max(100),environmentalConcern:Te.number().min(0).max(100),socialGrade:Te.string().optional(),householdIncome:Te.string().optional(),householdComposition:Te.string().optional(),livingSituation:Te.string().optional(),goals:Te.array(Te.string()).optional(),frustrations:Te.array(Te.string()).optional(),motivations:Te.array(Te.string()).optional(),scenarios:Te.array(Te.string()).optional(),scenarioType:Te.string().optional(),oceanTraits:Te.object({openness:Te.number().min(0).max(100),conscientiousness:Te.number().min(0).max(100),extraversion:Te.number().min(0).max(100),agreeableness:Te.number().min(0).max(100),neuroticism:Te.number().min(0).max(100)}).optional(),thinkFeelDo:Te.object({thinks:Te.array(Te.string()),feels:Te.array(Te.string()),does:Te.array(Te.string())}).optional(),mediaConsumption:Te.string().optional(),deviceUsage:Te.string().optional(),shoppingHabits:Te.string().optional(),brandPreferences:Te.string().optional(),communicationPreferences:Te.string().optional(),paymentMethods:Te.string().optional(),purchaseBehaviour:Te.string().optional(),coreValues:Te.string().optional(),lifestyleChoices:Te.string().optional(),socialActivities:Te.string().optional(),categoryKnowledge:Te.string().optional(),decisionInfluences:Te.string().optional(),painPoints:Te.string().optional(),journeyContext:Te.string().optional(),keyTouchpoints:Te.string().optional(),selfDeterminationNeeds:Te.object({autonomy:Te.string(),competence:Te.string(),relatedness:Te.string()}).optional(),fears:Te.array(Te.string()).optional(),narrative:Te.string().optional(),additionalInformation:Te.string().optional()});function bY({targetFolderId:e,targetFolderName:t}){const[n,r]=v.useState(1),[s,a]=v.useState(!1),[o,l]=v.useState(!1),[c,u]=v.useState(0),d=Tn(),{isAuthenticated:f,login:h}=Kl();v.useEffect(()=>{u(0)},[]),v.useEffect(()=>{(async()=>{if(!f&&!o){l(!0);try{console.log("Attempting auto login with default credentials"),await h("user","pass"),console.log("Auto login successful");const _=localStorage.getItem("auth_token");_?(console.log("Token successfully stored:",_.substring(0,10)+"..."),Ke.success("Logged in automatically with default account")):(console.error("Token not stored after successful login"),Ke.error("Authentication problem, token not stored"))}catch(_){console.error("Auto login failed:",_)}finally{l(!1)}}})()},[]);const p=Ny({resolver:_y(xY),defaultValues:{name:"",age:"",gender:"",occupation:"",education:"",location:"",ethnicity:"",personality:"",interests:"",hasPurchasingPower:!1,hasChildren:!1,techSavviness:50,brandLoyalty:50,priceConsciousness:50,environmentalConcern:50,socialGrade:"",householdIncome:"",householdComposition:"",livingSituation:"",goals:[],frustrations:[],motivations:[],scenarios:[],scenarioType:"",oceanTraits:{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:{thinks:[],feels:[],does:[]},mediaConsumption:"",deviceUsage:"",shoppingHabits:"",brandPreferences:"",communicationPreferences:"",paymentMethods:"",purchaseBehaviour:"",coreValues:"",lifestyleChoices:"",socialActivities:"",categoryKnowledge:"",decisionInfluences:"",painPoints:"",journeyContext:"",keyTouchpoints:"",selfDeterminationNeeds:{autonomy:"",competence:"",relatedness:""},fears:[],narrative:"",additionalInformation:""}}),g=N=>{const _=p.getValues(N)||[];p.setValue(N,[..._,""])},m=(N,_,P)=>{const O=[...p.getValues(N)||[]];O[_]=P,p.setValue(N,O)},y=(N,_)=>{const k=[...p.getValues(N)||[]];k.splice(_,1),p.setValue(N,k)},b=N=>{const _=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},P={..._,[N]:[..._[N]||[],""]};p.setValue("thinkFeelDo",P)},x=(N,_,P)=>{const k=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},O=[...k[N]||[]];O[_]=P;const M={...k,[N]:O};p.setValue("thinkFeelDo",M)},w=(N,_)=>{const P=p.getValues("thinkFeelDo")||{thinks:[],feels:[],does:[]},k=[...P[N]||[]];k.splice(_,1);const O={...P,[N]:k};p.setValue("thinkFeelDo",O)},j=(N,_)=>{const k={...p.getValues("oceanTraits")||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},[N]:_};p.setValue("oceanTraits",k)};async function S(N,_=!1){var P,k,O,M,A;if(_&&c>=1){console.log("Max retry attempts reached, stopping retry loop"),Ke.error("Authentication failed after multiple attempts",{description:"Please try logging in manually (user/pass)"}),d("/login",{state:{from:"/synthetic-users"}}),a(!1);return}_?(u($=>$+1),console.log(`Retry attempt ${c+1}`)):u(0),a(!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(F){console.error("Login failed before persona creation:",F),Ke.error("Authentication required",{description:"Please log in before creating personas. Default: user/pass"}),d("/login",{state:{from:"/synthetic-users"}}),a(!1);return}const $=`persona-generation-${Date.now()}`,L=e&&t?` in "${t}" folder`:"",H=n>1?`${n} personas`:"persona";console.log(`UserCreator - Creating ${H}${L}`),Ke.createPersistent({id:$,title:`Generating ${H}...`,description:`Creating synthetic user profile${n>1?"s":""}${L}`,type:"info"});const D={...N,oceanTraits:N.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:N.thinkFeelDo||{thinks:[],feels:[],does:[]},folderId:e||void 0},V={id:`temp-${Date.now()}`,...D},T=JSON.parse(localStorage.getItem("tempPersonas")||"[]");if(T.push(V),localStorage.setItem("tempPersonas",JSON.stringify(T)),n===1)try{if(!localStorage.getItem("auth_token")){console.error("No authentication token found"),Ke.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:",((P=localStorage.getItem("auth_token"))==null?void 0:P.substring(0,10))+"...")}catch(Z){throw console.error("Login retry failed:",Z),new Error("Authentication failed after retry")}}console.log("Sending persona creation request to API with auth token");const q=await Dn.create(D);console.log("Persona created successfully:",q),Ke.updatePersistent($,{title:"Synthetic user created successfully",description:`Created profile for ${N.name}`,type:"success"})}catch(F){throw console.error("Error creating persona via API:",F),F.response&&F.response.status===401&&Ke.error("Authentication error",{description:"Failed to authenticate with server. Please try again."}),F}else{const F=[];F.push(D);for(let q=1;q{d("/synthetic-users?mode=view")},300)}catch($){if(console.error("Error creating personas:",$),$.response&&$.response.status===401||$.message&&$.message.includes("Authentication failed")&&c<1)try{console.log("Got auth error, attempting login retry with default credentials"),localStorage.removeItem("auth_token");const L=await jw.login("user","pass");if((O=L==null?void 0:L.data)!=null&&O.access_token){localStorage.setItem("auth_token",L.data.access_token),localStorage.setItem("user",JSON.stringify(L.data.user)),console.log("Manual login successful, got new token:",L.data.access_token.substring(0,10)+"..."),Ke.info("Logged in with default account, retrying submission..."),setTimeout(()=>{S(N,!0)},500);return}else throw new Error("No access token received")}catch(L){console.error("Login retry failed:",L),Ke.error("Authentication error",{description:"Cannot authenticate with server. Please contact support."})}else Ke.updatePersistent(generationToastId,{title:"Failed to create synthetic users",description:((A=(M=$.response)==null?void 0:M.data)==null?void 0:A.message)||$.message||"An unexpected error occurred",type:"error"})}finally{a(!1)}}return i.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsx("h2",{className:"text-2xl font-sf font-semibold",children:"Create Synthetic Users"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(te,{variant:"outline",size:"sm",onClick:()=>r(Math.max(1,n-1)),children:"-"}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(or,{size:16,className:"text-muted-foreground"}),i.jsx("span",{className:"text-sm font-medium",children:n})]}),i.jsx(te,{variant:"outline",size:"sm",onClick:()=>r(n+1),children:"+"})]})]}),i.jsx(Ay,{...p,children:i.jsxs("form",{onSubmit:p.handleSubmit(S),className:"space-y-6",children:[i.jsxs(Fo,{defaultValue:"basic",children:[i.jsxs(Pi,{className:"grid w-full grid-cols-6",children:[i.jsx(Xt,{value:"basic",children:"Basic"}),i.jsx(Xt,{value:"cooper",children:"Cooper"}),i.jsx(Xt,{value:"personality",children:"Personality"}),i.jsx(Xt,{value:"demographics",children:"Demographics"}),i.jsx(Xt,{value:"lifestyle",children:"Lifestyle"}),i.jsx(Xt,{value:"extended",children:"Extended"})]}),i.jsx(Yt,{value:"basic",className:"mt-6",children:i.jsx(rt,{children:i.jsx(bt,{className:"p-6",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"name",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Name"}),i.jsx(ct,{children:i.jsx(Ot,{placeholder:"Jane Smith",...N})}),i.jsx(ut,{})]})}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsx(dt,{control:p.control,name:"age",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Age Range"}),i.jsxs(Mn,{onValueChange:N.onChange,defaultValue:N.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select age range"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"18-24",children:"18-24"}),i.jsx(fe,{value:"25-34",children:"25-34"}),i.jsx(fe,{value:"35-44",children:"35-44"}),i.jsx(fe,{value:"45-54",children:"45-54"}),i.jsx(fe,{value:"55-64",children:"55-64"}),i.jsx(fe,{value:"65+",children:"65+"})]})]}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"gender",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Gender"}),i.jsxs(Mn,{onValueChange:N.onChange,defaultValue:N.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select gender"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"Male",children:"Male"}),i.jsx(fe,{value:"Female",children:"Female"}),i.jsx(fe,{value:"Non-binary",children:"Non-binary"}),i.jsx(fe,{value:"Other",children:"Other"})]})]}),i.jsx(ut,{})]})})]}),i.jsx(dt,{control:p.control,name:"occupation",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Occupation"}),i.jsx(ct,{children:i.jsx(Ot,{placeholder:"Software Engineer",...N})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"education",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Education"}),i.jsxs(Mn,{onValueChange:N.onChange,defaultValue:N.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select education level"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"High School",children:"High School"}),i.jsx(fe,{value:"Some College",children:"Some College"}),i.jsx(fe,{value:"Associate's Degree",children:"Associate's Degree"}),i.jsx(fe,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),i.jsx(fe,{value:"Master's Degree",children:"Master's Degree"}),i.jsx(fe,{value:"PhD",children:"PhD"})]})]}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"location",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Location"}),i.jsx(ct,{children:i.jsx(Ot,{placeholder:"New York, USA",...N})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"ethnicity",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Ethnicity (Optional)"}),i.jsxs(Mn,{onValueChange:N.onChange,defaultValue:N.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select ethnicity"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"white",children:"White"}),i.jsx(fe,{value:"black",children:"Black"}),i.jsx(fe,{value:"asian",children:"Asian"}),i.jsx(fe,{value:"hispanic",children:"Hispanic/Latino"}),i.jsx(fe,{value:"native-american",children:"Native American"}),i.jsx(fe,{value:"middle-eastern",children:"Middle Eastern"}),i.jsx(fe,{value:"mixed",children:"Mixed"}),i.jsx(fe,{value:"other",children:"Other"}),i.jsx(fe,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),i.jsx(ut,{})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"personality",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Personality Traits"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Curious, analytical, detail-oriented",...N,rows:3})}),i.jsx(fn,{children:"Describe key personality traits that define this user"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"interests",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Interests"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Technology, fitness, cooking, travel",...N,rows:3})}),i.jsx(fn,{children:"List interests, hobbies and activities this user enjoys"}),i.jsx(ut,{})]})}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h3",{className:"font-medium text-sm",children:"Behavioral Attributes"}),i.jsx(dt,{control:p.control,name:"techSavviness",render:({field:N})=>i.jsxs(ot,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx(lt,{children:"Tech Savviness"}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),i.jsx(ct,{children:i.jsx(Un,{min:0,max:100,step:1,value:[N.value],onValueChange:_=>N.onChange(_[0])})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"brandLoyalty",render:({field:N})=>i.jsxs(ot,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx(lt,{children:"Brand Loyalty"}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),i.jsx(ct,{children:i.jsx(Un,{min:0,max:100,step:1,value:[N.value],onValueChange:_=>N.onChange(_[0])})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"priceConsciousness",render:({field:N})=>i.jsxs(ot,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx(lt,{children:"Price Consciousness"}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),i.jsx(ct,{children:i.jsx(Un,{min:0,max:100,step:1,value:[N.value],onValueChange:_=>N.onChange(_[0])})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"environmentalConcern",render:({field:N})=>i.jsxs(ot,{children:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx(lt,{children:"Environmental Concern"}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.value,"%"]})]}),i.jsx(ct,{children:i.jsx(Un,{min:0,max:100,step:1,value:[N.value],onValueChange:_=>N.onChange(_[0])})}),i.jsx(ut,{})]})}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[i.jsx(dt,{control:p.control,name:"hasPurchasingPower",render:({field:N})=>i.jsxs(ot,{className:"flex items-center justify-between",children:[i.jsx(lt,{children:"Purchasing Power"}),i.jsx(ct,{children:i.jsx(ah,{checked:N.value,onCheckedChange:N.onChange})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"hasChildren",render:({field:N})=>i.jsxs(ot,{className:"flex items-center justify-between",children:[i.jsx(lt,{children:"Has Children"}),i.jsx(ct,{children:i.jsx(ah,{checked:N.value,onCheckedChange:N.onChange})}),i.jsx(ut,{})]})})]})]})]})]})})})}),i.jsxs(Yt,{value:"cooper",className:"mt-6 space-y-6",children:[i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsxs("div",{className:"mb-4",children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(p.watch("goals")||[]).map((N,_)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:N,onChange:P=>m("goals",_,P.target.value),placeholder:"Enter a goal"}),i.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("goals",_),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},_)),i.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("goals"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),i.jsxs("div",{className:"mb-4 pt-4 border-t",children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(p.watch("frustrations")||[]).map((N,_)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:N,onChange:P=>m("frustrations",_,P.target.value),placeholder:"Enter a frustration"}),i.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("frustrations",_),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},_)),i.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("frustrations"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),i.jsxs("div",{className:"mb-4 pt-4 border-t",children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(p.watch("motivations")||[]).map((N,_)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:N,onChange:P=>m("motivations",_,P.target.value),placeholder:"Enter a motivation"}),i.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("motivations",_),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},_)),i.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("motivations"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).thinks||[]).map((N,_)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:N,onChange:P=>x("thinks",_,P.target.value),placeholder:"What they think"}),i.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("thinks",_),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},_)),i.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("thinks"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).feels||[]).map((N,_)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:N,onChange:P=>x("feels",_,P.target.value),placeholder:"What they feel"}),i.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("feels",_),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},_)),i.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("feels"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),((p.watch("thinkFeelDo")||{thinks:[],feels:[],does:[]}).does||[]).map((N,_)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:N,onChange:P=>x("does",_,P.target.value),placeholder:"What they do"}),i.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>w("does",_),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},_)),i.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>b("does"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),i.jsx(rt,{children:i.jsx(bt,{className:"p-6",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"scenarioType",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Scenario Section Title"}),i.jsx(ct,{children:i.jsx(Ot,{placeholder:"Life Scenarios",...N})}),i.jsx(fn,{children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'}),i.jsx(ut,{})]})}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(p.watch("scenarios")||[]).map((N,_)=>i.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[i.jsx(nt,{value:N,onChange:P=>m("scenarios",_,P.target.value),rows:2,placeholder:"Describe a usage scenario"}),i.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("scenarios",_),className:"mt-2",children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},_)),i.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("scenarios"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})]})})})]}),i.jsx(Yt,{value:"personality",className:"mt-6",children:i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),i.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{openness:50}).openness||50,"%"]})]}),i.jsx(Un,{value:[(p.watch("oceanTraits")||{openness:50}).openness||50],onValueChange:N=>j("openness",N[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),i.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50,"%"]})]}),i.jsx(Un,{value:[(p.watch("oceanTraits")||{conscientiousness:50}).conscientiousness||50],onValueChange:N=>j("conscientiousness",N[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),i.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50,"%"]})]}),i.jsx(Un,{value:[(p.watch("oceanTraits")||{extraversion:50}).extraversion||50],onValueChange:N=>j("extraversion",N[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),i.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50,"%"]})]}),i.jsx(Un,{value:[(p.watch("oceanTraits")||{agreeableness:50}).agreeableness||50],onValueChange:N=>j("agreeableness",N[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),i.jsxs("span",{className:"text-sm",children:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50,"%"]})]}),i.jsx(Un,{value:[(p.watch("oceanTraits")||{neuroticism:50}).neuroticism||50],onValueChange:N=>j("neuroticism",N[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),i.jsx(Yt,{value:"demographics",className:"mt-6",children:i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"socialGrade",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Social Grade"}),i.jsxs(Mn,{onValueChange:N.onChange,defaultValue:N.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select social grade"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"A",children:"A - Higher managerial"}),i.jsx(fe,{value:"B",children:"B - Intermediate managerial"}),i.jsx(fe,{value:"C1",children:"C1 - Supervisory or clerical"}),i.jsx(fe,{value:"C2",children:"C2 - Skilled manual workers"}),i.jsx(fe,{value:"D",children:"D - Semi and unskilled manual workers"}),i.jsx(fe,{value:"E",children:"E - State pensioners, unemployed"})]})]}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"householdIncome",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Household Income"}),i.jsxs(Mn,{onValueChange:N.onChange,defaultValue:N.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select income range"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"Under $25k",children:"Under $25,000"}),i.jsx(fe,{value:"$25k-$50k",children:"$25,000 - $50,000"}),i.jsx(fe,{value:"$50k-$75k",children:"$50,000 - $75,000"}),i.jsx(fe,{value:"$75k-$100k",children:"$75,000 - $100,000"}),i.jsx(fe,{value:"$100k-$150k",children:"$100,000 - $150,000"}),i.jsx(fe,{value:"$150k-$250k",children:"$150,000 - $250,000"}),i.jsx(fe,{value:"Over $250k",children:"Over $250,000"}),i.jsx(fe,{value:"Prefer not to say",children:"Prefer not to say"})]})]}),i.jsx(ut,{})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"householdComposition",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Household Composition"}),i.jsxs(Mn,{onValueChange:N.onChange,defaultValue:N.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select household type"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"Single person",children:"Single person"}),i.jsx(fe,{value:"Couple without children",children:"Couple without children"}),i.jsx(fe,{value:"Couple with children",children:"Couple with children"}),i.jsx(fe,{value:"Single parent",children:"Single parent"}),i.jsx(fe,{value:"Multi-generational",children:"Multi-generational"}),i.jsx(fe,{value:"Shared housing",children:"Shared housing"}),i.jsx(fe,{value:"Other",children:"Other"})]})]}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"livingSituation",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Living Situation"}),i.jsxs(Mn,{onValueChange:N.onChange,defaultValue:N.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select living situation"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"Own home",children:"Own home"}),i.jsx(fe,{value:"Rent apartment",children:"Rent apartment"}),i.jsx(fe,{value:"Rent house",children:"Rent house"}),i.jsx(fe,{value:"Live with family",children:"Live with family"}),i.jsx(fe,{value:"Student housing",children:"Student housing"}),i.jsx(fe,{value:"Assisted living",children:"Assisted living"}),i.jsx(fe,{value:"Other",children:"Other"})]})]}),i.jsx(ut,{})]})})]})]})]})})}),i.jsx(Yt,{value:"lifestyle",className:"mt-6",children:i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"mediaConsumption",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Media Consumption"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"TV shows, podcasts, news sources, social media platforms",...N,rows:3})}),i.jsx(fn,{children:"Describe media consumption habits and preferences"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"deviceUsage",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Device Usage"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Smartphone, laptop, tablet, smart TV, gaming console",...N,rows:3})}),i.jsx(fn,{children:"Primary devices and usage patterns"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"shoppingHabits",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Shopping Habits"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Online vs in-store, frequency, preferred retailers",...N,rows:3})}),i.jsx(fn,{children:"Shopping behavior and preferences"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"brandPreferences",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Brand Preferences"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Favorite brands, brand values alignment",...N,rows:3})}),i.jsx(fn,{children:"Preferred brands and reasoning"}),i.jsx(ut,{})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"communicationPreferences",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Communication Preferences"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Email, phone, text, video calls, in-person",...N,rows:3})}),i.jsx(fn,{children:"Preferred communication methods and channels"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"paymentMethods",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Payment Methods"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Credit cards, digital wallets, cash, BNPL",...N,rows:3})}),i.jsx(fn,{children:"Preferred payment methods and financial tools"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"purchaseBehaviour",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Purchase Behavior"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Research habits, decision factors, impulse vs planned buying",...N,rows:3})}),i.jsx(fn,{children:"How they approach making purchase decisions"}),i.jsx(ut,{})]})})]})]})]})})}),i.jsxs(Yt,{value:"extended",className:"mt-6 space-y-6",children:[i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"coreValues",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Core Values"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Key principles and values that guide decisions",...N,rows:3})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"lifestyleChoices",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Lifestyle Choices"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Health, fitness, diet, work-life balance preferences",...N,rows:3})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"socialActivities",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Social Activities"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Social hobbies, community involvement, networking",...N,rows:3})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"categoryKnowledge",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Category Knowledge"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Expertise in specific product/service categories",...N,rows:3})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"decisionInfluences",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Decision Influences"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"What factors most influence their decisions",...N,rows:3})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"painPoints",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Pain Points"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Common challenges and friction points",...N,rows:3})}),i.jsx(ut,{})]})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx(dt,{control:p.control,name:"journeyContext",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Journey Context"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Current life stage and contextual factors",...N,rows:3})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"keyTouchpoints",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Key Touchpoints"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Important interaction points and channels",...N,rows:3})}),i.jsx(ut,{})]})}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),i.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.autonomy",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Autonomy"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Need for independence and self-direction",...N,rows:2})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.competence",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Competence"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Need to feel capable and effective",...N,rows:2})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"selfDeterminationNeeds.relatedness",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Relatedness"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Need for connection and belonging",...N,rows:2})}),i.jsx(ut,{})]})})]})]})]})]})}),i.jsx(rt,{children:i.jsx(bt,{className:"p-6",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(p.watch("fears")||[]).map((N,_)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:N,onChange:P=>m("fears",_,P.target.value),placeholder:"Enter a fear or concern"}),i.jsx(te,{variant:"ghost",size:"icon",type:"button",onClick:()=>y("fears",_),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},_)),i.jsxs(te,{variant:"outline",size:"sm",type:"button",onClick:()=>g("fears"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),i.jsx(dt,{control:p.control,name:"narrative",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Personal Narrative"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Personal story, background, key life experiences",...N,rows:4})}),i.jsx(fn,{children:"A brief narrative that captures their personal story"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:p.control,name:"additionalInformation",render:({field:N})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Additional Information"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Any other relevant details or context",...N,rows:4})}),i.jsx(fn,{children:"Additional context or details not covered elsewhere"}),i.jsx(ut,{})]})})]})})})]})]}),i.jsxs("div",{className:"flex justify-end space-x-2",children:[i.jsx(te,{variant:"outline",type:"button",onClick:()=>p.reset(),children:"Reset"}),i.jsxs(te,{type:"submit",disabled:s,children:[s?i.jsx(jW,{className:"mr-2 h-4 w-4 animate-spin"}):i.jsx(RS,{className:"mr-2 h-4 w-4"}),s?"Creating...":`Create ${n>1?`${n} Users`:"User"}`]})]})]})})]})}var Lw=["Enter"," "],wY=["ArrowDown","PageUp","Home"],QD=["ArrowUp","PageDown","End"],jY=[...wY,...QD],SY={ltr:[...Lw,"ArrowRight"],rtl:[...Lw,"ArrowLeft"]},NY={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fp="Menu",[ih,_Y,PY]=Ey(fp),[Yl,JD]=Gr(fp,[PY,Gu,ed]),Ly=Gu(),e4=ed(),[AY,Zl]=Yl(fp),[CY,hp]=Yl(fp),t4=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:s,onOpenChange:a,modal:o=!0}=e,l=Ly(t),[c,u]=v.useState(null),d=v.useRef(!1),f=Hn(a),h=Xl(s);return v.useEffect(()=>{const p=()=>{d.current=!0,document.addEventListener("pointerdown",g,{capture:!0,once:!0}),document.addEventListener("pointermove",g,{capture:!0,once:!0})},g=()=>d.current=!1;return document.addEventListener("keydown",p,{capture:!0}),()=>{document.removeEventListener("keydown",p,{capture:!0}),document.removeEventListener("pointerdown",g,{capture:!0}),document.removeEventListener("pointermove",g,{capture:!0})}},[]),i.jsx(NM,{...l,children:i.jsx(AY,{scope:t,open:n,onOpenChange:f,content:c,onContentChange:u,children:i.jsx(CY,{scope:t,onClose:v.useCallback(()=>f(!1),[f]),isUsingKeyboardRef:d,dir:h,modal:o,children:r})})})};t4.displayName=fp;var EY="MenuAnchor",mN=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Ly(n);return i.jsx(wS,{...s,...r,ref:t})});mN.displayName=EY;var gN="MenuPortal",[OY,n4]=Yl(gN,{forceMount:void 0}),r4=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:s}=e,a=Zl(gN,t);return i.jsx(OY,{scope:t,forceMount:n,children:i.jsx(lr,{present:n||a.open,children:i.jsx(cy,{asChild:!0,container:s,children:r})})})};r4.displayName=gN;var _s="MenuContent",[kY,vN]=Yl(_s),s4=v.forwardRef((e,t)=>{const n=n4(_s,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,a=Zl(_s,e.__scopeMenu),o=hp(_s,e.__scopeMenu);return i.jsx(ih.Provider,{scope:e.__scopeMenu,children:i.jsx(lr,{present:r||a.open,children:i.jsx(ih.Slot,{scope:e.__scopeMenu,children:o.modal?i.jsx(TY,{...s,ref:t}):i.jsx($Y,{...s,ref:t})})})})}),TY=v.forwardRef((e,t)=>{const n=Zl(_s,e.__scopeMenu),r=v.useRef(null),s=xt(t,r);return v.useEffect(()=>{const a=r.current;if(a)return eN(a)},[]),i.jsx(yN,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ee(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),$Y=v.forwardRef((e,t)=>{const n=Zl(_s,e.__scopeMenu);return i.jsx(yN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),yN=v.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:g,...m}=e,y=Zl(_s,n),b=hp(_s,n),x=Ly(n),w=e4(n),j=_Y(n),[S,N]=v.useState(null),_=v.useRef(null),P=xt(t,_,y.onContentChange),k=v.useRef(0),O=v.useRef(""),M=v.useRef(0),A=v.useRef(null),$=v.useRef("right"),L=v.useRef(0),H=g?Ty:v.Fragment,D=g?{as:mi,allowPinchZoom:!0}:void 0,V=F=>{var ce,De;const q=O.current+F,Z=j().filter(de=>!de.disabled),re=document.activeElement,ge=(ce=Z.find(de=>de.ref.current===re))==null?void 0:ce.textValue,B=Z.map(de=>de.textValue),le=HY(B,q,ge),se=(De=Z.find(de=>de.textValue===le))==null?void 0:De.ref.current;(function de(be){O.current=be,window.clearTimeout(k.current),be!==""&&(k.current=window.setTimeout(()=>de(""),1e3))})(q),se&&setTimeout(()=>se.focus())};v.useEffect(()=>()=>window.clearTimeout(k.current),[]),JS();const T=v.useCallback(F=>{var Z,re;return $.current===((Z=A.current)==null?void 0:Z.side)&&qY(F,(re=A.current)==null?void 0:re.area)},[]);return i.jsx(kY,{scope:n,searchRef:O,onItemEnter:v.useCallback(F=>{T(F)&&F.preventDefault()},[T]),onItemLeave:v.useCallback(F=>{var q;T(F)||((q=_.current)==null||q.focus(),N(null))},[T]),onTriggerLeave:v.useCallback(F=>{T(F)&&F.preventDefault()},[T]),pointerGraceTimerRef:M,onPointerGraceIntentChange:v.useCallback(F=>{A.current=F},[]),children:i.jsx(H,{...D,children:i.jsx(Oy,{asChild:!0,trapped:s,onMountAutoFocus:Ee(a,F=>{var q;F.preventDefault(),(q=_.current)==null||q.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:i.jsx(Jh,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:i.jsx(dN,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:N,onEntryFocus:Ee(c,F=>{b.isUsingKeyboardRef.current||F.preventDefault()}),preventScrollOnEntryFocus:!0,children:i.jsx(jS,{role:"menu","aria-orientation":"vertical","data-state":b4(y.open),"data-radix-menu-content":"",dir:b.dir,...x,...m,ref:P,style:{outline:"none",...m.style},onKeyDown:Ee(m.onKeyDown,F=>{const Z=F.target.closest("[data-radix-menu-content]")===F.currentTarget,re=F.ctrlKey||F.altKey||F.metaKey,ge=F.key.length===1;Z&&(F.key==="Tab"&&F.preventDefault(),!re&&ge&&V(F.key));const B=_.current;if(F.target!==B||!jY.includes(F.key))return;F.preventDefault();const se=j().filter(ce=>!ce.disabled).map(ce=>ce.ref.current);QD.includes(F.key)&&se.reverse(),VY(se)}),onBlur:Ee(e.onBlur,F=>{F.currentTarget.contains(F.target)||(window.clearTimeout(k.current),O.current="")}),onPointerMove:Ee(e.onPointerMove,oh(F=>{const q=F.target,Z=L.current!==F.clientX;if(F.currentTarget.contains(q)&&Z){const re=F.clientX>L.current?"right":"left";$.current=re,L.current=F.clientX}}))})})})})})})});s4.displayName=_s;var MY="MenuGroup",xN=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ye.div,{role:"group",...r,ref:t})});xN.displayName=MY;var IY="MenuLabel",a4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ye.div,{...r,ref:t})});a4.displayName=IY;var Cg="MenuItem",PC="menu.itemSelect",Fy=v.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...s}=e,a=v.useRef(null),o=hp(Cg,e.__scopeMenu),l=vN(Cg,e.__scopeMenu),c=xt(t,a),u=v.useRef(!1),d=()=>{const f=a.current;if(!n&&f){const h=new CustomEvent(PC,{bubbles:!0,cancelable:!0});f.addEventListener(PC,p=>r==null?void 0:r(p),{once:!0}),rM(f,h),h.defaultPrevented?u.current=!1:o.onClose()}};return i.jsx(i4,{...s,ref:c,disabled:n,onClick:Ee(e.onClick,d),onPointerDown:f=>{var h;(h=e.onPointerDown)==null||h.call(e,f),u.current=!0},onPointerUp:Ee(e.onPointerUp,f=>{var h;u.current||(h=f.currentTarget)==null||h.click()}),onKeyDown:Ee(e.onKeyDown,f=>{const h=l.searchRef.current!=="";n||h&&f.key===" "||Lw.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})});Fy.displayName=Cg;var i4=v.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...a}=e,o=vN(Cg,n),l=e4(n),c=v.useRef(null),u=xt(t,c),[d,f]=v.useState(!1),[h,p]=v.useState("");return v.useEffect(()=>{const g=c.current;g&&p((g.textContent??"").trim())},[a.children]),i.jsx(ih.ItemSlot,{scope:n,disabled:r,textValue:s??h,children:i.jsx(fN,{asChild:!0,...l,focusable:!r,children:i.jsx(Ye.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...a,ref:u,onPointerMove:Ee(e.onPointerMove,oh(g=>{r?o.onItemLeave(g):(o.onItemEnter(g),g.defaultPrevented||g.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ee(e.onPointerLeave,oh(g=>o.onItemLeave(g))),onFocus:Ee(e.onFocus,()=>f(!0)),onBlur:Ee(e.onBlur,()=>f(!1))})})})}),RY="MenuCheckboxItem",o4=v.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...s}=e;return i.jsx(f4,{scope:e.__scopeMenu,checked:n,children:i.jsx(Fy,{role:"menuitemcheckbox","aria-checked":Eg(n)?"mixed":n,...s,ref:t,"data-state":wN(n),onSelect:Ee(s.onSelect,()=>r==null?void 0:r(Eg(n)?!0:!n),{checkForDefaultPrevented:!1})})})});o4.displayName=RY;var l4="MenuRadioGroup",[DY,LY]=Yl(l4,{value:void 0,onValueChange:()=>{}}),c4=v.forwardRef((e,t)=>{const{value:n,onValueChange:r,...s}=e,a=Hn(r);return i.jsx(DY,{scope:e.__scopeMenu,value:n,onValueChange:a,children:i.jsx(xN,{...s,ref:t})})});c4.displayName=l4;var u4="MenuRadioItem",d4=v.forwardRef((e,t)=>{const{value:n,...r}=e,s=LY(u4,e.__scopeMenu),a=n===s.value;return i.jsx(f4,{scope:e.__scopeMenu,checked:a,children:i.jsx(Fy,{role:"menuitemradio","aria-checked":a,...r,ref:t,"data-state":wN(a),onSelect:Ee(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});d4.displayName=u4;var bN="MenuItemIndicator",[f4,FY]=Yl(bN,{checked:!1}),h4=v.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...s}=e,a=FY(bN,n);return i.jsx(lr,{present:r||Eg(a.checked)||a.checked===!0,children:i.jsx(Ye.span,{...s,ref:t,"data-state":wN(a.checked)})})});h4.displayName=bN;var BY="MenuSeparator",p4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return i.jsx(Ye.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});p4.displayName=BY;var zY="MenuArrow",m4=v.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,s=Ly(n);return i.jsx(SS,{...s,...r,ref:t})});m4.displayName=zY;var UY="MenuSub",[kPe,g4]=Yl(UY),Yd="MenuSubTrigger",v4=v.forwardRef((e,t)=>{const n=Zl(Yd,e.__scopeMenu),r=hp(Yd,e.__scopeMenu),s=g4(Yd,e.__scopeMenu),a=vN(Yd,e.__scopeMenu),o=v.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=a,u={__scopeMenu:e.__scopeMenu},d=v.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return v.useEffect(()=>d,[d]),v.useEffect(()=>{const f=l.current;return()=>{window.clearTimeout(f),c(null)}},[l,c]),i.jsx(mN,{asChild:!0,...u,children:i.jsx(i4,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":b4(n.open),...e,ref:ay(t,s.onTriggerChange),onClick:f=>{var h;(h=e.onClick)==null||h.call(e,f),!(e.disabled||f.defaultPrevented)&&(f.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ee(e.onPointerMove,oh(f=>{a.onItemEnter(f),!f.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:Ee(e.onPointerLeave,oh(f=>{var p,g;d();const h=(p=n.content)==null?void 0:p.getBoundingClientRect();if(h){const m=(g=n.content)==null?void 0:g.dataset.side,y=m==="right",b=y?-5:5,x=h[y?"left":"right"],w=h[y?"right":"left"];a.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(l.current),l.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(f),f.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:Ee(e.onKeyDown,f=>{var p;const h=a.searchRef.current!=="";e.disabled||h&&f.key===" "||SY[r.dir].includes(f.key)&&(n.onOpenChange(!0),(p=n.content)==null||p.focus(),f.preventDefault())})})})});v4.displayName=Yd;var y4="MenuSubContent",x4=v.forwardRef((e,t)=>{const n=n4(_s,e.__scopeMenu),{forceMount:r=n.forceMount,...s}=e,a=Zl(_s,e.__scopeMenu),o=hp(_s,e.__scopeMenu),l=g4(y4,e.__scopeMenu),c=v.useRef(null),u=xt(t,c);return i.jsx(ih.Provider,{scope:e.__scopeMenu,children:i.jsx(lr,{present:r||a.open,children:i.jsx(ih.Slot,{scope:e.__scopeMenu,children:i.jsx(yN,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:u,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var f;o.isUsingKeyboardRef.current&&((f=c.current)==null||f.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:Ee(e.onFocusOutside,d=>{d.target!==l.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:Ee(e.onEscapeKeyDown,d=>{o.onClose(),d.preventDefault()}),onKeyDown:Ee(e.onKeyDown,d=>{var p;const f=d.currentTarget.contains(d.target),h=NY[o.dir].includes(d.key);f&&h&&(a.onOpenChange(!1),(p=l.trigger)==null||p.focus(),d.preventDefault())})})})})})});x4.displayName=y4;function b4(e){return e?"open":"closed"}function Eg(e){return e==="indeterminate"}function wN(e){return Eg(e)?"indeterminate":e?"checked":"unchecked"}function VY(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function WY(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function HY(e,t,n){const s=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let o=WY(e,Math.max(a,0));s.length===1&&(o=o.filter(u=>u!==n));const c=o.find(u=>u.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function GY(e,t){const{x:n,y:r}=e;let s=!1;for(let a=0,o=t.length-1;ar!=d>r&&n<(u-l)*(r-c)/(d-c)+l&&(s=!s)}return s}function qY(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return GY(n,t)}function oh(e){return t=>t.pointerType==="mouse"?e(t):void 0}var KY=t4,XY=mN,YY=r4,ZY=s4,QY=xN,JY=a4,eZ=Fy,tZ=o4,nZ=c4,rZ=d4,sZ=h4,aZ=p4,iZ=m4,oZ=v4,lZ=x4,jN="DropdownMenu",[cZ,TPe]=Gr(jN,[JD]),Mr=JD(),[uZ,w4]=cZ(jN),j4=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=e,c=Mr(t),u=v.useRef(null),[d=!1,f]=aa({prop:s,defaultProp:a,onChange:o});return i.jsx(uZ,{scope:t,triggerId:Ys(),triggerRef:u,contentId:Ys(),open:d,onOpenChange:f,onOpenToggle:v.useCallback(()=>f(h=>!h),[f]),modal:l,children:i.jsx(KY,{...c,open:d,onOpenChange:f,dir:r,modal:l,children:n})})};j4.displayName=jN;var S4="DropdownMenuTrigger",N4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=e,a=w4(S4,n),o=Mr(n);return i.jsx(XY,{asChild:!0,...o,children:i.jsx(Ye.button,{type:"button",id:a.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:ay(t,a.triggerRef),onPointerDown:Ee(e.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(a.onOpenToggle(),a.open||l.preventDefault())}),onKeyDown:Ee(e.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&a.onOpenToggle(),l.key==="ArrowDown"&&a.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});N4.displayName=S4;var dZ="DropdownMenuPortal",_4=e=>{const{__scopeDropdownMenu:t,...n}=e,r=Mr(t);return i.jsx(YY,{...r,...n})};_4.displayName=dZ;var P4="DropdownMenuContent",A4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=w4(P4,n),a=Mr(n),o=v.useRef(!1);return i.jsx(ZY,{id:s.contentId,"aria-labelledby":s.triggerId,...a,...r,ref:t,onCloseAutoFocus:Ee(e.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:Ee(e.onInteractOutside,l=>{const c=l.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!s.modal||d)&&(o.current=!0)}),style:{...e.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)"}})});A4.displayName=P4;var fZ="DropdownMenuGroup",hZ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(QY,{...s,...r,ref:t})});hZ.displayName=fZ;var pZ="DropdownMenuLabel",C4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(JY,{...s,...r,ref:t})});C4.displayName=pZ;var mZ="DropdownMenuItem",E4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(eZ,{...s,...r,ref:t})});E4.displayName=mZ;var gZ="DropdownMenuCheckboxItem",O4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(tZ,{...s,...r,ref:t})});O4.displayName=gZ;var vZ="DropdownMenuRadioGroup",yZ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(nZ,{...s,...r,ref:t})});yZ.displayName=vZ;var xZ="DropdownMenuRadioItem",k4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(rZ,{...s,...r,ref:t})});k4.displayName=xZ;var bZ="DropdownMenuItemIndicator",T4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(sZ,{...s,...r,ref:t})});T4.displayName=bZ;var wZ="DropdownMenuSeparator",$4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(aZ,{...s,...r,ref:t})});$4.displayName=wZ;var jZ="DropdownMenuArrow",SZ=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(iZ,{...s,...r,ref:t})});SZ.displayName=jZ;var NZ="DropdownMenuSubTrigger",M4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(oZ,{...s,...r,ref:t})});M4.displayName=NZ;var _Z="DropdownMenuSubContent",I4=v.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,s=Mr(n);return i.jsx(lZ,{...s,...r,ref:t,style:{...e.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)"}})});I4.displayName=_Z;var PZ=j4,AZ=N4,CZ=_4,R4=A4,D4=C4,L4=E4,F4=O4,B4=k4,z4=T4,U4=$4,V4=M4,W4=I4;const Fw=PZ,Bw=AZ,EZ=v.forwardRef(({className:e,inset:t,children:n,...r},s)=>i.jsxs(V4,{ref:s,className:Me("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",t&&"pl-8",e),...r,children:[n,i.jsx(zs,{className:"ml-auto h-4 w-4"})]}));EZ.displayName=V4.displayName;const OZ=v.forwardRef(({className:e,...t},n)=>i.jsx(W4,{ref:n,className:Me("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",e),...t}));OZ.displayName=W4.displayName;const Og=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>i.jsx(CZ,{children:i.jsx(R4,{ref:r,sideOffset:t,className:Me("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",e),...n})}));Og.displayName=R4.displayName;const Fi=v.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(L4,{ref:r,className:Me("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",t&&"pl-8",e),...n}));Fi.displayName=L4.displayName;const kZ=v.forwardRef(({className:e,children:t,checked:n,...r},s)=>i.jsxs(F4,{ref:s,className:Me("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",e),checked:n,...r,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(z4,{children:i.jsx(Ta,{className:"h-4 w-4"})})}),t]}));kZ.displayName=F4.displayName;const TZ=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(B4,{ref:r,className:Me("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",e),...n,children:[i.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:i.jsx(z4,{children:i.jsx(MS,{className:"h-2 w-2 fill-current"})})}),t]}));TZ.displayName=B4.displayName;const $Z=v.forwardRef(({className:e,inset:t,...n},r)=>i.jsx(D4,{ref:r,className:Me("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));$Z.displayName=D4.displayName;const MZ=v.forwardRef(({className:e,...t},n)=>i.jsx(U4,{ref:n,className:Me("-mx-1 my-1 h-px bg-muted",e),...t}));MZ.displayName=U4.displayName;var SN="Dialog",[H4,G4]=Gr(SN),[IZ,ca]=H4(SN),q4=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:s,onOpenChange:a,modal:o=!0}=e,l=v.useRef(null),c=v.useRef(null),[u=!1,d]=aa({prop:r,defaultProp:s,onChange:a});return i.jsx(IZ,{scope:t,triggerRef:l,contentRef:c,contentId:Ys(),titleId:Ys(),descriptionId:Ys(),open:u,onOpenChange:d,onOpenToggle:v.useCallback(()=>d(f=>!f),[d]),modal:o,children:n})};q4.displayName=SN;var K4="DialogTrigger",X4=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ca(K4,n),a=xt(t,s.triggerRef);return i.jsx(Ye.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":PN(s.open),...r,ref:a,onClick:Ee(e.onClick,s.onOpenToggle)})});X4.displayName=K4;var NN="DialogPortal",[RZ,Y4]=H4(NN,{forceMount:void 0}),Z4=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:s}=e,a=ca(NN,t);return i.jsx(RZ,{scope:t,forceMount:n,children:v.Children.map(r,o=>i.jsx(lr,{present:n||a.open,children:i.jsx(cy,{asChild:!0,container:s,children:o})}))})};Z4.displayName=NN;var kg="DialogOverlay",Q4=v.forwardRef((e,t)=>{const n=Y4(kg,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=ca(kg,e.__scopeDialog);return a.modal?i.jsx(lr,{present:r||a.open,children:i.jsx(DZ,{...s,ref:t})}):null});Q4.displayName=kg;var DZ=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ca(kg,n);return i.jsx(Ty,{as:mi,allowPinchZoom:!0,shards:[s.contentRef],children:i.jsx(Ye.div,{"data-state":PN(s.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),Fl="DialogContent",J4=v.forwardRef((e,t)=>{const n=Y4(Fl,e.__scopeDialog),{forceMount:r=n.forceMount,...s}=e,a=ca(Fl,e.__scopeDialog);return i.jsx(lr,{present:r||a.open,children:a.modal?i.jsx(LZ,{...s,ref:t}):i.jsx(FZ,{...s,ref:t})})});J4.displayName=Fl;var LZ=v.forwardRef((e,t)=>{const n=ca(Fl,e.__scopeDialog),r=v.useRef(null),s=xt(t,n.contentRef,r);return v.useEffect(()=>{const a=r.current;if(a)return eN(a)},[]),i.jsx(eL,{...e,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ee(e.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Ee(e.onPointerDownOutside,a=>{const o=a.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&a.preventDefault()}),onFocusOutside:Ee(e.onFocusOutside,a=>a.preventDefault())})}),FZ=v.forwardRef((e,t)=>{const n=ca(Fl,e.__scopeDialog),r=v.useRef(!1),s=v.useRef(!1);return i.jsx(eL,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,l;(o=e.onCloseAutoFocus)==null||o.call(e,a),a.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),a.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:a=>{var c,u;(c=e.onInteractOutside)==null||c.call(e,a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=a.target;((u=n.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&s.current&&a.preventDefault()}})}),eL=v.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:a,...o}=e,l=ca(Fl,n),c=v.useRef(null),u=xt(t,c);return JS(),i.jsxs(i.Fragment,{children:[i.jsx(Oy,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:a,children:i.jsx(Jh,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":PN(l.open),...o,ref:u,onDismiss:()=>l.onOpenChange(!1)})}),i.jsxs(i.Fragment,{children:[i.jsx(zZ,{titleId:l.titleId}),i.jsx(VZ,{contentRef:c,descriptionId:l.descriptionId})]})]})}),_N="DialogTitle",tL=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ca(_N,n);return i.jsx(Ye.h2,{id:s.titleId,...r,ref:t})});tL.displayName=_N;var nL="DialogDescription",rL=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ca(nL,n);return i.jsx(Ye.p,{id:s.descriptionId,...r,ref:t})});rL.displayName=nL;var sL="DialogClose",aL=v.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,s=ca(sL,n);return i.jsx(Ye.button,{type:"button",...r,ref:t,onClick:Ee(e.onClick,()=>s.onOpenChange(!1))})});aL.displayName=sL;function PN(e){return e?"open":"closed"}var iL="DialogTitleWarning",[BZ,oL]=dU(iL,{contentName:Fl,titleName:_N,docsSlug:"dialog"}),zZ=({titleId:e})=>{const t=oL(iL),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return v.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},UZ="DialogDescriptionWarning",VZ=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${oL(UZ).contentName}}.`;return v.useEffect(()=>{var a;const s=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},lL=q4,WZ=X4,cL=Z4,AN=Q4,CN=J4,EN=tL,ON=rL,kN=aL,uL="AlertDialog",[HZ,$Pe]=Gr(uL,[G4]),Ai=G4(),dL=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ai(t);return i.jsx(lL,{...r,...n,modal:!0})};dL.displayName=uL;var GZ="AlertDialogTrigger",qZ=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ai(n);return i.jsx(WZ,{...s,...r,ref:t})});qZ.displayName=GZ;var KZ="AlertDialogPortal",fL=e=>{const{__scopeAlertDialog:t,...n}=e,r=Ai(t);return i.jsx(cL,{...r,...n})};fL.displayName=KZ;var XZ="AlertDialogOverlay",hL=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ai(n);return i.jsx(AN,{...s,...r,ref:t})});hL.displayName=XZ;var zc="AlertDialogContent",[YZ,ZZ]=HZ(zc),pL=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,a=Ai(n),o=v.useRef(null),l=xt(t,o),c=v.useRef(null);return i.jsx(BZ,{contentName:zc,titleName:mL,docsSlug:"alert-dialog",children:i.jsx(YZ,{scope:n,cancelRef:c,children:i.jsxs(CN,{role:"alertdialog",...a,...s,ref:l,onOpenAutoFocus:Ee(s.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=c.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[i.jsx(fS,{children:r}),i.jsx(JZ,{contentRef:o})]})})})});pL.displayName=zc;var mL="AlertDialogTitle",gL=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ai(n);return i.jsx(EN,{...s,...r,ref:t})});gL.displayName=mL;var vL="AlertDialogDescription",yL=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ai(n);return i.jsx(ON,{...s,...r,ref:t})});yL.displayName=vL;var QZ="AlertDialogAction",xL=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=Ai(n);return i.jsx(kN,{...s,...r,ref:t})});xL.displayName=QZ;var bL="AlertDialogCancel",wL=v.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=ZZ(bL,n),a=Ai(n),o=xt(t,s);return i.jsx(kN,{...a,...r,ref:o})});wL.displayName=bL;var JZ=({contentRef:e})=>{const t=`\`${zc}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${zc}\` by passing a \`${vL}\` 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 \`${zc}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. + +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return v.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},eQ=dL,tQ=fL,jL=hL,SL=pL,NL=xL,_L=wL,PL=gL,AL=yL;const zw=eQ,nQ=tQ,CL=v.forwardRef(({className:e,...t},n)=>i.jsx(jL,{className:Me("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",e),...t,ref:n}));CL.displayName=jL.displayName;const Tg=v.forwardRef(({className:e,...t},n)=>i.jsxs(nQ,{children:[i.jsx(CL,{}),i.jsx(SL,{ref:n,className:Me("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",e),...t})]}));Tg.displayName=SL.displayName;const $g=({className:e,...t})=>i.jsx("div",{className:Me("flex flex-col space-y-2 text-center sm:text-left",e),...t});$g.displayName="AlertDialogHeader";const Mg=({className:e,...t})=>i.jsx("div",{className:Me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Mg.displayName="AlertDialogFooter";const Ig=v.forwardRef(({className:e,...t},n)=>i.jsx(PL,{ref:n,className:Me("text-lg font-semibold",e),...t}));Ig.displayName=PL.displayName;const Rg=v.forwardRef(({className:e,...t},n)=>i.jsx(AL,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));Rg.displayName=AL.displayName;const Dg=v.forwardRef(({className:e,...t},n)=>i.jsx(NL,{ref:n,className:Me(WS(),e),...t}));Dg.displayName=NL.displayName;const Lg=v.forwardRef(({className:e,...t},n)=>i.jsx(_L,{ref:n,className:Me(WS({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Lg.displayName=_L.displayName;const wl=lL,rQ=cL,EL=v.forwardRef(({className:e,...t},n)=>i.jsx(AN,{ref:n,className:Me("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",e),...t}));EL.displayName=AN.displayName;const ho=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(rQ,{children:[i.jsx(EL,{}),i.jsxs(CN,{ref:r,className:Me("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",e),...n,children:[t,i.jsxs(kN,{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:[i.jsx(Zs,{className:"h-4 w-4"}),i.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ho.displayName=CN.displayName;const po=({className:e,...t})=>i.jsx("div",{className:Me("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});po.displayName="DialogHeader";const mo=({className:e,...t})=>i.jsx("div",{className:Me("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});mo.displayName="DialogFooter";const go=v.forwardRef(({className:e,...t},n)=>i.jsx(EN,{ref:n,className:Me("text-lg font-semibold leading-none tracking-tight",e),...t}));go.displayName=EN.displayName;const jl=v.forwardRef(({className:e,...t},n)=>i.jsx(ON,{ref:n,className:Me("text-sm text-muted-foreground",e),...t}));jl.displayName=ON.displayName;var TN="Radio",[sQ,OL]=Gr(TN),[aQ,iQ]=sQ(TN),kL=v.forwardRef((e,t)=>{const{__scopeRadio:n,name:r,checked:s=!1,required:a,disabled:o,value:l="on",onCheck:c,form:u,...d}=e,[f,h]=v.useState(null),p=xt(t,y=>h(y)),g=v.useRef(!1),m=f?u||!!f.closest("form"):!0;return i.jsxs(aQ,{scope:n,checked:s,disabled:o,children:[i.jsx(Ye.button,{type:"button",role:"radio","aria-checked":s,"data-state":ML(s),"data-disabled":o?"":void 0,disabled:o,value:l,...d,ref:p,onClick:Ee(e.onClick,y=>{s||c==null||c(),m&&(g.current=y.isPropagationStopped(),g.current||y.stopPropagation())})}),m&&i.jsx(oQ,{control:f,bubbles:!g.current,name:r,value:l,checked:s,required:a,disabled:o,form:u,style:{transform:"translateX(-100%)"}})]})});kL.displayName=TN;var TL="RadioIndicator",$L=v.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:r,...s}=e,a=iQ(TL,n);return i.jsx(lr,{present:r||a.checked,children:i.jsx(Ye.span,{"data-state":ML(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t})})});$L.displayName=TL;var oQ=e=>{const{control:t,checked:n,bubbles:r=!0,...s}=e,a=v.useRef(null),o=ip(n),l=tp(t);return v.useEffect(()=>{const c=a.current,u=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(u,"checked").set;if(o!==n&&f){const h=new Event("click",{bubbles:r});f.call(c,n),c.dispatchEvent(h)}},[o,n,r]),i.jsx("input",{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:a,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function ML(e){return e?"checked":"unchecked"}var lQ=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],$N="RadioGroup",[cQ,MPe]=Gr($N,[ed,OL]),IL=ed(),RL=OL(),[uQ,dQ]=cQ($N),DL=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:r,defaultValue:s,value:a,required:o=!1,disabled:l=!1,orientation:c,dir:u,loop:d=!0,onValueChange:f,...h}=e,p=IL(n),g=Xl(u),[m,y]=aa({prop:a,defaultProp:s,onChange:f});return i.jsx(uQ,{scope:n,name:r,required:o,disabled:l,value:m,onValueChange:y,children:i.jsx(dN,{asChild:!0,...p,orientation:c,dir:g,loop:d,children:i.jsx(Ye.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:g,...h,ref:t})})})});DL.displayName=$N;var LL="RadioGroupItem",FL=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:r,...s}=e,a=dQ(LL,n),o=a.disabled||r,l=IL(n),c=RL(n),u=v.useRef(null),d=xt(t,u),f=a.value===s.value,h=v.useRef(!1);return v.useEffect(()=>{const p=m=>{lQ.includes(m.key)&&(h.current=!0)},g=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",g),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",g)}},[]),i.jsx(fN,{asChild:!0,...l,focusable:!o,active:f,children:i.jsx(kL,{disabled:o,required:a.required,checked:f,...c,...s,name:a.name,ref:d,onCheck:()=>a.onValueChange(s.value),onKeyDown:Ee(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:Ee(s.onFocus,()=>{var p;h.current&&((p=u.current)==null||p.click())})})})});FL.displayName=LL;var fQ="RadioGroupIndicator",BL=v.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...r}=e,s=RL(n);return i.jsx($L,{...s,...r,ref:t})});BL.displayName=fQ;var zL=DL,UL=FL,hQ=BL;const Uw=v.forwardRef(({className:e,...t},n)=>i.jsx(zL,{className:Me("grid gap-2",e),...t,ref:n}));Uw.displayName=zL.displayName;const Zd=v.forwardRef(({className:e,...t},n)=>i.jsx(UL,{ref:n,className:Me("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",e),...t,children:i.jsx(hQ,{className:"flex items-center justify-center",children:i.jsx(MS,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Zd.displayName=UL.displayName;var MN="Checkbox",[pQ,IPe]=Gr(MN),[mQ,gQ]=pQ(MN),VL=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:a,required:o,disabled:l,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=v.useState(null),g=xt(t,j=>p(j)),m=v.useRef(!1),y=h?d||!!h.closest("form"):!0,[b=!1,x]=aa({prop:s,defaultProp:a,onChange:u}),w=v.useRef(b);return v.useEffect(()=>{const j=h==null?void 0:h.form;if(j){const S=()=>x(w.current);return j.addEventListener("reset",S),()=>j.removeEventListener("reset",S)}},[h,x]),i.jsxs(mQ,{scope:n,state:b,disabled:l,children:[i.jsx(Ye.button,{type:"button",role:"checkbox","aria-checked":vo(b)?"mixed":b,"aria-required":o,"data-state":GL(b),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:g,onKeyDown:Ee(e.onKeyDown,j=>{j.key==="Enter"&&j.preventDefault()}),onClick:Ee(e.onClick,j=>{x(S=>vo(S)?!0:!S),y&&(m.current=j.isPropagationStopped(),m.current||j.stopPropagation())})}),y&&i.jsx(vQ,{control:h,bubbles:!m.current,name:r,value:c,checked:b,required:o,disabled:l,form:d,style:{transform:"translateX(-100%)"},defaultChecked:vo(a)?!1:a})]})});VL.displayName=MN;var WL="CheckboxIndicator",HL=v.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...s}=e,a=gQ(WL,n);return i.jsx(lr,{present:r||vo(a.state)||a.state===!0,children:i.jsx(Ye.span,{"data-state":GL(a.state),"data-disabled":a.disabled?"":void 0,...s,ref:t,style:{pointerEvents:"none",...e.style}})})});HL.displayName=WL;var vQ=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:s,...a}=e,o=v.useRef(null),l=ip(n),c=tp(t);v.useEffect(()=>{const d=o.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(l!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=vo(n),p.call(d,vo(n)?!1:n),d.dispatchEvent(g)}},[l,n,r]);const u=v.useRef(vo(n)?!1:n);return i.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:s??u.current,...a,tabIndex:-1,ref:o,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function vo(e){return e==="indeterminate"}function GL(e){return vo(e)?"indeterminate":e?"checked":"unchecked"}var qL=VL,yQ=HL;const ol=v.forwardRef(({className:e,...t},n)=>i.jsx(qL,{ref:n,className:Me("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",e),...t,children:i.jsx(yQ,{className:Me("flex items-center justify-center text-current"),children:i.jsx(Ta,{className:"h-4 w-4"})})}));ol.displayName=qL.displayName;const IN=({isActive:e,isComplete:t,hasError:n,label:r,onComplete:s,className:a})=>{const[o,l]=v.useState(0),[c,u]=v.useState("progressing"),[d,f]=v.useState(!1),h=v.useRef(null),p=v.useRef(null),g=()=>{h.current&&(clearInterval(h.current),h.current=null),p.current&&(clearTimeout(p.current),p.current=null)},m=()=>{g(),l(0),u("progressing"),f(!1)},y=j=>{g(),u("completing");const S=100-j,N=50,_=500/N,P=S/_;let k=0;h.current=setInterval(()=>{k++;const O=j+P*k;O>=100||k>=_?(l(100),u("completed"),g(),p.current=setTimeout(()=>{u("hiding"),setTimeout(()=>{m(),s==null||s()},300)},2e3)):l(O)},N)},b=()=>{c==="progressing"&&y(o)},x=()=>{c==="waiting"&&y(90)},w=()=>{g()};return v.useEffect(()=>{if(e&&!d){f(!0),l(0),u("progressing");const j=90/540;let S=0;h.current=setInterval(()=>{S+=j,S>=90?(l(90),u("waiting"),g()):l(S)},100)}return t&&c==="progressing"&&b(),t&&c==="waiting"&&x(),n&&(c==="progressing"||c==="waiting")&&w(),!e&&d&&m(),()=>{e||g()}},[e,t,n,c,d]),v.useEffect(()=>()=>{g()},[]),d?i.jsxs("div",{className:Me("w-full space-y-2",a),children:[r&&i.jsxs("div",{className:"flex justify-between items-center text-sm text-muted-foreground",children:[i.jsx("span",{children:c==="waiting"?`${r} - finalizing...`:r}),i.jsxs("span",{children:[Math.round(o),"%"]})]}),i.jsx(al,{value:o,className:Me("w-full transition-all duration-200",n&&"opacity-75",c==="completed"&&"bg-green-100")}),n&&i.jsx("div",{className:"text-sm text-red-600",children:"Generation failed. Please try again."}),c==="completed"&&!n&&i.jsx("div",{className:"text-sm text-green-600",children:"Generation completed successfully!"})]}):null},xn="all",xQ=()=>{var Lt,tn,Xr,za;const e=v.useCallback(()=>{document.body.style.pointerEvents==="none"&&(console.log("ensureBodyInteractive: Fixing body pointer-events..."),document.body.style.pointerEvents="auto")},[]),t=Tn(),[n]=iW(),{loadPersonas:r}=hD(),[s,a]=v.useState("view"),[o,l]=v.useState("ai"),[c,u]=v.useState("");v.useState(null);const[d,f]=v.useState(xn),[h,p]=v.useState(!1),[g,m]=v.useState("");v.useEffect(()=>{const G=n.get("mode");(G==="view"||G==="create")&&a(G)},[n]);const[y,b]=v.useState([]),[x,w]=v.useState([]),[j,S]=v.useState(!0);v.useState(null);const[N,_]=v.useState(new Set),[P,k]=v.useState(!1),[O,M]=v.useState(null),[A,$]=v.useState(""),[L,H]=v.useState(!1),[D,V]=v.useState(null),[T,F]=v.useState(!1),[q,Z]=v.useState(null),[re,ge]=v.useState(!1),[B,le]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[se,ce]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]}),[De,de]=v.useState(!1),[be,Pe]=v.useState(!1),[ne,Je]=v.useState(!1),[ve,at]=v.useState(!1),[st,Mt]=v.useState("gemini-2.5-pro"),C=()=>{de(!1),Pe(!1),Je(!1)},R=G=>{const Ce={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return G.forEach(Oe=>{if(Oe.age&&Ce.age.add(Oe.age),Oe.gender&&Ce.gender.add(Oe.gender),Oe.occupation&&Ce.occupation.add(Oe.occupation),Oe.location&&Ce.location.add(Oe.location),Oe.techSavviness!==void 0){const Ue=Oe.techSavviness<30?"Low (0-30)":Oe.techSavviness<70?"Medium (31-70)":"High (71-100)";Ce.techSavviness.add(Ue)}Oe.ethnicity&&Ce.ethnicity.add(Oe.ethnicity)}),{age:Array.from(Ce.age).sort(),gender:Array.from(Ce.gender).sort(),occupation:Array.from(Ce.occupation).sort(),location:Array.from(Ce.location).sort(),techSavviness:Array.from(Ce.techSavviness).sort((Oe,Ue)=>{const Le=["Low (0-30)","Medium (31-70)","High (71-100)"];return Le.indexOf(Oe)-Le.indexOf(Ue)}),ethnicity:Array.from(Ce.ethnicity).sort()}},U=()=>{ge(!1),setTimeout(()=>{le({...se})},0)},X=()=>{ce({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[],folderStatus:[]})},Q=(G,Ce)=>{ce(Oe=>{const Ue={...Oe};return Ue[G].includes(Ce)?Ue[G]=Ue[G].filter(Le=>Le!==Ce):Ue[G]=[...Ue[G],Ce],Ue})},z=async()=>{S(!0);try{const Oe=(await Dn.getAll()).data;{const Le=[...Oe.map(ft=>({...ft,id:ft.id||ft._id}))];try{(async()=>{const J=await r();console.log("Loaded stored personas (for debugging only):",J?J.length:0)})()}catch(ft){console.warn("Error loading stored personas:",ft)}b(Le)}}catch(Ce){console.error("Error fetching personas:",Ce),Ke.error("Failed to load personas"),b([])}finally{S(!1)}},ee=(G,Ce)=>(G.forEach(Oe=>{if(Oe.folderId){const Ue=Ce.find(Le=>Le.id===Oe.folderId);Ue&&!Ue.personaIds.includes(Oe.id)&&Ue.personaIds.push(Oe.id)}}),Ce.forEach(Oe=>{Oe.personaIds=Oe.personaIds.filter(Ue=>{const Le=G.find(ft=>ft.id===Ue);return Le&&(!Le.folderId||Le.folderId===Oe.id)})}),Ce);v.useEffect(()=>{let G=!0;const Ce=localStorage.getItem("persona-folders");let Oe=[];if(Ce)try{Oe=JSON.parse(Ce),w(Oe)}catch(Le){console.error("Failed to parse stored folders:",Le)}return(async()=>{if(await z(),G&&y.length>0){const Le=ee(y,Oe);w(Le)}})(),()=>{G=!1}},[e]),v.useEffect(()=>{var G;if(s==="view")z();else if(s==="create"&&(console.log(`Switching to create mode with folder: ${d}, ${d!==xn?"NOT default":"IS default"}`),d!==xn)){const Ce=(G=x.find(Oe=>Oe.id===d))==null?void 0:G.name;console.log(`Selected folder for creation: ${d} (${Ce})`)}},[s]),v.useEffect(()=>{if(y.length>0){const G=x.map(Oe=>({...Oe,personaIds:[...Oe.personaIds]})),Ce=ee(y,G);w(Ce)}},[y]),v.useEffect(()=>{z();const G=()=>{window.location.pathname.includes("/synthetic-users")&&!window.location.pathname.includes("/synthetic-users/")&&(console.log("Navigation to synthetic users page detected, refreshing data"),z())},Ce=()=>{console.log("Synthetic users navigation event detected, refreshing data"),z()};console.log("Setting up MutationObserver for body style");const Oe=new MutationObserver(Ue=>{Ue.forEach(Le=>{Le.type==="attributes"&&Le.attributeName==="style"&&document.body.style.pointerEvents==="none"&&(console.log("MutationObserver detected pointer-events: none, fixing..."),e())})});return Oe.observe(document.body,{attributes:!0,attributeFilter:["style"]}),e(),window.addEventListener("popstate",G),window.addEventListener("syntheticUsersNavigation",Ce),()=>{window.removeEventListener("popstate",G),window.removeEventListener("syntheticUsersNavigation",Ce),console.log("Disconnecting MutationObserver"),Oe.disconnect()}},[]),v.useEffect(()=>{x.length>0&&localStorage.setItem("persona-folders",JSON.stringify(x))},[x]),v.useEffect(()=>{if(y.length>0&&x.length>0){const G=ee(y,[...x]);JSON.stringify(G)!==JSON.stringify(x)&&w(G)}},[y,x.length]);const me=()=>{if(!g.trim()){Ke.error("Please enter a folder name");return}const G={id:`folder-${Date.now()}`,name:g.trim(),personaIds:[]};w([...x,G]),m(""),p(!1),Ke.success(`Folder "${g}" created`)},Se=()=>{m(""),p(!1)},Ie=G=>{M(G),$(G.name)},we=()=>{if(!O||!A.trim()){M(null);return}const G=x.map(Ce=>Ce.id===O.id?{...Ce,name:A.trim()}:Ce);w(G),M(null),Ke.success(`Folder renamed to "${A}"`)},ze=()=>{M(null),$("")},gt=G=>{V(G),H(!0)},jt=()=>{D&&(w(x.filter(G=>G.id!==D.id)),d===D.id&&f(xn),H(!1),V(null),Ke.success(`Folder "${D.name}" deleted`))},Ge=async(G,Ce)=>{var ft;const Oe=G||N,Ue=Ce||q;if(!Ue||Oe.size===0)return;const Le=Array.from(Oe);try{const J=x.map(K=>{if(K.id===Ue){const W=[...K.personaIds];return Le.forEach(ie=>{W.includes(ie)||W.push(ie)}),{...K,personaIds:W}}else return{...K,personaIds:K.personaIds.filter(W=>!Le.includes(W))}});w(J),localStorage.setItem("persona-folders",JSON.stringify(J));const Y=Le.map(async K=>{try{const W=y.find(ie=>ie.id===K);if(W){const ie={...W,folderId:Ue===xn?null:Ue},he=W._id||W.id;return await Dn.update(he,ie),{success:!0,id:K}}return{success:!1,id:K,error:"Persona not found locally"}}catch(W){return console.error(`Failed to update folder for persona ${K}:`,W),{success:!1,id:K,error:W}}}),ye=await Promise.all(Y),xe=ye.filter(K=>K.success).map(K=>K.id),je=ye.filter(K=>!K.success),Qe=y.map(K=>xe.includes(K.id)?{...K,folderId:Ue===xn?null:Ue}:K);b(Qe);const I=Ue===xn?"All Personas":((ft=x.find(K=>K.id===Ue))==null?void 0:ft.name)||"folder";return xe.length>0&&Ke.success(`Moved ${xe.length} persona${xe.length!==1?"s":""} to ${I}`),je.length>0&&(Ke.error(`Failed to move ${je.length} persona${je.length!==1?"s":""}.`),console.error("Failed updates:",je)),G||_(new Set),{success:xe.length>0,successCount:xe.length,failureCount:je.length}}catch(J){return console.error("Error moving personas to folder:",J),Ke.error("An unexpected error occurred while moving personas."),{success:!1,error:J}}},Ze=async()=>{var ft;if(N.size===0||d===xn)return;const G=Array.from(N),Ce=x.map(J=>J.id===d?{...J,personaIds:J.personaIds.filter(Y=>!G.includes(Y))}:J);w(Ce);const Oe=[],Ue=[];for(const J of G)try{const Y=y.find(ye=>ye.id===J);if(Y){const ye={...Y,folderId:null},xe=Y._id||Y.id;await Dn.update(xe,ye),Oe.push(J)}}catch(Y){console.error(`Failed to update persona ${J}:`,Y),Ue.push(J)}b(J=>J.map(Y=>Oe.includes(Y.id)?{...Y,folderId:null}:Y)),_(new Set);const Le=((ft=x.find(J=>J.id===d))==null?void 0:ft.name)||"folder";Oe.length>0&&Ke.success(`Removed ${Oe.length} persona${Oe.length!==1?"s":""} from ${Le}`),Ue.length>0&&Ke.error(`Failed to remove ${Ue.length} persona${Ue.length!==1?"s":""} from ${Le}`)},kt=G=>{_(Ce=>{const Oe=new Set(Ce);return Oe.has(G)?Oe.delete(G):Oe.add(G),Oe})},Vt=()=>{N.size===an.length?_(new Set):_(new Set(an.map(G=>G.id)))},Xn=async()=>{if(N.size===0)return;const G=Array.from(N);_(new Set),k(!1),S(!0);const Ce=[],Oe=[];for(const Ue of G)try{const Le=y.find(J=>J.id===Ue);if(!Le){console.error(`Could not find persona with id: ${Ue}`),Oe.push(Ue);continue}let ft=Ue;Le._id&&(ft=Le._id.toString()),console.log(`Attempting to delete persona: ${ft}`),await Dn.delete(ft),Ce.push(Ue)}catch(Le){console.error(`Failed to delete persona ${Ue}:`,Le),Oe.push(Ue)}b(Ue=>Ue.filter(Le=>!Ce.includes(Le.id))),w(Ue=>{const Le=Ue.map(ft=>({...ft,personaIds:ft.personaIds.filter(J=>!Ce.includes(J))}));return localStorage.setItem("persona-folders",JSON.stringify(Le)),Le}),S(!1),setTimeout(()=>{Ce.length>0&&Ke.success(`Successfully deleted ${Ce.length} persona${Ce.length!==1?"s":""}`),Oe.length>0&&Ke.error(`Failed to delete ${Oe.length} persona${Oe.length!==1?"s":""}`),(Ce.length>0||Oe.length>0)&&z()},50)},an=y.filter(G=>{const Ce=G.name.toLowerCase().includes(c.toLowerCase())||G.occupation.toLowerCase().includes(c.toLowerCase())||G.location.toLowerCase().includes(c.toLowerCase()),Oe=(B.age.length===0||B.age.includes(G.age))&&(B.gender.length===0||B.gender.includes(G.gender))&&(B.occupation.length===0||B.occupation.includes(G.occupation))&&(B.location.length===0||B.location.includes(G.location))&&(B.ethnicity.length===0||G.ethnicity&&B.ethnicity.includes(G.ethnicity))&&(B.techSavviness.length===0||G.techSavviness!==void 0&&B.techSavviness.includes(G.techSavviness<30?"Low (0-30)":G.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&(B.folderStatus.length===0||B.folderStatus.includes("hasFolder")&&B.folderStatus.includes("noFolder")||B.folderStatus.includes("hasFolder")&&!B.folderStatus.includes("noFolder")&&G.folderId&&G.folderId!==xn||B.folderStatus.includes("noFolder")&&!B.folderStatus.includes("hasFolder")&&(!G.folderId||G.folderId===xn));if(d===xn||G.folderId===d)return Ce&&Oe;const Ue=x.find(Le=>Le.id===d);return Ue&&Ue.personaIds.includes(G.id)&&Ce&&Oe}),pt=(G,Ce)=>{const Oe=new Date().toISOString().split("T")[0],Ue=G.length;let Le=`# Persona Summary Report + +`;return Le+=`**Folder:** ${Ce} +`,Le+=`**Date:** ${Oe} +`,Le+=`**Total Personas:** ${Ue} + +`,Ue===0?(Le+=`No personas found in this folder. +`,Le):(G.forEach((ft,J)=>{Le+=`## ${ft.name} + +`,Le+=`### Demographics +`,Le+=`- **Age:** ${ft.age} +`,Le+=`- **Gender:** ${ft.gender} +`,Le+=`- **Occupation:** ${ft.occupation} +`,Le+=`- **Location:** ${ft.location} + +`,ft.aiSynthesizedBio&&(Le+=`### AI-Synthesized Bio +`,Le+=`${ft.aiSynthesizedBio} + +`),ft.qualitativeAttributes&&ft.qualitativeAttributes.length>0&&(Le+=`### Key Attributes +`,ft.qualitativeAttributes.forEach(Y=>{Le+=`- 🏷️ ${Y} +`}),Le+=` +`),ft.topPersonalityTraits&&ft.topPersonalityTraits.length>0&&(Le+=`### Top Personality Traits +`,ft.topPersonalityTraits.forEach(Y=>{Le+=`- 🧠 ${Y} +`}),Le+=` +`),J{if(an.length===0){Ke.error("No personas to download");return}at(!0)},it=async()=>{var Oe,Ue,Le,ft,J;const G=d===xn?"All Personas":((Oe=x.find(Y=>Y.id===d))==null?void 0:Oe.name)||"Unknown Folder",Ce=an.map(Y=>Y._id||Y.id);console.log(`🤖 Frontend: User selected ${st} for persona summary download`),at(!1),de(!0),Pe(!1),Je(!1),S(!0);try{Ke.info("Generating persona summaries...",{description:`Processing ${an.length} persona${an.length!==1?"s":""} with AI`});const Y=await Ka.batchGenerateSummaries(Ce,.7,st),{summaries:ye,summary_stats:xe,errors:je}=Y.data,Qe=new Date().toISOString().split("T")[0],I=`persona-summary-${G.toLowerCase().replace(/\s+/g,"-")}-${Qe}.md`;let K=`# Persona Summary Report + +`;K+=`**Folder:** ${G} +`,K+=`**Date:** ${Qe} +`,K+=`**Total Personas:** ${xe.total_requested} +`,K+=`**Successfully Processed:** ${xe.total_successful} +`,xe.total_failed>0&&(K+=`**Failed to Process:** ${xe.total_failed} +`),K+=` +--- + +`,ye.length===0?K+=`No persona summaries could be generated. +`:ye.forEach((ke,qe)=>{K+=`# ${ke.persona_name} + +`,K+=`${ke.summary} + +`,qe0||((Le=je.missing_personas)==null?void 0:Le.length)>0)&&(K+=` +--- + +## Processing Errors + +`,((ft=je.failed_summaries)==null?void 0:ft.length)>0&&(K+=`### Failed to Generate Summaries +`,je.failed_summaries.forEach(ke=>{K+=`- **${ke.persona_name}** (ID: ${ke.persona_id}): ${ke.error} +`}),K+=` +`),((J=je.missing_personas)==null?void 0:J.length)>0&&(K+=`### Missing Personas +`,je.missing_personas.forEach(ke=>{K+=`- ID: ${ke} +`})));const W=document.createElement("a"),ie=new Blob([K],{type:"text/markdown"});W.href=URL.createObjectURL(ie),W.download=I,document.body.appendChild(W),W.click(),document.body.removeChild(W),Pe(!0);const he=st==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro";xe.total_successful===xe.total_requested?Ke.success("Persona summary downloaded",{description:`Successfully processed all ${xe.total_successful} persona${xe.total_successful!==1?"s":""} from "${G}" using ${he}`}):Ke.success("Persona summary downloaded with warnings",{description:`Processed ${xe.total_successful} of ${xe.total_requested} personas from "${G}" using ${he}`})}catch(Y){console.error("Error generating persona summaries:",Y),Y.response?(console.error("Error response data:",Y.response.data),console.error("Error response status:",Y.response.status),console.error("Error response headers:",Y.response.headers)):Y.request?console.error("Error request:",Y.request):console.error("Error message:",Y.message),Je(!0),Ke.error("AI summary generation failed, creating basic summary",{description:"Using simplified format due to processing error"});try{const ye=new Date().toISOString().split("T")[0],xe=`persona-summary-basic-${G.toLowerCase().replace(/\s+/g,"-")}-${ye}.md`,je=pt(an,G),Qe=document.createElement("a"),I=new Blob([je],{type:"text/markdown"});Qe.href=URL.createObjectURL(I),Qe.download=xe,document.body.appendChild(Qe),Qe.click(),document.body.removeChild(Qe)}catch{Ke.error("Failed to create persona summary",{description:"Unable to generate summary in any format"})}}finally{S(!1)}};return i.jsxs("div",{className:"min-h-screen bg-slate-50",children:[i.jsx(oi,{}),i.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Synthetic Personas"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Create and manage AI-generated research participants"})]}),i.jsx("div",{className:"mt-4 sm:mt-0 flex flex-col items-end gap-3",children:i.jsxs("div",{className:"flex items-center gap-3",children:[s==="view"&&an.length>0&&i.jsxs(te,{variant:"outline",onClick:tt,disabled:De,className:"flex items-center gap-2 hover-transition",children:[i.jsx($l,{className:"h-4 w-4"}),De?"Generating Summary...":"Download Persona Summary"]}),i.jsx(te,{onClick:()=>a(s==="view"?"create":"view"),className:"hover-transition",children:s==="view"?"Create New Personas":"View All Personas"})]})})]}),s==="view"&&an.length>0&&De&&i.jsx("div",{className:"mb-6",children:i.jsx(IN,{isActive:De,isComplete:be,hasError:ne,label:"Generating comprehensive persona summaries",onComplete:C,className:"max-w-4xl mx-auto"})}),s==="view"?i.jsx(i.Fragment,{children:i.jsxs("div",{className:"flex flex-col md:flex-row gap-6 mb-6",children:[i.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),i.jsx(te,{variant:"ghost",size:"sm",onClick:()=>p(!0),className:"h-7 w-7 p-0",children:i.jsx(iI,{className:"h-4 w-4"})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsxs("button",{onClick:()=>f(xn),className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===xn?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx("span",{children:"All Personas"})]}),x.map(G=>i.jsx("div",{className:"flex items-center justify-between group",children:O&&O.id===G.id?i.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx(Ot,{value:A,onChange:Ce=>$(Ce.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:Ce=>{Ce.key==="Enter"?we():Ce.key==="Escape"&&ze()}}),i.jsx(te,{size:"sm",variant:"ghost",onClick:we,className:"h-7 w-7 p-0",children:i.jsx(Ta,{className:"h-4 w-4"})}),i.jsx(te,{size:"sm",variant:"ghost",onClick:ze,className:"h-7 w-7 p-0",children:i.jsx(Zs,{className:"h-4 w-4"})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>f(G.id),className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${d===G.id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx("span",{children:G.name}),i.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:G.personaIds.length})]}),i.jsxs(Fw,{children:[i.jsx(Bw,{asChild:!0,children:i.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:i.jsx(uw,{className:"h-4 w-4"})})}),i.jsxs(Og,{align:"end",children:[i.jsx(Fi,{onClick:()=>Ie(G),children:"Rename"}),i.jsx(Fi,{className:"text-red-600",onClick:()=>gt(G),children:"Delete"})]})]})]})},G.id)),h&&i.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[i.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx(Ot,{value:g,onChange:G=>m(G.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:G=>{G.key==="Enter"?me():G.key==="Escape"&&Se()}})]}),i.jsx(te,{size:"sm",variant:"ghost",onClick:me,className:"h-7 w-7 p-0",children:i.jsx(Ta,{className:"h-4 w-4"})}),i.jsx(te,{size:"sm",variant:"ghost",onClick:Se,className:"h-7 w-7 p-0",children:i.jsx(Zs,{className:"h-4 w-4"})})]})]})]}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(DS,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),i.jsx(Ot,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:c,onChange:G=>u(G.target.value)})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[N.size>0&&i.jsxs(Fw,{children:[i.jsx(Bw,{asChild:!0,children:i.jsxs(te,{variant:"outline",size:"sm",className:"flex items-center gap-2",onClick:G=>{G.stopPropagation()},children:[i.jsxs("span",{children:["Actions (",N.size,")"]}),i.jsx(uw,{className:"h-4 w-4"})]})}),i.jsxs(Og,{align:"end",onCloseAutoFocus:G=>{G.preventDefault()},children:[i.jsxs(Fi,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.preventDefault(),G.stopPropagation();const Ce=Array.from(N);t("/focus-groups",{state:{mode:"create",preSelectedParticipants:Ce}})},children:[i.jsx($a,{className:"h-4 w-4"}),"Create Focus Group with selected Personas"]}),i.jsxs(Fi,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.preventDefault(),G.stopPropagation(),k(!0)},children:[i.jsx(_n,{className:"h-4 w-4"}),"Delete"]}),i.jsxs(Fi,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.preventDefault(),G.stopPropagation(),F(!0)},children:[i.jsx(Us,{className:"h-4 w-4"}),"Move to folder"]}),d!==xn&&i.jsxs(Fi,{className:"flex items-center gap-2 cursor-pointer",onClick:G=>{G.preventDefault(),G.stopPropagation(),Ze()},children:[i.jsx(Zs,{className:"h-4 w-4"}),"Remove from ",((Lt=x.find(G=>G.id===d))==null?void 0:Lt.name)||"folder"]})]})]}),i.jsxs(te,{variant:"outline",className:"flex items-center gap-2",onClick:()=>ge(!0),children:[i.jsx(IS,{className:"h-4 w-4"}),i.jsxs("span",{children:["Filter",Object.values(B).some(G=>G.length>0)?` (${Object.values(B).reduce((G,Ce)=>G+Ce.length,0)})`:""]})]})]})]}),i.jsxs("div",{className:"glass-panel rounded-xl p-6 mb-6",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(or,{className:"h-5 w-5 text-primary"}),i.jsx("h2",{className:"font-sf text-xl font-semibold",children:d===xn?"Your Synthetic Persona Library":((tn=x.find(G=>G.id===d))==null?void 0:tn.name)||"Personas"}),i.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",an.length,")"]})]}),an.length>0&&i.jsxs("div",{className:"flex items-center",children:[i.jsx(ol,{id:"select-all",checked:an.length>0&&N.size===an.length,onCheckedChange:Vt,className:"mr-2"}),i.jsx("label",{htmlFor:"select-all",className:"text-sm cursor-pointer",children:"Select All"})]})]}),an.length>0?i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-1 lg:grid-cols-2 xl:grid-cols-2 gap-4",children:an.map(G=>i.jsx("div",{className:"relative group",children:i.jsx(sN,{user:G,selected:N.has(G.id),onClick:()=>t(`/synthetic-users/${G._id||G.id}`),onSelectionToggle:Ce=>{Ce.stopPropagation(),kt(G.id)},showAddToFolderButton:!1})},G.id))}):i.jsx("div",{className:"text-center py-12",children:i.jsx("p",{className:"text-muted-foreground",children:"No personas found matching your criteria."})})]}),i.jsx(zw,{open:P,onOpenChange:G=>{k(G||!1)},children:i.jsxs(Tg,{onInteractOutside:G=>{G.preventDefault()},children:[i.jsxs($g,{children:[i.jsx(Ig,{children:"Delete Personas"}),i.jsxs(Rg,{children:["Are you sure you want to delete ",N.size," selected persona",N.size!==1?"s":"","? This action cannot be undone."]})]}),i.jsxs(Mg,{children:[i.jsx(Lg,{onClick:()=>{setTimeout(()=>_(new Set),50)},children:"Cancel"}),i.jsx(Dg,{onClick:Xn,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),i.jsx(zw,{open:L,onOpenChange:G=>{H(G||!1)},children:i.jsxs(Tg,{children:[i.jsxs($g,{children:[i.jsx(Ig,{children:"Delete Folder"}),i.jsxs(Rg,{children:['Are you sure you want to delete the folder "',D==null?void 0:D.name,'"?',i.jsx("br",{}),i.jsx("br",{}),i.jsx("strong",{children:"Note:"})," Any personas in this folder will not be deleted - they will still be available under 'All Personas' after folder deletion."]})]}),i.jsxs(Mg,{children:[i.jsx(Lg,{children:"Cancel"}),i.jsx(Dg,{onClick:jt,className:"bg-red-600 hover:bg-red-700",children:"Delete"})]})]})}),i.jsx(wl,{open:T,onOpenChange:G=>{F(G||!1)},children:i.jsxs(ho,{className:"z-50",children:[i.jsxs(po,{children:[i.jsx(go,{children:"Move to Folder"}),i.jsxs(jl,{children:["Choose a folder to move ",N.size," selected persona",N.size!==1?"s":""," to."]})]}),i.jsx("div",{className:"py-4",children:i.jsxs(Uw,{value:q||"",onValueChange:Z,className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(Zd,{value:xn,id:"folder-all"}),i.jsxs(vs,{htmlFor:"folder-all",className:"flex items-center gap-2",children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx("span",{children:"All Personas (Remove from folders)"})]})]}),x.map(G=>i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(Zd,{value:G.id,id:`folder-${G.id}`}),i.jsxs(vs,{htmlFor:`folder-${G.id}`,className:"flex items-center gap-2",children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx("span",{children:G.name})]})]},G.id))]})}),i.jsxs(mo,{children:[i.jsx(te,{variant:"outline",onClick:G=>{G.preventDefault(),G.stopPropagation(),F(!1),Z(null)},children:"Cancel"}),i.jsx(te,{onClick:async G=>{if(G.preventDefault(),G.stopPropagation(),!q)return;const Ce=new Set(N),Oe=q;if(F(!1),Z(null),Oe&&Ce.size>0){S(!0);try{await Ge(Ce,Oe)}finally{S(!1),_(new Set)}}},disabled:!q,children:"Move"})]})]})}),i.jsx(wl,{open:re,onOpenChange:G=>{G?(ge(G),ce({...B})):(N.size>0&&_(new Set),ge(!1))},children:i.jsxs(ho,{className:"max-w-4xl max-h-[80vh] flex flex-col",onInteractOutside:G=>{G.preventDefault()},children:[i.jsx("div",{className:"sticky top-0 bg-background border-b shadow-sm pb-4 z-10",children:i.jsxs(po,{children:[i.jsx(go,{children:"Filter Personas"}),i.jsx(jl,{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."})]})}),i.jsxs("div",{className:"flex-1 overflow-y-auto px-1 py-4 space-y-6",children:[Object.values(se).some(G=>G.length>0)&&i.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:i.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(se).reduce((G,Ce)=>G+Ce.length,0)," active filters"]})}),i.jsx("div",{className:"space-y-4",children:(()=>{const G=Le=>{const ft={...se};ft[Le]=[];const J=y.filter(Y=>Object.entries(ft).every(([ye,xe])=>{if(xe.length===0)return!0;const je=ye;if(je==="techSavviness"&&Y.techSavviness!==void 0){const Qe=Y.techSavviness<30?"Low (0-30)":Y.techSavviness<70?"Medium (31-70)":"High (71-100)";return xe.includes(Qe)}else{if(je==="age"&&Y.age)return xe.includes(Y.age);if(je==="gender"&&Y.gender)return xe.includes(Y.gender);if(je==="occupation"&&Y.occupation)return xe.includes(Y.occupation);if(je==="location"&&Y.location)return xe.includes(Y.location);if(je==="ethnicity"&&Y.ethnicity)return xe.includes(Y.ethnicity)}return!0}));return R(J)},Ce=Object.values(se).every(Le=>Le.length===0),Oe=R(y),Ue=(Le,ft,J,Y=1)=>{const ye=se[ft],xe=[...new Set([...J,...ye])].sort();return xe.length===0?null:i.jsxs("div",{className:"mb-6",children:[i.jsx("h3",{className:"text-sm font-medium mb-3",children:Le}),i.jsx("div",{className:`grid grid-cols-1 ${Y===2?"sm:grid-cols-2":Y===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:xe.map(je=>{const Qe=se[ft].includes(je),I=J.includes(je);return i.jsxs("div",{className:`flex items-center space-x-2 ${!I&&!Qe?"opacity-50":""}`,children:[i.jsx(ol,{id:`${ft}-${je}`,checked:Qe,onCheckedChange:()=>Q(ft,je),disabled:!I&&!Qe}),i.jsxs(vs,{htmlFor:`${ft}-${je}`,className:"truncate overflow-hidden",children:[je,Qe&&!I&&i.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},je)})})]})};return i.jsxs(i.Fragment,{children:[Ue("Gender","gender",Ce?Oe.gender:G("gender").gender,3),Ue("Age","age",Ce?Oe.age:G("age").age,3),Ue("Ethnicity","ethnicity",Ce?Oe.ethnicity:G("ethnicity").ethnicity,2),Ue("Location","location",Ce?Oe.location:G("location").location,2),Ue("Occupation","occupation",Ce?Oe.occupation:G("occupation").occupation,2),Ue("Tech Savviness","techSavviness",Ce?Oe.techSavviness:G("techSavviness").techSavviness,3),i.jsxs("div",{className:"mb-6",children:[i.jsx("h3",{className:"text-sm font-medium mb-3",children:"Folder Assignment"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ol,{id:"folderStatus-hasFolder",checked:se.folderStatus.includes("hasFolder"),onCheckedChange:()=>Q("folderStatus","hasFolder")}),i.jsx(vs,{htmlFor:"folderStatus-hasFolder",className:"truncate overflow-hidden",children:"Has folder assignment"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(ol,{id:"folderStatus-noFolder",checked:se.folderStatus.includes("noFolder"),onCheckedChange:()=>Q("folderStatus","noFolder")}),i.jsx(vs,{htmlFor:"folderStatus-noFolder",className:"truncate overflow-hidden",children:"No folder assignment"})]})]})]}),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()})]}),i.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:i.jsxs(mo,{children:[i.jsx(te,{variant:"outline",onClick:X,children:"Reset"}),i.jsx(te,{onClick:U,children:"Apply Filters"})]})})]})}),i.jsx(wl,{open:ve,onOpenChange:at,children:i.jsxs(ho,{children:[i.jsxs(po,{children:[i.jsx(go,{children:"Select AI Model for Summary Generation"}),i.jsx(jl,{children:"Choose which AI model to use for generating persona summaries"})]}),i.jsx("div",{className:"py-4",children:i.jsxs(Uw,{value:st,onValueChange:Mt,className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(Zd,{value:"gemini-2.5-pro",id:"download-gemini"}),i.jsx(vs,{htmlFor:"download-gemini",className:"text-sm font-medium",children:"Gemini 2.5 Pro"})]}),i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(Zd,{value:"gpt-4.1",id:"download-gpt"}),i.jsx(vs,{htmlFor:"download-gpt",className:"text-sm font-medium",children:"GPT-4.1"})]})]})}),i.jsxs(mo,{children:[i.jsx(te,{variant:"outline",onClick:()=>at(!1),children:"Cancel"}),i.jsx(te,{onClick:it,children:"Generate Summary"})]})]})})]})]})}):i.jsxs(Fo,{defaultValue:"ai",onValueChange:G=>l(G),children:[i.jsxs(Pi,{className:"grid w-full grid-cols-2 mb-6",children:[i.jsx(Xt,{value:"ai",children:"AI Recruiter"}),i.jsx(Xt,{value:"manual",children:"Manual Creation"})]}),i.jsxs(Yt,{value:"ai",children:[console.log(`Rendering AIRecruiter with targetFolderId: ${d!==xn?d:"null"}`),console.log("Current folders:",x.map(G=>({id:G.id,name:G.name}))),i.jsx(OX,{targetFolderId:d!==xn?d:null,targetFolderName:d!==xn?(Xr=x.find(G=>G.id===d))==null?void 0:Xr.name:null})]}),i.jsx(Yt,{value:"manual",children:i.jsx(bY,{targetFolderId:d!==xn?d:null,targetFolderName:d!==xn?(za=x.find(G=>G.id===d))==null?void 0:za.name:null})})]})]})]})},bQ="modulepreload",wQ=function(e){return"/semblance/"+e},AC={},jQ=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=wQ(c),c in AC)return;AC[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":bQ,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),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 ${c}`)))})}))}function a(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&a(l.reason);return t().catch(a)})},KL=v.createContext(void 0),A0="synthetic-society-navigation-state",SQ=({children:e})=>{const[t,n]=v.useState(()=>{try{const a=localStorage.getItem(A0);return a?JSON.parse(a):{}}catch{return{}}});v.useEffect(()=>{localStorage.setItem(A0,JSON.stringify(t))},[t]);const r=(a,o)=>{n({...t,previousRoute:a,...o})},s=()=>{n({}),localStorage.removeItem(A0)};return i.jsx(KL.Provider,{value:{navigationState:t,setNavigationState:n,clearNavigationState:s,setPreviousRoute:r},children:e})},XL=()=>{const e=v.useContext(KL);if(!e)throw new Error("useNavigation must be used within a NavigationProvider");return e},NQ=VS("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 Wn({className:e,variant:t,...n}){return i.jsx("div",{className:Me(NQ({variant:t}),e),...n})}const RN=E.memo(e=>{const{discussionGuide:t,moderatorStatus:n,onSectionSelect:r,onSetPosition:s,onSave:a,showProgress:o=!0,collapsible:l=!0,defaultExpanded:c=!1,className:u,onDownload:d,isDownloading:f=!1,focusGroupId:h,onEditingChange:p}=e,g=typeof t=="string",m=v.useMemo(()=>g?null:t,[t,g]),[y,b]=v.useState(new Set),[x,w]=v.useState(null),[j,S]=v.useState(null),[N,_]=v.useState(!1),[P,k]=v.useState(null),[O,M]=v.useState("");v.useEffect(()=>{p&&p(!!x)},[x,p]),v.useEffect(()=>{if(x&&m){const C=m.sections.find(R=>R.id===x);C&&!j&&S({...C})}},[m,x,j]);const A=C=>{w(C.id),S({...C}),b(R=>new Set(R).add(C.id))},$=()=>{w(null),S(null)},L=v.useCallback(C=>{S(R=>R&&{...R,...C})},[]),H=v.useCallback((C,R,U)=>{S(X=>{if(!X)return X;const Q={...X};if(U==="question"&&Q.questions){if(Q.questions.findIndex(ee=>ee.id===C)!==-1)return Q.questions=Q.questions.map(ee=>ee.id===C?{...ee,...R}:ee),Q}else if(U==="activity"&&Q.activities&&Q.activities.findIndex(ee=>ee.id===C)!==-1)return Q.activities=Q.activities.map(ee=>ee.id===C?{...ee,...R}:ee),Q;return Q.subsections&&(Q.subsections=Q.subsections.map(z=>{const ee={...z};return U==="question"&&ee.questions?ee.questions.findIndex(Se=>Se.id===C)!==-1&&(ee.questions=ee.questions.map(Se=>Se.id===C?{...Se,...R}:Se)):U==="activity"&&ee.activities&&ee.activities.findIndex(Se=>Se.id===C)!==-1&&(ee.activities=ee.activities.map(Se=>Se.id===C?{...Se,...R}:Se)),ee})),Q})},[]),D=C=>{if(!j)return;const R={id:`${C}-${Date.now()}`,content:`New ${C}`,type:C==="question"?"open_ended":"discussion",time_limit:void 0},U={...j};C==="question"?U.questions=[...U.questions||[],R]:U.activities=[...U.activities||[],R],S(U)},V=(C,R)=>{if(!j||!j.subsections)return;const U={id:`${R}-${Date.now()}`,content:`New ${R}`,type:R==="question"?"open_ended":"discussion",time_limit:void 0},X=[...j.subsections],Q={...X[C]};R==="question"?Q.questions=[...Q.questions||[],U]:Q.activities=[...Q.activities||[],U],X[C]=Q,S(z=>z&&{...z,subsections:X})},T=()=>{if(!j)return;const C={id:`subsection-${Date.now()}`,title:"New Subsection",questions:[],activities:[]},R=[...j.subsections||[],C];S(U=>U&&{...U,subsections:R})},F=C=>{if(!j||!j.subsections)return;const R=j.subsections.filter((U,X)=>X!==C);S(U=>U&&{...U,subsections:R})},q=(C,R)=>{var X,Q;if(!j)return;const U={...j};R==="question"?U.questions=(X=U.questions)==null?void 0:X.filter(z=>z.id!==C):U.activities=(Q=U.activities)==null?void 0:Q.filter(z=>z.id!==C),S(U)},Z=async()=>{if(!(!j||!m||!a)){_(!0);try{const C={...m,sections:m.sections.map(R=>R.id===x?j:R)};await a(C),$(),oe.success("Section updated successfully")}catch(C){console.error("Error saving section:",C),oe.error("Failed to save section")}finally{_(!1)}}},re=C=>{b(R=>{const U=new Set(R);return U.has(C)?U.delete(C):U.add(C),U})};v.useEffect(()=>{m&&m.sections.length>0&&b(c?new Set(m.sections.map(C=>C.id)):new Set)},[c,m]);const ge=(C,R,U,X)=>{if(!n||n.legacy_format)return null;const Q=n.moderator_position;if(Q.section_index!==C)return Q.section_index>C?"completed":null;if(X!==void 0){if(Q.subsection_index===void 0)return null;if(Q.subsection_index!==X)return Q.subsection_index>X?"completed":null}else if(Q.subsection_index!==void 0)return"completed";return Q.item_type!==U?U==="activity"&&Q.item_type==="question"?"completed":null:Q.item_index===R?"current":Q.item_index>R?"completed":null},B=(C,R)=>C===`New ${R}`,le=v.useCallback((C,R,U)=>{if(R<0||R>=C.length||U<0||U>=C.length)return C;const X=[...C],[Q]=X.splice(R,1);return X.splice(U,0,Q),X},[]),se=v.useCallback((C,R)=>R>0,[]),ce=v.useCallback((C,R)=>R{if(!j||!j.subsections)return;const R=j.subsections;if(se(R,C)){const U=le(R,C,C-1);S(X=>X&&{...X,subsections:U})}},[j,se,le]),de=v.useCallback(C=>{if(!j||!j.subsections)return;const R=j.subsections;if(ce(R,C)){const U=le(R,C,C+1);S(X=>X&&{...X,subsections:U})}},[j,ce,le]),be=v.useCallback((C,R)=>{k(C),M(R)},[]),Pe=v.useCallback(()=>{k(null),M("")},[]),ne=v.useCallback(()=>{if(!P||!j||!j.subsections)return;const C=j.subsections.map(R=>R.id===P?{...R,title:O.trim()}:R);S(R=>R&&{...R,subsections:C}),Pe()},[P,j,O,Pe]),Je=v.useCallback((C,R,U,X)=>{if(!j)return;const Q=R==="question"?"questions":"activities";if(X!==void 0){const z=j.subsections||[];if(X>=0&&Xwe&&{...we,subsections:Ie})}}}else{const z=j[Q]||[];if(se(z,U)){const ee=le(z,U,U-1);S(me=>me&&{...me,[Q]:ee})}}},[j,se,le]),ve=v.useCallback((C,R,U,X)=>{if(!j)return;const Q=R==="question"?"questions":"activities";if(X!==void 0){const z=j.subsections||[];if(X>=0&&Xwe&&{...we,subsections:Ie})}}}else{const z=j[Q]||[];if(ce(z,U)){const ee=le(z,U,U+1);S(me=>me&&{...me,[Q]:ee})}}},[j,ce,le]),at=(C,R,U,X,Q)=>{var jt,Ge,Ze,kt,Vt,Xn,an,pt,tt;const z=m==null?void 0:m.sections[R],ee=x===(z==null?void 0:z.id),me=ge(R,U,X,Q),Se=me==="current",Ie=me==="completed",ze=(it=>{const Lt=it.match(/['"`]([^'"`]*fg-[^'"`]*\.(jpe?g|png|gif|webp))['"`]/i);return Lt?Lt[1]:null})(C.content),gt=B(C.content,X);return ee?i.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border bg-white border-blue-200",children:[i.jsxs("div",{className:"flex-shrink-0 flex flex-col gap-1",children:[i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>Je(C.id,X,U,Q),disabled:(()=>{if(Q!==void 0){const Lt=((j==null?void 0:j.subsections)||[])[Q],tn=(Lt==null?void 0:Lt[X==="question"?"questions":"activities"])||[];return!se(tn,U)}else{const it=(j==null?void 0:j[X==="question"?"questions":"activities"])||[];return!se(it,U)}})(),className:"h-6 w-6 p-0",title:"Move item up",children:i.jsx(Tl,{className:"h-3 w-3"})}),i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>ve(C.id,X,U,Q),disabled:(()=>{if(Q!==void 0){const Lt=((j==null?void 0:j.subsections)||[])[Q],tn=(Lt==null?void 0:Lt[X==="question"?"questions":"activities"])||[];return!ce(tn,U)}else{const it=(j==null?void 0:j[X==="question"?"questions":"activities"])||[];return!ce(it,U)}})(),className:"h-6 w-6 p-0",title:"Move item down",children:i.jsx(yi,{className:"h-3 w-3"})})]}),i.jsxs("div",{className:"flex-1 min-w-0 space-y-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Wn,{variant:"outline",className:"text-xs",children:X==="activity"?i.jsxs(i.Fragment,{children:[i.jsx(Za,{className:"h-3 w-3 mr-1"}),typeof C.type=="string"?C.type.replace("_"," "):String(C.type||"unknown")]}):i.jsxs(i.Fragment,{children:[i.jsx(xa,{className:"h-3 w-3 mr-1"}),typeof C.type=="string"?C.type.replace("_"," "):String(C.type||"unknown")]})}),C.time_limit&&i.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500",children:[i.jsx(Uf,{className:"h-3 w-3"}),i.jsx(Ot,{type:"number",value:C.time_limit,onChange:it=>H(C.id,{time_limit:parseInt(it.target.value)||void 0},X),className:"w-16 h-6 text-xs",placeholder:"min"}),"min"]})]}),i.jsx(nt,{value:gt?"":C.content,onChange:it=>H(C.id,{content:it.target.value},X),placeholder:gt?C.content:"Enter content...",className:"min-h-[60px]"}),X==="question"&&i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium text-slate-700 mb-1 block",children:"Probe Questions (one per line)"}),i.jsx(nt,{value:((jt=C.probes)==null?void 0:jt.join(` +`))||"",onChange:it=>{const Lt=it.target.value.trim()?it.target.value.split(` +`).filter(tn=>tn.trim()):[];H(C.id,{probes:Lt},X)},placeholder:"Enter probe questions, one per line...",className:"min-h-[40px]"})]}),(((Ge=C.metadata)==null?void 0:Ge.image_url)||((Ze=C.metadata)==null?void 0:Ze.image_id)||ze)&&i.jsxs("div",{className:"mt-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(_m,{className:"h-4 w-4 text-slate-600"}),i.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(kt=C.metadata)!=null&&kt.image_url?i.jsx("img",{src:C.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(Vt=C.metadata)!=null&&Vt.image_id&&h?i.jsx("img",{src:St.getAssetUrl(h,C.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):ze&&h?i.jsx("img",{src:St.getAssetUrl(h,ze),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]}),i.jsx("div",{className:"flex-shrink-0",children:i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>q(C.id,X),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:i.jsx(_n,{className:"h-3 w-3"})})})]},`edit-item-${C.id}`):i.jsxs("div",{className:Me("flex items-start gap-3 p-3 rounded-lg border transition-colors",Se&&"bg-blue-50 border-blue-200",Ie&&"bg-green-50 border-green-200",!Se&&!Ie&&"bg-slate-50 border-slate-200",r&&"cursor-pointer hover:bg-slate-100"),onClick:()=>r==null?void 0:r(m.sections[R].id,C.id),children:[i.jsx("div",{className:"flex-shrink-0 mt-1",children:Ie?i.jsx($S,{className:"h-4 w-4 text-green-600"}):Se?i.jsx(sI,{className:"h-4 w-4 text-blue-600"}):i.jsx(MS,{className:"h-4 w-4 text-slate-400"})}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[i.jsx(Wn,{variant:"outline",className:"text-xs whitespace-nowrap",children:X==="activity"?i.jsxs(i.Fragment,{children:[i.jsx(Za,{className:"h-3 w-3 mr-1"}),typeof C.type=="string"?C.type.replace("_"," "):String(C.type||"unknown")]}):i.jsxs(i.Fragment,{children:[i.jsx(xa,{className:"h-3 w-3 mr-1"}),typeof C.type=="string"?C.type.replace("_"," "):String(C.type||"unknown")]})}),C.time_limit&&i.jsxs("div",{className:"flex items-center gap-1 text-xs text-slate-500 whitespace-nowrap",children:[i.jsx(Uf,{className:"h-3 w-3"}),C.time_limit," min"]}),s&&i.jsxs(te,{size:"sm",variant:"ghost",onClick:it=>{it.stopPropagation();const Lt=m.sections[R],tn=X==="activity"?`Activity ${U+1}`:`Question ${U+1}`;s(Lt.id,C.id,C.content,Lt.title,tn,X)},className:"h-6 px-2 ml-auto",children:[i.jsx(Pm,{className:"h-3 w-3 mr-1"}),"Set Position"]})]}),i.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:C.content}),C.probes&&C.probes.length>0&&i.jsxs("div",{className:"mt-2 pl-4 border-l-2 border-slate-200",children:[i.jsx("p",{className:"text-xs font-medium text-slate-600 mb-1",children:"Probe Questions:"}),i.jsx("ul",{className:"space-y-1",children:C.probes.map((it,Lt)=>i.jsxs("li",{className:"text-xs text-slate-600",children:["• ",it]},Lt))})]}),(((Xn=C.metadata)==null?void 0:Xn.image_url)||((an=C.metadata)==null?void 0:an.image_id)||ze)&&i.jsxs("div",{className:"mt-3",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(_m,{className:"h-4 w-4 text-slate-600"}),i.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),(pt=C.metadata)!=null&&pt.image_url?i.jsx("img",{src:C.metadata.image_url,alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):(tt=C.metadata)!=null&&tt.image_id&&h?i.jsx("img",{src:St.getAssetUrl(h,C.metadata.image_id),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):ze&&h?i.jsx("img",{src:St.getAssetUrl(h,ze),alt:"Visual aid for item",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},C.id)},st=(C,R)=>{var ee,me,Se,Ie;const U=y.has(C.id),X=x===C.id,Q=X?j:C,z=(n==null?void 0:n.moderator_position.section_index)===R;return i.jsxs("div",{className:Me("border rounded-lg overflow-hidden transition-colors",z&&"border-blue-500 shadow-md",!z&&"border-slate-200"),children:[i.jsxs("div",{className:Me("px-4 py-3 flex items-center justify-between cursor-pointer hover:bg-slate-50 transition-colors",z&&"bg-blue-50"),onClick:()=>!X&&re(C.id),children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("div",{className:"transition-transform",style:{transform:U?"rotate(90deg)":"rotate(0deg)"},children:i.jsx(zs,{className:"h-5 w-5 text-slate-500"})}),i.jsx("h3",{className:"font-semibold text-slate-800",children:X?i.jsx(Ot,{value:Q.title,onChange:we=>L({title:we.target.value}),onClick:we=>we.stopPropagation(),className:"font-semibold"}):Q.title}),z&&i.jsx(Wn,{variant:"default",className:"text-xs",children:"Current"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[a&&!X&&i.jsx(te,{size:"sm",variant:"ghost",onClick:we=>{we.stopPropagation(),A(C)},className:"h-8 px-2",children:i.jsx(BA,{className:"h-3 w-3"})}),X&&i.jsxs("div",{className:"flex items-center gap-2",onClick:we=>we.stopPropagation(),children:[i.jsxs(te,{size:"sm",variant:"default",onClick:Z,disabled:N,className:"h-8",children:[N?i.jsx(ii,{className:"h-3 w-3 animate-spin"}):i.jsx(RS,{className:"h-3 w-3"}),i.jsx("span",{className:"ml-1",children:"Save"})]}),i.jsxs(te,{size:"sm",variant:"ghost",onClick:$,disabled:N,className:"h-8",children:[i.jsx(Zs,{className:"h-3 w-3"}),i.jsx("span",{className:"ml-1",children:"Cancel"})]})]})]})]}),U&&i.jsxs("div",{className:"px-4 py-3 border-t border-slate-200 space-y-4",children:[Q.content&&i.jsx("div",{className:"prose prose-sm max-w-none",children:X?i.jsx(nt,{value:Q.content,onChange:we=>L({content:we.target.value}),placeholder:"Section introduction or context...",className:"min-h-[80px] w-full"}):i.jsx("p",{className:"text-slate-700",children:Q.content})}),Q.activities&&Q.activities.length>0||X?i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[i.jsx(Za,{className:"h-4 w-4"}),"Activities"]}),X&&i.jsxs(te,{size:"sm",variant:"outline",onClick:()=>D("activity"),className:"h-7",children:[i.jsx(Za,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),i.jsx("div",{className:"space-y-2",children:(ee=Q.activities)==null?void 0:ee.map((we,ze)=>at(we,R,ze,"activity"))})]}):null,Q.questions&&Q.questions.length>0||X?i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[i.jsx(xa,{className:"h-4 w-4"}),"Questions"]}),X&&i.jsxs(te,{size:"sm",variant:"outline",onClick:()=>D("question"),className:"h-7",children:[i.jsx(xa,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),i.jsx("div",{className:"space-y-2",children:(me=Q.questions)==null?void 0:me.map((we,ze)=>at(we,R,ze,"question"))})]}):null,X&&i.jsx("div",{className:"space-y-2",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h5",{className:"font-medium text-slate-700 flex items-center gap-2",children:[i.jsx(Pm,{className:"h-4 w-4"}),"Subsections"]}),i.jsxs(te,{size:"sm",variant:"outline",onClick:T,className:"h-7",children:[i.jsx(Pm,{className:"h-3 w-3 mr-1"}),"Add Subsection"]})]})}),Q.subsections&&Q.subsections.length>0&&i.jsx("div",{className:"space-y-3 ml-4",children:Q.subsections.map((we,ze)=>{var gt,jt;return i.jsxs("div",{className:"border-l-2 border-slate-200 pl-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[X&&i.jsxs("div",{className:"flex flex-col gap-1",children:[i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>De(ze),disabled:!se(Q.subsections||[],ze),className:"h-7 w-7 p-0",title:"Move subsection up",children:i.jsx(Tl,{className:"h-4 w-4"})}),i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>de(ze),disabled:!ce(Q.subsections||[],ze),className:"h-7 w-7 p-0",title:"Move subsection down",children:i.jsx(yi,{className:"h-4 w-4"})})]}),X&&P===we.id?i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx(Ot,{value:O,onChange:Ge=>M(Ge.target.value),className:"flex-1",onKeyDown:Ge=>{Ge.key==="Enter"?ne():Ge.key==="Escape"&&Pe()},autoFocus:!0}),i.jsx(te,{size:"sm",onClick:ne,children:i.jsx(Ta,{className:"h-3 w-3"})}),i.jsx(te,{size:"sm",variant:"outline",onClick:Pe,children:i.jsx(Zs,{className:"h-3 w-3"})})]}):i.jsxs("div",{className:"flex items-center gap-2 flex-1",children:[i.jsx("h5",{className:Me("font-medium text-slate-700",X&&"cursor-pointer hover:text-blue-600"),onClick:()=>X&&be(we.id,we.title),children:we.title}),X&&i.jsxs(i.Fragment,{children:[i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>be(we.id,we.title),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100",children:i.jsx(BA,{className:"h-3 w-3"})}),i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>F(ze),className:"h-6 w-6 p-0 opacity-60 hover:opacity-100 text-red-600 hover:text-red-700",title:"Delete subsection",children:i.jsx(_n,{className:"h-3 w-3"})})]})]})]}),we.questions&&we.questions.length>0||X?i.jsxs("div",{className:"space-y-2 mb-3",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[i.jsx(xa,{className:"h-3 w-3"}),"Questions"]}),X&&i.jsxs(te,{size:"sm",variant:"outline",onClick:()=>V(ze,"question"),className:"h-6",children:[i.jsx(xa,{className:"h-3 w-3 mr-1"}),"Add Question"]})]}),i.jsx("div",{className:"space-y-2",children:(gt=we.questions)==null?void 0:gt.map((Ge,Ze)=>at(Ge,R,Ze,"question",ze))})]}):null,we.activities&&we.activities.length>0||X?i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("h6",{className:"text-sm font-medium text-slate-600 flex items-center gap-1",children:[i.jsx(Za,{className:"h-3 w-3"}),"Activities"]}),X&&i.jsxs(te,{size:"sm",variant:"outline",onClick:()=>V(ze,"activity"),className:"h-6",children:[i.jsx(Za,{className:"h-3 w-3 mr-1"}),"Add Activity"]})]}),i.jsx("div",{className:"space-y-2",children:(jt=we.activities)==null?void 0:jt.map((Ge,Ze)=>at(Ge,R,Ze,"activity",ze))})]}):null]},we.id)})}),(((Se=C.metadata)==null?void 0:Se.image_url)||((Ie=C.metadata)==null?void 0:Ie.image_id))&&i.jsxs("div",{className:"mt-4",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(_m,{className:"h-4 w-4 text-slate-600"}),i.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Visual Aid"})]}),C.metadata.image_url?i.jsx("img",{src:C.metadata.image_url,alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):C.metadata.image_id&&h?i.jsx("img",{src:St.getAssetUrl(h,C.metadata.image_id),alt:"Visual aid for section",className:"max-w-[400px] max-h-[400px] object-contain rounded-lg border border-slate-200"}):null]})]})]},C.id)};if(g)return i.jsxs("div",{className:Me("space-y-4",u),children:[o&&n&&i.jsxs("div",{className:"mb-4",children:[i.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[i.jsx("span",{children:"Progress"}),i.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),i.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:i.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})})]}),i.jsxs("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h2",{className:"text-xl font-semibold text-slate-800",children:"Discussion Guide"}),d&&i.jsxs(te,{size:"sm",variant:"outline",onClick:d,disabled:f,children:[f?i.jsx(ii,{className:"h-4 w-4 animate-spin mr-2"}):i.jsx($l,{className:"h-4 w-4 mr-2"}),"Download"]})]}),i.jsx("div",{className:"prose prose-sm max-w-none",children:i.jsx("pre",{className:"whitespace-pre-wrap text-sm text-slate-700 font-sans",children:t})}),n&&i.jsxs("div",{className:"mt-6 p-4 bg-blue-50 rounded-lg border border-blue-200",children:[i.jsx("h3",{className:"font-medium text-blue-900 mb-2",children:"Current Position"}),i.jsx("p",{className:"text-sm text-blue-800",children:n.current_section}),n.current_item&&i.jsx("p",{className:"text-sm text-blue-700 mt-1",children:n.current_item})]})]})]});if(!m)return i.jsx("div",{className:Me("bg-slate-50 rounded-lg p-8 text-center",u),children:i.jsx("p",{className:"text-slate-600",children:"No discussion guide available"})});const Mt=i.jsxs("div",{className:"space-y-4",children:[o&&n&&i.jsxs("div",{className:"mb-4",children:[i.jsxs("div",{className:"flex items-center justify-between text-sm text-slate-600 mb-2",children:[i.jsx("span",{children:"Overall Progress"}),i.jsxs("span",{children:[Math.round(n.progress),"%"]})]}),i.jsx("div",{className:"w-full bg-slate-200 rounded-full h-2",children:i.jsx("div",{className:"bg-blue-600 h-2 rounded-full transition-all",style:{width:`${n.progress}%`}})}),i.jsxs("div",{className:"flex items-center justify-between text-xs text-slate-500 mt-2",children:[i.jsxs("span",{children:["Section ",n.moderator_position.section_index+1," of ",n.total_sections]}),i.jsxs("span",{children:[Math.round(n.section_progress),"% of current section"]})]})]}),i.jsx("div",{className:"space-y-3",children:m.sections.map((C,R)=>st(C,R))})]});return l?i.jsxs(cp,{defaultOpen:c,className:u,children:[i.jsx(up,{asChild:!0,children:i.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:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(zs,{className:"h-5 w-5 text-slate-500 transition-transform data-[state=open]:rotate-90"}),i.jsx("h2",{className:"text-lg font-semibold text-slate-800",children:m.title||"Discussion Guide"}),i.jsxs(Wn,{variant:"outline",className:"text-xs",children:[m.total_duration," min"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[n&&i.jsxs(Wn,{variant:n.progress===100?"success":"default",className:"text-xs",children:[Math.round(n.progress),"% Complete"]}),d&&i.jsx(te,{size:"sm",variant:"outline",onClick:C=>{C.stopPropagation(),d()},disabled:f,children:f?i.jsx(ii,{className:"h-4 w-4 animate-spin"}):i.jsx($l,{className:"h-4 w-4"})})]})]})}),i.jsx(dp,{className:"mt-4",children:Mt})]}):i.jsx("div",{className:u,children:Mt})});RN.displayName="DiscussionGuideViewer";const Ho="all",_Q=Te.object({researchBrief:Te.string().min(10,{message:"Research brief must be at least 10 characters."}),focusGroupName:Te.string().min(3,{message:"Focus group name must be at least 3 characters."}),discussionTopics:Te.string().min(10,{message:"Discussion topics are required."}),creativeAssets:Te.instanceof(FileList).optional(),duration:Te.string().min(1,{message:"Duration is required."}),llm_model:Te.string().optional()}),kd={introduction:"Welcome to our focus group discussion. Today we'll be exploring your experiences and opinions on [product/service]. There are no right or wrong answers, we're just interested in your honest thoughts.",warmup:"Let's start by introducing ourselves and sharing a bit about your background and daily routines relevant to this topic.",exploration:"Now, let's dive deeper into your experiences with similar products. What features do you find most valuable? What frustrations have you encountered?",creative:"We'll now show you some concepts and get your feedback. Please be honest and specific in your reactions.",conclusion:"To wrap up, I'd like to hear your final thoughts on what we've discussed today and any additional insights you'd like to share."};function PQ({draftToEdit:e,onDraftSaved:t,preSelectedParticipants:n=[]}={}){console.log("FocusGroupModerator component rendering, draftToEdit:",e);const r=Tn();qr();const{setPreviousRoute:s,navigationState:a,clearNavigationState:o}=XL(),[l,c]=v.useState("setup"),[u,d]=v.useState(!1),[f,h]=v.useState(!1),[p,g]=v.useState(!1),[m,y]=v.useState(null),[b,x]=v.useState(null),[w,j]=v.useState(!1),S=v.useRef(m);S.current=m;const N=v.useRef(!1),_=I=>I&&typeof I=="object"&&I.title&&I.sections,[P,k]=v.useState([]),[O,M]=v.useState([]),[A,$]=v.useState([]),[L,H]=v.useState(!1),[D,V]=v.useState(!1),[T,F]=v.useState([]),[q,Z]=v.useState(Ho),[re,ge]=v.useState(!1),[B,le]=v.useState(""),[se,ce]=v.useState(null),[De,de]=v.useState(""),[be,Pe]=v.useState(""),[ne,Je]=v.useState(!1),[ve,at]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[st,Mt]=v.useState({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]}),[C,R]=v.useState("idle"),[U,X]=v.useState(null),[Q,z]=v.useState(0),ee=v.useRef(null),me=v.useRef(!1),Se=v.useRef(!1),Ie=I=>{s("/focus-groups",{focusGroupId:b,focusGroupTab:"participants",isNewFocusGroup:!e,focusGroupData:{name:tt.getValues("name"),description:tt.getValues("description"),selectedParticipants:P,discussionGuide:m}}),r(`/synthetic-users/${I.id}`)},we=I=>{const K={age:new Set,gender:new Set,occupation:new Set,location:new Set,techSavviness:new Set,ethnicity:new Set};return I.forEach(W=>{if(W.age&&K.age.add(W.age),W.gender&&K.gender.add(W.gender),W.occupation&&K.occupation.add(W.occupation),W.location&&K.location.add(W.location),W.techSavviness!==void 0){const ie=W.techSavviness<30?"Low (0-30)":W.techSavviness<70?"Medium (31-70)":"High (71-100)";K.techSavviness.add(ie)}W.ethnicity&&K.ethnicity.add(W.ethnicity)}),{age:Array.from(K.age).sort(),gender:Array.from(K.gender).sort(),occupation:Array.from(K.occupation).sort(),location:Array.from(K.location).sort(),techSavviness:Array.from(K.techSavviness).sort((W,ie)=>{const he=["Low (0-30)","Medium (31-70)","High (71-100)"];return he.indexOf(W)-he.indexOf(ie)}),ethnicity:Array.from(K.ethnicity).sort()}},ze=I=>{const K={...st};K[I]=[];const W=A.filter(ie=>{let he=!0;if(q!==Ho)if(he=!1,ie.folderId===q)he=!0;else{const ke=T.find(qe=>qe.id===q);ke&&ke.personaIds.includes(ie.id)&&(he=!0)}return he?Object.entries(K).every(([ke,qe])=>{if(qe.length===0)return!0;const Ft=ke;if(Ft==="techSavviness"&&ie.techSavviness!==void 0){const Wt=ie.techSavviness<30?"Low (0-30)":ie.techSavviness<70?"Medium (31-70)":"High (71-100)";return qe.includes(Wt)}else{if(Ft==="age"&&ie.age)return qe.includes(ie.age);if(Ft==="gender"&&ie.gender)return qe.includes(ie.gender);if(Ft==="occupation"&&ie.occupation)return qe.includes(ie.occupation);if(Ft==="location"&&ie.location)return qe.includes(ie.location);if(Ft==="ethnicity"&&ie.ethnicity)return qe.includes(ie.ethnicity)}return!0}):!1});return we(W)},gt=()=>{Je(!1),setTimeout(()=>{at({...st})},0)},jt=()=>{Mt({age:[],gender:[],occupation:[],location:[],techSavviness:[],ethnicity:[]})},Ge=(I,K)=>{Mt(W=>{const ie={...W};return ie[I].includes(K)?ie[I]=ie[I].filter(he=>he!==K):ie[I]=[...ie[I],K],ie})},Ze=()=>{if(!B.trim()){oe.error("Please enter a folder name");return}const I={id:`folder-${Date.now()}`,name:B.trim(),personaIds:[]};F([...T,I]),le(""),ge(!1),oe.success(`Folder "${B}" created`)},kt=()=>{le(""),ge(!1)},Vt=I=>{ce(I),de(I.name)},Xn=()=>{if(!se||!De.trim()){ce(null);return}const I=T.map(K=>K.id===se.id?{...K,name:De.trim()}:K);F(I),ce(null),oe.success(`Folder renamed to "${De}"`)},an=()=>{ce(null),de("")},pt=(I,K)=>(I.forEach(W=>{if(W.folderId){const ie=K.find(he=>he.id===W.folderId);ie&&!ie.personaIds.includes(W.id)&&ie.personaIds.push(W.id)}}),K.forEach(W=>{W.personaIds=W.personaIds.filter(ie=>{if(!ie)return console.log(`Removing invalid personaId (${ie}) from folder ${W.name}`),!1;const he=I.find(ke=>ke.id===ie||ke._id===ie);return he||console.log(`Removing non-existent personaId ${ie} from folder ${W.name}`),!!he})}),K);v.useEffect(()=>{const I=async()=>{H(!0);try{const ie=await Dn.getAll();console.log("Fetched personas for FocusGroupModerator:",ie.data),Array.isArray(ie.data)&&ie.data.length>0?$(ie.data):(console.warn("No personas returned from API or invalid format",ie.data),oe.warning("No participants available"))}catch(ie){console.error("Error fetching personas:",ie),oe.error("Failed to load participants")}finally{H(!1)}},K=localStorage.getItem("persona-folders");let W=[];if(K)try{W=JSON.parse(K),F(W)}catch(ie){console.error("Failed to parse stored folders:",ie)}I()},[]),v.useEffect(()=>{T.length>0&&(console.log("Saving folders to localStorage:",T),localStorage.setItem("persona-folders",JSON.stringify(T)))},[T]),v.useEffect(()=>{if(A.length>0&&T.length>0){console.log("Running folder sync with personas:",A.length,"and folders:",T.length);const I=pt(A,[...T]);JSON.stringify(I)!==JSON.stringify(T)?(console.log("Updating folders after sync"),F(I)):console.log("No folder changes after sync")}},[A,T.length]),console.log("About to initialize form with useForm hook");const tt=Ny({resolver:_y(_Q),defaultValues:{researchBrief:"",focusGroupName:"",discussionTopics:"",duration:"60",llm_model:"gemini-2.5-pro"}});console.log("Form initialized successfully");const it=()=>{l!=="setup"||Se.current||(ee.current&&clearTimeout(ee.current),ee.current=setTimeout(async()=>{if(me.current)return;const I=tt.getValues(),K={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",participants:P,participants_count:P.length,status:"draft",date:new Date().toISOString(),uploadedAssets:O.map(W=>W.name)};if(!(U&&JSON.stringify(K)===JSON.stringify(U))&&!(!K.name&&!K.description&&!K.topic)){me.current=!0,R("saving");try{let W=b||(e==null?void 0:e.id)||(e==null?void 0:e._id);if(console.log("Auto-save: draftFocusGroupId =",b),console.log("Auto-save: draftToEdit ID =",(e==null?void 0:e.id)||(e==null?void 0:e._id)),console.log("Auto-save: using focusGroupId =",W),console.log("Auto-save: llm_model in currentData =",K.llm_model),console.log("Auto-save: duration in currentData =",K.duration),W)console.log("Auto-save: Updating existing focus group:",W),await St.update(W,K),console.log("Auto-save: Updated existing draft:",W);else{console.log("Auto-save: Creating NEW focus group (no existing ID)");const ie=await St.create(K);W=ie.data.focus_group_id||ie.data.id||ie.data._id,x(W),console.log("Auto-save: Created new draft with ID:",W)}X(K),R("saved"),z(0),setTimeout(()=>{R("idle")},2e3)}catch(W){if(console.error("Auto-save failed:",W),R("error"),z(ie=>ie+1),Q<3){const ie=Math.pow(2,Q)*2e3;setTimeout(()=>{it()},ie)}else oe.error("Auto-save failed",{description:"Your changes may not be saved. Please check your connection."})}finally{me.current=!1}}},2e3))},Lt=tt.watch(),tn=v.useRef(""),Xr=v.useRef(""),za=v.useRef("");v.useEffect(()=>{const I=JSON.stringify(Lt);l==="setup"&&I!==tn.current&&(tn.current=I,it())},[Lt,l]),v.useEffect(()=>{const I=JSON.stringify(P);l==="setup"&&I!==Xr.current&&(Xr.current=I,it())},[P,l]),v.useEffect(()=>{const I=JSON.stringify(O.map(K=>K.name));l==="setup"&&I!==za.current&&(za.current=I,it())},[O,l]),v.useEffect(()=>(l!=="setup"&&ee.current&&clearTimeout(ee.current),()=>{ee.current&&clearTimeout(ee.current)}),[l]),v.useEffect(()=>{if(console.log("Draft loading effect - draftToEdit:",e,"draftLoadedRef.current:",N.current),!e){N.current=!1;return}if(e&&!N.current){console.log("Loading draft focus group:",e),Se.current=!0,N.current=!0;const I=e.id||e._id;x(I),console.log("Setting draft ID from draftToEdit:",I),e.name&&tt.setValue("focusGroupName",e.name),(e.description||e.objective)&&tt.setValue("researchBrief",e.description||e.objective||""),e.topic&&tt.setValue("discussionTopics",e.topic),e.duration&&tt.setValue("duration",e.duration.toString()),e.llm_model&&tt.setValue("llm_model",e.llm_model),e.discussionGuide&&(y(e.discussionGuide),(!a.focusGroupTab||a.previousRoute!=="/focus-groups")&&c("review")),e.participants&&Array.isArray(e.participants)&&k(e.participants);const K={name:e.name||"",description:e.description||e.objective||"",objective:e.description||e.objective||"",topic:e.topic||"",duration:e.duration||60,llm_model:e.llm_model||"gemini-2.5-pro",participants:e.participants||[],participants_count:(e.participants||[]).length,status:"draft",date:e.date||new Date().toISOString(),uploadedAssets:[]};X(K),console.log("Set lastSavedData to current draft:",K),oe.success("Draft focus group loaded",{description:"Continue editing your focus group setup"}),setTimeout(()=>{Se.current=!1},1e3)}},[e,tt]),v.useEffect(()=>{n.length>0&&(console.log("Pre-selected participants received:",n),k(n),c("participants"))},[n]),v.useEffect(()=>{a.focusGroupTab&&a.previousRoute==="/focus-groups"&&setTimeout(()=>{c(a.focusGroupTab),o()},0)},[a.focusGroupTab,e,o]),v.useEffect(()=>{e||setTimeout(()=>{Se.current=!1},500)},[e]);const G=()=>{if(C==="idle")return null;const K={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"}}[C];return i.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 ${K.className}`,children:K.text})},Ce=async(I,K)=>{var W,ie;d(!0),h(!1),g(!1);try{const he={name:I.focusGroupName,description:I.researchBrief,objective:I.researchBrief,topic:I.discussionTopics,duration:parseInt(I.duration),llm_model:I.llm_model},ke=K?await St.generateDiscussionGuideForGroup(K,he):await St.generateDiscussionGuide(he);if(ke.data&&ke.data.discussionGuide)return h(!0),ke.data.discussionGuide;throw new Error("Failed to generate discussion guide")}catch(he){console.error("Error generating discussion guide:",he),g(!0);let ke="Unknown error occurred";return(ie=(W=he==null?void 0:he.response)==null?void 0:W.data)!=null&&ie.error?ke=he.response.data.error:he!=null&&he.message&&(ke=he.message),ke.includes("500")||ke.includes("internal error")||ke.includes("Internal Server Error")?oe.error("AI service temporarily unavailable",{description:"The discussion guide generator is experiencing issues. Please try again in a few minutes.",action:{label:"Retry",onClick:()=>Ce(I)}}):oe.error("Failed to generate discussion guide",{description:ke,action:{label:"Retry",onClick:()=>Ce(I)}}),` +# Discussion Guide: ${I.focusGroupName} + +## Introduction (5 minutes) +${kd.introduction} + +## Warm-up Questions (10 minutes) +${kd.warmup} + +## ${I.discussionTopics.split(",")[0]} Exploration (15 minutes) +${kd.exploration} + +## Creative Testing (20 minutes) +${kd.creative} +${I.creativeAssets&&I.creativeAssets.length>0?`We'll be reviewing ${I.creativeAssets.length} creative assets.`:""} + +## Conclusion (10 minutes) +${kd.conclusion} + +## Research Brief Context +${I.researchBrief} + `}},Oe=()=>{d(!1),h(!1),g(!1)};async function Ue(I){var K;try{let W=b;if(!W){const he={name:I.focusGroupName,status:"draft",participants:P,participants_count:P.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},ke=await St.create(he);W=ke.data.focus_group_id||ke.data.id||ke.data._id,x(W),console.log("Draft focus group created for asset upload:",ke,"with ID:",W)}if(I.creativeAssets&&I.creativeAssets.length>0&&W)try{const he=new FormData;Array.from(I.creativeAssets).forEach(Wt=>{he.append("assets",Wt)});const qe=(await St.uploadAssets(W,he)).data;console.log("Assets uploaded successfully:",qe),oe.success(`${qe.uploaded_assets} asset(s) uploaded successfully`,{description:"Assets will be included in the discussion guide"});const Ft=Array.from(I.creativeAssets);M(Ft)}catch(he){console.error("Asset upload failed:",he);const ke=(K=he.response)==null?void 0:K.data;let qe="Asset upload failed",Ft="Some assets could not be uploaded";(ke==null?void 0:ke.code)==="TEMP_DIR_ERROR"?(qe="Upload temporarily unavailable",Ft="Server storage issue. Please try again in a moment."):(ke==null?void 0:ke.code)==="UPLOAD_SYSTEM_FAILURE"?(qe="Upload system unavailable",Ft="Critical server issue. Please contact support."):ke!=null&&ke.can_retry&&(qe="Upload failed - can retry",Ft=(ke==null?void 0:ke.details)||"Please try uploading again."),oe.error(qe,{description:Ft}),console.log("Continuing without assets due to upload failure")}if(W)try{const he={name:I.focusGroupName,participants:P,participants_count:P.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};await St.update(W,he),console.log("Focus group updated with latest form values before guide generation"),console.log(`🔄 Updated focus group ${W} with model: ${I.llm_model}`)}catch(he){console.error("Failed to update focus group before guide generation:",he)}const ie=await Ce(I,W);y(ie);try{const he={name:I.focusGroupName,status:"draft",participants:P,participants_count:P.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,discussionGuide:ie};await St.update(W,he),console.log("Focus group updated with discussion guide"),oe.success("Progress saved as draft",{description:"Your focus group setup has been automatically saved"})}catch(he){console.error("Failed to update focus group with discussion guide:",he),oe.error("Failed to save draft",{description:"Discussion guide generated, but draft save failed"})}c("review"),oe.success("Discussion guide generated",{description:"Review and edit before proceeding"})}catch(W){console.error("Error in focus group creation flow:",W),oe.error("Focus group creation failed",{description:W.message||"An unexpected error occurred"})}}const Le=(()=>{var K;const I=A.filter(W=>{const ie=W.name.toLowerCase().includes(be.toLowerCase())||W.occupation&&W.occupation.toLowerCase().includes(be.toLowerCase())||W.location&&W.location.toLowerCase().includes(be.toLowerCase()),he=(ve.age.length===0||ve.age.includes(W.age))&&(ve.gender.length===0||ve.gender.includes(W.gender))&&(ve.occupation.length===0||ve.occupation.includes(W.occupation))&&(ve.location.length===0||ve.location.includes(W.location))&&(ve.ethnicity.length===0||W.ethnicity&&ve.ethnicity.includes(W.ethnicity))&&(ve.techSavviness.length===0||W.techSavviness!==void 0&&ve.techSavviness.includes(W.techSavviness<30?"Low (0-30)":W.techSavviness<70?"Medium (31-70)":"High (71-100)"))&&!0;let ke=!0;if(q!==Ho)if(ke=!1,W.folderId===q)ke=!0;else{const qe=T.find(Ft=>Ft.id===q);if(qe){const Ft=qe.personaIds.filter(It=>!!It),Wt=W.id||W._id;Ft.includes(Wt)&&(ke=!0)}}return ie&&he&&ke});if(console.log(`Filtered personas: ${I.length}/${A.length}`),console.log(`Selected folder: ${q===Ho?"All Personas":((K=T.find(W=>W.id===q))==null?void 0:K.name)||q}`),q!==Ho){const W=T.find(ie=>ie.id===q);if(W){const ie=W.personaIds.filter(qe=>!!qe);console.log(`Folder details: ${W.name}, ID: ${W.id}, Contains: ${ie.length} valid personas`),console.log("Folder personaIds (valid only):",ie);const he=A.filter(qe=>qe.folderId===q);console.log(`Personas with folderId matching this folder: ${he.length}`);const ke=A.filter(qe=>{const Ft=qe.id||qe._id;return W.personaIds.includes(Ft)});console.log(`Personas in folder's personaIds array: ${ke.length}`)}}return I})(),ft=I=>{console.log("Toggling selection for participant ID:",I),k(K=>{const W=K.includes(I);console.log("Current selection:",{id:I,isCurrentlySelected:W,currentSelections:[...K]});const ie=W?K.filter(he=>he!==I):[...K,I];return console.log("New selection:",ie),ie})},J=async()=>{try{const I=tt.getValues(),K={name:I.focusGroupName,status:"in-progress",participants:P,participants_count:P.length,date:new Date().toISOString(),duration:parseInt(I.duration),topic:I.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),discussionGuide:m},ie=(await St.create(K)).data;return console.log("Focus group created successfully:",ie),ie.focus_group_id}catch(I){throw console.error("Error saving focus group:",I),I}},Y=v.useCallback(async()=>{if(!S.current){oe.error("No discussion guide available",{description:"Please generate a discussion guide first"});return}V(!0);try{const{downloadDiscussionGuideAsMarkdown:I}=await jQ(async()=>{const{downloadDiscussionGuideAsMarkdown:W}=await import("./discussionGuideMarkdown-eMXneipz.js");return{downloadDiscussionGuideAsMarkdown:W}},[]),K=tt.getValues();I(S.current,K.focusGroupName),oe.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(I){console.error("Error downloading discussion guide:",I),oe.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{V(!1)}},[tt]),ye=v.useCallback(async I=>{console.log("📝 handleSaveDiscussionGuide called with:",I),w?(S.current=I,console.log("📝 Skipping discussionGuide state update during editing to preserve focus")):(y(I),oe.success("Discussion guide updated",{description:"Your changes have been saved."}))},[w]),xe=v.useCallback(I=>{console.log("📝 Discussion guide editing state changed:",I),j(I),!I&&S.current&&(console.log("📝 Updating discussionGuide state after editing ended"),y(S.current))},[]),je=v.useCallback(()=>{},[]),Qe=async()=>{if(!tt.getValues().focusGroupName){oe.error("Missing focus group name",{description:"Please provide a name for the focus group"});return}if(!m){oe.error("Missing discussion guide",{description:"Please generate a discussion guide first"});return}if(P.length<1){oe.error("Not enough participants",{description:"Please select at least one participant for the focus group"});return}console.log("Starting focus group with participants:",P);try{oe.loading("Creating focus group...");let I;if(b){const K=tt.getValues(),W={name:K.focusGroupName,status:"in-progress",participants:P,participants_count:P.length,date:new Date().toISOString(),duration:parseInt(K.duration),topic:K.discussionTopics.split(",")[0].trim().toLowerCase().replace(/\s+/g,"-"),description:K.researchBrief,objective:K.researchBrief,discussionGuide:m},ie=await St.update(b,W);I=b,console.log("Draft focus group updated to in-progress:",ie),t&&t()}else I=await J();oe.dismiss(),oe.success("Focus group created successfully",{description:"The AI moderator is now running the session"}),r(`/focus-groups/${I}`)}catch(I){oe.dismiss(),I!=null&&I.message,console.error("Failed to start focus group:",I),oe.error("Failed to create focus group",{description:"Please try again or check your connection"})}};return i.jsxs(i.Fragment,{children:[i.jsx(G,{}),i.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[i.jsx($a,{className:"h-5 w-5 text-primary"}),i.jsx("h2",{className:"font-sf text-xl font-semibold",children:"AI Focus Group Moderator"})]}),u&&i.jsx("div",{className:"mb-6",children:i.jsx(IN,{isActive:u,isComplete:f,hasError:p,label:"Generating discussion guide",onComplete:Oe})}),i.jsxs(Fo,{value:l,onValueChange:c,children:[i.jsxs(Pi,{className:"grid w-full grid-cols-3 mb-6",children:[i.jsx(Xt,{value:"setup",children:"Setup"}),i.jsx(Xt,{value:"review",children:"Review & Edit"}),i.jsx(Xt,{value:"participants",children:"Participants"})]}),i.jsx(Yt,{value:"setup",children:i.jsx(Ay,{...tt,children:i.jsxs("form",{onSubmit:tt.handleSubmit(Ue),className:"space-y-6",children:[i.jsx(dt,{control:tt.control,name:"focusGroupName",render:({field:I})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Focus Group Name"}),i.jsx(ct,{children:i.jsx(Ot,{placeholder:"e.g., Mobile App UX Evaluation",...I})}),i.jsx(fn,{children:"Give your focus group a descriptive name"}),i.jsx(ut,{})]})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsx(dt,{control:tt.control,name:"researchBrief",render:({field:I})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Research Brief"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"Describe your research objectives...",className:"h-36",...I})}),i.jsx(fn,{children:"Provide context about what you want to learn"}),i.jsx(ut,{})]})}),i.jsxs("div",{className:"space-y-6",children:[i.jsx(dt,{control:tt.control,name:"discussionTopics",render:({field:I})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Discussion Topics"}),i.jsx(ct,{children:i.jsx(nt,{placeholder:"List main topics to cover, separated by commas",className:"h-24",...I})}),i.jsx(fn,{children:"E.g., User experience, feature preferences, pain points"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:tt.control,name:"duration",render:({field:I})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Duration (minutes)"}),i.jsxs(Mn,{onValueChange:I.onChange,value:I.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select duration"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"30",children:"30 minutes"}),i.jsx(fe,{value:"45",children:"45 minutes"}),i.jsx(fe,{value:"60",children:"60 minutes"}),i.jsx(fe,{value:"90",children:"90 minutes"}),i.jsx(fe,{value:"120",children:"120 minutes"})]})]}),i.jsx(fn,{children:"How long should the focus group session last?"}),i.jsx(ut,{})]})}),i.jsx(dt,{control:tt.control,name:"llm_model",render:({field:I})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"AI Model"}),i.jsxs(Mn,{onValueChange:I.onChange,value:I.value,children:[i.jsx(ct,{children:i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select AI model"})})}),i.jsxs(An,{children:[i.jsx(fe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),i.jsx(fe,{value:"gpt-4.1",children:"GPT-4.1"})]})]}),i.jsx(fn,{children:"Choose which AI model to use for generating responses and discussion guides"}),i.jsx(ut,{})]})})]})]}),i.jsx(dt,{control:tt.control,name:"creativeAssets",render:({field:{value:I,onChange:K,...W}})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Creative Assets (Optional)"}),i.jsx(ct,{children:i.jsxs("div",{className:"border-2 border-dashed border-slate-200 rounded-lg p-6 flex flex-col items-center justify-center bg-slate-50 hover:bg-slate-100 transition cursor-pointer",children:[i.jsx(aI,{className:"h-10 w-10 text-slate-400 mb-2"}),i.jsx("p",{className:"text-sm text-slate-600 mb-1",children:"Upload creative assets for testing"}),i.jsx("p",{className:"text-xs text-slate-500 mb-3",children:"Images, mockups, or product designs"}),i.jsx(Ot,{...W,type:"file",accept:"image/*,.pdf",multiple:!0,onChange:ie=>{K(ie.target.files)},className:"hidden",id:"assets-file-input"}),i.jsxs(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var ie;return(ie=document.getElementById("assets-file-input"))==null?void 0:ie.click()},children:[i.jsx(oI,{className:"mr-2 h-4 w-4"}),"Select Files"]}),I&&I.length>0&&i.jsxs("p",{className:"text-xs text-primary mt-2",children:[I.length," file(s) selected"]})]})}),i.jsx(fn,{children:"Upload visuals that you want feedback on during the session"}),i.jsx(ut,{})]})}),i.jsx("div",{className:"space-y-3",children:i.jsx("div",{className:"flex justify-end",children:i.jsxs(te,{type:"submit",disabled:u,className:"min-w-32",children:[i.jsx($a,{className:"mr-2 h-4 w-4"}),u?"Generating...":"Generate Discussion Guide"]})})})]})})}),i.jsx(Yt,{value:"review",children:i.jsxs("div",{className:"space-y-6",children:[i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("div",{className:"flex items-center justify-between mb-4",children:i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx("h3",{className:"font-sf text-lg font-medium",children:"AI-Generated Discussion Guide"}),m&&i.jsx(Wn,{variant:"outline",className:"text-xs",children:_(m)?"Structured JSON":"Legacy Text"})]})}),i.jsx("div",{className:"prose max-w-none",children:m?i.jsx(RN,{discussionGuide:m,showProgress:!1,collapsible:!0,defaultExpanded:!0,className:"border-0",onSave:ye,onDownload:Y,onSectionSelect:je,isDownloading:D,focusGroupId:b,onEditingChange:xe}):i.jsx("div",{className:"bg-slate-50 p-4 rounded border text-center text-slate-600",children:'No discussion guide generated yet. Complete the setup and click "Generate Discussion Guide" to create one.'})})]})}),O.length>0&&i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Uploaded Creative Assets"}),i.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-4",children:O.map((I,K)=>i.jsxs("div",{className:"border rounded-md p-2",children:[i.jsx("div",{className:"aspect-square bg-slate-100 rounded flex items-center justify-center mb-2",children:I.type.startsWith("image/")?i.jsx("img",{src:URL.createObjectURL(I),alt:`Asset ${K+1}`,className:"max-h-full max-w-full object-contain"}):i.jsx(dw,{className:"h-10 w-10 text-slate-400"})}),i.jsx("p",{className:"text-xs truncate",children:I.name})]},K))})]})}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx(te,{variant:"outline",onClick:()=>c("setup"),children:"Back to Setup"}),i.jsxs(te,{onClick:()=>c("participants"),children:["Select Participants",i.jsx(or,{className:"ml-2 h-4 w-4"})]})]})]})}),i.jsxs(Yt,{value:"participants",children:[i.jsxs("div",{className:"flex flex-col md:flex-row gap-6",children:[i.jsxs("div",{className:"w-full md:w-64 space-y-4",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"text-sm font-medium",children:"Folders"}),i.jsx(te,{variant:"ghost",size:"sm",onClick:()=>{console.log("Clicked 'Create new folder' button"),ge(!0)},className:"h-7 w-7 p-0",children:i.jsx(iI,{className:"h-4 w-4"})})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsxs("button",{onClick:()=>{console.log("Clicked 'All Personas' folder"),console.log("All personas count:",A.length),Z(Ho),setTimeout(()=>{console.log(`Will show all ${A.length} personas`)},0)},className:`w-full flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${q===Ho?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx("span",{children:"All Personas"})]}),T.map(I=>i.jsx("div",{className:"flex items-center justify-between group",children:se&&se.id===I.id?i.jsxs("div",{className:"flex-1 flex items-center px-3 py-2 space-x-2",children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx(Ot,{value:De,onChange:K=>de(K.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:K=>{K.key==="Enter"?Xn():K.key==="Escape"&&an()}}),i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming folder rename: "${se==null?void 0:se.name}" to "${De}"`),Xn()},className:"h-7 w-7 p-0",children:i.jsx(Ta,{className:"h-4 w-4"})}),i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Cancelling rename of folder: "${se==null?void 0:se.name}"`),an()},className:"h-7 w-7 p-0",children:i.jsx(Zs,{className:"h-4 w-4"})})]}):i.jsxs(i.Fragment,{children:[i.jsxs("button",{onClick:()=>{console.log(`Clicked folder: ${I.name} (ID: ${I.id})`);const K=I.personaIds.filter(W=>!!W);console.log(`Current persona count in folder: ${K.length}`),console.log("Folder personaIds:",K),console.log("All personas count:",A.length),Z(I.id),setTimeout(()=>{const W=A.filter(ie=>{if(ie.folderId===I.id)return!0;const he=ie.id||ie._id;return K.includes(he)});console.log(`Will show ${W.length} personas after filtering`),console.log("Filtered personas:",W.map(ie=>ie.name))},0)},className:`flex-1 flex items-center space-x-2 px-3 py-2 text-sm rounded-md text-left transition-colors ${q===I.id?"bg-primary/10 text-primary font-medium":"hover:bg-slate-100"}`,children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx("span",{children:I.name}),i.jsx("span",{className:"text-muted-foreground text-xs ml-auto",children:I.personaIds.filter(K=>!!K).length})]}),i.jsxs(Fw,{children:[i.jsx(Bw,{asChild:!0,children:i.jsx(te,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0 opacity-0 group-hover:opacity-100",children:i.jsx(uw,{className:"h-4 w-4"})})}),i.jsx(Og,{align:"end",children:i.jsx(Fi,{onClick:()=>{console.log(`Initiating rename for folder: ${I.name} (ID: ${I.id})`),Vt(I)},children:"Rename"})})]})]})},I.id)),re&&i.jsxs("div",{className:"flex items-center px-3 py-2 space-x-2",children:[i.jsxs("div",{className:"flex-1 flex items-center space-x-2",children:[i.jsx(Us,{className:"h-4 w-4"}),i.jsx(Ot,{value:B,onChange:I=>le(I.target.value),placeholder:"Folder name",className:"h-7 text-sm",autoFocus:!0,onKeyDown:I=>{I.key==="Enter"?Ze():I.key==="Escape"&&kt()}})]}),i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log(`Confirming creation of new folder: "${B}"`),Ze()},className:"h-7 w-7 p-0",children:i.jsx(Ta,{className:"h-4 w-4"})}),i.jsx(te,{size:"sm",variant:"ghost",onClick:()=>{console.log("Cancelling folder creation"),kt()},className:"h-7 w-7 p-0",children:i.jsx(Zs,{className:"h-4 w-4"})})]})]})]}),i.jsxs("div",{className:"flex-1",children:[i.jsx(rt,{className:"mb-4",children:i.jsx(bt,{className:"p-6",children:i.jsxs("div",{className:"flex flex-col space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("h3",{className:"font-sf text-lg font-medium",children:"Select Participants"}),i.jsxs("div",{className:"flex items-center",children:[i.jsx(or,{className:"h-5 w-5 mr-2 text-muted-foreground"}),i.jsxs("span",{className:"text-sm font-medium",children:[P.length," of ",Le.length," selected"]})]})]}),i.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(DS,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),i.jsx(Ot,{placeholder:"Search personas by name, occupation, or location...",className:"pl-10 bg-white",value:be,onChange:I=>Pe(I.target.value)})]}),i.jsxs(te,{variant:"outline",className:"flex items-center gap-2",onClick:()=>Je(!0),children:[i.jsx(IS,{className:"h-4 w-4"}),i.jsxs("span",{children:["Filter",Object.values(ve).some(I=>I.length>0)?` (${Object.values(ve).reduce((I,K)=>I+K.length,0)})`:""]})]})]}),L?i.jsx("div",{className:"flex justify-center items-center py-12",children:i.jsx(ii,{className:"h-8 w-8 animate-spin text-primary"})}):Le.length>0?i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Le.map(I=>{const K=I._id||I.id;return i.jsx(sN,{user:{id:K,_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:P.includes(K),onSelectionToggle:()=>ft(K),onViewDetails:Ie},K)})}):i.jsx("div",{className:"text-center py-12",children:i.jsx("p",{className:"text-muted-foreground",children:"No personas available matching your criteria."})})]})})}),i.jsxs("div",{className:"flex justify-between",children:[i.jsx(te,{variant:"outline",onClick:()=>c("review"),children:"Back to Review"}),i.jsxs(te,{onClick:Qe,disabled:P.length<1||!m,children:[i.jsx(AW,{className:"mr-2 h-4 w-4"}),"Start Focus Group Session"]})]})]})]}),i.jsx(wl,{open:ne,onOpenChange:I=>{I?(Je(I),Mt({...ve})):Je(!1)},children:i.jsxs(ho,{className:"max-w-4xl max-h-[80vh] overflow-y-auto",children:[i.jsxs(po,{children:[i.jsx(go,{children:"Filter Personas"}),i.jsx(jl,{children:"Select attributes to filter personas by. Multiple selections within a category use OR logic, different categories use AND logic."})]}),i.jsxs("div",{className:"py-4 space-y-6",children:[Object.values(st).some(I=>I.length>0)&&i.jsx("div",{className:"bg-muted/30 p-3 rounded-md",children:i.jsxs("p",{className:"text-sm text-muted-foreground",children:[Object.values(st).reduce((I,K)=>I+K.length,0)," active filters"]})}),(()=>{const I=we(A),K=Object.values(st).every(ie=>ie.length===0),W=(ie,he,ke=1)=>{const qe=K?I[he]:ze(he)[he],Ft=st[he],Wt=[...new Set([...qe,...Ft])].sort();return Wt.length===0?null:i.jsxs("div",{className:"mb-6",children:[i.jsx("h3",{className:"text-sm font-medium mb-3",children:ie}),i.jsx("div",{className:`grid grid-cols-1 ${ke===2?"sm:grid-cols-2":ke===3?"sm:grid-cols-2 md:grid-cols-3":""} gap-2`,children:Wt.map(It=>{const fa=st[he].includes(It),tc=qe.includes(It);return i.jsxs("div",{className:`flex items-center space-x-2 ${!tc&&!fa?"opacity-50":""}`,children:[i.jsx(ol,{id:`${he}-${It}`,checked:fa,onCheckedChange:()=>Ge(he,It),disabled:!tc&&!fa}),i.jsxs(vs,{htmlFor:`${he}-${It}`,className:"truncate overflow-hidden",children:[It,fa&&!tc&&i.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(no matches)"})]})]},It)})})]})};return i.jsxs(i.Fragment,{children:[W("Gender","gender",3),W("Age","age",3),W("Ethnicity","ethnicity",2),W("Location","location",2),W("Occupation","occupation",2),W("Tech Savviness","techSavviness",3),i.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6"})]})})()]}),i.jsxs(mo,{children:[i.jsx(te,{variant:"outline",onClick:jt,children:"Reset"}),i.jsx(te,{onClick:gt,children:"Apply Filters"})]})]})})]})]})]})]})}const AQ=[{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"}],CQ={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"},EQ=()=>{console.log("FocusGroups component rendering");const[e,t]=v.useState("view"),[n,r]=v.useState(""),[s,a]=v.useState([]),[o,l]=v.useState(!0),[c,u]=v.useState([]),[d,f]=v.useState(!1),[h,p]=v.useState(!1),[g,m]=v.useState(null),y=Tn(),b=qr(),[x,w]=v.useState([]),j=v.useRef(!0),S=async(A=!0)=>{if(console.log("fetchFocusGroups called with isMountedCheck:",A),console.log("isMounted.current:",j.current),A&&!j.current){console.log("Exiting early: component not mounted");return}console.log("Setting loading to true and making API call"),l(!0);try{console.log("Calling focusGroupsApi.getAll()");const $=await St.getAll();if(console.log("API response received:",$),!A||j.current){const L=$.data.map(H=>({...H,id:H.id||H._id,participants_count:Array.isArray(H.participants)?H.participants.length:typeof H.participants=="number"?H.participants:0}));a(L)}}catch($){console.error("Error fetching focus groups:",$),(!A||j.current)&&(Ke.error("Failed to load focus groups"),a(AQ))}finally{(!A||j.current)&&l(!1)}},N=async A=>{try{const $=await St.getById(A);$&&$.data&&(m($.data),t("create"))}catch($){console.error("Error fetching focus group for edit:",$),Ke.error("Failed to load focus group for editing")}};v.useEffect(()=>(console.log("useEffect running - about to fetch focus groups"),S(),()=>{console.log("useEffect cleanup - setting isMounted to false"),j.current=!1}),[]),v.useEffect(()=>{console.log("Mode change useEffect running, mode:",e),e==="view"&&(console.log("Mode is view, calling fetchFocusGroups"),S())},[e]),v.useEffect(()=>{const A=b.state;(A==null?void 0:A.mode)==="create"&&(A!=null&&A.preSelectedParticipants)&&(w(A.preSelectedParticipants),t("create"),y(b.pathname,{replace:!0,state:null}))},[b.state,b.pathname,y]),v.useEffect(()=>{const A=new URLSearchParams(b.search),$=A.get("mode"),L=A.get("id"),H=A.get("tab");if($==="create")t("create"),m(null);else if($==="edit"&&L){const D=s.find(V=>(V._id||V.id)===L);D?(m(D),t("create")):N(L)}if($||L||H){const D=b.pathname;y(D,{replace:!0})}},[b.search,s,y,b.pathname]);const _=s.filter(A=>A.name.toLowerCase().includes(n.toLowerCase())||A.topic.toLowerCase().includes(n.toLowerCase())),P=A=>new Date(A).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),k=A=>new Date(A).toLocaleTimeString("en-US",{hour:"numeric",minute:"2-digit",hour12:!0}),O=A=>{u($=>$.includes(A)?$.filter(L=>L!==A):[...$,A])},M=async()=>{if(c.length!==0){p(!0);try{const A=c.map($=>St.delete($));await Promise.all(A),a($=>$.filter(L=>!c.includes(L.id||L._id||""))),u([]),Ke.success(`${c.length} focus group${c.length>1?"s":""} deleted successfully`)}catch(A){console.error("Error deleting focus groups:",A),Ke.error("Failed to delete focus groups")}finally{p(!1),f(!1)}}};return i.jsxs("div",{className:"min-h-screen bg-slate-50",children:[i.jsx(oi,{}),i.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:"Focus Groups"}),i.jsx("p",{className:"text-slate-600 mt-1",children:"Set up and manage AI-moderated research sessions"})]}),i.jsx("div",{className:"mt-4 sm:mt-0",children:i.jsx(te,{onClick:()=>{console.log("Create New Focus Group button clicked, current mode:",e);try{e==="view"?(console.log("Setting draft to null and switching to create mode"),m(null),t("create")):(console.log("Switching back to view mode"),t("view"))}catch(A){console.error("Error in Create New Focus Group onClick:",A)}},className:"hover-transition",children:e==="view"?"Create New Focus Group":"View All Focus Groups"})})]}),e==="view"?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[i.jsxs("div",{className:"relative flex-1",children:[i.jsx(DS,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 text-muted-foreground h-4 w-4"}),i.jsx(Ot,{placeholder:"Search focus groups by name or topic...",className:"pl-10 bg-white",value:n,onChange:A=>r(A.target.value)})]}),i.jsxs(te,{variant:"outline",className:"flex items-center gap-2",children:[i.jsx(IS,{className:"h-4 w-4"}),i.jsx("span",{children:"Filter"})]})]}),i.jsxs("div",{className:"glass-panel rounded-xl p-6",children:[i.jsxs("div",{className:"flex items-center justify-between mb-6",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx($a,{className:"h-5 w-5 text-primary"}),i.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Your Focus Groups"})]}),c.length>0&&i.jsxs(te,{variant:"destructive",size:"sm",onClick:()=>f(!0),disabled:h,className:"flex items-center gap-2",children:[i.jsx(_n,{className:"h-4 w-4"}),"Delete Selected (",c.length,")"]})]}),o?i.jsx("div",{className:"flex justify-center items-center py-12",children:i.jsx(ii,{className:"h-8 w-8 animate-spin text-primary"})}):_.length>0?i.jsx("div",{className:"space-y-4",children:_.map(A=>i.jsx("div",{className:"glass-card rounded-xl overflow-hidden hover:shadow-md button-transition",children:i.jsxs("div",{className:"flex flex-col md:flex-row",children:[i.jsxs("div",{className:"flex-1 p-6",children:[i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex items-start gap-3",children:[i.jsx(ol,{id:`select-${A.id||A._id}`,checked:c.includes(A.id||A._id||""),onCheckedChange:()=>O(A.id||A._id||""),className:"mt-1"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-sf text-lg font-semibold mb-2",children:A.name}),i.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(uW,{className:"h-4 w-4 mr-1"}),P(A.date)]}),i.jsxs("div",{className:"flex items-center",children:[i.jsx(Uf,{className:"h-4 w-4 mr-1"}),k(A.date)]}),i.jsxs("div",{className:"flex items-center",children:[i.jsx(or,{className:"h-4 w-4 mr-1"}),A.participants_count||(Array.isArray(A.participants)?A.participants.length:0)," participant",A.participants_count>1||Array.isArray(A.participants)&&A.participants.length>1?"s":""]}),i.jsxs("div",{className:"flex items-center",children:[i.jsx(Uf,{className:"h-4 w-4 mr-1"}),A.duration," min"]})]})]})]}),i.jsxs("div",{className:Me("px-3 py-1 rounded-full text-xs font-medium border",CQ[A.status]||"bg-gray-100 text-gray-800 border-gray-200"),children:[A.status==="completed"&&"Completed",A.status==="scheduled"&&"Scheduled",A.status==="in-progress"&&"In Progress",A.status==="active"&&"In Progress",A.status==="ai_mode"&&"In Progress",A.status==="paused"&&"Paused",A.status==="new"&&"Not Started",A.status==="draft"&&"Draft",!["completed","scheduled","in-progress","active","ai_mode","paused","new","draft"].includes(A.status)&&A.status]})]}),i.jsxs("div",{className:"mt-4 flex flex-wrap gap-2",children:[i.jsxs("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:[A.topic==="user-experience"&&"User Experience",A.topic==="product-feedback"&&"Product Feedback",A.topic==="creative-testing"&&"Creative Testing",A.topic==="messaging-evaluation"&&"Messaging Evaluation",A.topic&&!["user-experience","product-feedback","creative-testing","messaging-evaluation"].includes(A.topic)&&A.topic.charAt(0).toUpperCase()+A.topic.slice(1).replace(/-/g," ")]}),i.jsx("div",{className:"px-3 py-1 bg-slate-100 rounded-full text-xs font-medium text-slate-800",children:"AI Moderated"})]})]}),i.jsx("div",{className:"bg-slate-50 p-6 flex flex-col justify-center items-center md:border-l border-slate-100",children:i.jsx(te,{variant:A.status==="in-progress"||A.status==="active"||A.status==="ai_mode"?"default":A.status==="new"||A.status==="draft"?"outline":"default",className:Me("w-full hover-transition",A.status==="new"?"bg-slate-200 text-slate-700 hover:bg-slate-300 border-slate-300":"",A.status==="draft"?"bg-gray-200 text-gray-700 hover:bg-gray-300 border-gray-300":""),onClick:()=>{if(A.status==="draft")m(A),t("create");else{const $=A.id||A._id;console.log("Navigating to focus group:",$),y(`/focus-groups/${$}`)}},children:A.status==="completed"?i.jsxs(i.Fragment,{children:["View Session",i.jsx(zs,{className:"ml-2 h-4 w-4"})]}):A.status==="in-progress"||A.status==="active"||A.status==="ai_mode"?i.jsxs(i.Fragment,{children:["Join Session",i.jsx(zs,{className:"ml-2 h-4 w-4"})]}):A.status==="paused"?i.jsxs(i.Fragment,{children:["Session Details",i.jsx(zs,{className:"ml-2 h-4 w-4"})]}):A.status==="scheduled"?i.jsxs(i.Fragment,{children:["View Details",i.jsx(zs,{className:"ml-2 h-4 w-4"})]}):A.status==="new"?i.jsxs(i.Fragment,{children:["View Session",i.jsx(zs,{className:"ml-2 h-4 w-4"})]}):A.status==="draft"?i.jsxs(i.Fragment,{children:["Edit",i.jsx(zs,{className:"ml-2 h-4 w-4"})]}):i.jsxs(i.Fragment,{children:["View Session",i.jsx(zs,{className:"ml-2 h-4 w-4"})]})})})]})},A.id))}):i.jsx("div",{className:"text-center py-12",children:i.jsx("p",{className:"text-muted-foreground",children:"No focus groups found matching your search criteria."})})]})]}):i.jsx(PQ,{draftToEdit:g,preSelectedParticipants:x,onDraftSaved:()=>{m(null),t("view"),w([]),S()}})]}),i.jsx(zw,{open:d,onOpenChange:f,children:i.jsxs(Tg,{children:[i.jsxs($g,{children:[i.jsxs(Ig,{children:["Delete ",c.length," Focus Group",c.length!==1?"s":"","?"]}),i.jsxs(Rg,{children:["This action cannot be undone. This will permanently delete the selected focus group",c.length!==1?"s":""," and remove all data associated with ",c.length!==1?"them":"it","."]})]}),i.jsxs(Mg,{children:[i.jsx(Lg,{disabled:h,children:"Cancel"}),i.jsx(Dg,{onClick:A=>{A.preventDefault(),M()},disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:h?i.jsxs(i.Fragment,{children:[i.jsx(ii,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting..."]}):i.jsx(i.Fragment,{children:"Delete"})})]})]})})]})},OQ=({participants:e,selectedParticipantIds:t,onToggleParticipantFilter:n})=>{const r=Tn(),s=o=>{const l=o.id||o._id;l&&r(`/personas/${l}`)},a=o=>{const l=o.id||o._id;l&&n(l)};return i.jsx("div",{className:"w-full lg:w-64 shrink-0",children:i.jsxs("div",{className:"glass-panel rounded-xl p-4",children:[i.jsxs("h2",{className:"font-sf text-lg font-semibold flex items-center mb-3",children:[i.jsx(or,{className:"h-5 w-5 text-primary mr-2"})," Participants"]}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-center p-2 bg-primary/5 rounded-lg",children:[i.jsx(fo,{className:"h-8 w-8 text-primary mr-3"}),i.jsxs("div",{children:[i.jsx("p",{className:"font-medium text-primary",children:"AI Moderator"}),i.jsx("p",{className:"text-xs text-slate-500",children:"Session facilitator"})]})]}),e.map(o=>{const l=o.id||o._id,c=t.includes(l);return i.jsxs("div",{className:`flex items-center p-2 rounded-lg transition-colors ${c?"bg-blue-50 border border-blue-200":"hover:bg-slate-100"}`,children:[i.jsx("div",{className:"cursor-pointer mr-3",onClick:()=>s(o),title:`View ${o.name}'s profile`,children:i.jsx("img",{src:lp(o),alt:o.name,className:"h-8 w-8 rounded-full object-cover"})}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx("p",{className:"font-medium cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>a(o),title:`Filter to show only ${o.name}'s messages`,children:o.name}),c&&i.jsx(Ta,{className:"h-4 w-4 text-blue-600 ml-2"})]}),i.jsx("p",{className:"text-xs text-slate-500",children:o.occupation})]})]},o.id)})]})]})})};function kQ(e,t){return v.useReducer((n,r)=>t[n][r]??n,e)}var DN="ScrollArea",[YL,RPe]=Gr(DN),[TQ,Os]=YL(DN),ZL=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:a=600,...o}=e,[l,c]=v.useState(null),[u,d]=v.useState(null),[f,h]=v.useState(null),[p,g]=v.useState(null),[m,y]=v.useState(null),[b,x]=v.useState(0),[w,j]=v.useState(0),[S,N]=v.useState(!1),[_,P]=v.useState(!1),k=xt(t,M=>c(M)),O=Xl(s);return i.jsx(TQ,{scope:n,type:r,dir:O,scrollHideDelay:a,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:p,onScrollbarXChange:g,scrollbarXEnabled:S,onScrollbarXEnabledChange:N,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:_,onScrollbarYEnabledChange:P,onCornerWidthChange:x,onCornerHeightChange:j,children:i.jsx(Ye.div,{dir:O,...o,ref:k,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...e.style}})})});ZL.displayName=DN;var QL="ScrollAreaViewport",JL=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,asChild:s,nonce:a,...o}=e,l=Os(QL,n),c=v.useRef(null),u=xt(t,c,l.onViewportChange);return i.jsxs(i.Fragment,{children:[i.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:a}),i.jsx(Ye.div,{"data-radix-scroll-area-viewport":"",...o,asChild:s,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:UQ({asChild:s,children:r},d=>i.jsx("div",{"data-radix-scroll-area-content":"",ref:l.onContentChange,style:{minWidth:l.scrollbarXEnabled?"fit-content":void 0},children:d}))})]})});JL.displayName=QL;var La="ScrollAreaScrollbar",LN=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Os(La,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=s,l=e.orientation==="horizontal";return v.useEffect(()=>(l?a(!0):o(!0),()=>{l?a(!1):o(!1)}),[l,a,o]),s.type==="hover"?i.jsx($Q,{...r,ref:t,forceMount:n}):s.type==="scroll"?i.jsx(MQ,{...r,ref:t,forceMount:n}):s.type==="auto"?i.jsx(e3,{...r,ref:t,forceMount:n}):s.type==="always"?i.jsx(FN,{...r,ref:t}):null});LN.displayName=La;var $Q=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Os(La,e.__scopeScrollArea),[a,o]=v.useState(!1);return v.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const u=()=>{window.clearTimeout(c),o(!0)},d=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[s.scrollArea,s.scrollHideDelay]),i.jsx(lr,{present:n||a,children:i.jsx(e3,{"data-state":a?"visible":"hidden",...r,ref:t})})}),MQ=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=Os(La,e.__scopeScrollArea),a=e.orientation==="horizontal",o=zy(()=>c("SCROLL_END"),100),[l,c]=kQ("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 v.useEffect(()=>{if(l==="idle"){const u=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[l,s.scrollHideDelay,c]),v.useEffect(()=>{const u=s.viewport,d=a?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const p=u[d];f!==p&&(c("SCROLL"),o()),f=p};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[s.viewport,a,c,o]),i.jsx(lr,{present:n||l!=="hidden",children:i.jsx(FN,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Ee(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ee(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),e3=v.forwardRef((e,t)=>{const n=Os(La,e.__scopeScrollArea),{forceMount:r,...s}=e,[a,o]=v.useState(!1),l=e.orientation==="horizontal",c=zy(()=>{if(n.viewport){const u=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,s=Os(La,e.__scopeScrollArea),a=v.useRef(null),o=v.useRef(0),[l,c]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=a3(l.viewport,l.content),d={...r,sizes:l,onSizesChange:c,hasThumb:u>0&&u<1,onThumbChange:h=>a.current=h,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:h=>o.current=h};function f(h,p){return BQ(h,o.current,l,p)}return n==="horizontal"?i.jsx(IQ,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&a.current){const h=s.viewport.scrollLeft,p=CC(h,l,s.dir);a.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=f(h,s.dir))}}):n==="vertical"?i.jsx(RQ,{...d,ref:t,onThumbPositionChange:()=>{if(s.viewport&&a.current){const h=s.viewport.scrollTop,p=CC(h,l);a.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=f(h))}}):null}),IQ=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,a=Os(La,e.__scopeScrollArea),[o,l]=v.useState(),c=v.useRef(null),u=xt(t,c,a.onScrollbarXChange);return v.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),i.jsx(n3,{"data-orientation":"horizontal",...s,ref:u,sizes:n,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":By(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,f)=>{if(a.viewport){const h=a.viewport.scrollLeft+d.deltaX;e.onWheelScroll(h),o3(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:Bg(o.paddingLeft),paddingEnd:Bg(o.paddingRight)}})}})}),RQ=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...s}=e,a=Os(La,e.__scopeScrollArea),[o,l]=v.useState(),c=v.useRef(null),u=xt(t,c,a.onScrollbarYChange);return v.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),i.jsx(n3,{"data-orientation":"vertical",...s,ref:u,sizes:n,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":By(n)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,f)=>{if(a.viewport){const h=a.viewport.scrollTop+d.deltaY;e.onWheelScroll(h),o3(h,f)&&d.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:Bg(o.paddingTop),paddingEnd:Bg(o.paddingBottom)}})}})}),[DQ,t3]=YL(La),n3=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:u,onWheelScroll:d,onResize:f,...h}=e,p=Os(La,n),[g,m]=v.useState(null),y=xt(t,k=>m(k)),b=v.useRef(null),x=v.useRef(""),w=p.viewport,j=r.content-r.viewport,S=Hn(d),N=Hn(c),_=zy(f,10);function P(k){if(b.current){const O=k.clientX-b.current.left,M=k.clientY-b.current.top;u({x:O,y:M})}}return v.useEffect(()=>{const k=O=>{const M=O.target;(g==null?void 0:g.contains(M))&&S(O,j)};return document.addEventListener("wheel",k,{passive:!1}),()=>document.removeEventListener("wheel",k,{passive:!1})},[w,g,j,S]),v.useEffect(N,[r,N]),hu(g,_),hu(p.content,_),i.jsx(DQ,{scope:n,scrollbar:g,hasThumb:s,onThumbChange:Hn(a),onThumbPointerUp:Hn(o),onThumbPositionChange:N,onThumbPointerDown:Hn(l),children:i.jsx(Ye.div,{...h,ref:y,style:{position:"absolute",...h.style},onPointerDown:Ee(e.onPointerDown,k=>{k.button===0&&(k.target.setPointerCapture(k.pointerId),b.current=g.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),P(k))}),onPointerMove:Ee(e.onPointerMove,P),onPointerUp:Ee(e.onPointerUp,k=>{const O=k.target;O.hasPointerCapture(k.pointerId)&&O.releasePointerCapture(k.pointerId),document.body.style.webkitUserSelect=x.current,p.viewport&&(p.viewport.style.scrollBehavior=""),b.current=null})})})}),Fg="ScrollAreaThumb",r3=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,s=t3(Fg,e.__scopeScrollArea);return i.jsx(lr,{present:n||s.hasThumb,children:i.jsx(LQ,{ref:t,...r})})}),LQ=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...s}=e,a=Os(Fg,n),o=t3(Fg,n),{onThumbPositionChange:l}=o,c=xt(t,f=>o.onThumbChange(f)),u=v.useRef(),d=zy(()=>{u.current&&(u.current(),u.current=void 0)},100);return v.useEffect(()=>{const f=a.viewport;if(f){const h=()=>{if(d(),!u.current){const p=zQ(f,l);u.current=p,l()}};return l(),f.addEventListener("scroll",h),()=>f.removeEventListener("scroll",h)}},[a.viewport,d,l]),i.jsx(Ye.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ee(e.onPointerDownCapture,f=>{const p=f.target.getBoundingClientRect(),g=f.clientX-p.left,m=f.clientY-p.top;o.onThumbPointerDown({x:g,y:m})}),onPointerUp:Ee(e.onPointerUp,o.onThumbPointerUp)})});r3.displayName=Fg;var BN="ScrollAreaCorner",s3=v.forwardRef((e,t)=>{const n=Os(BN,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?i.jsx(FQ,{...e,ref:t}):null});s3.displayName=BN;var FQ=v.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,s=Os(BN,n),[a,o]=v.useState(0),[l,c]=v.useState(0),u=!!(a&&l);return hu(s.scrollbarX,()=>{var f;const d=((f=s.scrollbarX)==null?void 0:f.offsetHeight)||0;s.onCornerHeightChange(d),c(d)}),hu(s.scrollbarY,()=>{var f;const d=((f=s.scrollbarY)==null?void 0:f.offsetWidth)||0;s.onCornerWidthChange(d),o(d)}),u?i.jsx(Ye.div,{...r,ref:t,style:{width:a,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Bg(e){return e?parseInt(e,10):0}function a3(e,t){const n=e/t;return isNaN(n)?0:n}function By(e){const t=a3(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function BQ(e,t,n,r="ltr"){const s=By(n),a=s/2,o=t||a,l=s-o,c=n.scrollbar.paddingStart+o,u=n.scrollbar.size-n.scrollbar.paddingEnd-l,d=n.content-n.viewport,f=r==="ltr"?[0,d]:[d*-1,0];return i3([c,u],f)(e)}function CC(e,t,n="ltr"){const r=By(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-s,o=t.content-t.viewport,l=a-r,c=n==="ltr"?[0,o]:[o*-1,0],u=sh(e,c);return i3([0,o],[0,l])(u)}function i3(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function o3(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function s(){const a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,l=n.top!==a.top;(o||l)&&t(),n=a,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function zy(e,t){const n=Hn(e),r=v.useRef(0);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),v.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function hu(e,t){const n=Hn(t);ir(()=>{let r=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(e),()=>{window.cancelAnimationFrame(r),s.unobserve(e)}}},[e,n])}function UQ(e,t){const{asChild:n,children:r}=e;if(!n)return typeof t=="function"?t(r):t;const s=v.Children.only(r);return v.cloneElement(s,{children:typeof t=="function"?t(s.props.children):t})}var l3=ZL,VQ=JL,WQ=s3;const Uy=v.forwardRef(({className:e,children:t,...n},r)=>i.jsxs(l3,{ref:r,className:Me("relative overflow-hidden",e),...n,children:[i.jsx(VQ,{className:"h-full w-full rounded-[inherit]",children:t}),i.jsx(c3,{}),i.jsx(WQ,{})]}));Uy.displayName=l3.displayName;const c3=v.forwardRef(({className:e,orientation:t="vertical",...n},r)=>i.jsx(LN,{ref:r,orientation:t,className:Me("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:i.jsx(r3,{className:"relative flex-1 rounded-full bg-border"})}));c3.displayName=LN.displayName;const HQ=({participants:e,isVisible:t,selectedIndex:n,onSelect:r,onClose:s,position:a})=>{const o=v.useRef(null);return v.useEffect(()=>{const l=c=>{o.current&&!o.current.contains(c.target)&&s()};if(t)return document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)},[t,s]),v.useEffect(()=>{if(t&&n>=0&&o.current){const l=o.current.children[n];l&&l.scrollIntoView({block:"nearest",behavior:"smooth"})}},[n,t]),!t||e.length===0?null:i.jsxs("div",{ref:o,className:"absolute z-50 w-64 max-h-48 overflow-y-auto bg-white border border-slate-200 rounded-lg shadow-lg",style:{top:a.top,left:a.left},children:[e.map((l,c)=>{const u=l.id||l._id,d=c===n;return i.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(l),children:[i.jsx("img",{src:lp(l),alt:l.name,className:"h-8 w-8 rounded-full object-cover mr-3 flex-shrink-0"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("p",{className:`font-medium truncate ${d?"text-blue-900":"text-slate-900"}`,children:l.name}),i.jsx("p",{className:`text-sm truncate ${d?"text-blue-600":"text-slate-500"}`,children:l.occupation})]})]},u)}),e.length===0&&i.jsx("div",{className:"p-3 text-center text-slate-500 text-sm",children:"No participants found"})]})};function Vw(e,t){const n=[],r=[],s=/@(\w+(?:\s+\w+)*)/g;let a;for(;(a=s.exec(e))!==null;){const o=a[1],l=a.index,c=a.index+a[0].length,u=t.find(d=>d.name.toLowerCase()===o.toLowerCase());if(u){const d=u.id||u._id;d&&(n.push({id:d,name:u.name,startIndex:l,endIndex:c}),r.includes(d)||r.push(d))}}return{text:e,mentions:n,mentionedParticipantIds:r}}function GQ(e,t){if(t.length===0)return[e];const n=[];let r=0;return[...t].sort((a,o)=>a.startIndex-o.startIndex).forEach((a,o)=>{a.startIndex>r&&n.push(e.slice(r,a.startIndex)),n.push(E.createElement("span",{key:`mention-${o}`,className:"text-blue-600 bg-blue-50 px-1 rounded font-medium"},`@${a.name}`)),r=a.endIndex}),r=0;n--){const r=e[n];if(r==="@"){if(n===0||/\s/.test(e[n-1]))return n}else if(/\s/.test(r))break}return null}function XQ(e,t,n){return e.slice(t+1,n).toLowerCase()}function YQ(e,t){return t?e.filter(n=>n.name.toLowerCase().includes(t)):e}const u3=v.forwardRef(({value:e,onChange:t,participants:n,placeholder:r="Ask a question or provide guidance...",className:s="",disabled:a=!1},o)=>{const[l,c]=v.useState(!1),[u,d]=v.useState(0),[f,h]=v.useState({top:0,left:0}),[p,g]=v.useState(null),[m,y]=v.useState([]),b=v.useRef(null),x=v.useRef(null);v.useEffect(()=>{o&&b.current&&(typeof o=="function"?o(b.current):o.current=b.current)},[o]);const w=()=>{if(b.current&&x.current&&p!==null){const P=b.current,k=x.current,O=document.createElement("div");O.style.position="absolute",O.style.visibility="hidden",O.style.whiteSpace="pre",O.style.font=window.getComputedStyle(P).font,O.textContent=e.slice(0,p),document.body.appendChild(O);const M=O.offsetWidth;document.body.removeChild(O);const A=k.getBoundingClientRect(),$=P.getBoundingClientRect();h({top:$.height+4,left:Math.min(M,A.width-280)})}},j=P=>{const k=P.target.value,O=P.target.selectionStart||0,M=KQ(k,O);if(M!==null&&n.length>0){const $=XQ(k,M,O),L=YQ(n,$);g(M),y(L),d(0),c(!0)}else c(!1),g(null);const A=Vw(k,n);t(k,A)},S=P=>{if(l&&m.length>0)switch(P.key){case"ArrowDown":P.preventDefault(),d(k=>kk>0?k-1:m.length-1);break;case"Enter":case"Tab":P.preventDefault(),m[u]&&N(m[u]);break;case"Escape":P.preventDefault(),c(!1);break}},N=P=>{if(p!==null&&b.current){const k=b.current.selectionStart||0,{newText:O,newCursorPosition:M}=qQ(e,k,P,p),A=Vw(O,n);t(O,A),setTimeout(()=>{b.current&&(b.current.focus(),b.current.setSelectionRange(M,M))},0),c(!1),g(null)}},_=()=>{c(!1),g(null)};return v.useEffect(()=>{l&&p!==null&&w()},[l,p,e]),i.jsxs("div",{ref:x,className:`relative ${s}`,children:[i.jsx("input",{ref:b,type:"text",value:e,onChange:j,onKeyDown:S,placeholder:r,disabled:a,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"}),i.jsx(HQ,{participants:m,isVisible:l,selectedIndex:u,onSelect:N,onClose:_,position:f})]})});u3.displayName="MentionInput";const ZQ=({message:e,persona:t,toggleHighlight:n,participants:r=[],focusGroupId:s})=>{const[a,o]=v.useState(!1),l=e.senderId==="moderator",c=e.senderId==="facilitator",u=Vw(e.text,r),d=GQ(e.text,u.mentions),h=(m=>{const y=[/titled\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/asset\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/image\s+['"]([^'"]+\.(jpg|jpeg|png))['\"]/i,/['"]([a-zA-Z0-9_\-]+\.(jpg|jpeg|png))['\"]/i,/(fg-[a-f0-9]+-[a-f0-9]{32}\.(jpg|jpeg|png))/i];for(const b of y){const x=m.match(b);if(x)return x[1]}return null})(e.text),p=(l||c)&&h&&s,g=()=>{n()};return i.jsxs("div",{id:`message-${e.id}`,className:Me("flex items-start p-3 rounded-lg transition-colors",e.highlighted?"bg-amber-50 border border-amber-200":"hover:bg-slate-50",l?"border-l-4 border-l-primary pl-4":"",c?"border-l-4 border-l-green-500 pl-4":""),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),"data-highlighted":e.highlighted?"true":"false",children:[i.jsx("div",{className:"flex-shrink-0 mr-3",children:l?i.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:i.jsx(fo,{className:"h-6 w-6 text-primary"})}):c?i.jsx("div",{className:"bg-green-100 p-2 rounded-full",children:i.jsx(fg,{className:"h-6 w-6 text-green-600"})}):t?i.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:i.jsx("img",{src:lp(t),alt:`${t.name} avatar`,className:"h-6 w-6 rounded-full object-cover"})}):i.jsx("div",{className:"bg-slate-100 p-2 rounded-full",children:i.jsx(pW,{className:"h-6 w-6 text-slate-600"})})}),i.jsxs("div",{className:"flex-1",children:[i.jsxs("div",{className:"flex items-center mb-1",children:[i.jsx("span",{className:"font-medium mr-2",children:l?"AI Moderator":c?"Human Facilitator":(t==null?void 0:t.name)||"Unknown"}),!l&&!c&&t&&i.jsx(Wn,{variant:"outline",className:"text-xs font-normal",children:t.occupation}),i.jsx("span",{className:"text-xs text-slate-500 ml-auto",children:e.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]}),i.jsx("p",{className:"text-slate-700",children:d}),p&&i.jsxs("div",{className:"mt-3 p-3 border rounded-lg bg-slate-50",children:[i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(_m,{className:"h-4 w-4 text-slate-600"}),i.jsx("span",{className:"text-sm font-medium text-slate-700",children:"Creative Asset"})]}),i.jsx("img",{src:St.getAssetUrl(s,h),alt:"Creative asset for review",className:"max-w-full h-auto rounded border shadow-sm",style:{maxHeight:"300px"},onError:m=>{var b;console.error("Failed to load creative asset:",St.getAssetUrl(s,h)),m.currentTarget.style.display="none";const y=document.createElement("div");y.className="text-xs text-slate-500 italic p-2 border rounded bg-slate-100",y.textContent=`Creative asset not found: ${h}`,(b=m.currentTarget.parentNode)==null||b.appendChild(y)}})]}),i.jsx("div",{className:Me("flex mt-2 space-x-2",!a&&!e.highlighted&&"hidden"),children:i.jsxs(te,{variant:"ghost",size:"sm",onClick:g,className:"h-8 px-2 text-xs",children:[i.jsx($W,{className:Me("h-3 w-3 mr-1",e.highlighted?"fill-amber-400 text-amber-400":"text-slate-400")}),e.highlighted?"Highlighted":"Highlight"]})})]})]})},QQ=({action:e})=>{switch(e){case"moderator_speak":return i.jsx($a,{className:"h-4 w-4 text-blue-500"});case"participant_respond":return i.jsx(or,{className:"h-4 w-4 text-green-500"});case"participant_interaction":return i.jsx(or,{className:"h-4 w-4 text-purple-500"});case"probe_trigger":return i.jsx(lI,{className:"h-4 w-4 text-orange-500"});case"end_session":return i.jsx(RW,{className:"h-4 w-4 text-red-500"});default:return i.jsx(kl,{className:"h-4 w-4 text-gray-500"})}},JQ=({status:e})=>{switch(e){case"success":return i.jsx($S,{className:"h-3 w-3 text-green-500"});case"error":return i.jsx(mW,{className:"h-3 w-3 text-red-500"});case"pending":return i.jsx(Uf,{className:"h-3 w-3 text-yellow-500 animate-pulse"});default:return null}},eJ=({action:e})=>({moderator_speak:"Moderator",participant_respond:"Participant Response",participant_interaction:"Participant Interaction",probe_trigger:"Probe Question",end_session:"End Session"})[e]||e,tJ=e=>{try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}},nJ=({entry:e,isLatest:t})=>{const[n,r]=v.useState(t);return i.jsx(rt,{className:`mb-2 ${t?"ring-2 ring-blue-200 bg-blue-50/50":""}`,children:i.jsxs(cp,{open:n,onOpenChange:r,children:[i.jsx(up,{asChild:!0,children:i.jsx(Dr,{className:"pb-2 cursor-pointer hover:bg-gray-50/50 transition-colors",children:i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(QQ,{action:e.action}),i.jsxs("div",{className:"flex flex-col",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("span",{className:"font-medium text-sm",children:i.jsx(eJ,{action:e.action})}),i.jsx(JQ,{status:e.execution_status})]}),i.jsx("span",{className:"text-xs text-gray-500",children:tJ(e.timestamp)})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[t&&i.jsx(Wn,{variant:"secondary",className:"text-xs",children:"Latest"}),n?i.jsx(Tl,{className:"h-4 w-4 text-gray-400"}):i.jsx(yi,{className:"h-4 w-4 text-gray-400"})]})]})})}),i.jsx(dp,{children:i.jsx(bt,{className:"pt-0",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"AI Reasoning:"}),i.jsxs("p",{className:"text-sm text-gray-600 bg-gray-50 p-2 rounded italic",children:['"',e.reasoning,'"']})]}),e.details&&Object.keys(e.details).length>0&&i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Details:"}),i.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded font-mono",children:JSON.stringify(e.details,null,2)})]}),e.execution_result&&i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium text-gray-700 mb-1",children:"Execution Result:"}),i.jsx("div",{className:"text-xs text-gray-600 bg-gray-50 p-2 rounded",children:e.execution_result.error?i.jsxs("span",{className:"text-red-600",children:["Error: ",e.execution_result.error]}):i.jsx("span",{className:"text-green-600",children:e.execution_result.message||"Success"})})]})]})})})]})})},rJ=({reasoningHistory:e,isVisible:t,onToggle:n,isAiMode:r=!1})=>{const[s,a]=v.useState(!0);return v.useEffect(()=>{if(s&&e.length>0){const o=document.getElementById("reasoning-panel-content");o&&(o.scrollTop=0)}},[e.length,s]),i.jsx("div",{className:"border-t border-gray-200 bg-white",children:i.jsxs(cp,{open:t,onOpenChange:n,children:[i.jsx(up,{asChild:!0,children:i.jsxs("div",{className:"flex items-center justify-between p-3 cursor-pointer hover:bg-gray-50 transition-colors",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(kl,{className:"h-4 w-4 text-purple-600"}),i.jsx("span",{className:"font-medium text-sm",children:r?"AI Decision Reasoning":"AI Moderator Logic"}),r&&e.length>0&&i.jsx(Wn,{variant:"outline",className:"text-xs",children:e.length}),!r&&i.jsx(Wn,{variant:"secondary",className:"text-xs",children:"Manual Mode"})]}),t?i.jsx(Tl,{className:"h-4 w-4 text-gray-400"}):i.jsx(yi,{className:"h-4 w-4 text-gray-400"})]})}),i.jsx(dp,{children:i.jsx("div",{className:"border-t border-gray-100",children:r?e.length===0?i.jsxs("div",{className:"p-4 text-center text-gray-500",children:[i.jsx(kl,{className:"h-8 w-8 mx-auto mb-2 text-gray-300"}),i.jsx("p",{className:"text-sm",children:"No AI decisions yet"}),i.jsx("p",{className:"text-xs text-gray-400",children:"Reasoning will appear here when the AI makes decisions"})]}):i.jsx(Uy,{id:"reasoning-panel-content",className:"h-[25vh] p-3",children:i.jsx("div",{className:"space-y-2",children:e.map((o,l)=>i.jsx(nJ,{entry:o,isLatest:l===0},`${o.timestamp}-${l}`))})}):i.jsxs("div",{className:"p-4 text-center text-gray-500",children:[i.jsx(LS,{className:"h-8 w-8 mx-auto mb-2 text-gray-400"}),i.jsx("p",{className:"text-sm font-medium text-gray-700",children:"Manual Moderation Mode"}),i.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"You are currently moderating the discussion manually."}),i.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"Switch to AI Mode to see automated reasoning and decisions."})]})})})]})})},sJ=({modeEvent:e})=>{const t=s=>s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=s=>{switch(s){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=s=>{switch(s){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 i.jsxs("div",{className:"flex items-center my-6 px-4",children:[i.jsx("div",{className:"flex-1 border-t border-gray-200"}),i.jsx("div",{className:`mx-4 px-3 py-1 bg-white border border-gray-200 rounded-full ${r(e.event_type)}`,children:i.jsxs("div",{className:"flex items-center space-x-2 text-xs font-medium",children:[i.jsx("span",{children:n(e.event_type)}),i.jsx("span",{className:"text-gray-400",children:"at"}),i.jsx("span",{children:t(e.timestamp)})]})}),i.jsx("div",{className:"flex-1 border-t border-gray-200"})]})},aJ=({messages:e,modeEvents:t,personas:n,isSpeaking:r,focusGroupId:s,isAiModeActive:a=!1,selectedParticipantIds:o,onToggleHighlight:l,onAdvanceDiscussion:c,onNewMessage:u,onStatusChange:d,isEditingDiscussionGuide:f=!1})=>{const[h,p]=v.useState(""),[g,m]=v.useState(null),[y,b]=v.useState(!1),[x,w]=v.useState(null),j=v.useRef(null),[S,N]=v.useState(-1),[_,P]=v.useState(!1),k=v.useRef(0),O=v.useRef(null),M=v.useRef(1e4),A=v.useRef(null),[$,L]=v.useState(!1),[H,D]=v.useState(!1),[V,T]=v.useState(!1),[F,q]=v.useState(null),Z=F!==null?F:a,[re,ge]=v.useState([]),[B,le]=v.useState(!1),se=B;v.useEffect(()=>{a&&s&&ce()},[a,s]);const ce=async()=>{if(s)try{a&&De()}catch(z){console.error("Error checking autonomous status:",z)}},De=async()=>{if(s)try{const z=await jn.getReasoningHistory(s);ge(z.data.reasoning_history||[])}catch(z){console.error("Error fetching reasoning history:",z)}};v.useEffect(()=>{$&&ne()},[e,$]),v.useEffect(()=>{let z;return a&&s&&(z=setInterval(()=>{De(),ce()},5e3)),()=>{z&&clearInterval(z)}},[a,s]),v.useEffect(()=>{k.current=e.length},[]),v.useEffect(()=>{const z=e.length,ee=k.current;if(_&&z>ee){const me=Date.now(),Se=O.current;if(Se&&me-Se>=M.current)b(!1),P(!1),O.current=null;else if(Se){const Ie=M.current-(me-Se);setTimeout(()=>{b(!1),P(!1),O.current=null},Math.max(0,Ie))}else b(!1),P(!1)}k.current=z},[e.length,_]);const de=z=>n.find(ee=>ee.id===z||ee._id===z),be=o.length===0?e:e.filter(z=>z.senderId==="moderator"||z.senderId==="facilitator"||o.includes(z.senderId)),Pe=()=>{const z=[];return be.forEach(ee=>{z.push({type:"message",data:ee,timestamp:ee.timestamp})}),t.forEach(ee=>{z.push({type:"mode_event",data:ee,timestamp:ee.timestamp})}),z.sort((ee,me)=>ee.timestamp.getTime()-me.timestamp.getTime())},ne=()=>{if(!f&&A.current){const z=A.current.closest("[data-radix-scroll-area-viewport]");if(z){const ee=A.current.offsetTop-z.clientHeight+50,me=z.scrollTop,Se=ee-me,Ie=300;let we=null;const ze=gt=>{we||(we=gt);const jt=gt-we,Ge=Math.min(jt/Ie,1),Ze=1-Math.pow(1-Ge,3);z.scrollTop=me+Se*Ze,Ge<1&&window.requestAnimationFrame(ze)};window.requestAnimationFrame(ze)}else A.current.scrollIntoView({behavior:"smooth",block:"end"})}},Je=async z=>{var Ie,we;if(z.preventDefault(),!h.trim())return;let ee=h,me=null;const Se=g;p(""),m(null),b(!0),P(!0),O.current=Date.now();try{if(x){try{oe.info("Uploading creative asset...",{description:"Please wait while we upload your image."});const jt=new FormData;jt.append("assets",x);const Ge=await St.uploadAssets(s,jt);console.log("Upload response:",Ge==null?void 0:Ge.data);const Ze=Ge==null?void 0:Ge.data;Ze&&Ze.assets&&Ze.assets.length>0?(me=Ze.assets[0].filename,console.log("Successfully got filename from upload response:",me)):console.error("Invalid upload response structure:",Ze),me&&(ee=`Please review this creative asset titled '${me}'. ${h}`,oe.success("Creative asset uploaded successfully",{description:"The image has been attached to your message."}))}catch(jt){console.error("Error uploading file:",jt),console.error("Upload error details:",(Ie=jt.response)==null?void 0:Ie.data),oe.error("Failed to upload creative asset",{description:"Your message will be sent without the attachment."})}U()}const ze={id:`msg-${Date.now()}`,senderId:"facilitator",text:ee,timestamp:new Date,type:"question"},gt=await St.sendMessage(s,{text:ee,type:"question",senderId:"facilitator"});console.log("Message sent to API:",gt),(we=gt==null?void 0:gt.data)!=null&&we.message_id&&(ze.id=gt.data.message_id),u(ze),setTimeout(()=>{ne()},100),Se&&Se.mentionedParticipantIds.length>0&&setTimeout(()=>{X(Se.mentionedParticipantIds,ze.text)},500)}catch(ze){console.error("Error sending message:",ze),b(!1),P(!1),O.current=null;const gt={id:`msg-${Date.now()}`,senderId:"facilitator",text:h,timestamp:new Date,type:"question"};u(gt),setTimeout(()=>{ne()},100),oe.error("Failed to send message to server",{description:"Message will be shown locally but not saved."})}},ve=()=>{for(let z=e.length-1;z>=0;z--)if(e[z].senderId==="moderator"&&e[z].type==="question")return e[z].text;for(let z=e.length-1;z>=0;z--)if(e[z].senderId==="moderator")return e[z].text;return"What are your thoughts on this topic?"},at=(z,ee)=>{if(!z||!z.sections||!ee)return null;const{section_index:me,subsection_index:Se,item_index:Ie,item_type:we}=ee,ze=z.sections,gt=Ge=>{const Ze=[];return Ge.questions&&Ge.questions.forEach((kt,Vt)=>{Ze.push({...kt,type:"question",index:Vt})}),Ge.activities&&Ge.activities.forEach((kt,Vt)=>{Ze.push({...kt,type:"activity",index:Vt})}),Ze.sort((kt,Vt)=>kt.type!==Vt.type?kt.type==="question"?-1:1:kt.index-Vt.index)};if(me>=ze.length)return{completed:!0};const jt=ze[me];if(Se!==void 0&&jt.subsections){if(Se>=jt.subsections.length)return at(z,{section_index:me+1,subsection_index:void 0,item_index:0,item_type:"question"});const Ge=jt.subsections[Se],Ze=gt(Ge),kt=Ze.findIndex(Vt=>Vt.type===we&&Vt.index===Ie);if(kt0){const Ze=Ge.findIndex(kt=>kt.type===we&&kt.index===Ie);if(Ze0?at(z,{section_index:me,subsection_index:0,item_index:0,item_type:"question"}):at(z,{section_index:me+1,subsection_index:void 0,item_index:0,item_type:"question"})}},st=async()=>{var z,ee,me;if(s)try{b(!0),P(!0),O.current=Date.now(),oe.info("Advancing discussion...",{description:"Moving to the next question in the discussion guide."});const[Se,Ie]=await Promise.all([jn.getModeratorStatus(s),St.getById(s)]);if(!((z=Se==null?void 0:Se.data)!=null&&z.status)||!((ee=Ie==null?void 0:Ie.data)!=null&&ee.discussionGuide))throw new Error("Could not fetch moderator status or discussion guide");const we=Se.data.status,ze=Ie.data.discussionGuide;if(!ze.sections)throw new Error("Discussion guide does not have a structured format");const gt=at(ze,we.moderator_position);if(!gt)throw new Error("Could not determine next discussion item");if(gt.completed){oe.success("Discussion guide completed",{description:"All sections of the discussion guide have been covered."});const Ge={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(Ge);return}await jn.setModeratorPosition(s,gt.sectionId,gt.itemId);const jt={id:`msg-${Date.now()}`,senderId:"moderator",text:gt.content,timestamp:new Date,type:"question"};try{const Ge=await St.sendMessage(s,{senderId:"moderator",text:jt.text,type:"question"});(me=Ge==null?void 0:Ge.data)!=null&&me.message_id&&(jt.id=Ge.data.message_id)}catch(Ge){console.warn("Failed to save message to API, showing locally:",Ge)}u(jt),setTimeout(()=>{ne()},100),oe.success("Discussion advanced",{description:`Moved to: ${gt.section.title}${gt.subsection?` > ${gt.subsection.title}`:""}`}),d&&setTimeout(()=>d(),500)}catch(Se){console.error("Error advancing discussion:",Se),oe.error("Failed to advance discussion",{description:Se.message||"There was a problem advancing to the next question."}),b(!1),P(!1),O.current=null}},Mt=async()=>{var z,ee,me,Se;if(s){console.log("Starting AI Mode: setting autonomousLoading to true"),T(!0);try{console.log("Starting AI Mode: calling API...");const we=await Promise.race([jn.startAutonomousConversation(s),new Promise((ze,gt)=>setTimeout(()=>gt(new Error("API call timeout after 30 seconds")),3e4))]);if(console.log("Starting AI Mode: API response received:",we),we.data.error){oe.error("Failed to start autonomous conversation",{description:we.data.error}),T(!1);return}oe.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(ze){console.error("Starting AI Mode: onStatusChange failed:",ze)}console.log("Starting AI Mode: resetting autonomousLoading to false"),T(!1),setTimeout(()=>{console.log("Starting AI Mode: clearing local AI mode state"),q(null)},1e3),De()}catch(Ie){console.error("Error starting autonomous conversation:",Ie),Ie.response&&Ie.response.data&&console.error("Backend error details:",Ie.response.data);const we=((ee=(z=Ie.response)==null?void 0:z.data)==null?void 0:ee.message)||((Se=(me=Ie.response)==null?void 0:me.data)==null?void 0:Se.error)||"Please check your connection and try again";oe.error("Failed to start autonomous conversation",{description:we}),T(!1)}}},C=async()=>{if(s){console.log("Stopping AI Mode: setting autonomousLoading to true"),T(!0);try{const z=await jn.stopAutonomousConversation(s,"manual_stop");if(z.data.error){oe.error("Failed to stop autonomous conversation",{description:z.data.error}),T(!1);return}ge([]),oe.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(ee){console.error("Stopping AI Mode: onStatusChange failed:",ee)}console.log("Stopping AI Mode: resetting autonomousLoading to false"),T(!1),setTimeout(()=>{console.log("Stopping AI Mode: clearing local AI mode state"),q(null)},1e3)}catch(z){console.error("Error stopping autonomous conversation:",z),oe.error("Failed to stop autonomous conversation"),T(!1)}}},R=z=>{var me;const ee=(me=z.target.files)==null?void 0:me[0];if(ee){if(!ee.type.startsWith("image/")){oe.error("Please select an image file",{description:"Only image files (JPG, PNG, etc.) are supported for creative review."});return}if(ee.size>10*1024*1024){oe.error("File too large",{description:"Please select an image smaller than 10MB."});return}w(ee),oe.success(`Image selected: ${ee.name}`,{description:"The image will be attached to your next message."})}},U=()=>{w(null),j.current&&(j.current.value="")},X=async(z,ee)=>{var me;if(!(!s||z.length===0))try{b(!0),P(!0),O.current=Date.now(),oe.info("Generating responses from mentioned participants...",{description:`Generating responses from ${z.length} mentioned participant(s).`});for(const Se of z){const Ie=n.find(we=>(we._id||we.id)===Se);if(!Ie){console.warn(`Mentioned participant ${Se} not found in focus group`);continue}try{const we=await jn.generateResponse(s,Se,ee||"Continue the conversation based on the latest moderator message.");if((me=we==null?void 0:we.data)!=null&&me.response){console.log("Generated response from mentioned participant:",we.data);const ze={id:we.data.message_id||`msg-${Date.now()}-${Se}`,senderId:Se,text:we.data.response,timestamp:new Date,type:"response"};u(ze),oe.success(`Response generated from ${Ie.name}`,{description:we.data.response.substring(0,100)+"..."})}}catch(we){console.error(`Error generating response from ${Ie.name}:`,we),oe.error(`Failed to generate response from ${Ie.name}`)}}}catch(Se){console.error("Error generating mentioned responses:",Se),oe.error("Failed to generate responses from mentioned participants"),b(!1),P(!1),O.current=null}},Q=async()=>{var z,ee,me,Se;if(s){if(n.length===0){oe.error("No participants available",{description:"Add participants to the focus group before generating responses."});return}try{b(!0),P(!0),O.current=Date.now(),oe.info("AI is selecting participant...",{description:"Analyzing the conversation to choose the best respondent."});const Ie=await jn.makeConversationDecision(s,.7,"manual");if(!Ie||!Ie.data||!Ie.data.decision)throw new Error("Empty decision response from AI");const we=Ie.data.decision;if(we.action==="participant_respond"){const ze=we.details.participant_id,gt=we.details.topic_context,jt=we.reasoning,Ge=n.find(kt=>(kt._id||kt.id)===ze);if(!Ge)throw new Error(`Selected participant ${ze} not found in focus group`);oe.info("Generating response...",{description:`AI selected ${Ge.name}: ${jt.substring(0,100)}${jt.length>100?"...":""}`});const Ze=await jn.generateResponse(s,ze,gt);if(!Ze||!Ze.data)throw new Error("Empty response from API");if((z=Ze==null?void 0:Ze.data)!=null&&z.message_id&&((ee=Ze==null?void 0:Ze.data)!=null&&ee.response)){const kt={id:Ze.data.message_id,senderId:ze,text:Ze.data.response,timestamp:new Date,type:"response",highlighted:!1};u(kt),setTimeout(()=>{ne()},100)}else throw new Error("Failed to generate or save AI response")}else{if(console.log("AI suggested different action:",we.action),we.action==="moderator_speak"){oe.info("AI suggests moderator intervention",{description:`AI reasoning: ${we.reasoning.substring(0,100)}${we.reasoning.length>100?"...":""}`});return}oe.warning("Using fallback participant selection",{description:`AI suggested "${we.action}" but generating participant response anyway.`});const ze=(S+1)%n.length,gt=n[ze],jt=ve(),Ge=gt._id||gt.id,Ze=await jn.generateResponse(s,Ge,jt);if((me=Ze==null?void 0:Ze.data)!=null&&me.message_id&&((Se=Ze==null?void 0:Ze.data)!=null&&Se.response)){const kt={id:Ze.data.message_id,senderId:Ge,text:Ze.data.response,timestamp:new Date,type:"response",highlighted:!1};u(kt),setTimeout(()=>{ne()},100),N(ze)}}}catch(Ie){console.error("Error generating AI response:",Ie),oe.error("Failed to generate AI response",{description:"There was a problem connecting to the server."}),b(!1),P(!1),O.current=null}}};return i.jsxs("div",{className:"glass-panel rounded-xl p-4 flex flex-col h-full",children:[i.jsx("div",{className:"flex-1 min-h-0 mb-4",children:i.jsxs(Uy,{className:"h-full pr-4",children:[i.jsxs("div",{className:"space-y-4",children:[Pe().map(z=>z.type==="message"?i.jsx(ZQ,{message:z.data,persona:z.data.senderId!=="moderator"&&z.data.senderId!=="facilitator"?de(z.data.senderId):null,toggleHighlight:()=>l(z.data.id),participants:n,focusGroupId:s},z.data.id):i.jsx(sJ,{modeEvent:z.data},z.data.id)),y&&i.jsxs("div",{className:"flex items-center space-x-2 text-sm text-slate-500 animate-pulse",children:[i.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:i.jsx(xa,{className:"h-4 w-4 text-primary"})}),i.jsx("span",{children:"Generating AI response..."})]}),i.jsx("div",{className:"h-8"}),i.jsx("div",{ref:A,className:"h-1"})]}),!$&&be.length>6&&i.jsx("div",{className:"sticky bottom-5 ml-auto mr-5 z-10 w-fit",children:i.jsx(te,{size:"sm",className:"rounded-full shadow-md h-10 w-10 p-0",onClick:ne,title:"Scroll to bottom",children:i.jsx(MA,{className:"h-4 w-4"})})})]})}),i.jsx(rJ,{reasoningHistory:re,isVisible:se,onToggle:()=>le(!B),isAiMode:a}),i.jsxs("div",{className:"pt-4 border-t border-slate-200 w-full",children:[x&&i.jsxs("div",{className:"mb-2 p-2 bg-blue-50 border border-blue-200 rounded-md flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(FA,{className:"h-4 w-4 text-blue-600"}),i.jsx("span",{className:"text-sm text-blue-700",children:x.name}),i.jsxs("span",{className:"text-xs text-blue-500",children:["(",(x.size/1024/1024).toFixed(1)," MB)"]})]}),i.jsx(te,{type:"button",variant:"ghost",size:"sm",onClick:U,className:"h-6 w-6 p-0 text-blue-600 hover:text-blue-800",children:"×"})]}),i.jsxs("form",{onSubmit:Je,className:"flex items-center gap-2 w-full",children:[i.jsx("input",{ref:j,type:"file",accept:"image/*",onChange:R,className:"hidden"}),i.jsx(u3,{value:h,onChange:(z,ee)=>{p(z),m(ee||null)},participants:n,placeholder:"Ask a question or provide guidance...",className:"flex-1 min-w-0",disabled:!1}),i.jsx(te,{type:"button",variant:"outline",size:"sm",onClick:()=>{var z;return(z=j.current)==null?void 0:z.click()},className:"hover-transition shrink-0 px-3",disabled:!1,title:"Attach image for creative review",children:i.jsx(FA,{className:"h-4 w-4"})}),i.jsxs(te,{type:"submit",variant:"default",className:"hover-transition shrink-0",disabled:!1,children:[i.jsx($a,{className:"mr-2 h-4 w-4"}),"Send"]})]}),i.jsxs("div",{className:"flex justify-between items-center mt-3",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx("p",{className:"text-sm text-slate-500",children:r?"Speaking...":a?"AI mode active":"Manual moderation mode"}),i.jsx(te,{variant:"outline",size:"sm",onClick:Z?C:Mt,disabled:V,className:`hover-transition ${Z?"bg-red-50 text-red-600 hover:bg-red-100":"bg-blue-50 text-blue-600 hover:bg-blue-100"}`,title:Z?"Stop AI mode and return to manual":"Start autonomous AI conversation",children:V?i.jsxs(i.Fragment,{children:[i.jsx(fo,{className:"mr-1 h-3 w-3 animate-spin"}),a?"Stopping...":"Starting..."]}):Z?i.jsxs(i.Fragment,{children:[i.jsx(fo,{className:"mr-1 h-3 w-3"}),"Stop AI Mode"]}):i.jsxs(i.Fragment,{children:[i.jsx(fo,{className:"mr-1 h-3 w-3"}),"Start AI Mode"]})}),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>{L(!$),$||ne()},className:`hover-transition ${$?"bg-blue-50 text-blue-600 hover:bg-blue-100":""}`,title:$?"Disable auto-scroll":"Enable auto-scroll",children:[i.jsx(MA,{className:`h-3 w-3 ${$?"mr-1":""}`}),$&&"Auto-scroll"]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[!a&&i.jsxs(i.Fragment,{children:[i.jsxs(te,{variant:"outline",onClick:st,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:[i.jsx($a,{className:"mr-2 h-4 w-4"}),n.length===0?"No Participants":"Advance Discussion"]}),i.jsxs(te,{variant:"ghost",size:"sm",onClick:Q,className:`hover-transition ${n.length===0?"bg-red-50":""}`,disabled:y||n.length===0,title:"Generate a participant response to the current topic",children:[i.jsx(xa,{className:"mr-1 h-3 w-3"}),"Get Response"]})]}),a&&i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsxs("div",{className:"flex items-center gap-1 text-sm text-slate-600",children:[i.jsx("div",{className:"w-2 h-2 bg-green-500 rounded-full animate-pulse"}),i.jsx("span",{children:"AI Active"})]}),i.jsx(te,{variant:"outline",size:"sm",onClick:()=>D(!H),className:"hover-transition",title:"Show autonomous conversation controls",children:i.jsx(LS,{className:"h-3 w-3"})})]})]})]})]})]})},iJ=({themes:e,messages:t,personas:n=[],onThemeDelete:r,onQuoteClick:s})=>{const a=(d,f)=>{d.stopPropagation(),r&&(r(f),oe.success("Theme deleted successfully"))},o=d=>n.find(f=>f.id===d||f._id===d),l=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 g=f.match(/^([^:]+):\s*(.*)$/);return g&&g[1].trim()!==f.trim()?{persona:g[1].trim(),text:g[2]}:{persona:null,text:f}},c=e.filter(d=>"source"in d?d.source==="highlight":!0),u=e.filter(d=>"source"in d&&d.source==="generated");return i.jsxs("div",{className:"glass-panel rounded-xl p-6 h-[70vh] flex flex-col overflow-hidden",children:[i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx(Ml,{className:"h-5 w-5 text-primary mr-2"}),i.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Key Themes"})]}),i.jsxs("div",{className:"overflow-auto",children:[u.length>0&&i.jsxs("div",{className:"mb-8",children:[i.jsxs("div",{className:"flex items-center mb-3",children:[i.jsx(kl,{className:"h-4 w-4 text-primary mr-2"}),i.jsx("h3",{className:"font-medium",children:"AI-Generated Themes"})]}),i.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:u.map(d=>i.jsxs(rt,{className:"hover:shadow-md transition-shadow relative group",children:[r&&i.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=>a(f,d.id),children:i.jsx(Zs,{className:"h-3 w-3 text-slate-700"})}),i.jsx(Dr,{className:"pb-2",children:i.jsx(ts,{className:"text-base",children:d.title})}),i.jsxs(bt,{children:[i.jsx("p",{className:"text-sm text-slate-600 mb-2",children:d.description}),d.quotes&&d.quotes.length>0&&i.jsxs("div",{className:"mt-3",children:[i.jsx("h4",{className:"text-xs font-medium text-slate-700 mb-2",children:"Supporting Quotes:"}),i.jsx("div",{className:"space-y-2",children:d.quotes.map((f,h)=>{const p=typeof f=="object"&&f!==null,g=p?f.text:f,m=p?f.speaker:l(f).persona,y=p?f.message_id:void 0,b=p?f.original:f;return i.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(),s&&s(p?f:b,y)},title:y?`Message ID: ${y}`:"Click to find original message",children:[m&&i.jsxs("span",{className:"font-semibold text-slate-700 mr-1",children:[m,":"]}),'"',g,'"',y&&i.jsx("span",{className:"ml-2 text-xs text-green-600 opacity-70",children:"✓"})]},h)})})]})]})]},d.id))})]}),c.length>0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center mb-3",children:[i.jsx(PW,{className:"h-4 w-4 text-primary mr-2"}),i.jsx("h3",{className:"font-medium",children:"Highlighted Comments"})]}),i.jsx("div",{className:"grid grid-cols-1 gap-4 mb-4",children:c.map(d=>{const f=d.messages.length>0?t.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,g=f==null?void 0:f.senderId;let m="";if(g==="moderator")m="AI Moderator";else if(g==="facilitator")m="Human Facilitator";else if(g){const y=o(g);m=(y==null?void 0:y.name)||"Unknown Participant"}return i.jsxs(rt,{className:"hover:shadow-md hover:bg-slate-50 transition-all cursor-pointer relative group",onClick:y=>{y.stopPropagation(),s&&f&&s(f.text,f.id)},title:"Click to view in discussion",children:[r&&i.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=>a(y,d.id),children:i.jsx(Zs,{className:"h-3 w-3 text-slate-700"})}),i.jsx(Dr,{className:"pb-2",children:i.jsx(ts,{className:"text-sm font-medium text-slate-800 line-clamp-2",children:m&&i.jsx("span",{className:"text-primary font-semibold",children:m})})}),i.jsxs(bt,{className:"pt-0",children:[i.jsxs("p",{className:"text-sm text-slate-600 leading-relaxed",children:['"',p,'"']}),i.jsxs("div",{className:"mt-2 flex items-center text-xs text-slate-400",children:[i.jsx(xa,{className:"h-3 w-3 mr-1"}),"Click to view in discussion"]})]})]},d.id)})})]}),e.length===0&&i.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[i.jsx(Ml,{className:"h-8 w-8 text-slate-400 mb-3"}),i.jsx("p",{className:"text-slate-600",children:"No themes have been identified yet."}),i.jsx("p",{className:"text-sm text-slate-500 mt-2",children:"Highlight important messages in the discussion or generate themes automatically."})]})]})]})},oJ=({themes:e,messages:t,personas:n,focusGroupId:r,onThemesGenerated:s,onThemeDelete:a,onQuoteClick:o,onGenerateKeyThemes:l})=>{const c=()=>{if(!e||e.length===0){oe.warning("No themes to export",{description:"Generate some themes first before exporting."});return}let u=`# Key Themes Analysis + +`;const d=e.filter(g=>"source"in g&&g.source==="generated");if(d.length===0){oe.warning("No AI-generated themes to export",{description:"Only AI-generated themes are included in the export."});return}d.forEach((g,m)=>{u+=`## ${m+1}. ${g.title} + +`,u+=`${g.description} + +`,g.quotes&&g.quotes.length>0&&(u+=`**Supporting Quotes:** + +`,g.quotes.forEach(y=>{u+=`> ${y} + +`})),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),oe.success("Themes exported successfully",{description:`Downloaded ${d.length} themes as markdown file.`})};return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{className:"mb-4 space-y-2",children:[i.jsxs(te,{onClick:l,className:"w-full",children:[i.jsx(DW,{className:"mr-2 h-4 w-4"}),"Analyze Discussion for Key Themes"]}),i.jsxs(te,{onClick:c,disabled:!e||e.length===0,variant:"outline",className:"w-full",children:[i.jsx($l,{className:"mr-2 h-4 w-4"}),"Export Themes"]})]}),i.jsx("div",{className:"flex-grow overflow-hidden",children:i.jsx(iJ,{themes:e,messages:t,personas:n,onThemeDelete:a,focusGroupId:r,onQuoteClick:o})})]})};var lJ=Array.isArray,Kr=lJ,cJ=typeof _p=="object"&&_p&&_p.Object===Object&&_p,d3=cJ,uJ=d3,dJ=typeof self=="object"&&self&&self.Object===Object&&self,fJ=uJ||dJ||Function("return this")(),Fa=fJ,hJ=Fa,pJ=hJ.Symbol,pp=pJ,EC=pp,f3=Object.prototype,mJ=f3.hasOwnProperty,gJ=f3.toString,Td=EC?EC.toStringTag:void 0;function vJ(e){var t=mJ.call(e,Td),n=e[Td];try{e[Td]=void 0;var r=!0}catch{}var s=gJ.call(e);return r&&(t?e[Td]=n:delete e[Td]),s}var yJ=vJ,xJ=Object.prototype,bJ=xJ.toString;function wJ(e){return bJ.call(e)}var jJ=wJ,OC=pp,SJ=yJ,NJ=jJ,_J="[object Null]",PJ="[object Undefined]",kC=OC?OC.toStringTag:void 0;function AJ(e){return e==null?e===void 0?PJ:_J:kC&&kC in Object(e)?SJ(e):NJ(e)}var Ci=AJ;function CJ(e){return e!=null&&typeof e=="object"}var Ei=CJ,EJ=Ci,OJ=Ei,kJ="[object Symbol]";function TJ(e){return typeof e=="symbol"||OJ(e)&&EJ(e)==kJ}var td=TJ,$J=Kr,MJ=td,IJ=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,RJ=/^\w*$/;function DJ(e,t){if($J(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||MJ(e)?!0:RJ.test(e)||!IJ.test(e)||t!=null&&e in Object(t)}var zN=DJ;function LJ(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Bo=LJ;const nd=Gt(Bo);var FJ=Ci,BJ=Bo,zJ="[object AsyncFunction]",UJ="[object Function]",VJ="[object GeneratorFunction]",WJ="[object Proxy]";function HJ(e){if(!BJ(e))return!1;var t=FJ(e);return t==UJ||t==VJ||t==zJ||t==WJ}var UN=HJ;const ht=Gt(UN);var GJ=Fa,qJ=GJ["__core-js_shared__"],KJ=qJ,C0=KJ,TC=function(){var e=/[^.]+$/.exec(C0&&C0.keys&&C0.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function XJ(e){return!!TC&&TC in e}var YJ=XJ,ZJ=Function.prototype,QJ=ZJ.toString;function JJ(e){if(e!=null){try{return QJ.call(e)}catch{}try{return e+""}catch{}}return""}var h3=JJ,eee=UN,tee=YJ,nee=Bo,ree=h3,see=/[\\^$.*+?()[\]{}|]/g,aee=/^\[object .+?Constructor\]$/,iee=Function.prototype,oee=Object.prototype,lee=iee.toString,cee=oee.hasOwnProperty,uee=RegExp("^"+lee.call(cee).replace(see,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function dee(e){if(!nee(e)||tee(e))return!1;var t=eee(e)?uee:aee;return t.test(ree(e))}var fee=dee;function hee(e,t){return e==null?void 0:e[t]}var pee=hee,mee=fee,gee=pee;function vee(e,t){var n=gee(e,t);return mee(n)?n:void 0}var Ql=vee,yee=Ql,xee=yee(Object,"create"),Vy=xee,$C=Vy;function bee(){this.__data__=$C?$C(null):{},this.size=0}var wee=bee;function jee(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var See=jee,Nee=Vy,_ee="__lodash_hash_undefined__",Pee=Object.prototype,Aee=Pee.hasOwnProperty;function Cee(e){var t=this.__data__;if(Nee){var n=t[e];return n===_ee?void 0:n}return Aee.call(t,e)?t[e]:void 0}var Eee=Cee,Oee=Vy,kee=Object.prototype,Tee=kee.hasOwnProperty;function $ee(e){var t=this.__data__;return Oee?t[e]!==void 0:Tee.call(t,e)}var Mee=$ee,Iee=Vy,Ree="__lodash_hash_undefined__";function Dee(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=Iee&&t===void 0?Ree:t,this}var Lee=Dee,Fee=wee,Bee=See,zee=Eee,Uee=Mee,Vee=Lee;function rd(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var ite=ate,ote=Wy;function lte(e,t){var n=this.__data__,r=ote(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var cte=lte,ute=Gee,dte=ete,fte=rte,hte=ite,pte=cte;function sd(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},ll=function(t){return mp(t)&&t.indexOf("%")===t.length-1},Ae=function(t){return Ine(t)&&!id(t)},qn=function(t){return Ae(t)||mp(t)},Fne=0,od=function(t){var n=++Fne;return"".concat(t||"").concat(n)},Cr=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ae(t)&&!mp(t))return r;var a;if(ll(t)){var o=t.indexOf("%");a=n*parseFloat(t.slice(0,o))/100}else a=+t;return id(a)&&(a=r),s&&a>n&&(a=n),a},Hi=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},Bne=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gne(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Hw(e){"@babel/helpers - typeof";return Hw=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hw(e)}var BC={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart"},li=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},zC=null,O0=null,QN=function e(t){if(t===zC&&Array.isArray(O0))return O0;var n=[];return v.Children.forEach(t,function(r){Nt(r)||(j3.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),O0=n,zC=t,n};function Ps(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(s){return li(s)}):r=[li(t)],QN(e).forEach(function(s){var a=ls(s,"type.displayName")||ls(s,"type.name");r.indexOf(a)!==-1&&n.push(s)}),n}function es(e,t){var n=Ps(e,t);return n&&n[0]}var UC=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,s=n.height;return!(!Ae(r)||r<=0||!Ae(s)||s<=0)},qne=["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"],Kne=function(t){return t&&t.type&&mp(t.type)&&qne.indexOf(t.type)>=0},Xne=function(t){return t&&Hw(t)==="object"&&"clipDot"in t},Yne=function(t,n,r,s){var a,o=(a=E0==null?void 0:E0[s])!==null&&a!==void 0?a:[];return!ht(t)&&(s&&o.includes(n)||Une.includes(n))||r&&ZN.includes(n)},Xe=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var s=t;if(v.isValidElement(t)&&(s=t.props),!nd(s))return null;var a={};return Object.keys(s).forEach(function(o){var l;Yne((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(a[o]=s[o])}),a},Gw=function e(t,n){if(t===n)return!0;var r=v.Children.count(t);if(r!==v.Children.count(n))return!1;if(r===0)return!0;if(r===1)return VC(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Kw(e){var t=e.children,n=e.width,r=e.height,s=e.viewBox,a=e.className,o=e.style,l=e.title,c=e.desc,u=ere(e,Jne),d=s||{width:n,height:r,x:0,y:0},f=wt("recharts-surface",a);return E.createElement("svg",qw({},Xe(u,!0,"svg"),{className:f,width:n,height:r,style:o,viewBox:"".concat(d.x," ").concat(d.y," ").concat(d.width," ").concat(d.height)}),E.createElement("title",null,l),E.createElement("desc",null,c),t)}var nre=["children","className"];function Xw(){return Xw=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Rt=E.forwardRef(function(e,t){var n=e.children,r=e.className,s=rre(e,nre),a=wt("recharts-layer",r);return E.createElement("g",Xw({className:a},Xe(s,!0),{ref:t}),n)}),Js=function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),a=2;as?0:s+t),n=n>s?s:n,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(s);++r=r?e:ore(e,t,n)}var cre=lre,ure="\\ud800-\\udfff",dre="\\u0300-\\u036f",fre="\\ufe20-\\ufe2f",hre="\\u20d0-\\u20ff",pre=dre+fre+hre,mre="\\ufe0e\\ufe0f",gre="\\u200d",vre=RegExp("["+gre+ure+pre+mre+"]");function yre(e){return vre.test(e)}var N3=yre;function xre(e){return e.split("")}var bre=xre,_3="\\ud800-\\udfff",wre="\\u0300-\\u036f",jre="\\ufe20-\\ufe2f",Sre="\\u20d0-\\u20ff",Nre=wre+jre+Sre,_re="\\ufe0e\\ufe0f",Pre="["+_3+"]",Yw="["+Nre+"]",Zw="\\ud83c[\\udffb-\\udfff]",Are="(?:"+Yw+"|"+Zw+")",P3="[^"+_3+"]",A3="(?:\\ud83c[\\udde6-\\uddff]){2}",C3="[\\ud800-\\udbff][\\udc00-\\udfff]",Cre="\\u200d",E3=Are+"?",O3="["+_re+"]?",Ere="(?:"+Cre+"(?:"+[P3,A3,C3].join("|")+")"+O3+E3+")*",Ore=O3+E3+Ere,kre="(?:"+[P3+Yw+"?",Yw,A3,C3,Pre].join("|")+")",Tre=RegExp(Zw+"(?="+Zw+")|"+kre+Ore,"g");function $re(e){return e.match(Tre)||[]}var Mre=$re,Ire=bre,Rre=N3,Dre=Mre;function Lre(e){return Rre(e)?Dre(e):Ire(e)}var Fre=Lre,Bre=cre,zre=N3,Ure=Fre,Vre=v3;function Wre(e){return function(t){t=Vre(t);var n=zre(t)?Ure(t):void 0,r=n?n[0]:t.charAt(0),s=n?Bre(n,1).join(""):t.slice(1);return r[e]()+s}}var Hre=Wre,Gre=Hre,qre=Gre("toUpperCase"),Kre=qre;const sx=Gt(Kre);function rn(e){return function(){return e}}const k3=Math.cos,Vg=Math.sin,ua=Math.sqrt,Wg=Math.PI,ax=2*Wg,Qw=Math.PI,Jw=2*Qw,Zo=1e-6,Xre=Jw-Zo;function T3(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return T3;const n=10**t;return function(r){this._+=r[0];for(let s=1,a=r.length;sZo)if(!(Math.abs(f*c-u*d)>Zo)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let p=r-o,g=s-l,m=c*c+u*u,y=p*p+g*g,b=Math.sqrt(m),x=Math.sqrt(h),w=a*Math.tan((Qw-Math.acos((m+h-y)/(2*b*x)))/2),j=w/x,S=w/b;Math.abs(j-1)>Zo&&this._append`L${t+j*d},${n+j*f}`,this._append`A${a},${a},0,0,${+(f*p>d*g)},${this._x1=t+S*c},${this._y1=n+S*u}`}}arc(t,n,r,s,a,o){if(t=+t,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),u=t+l,d=n+c,f=1^o,h=o?s-a:a-s;this._x1===null?this._append`M${u},${d}`:(Math.abs(this._x1-u)>Zo||Math.abs(this._y1-d)>Zo)&&this._append`L${u},${d}`,r&&(h<0&&(h=h%Jw+Jw),h>Xre?this._append`A${r},${r},0,1,${f},${t-l},${n-c}A${r},${r},0,1,${f},${this._x1=u},${this._y1=d}`:h>Zo&&this._append`A${r},${r},0,${+(h>=Qw)},${f},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,s){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function JN(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new Zre(t)}function e_(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $3(e){this._context=e}$3.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function ix(e){return new $3(e)}function M3(e){return e[0]}function I3(e){return e[1]}function R3(e,t){var n=rn(!0),r=null,s=ix,a=null,o=JN(l);e=typeof e=="function"?e:e===void 0?M3:rn(e),t=typeof t=="function"?t:t===void 0?I3:rn(t);function l(c){var u,d=(c=e_(c)).length,f,h=!1,p;for(r==null&&(a=s(p=o())),u=0;u<=d;++u)!(u=p;--g)l.point(w[g],j[g]);l.lineEnd(),l.areaEnd()}b&&(w[h]=+e(y,h,f),j[h]=+t(y,h,f),l.point(r?+r(y,h,f):w[h],n?+n(y,h,f):j[h]))}if(x)return l=null,x+""||null}function d(){return R3().defined(s).curve(o).context(a)}return u.x=function(f){return arguments.length?(e=typeof f=="function"?f:rn(+f),r=null,u):e},u.x0=function(f){return arguments.length?(e=typeof f=="function"?f:rn(+f),u):e},u.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:rn(+f),u):r},u.y=function(f){return arguments.length?(t=typeof f=="function"?f:rn(+f),n=null,u):t},u.y0=function(f){return arguments.length?(t=typeof f=="function"?f:rn(+f),u):t},u.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:rn(+f),u):n},u.lineX0=u.lineY0=function(){return d().x(e).y(t)},u.lineY1=function(){return d().x(e).y(n)},u.lineX1=function(){return d().x(r).y(t)},u.defined=function(f){return arguments.length?(s=typeof f=="function"?f:rn(!!f),u):s},u.curve=function(f){return arguments.length?(o=f,a!=null&&(l=o(a)),u):o},u.context=function(f){return arguments.length?(f==null?a=l=null:l=o(a=f),u):a},u}class D3{constructor(t,n){this._context=t,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(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function Qre(e){return new D3(e,!0)}function Jre(e){return new D3(e,!1)}const t_={draw(e,t){const n=ua(t/Wg);e.moveTo(n,0),e.arc(0,0,n,0,ax)}},ese={draw(e,t){const n=ua(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},L3=ua(1/3),tse=L3*2,nse={draw(e,t){const n=ua(t/tse),r=n*L3;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},rse={draw(e,t){const n=ua(t),r=-n/2;e.rect(r,r,n,n)}},sse=.8908130915292852,F3=Vg(Wg/10)/Vg(7*Wg/10),ase=Vg(ax/10)*F3,ise=-k3(ax/10)*F3,ose={draw(e,t){const n=ua(t*sse),r=ase*n,s=ise*n;e.moveTo(0,-n),e.lineTo(r,s);for(let a=1;a<5;++a){const o=ax*a/5,l=k3(o),c=Vg(o);e.lineTo(c*n,-l*n),e.lineTo(l*r-c*s,c*r+l*s)}e.closePath()}},k0=ua(3),lse={draw(e,t){const n=-ua(t/(k0*3));e.moveTo(0,n*2),e.lineTo(-k0*n,-n),e.lineTo(k0*n,-n),e.closePath()}},fs=-.5,hs=ua(3)/2,e1=1/ua(12),cse=(e1/2+1)*3,use={draw(e,t){const n=ua(t/cse),r=n/2,s=n*e1,a=r,o=n*e1+n,l=-a,c=o;e.moveTo(r,s),e.lineTo(a,o),e.lineTo(l,c),e.lineTo(fs*r-hs*s,hs*r+fs*s),e.lineTo(fs*a-hs*o,hs*a+fs*o),e.lineTo(fs*l-hs*c,hs*l+fs*c),e.lineTo(fs*r+hs*s,fs*s-hs*r),e.lineTo(fs*a+hs*o,fs*o-hs*a),e.lineTo(fs*l+hs*c,fs*c-hs*l),e.closePath()}};function dse(e,t){let n=null,r=JN(s);e=typeof e=="function"?e:rn(e||t_),t=typeof t=="function"?t:rn(t===void 0?64:+t);function s(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return s.type=function(a){return arguments.length?(e=typeof a=="function"?a:rn(a),s):e},s.size=function(a){return arguments.length?(t=typeof a=="function"?a:rn(+a),s):t},s.context=function(a){return arguments.length?(n=a??null,s):n},s}function Hg(){}function Gg(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function B3(e){this._context=e}B3.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:Gg(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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:Gg(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function fse(e){return new B3(e)}function z3(e){this._context=e}z3.prototype={areaStart:Hg,areaEnd:Hg,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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Gg(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function hse(e){return new z3(e)}function U3(e){this._context=e}U3.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(e,t){switch(e=+e,t=+t,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+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Gg(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function pse(e){return new U3(e)}function V3(e){this._context=e}V3.prototype={areaStart:Hg,areaEnd:Hg,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function mse(e){return new V3(e)}function HC(e){return e<0?-1:1}function GC(e,t,n){var r=e._x1-e._x0,s=t-e._x1,a=(e._y1-e._y0)/(r||s<0&&-0),o=(n-e._y1)/(s||r<0&&-0),l=(a*s+o*r)/(r+s);return(HC(a)+HC(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(l))||0}function qC(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function T0(e,t,n){var r=e._x0,s=e._y0,a=e._x1,o=e._y1,l=(a-r)/3;e._context.bezierCurveTo(r+l,s+l*t,a-l,o-l*n,a,o)}function qg(e){this._context=e}qg.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:T0(this,this._t0,qC(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,T0(this,qC(this,n=GC(this,e,t)),n);break;default:T0(this,this._t0,n=GC(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function W3(e){this._context=new H3(e)}(W3.prototype=Object.create(qg.prototype)).point=function(e,t){qg.prototype.point.call(this,t,e)};function H3(e){this._context=e}H3.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,s,a){this._context.bezierCurveTo(t,e,r,n,a,s)}};function gse(e){return new qg(e)}function vse(e){return new W3(e)}function G3(e){this._context=e}G3.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=KC(e),s=KC(t),a=0,o=1;o=0;--t)s[t]=(o[t]-s[t+1])/a[t];for(a[n-1]=(e[n]+s[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function xse(e){return new ox(e,.5)}function bse(e){return new ox(e,0)}function wse(e){return new ox(e,1)}function pu(e,t){if((o=e.length)>1)for(var n=1,r,s,a=e[t[0]],o,l=a.length;n=0;)n[t]=t;return n}function jse(e,t){return e[t]}function Sse(e){const t=[];return t.key=e,t}function Nse(){var e=rn([]),t=t1,n=pu,r=jse;function s(a){var o=Array.from(e.apply(this,arguments),Sse),l,c=o.length,u=-1,d;for(const f of a)for(l=0,++u;l0){for(var n,r,s=0,a=e[0].length,o;s0){for(var n=0,r=e[t[0]],s,a=r.length;n0)||!((a=(s=e[t[0]]).length)>0))){for(var n=0,r=1,s,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $se(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var q3={symbolCircle:t_,symbolCross:ese,symbolDiamond:nse,symbolSquare:rse,symbolStar:ose,symbolTriangle:lse,symbolWye:use},Mse=Math.PI/180,Ise=function(t){var n="symbol".concat(sx(t));return q3[n]||t_},Rse=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var s=18*Mse;return 1.25*t*t*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},Dse=function(t,n){q3["symbol".concat(sx(t))]=n},n_=function(t){var n=t.type,r=n===void 0?"circle":n,s=t.size,a=s===void 0?64:s,o=t.sizeType,l=o===void 0?"area":o,c=Tse(t,Cse),u=YC(YC({},c),{},{type:r,size:a,sizeType:l}),d=function(){var y=Ise(r),b=dse().type(y).size(Rse(a,l,r));return b()},f=u.className,h=u.cx,p=u.cy,g=Xe(u,!0);return h===+h&&p===+p&&a===+a?E.createElement("path",n1({},g,{className:wt("recharts-symbols",f),transform:"translate(".concat(h,", ").concat(p,")"),d:d()})):null};n_.registerSymbol=Dse;function mu(e){"@babel/helpers - typeof";return mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mu(e)}function r1(){return r1=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var x=p.inactive?u:p.color;return E.createElement("li",r1({className:y,style:f,key:"legend-item-".concat(g)},Bl(r.props,p,g)),E.createElement(Kw,{width:o,height:o,viewBox:d,style:h},r.renderIcon(p)),E.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},m?m(b,p,g):b))})}},{key:"render",value:function(){var r=this.props,s=r.payload,a=r.layout,o=r.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:a==="horizontal"?o:"left"};return E.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(v.PureComponent);ch(r_,"displayName","Legend");ch(r_,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var qse=Hy;function Kse(){this.__data__=new qse,this.size=0}var Xse=Kse;function Yse(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var Zse=Yse;function Qse(e){return this.__data__.get(e)}var Jse=Qse;function eae(e){return this.__data__.has(e)}var tae=eae,nae=Hy,rae=WN,sae=HN,aae=200;function iae(e,t){var n=this.__data__;if(n instanceof nae){var r=n.__data__;if(!rae||r.lengthl))return!1;var u=a.get(e),d=a.get(t);if(u&&d)return u==t&&d==e;var f=-1,h=!0,p=n&Cae?new Nae:void 0;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e-1&&e%1==0&&e<=Tie}var o_=$ie,Mie=Ci,Iie=o_,Rie=Ei,Die="[object Arguments]",Lie="[object Array]",Fie="[object Boolean]",Bie="[object Date]",zie="[object Error]",Uie="[object Function]",Vie="[object Map]",Wie="[object Number]",Hie="[object Object]",Gie="[object RegExp]",qie="[object Set]",Kie="[object String]",Xie="[object WeakMap]",Yie="[object ArrayBuffer]",Zie="[object DataView]",Qie="[object Float32Array]",Jie="[object Float64Array]",eoe="[object Int8Array]",toe="[object Int16Array]",noe="[object Int32Array]",roe="[object Uint8Array]",soe="[object Uint8ClampedArray]",aoe="[object Uint16Array]",ioe="[object Uint32Array]",cn={};cn[Qie]=cn[Jie]=cn[eoe]=cn[toe]=cn[noe]=cn[roe]=cn[soe]=cn[aoe]=cn[ioe]=!0;cn[Die]=cn[Lie]=cn[Yie]=cn[Fie]=cn[Zie]=cn[Bie]=cn[zie]=cn[Uie]=cn[Vie]=cn[Wie]=cn[Hie]=cn[Gie]=cn[qie]=cn[Kie]=cn[Xie]=!1;function ooe(e){return Rie(e)&&Iie(e.length)&&!!cn[Mie(e)]}var loe=ooe;function coe(e){return function(t){return e(t)}}var s5=coe,Zg={exports:{}};Zg.exports;(function(e,t){var n=d3,r=t&&!t.nodeType&&t,s=r&&!0&&e&&!e.nodeType&&e,a=s&&s.exports===r,o=a&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();e.exports=l})(Zg,Zg.exports);var uoe=Zg.exports,doe=loe,foe=s5,rE=uoe,sE=rE&&rE.isTypedArray,hoe=sE?foe(sE):doe,a5=hoe,poe=vie,moe=a_,goe=Kr,voe=r5,yoe=i_,xoe=a5,boe=Object.prototype,woe=boe.hasOwnProperty;function joe(e,t){var n=goe(e),r=!n&&moe(e),s=!n&&!r&&voe(e),a=!n&&!r&&!s&&xoe(e),o=n||r||s||a,l=o?poe(e.length,String):[],c=l.length;for(var u in e)(t||woe.call(e,u))&&!(o&&(u=="length"||s&&(u=="offset"||u=="parent")||a&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||yoe(u,c)))&&l.push(u);return l}var Soe=joe,Noe=Object.prototype;function _oe(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Noe;return e===n}var Poe=_oe;function Aoe(e,t){return function(n){return e(t(n))}}var i5=Aoe,Coe=i5,Eoe=Coe(Object.keys,Object),Ooe=Eoe,koe=Poe,Toe=Ooe,$oe=Object.prototype,Moe=$oe.hasOwnProperty;function Ioe(e){if(!koe(e))return Toe(e);var t=[];for(var n in Object(e))Moe.call(e,n)&&n!="constructor"&&t.push(n);return t}var Roe=Ioe,Doe=UN,Loe=o_;function Foe(e){return e!=null&&Loe(e.length)&&!Doe(e)}var gp=Foe,Boe=Soe,zoe=Roe,Uoe=gp;function Voe(e){return Uoe(e)?Boe(e):zoe(e)}var lx=Voe,Woe=aie,Hoe=mie,Goe=lx;function qoe(e){return Woe(e,Goe,Hoe)}var Koe=qoe,aE=Koe,Xoe=1,Yoe=Object.prototype,Zoe=Yoe.hasOwnProperty;function Qoe(e,t,n,r,s,a){var o=n&Xoe,l=aE(e),c=l.length,u=aE(t),d=u.length;if(c!=d&&!o)return!1;for(var f=c;f--;){var h=l[f];if(!(o?h in t:Zoe.call(t,h)))return!1}var p=a.get(e),g=a.get(t);if(p&&g)return p==t&&g==e;var m=!0;a.set(e,t),a.set(t,e);for(var y=o;++f-1}var Yce=Xce;function Zce(e,t,n){for(var r=-1,s=e==null?0:e.length;++r=fue){var u=t?null:uue(e);if(u)return due(u);o=!1,s=cue,c=new iue}else c=t?[]:l;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Cue(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Eue(e){return e.value}function Oue(e,t){if(E.isValidElement(e))return E.cloneElement(e,t);if(typeof e=="function")return E.createElement(e,t);t.ref;var n=Aue(t,xue);return E.createElement(r_,n)}var wE=1,ci=function(e){function t(){var n;bue(this,t);for(var r=arguments.length,s=new Array(r),a=0;awE||Math.abs(s.height-this.lastBoundingBox.height)>wE)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(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?Wa({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,a=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,u=s.chartWidth,d=s.chartHeight,f,h;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&a==="vertical"){var p=this.getBBoxSnapshot();f={left:((u||0)-p.width)/2}}else f=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var g=this.getBBoxSnapshot();h={top:((d||0)-g.height)/2}}else h=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return Wa(Wa({},f),h)}},{key:"render",value:function(){var r=this,s=this.props,a=s.content,o=s.width,l=s.height,c=s.wrapperStyle,u=s.payloadUniqBy,d=s.payload,f=Wa(Wa({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return E.createElement("div",{className:"recharts-legend-wrapper",style:f,ref:function(p){r.wrapperNode=p}},Oue(a,Wa(Wa({},this.props),{},{payload:h5(d,u,Eue)})))}}],[{key:"getWithHeight",value:function(r,s){var a=Wa(Wa({},this.defaultProps),r.props),o=a.layout;return o==="vertical"&&Ae(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(v.PureComponent);cx(ci,"displayName","Legend");cx(ci,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var jE=pp,kue=a_,Tue=Kr,SE=jE?jE.isConcatSpreadable:void 0;function $ue(e){return Tue(e)||kue(e)||!!(SE&&e&&e[SE])}var Mue=$ue,Iue=t5,Rue=Mue;function g5(e,t,n,r,s){var a=-1,o=e.length;for(n||(n=Rue),s||(s=[]);++a0&&n(l)?t>1?g5(l,t-1,n,r,s):Iue(s,l):r||(s[s.length]=l)}return s}var v5=g5;function Due(e){return function(t,n,r){for(var s=-1,a=Object(t),o=r(t),l=o.length;l--;){var c=o[e?l:++s];if(n(a[c],c,a)===!1)break}return t}}var Lue=Due,Fue=Lue,Bue=Fue(),zue=Bue,Uue=zue,Vue=lx;function Wue(e,t){return e&&Uue(e,t,Vue)}var y5=Wue,Hue=gp;function Gue(e,t){return function(n,r){if(n==null)return n;if(!Hue(n))return e(n,r);for(var s=n.length,a=t?s:-1,o=Object(n);(t?a--:++at||a&&o&&c&&!l&&!u||r&&o&&c||!n&&c||!s)return 1;if(!r&&!a&&!u&&e=l)return c;var u=n[r];return c*(u=="desc"?-1:1)}}return e.index-t.index}var ide=ade,R0=qN,ode=KN,lde=Ba,cde=x5,ude=tde,dde=s5,fde=ide,hde=ud,pde=Kr;function mde(e,t,n){t.length?t=R0(t,function(a){return pde(a)?function(o){return ode(o,a.length===1?a[0]:a)}:a}):t=[hde];var r=-1;t=R0(t,dde(lde));var s=cde(e,function(a,o,l){var c=R0(t,function(u){return u(a)});return{criteria:c,index:++r,value:a}});return ude(s,function(a,o){return fde(a,o,n)})}var gde=mde;function vde(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var yde=vde,xde=yde,_E=Math.max;function bde(e,t,n){return t=_E(t===void 0?e.length-1:t,0),function(){for(var r=arguments,s=-1,a=_E(r.length-t,0),o=Array(a);++s0){if(++t>=Ode)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Mde=$de,Ide=Ede,Rde=Mde,Dde=Rde(Ide),Lde=Dde,Fde=ud,Bde=wde,zde=Lde;function Ude(e,t){return zde(Bde(e,t,Fde),e+"")}var Vde=Ude,Wde=VN,Hde=gp,Gde=i_,qde=Bo;function Kde(e,t,n){if(!qde(n))return!1;var r=typeof t;return(r=="number"?Hde(n)&&Gde(t,n.length):r=="string"&&t in n)?Wde(n[t],e):!1}var ux=Kde,Xde=v5,Yde=gde,Zde=Vde,AE=ux,Qde=Zde(function(e,t){if(e==null)return[];var n=t.length;return n>1&&AE(e,t[0],t[1])?t=[]:n>2&&AE(t[0],t[1],t[2])&&(t=[t[0]]),Yde(e,Xde(t,1),[])}),Jde=Qde;const u_=Gt(Jde);function uh(e){"@babel/helpers - typeof";return uh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uh(e)}function d1(){return d1=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat($d,"-left"),Ae(n)&&t&&Ae(t.x)&&n=t.y),"".concat($d,"-top"),Ae(r)&&t&&Ae(t.y)&&rm?Math.max(d,c[r]):Math.max(f,c[r])}function pfe(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function mfe(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,s=e.position,a=e.reverseDirection,o=e.tooltipBox,l=e.useTranslate3d,c=e.viewBox,u,d,f;return o.height>0&&o.width>0&&n?(d=OE({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),f=OE({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),u=pfe({translateX:d,translateY:f,useTranslate3d:l})):u=ffe,{cssProperties:u,cssClasses:hfe({translateX:d,translateY:f,coordinate:n})}}function vu(e){"@babel/helpers - typeof";return vu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vu(e)}function kE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function TE(e){for(var t=1;t$E||Math.abs(r.height-this.state.lastBoundingBox.height)>$E)&&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,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,a=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,u=s.children,d=s.coordinate,f=s.hasPayload,h=s.isAnimationActive,p=s.offset,g=s.position,m=s.reverseDirection,y=s.useTranslate3d,b=s.viewBox,x=s.wrapperStyle,w=mfe({allowEscapeViewBox:o,coordinate:d,offsetTopLeft:p,position:g,reverseDirection:m,tooltipBox:this.state.lastBoundingBox,useTranslate3d:y,viewBox:b}),j=w.cssClasses,S=w.cssProperties,N=TE(TE({transition:h&&a?"transform ".concat(l,"ms ").concat(c):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&a&&f?"visible":"hidden",position:"absolute",top:0,left:0},x);return E.createElement("div",{tabIndex:-1,className:j,style:N,ref:function(P){r.wrapperNode=P}},u)}}])}(v.PureComponent),_fe=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ea={isSsr:_fe(),get:function(t){return ea[t]},set:function(t,n){if(typeof t=="string")ea[t]=n;else{var r=Object.keys(t);r&&r.length&&r.forEach(function(s){ea[s]=t[s]})}}};function yu(e){"@babel/helpers - typeof";return yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(e)}function ME(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function IE(e){for(var t=1;t0;return E.createElement(Nfe,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:h,active:a,coordinate:d,hasPayload:N,offset:p,position:y,reverseDirection:b,useTranslate3d:x,viewBox:w,wrapperStyle:j},Ife(u,IE(IE({},this.props),{},{payload:S})))}}])}(v.PureComponent);d_(mr,"displayName","Tooltip");d_(mr,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ea.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 Rfe=Fa,Dfe=function(){return Rfe.Date.now()},Lfe=Dfe,Ffe=/\s/;function Bfe(e){for(var t=e.length;t--&&Ffe.test(e.charAt(t)););return t}var zfe=Bfe,Ufe=zfe,Vfe=/^\s+/;function Wfe(e){return e&&e.slice(0,Ufe(e)+1).replace(Vfe,"")}var Hfe=Wfe,Gfe=Hfe,RE=Bo,qfe=td,DE=NaN,Kfe=/^[-+]0x[0-9a-f]+$/i,Xfe=/^0b[01]+$/i,Yfe=/^0o[0-7]+$/i,Zfe=parseInt;function Qfe(e){if(typeof e=="number")return e;if(qfe(e))return DE;if(RE(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=RE(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Gfe(e);var n=Xfe.test(e);return n||Yfe.test(e)?Zfe(e.slice(2),n?2:8):Kfe.test(e)?DE:+e}var _5=Qfe,Jfe=Bo,L0=Lfe,LE=_5,ehe="Expected a function",the=Math.max,nhe=Math.min;function rhe(e,t,n){var r,s,a,o,l,c,u=0,d=!1,f=!1,h=!0;if(typeof e!="function")throw new TypeError(ehe);t=LE(t)||0,Jfe(n)&&(d=!!n.leading,f="maxWait"in n,a=f?the(LE(n.maxWait)||0,t):a,h="trailing"in n?!!n.trailing:h);function p(N){var _=r,P=s;return r=s=void 0,u=N,o=e.apply(P,_),o}function g(N){return u=N,l=setTimeout(b,t),d?p(N):o}function m(N){var _=N-c,P=N-u,k=t-_;return f?nhe(k,a-P):k}function y(N){var _=N-c,P=N-u;return c===void 0||_>=t||_<0||f&&P>=a}function b(){var N=L0();if(y(N))return x(N);l=setTimeout(b,m(N))}function x(N){return l=void 0,h&&r?p(N):(r=s=void 0,o)}function w(){l!==void 0&&clearTimeout(l),u=0,r=c=s=l=void 0}function j(){return l===void 0?o:x(L0())}function S(){var N=L0(),_=y(N);if(r=arguments,s=this,c=N,_){if(l===void 0)return g(c);if(f)return clearTimeout(l),l=setTimeout(b,t),p(c)}return l===void 0&&(l=setTimeout(b,t)),o}return S.cancel=w,S.flush=j,S}var she=rhe,ahe=she,ihe=Bo,ohe="Expected a function";function lhe(e,t,n){var r=!0,s=!0;if(typeof e!="function")throw new TypeError(ohe);return ihe(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),ahe(e,t,{leading:r,maxWait:t,trailing:s})}var che=lhe;const P5=Gt(che);function fh(e){"@babel/helpers - typeof";return fh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fh(e)}function FE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function tm(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&($=P5($,m,{trailing:!0,leading:!1}));var L=new ResizeObserver($),H=S.current.getBoundingClientRect(),D=H.width,V=H.height;return M(D,V),L.observe(S.current),function(){L.disconnect()}},[M,m]);var A=v.useMemo(function(){var $=k.containerWidth,L=k.containerHeight;if($<0||L<0)return null;Js(ll(o)||ll(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,c),Js(!n||n>0,"The aspect(%s) must be greater than zero.",n);var H=ll(o)?$:o,D=ll(c)?L:c;n&&n>0&&(H?D=H/n:D&&(H=D*n),h&&D>h&&(D=h)),Js(H>0||D>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.`,H,D,o,c,d,f,n);var V=!Array.isArray(p)&&li(p.type).endsWith("Chart");return E.Children.map(p,function(T){return j3.isElement(T)?v.cloneElement(T,tm({width:H,height:D},V?{style:tm({height:"100%",width:"100%",maxHeight:D,maxWidth:H},T.props.style)}:{})):T})},[n,p,c,h,f,d,k,o]);return E.createElement("div",{id:y?"".concat(y):void 0,className:wt("recharts-responsive-container",b),style:tm(tm({},j),{},{width:o,height:c,minWidth:d,minHeight:f,maxHeight:h}),ref:S},A)}),vp=function(t){return null};vp.displayName="Cell";function hh(e){"@babel/helpers - typeof";return hh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hh(e)}function zE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function m1(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ea.isSsr)return{width:0,height:0};var r=She(n),s=JSON.stringify({text:t,copyStyle:r});if(lc.widthCache[s])return lc.widthCache[s];try{var a=document.getElementById(UE);a||(a=document.createElement("span"),a.setAttribute("id",UE),a.setAttribute("aria-hidden","true"),document.body.appendChild(a));var o=m1(m1({},jhe),r);Object.assign(a.style,o),a.textContent="".concat(t);var l=a.getBoundingClientRect(),c={width:l.width,height:l.height};return lc.widthCache[s]=c,++lc.cacheCount>whe&&(lc.cacheCount=0,lc.widthCache={}),c}catch{return{width:0,height:0}}},Nhe=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function ph(e){"@babel/helpers - typeof";return ph=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ph(e)}function tv(e,t){return Che(e)||Ahe(e,t)||Phe(e,t)||_he()}function _he(){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 Phe(e,t){if(e){if(typeof e=="string")return VE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VE(e,t)}}function VE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Uhe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function XE(e,t){return Ghe(e)||Hhe(e,t)||Whe(e,t)||Vhe()}function Vhe(){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 Whe(e,t){if(e){if(typeof e=="string")return YE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return YE(e,t)}}function YE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return H.reduce(function(D,V){var T=V.word,F=V.width,q=D[D.length-1];if(q&&(s==null||a||q.width+F+rV.width?D:V})};if(!d)return p;for(var m="…",y=function(H){var D=f.slice(0,H),V=O5({breakAll:u,style:c,children:D+m}).wordsWithComputedWidth,T=h(V),F=T.length>o||g(T).width>Number(s);return[F,T]},b=0,x=f.length-1,w=0,j;b<=x&&w<=f.length-1;){var S=Math.floor((b+x)/2),N=S-1,_=y(N),P=XE(_,2),k=P[0],O=P[1],M=y(S),A=XE(M,1),$=A[0];if(!k&&!$&&(b=S+1),k&&$&&(x=S-1),!k&&$){j=O;break}w++}return j||p},ZE=function(t){var n=Nt(t)?[]:t.toString().split(E5);return[{words:n}]},Khe=function(t){var n=t.width,r=t.scaleToFit,s=t.children,a=t.style,o=t.breakAll,l=t.maxLines;if((n||r)&&!ea.isSsr){var c,u,d=O5({breakAll:o,children:s,style:a});if(d){var f=d.wordsWithComputedWidth,h=d.spaceWidth;c=f,u=h}else return ZE(s);return qhe({breakAll:o,children:s,maxLines:l,style:a},c,u,n,r)}return ZE(s)},QE="#808080",zl=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,a=s===void 0?0:s,o=t.lineHeight,l=o===void 0?"1em":o,c=t.capHeight,u=c===void 0?"0.71em":c,d=t.scaleToFit,f=d===void 0?!1:d,h=t.textAnchor,p=h===void 0?"start":h,g=t.verticalAnchor,m=g===void 0?"end":g,y=t.fill,b=y===void 0?QE:y,x=KE(t,Bhe),w=v.useMemo(function(){return Khe({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]),j=x.dx,S=x.dy,N=x.angle,_=x.className,P=x.breakAll,k=KE(x,zhe);if(!qn(r)||!qn(a))return null;var O=r+(Ae(j)?j:0),M=a+(Ae(S)?S:0),A;switch(m){case"start":A=F0("calc(".concat(u,")"));break;case"middle":A=F0("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(u," / 2))"));break;default:A=F0("calc(".concat(w.length-1," * -").concat(l,")"));break}var $=[];if(f){var L=w[0].width,H=x.width;$.push("scale(".concat((Ae(H)?H/L:1)/L,")"))}return N&&$.push("rotate(".concat(N,", ").concat(O,", ").concat(M,")")),$.length&&(k.transform=$.join(" ")),E.createElement("text",g1({},Xe(k,!0),{x:O,y:M,className:wt("recharts-text",_),textAnchor:p,fill:b.includes("url")?QE:b}),w.map(function(D,V){var T=D.words.join(P?"":" ");return E.createElement("tspan",{x:O,dy:V===0?A:l,key:"".concat(T,"-").concat(V)},T)}))};function xo(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Xhe(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function f_(e){let t,n,r;e.length!==2?(t=xo,n=(l,c)=>xo(e(l),c),r=(l,c)=>e(l)-c):(t=e===xo||e===Xhe?e:Yhe,n=e,r=e);function s(l,c,u=0,d=l.length){if(u>>1;n(l[f],c)<0?u=f+1:d=f}while(u>>1;n(l[f],c)<=0?u=f+1:d=f}while(uu&&r(l[f-1],c)>-r(l[f],c)?f-1:f}return{left:s,center:o,right:a}}function Yhe(){return 0}function k5(e){return e===null?NaN:+e}function*Zhe(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const Qhe=f_(xo),yp=Qhe.right;f_(k5).center;class JE extends Map{constructor(t,n=tpe){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,s]of t)this.set(r,s)}get(t){return super.get(e2(this,t))}has(t){return super.has(e2(this,t))}set(t,n){return super.set(Jhe(this,t),n)}delete(t){return super.delete(epe(this,t))}}function e2({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function Jhe({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function epe({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function tpe(e){return e!==null&&typeof e=="object"?e.valueOf():e}function npe(e=xo){if(e===xo)return T5;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function T5(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const rpe=Math.sqrt(50),spe=Math.sqrt(10),ape=Math.sqrt(2);function nv(e,t,n){const r=(t-e)/Math.max(0,n),s=Math.floor(Math.log10(r)),a=r/Math.pow(10,s),o=a>=rpe?10:a>=spe?5:a>=ape?2:1;let l,c,u;return s<0?(u=Math.pow(10,-s)/o,l=Math.round(e*u),c=Math.round(t*u),l/ut&&--c,u=-u):(u=Math.pow(10,s)*o,l=Math.round(e/u),c=Math.round(t/u),l*ut&&--c),c0))return[];if(e===t)return[e];const r=t=s))return[];const l=a-s+1,c=new Array(l);if(r)if(o<0)for(let u=0;u=r)&&(n=r);return n}function n2(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function $5(e,t,n=0,r=1/0,s){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(s=s===void 0?T5:npe(s);r>n;){if(r-n>600){const c=r-n+1,u=t-n+1,d=Math.log(c),f=.5*Math.exp(2*d/3),h=.5*Math.sqrt(d*f*(c-f)/c)*(u-c/2<0?-1:1),p=Math.max(n,Math.floor(t-u*f/c+h)),g=Math.min(r,Math.floor(t+(c-u)*f/c+h));$5(e,t,p,g,s)}const a=e[t];let o=n,l=r;for(Md(e,n,t),s(e[r],a)>0&&Md(e,n,r);o0;)--l}s(e[n],a)===0?Md(e,n,l):(++l,Md(e,l,r)),l<=t&&(n=l+1),t<=l&&(r=l-1)}return e}function Md(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function ipe(e,t,n){if(e=Float64Array.from(Zhe(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return n2(e);if(t>=1)return t2(e);var r,s=(r-1)*t,a=Math.floor(s),o=t2($5(e,a).subarray(0,a+1)),l=n2(e.subarray(a+1));return o+(l-o)*(s-a)}}function ope(e,t,n=k5){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,s=(r-1)*t,a=Math.floor(s),o=+n(e[a],a,e),l=+n(e[a+1],a+1,e);return o+(l-o)*(s-a)}}function lpe(e,t,n){e=+e,t=+t,n=(s=arguments.length)<2?(t=e,e=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(s);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?rm(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?rm(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=upe.exec(e))?new Br(t[1],t[2],t[3],1):(t=dpe.exec(e))?new Br(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=fpe.exec(e))?rm(t[1],t[2],t[3],t[4]):(t=hpe.exec(e))?rm(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ppe.exec(e))?c2(t[1],t[2]/100,t[3]/100,1):(t=mpe.exec(e))?c2(t[1],t[2]/100,t[3]/100,t[4]):r2.hasOwnProperty(e)?i2(r2[e]):e==="transparent"?new Br(NaN,NaN,NaN,0):null}function i2(e){return new Br(e>>16&255,e>>8&255,e&255,1)}function rm(e,t,n,r){return r<=0&&(e=t=n=NaN),new Br(e,t,n,r)}function ype(e){return e instanceof xp||(e=yh(e)),e?(e=e.rgb(),new Br(e.r,e.g,e.b,e.opacity)):new Br}function w1(e,t,n,r){return arguments.length===1?ype(e):new Br(e,t,n,r??1)}function Br(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}p_(Br,w1,I5(xp,{brighter(e){return e=e==null?rv:Math.pow(rv,e),new Br(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?gh:Math.pow(gh,e),new Br(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Br(Sl(this.r),Sl(this.g),Sl(this.b),sv(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:o2,formatHex:o2,formatHex8:xpe,formatRgb:l2,toString:l2}));function o2(){return`#${cl(this.r)}${cl(this.g)}${cl(this.b)}`}function xpe(){return`#${cl(this.r)}${cl(this.g)}${cl(this.b)}${cl((isNaN(this.opacity)?1:this.opacity)*255)}`}function l2(){const e=sv(this.opacity);return`${e===1?"rgb(":"rgba("}${Sl(this.r)}, ${Sl(this.g)}, ${Sl(this.b)}${e===1?")":`, ${e})`}`}function sv(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Sl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function cl(e){return e=Sl(e),(e<16?"0":"")+e.toString(16)}function c2(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Gs(e,t,n,r)}function R5(e){if(e instanceof Gs)return new Gs(e.h,e.s,e.l,e.opacity);if(e instanceof xp||(e=yh(e)),!e)return new Gs;if(e instanceof Gs)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,l=a-s,c=(a+s)/2;return l?(t===a?o=(n-r)/l+(n0&&c<1?0:o,new Gs(o,l,c,e.opacity)}function bpe(e,t,n,r){return arguments.length===1?R5(e):new Gs(e,t,n,r??1)}function Gs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}p_(Gs,bpe,I5(xp,{brighter(e){return e=e==null?rv:Math.pow(rv,e),new Gs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?gh:Math.pow(gh,e),new Gs(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new Br(B0(e>=240?e-240:e+120,s,r),B0(e,s,r),B0(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Gs(u2(this.h),sm(this.s),sm(this.l),sv(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 e=sv(this.opacity);return`${e===1?"hsl(":"hsla("}${u2(this.h)}, ${sm(this.s)*100}%, ${sm(this.l)*100}%${e===1?")":`, ${e})`}`}}));function u2(e){return e=(e||0)%360,e<0?e+360:e}function sm(e){return Math.max(0,Math.min(1,e||0))}function B0(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const m_=e=>()=>e;function wpe(e,t){return function(n){return e+n*t}}function jpe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Spe(e){return(e=+e)==1?D5:function(t,n){return n-t?jpe(t,n,e):m_(isNaN(t)?n:t)}}function D5(e,t){var n=t-e;return n?wpe(e,n):m_(isNaN(e)?t:e)}const d2=function e(t){var n=Spe(t);function r(s,a){var o=n((s=w1(s)).r,(a=w1(a)).r),l=n(s.g,a.g),c=n(s.b,a.b),u=D5(s.opacity,a.opacity);return function(d){return s.r=o(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function Npe(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(a){for(s=0;sn&&(a=t.slice(n,a),l[o]?l[o]+=a:l[++o]=a),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:av(r,s)})),n=z0.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Ipe(e,t,n){var r=e[0],s=e[1],a=t[0],o=t[1];return s2?Rpe:Ipe,c=u=null,f}function f(h){return h==null||isNaN(h=+h)?a:(c||(c=l(e.map(r),t,n)))(r(o(h)))}return f.invert=function(h){return o(s((u||(u=l(t,e.map(r),av)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,iv),d()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),d()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=g_,d()},f.clamp=function(h){return arguments.length?(o=h?!0:Er,d()):o!==Er},f.interpolate=function(h){return arguments.length?(n=h,d()):n},f.unknown=function(h){return arguments.length?(a=h,f):a},function(h,p){return r=h,s=p,d()}}function v_(){return dx()(Er,Er)}function Dpe(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ov(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function xu(e){return e=ov(Math.abs(e)),e?e[1]:NaN}function Lpe(e,t){return function(n,r){for(var s=n.length,a=[],o=0,l=e[0],c=0;s>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),a.push(n.substring(s-=l,s+l)),!((c+=l+1)>r));)l=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Fpe(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var Bpe=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xh(e){if(!(t=Bpe.exec(e)))throw new Error("invalid format: "+e);var t;return new y_({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}xh.prototype=y_.prototype;function y_(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}y_.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 zpe(e){e:for(var t=e.length,n=1,r=-1,s;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(s+1):e}var L5;function Upe(e,t){var n=ov(e,t);if(!n)return e+"";var r=n[0],s=n[1],a=s-(L5=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return a===o?r:a>o?r+new Array(a-o+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+ov(e,Math.max(0,t+a-1))[0]}function h2(e,t){var n=ov(e,t);if(!n)return e+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const p2={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Dpe,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>h2(e*100,t),r:h2,s:Upe,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function m2(e){return e}var g2=Array.prototype.map,v2=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Vpe(e){var t=e.grouping===void 0||e.thousands===void 0?m2:Lpe(g2.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",s=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?m2:Fpe(g2.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function u(f){f=xh(f);var h=f.fill,p=f.align,g=f.sign,m=f.symbol,y=f.zero,b=f.width,x=f.comma,w=f.precision,j=f.trim,S=f.type;S==="n"?(x=!0,S="g"):p2[S]||(w===void 0&&(w=12),j=!0,S="g"),(y||h==="0"&&p==="=")&&(y=!0,h="0",p="=");var N=m==="$"?n:m==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",_=m==="$"?r:/[%p]/.test(S)?o:"",P=p2[S],k=/[defgprs%]/.test(S);w=w===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function O(M){var A=N,$=_,L,H,D;if(S==="c")$=P(M)+$,M="";else{M=+M;var V=M<0||1/M<0;if(M=isNaN(M)?c:P(Math.abs(M),w),j&&(M=zpe(M)),V&&+M==0&&g!=="+"&&(V=!1),A=(V?g==="("?g:l:g==="-"||g==="("?"":g)+A,$=(S==="s"?v2[8+L5/3]:"")+$+(V&&g==="("?")":""),k){for(L=-1,H=M.length;++LD||D>57){$=(D===46?s+M.slice(L+1):M.slice(L))+$,M=M.slice(0,L);break}}}x&&!y&&(M=t(M,1/0));var T=A.length+M.length+$.length,F=T>1)+A+M+$+F.slice(T);break;default:M=F+A+M+$;break}return a(M)}return O.toString=function(){return f+""},O}function d(f,h){var p=u((f=xh(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(xu(h)/3)))*3,m=Math.pow(10,-g),y=v2[8+g/3];return function(b){return p(m*b)+y}}return{format:u,formatPrefix:d}}var am,x_,F5;Wpe({thousands:",",grouping:[3],currency:["$",""]});function Wpe(e){return am=Vpe(e),x_=am.format,F5=am.formatPrefix,am}function Hpe(e){return Math.max(0,-xu(Math.abs(e)))}function Gpe(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(xu(t)/3)))*3-xu(Math.abs(e)))}function qpe(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,xu(t)-xu(e))+1}function B5(e,t,n,r){var s=x1(e,t,n),a;switch(r=xh(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Gpe(s,o))&&(r.precision=a),F5(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=qpe(s,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=Hpe(s))&&(r.precision=a-(r.type==="%")*2);break}}return x_(r)}function zo(e){var t=e.domain;return e.ticks=function(n){var r=t();return v1(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var s=t();return B5(s[0],s[s.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),s=0,a=r.length-1,o=r[s],l=r[a],c,u,d=10;for(l0;){if(u=y1(o,l,n),u===c)return r[s]=o,r[a]=l,t(r);if(u>0)o=Math.floor(o/u)*u,l=Math.ceil(l/u)*u;else if(u<0)o=Math.ceil(o*u)/u,l=Math.floor(l*u)/u;else break;c=u}return e},e}function lv(){var e=v_();return e.copy=function(){return bp(e,lv())},Ts.apply(e,arguments),zo(e)}function z5(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,iv),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return z5(e).unknown(t)},e=arguments.length?Array.from(e,iv):[0,1],zo(n)}function U5(e,t){e=e.slice();var n=0,r=e.length-1,s=e[n],a=e[r],o;return aMath.pow(e,t)}function Qpe(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function b2(e){return(t,n)=>-e(-t,n)}function b_(e){const t=e(y2,x2),n=t.domain;let r=10,s,a;function o(){return s=Qpe(r),a=Zpe(r),n()[0]<0?(s=b2(s),a=b2(a),e(Kpe,Xpe)):e(y2,x2),t}return t.base=function(l){return arguments.length?(r=+l,o()):r},t.domain=function(l){return arguments.length?(n(l),o()):n()},t.ticks=l=>{const c=n();let u=c[0],d=c[c.length-1];const f=d0){for(;h<=p;++h)for(g=1;gd)break;b.push(m)}}else for(;h<=p;++h)for(g=r-1;g>=1;--g)if(m=h>0?g/a(-h):g*a(h),!(md)break;b.push(m)}b.length*2{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=xh(c)).precision==null&&(c.trim=!0),c=x_(c)),l===1/0)return c;const u=Math.max(1,r*l/t.ticks().length);return d=>{let f=d/a(Math.round(s(d)));return f*rn(U5(n(),{floor:l=>a(Math.floor(s(l))),ceil:l=>a(Math.ceil(s(l)))})),t}function V5(){const e=b_(dx()).domain([1,10]);return e.copy=()=>bp(e,V5()).base(e.base()),Ts.apply(e,arguments),e}function w2(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function j2(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function w_(e){var t=1,n=e(w2(t),j2(t));return n.constant=function(r){return arguments.length?e(w2(t=+r),j2(t)):t},zo(n)}function W5(){var e=w_(dx());return e.copy=function(){return bp(e,W5()).constant(e.constant())},Ts.apply(e,arguments)}function S2(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Jpe(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function eme(e){return e<0?-e*e:e*e}function j_(e){var t=e(Er,Er),n=1;function r(){return n===1?e(Er,Er):n===.5?e(Jpe,eme):e(S2(n),S2(1/n))}return t.exponent=function(s){return arguments.length?(n=+s,r()):n},zo(t)}function S_(){var e=j_(dx());return e.copy=function(){return bp(e,S_()).exponent(e.exponent())},Ts.apply(e,arguments),e}function tme(){return S_.apply(null,arguments).exponent(.5)}function N2(e){return Math.sign(e)*e*e}function nme(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function H5(){var e=v_(),t=[0,1],n=!1,r;function s(a){var o=nme(e(a));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(a){return e.invert(N2(a))},s.domain=function(a){return arguments.length?(e.domain(a),s):e.domain()},s.range=function(a){return arguments.length?(e.range((t=Array.from(a,iv)).map(N2)),s):t.slice()},s.rangeRound=function(a){return s.range(a).round(!0)},s.round=function(a){return arguments.length?(n=!!a,s):n},s.clamp=function(a){return arguments.length?(e.clamp(a),s):e.clamp()},s.unknown=function(a){return arguments.length?(r=a,s):r},s.copy=function(){return H5(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Ts.apply(s,arguments),zo(s)}function G5(){var e=[],t=[],n=[],r;function s(){var o=0,l=Math.max(1,t.length);for(n=new Array(l-1);++o0?n[l-1]:e[0],l=n?[r[n-1],t]:[r[u-1],r[u]]},o.unknown=function(c){return arguments.length&&(a=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return q5().domain([e,t]).range(s).unknown(a)},Ts.apply(zo(o),arguments)}function K5(){var e=[.5],t=[0,1],n,r=1;function s(a){return a!=null&&a<=a?t[yp(e,a,0,r)]:n}return s.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),s):e.slice()},s.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),s):t.slice()},s.invertExtent=function(a){var o=t.indexOf(a);return[e[o-1],e[o]]},s.unknown=function(a){return arguments.length?(n=a,s):n},s.copy=function(){return K5().domain(e).range(t).unknown(n)},Ts.apply(s,arguments)}const U0=new Date,V0=new Date;function Kn(e,t,n,r){function s(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return s.floor=a=>(e(a=new Date(+a)),a),s.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),s.round=a=>{const o=s(a),l=s.ceil(a);return a-o(t(a=new Date(+a),o==null?1:Math.floor(o)),a),s.range=(a,o,l)=>{const c=[];if(a=s.ceil(a),l=l==null?1:Math.floor(l),!(a0))return c;let u;do c.push(u=new Date(+a)),t(a,l),e(a);while(uKn(o=>{if(o>=o)for(;e(o),!a(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!a(o););else for(;--l>=0;)for(;t(o,1),!a(o););}),n&&(s.count=(a,o)=>(U0.setTime(+a),V0.setTime(+o),e(U0),e(V0),Math.floor(n(U0,V0))),s.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?s.filter(r?o=>r(o)%a===0:o=>s.count(0,o)%a===0):s)),s}const cv=Kn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);cv.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Kn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):cv);cv.range;const ni=1e3,Ss=ni*60,ri=Ss*60,bi=ri*24,N_=bi*7,_2=bi*30,W0=bi*365,ul=Kn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ni)},(e,t)=>(t-e)/ni,e=>e.getUTCSeconds());ul.range;const __=Kn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ni)},(e,t)=>{e.setTime(+e+t*Ss)},(e,t)=>(t-e)/Ss,e=>e.getMinutes());__.range;const P_=Kn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Ss)},(e,t)=>(t-e)/Ss,e=>e.getUTCMinutes());P_.range;const A_=Kn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ni-e.getMinutes()*Ss)},(e,t)=>{e.setTime(+e+t*ri)},(e,t)=>(t-e)/ri,e=>e.getHours());A_.range;const C_=Kn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ri)},(e,t)=>(t-e)/ri,e=>e.getUTCHours());C_.range;const wp=Kn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Ss)/bi,e=>e.getDate()-1);wp.range;const fx=Kn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/bi,e=>e.getUTCDate()-1);fx.range;const X5=Kn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/bi,e=>Math.floor(e/bi));X5.range;function Jl(e){return Kn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Ss)/N_)}const hx=Jl(0),uv=Jl(1),rme=Jl(2),sme=Jl(3),bu=Jl(4),ame=Jl(5),ime=Jl(6);hx.range;uv.range;rme.range;sme.range;bu.range;ame.range;ime.range;function ec(e){return Kn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/N_)}const px=ec(0),dv=ec(1),ome=ec(2),lme=ec(3),wu=ec(4),cme=ec(5),ume=ec(6);px.range;dv.range;ome.range;lme.range;wu.range;cme.range;ume.range;const E_=Kn(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());E_.range;const O_=Kn(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());O_.range;const wi=Kn(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());wi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Kn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});wi.range;const ji=Kn(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());ji.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Kn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});ji.range;function Y5(e,t,n,r,s,a){const o=[[ul,1,ni],[ul,5,5*ni],[ul,15,15*ni],[ul,30,30*ni],[a,1,Ss],[a,5,5*Ss],[a,15,15*Ss],[a,30,30*Ss],[s,1,ri],[s,3,3*ri],[s,6,6*ri],[s,12,12*ri],[r,1,bi],[r,2,2*bi],[n,1,N_],[t,1,_2],[t,3,3*_2],[e,1,W0]];function l(u,d,f){const h=dy).right(o,h);if(p===o.length)return e.every(x1(u/W0,d/W0,f));if(p===0)return cv.every(Math.max(x1(u,d,f),1));const[g,m]=o[h/o[p-1][2]53)return null;"w"in ne||(ne.w=1),"Z"in ne?(ve=G0(Id(ne.y,0,1)),at=ve.getUTCDay(),ve=at>4||at===0?dv.ceil(ve):dv(ve),ve=fx.offset(ve,(ne.V-1)*7),ne.y=ve.getUTCFullYear(),ne.m=ve.getUTCMonth(),ne.d=ve.getUTCDate()+(ne.w+6)%7):(ve=H0(Id(ne.y,0,1)),at=ve.getDay(),ve=at>4||at===0?uv.ceil(ve):uv(ve),ve=wp.offset(ve,(ne.V-1)*7),ne.y=ve.getFullYear(),ne.m=ve.getMonth(),ne.d=ve.getDate()+(ne.w+6)%7)}else("W"in ne||"U"in ne)&&("w"in ne||(ne.w="u"in ne?ne.u%7:"W"in ne?1:0),at="Z"in ne?G0(Id(ne.y,0,1)).getUTCDay():H0(Id(ne.y,0,1)).getDay(),ne.m=0,ne.d="W"in ne?(ne.w+6)%7+ne.W*7-(at+5)%7:ne.w+ne.U*7-(at+6)%7);return"Z"in ne?(ne.H+=ne.Z/100|0,ne.M+=ne.Z%100,G0(ne)):H0(ne)}}function P(de,be,Pe,ne){for(var Je=0,ve=be.length,at=Pe.length,st,Mt;Je=at)return-1;if(st=be.charCodeAt(Je++),st===37){if(st=be.charAt(Je++),Mt=S[st in P2?be.charAt(Je++):st],!Mt||(ne=Mt(de,Pe,ne))<0)return-1}else if(st!=Pe.charCodeAt(ne++))return-1}return ne}function k(de,be,Pe){var ne=u.exec(be.slice(Pe));return ne?(de.p=d.get(ne[0].toLowerCase()),Pe+ne[0].length):-1}function O(de,be,Pe){var ne=p.exec(be.slice(Pe));return ne?(de.w=g.get(ne[0].toLowerCase()),Pe+ne[0].length):-1}function M(de,be,Pe){var ne=f.exec(be.slice(Pe));return ne?(de.w=h.get(ne[0].toLowerCase()),Pe+ne[0].length):-1}function A(de,be,Pe){var ne=b.exec(be.slice(Pe));return ne?(de.m=x.get(ne[0].toLowerCase()),Pe+ne[0].length):-1}function $(de,be,Pe){var ne=m.exec(be.slice(Pe));return ne?(de.m=y.get(ne[0].toLowerCase()),Pe+ne[0].length):-1}function L(de,be,Pe){return P(de,t,be,Pe)}function H(de,be,Pe){return P(de,n,be,Pe)}function D(de,be,Pe){return P(de,r,be,Pe)}function V(de){return o[de.getDay()]}function T(de){return a[de.getDay()]}function F(de){return c[de.getMonth()]}function q(de){return l[de.getMonth()]}function Z(de){return s[+(de.getHours()>=12)]}function re(de){return 1+~~(de.getMonth()/3)}function ge(de){return o[de.getUTCDay()]}function B(de){return a[de.getUTCDay()]}function le(de){return c[de.getUTCMonth()]}function se(de){return l[de.getUTCMonth()]}function ce(de){return s[+(de.getUTCHours()>=12)]}function De(de){return 1+~~(de.getUTCMonth()/3)}return{format:function(de){var be=N(de+="",w);return be.toString=function(){return de},be},parse:function(de){var be=_(de+="",!1);return be.toString=function(){return de},be},utcFormat:function(de){var be=N(de+="",j);return be.toString=function(){return de},be},utcParse:function(de){var be=_(de+="",!0);return be.toString=function(){return de},be}}}var P2={"-":"",_:" ",0:"0"},tr=/^\s*\d+/,gme=/^%/,vme=/[\\^$*+?|[\]().{}]/g;function Ut(e,t,n){var r=e<0?"-":"",s=(r?-e:e)+"",a=s.length;return r+(a[t.toLowerCase(),n]))}function xme(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function bme(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function wme(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function jme(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function Sme(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function A2(e,t,n){var r=tr.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function C2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nme(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function _me(e,t,n){var r=tr.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Pme(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function E2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Ame(e,t,n){var r=tr.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function O2(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Cme(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function Eme(e,t,n){var r=tr.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Ome(e,t,n){var r=tr.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function kme(e,t,n){var r=tr.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Tme(e,t,n){var r=gme.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function $me(e,t,n){var r=tr.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Mme(e,t,n){var r=tr.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function k2(e,t){return Ut(e.getDate(),t,2)}function Ime(e,t){return Ut(e.getHours(),t,2)}function Rme(e,t){return Ut(e.getHours()%12||12,t,2)}function Dme(e,t){return Ut(1+wp.count(wi(e),e),t,3)}function Z5(e,t){return Ut(e.getMilliseconds(),t,3)}function Lme(e,t){return Z5(e,t)+"000"}function Fme(e,t){return Ut(e.getMonth()+1,t,2)}function Bme(e,t){return Ut(e.getMinutes(),t,2)}function zme(e,t){return Ut(e.getSeconds(),t,2)}function Ume(e){var t=e.getDay();return t===0?7:t}function Vme(e,t){return Ut(hx.count(wi(e)-1,e),t,2)}function Q5(e){var t=e.getDay();return t>=4||t===0?bu(e):bu.ceil(e)}function Wme(e,t){return e=Q5(e),Ut(bu.count(wi(e),e)+(wi(e).getDay()===4),t,2)}function Hme(e){return e.getDay()}function Gme(e,t){return Ut(uv.count(wi(e)-1,e),t,2)}function qme(e,t){return Ut(e.getFullYear()%100,t,2)}function Kme(e,t){return e=Q5(e),Ut(e.getFullYear()%100,t,2)}function Xme(e,t){return Ut(e.getFullYear()%1e4,t,4)}function Yme(e,t){var n=e.getDay();return e=n>=4||n===0?bu(e):bu.ceil(e),Ut(e.getFullYear()%1e4,t,4)}function Zme(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Ut(t/60|0,"0",2)+Ut(t%60,"0",2)}function T2(e,t){return Ut(e.getUTCDate(),t,2)}function Qme(e,t){return Ut(e.getUTCHours(),t,2)}function Jme(e,t){return Ut(e.getUTCHours()%12||12,t,2)}function ege(e,t){return Ut(1+fx.count(ji(e),e),t,3)}function J5(e,t){return Ut(e.getUTCMilliseconds(),t,3)}function tge(e,t){return J5(e,t)+"000"}function nge(e,t){return Ut(e.getUTCMonth()+1,t,2)}function rge(e,t){return Ut(e.getUTCMinutes(),t,2)}function sge(e,t){return Ut(e.getUTCSeconds(),t,2)}function age(e){var t=e.getUTCDay();return t===0?7:t}function ige(e,t){return Ut(px.count(ji(e)-1,e),t,2)}function eF(e){var t=e.getUTCDay();return t>=4||t===0?wu(e):wu.ceil(e)}function oge(e,t){return e=eF(e),Ut(wu.count(ji(e),e)+(ji(e).getUTCDay()===4),t,2)}function lge(e){return e.getUTCDay()}function cge(e,t){return Ut(dv.count(ji(e)-1,e),t,2)}function uge(e,t){return Ut(e.getUTCFullYear()%100,t,2)}function dge(e,t){return e=eF(e),Ut(e.getUTCFullYear()%100,t,2)}function fge(e,t){return Ut(e.getUTCFullYear()%1e4,t,4)}function hge(e,t){var n=e.getUTCDay();return e=n>=4||n===0?wu(e):wu.ceil(e),Ut(e.getUTCFullYear()%1e4,t,4)}function pge(){return"+0000"}function $2(){return"%"}function M2(e){return+e}function I2(e){return Math.floor(+e/1e3)}var cc,tF,nF;mge({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 mge(e){return cc=mme(e),tF=cc.format,cc.parse,nF=cc.utcFormat,cc.utcParse,cc}function gge(e){return new Date(e)}function vge(e){return e instanceof Date?+e:+new Date(+e)}function k_(e,t,n,r,s,a,o,l,c,u){var d=v_(),f=d.invert,h=d.domain,p=u(".%L"),g=u(":%S"),m=u("%I:%M"),y=u("%I %p"),b=u("%a %d"),x=u("%b %d"),w=u("%B"),j=u("%Y");function S(N){return(c(N)t(s/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,a)=>ipe(e,a/r))},n.copy=function(){return iF(t).domain(e)},Oi.apply(n,arguments)}function gx(){var e=0,t=.5,n=1,r=1,s,a,o,l,c,u=Er,d,f=!1,h;function p(m){return isNaN(m=+m)?h:(m=.5+((m=+d(m))-a)*(r*mt}var uF=Nge,_ge=vx,Pge=uF,Age=ud;function Cge(e){return e&&e.length?_ge(e,Age,Pge):void 0}var Ege=Cge;const eo=Gt(Ege);function Oge(e,t){return ee.e^a.s<0?1:-1;for(r=a.d.length,s=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===s?0:r>s^a.s<0?1:-1};We.decimalPlaces=We.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*un;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};We.dividedBy=We.div=function(e){return ui(this,new this.constructor(e))};We.dividedToIntegerBy=We.idiv=function(e){var t=this,n=t.constructor;return en(ui(t,new n(e),0,1),n.precision)};We.equals=We.eq=function(e){return!this.cmp(e)};We.exponent=function(){return Ln(this)};We.greaterThan=We.gt=function(e){return this.cmp(e)>0};We.greaterThanOrEqualTo=We.gte=function(e){return this.cmp(e)>=0};We.isInteger=We.isint=function(){return this.e>this.d.length-2};We.isNegative=We.isneg=function(){return this.s<0};We.isPositive=We.ispos=function(){return this.s>0};We.isZero=function(){return this.s===0};We.lessThan=We.lt=function(e){return this.cmp(e)<0};We.lessThanOrEqualTo=We.lte=function(e){return this.cmp(e)<1};We.logarithm=We.log=function(e){var t,n=this,r=n.constructor,s=r.precision,a=s+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(rs))throw Error(Es+"NaN");if(n.s<1)throw Error(Es+(n.s?"NaN":"-Infinity"));return n.eq(rs)?new r(0):(pn=!1,t=ui(bh(n,a),bh(e,a),a),pn=!0,en(t,s))};We.minus=We.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?mF(t,e):hF(t,(e.s=-e.s,e))};We.modulo=We.mod=function(e){var t,n=this,r=n.constructor,s=r.precision;if(e=new r(e),!e.s)throw Error(Es+"NaN");return n.s?(pn=!1,t=ui(n,e,0,1).times(e),pn=!0,n.minus(t)):en(new r(n),s)};We.naturalExponential=We.exp=function(){return pF(this)};We.naturalLogarithm=We.ln=function(){return bh(this)};We.negated=We.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};We.plus=We.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?hF(t,e):mF(t,(e.s=-e.s,e))};We.precision=We.sd=function(e){var t,n,r,s=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Nl+e);if(t=Ln(s)+1,r=s.d.length-1,n=r*un+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};We.squareRoot=We.sqrt=function(){var e,t,n,r,s,a,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Es+"NaN")}for(e=Ln(l),pn=!1,s=Math.sqrt(+l),s==0||s==1/0?(t=Sa(l.d),(t.length+e)%2==0&&(t+="0"),s=Math.sqrt(t),e=hd((e+1)/2)-(e<0||e%2),s==1/0?t="5e"+e:(t=s.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new c(t)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(a=r,r=a.plus(ui(l,a,o+2)).times(.5),Sa(a.d).slice(0,o)===(t=Sa(r.d)).slice(0,o)){if(t=t.slice(o-3,o+1),s==o&&t=="4999"){if(en(a,n+1,0),a.times(a).eq(l)){r=a;break}}else if(t!="9999")break;o+=4}return pn=!0,en(r,n)};We.times=We.mul=function(e){var t,n,r,s,a,o,l,c,u,d=this,f=d.constructor,h=d.d,p=(e=new f(e)).d;if(!d.s||!e.s)return new f(0);for(e.s*=d.s,n=d.e+e.e,c=h.length,u=p.length,c=0;){for(t=0,s=c+r;s>r;)l=a[s]+p[r]*h[s-r-1]+t,a[s--]=l%Yn|0,t=l/Yn|0;a[s]=(a[s]+t)%Yn|0}for(;!a[--o];)a.pop();return t?++n:a.shift(),e.d=a,e.e=n,pn?en(e,f.precision):e};We.toDecimalPlaces=We.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(Ra(e,0,fd),t===void 0?t=r.rounding:Ra(t,0,8),en(n,e+Ln(n)+1,t))};We.toExponential=function(e,t){var n,r=this,s=r.constructor;return e===void 0?n=Vl(r,!0):(Ra(e,0,fd),t===void 0?t=s.rounding:Ra(t,0,8),r=en(new s(r),e+1,t),n=Vl(r,!0,e+1)),n};We.toFixed=function(e,t){var n,r,s=this,a=s.constructor;return e===void 0?Vl(s):(Ra(e,0,fd),t===void 0?t=a.rounding:Ra(t,0,8),r=en(new a(s),e+Ln(s)+1,t),n=Vl(r.abs(),!1,e+Ln(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};We.toInteger=We.toint=function(){var e=this,t=e.constructor;return en(new t(e),Ln(e)+1,t.rounding)};We.toNumber=function(){return+this};We.toPower=We.pow=function(e){var t,n,r,s,a,o,l=this,c=l.constructor,u=12,d=+(e=new c(e));if(!e.s)return new c(rs);if(l=new c(l),!l.s){if(e.s<1)throw Error(Es+"Infinity");return l}if(l.eq(rs))return l;if(r=c.precision,e.eq(rs))return en(l,r);if(t=e.e,n=e.d.length-1,o=t>=n,a=l.s,o){if((n=d<0?-d:d)<=fF){for(s=new c(rs),t=Math.ceil(r/un+4),pn=!1;n%2&&(s=s.times(l),L2(s.d,t)),n=hd(n/2),n!==0;)l=l.times(l),L2(l.d,t);return pn=!0,e.s<0?new c(rs).div(s):en(s,r)}}else if(a<0)throw Error(Es+"NaN");return a=a<0&&e.d[Math.max(t,n)]&1?-1:1,l.s=1,pn=!1,s=e.times(bh(l,r+u)),pn=!0,s=pF(s),s.s=a,s};We.toPrecision=function(e,t){var n,r,s=this,a=s.constructor;return e===void 0?(n=Ln(s),r=Vl(s,n<=a.toExpNeg||n>=a.toExpPos)):(Ra(e,1,fd),t===void 0?t=a.rounding:Ra(t,0,8),s=en(new a(s),e,t),n=Ln(s),r=Vl(s,e<=n||n<=a.toExpNeg,e)),r};We.toSignificantDigits=We.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(Ra(e,1,fd),t===void 0?t=r.rounding:Ra(t,0,8)),en(new r(n),e,t)};We.toString=We.valueOf=We.val=We.toJSON=We[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Ln(e),n=e.constructor;return Vl(e,t<=n.toExpNeg||t>=n.toExpPos)};function hF(e,t){var n,r,s,a,o,l,c,u,d=e.constructor,f=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),pn?en(t,f):t;if(c=e.d,u=t.d,o=e.e,s=t.e,c=c.slice(),a=o-s,a){for(a<0?(r=c,a=-a,l=u.length):(r=u,s=o,l=c.length),o=Math.ceil(f/un),l=o>l?o+1:l+1,a>l&&(a=l,r.length=1),r.reverse();a--;)r.push(0);r.reverse()}for(l=c.length,a=u.length,l-a<0&&(a=l,r=u,u=c,c=r),n=0;a;)n=(c[--a]=c[a]+u[a]+n)/Yn|0,c[a]%=Yn;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=s,pn?en(t,f):t}function Ra(e,t,n){if(e!==~~e||en)throw Error(Nl+e)}function Sa(e){var t,n,r,s=e.length-1,a="",o=e[0];if(s>0){for(a+=o,t=1;to?1:-1;else for(l=c=0;ls[l]?1:-1;break}return c}function n(r,s,a){for(var o=0;a--;)r[a]-=o,o=r[a]1;)r.shift()}return function(r,s,a,o){var l,c,u,d,f,h,p,g,m,y,b,x,w,j,S,N,_,P,k=r.constructor,O=r.s==s.s?1:-1,M=r.d,A=s.d;if(!r.s)return new k(r);if(!s.s)throw Error(Es+"Division by zero");for(c=r.e-s.e,_=A.length,S=M.length,p=new k(O),g=p.d=[],u=0;A[u]==(M[u]||0);)++u;if(A[u]>(M[u]||0)&&--c,a==null?x=a=k.precision:o?x=a+(Ln(r)-Ln(s))+1:x=a,x<0)return new k(0);if(x=x/un+2|0,u=0,_==1)for(d=0,A=A[0],x++;(u1&&(A=e(A,d),M=e(M,d),_=A.length,S=M.length),j=_,m=M.slice(0,_),y=m.length;y<_;)m[y++]=0;P=A.slice(),P.unshift(0),N=A[0],A[1]>=Yn/2&&++N;do d=0,l=t(A,m,_,y),l<0?(b=m[0],_!=y&&(b=b*Yn+(m[1]||0)),d=b/N|0,d>1?(d>=Yn&&(d=Yn-1),f=e(A,d),h=f.length,y=m.length,l=t(f,m,h,y),l==1&&(d--,n(f,_16)throw Error(M_+Ln(e));if(!e.s)return new d(rs);for(t==null?(pn=!1,l=f):l=t,o=new d(.03125);e.abs().gte(.1);)e=e.times(o),u+=5;for(r=Math.log(Jo(2,u))/Math.LN10*2+5|0,l+=r,n=s=a=new d(rs),d.precision=l;;){if(s=en(s.times(e),l),n=n.times(++c),o=a.plus(ui(s,n,l)),Sa(o.d).slice(0,l)===Sa(a.d).slice(0,l)){for(;u--;)a=en(a.times(a),l);return d.precision=f,t==null?(pn=!0,en(a,f)):a}a=o}}function Ln(e){for(var t=e.e*un,n=e.d[0];n>=10;n/=10)t++;return t}function q0(e,t,n){if(t>e.LN10.sd())throw pn=!0,n&&(e.precision=n),Error(Es+"LN10 precision limit exceeded");return en(new e(e.LN10),t)}function Bi(e){for(var t="";e--;)t+="0";return t}function bh(e,t){var n,r,s,a,o,l,c,u,d,f=1,h=10,p=e,g=p.d,m=p.constructor,y=m.precision;if(p.s<1)throw Error(Es+(p.s?"NaN":"-Infinity"));if(p.eq(rs))return new m(0);if(t==null?(pn=!1,u=y):u=t,p.eq(10))return t==null&&(pn=!0),q0(m,u);if(u+=h,m.precision=u,n=Sa(g),r=n.charAt(0),a=Ln(p),Math.abs(a)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)p=p.times(e),n=Sa(p.d),r=n.charAt(0),f++;a=Ln(p),r>1?(p=new m("0."+n),a++):p=new m(r+"."+n.slice(1))}else return c=q0(m,u+2,y).times(a+""),p=bh(new m(r+"."+n.slice(1)),u-h).plus(c),m.precision=y,t==null?(pn=!0,en(p,y)):p;for(l=o=p=ui(p.minus(rs),p.plus(rs),u),d=en(p.times(p),u),s=3;;){if(o=en(o.times(d),u),c=l.plus(ui(o,new m(s),u)),Sa(c.d).slice(0,u)===Sa(l.d).slice(0,u))return l=l.times(2),a!==0&&(l=l.plus(q0(m,u+2,y).times(a+""))),l=ui(l,new m(f),u),m.precision=y,t==null?(pn=!0,en(l,y)):l;l=c,s+=2}}function D2(e,t){var n,r,s;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(s=t.length;t.charCodeAt(s-1)===48;)--s;if(t=t.slice(r,s),t){if(s-=r,n=n-r-1,e.e=hd(n/un),e.d=[],r=(n+1)%un,n<0&&(r+=un),rfv||e.e<-fv))throw Error(M_+n)}else e.s=0,e.e=0,e.d=[0];return e}function en(e,t,n){var r,s,a,o,l,c,u,d,f=e.d;for(o=1,a=f[0];a>=10;a/=10)o++;if(r=t-o,r<0)r+=un,s=t,u=f[d=0];else{if(d=Math.ceil((r+1)/un),a=f.length,d>=a)return e;for(u=a=f[d],o=1;a>=10;a/=10)o++;r%=un,s=r-un+o}if(n!==void 0&&(a=Jo(10,o-s-1),l=u/a%10|0,c=t<0||f[d+1]!==void 0||u%a,c=n<4?(l||c)&&(n==0||n==(e.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?u/Jo(10,o-s):0:f[d-1])%10&1||n==(e.s<0?8:7))),t<1||!f[0])return c?(a=Ln(e),f.length=1,t=t-a-1,f[0]=Jo(10,(un-t%un)%un),e.e=hd(-t/un)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(r==0?(f.length=d,a=1,d--):(f.length=d+1,a=Jo(10,un-r),f[d]=s>0?(u/Jo(10,o-s)%Jo(10,s)|0)*a:0),c)for(;;)if(d==0){(f[0]+=a)==Yn&&(f[0]=1,++e.e);break}else{if(f[d]+=a,f[d]!=Yn)break;f[d--]=0,a=1}for(r=f.length;f[--r]===0;)f.pop();if(pn&&(e.e>fv||e.e<-fv))throw Error(M_+Ln(e));return e}function mF(e,t){var n,r,s,a,o,l,c,u,d,f,h=e.constructor,p=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),pn?en(t,p):t;if(c=e.d,f=t.d,r=t.e,u=e.e,c=c.slice(),o=u-r,o){for(d=o<0,d?(n=c,o=-o,l=f.length):(n=f,r=u,l=c.length),s=Math.max(Math.ceil(p/un),l)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,l=f.length,d=s0;--s)c[l++]=0;for(s=f.length;s>o;){if(c[--s]0?a=a.charAt(0)+"."+a.slice(1)+Bi(r):o>1&&(a=a.charAt(0)+"."+a.slice(1)),a=a+(s<0?"e":"e+")+s):s<0?(a="0."+Bi(-s-1)+a,n&&(r=n-o)>0&&(a+=Bi(r))):s>=o?(a+=Bi(s+1-o),n&&(r=n-s-1)>0&&(a=a+"."+Bi(r))):((r=s+1)0&&(s+1===o&&(a+="."),a+=Bi(r))),e.s<0?"-"+a:a}function L2(e,t){if(e.length>t)return e.length=t,!0}function gF(e){var t,n,r;function s(a){var o=this;if(!(o instanceof s))return new s(a);if(o.constructor=s,a instanceof s){o.s=a.s,o.e=a.e,o.d=(a=a.d)?a.slice():a;return}if(typeof a=="number"){if(a*0!==0)throw Error(Nl+a);if(a>0)o.s=1;else if(a<0)a=-a,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(a===~~a&&a<1e7){o.e=0,o.d=[a];return}return D2(o,a.toString())}else if(typeof a!="string")throw Error(Nl+a);if(a.charCodeAt(0)===45?(a=a.slice(1),o.s=-1):o.s=1,Zge.test(a))D2(o,a);else throw Error(Nl+a)}if(s.prototype=We,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=gF,s.config=s.set=Qge,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=s[t+1]&&r<=s[t+2])this[n]=r;else throw Error(Nl+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(Nl+n+": "+r);return this}var I_=gF(Yge);rs=new I_(1);const Jt=I_;function Jge(e){return rve(e)||nve(e)||tve(e)||eve()}function eve(){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 tve(e,t){if(e){if(typeof e=="string")return N1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return N1(e,t)}}function nve(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function rve(e){if(Array.isArray(e))return N1(e)}function N1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,s):e(t-o,F2(function(){for(var l=arguments.length,c=new Array(l),u=0;ue.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,s=!1,a=void 0;try{for(var o=e[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(t&&n.length===t));r=!0);}catch(c){s=!0,a=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(s)throw a}}return n}}function yve(e){if(Array.isArray(e))return e}function wF(e){var t=wh(e,2),n=t[0],r=t[1],s=n,a=r;return n>r&&(s=r,a=n),[s,a]}function jF(e,t,n){if(e.lte(0))return new Jt(0);var r=bx.getDigitCount(e.toNumber()),s=new Jt(10).pow(r),a=e.div(s),o=r!==1?.05:.1,l=new Jt(Math.ceil(a.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return t?c:new Jt(Math.ceil(c))}function xve(e,t,n){var r=1,s=new Jt(e);if(!s.isint()&&n){var a=Math.abs(e);a<1?(r=new Jt(10).pow(bx.getDigitCount(e)-1),s=new Jt(Math.floor(s.div(r).toNumber())).mul(r)):a>1&&(s=new Jt(Math.floor(e)))}else e===0?s=new Jt(Math.floor((t-1)/2)):n||(s=new Jt(Math.floor(e)));var o=Math.floor((t-1)/2),l=ove(ive(function(c){return s.add(new Jt(c-o).mul(r)).toNumber()}),_1);return l(0,t)}function SF(e,t,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Jt(0),tickMin:new Jt(0),tickMax:new Jt(0)};var a=jF(new Jt(t).sub(e).div(n-1),r,s),o;e<=0&&t>=0?o=new Jt(0):(o=new Jt(e).add(t).div(2),o=o.sub(new Jt(o).mod(a)));var l=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new Jt(t).sub(o).div(a).toNumber()),u=l+c+1;return u>n?SF(e,t,n,r,s+1):(u0?c+(n-u):c,l=t>0?l:l+(n-u)),{step:a,tickMin:o.sub(new Jt(l).mul(a)),tickMax:o.add(new Jt(c).mul(a))})}function bve(e){var t=wh(e,2),n=t[0],r=t[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=wF([n,r]),c=wh(l,2),u=c[0],d=c[1];if(u===-1/0||d===1/0){var f=d===1/0?[u].concat(A1(_1(0,s-1).map(function(){return 1/0}))):[].concat(A1(_1(0,s-1).map(function(){return-1/0})),[d]);return n>r?P1(f):f}if(u===d)return xve(u,s,a);var h=SF(u,d,o,a),p=h.step,g=h.tickMin,m=h.tickMax,y=bx.rangeStep(g,m.add(new Jt(.1).mul(p)),p);return n>r?P1(y):y}function wve(e,t){var n=wh(e,2),r=n[0],s=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=wF([r,s]),l=wh(o,2),c=l[0],u=l[1];if(c===-1/0||u===1/0)return[r,s];if(c===u)return[c];var d=Math.max(t,2),f=jF(new Jt(u).sub(c).div(d-1),a,0),h=[].concat(A1(bx.rangeStep(new Jt(c),new Jt(u).sub(new Jt(.99).mul(f)),f)),[u]);return r>s?P1(h):h}var jve=xF(bve),Sve=xF(wve),Nve="Invariant failed";function Wl(e,t){throw new Error(Nve)}var _ve=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function ju(e){"@babel/helpers - typeof";return ju=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ju(e)}function hv(){return hv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Tve(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function $ve(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Mve(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,a=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(a&&a.axisType==="angleAxis"&&Math.abs(Math.abs(a.range[1]-a.range[0])-360)<=1e-6)for(var c=a.range,u=0;u0?s[u-1].coordinate:s[l-1].coordinate,f=s[u].coordinate,h=u>=l-1?s[0].coordinate:s[u+1].coordinate,p=void 0;if(Ar(f-d)!==Ar(h-f)){var g=[];if(Ar(h-f)===Ar(c[1]-c[0])){p=h;var m=f+c[1]-c[0];g[0]=Math.min(m,(m+d)/2),g[1]=Math.max(m,(m+d)/2)}else{p=d;var y=h+c[1]-c[0];g[0]=Math.min(f,(y+f)/2),g[1]=Math.max(f,(y+f)/2)}var b=[Math.min(f,(p+f)/2),Math.max(f,(p+f)/2)];if(t>b[0]&&t<=b[1]||t>=g[0]&&t<=g[1]){o=s[u].index;break}}else{var x=Math.min(d,h),w=Math.max(d,h);if(t>(x+f)/2&&t<=(w+f)/2){o=s[u].index;break}}}else for(var j=0;j0&&j(r[j].coordinate+r[j-1].coordinate)/2&&t<=(r[j].coordinate+r[j+1].coordinate)/2||j===l-1&&t>(r[j].coordinate+r[j-1].coordinate)/2){o=r[j].index;break}return o},R_=function(t){var n,r=t,s=r.type.displayName,a=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Nn(Nn({},t.type.defaultProps),t.props):t.props,o=a.stroke,l=a.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},Zve=function(t){var n=t.barSize,r=t.totalSize,s=t.stackGroups,a=s===void 0?{}:s;if(!a)return{};for(var o={},l=Object.keys(a),c=0,u=l.length;c=0});if(b&&b.length){var x=b[0].type.defaultProps,w=x!==void 0?Nn(Nn({},x),b[0].props):b[0].props,j=w.barSize,S=w[y];o[S]||(o[S]=[]);var N=Nt(j)?n:j;o[S].push({item:b[0],stackList:b.slice(1),barSize:Nt(N)?void 0:Cr(N,r,0)})}}return o},Qve=function(t){var n=t.barGap,r=t.barCategoryGap,s=t.bandSize,a=t.sizeList,o=a===void 0?[]:a,l=t.maxBarSize,c=o.length;if(c<1)return null;var u=Cr(n,s,0,!0),d,f=[];if(o[0].barSize===+o[0].barSize){var h=!1,p=s/c,g=o.reduce(function(j,S){return j+S.barSize||0},0);g+=(c-1)*u,g>=s&&(g-=(c-1)*u,u=0),g>=s&&p>0&&(h=!0,p*=.9,g=c*p);var m=(s-g)/2>>0,y={offset:m-u,size:0};d=o.reduce(function(j,S){var N={item:S.item,position:{offset:y.offset+y.size+u,size:h?p:S.barSize}},_=[].concat(U2(j),[N]);return y=_[_.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(P){_.push({item:P,position:y})}),_},f)}else{var b=Cr(r,s,0,!0);s-2*b-(c-1)*u<=0&&(u=0);var x=(s-2*b-(c-1)*u)/c;x>1&&(x>>=0);var w=l===+l?Math.min(x,l):x;d=o.reduce(function(j,S,N){var _=[].concat(U2(j),[{item:S.item,position:{offset:b+(x+u)*N+(x-w)/2,size:w}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(P){_.push({item:P,position:_[_.length-1].position})}),_},f)}return d},Jve=function(t,n,r,s){var a=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),u=AF({children:a,legendWidth:c});if(u){var d=s||{},f=d.width,h=d.height,p=u.align,g=u.verticalAlign,m=u.layout;if((m==="vertical"||m==="horizontal"&&g==="middle")&&p!=="center"&&Ae(t[p]))return Nn(Nn({},t),{},Wc({},p,t[p]+(f||0)));if((m==="horizontal"||m==="vertical"&&p==="center")&&g!=="middle"&&Ae(t[g]))return Nn(Nn({},t),{},Wc({},g,t[g]+(h||0)))}return t},eye=function(t,n,r){return Nt(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},CF=function(t,n,r,s,a){var o=n.props.children,l=Ps(o,wx).filter(function(u){return eye(s,a,u.props.direction)});if(l&&l.length){var c=l.map(function(u){return u.props.dataKey});return t.reduce(function(u,d){var f=En(d,r);if(Nt(f))return u;var h=Array.isArray(f)?[yx(f),eo(f)]:[f,f],p=c.reduce(function(g,m){var y=En(d,m,0),b=h[0]-Math.abs(Array.isArray(y)?y[0]:y),x=h[1]+Math.abs(Array.isArray(y)?y[1]:y);return[Math.min(b,g[0]),Math.max(x,g[1])]},[1/0,-1/0]);return[Math.min(p[0],u[0]),Math.max(p[1],u[1])]},[1/0,-1/0])}return null},tye=function(t,n,r,s,a){var o=n.map(function(l){return CF(t,l,r,a,s)}).filter(function(l){return!Nt(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},EF=function(t,n,r,s,a){var o=n.map(function(c){var u=c.props.dataKey;return r==="number"&&u&&CF(t,c,u,s)||hf(t,u,r,a)});if(r==="number")return o.reduce(function(c,u){return[Math.min(c[0],u[0]),Math.max(c[1],u[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,u){for(var d=0,f=u.length;d=2?Ar(l[0]-l[1])*2*u:u,n&&(t.ticks||t.niceTicks)){var d=(t.ticks||t.niceTicks).map(function(f){var h=a?a.indexOf(f):f;return{coordinate:s(h)+u,value:f,offset:u}});return d.filter(function(f){return!id(f.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(f,h){return{coordinate:s(f)+u,value:f,index:h,offset:u}}):s.ticks&&!r?s.ticks(t.tickCount).map(function(f){return{coordinate:s(f)+u,value:f,offset:u}}):s.domain().map(function(f,h){return{coordinate:s(f)+u,value:a?a[f]:f,index:h,offset:u}})},K0=new WeakMap,im=function(t,n){if(typeof n!="function")return t;K0.has(t)||K0.set(t,new WeakMap);var r=K0.get(t);if(r.has(n))return r.get(n);var s=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},TF=function(t,n,r){var s=t.scale,a=t.type,o=t.layout,l=t.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:mh(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:lv(),realScaleType:"linear"}:a==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:ff(),realScaleType:"point"}:a==="category"?{scale:mh(),realScaleType:"band"}:{scale:lv(),realScaleType:"linear"};if(mp(s)){var c="scale".concat(sx(s));return{scale:(R2[c]||ff)(),realScaleType:R2[c]?c:"point"}}return ht(s)?{scale:s}:{scale:ff(),realScaleType:"point"}},W2=1e-4,$F=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,s=t.range(),a=Math.min(s[0],s[1])-W2,o=Math.max(s[0],s[1])+W2,l=t(n[0]),c=t(n[r-1]);(lo||co)&&t.domain([n[0],n[r-1]])}},nye=function(t,n){if(!t)return null;for(var r=0,s=t.length;rs)&&(a[1]=s),a[0]>s&&(a[0]=s),a[1]=0?(t[l][r][0]=a,t[l][r][1]=a+c,a=t[l][r][1]):(t[l][r][0]=o,t[l][r][1]=o+c,o=t[l][r][1])}},aye=function(t){var n=t.length;if(!(n<=0))for(var r=0,s=t[0].length;r=0?(t[o][r][0]=a,t[o][r][1]=a+l,a=t[o][r][1]):(t[o][r][0]=0,t[o][r][1]=0)}},iye={sign:sye,expand:_se,none:pu,silhouette:Pse,wiggle:Ase,positive:aye},oye=function(t,n,r){var s=n.map(function(l){return l.props.dataKey}),a=iye[r],o=Nse().keys(s).value(function(l,c){return+En(l,c,0)}).order(t1).offset(a);return o(t)},lye=function(t,n,r,s,a,o){if(!t)return null;var l=o?n.reverse():n,c={},u=l.reduce(function(f,h){var p,g=(p=h.type)!==null&&p!==void 0&&p.defaultProps?Nn(Nn({},h.type.defaultProps),h.props):h.props,m=g.stackId,y=g.hide;if(y)return f;var b=g[r],x=f[b]||{hasStack:!1,stackGroups:{}};if(qn(m)){var w=x.stackGroups[m]||{numericAxisId:r,cateAxisId:s,items:[]};w.items.push(h),x.hasStack=!0,x.stackGroups[m]=w}else x.stackGroups[od("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[h]};return Nn(Nn({},f),{},Wc({},b,x))},c),d={};return Object.keys(u).reduce(function(f,h){var p=u[h];if(p.hasStack){var g={};p.stackGroups=Object.keys(p.stackGroups).reduce(function(m,y){var b=p.stackGroups[y];return Nn(Nn({},m),{},Wc({},y,{numericAxisId:r,cateAxisId:s,items:b.items,stackedData:oye(t,b.items,a)}))},g)}return Nn(Nn({},f),{},Wc({},h,p))},d)},MF=function(t,n){var r=n.realScaleType,s=n.type,a=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(a&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var u=t.domain();if(!u.length)return null;var d=jve(u,a,l);return t.domain([yx(d),eo(d)]),{niceTicks:d}}if(a&&s==="number"){var f=t.domain(),h=Sve(f,a,l);return{niceTicks:h}}return null};function H2(e){var t=e.axis,n=e.ticks,r=e.bandSize,s=e.entry,a=e.index,o=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Nt(s[t.dataKey])){var l=zg(n,"value",s[t.dataKey]);if(l)return l.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=En(s,Nt(o)?t.dataKey:o);return Nt(c)?null:t.scale(c)}var G2=function(t){var n=t.axis,r=t.ticks,s=t.offset,a=t.bandSize,o=t.entry,l=t.index;if(n.type==="category")return r[l]?r[l].coordinate+s:null;var c=En(o,n.dataKey,n.domain[l]);return Nt(c)?null:n.scale(c)-a/2+s},cye=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return s<=0&&a>=0?0:a<0?a:s}return r[0]},uye=function(t,n){var r,s=(r=t.type)!==null&&r!==void 0&&r.defaultProps?Nn(Nn({},t.type.defaultProps),t.props):t.props,a=s.stackId;if(qn(a)){var o=n[a];if(o){var l=o.items.indexOf(t);return l>=0?o.stackedData[l]:null}}return null},dye=function(t){return t.reduce(function(n,r){return[yx(r.concat([n[0]]).filter(Ae)),eo(r.concat([n[1]]).filter(Ae))]},[1/0,-1/0])},IF=function(t,n,r){return Object.keys(t).reduce(function(s,a){var o=t[a],l=o.stackedData,c=l.reduce(function(u,d){var f=dye(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(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},q2=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,K2=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,k1=function(t,n,r){if(ht(t))return t(n,r);if(!Array.isArray(t))return n;var s=[];if(Ae(t[0]))s[0]=r?t[0]:Math.min(t[0],n[0]);else if(q2.test(t[0])){var a=+q2.exec(t[0])[1];s[0]=n[0]-a}else ht(t[0])?s[0]=t[0](n[0]):s[0]=n[0];if(Ae(t[1]))s[1]=r?t[1]:Math.max(t[1],n[1]);else if(K2.test(t[1])){var o=+K2.exec(t[1])[1];s[1]=n[1]+o}else ht(t[1])?s[1]=t[1](n[1]):s[1]=n[1];return s},mv=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var s=t.scale.bandwidth();if(!r||s>0)return s}if(t&&n&&n.length>=2){for(var a=u_(n,function(f){return f.coordinate}),o=1/0,l=1,c=a.length;le.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},FF=function(t,n,r,s,a){var o=t.width,l=t.height,c=t.startAngle,u=t.endAngle,d=Cr(t.cx,o,o/2),f=Cr(t.cy,l,l/2),h=LF(o,l,r),p=Cr(t.innerRadius,h,0),g=Cr(t.outerRadius,h,h*.8),m=Object.keys(n);return m.reduce(function(y,b){var x=n[b],w=x.domain,j=x.reversed,S;if(Nt(x.range))s==="angleAxis"?S=[c,u]:s==="radiusAxis"&&(S=[p,g]),j&&(S=[S[1],S[0]]);else{S=x.range;var N=S,_=pye(N,2);c=_[0],u=_[1]}var P=TF(x,a),k=P.realScaleType,O=P.scale;O.domain(w).range(S),$F(O);var M=MF(O,Xa(Xa({},x),{},{realScaleType:k})),A=Xa(Xa(Xa({},x),M),{},{range:S,radius:g,realScaleType:k,scale:O,cx:d,cy:f,innerRadius:p,outerRadius:g,startAngle:c,endAngle:u});return Xa(Xa({},y),{},DF({},b,A))},{})},bye=function(t,n){var r=t.x,s=t.y,a=n.x,o=n.y;return Math.sqrt(Math.pow(r-a,2)+Math.pow(s-o,2))},wye=function(t,n){var r=t.x,s=t.y,a=n.cx,o=n.cy,l=bye({x:r,y:s},{x:a,y:o});if(l<=0)return{radius:l};var c=(r-a)/l,u=Math.acos(c);return s>o&&(u=2*Math.PI-u),{radius:l,angle:xye(u),angleInRadian:u}},jye=function(t){var n=t.startAngle,r=t.endAngle,s=Math.floor(n/360),a=Math.floor(r/360),o=Math.min(s,a);return{startAngle:n-o*360,endAngle:r-o*360}},Sye=function(t,n){var r=n.startAngle,s=n.endAngle,a=Math.floor(r/360),o=Math.floor(s/360),l=Math.min(a,o);return t+l*360},Q2=function(t,n){var r=t.x,s=t.y,a=wye({x:r,y:s},n),o=a.radius,l=a.angle,c=n.innerRadius,u=n.outerRadius;if(ou)return!1;if(o===0)return!0;var d=jye(n),f=d.startAngle,h=d.endAngle,p=l,g;if(f<=h){for(;p>h;)p-=360;for(;p=f&&p<=h}else{for(;p>f;)p-=360;for(;p=h&&p<=f}return g?Xa(Xa({},n),{},{radius:o,angle:Sye(p,n)}):null},BF=function(t){return!v.isValidElement(t)&&!ht(t)&&typeof t!="boolean"?t.className:""};function _h(e){"@babel/helpers - typeof";return _h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_h(e)}var Nye=["offset"];function _ye(e){return Eye(e)||Cye(e)||Aye(e)||Pye()}function Pye(){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 Aye(e,t){if(e){if(typeof e=="string")return T1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return T1(e,t)}}function Cye(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Eye(e){if(Array.isArray(e))return T1(e)}function T1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kye(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function J2(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function Bn(e){for(var t=1;t=0?1:-1,w,j;s==="insideStart"?(w=p+x*o,j=m):s==="insideEnd"?(w=g-x*o,j=!m):s==="end"&&(w=g+x*o,j=m),j=b<=0?j:!j;var S=Ht(u,d,y,w),N=Ht(u,d,y,w+(j?1:-1)*359),_="M".concat(S.x,",").concat(S.y,` + A`).concat(y,",").concat(y,",0,1,").concat(j?0:1,`, + `).concat(N.x,",").concat(N.y),P=Nt(t.id)?od("recharts-radial-line-"):t.id;return E.createElement("text",Ph({},r,{dominantBaseline:"central",className:wt("recharts-radial-bar-label",l)}),E.createElement("defs",null,E.createElement("path",{id:P,d:_})),E.createElement("textPath",{xlinkHref:"#".concat(P)},n))},Lye=function(t){var n=t.viewBox,r=t.offset,s=t.position,a=n,o=a.cx,l=a.cy,c=a.innerRadius,u=a.outerRadius,d=a.startAngle,f=a.endAngle,h=(d+f)/2;if(s==="outside"){var p=Ht(o,l,u+r,h),g=p.x,m=p.y;return{x:g,y:m,textAnchor:g>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var y=(c+u)/2,b=Ht(o,l,y,h),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},Fye=function(t){var n=t.viewBox,r=t.parentViewBox,s=t.offset,a=t.position,o=n,l=o.x,c=o.y,u=o.width,d=o.height,f=d>=0?1:-1,h=f*s,p=f>0?"end":"start",g=f>0?"start":"end",m=u>=0?1:-1,y=m*s,b=m>0?"end":"start",x=m>0?"start":"end";if(a==="top"){var w={x:l+u/2,y:c-f*s,textAnchor:"middle",verticalAnchor:p};return Bn(Bn({},w),r?{height:Math.max(c-r.y,0),width:u}:{})}if(a==="bottom"){var j={x:l+u/2,y:c+d+h,textAnchor:"middle",verticalAnchor:g};return Bn(Bn({},j),r?{height:Math.max(r.y+r.height-(c+d),0),width:u}:{})}if(a==="left"){var S={x:l-y,y:c+d/2,textAnchor:b,verticalAnchor:"middle"};return Bn(Bn({},S),r?{width:Math.max(S.x-r.x,0),height:d}:{})}if(a==="right"){var N={x:l+u+y,y:c+d/2,textAnchor:x,verticalAnchor:"middle"};return Bn(Bn({},N),r?{width:Math.max(r.x+r.width-N.x,0),height:d}:{})}var _=r?{width:u,height:d}:{};return a==="insideLeft"?Bn({x:l+y,y:c+d/2,textAnchor:x,verticalAnchor:"middle"},_):a==="insideRight"?Bn({x:l+u-y,y:c+d/2,textAnchor:b,verticalAnchor:"middle"},_):a==="insideTop"?Bn({x:l+u/2,y:c+h,textAnchor:"middle",verticalAnchor:g},_):a==="insideBottom"?Bn({x:l+u/2,y:c+d-h,textAnchor:"middle",verticalAnchor:p},_):a==="insideTopLeft"?Bn({x:l+y,y:c+h,textAnchor:x,verticalAnchor:g},_):a==="insideTopRight"?Bn({x:l+u-y,y:c+h,textAnchor:b,verticalAnchor:g},_):a==="insideBottomLeft"?Bn({x:l+y,y:c+d-h,textAnchor:x,verticalAnchor:p},_):a==="insideBottomRight"?Bn({x:l+u-y,y:c+d-h,textAnchor:b,verticalAnchor:p},_):nd(a)&&(Ae(a.x)||ll(a.x))&&(Ae(a.y)||ll(a.y))?Bn({x:l+Cr(a.x,u),y:c+Cr(a.y,d),textAnchor:"end",verticalAnchor:"end"},_):Bn({x:l+u/2,y:c+d/2,textAnchor:"middle",verticalAnchor:"middle"},_)},Bye=function(t){return"cx"in t&&Ae(t.cx)};function Jn(e){var t=e.offset,n=t===void 0?5:t,r=Oye(e,Nye),s=Bn({offset:n},r),a=s.viewBox,o=s.position,l=s.value,c=s.children,u=s.content,d=s.className,f=d===void 0?"":d,h=s.textBreakAll;if(!a||Nt(l)&&Nt(c)&&!v.isValidElement(u)&&!ht(u))return null;if(v.isValidElement(u))return v.cloneElement(u,s);var p;if(ht(u)){if(p=v.createElement(u,s),v.isValidElement(p))return p}else p=Iye(s);var g=Bye(a),m=Xe(s,!0);if(g&&(o==="insideStart"||o==="insideEnd"||o==="end"))return Dye(s,p,m);var y=g?Lye(s):Fye(s);return E.createElement(zl,Ph({className:wt("recharts-label",f)},m,y,{breakAll:h}),p)}Jn.displayName="Label";var zF=function(t){var n=t.cx,r=t.cy,s=t.angle,a=t.startAngle,o=t.endAngle,l=t.r,c=t.radius,u=t.innerRadius,d=t.outerRadius,f=t.x,h=t.y,p=t.top,g=t.left,m=t.width,y=t.height,b=t.clockWise,x=t.labelViewBox;if(x)return x;if(Ae(m)&&Ae(y)){if(Ae(f)&&Ae(h))return{x:f,y:h,width:m,height:y};if(Ae(p)&&Ae(g))return{x:p,y:g,width:m,height:y}}return Ae(f)&&Ae(h)?{x:f,y:h,width:0,height:0}:Ae(n)&&Ae(r)?{cx:n,cy:r,startAngle:a||s||0,endAngle:o||s||0,innerRadius:u||0,outerRadius:d||c||l||0,clockWise:b}:t.viewBox?t.viewBox:{}},zye=function(t,n){return t?t===!0?E.createElement(Jn,{key:"label-implicit",viewBox:n}):qn(t)?E.createElement(Jn,{key:"label-implicit",viewBox:n,value:t}):v.isValidElement(t)?t.type===Jn?v.cloneElement(t,{key:"label-implicit",viewBox:n}):E.createElement(Jn,{key:"label-implicit",content:t,viewBox:n}):ht(t)?E.createElement(Jn,{key:"label-implicit",content:t,viewBox:n}):nd(t)?E.createElement(Jn,Ph({viewBox:n},t,{key:"label-implicit"})):null:null},Uye=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var s=t.children,a=zF(t),o=Ps(s,Jn).map(function(c,u){return v.cloneElement(c,{viewBox:n||a,key:"label-".concat(u)})});if(!r)return o;var l=zye(t.label,n||a);return[l].concat(_ye(o))};Jn.parseViewBox=zF;Jn.renderCallByParent=Uye;function Vye(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var Wye=Vye;const UF=Gt(Wye);function Ah(e){"@babel/helpers - typeof";return Ah=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ah(e)}var Hye=["valueAccessor"],Gye=["data","dataKey","clockWise","id","textBreakAll"];function qye(e){return Zye(e)||Yye(e)||Xye(e)||Kye()}function Kye(){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 Xye(e,t){if(e){if(typeof e=="string")return $1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $1(e,t)}}function Yye(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Zye(e){if(Array.isArray(e))return $1(e)}function $1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function txe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var nxe=function(t){return Array.isArray(t.value)?UF(t.value):t.value};function Ea(e){var t=e.valueAccessor,n=t===void 0?nxe:t,r=nO(e,Hye),s=r.data,a=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,u=nO(r,Gye);return!s||!s.length?null:E.createElement(Rt,{className:"recharts-label-list"},s.map(function(d,f){var h=Nt(a)?n(d,f):En(d&&d.payload,a),p=Nt(l)?{}:{id:"".concat(l,"-").concat(f)};return E.createElement(Jn,vv({},Xe(d,!0),u,p,{parentViewBox:d.parentViewBox,value:h,textBreakAll:c,viewBox:Jn.parseViewBox(Nt(o)?d:tO(tO({},d),{},{clockWise:o})),key:"label-".concat(f),index:f}))}))}Ea.displayName="LabelList";function rxe(e,t){return e?e===!0?E.createElement(Ea,{key:"labelList-implicit",data:t}):E.isValidElement(e)||ht(e)?E.createElement(Ea,{key:"labelList-implicit",data:t,content:e}):nd(e)?E.createElement(Ea,vv({data:t},e,{key:"labelList-implicit"})):null:null}function sxe(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,s=Ps(r,Ea).map(function(o,l){return v.cloneElement(o,{data:t,key:"labelList-".concat(l)})});if(!n)return s;var a=rxe(e.label,t);return[a].concat(qye(s))}Ea.renderCallByParent=sxe;function Ch(e){"@babel/helpers - typeof";return Ch=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ch(e)}function M1(){return M1=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(o>u),`, + `).concat(f.x,",").concat(f.y,` + `);if(s>0){var p=Ht(n,r,s,o),g=Ht(n,r,s,u);h+="L ".concat(g.x,",").concat(g.y,` + A `).concat(s,",").concat(s,`,0, + `).concat(+(Math.abs(c)>180),",").concat(+(o<=u),`, + `).concat(p.x,",").concat(p.y," Z")}else h+="L ".concat(n,",").concat(r," Z");return h},cxe=function(t){var n=t.cx,r=t.cy,s=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,l=t.forceCornerRadius,c=t.cornerIsExternal,u=t.startAngle,d=t.endAngle,f=Ar(d-u),h=om({cx:n,cy:r,radius:a,angle:u,sign:f,cornerRadius:o,cornerIsExternal:c}),p=h.circleTangency,g=h.lineTangency,m=h.theta,y=om({cx:n,cy:r,radius:a,angle:d,sign:-f,cornerRadius:o,cornerIsExternal:c}),b=y.circleTangency,x=y.lineTangency,w=y.theta,j=c?Math.abs(u-d):Math.abs(u-d)-m-w;if(j<0)return l?"M ".concat(g.x,",").concat(g.y,` + a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0 + a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0 + `):VF({cx:n,cy:r,innerRadius:s,outerRadius:a,startAngle:u,endAngle:d});var S="M ".concat(g.x,",").concat(g.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(p.x,",").concat(p.y,` + A`).concat(a,",").concat(a,",0,").concat(+(j>180),",").concat(+(f<0),",").concat(b.x,",").concat(b.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(x.x,",").concat(x.y,` + `);if(s>0){var N=om({cx:n,cy:r,radius:s,angle:u,sign:f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),_=N.circleTangency,P=N.lineTangency,k=N.theta,O=om({cx:n,cy:r,radius:s,angle:d,sign:-f,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),M=O.circleTangency,A=O.lineTangency,$=O.theta,L=c?Math.abs(u-d):Math.abs(u-d)-k-$;if(L<0&&o===0)return"".concat(S,"L").concat(n,",").concat(r,"Z");S+="L".concat(A.x,",").concat(A.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(M.x,",").concat(M.y,` + A`).concat(s,",").concat(s,",0,").concat(+(L>180),",").concat(+(f>0),",").concat(_.x,",").concat(_.y,` + A`).concat(o,",").concat(o,",0,0,").concat(+(f<0),",").concat(P.x,",").concat(P.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},uxe={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},WF=function(t){var n=sO(sO({},uxe),t),r=n.cx,s=n.cy,a=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,u=n.cornerIsExternal,d=n.startAngle,f=n.endAngle,h=n.className;if(o0&&Math.abs(d-f)<360?y=cxe({cx:r,cy:s,innerRadius:a,outerRadius:o,cornerRadius:Math.min(m,g/2),forceCornerRadius:c,cornerIsExternal:u,startAngle:d,endAngle:f}):y=VF({cx:r,cy:s,innerRadius:a,outerRadius:o,startAngle:d,endAngle:f}),E.createElement("path",M1({},Xe(n,!0),{className:p,d:y,role:"img"}))};function Eh(e){"@babel/helpers - typeof";return Eh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Eh(e)}function I1(){return I1=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function _xe(e,t){return pd(e.getTime(),t.getTime())}function fO(e,t,n){if(e.size!==t.size)return!1;for(var r={},s=e.entries(),a=0,o,l;(o=s.next())&&!o.done;){for(var c=t.entries(),u=!1,d=0;(l=c.next())&&!l.done;){var f=o.value,h=f[0],p=f[1],g=l.value,m=g[0],y=g[1];!u&&!r[d]&&(u=n.equals(h,m,a,d,e,t,n)&&n.equals(p,y,h,m,e,t,n))&&(r[d]=!0),d++}if(!u)return!1;a++}return!0}function Pxe(e,t,n){var r=dO(e),s=r.length;if(dO(t).length!==s)return!1;for(var a;s-- >0;)if(a=r[s],a===XF&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!KF(t,a)||!n.equals(e[a],t[a],a,a,e,t,n))return!1;return!0}function Bd(e,t,n){var r=cO(e),s=r.length;if(cO(t).length!==s)return!1;for(var a,o,l;s-- >0;)if(a=r[s],a===XF&&(e.$$typeof||t.$$typeof)&&e.$$typeof!==t.$$typeof||!KF(t,a)||!n.equals(e[a],t[a],a,a,e,t,n)||(o=uO(e,a),l=uO(t,a),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function Axe(e,t){return pd(e.valueOf(),t.valueOf())}function Cxe(e,t){return e.source===t.source&&e.flags===t.flags}function hO(e,t,n){if(e.size!==t.size)return!1;for(var r={},s=e.values(),a,o;(a=s.next())&&!a.done;){for(var l=t.values(),c=!1,u=0;(o=l.next())&&!o.done;)!c&&!r[u]&&(c=n.equals(a.value,o.value,a.value,o.value,e,t,n))&&(r[u]=!0),u++;if(!c)return!1}return!0}function Exe(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}var Oxe="[object Arguments]",kxe="[object Boolean]",Txe="[object Date]",$xe="[object Map]",Mxe="[object Number]",Ixe="[object Object]",Rxe="[object RegExp]",Dxe="[object Set]",Lxe="[object String]",Fxe=Array.isArray,pO=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,mO=Object.assign,Bxe=Object.prototype.toString.call.bind(Object.prototype.toString);function zxe(e){var t=e.areArraysEqual,n=e.areDatesEqual,r=e.areMapsEqual,s=e.areObjectsEqual,a=e.arePrimitiveWrappersEqual,o=e.areRegExpsEqual,l=e.areSetsEqual,c=e.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 s(d,f,h);if(Fxe(d))return t(d,f,h);if(pO!=null&&pO(d))return c(d,f,h);if(p===Date)return n(d,f,h);if(p===RegExp)return o(d,f,h);if(p===Map)return r(d,f,h);if(p===Set)return l(d,f,h);var g=Bxe(d);return g===Txe?n(d,f,h):g===Rxe?o(d,f,h):g===$xe?r(d,f,h):g===Dxe?l(d,f,h):g===Ixe?typeof d.then!="function"&&typeof f.then!="function"&&s(d,f,h):g===Oxe?s(d,f,h):g===kxe||g===Mxe||g===Lxe?a(d,f,h):!1}}function Uxe(e){var t=e.circular,n=e.createCustomConfig,r=e.strict,s={areArraysEqual:r?Bd:Nxe,areDatesEqual:_xe,areMapsEqual:r?lO(fO,Bd):fO,areObjectsEqual:r?Bd:Pxe,arePrimitiveWrappersEqual:Axe,areRegExpsEqual:Cxe,areSetsEqual:r?lO(hO,Bd):hO,areTypedArraysEqual:r?Bd:Exe};if(n&&(s=mO({},s,n(s))),t){var a=cm(s.areArraysEqual),o=cm(s.areMapsEqual),l=cm(s.areObjectsEqual),c=cm(s.areSetsEqual);s=mO({},s,{areArraysEqual:a,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function Vxe(e){return function(t,n,r,s,a,o,l){return e(t,n,l)}}function Wxe(e){var t=e.circular,n=e.comparator,r=e.createState,s=e.equals,a=e.strict;if(r)return function(c,u){var d=r(),f=d.cache,h=f===void 0?t?new WeakMap:void 0:f,p=d.meta;return n(c,u,{cache:h,equals:s,meta:p,strict:a})};if(t)return function(c,u){return n(c,u,{cache:new WeakMap,equals:s,meta:void 0,strict:a})};var o={cache:void 0,equals:s,meta:void 0,strict:a};return function(c,u){return n(c,u,o)}}var Hxe=Vo();Vo({strict:!0});Vo({circular:!0});Vo({circular:!0,strict:!0});Vo({createInternalComparator:function(){return pd}});Vo({strict:!0,createInternalComparator:function(){return pd}});Vo({circular:!0,createInternalComparator:function(){return pd}});Vo({circular:!0,createInternalComparator:function(){return pd},strict:!0});function Vo(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,r=e.createInternalComparator,s=e.createState,a=e.strict,o=a===void 0?!1:a,l=Uxe(e),c=zxe(l),u=r?r(c):Vxe(c);return Wxe({circular:n,comparator:c,createState:s,equals:u,strict:o})}function Gxe(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function gO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(a){n<0&&(n=a),a-n>t?(e(a),n=-1):Gxe(s)};requestAnimationFrame(r)}function R1(e){"@babel/helpers - typeof";return R1=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R1(e)}function qxe(e){return Zxe(e)||Yxe(e)||Xxe(e)||Kxe()}function Kxe(){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 Xxe(e,t){if(e){if(typeof e=="string")return vO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vO(e,t)}}function vO(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:b<0?0:b},m=function(b){for(var x=b>1?1:b,w=x,j=0;j<8;++j){var S=f(w)-x,N=p(w);if(Math.abs(S-x)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,s=t.damping,a=s===void 0?8:s,o=t.dt,l=o===void 0?17:o,c=function(d,f,h){var p=-(d-f)*r,g=h*a,m=h+(p-g)*l/1e3,y=h*l/1e3+d;return Math.abs(y-f)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function C0e(e,t){if(e==null)return{};var n={},r=Object.keys(e),s,a;for(a=0;a=0)&&(n[s]=e[s]);return n}function X0(e){return T0e(e)||k0e(e)||O0e(e)||E0e()}function E0e(){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 O0e(e,t){if(e){if(typeof e=="string")return z1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return z1(e,t)}}function k0e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function T0e(e){if(Array.isArray(e))return z1(e)}function z1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);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 bv(e){return bv=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bv(e)}var oa=function(e){D0e(n,e);var t=L0e(n);function n(r,s){var a;$0e(this,n),a=t.call(this,r,s);var o=a.props,l=o.isActive,c=o.attributeName,u=o.from,d=o.to,f=o.steps,h=o.children,p=o.duration;if(a.handleStyleChange=a.handleStyleChange.bind(W1(a)),a.changeStyle=a.changeStyle.bind(W1(a)),!l||p<=0)return a.state={style:{}},typeof h=="function"&&(a.state={style:d}),V1(a);if(f&&f.length)a.state={style:f[0].style};else if(u){if(typeof h=="function")return a.state={style:u},V1(a);a.state={style:c?Qd({},c,u):u}}else a.state={style:{}};return a}return I0e(n,[{key:"componentDidMount",value:function(){var s=this.props,a=s.isActive,o=s.canBegin;this.mounted=!0,!(!a||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var a=this.props,o=a.isActive,l=a.canBegin,c=a.attributeName,u=a.shouldReAnimate,d=a.to,f=a.from,h=this.state.style;if(l){if(!o){var p={style:c?Qd({},c,d):d};this.state&&h&&(c&&h[c]!==d||!c&&h!==d)&&this.setState(p);return}if(!(Hxe(s.to,d)&&s.canBegin&&s.isActive)){var g=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var m=g||u?f:s.to;if(this.state&&h){var y={style:c?Qd({},c,m):m};(c&&h[c]!==m||!c&&h!==m)&&this.setState(y)}this.runAnimation(Ms(Ms({},this.props),{},{from:m,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var a=this,o=s.from,l=s.to,c=s.duration,u=s.easing,d=s.begin,f=s.onAnimationEnd,h=s.onAnimationStart,p=_0e(o,l,p0e(u),c,this.changeStyle),g=function(){a.stopJSAnimation=p()};this.manager.start([h,d,g,c,f])}},{key:"runStepAnimation",value:function(s){var a=this,o=s.steps,l=s.begin,c=s.onAnimationStart,u=o[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,j=w===void 0?"ease":w,S=y.style,N=y.properties,_=y.onAnimationEnd,P=b>0?o[b-1]:y,k=N||Object.keys(S);if(typeof j=="function"||j==="spring")return[].concat(X0(m),[a.runJSAnimation.bind(a,{from:P.style,to:S,duration:x,easing:j}),x]);var O=bO(k,x,j),M=Ms(Ms(Ms({},P.style),S),{},{transition:O});return[].concat(X0(m),[M,x,_]).filter(n0e)};return this.manager.start([c].concat(X0(o.reduce(p,[d,Math.max(h,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=Qxe());var a=s.begin,o=s.duration,l=s.attributeName,c=s.to,u=s.easing,d=s.onAnimationStart,f=s.onAnimationEnd,h=s.steps,p=s.children,g=this.manager;if(this.unSubscribe=g.subscribe(this.handleStyleChange),typeof u=="function"||typeof p=="function"||u==="spring"){this.runJSAnimation(s);return}if(h.length>1){this.runStepAnimation(s);return}var m=l?Qd({},l,c):c,y=bO(Object.keys(m),o,u);g.start([d,a,Ms(Ms({},m),{},{transition:y}),o,f])}},{key:"render",value:function(){var s=this.props,a=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=A0e(s,P0e),u=v.Children.count(a),d=this.state.style;if(typeof a=="function")return a(d);if(!l||u===0||o<=0)return a;var f=function(p){var g=p.props,m=g.style,y=m===void 0?{}:m,b=g.className,x=v.cloneElement(p,Ms(Ms({},c),{},{style:Ms(Ms({},y),d),className:b}));return x};return u===1?f(v.Children.only(a)):E.createElement("div",null,v.Children.map(a,function(h){return f(h)}))}}]),n}(v.PureComponent);oa.displayName="Animate";oa.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};oa.propTypes={from:Et.oneOfType([Et.object,Et.string]),to:Et.oneOfType([Et.object,Et.string]),attributeName:Et.string,duration:Et.number,begin:Et.number,easing:Et.oneOfType([Et.string,Et.func]),steps:Et.arrayOf(Et.shape({duration:Et.number.isRequired,style:Et.object.isRequired,easing:Et.oneOfType([Et.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),Et.func]),properties:Et.arrayOf("string"),onAnimationEnd:Et.func})),children:Et.oneOfType([Et.node,Et.func]),isActive:Et.bool,canBegin:Et.bool,onAnimationEnd:Et.func,shouldReAnimate:Et.bool,onAnimationStart:Et.func,onAnimationReStart:Et.func};Et.object,Et.object,Et.object,Et.element;Et.object,Et.object,Et.object,Et.oneOfType([Et.array,Et.element]),Et.any;function Th(e){"@babel/helpers - typeof";return Th=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Th(e)}function wv(){return wv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,c=r>=0?1:-1,u=s>=0&&r>=0||s<0&&r<0?1:0,d;if(o>0&&a instanceof Array){for(var f=[0,0,0,0],h=0,p=4;ho?o:a[h];d="M".concat(t,",").concat(n+l*f[0]),f[0]>0&&(d+="A ".concat(f[0],",").concat(f[0],",0,0,").concat(u,",").concat(t+c*f[0],",").concat(n)),d+="L ".concat(t+r-c*f[1],",").concat(n),f[1]>0&&(d+="A ".concat(f[1],",").concat(f[1],",0,0,").concat(u,`, + `).concat(t+r,",").concat(n+l*f[1])),d+="L ".concat(t+r,",").concat(n+s-l*f[2]),f[2]>0&&(d+="A ".concat(f[2],",").concat(f[2],",0,0,").concat(u,`, + `).concat(t+r-c*f[2],",").concat(n+s)),d+="L ".concat(t+c*f[3],",").concat(n+s),f[3]>0&&(d+="A ".concat(f[3],",").concat(f[3],",0,0,").concat(u,`, + `).concat(t,",").concat(n+s-l*f[3])),d+="Z"}else if(o>0&&a===+a&&a>0){var g=Math.min(o,a);d="M ".concat(t,",").concat(n+l*g,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+c*g,",").concat(n,` + L `).concat(t+r-c*g,",").concat(n,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+r,",").concat(n+l*g,` + L `).concat(t+r,",").concat(n+s-l*g,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t+r-c*g,",").concat(n+s,` + L `).concat(t+c*g,",").concat(n+s,` + A `).concat(g,",").concat(g,",0,0,").concat(u,",").concat(t,",").concat(n+s-l*g," Z")}else d="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return d},K0e=function(t,n){if(!t||!n)return!1;var r=t.x,s=t.y,a=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var u=Math.min(a,a+l),d=Math.max(a,a+l),f=Math.min(o,o+c),h=Math.max(o,o+c);return r>=u&&r<=d&&s>=f&&s<=h}return!1},X0e={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},D_=function(t){var n=CO(CO({},X0e),t),r=v.useRef(),s=v.useState(-1),a=B0e(s,2),o=a[0],l=a[1];v.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var j=r.current.getTotalLength();j&&l(j)}catch{}},[]);var c=n.x,u=n.y,d=n.width,f=n.height,h=n.radius,p=n.className,g=n.animationEasing,m=n.animationDuration,y=n.animationBegin,b=n.isAnimationActive,x=n.isUpdateAnimationActive;if(c!==+c||u!==+u||d!==+d||f!==+f||d===0||f===0)return null;var w=wt("recharts-rectangle",p);return x?E.createElement(oa,{canBegin:o>0,from:{width:d,height:f,x:c,y:u},to:{width:d,height:f,x:c,y:u},duration:m,animationEasing:g,isActive:x},function(j){var S=j.width,N=j.height,_=j.x,P=j.y;return E.createElement(oa,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:m,isActive:b,easing:g},E.createElement("path",wv({},Xe(n,!0),{className:w,d:EO(_,P,S,N,h),ref:r})))}):E.createElement("path",wv({},Xe(n,!0),{className:w,d:EO(c,u,d,f,h)}))},Y0e=["points","className","baseLinePoints","connectNulls"];function Ac(){return Ac=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Q0e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function OO(e){return nbe(e)||tbe(e)||ebe(e)||J0e()}function J0e(){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 ebe(e,t){if(e){if(typeof e=="string")return H1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return H1(e,t)}}function tbe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nbe(e){if(Array.isArray(e))return H1(e)}function H1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(r){kO(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),kO(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},mf=function(t,n){var r=rbe(t);n&&(r=[r.reduce(function(a,o){return[].concat(OO(a),OO(o))},[])]);var s=r.map(function(a){return a.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(s,"Z"):s},sbe=function(t,n,r){var s=mf(t,r);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(mf(n.reverse(),r).slice(1))},n6=function(t){var n=t.points,r=t.className,s=t.baseLinePoints,a=t.connectNulls,o=Z0e(t,Y0e);if(!n||!n.length)return null;var l=wt("recharts-polygon",r);if(s&&s.length){var c=o.stroke&&o.stroke!=="none",u=sbe(n,s,a);return E.createElement("g",{className:l},E.createElement("path",Ac({},Xe(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",stroke:"none",d:u})),c?E.createElement("path",Ac({},Xe(o,!0),{fill:"none",d:mf(n,a)})):null,c?E.createElement("path",Ac({},Xe(o,!0),{fill:"none",d:mf(s,a)})):null)}var d=mf(n,a);return E.createElement("path",Ac({},Xe(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",className:l,d}))};function G1(){return G1=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dbe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var fbe=function(t,n,r,s,a,o){return"M".concat(t,",").concat(a,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},hbe=function(t){var n=t.x,r=n===void 0?0:n,s=t.y,a=s===void 0?0:s,o=t.top,l=o===void 0?0:o,c=t.left,u=c===void 0?0:c,d=t.width,f=d===void 0?0:d,h=t.height,p=h===void 0?0:h,g=t.className,m=ube(t,abe),y=ibe({x:r,y:a,top:l,left:u,width:f,height:p},m);return!Ae(r)||!Ae(a)||!Ae(f)||!Ae(p)||!Ae(l)||!Ae(u)?null:E.createElement("path",q1({},Xe(y,!0),{className:wt("recharts-cross",g),d:fbe(r,a,f,p,l,u)}))},pbe=["cx","cy","innerRadius","outerRadius","gridType","radialLines"];function Mh(e){"@babel/helpers - typeof";return Mh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mh(e)}function mbe(e,t){if(e==null)return{};var n=gbe(e,t),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gbe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Si(){return Si=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Fbe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Bbe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RO(e,t){for(var n=0;nFO?o=s==="outer"?"start":"end":a<-FO?o=s==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,a=r.cy,o=r.radius,l=r.axisLine,c=r.axisLineType,u=Ko(Ko({},Xe(this.props,!1)),{},{fill:"none"},Xe(l,!1));if(c==="circle")return E.createElement(jp,el({className:"recharts-polar-angle-axis-line"},u,{cx:s,cy:a,r:o}));var d=this.props.ticks,f=d.map(function(h){return Ht(s,a,o,h.coordinate)});return E.createElement(n6,el({className:"recharts-polar-angle-axis-line"},u,{points:f}))}},{key:"renderTicks",value:function(){var r=this,s=this.props,a=s.ticks,o=s.tick,l=s.tickLine,c=s.tickFormatter,u=s.stroke,d=Xe(this.props,!1),f=Xe(o,!1),h=Ko(Ko({},d),{},{fill:"none"},Xe(l,!1)),p=a.map(function(g,m){var y=r.getTickLineCoord(g),b=r.getTickTextAnchor(g),x=Ko(Ko(Ko({textAnchor:b},d),{},{stroke:"none",fill:u},f),{},{index:m,payload:g,x:y.x2,y:y.y2});return E.createElement(Rt,el({className:wt("recharts-polar-angle-axis-tick",BF(o)),key:"tick-".concat(g.coordinate)},Bl(r.props,g,m)),l&&E.createElement("line",el({className:"recharts-polar-angle-axis-tick-line"},h,y)),o&&t.renderTickItem(o,x,c?c(g.value,m):g.value))});return E.createElement(Rt,{className:"recharts-polar-angle-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,s=r.ticks,a=r.radius,o=r.axisLine;return a<=0||!s||!s.length?null:E.createElement(Rt,{className:wt("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,s,a){var o;return E.isValidElement(r)?o=E.cloneElement(r,s):ht(r)?o=r(s):o=E.createElement(zl,el({},s,{className:"recharts-polar-angle-axis-tick-value"}),a),o}}])}(v.PureComponent);Sx(gd,"displayName","PolarAngleAxis");Sx(gd,"axisType","angleAxis");Sx(gd,"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 twe=i5,nwe=twe(Object.getPrototypeOf,Object),rwe=nwe,swe=Ci,awe=rwe,iwe=Ei,owe="[object Object]",lwe=Function.prototype,cwe=Object.prototype,l6=lwe.toString,uwe=cwe.hasOwnProperty,dwe=l6.call(Object);function fwe(e){if(!iwe(e)||swe(e)!=owe)return!1;var t=awe(e);if(t===null)return!0;var n=uwe.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&l6.call(n)==dwe}var hwe=fwe;const pwe=Gt(hwe);var mwe=Ci,gwe=Ei,vwe="[object Boolean]";function ywe(e){return e===!0||e===!1||gwe(e)&&mwe(e)==vwe}var xwe=ywe;const bwe=Gt(xwe);function Rh(e){"@babel/helpers - typeof";return Rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rh(e)}function Nv(){return Nv=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:h,x:c,y:u},to:{upperWidth:d,lowerWidth:f,height:h,x:c,y:u},duration:m,animationEasing:g,isActive:b},function(w){var j=w.upperWidth,S=w.lowerWidth,N=w.height,_=w.x,P=w.y;return E.createElement(oa,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:y,duration:m,easing:g},E.createElement("path",Nv({},Xe(n,!0),{className:x,d:VO(_,P,j,S,N),ref:r})))}):E.createElement("g",null,E.createElement("path",Nv({},Xe(n,!0),{className:x,d:VO(c,u,d,f,h)})))},kwe=["option","shapeType","propTransformer","activeClassName","isActive"];function Dh(e){"@babel/helpers - typeof";return Dh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dh(e)}function Twe(e,t){if(e==null)return{};var n=$we(e,t),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $we(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function WO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function _v(e){for(var t=1;t0?ls(w,"paddingAngle",0):0;if(S){var _=Qn(S.endAngle-S.startAngle,w.endAngle-w.startAngle),P=nn(nn({},w),{},{startAngle:x+N,endAngle:x+_(m)+N});y.push(P),x=P.endAngle}else{var k=w.endAngle,O=w.startAngle,M=Qn(0,k-O),A=M(m),$=nn(nn({},w),{},{startAngle:x+N,endAngle:x+A+N});y.push($),x=$.endAngle}}),E.createElement(Rt,null,r.renderSectorsStatically(y))})}},{key:"attachKeyboardHandlers",value:function(r){var s=this;r.onkeydown=function(a){if(!a.altKey)switch(a.key){case"ArrowLeft":{var o=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[o].focus(),s.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[l].focus(),s.setState({sectorToFocus:l});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,s=r.sectors,a=r.isAnimationActive,o=this.state.prevSectors;return a&&s&&s.length&&(!o||!Ul(o,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,s=this.props,a=s.hide,o=s.sectors,l=s.className,c=s.label,u=s.cx,d=s.cy,f=s.innerRadius,h=s.outerRadius,p=s.isAnimationActive,g=this.state.isAnimationFinished;if(a||!o||!o.length||!Ae(u)||!Ae(d)||!Ae(f)||!Ae(h))return null;var m=wt("recharts-pie",l);return E.createElement(Rt,{tabIndex:this.props.rootTabIndex,className:m,ref:function(b){r.pieRef=b}},this.renderSectors(),c&&this.renderLabels(o),Jn.renderCallByParent(this.props,null,!1),(!p||g)&&Ea.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return s.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:r.sectors!==s.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,s){return r>s?"start":r=360?x:x-1)*c,j=y-x*p-w,S=s.reduce(function(P,k){var O=En(k,b,0);return P+(Ae(O)?O:0)},0),N;if(S>0){var _;N=s.map(function(P,k){var O=En(P,b,0),M=En(P,d,k),A=(Ae(O)?O:0)/S,$;k?$=_.endAngle+Ar(m)*c*(O!==0?1:0):$=o;var L=$+Ar(m)*((O!==0?p:0)+A*j),H=($+L)/2,D=(g.innerRadius+g.outerRadius)/2,V=[{name:M,value:O,payload:P,dataKey:b,type:h}],T=Ht(g.cx,g.cy,D,H);return _=nn(nn(nn({percent:A,cornerRadius:a,name:M,tooltipPayload:V,midAngle:H,middleRadius:D,tooltipPosition:T},P),g),{},{value:En(P,b),startAngle:$,endAngle:L,payload:P,paddingAngle:Ar(m)*c}),_})}return nn(nn({},g),{},{sectors:N,data:s})});function e1e(e){return e&&e.length?e[0]:void 0}var t1e=e1e,n1e=t1e;const r1e=Gt(n1e);var s1e=["key"];function Au(e){"@babel/helpers - typeof";return Au=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Au(e)}function a1e(e,t){if(e==null)return{};var n=i1e(e,t),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function i1e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Av(){return Av=Object.assign?Object.assign.bind():function(e){for(var t=1;t=2&&(c=!0),u.push(Sr(Sr({},Ht(o,l,x,y)),{},{name:g,value:m,cx:o,cy:l,radius:x,angle:y,payload:h}))});var f=[];return c&&u.forEach(function(h){if(Array.isArray(h.value)){var p=r1e(h.value),g=Nt(p)?void 0:t.scale(p);f.push(Sr(Sr({},h),{},{radius:g},Ht(o,l,g,h.angle)))}else f.push(h)}),{points:u,isRange:c,baseLinePoints:f}});var p1e=Math.ceil,m1e=Math.max;function g1e(e,t,n,r){for(var s=-1,a=m1e(p1e((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++s]=e,e+=n;return o}var v1e=g1e,y1e=_5,YO=1/0,x1e=17976931348623157e292;function b1e(e){if(!e)return e===0?e:0;if(e=y1e(e),e===YO||e===-YO){var t=e<0?-1:1;return t*x1e}return e===e?e:0}var p6=b1e,w1e=v1e,j1e=ux,Y0=p6;function S1e(e){return function(t,n,r){return r&&typeof r!="number"&&j1e(t,n,r)&&(n=r=void 0),t=Y0(t),n===void 0?(n=t,t=0):n=Y0(n),r=r===void 0?t0&&r.handleDrag(s.changedTouches[0])}),Yr(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,a=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:a,startIndex:l})}),r.detachDragEndListener()}),Yr(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Yr(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Yr(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Yr(r,"handleSlideDragStart",function(s){var a=tk(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:a.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return D1e(t,e),$1e(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,a=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,u=l.data,d=u.length-1,f=Math.min(s,a),h=Math.max(s,a),p=t.getIndexInRange(o,f),g=t.getIndexInRange(o,h);return{startIndex:p-p%c,endIndex:g===d?d:g-g%c}}},{key:"getTextOfTick",value:function(r){var s=this.props,a=s.data,o=s.tickFormatter,l=s.dataKey,c=En(a[r],l,r);return ht(o)?o(c,r):c}},{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 s=this.state,a=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,u=c.x,d=c.width,f=c.travellerWidth,h=c.startIndex,p=c.endIndex,g=c.onChange,m=r.pageX-a;m>0?m=Math.min(m,u+d-f-l,u+d-f-o):m<0&&(m=Math.max(m,u-o,u-l));var y=this.getIndex({startX:o+m,endX:l+m});(y.startIndex!==h||y.endIndex!==p)&&g&&g(y),this.setState({startX:o+m,endX:l+m,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var a=tk(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:a.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,a=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,u=this.state[o],d=this.props,f=d.x,h=d.width,p=d.travellerWidth,g=d.onChange,m=d.gap,y=d.data,b={startX:this.state.startX,endX:this.state.endX},x=r.pageX-a;x>0?x=Math.min(x,f+h-p-u):x<0&&(x=Math.max(x,f-u)),b[o]=u+x;var w=this.getIndex(b),j=w.startIndex,S=w.endIndex,N=function(){var P=y.length-1;return o==="startX"&&(l>c?j%m===0:S%m===0)||lc?S%m===0:j%m===0)||l>c&&S===P};this.setState(Yr(Yr({},o,u+x),"brushMoveStartX",r.pageX),function(){g&&N()&&g(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var a=this,o=this.state,l=o.scaleValues,c=o.startX,u=o.endX,d=this.state[s],f=l.indexOf(d);if(f!==-1){var h=f+r;if(!(h===-1||h>=l.length)){var p=l[h];s==="startX"&&p>=u||s==="endX"&&p<=c||this.setState(Yr({},s,p),function(){a.props.onChange(a.getIndex({startX:a.state.startX,endX:a.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,a=r.y,o=r.width,l=r.height,c=r.fill,u=r.stroke;return E.createElement("rect",{stroke:u,fill:c,x:s,y:a,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,a=r.y,o=r.width,l=r.height,c=r.data,u=r.children,d=r.padding,f=v.Children.only(u);return f?E.cloneElement(f,{x:s,y:a,width:o,height:l,margin:d,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,s){var a,o,l=this,c=this.props,u=c.y,d=c.travellerWidth,f=c.height,h=c.traveller,p=c.ariaLabel,g=c.data,m=c.startIndex,y=c.endIndex,b=Math.max(r,this.props.x),x=Z0(Z0({},Xe(this.props,!1)),{},{x:b,y:u,width:d,height:f}),w=p||"Min value: ".concat((a=g[m])===null||a===void 0?void 0:a.name,", Max value: ").concat((o=g[y])===null||o===void 0?void 0:o.name);return E.createElement(Rt,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(h,x))}},{key:"renderSlide",value:function(r,s){var a=this.props,o=a.y,l=a.height,c=a.stroke,u=a.travellerWidth,d=Math.min(r,s)+u,f=Math.max(Math.abs(s-r)-u,0);return E.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:c,fillOpacity:.2,x:d,y:o,width:f,height:l})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,a=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,u=r.stroke,d=this.state,f=d.startX,h=d.endX,p=5,g={pointerEvents:"none",fill:u};return E.createElement(Rt,{className:"recharts-brush-texts"},E.createElement(zl,Ov({textAnchor:"end",verticalAnchor:"middle",x:Math.min(f,h)-p,y:o+l/2},g),this.getTextOfTick(s)),E.createElement(zl,Ov({textAnchor:"start",verticalAnchor:"middle",x:Math.max(f,h)+c+p,y:o+l/2},g),this.getTextOfTick(a)))}},{key:"render",value:function(){var r=this.props,s=r.data,a=r.className,o=r.children,l=r.x,c=r.y,u=r.width,d=r.height,f=r.alwaysShowText,h=this.state,p=h.startX,g=h.endX,m=h.isTextActive,y=h.isSlideMoving,b=h.isTravellerMoving,x=h.isTravellerFocused;if(!s||!s.length||!Ae(l)||!Ae(c)||!Ae(u)||!Ae(d)||u<=0||d<=0)return null;var w=wt("recharts-brush",a),j=E.Children.count(o)===1,S=k1e("userSelect","none");return E.createElement(Rt,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),j&&this.renderPanorama(),this.renderSlide(p,g),this.renderTravellerLayer(p,"startX"),this.renderTravellerLayer(g,"endX"),(m||y||b||x||f)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,a=r.y,o=r.width,l=r.height,c=r.stroke,u=Math.floor(a+l/2)-1;return E.createElement(E.Fragment,null,E.createElement("rect",{x:s,y:a,width:o,height:l,fill:c,stroke:"none"}),E.createElement("line",{x1:s+1,y1:u,x2:s+o-1,y2:u,fill:"none",stroke:"#fff"}),E.createElement("line",{x1:s+1,y1:u+2,x2:s+o-1,y2:u+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var a;return E.isValidElement(r)?a=E.cloneElement(r,s):ht(r)?a=r(s):a=t.renderDefaultTraveller(s),a}},{key:"getDerivedStateFromProps",value:function(r,s){var a=r.data,o=r.width,l=r.x,c=r.travellerWidth,u=r.updateId,d=r.startIndex,f=r.endIndex;if(a!==s.prevData||u!==s.prevUpdateId)return Z0({prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o},a&&a.length?F1e({data:a,width:o,x:l,travellerWidth:c,startIndex:d,endIndex:f}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var h=s.scale.domain().map(function(p){return s.scale(p)});return{prevData:a,prevTravellerWidth:c,prevUpdateId:u,prevX:l,prevWidth:o,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:h}}return null}},{key:"getIndexInRange",value:function(r,s){for(var a=r.length,o=0,l=a-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>s?l=c:o=c}return s>=r[l]?l:o}}])}(v.PureComponent);Yr(Eu,"displayName","Brush");Yr(Eu,"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 B1e=c_;function z1e(e,t){var n;return B1e(e,function(r,s,a){return n=t(r,s,a),!n}),!!n}var U1e=z1e,V1e=Q3,W1e=Ba,H1e=U1e,G1e=Kr,q1e=ux;function K1e(e,t,n){var r=G1e(e)?V1e:H1e;return n&&q1e(e,t,n)&&(t=void 0),r(e,W1e(t))}var X1e=K1e;const Y1e=Gt(X1e);var Oa=function(t,n){var r=t.alwaysShow,s=t.ifOverflow;return r&&(s="extendDomain"),s===n},nk=b5;function Z1e(e,t,n){t=="__proto__"&&nk?nk(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var Q1e=Z1e,J1e=Q1e,eje=y5,tje=Ba;function nje(e,t){var n={};return t=tje(t),eje(e,function(r,s,a){J1e(n,s,t(r,s,a))}),n}var rje=nje;const sje=Gt(rje);function aje(e,t){for(var n=-1,r=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function jje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Sje(e,t){var n=e.x,r=e.y,s=wje(e,vje),a="".concat(n),o=parseInt(a,10),l="".concat(r),c=parseInt(l,10),u="".concat(t.height||s.height),d=parseInt(u,10),f="".concat(t.width||s.width),h=parseInt(f,10);return zd(zd(zd(zd(zd({},t),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:d,width:h,name:t.name,radius:t.radius})}function sk(e){return E.createElement(c6,J1({shapeType:"rectangle",propTransformer:Sje,activeClassName:"recharts-active-bar"},e))}var Nje=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof t=="number")return t;var a=typeof r=="number";return a?t(r,s):(a||Wl(),n)}},_je=["value","background"],x6;function Ou(e){"@babel/helpers - typeof";return Ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ou(e)}function Pje(e,t){if(e==null)return{};var n=Aje(e,t),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Aje(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Tv(){return Tv=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(H)0&&Math.abs(L)0&&($=Math.min((B||0)-(L[le-1]||0),$))}),Number.isFinite($)){var H=$/A,D=m.layout==="vertical"?r.height:r.width;if(m.padding==="gap"&&(_=H*D/2),m.padding==="no-gap"){var V=Cr(t.barCategoryGap,H*D),T=H*D/2;_=T-V-(T-V)/D*V}}}s==="xAxis"?P=[r.left+(w.left||0)+(_||0),r.left+r.width-(w.right||0)-(_||0)]:s==="yAxis"?P=c==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(_||0),r.top+r.height-(w.bottom||0)-(_||0)]:P=m.range,S&&(P=[P[1],P[0]]);var F=TF(m,a,h),q=F.scale,Z=F.realScaleType;q.domain(b).range(P),$F(q);var re=MF(q,Vs(Vs({},m),{},{realScaleType:Z}));s==="xAxis"?(M=y==="top"&&!j||y==="bottom"&&j,k=r.left,O=f[N]-M*m.height):s==="yAxis"&&(M=y==="left"&&!j||y==="right"&&j,k=f[N]-M*m.width,O=r.top);var ge=Vs(Vs(Vs({},m),re),{},{realScaleType:Z,x:k,y:O,scale:q,width:s==="xAxis"?r.width:m.width,height:s==="yAxis"?r.height:m.height});return ge.bandSize=mv(ge,re),!m.hide&&s==="xAxis"?f[N]+=(M?-1:1)*ge.height:m.hide||(f[N]+=(M?-1:1)*ge.width),Vs(Vs({},p),{},Px({},g,ge))},{})},N6=function(t,n){var r=t.x,s=t.y,a=n.x,o=n.y;return{x:Math.min(r,a),y:Math.min(s,o),width:Math.abs(a-r),height:Math.abs(o-s)}},Lje=function(t){var n=t.x1,r=t.y1,s=t.x2,a=t.y2;return N6({x:n,y:r},{x:s,y:a})},_6=function(){function e(t){Ije(this,e),this.scale=t}return Rje(e,[{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]:{},s=r.bandAware,a=r.position;if(n!==void 0){if(a)switch(a){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],a=r[r.length-1];return s<=a?n>=s&&n<=a:n>=a&&n<=s}}],[{key:"create",value:function(n){return new e(n)}}])}();Px(_6,"EPS",1e-4);var L_=function(t){var n=Object.keys(t).reduce(function(r,s){return Vs(Vs({},r),{},Px({},s,_6.create(t[s])))},{});return Vs(Vs({},n),{},{apply:function(s){var a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=a.bandAware,l=a.position;return sje(s,function(c,u){return n[u].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return y6(s,function(a,o){return n[o].isInRange(a)})}})};function Fje(e){return(e%180+180)%180}var Bje=function(t){var n=t.width,r=t.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=Fje(s),o=a*Math.PI/180,l=Math.atan(r/n),c=o>l&&o-1?s[a?t[o]:o]:void 0}}var Hje=Wje,Gje=p6;function qje(e){var t=Gje(e),n=t%1;return t===t?n?t-n:t:0}var Kje=qje,Xje=f5,Yje=Ba,Zje=Kje,Qje=Math.max;function Jje(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var s=n==null?0:Zje(n);return s<0&&(s=Qje(r+s,0)),Xje(e,Yje(t),s)}var eSe=Jje,tSe=Hje,nSe=eSe,rSe=tSe(nSe),sSe=rSe;const aSe=Gt(sSe);var iSe=Wte(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),F_=v.createContext(void 0),B_=v.createContext(void 0),P6=v.createContext(void 0),A6=v.createContext({}),C6=v.createContext(void 0),E6=v.createContext(0),O6=v.createContext(0),ck=function(t){var n=t.state,r=n.xAxisMap,s=n.yAxisMap,a=n.offset,o=t.clipPathId,l=t.children,c=t.width,u=t.height,d=iSe(a);return E.createElement(F_.Provider,{value:r},E.createElement(B_.Provider,{value:s},E.createElement(A6.Provider,{value:a},E.createElement(P6.Provider,{value:d},E.createElement(C6.Provider,{value:o},E.createElement(E6.Provider,{value:u},E.createElement(O6.Provider,{value:c},l)))))))},oSe=function(){return v.useContext(C6)},k6=function(t){var n=v.useContext(F_);n==null&&Wl();var r=n[t];return r==null&&Wl(),r},lSe=function(){var t=v.useContext(F_);return Hi(t)},cSe=function(){var t=v.useContext(B_),n=aSe(t,function(r){return y6(r.domain,Number.isFinite)});return n||Hi(t)},T6=function(t){var n=v.useContext(B_);n==null&&Wl();var r=n[t];return r==null&&Wl(),r},uSe=function(){var t=v.useContext(P6);return t},dSe=function(){return v.useContext(A6)},z_=function(){return v.useContext(O6)},U_=function(){return v.useContext(E6)};function ku(e){"@babel/helpers - typeof";return ku=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ku(e)}function fSe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hSe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*s)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-s)<=0}function KSe(e,t){return F6(e,t+1)}function XSe(e,t,n,r,s){for(var a=(r||[]).slice(),o=t.start,l=t.end,c=0,u=1,d=o,f=function(){var g=r==null?void 0:r[c];if(g===void 0)return{v:F6(r,u)};var m=c,y,b=function(){return y===void 0&&(y=n(g,m)),y},x=g.coordinate,w=c===0||Dv(e,x,b,d,l);w||(c=0,d=o,u+=1),w&&(d=x+e*(b()/2+s),c+=u)},h;u<=a.length;)if(h=f(),h)return h.v;return[]}function Uh(e){"@babel/helpers - typeof";return Uh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uh(e)}function vk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function hr(e){for(var t=1;t0?p.coordinate-y*e:p.coordinate})}else a[h]=p=hr(hr({},p),{},{tickCoord:p.coordinate});var b=Dv(e,p.tickCoord,m,l,c);b&&(c=p.tickCoord-e*(m()/2+s),a[h]=hr(hr({},p),{},{isShow:!0}))},d=o-1;d>=0;d--)u(d);return a}function eNe(e,t,n,r,s,a){var o=(r||[]).slice(),l=o.length,c=t.start,u=t.end;if(a){var d=r[l-1],f=n(d,l-1),h=e*(d.coordinate+e*f/2-u);o[l-1]=d=hr(hr({},d),{},{tickCoord:h>0?d.coordinate-h*e:d.coordinate});var p=Dv(e,d.tickCoord,function(){return f},c,u);p&&(u=d.tickCoord-e*(f/2+s),o[l-1]=hr(hr({},d),{},{isShow:!0}))}for(var g=a?l-1:l,m=function(x){var w=o[x],j,S=function(){return j===void 0&&(j=n(w,x)),j};if(x===0){var N=e*(w.coordinate-e*S()/2-c);o[x]=w=hr(hr({},w),{},{tickCoord:N<0?w.coordinate-N*e:w.coordinate})}else o[x]=w=hr(hr({},w),{},{tickCoord:w.coordinate});var _=Dv(e,w.tickCoord,S,c,u);_&&(c=w.tickCoord+e*(S()/2+s),o[x]=hr(hr({},w),{},{isShow:!0}))},y=0;y=2?Ar(s[1].coordinate-s[0].coordinate):1,b=qSe(a,y,p);return c==="equidistantPreserveStart"?XSe(y,b,m,s,o):(c==="preserveStart"||c==="preserveStartEnd"?h=eNe(y,b,m,s,o,c==="preserveStartEnd"):h=JSe(y,b,m,s,o),h.filter(function(x){return x.isShow}))}var tNe=["viewBox"],nNe=["viewBox"],rNe=["ticks"];function Mu(e){"@babel/helpers - typeof";return Mu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(e)}function Ec(){return Ec=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function aNe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xk(e,t){for(var n=0;n0?c(this.props):c(p)),o<=0||l<=0||!g||!g.length?null:E.createElement(Rt,{className:wt("recharts-cartesian-axis",u),ref:function(y){r.layerReference=y}},a&&this.renderAxisLine(),this.renderTicks(g,this.state.fontSize,this.state.letterSpacing),Jn.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,a){var o;return E.isValidElement(r)?o=E.cloneElement(r,s):ht(r)?o=r(s):o=E.createElement(zl,Ec({},s,{className:"recharts-cartesian-axis-tick-value"}),a),o}}])}(v.Component);G_(vd,"displayName","CartesianAxis");G_(vd,"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 fNe=["x1","y1","x2","y2","key"],hNe=["offset"];function Hl(e){"@babel/helpers - typeof";return Hl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hl(e)}function bk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,r)}return n}function vr(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function vNe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var yNe=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,s=t.x,a=t.y,o=t.width,l=t.height,c=t.ry;return E.createElement("rect",{x:s,y:a,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function U6(e,t){var n;if(E.isValidElement(e))n=E.cloneElement(e,t);else if(ht(e))n=e(t);else{var r=t.x1,s=t.y1,a=t.x2,o=t.y2,l=t.key,c=wk(t,fNe),u=Xe(c,!1);u.offset;var d=wk(u,hNe);n=E.createElement("line",dl({},d,{x1:r,y1:s,x2:a,y2:o,fill:"none",key:l}))}return n}function xNe(e){var t=e.x,n=e.width,r=e.horizontal,s=r===void 0?!0:r,a=e.horizontalPoints;if(!s||!a||!a.length)return null;var o=a.map(function(l,c){var u=vr(vr({},e),{},{x1:t,y1:l,x2:t+n,y2:l,key:"line-".concat(c),index:c});return U6(s,u)});return E.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function bNe(e){var t=e.y,n=e.height,r=e.vertical,s=r===void 0?!0:r,a=e.verticalPoints;if(!s||!a||!a.length)return null;var o=a.map(function(l,c){var u=vr(vr({},e),{},{x1:l,y1:t,x2:l,y2:t+n,key:"line-".concat(c),index:c});return U6(s,u)});return E.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function wNe(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,s=e.y,a=e.width,o=e.height,l=e.horizontalPoints,c=e.horizontal,u=c===void 0?!0:c;if(!u||!t||!t.length)return null;var d=l.map(function(h){return Math.round(h+s-s)}).sort(function(h,p){return h-p});s!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?s+o-h:d[p+1]-h;if(m<=0)return null;var y=p%t.length;return E.createElement("rect",{key:"react-".concat(p),y:h,x:r,height:m,width:a,stroke:"none",fill:t[y],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return E.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},f)}function jNe(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,s=e.fillOpacity,a=e.x,o=e.y,l=e.width,c=e.height,u=e.verticalPoints;if(!n||!r||!r.length)return null;var d=u.map(function(h){return Math.round(h+a-a)}).sort(function(h,p){return h-p});a!==d[0]&&d.unshift(0);var f=d.map(function(h,p){var g=!d[p+1],m=g?a+l-h:d[p+1]-h;if(m<=0)return null;var y=p%r.length;return E.createElement("rect",{key:"react-".concat(p),x:h,y:o,width:m,height:c,stroke:"none",fill:r[y],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return E.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},f)}var SNe=function(t,n){var r=t.xAxis,s=t.width,a=t.height,o=t.offset;return kF(H_(vr(vr(vr({},vd.defaultProps),r),{},{ticks:si(r,!0),viewBox:{x:0,y:0,width:s,height:a}})),o.left,o.left+o.width,n)},NNe=function(t,n){var r=t.yAxis,s=t.width,a=t.height,o=t.offset;return kF(H_(vr(vr(vr({},vd.defaultProps),r),{},{ticks:si(r,!0),viewBox:{x:0,y:0,width:s,height:a}})),o.top,o.top+o.height,n)},uc={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Vh(e){var t,n,r,s,a,o,l=z_(),c=U_(),u=dSe(),d=vr(vr({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:uc.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:uc.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:uc.horizontal,horizontalFill:(s=e.horizontalFill)!==null&&s!==void 0?s:uc.horizontalFill,vertical:(a=e.vertical)!==null&&a!==void 0?a:uc.vertical,verticalFill:(o=e.verticalFill)!==null&&o!==void 0?o:uc.verticalFill,x:Ae(e.x)?e.x:u.left,y:Ae(e.y)?e.y:u.top,width:Ae(e.width)?e.width:u.width,height:Ae(e.height)?e.height:u.height}),f=d.x,h=d.y,p=d.width,g=d.height,m=d.syncWithTicks,y=d.horizontalValues,b=d.verticalValues,x=lSe(),w=cSe();if(!Ae(p)||p<=0||!Ae(g)||g<=0||!Ae(f)||f!==+f||!Ae(h)||h!==+h)return null;var j=d.verticalCoordinatesGenerator||SNe,S=d.horizontalCoordinatesGenerator||NNe,N=d.horizontalPoints,_=d.verticalPoints;if((!N||!N.length)&&ht(S)){var P=y&&y.length,k=S({yAxis:w?vr(vr({},w),{},{ticks:P?y:w.ticks}):void 0,width:l,height:c,offset:u},P?!0:m);Js(Array.isArray(k),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(Hl(k),"]")),Array.isArray(k)&&(N=k)}if((!_||!_.length)&&ht(j)){var O=b&&b.length,M=j({xAxis:x?vr(vr({},x),{},{ticks:O?b:x.ticks}):void 0,width:l,height:c,offset:u},O?!0:m);Js(Array.isArray(M),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(Hl(M),"]")),Array.isArray(M)&&(_=M)}return E.createElement("g",{className:"recharts-cartesian-grid"},E.createElement(yNe,{fill:d.fill,fillOpacity:d.fillOpacity,x:d.x,y:d.y,width:d.width,height:d.height,ry:d.ry}),E.createElement(xNe,dl({},d,{offset:u,horizontalPoints:N,xAxis:x,yAxis:w})),E.createElement(bNe,dl({},d,{offset:u,verticalPoints:_,xAxis:x,yAxis:w})),E.createElement(wNe,dl({},d,{horizontalPoints:N})),E.createElement(jNe,dl({},d,{verticalPoints:_})))}Vh.displayName="CartesianGrid";var _Ne=["layout","type","stroke","connectNulls","isRange","ref"],PNe=["key"],V6;function Iu(e){"@babel/helpers - typeof";return Iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(e)}function W6(e,t){if(e==null)return{};var n=ANe(e,t),r,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ANe(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fl(){return fl=Object.assign?Object.assign.bind():function(e){for(var t=1;t0||!Ul(d,o)||!Ul(f,l))?this.renderAreaWithAnimation(r,s):this.renderAreaStatically(o,l,r,s)}},{key:"render",value:function(){var r,s=this.props,a=s.hide,o=s.dot,l=s.points,c=s.className,u=s.top,d=s.left,f=s.xAxis,h=s.yAxis,p=s.width,g=s.height,m=s.isAnimationActive,y=s.id;if(a||!l||!l.length)return null;var b=this.state.isAnimationFinished,x=l.length===1,w=wt("recharts-area",c),j=f&&f.allowDataOverflow,S=h&&h.allowDataOverflow,N=j||S,_=Nt(y)?this.id:y,P=(r=Xe(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},k=P.r,O=k===void 0?3:k,M=P.strokeWidth,A=M===void 0?2:M,$=Xne(o)?o:{},L=$.clipDot,H=L===void 0?!0:L,D=O*2+A;return E.createElement(Rt,{className:w},j||S?E.createElement("defs",null,E.createElement("clipPath",{id:"clipPath-".concat(_)},E.createElement("rect",{x:j?d:d-p/2,y:S?u:u-g/2,width:j?p:p*2,height:S?g:g*2})),!H&&E.createElement("clipPath",{id:"clipPath-dots-".concat(_)},E.createElement("rect",{x:d-D/2,y:u-D/2,width:p+D,height:g+D}))):null,x?null:this.renderArea(N,_),(o||x)&&this.renderDots(N,H,_),(!m||b)&&Ea.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:s.curPoints,prevBaseLine:s.curBaseLine}:r.points!==s.curPoints||r.baseLine!==s.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(v.PureComponent);V6=ta;Na(ta,"displayName","Area");Na(ta,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!ea.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});Na(ta,"getBaseValue",function(e,t,n,r){var s=e.layout,a=e.baseValue,o=t.props.baseValue,l=o??a;if(Ae(l)&&typeof l=="number")return l;var c=s==="horizontal"?r:n,u=c.scale.domain();if(c.type==="number"){var d=Math.max(u[0],u[1]),f=Math.min(u[0],u[1]);return l==="dataMin"?f:l==="dataMax"||d<0?d:Math.max(Math.min(u[0],u[1]),0)}return l==="dataMin"?u[0]:l==="dataMax"?u[1]:u[0]});Na(ta,"getComposedData",function(e){var t=e.props,n=e.item,r=e.xAxis,s=e.yAxis,a=e.xAxisTicks,o=e.yAxisTicks,l=e.bandSize,c=e.dataKey,u=e.stackedData,d=e.dataStartIndex,f=e.displayedData,h=e.offset,p=t.layout,g=u&&u.length,m=V6.getBaseValue(t,n,r,s),y=p==="horizontal",b=!1,x=f.map(function(j,S){var N;g?N=u[d+S]:(N=En(j,c),Array.isArray(N)?b=!0:N=[m,N]);var _=N[1]==null||g&&En(j,c)==null;return y?{x:H2({axis:r,ticks:a,bandSize:l,entry:j,index:S}),y:_?null:s.scale(N[1]),value:N,payload:j}:{x:_?null:r.scale(N[1]),y:H2({axis:s,ticks:o,bandSize:l,entry:j,index:S}),value:N,payload:j}}),w;return g||b?w=x.map(function(j){var S=Array.isArray(j.value)?j.value[0]:null;return y?{x:j.x,y:S!=null&&j.y!=null?s.scale(S):null}:{x:S!=null?r.scale(S):null,y:j.y}}):w=y?s.scale(m):r.scale(m),Ri({points:x,baseLine:w,layout:p,isRange:b},h)});Na(ta,"renderDotItem",function(e,t){var n;if(E.isValidElement(e))n=E.cloneElement(e,t);else if(ht(e))n=e(t);else{var r=wt("recharts-area-dot",typeof e!="boolean"?e.className:""),s=t.key,a=W6(t,PNe);n=E.createElement(jp,fl({},a,{key:s,className:r}))}return n});function Ru(e){"@babel/helpers - typeof";return Ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ru(e)}function INe(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function RNe(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function j_e(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function S_e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function N_e(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?o:t&&t.length&&Ae(s)&&Ae(a)?t.slice(s,a+1):[]};function iB(e){return e==="number"?[0,"auto"]:void 0}var vj=function(t,n,r,s){var a=t.graphicalItems,o=t.tooltipAxis,l=kx(n,t);return r<0||!a||!a.length||r>=l.length?null:a.reduce(function(c,u){var d,f=(d=u.props.data)!==null&&d!==void 0?d:n;f&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(f=f.slice(t.dataStartIndex,t.dataEndIndex+1));var h;if(o.dataKey&&!o.allowDuplicatedCategory){var p=f===void 0?l:f;h=zg(p,o.dataKey,s)}else h=f&&f[r]||l[r];return h?[].concat(Fu(c),[RF(u,h)]):c},[])},Ek=function(t,n,r,s){var a=s||{x:t.chartX,y:t.chartY},o=R_e(a,r),l=t.orderedTooltipTicks,c=t.tooltipAxis,u=t.tooltipTicks,d=Yve(o,l,u,c);if(d>=0&&u){var f=u[d]&&u[d].value,h=vj(t,n,d,f),p=D_e(r,l,d,a);return{activeTooltipIndex:d,activeLabel:f,activePayload:h,activeCoordinate:p}}return null},L_e=function(t,n){var r=n.axes,s=n.graphicalItems,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=t.stackOffset,p=OF(d,a);return r.reduce(function(g,m){var y,b=m.type.defaultProps!==void 0?ue(ue({},m.type.defaultProps),m.props):m.props,x=b.type,w=b.dataKey,j=b.allowDataOverflow,S=b.allowDuplicatedCategory,N=b.scale,_=b.ticks,P=b.includeHidden,k=b[o];if(g[k])return g;var O=kx(t.data,{graphicalItems:s.filter(function(re){var ge,B=o in re.props?re.props[o]:(ge=re.type.defaultProps)===null||ge===void 0?void 0:ge[o];return B===k}),dataStartIndex:c,dataEndIndex:u}),M=O.length,A,$,L;u_e(b.domain,j,x)&&(A=k1(b.domain,null,j),p&&(x==="number"||N!=="auto")&&(L=hf(O,w,"category")));var H=iB(x);if(!A||A.length===0){var D,V=(D=b.domain)!==null&&D!==void 0?D:H;if(w){if(A=hf(O,w,x),x==="category"&&p){var T=Bne(A);S&&T?($=A,A=Ev(0,M)):S||(A=X2(V,A,m).reduce(function(re,ge){return re.indexOf(ge)>=0?re:[].concat(Fu(re),[ge])},[]))}else if(x==="category")S?A=A.filter(function(re){return re!==""&&!Nt(re)}):A=X2(V,A,m).reduce(function(re,ge){return re.indexOf(ge)>=0||ge===""||Nt(ge)?re:[].concat(Fu(re),[ge])},[]);else if(x==="number"){var F=tye(O,s.filter(function(re){var ge,B,le=o in re.props?re.props[o]:(ge=re.type.defaultProps)===null||ge===void 0?void 0:ge[o],se="hide"in re.props?re.props.hide:(B=re.type.defaultProps)===null||B===void 0?void 0:B.hide;return le===k&&(P||!se)}),w,a,d);F&&(A=F)}p&&(x==="number"||N!=="auto")&&(L=hf(O,w,"category"))}else p?A=Ev(0,M):l&&l[k]&&l[k].hasStack&&x==="number"?A=h==="expand"?[0,1]:IF(l[k].stackGroups,c,u):A=EF(O,s.filter(function(re){var ge=o in re.props?re.props[o]:re.type.defaultProps[o],B="hide"in re.props?re.props.hide:re.type.defaultProps.hide;return ge===k&&(P||!B)}),x,d,!0);if(x==="number")A=pj(f,A,k,a,_),V&&(A=k1(V,A,j));else if(x==="category"&&V){var q=V,Z=A.every(function(re){return q.indexOf(re)>=0});Z&&(A=q)}}return ue(ue({},g),{},vt({},k,ue(ue({},b),{},{axisType:a,domain:A,categoricalDomain:L,duplicateDomain:$,originalDomain:(y=b.domain)!==null&&y!==void 0?y:H,isCategorical:p,layout:d})))},{})},F_e=function(t,n){var r=n.graphicalItems,s=n.Axis,a=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.layout,f=t.children,h=kx(t.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:u}),p=h.length,g=OF(d,a),m=-1;return r.reduce(function(y,b){var x=b.type.defaultProps!==void 0?ue(ue({},b.type.defaultProps),b.props):b.props,w=x[o],j=iB("number");if(!y[w]){m++;var S;return g?S=Ev(0,p):l&&l[w]&&l[w].hasStack?(S=IF(l[w].stackGroups,c,u),S=pj(f,S,w,a)):(S=k1(j,EF(h,r.filter(function(N){var _,P,k=o in N.props?N.props[o]:(_=N.type.defaultProps)===null||_===void 0?void 0:_[o],O="hide"in N.props?N.props.hide:(P=N.type.defaultProps)===null||P===void 0?void 0:P.hide;return k===w&&!O}),"number",d),s.defaultProps.allowDataOverflow),S=pj(f,S,w,a)),ue(ue({},y),{},vt({},w,ue(ue({axisType:a},s.defaultProps),{},{hide:!0,orientation:ls(M_e,"".concat(a,".").concat(m%2),null),domain:S,originalDomain:j,isCategorical:g,layout:d})))}return y},{})},B_e=function(t,n){var r=n.axisType,s=r===void 0?"xAxis":r,a=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,u=n.dataEndIndex,d=t.children,f="".concat(s,"Id"),h=Ps(d,a),p={};return h&&h.length?p=L_e(t,{axes:h,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u}):o&&o.length&&(p=F_e(t,{Axis:a,graphicalItems:o,axisType:s,axisIdKey:f,stackGroups:l,dataStartIndex:c,dataEndIndex:u})),p},z_e=function(t){var n=Hi(t),r=si(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:u_(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:mv(n,r)}},Ok=function(t){var n=t.children,r=t.defaultShowTooltip,s=es(n,Eu),a=0,o=0;return t.data&&t.data.length!==0&&(o=t.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(a=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:a,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},U_e=function(t){return!t||!t.length?!1:t.some(function(n){var r=li(n&&n.type);return r&&r.indexOf("Bar")>=0})},kk=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},V_e=function(t,n){var r=t.props,s=t.graphicalItems,a=t.xAxisMap,o=a===void 0?{}:a,l=t.yAxisMap,c=l===void 0?{}:l,u=r.width,d=r.height,f=r.children,h=r.margin||{},p=es(f,Eu),g=es(f,ci),m=Object.keys(c).reduce(function(S,N){var _=c[N],P=_.orientation;return!_.mirror&&!_.hide?ue(ue({},S),{},vt({},P,S[P]+_.width)):S},{left:h.left||0,right:h.right||0}),y=Object.keys(o).reduce(function(S,N){var _=o[N],P=_.orientation;return!_.mirror&&!_.hide?ue(ue({},S),{},vt({},P,ls(S,"".concat(P))+_.height)):S},{top:h.top||0,bottom:h.bottom||0}),b=ue(ue({},y),m),x=b.bottom;p&&(b.bottom+=p.props.height||Eu.defaultProps.height),g&&n&&(b=Jve(b,s,r,n));var w=u-b.left-b.right,j=d-b.top-b.bottom;return ue(ue({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(j,0)})},W_e=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},Tx=function(t){var n=t.chartName,r=t.GraphicalChild,s=t.defaultTooltipEventType,a=s===void 0?"axis":s,o=t.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=t.axisComponents,u=t.legendContent,d=t.formatAxisMap,f=t.defaultProps,h=function(y,b){var x=b.graphicalItems,w=b.stackGroups,j=b.offset,S=b.updateId,N=b.dataStartIndex,_=b.dataEndIndex,P=y.barSize,k=y.layout,O=y.barGap,M=y.barCategoryGap,A=y.maxBarSize,$=kk(k),L=$.numericAxisName,H=$.cateAxisName,D=U_e(x),V=[];return x.forEach(function(T,F){var q=kx(y.data,{graphicalItems:[T],dataStartIndex:N,dataEndIndex:_}),Z=T.type.defaultProps!==void 0?ue(ue({},T.type.defaultProps),T.props):T.props,re=Z.dataKey,ge=Z.maxBarSize,B=Z["".concat(L,"Id")],le=Z["".concat(H,"Id")],se={},ce=c.reduce(function(U,X){var Q=b["".concat(X.axisType,"Map")],z=Z["".concat(X.axisType,"Id")];Q&&Q[z]||X.axisType==="zAxis"||Wl();var ee=Q[z];return ue(ue({},U),{},vt(vt({},X.axisType,ee),"".concat(X.axisType,"Ticks"),si(ee)))},se),De=ce[H],de=ce["".concat(H,"Ticks")],be=w&&w[B]&&w[B].hasStack&&uye(T,w[B].stackGroups),Pe=li(T.type).indexOf("Bar")>=0,ne=mv(De,de),Je=[],ve=D&&Zve({barSize:P,stackGroups:w,totalSize:W_e(ce,H)});if(Pe){var at,st,Mt=Nt(ge)?A:ge,C=(at=(st=mv(De,de,!0))!==null&&st!==void 0?st:Mt)!==null&&at!==void 0?at:0;Je=Qve({barGap:O,barCategoryGap:M,bandSize:C!==ne?C:ne,sizeList:ve[le],maxBarSize:Mt}),C!==ne&&(Je=Je.map(function(U){return ue(ue({},U),{},{position:ue(ue({},U.position),{},{offset:U.position.offset-C/2})})}))}var R=T&&T.type&&T.type.getComposedData;R&&V.push({props:ue(ue({},R(ue(ue({},ce),{},{displayedData:q,props:y,dataKey:re,item:T,bandSize:ne,barPosition:Je,offset:j,stackedData:be,layout:k,dataStartIndex:N,dataEndIndex:_}))),{},vt(vt(vt({key:T.key||"item-".concat(F)},L,ce[L]),H,ce[H]),"animationId",S)),childIndex:Qne(T,y.children),item:T})}),V},p=function(y,b){var x=y.props,w=y.dataStartIndex,j=y.dataEndIndex,S=y.updateId;if(!UC({props:x}))return null;var N=x.children,_=x.layout,P=x.stackOffset,k=x.data,O=x.reverseStackOrder,M=kk(_),A=M.numericAxisName,$=M.cateAxisName,L=Ps(N,r),H=lye(k,L,"".concat(A,"Id"),"".concat($,"Id"),P,O),D=c.reduce(function(Z,re){var ge="".concat(re.axisType,"Map");return ue(ue({},Z),{},vt({},ge,B_e(x,ue(ue({},re),{},{graphicalItems:L,stackGroups:re.axisType===A&&H,dataStartIndex:w,dataEndIndex:j}))))},{}),V=V_e(ue(ue({},D),{},{props:x,graphicalItems:L}),b==null?void 0:b.legendBBox);Object.keys(D).forEach(function(Z){D[Z]=d(x,D[Z],V,Z.replace("Map",""),n)});var T=D["".concat($,"Map")],F=z_e(T),q=h(x,ue(ue({},D),{},{dataStartIndex:w,dataEndIndex:j,updateId:S,graphicalItems:L,stackGroups:H,offset:V}));return ue(ue({formattedGraphicalItems:q,graphicalItems:L,offset:V,stackGroups:H},F),D)},g=function(m){function y(b){var x,w,j;return S_e(this,y),j=P_e(this,y,[b]),vt(j,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),vt(j,"accessibilityManager",new c_e),vt(j,"handleLegendBBoxUpdate",function(S){if(S){var N=j.state,_=N.dataStartIndex,P=N.dataEndIndex,k=N.updateId;j.setState(ue({legendBBox:S},p({props:j.props,dataStartIndex:_,dataEndIndex:P,updateId:k},ue(ue({},j.state),{},{legendBBox:S}))))}}),vt(j,"handleReceiveSyncEvent",function(S,N,_){if(j.props.syncId===S){if(_===j.eventEmitterSymbol&&typeof j.props.syncMethod!="function")return;j.applySyncEvent(N)}}),vt(j,"handleBrushChange",function(S){var N=S.startIndex,_=S.endIndex;if(N!==j.state.dataStartIndex||_!==j.state.dataEndIndex){var P=j.state.updateId;j.setState(function(){return ue({dataStartIndex:N,dataEndIndex:_},p({props:j.props,dataStartIndex:N,dataEndIndex:_,updateId:P},j.state))}),j.triggerSyncEvent({dataStartIndex:N,dataEndIndex:_})}}),vt(j,"handleMouseEnter",function(S){var N=j.getMouseInfo(S);if(N){var _=ue(ue({},N),{},{isTooltipActive:!0});j.setState(_),j.triggerSyncEvent(_);var P=j.props.onMouseEnter;ht(P)&&P(_,S)}}),vt(j,"triggeredAfterMouseMove",function(S){var N=j.getMouseInfo(S),_=N?ue(ue({},N),{},{isTooltipActive:!0}):{isTooltipActive:!1};j.setState(_),j.triggerSyncEvent(_);var P=j.props.onMouseMove;ht(P)&&P(_,S)}),vt(j,"handleItemMouseEnter",function(S){j.setState(function(){return{isTooltipActive:!0,activeItem:S,activePayload:S.tooltipPayload,activeCoordinate:S.tooltipPosition||{x:S.cx,y:S.cy}}})}),vt(j,"handleItemMouseLeave",function(){j.setState(function(){return{isTooltipActive:!1}})}),vt(j,"handleMouseMove",function(S){S.persist(),j.throttleTriggeredAfterMouseMove(S)}),vt(j,"handleMouseLeave",function(S){j.throttleTriggeredAfterMouseMove.cancel();var N={isTooltipActive:!1};j.setState(N),j.triggerSyncEvent(N);var _=j.props.onMouseLeave;ht(_)&&_(N,S)}),vt(j,"handleOuterEvent",function(S){var N=Zne(S),_=ls(j.props,"".concat(N));if(N&&ht(_)){var P,k;/.*touch.*/i.test(N)?k=j.getMouseInfo(S.changedTouches[0]):k=j.getMouseInfo(S),_((P=k)!==null&&P!==void 0?P:{},S)}}),vt(j,"handleClick",function(S){var N=j.getMouseInfo(S);if(N){var _=ue(ue({},N),{},{isTooltipActive:!0});j.setState(_),j.triggerSyncEvent(_);var P=j.props.onClick;ht(P)&&P(_,S)}}),vt(j,"handleMouseDown",function(S){var N=j.props.onMouseDown;if(ht(N)){var _=j.getMouseInfo(S);N(_,S)}}),vt(j,"handleMouseUp",function(S){var N=j.props.onMouseUp;if(ht(N)){var _=j.getMouseInfo(S);N(_,S)}}),vt(j,"handleTouchMove",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.throttleTriggeredAfterMouseMove(S.changedTouches[0])}),vt(j,"handleTouchStart",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseDown(S.changedTouches[0])}),vt(j,"handleTouchEnd",function(S){S.changedTouches!=null&&S.changedTouches.length>0&&j.handleMouseUp(S.changedTouches[0])}),vt(j,"triggerSyncEvent",function(S){j.props.syncId!==void 0&&J0.emit(eb,j.props.syncId,S,j.eventEmitterSymbol)}),vt(j,"applySyncEvent",function(S){var N=j.props,_=N.layout,P=N.syncMethod,k=j.state.updateId,O=S.dataStartIndex,M=S.dataEndIndex;if(S.dataStartIndex!==void 0||S.dataEndIndex!==void 0)j.setState(ue({dataStartIndex:O,dataEndIndex:M},p({props:j.props,dataStartIndex:O,dataEndIndex:M,updateId:k},j.state)));else if(S.activeTooltipIndex!==void 0){var A=S.chartX,$=S.chartY,L=S.activeTooltipIndex,H=j.state,D=H.offset,V=H.tooltipTicks;if(!D)return;if(typeof P=="function")L=P(V,S);else if(P==="value"){L=-1;for(var T=0;T=0){var be,Pe;if(A.dataKey&&!A.allowDuplicatedCategory){var ne=typeof A.dataKey=="function"?de:"payload.".concat(A.dataKey.toString());be=zg(T,ne,L),Pe=F&&q&&zg(q,ne,L)}else be=T==null?void 0:T[$],Pe=F&&q&&q[$];if(le||B){var Je=S.props.activeIndex!==void 0?S.props.activeIndex:$;return[v.cloneElement(S,ue(ue(ue({},P.props),ce),{},{activeIndex:Je})),null,null]}if(!Nt(be))return[De].concat(Fu(j.renderActivePoints({item:P,activePoint:be,basePoint:Pe,childIndex:$,isRange:F})))}else{var ve,at=(ve=j.getItemByXY(j.state.activeCoordinate))!==null&&ve!==void 0?ve:{graphicalItem:De},st=at.graphicalItem,Mt=st.item,C=Mt===void 0?S:Mt,R=st.childIndex,U=ue(ue(ue({},P.props),ce),{},{activeIndex:R});return[v.cloneElement(C,U),null,null]}return F?[De,null,null]:[De,null]}),vt(j,"renderCustomized",function(S,N,_){return v.cloneElement(S,ue(ue({key:"recharts-customized-".concat(_)},j.props),j.state))}),vt(j,"renderMap",{CartesianGrid:{handler:dm,once:!0},ReferenceArea:{handler:j.renderReferenceElement},ReferenceLine:{handler:dm},ReferenceDot:{handler:j.renderReferenceElement},XAxis:{handler:dm},YAxis:{handler:dm},Brush:{handler:j.renderBrush,once:!0},Bar:{handler:j.renderGraphicChild},Line:{handler:j.renderGraphicChild},Area:{handler:j.renderGraphicChild},Radar:{handler:j.renderGraphicChild},RadialBar:{handler:j.renderGraphicChild},Scatter:{handler:j.renderGraphicChild},Pie:{handler:j.renderGraphicChild},Funnel:{handler:j.renderGraphicChild},Tooltip:{handler:j.renderCursor,once:!0},PolarGrid:{handler:j.renderPolarGrid,once:!0},PolarAngleAxis:{handler:j.renderPolarAxis},PolarRadiusAxis:{handler:j.renderPolarAxis},Customized:{handler:j.renderCustomized}}),j.clipPathId="".concat((x=b.id)!==null&&x!==void 0?x:od("recharts"),"-clip"),j.throttleTriggeredAfterMouseMove=P5(j.triggeredAfterMouseMove,(w=b.throttleDelay)!==null&&w!==void 0?w:1e3/60),j.state={},j}return E_e(y,m),__e(y,[{key:"componentDidMount",value:function(){var x,w;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(x=this.props.margin.left)!==null&&x!==void 0?x:0,top:(w=this.props.margin.top)!==null&&w!==void 0?w:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var x=this.props,w=x.children,j=x.data,S=x.height,N=x.layout,_=es(w,mr);if(_){var P=_.props.defaultIndex;if(!(typeof P!="number"||P<0||P>this.state.tooltipTicks.length-1)){var k=this.state.tooltipTicks[P]&&this.state.tooltipTicks[P].value,O=vj(this.state,j,P,k),M=this.state.tooltipTicks[P].coordinate,A=(this.state.offset.top+S)/2,$=N==="horizontal",L=$?{x:M,y:A}:{y:M,x:A},H=this.state.formattedGraphicalItems.find(function(V){var T=V.item;return T.type.name==="Scatter"});H&&(L=ue(ue({},L),H.props.points[P].tooltipPosition),O=H.props.points[P].tooltipPayload);var D={activeTooltipIndex:P,isTooltipActive:!0,activeLabel:k,activePayload:O,activeCoordinate:L};this.setState(D),this.renderCursor(_),this.accessibilityManager.setIndex(P)}}}},{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 j,S;this.accessibilityManager.setDetails({offset:{left:(j=this.props.margin.left)!==null&&j!==void 0?j:0,top:(S=this.props.margin.top)!==null&&S!==void 0?S:0}})}return null}},{key:"componentDidUpdate",value:function(x){Gw([es(x.children,mr)],[es(this.props.children,mr)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var x=es(this.props.children,mr);if(x&&typeof x.props.shared=="boolean"){var w=x.props.shared?"axis":"item";return l.indexOf(w)>=0?w:a}return a}},{key:"getMouseInfo",value:function(x){if(!this.container)return null;var w=this.container,j=w.getBoundingClientRect(),S=Nhe(j),N={chartX:Math.round(x.pageX-S.left),chartY:Math.round(x.pageY-S.top)},_=j.width/w.offsetWidth||1,P=this.inRange(N.chartX,N.chartY,_);if(!P)return null;var k=this.state,O=k.xAxisMap,M=k.yAxisMap,A=this.getTooltipEventType();if(A!=="axis"&&O&&M){var $=Hi(O).scale,L=Hi(M).scale,H=$&&$.invert?$.invert(N.chartX):null,D=L&&L.invert?L.invert(N.chartY):null;return ue(ue({},N),{},{xValue:H,yValue:D})}var V=Ek(this.state,this.props.data,this.props.layout,P);return V?ue(ue({},N),V):null}},{key:"inRange",value:function(x,w){var j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,S=this.props.layout,N=x/j,_=w/j;if(S==="horizontal"||S==="vertical"){var P=this.state.offset,k=N>=P.left&&N<=P.left+P.width&&_>=P.top&&_<=P.top+P.height;return k?{x:N,y:_}:null}var O=this.state,M=O.angleAxisMap,A=O.radiusAxisMap;if(M&&A){var $=Hi(M);return Q2({x:N,y:_},$)}return null}},{key:"parseEventsOfWrapper",value:function(){var x=this.props.children,w=this.getTooltipEventType(),j=es(x,mr),S={};j&&w==="axis"&&(j.props.trigger==="click"?S={onClick:this.handleClick}:S={onMouseEnter:this.handleMouseEnter,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd});var N=Ug(this.props,this.handleOuterEvent);return ue(ue({},N),S)}},{key:"addListener",value:function(){J0.on(eb,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){J0.removeListener(eb,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(x,w,j){for(var S=this.state.formattedGraphicalItems,N=0,_=S.length;N<_;N++){var P=S[N];if(P.item===x||P.props.key===x.key||w===li(P.item.type)&&j===P.childIndex)return P}return null}},{key:"renderClipPath",value:function(){var x=this.clipPathId,w=this.state.offset,j=w.left,S=w.top,N=w.height,_=w.width;return E.createElement("defs",null,E.createElement("clipPath",{id:x},E.createElement("rect",{x:j,y:S,height:N,width:_})))}},{key:"getXScales",value:function(){var x=this.state.xAxisMap;return x?Object.entries(x).reduce(function(w,j){var S=Pk(j,2),N=S[0],_=S[1];return ue(ue({},w),{},vt({},N,_.scale))},{}):null}},{key:"getYScales",value:function(){var x=this.state.yAxisMap;return x?Object.entries(x).reduce(function(w,j){var S=Pk(j,2),N=S[0],_=S[1];return ue(ue({},w),{},vt({},N,_.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(x){var w;return(w=this.state.xAxisMap)===null||w===void 0||(w=w[x])===null||w===void 0?void 0:w.scale}},{key:"getYScaleByAxisId",value:function(x){var w;return(w=this.state.yAxisMap)===null||w===void 0||(w=w[x])===null||w===void 0?void 0:w.scale}},{key:"getItemByXY",value:function(x){var w=this.state,j=w.formattedGraphicalItems,S=w.activeItem;if(j&&j.length)for(var N=0,_=j.length;N<_;N++){var P=j[N],k=P.props,O=P.item,M=O.type.defaultProps!==void 0?ue(ue({},O.type.defaultProps),O.props):O.props,A=li(O.type);if(A==="Bar"){var $=(k.data||[]).find(function(V){return K0e(x,V)});if($)return{graphicalItem:P,payload:$}}else if(A==="RadialBar"){var L=(k.data||[]).find(function(V){return Q2(x,V)});if(L)return{graphicalItem:P,payload:L}}else if(Nx(P,S)||_x(P,S)||Lh(P,S)){var H=Gwe({graphicalItem:P,activeTooltipItem:S,itemData:M.data}),D=M.activeIndex===void 0?H:M.activeIndex;return{graphicalItem:ue(ue({},P),{},{childIndex:D}),payload:Lh(P,S)?M.data[H]:P.props.data[H]}}}return null}},{key:"render",value:function(){var x=this;if(!UC(this))return null;var w=this.props,j=w.children,S=w.className,N=w.width,_=w.height,P=w.style,k=w.compact,O=w.title,M=w.desc,A=Ak(w,y_e),$=Xe(A,!1);if(k)return E.createElement(ck,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement(Kw,vf({},$,{width:N,height:_,title:O,desc:M}),this.renderClipPath(),WC(j,this.renderMap)));if(this.props.accessibilityLayer){var L,H;$.tabIndex=(L=this.props.tabIndex)!==null&&L!==void 0?L:0,$.role=(H=this.props.role)!==null&&H!==void 0?H:"application",$.onKeyDown=function(V){x.accessibilityManager.keyboardEvent(V)},$.onFocus=function(){x.accessibilityManager.focus()}}var D=this.parseEventsOfWrapper();return E.createElement(ck,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},E.createElement("div",vf({className:wt("recharts-wrapper",S),style:ue({position:"relative",cursor:"default",width:N,height:_},P)},D,{ref:function(T){x.container=T}}),E.createElement(Kw,vf({},$,{width:N,height:_,title:O,desc:M,style:I_e}),this.renderClipPath(),WC(j,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(v.Component);return vt(g,"displayName",n),vt(g,"defaultProps",ue({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},f)),vt(g,"getDerivedStateFromProps",function(m,y){var b=m.dataKey,x=m.data,w=m.children,j=m.width,S=m.height,N=m.layout,_=m.stackOffset,P=m.margin,k=y.dataStartIndex,O=y.dataEndIndex;if(y.updateId===void 0){var M=Ok(m);return ue(ue(ue({},M),{},{updateId:0},p(ue(ue({props:m},M),{},{updateId:0}),y)),{},{prevDataKey:b,prevData:x,prevWidth:j,prevHeight:S,prevLayout:N,prevStackOffset:_,prevMargin:P,prevChildren:w})}if(b!==y.prevDataKey||x!==y.prevData||j!==y.prevWidth||S!==y.prevHeight||N!==y.prevLayout||_!==y.prevStackOffset||!Uc(P,y.prevMargin)){var A=Ok(m),$={chartX:y.chartX,chartY:y.chartY,isTooltipActive:y.isTooltipActive},L=ue(ue({},Ek(y,x,N)),{},{updateId:y.updateId+1}),H=ue(ue(ue({},A),$),L);return ue(ue(ue({},H),p(ue({props:m},H),y)),{},{prevDataKey:b,prevData:x,prevWidth:j,prevHeight:S,prevLayout:N,prevStackOffset:_,prevMargin:P,prevChildren:w})}if(!Gw(w,y.prevChildren)){var D,V,T,F,q=es(w,Eu),Z=q&&(D=(V=q.props)===null||V===void 0?void 0:V.startIndex)!==null&&D!==void 0?D:k,re=q&&(T=(F=q.props)===null||F===void 0?void 0:F.endIndex)!==null&&T!==void 0?T:O,ge=Z!==k||re!==O,B=!Nt(x),le=B&&!ge?y.updateId:y.updateId+1;return ue(ue({updateId:le},p(ue(ue({props:m},y),{},{updateId:le,dataStartIndex:Z,dataEndIndex:re}),y)),{},{prevChildren:w,dataStartIndex:Z,dataEndIndex:re})}return null}),vt(g,"renderActiveDot",function(m,y,b){var x;return v.isValidElement(m)?x=v.cloneElement(m,y):ht(m)?x=m(y):x=E.createElement(jp,y),E.createElement(Rt,{className:"recharts-active-dot",key:b},x)}),function(y){return E.createElement(g,y)}},oB=Tx({chartName:"BarChart",GraphicalChild:Wo,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:ko},{axisType:"yAxis",AxisComp:To}],formatAxisMap:S6}),q_=Tx({chartName:"PieChart",GraphicalChild:da,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:gd},{axisType:"radiusAxis",AxisComp:md}],formatAxisMap:FF,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),H_e=Tx({chartName:"RadarChart",GraphicalChild:Sp,axisComponents:[{axisType:"angleAxis",AxisComp:gd},{axisType:"radiusAxis",AxisComp:md}],formatAxisMap:FF,defaultProps:{layout:"centric",startAngle:90,endAngle:-270,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),lB=Tx({chartName:"AreaChart",GraphicalChild:ta,axisComponents:[{axisType:"xAxis",AxisComp:ko},{axisType:"yAxis",AxisComp:To}],formatAxisMap:S6});const G_e=({messages:e,themes:t,personas:n=[]})=>{var g;const[r,s]=v.useState([{name:"Very Positive",value:0,color:"#4ade80"},{name:"Positive",value:0,color:"#a3e635"},{name:"Neutral",value:0,color:"#93c5fd"},{name:"Negative",value:0,color:"#fb923c"},{name:"Very Negative",value:0,color:"#f87171"}]),[a,o]=v.useState([]),[l,c]=v.useState({}),[u,d]=v.useState({isBalanced:!1,score:0,reason:""}),f=m=>{const y=n.find(b=>b.id===m);return y?y.name:`Participant ${m}`};v.useEffect(()=>{if(e.length===0)return;const m={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0},y={},b={};e.forEach(j=>{if(j.senderId!=="moderator"&&j.senderId!=="facilitator"){const S=j.text.toLowerCase();let N="Neutral";S.includes("love")||S.includes("excellent")||S.includes("amazing")?N="Very Positive":S.includes("good")||S.includes("like")||S.includes("great")?N="Positive":S.includes("bad")||S.includes("issue")||S.includes("problem")?N="Negative":(S.includes("terrible")||S.includes("hate")||S.includes("awful"))&&(N="Very Negative"),m[N]++,b[j.senderId]||(b[j.senderId]={"Very Positive":0,Positive:0,Neutral:0,Negative:0,"Very Negative":0}),b[j.senderId][N]++,y[j.senderId]=(y[j.senderId]||0)+1}}),s(j=>j.map(S=>({...S,value:m[S.name]||0})));const x=Object.entries(y).map(([j,S])=>({name:f(j),messages:S}));o(x);const w={};Object.entries(b).forEach(([j,S])=>{w[j]={name:f(j),sentiments:S}}),c(w),h(y,b)},[e,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((V,T)=>V+T,0)/Object.keys(m).length,w=Object.values(m).map(V=>Math.abs(V-x)/x),j=w.reduce((V,T)=>V+T,0)/w.length,S=Object.values(y).map(V=>Object.values(V).filter(T=>T>0).length),N=S.reduce((V,T)=>V+T,0)/S.length,_=["Very Positive","Positive","Neutral","Negative","Very Negative"],P=Object.values(y).map(V=>{const T=Math.max(...Object.values(V));return _.find(F=>V[F]===T)||"Neutral"}),k=new Set(P).size,O=k/_.length,M=Math.max(0,100-j*100),A=N/5*100,$=O*100,L=Math.round(M*.6+A*.2+$*.2);let H="";const D=L>=70;j>.3&&(H+="Participation is uneven among participants. "),N<2&&(H+="Limited range of sentiments expressed. "),k<=1?H+="Participants show similar sentiment patterns, suggesting potential group-think. ":k>=4&&(H+="Wide divergence in participant sentiments, showing healthy diversity of opinions. "),H===""&&(H=D?"Good mix of participation and diverse opinions.":"Multiple factors affecting balance."),d({isBalanced:D,score:L,reason:H})},p=m=>{const y=l[m];if(!y)return"N/A";const b=y.sentiments;let x=0,w="Neutral";return Object.entries(b).forEach(([j,S])=>{S>x&&(x=S,w=j)}),w};return i.jsx("div",{className:"glass-panel rounded-xl p-4",children:i.jsxs(Fo,{defaultValue:"sentiment",children:[i.jsxs(Pi,{className:"grid grid-cols-2 mb-4",children:[i.jsxs(Xt,{value:"sentiment",className:"flex items-center",children:[i.jsx(fW,{className:"h-4 w-4 mr-2"}),"Sentiment"]}),i.jsxs(Xt,{value:"participation",className:"flex items-center",children:[i.jsx(cw,{className:"h-4 w-4 mr-2"}),"Participation"]})]}),i.jsx(Yt,{value:"sentiment",children:i.jsx(rt,{children:i.jsxs(bt,{className:"pt-6",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsx("h3",{className:"text-lg font-semibold",children:"Sentiment Analysis"}),i.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"]})]}),i.jsx("div",{className:"h-60",children:i.jsx(yo,{width:"100%",height:"100%",children:i.jsxs(q_,{children:[i.jsx(mr,{}),i.jsx(da,{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)=>i.jsx(vp,{fill:m.color},`cell-${y}`))}),i.jsx(ci,{})]})})}),i.jsxs("div",{className:"mt-4",children:[i.jsx("h4",{className:"text-sm font-medium mb-2",children:"Sentiment by Participant"}),i.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto pr-2",children:Object.entries(l).map(([m,y])=>{var w;const b=p(m),x=((w=r.find(j=>j.name===b))==null?void 0:w.color)||"#93c5fd";return i.jsxs("div",{className:"flex items-center justify-between p-2 bg-slate-50 rounded",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(fg,{className:"h-4 w-4 text-slate-400 mr-2"}),i.jsx("span",{className:"text-sm",children:y.name})]}),i.jsxs("div",{className:"flex items-center",children:[i.jsx("span",{className:"text-xs mr-2",children:"Predominant:"}),i.jsx("span",{className:"text-xs font-medium px-2 py-0.5 rounded",style:{backgroundColor:`${x}30`,color:x},children:b})]})]},m)})})]}),i.jsxs("div",{className:"mt-4 pt-4 border-t",children:[i.jsx("h4",{className:"text-sm font-medium mb-2",children:"Focus Group Balance Assessment"}),i.jsxs("div",{className:`p-3 rounded text-sm ${u.isBalanced?"bg-green-50 text-green-700":"bg-amber-50 text-amber-700"}`,children:[i.jsx("span",{className:"font-medium",children:u.isBalanced?"Balanced Focus Group":"Potential Balance Issues"}),i.jsx("p",{className:"mt-1 text-xs",children:u.reason})]})]})]})})}),i.jsx(Yt,{value:"participation",children:i.jsx(rt,{children:i.jsxs(bt,{className:"pt-6",children:[i.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Participation Distribution"}),i.jsx("div",{className:"h-60",children:i.jsx(yo,{width:"100%",height:"100%",children:i.jsxs(oB,{data:a,layout:"vertical",margin:{top:5,right:30,left:20,bottom:5},children:[i.jsx(Vh,{strokeDasharray:"3 3"}),i.jsx(ko,{type:"number"}),i.jsx(To,{dataKey:"name",type:"category",width:100}),i.jsx(mr,{}),i.jsx(Wo,{dataKey:"messages",fill:"#8884d8",name:"Messages"})]})})}),i.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:a.length>0?`Most active: ${(g=a.sort((m,y)=>y.messages-m.messages)[0])==null?void 0:g.name}`:"No participation data available"})]})})})]})})},q_e=({focusGroupId:e,personas:t,isVisible:n,onToggle:r})=>{const[s,a]=v.useState(null),[o,l]=v.useState(null),[c,u]=v.useState(null),[d,f]=v.useState(null),[h,p]=v.useState(!1),[g,m]=v.useState(null),[y,b]=v.useState(null);v.useEffect(()=>{if(n&&e){x();const _=setInterval(x,3e4);return()=>clearInterval(_)}},[n,e]);const x=async()=>{p(!0),m(null);try{const[_,P,k,O]=await Promise.allSettled([jn.getConversationAnalytics(e),jn.getConversationState(e),jn.getAutonomousConversationStatus(e),jn.getConversationInsights(e)]);_.status==="fulfilled"&&a(_.value.data.analytics),P.status==="fulfilled"&&l(P.value.data.state),k.status==="fulfilled"&&u(k.value.data.status),O.status==="fulfilled"&&f(O.value.data.insights),b(new Date)}catch(_){console.error("Error fetching dashboard data:",_),m("Failed to load dashboard data")}finally{p(!1)}},w=()=>{x()},j=_=>{switch(_){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"}},S=_=>{switch(_){case"positive":return"text-green-600";case"negative":return"text-red-600";default:return"text-gray-600"}},N=_=>{switch(_){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?i.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:[i.jsxs("div",{className:"p-4 border-b border-gray-200 bg-gray-50",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(fo,{className:"h-5 w-5 text-blue-600"}),i.jsx("h3",{className:"font-semibold text-gray-900",children:"AI Dashboard"})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(te,{variant:"ghost",size:"sm",onClick:w,disabled:h,className:"p-1",children:i.jsx(Lc,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),i.jsx(te,{variant:"ghost",size:"sm",onClick:r,className:"p-1",children:i.jsx(vW,{className:"h-4 w-4"})})]})]}),y&&i.jsxs("p",{className:"text-xs text-gray-500 mt-1",children:["Last updated: ",y.toLocaleTimeString()]})]}),i.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[g&&i.jsx("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3",children:i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(hW,{className:"h-4 w-4 text-red-600"}),i.jsx("span",{className:"text-sm text-red-800",children:g})]})}),c&&i.jsxs(rt,{children:[i.jsx(Dr,{className:"pb-3",children:i.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[i.jsx("div",{className:`w-3 h-3 rounded-full ${j(c.conversation_state)}`}),"Autonomous Status"]})}),i.jsx(bt,{className:"pt-0",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"State:"}),i.jsx(Wn,{variant:c.conversation_state==="running"?"default":"secondary",children:c.conversation_state})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Actions:"}),i.jsx("span",{className:"font-medium",children:c.action_count||0})]})]})})]}),o&&i.jsxs(rt,{children:[i.jsx(Dr,{className:"pb-3",children:i.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[i.jsx(Za,{className:"h-4 w-4"}),"Conversation Health"]})}),i.jsx(bt,{className:"pt-0",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-sm",children:"Overall Health:"}),i.jsx(Wn,{className:N(o.conversation_health.status),children:o.conversation_health.status})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Score:"}),i.jsxs("span",{className:"font-medium",children:[o.conversation_health.score,"/100"]})]}),i.jsx(al,{value:o.conversation_health.score,className:"h-2"})]}),i.jsxs("div",{className:"space-y-1",children:[i.jsx("span",{className:"text-xs text-gray-600",children:"Indicators:"}),i.jsx("div",{className:"flex flex-wrap gap-1",children:o.conversation_health.indicators.map((_,P)=>i.jsx(Wn,{variant:"outline",className:"text-xs",children:_.replace("_"," ")},P))})]})]})})]}),s&&i.jsxs(rt,{children:[i.jsx(Dr,{className:"pb-3",children:i.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[i.jsx(or,{className:"h-4 w-4"}),"Participation"]})}),i.jsx(bt,{className:"pt-0",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-lg font-semibold text-blue-600",children:s.overview.active_participants}),i.jsx("div",{className:"text-xs text-gray-600",children:"Active"})]}),i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-lg font-semibold text-green-600",children:s.overview.participant_messages}),i.jsx("div",{className:"text-xs text-gray-600",children:"Messages"})]})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Balance:"}),i.jsx(Wn,{variant:s.participation.participation_balance==="balanced"?"default":"secondary",children:s.participation.participation_balance.replace("_"," ")})]}),s.participation.dominant_participants.length>0&&i.jsxs("div",{className:"text-xs text-amber-600",children:["Dominant: ",s.participation.dominant_participants.length," participant(s)"]}),s.participation.quiet_participants.length>0&&i.jsxs("div",{className:"text-xs text-blue-600",children:["Quiet: ",s.participation.quiet_participants.length," participant(s)"]})]})]})})]}),s&&i.jsxs(rt,{children:[i.jsx(Dr,{className:"pb-3",children:i.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[i.jsx(IW,{className:"h-4 w-4"}),"Sentiment"]})}),i.jsx(bt,{className:"pt-0",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex justify-between items-center",children:[i.jsx("span",{className:"text-sm",children:"Overall:"}),i.jsx(Wn,{className:S(s.sentiment_analysis.overall_sentiment),children:s.sentiment_analysis.overall_sentiment})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-xs",children:[i.jsxs("span",{children:["Positive: ",s.sentiment_analysis.sentiment_distribution.positive]}),i.jsxs("span",{children:["Neutral: ",s.sentiment_analysis.sentiment_distribution.neutral]}),i.jsxs("span",{children:["Negative: ",s.sentiment_analysis.sentiment_distribution.negative]})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Trend:"}),i.jsx("span",{className:"font-medium",children:s.sentiment_analysis.sentiment_trend})]})]})]})})]}),s&&i.jsxs(rt,{children:[i.jsx(Dr,{className:"pb-3",children:i.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[i.jsx(dW,{className:"h-4 w-4"}),"Quality Metrics"]})}),i.jsx(bt,{className:"pt-0",children:i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Engagement:"}),i.jsxs("span",{className:"font-medium",children:[Math.round(s.quality_metrics.engagement_score),"/100"]})]}),i.jsx(al,{value:s.quality_metrics.engagement_score,className:"h-2"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Depth:"}),i.jsxs("span",{className:"font-medium",children:[Math.round(s.quality_metrics.depth_score),"/100"]})]}),i.jsx(al,{value:s.quality_metrics.depth_score,className:"h-2"})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Overall:"}),i.jsxs("span",{className:"font-medium",children:[Math.round(s.quality_metrics.quality_score),"/100"]})]}),i.jsx(al,{value:s.quality_metrics.quality_score,className:"h-2"})]})]})})]}),d&&i.jsxs(rt,{children:[i.jsx(Dr,{className:"pb-3",children:i.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[i.jsx(Ml,{className:"h-4 w-4"}),"AI Insights"]})}),i.jsx(bt,{className:"pt-0",children:i.jsxs("div",{className:"space-y-2",children:[i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Energy:"}),i.jsx(Wn,{variant:d.conversation_energy==="high"?"default":"secondary",children:d.conversation_energy})]}),i.jsxs("div",{className:"flex justify-between text-sm",children:[i.jsx("span",{children:"Engagement:"}),i.jsx(Wn,{variant:d.topic_engagement==="high"?"default":"secondary",children:d.topic_engagement})]}),d.next_suggested_action&&i.jsx("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-2 mt-2",children:i.jsxs("div",{className:"text-xs text-blue-800",children:[i.jsx("strong",{children:"Suggestion:"})," ",d.next_suggested_action]})})]})})]}),s&&s.recommendations.length>0&&i.jsxs(rt,{children:[i.jsx(Dr,{className:"pb-3",children:i.jsxs(ts,{className:"text-sm flex items-center gap-2",children:[i.jsx($S,{className:"h-4 w-4"}),"Recommendations"]})}),i.jsx(bt,{className:"pt-0",children:i.jsx("div",{className:"space-y-2",children:s.recommendations.map((_,P)=>i.jsx("div",{className:"bg-amber-50 border border-amber-200 rounded-lg p-2",children:i.jsx("div",{className:"text-xs text-amber-800",children:_})},P))})})]})]})]}):null},K_e=({discussionGuide:e,moderatorStatus:t,onSectionSelect:n,onSetPosition:r,onSave:s,focusGroupId:a,isOpen:o,onToggle:l,className:c,onEditingChange:u})=>{const d=v.useRef(!1),f=v.useCallback(y=>{d.current=y,u==null||u(y)},[u]),[h,p]=v.useState(!1),g=async()=>{if(!e){oe.error("No discussion guide available",{description:"The discussion guide is not available for download"});return}p(!0);try{await St.downloadDiscussionGuide(a),oe.success("Discussion guide downloaded",{description:"The guide has been saved to your downloads folder"})}catch(y){console.error("Error downloading discussion guide:",y),oe.error("Download failed",{description:"Unable to download the discussion guide. Please try again."})}finally{p(!1)}},m=e&&typeof e=="object"&&e.sections;return i.jsx("div",{className:Me("w-full border-b bg-white shadow-sm",c),children:i.jsxs(cp,{open:o,onOpenChange:l,children:[i.jsx(up,{asChild:!0,children:i.jsxs("div",{className:"w-full px-4 py-3 flex items-center justify-between hover:bg-slate-50 transition-colors cursor-pointer",children:[i.jsxs("div",{className:"flex items-center gap-3",children:[i.jsx(gW,{className:"h-5 w-5 text-slate-600"}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-semibold text-slate-900",children:"Discussion Guide"}),m&&i.jsxs("p",{className:"text-xs text-slate-500",children:[e.title," • ",e.total_duration," minutes"]})]})]}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx(te,{variant:"ghost",size:"sm",onClick:y=>{y.stopPropagation(),g()},disabled:!e||h,className:"h-8",children:h?i.jsx(ii,{className:"h-4 w-4 animate-spin"}):i.jsx($l,{className:"h-4 w-4"})}),o?i.jsx(Tl,{className:"h-4 w-4 text-slate-500"}):i.jsx(yi,{className:"h-4 w-4 text-slate-500"})]})]})}),i.jsx(dp,{children:i.jsx("div",{className:"border-t bg-slate-50",children:i.jsx(rt,{className:"mx-4 mb-4 mt-2",children:i.jsx(bt,{className:"p-4",children:i.jsx("div",{className:"max-h-[70vh] overflow-y-auto",children:i.jsx(RN,{discussionGuide:e,moderatorStatus:t,onSectionSelect:n,onSetPosition:r,onSave:s,showProgress:!0,collapsible:!0,defaultExpanded:!0,focusGroupId:a,onEditingChange:f})})})})})})]})})},X_e=({focusGroupId:e,focusGroupName:t="Focus Group",onNoteClick:n})=>{const[r,s]=v.useState([]),[a,o]=v.useState(!0),[l,c]=v.useState(null);v.useEffect(()=>{u()},[e]);const u=async()=>{try{o(!0);const x=await St.getNotes(e);if(x.data&&Array.isArray(x.data)){const w=x.data.map(j=>({...j,timestamp:new Date(j.timestamp),createdAt:new Date(j.createdAt)}));s(y(w))}}catch(x){console.error("Error fetching notes:",x),oe.error("Failed to load notes",{description:"Please refresh the page to try again."})}finally{o(!1)}},d=async x=>{c(x);try{await St.deleteNote(e,x),s(r.filter(w=>w.id!==x)),oe.success("Note deleted successfully")}catch(w){console.error("Error deleting note:",w),oe.error("Failed to delete note",{description:"Please try again."})}finally{c(null)}},f=x=>{x.associatedMessageId&&n?n(x.associatedMessageId):oe.info("No associated message",{description:"This note is not linked to a specific discussion point."})},h=()=>{if(r.length===0){oe.warning("No notes to export",{description:"Create some notes first before exporting."});return}const x=p(),w=document.createElement("a"),j=new Blob([x],{type:"text/markdown"});w.href=URL.createObjectURL(j),w.download=`${t.replace(/[^a-z0-9]/gi,"_").toLowerCase()}_notes.md`,document.body.appendChild(w),w.click(),document.body.removeChild(w),oe.success("Notes exported successfully",{description:`Downloaded ${r.length} notes as Markdown file.`})},p=()=>{const x=[`# Notes: ${t}`,"",`Exported on: ${new Date().toLocaleString()}`,`Total notes: ${r.length}`,"","---",""];return r.forEach((w,j)=>{var S;x.push(`## Note ${j+1}`),x.push(""),x.push(`**Created:** ${w.createdAt.toLocaleString()}`),(S=w.sectionInfo)!=null&&S.sectionTitle&&x.push(`**Section:** ${w.sectionInfo.sectionTitle}`),x.push(`**Elapsed Time:** ${g(w.elapsedTime)}`),x.push(""),x.push("**Content:**"),x.push(w.content),x.push(""),x.push("---"),x.push("")}),x.join(` +`)},g=x=>{const w=Math.floor(x/1e3),j=Math.floor(w/60),S=w%60;return`${j}:${S.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,j)=>j.createdAt.getTime()-w.createdAt.getTime()),b=x=>{s(w=>y([...w,x]))};return v.useEffect(()=>(window.notesPanelAddNote=b,()=>{delete window.notesPanelAddNote}),[]),a?i.jsx("div",{className:"flex items-center justify-center h-64",children:i.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}):i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{className:"flex items-center justify-between mb-4",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(dg,{className:"h-5 w-5 text-primary mr-2"}),i.jsx("h2",{className:"font-sf text-xl font-semibold",children:"Notes"}),r.length>0&&i.jsxs("span",{className:"ml-2 text-sm text-slate-500",children:["(",r.length,")"]})]}),i.jsxs(te,{variant:"outline",size:"sm",onClick:h,disabled:r.length===0,children:[i.jsx($l,{className:"mr-2 h-4 w-4"}),"Export Notes"]})]}),i.jsx(Uy,{className:"flex-1",children:r.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center bg-slate-50 rounded-lg",children:[i.jsx(dg,{className:"h-8 w-8 text-slate-400 mb-3"}),i.jsx("p",{className:"text-slate-600",children:"No notes yet."}),i.jsx("p",{className:"text-sm text-slate-500 mt-2",children:'Click the "Note" button during the session to add contextual notes.'})]}):i.jsx("div",{className:"space-y-4",children:r.map(x=>{var w;return i.jsxs(rt,{className:"hover:shadow-md transition-shadow cursor-pointer group",onClick:()=>f(x),children:[i.jsx(Dr,{className:"pb-2",children:i.jsxs("div",{className:"flex items-start justify-between",children:[i.jsxs("div",{className:"flex-1",children:[i.jsx(ts,{className:"text-sm font-medium text-slate-600",children:m(x.createdAt)}),((w=x.sectionInfo)==null?void 0:w.sectionTitle)&&i.jsx("div",{className:"text-xs text-slate-500 mt-1",children:i.jsx("span",{children:x.sectionInfo.sectionTitle})})]}),i.jsxs("div",{className:"flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[x.associatedMessageId&&i.jsx(te,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:j=>{j.stopPropagation(),f(x)},title:"Go to discussion point",children:i.jsx(CW,{className:"h-3 w-3"})}),i.jsx(te,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",onClick:j=>{j.stopPropagation(),d(x.id)},disabled:l===x.id,title:"Delete note",children:i.jsx(_n,{className:"h-3 w-3"})})]})]})}),i.jsx(bt,{className:"pt-0",children:i.jsx("p",{className:"text-sm text-slate-700 whitespace-pre-wrap",children:x.content})})]},x.id)})})})]})},Y_e=({isOpen:e,onClose:t,focusGroupId:n,associatedMessageId:r,sectionInfo:s,messageTimestamp:a,onNoteSaved:o})=>{const[l,c]=v.useState(""),[u,d]=v.useState(!1),f=async()=>{if(!l.trim()){oe.error("Note content cannot be empty");return}d(!0);try{const p={content:l.trim(),associatedMessageId:r,sectionInfo:s,elapsedTime:0,timestamp:a.toISOString(),createdAt:new Date().toISOString()},g=await St.createNote(n,p);if(g.data){const m={...g.data,timestamp:new Date(g.data.timestamp),createdAt:new Date(g.data.createdAt)},y=s!=null&&s.sectionTitle?`'${s.sectionTitle}'`:"current section",b=a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});oe.success("Quick note saved",{description:`Note linked to ${y} at ${b}`}),o&&o(m),c(""),t()}}catch(p){console.error("Error saving note:",p),oe.error("Failed to save note",{description:"Please try again or check your connection."})}finally{d(!1)}},h=()=>{c(""),t()};return i.jsx(wl,{open:e,onOpenChange:h,children:i.jsxs(ho,{className:"sm:max-w-md",children:[i.jsx(po,{children:i.jsx(go,{children:"Quick Note"})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"text-sm text-slate-600",children:[i.jsxs("div",{children:[i.jsx("strong",{children:"Section:"})," ",(s==null?void 0:s.sectionTitle)||"Unknown section"]}),i.jsxs("div",{children:[i.jsx("strong",{children:"Time:"})," ",a.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),i.jsx(nt,{placeholder:"Enter your note here...",value:l,onChange:p=>c(p.target.value),className:"min-h-[100px] resize-none",autoFocus:!0})]}),i.jsxs(mo,{children:[i.jsx(te,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),i.jsx(te,{onClick:f,disabled:u,children:u?"Saving...":"Save Note"})]})]})})},Z_e=()=>{const{id:e}=QM(),t=Tn(),[n,r]=v.useState([]),[s,a]=v.useState([]),[o,l]=v.useState([]),[c,u]=v.useState(null),[d,f]=v.useState([]),[h,p]=v.useState("chat"),[g,m]=v.useState(null),[y,b]=v.useState(!1),[x,w]=v.useState(!1),[j,S]=v.useState(!0),[N,_]=v.useState(!1),[P,k]=v.useState(!1),O=v.useRef(!1),[M,A]=v.useState(!1),$=v.useRef(c);$.current=c;const[L,H]=v.useState([]),[D,V]=v.useState(!1),[T,F]=v.useState(""),[q,Z]=v.useState(!1),[re,ge]=v.useState(!1),[B,le]=v.useState(null),[se,ce]=v.useState([]),[De,de]=v.useState(!1),[be,Pe]=v.useState(!1),[ne,Je]=v.useState(!1),[ve,at]=v.useState({isOpen:!1}),st=v.useRef(!1),[Mt,C]=v.useState(""),R=v.useRef(""),U=v.useRef(!1),X=async()=>{var J;if(e)try{const Y=await jn.getModeratorStatus(e);if((J=Y==null?void 0:Y.data)!=null&&J.status){const ye=Y.data.status;if(g){const xe=g.current_section_id!==ye.current_section_id||g.current_item_id!==ye.current_item_id||g.progress!==ye.progress}O.current||m(ye)}}catch(Y){console.error("Error fetching moderator status:",Y)}},Q=async()=>{if(!e)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:x,sessionStatus:Mt};const J=await St.getById(e);if(!J||typeof J!="object")return console.error("Invalid response object received:",J),{aiActive:x,sessionStatus:Mt};if(!J.data||typeof J.data!="object")return console.warn("Focus group response missing data property:",J),{aiActive:x,sessionStatus:Mt};const Y=J.data.status;if(typeof Y>"u")return console.warn("Focus group response missing status field:",J.data),{aiActive:x,sessionStatus:Mt};const ye=Y==="ai_mode";return Y==="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(Y)||console.warn("Unexpected focus group status value:",Y),{aiActive:ye,sessionStatus:Y}}catch(J){console.error("Error checking AI mode status:",J);const Y={focusGroupId:e,currentAiModeStatus:x,errorType:"unknown",timestamp:new Date().toISOString()};return J.response?(Y.errorType="api_error",Y.status=J.response.status,Y.data=J.response.data,console.error("API error response:",J.response.status,J.response.data),J.response.status===404?console.warn("Focus group not found - may have been deleted"):J.response.status===500&&console.error("Server error during status check - backend issue")):J.request?(Y.errorType="network_error",console.error("Network error - no response received, check connectivity")):(Y.errorType="request_setup",Y.message=J.message,console.error("Request setup error:",J.message)),console.debug("Status check error details:",Y),{aiActive:x,sessionStatus:Mt}}},z=async(J,Y)=>{if(!e||U.current)return;const ye=["completed","paused"],je=["ai_mode","autonomous_active","active","in-progress"].includes(Y),Qe=ye.includes(J);if(je&&Qe){U.current=!0;try{let I="session_ended";J==="completed"?I="auto_complete":J==="paused"&&(I="manual_stop");const K=await jn.endSession(e,I);K!=null&&K.data&&(Ke.success("Session concluded",{description:"The focus group session has ended with a concluding statement from the moderator."}),setTimeout(()=>{ee()},1e3))}catch(I){console.error("❌ Error ending session with concluding statement:",I),Ke.error("Error ending session",{description:"Failed to add concluding statement, but the session has ended."})}}},ee=async()=>{var J;if(e)try{const Y=await St.getMessages(e);let ye=[],xe=[];Y&&Y.data&&(Array.isArray(Y.data)?(ye=Y.data,xe=[]):Y.data.messages||Y.data.mode_events?(ye=Y.data.messages||[],xe=Y.data.mode_events||[]):(ye=Array.isArray(Y.data)?Y.data:[],xe=[]));const je=ye.map(W=>({id:W._id||W.id||`msg-${Date.now()}`,senderId:W.senderId,text:W.text,timestamp:new Date(W.timestamp||W.created_at||new Date),type:W.type||"response",highlighted:W.highlighted||!1})),Qe=xe.map(W=>({id:W._id||W.id||`event-${Date.now()}`,focus_group_id:W.focus_group_id,event_type:W.event_type,timestamp:new Date(W.timestamp||W.created_at||new Date),user_id:W.user_id,created_at:new Date(W.created_at||new Date)}));a(Qe),je.length>0?r(W=>{if(W.length===0)return je;{const ie=new Map;W.forEach(Wt=>ie.set(Wt.id,Wt));const he=je.map(Wt=>{if(ie.has(Wt.id)){const It=ie.get(Wt.id);return{...Wt,highlighted:It.highlighted}}return Wt}),ke=new Set(he.map(Wt=>Wt.id)),qe=W.filter(Wt=>!ke.has(Wt.id));return[...he,...qe].sort((Wt,It)=>Wt.timestamp.getTime()-It.timestamp.getTime())}}):je.length===0&&r(W=>W.length===0?[]:W);const I=je.filter(W=>W.highlighted),K=I.length>0?I.map(W=>({id:`theme-${W.id}`,text:W.text.substring(0,40)+(W.text.length>40?"...":""),count:1,messages:[W.id],source:"highlight"})):[];try{const W=await jn.getKeyThemes(e);if((J=W==null?void 0:W.data)!=null&&J.themes&&Array.isArray(W.data.themes)){const ie=W.data.themes;l([...K,...ie])}else l(K)}catch(W){console.error("Error fetching AI-generated themes:",W),l(K)}}catch(Y){console.error("Error fetching messages:",Y),n.length===0&&Ke.error("Failed to fetch messages",{description:"Please try again later or restart the session."})}},me=async()=>{if(!e)return!1;try{const Y=(await Dn.getAll()).data||[],ye=await St.getById(e);if(ye&&ye.data){const xe=ye.data;console.log("Focus group data from API:",xe);const je={id:xe._id||xe.id,name:xe.name,status:xe.status||"in-progress",participants:xe.participants||[],date:xe.date||new Date().toISOString(),duration:xe.duration||60,topic:xe.topic||"general",discussionGuide:xe.discussionGuide||"",llm_model:xe.llm_model||"gemini-2.5-pro"};if(u(je),F(je.llm_model||"gemini-2.5-pro"),xe.participants_data&&Array.isArray(xe.participants_data))f(xe.participants_data.map(I=>({...I,id:I._id||I.id})));else if(je.participants&&Array.isArray(je.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:je.participants,allPersonas:Y.map(K=>({id:K._id||K.id,name:K.name}))});const I=Y.filter(K=>{const W=K._id||K.id;return je.participants.includes(W)});console.log("Matched participants:",I.map(K=>K.name)),f(I)}await ee(),await X();const Qe=await Q();return w(Qe.aiActive),C(Qe.sessionStatus),st.current=Qe.aiActive,R.current=Qe.sessionStatus,!0}return!1}catch(J){return console.error("Error fetching focus group:",J),!1}},Se=async J=>{if(console.log("🔧 updateFocusGroupModel called with:",{id:e,focusGroup:!!c,newModel:J}),!e||!c){console.log("❌ updateFocusGroupModel: Missing id or focusGroup",{id:e,focusGroup:!!c});return}Z(!0);try{console.log("🔧 Making API call to update focus group model:",{id:e,newModel:J});const Y=await St.update(e,{llm_model:J});console.log("🔧 API response:",Y),Y&&Y.data?(u(ye=>ye?{...ye,llm_model:J}:null),Ke.success("AI Model Updated",{description:`Focus group will now use ${J==="gemini-2.5-pro"?"Gemini 2.5 Pro":"GPT-4.1"} for AI responses`}),V(!1),console.log("✅ Model update successful")):console.log("❌ API response missing data:",Y)}catch(Y){console.error("❌ Error updating focus group model:",Y),Ke.error("Failed to update AI model",{description:"There was an error updating the AI model. Please try again."})}finally{Z(!1)}};v.useEffect(()=>{console.log("Looking for focus group with ID:",e);const J=async()=>{try{return(await Dn.getAll()).data||[]}catch(je){return console.error("Error fetching personas:",je),[]}},Y=async je=>{try{const Qe=await St.getById(e);if(Qe&&Qe.data){const I=Qe.data;console.log("Focus group data from API:",I);const K={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(u(K),F(K.llm_model||"gemini-2.5-pro"),I.participants_data&&Array.isArray(I.participants_data))f(I.participants_data.map(W=>({...W,id:W._id||W.id})));else if(K.participants&&Array.isArray(K.participants)){console.log("Matching participants from DB:",{focusGroupParticipants:K.participants,allPersonas:je.map(ie=>({id:ie._id||ie.id,name:ie.name}))});const W=je.filter(ie=>{const he=ie._id||ie.id;return K.participants.includes(he)});console.log("Matched participants:",W.map(ie=>ie.name)),f(W)}return ee(),X(),S(!1),!0}return!1}catch(Qe){return console.error("Error fetching focus group:",Qe),!1}};let ye,xe;return J().then(je=>{Y(je).then(Qe=>{Qe?((()=>{ee(),X(),ye&&window.clearInterval(ye);const W=x?3e3:1e4;console.log("📡 Setting up message polling:",{aiModeActive:x,pollInterval:W,timestamp:new Date().toISOString()}),ye=window.setInterval(()=>{O.current?console.log("📡 Skipping poll - editing discussion guide"):(console.log("📡 Polling for messages...",new Date().toISOString()),ee(),X())},W)})(),xe=window.setInterval(async()=>{const W=st.current,ie=R.current,he=await Q();if(st.current=he.aiActive,R.current=he.sessionStatus,w(he.aiActive),C(he.sessionStatus),ie&&ie!==he.sessionStatus&&await z(he.sessionStatus,ie),W!==he.aiActive&&ye){window.clearInterval(ye);const ke=he.aiActive?3e3:1e4;ye=window.setInterval(()=>{O.current||(ee(),X())},ke)}},15e3)):(console.error("Focus group not found with ID:",e),S(!1),Ke.error("Focus group not found",{description:`Could not find focus group with ID: ${e}`}))})}),()=>{ye&&window.clearInterval(ye),xe&&window.clearInterval(xe)}},[e,t]);const Ie=J=>{if(!J||!J.sections||!Array.isArray(J.sections))return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const Y=J.sections[0];if(!Y)return{content:"Welcome to our focus group session! Let's begin our discussion.",sectionId:"welcome",itemId:"welcome-message"};const ye=je=>je.questions&&Array.isArray(je.questions)&&je.questions.length>0?{content:je.questions[0].content,itemId:je.questions[0].id,type:"question"}:je.activities&&Array.isArray(je.activities)&&je.activities.length>0?{content:je.activities[0].content,itemId:je.activities[0].id,type:"activity"}:null;let xe=ye(Y);if(!xe&&Y.subsections&&Array.isArray(Y.subsections)){for(const je of Y.subsections)if(xe=ye(je),xe)break}return xe?{content:xe.content,sectionId:Y.id,itemId:xe.itemId}:{content:`Welcome to our focus group session on "${Y.title||"our topic"}". Let's begin our discussion.`,sectionId:Y.id,itemId:"section-intro"}},we=async()=>{var J,Y,ye,xe,je,Qe;if(e)try{Ke.info("Starting focus group session...",{description:"The session is now ready for AI moderation."});try{const I=await jn.getModeratorStatus(e),K=(Y=(J=I==null?void 0:I.data)==null?void 0:J.status)==null?void 0:Y.moderator_position;K?console.log("📍 Preserving existing moderator position:",K):(await jn.setModeratorPosition(e,((je=(xe=(ye=c==null?void 0:c.discussionGuide)==null?void 0:ye.sections)==null?void 0:xe[0])==null?void 0:je.id)||"welcome"),console.log("🚀 Moderator position initialized to start of discussion guide (first time)"))}catch(I){console.warn("Failed to check/initialize moderator position:",I)}await St.update(e,{status:"active"});try{const I=Ie(c==null?void 0:c.discussionGuide),K={id:`msg-${Date.now()}`,senderId:"moderator",text:I.content,timestamp:new Date,type:"question"},W=await St.sendMessage(e,{senderId:"moderator",text:K.text,type:"question"});(Qe=W==null?void 0:W.data)!=null&&Qe.message_id&&(K.id=W.data.message_id),ze(K),console.log("🚀 Initial moderator message created:",{content:I.content,sectionId:I.sectionId,itemId:I.itemId})}catch(I){console.warn("Failed to create initial moderator message:",I)}Ke.success("Focus group session started",{description:"The discussion has begun. Use the control panel below to moderate."})}catch(I){console.error("Error starting session:",I),Ke.error("Error starting session",{description:"There was a problem connecting to the server."})}},ze=J=>{r(Y=>[...Y,J])},gt=async J=>{const Y=[...n],ye=Y.findIndex(xe=>xe.id===J);if(ye!==-1){const xe=Y[ye],je=!xe.highlighted;if(Y[ye]={...xe,highlighted:je},r(Y),e)try{!J.startsWith("local-")&&!J.startsWith("msg-")?await St.updateMessageHighlight(e,J,je):console.log("Skipping database update for local message:",J)}catch(Qe){console.error("Error updating message highlight state:",Qe),Ke.error("Failed to save highlight state",{description:"The highlight may not persist if the page is refreshed."})}}},jt=J=>d.find(Y=>Y.id===J||Y._id===J),Ge=()=>{const J=n.map(xe=>{var I;let je;return xe.senderId==="moderator"?je="AI Moderator":xe.senderId==="facilitator"?je="Human Facilitator":je=((I=jt(xe.senderId))==null?void 0:I.name)||"Unknown",`[${xe.timestamp.toLocaleTimeString()}] ${je}: ${xe.text}`}).join(` + +`),Y=document.createElement("a"),ye=new Blob([J],{type:"text/plain"});Y.href=URL.createObjectURL(ye),Y.download=`focus-group-${e}-transcript.txt`,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y),Ke.success("Transcript downloaded",{description:"The focus group transcript has been saved to your device."})},Ze=(J,Y)=>{const ye=he=>{const ke=he.match(/^\[([^\]]+)\]:\s*(.*)$/);return ke?ke[2].trim():he.trim()},xe=he=>he.toLowerCase().replace(/[^\w\s]/g," ").replace(/\s+/g," ").trim(),je=(he,ke)=>{const qe=xe(he),Ft=xe(ke);if(qe===Ft)return 1;if(qe.includes(Ft)||Ft.includes(qe))return Math.min(qe.length,Ft.length)/Math.max(qe.length,Ft.length);const Wt=qe.split(" "),It=Ft.split(" "),fa=Wt.filter(tc=>It.includes(tc)&&tc.length>2);return Wt.length===0||It.length===0?0:fa.length/Math.max(Wt.length,It.length)},Qe=typeof J=="object"&&J!==null,I=Qe?J.text:ye(J),K=Qe?J.original:J;let W=null,ie="";if(Y&&(W=n.find(he=>he.id===Y),W?ie="direct_message_id_match":console.warn(`Message ID ${Y} not found in current messages array`)),W||(W=n.find(he=>he.text.includes(K)),W&&(ie="exact_full_match")),W||(W=n.find(he=>he.text.includes(I)),W&&(ie="exact_text_match")),W||(W=n.find(he=>I.includes(he.text.trim())),W&&(ie="reverse_exact_match")),!W){const he=I.toLowerCase();W=n.find(ke=>ke.text.toLowerCase().includes(he)||he.includes(ke.text.toLowerCase())),W&&(ie="case_insensitive_match")}if(!W){const he=n.map(ke=>({message:ke,similarity:je(I,ke.text)})).filter(ke=>ke.similarity>.7).sort((ke,qe)=>qe.similarity-ke.similarity);he.length>0&&(W=he[0].message,ie=`fuzzy_match_${Math.round(he[0].similarity*100)}%`)}if(!W){const ke=xe(I).split(" ").filter(qe=>qe.length>3);ke.length>0&&(W=n.find(qe=>{const Ft=xe(qe.text);return ke.every(Wt=>Ft.includes(Wt))}),W&&(ie="partial_word_match"))}W?(console.log(`Quote match found using strategy: ${ie}`,{quoteType:Qe?"QuoteData":"string",providedMessageId:Y,extractedText:I,matchedMessage:W.text.substring(0,100),matchedMessageId:W.id,originalQuote:K.substring(0,100)}),p("chat"),setTimeout(()=>{const he=document.getElementById(`message-${W.id}`);he&&(P||he.scrollIntoView({behavior:"smooth",block:"center"}),he.style.backgroundColor="#fbbf24",he.style.transition="background-color 0.3s ease",setTimeout(()=>{he.style.backgroundColor=""},2e3))},100)):(console.warn("Quote match failed",{quoteType:Qe?"QuoteData":"string",providedMessageId:Y,originalQuote:K.substring(0,100),extractedText:I.substring(0,100),totalMessages:n.length,messageSample:n.slice(0,3).map(he=>({id:he.id,text:he.text.substring(0,50)}))}),Ke.warning("Message not found",{description:"Could not locate the original message for this quote. The quote may have been paraphrased by the AI."}))},kt=J=>{l(Y=>{const ye=new Set(Y.map(je=>je.id)),xe=J.filter(je=>!ye.has(je.id));return[...Y,...xe]})},Vt=async J=>{if(!e)return;const Y=o.find(ye=>ye.id===J);if(Y)try{"source"in Y&&Y.source==="generated"&&await jn.deleteKeyTheme(e,J),l(o.filter(ye=>ye.id!==J))}catch(ye){console.error("Error deleting theme:",ye),Ke.error("Failed to delete theme",{description:"There was an error removing the theme. Please try again."})}},Xn=v.useCallback(async(J,Y)=>{if(e)try{await jn.setModeratorPosition(e,J,Y),await X(),Ke.success("Moderator position updated",{description:"The moderator has been moved to the selected section."})}catch(ye){console.error("Error setting moderator position:",ye),Ke.error("Failed to update moderator position",{description:"There was an error updating the moderator position."})}},[e]),an=v.useCallback(async J=>{if(console.log("💾 handleDiscussionGuideSave called:",{hasId:!!e,isEditingGuideContent:M,timestamp:new Date().toISOString()}),!!e)try{await St.update(e,{discussionGuide:J}),M?($.current&&($.current={...$.current,discussionGuide:J}),console.log("⚠️ Skipping focus group state update during editing to preserve focus")):(console.log("🔄 Updating focus group state (not editing)"),u(Y=>Y?{...Y,discussionGuide:J}:null))}catch(Y){throw console.error("Error saving discussion guide:",Y),Y}},[e,M]),pt=v.useCallback(J=>{console.log("🔄 handleGuideEditingStateChange called:",{editing:J,timestamp:new Date().toISOString(),currentIsEditingGuideContent:M}),k(J),A(J),!J&&$.current&&(console.log("📝 Updating focus group state after editing ended"),u($.current))},[M]),tt=v.useCallback(()=>{_(J=>!J)},[]),it=v.useCallback((J,Y,ye,xe,je,Qe)=>{at({isOpen:!0,sectionId:J,itemId:Y,content:ye,sectionTitle:xe,itemTitle:je,itemType:Qe})},[]),Lt=J=>{console.log("🔍 EXTRACT ASSET FILENAME DEBUG - Input content:",J);const Y=[/'([^']*\.[a-zA-Z]{3,4})'/g,/"([^"]*\.[a-zA-Z]{3,4})"/g,/titled\s+['"]([^'"]*\.[a-zA-Z]{3,4})['"](?:\.|,|\s|$)/gi,/asset[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/image[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/file[:\s]+['"]?([^'"\s]*\.[a-zA-Z]{3,4})['"]?(?:\.|,|\s|$)/gi,/\b([a-zA-Z0-9_-]+\.[a-zA-Z]{3,4})\b/g];for(let ye=0;ye0){const Qe=je[0][1];if(console.log(`🔍 Pattern ${ye+1} extracted filename:`,Qe),Qe&&Qe.includes("."))return console.log("✅ EXTRACT ASSET FILENAME - Found:",Qe),Qe}}return console.warn("❌ EXTRACT ASSET FILENAME - No filename found in content"),null},tn=()=>{if(g)return{sectionId:g.current_section_id,sectionTitle:g.current_section,itemId:g.current_item_id,itemTitle:g.current_item}},Xr=()=>{if(n.length!==0)return n[n.length-1].id},za=()=>{const J=Xr();if(!J||n.length===0)return new Date;const Y=n.find(ye=>ye.id===J);return Y?Y.timestamp:new Date},G=async()=>{if(e){de(!0),Pe(!1),Je(!1),Ke.info("Analyzing discussion for key themes...",{description:"This may take a moment as we process the entire conversation."});try{const J=await jn.generateKeyThemes(e);J.data&&J.data.themes?(Pe(!0),Ke.success(`Generated ${J.data.themes.length} key themes`,{description:"New themes have been added to the analysis."}),l(Y=>[...Y,...J.data.themes])):(Pe(!0),Ke.warning("No new themes were generated",{description:"Try again when the discussion has more content."}))}catch(J){console.error("Error generating key themes:",J),Je(!0),Ke.error("Failed to generate key themes",{description:"There was an error analyzing the discussion. Please try again."})}}},Ce=()=>{de(!1),Pe(!1),Je(!1)},Oe=()=>{B||le(new Date),ge(!0)},Ue=J=>{H(Y=>[...Y,J].sort((ye,xe)=>xe.createdAt.getTime()-ye.createdAt.getTime())),window.notesPanelAddNote&&window.notesPanelAddNote(J)},Le=J=>{const Y=n.find(ye=>ye.id===J);Y?(p("chat"),setTimeout(()=>{const ye=document.getElementById(`message-${Y.id}`);ye&&(P||ye.scrollIntoView({behavior:"smooth",block:"center"}),ye.style.backgroundColor="#fbbf24",ye.style.transition="background-color 0.3s ease",setTimeout(()=>{ye.style.backgroundColor=""},2e3))},100)):Ke.info("Message not found",{description:"Could not locate the original message for this note."})};v.useEffect(()=>{n.length>0&&!B&&le(new Date)},[n.length,B]),v.useEffect(()=>{O.current=P,P||X()},[P]);const ft=J=>{ce(Y=>Y.includes(J)?Y.filter(ye=>ye!==J):[...Y,J])};return j?i.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[i.jsx(oi,{}),i.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[i.jsx("div",{className:"flex justify-center items-center",children:i.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})}),i.jsx("p",{className:"mt-4 text-slate-600",children:"Loading focus group..."})]})]}):c?i.jsxs("div",{className:"min-h-screen bg-slate-50",children:[i.jsx(oi,{}),i.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[i.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-4",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(te,{variant:"ghost",onClick:()=>t("/focus-groups"),className:"mr-2",children:i.jsx(zf,{className:"h-4 w-4"})}),i.jsxs("div",{children:[i.jsx("h1",{className:"font-sf text-2xl font-bold text-slate-900",children:c.name}),i.jsx("p",{className:"text-slate-600",children:new Date(c.date).toLocaleString()}),i.jsxs("div",{className:"flex items-center mt-1",children:[i.jsx(fo,{className:"h-3 w-3 text-slate-500 mr-1"}),i.jsx(Wn,{variant:"secondary",className:"text-xs",children:c.llm_model==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro"})]})]})]}),i.jsxs("div",{className:"flex items-center space-x-4 mt-4 sm:mt-0",children:[i.jsxs(te,{variant:"outline",onClick:()=>b(!y),className:y?"bg-blue-50 text-blue-600":"",children:[i.jsx(cw,{className:"mr-2 h-4 w-4"}),"AI Dashboard"]}),i.jsxs(te,{variant:"outline",onClick:()=>V(!0),children:[i.jsx(LS,{className:"mr-2 h-4 w-4"}),"AI Model"]}),i.jsxs(te,{variant:"outline",onClick:Ge,children:[i.jsx($l,{className:"mr-2 h-4 w-4"}),"Download Transcript"]})]})]}),De&&i.jsx("div",{className:"mb-6",children:i.jsx(IN,{isActive:De,isComplete:be,hasError:ne,label:"Analyzing discussion for key themes",onComplete:Ce,className:"max-w-4xl mx-auto"})}),i.jsx(K_e,{discussionGuide:c.discussionGuide,moderatorStatus:g,onSectionSelect:Xn,onSetPosition:it,onSave:an,focusGroupId:e||"",isOpen:N,onToggle:tt,onEditingChange:pt}),i.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 h-[calc(100vh-12rem)]",children:[i.jsx(OQ,{participants:d,selectedParticipantIds:se,onToggleParticipantFilter:ft}),i.jsx("div",{className:"flex-1 flex flex-col",children:i.jsxs(Fo,{defaultValue:"chat",value:h,onValueChange:p,className:"w-full h-full flex flex-col",children:[i.jsxs(Pi,{className:"grid grid-cols-4 mb-4",children:[i.jsxs(Xt,{value:"chat",className:"flex items-center",children:[i.jsx(xa,{className:"h-4 w-4 mr-2"}),"Discussion"]}),i.jsxs(Xt,{value:"themes",className:"flex items-center",children:[i.jsx(Ml,{className:"h-4 w-4 mr-2"}),"Key Themes"]}),i.jsxs(Xt,{value:"notes",className:"flex items-center",children:[i.jsx(dg,{className:"h-4 w-4 mr-2"}),"Notes"]}),i.jsxs(Xt,{value:"analytics",className:"flex items-center",children:[i.jsx(cw,{className:"h-4 w-4 mr-2"}),"Analytics"]})]}),i.jsx(Yt,{value:"chat",className:"m-0 flex-1 flex flex-col h-0",children:n.length===0?i.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[i.jsx("p",{className:"text-lg text-slate-600",children:"No messages yet. Start the session to begin the discussion."}),i.jsxs(te,{onClick:we,size:"lg",className:"flex items-center gap-2",children:[i.jsx(sI,{className:"h-5 w-5"}),"Start Session"]})]}):i.jsx(aJ,{messages:n,modeEvents:s,personas:d,isSpeaking:!1,focusGroupId:e||"",isAiModeActive:x,selectedParticipantIds:se,onToggleHighlight:gt,onAdvanceDiscussion:()=>null,onNewMessage:ze,onStatusChange:me,isEditingDiscussionGuide:P})}),i.jsx(Yt,{value:"themes",className:"m-0",children:i.jsx(oJ,{themes:o,messages:n,personas:d,focusGroupId:e||"",onThemesGenerated:kt,onThemeDelete:Vt,onQuoteClick:Ze,onGenerateKeyThemes:G})}),i.jsx(Yt,{value:"notes",className:"m-0",style:{height:"calc(100% - 3.5rem)"},children:i.jsx("div",{className:"h-full",children:i.jsx(X_e,{focusGroupId:e||"",focusGroupName:c==null?void 0:c.name,onNoteClick:Le})})}),i.jsx(Yt,{value:"analytics",className:"m-0",children:i.jsx(G_e,{messages:n,themes:o,personas:d})})]})})]})]}),n.length>0&&i.jsx("div",{className:"fixed bottom-6 right-6 z-40",children:i.jsx(te,{onClick:Oe,className:"rounded-full h-12 w-12 p-0 shadow-lg",title:"Take a quick note",children:i.jsx(dg,{className:"h-5 w-5"})})}),i.jsx(Y_e,{isOpen:re,onClose:()=>ge(!1),focusGroupId:e||"",associatedMessageId:Xr(),sectionInfo:tn(),messageTimestamp:za(),onNoteSaved:Ue}),i.jsx(wl,{open:ve.isOpen,onOpenChange:J=>at(Y=>({...Y,isOpen:J})),children:i.jsxs(ho,{children:[i.jsxs(po,{children:[i.jsx(go,{children:"Set Moderator Position"}),i.jsxs(jl,{children:['Are you sure you want to set the moderator position to "',ve.itemTitle,'" in section "',ve.sectionTitle,'"? This will make the moderator ask this question in the chat.']})]}),i.jsxs(mo,{children:[i.jsx(te,{variant:"outline",disabled:ve.isLoading,onClick:()=>at({isOpen:!1}),children:"Cancel"}),i.jsxs(te,{disabled:ve.isLoading,onClick:async()=>{var J,Y,ye,xe,je,Qe,I,K,W;if(!(!e||!ve.sectionId||!ve.itemId||!ve.content)){at(ie=>({...ie,isLoading:!0}));try{await jn.setModeratorPosition(e,ve.sectionId,ve.itemId);let ie=[],he=!1,ke=ve.content;const qe=ve.content?Lt(ve.content):null,Ft=!!qe;if(console.log("🔍 MANUAL POSITION DEBUG:",{itemType:ve.itemType,hasImageAttached:Ft,assetFilename:qe,content:ve.content,sectionTitle:ve.sectionTitle,itemTitle:ve.itemTitle,contentLength:(J=ve.content)==null?void 0:J.length}),Ft&&ve.content&&qe)if(console.log("🔍 ASSET EXTRACTION DEBUG:",{originalContent:ve.content,extractedFilename:qe,contentLength:ve.content.length}),qe){ie=[qe],he=!0,console.log("🎨 MANUAL POSITION: Creative review detected, will activate visual context for:",qe);try{console.log("🎨 MANUAL MODE: Requesting AI description for",qe);try{console.log("🔍 TESTING: Calling test endpoint first...");const fa=await He.post(`/focus-groups/${e}/test-endpoint`,{test:"data"});console.log("✅ TEST: Test endpoint response:",fa.data)}catch(fa){console.error("❌ TEST: Test endpoint failed:",fa)}const It=await St.describeAsset(e,qe);It.data.description&&(ke=ve.content.replace(`'${qe}'`,`'${qe}' - ${It.data.description}`),console.log("✅ MANUAL MODE: Enhanced question with AI description"),console.log("🔍 Original:",ve.content),console.log("🔍 Enhanced:",ke))}catch(It){console.error("⚠️ MANUAL MODE: Failed to generate AI description:",It),console.error("⚠️ Error response data:",(Y=It.response)==null?void 0:Y.data),console.error("⚠️ Error status:",(ye=It.response)==null?void 0:ye.status),console.error("⚠️ Error headers:",(xe=It.response)==null?void 0:xe.headers),console.error("⚠️ Full axios error:",{message:It.message,code:It.code,status:(je=It.response)==null?void 0:je.status,statusText:(Qe=It.response)==null?void 0:Qe.statusText,url:(I=It.config)==null?void 0:I.url,method:(K=It.config)==null?void 0:K.method}),Ke.warning("AI description failed",{description:"Using original question text. Image will still be available to participants."})}}else console.warn("⚠️ MANUAL POSITION: Creative review detected but no asset filename extracted from content");const Wt={id:`msg-${Date.now()}`,senderId:"moderator",text:ke,timestamp:new Date,type:"question"};try{const It=await St.sendMessage(e,{senderId:"moderator",text:ke,type:"question",attached_assets:ie,activates_visual_context:he});(W=It==null?void 0:It.data)!=null&&W.message_id&&(Wt.id=It.data.message_id)}catch(It){console.warn("Failed to save message to API, showing locally:",It)}ze(Wt),at({isOpen:!1}),setTimeout(async()=>{await X(),setTimeout(()=>X(),500)},200),Ke.success("Moderator position set",{description:`Position set to "${ve.itemTitle}" in "${ve.sectionTitle}"`})}catch(ie){console.error("Error setting moderator position:",ie),at(he=>({...he,isLoading:!1})),Ke.error("Failed to set moderator position",{description:"There was an error setting the moderator position."})}}},className:"flex items-center gap-2",children:[ve.isLoading&&i.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white"}),ve.isLoading?"Generating detailed image description...":"Confirm"]})]})]})}),i.jsx(wl,{open:D,onOpenChange:V,children:i.jsxs(ho,{children:[i.jsxs(po,{children:[i.jsx(go,{children:"AI Model Settings"}),i.jsx(jl,{children:"Choose which AI model to use for generating responses and discussion guides in this focus group."})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{className:"flex items-center space-x-2",children:[i.jsx(fo,{className:"h-4 w-4 text-slate-500"}),i.jsx("span",{className:"text-sm font-medium",children:"Current Model:"}),i.jsx(Wn,{variant:"secondary",children:(c==null?void 0:c.llm_model)==="gpt-4.1"?"GPT-4.1":"Gemini 2.5 Pro"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium",children:"Select AI Model:"}),i.jsxs(Mn,{value:T,onValueChange:J=>{console.log("🔧 Model selection changed:",{from:T,to:J}),F(J)},children:[i.jsx(Pn,{className:"mt-1",children:i.jsx(In,{placeholder:"Select AI model"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"gemini-2.5-pro",children:"Gemini 2.5 Pro"}),i.jsx(fe,{value:"gpt-4.1",children:"GPT-4.1"})]})]})]}),i.jsxs("div",{className:"text-xs text-slate-600",children:[i.jsxs("p",{children:[i.jsx("strong",{children:"Gemini 2.5 Pro:"})," Google's advanced model, great for creative and analytical tasks."]}),i.jsxs("p",{children:[i.jsx("strong",{children:"GPT-4.1:"})," OpenAI's latest model, excellent for conversational and reasoning tasks."]})]})]}),i.jsxs(mo,{children:[i.jsx(te,{variant:"outline",onClick:()=>V(!1),disabled:q,children:"Cancel"}),i.jsxs(te,{onClick:()=>{console.log("🔧 Update button clicked:",{selectedModel:T,currentModel:c==null?void 0:c.llm_model,isDisabled:q||T===(c==null?void 0:c.llm_model)}),Se(T)},disabled:q||T===(c==null?void 0:c.llm_model),children:[q&&i.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"}),q?"Updating...":"Update Model"]})]})]})}),i.jsx(q_e,{focusGroupId:e,personas:d,isVisible:y,onToggle:()=>b(!y)})]}):i.jsxs("div",{className:"min-h-screen bg-slate-50 pt-20 pb-16 px-4",children:[i.jsx(oi,{}),i.jsxs("div",{className:"max-w-7xl mx-auto text-center py-12",children:[i.jsx("h1",{className:"text-2xl font-bold",children:"Focus group not found"}),i.jsx("p",{className:"mt-2 text-slate-600",children:"We couldn't find the focus group you're looking for."}),i.jsxs(te,{onClick:()=>t("/focus-groups"),className:"mt-4",children:[i.jsx(zf,{className:"mr-2 h-4 w-4"})," Back to Focus Groups"]})]})]})},Q_e=({title:e,description:t})=>i.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center mb-8",children:[i.jsxs("div",{children:[i.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900",children:e}),i.jsx("p",{className:"text-slate-600 mt-1",children:t})]}),i.jsxs("div",{className:"mt-4 sm:mt-0 flex gap-2",children:[i.jsx(te,{variant:"outline",children:"Export Data"}),i.jsx(te,{children:"Generate Report"})]})]}),nb=({title:e,value:t,changePercentage:n,icon:r})=>i.jsx(rt,{className:"p-6 hover:shadow-md transition-shadow",children:i.jsxs("div",{className:"flex justify-between items-start",children:[i.jsxs("div",{children:[i.jsx("p",{className:"text-muted-foreground text-sm",children:e}),i.jsx("h3",{className:"text-2xl font-bold mt-1",children:t}),i.jsxs("p",{className:`${n>=0?"text-green-500":"text-red-500"} text-xs mt-1`,children:[n>=0?"↑":"↓"," ",Math.abs(n),"% from last month"]})]}),i.jsx("div",{className:"bg-primary/10 p-2 rounded-full",children:i.jsx(r,{className:"h-6 w-6 text-primary"})})]})}),J_e=[{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}],ePe=[{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"}],tPe=()=>i.jsxs("div",{className:"space-y-6",children:[i.jsxs(rt,{className:"p-6",children:[i.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Research Activity"}),i.jsx("div",{className:"h-64",children:i.jsx(yo,{width:"100%",height:"100%",children:i.jsxs(lB,{data:J_e,margin:{top:10,right:30,left:0,bottom:0},children:[i.jsx(Vh,{strokeDasharray:"3 3"}),i.jsx(ko,{dataKey:"name"}),i.jsx(To,{}),i.jsx(mr,{}),i.jsx(ta,{type:"monotone",dataKey:"users",stackId:"1",stroke:"#8884d8",fill:"#8884d8",name:"Synthetic Users"}),i.jsx(ta,{type:"monotone",dataKey:"groups",stackId:"2",stroke:"#82ca9d",fill:"#82ca9d",name:"Focus Groups"}),i.jsx(ta,{type:"monotone",dataKey:"interactions",stackId:"3",stroke:"#ffc658",fill:"#ffc658",name:"Interactions"})]})})})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs(rt,{className:"p-6",children:[i.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Recent AI Insights"}),i.jsxs("div",{className:"space-y-4",children:[ePe.slice(0,3).map(e=>i.jsx("div",{className:"border-b pb-4 last:border-b-0 last:pb-0",children:i.jsxs("div",{className:"flex items-start",children:[i.jsx("div",{className:`p-2 rounded-full mr-3 ${e.sentiment==="positive"?"bg-green-100":e.sentiment==="negative"?"bg-red-100":"bg-slate-100"}`,children:i.jsx(kl,{className:`h-4 w-4 ${e.sentiment==="positive"?"text-green-600":e.sentiment==="negative"?"text-red-600":"text-slate-600"}`})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium",children:e.title}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:e.description}),i.jsxs("div",{className:"flex items-center text-xs text-muted-foreground mt-2",children:[i.jsx("span",{children:e.source}),i.jsx("span",{className:"mx-2",children:"•"}),i.jsx("span",{children:e.date})]})]})]})},e.id)),i.jsx(te,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"View All Insights"})]})]}),i.jsxs(rt,{className:"p-6",children:[i.jsx("h3",{className:"font-sf text-lg font-semibold mb-4",children:"Upcoming Research Tasks"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{className:"flex items-start",children:[i.jsx("div",{className:"bg-blue-100 p-2 rounded-full mr-3",children:i.jsx(qp,{className:"h-4 w-4 text-blue-600"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium",children:"Website Redesign Feedback"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Focus group scheduled for Jun 20"})]})]}),i.jsxs("div",{className:"flex items-start",children:[i.jsx("div",{className:"bg-purple-100 p-2 rounded-full mr-3",children:i.jsx(qp,{className:"h-4 w-4 text-purple-600"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium",children:"Mobile App User Testing"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"8 participants needed by Jun 25"})]})]}),i.jsxs("div",{className:"flex items-start",children:[i.jsx("div",{className:"bg-amber-100 p-2 rounded-full mr-3",children:i.jsx(qp,{className:"h-4 w-4 text-amber-600"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium",children:"Pricing Strategy Evaluation"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Create discussion guide by Jun 22"})]})]}),i.jsxs("div",{className:"flex items-start",children:[i.jsx("div",{className:"bg-green-100 p-2 rounded-full mr-3",children:i.jsx(qp,{className:"h-4 w-4 text-green-600"})}),i.jsxs("div",{children:[i.jsx("h4",{className:"text-sm font-medium",children:"Product Onboarding Flow"}),i.jsx("p",{className:"text-xs text-muted-foreground",children:"Results analysis due Jun 30"})]})]}),i.jsx(te,{variant:"ghost",className:"w-full text-sm",size:"sm",children:"Manage Research Calendar"})]})]})]})]}),nPe=[{name:"18-24",value:15},{name:"25-34",value:35},{name:"35-44",value:25},{name:"45-54",value:15},{name:"55+",value:10}],rPe=()=>i.jsxs(rt,{className:"p-6",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Synthetic Persona Analytics"}),i.jsx(te,{variant:"outline",size:"sm",children:"View Demographics"})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Demographics"}),i.jsx("div",{className:"h-60",children:i.jsx(yo,{width:"100%",height:"100%",children:i.jsxs(q_,{children:[i.jsx(mr,{}),i.jsx(da,{data:nPe,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,fill:"#FFDEE2",label:!0})]})})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Persona Distribution"}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[i.jsx("span",{children:"Age: 25-34"}),i.jsx("span",{children:"35%"})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-pink-400 rounded-full",style:{width:"35%"}})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[i.jsx("span",{children:"Tech Savvy"}),i.jsx("span",{children:"72%"})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-pink-300 rounded-full",style:{width:"72%"}})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[i.jsx("span",{children:"Brand Loyal"}),i.jsx("span",{children:"58%"})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-pink-500 rounded-full",style:{width:"58%"}})})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[i.jsx("span",{children:"Price Sensitive"}),i.jsx("span",{children:"67%"})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-pink-200 rounded-full",style:{width:"67%"}})})]})]})]})]}),i.jsx("div",{className:"flex justify-center mt-6",children:i.jsx(te,{onClick:()=>window.location.href="/synthetic-users",children:"Manage Synthetic Personas"})})]}),sPe=[{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}],Tk=[{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"}],aPe=[{name:"Navigation",count:42},{name:"Performance",count:28},{name:"UX Design",count:36},{name:"Features",count:22},{name:"Onboarding",count:18}],iPe=()=>{const e=Tn();return i.jsxs(rt,{className:"p-6",children:[i.jsxs("div",{className:"flex justify-between items-center mb-4",children:[i.jsx("h3",{className:"font-sf text-lg font-semibold",children:"Focus Group Insights"}),i.jsx(te,{variant:"outline",size:"sm",onClick:()=>e("/focus-groups"),children:"View All Sessions"})]}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6 mb-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Session Analytics"}),i.jsx("div",{className:"h-60",children:i.jsx(yo,{width:"100%",height:"100%",children:i.jsxs(lB,{data:sPe,margin:{top:10,right:30,left:0,bottom:0},children:[i.jsx(Vh,{strokeDasharray:"3 3"}),i.jsx(ko,{dataKey:"name"}),i.jsx(To,{}),i.jsx(mr,{}),i.jsx(ta,{type:"monotone",dataKey:"interactions",stroke:"#8884d8",fill:"#8884d8",name:"User Interactions"})]})})})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("p",{className:"text-sm text-muted-foreground",children:"Feedback Sentiment"}),i.jsx("div",{className:"h-60",children:i.jsx(yo,{width:"100%",height:"100%",children:i.jsxs(q_,{children:[i.jsx(mr,{}),i.jsx(da,{data:Tk,dataKey:"value",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:t,percent:n})=>`${t} ${(n*100).toFixed(0)}%`,children:Tk.map((t,n)=>i.jsx(vp,{fill:t.color},`cell-${n}`))}),i.jsx(ci,{})]})})})]})]}),i.jsxs("div",{className:"mb-6",children:[i.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Topic Frequency Analysis"}),i.jsx("div",{className:"h-60",children:i.jsx(yo,{width:"100%",height:"100%",children:i.jsxs(oB,{data:aPe,margin:{top:5,right:30,left:20,bottom:5},children:[i.jsx(Vh,{strokeDasharray:"3 3"}),i.jsx(ko,{dataKey:"name"}),i.jsx(To,{}),i.jsx(mr,{}),i.jsx(ci,{}),i.jsx(Wo,{dataKey:"count",name:"Mentions",fill:"#8884d8"})]})})})]}),i.jsx("div",{className:"flex justify-center",children:i.jsx(te,{onClick:()=>e("/focus-groups"),children:"Manage Focus Groups"})})]})},oPe=()=>{const[e,t]=v.useState("overview");return i.jsxs("div",{className:"min-h-screen bg-slate-50",children:[i.jsx(oi,{}),i.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[i.jsx(Q_e,{title:"Dashboard",description:"Monitor and analyze your research insights"}),i.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 mb-8",children:[i.jsx(nb,{title:"Total Synthetic Users",value:48,changePercentage:12,icon:or}),i.jsx(nb,{title:"Active Focus Groups",value:7,changePercentage:5,icon:$a}),i.jsx(nb,{title:"Research Insights",value:124,changePercentage:18,icon:Ml})]}),i.jsxs(Fo,{value:e,onValueChange:t,className:"glass-panel rounded-xl p-6",children:[i.jsxs(Pi,{className:"grid w-full grid-cols-3 mb-6",children:[i.jsx(Xt,{value:"overview",children:"Overview"}),i.jsx(Xt,{value:"users",children:"Synthetic Users"}),i.jsx(Xt,{value:"focus-groups",children:"Focus Groups"})]}),i.jsx(Yt,{value:"overview",children:i.jsx(tPe,{})}),i.jsx(Yt,{value:"users",children:i.jsx(rPe,{})}),i.jsx(Yt,{value:"focus-groups",children:i.jsx(iPe,{})})]})]})]})};function lPe({persona:e}){const t=e.id==="0",n=e.id==="1";return i.jsxs(rt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsx("div",{className:"h-16 w-16 rounded-full bg-muted flex items-center justify-center",children:i.jsx("img",{src:lp(e),alt:e.name,className:"h-16 w-16 rounded-full object-cover"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"font-sf text-xl font-semibold",children:e.name}),i.jsx("p",{className:"text-muted-foreground",children:e.occupation})]})]}),i.jsxs("div",{className:"mt-6 space-y-4",children:[i.jsxs("div",{className:"sidebar-section",children:[i.jsx(or,{className:"sidebar-icon"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-medium text-sm",children:"Demographics"}),i.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[e.age," ",e.gender?i.jsxs(i.Fragment,{children:["• ",e.gender]}):null,e.ethnicity?i.jsxs(i.Fragment,{children:[" • ",e.ethnicity]}):null]}),e.education&&i.jsx("p",{className:"sidebar-sub-item",children:e.education}),e.socialGrade&&i.jsxs("p",{className:"sidebar-sub-item",children:["Social Grade: ",e.socialGrade]}),e.householdIncome&&i.jsxs("p",{className:"sidebar-sub-item",children:["Household Income: ",e.householdIncome]}),e.householdComposition&&i.jsxs("p",{className:"sidebar-sub-item",children:["Household: ",e.householdComposition]})]})]}),i.jsxs("div",{className:"sidebar-section",children:[i.jsx(SW,{className:"sidebar-icon"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-medium text-sm",children:"Location"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.location}),e.livingSituation&&i.jsx("p",{className:"sidebar-sub-item",children:e.livingSituation})]})]}),e.interests&&i.jsxs("div",{className:"sidebar-section",children:[i.jsx(fw,{className:"sidebar-icon"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-medium text-sm",children:"Interests"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.interests})]})]}),e.mediaConsumption&&i.jsxs("div",{className:"sidebar-section",children:[i.jsx(d0,{className:"sidebar-icon"}),i.jsxs("div",{children:[i.jsx("h3",{className:"font-medium text-sm",children:"Media"}),i.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.mediaConsumption})]})]}),i.jsxs("div",{className:"pt-4 border-t",children:[i.jsx("h3",{className:"font-medium text-sm mb-3",children:"Digital Behavior"}),i.jsxs("div",{className:"space-y-3",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[i.jsx("span",{children:"Tech Savviness"}),i.jsxs("span",{children:[e.techSavviness,"%"]})]}),i.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${e.techSavviness}%`}})})]}),e.brandLoyalty!==void 0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[i.jsx("span",{children:"Brand Loyalty"}),i.jsxs("span",{children:[e.brandLoyalty,"%"]})]}),i.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${e.brandLoyalty}%`}})})]}),e.priceConsciousness!==void 0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[i.jsx("span",{children:"Price Sensitivity"}),i.jsxs("span",{children:[e.priceConsciousness,"%"]})]}),i.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${e.priceConsciousness}%`}})})]}),e.environmentalConcern!==void 0&&i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-xs mb-1",children:[i.jsx("span",{children:"Environmental Concern"}),i.jsxs("span",{children:[e.environmentalConcern,"%"]})]}),i.jsx("div",{className:"h-1.5 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${e.environmentalConcern}%`}})})]}),e.deviceUsage&&i.jsxs("div",{children:[i.jsx("h4",{className:"text-xs font-medium mt-3",children:"Device Usage"}),i.jsx("p",{className:"sidebar-sub-item text-xs",children:e.deviceUsage})]}),e.shoppingHabits&&i.jsxs("div",{children:[i.jsx("h4",{className:"text-xs font-medium mt-3",children:"Shopping Habits"}),i.jsx("p",{className:"sidebar-sub-item text-xs",children:e.shoppingHabits})]})]})]}),i.jsxs("div",{className:"pt-4 border-t",children:[i.jsx("h3",{className:"font-medium text-sm mb-3",children:"Additional Information"}),i.jsxs("div",{className:"space-y-2",children:[e.brandPreferences&&i.jsxs("div",{className:"sidebar-section",children:[i.jsx(fw,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:e.brandPreferences})]}),e.communicationPreferences&&i.jsxs("div",{className:"sidebar-section",children:[i.jsx(fg,{className:"sidebar-icon"}),i.jsxs("span",{className:"text-muted-foreground text-sm",children:["Prefers: ",e.communicationPreferences]})]}),e.deviceUsage&&i.jsxs("div",{className:"sidebar-section",children:[i.jsx(_W,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:e.deviceUsage})]}),e.shoppingHabits&&i.jsxs("div",{className:"sidebar-section",children:[i.jsx(EW,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:e.shoppingHabits})]}),e.additionalInformation&&typeof e.additionalInformation=="string"&&i.jsxs("div",{className:"sidebar-section",children:[i.jsx(xW,{className:"sidebar-icon"}),i.jsx("div",{className:"sidebar-sub-item",children:e.additionalInformation.split(` +`).map((r,s)=>i.jsx("div",{className:"mb-1",children:r.trim().startsWith("•")||r.trim().startsWith("-")?r.trim():`• ${r.trim()}`},s))})]}),t&&i.jsxs("div",{className:"pt-2 space-y-2",children:[i.jsxs("div",{className:"sidebar-section",children:[i.jsx(IA,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Maintains an extensive network of financial and luxury industry contacts"})]}),i.jsxs("div",{className:"sidebar-section",children:[i.jsx(hw,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Owns vacation properties in the Cotswolds and South of France"})]}),i.jsxs("div",{className:"sidebar-section",children:[i.jsx(d0,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Collector of rare first-edition books and limited-edition art prints"})]}),i.jsxs("div",{className:"sidebar-section",children:[i.jsx(RA,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Significant investment portfolio with focus on sustainable luxury ventures"})]})]}),n&&i.jsxs("div",{className:"pt-2 space-y-2",children:[i.jsxs("div",{className:"sidebar-section",children:[i.jsx(d0,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Active in industry panels, luxury brand collaborations, follows influencers in luxury & design"})]}),i.jsxs("div",{className:"sidebar-section",children:[i.jsx(hw,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Modern flat in exclusive Chelsea, accessible to boutique services"})]}),i.jsxs("div",{className:"sidebar-section",children:[i.jsx(RA,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Uses premium digital payment & secure banking for HNWIs"})]}),i.jsxs("div",{className:"sidebar-section",children:[i.jsx(IA,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Respected network in London's luxury sector; attends exclusive events"})]}),i.jsxs("div",{className:"sidebar-section",children:[i.jsx(fg,{className:"sidebar-icon"}),i.jsx("span",{className:"text-muted-foreground text-sm",children:"Seeks autonomy, bespoke service, and acknowledgment for taste"})]})]})]})]})]})]})}function cPe({persona:e}){var t,n,r,s,a,o,l,c,u;return i.jsxs("div",{className:"space-y-6",children:[i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx(Pm,{className:"h-5 w-5 text-primary mr-2"}),i.jsx("h3",{className:"font-sf text-lg font-medium",children:"Goals"})]}),i.jsx("ul",{className:"space-y-2",children:(t=e.goals)==null?void 0:t.map((d,f)=>i.jsxs("li",{className:"flex items-start",children:[i.jsx("div",{className:"h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center mt-0.5 mr-3",children:i.jsx("span",{className:"text-xs text-primary font-medium",children:f+1})}),i.jsx("p",{className:"text-sm",children:d})]},f))})]})}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx(lI,{className:"h-5 w-5 text-amber-500 mr-2"}),i.jsx("h3",{className:"font-sf text-lg font-medium",children:"Frustrations"})]}),i.jsx("ul",{className:"space-y-2",children:(n=e.frustrations)==null?void 0:n.map((d,f)=>i.jsxs("li",{className:"text-sm flex items-start",children:[i.jsx("span",{className:"text-amber-500 mr-2",children:"•"}),i.jsx("span",{children:d})]},f))})]})}),i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center mb-4",children:[i.jsx(Za,{className:"h-5 w-5 text-green-500 mr-2"}),i.jsx("h3",{className:"font-sf text-lg font-medium",children:"Motivations"})]}),i.jsx("ul",{className:"space-y-2",children:(r=e.motivations)==null?void 0:r.map((d,f)=>i.jsxs("li",{className:"text-sm flex items-start",children:[i.jsx("span",{className:"text-green-500 mr-2",children:"•"}),i.jsx("span",{children:d})]},f))})]})})]}),i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"Think, Feel, Do"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center mb-3",children:[i.jsx(kl,{className:"h-5 w-5 text-blue-500 mr-2"}),i.jsx("h4",{className:"font-medium text-sm",children:"Thinks"})]}),i.jsx("ul",{className:"space-y-2",children:(a=(s=e.thinkFeelDo)==null?void 0:s.thinks)==null?void 0:a.map((d,f)=>i.jsxs("li",{className:"text-sm bg-blue-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center mb-3",children:[i.jsx(fw,{className:"h-5 w-5 text-red-500 mr-2"}),i.jsx("h4",{className:"font-medium text-sm",children:"Feels"})]}),i.jsx("ul",{className:"space-y-2",children:(l=(o=e.thinkFeelDo)==null?void 0:o.feels)==null?void 0:l.map((d,f)=>i.jsxs("li",{className:"text-sm bg-red-50 p-2 rounded-md",children:['"',d,'"']},f))})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex items-center mb-3",children:[i.jsx(Za,{className:"h-5 w-5 text-green-500 mr-2"}),i.jsx("h4",{className:"font-medium text-sm",children:"Does"})]}),i.jsx("ul",{className:"space-y-2",children:(u=(c=e.thinkFeelDo)==null?void 0:c.does)==null?void 0:u.map((d,f)=>i.jsxs("li",{className:"text-sm bg-green-50 p-2 rounded-md",children:['"',d,'"']},f))})]})]})]})})]})}function uPe({persona:e}){var n,r,s,a,o;const t=[{trait:"Openness",value:((n=e.oceanTraits)==null?void 0:n.openness)||50},{trait:"Conscientiousness",value:((r=e.oceanTraits)==null?void 0:r.conscientiousness)||50},{trait:"Extraversion",value:((s=e.oceanTraits)==null?void 0:s.extraversion)||50},{trait:"Agreeableness",value:((a=e.oceanTraits)==null?void 0:a.agreeableness)||50},{trait:"Neuroticism",value:((o=e.oceanTraits)==null?void 0:o.neuroticism)||50}];return i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:"OCEAN Personality Traits"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsx("div",{className:"h-80",children:i.jsx(yo,{width:"100%",height:"100%",children:i.jsxs(H_e,{outerRadius:90,data:t,children:[i.jsx(r6,{}),i.jsx(gd,{dataKey:"trait"}),i.jsx(md,{domain:[0,100]}),i.jsx(Sp,{name:"Personality",dataKey:"value",stroke:"#8884d8",fill:"#8884d8",fillOpacity:.5})]})})}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[i.jsx("span",{children:"Openness to Experience"}),i.jsxs("span",{className:"font-medium",children:[t[0].value,"%"]})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-purple-500 rounded-full",style:{width:`${t[0].value}%`}})}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[0].value>75?"Highly creative and curious":t[0].value>50?"Somewhat imaginative and open to new ideas":"Practical and prefers routine"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[i.jsx("span",{children:"Conscientiousness"}),i.jsxs("span",{className:"font-medium",children:[t[1].value,"%"]})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-blue-500 rounded-full",style:{width:`${t[1].value}%`}})}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[1].value>75?"Highly organized and responsible":t[1].value>50?"Generally reliable and hardworking":"Spontaneous and flexible"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[i.jsx("span",{children:"Extraversion"}),i.jsxs("span",{className:"font-medium",children:[t[2].value,"%"]})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-green-500 rounded-full",style:{width:`${t[2].value}%`}})}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[2].value>75?"Highly sociable and outgoing":t[2].value>50?"Moderately social and talkative":"Reserved and reflective"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[i.jsx("span",{children:"Agreeableness"}),i.jsxs("span",{className:"font-medium",children:[t[3].value,"%"]})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-amber-500 rounded-full",style:{width:`${t[3].value}%`}})}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[3].value>75?"Highly cooperative and compassionate":t[3].value>50?"Generally kind and helpful":"Competitive and challenging"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between text-sm mb-1",children:[i.jsx("span",{children:"Neuroticism"}),i.jsxs("span",{className:"font-medium",children:[t[4].value,"%"]})]}),i.jsx("div",{className:"h-2 bg-slate-100 rounded-full overflow-hidden",children:i.jsx("div",{className:"h-full bg-red-500 rounded-full",style:{width:`${t[4].value}%`}})}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:t[4].value>75?"Highly sensitive and prone to stress":t[4].value>50?"Moderately reactive to challenges":"Emotionally stable and resilient"})]})]})]})]})})}function dPe({persona:e}){var r;const t=(s,a)=>{const o=[i.jsx(wW,{className:"sidebar-icon"},"grid"),i.jsx(OW,{className:"sidebar-icon"},"smartphone"),i.jsx(bW,{className:"sidebar-icon"},"laptop"),i.jsx(yW,{className:"sidebar-icon"},"grid2x2")];return o[a%o.length]},n=()=>e.scenarioType?e.scenarioType:"Life Scenarios";return i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-sf text-lg font-medium mb-4",children:n()}),i.jsx("div",{className:"space-y-4",children:(r=e.scenarios)==null?void 0:r.map((s,a)=>i.jsx("div",{className:"bg-slate-50 p-4 rounded-lg border",children:i.jsxs("div",{className:"sidebar-section",children:[t(s,a),i.jsxs("div",{children:[i.jsxs("h4",{className:"font-medium text-sm mb-2",children:["Scenario ",a+1]}),i.jsx("p",{className:"text-sm",children:s})]})]})},a))})]})})}function fPe(){const e=Tn();return i.jsx("div",{className:"min-h-screen bg-slate-50 flex items-center justify-center",children:i.jsxs(rt,{className:"w-96 text-center p-6",children:[i.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Persona Not Found"}),i.jsx("p",{className:"text-muted-foreground mb-6",children:"The persona you're looking for couldn't be found."}),i.jsx(te,{onClick:()=>e("/synthetic-users"),children:"Return to Personas"})]})})}function Ct({className:e,...t}){return i.jsx("div",{className:Me("animate-pulse rounded-md bg-muted",e),...t})}function hPe(){return i.jsxs("div",{className:"min-h-screen bg-slate-50",children:[i.jsx(oi,{}),i.jsxs("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:[i.jsxs("div",{className:"flex items-center mb-6 relative",children:[i.jsx(Ct,{className:"absolute left-0 top-0 h-10 w-20"}),i.jsx(Ct,{className:"h-8 w-48 mx-auto"}),i.jsx(Ct,{className:"absolute right-0 top-0 h-10 w-32"})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[i.jsx("div",{className:"lg:col-span-1",children:i.jsxs(rt,{className:"p-6",children:[i.jsxs("div",{className:"flex items-center space-x-4",children:[i.jsx(Ct,{className:"h-16 w-16 rounded-full"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(Ct,{className:"h-6 w-32 mb-2"}),i.jsx(Ct,{className:"h-4 w-24"})]})]}),i.jsxs("div",{className:"mt-6 space-y-4",children:[i.jsxs("div",{className:"flex items-start",children:[i.jsx(Ct,{className:"h-5 w-5 mr-3 mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(Ct,{className:"h-4 w-20 mb-2"}),i.jsx(Ct,{className:"h-3 w-40 mb-1"}),i.jsx(Ct,{className:"h-3 w-36"})]})]}),i.jsxs("div",{className:"flex items-start",children:[i.jsx(Ct,{className:"h-5 w-5 mr-3 mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(Ct,{className:"h-4 w-16 mb-2"}),i.jsx(Ct,{className:"h-3 w-32"})]})]}),i.jsxs("div",{className:"flex items-start",children:[i.jsx(Ct,{className:"h-5 w-5 mr-3 mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(Ct,{className:"h-4 w-16 mb-2"}),i.jsx(Ct,{className:"h-3 w-full"})]})]}),i.jsxs("div",{className:"flex items-start",children:[i.jsx(Ct,{className:"h-5 w-5 mr-3 mt-0.5"}),i.jsxs("div",{className:"flex-1",children:[i.jsx(Ct,{className:"h-4 w-12 mb-2"}),i.jsx(Ct,{className:"h-3 w-full"})]})]}),i.jsxs("div",{className:"pt-4 border-t",children:[i.jsx(Ct,{className:"h-4 w-32 mb-3"}),i.jsx("div",{className:"space-y-3",children:[...Array(4)].map((e,t)=>i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx(Ct,{className:"h-3 w-24"}),i.jsx(Ct,{className:"h-3 w-8"})]}),i.jsx(Ct,{className:"h-1.5 w-full rounded-full"})]},t))})]}),i.jsxs("div",{className:"pt-4 border-t",children:[i.jsx(Ct,{className:"h-4 w-36 mb-3"}),i.jsx("div",{className:"space-y-2",children:[...Array(3)].map((e,t)=>i.jsxs("div",{className:"flex items-center",children:[i.jsx(Ct,{className:"h-4 w-4 mr-2"}),i.jsx(Ct,{className:"h-3 w-40"})]},t))})]})]})]})}),i.jsxs("div",{className:"lg:col-span-2",children:[i.jsxs("div",{className:"grid w-full grid-cols-3 gap-2 mb-6",children:[i.jsx(Ct,{className:"h-10 w-full"}),i.jsx(Ct,{className:"h-10 w-full"}),i.jsx(Ct,{className:"h-10 w-full"})]}),i.jsx(rt,{className:"p-6",children:i.jsxs("div",{className:"space-y-4",children:[i.jsx(Ct,{className:"h-6 w-48"}),i.jsx(Ct,{className:"h-4 w-full"}),i.jsx(Ct,{className:"h-4 w-full"}),i.jsx(Ct,{className:"h-4 w-3/4"}),i.jsxs("div",{className:"mt-8 space-y-4",children:[i.jsx(Ct,{className:"h-6 w-32"}),i.jsx(Ct,{className:"h-4 w-full"}),i.jsx(Ct,{className:"h-4 w-full"}),i.jsx(Ct,{className:"h-4 w-2/3"})]}),i.jsxs("div",{className:"mt-8 space-y-4",children:[i.jsx(Ct,{className:"h-6 w-40"}),i.jsx(Ct,{className:"h-4 w-full"}),i.jsx(Ct,{className:"h-4 w-full"}),i.jsx(Ct,{className:"h-4 w-5/6"})]})]})})]})]})]})]})}function pPe({message:e,onLoginSuccess:t,onCancel:n}){const{login:r}=Kl(),s=Tn(),[a,o]=v.useState("user"),[l,c]=v.useState("pass"),[u,d]=v.useState(!1),f=async()=>{if(!a||!l){oe.error("Please enter username and password");return}d(!0);try{await r(a,l),oe.success("Login successful"),t&&t()}catch(p){console.error("Login error:",p),oe.error("Login failed",{description:"Please check your credentials and try again"})}finally{d(!1)}},h=()=>{n?n():s("/synthetic-users")};return i.jsxs(rt,{className:"max-w-md mx-auto shadow-lg",children:[i.jsxs(Dr,{children:[i.jsx(ts,{children:"Login Required"}),i.jsx(nN,{children:e||"You need to log in to save personas to the database"})]}),i.jsxs(bt,{className:"space-y-4",children:[i.jsxs("div",{className:"space-y-2",children:[i.jsx(vs,{htmlFor:"username",children:"Username"}),i.jsx(Ot,{id:"username",placeholder:"Username",value:a,onChange:p=>o(p.target.value),disabled:u})]}),i.jsxs("div",{className:"space-y-2",children:[i.jsx(vs,{htmlFor:"password",children:"Password"}),i.jsx(Ot,{id:"password",type:"password",placeholder:"Password",value:l,onChange:p=>c(p.target.value),disabled:u})]}),i.jsx("div",{className:"text-sm text-muted-foreground",children:"Default credentials: user / pass"})]}),i.jsxs(rN,{className:"flex justify-between",children:[i.jsx(te,{variant:"outline",onClick:h,disabled:u,children:"Cancel"}),i.jsx(te,{onClick:f,disabled:u,children:u?i.jsxs(i.Fragment,{children:[i.jsx(ii,{className:"h-4 w-4 mr-2 animate-spin"}),"Logging in..."]}):"Login"})]})]})}function mPe({persona:e,onSave:t,onCancel:n}){var P,k,O,M,A,$,L,H,D,V,T,F,q,Z,re,ge;const r={...e,education:e.education||"",interests:e.interests||"",brandLoyalty:e.brandLoyalty||0,priceConsciousness:e.priceConsciousness||0,environmentalConcern:e.environmentalConcern||0,hasPurchasingPower:e.hasPurchasingPower||!1,hasChildren:e.hasChildren||!1,goals:e.goals||[],frustrations:e.frustrations||[],motivations:e.motivations||[],scenarios:e.scenarios||[],oceanTraits:e.oceanTraits||{openness:50,conscientiousness:50,extraversion:50,agreeableness:50,neuroticism:50},thinkFeelDo:e.thinkFeelDo||{thinks:[],feels:[],does:[]}},[s,a]=v.useState(r),[o,l]=v.useState(!1),[c,u]=v.useState(!1),[d,f]=v.useState(null);v.useState(!1);const{isAuthenticated:h,token:p}=Kl();v.useEffect(()=>{(async()=>{c&&h&&p&&(u(!1),d&&await _())})()},[h,p,c]);const g=(B,le)=>{a(se=>({...se,[B]:le}))},m=(B,le)=>{a(se=>({...se,oceanTraits:{...se.oceanTraits,[B]:le}}))},y=B=>{a(le=>({...le,[B]:[...le[B]||[],""]}))},b=(B,le,se)=>{a(ce=>{const De=[...ce[B]||[]];return De[le]=se,{...ce,[B]:De}})},x=(B,le)=>{a(se=>{const ce=[...se[B]||[]];return ce.splice(le,1),{...se,[B]:ce}})},w=(B,le,se)=>{a(ce=>{const De={...ce.thinkFeelDo},de=[...De[B]||[]];return de[le]=se,De[B]=de,{...ce,thinkFeelDo:De}})},j=B=>{a(le=>{var ce;const se={...le.thinkFeelDo,[B]:[...((ce=le.thinkFeelDo)==null?void 0:ce[B])||[],""]};return{...le,thinkFeelDo:se}})},S=(B,le)=>{a(se=>{const ce={...se.thinkFeelDo},De=[...ce[B]||[]];return De.splice(le,1),ce[B]=De,{...se,thinkFeelDo:ce}})},N=()=>{d&&(oe.error("Login canceled - Persona changes not saved"),u(!1),f(null),n())},_=async()=>{if(d){l(!0);try{const B={...d};delete B._id,delete B.isDbPersona;const le=await Dn.create(B),se={...d,id:le.data._id||le.data.id,_id:le.data._id||le.data.id,isDbPersona:!0};oe.success("Persona saved to database successfully"),u(!1),f(null),t(se)}catch(B){console.error("Error saving after login:",B),oe.error("Failed to save to database after login"),u(!1),f(null)}finally{l(!1)}}};return c?i.jsxs("div",{className:"max-w-5xl mx-auto bg-background p-6",children:[i.jsx("div",{className:"flex justify-between items-center mb-6",children:i.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Authentication Required"})}),i.jsx("p",{className:"mb-6 text-muted-foreground",children:"Login is required to save personas to the database. You can either:"}),i.jsxs("ul",{className:"list-disc ml-6 mt-2 mb-6",children:[i.jsx("li",{children:"Log in to save this persona to the database"}),i.jsx("li",{children:"Cancel to discard your changes"})]}),i.jsx(pPe,{message:"Login is required to save your persona to the database",onLoginSuccess:_,onCancel:N})]}):i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsxs("div",{className:"flex items-center",children:[i.jsx(te,{variant:"ghost",onClick:n,className:"mr-2",children:i.jsx(zf,{className:"h-5 w-5"})}),i.jsx("h2",{className:"font-sf text-2xl font-bold",children:"Edit Persona"})]}),i.jsxs(te,{onClick:async()=>{l(!0);try{const B=s._id||s.id,le={...s};le._id&&delete le._id,delete le.isDbPersona;let se;if(B&&typeof B=="string"&&B.startsWith("local-")){console.log("Creating new persona instead of updating local ID"),se=await Dn.create(le),oe.success("Persona saved to database");const ce={...s,id:se.data._id||se.data.id,_id:se.data._id||se.data.id,isDbPersona:!0};t(ce)}else if(B){se=await Dn.update(B,le),oe.success("Persona updated successfully");const ce={...s,isDbPersona:!0};t(ce)}else{se=await Dn.create(le);const ce={...s,id:se.data._id||se.data.id,_id:se.data._id||se.data.id,isDbPersona:!0};oe.success("Persona created successfully"),t(ce)}}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"),oe.error("Authentication error - saving locally instead"),t(s)):(f(s),u(!0)):(oe.error("Failed to save persona"),t(s))}finally{l(!1)}},disabled:o,children:[o?i.jsx(ii,{className:"h-4 w-4 mr-2 animate-spin"}):i.jsx(RS,{className:"h-4 w-4 mr-2"}),o?"Saving...":"Save Changes"]})]}),i.jsxs(Fo,{defaultValue:"basic",children:[i.jsxs(Pi,{className:"grid w-full grid-cols-6",children:[i.jsx(Xt,{value:"basic",children:"Basic"}),i.jsx(Xt,{value:"cooper",children:"Cooper"}),i.jsx(Xt,{value:"personality",children:"Personality"}),i.jsx(Xt,{value:"demographics",children:"Demographics"}),i.jsx(Xt,{value:"lifestyle",children:"Lifestyle"}),i.jsx(Xt,{value:"extended",children:"Extended"})]}),i.jsx(Yt,{value:"basic",className:"mt-6",children:i.jsx(rt,{children:i.jsx(bt,{className:"p-6",children:i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Name"}),i.jsx(Ot,{value:s.name||"",onChange:B=>g("name",B.target.value)})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Age Range"}),i.jsxs(Mn,{value:s.age||"",onValueChange:B=>g("age",B),children:[i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select age range"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"18-24",children:"18-24"}),i.jsx(fe,{value:"25-34",children:"25-34"}),i.jsx(fe,{value:"35-44",children:"35-44"}),i.jsx(fe,{value:"45-54",children:"45-54"}),i.jsx(fe,{value:"55-64",children:"55-64"}),i.jsx(fe,{value:"65+",children:"65+"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Gender"}),i.jsxs(Mn,{value:s.gender||"",onValueChange:B=>g("gender",B),children:[i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select gender"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"Male",children:"Male"}),i.jsx(fe,{value:"Female",children:"Female"}),i.jsx(fe,{value:"Non-binary",children:"Non-binary"}),i.jsx(fe,{value:"Other",children:"Other"})]})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Occupation"}),i.jsx(Ot,{value:s.occupation||"",onChange:B=>g("occupation",B.target.value)})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Education"}),i.jsxs(Mn,{value:s.education||"",onValueChange:B=>g("education",B),children:[i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select education level"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"High School",children:"High School"}),i.jsx(fe,{value:"Some College",children:"Some College"}),i.jsx(fe,{value:"Associate's Degree",children:"Associate's Degree"}),i.jsx(fe,{value:"Bachelor's Degree",children:"Bachelor's Degree"}),i.jsx(fe,{value:"Master's Degree",children:"Master's Degree"}),i.jsx(fe,{value:"PhD",children:"PhD"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Location"}),i.jsx(Ot,{value:s.location||"",onChange:B=>g("location",B.target.value)})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Ethnicity (Optional)"}),i.jsxs(Mn,{value:s.ethnicity||"",onValueChange:B=>g("ethnicity",B),children:[i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select ethnicity"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"white",children:"White"}),i.jsx(fe,{value:"black",children:"Black"}),i.jsx(fe,{value:"asian",children:"Asian"}),i.jsx(fe,{value:"hispanic",children:"Hispanic/Latino"}),i.jsx(fe,{value:"native-american",children:"Native American"}),i.jsx(fe,{value:"middle-eastern",children:"Middle Eastern"}),i.jsx(fe,{value:"mixed",children:"Mixed"}),i.jsx(fe,{value:"other",children:"Other"}),i.jsx(fe,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personality"}),i.jsx(nt,{value:s.personality||"",onChange:B=>g("personality",B.target.value),rows:3})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Interests"}),i.jsx(nt,{value:s.interests||"",onChange:B=>g("interests",B.target.value),rows:3,placeholder:"Tech, travel, cooking, etc."})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Tech Savviness"}),i.jsxs("span",{className:"text-sm",children:[s.techSavviness,"%"]})]}),i.jsx(Un,{value:[s.techSavviness],onValueChange:B=>g("techSavviness",B[0]),max:100,step:1})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Brand Loyalty"}),i.jsxs("span",{className:"text-sm",children:[s.brandLoyalty||0,"%"]})]}),i.jsx(Un,{value:[s.brandLoyalty||0],onValueChange:B=>g("brandLoyalty",B[0]),max:100,step:1})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Price Consciousness"}),i.jsxs("span",{className:"text-sm",children:[s.priceConsciousness||0,"%"]})]}),i.jsx(Un,{value:[s.priceConsciousness||0],onValueChange:B=>g("priceConsciousness",B[0]),max:100,step:1})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Environmental Concern"}),i.jsxs("span",{className:"text-sm",children:[s.environmentalConcern||0,"%"]})]}),i.jsx(Un,{value:[s.environmentalConcern||0],onValueChange:B=>g("environmentalConcern",B[0]),max:100,step:1})]}),i.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-2",children:[i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("label",{className:"text-sm font-medium",children:"Purchasing Power"}),i.jsx(ah,{checked:s.hasPurchasingPower||!1,onCheckedChange:B=>g("hasPurchasingPower",B)})]}),i.jsxs("div",{className:"flex items-center justify-between",children:[i.jsx("label",{className:"text-sm font-medium",children:"Has Children"}),i.jsx(ah,{checked:s.hasChildren||!1,onCheckedChange:B=>g("hasChildren",B)})]})]})]})]})})})}),i.jsxs(Yt,{value:"cooper",className:"mt-6 space-y-6",children:[i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsxs("div",{className:"mb-4",children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Goals"}),(s.goals||[]).map((B,le)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:B||"",onChange:se=>b("goals",le,se.target.value)}),i.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("goals",le),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},le)),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>y("goals"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Goal"]})]}),i.jsxs("div",{className:"mb-4 pt-4 border-t",children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Frustrations"}),(s.frustrations||[]).map((B,le)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:B||"",onChange:se=>b("frustrations",le,se.target.value)}),i.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("frustrations",le),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},le)),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>y("frustrations"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Frustration"]})]}),i.jsxs("div",{className:"mb-4 pt-4 border-t",children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Motivations"}),(s.motivations||[]).map((B,le)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:B||"",onChange:se=>b("motivations",le,se.target.value)}),i.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("motivations",le),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},le)),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>y("motivations"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Motivation"]})]})]})}),i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"Think, Feel, Do"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-sm mb-3",children:"Thinks"}),(((P=s.thinkFeelDo)==null?void 0:P.thinks)||[]).map((B,le)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:B||"",onChange:se=>w("thinks",le,se.target.value)}),i.jsx(te,{variant:"ghost",size:"icon",onClick:()=>S("thinks",le),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},le)),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>j("thinks"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Thought"]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-sm mb-3",children:"Feels"}),(((k=s.thinkFeelDo)==null?void 0:k.feels)||[]).map((B,le)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:B||"",onChange:se=>w("feels",le,se.target.value)}),i.jsx(te,{variant:"ghost",size:"icon",onClick:()=>S("feels",le),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},le)),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>j("feels"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Feeling"]})]}),i.jsxs("div",{children:[i.jsx("h4",{className:"font-medium text-sm mb-3",children:"Does"}),(((O=s.thinkFeelDo)==null?void 0:O.does)||[]).map((B,le)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:B||"",onChange:se=>w("does",le,se.target.value)}),i.jsx(te,{variant:"ghost",size:"icon",onClick:()=>S("does",le),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},le)),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>j("does"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Action"]})]})]})]})}),i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("div",{className:"space-y-4 mb-6",children:i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Scenario Section Title"}),i.jsx(Ot,{value:s.scenarioType||"",onChange:B=>g("scenarioType",B.target.value),placeholder:"Life Scenarios"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Custom title for the scenarios section (e.g., "Customer Journey", "Use Cases")'})]})}),i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Usage Scenarios"}),(s.scenarios||[]).map((B,le)=>i.jsxs("div",{className:"flex items-start gap-2 mb-2",children:[i.jsx(nt,{value:B||"",onChange:se=>b("scenarios",le,se.target.value),rows:2}),i.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("scenarios",le),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},le)),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>y("scenarios"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Scenario"]})]})})]}),i.jsx(Yt,{value:"personality",className:"mt-6",children:i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"OCEAN Personality Traits"}),i.jsxs("div",{className:"space-y-6",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Openness to Experience"}),i.jsxs("span",{className:"text-sm",children:[((M=s.oceanTraits)==null?void 0:M.openness)||50,"%"]})]}),i.jsx(Un,{value:[((A=s.oceanTraits)==null?void 0:A.openness)||50],onValueChange:B=>m("openness",B[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Creativity, curiosity, and openness to new ideas"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Conscientiousness"}),i.jsxs("span",{className:"text-sm",children:[(($=s.oceanTraits)==null?void 0:$.conscientiousness)||50,"%"]})]}),i.jsx(Un,{value:[((L=s.oceanTraits)==null?void 0:L.conscientiousness)||50],onValueChange:B=>m("conscientiousness",B[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Organization, responsibility, and self-discipline"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Extraversion"}),i.jsxs("span",{className:"text-sm",children:[((H=s.oceanTraits)==null?void 0:H.extraversion)||50,"%"]})]}),i.jsx(Un,{value:[((D=s.oceanTraits)==null?void 0:D.extraversion)||50],onValueChange:B=>m("extraversion",B[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Sociability, assertiveness, and talkativeness"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Agreeableness"}),i.jsxs("span",{className:"text-sm",children:[((V=s.oceanTraits)==null?void 0:V.agreeableness)||50,"%"]})]}),i.jsx(Un,{value:[((T=s.oceanTraits)==null?void 0:T.agreeableness)||50],onValueChange:B=>m("agreeableness",B[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Compassion, cooperation, and concern for others"})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"flex justify-between mb-1",children:[i.jsx("label",{className:"text-sm font-medium",children:"Neuroticism"}),i.jsxs("span",{className:"text-sm",children:[((F=s.oceanTraits)==null?void 0:F.neuroticism)||50,"%"]})]}),i.jsx(Un,{value:[((q=s.oceanTraits)==null?void 0:q.neuroticism)||50],onValueChange:B=>m("neuroticism",B[0]),max:100,step:1}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Emotional reactivity, anxiety, and sensitivity to stress"})]})]})]})})}),i.jsx(Yt,{value:"demographics",className:"mt-6",children:i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"Demographic Information"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Grade"}),i.jsxs(Mn,{value:s.socialGrade||"",onValueChange:B=>g("socialGrade",B),children:[i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select social grade"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"A",children:"A - Higher managerial"}),i.jsx(fe,{value:"B",children:"B - Intermediate managerial"}),i.jsx(fe,{value:"C1",children:"C1 - Supervisory or clerical"}),i.jsx(fe,{value:"C2",children:"C2 - Skilled manual workers"}),i.jsx(fe,{value:"D",children:"D - Semi and unskilled manual workers"}),i.jsx(fe,{value:"E",children:"E - State pensioners, unemployed"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Income"}),i.jsxs(Mn,{value:s.householdIncome||"",onValueChange:B=>g("householdIncome",B),children:[i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select income range"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"Under $25k",children:"Under $25,000"}),i.jsx(fe,{value:"$25k-$50k",children:"$25,000 - $50,000"}),i.jsx(fe,{value:"$50k-$75k",children:"$50,000 - $75,000"}),i.jsx(fe,{value:"$75k-$100k",children:"$75,000 - $100,000"}),i.jsx(fe,{value:"$100k-$150k",children:"$100,000 - $150,000"}),i.jsx(fe,{value:"$150k-$250k",children:"$150,000 - $250,000"}),i.jsx(fe,{value:"Over $250k",children:"Over $250,000"}),i.jsx(fe,{value:"Prefer not to say",children:"Prefer not to say"})]})]})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Household Composition"}),i.jsxs(Mn,{value:s.householdComposition||"",onValueChange:B=>g("householdComposition",B),children:[i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select household type"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"Single person",children:"Single person"}),i.jsx(fe,{value:"Couple without children",children:"Couple without children"}),i.jsx(fe,{value:"Couple with children",children:"Couple with children"}),i.jsx(fe,{value:"Single parent",children:"Single parent"}),i.jsx(fe,{value:"Multi-generational",children:"Multi-generational"}),i.jsx(fe,{value:"Shared housing",children:"Shared housing"}),i.jsx(fe,{value:"Other",children:"Other"})]})]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Living Situation"}),i.jsxs(Mn,{value:s.livingSituation||"",onValueChange:B=>g("livingSituation",B),children:[i.jsx(Pn,{children:i.jsx(In,{placeholder:"Select living situation"})}),i.jsxs(An,{children:[i.jsx(fe,{value:"Own home",children:"Own home"}),i.jsx(fe,{value:"Rent apartment",children:"Rent apartment"}),i.jsx(fe,{value:"Rent house",children:"Rent house"}),i.jsx(fe,{value:"Live with family",children:"Live with family"}),i.jsx(fe,{value:"Student housing",children:"Student housing"}),i.jsx(fe,{value:"Assisted living",children:"Assisted living"}),i.jsx(fe,{value:"Other",children:"Other"})]})]})]})]})]})]})})}),i.jsx(Yt,{value:"lifestyle",className:"mt-6",children:i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"Lifestyle & Behavior"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Media Consumption"}),i.jsx(nt,{value:s.mediaConsumption||"",onChange:B=>g("mediaConsumption",B.target.value),rows:3,placeholder:"TV shows, podcasts, news sources, social media platforms"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Describe media consumption habits and preferences"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Device Usage"}),i.jsx(nt,{value:s.deviceUsage||"",onChange:B=>g("deviceUsage",B.target.value),rows:3,placeholder:"Smartphone, laptop, tablet, smart TV, gaming console"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Primary devices and usage patterns"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Shopping Habits"}),i.jsx(nt,{value:s.shoppingHabits||"",onChange:B=>g("shoppingHabits",B.target.value),rows:3,placeholder:"Online vs in-store, frequency, preferred retailers"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shopping behavior and preferences"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Brand Preferences"}),i.jsx(nt,{value:s.brandPreferences||"",onChange:B=>g("brandPreferences",B.target.value),rows:3,placeholder:"Favorite brands, brand values alignment"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred brands and reasoning"})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Communication Preferences"}),i.jsx(nt,{value:s.communicationPreferences||"",onChange:B=>g("communicationPreferences",B.target.value),rows:3,placeholder:"Email, phone, text, video calls, in-person"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred communication methods and channels"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Payment Methods"}),i.jsx(nt,{value:s.paymentMethods||"",onChange:B=>g("paymentMethods",B.target.value),rows:3,placeholder:"Credit cards, digital wallets, cash, BNPL"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Preferred payment methods and financial tools"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Purchase Behavior"}),i.jsx(nt,{value:s.purchaseBehaviour||"",onChange:B=>g("purchaseBehaviour",B.target.value),rows:3,placeholder:"Research habits, decision factors, impulse vs planned buying"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"How they approach making purchase decisions"})]})]})]})]})})}),i.jsxs(Yt,{value:"extended",className:"mt-6 space-y-6",children:[i.jsx(rt,{children:i.jsxs(bt,{className:"p-6",children:[i.jsx("h3",{className:"font-medium text-lg mb-4",children:"Extended Profile"}),i.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Core Values"}),i.jsx(nt,{value:s.coreValues||"",onChange:B=>g("coreValues",B.target.value),rows:3,placeholder:"Key principles and values that guide decisions"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Lifestyle Choices"}),i.jsx(nt,{value:s.lifestyleChoices||"",onChange:B=>g("lifestyleChoices",B.target.value),rows:3,placeholder:"Health, fitness, diet, work-life balance preferences"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Social Activities"}),i.jsx(nt,{value:s.socialActivities||"",onChange:B=>g("socialActivities",B.target.value),rows:3,placeholder:"Social hobbies, community involvement, networking"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Category Knowledge"}),i.jsx(nt,{value:s.categoryKnowledge||"",onChange:B=>g("categoryKnowledge",B.target.value),rows:3,placeholder:"Expertise in specific product/service categories"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Decision Influences"}),i.jsx(nt,{value:s.decisionInfluences||"",onChange:B=>g("decisionInfluences",B.target.value),rows:3,placeholder:"What factors most influence their decisions"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Pain Points"}),i.jsx(nt,{value:s.painPoints||"",onChange:B=>g("painPoints",B.target.value),rows:3,placeholder:"Common challenges and friction points"})]})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Journey Context"}),i.jsx(nt,{value:s.journeyContext||"",onChange:B=>g("journeyContext",B.target.value),rows:3,placeholder:"Current life stage and contextual factors"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Key Touchpoints"}),i.jsx(nt,{value:s.keyTouchpoints||"",onChange:B=>g("keyTouchpoints",B.target.value),rows:3,placeholder:"Important interaction points and channels"})]}),i.jsxs("div",{className:"space-y-4",children:[i.jsx("h4",{className:"font-medium text-sm",children:"Self-Determination Needs"}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Autonomy"}),i.jsx(nt,{value:((Z=s.selfDeterminationNeeds)==null?void 0:Z.autonomy)||"",onChange:B=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,autonomy:B.target.value}),rows:2,placeholder:"Need for independence and self-direction"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Competence"}),i.jsx(nt,{value:((re=s.selfDeterminationNeeds)==null?void 0:re.competence)||"",onChange:B=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,competence:B.target.value}),rows:2,placeholder:"Need to feel capable and effective"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Relatedness"}),i.jsx(nt,{value:((ge=s.selfDeterminationNeeds)==null?void 0:ge.relatedness)||"",onChange:B=>g("selfDeterminationNeeds",{...s.selfDeterminationNeeds,relatedness:B.target.value}),rows:2,placeholder:"Need for connection and belonging"})]})]})]})]})]})}),i.jsx(rt,{children:i.jsx(bt,{className:"p-6",children:i.jsxs("div",{className:"space-y-4",children:[i.jsxs("div",{children:[i.jsx("h3",{className:"font-medium text-lg mb-3",children:"Fears & Concerns"}),(s.fears||[]).map((B,le)=>i.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i.jsx(Ot,{value:B,onChange:se=>b("fears",le,se.target.value),placeholder:"Enter a fear or concern"}),i.jsx(te,{variant:"ghost",size:"icon",onClick:()=>x("fears",le),children:i.jsx(_n,{className:"h-4 w-4 text-muted-foreground"})})]},le)),i.jsxs(te,{variant:"outline",size:"sm",onClick:()=>y("fears"),className:"mt-2",children:[i.jsx(pr,{className:"h-4 w-4 mr-2"}),"Add Fear/Concern"]})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Personal Narrative"}),i.jsx(nt,{value:s.narrative||"",onChange:B=>g("narrative",B.target.value),rows:4,placeholder:"Personal story, background, key life experiences"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"A brief narrative that captures their personal story"})]}),i.jsxs("div",{children:[i.jsx("label",{className:"text-sm font-medium block mb-1",children:"Additional Information"}),i.jsx(nt,{value:s.additionalInformation||"",onChange:B=>g("additionalInformation",B.target.value),rows:4,placeholder:"Any other relevant details or context"}),i.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Additional context or details not covered elsewhere"})]})]})})})]})]})]})}function gPe(){const{id:e}=QM(),t=qr(),n=Tn(),{navigationState:r,clearNavigationState:s}=XL(),[a,o]=v.useState(void 0),[l,c]=v.useState(!1),[u,d]=v.useState(!1),[f,h]=v.useState(!0);return v.useEffect(()=>{if(!e){h(!1);return}let m=!0;const b=new URLSearchParams(t.search).get("fromReview")==="true";return c(b),h(!0),(async()=>{try{const w=e.startsWith("local-")?e.substring(6):e,j=await Dn.getById(w);if(j&&j.data){const S=j.data;if(m){console.log("Found persona in database:",S),o({...S,id:S.id||S._id,isDbPersona:!0}),h(!1);return}}console.error("Could not find persona with id:",e),m&&(o(void 0),h(!1),oe.error("Persona not found"))}catch(w){console.error("Error fetching persona:",w),m&&(o(void 0),h(!1),oe.error("Failed to load persona details"))}})(),()=>{m=!1}},[e,t.search]),{currentPersona:a,isEditing:u,isFromReview:l,isLoading:f,setIsEditing:d,handleGoBack:()=>{r.previousRoute==="/focus-groups"&&r.focusGroupTab?r.isNewFocusGroup?n(`/focus-groups?mode=create&tab=${r.focusGroupTab}`):r.focusGroupId?n(`/focus-groups?mode=edit&id=${r.focusGroupId}&tab=${r.focusGroupTab}`):n("/focus-groups?mode=create&tab=participants"):n(l?"/synthetic-users?mode=create&tab=ai&step=review":"/synthetic-users")},handleSaveEdit:async m=>{try{d(!1);const y=m.isDbPersona||e&&e.length===24&&/^[0-9a-f]{24}$/i.test(e),b={...m};if(b._id&&delete b._id,delete b.isDbPersona,y&&e&&e.length===24&&/^[0-9a-f]{24}$/i.test(e)){const x=await Dn.update(e,b);console.log("Updated persona in database:",x);const w={...m,isDbPersona:!0};o(w),oe.success("Persona updated in database successfully")}else{const x=await Dn.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};o(w),oe.success("Persona saved to database successfully")}}catch(y){return console.error("Error saving persona:",y),y.response&&y.response.status===401?oe.error("Authentication error - Please log in to save personas"):y.response&&y.response.status===404?oe.error("API endpoint not found - Database service may be unavailable"):oe.error("Failed to save persona to database: "+(y.message||"Unknown error")),!1}return!0}}}function $k(){const{currentPersona:e,isEditing:t,isFromReview:n,isLoading:r,setIsEditing:s,handleGoBack:a,handleSaveEdit:o}=gPe();return r?i.jsx(hPe,{}):e?i.jsxs("div",{className:"min-h-screen bg-slate-50",children:[i.jsx(oi,{}),i.jsx("main",{className:"pt-20 pb-16 px-4 sm:px-6 lg:px-8 max-w-7xl mx-auto",children:t?i.jsx(mPe,{persona:e,onSave:o,onCancel:()=>s(!1)}):i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"flex items-center mb-6 relative",children:[i.jsx(te,{variant:"ghost",onClick:a,className:"absolute left-0 top-0 flex items-center",children:i.jsx(zf,{className:"h-5 w-5"})}),i.jsx("h1",{className:"font-sf text-3xl font-bold text-slate-900 mx-auto",children:"Persona Profile"}),i.jsxs(te,{onClick:()=>s(!0),className:"absolute right-0 top-0",children:[i.jsx(TW,{className:"h-4 w-4 mr-2"}),"Edit Persona"]})]}),i.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 mt-10",children:[i.jsx("div",{className:"lg:col-span-1",children:i.jsx(lPe,{persona:e})}),i.jsx("div",{className:"lg:col-span-2",children:i.jsxs(Fo,{defaultValue:"cooper-profile",children:[i.jsxs(Pi,{className:"grid w-full grid-cols-3",children:[i.jsx(Xt,{value:"cooper-profile",children:"Cooper Profile"}),i.jsx(Xt,{value:"personality",children:"Personality"}),i.jsx(Xt,{value:"scenarios",children:"Scenarios"})]}),i.jsx(Yt,{value:"cooper-profile",className:"mt-6",children:i.jsx(cPe,{persona:e})}),i.jsx(Yt,{value:"personality",className:"mt-6",children:i.jsx(uPe,{persona:e})}),i.jsx(Yt,{value:"scenarios",className:"mt-6",children:i.jsx(dPe,{persona:e})})]})})]})]})})]}):i.jsx(fPe,{})}const vPe=Te.object({username:Te.string().min(3,"Username must be at least 3 characters"),password:Te.string().min(4,"Password must be at least 4 characters")});function yPe(){var u;const e=Tn(),t=qr(),{login:n,isAuthenticated:r}=Kl(),[s,a]=v.useState(!1),o=((u=t.state)==null?void 0:u.from)||"/";console.log("Login page - destination path:",o),v.useEffect(()=>{r&&(console.log("User already authenticated, redirecting from login page"),e("/",{replace:!0}))},[r,e]);const l=Ny({resolver:_y(vPe),defaultValues:{username:"",password:""}});async function c(d){a(!0);try{await n(d.username,d.password)?(console.log("Login successful, received token, navigating to:",o),e(o,{replace:!0})):(console.error("Login succeeded but no token received"),a(!1))}catch(f){console.error("Login error in form handler:",f),a(!1)}}return i.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:i.jsxs(rt,{className:"w-full max-w-md",children:[i.jsxs(Dr,{className:"space-y-1",children:[i.jsx(ts,{className:"text-2xl font-bold text-center",children:"Sign In"}),i.jsx(nN,{className:"text-center",children:"Enter your credentials to access your account"})]}),i.jsx(bt,{children:i.jsx(Ay,{...l,children:i.jsxs("form",{onSubmit:l.handleSubmit(c),className:"space-y-4",children:[i.jsx(dt,{control:l.control,name:"username",render:({field:d})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Username"}),i.jsx(ct,{children:i.jsx(Ot,{placeholder:"Enter your username",...d,disabled:s,autoComplete:"username"})}),i.jsx(ut,{})]})}),i.jsx(dt,{control:l.control,name:"password",render:({field:d})=>i.jsxs(ot,{children:[i.jsx(lt,{children:"Password"}),i.jsx(ct,{children:i.jsx(Ot,{placeholder:"Enter your password",type:"password",...d,disabled:s,autoComplete:"current-password"})}),i.jsx(ut,{})]})}),i.jsx(te,{type:"submit",className:"w-full",disabled:s,children:s?"Signing in...":"Sign In"})]})})}),i.jsxs(rN,{className:"flex flex-col space-y-2",children:[i.jsx("div",{className:"text-sm text-center text-gray-500 mb-2",children:"Default account: user / pass"}),!s&&i.jsxs("div",{className:"flex flex-col items-center justify-center gap-2",children:[i.jsx(te,{variant:"outline",onClick:()=>e("/",{replace:!0}),className:"mt-2",children:"Return to Home"}),i.jsx(te,{variant:"link",onClick:()=>{localStorage.setItem("offline_mode","true");const d={username:"guest",email:"guest@example.com",role:"user"};localStorage.setItem("auth_token","offline-mode-token"),localStorage.setItem("user",JSON.stringify(d)),Ke.success("Offline mode activated",{description:"Using demo account with limited functionality"}),e("/",{replace:!0})},className:"text-sm text-gray-500",children:"Use offline mode"})]})]})]})})}function dc({children:e}){const{isAuthenticated:t,isLoading:n}=Kl(),r=qr();return console.log("ProtectedRoute check:",{isAuthenticated:t,isLoading:n,path:r.pathname}),n?i.jsx("div",{className:"flex items-center justify-center min-h-screen",children:i.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-primary"})}):t?(console.log("User is authenticated, showing protected content"),i.jsx(i.Fragment,{children:e})):(console.log("Not authenticated, redirecting to login"),i.jsx(nI,{to:"/login",state:{from:r.pathname},replace:!0}))}const xPe=new s9,bPe=()=>i.jsx(i9,{client:xPe,children:i.jsx(nW,{basename:"/semblance",children:i.jsx(pG,{children:i.jsx(SQ,{children:i.jsxs(I7,{children:[i.jsx(cU,{}),i.jsxs(K9,{children:[i.jsx(Is,{path:"/",element:i.jsx(gG,{})}),i.jsx(Is,{path:"/login",element:i.jsx(yPe,{})}),i.jsx(Is,{path:"/synthetic-users",element:i.jsx(dc,{children:i.jsx(xQ,{})})}),i.jsx(Is,{path:"/synthetic-users/:id",element:i.jsx(dc,{children:i.jsx($k,{})})}),i.jsx(Is,{path:"/personas/:id",element:i.jsx(dc,{children:i.jsx($k,{})})}),i.jsx(Is,{path:"/focus-groups",element:i.jsx(dc,{children:i.jsx(EQ,{})})}),i.jsx(Is,{path:"/focus-groups/:id",element:i.jsx(dc,{children:i.jsx(Z_e,{})})}),i.jsx(Is,{path:"/dashboard",element:i.jsx(dc,{children:i.jsx(oPe,{})})}),i.jsx(Is,{path:"/old-path",element:i.jsx(nI,{to:"/",replace:!0})}),i.jsx(Is,{path:"*",element:i.jsx(vG,{})})]})]})})})})});nM(document.getElementById("root")).render(i.jsx(bPe,{})); diff --git a/dist/index.html b/dist/index.html index 8316d569..00b36ee9 100644 --- a/dist/index.html +++ b/dist/index.html @@ -7,8 +7,8 @@ - - + + diff --git a/src/App.tsx b/src/App.tsx index 5928e9be..5de09c55 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -13,6 +13,7 @@ import PersonaProfile from "./components/persona/PersonaProfile"; import Login from "./pages/Login"; import ProtectedRoute from "./components/ProtectedRoute"; import { AuthProvider } from "./contexts/AuthContext"; +import { NavigationProvider } from "./contexts/NavigationContext"; // CSS for consistent back button positioning import "./styles/backButton.css"; @@ -23,7 +24,8 @@ const App = () => ( - + + } /> @@ -71,7 +73,8 @@ const App = () => ( {/* ADD ALL CUSTOM ROUTES ABOVE THE CATCH-ALL "*" ROUTE */} } /> - + + diff --git a/src/components/AIRecruiter.tsx b/src/components/AIRecruiter.tsx index a849ad96..31d52f3b 100644 --- a/src/components/AIRecruiter.tsx +++ b/src/components/AIRecruiter.tsx @@ -154,7 +154,7 @@ export default function AIRecruiter({ targetFolderId, targetFolderName }: AIRecr } // Navigate directly back to synthetic users list - navigate('/synthetic-users'); + navigate('/synthetic-users?mode=view'); } else { throw new Error("No personas were generated"); } @@ -307,7 +307,7 @@ export default function AIRecruiter({ targetFolderId, targetFolderName }: AIRecr savePersonas(approved); // Redirect to the persona library view instead of resetting - navigate('/synthetic-users'); + navigate('/synthetic-users?mode=view'); }; return ( diff --git a/src/components/FocusGroupModerator.tsx b/src/components/FocusGroupModerator.tsx index ee13396d..42e5e27c 100644 --- a/src/components/FocusGroupModerator.tsx +++ b/src/components/FocusGroupModerator.tsx @@ -1,5 +1,6 @@ import { useState, useEffect, useCallback, useRef } from 'react'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate, useLocation } from 'react-router-dom'; +import { useNavigation } from '@/contexts/NavigationContext'; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; @@ -75,7 +76,6 @@ import { import { Label } from "@/components/ui/label"; import { Checkbox } from "@/components/ui/checkbox"; import UserCard from "@/components/UserCard"; -import PersonaDetailsModal from "@/components/PersonaDetailsModal"; import { Persona } from "@/types/persona"; // Define folder interface @@ -129,11 +129,14 @@ const sampleGuide = { interface FocusGroupModeratorProps { draftToEdit?: any | null; onDraftSaved?: () => void; + preSelectedParticipants?: string[]; } -export default function FocusGroupModerator({ draftToEdit, onDraftSaved }: FocusGroupModeratorProps = {}) { +export default function FocusGroupModerator({ draftToEdit, onDraftSaved, preSelectedParticipants = [] }: FocusGroupModeratorProps = {}) { console.log('FocusGroupModerator component rendering, draftToEdit:', draftToEdit); const navigate = useNavigate(); + const location = useLocation(); + const { setPreviousRoute, navigationState, clearNavigationState } = useNavigation(); const [activeTab, setActiveTab] = useState('setup'); const [isGenerating, setIsGenerating] = useState(false); const [guideGenerationComplete, setGuideGenerationComplete] = useState(false); @@ -141,6 +144,9 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved }: Focus const [discussionGuide, setDiscussionGuide] = useState(null); const [draftFocusGroupId, setDraftFocusGroupId] = useState(null); + // Track if discussion guide is being edited to prevent updates during editing + const [isEditingGuide, setIsEditingGuide] = useState(false); + // Ref to access current discussionGuide in callbacks without adding it as dependency const discussionGuideRef = useRef(discussionGuide); discussionGuideRef.current = discussionGuide; @@ -188,20 +194,32 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved }: Focus ethnicity: [], }); - // Persona details modal state - const [isPersonaModalOpen, setIsPersonaModalOpen] = useState(false); - const [selectedPersonaForModal, setSelectedPersonaForModal] = useState(null); - // Handler for opening persona details modal - const handleOpenPersonaModal = (persona: Persona) => { - setSelectedPersonaForModal(persona); - setIsPersonaModalOpen(true); - }; + // Auto-save state management + const [autoSaveStatus, setAutoSaveStatus] = useState<'idle' | 'saving' | 'saved' | 'error'>('idle'); + const [lastSavedData, setLastSavedData] = useState(null); + const [saveRetryCount, setSaveRetryCount] = useState(0); + const debouncedSaveTimerRef = useRef(null); + const isSavingRef = useRef(false); + const isLoadingDraftRef = useRef(false); - // Handler for closing persona details modal - const handleClosePersonaModal = () => { - setIsPersonaModalOpen(false); - setSelectedPersonaForModal(null); + // Handler for persona view details navigation + const handlePersonaViewDetails = (persona: Persona) => { + // Set navigation context with current focus group state + setPreviousRoute('/focus-groups', { + focusGroupId: draftFocusGroupId, + focusGroupTab: 'participants', + isNewFocusGroup: !draftToEdit, + focusGroupData: { + name: form.getValues('name'), + description: form.getValues('description'), + selectedParticipants: selectedParticipants, + discussionGuide: discussionGuide, + } + }); + + // Navigate to persona profile page + navigate(`/synthetic-users/${persona.id}`); }; // Function to collect unique filter options from personas @@ -514,15 +532,167 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved }: Focus }, }); console.log('Form initialized successfully'); + + // Simplified auto-save trigger function - only debounced save on changes + const triggerAutoSave = () => { + if (activeTab !== 'setup' || isLoadingDraftRef.current) return; + + // Clear existing debounced timer + if (debouncedSaveTimerRef.current) { + clearTimeout(debouncedSaveTimerRef.current); + } + + // Schedule debounced save - create inline function to avoid dependencies + debouncedSaveTimerRef.current = setTimeout(async () => { + if (isSavingRef.current) return; + + const values = form.getValues(); + const currentData = { + name: values.focusGroupName || '', + description: values.researchBrief || '', + objective: values.researchBrief || '', + topic: values.discussionTopics || '', + duration: values.duration ? parseInt(values.duration) : 60, + llm_model: values.llm_model || 'gemini-2.5-pro', + participants: selectedParticipants, + participants_count: selectedParticipants.length, + status: 'draft', + date: new Date().toISOString(), + uploadedAssets: uploadedAssets.map(file => file.name) + }; + + if (lastSavedData && JSON.stringify(currentData) === JSON.stringify(lastSavedData)) { + return; // No changes + } + + if (!currentData.name && !currentData.description && !currentData.topic) { + return; // Don't save empty form + } + + isSavingRef.current = true; + setAutoSaveStatus('saving'); + + try { + // Use draftFocusGroupId from state, or fall back to draftToEdit ID if available + let focusGroupId = draftFocusGroupId || (draftToEdit?.id || draftToEdit?._id); + console.log("Auto-save: draftFocusGroupId =", draftFocusGroupId); + console.log("Auto-save: draftToEdit ID =", draftToEdit?.id || draftToEdit?._id); + console.log("Auto-save: using focusGroupId =", focusGroupId); + console.log("Auto-save: llm_model in currentData =", currentData.llm_model); + console.log("Auto-save: duration in currentData =", currentData.duration); + + if (!focusGroupId) { + console.log("Auto-save: Creating NEW focus group (no existing ID)"); + const response = await focusGroupsApi.create(currentData); + focusGroupId = response.data.focus_group_id || response.data.id || response.data._id; + setDraftFocusGroupId(focusGroupId); + console.log("Auto-save: Created new draft with ID:", focusGroupId); + } else { + console.log("Auto-save: Updating existing focus group:", focusGroupId); + await focusGroupsApi.update(focusGroupId, currentData); + console.log("Auto-save: Updated existing draft:", focusGroupId); + } + + setLastSavedData(currentData); + setAutoSaveStatus('saved'); + setSaveRetryCount(0); + + setTimeout(() => { + setAutoSaveStatus('idle'); + }, 2000); + + } catch (error) { + console.error("Auto-save failed:", error); + setAutoSaveStatus('error'); + setSaveRetryCount(prev => prev + 1); + + if (saveRetryCount < 3) { + const retryDelay = Math.pow(2, saveRetryCount) * 2000; + setTimeout(() => { + triggerAutoSave(); + }, retryDelay); + } else { + toast.error("Auto-save failed", { + description: "Your changes may not be saved. Please check your connection.", + }); + } + } finally { + isSavingRef.current = false; + } + }, 2000); + }; + + // Watch for form field changes to trigger auto-save + const watchedFields = form.watch(); + + // Use refs to track previous values to prevent unnecessary saves + const prevWatchedFieldsRef = useRef(''); + const prevSelectedParticipantsRef = useRef(''); + const prevUploadedAssetsRef = useRef(''); + + // Effect to handle form field changes and trigger auto-save + useEffect(() => { + const currentWatchedFields = JSON.stringify(watchedFields); + if (activeTab === 'setup' && currentWatchedFields !== prevWatchedFieldsRef.current) { + prevWatchedFieldsRef.current = currentWatchedFields; + triggerAutoSave(); + } + }, [watchedFields, activeTab]); + + // Effect to handle participant changes + useEffect(() => { + const currentParticipants = JSON.stringify(selectedParticipants); + if (activeTab === 'setup' && currentParticipants !== prevSelectedParticipantsRef.current) { + prevSelectedParticipantsRef.current = currentParticipants; + triggerAutoSave(); + } + }, [selectedParticipants, activeTab]); + + // Effect to handle uploaded assets changes + useEffect(() => { + const currentAssets = JSON.stringify(uploadedAssets.map(f => f.name)); + if (activeTab === 'setup' && currentAssets !== prevUploadedAssetsRef.current) { + prevUploadedAssetsRef.current = currentAssets; + triggerAutoSave(); + } + }, [uploadedAssets, activeTab]); + + // Effect to clear timers when leaving setup tab or component unmounts + useEffect(() => { + if (activeTab !== 'setup') { + // Clear debounced timer when leaving setup tab + if (debouncedSaveTimerRef.current) { + clearTimeout(debouncedSaveTimerRef.current); + } + } + + // Cleanup timer on unmount + return () => { + if (debouncedSaveTimerRef.current) { + clearTimeout(debouncedSaveTimerRef.current); + } + }; + }, [activeTab]); // Effect to load draft data when editing an existing draft useEffect(() => { + console.log("Draft loading effect - draftToEdit:", draftToEdit, "draftLoadedRef.current:", draftLoadedRef.current); + + // Reset loaded flag when draftToEdit changes + if (!draftToEdit) { + draftLoadedRef.current = false; + return; + } + if (draftToEdit && !draftLoadedRef.current) { console.log("Loading draft focus group:", draftToEdit); + isLoadingDraftRef.current = true; // Prevent auto-save during loading draftLoadedRef.current = true; // Mark as loaded to prevent re-loading // Set the draft ID - setDraftFocusGroupId(draftToEdit.id || draftToEdit._id); + const draftId = draftToEdit.id || draftToEdit._id; + setDraftFocusGroupId(draftId); + console.log("Setting draft ID from draftToEdit:", draftId); // Load form data if available if (draftToEdit.name) { @@ -537,12 +707,17 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved }: Focus if (draftToEdit.duration) { form.setValue('duration', draftToEdit.duration.toString()); } + if (draftToEdit.llm_model) { + form.setValue('llm_model', draftToEdit.llm_model); + } // Load discussion guide if available if (draftToEdit.discussionGuide) { setDiscussionGuide(draftToEdit.discussionGuide); - // If we have a discussion guide, start on the review tab - setActiveTab('review'); + // If we have a discussion guide and no navigation state override, start on the review tab + if (!navigationState.focusGroupTab || navigationState.previousRoute !== '/focus-groups') { + setActiveTab('review'); + } } // Load selected participants if available @@ -550,12 +725,85 @@ export default function FocusGroupModerator({ draftToEdit, onDraftSaved }: Focus setSelectedParticipants(draftToEdit.participants); } + // Set lastSavedData to current draft state to prevent immediate auto-save + const currentDraftData = { + name: draftToEdit.name || '', + description: draftToEdit.description || draftToEdit.objective || '', + objective: draftToEdit.description || draftToEdit.objective || '', + topic: draftToEdit.topic || '', + duration: draftToEdit.duration || 60, + llm_model: draftToEdit.llm_model || 'gemini-2.5-pro', + participants: draftToEdit.participants || [], + participants_count: (draftToEdit.participants || []).length, + status: 'draft', + date: draftToEdit.date || new Date().toISOString(), + uploadedAssets: [] + }; + setLastSavedData(currentDraftData); + console.log("Set lastSavedData to current draft:", currentDraftData); + toast.success("Draft focus group loaded", { description: "Continue editing your focus group setup" }); + + // Allow auto-save after loading is complete + setTimeout(() => { + isLoadingDraftRef.current = false; + }, 1000); // Give it a second to settle } }, [draftToEdit, form]); + // Effect to handle pre-selected participants from persona list + useEffect(() => { + if (preSelectedParticipants.length > 0) { + console.log("Pre-selected participants received:", preSelectedParticipants); + setSelectedParticipants(preSelectedParticipants); + // Auto-switch to participants tab to show the pre-selected personas + setActiveTab('participants'); + } + }, [preSelectedParticipants]); + + // Handle navigation state to set the correct tab when returning from persona details + useEffect(() => { + if (navigationState.focusGroupTab && navigationState.previousRoute === '/focus-groups') { + // Use setTimeout to ensure this runs after other tab-setting logic + setTimeout(() => { + setActiveTab(navigationState.focusGroupTab); + // Clear navigation state after using it + clearNavigationState(); + }, 0); + } + }, [navigationState.focusGroupTab, draftToEdit, clearNavigationState]); // Also depend on draftToEdit so this runs after draft loading + + // Initialize refs on mount for new focus groups (not editing drafts) + useEffect(() => { + if (!draftToEdit) { + setTimeout(() => { + isLoadingDraftRef.current = false; + }, 500); // Allow initial render to complete + } + }, [draftToEdit]); + + + // Save Status Indicator Component + const SaveStatusIndicator = () => { + if (autoSaveStatus === 'idle') return null; + + const statusConfig = { + 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' } + }; + + const config = statusConfig[autoSaveStatus]; + + return ( +
+ {config.text} +
+ ); + }; + // Function to generate a discussion guide via the API const generateDiscussionGuide = async (values: z.infer, focusGroupId?: string): Promise => { // Reset states @@ -902,41 +1150,12 @@ true; console.log("New selection:", newSelection); - // Auto-save participant selection if we have a draft - if (draftFocusGroupId && discussionGuide) { - saveDraftParticipants(newSelection); - } + // Auto-save will be triggered by the useEffect watching selectedParticipants return newSelection; }); }; - // Function to auto-save participant changes to draft - const saveDraftParticipants = async (participants: string[]) => { - if (!draftFocusGroupId) return; - - try { - const values = form.getValues(); - const draftData = { - name: values.focusGroupName, - status: 'draft', - participants: participants, - participants_count: participants.length, - date: new Date().toISOString(), - duration: parseInt(values.duration), - topic: values.discussionTopics.split(',')[0].trim().toLowerCase().replace(/\s+/g, '-'), - description: values.researchBrief, - objective: values.researchBrief, - discussionGuide: discussionGuide - }; - - await focusGroupsApi.update(draftFocusGroupId, draftData); - console.log("Participant selection auto-saved to draft"); - } catch (error) { - console.error("Failed to auto-save participant selection:", error); - // Don't show toast for auto-save failures to avoid spam - } - }; const handleAssetUpload = (files: FileList | null) => { if (files && files.length > 0) { @@ -1012,15 +1231,34 @@ true; // Stable callback for saving discussion guide changes const handleSaveDiscussionGuide = useCallback(async (updatedGuide: any) => { console.log('📝 handleSaveDiscussionGuide called with:', updatedGuide); - setDiscussionGuide(updatedGuide); - toast.success('Discussion guide updated', { - description: 'Your changes have been saved.' - }); + // Only update the discussion guide state if we're not currently editing + // This prevents re-renders that would cause focus loss during editing + if (!isEditingGuide) { + setDiscussionGuide(updatedGuide); + toast.success('Discussion guide updated', { + description: 'Your changes have been saved.' + }); + } else { + // During editing, just update the ref so the latest version is available + discussionGuideRef.current = updatedGuide; + console.log('📝 Skipping discussionGuide state update during editing to preserve focus'); + } + }, [isEditingGuide]); + + // Handle editing state changes from DiscussionGuideViewer + const handleEditingStateChange = useCallback((editing: boolean) => { + console.log('📝 Discussion guide editing state changed:', editing); + setIsEditingGuide(editing); + + // When editing ends, update the discussion guide state with the latest version + if (!editing && discussionGuideRef.current) { + console.log('📝 Updating discussionGuide state after editing ended'); + setDiscussionGuide(discussionGuideRef.current); + } }, []); // Stable dummy callbacks for optional props const handleSectionSelect = useCallback(() => {}, []); - const handleSetPosition = useCallback(() => {}, []); const handleStartFocusGroup = async () => { // Validate form data @@ -1105,11 +1343,15 @@ true; }; return ( -
-
- -

AI Focus Group Moderator

-
+ <> + {/* Auto-save Status Indicator */} + + +
+
+ +

AI Focus Group Moderator

+
{/* Progress Bar - Consistent top placement for discussion guide generation */} {isGenerating && ( @@ -1201,7 +1443,7 @@ true; render={({ field }) => ( Duration (minutes) - @@ -1229,7 +1471,7 @@ true; render={({ field }) => ( AI Model - @@ -1339,9 +1581,9 @@ true; onSave={handleSaveDiscussionGuide} onDownload={handleDownloadDiscussionGuide} onSectionSelect={handleSectionSelect} - onSetPosition={handleSetPosition} isDownloading={isDownloadingGuide} focusGroupId={draftFocusGroupId} + onEditingChange={handleEditingStateChange} /> ) : (
@@ -1657,8 +1899,7 @@ true; }} selected={selectedParticipants.includes(personaId)} onSelectionToggle={() => handleParticipantSelection(personaId)} - showModalInsteadOfNavigate={true} - onOpenPersonaModal={handleOpenPersonaModal} + onViewDetails={handlePersonaViewDetails} /> ); })} @@ -1819,13 +2060,7 @@ true; - - {/* Persona Details Modal */} -
+ ); } diff --git a/src/components/UserCard.tsx b/src/components/UserCard.tsx index 99f184a1..7468e9bc 100644 --- a/src/components/UserCard.tsx +++ b/src/components/UserCard.tsx @@ -21,8 +21,7 @@ interface UserCardProps { onSelectionToggle?: (e: React.MouseEvent) => void; showAddToFolderButton?: boolean; onAddToFolder?: (e: React.MouseEvent) => void; - showModalInsteadOfNavigate?: boolean; - onOpenPersonaModal?: (persona: Persona) => void; + onViewDetails?: (persona: Persona) => void; } export default function UserCard({ @@ -33,8 +32,7 @@ export default function UserCard({ onSelectionToggle, showAddToFolderButton = false, onAddToFolder, - showModalInsteadOfNavigate = false, - onOpenPersonaModal + onViewDetails }: UserCardProps) { const navigate = useNavigate(); const [isEditing, setIsEditing] = useState(false); @@ -92,8 +90,8 @@ export default function UserCard({ const handleViewDetailsClick = (e: React.MouseEvent) => { e.stopPropagation(); - if (showModalInsteadOfNavigate && onOpenPersonaModal) { - onOpenPersonaModal(currentPersona); + if (onViewDetails) { + onViewDetails(currentPersona); } else { handleViewDetails(e); } diff --git a/src/components/UserCreator.tsx b/src/components/UserCreator.tsx index 3cbf1e1b..6733290c 100644 --- a/src/components/UserCreator.tsx +++ b/src/components/UserCreator.tsx @@ -521,7 +521,7 @@ export default function UserCreator({ targetFolderId, targetFolderName }: UserCr // Navigate back to the synthetic users page after successful creation setTimeout(() => { - navigate('/synthetic-users'); + navigate('/synthetic-users?mode=view'); }, 300); } catch (error: unknown) { console.error("Error creating personas:", error); diff --git a/src/components/ai-recruiter/AIRecruiterForm.tsx b/src/components/ai-recruiter/AIRecruiterForm.tsx index 1417cf04..64e8033e 100644 --- a/src/components/ai-recruiter/AIRecruiterForm.tsx +++ b/src/components/ai-recruiter/AIRecruiterForm.tsx @@ -381,49 +381,52 @@ export default function AIRecruiterForm({ onSubmit, isGenerating }: AIRecruiterF
)} - {/* LLM Model Selection */} - ( - - AI Model - + + + + + + + Gemini 2.5 Pro + GPT-4.1 + + + + Choose which AI model to use for generating personas + + + + )} + /> + + {/* Number of Personas to Generate */} + ( + + Number of Personas to Generate - - - + - - Gemini 2.5 Pro - GPT-4.1 - - - - Choose which AI model to use for generating personas - - - - )} - /> - - {/* Number of Personas to Generate */} - ( - - Number of Personas to Generate - - - - - How many synthetic users do you need for your research? - - - - )} - /> + + How many synthetic users do you need for your research? + + + + )} + /> +
@@ -147,35 +152,4 @@ const CollapsibleDiscussionGuide: React.FC = ({ ); }; -// Simplified memo comparison function -const CollapsibleDiscussionGuideMemo = React.memo(CollapsibleDiscussionGuide, (prevProps, nextProps) => { - // Check all props to determine if we should re-render - const propsToCompare = ['discussionGuide', 'onSectionSelect', 'onSave', 'focusGroupId', 'isOpen', 'onToggle', 'className']; - - let hasNonModeratorChanges = false; - for (const prop of propsToCompare) { - if (prevProps[prop] !== nextProps[prop]) { - hasNonModeratorChanges = true; - break; - } - } - - // If only moderatorStatus changed, skip re-render - if (prevProps.moderatorStatus !== nextProps.moderatorStatus && !hasNonModeratorChanges) { - return true; // Skip re-render - } - - // If no props changed at all, skip re-render - if (!hasNonModeratorChanges && prevProps.moderatorStatus === nextProps.moderatorStatus) { - return true; // Skip re-render - } - - // Props changed, re-render - console.log('🔄 Will re-render (props changed)', { - changedProps: propsToCompare.filter(prop => prevProps[prop] !== nextProps[prop]), - timestamp: new Date().toISOString() - }); - return false; // Re-render -}); - -export default CollapsibleDiscussionGuideMemo; \ No newline at end of file +export default CollapsibleDiscussionGuide; \ No newline at end of file diff --git a/src/components/focus-group-session/DiscussionGuideEditor.tsx b/src/components/focus-group-session/DiscussionGuideEditor.tsx deleted file mode 100644 index c331a460..00000000 --- a/src/components/focus-group-session/DiscussionGuideEditor.tsx +++ /dev/null @@ -1,954 +0,0 @@ -import React, { useState, useCallback, useEffect, useRef } from 'react'; -import { - GripVertical, - Plus, - Trash2, - Edit3, - Check, - X, - Clock, - MessageCircle, - Activity, - ChevronDown, - ChevronRight, - Save -} from 'lucide-react'; -import { - DndContext, - closestCenter, - closestCorners, - KeyboardSensor, - PointerSensor, - useSensor, - useSensors, - DragEndEvent, -} from '@dnd-kit/core'; -import { - arrayMove, - SortableContext, - sortableKeyboardCoordinates, - verticalListSortingStrategy, -} from '@dnd-kit/sortable'; -import { - useSortable, -} from '@dnd-kit/sortable'; -import { CSS } from '@dnd-kit/utilities'; -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; -import { Textarea } from '@/components/ui/textarea'; -import { Badge } from '@/components/ui/badge'; -import { Card, CardContent, CardHeader } from '@/components/ui/card'; -import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'; -import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; -import { cn } from '@/lib/utils'; - -interface DiscussionGuideItem { - id: string; - type: string; - content: string; - time_limit?: number; - probes?: string[]; - metadata?: Record; -} - -interface DiscussionGuideSection { - id: string; - title: string; - content?: string; - questions?: DiscussionGuideItem[]; - activities?: DiscussionGuideItem[]; - subsections?: any[]; - metadata?: Record; -} - -interface StructuredDiscussionGuide { - title: string; - total_duration: number; - sections: DiscussionGuideSection[]; - metadata?: Record; -} - -interface DiscussionGuideEditorProps { - discussionGuide: StructuredDiscussionGuide; - onChange: (guide: StructuredDiscussionGuide) => void; - onSave: () => void; - onCancel: () => void; -} - -const DiscussionGuideEditor: React.FC = React.memo(({ - discussionGuide, - onChange, - onSave, - onCancel -}) => { - - - const [editingItem, setEditingItem] = useState(null); - const [openSections, setOpenSections] = useState>(new Set()); - - // Drag and drop sensors - const sensors = useSensors( - useSensor(PointerSensor), - useSensor(KeyboardSensor, { - coordinateGetter: sortableKeyboardCoordinates, - }) - ); - - // Track which item is being edited - - // Helper function to update the guide - const updateGuide = useCallback((updater: (guide: StructuredDiscussionGuide) => StructuredDiscussionGuide) => { - const newGuide = updater({ ...discussionGuide }); - onChange(newGuide); - }, [discussionGuide, onChange]); - - // Toggle section open/closed - const toggleSection = (sectionId: string) => { - const newOpenSections = new Set(openSections); - if (newOpenSections.has(sectionId)) { - newOpenSections.delete(sectionId); - } else { - newOpenSections.add(sectionId); - } - setOpenSections(newOpenSections); - }; - - // Update guide title - const updateTitle = (newTitle: string) => { - updateGuide(guide => ({ - ...guide, - title: newTitle - })); - }; - - // Update total duration - const updateTotalDuration = (newDuration: number) => { - updateGuide(guide => ({ - ...guide, - total_duration: newDuration - })); - }; - - // Add new section - const addSection = () => { - const newSection: DiscussionGuideSection = { - id: `section_${Date.now()}`, - title: 'New Section', - questions: [], - activities: [] - }; - - updateGuide(guide => ({ - ...guide, - sections: [...guide.sections, newSection] - })); - }; - - // Update section - const updateSection = useCallback((sectionId: string, updates: Partial) => { - updateGuide(guide => ({ - ...guide, - sections: guide.sections.map(section => - section.id === sectionId ? { ...section, ...updates } : section - ) - })); - }, [updateGuide]); - - // Delete section - const deleteSection = useCallback((sectionId: string) => { - updateGuide(guide => ({ - ...guide, - sections: guide.sections.filter(section => section.id !== sectionId) - })); - }, [updateGuide]); - - // Move section - const moveSection = useCallback((fromIndex: number, toIndex: number) => { - updateGuide(guide => { - const newSections = [...guide.sections]; - const [movedSection] = newSections.splice(fromIndex, 1); - newSections.splice(toIndex, 0, movedSection); - return { ...guide, sections: newSections }; - }); - }, [updateGuide]); - - // Move item within section - const moveItem = useCallback((sectionId: string, itemType: 'question' | 'activity', fromIndex: number, toIndex: number) => { - updateGuide(guide => ({ - ...guide, - sections: guide.sections.map(section => { - if (section.id === sectionId) { - const itemsKey = itemType === 'question' ? 'questions' : 'activities'; - const items = section[itemsKey] || []; - const newItems = arrayMove(items, fromIndex, toIndex); - return { ...section, [itemsKey]: newItems }; - } - return section; - }) - })); - }, [updateGuide]); - - // Handle drag end for all draggable items - const handleDragEnd = useCallback((event: DragEndEvent) => { - const { active, over } = event; - - if (!over || active.id === over.id) { - return; - } - - const activeId = String(active.id); - const overId = String(over.id); - - // Check if dragging sections - if (activeId.startsWith('section-') && overId.startsWith('section-')) { - const oldIndex = discussionGuide.sections.findIndex(section => `section-${section.id}` === activeId); - const newIndex = discussionGuide.sections.findIndex(section => `section-${section.id}` === overId); - - if (oldIndex !== -1 && newIndex !== -1) { - moveSection(oldIndex, newIndex); - } - } - // Check if dragging items within a section - else if (activeId.includes('-item-') && overId.includes('-item-')) { - // Parse IDs to extract section, type, and item info - const activeMatch = activeId.match(/^(.*?)-(question|activity)-item-(.*)$/); - const overMatch = overId.match(/^(.*?)-(question|activity)-item-(.*)$/); - - if (activeMatch && overMatch) { - const [, activeSectionId, activeItemType] = activeMatch; - const [, overSectionId, overItemType] = overMatch; - - // Only allow reordering within the same section and same item type - if (activeSectionId === overSectionId && activeItemType === overItemType) { - const section = discussionGuide.sections.find(s => s.id === activeSectionId); - if (section) { - const itemsKey = activeItemType === 'question' ? 'questions' : 'activities'; - const items = section[itemsKey] || []; - const oldIndex = items.findIndex(item => `${activeSectionId}-${activeItemType}-item-${item.id}` === activeId); - const newIndex = items.findIndex(item => `${overSectionId}-${overItemType}-item-${item.id}` === overId); - - if (oldIndex !== -1 && newIndex !== -1) { - moveItem(activeSectionId, activeItemType as 'question' | 'activity', oldIndex, newIndex); - } - } - } - } - } - }, [discussionGuide.sections, moveSection, moveItem]); - - // Add item to section - const addItem = useCallback((sectionId: string, itemType: 'question' | 'activity') => { - const newItem: DiscussionGuideItem = { - id: `${itemType}_${Date.now()}`, - type: itemType === 'question' ? 'open_question' : 'moderator_statement', - content: `New ${itemType}`, - probes: itemType === 'question' ? [] : undefined - }; - - updateGuide(guide => ({ - ...guide, - sections: guide.sections.map(section => - section.id === sectionId - ? { - ...section, - [itemType === 'question' ? 'questions' : 'activities']: [ - ...(section[itemType === 'question' ? 'questions' : 'activities'] || []), - newItem - ] - } - : section - ) - })); - }, [updateGuide]); - - // Update item - const updateItem = useCallback((sectionId: string, itemId: string, updates: Partial, itemType: 'question' | 'activity') => { - updateGuide(guide => ({ - ...guide, - sections: guide.sections.map(section => - section.id === sectionId - ? { - ...section, - [itemType === 'question' ? 'questions' : 'activities']: section[itemType === 'question' ? 'questions' : 'activities']?.map(item => - item.id === itemId ? { ...item, ...updates } : item - ) - } - : section - ) - })); - }, [updateGuide]); - - // Delete item - const deleteItem = useCallback((sectionId: string, itemId: string, itemType: 'question' | 'activity') => { - updateGuide(guide => ({ - ...guide, - sections: guide.sections.map(section => - section.id === sectionId - ? { - ...section, - [itemType === 'question' ? 'questions' : 'activities']: section[itemType === 'question' ? 'questions' : 'activities']?.filter(item => item.id !== itemId) - } - : section - ) - })); - }, [updateGuide]); - - // Functions to manage editing state - const startEditingItem = useCallback((itemId: string) => { - setEditingItem(itemId); - }, []); - - const stopEditingItem = useCallback(() => { - setEditingItem(null); - }, []); - -// Helper function to check if content is default placeholder text -const isDefaultPlaceholderContent = (content: string, itemType: 'question' | 'activity'): boolean => { - return content === `New ${itemType}`; -}; - -// Sortable Item wrapper -const SortableItem: React.FC<{ - id: string; - item: DiscussionGuideItem; - sectionId: string; - itemType: 'question' | 'activity'; - isEditing: boolean; - initialContent: string; - initialProbes: string; - onStartEdit: () => void; - onSave: (updates: Partial) => void; - onCancel: () => void; - onDelete: () => void; - onUpdateItem: (updates: Partial) => void; -}> = ({ id, item, sectionId, itemType, isEditing, initialContent, initialProbes, onStartEdit, onSave, onCancel, onDelete, onUpdateItem }) => { - const { - attributes, - listeners, - setNodeRef, - transform, - transition, - isDragging, - } = useSortable({ id }); - - const style = { - transform: CSS.Transform.toString(transform), - transition, - opacity: isDragging ? 0.5 : 1, - zIndex: isDragging ? 1000 : 'auto', - cursor: isDragging ? 'grabbing' : 'grab', - }; - - return ( -
- -
- ); -}; - -// EditableItem component - moved outside to prevent re-mounting issues -const EditableItem: React.FC<{ - item: DiscussionGuideItem; - sectionId: string; - itemType: 'question' | 'activity'; - isEditing: boolean; - initialContent: string; - initialProbes: string; - onStartEdit: () => void; - onSave: (updates: Partial) => void; - onCancel: () => void; - onDelete: () => void; - onUpdateItem: (updates: Partial) => void; - dragHandleProps?: Record; -}> = React.memo(({ - item, - sectionId, - itemType, - isEditing, - initialContent, - initialProbes, - onStartEdit, - onSave, - onCancel, - onDelete, - onUpdateItem, - dragHandleProps -}) => { - // Local state for editing to prevent parent re-renders - const [localEditContent, setLocalEditContent] = useState(initialContent); - const [localEditProbes, setLocalEditProbes] = useState(initialProbes); - const textareaRef = useRef(null); - - // Check if this is a default placeholder item - const isPlaceholder = isDefaultPlaceholderContent(initialContent, itemType); - - // Update local state when editing starts - useEffect(() => { - if (isEditing) { - // If this is a placeholder item, start with empty content so user can type immediately - setLocalEditContent(isPlaceholder ? '' : initialContent); - setLocalEditProbes(initialProbes); - // Focus the textarea when editing starts - setTimeout(() => { - textareaRef.current?.focus(); - }, 0); - } - }, [isEditing, initialContent, initialProbes, isPlaceholder]); - const handleSave = () => { - const updates = { - content: localEditContent, - probes: localEditProbes.trim() ? localEditProbes.split('\n').filter(p => p.trim()) : undefined - }; - onSave(updates); - }; - - const handleCancel = () => { - onCancel(); - }; - - return ( - - -
-
- -
- -
-
- - {itemType === 'activity' ? ( - <> - - {item.type.replace('_', ' ')} - - ) : ( - <> - - {item.type.replace('_', ' ')} - - )} - - - - - {item.time_limit && ( -
- - onUpdateItem({ time_limit: parseInt(e.target.value) })} - className="w-16 h-6 text-xs" - /> - min -
- )} -
- - {isEditing ? ( -
-