diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a25d1bc..5677a32 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.15.0" + ".": "1.16.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 09434cf..91699b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.16.0](https://github.com/PMDevSolutions/Claudius/compare/v1.15.0...v1.16.0) (2026-09-19) + + +### Features + +* **scripts:** voice option in client config schema, validation, and snippets ([ec59fc1](https://github.com/PMDevSolutions/Claudius/commit/ec59fc18eddaaab86f06ec911f7e423e30c5b581)), closes [#54](https://github.com/PMDevSolutions/Claudius/issues/54) +* **widget:** voice input and text-to-speech playback ([9f8484b](https://github.com/PMDevSolutions/Claudius/commit/9f8484bfce47dd8259c1b06bf2bed57f112c11cf)) +* **widget:** voice input and text-to-speech playback ([f7233ae](https://github.com/PMDevSolutions/Claudius/commit/f7233ae3100a9691d9e54b873b5d963ea8b3d44c)), closes [#54](https://github.com/PMDevSolutions/Claudius/issues/54) + ## [1.15.0](https://github.com/PMDevSolutions/Claudius/compare/v1.14.0...v1.15.0) (2026-09-01) diff --git a/cdn/claudius.css b/cdn/claudius.css index d31cdba..5a5d38e 100644 --- a/cdn/claudius.css +++ b/cdn/claudius.css @@ -1 +1 @@ -*,: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:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";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}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.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}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-right-1{right:-.25rem}.-right-1\.5{right:-.375rem}.-top-1{top:-.25rem}.-top-1\.5{top:-.375rem}.bottom-0{bottom:0}.bottom-20{bottom:5rem}.bottom-24{bottom:6rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-1{right:.25rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-1{top:.25rem}.top-20{top:5rem}.top-24{top:6rem}.top-6{top:1.5rem}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-1{height:.25rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[90vh\]{height:90vh}.h-\[min\(500px\,calc\(100vh-7rem\)\)\]{height:min(500px,calc(100vh - 7rem))}.h-full{height:100%}.max-h-48{max-height:12rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[280px\]{width:280px}.w-\[calc\(100vw-1\.5rem\)\]{width:calc(100vw - 1.5rem)}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-4{min-width:1rem}.max-w-\[220px\]{max-width:220px}.max-w-\[380px\]{max-width:380px}.max-w-\[85\%\]{max-width:85%}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.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))}.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))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.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}.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-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))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-claudius-bubble{border-radius:var(--claudius-radius-bubble, var(--cl-radius-lg, 16px))}.rounded-claudius-full{border-radius:var(--cl-radius-full, 9999px)}.rounded-claudius-lg{border-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-claudius-md{border-radius:var(--claudius-radius-button, var(--cl-radius-md, 12px))}.rounded-claudius-sm{border-radius:var(--cl-radius-sm, 8px)}.rounded-r-claudius-lg{border-top-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px));border-bottom-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-t-claudius-lg{border-top-left-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px));border-top-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-bl-claudius-tail{border-bottom-left-radius:var(--cl-radius-tail, 2px)}.rounded-br-claudius-tail{border-bottom-right-radius:var(--cl-radius-tail, 2px)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-claudius-border{border-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.bg-claudius-accent{background-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.bg-claudius-accent-soft{background-color:var(--cl-color-accent-soft, rgb(255 255 255 / .2))}.bg-claudius-assistant-bubble{background-color:var(--claudius-assistant-bg, var(--cl-color-assistant-bubble, var(--cl-color-surface-muted, #f1f5f9)))}.bg-claudius-border{background-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.bg-claudius-error{background-color:var(--claudius-error, var(--cl-color-error, #dc2626))}.bg-claudius-error-surface{background-color:var(--claudius-error-bg, var(--cl-color-error-surface, #fef2f2))}.bg-claudius-field{background-color:var(--cl-color-field, #ffffff)}.bg-claudius-scrim{background-color:var(--cl-color-scrim, rgb(0 0 0 / .5))}.bg-claudius-surface{background-color:var(--cl-color-surface, #ffffff)}.bg-claudius-surface-muted{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.bg-claudius-text{background-color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.bg-claudius-text-muted{background-color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.bg-claudius-user-bubble{background-color:var(--claudius-user-bg, var(--cl-color-user-bubble, var(--cl-color-accent, #2563eb)))}.bg-transparent{background-color:transparent}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.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}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pr-8{padding-right:2rem}.pt-1{padding-top:.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-body{font-family:var(--claudius-font-body, var(--cl-font-body, system-ui)),sans-serif}.font-heading{font-family:var(--claudius-font-heading, var(--cl-font-heading, system-ui)),sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-\[10px\]{font-size:10px}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.text-claudius-accent{color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.text-claudius-accent-text{color:var(--cl-color-accent-text, #ffffff)}.text-claudius-accent-text-muted{color:var(--cl-color-accent-text-muted, rgb(255 255 255 / .7))}.text-claudius-assistant-bubble-text{color:var(--claudius-assistant-text, var(--cl-color-assistant-bubble-text, var(--cl-color-text, #1e293b)))}.text-claudius-error{color:var(--claudius-error, var(--cl-color-error, #dc2626))}.text-claudius-error-text{color:var(--cl-color-error-text, #ffffff)}.text-claudius-link{color:var(--cl-color-link, currentColor)}.text-claudius-surface{color:var(--cl-color-surface, #ffffff)}.text-claudius-text{color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.text-claudius-text-muted{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.text-claudius-user-bubble-text{color:var(--claudius-user-text, var(--cl-color-user-bubble-text, #ffffff))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-70{opacity:.7}.shadow-claudius-elevated{--tw-shadow: var(--cl-shadow-elevated, 0 25px 50px -12px rgb(0 0 0 / .25));--tw-shadow-colored: 0 25px 50px -12px 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-claudius-floating{--tw-shadow: var(--cl-shadow-floating, 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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.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-inset{--tw-ring-inset: inset}.ring-claudius-accent{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.ring-claudius-border{--tw-ring-color: var(--claudius-border, var(--cl-color-border, #e2e8f0))}.sepia{--tw-sepia: sepia(100%);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)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;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-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[animation-delay\:0ms\]{animation-delay:0ms}.\[animation-delay\:150ms\]{animation-delay:.15s}.\[animation-delay\:300ms\]{animation-delay:.3s}[data-claudius-dark=true]{--cl-color-accent: var(--cl-color-accent-dark, #2563eb);--cl-color-accent-text: var(--cl-color-accent-text-dark, #ffffff);--cl-color-accent-soft: var( --cl-color-accent-soft-dark, rgb(255 255 255 / .2) );--cl-color-accent-text-muted: var( --cl-color-accent-text-muted-dark, rgb(255 255 255 / .7) );--cl-color-surface: var(--cl-color-surface-dark, #111827);--cl-color-surface-muted: var(--cl-color-surface-muted-dark, #1f2937);--cl-color-text: var(--cl-color-text-dark, #f3f4f6);--cl-color-text-muted: var(--cl-color-text-muted-dark, #9ca3af);--cl-color-border: var(--cl-color-border-dark, #374151);--cl-color-user-bubble: var( --cl-color-user-bubble-dark, var(--cl-color-accent) );--cl-color-user-bubble-text: var(--cl-color-user-bubble-text-dark, #ffffff);--cl-color-assistant-bubble: var( --cl-color-assistant-bubble-dark, var(--cl-color-surface-muted) );--cl-color-assistant-bubble-text: var( --cl-color-assistant-bubble-text-dark, #e5e7eb );--cl-color-field: var(--cl-color-field-dark, #1f2937);--cl-color-error: var(--cl-color-error-dark, #f87171);--cl-color-error-surface: var( --cl-color-error-surface-dark, rgb(127 29 29 / .3) );--cl-color-error-text: var(--cl-color-error-text-dark, #ffffff);--cl-color-link: var(--cl-color-link-dark, #60a5fa);--cl-color-scrim: var(--cl-color-scrim-dark, rgb(0 0 0 / .5))}.claudius-bottom-sheet{transition:transform .3s cubic-bezier(.32,.72,0,1)}.claudius-bottom-sheet[data-dragging=true]{transition:none}.claudius-scrim{transition:opacity .3s ease}@media(prefers-reduced-motion:reduce){.claudius-bottom-sheet{transition:opacity .2s ease;transform:none!important}.claudius-scrim{transition:opacity .15s ease}}.placeholder\:text-claudius-text-muted::-moz-placeholder{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.placeholder\:text-claudius-text-muted::placeholder{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;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\:bg-claudius-accent-soft:hover{background-color:var(--cl-color-accent-soft, rgb(255 255 255 / .2))}.hover\:bg-claudius-border:hover{background-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.hover\:bg-claudius-surface-muted:hover{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.hover\:text-claudius-accent-text:hover{color:var(--cl-color-accent-text, #ffffff)}.hover\:text-claudius-text:hover{color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-claudius-floating-hover:hover{--tw-shadow: var(--cl-shadow-floating-hover, 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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-claudius-accent:focus{border-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\: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)}.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-claudius-accent:focus{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.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-claudius-accent:focus-visible{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus-visible\:ring-claudius-error:focus-visible{--tw-ring-color: var(--claudius-error, var(--cl-color-error, #dc2626))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:opacity-100:hover:disabled{opacity:1}@media(prefers-reduced-motion:no-preference){@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.motion-safe\:animate-bounce{animation:bounce 1s infinite}}@media(min-width:640px){.sm\:left-6{left:1.5rem}.sm\:right-6{right:1.5rem}.sm\:max-w-\[400px\]{max-width:400px}}@media(min-width:768px){.md\:max-w-\[440px\]{max-width:440px}} +*,: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:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";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}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.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}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.-right-1{right:-.25rem}.-right-1\.5{right:-.375rem}.-top-1{top:-.25rem}.-top-1\.5{top:-.375rem}.bottom-0{bottom:0}.bottom-20{bottom:5rem}.bottom-24{bottom:6rem}.bottom-6{bottom:1.5rem}.left-0{left:0}.left-3{left:.75rem}.left-4{left:1rem}.left-6{left:1.5rem}.right-1{right:.25rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-20{top:5rem}.top-24{top:6rem}.top-6{top:1.5rem}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.ml-auto{margin-left:auto}.mr-auto{margin-right:auto}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.block{display:block}.inline-block{display:inline-block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-1{height:.25rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[90vh\]{height:90vh}.h-\[min\(500px\,calc\(100vh-7rem\)\)\]{height:min(500px,calc(100vh - 7rem))}.h-full{height:100%}.max-h-48{max-height:12rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-2{width:.5rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-8{width:2rem}.w-\[280px\]{width:280px}.w-\[calc\(100vw-1\.5rem\)\]{width:calc(100vw - 1.5rem)}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-4{min-width:1rem}.max-w-\[220px\]{max-width:220px}.max-w-\[380px\]{max-width:380px}.max-w-\[85\%\]{max-width:85%}.max-w-\[90\%\]{max-width:90%}.max-w-full{max-width:100%}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.-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))}.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))}.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))}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.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-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))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-claudius-bubble{border-radius:var(--claudius-radius-bubble, var(--cl-radius-lg, 16px))}.rounded-claudius-full{border-radius:var(--cl-radius-full, 9999px)}.rounded-claudius-lg{border-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-claudius-md{border-radius:var(--claudius-radius-button, var(--cl-radius-md, 12px))}.rounded-claudius-sm{border-radius:var(--cl-radius-sm, 8px)}.rounded-r-claudius-lg{border-top-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px));border-bottom-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-t-claudius-lg{border-top-left-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px));border-top-right-radius:var(--claudius-radius-card, var(--cl-radius-lg, 16px))}.rounded-bl-claudius-tail{border-bottom-left-radius:var(--cl-radius-tail, 2px)}.rounded-br-claudius-tail{border-bottom-right-radius:var(--cl-radius-tail, 2px)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-r-2{border-right-width:2px}.border-t{border-top-width:1px}.border-claudius-accent{border-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.border-claudius-border{border-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.bg-claudius-accent{background-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.bg-claudius-accent-soft{background-color:var(--cl-color-accent-soft, rgb(255 255 255 / .2))}.bg-claudius-assistant-bubble{background-color:var(--claudius-assistant-bg, var(--cl-color-assistant-bubble, var(--cl-color-surface-muted, #f1f5f9)))}.bg-claudius-border{background-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.bg-claudius-error{background-color:var(--claudius-error, var(--cl-color-error, #dc2626))}.bg-claudius-error-surface{background-color:var(--claudius-error-bg, var(--cl-color-error-surface, #fef2f2))}.bg-claudius-field{background-color:var(--cl-color-field, #ffffff)}.bg-claudius-scrim{background-color:var(--cl-color-scrim, rgb(0 0 0 / .5))}.bg-claudius-surface{background-color:var(--cl-color-surface, #ffffff)}.bg-claudius-surface-muted{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.bg-claudius-text{background-color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.bg-claudius-text-muted{background-color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.bg-claudius-user-bubble{background-color:var(--claudius-user-bg, var(--cl-color-user-bubble, var(--cl-color-accent, #2563eb)))}.bg-transparent{background-color:transparent}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.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}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.pl-3{padding-left:.75rem}.pr-10{padding-right:2.5rem}.pr-3{padding-right:.75rem}.pr-8{padding-right:2rem}.pt-1{padding-top:.25rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-body{font-family:var(--claudius-font-body, var(--cl-font-body, system-ui)),sans-serif}.font-heading{font-family:var(--claudius-font-heading, var(--cl-font-heading, system-ui)),sans-serif}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-\[10px\]{font-size:10px}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.tracking-wide{letter-spacing:.025em}.text-claudius-accent{color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.text-claudius-accent-text{color:var(--cl-color-accent-text, #ffffff)}.text-claudius-accent-text-muted{color:var(--cl-color-accent-text-muted, rgb(255 255 255 / .7))}.text-claudius-assistant-bubble-text{color:var(--claudius-assistant-text, var(--cl-color-assistant-bubble-text, var(--cl-color-text, #1e293b)))}.text-claudius-error{color:var(--claudius-error, var(--cl-color-error, #dc2626))}.text-claudius-error-text{color:var(--cl-color-error-text, #ffffff)}.text-claudius-link{color:var(--cl-color-link, currentColor)}.text-claudius-surface{color:var(--cl-color-surface, #ffffff)}.text-claudius-text{color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.text-claudius-text-muted{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.text-claudius-user-bubble-text{color:var(--claudius-user-text, var(--cl-color-user-bubble-text, #ffffff))}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.opacity-70{opacity:.7}.shadow-claudius-elevated{--tw-shadow: var(--cl-shadow-elevated, 0 25px 50px -12px rgb(0 0 0 / .25));--tw-shadow-colored: 0 25px 50px -12px 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-claudius-floating{--tw-shadow: var(--cl-shadow-floating, 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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.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-inset{--tw-ring-inset: inset}.ring-claudius-accent{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.ring-claudius-border{--tw-ring-color: var(--claudius-border, var(--cl-color-border, #e2e8f0))}.blur{--tw-blur: blur(8px);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)}.sepia{--tw-sepia: sepia(100%);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)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;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-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.\[animation-delay\:0ms\]{animation-delay:0ms}.\[animation-delay\:150ms\]{animation-delay:.15s}.\[animation-delay\:300ms\]{animation-delay:.3s}[data-claudius-dark=true]{--cl-color-accent: var(--cl-color-accent-dark, #2563eb);--cl-color-accent-text: var(--cl-color-accent-text-dark, #ffffff);--cl-color-accent-soft: var( --cl-color-accent-soft-dark, rgb(255 255 255 / .2) );--cl-color-accent-text-muted: var( --cl-color-accent-text-muted-dark, rgb(255 255 255 / .7) );--cl-color-surface: var(--cl-color-surface-dark, #111827);--cl-color-surface-muted: var(--cl-color-surface-muted-dark, #1f2937);--cl-color-text: var(--cl-color-text-dark, #f3f4f6);--cl-color-text-muted: var(--cl-color-text-muted-dark, #9ca3af);--cl-color-border: var(--cl-color-border-dark, #374151);--cl-color-user-bubble: var( --cl-color-user-bubble-dark, var(--cl-color-accent) );--cl-color-user-bubble-text: var(--cl-color-user-bubble-text-dark, #ffffff);--cl-color-assistant-bubble: var( --cl-color-assistant-bubble-dark, var(--cl-color-surface-muted) );--cl-color-assistant-bubble-text: var( --cl-color-assistant-bubble-text-dark, #e5e7eb );--cl-color-field: var(--cl-color-field-dark, #1f2937);--cl-color-error: var(--cl-color-error-dark, #f87171);--cl-color-error-surface: var( --cl-color-error-surface-dark, rgb(127 29 29 / .3) );--cl-color-error-text: var(--cl-color-error-text-dark, #ffffff);--cl-color-link: var(--cl-color-link-dark, #60a5fa);--cl-color-scrim: var(--cl-color-scrim-dark, rgb(0 0 0 / .5))}.claudius-bottom-sheet{transition:transform .3s cubic-bezier(.32,.72,0,1)}.claudius-bottom-sheet[data-dragging=true]{transition:none}.claudius-scrim{transition:opacity .3s ease}.claudius-voice-level>span{width:3px;height:100%;border-radius:9999px;background:currentColor;opacity:.5;transform:scaleY(.25);animation:claudius-voice-idle 1.2s ease-in-out infinite}.claudius-voice-level[data-claudius-voice-level=active]>span{opacity:1;animation:claudius-voice-active .6s ease-in-out infinite}.claudius-voice-level>span:nth-child(2){animation-delay:-.45s}.claudius-voice-level>span:nth-child(3){animation-delay:-.2s}.claudius-voice-level>span:nth-child(4){animation-delay:-.65s}@keyframes claudius-voice-idle{0%,to{transform:scaleY(.25)}50%{transform:scaleY(.4)}}@keyframes claudius-voice-active{0%,to{transform:scaleY(.3)}50%{transform:scaleY(1)}}@media(prefers-reduced-motion:reduce){.claudius-bottom-sheet{transition:opacity .2s ease;transform:none!important}.claudius-scrim{transition:opacity .15s ease}.claudius-voice-level>span,.claudius-voice-level[data-claudius-voice-level=active]>span{animation:none;transform:scaleY(.6)}}.placeholder\:text-claudius-text-muted::-moz-placeholder{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.placeholder\:text-claudius-text-muted::placeholder{color:var(--claudius-gray, var(--cl-color-text-muted, #64748b))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;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\:bg-claudius-accent-soft:hover{background-color:var(--cl-color-accent-soft, rgb(255 255 255 / .2))}.hover\:bg-claudius-border:hover{background-color:var(--claudius-border, var(--cl-color-border, #e2e8f0))}.hover\:bg-claudius-surface-muted:hover{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.hover\:text-claudius-accent-text:hover{color:var(--cl-color-accent-text, #ffffff)}.hover\:text-claudius-text:hover{color:var(--claudius-dark, var(--cl-color-text, #1e293b))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-90:hover{opacity:.9}.hover\:shadow-claudius-floating-hover:hover{--tw-shadow: var(--cl-shadow-floating-hover, 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);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.focus\:border-claudius-accent:focus{border-color:var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\: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)}.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-claudius-accent:focus{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.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-claudius-accent:focus-visible{--tw-ring-color: var(--claudius-primary, var(--cl-color-accent, #2563eb))}.focus-visible\:ring-claudius-error:focus-visible{--tw-ring-color: var(--claudius-error, var(--cl-color-error, #dc2626))}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width: 1px}.disabled\:cursor-default:disabled{cursor:default}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:opacity-100:hover:disabled{opacity:1}@media(prefers-reduced-motion:no-preference){@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.motion-safe\:animate-bounce{animation:bounce 1s infinite}}@media(min-width:640px){.sm\:left-6{left:1.5rem}.sm\:right-6{right:1.5rem}.sm\:max-w-\[400px\]{max-width:400px}}@media(min-width:768px){.md\:max-w-\[440px\]{max-width:440px}} diff --git a/cdn/claudius.iife.js b/cdn/claudius.iife.js index ca5bc59..6f8cbaa 100644 --- a/cdn/claudius.iife.js +++ b/cdn/claudius.iife.js @@ -1,4 +1,4 @@ -var Claudius=(function(jt){"use strict";var Fp=Object.defineProperty;var Up=(jt,pt,St)=>pt in jt?Fp(jt,pt,{enumerable:!0,configurable:!0,writable:!0,value:St}):jt[pt]=St;var un=(jt,pt,St)=>Up(jt,typeof pt!="symbol"?pt+"":pt,St);var pt={exports:{}},St={},Wl={exports:{}},le={};/** +var Claudius=(function(Mt){"use strict";var rh=Object.defineProperty;var lh=(Mt,gt,Ct)=>gt in Mt?rh(Mt,gt,{enumerable:!0,configurable:!0,writable:!0,value:Ct}):Mt[gt]=Ct;var un=(Mt,gt,Ct)=>lh(Mt,typeof gt!="symbol"?gt+"":gt,Ct);var gt={exports:{}},Ct={},Gl={exports:{}},ce={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var Claudius=(function(jt){"use strict";var Fp=Object.defineProperty;var Up=(jt, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Go;function fc(){if(Go)return le;Go=1;var s=Symbol.for("react.element"),c=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),k=Symbol.for("react.provider"),x=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),M=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),H=Symbol.iterator;function te(f){return f===null||typeof f!="object"?null:(f=H&&f[H]||f["@@iterator"],typeof f=="function"?f:null)}var ie={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},oe=Object.assign,O={};function Y(f,S,B){this.props=f,this.context=S,this.refs=O,this.updater=B||ie}Y.prototype.isReactComponent={},Y.prototype.setState=function(f,S){if(typeof f!="object"&&typeof f!="function"&&f!=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,f,S,"setState")},Y.prototype.forceUpdate=function(f){this.updater.enqueueForceUpdate(this,f,"forceUpdate")};function se(){}se.prototype=Y.prototype;function ae(f,S,B){this.props=f,this.context=S,this.refs=O,this.updater=B||ie}var ue=ae.prototype=new se;ue.constructor=ae,oe(ue,Y.prototype),ue.isPureReactComponent=!0;var X=Array.isArray,b=Object.prototype.hasOwnProperty,he={current:null},ge={key:!0,ref:!0,__self:!0,__source:!0};function ne(f,S,B){var J,re={},ee=null,I=null;if(S!=null)for(J in S.ref!==void 0&&(I=S.ref),S.key!==void 0&&(ee=""+S.key),S)b.call(S,J)&&!ge.hasOwnProperty(J)&&(re[J]=S[J]);var K=arguments.length-2;if(K===1)re.children=B;else if(1>>1,S=L[f];if(0>>1;fg(re,C))eeg(I,re)?(L[f]=I,L[ee]=C,f=ee):(L[f]=re,L[J]=C,f=J);else if(eeg(I,C))L[f]=I,L[ee]=C,f=ee;else break e}}return V}function g(L,V){var C=L.sortIndex-V.sortIndex;return C!==0?C:L.id-V.id}if(typeof performance=="object"&&typeof performance.now=="function"){var k=performance;s.unstable_now=function(){return k.now()}}else{var x=Date,E=x.now();s.unstable_now=function(){return x.now()-E}}var T=[],M=[],W=1,H=null,te=3,ie=!1,oe=!1,O=!1,Y=typeof setTimeout=="function"?setTimeout:null,se=typeof clearTimeout=="function"?clearTimeout:null,ae=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function ue(L){for(var V=u(M);V!==null;){if(V.callback===null)h(M);else if(V.startTime<=L)h(M),V.sortIndex=V.expirationTime,c(T,V);else break;V=u(M)}}function X(L){if(O=!1,ue(L),!oe)if(u(T)!==null)oe=!0,Me(b);else{var V=u(M);V!==null&&me(X,V.startTime-L)}}function b(L,V){oe=!1,O&&(O=!1,se(ne),ne=-1),ie=!0;var C=te;try{for(ue(V),H=u(T);H!==null&&(!(H.expirationTime>V)||L&&!Se());){var f=H.callback;if(typeof f=="function"){H.callback=null,te=H.priorityLevel;var S=f(H.expirationTime<=V);V=s.unstable_now(),typeof S=="function"?H.callback=S:H===u(T)&&h(T),ue(V)}else h(T);H=u(T)}if(H!==null)var B=!0;else{var J=u(M);J!==null&&me(X,J.startTime-V),B=!1}return B}finally{H=null,te=C,ie=!1}}var he=!1,ge=null,ne=-1,Le=5,de=-1;function Se(){return!(s.unstable_now()-deL||125f?(L.sortIndex=C,c(M,L),u(T)===null&&L===u(M)&&(O?(se(ne),ne=-1):O=!0,me(X,C-f))):(L.sortIndex=S,c(T,L),oe||ie||(oe=!0,Me(b))),L},s.unstable_shouldYield=Se,s.unstable_wrapCallback=function(L){var V=te;return function(){var C=te;te=V;try{return L.apply(this,arguments)}finally{te=C}}}})(Gl)),Gl}var Jo;function mc(){return Jo||(Jo=1,Kl.exports=hc()),Kl.exports}/** + */var bi;function Sc(){return bi||(bi=1,(function(s){function a(P,Y){var T=P.length;P.push(Y);e:for(;0>>1,k=P[m];if(0>>1;mh(ae,T))ueh(B,ae)?(P[m]=B,P[ue]=T,m=ue):(P[m]=ae,P[Z]=T,m=Z);else if(ueh(B,T))P[m]=B,P[ue]=T,m=ue;else break e}}return Y}function h(P,Y){var T=P.sortIndex-Y.sortIndex;return T!==0?T:P.id-Y.id}if(typeof performance=="object"&&typeof performance.now=="function"){var y=performance;s.unstable_now=function(){return y.now()}}else{var v=Date,E=v.now();s.unstable_now=function(){return v.now()-E}}var C=[],R=[],A=1,$=null,q=3,G=!1,D=!1,z=!1,I=typeof setTimeout=="function"?setTimeout:null,pe=typeof clearTimeout=="function"?clearTimeout:null,se=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function le(P){for(var Y=u(R);Y!==null;){if(Y.callback===null)d(R);else if(Y.startTime<=P)d(R),Y.sortIndex=Y.expirationTime,a(C,Y);else break;Y=u(R)}}function Q(P){if(z=!1,le(P),!D)if(u(C)!==null)D=!0,Re(ie);else{var Y=u(R);Y!==null&&W(Q,Y.startTime-P)}}function ie(P,Y){D=!1,z&&(z=!1,pe(J),J=-1),G=!0;var T=q;try{for(le(Y),$=u(C);$!==null&&(!($.expirationTime>Y)||P&&!we());){var m=$.callback;if(typeof m=="function"){$.callback=null,q=$.priorityLevel;var k=m($.expirationTime<=Y);Y=s.unstable_now(),typeof k=="function"?$.callback=k:$===u(C)&&d(C),le(Y)}else d(C);$=u(C)}if($!==null)var te=!0;else{var Z=u(R);Z!==null&&W(Q,Z.startTime-Y),te=!1}return te}finally{$=null,q=T,G=!1}}var re=!1,de=null,J=-1,Te=5,ye=-1;function we(){return!(s.unstable_now()-yeP||125m?(P.sortIndex=T,a(R,P),u(C)===null&&P===u(R)&&(z?(pe(J),J=-1):z=!0,W(Q,T-m))):(P.sortIndex=k,a(C,P),D||G||(D=!0,Re(ie))),P},s.unstable_shouldYield=we,s.unstable_wrapCallback=function(P){var Y=q;return function(){var T=q;q=Y;try{return P.apply(this,arguments)}finally{q=T}}}})(Zl)),Zl}var eu;function kc(){return eu||(eu=1,ql.exports=Sc()),ql.exports}/** * @license React * react-dom.production.min.js * @@ -30,17 +30,18 @@ var Claudius=(function(jt){"use strict";var Fp=Object.defineProperty;var Up=(jt, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var bo;function gc(){if(bo)return Xe;bo=1;var s=$l(),c=mc();function u(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"),T=Object.prototype.hasOwnProperty,M=/^[: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]*$/,W={},H={};function te(e){return T.call(H,e)?!0:T.call(W,e)?!1:M.test(e)?H[e]=!0:(W[e]=!0,!1)}function ie(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 oe(e,t,n,r){if(t===null||typeof t>"u"||ie(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 O(e,t,n,r,l,i,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=o}var Y={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Y[e]=new O(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Y[t]=new O(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){Y[e]=new O(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Y[e]=new O(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){Y[e]=new O(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){Y[e]=new O(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){Y[e]=new O(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){Y[e]=new O(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){Y[e]=new O(e,5,!1,e.toLowerCase(),null,!1,!1)});var se=/[\-:]([a-z])/g;function ae(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(se,ae);Y[t]=new O(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(se,ae);Y[t]=new O(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(se,ae);Y[t]=new O(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){Y[e]=new O(e,1,!1,e.toLowerCase(),null,!1,!1)}),Y.xlinkHref=new O("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){Y[e]=new O(e,1,!1,e.toLowerCase(),null,!0,!0)});function ue(e,t,n,r){var l=Y.hasOwnProperty(t)?Y[t]:null;(l!==null?l.type!==0:r||!(2a||l[o]!==i[a]){var d=` -`+l[o].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=o&&0<=a);break}}}finally{B=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?S(e):""}function re(e){switch(e.tag){case 5:return S(e.type);case 16:return S("Lazy");case 13:return S("Suspense");case 19:return S("SuspenseList");case 0:case 2:case 15:return e=J(e.type,!1),e;case 11:return e=J(e.type.render,!1),e;case 1:return e=J(e.type,!0),e;default:return""}}function ee(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 ge:return"Fragment";case he:return"Portal";case Le:return"Profiler";case ne:return"StrictMode";case q:return"Suspense";case Re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Se:return(e.displayName||"Context")+".Consumer";case de:return(e._context.displayName||"Context")+".Provider";case ke:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ze:return t=e.displayName||null,t!==null?t:ee(e.type)||"Memo";case Me:t=e._payload,e=e._init;try{return ee(e(t))}catch{}}return null}function I(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 ee(t);case 8:return t===ne?"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 K(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function G(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ye(e){var t=G(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 l=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.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 Ze(e){e._valueTracker||(e._valueTracker=ye(e))}function kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=G(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ft(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 Et(e,t){var n=t.checked;return C({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Ke(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=K(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 De(e,t){t=t.checked,t!=null&&ue(e,"checked",t,!1)}function Ut(e,t){De(e,t);var n=K(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")?ti(e,t.type,n):t.hasOwnProperty("defaultValue")&&ti(e,t.type,K(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Bt(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 ti(e,t,n){(t!=="number"||Ft(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Gn=Array.isArray;function Sn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Or.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Yn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Xn={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},Vf=["Webkit","ms","Moz","O"];Object.keys(Xn).forEach(function(e){Vf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Xn[t]=Xn[e]})});function Nu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Xn.hasOwnProperty(e)&&Xn[e]?(""+t).trim():t+"px"}function Ru(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Nu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var Wf=C({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 li(e,t){if(t){if(Wf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(u(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(u(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(u(61))}if(t.style!=null&&typeof t.style!="object")throw Error(u(62))}}function ii(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 oi=null;function ui(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var si=null,kn=null,En=null;function _u(e){if(e=vr(e)){if(typeof si!="function")throw Error(u(280));var t=e.stateNode;t&&(t=ll(t),si(e.stateNode,e.type,t))}}function ju(e){kn?En?En.push(e):En=[e]:kn=e}function Lu(){if(kn){var e=kn,t=En;if(En=kn=null,_u(e),t)for(e=0;e>>=0,e===0?32:31-(ed(e)/td|0)|0}var Br=64,Hr=4194304;function bn(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 Vr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,i=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~l;a!==0?r=bn(a):(i&=o,i!==0&&(r=bn(i)))}else o=n&~l,o!==0?r=bn(o):i!==0&&(r=bn(i));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,i=t&-t,l>=i||l===16&&(i&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function er(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ht(t),e[t]=n}function id(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=sr),ls=" ",is=!1;function os(e,t){switch(e){case"keyup":return zd.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function us(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Nn=!1;function Od(e,t){switch(e){case"compositionend":return us(t);case"keypress":return t.which!==32?null:(is=!0,ls);case"textInput":return e=t.data,e===ls&&is?null:e;default:return null}}function Ad(e,t){if(Nn)return e==="compositionend"||!Ni&&os(e,t)?(e=Ju(),Gr=xi=Qt=null,Nn=!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=hs(n)}}function gs(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?gs(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function vs(){for(var e=window,t=Ft();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ft(e.document)}return t}function ji(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 Qd(e){var t=vs(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&gs(n.ownerDocument.documentElement,n)){if(r!==null&&ji(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 l=n.textContent.length,i=Math.min(r.start,l);r=r.end===void 0?i:Math.min(r.end,l),!e.extend&&i>r&&(l=r,r=i,i=l),l=ms(n,i);var o=ms(n,r);l&&o&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(l.node,l.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,Rn=null,Li=null,dr=null,Mi=!1;function ys(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Mi||Rn==null||Rn!==Ft(r)||(r=Rn,"selectionStart"in r&&ji(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}),dr&&fr(dr,r)||(dr=r,r=tl(Li,"onSelect"),0Pn||(e.current=Wi[Pn],Wi[Pn]=null,Pn--)}function ve(e,t){Pn++,Wi[Pn]=e.current,e.current=t}var Xt={},Ve=Yt(Xt),Je=Yt(!1),cn=Xt;function zn(e,t){var n=e.type.contextTypes;if(!n)return Xt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},i;for(i in n)l[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function be(e){return e=e.childContextTypes,e!=null}function il(){xe(Je),xe(Ve)}function zs(e,t,n){if(Ve.current!==Xt)throw Error(u(168));ve(Ve,t),ve(Je,n)}function Ds(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(u(108,I(e)||"Unknown",l));return C({},n,r)}function ol(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xt,cn=Ve.current,ve(Ve,e),ve(Je,Je.current),!0}function Os(e,t,n){var r=e.stateNode;if(!r)throw Error(u(169));n?(e=Ds(e,t,cn),r.__reactInternalMemoizedMergedChildContext=e,xe(Je),xe(Ve),ve(Ve,e)):xe(Je),ve(Je,n)}var Mt=null,ul=!1,$i=!1;function As(e){Mt===null?Mt=[e]:Mt.push(e)}function rp(e){ul=!0,As(e)}function qt(){if(!$i&&Mt!==null){$i=!0;var e=0,t=pe;try{var n=Mt;for(pe=1;e>=o,l-=o,Pt=1<<32-ht(t)+l|n<Z?(Ue=Q,Q=null):Ue=Q.sibling;var fe=N(m,Q,v[Z],j);if(fe===null){Q===null&&(Q=Ue);break}e&&Q&&fe.alternate===null&&t(m,Q),p=i(fe,p,Z),$===null?U=fe:$.sibling=fe,$=fe,Q=Ue}if(Z===v.length)return n(m,Q),Ee&&dn(m,Z),U;if(Q===null){for(;ZZ?(Ue=Q,Q=null):Ue=Q.sibling;var on=N(m,Q,fe.value,j);if(on===null){Q===null&&(Q=Ue);break}e&&Q&&on.alternate===null&&t(m,Q),p=i(on,p,Z),$===null?U=on:$.sibling=on,$=on,Q=Ue}if(fe.done)return n(m,Q),Ee&&dn(m,Z),U;if(Q===null){for(;!fe.done;Z++,fe=v.next())fe=_(m,fe.value,j),fe!==null&&(p=i(fe,p,Z),$===null?U=fe:$.sibling=fe,$=fe);return Ee&&dn(m,Z),U}for(Q=r(m,Q);!fe.done;Z++,fe=v.next())fe=z(Q,m,Z,fe.value,j),fe!==null&&(e&&fe.alternate!==null&&Q.delete(fe.key===null?Z:fe.key),p=i(fe,p,Z),$===null?U=fe:$.sibling=fe,$=fe);return e&&Q.forEach(function(Ip){return t(m,Ip)}),Ee&&dn(m,Z),U}function je(m,p,v,j){if(typeof v=="object"&&v!==null&&v.type===ge&&v.key===null&&(v=v.props.children),typeof v=="object"&&v!==null){switch(v.$$typeof){case b:e:{for(var U=v.key,$=p;$!==null;){if($.key===U){if(U=v.type,U===ge){if($.tag===7){n(m,$.sibling),p=l($,v.props.children),p.return=m,m=p;break e}}else if($.elementType===U||typeof U=="object"&&U!==null&&U.$$typeof===Me&&Vs(U)===$.type){n(m,$.sibling),p=l($,v.props),p.ref=yr(m,$,v),p.return=m,m=p;break e}n(m,$);break}else t(m,$);$=$.sibling}v.type===ge?(p=xn(v.props.children,m.mode,j,v.key),p.return=m,m=p):(j=Ol(v.type,v.key,v.props,null,m.mode,j),j.ref=yr(m,p,v),j.return=m,m=j)}return o(m);case he:e:{for($=v.key;p!==null;){if(p.key===$)if(p.tag===4&&p.stateNode.containerInfo===v.containerInfo&&p.stateNode.implementation===v.implementation){n(m,p.sibling),p=l(p,v.children||[]),p.return=m,m=p;break e}else{n(m,p);break}else t(m,p);p=p.sibling}p=Vo(v,m.mode,j),p.return=m,m=p}return o(m);case Me:return $=v._init,je(m,p,$(v._payload),j)}if(Gn(v))return A(m,p,v,j);if(V(v))return F(m,p,v,j);fl(m,v)}return typeof v=="string"&&v!==""||typeof v=="number"?(v=""+v,p!==null&&p.tag===6?(n(m,p.sibling),p=l(p,v),p.return=m,m=p):(n(m,p),p=Ho(v,m.mode,j),p.return=m,m=p),o(m)):n(m,p)}return je}var In=Ws(!0),$s=Ws(!1),dl=Yt(null),pl=null,Fn=null,qi=null;function Zi(){qi=Fn=pl=null}function Ji(e){var t=dl.current;xe(dl),e._currentValue=t}function bi(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 Un(e,t){pl=e,qi=Fn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(et=!0),e.firstContext=null)}function at(e){var t=e._currentValue;if(qi!==e)if(e={context:e,memoizedValue:t,next:null},Fn===null){if(pl===null)throw Error(u(308));Fn=e,pl.dependencies={lanes:0,firstContext:e}}else Fn=Fn.next=e;return t}var pn=null;function eo(e){pn===null?pn=[e]:pn.push(e)}function Qs(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,eo(t)):(n.next=l.next,l.next=n),t.interleaved=n,Dt(e,r)}function Dt(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 Zt=!1;function to(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Ks(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 Ot(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Jt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(ce&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Dt(e,n)}return l=r.interleaved,l===null?(t.next=t,eo(r)):(t.next=l.next,l.next=t),r.interleaved=t,Dt(e,n)}function hl(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,mi(e,n)}}function Gs(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=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?l=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?l=i=t:i=i.next=t}else l=i=t;n={baseState:r.baseState,firstBaseUpdate:l,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 ml(e,t,n,r){var l=e.updateQueue;Zt=!1;var i=l.firstBaseUpdate,o=l.lastBaseUpdate,a=l.shared.pending;if(a!==null){l.shared.pending=null;var d=a,w=d.next;d.next=null,o===null?i=w:o.next=w,o=d;var R=e.alternate;R!==null&&(R=R.updateQueue,a=R.lastBaseUpdate,a!==o&&(a===null?R.firstBaseUpdate=w:a.next=w,R.lastBaseUpdate=d))}if(i!==null){var _=l.baseState;o=0,R=w=d=null,a=i;do{var N=a.lane,z=a.eventTime;if((r&N)===N){R!==null&&(R=R.next={eventTime:z,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var A=e,F=a;switch(N=t,z=n,F.tag){case 1:if(A=F.payload,typeof A=="function"){_=A.call(z,_,N);break e}_=A;break e;case 3:A.flags=A.flags&-65537|128;case 0:if(A=F.payload,N=typeof A=="function"?A.call(z,_,N):A,N==null)break e;_=C({},_,N);break e;case 2:Zt=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,N=l.effects,N===null?l.effects=[a]:N.push(a))}else z={eventTime:z,lane:N,tag:a.tag,payload:a.payload,callback:a.callback,next:null},R===null?(w=R=z,d=_):R=R.next=z,o|=N;if(a=a.next,a===null){if(a=l.shared.pending,a===null)break;N=a,a=N.next,N.next=null,l.lastBaseUpdate=N,l.shared.pending=null}}while(!0);if(R===null&&(d=_),l.baseState=d,l.firstBaseUpdate=w,l.lastBaseUpdate=R,t=l.shared.interleaved,t!==null){l=t;do o|=l.lane,l=l.next;while(l!==t)}else i===null&&(l.shared.lanes=0);gn|=o,e.lanes=o,e.memoizedState=_}}function Ys(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=oo.transition;oo.transition={};try{e(!1),t()}finally{pe=n,oo.transition=r}}function pa(){return ct().memoizedState}function up(e,t,n){var r=nn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},ha(e))ma(t,n);else if(n=Qs(e,t,n,r),n!==null){var l=Ye();xt(n,e,r,l),ga(n,t,r)}}function sp(e,t,n){var r=nn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(ha(e))ma(t,l);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var o=t.lastRenderedState,a=i(o,n);if(l.hasEagerState=!0,l.eagerState=a,mt(a,o)){var d=t.interleaved;d===null?(l.next=l,eo(t)):(l.next=d.next,d.next=l),t.interleaved=l;return}}catch{}finally{}n=Qs(e,t,l,r),n!==null&&(l=Ye(),xt(n,e,r,l),ga(n,t,r))}}function ha(e){var t=e.alternate;return e===Te||t!==null&&t===Te}function ma(e,t){kr=yl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ga(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mi(e,n)}}var Sl={readContext:at,useCallback:We,useContext:We,useEffect:We,useImperativeHandle:We,useInsertionEffect:We,useLayoutEffect:We,useMemo:We,useReducer:We,useRef:We,useState:We,useDebugValue:We,useDeferredValue:We,useTransition:We,useMutableSource:We,useSyncExternalStore:We,useId:We,unstable_isNewReconciler:!1},ap={readContext:at,useCallback:function(e,t){return Rt().memoizedState=[e,t===void 0?null:t],e},useContext:at,useEffect:ia,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,wl(4194308,4,sa.bind(null,t,e),n)},useLayoutEffect:function(e,t){return wl(4194308,4,e,t)},useInsertionEffect:function(e,t){return wl(4,2,e,t)},useMemo:function(e,t){var n=Rt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Rt();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=up.bind(null,Te,e),[r.memoizedState,e]},useRef:function(e){var t=Rt();return e={current:e},t.memoizedState=e},useState:ra,useDebugValue:ho,useDeferredValue:function(e){return Rt().memoizedState=e},useTransition:function(){var e=ra(!1),t=e[0];return e=op.bind(null,e[1]),Rt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Te,l=Rt();if(Ee){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),Fe===null)throw Error(u(349));(mn&30)!==0||Js(r,t,n)}l.memoizedState=n;var i={value:n,getSnapshot:t};return l.queue=i,ia(ea.bind(null,r,i,e),[e]),r.flags|=2048,Tr(9,bs.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Rt(),t=Fe.identifierPrefix;if(Ee){var n=zt,r=Pt;n=(r&~(1<<32-ht(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Er++,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[Tt]=t,e[gr]=r,Aa(e,t,!1,!1),t.stateNode=e;e:{switch(o=ii(n,r),n){case"dialog":we("cancel",e),we("close",e),l=r;break;case"iframe":case"object":case"embed":we("load",e),l=r;break;case"video":case"audio":for(l=0;l$n&&(t.flags|=128,r=!0,Nr(i,!1),t.lanes=4194304)}else{if(!r)if(e=gl(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Nr(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ee)return $e(t),null}else 2*_e()-i.renderingStartTime>$n&&n!==1073741824&&(t.flags|=128,r=!0,Nr(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=_e(),t.sibling=null,n=Ce.current,ve(Ce,r?n&1|2:n&1),t):($e(t),null);case 22:case 23:return Fo(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(ot&1073741824)!==0&&($e(t),t.subtreeFlags&6&&(t.flags|=8192)):$e(t),null;case 24:return null;case 25:return null}throw Error(u(156,t.tag))}function vp(e,t){switch(Ki(t),t.tag){case 1:return be(t.type)&&il(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Bn(),xe(Je),xe(Ve),io(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return ro(t),null;case 13:if(xe(Ce),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));An()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xe(Ce),null;case 4:return Bn(),null;case 10:return Ji(t.type._context),null;case 22:case 23:return Fo(),null;case 24:return null;default:return null}}var Tl=!1,Qe=!1,yp=typeof WeakSet=="function"?WeakSet:Set,D=null;function Vn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ne(e,t,r)}else n.current=null}function No(e,t,n){try{n()}catch(r){Ne(e,t,r)}}var Ua=!1;function wp(e,t){if(Ii=Qr,e=vs(),ji(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 l=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,a=-1,d=-1,w=0,R=0,_=e,N=null;t:for(;;){for(var z;_!==n||l!==0&&_.nodeType!==3||(a=o+l),_!==i||r!==0&&_.nodeType!==3||(d=o+r),_.nodeType===3&&(o+=_.nodeValue.length),(z=_.firstChild)!==null;)N=_,_=z;for(;;){if(_===e)break t;if(N===n&&++w===l&&(a=o),N===i&&++R===r&&(d=o),(z=_.nextSibling)!==null)break;_=N,N=_.parentNode}_=z}n=a===-1||d===-1?null:{start:a,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(Fi={focusedElem:e,selectionRange:n},Qr=!1,D=t;D!==null;)if(t=D,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,D=e;else for(;D!==null;){t=D;try{var A=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(A!==null){var F=A.memoizedProps,je=A.memoizedState,m=t.stateNode,p=m.getSnapshotBeforeUpdate(t.elementType===t.type?F:vt(t.type,F),je);m.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var v=t.stateNode.containerInfo;v.nodeType===1?v.textContent="":v.nodeType===9&&v.documentElement&&v.removeChild(v.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(j){Ne(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,D=e;break}D=t.return}return A=Ua,Ua=!1,A}function Rr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var i=l.destroy;l.destroy=void 0,i!==void 0&&No(t,n,i)}l=l.next}while(l!==r)}}function Nl(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 Ro(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 Ba(e){var t=e.alternate;t!==null&&(e.alternate=null,Ba(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Tt],delete t[gr],delete t[Vi],delete t[tp],delete t[np])),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 Ha(e){return e.tag===5||e.tag===3||e.tag===4}function Va(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ha(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 _o(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=rl));else if(r!==4&&(e=e.child,e!==null))for(_o(e,t,n),e=e.sibling;e!==null;)_o(e,t,n),e=e.sibling}function jo(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(jo(e,t,n),e=e.sibling;e!==null;)jo(e,t,n),e=e.sibling}var Be=null,yt=!1;function bt(e,t,n){for(n=n.child;n!==null;)Wa(e,t,n),n=n.sibling}function Wa(e,t,n){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(Ur,n)}catch{}switch(n.tag){case 5:Qe||Vn(n,t);case 6:var r=Be,l=yt;Be=null,bt(e,t,n),Be=r,yt=l,Be!==null&&(yt?(e=Be,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Be.removeChild(n.stateNode));break;case 18:Be!==null&&(yt?(e=Be,n=n.stateNode,e.nodeType===8?Hi(e.parentNode,n):e.nodeType===1&&Hi(e,n),ir(e)):Hi(Be,n.stateNode));break;case 4:r=Be,l=yt,Be=n.stateNode.containerInfo,yt=!0,bt(e,t,n),Be=r,yt=l;break;case 0:case 11:case 14:case 15:if(!Qe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var i=l,o=i.destroy;i=i.tag,o!==void 0&&((i&2)!==0||(i&4)!==0)&&No(n,t,o),l=l.next}while(l!==r)}bt(e,t,n);break;case 1:if(!Qe&&(Vn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Ne(n,t,a)}bt(e,t,n);break;case 21:bt(e,t,n);break;case 22:n.mode&1?(Qe=(r=Qe)||n.memoizedState!==null,bt(e,t,n),Qe=r):bt(e,t,n);break;default:bt(e,t,n)}}function $a(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new yp),t.forEach(function(r){var l=_p.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function wt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=o),r&=~i}if(r=l,r=_e()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Sp(r/1960))-r,10e?16:e,tn===null)var r=!1;else{if(e=tn,tn=null,Ml=0,(ce&6)!==0)throw Error(u(331));var l=ce;for(ce|=4,D=e.current;D!==null;){var i=D,o=i.child;if((D.flags&16)!==0){var a=i.deletions;if(a!==null){for(var d=0;d_e()-Po?yn(e,0):Mo|=n),nt(e,t)}function rc(e,t){t===0&&((e.mode&1)===0?t=1:(t=Hr,Hr<<=1,(Hr&130023424)===0&&(Hr=4194304)));var n=Ye();e=Dt(e,t),e!==null&&(er(e,t,n),nt(e,n))}function Rp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),rc(e,n)}function _p(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(u(314))}r!==null&&r.delete(t),rc(e,n)}var lc;lc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Je.current)et=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return et=!1,mp(e,t,n);et=(e.flags&131072)!==0}else et=!1,Ee&&(t.flags&1048576)!==0&&Is(t,al,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Cl(e,t),e=t.pendingProps;var l=zn(t,Ve.current);Un(t,n),l=so(null,t,r,e,l,n);var i=ao();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,be(r)?(i=!0,ol(t)):i=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,to(t),l.updater=kl,t.stateNode=l,l._reactInternals=t,go(t,r,e,n),t=xo(null,t,r,!0,i,n)):(t.tag=0,Ee&&i&&Qi(t),Ge(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Cl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Lp(r),e=vt(r,e),l){case 0:t=wo(null,t,r,e,n);break e;case 1:t=La(null,t,r,e,n);break e;case 11:t=Ta(null,t,r,e,n);break e;case 14:t=Na(null,t,r,vt(r.type,e),n);break e}throw Error(u(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),wo(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),La(e,t,r,l,n);case 3:e:{if(Ma(t),e===null)throw Error(u(387));r=t.pendingProps,i=t.memoizedState,l=i.element,Ks(e,t),ml(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){l=Hn(Error(u(423)),t),t=Pa(e,t,r,n,l);break e}else if(r!==l){l=Hn(Error(u(424)),t),t=Pa(e,t,r,n,l);break e}else for(it=Gt(t.stateNode.containerInfo.firstChild),lt=t,Ee=!0,gt=null,n=$s(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(An(),r===l){t=At(e,t,n);break e}Ge(e,t,r,n)}t=t.child}return t;case 5:return Xs(t),e===null&&Yi(t),r=t.type,l=t.pendingProps,i=e!==null?e.memoizedProps:null,o=l.children,Ui(r,l)?o=null:i!==null&&Ui(r,i)&&(t.flags|=32),ja(e,t),Ge(e,t,o,n),t.child;case 6:return e===null&&Yi(t),null;case 13:return za(e,t,n);case 4:return no(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=In(t,null,r,n):Ge(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),Ta(e,t,r,l,n);case 7:return Ge(e,t,t.pendingProps,n),t.child;case 8:return Ge(e,t,t.pendingProps.children,n),t.child;case 12:return Ge(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,i=t.memoizedProps,o=l.value,ve(dl,r._currentValue),r._currentValue=o,i!==null)if(mt(i.value,o)){if(i.children===l.children&&!Je.current){t=At(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){o=i.child;for(var d=a.firstContext;d!==null;){if(d.context===r){if(i.tag===1){d=Ot(-1,n&-n),d.tag=2;var w=i.updateQueue;if(w!==null){w=w.shared;var R=w.pending;R===null?d.next=d:(d.next=R.next,R.next=d),w.pending=d}}i.lanes|=n,d=i.alternate,d!==null&&(d.lanes|=n),bi(i.return,n,t),a.lanes|=n;break}d=d.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(u(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),bi(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}Ge(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Un(t,n),l=at(l),r=r(l),t.flags|=1,Ge(e,t,r,n),t.child;case 14:return r=t.type,l=vt(r,t.pendingProps),l=vt(r.type,l),Na(e,t,r,l,n);case 15:return Ra(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:vt(r,l),Cl(e,t),t.tag=1,be(r)?(e=!0,ol(t)):e=!1,Un(t,n),ya(t,r,l),go(t,r,l,n),xo(null,t,r,!0,e,n);case 19:return Oa(e,t,n);case 22:return _a(e,t,n)}throw Error(u(156,t.tag))};function ic(e,t){return Fu(e,t)}function jp(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 dt(e,t,n,r){return new jp(e,t,n,r)}function Bo(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Lp(e){if(typeof e=="function")return Bo(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ke)return 11;if(e===ze)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=dt(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 Ol(e,t,n,r,l,i){var o=2;if(r=e,typeof e=="function")Bo(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ge:return xn(n.children,l,i,t);case ne:o=8,l|=8;break;case Le:return e=dt(12,n,t,l|2),e.elementType=Le,e.lanes=i,e;case q:return e=dt(13,n,t,l),e.elementType=q,e.lanes=i,e;case Re:return e=dt(19,n,t,l),e.elementType=Re,e.lanes=i,e;case me:return Al(n,l,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case de:o=10;break e;case Se:o=9;break e;case ke:o=11;break e;case ze:o=14;break e;case Me:o=16,r=null;break e}throw Error(u(130,e==null?e:typeof e,""))}return t=dt(o,n,t,l),t.elementType=e,t.type=r,t.lanes=i,t}function xn(e,t,n,r){return e=dt(7,e,r,t),e.lanes=n,e}function Al(e,t,n,r){return e=dt(22,e,r,t),e.elementType=me,e.lanes=n,e.stateNode={isHidden:!1},e}function Ho(e,t,n){return e=dt(6,e,null,t),e.lanes=n,e}function Vo(e,t,n){return t=dt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Mp(e,t,n,r,l){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=hi(0),this.expirationTimes=hi(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hi(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Wo(e,t,n,r,l,i,o,a,d){return e=new Mp(e,t,n,a,d),t===1?(t=1,i===!0&&(t|=8)):t=0,i=dt(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},to(i),e}function Pp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(c){console.error(c)}}return s(),Ql.exports=gc(),Ql.exports}var tu;function yc(){if(tu)return Pr;tu=1;var s=vc();return Pr.createRoot=s.createRoot,Pr.hydrateRoot=s.hydrateRoot,Pr}var nu=yc(),P=$l();class qe extends Error{constructor(c,u,h,g){super(c),this.status=u,this.code=h,this.retryAfter=g,this.name="ChatApiError"}}class Yl extends Error{constructor(){super("Request debounced"),this.name="DebounceError"}}const wc=3e4;function xc(s,c){const u=atob(s),h=new Uint8Array(u.length);for(let g=0;g0&&Date.now()-this.lastSendTime({})),x=g.headers.get("Retry-After"),E=x?Number(x):void 0;if(u=new qe(k.error??`Request failed with status ${g.status}`,g.status,k.code,E),!this.isRetryable(g.status))throw u;if(h{var x;return(x=k.attachments)==null?void 0:x.some(E=>!!E.data)}))return{headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:c})};const h=new FormData,g=c.map(k=>k.attachments?{...k,attachments:k.attachments.map(x=>{const E={...x};return delete E.data,E})}:k);h.append("payload",JSON.stringify({messages:g}));for(const k of c)for(const x of k.attachments??[])x.data&&h.append(x.id,xc(x.data,x.mediaType),x.name);return{body:h}}async streamMessage(c,u={}){var g;if(typeof ReadableStream>"u")return this.sendMessage(c);if(this.debounceMs>0&&Date.now()-this.lastSendTime({})),M=x.headers.get("Retry-After");if(h=new qe(T.error??`Request failed with status ${x.status}`,x.status,T.code,M?Number(M):void 0),!this.isRetryable(x.status))throw h;k{h.cancel().catch(()=>{})};(W=u.signal)==null||W.addEventListener("abort",M,{once:!0});try{for(;;){let se;try{se=await h.read()}catch(ue){if((H=u.signal)!=null&&H.aborted)break;throw ue}if((te=u.signal)!=null&&te.aborted||se.done)break;k+=g.decode(se.value,{stream:!0});let ae;for(;(ae=k.indexOf(` + */var tu;function Ec(){if(tu)return Je;tu=1;var s=Yl(),a=kc();function u(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"),C=Object.prototype.hasOwnProperty,R=/^[: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]*$/,A={},$={};function q(e){return C.call($,e)?!0:C.call(A,e)?!1:R.test(e)?$[e]=!0:(A[e]=!0,!1)}function G(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 D(e,t,n,r){if(t===null||typeof t>"u"||G(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 z(e,t,n,r,l,o,i){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=l,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=i}var I={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){I[e]=new z(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];I[t]=new z(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){I[e]=new z(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){I[e]=new z(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){I[e]=new z(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){I[e]=new z(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){I[e]=new z(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){I[e]=new z(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){I[e]=new z(e,5,!1,e.toLowerCase(),null,!1,!1)});var pe=/[\-:]([a-z])/g;function se(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(pe,se);I[t]=new z(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(pe,se);I[t]=new z(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(pe,se);I[t]=new z(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){I[e]=new z(e,1,!1,e.toLowerCase(),null,!1,!1)}),I.xlinkHref=new z("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){I[e]=new z(e,1,!1,e.toLowerCase(),null,!0,!0)});function le(e,t,n,r){var l=I.hasOwnProperty(t)?I[t]:null;(l!==null?l.type!==0:r||!(2c||l[i]!==o[c]){var f=` +`+l[i].replace(" at new "," at ");return e.displayName&&f.includes("")&&(f=f.replace("",e.displayName)),f}while(1<=i&&0<=c);break}}}finally{te=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?k(e):""}function ae(e){switch(e.tag){case 5:return k(e.type);case 16:return k("Lazy");case 13:return k("Suspense");case 19:return k("SuspenseList");case 0:case 2:case 15:return e=Z(e.type,!1),e;case 11:return e=Z(e.type.render,!1),e;case 1:return e=Z(e.type,!0),e;default:return""}}function ue(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 de:return"Fragment";case re:return"Portal";case Te:return"Profiler";case J:return"StrictMode";case Ce:return"Suspense";case De:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case we:return(e.displayName||"Context")+".Consumer";case ye:return(e._context.displayName||"Context")+".Provider";case ge:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Me:return t=e.displayName||null,t!==null?t:ue(e.type)||"Memo";case Re:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}function B(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 ue(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 X(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function ne(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function xe(e){var t=ne(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 l=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.call(this)},set:function(i){r=""+i,o.call(this,i)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(i){r=""+i},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Fe(e){e._valueTracker||(e._valueTracker=xe(e))}function at(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=ne(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Rt(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 F(e,t){var n=t.checked;return T({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function fe(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=X(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 Ue(e,t){t=t.checked,t!=null&&le(e,"checked",t,!1)}function Pt(e,t){Ue(e,t);var n=X(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")?kn(e,t.type,n):t.hasOwnProperty("defaultValue")&&kn(e,t.type,X(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function $e(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 kn(e,t,n){(t!=="number"||Rt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var sn=Array.isArray;function En(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Ur.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Zn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jn={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},uf=["Webkit","ms","Moz","O"];Object.keys(Jn).forEach(function(e){uf.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Jn[t]=Jn[e]})});function zu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Jn.hasOwnProperty(e)&&Jn[e]?(""+t).trim():t+"px"}function Du(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=zu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var sf=T({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 io(e,t){if(t){if(sf[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(u(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(u(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(u(61))}if(t.style!=null&&typeof t.style!="object")throw Error(u(62))}}function uo(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 so=null;function ao(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var co=null,Cn=null,Rn=null;function Au(e){if(e=xr(e)){if(typeof co!="function")throw Error(u(280));var t=e.stateNode;t&&(t=sl(t),co(e.stateNode,e.type,t))}}function Ou(e){Cn?Rn?Rn.push(e):Rn=[e]:Cn=e}function Iu(){if(Cn){var e=Cn,t=Rn;if(Rn=Cn=null,Au(e),t)for(e=0;e>>=0,e===0?32:31-(wf(e)/xf|0)|0}var Wr=64,Qr=4194304;function nr(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 Kr(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,i=n&268435455;if(i!==0){var c=i&~l;c!==0?r=nr(c):(o&=i,o!==0&&(r=nr(o)))}else i=n&~l,i!==0?r=nr(i):o!==0&&(r=nr(o));if(r===0)return 0;if(t!==0&&t!==r&&(t&l)===0&&(l=r&-r,o=t&-t,l>=o||l===16&&(o&4194240)!==0))return t;if((r&4)!==0&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function rr(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-vt(t),e[t]=n}function Cf(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=dr),ds=" ",fs=!1;function ps(e,t){switch(e){case"keyup":return Jf.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hs(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var _n=!1;function ep(e,t){switch(e){case"compositionend":return hs(t);case"keypress":return t.which!==32?null:(fs=!0,ds);case"textInput":return e=t.data,e===ds&&fs?null:e;default:return null}}function tp(e,t){if(_n)return e==="compositionend"||!jo&&ps(e,t)?(e=os(),Zr=Eo=Qt=null,_n=!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=Ss(n)}}function Es(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Es(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Cs(){for(var e=window,t=Rt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Rt(e.document)}return t}function Po(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 cp(e){var t=Cs(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Es(n.ownerDocument.documentElement,n)){if(r!==null&&Po(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 l=n.textContent.length,o=Math.min(r.start,l);r=r.end===void 0?o:Math.min(r.end,l),!e.extend&&o>r&&(l=r,r=o,o=l),l=ks(n,o);var i=ks(n,r);l&&i&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==i.node||e.focusOffset!==i.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(i.node,i.offset)):(t.setEnd(i.node,i.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,jn=null,zo=null,mr=null,Do=!1;function Rs(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Do||jn==null||jn!==Rt(r)||(r=jn,"selectionStart"in r&&Po(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}),mr&&hr(mr,r)||(mr=r,r=ol(zo,"onSelect"),0Dn||(e.current=Ko[Dn],Ko[Dn]=null,Dn--)}function Se(e,t){Dn++,Ko[Dn]=e.current,e.current=t}var Xt={},Ke=Yt(Xt),et=Yt(!1),dn=Xt;function An(e,t){var n=e.type.contextTypes;if(!n)return Xt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var l={},o;for(o in n)l[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=l),l}function tt(e){return e=e.childContextTypes,e!=null}function al(){Ee(et),Ee(Ke)}function Bs(e,t,n){if(Ke.current!==Xt)throw Error(u(168));Se(Ke,t),Se(et,n)}function Hs(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var l in r)if(!(l in t))throw Error(u(108,B(e)||"Unknown",l));return T({},n,r)}function cl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Xt,dn=Ke.current,Se(Ke,e),Se(et,et.current),!0}function Vs(e,t,n){var r=e.stateNode;if(!r)throw Error(u(169));n?(e=Hs(e,t,dn),r.__reactInternalMemoizedMergedChildContext=e,Ee(et),Ee(Ke),Se(Ke,e)):Ee(et),Se(et,n)}var Dt=null,dl=!1,Go=!1;function $s(e){Dt===null?Dt=[e]:Dt.push(e)}function kp(e){dl=!0,$s(e)}function qt(){if(!Go&&Dt!==null){Go=!0;var e=0,t=ve;try{var n=Dt;for(ve=1;e>=i,l-=i,At=1<<32-vt(t)+l|n<oe?(Ve=ee,ee=null):Ve=ee.sibling;var me=_(w,ee,x[oe],M);if(me===null){ee===null&&(ee=Ve);break}e&&ee&&me.alternate===null&&t(w,ee),p=o(me,p,oe),b===null?K=me:b.sibling=me,b=me,ee=Ve}if(oe===x.length)return n(w,ee),Ne&&pn(w,oe),K;if(ee===null){for(;oeoe?(Ve=ee,ee=null):Ve=ee.sibling;var on=_(w,ee,me.value,M);if(on===null){ee===null&&(ee=Ve);break}e&&ee&&on.alternate===null&&t(w,ee),p=o(on,p,oe),b===null?K=on:b.sibling=on,b=on,ee=Ve}if(me.done)return n(w,ee),Ne&&pn(w,oe),K;if(ee===null){for(;!me.done;oe++,me=x.next())me=L(w,me.value,M),me!==null&&(p=o(me,p,oe),b===null?K=me:b.sibling=me,b=me);return Ne&&pn(w,oe),K}for(ee=r(w,ee);!me.done;oe++,me=x.next())me=O(ee,w,oe,me.value,M),me!==null&&(e&&me.alternate!==null&&ee.delete(me.key===null?oe:me.key),p=o(me,p,oe),b===null?K=me:b.sibling=me,b=me);return e&&ee.forEach(function(nh){return t(w,nh)}),Ne&&pn(w,oe),K}function ze(w,p,x,M){if(typeof x=="object"&&x!==null&&x.type===de&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case ie:e:{for(var K=x.key,b=p;b!==null;){if(b.key===K){if(K=x.type,K===de){if(b.tag===7){n(w,b.sibling),p=l(b,x.props.children),p.return=w,w=p;break e}}else if(b.elementType===K||typeof K=="object"&&K!==null&&K.$$typeof===Re&&Xs(K)===b.type){n(w,b.sibling),p=l(b,x.props),p.ref=Sr(w,b,x),p.return=w,w=p;break e}n(w,b);break}else t(w,b);b=b.sibling}x.type===de?(p=Sn(x.props.children,w.mode,M,x.key),p.return=w,w=p):(M=Ul(x.type,x.key,x.props,null,w.mode,M),M.ref=Sr(w,p,x),M.return=w,w=M)}return i(w);case re:e:{for(b=x.key;p!==null;){if(p.key===b)if(p.tag===4&&p.stateNode.containerInfo===x.containerInfo&&p.stateNode.implementation===x.implementation){n(w,p.sibling),p=l(p,x.children||[]),p.return=w,w=p;break e}else{n(w,p);break}else t(w,p);p=p.sibling}p=Wi(x,w.mode,M),p.return=w,w=p}return i(w);case Re:return b=x._init,ze(w,p,b(x._payload),M)}if(sn(x))return H(w,p,x,M);if(Y(x))return V(w,p,x,M);ml(w,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,p!==null&&p.tag===6?(n(w,p.sibling),p=l(p,x),p.return=w,w=p):(n(w,p),p=$i(x,w.mode,M),p.return=w,w=p),i(w)):n(w,p)}return ze}var Un=qs(!0),Zs=qs(!1),gl=Yt(null),vl=null,Bn=null,bo=null;function ei(){bo=Bn=vl=null}function ti(e){var t=gl.current;Ee(gl),e._currentValue=t}function ni(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 Hn(e,t){vl=e,bo=Bn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(nt=!0),e.firstContext=null)}function ft(e){var t=e._currentValue;if(bo!==e)if(e={context:e,memoizedValue:t,next:null},Bn===null){if(vl===null)throw Error(u(308));Bn=e,vl.dependencies={lanes:0,firstContext:e}}else Bn=Bn.next=e;return t}var hn=null;function ri(e){hn===null?hn=[e]:hn.push(e)}function Js(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,ri(t)):(n.next=l.next,l.next=n),t.interleaved=n,It(e,r)}function It(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 Zt=!1;function li(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function bs(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 Ft(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Jt(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(he&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,It(e,n)}return l=r.interleaved,l===null?(t.next=t,ri(r)):(t.next=l.next,l.next=t),r.interleaved=t,It(e,n)}function yl(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,yo(e,n)}}function ea(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var l=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var i={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=i:o=o.next=i,n=n.next}while(n!==null);o===null?l=o=t:o=o.next=t}else l=o=t;n={baseState:r.baseState,firstBaseUpdate:l,lastBaseUpdate:o,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 wl(e,t,n,r){var l=e.updateQueue;Zt=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,c=l.shared.pending;if(c!==null){l.shared.pending=null;var f=c,S=f.next;f.next=null,i===null?o=S:i.next=S,i=f;var j=e.alternate;j!==null&&(j=j.updateQueue,c=j.lastBaseUpdate,c!==i&&(c===null?j.firstBaseUpdate=S:c.next=S,j.lastBaseUpdate=f))}if(o!==null){var L=l.baseState;i=0,j=S=f=null,c=o;do{var _=c.lane,O=c.eventTime;if((r&_)===_){j!==null&&(j=j.next={eventTime:O,lane:0,tag:c.tag,payload:c.payload,callback:c.callback,next:null});e:{var H=e,V=c;switch(_=t,O=n,V.tag){case 1:if(H=V.payload,typeof H=="function"){L=H.call(O,L,_);break e}L=H;break e;case 3:H.flags=H.flags&-65537|128;case 0:if(H=V.payload,_=typeof H=="function"?H.call(O,L,_):H,_==null)break e;L=T({},L,_);break e;case 2:Zt=!0}}c.callback!==null&&c.lane!==0&&(e.flags|=64,_=l.effects,_===null?l.effects=[c]:_.push(c))}else O={eventTime:O,lane:_,tag:c.tag,payload:c.payload,callback:c.callback,next:null},j===null?(S=j=O,f=L):j=j.next=O,i|=_;if(c=c.next,c===null){if(c=l.shared.pending,c===null)break;_=c,c=_.next,_.next=null,l.lastBaseUpdate=_,l.shared.pending=null}}while(!0);if(j===null&&(f=L),l.baseState=f,l.firstBaseUpdate=S,l.lastBaseUpdate=j,t=l.shared.interleaved,t!==null){l=t;do i|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);vn|=i,e.lanes=i,e.memoizedState=L}}function ta(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ai.transition;ai.transition={};try{e(!1),t()}finally{ve=n,ai.transition=r}}function xa(){return pt().memoizedState}function Np(e,t,n){var r=nn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Sa(e))ka(t,n);else if(n=Js(e,t,n,r),n!==null){var l=Ze();Et(n,e,r,l),Ea(n,t,r)}}function Tp(e,t,n){var r=nn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Sa(e))ka(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var i=t.lastRenderedState,c=o(i,n);if(l.hasEagerState=!0,l.eagerState=c,yt(c,i)){var f=t.interleaved;f===null?(l.next=l,ri(t)):(l.next=f.next,f.next=l),t.interleaved=l;return}}catch{}finally{}n=Js(e,t,l,r),n!==null&&(l=Ze(),Et(n,e,r,l),Ea(n,t,r))}}function Sa(e){var t=e.alternate;return e===je||t!==null&&t===je}function ka(e,t){Rr=kl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ea(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,yo(e,n)}}var Rl={readContext:ft,useCallback:Ge,useContext:Ge,useEffect:Ge,useImperativeHandle:Ge,useInsertionEffect:Ge,useLayoutEffect:Ge,useMemo:Ge,useReducer:Ge,useRef:Ge,useState:Ge,useDebugValue:Ge,useDeferredValue:Ge,useTransition:Ge,useMutableSource:Ge,useSyncExternalStore:Ge,useId:Ge,unstable_isNewReconciler:!1},_p={readContext:ft,useCallback:function(e,t){return jt().memoizedState=[e,t===void 0?null:t],e},useContext:ft,useEffect:fa,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,El(4194308,4,ma.bind(null,t,e),n)},useLayoutEffect:function(e,t){return El(4194308,4,e,t)},useInsertionEffect:function(e,t){return El(4,2,e,t)},useMemo:function(e,t){var n=jt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=jt();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=Np.bind(null,je,e),[r.memoizedState,e]},useRef:function(e){var t=jt();return e={current:e},t.memoizedState=e},useState:ca,useDebugValue:gi,useDeferredValue:function(e){return jt().memoizedState=e},useTransition:function(){var e=ca(!1),t=e[0];return e=Rp.bind(null,e[1]),jt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=je,l=jt();if(Ne){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),He===null)throw Error(u(349));(gn&30)!==0||oa(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,fa(ua.bind(null,r,o,e),[e]),r.flags|=2048,_r(9,ia.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=jt(),t=He.identifierPrefix;if(Ne){var n=Ot,r=At;n=(r&~(1<<32-vt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Nr++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=i.createElement(n,{is:r.is}):(e=i.createElement(n),n==="select"&&(i=e,r.multiple?i.multiple=!0:r.size&&(i.size=r.size))):e=i.createElementNS(e,n),e[Tt]=t,e[wr]=r,$a(e,t,!1,!1),t.stateNode=e;e:{switch(i=uo(n,r),n){case"dialog":ke("cancel",e),ke("close",e),l=r;break;case"iframe":case"object":case"embed":ke("load",e),l=r;break;case"video":case"audio":for(l=0;lKn&&(t.flags|=128,r=!0,jr(o,!1),t.lanes=4194304)}else{if(!r)if(e=xl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),jr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Ne)return Ye(t),null}else 2*Pe()-o.renderingStartTime>Kn&&n!==1073741824&&(t.flags|=128,r=!0,jr(o,!1),t.lanes=4194304);o.isBackwards?(i.sibling=t.child,t.child=i):(n=o.last,n!==null?n.sibling=i:t.child=i,o.last=i)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Pe(),t.sibling=null,n=_e.current,Se(_e,r?n&1|2:n&1),t):(Ye(t),null);case 22:case 23:return Bi(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(st&1073741824)!==0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),null;case 24:return null;case 25:return null}throw Error(u(156,t.tag))}function Op(e,t){switch(Xo(t),t.tag){case 1:return tt(t.type)&&al(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vn(),Ee(et),Ee(Ke),si(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return ii(t),null;case 13:if(Ee(_e),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));Fn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ee(_e),null;case 4:return Vn(),null;case 10:return ti(t.type._context),null;case 22:case 23:return Bi(),null;case 24:return null;default:return null}}var jl=!1,Xe=!1,Ip=typeof WeakSet=="function"?WeakSet:Set,U=null;function Wn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Le(e,t,r)}else n.current=null}function _i(e,t,n){try{n()}catch(r){Le(e,t,r)}}var Ka=!1;function Fp(e,t){if(Bo=Xr,e=Cs(),Po(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 l=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var i=0,c=-1,f=-1,S=0,j=0,L=e,_=null;t:for(;;){for(var O;L!==n||l!==0&&L.nodeType!==3||(c=i+l),L!==o||r!==0&&L.nodeType!==3||(f=i+r),L.nodeType===3&&(i+=L.nodeValue.length),(O=L.firstChild)!==null;)_=L,L=O;for(;;){if(L===e)break t;if(_===n&&++S===l&&(c=i),_===o&&++j===r&&(f=i),(O=L.nextSibling)!==null)break;L=_,_=L.parentNode}L=O}n=c===-1||f===-1?null:{start:c,end:f}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ho={focusedElem:e,selectionRange:n},Xr=!1,U=t;U!==null;)if(t=U,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,U=e;else for(;U!==null;){t=U;try{var H=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(H!==null){var V=H.memoizedProps,ze=H.memoizedState,w=t.stateNode,p=w.getSnapshotBeforeUpdate(t.elementType===t.type?V:xt(t.type,V),ze);w.__reactInternalSnapshotBeforeUpdate=p}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(u(163))}}catch(M){Le(t,t.return,M)}if(e=t.sibling,e!==null){e.return=t.return,U=e;break}U=t.return}return H=Ka,Ka=!1,H}function Lr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var l=r=r.next;do{if((l.tag&e)===e){var o=l.destroy;l.destroy=void 0,o!==void 0&&_i(t,n,o)}l=l.next}while(l!==r)}}function Ll(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 ji(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 Ga(e){var t=e.alternate;t!==null&&(e.alternate=null,Ga(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Tt],delete t[wr],delete t[Qo],delete t[xp],delete t[Sp])),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 Ya(e){return e.tag===5||e.tag===3||e.tag===4}function Xa(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Ya(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 Li(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=ul));else if(r!==4&&(e=e.child,e!==null))for(Li(e,t,n),e=e.sibling;e!==null;)Li(e,t,n),e=e.sibling}function Mi(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(Mi(e,t,n),e=e.sibling;e!==null;)Mi(e,t,n),e=e.sibling}var We=null,St=!1;function bt(e,t,n){for(n=n.child;n!==null;)qa(e,t,n),n=n.sibling}function qa(e,t,n){if(Nt&&typeof Nt.onCommitFiberUnmount=="function")try{Nt.onCommitFiberUnmount($r,n)}catch{}switch(n.tag){case 5:Xe||Wn(n,t);case 6:var r=We,l=St;We=null,bt(e,t,n),We=r,St=l,We!==null&&(St?(e=We,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):We.removeChild(n.stateNode));break;case 18:We!==null&&(St?(e=We,n=n.stateNode,e.nodeType===8?Wo(e.parentNode,n):e.nodeType===1&&Wo(e,n),sr(e)):Wo(We,n.stateNode));break;case 4:r=We,l=St,We=n.stateNode.containerInfo,St=!0,bt(e,t,n),We=r,St=l;break;case 0:case 11:case 14:case 15:if(!Xe&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){l=r=r.next;do{var o=l,i=o.destroy;o=o.tag,i!==void 0&&((o&2)!==0||(o&4)!==0)&&_i(n,t,i),l=l.next}while(l!==r)}bt(e,t,n);break;case 1:if(!Xe&&(Wn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){Le(n,t,c)}bt(e,t,n);break;case 21:bt(e,t,n);break;case 22:n.mode&1?(Xe=(r=Xe)||n.memoizedState!==null,bt(e,t,n),Xe=r):bt(e,t,n);break;default:bt(e,t,n)}}function Za(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Ip),t.forEach(function(r){var l=Gp.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function kt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=Pe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*Bp(r/1960))-r,10e?16:e,tn===null)var r=!1;else{if(e=tn,tn=null,Al=0,(he&6)!==0)throw Error(u(331));var l=he;for(he|=4,U=e.current;U!==null;){var o=U,i=o.child;if((U.flags&16)!==0){var c=o.deletions;if(c!==null){for(var f=0;fPe()-Di?wn(e,0):zi|=n),lt(e,t)}function cc(e,t){t===0&&((e.mode&1)===0?t=1:(t=Qr,Qr<<=1,(Qr&130023424)===0&&(Qr=4194304)));var n=Ze();e=It(e,t),e!==null&&(rr(e,t,n),lt(e,n))}function Kp(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),cc(e,n)}function Gp(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;l!==null&&(n=l.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(u(314))}r!==null&&r.delete(t),cc(e,n)}var dc;dc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||et.current)nt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return nt=!1,Dp(e,t,n);nt=(e.flags&131072)!==0}else nt=!1,Ne&&(t.flags&1048576)!==0&&Ws(t,pl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;_l(e,t),e=t.pendingProps;var l=An(t,Ke.current);Hn(t,n),l=di(null,t,r,e,l,n);var o=fi();return t.flags|=1,typeof l=="object"&&l!==null&&typeof l.render=="function"&&l.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,tt(r)?(o=!0,cl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,li(t),l.updater=Nl,t.stateNode=l,l._reactInternals=t,yi(t,r,e,n),t=ki(null,t,r,!0,o,n)):(t.tag=0,Ne&&o&&Yo(t),qe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(_l(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Xp(r),e=xt(r,e),l){case 0:t=Si(null,t,r,e,n);break e;case 1:t=Ia(null,t,r,e,n);break e;case 11:t=Pa(null,t,r,e,n);break e;case 14:t=za(null,t,r,xt(r.type,e),n);break e}throw Error(u(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:xt(r,l),Si(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:xt(r,l),Ia(e,t,r,l,n);case 3:e:{if(Fa(t),e===null)throw Error(u(387));r=t.pendingProps,o=t.memoizedState,l=o.element,bs(e,t),wl(t,r,null,n);var i=t.memoizedState;if(r=i.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:i.cache,pendingSuspenseBoundaries:i.pendingSuspenseBoundaries,transitions:i.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=$n(Error(u(423)),t),t=Ua(e,t,r,n,l);break e}else if(r!==l){l=$n(Error(u(424)),t),t=Ua(e,t,r,n,l);break e}else for(ut=Gt(t.stateNode.containerInfo.firstChild),it=t,Ne=!0,wt=null,n=Zs(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Fn(),r===l){t=Ut(e,t,n);break e}qe(e,t,r,n)}t=t.child}return t;case 5:return na(t),e===null&&Zo(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Vo(r,l)?i=null:o!==null&&Vo(r,o)&&(t.flags|=32),Oa(e,t),qe(e,t,i,n),t.child;case 6:return e===null&&Zo(t),null;case 13:return Ba(e,t,n);case 4:return oi(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Un(t,null,r,n):qe(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:xt(r,l),Pa(e,t,r,l,n);case 7:return qe(e,t,t.pendingProps,n),t.child;case 8:return qe(e,t,t.pendingProps.children,n),t.child;case 12:return qe(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,i=l.value,Se(gl,r._currentValue),r._currentValue=i,o!==null)if(yt(o.value,i)){if(o.children===l.children&&!et.current){t=Ut(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){i=o.child;for(var f=c.firstContext;f!==null;){if(f.context===r){if(o.tag===1){f=Ft(-1,n&-n),f.tag=2;var S=o.updateQueue;if(S!==null){S=S.shared;var j=S.pending;j===null?f.next=f:(f.next=j.next,j.next=f),S.pending=f}}o.lanes|=n,f=o.alternate,f!==null&&(f.lanes|=n),ni(o.return,n,t),c.lanes|=n;break}f=f.next}}else if(o.tag===10)i=o.type===t.type?null:o.child;else if(o.tag===18){if(i=o.return,i===null)throw Error(u(341));i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),ni(i,n,t),i=o.sibling}else i=o.child;if(i!==null)i.return=o;else for(i=o;i!==null;){if(i===t){i=null;break}if(o=i.sibling,o!==null){o.return=i.return,i=o;break}i=i.return}o=i}qe(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Hn(t,n),l=ft(l),r=r(l),t.flags|=1,qe(e,t,r,n),t.child;case 14:return r=t.type,l=xt(r,t.pendingProps),l=xt(r.type,l),za(e,t,r,l,n);case 15:return Da(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:xt(r,l),_l(e,t),t.tag=1,tt(r)?(e=!0,cl(t)):e=!1,Hn(t,n),Ra(t,r,l),yi(t,r,l,n),ki(null,t,r,!0,e,n);case 19:return Va(e,t,n);case 22:return Aa(e,t,n)}throw Error(u(156,t.tag))};function fc(e,t){return Qu(e,t)}function Yp(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 mt(e,t,n,r){return new Yp(e,t,n,r)}function Vi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xp(e){if(typeof e=="function")return Vi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ge)return 11;if(e===Me)return 14}return 2}function ln(e,t){var n=e.alternate;return n===null?(n=mt(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 Ul(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")Vi(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case de:return Sn(n.children,l,o,t);case J:i=8,l|=8;break;case Te:return e=mt(12,n,t,l|2),e.elementType=Te,e.lanes=o,e;case Ce:return e=mt(13,n,t,l),e.elementType=Ce,e.lanes=o,e;case De:return e=mt(19,n,t,l),e.elementType=De,e.lanes=o,e;case W:return Bl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case ye:i=10;break e;case we:i=9;break e;case ge:i=11;break e;case Me:i=14;break e;case Re:i=16,r=null;break e}throw Error(u(130,e==null?e:typeof e,""))}return t=mt(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Sn(e,t,n,r){return e=mt(7,e,r,t),e.lanes=n,e}function Bl(e,t,n,r){return e=mt(22,e,r,t),e.elementType=W,e.lanes=n,e.stateNode={isHidden:!1},e}function $i(e,t,n){return e=mt(6,e,null,t),e.lanes=n,e}function Wi(e,t,n){return t=mt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function qp(e,t,n,r,l){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=vo(0),this.expirationTimes=vo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Qi(e,t,n,r,l,o,i,c,f){return e=new qp(e,t,n,c,f),t===1?(t=1,o===!0&&(t|=8)):t=0,o=mt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},li(o),e}function Zp(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),Xl.exports=Ec(),Xl.exports}var ru;function Rc(){if(ru)return Ar;ru=1;var s=Cc();return Ar.createRoot=s.createRoot,Ar.hydrateRoot=s.hydrateRoot,Ar}var lu=Rc(),N=Yl();class be extends Error{constructor(a,u,d,h){super(a),this.status=u,this.code=d,this.retryAfter=h,this.name="ChatApiError"}}class Jl extends Error{constructor(){super("Request debounced"),this.name="DebounceError"}}const Nc=3e4;function Tc(s,a){const u=atob(s),d=new Uint8Array(u.length);for(let h=0;h0&&Date.now()-this.lastSendTime({})),v=h.headers.get("Retry-After"),E=v?Number(v):void 0;if(u=new be(y.error??`Request failed with status ${h.status}`,h.status,y.code,E),!this.isRetryable(h.status))throw u;if(d{var v;return(v=y.attachments)==null?void 0:v.some(E=>!!E.data)}))return{headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:a})};const d=new FormData,h=a.map(y=>y.attachments?{...y,attachments:y.attachments.map(v=>{const E={...v};return delete E.data,E})}:y);d.append("payload",JSON.stringify({messages:h}));for(const y of a)for(const v of y.attachments??[])v.data&&d.append(v.id,Tc(v.data,v.mediaType),v.name);return{body:d}}async streamMessage(a,u={}){var h;if(typeof ReadableStream>"u")return this.sendMessage(a);if(this.debounceMs>0&&Date.now()-this.lastSendTime({})),R=v.headers.get("Retry-After");if(d=new be(C.error??`Request failed with status ${v.status}`,v.status,C.code,R?Number(R):void 0),!this.isRetryable(v.status))throw d;y{d.cancel().catch(()=>{})};(A=u.signal)==null||A.addEventListener("abort",R,{once:!0});try{for(;;){let pe;try{pe=await d.read()}catch(le){if(($=u.signal)!=null&&$.aborted)break;throw le}if((q=u.signal)!=null&&q.aborted||pe.done)break;y+=h.decode(pe.value,{stream:!0});let se;for(;(se=y.indexOf(` -`))!==-1;){const ue=k.slice(0,ae);k=k.slice(ae+2);const X=kc(ue);if(X){if(X.event==="chunk"){const b=typeof X.data.text=="string"?X.data.text:"";b&&(x+=b,(ie=u.onChunk)==null||ie.call(u,b,x))}else if(X.event==="tool"){if(typeof X.data.name=="string"){const b=X.data;E.push(b),(oe=u.onToolUse)==null||oe.call(u,b,E)}}else if(X.event==="done"){const b=Array.isArray(X.data.toolUses)?X.data.toolUses:E;T={reply:typeof X.data.reply=="string"?X.data.reply:x,sources:X.data.sources,...b.length>0?{toolUses:b}:{},...Array.isArray(X.data.attachments)?{attachments:X.data.attachments}:{}}}else if(X.event==="error")throw new qe(typeof X.data.error=="string"?X.data.error:"Something went wrong. Please try again.",0,"STREAM_ERROR")}}}}finally{(O=u.signal)==null||O.removeEventListener("abort",M),h.releaseLock()}if((Y=u.signal)!=null&&Y.aborted)return{reply:x,aborted:!0,...E.length>0?{toolUses:E}:{}};if(T)return T;throw new qe("Connection interrupted. Please try again.",0,"STREAM_ERROR")}async fetchStream(c,u){const h=new AbortController,g=()=>h.abort();u==null||u.addEventListener("abort",g,{once:!0});let k=!1;const x=this.timeoutMs>0?setTimeout(()=>{k=!0,h.abort()},this.timeoutMs):void 0,{headers:E,body:T}=this.buildRequest(c);try{return await fetch(`${this.baseUrl}/api/chat/stream`,{method:"POST",headers:E,body:T,signal:h.signal})}catch(M){throw k?new qe("Request timed out. Please try again.",0,"TIMEOUT"):M}finally{x!==void 0&&clearTimeout(x),u==null||u.removeEventListener("abort",g)}}async fetchWithTimeout(c){const{headers:u,body:h}=this.buildRequest(c);if(this.timeoutMs<=0)return fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:u,body:h});const g=new AbortController,k=setTimeout(()=>g.abort(),this.timeoutMs);try{return await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:u,body:h,signal:g.signal})}catch(x){throw g.signal.aborted?new qe("Request timed out. Please try again.",0,"TIMEOUT"):x}finally{clearTimeout(k)}}isRetryable(c,u){return u==="TIMEOUT"||u==="NETWORK_ERROR"?!0:c===429||c===503}getRetryDelay(c,u){if(c&&c.status===429){const h=c.headers.get("Retry-After");if(h){const g=Number(h);return Math.min(g*1e3,6e4)}}return u===0?1e3:3e3}delay(c){return new Promise(u=>setTimeout(u,c))}}function kc(s){let c="message";const u=[];for(const h of s.split(` -`))h.startsWith("event:")?c=h.slice(6).trim():h.startsWith("data:")&&u.push(h.slice(5).trimStart());if(u.length===0)return null;try{const h=JSON.parse(u.join(` -`));return typeof h!="object"||h===null?null:{event:c,data:h}}catch{return null}}function ru(s){return typeof s=="string"?{content:s}:s}function Xl(s,c,u){console.error(`[claudius] plugin "${s.name}" failed in ${c}:`,u)}async function Ec(s,c,u){let h=c;for(const g of s){if(!g.onBeforeSend)continue;let k=null;const x={...u,respondWith(E){k={type:"respond",message:h,reply:ru(E)}},abort(E){k={type:"abort",reason:E}}};try{const E=await g.onBeforeSend(h,x);if(k)return k;E&&(h=E)}catch(E){Xl(g,"onBeforeSend",E)}}return{type:"send",message:h}}async function Cc(s,c,u){let h=c;for(const g of s)if(g.onAfterReceive)try{const k=await g.onAfterReceive(h,u);k&&(h=k)}catch(k){Xl(g,"onAfterReceive",k)}return h}async function Tc(s,c,u){for(const h of s){if(!h.onError)continue;let g=null;const k={...u,respondWith(x){g=ru(x)}};try{if(await h.onError(c,k),g)return g}catch(x){Xl(h,"onError",x)}}return null}const zr={maxSizeBytes:5*1024*1024,maxCount:5,allowedTypes:["image/jpeg","image/png","image/gif","image/webp","application/pdf"]};function Nc(s){return s?s===!0?zr:{maxSizeBytes:s.maxSizeBytes??zr.maxSizeBytes,maxCount:s.maxCount??zr.maxCount,allowedTypes:(s.allowedTypes??zr.allowedTypes).map(c=>c.trim().toLowerCase()).filter(Boolean)}:null}function ql(s){if(!Number.isFinite(s)||s<0)return"0 B";if(s<1024)return`${s} B`;const c=s/1024;if(c<1024)return`${Math.round(c)} KB`;const u=c/1024;return`${Number.isInteger(u)?u:u.toFixed(1)} MB`}const Rc={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",pdf:"application/pdf"};function lu(s){var h;const c=(s.type||"").trim().toLowerCase();if(c)return c;const u=((h=s.name.split(".").pop())==null?void 0:h.toLowerCase())??"";return Rc[u]??""}function _c(s){return s.startsWith("image/")}function jc(s){if(_c(s.mediaType)){if(s.url)try{const c=new URL(s.url);if(c.protocol==="http:"||c.protocol==="https:")return s.url}catch{}if(s.data)return`data:${s.mediaType};base64,${s.data}`}}function Lc(s,c,u){const h=[],g=[];let k=Math.max(0,u.maxCount-c);for(const x of s){const E=lu(x);!E||!u.allowedTypes.includes(E)?g.push({file:x,reason:"type"}):x.size>u.maxSizeBytes||x.size===0?g.push({file:x,reason:"size"}):k<=0?g.push({file:x,reason:"count"}):(h.push(x),k-=1)}return{accepted:h,rejected:g}}function Mc(s){return new Promise((c,u)=>{const h=new FileReader;h.onerror=()=>u(h.error??new Error("Failed to read file")),h.onload=()=>{const g=String(h.result??""),k=g.indexOf(",");c(k>=0?g.slice(k+1):g)},h.readAsDataURL(s)})}let iu=0;function Pc(){return iu+=1,`att-${Date.now().toString(36)}-${iu}`}async function zc(s){const c=await Mc(s);return{id:Pc(),name:s.name||"attachment",mediaType:lu(s),size:s.size,data:c}}function Dc(s){return s.map(c=>{var u;return(u=c.attachments)!=null&&u.some(h=>h.data)?{...c,attachments:c.attachments.map(h=>{if(!h.data)return h;const g={...h};return delete g.data,g})}:c})}function Oc(s,c){if(!c||c.length===0)return s;const u=new Map(c.map(h=>[h.id,h]));return s.map(h=>{var g;return(g=h.attachments)!=null&&g.some(k=>u.has(k.id))?{...h,attachments:h.attachments.map(k=>{const x=u.get(k.id);if(!x)return k;const E={...k,key:x.key,url:x.url,expiresAt:x.expiresAt};return delete E.data,E})}:h})}const Ac=200,Ic="claudius:messages";function Fc(s,c){let u;try{u=new URL(c).host}catch{u=c}return`${s}:${u}`}function Zl(){try{return typeof sessionStorage<"u"?sessionStorage:null}catch{return null}}function Uc(s){const c=Zl();if(!c)return[];try{const u=c.getItem(s);if(!u)return[];const h=JSON.parse(u);return Array.isArray(h)?h:[]}catch{return[]}}function Bc({apiUrl:s,persistMessages:c=!0,storageKeyPrefix:u=Ic,timeoutMs:h,translations:g,plugins:k,streaming:x=!0}){const E=P.useMemo(()=>new Sc(s,{debounceMs:0,timeoutMs:h}),[s,h]),T=Fc(u,s),M=c?Uc(T):[],[W,H]=P.useState(M),[te,ie]=P.useState(!1),[oe,O]=P.useState(!1),[Y,se]=P.useState(null),[ae,ue]=P.useState(null),[X,b]=P.useState(!1),he=P.useRef(M.length),ge=P.useRef(!1),ne=P.useRef(M),Le=P.useRef(null),de=P.useRef(k??[]);de.current=k??[];const Se=P.useCallback(C=>{if(!c)return;const f=Zl();if(f)try{const S=Dc(C.slice(-Ac));f.setItem(T,JSON.stringify(S))}catch{}},[c,T]),ke=()=>(he.current+=1,`msg-${he.current}`),q=P.useCallback((C,f)=>{if(!g)return f??"Something went wrong. Please try again.";switch(C){case"TIMEOUT":return g.errorTimeout;case"NETWORK_ERROR":return g.errorConnection;case"RATE_LIMITED":return f!=null&&f.includes("minute")?g.errorRateLimitMinute:g.errorRateLimitHour;case"ATTACHMENT_QUOTA_EXCEEDED":return g.errorAttachmentQuota;case"ATTACHMENTS_DISABLED":case"ATTACHMENT_INVALID":case"ATTACHMENT_TOO_LARGE":return g.errorAttachmentRejected;case"VALIDATION_ERROR":case"CONFIG_ERROR":case"SERVICE_ERROR":case"UNKNOWN_ERROR":default:return f??g.errorGeneric}},[g]),Re=P.useCallback(C=>!(C instanceof qe)||C.code==="TIMEOUT"||C.code==="NETWORK_ERROR"||C.code==="RATE_LIMITED"||C.code==="SERVICE_ERROR"||C.code==="UNKNOWN_ERROR"||C.status>=500||C.status===0,[]),ze=P.useCallback(async C=>{var re,ee;ie(!0),ge.current=!0,ue(null),b(!1);const f=x&&typeof E.streamMessage=="function";let S=null;const B=I=>{if(S===null){S=ke(),se(S);const K=[...ne.current,{id:S,role:"assistant",content:"",...I}];ne.current=K,H(K)}else{const K=S,G=ne.current.map(ye=>ye.id===K?{...ye,...I}:ye);ne.current=G,H(G)}},J=()=>{if(S===null)return;const I=S,K=ne.current.filter(G=>G.id!==I);ne.current=K,H(K)};try{let I,K,G,ye,Ze=!1;if(f){const Ke=new AbortController;Le.current=Ke,O(!0);const De=await E.streamMessage(C,{signal:Ke.signal,onChunk:(Ut,Bt)=>B({content:Bt}),onToolUse:(Ut,Bt)=>B({toolUses:[...Bt]})});I=De.reply,K=De.sources,G=De.toolUses,ye=De.attachments,Ze=De.aborted??!1}else{const Ke=await E.sendMessage(C);I=Ke.reply,K=Ke.sources,G=Ke.toolUses,ye=Ke.attachments}if(Ze&&!I){J();return}let kt={id:S??ke(),role:"assistant",content:I,sources:K,toolUses:G};de.current.length>0&&!Ze&&(kt=await Cc(de.current,kt,{messages:C,apiUrl:s}));const Ft=S!==null?ne.current.map(Ke=>Ke.id===kt.id?kt:Ke):[...C,kt],Et=Oc(Ft,ye);ne.current=Et,H(Et),Se(Et)}catch(I){if(I instanceof Yl)return;if(I instanceof qe&&((re=I.code)!=null&&re.startsWith("ATTACHMENT"))&&C.length>0){const K=C[C.length-1];if(K.role==="user"&&((ee=K.attachments)!=null&&ee.length)){const G=C.slice(0,-1);ne.current=G,H(G),Se(G)}}if(S!==null){Se(ne.current),I instanceof qe?ue(q(I.code,I.message)):ue((g==null?void 0:g.errorConnection)??"Failed to connect. Please try again."),b(!1);return}if(de.current.length>0){const K=I instanceof Error?I:new Error(String(I)),G=await Tc(de.current,K,{messages:C,apiUrl:s});if(G){const ye={id:ke(),role:"assistant",content:G.content,sources:G.sources},Ze=[...C,ye];ne.current=Ze,H(Ze),Se(Ze),ue(null),b(!1);return}}I instanceof qe?ue(q(I.code,I.message)):ue((g==null?void 0:g.errorConnection)??"Failed to connect. Please try again."),b(Re(I))}finally{ie(!1),ge.current=!1,O(!1),se(null),Le.current=null}},[s,E,q,Re,Se,x,g]),Me=P.useCallback(()=>{var C;(C=Le.current)==null||C.abort()},[]),me=P.useCallback(async(C,f)=>{const S=C.trim(),B=(f==null?void 0:f.filter(I=>I&&I.id))??[];if(!S&&B.length===0||ge.current)return;const J={id:ke(),role:"user",content:S,...B.length>0?{attachments:B}:{}};let re=J;if(de.current.length>0){const I=await Ec(de.current,J,{messages:ne.current,apiUrl:s});if(I.type==="abort")return;if(I.type==="respond"){const K={id:ke(),role:"assistant",content:I.reply.content,sources:I.reply.sources},G=[...ne.current,I.message,K];ne.current=G,H(G),Se(G),ue(null),b(!1);return}re=I.message}const ee=[...ne.current,re];ne.current=ee,H(ee),Se(ee),await ze(ee)},[s,Se,ze]),L=P.useCallback(async()=>{if(ge.current)return;const C=ne.current[ne.current.length-1];!C||C.role!=="user"||await ze(ne.current)},[ze]),V=P.useCallback(()=>{if(ne.current=[],H([]),ue(null),b(!1),c){const C=Zl();if(!C)return;try{C.removeItem(T)}catch{}}},[c,T]);return{messages:W,isLoading:te,isStreaming:oe,streamingMessageId:Y,error:ae,canRetry:X,sendMessage:me,stop:Me,retry:L,clearMessages:V}}function Hc(s){const[c,u]=P.useState(()=>typeof window>"u"?!1:window.matchMedia(s).matches);return P.useEffect(()=>{const h=window.matchMedia(s);u(h.matches);const g=k=>u(k.matches);return h.addEventListener("change",g),()=>h.removeEventListener("change",g)},[s]),c}function Dr(s,c){return s instanceof RegExp?s.test(c):c.toLowerCase().includes(s.toLowerCase())}function Vc(){const s=document.documentElement,c=document.body,u=s.scrollTop||c.scrollTop||0,h=Math.max(s.scrollHeight,c.scrollHeight),g=s.clientHeight||window.innerHeight,k=h-g;return k<=0?100:u/k*100}function Wc({triggers:s,enabled:c,onOpen:u,onGreeting:h}){P.useEffect(()=>{if(!c||!s||s.length===0)return;const g=new Set,k=[],x=typeof window<"u"?window.location.href:"",E=(T,M)=>{g.has(T)||(g.add(T),M==="open"?u():h(M.greeting))};return s.forEach((T,M)=>{switch(T.on){case"url":{Dr(T.pattern,x)&&E(M,T.action);break}case"time":{if(T.matchUrl&&!Dr(T.matchUrl,x))return;const W=window.setTimeout(()=>E(M,T.action),Math.max(0,T.seconds*1e3));k.push(()=>window.clearTimeout(W));break}case"scroll":{if(T.matchUrl&&!Dr(T.matchUrl,x))return;const W=()=>{Vc()>=T.percent&&E(M,T.action)};W(),window.addEventListener("scroll",W,{passive:!0}),k.push(()=>window.removeEventListener("scroll",W));break}case"exit-intent":{if(T.matchUrl&&!Dr(T.matchUrl,x))return;const W=H=>{H.clientY<=0&&E(M,T.action)};document.addEventListener("mouseleave",W),k.push(()=>document.removeEventListener("mouseleave",W));break}}}),()=>{k.forEach(T=>T())}},[s,c,u,h])}const $c={"bottom-right":"bottom-6 right-6","bottom-left":"bottom-6 left-6","top-right":"top-6 right-6","top-left":"top-6 left-6"},Qc=P.forwardRef(function({isOpen:c,onClick:u,position:h="bottom-right",translations:g},k){const x=c?(g==null?void 0:g.closeChat)??"Close chat":(g==null?void 0:g.openChat)??"Open chat";return y.jsx("button",{ref:k,onClick:u,"aria-label":x,className:`fixed ${$c[h]} z-50 flex h-14 w-14 items-center justify-center rounded-claudius-full bg-claudius-accent text-claudius-accent-text shadow-claudius-floating transition-transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-claudius-accent focus:ring-offset-2`,children:c?y.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):y.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})})}),Kc=P.memo(function({count:c,isActive:u,onClick:h}){return y.jsxs("button",{onClick:h,"aria-label":"View sources",title:"View sources",className:`group relative flex h-7 w-7 items-center justify-center rounded-claudius-full transition-colors ${u?"bg-claudius-accent text-claudius-accent-text":"text-claudius-text-muted hover:bg-claudius-surface-muted hover:text-claudius-text"}`,children:[y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),y.jsx("polyline",{points:"14 2 14 8 20 8"}),y.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),y.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),y.jsx("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-claudius-full bg-claudius-accent px-1 text-[10px] font-bold text-claudius-accent-text",children:c})]})}),Gc=["http:","https:"];function Jl(s){if(!s||typeof s!="string")return null;const c=s.trim();if(!c)return null;try{const u=new URL(c);return Gc.includes(u.protocol)?c:null}catch{return null}}function Yc(){return y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),y.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function ou({label:s,onClick:c}){return y.jsx("button",{type:"button",onClick:c,"aria-label":s,className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-claudius-full bg-claudius-text text-claudius-surface shadow-claudius-floating hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-accent",children:y.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}const uu=P.memo(function({attachment:c,variant:u,onRemove:h,removeLabel:g}){const k=jc(c),x=u==="composer",E=`${c.name} (${ql(c.size)})`,T=c.url?Jl(c.url):null;if(k){const W=y.jsx("img",{src:k,alt:c.name,title:E,loading:"lazy",className:x?"h-12 w-12 rounded-claudius-sm border border-claudius-border object-cover":"max-h-48 max-w-full rounded-claudius-sm object-contain"});return y.jsxs("div",{className:"relative inline-block",children:[!x&&T?y.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",children:[W,y.jsxs("span",{className:"sr-only",children:[E," (opens in a new tab)"]})]}):W,h&&g&&y.jsx(ou,{label:g,onClick:h})]})}const M=y.jsxs("span",{title:E,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-claudius-sm border px-2 py-1 text-xs ${x?"border-claudius-border bg-claudius-field text-claudius-text":"border-current/30 bg-transparent"}`,children:[y.jsx(Yc,{}),y.jsx("span",{className:"truncate",children:c.name}),y.jsx("span",{className:"shrink-0 opacity-70",children:ql(c.size)})]});return y.jsxs("div",{className:"relative inline-block",children:[!x&&T?y.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:[M,y.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}):M,h&&g&&y.jsx(ou,{label:g,onClick:h})]})});function Xc(s){const c=s.lastIndexOf(` -`),u=c===-1?"":s.slice(0,c+1);let h=c===-1?s:s.slice(c+1);return h=Jc(h),h=bc(h),u+h}function qc(s){const c=[];for(let u=0;ug(x=>!x),"aria-expanded":k?h:void 0,className:"flex items-center gap-1.5 rounded-claudius-full border border-claudius-border bg-claudius-surface px-2 py-0.5 hover:opacity-80 disabled:cursor-default disabled:hover:opacity-100",children:[y.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),y.jsxs("span",{children:[c," ",y.jsx("span",{className:"font-mono text-claudius-text",children:s.name}),s.isError&&y.jsx("span",{className:"text-claudius-error",children:" ✕"})]}),k&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"sr-only",children:u}),y.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:h?"rotate-180":void 0,children:y.jsx("polyline",{points:"6 9 12 15 18 9"})})]})]}),h&&k&&y.jsxs("div",{className:"mt-1 overflow-x-auto rounded-claudius-sm border border-claudius-border bg-claudius-field p-2 font-mono",children:[s.input!==void 0&&y.jsx("pre",{className:"whitespace-pre-wrap break-all",children:JSON.stringify(s.input,null,2)}),s.result!==void 0&&y.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-all border-t border-claudius-border pt-1",children:s.result})]})]})}const su=/(https?:\/\/[^\s)]+)/,au=/(\*\*[^*]+\*\*)/,cu=/(\*[^*]+\*)/;function tf(s,c){const u=s.match(/[.,;:!?'"]+$/),h=u?s.slice(0,-u[0].length):s,g=u?u[0]:"",k=Jl(h);return k?y.jsxs(y.Fragment,{children:[y.jsxs("a",{href:k,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium hover:opacity-80 text-claudius-link",children:[k.replace(/^https?:\/\//,""),y.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]},c),g]}):s}function nf(s,c){const u=s.split(au),h=[];return u.forEach((g,k)=>{if(au.test(g)){const x=g.slice(2,-2);h.push(y.jsx("strong",{children:x},`${c}-b${k}`))}else g.split(cu).forEach((E,T)=>{if(cu.test(E)){const M=E.slice(1,-1);h.push(y.jsx("em",{children:M},`${c}-b${k}-i${T}`))}else E.split(su).forEach((W,H)=>{su.test(W)?h.push(tf(W,`${c}-b${k}-i${T}-u${H}`)):W&&h.push(W)})})}),h}function rf(s){const c=s.split(` -`);return c.map((u,h)=>y.jsxs("span",{children:[nf(u,`l${h}`),h0,ie=h?Xc(u):u,oe=H||u!==""||!(x!=null&&x.length);return y.jsxs("div",{className:`${H?"ml-auto":"mr-auto"} max-w-[85%]`,children:[oe&&y.jsxs("div",{className:`rounded-claudius-bubble px-4 py-2.5 text-sm leading-relaxed font-body ${H?"bg-claudius-user-bubble text-claudius-user-bubble-text rounded-br-claudius-tail":"bg-claudius-assistant-bubble text-claudius-assistant-bubble-text rounded-bl-claudius-tail"}`,children:[te&&y.jsx("ul",{className:`flex flex-wrap gap-2 ${u?"mb-2":""}`,"aria-label":"Attachments",children:k.map(O=>y.jsx("li",{children:y.jsx(uu,{attachment:O,variant:"message"})},O.id))}),(u!==""||!te)&&rf(ie)]}),!H&&x&&x.length>0&&y.jsx("div",{className:"mt-1 space-y-1",children:x.map((O,Y)=>y.jsx(ef,{toolUse:O,usedLabel:E,detailsLabel:T},`${O.name}-${Y}`))}),!H&&g&&g.length>0&&M&&y.jsx("div",{className:"mt-1",children:y.jsx(Kc,{count:g.length,isActive:W??!1,onClick:M})})]})}),fu={title:"Chat",subtitle:"Ask me anything",welcomeMessage:"Hi! How can I help you today?",closeChat:"Close chat",chatMessages:"Chat messages",typingIndicator:"Assistant is typing",placeholder:"Type your message...",sendMessage:"Send message",stopGenerating:"Stop generating",toolUsed:"Used tool:",toolDetails:"Tool details",typeYourMessage:"Type your message",openChat:"Open chat",dismissGreeting:"Dismiss greeting",attachFile:"Attach a file",removeAttachment:"Remove attachment",attachmentsLabel:"Attachments",dropFilesHint:"Drop files to attach",attachmentTooLarge:"{name} is too large. The maximum size is {max}.",attachmentTypeNotAllowed:"{name} is not a supported file type.",attachmentTooMany:"You can attach up to {max} files per message.",errorGeneric:"Something went wrong. Please try again.",errorConnection:"Failed to connect. Please try again.",errorTimeout:"Request timed out. Please try again.",errorRateLimitMinute:"Too many requests. Please wait a minute.",errorRateLimitHour:"Hourly limit reached. Please try again later.",errorAttachmentRejected:"An attachment was rejected. Please remove it and try again.",errorAttachmentQuota:"Upload limit reached. Please try again later.",errorRetry:"Retry"},of=fu;function bl(s,c){return s.replace(/\{(\w+)\}/g,(u,h)=>h in c?String(c[h]):u)}const ei=2e3,uf=1800;function du(s){var u;const c=(u=s.dataTransfer)==null?void 0:u.types;return!!c&&Array.from(c).includes("Files")}function sf({onSend:s,isLoading:c,isStreaming:u=!1,onStop:h,placeholder:g,translations:k,attachments:x=null}){const E=k??of,[T,M]=P.useState(""),[W,H]=P.useState([]),[te,ie]=P.useState(null),[oe,O]=P.useState(!1),Y=P.useRef(null),se=P.useRef(null),ae=P.useRef([]),ue=P.useRef(0),X=T.length,b=X>=uf,he=X>=ei,ge=g??E.placeholder,ne=!!x&&W.length{var f;c||(f=Y.current)==null||f.focus()},[c]);const de=P.useCallback((f,S)=>{if(!x)return"";switch(S){case"size":return bl(E.attachmentTooLarge,{name:f,max:ql(x.maxSizeBytes)});case"type":return bl(E.attachmentTypeNotAllowed,{name:f});case"count":return bl(E.attachmentTooMany,{max:x.maxCount})}},[x,E]),Se=P.useCallback(async f=>{if(!x||f.length===0)return;const{accepted:S,rejected:B}=Lc(f,ae.current.length,x);if(ie(B.length>0?de(B[0].file.name,B[0].reason):null),S.length===0)return;const J=await Promise.all(S.map(zc));ae.current=[...ae.current,...J],H(ae.current)},[x,de]),ke=P.useCallback(f=>{ae.current=ae.current.filter(S=>S.id!==f),H(ae.current),ie(null)},[]),q=f=>{f.preventDefault();const S=T.trim(),B=ae.current;!S&&B.length===0||he||(B.length>0?s(S,B):s(S),M(""),ae.current=[],H([]),ie(null))},Re=f=>{const S=f.target.value;S.length<=ei&&M(S)},ze=f=>{const S=Array.from(f.target.files??[]);f.target.value="",Se(S)},Me=f=>{var B;if(!x)return;const S=Array.from(((B=f.clipboardData)==null?void 0:B.files)??[]);S.length!==0&&(f.preventDefault(),Se(S))},me=f=>{!x||!du(f)||(f.preventDefault(),ue.current+=1,O(!0))},L=f=>{!x||!du(f)||f.preventDefault()},V=()=>{x&&(ue.current=Math.max(0,ue.current-1),ue.current===0&&O(!1))},C=f=>{var S;x&&(f.preventDefault(),ue.current=0,O(!1),Se(Array.from(((S=f.dataTransfer)==null?void 0:S.files)??[])))};return y.jsxs("form",{onSubmit:q,onDragEnter:me,onDragOver:L,onDragLeave:V,onDrop:C,"data-drag-over":oe||void 0,className:`relative border-t border-claudius-border bg-claudius-surface p-3 ${oe?"ring-2 ring-inset ring-claudius-accent":""}`,children:[oe&&y.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-claudius-surface text-sm font-medium text-claudius-accent",children:E.dropFilesHint}),x&&W.length>0&&y.jsx("ul",{"aria-label":E.attachmentsLabel,className:"mb-2 flex flex-wrap gap-3 pt-1",children:W.map(f=>y.jsx("li",{children:y.jsx(uu,{attachment:f,variant:"composer",onRemove:()=>ke(f.id),removeLabel:`${E.removeAttachment}: ${f.name}`})},f.id))}),y.jsxs("div",{className:"flex gap-2",children:[x&&y.jsxs(y.Fragment,{children:[y.jsx("input",{ref:se,type:"file",multiple:!0,hidden:!0,tabIndex:-1,accept:x.allowedTypes.join(","),onChange:ze,"aria-label":E.attachFile}),y.jsx("button",{type:"button",onClick:()=>{var f;return(f=se.current)==null?void 0:f.click()},disabled:c||!ne,"aria-label":E.attachFile,title:E.attachFile,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm border border-claudius-border bg-claudius-field text-claudius-text-muted transition-colors hover:text-claudius-text focus:border-claudius-accent focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:y.jsx("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"})})})]}),y.jsx("input",{ref:Y,type:"text",value:T,onChange:Re,onPaste:Me,placeholder:ge,disabled:c,"aria-label":E.typeYourMessage,"aria-describedby":b?"char-count":void 0,className:"min-w-0 flex-1 rounded-claudius-sm border border-claudius-border bg-claudius-field px-3 py-2 text-sm font-body text-claudius-text placeholder:text-claudius-text-muted focus:border-claudius-accent focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50"}),Le?y.jsx("button",{type:"button",onClick:h,"aria-label":E.stopGenerating,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm bg-claudius-accent text-claudius-accent-text transition-colors hover:opacity-90",children:y.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})}):y.jsx("button",{type:"submit",disabled:c||he,"aria-label":E.sendMessage,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm bg-claudius-accent text-claudius-accent-text transition-colors hover:opacity-90 disabled:opacity-50",children:y.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),y.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),te&&y.jsx("div",{role:"alert",className:"mt-1 text-xs text-claudius-error",children:te}),b&&y.jsxs("div",{id:"char-count",className:`mt-1 text-xs text-right ${he?"text-claudius-error":"text-claudius-text-muted"}`,"aria-live":"polite",children:[X,"/",ei]})]})}const af=["blog","page","external"],cf={blog:"Blog",page:"Page",external:"External"};function ff(s){try{return new URL(s).hostname}catch{return s}}const df=P.memo(function({sources:c,onClose:u}){const h=af.map(k=>({type:k,label:cf[k],items:c.filter(x=>x.type===k)})).filter(k=>k.items.length>0),g=c.length===1?"1 source found":`${c.length} sources found`;return y.jsxs("div",{className:"absolute inset-y-0 left-0 z-10 flex w-[280px] flex-col border-r-2 border-claudius-border bg-claudius-surface rounded-r-claudius-lg transition-transform duration-200 ease-out",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-claudius-border px-4 py-3",children:[y.jsxs("div",{children:[y.jsx("h3",{className:"text-sm font-heading font-semibold text-claudius-text",children:"Sources"}),y.jsx("p",{className:"text-xs text-claudius-text-muted",children:g})]}),y.jsx("button",{onClick:u,"aria-label":"Close sources",className:"flex h-7 w-7 items-center justify-center rounded-claudius-full text-claudius-text-muted transition-colors hover:bg-claudius-surface-muted hover:text-claudius-text",children:y.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),y.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-4",children:h.map(k=>y.jsxs("div",{children:[y.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-claudius-text-muted",children:k.label}),y.jsx("div",{className:"space-y-2",children:k.items.map(x=>{const E=Jl(x.url);return E?y.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"block rounded-claudius-md border-2 border-claudius-border bg-claudius-surface-muted p-3 transition-colors hover:bg-claudius-border",children:[y.jsx("p",{className:"truncate text-sm font-medium text-claudius-text",children:x.title}),y.jsx("p",{className:"mt-0.5 text-xs text-claudius-text-muted",children:ff(E)})]},E):null})})]},k.type))})]})});function pf({title:s,subtitle:c,titleId:u,closeLabel:h,onClose:g}){return y.jsxs("div",{className:"flex items-center gap-3 bg-claudius-accent px-5 py-4",children:[y.jsx("div",{"aria-hidden":"true",className:"flex h-8 w-8 items-center justify-center rounded-claudius-full bg-claudius-accent-soft text-sm font-bold text-claudius-accent-text",children:s.charAt(0).toUpperCase()}),y.jsxs("div",{className:"flex-1",children:[y.jsx("h2",{id:u,className:"text-sm font-heading font-semibold text-claudius-accent-text",children:s}),y.jsx("p",{className:"text-xs text-claudius-accent-text",children:c})]}),y.jsx("button",{onClick:g,"aria-label":h,className:"flex h-10 w-10 items-center justify-center rounded-claudius-full text-claudius-accent-text-muted transition-colors hover:bg-claudius-accent-soft hover:text-claudius-accent-text",children:y.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[y.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),y.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function hf({message:s,retryLabel:c,onRetry:u}){return y.jsxs("div",{role:"alert",className:"mx-auto flex max-w-[90%] flex-col items-center gap-2 rounded-claudius-sm bg-claudius-error-surface px-3 py-2 text-center text-xs text-claudius-error",children:[y.jsx("span",{children:s}),u&&y.jsx("button",{type:"button",onClick:u,className:"rounded-claudius-md bg-claudius-error px-3 py-1 text-xs font-semibold text-claudius-error-text transition-opacity hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-error focus-visible:ring-offset-1",children:c})]})}function mf({label:s}){return y.jsx("div",{role:"status","aria-live":"polite","aria-label":s,className:"mr-auto flex max-w-[85%]",children:y.jsxs("div",{className:"flex gap-1 rounded-claudius-bubble rounded-bl-claudius-tail bg-claudius-assistant-bubble px-4 py-3",children:[y.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:0ms]"}),y.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:150ms]"}),y.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:300ms]"})]})})}function gf(s,c,u){const[h,g]=P.useState(0),k=P.useRef(0),x=P.useRef(0),E=P.useRef(0),T=P.useRef(!1);return P.useEffect(()=>{const M=s.current;if(!u||!M)return;const W=ie=>{if(M.scrollTop>0){T.current=!1;return}T.current=!0,x.current=ie.touches[0].clientY,E.current=Date.now()},H=ie=>{if(!T.current)return;let oe=ie.touches[0].clientY-x.current;oe<0&&(oe=oe*.3),k.current=oe,g(oe)},te=()=>{if(!T.current)return;T.current=!1;const ie=k.current,oe=(Date.now()-E.current)/1e3,O=M.getBoundingClientRect().height,Y=oe>.05&&ie>0&&ie/oe>500,se=ie>O*.3;Y||se?c():(k.current=0,g(0))};return M.addEventListener("touchstart",W,{passive:!0}),M.addEventListener("touchmove",H,{passive:!0}),M.addEventListener("touchend",te),()=>{M.removeEventListener("touchstart",W),M.removeEventListener("touchmove",H),M.removeEventListener("touchend",te)}},[s,c,u]),{offsetY:h}}const vf='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function yf(s,c){P.useEffect(()=>{const u=s.current;if(!u)return;const h=g=>{if(g.key!=="Tab")return;const k=Array.from(u.querySelectorAll(vf)).filter(M=>!M.hasAttribute("aria-hidden"));if(k.length===0)return;const x=k[0],E=k[k.length-1],T=document.activeElement;g.shiftKey&&T===x?(g.preventDefault(),E.focus()):!g.shiftKey&&T===E&&(g.preventDefault(),x.focus())};return u.addEventListener("keydown",h),()=>u.removeEventListener("keydown",h)},[s,c])}const wf=/\*\*([^*]+)\*\*/g,xf=/\*([^*]+)\*/g,Sf=/https?:\/\/[^\s)]+/g;function kf(s){return s.replace(wf,"$1").replace(xf,"$1").replace(Sf,c=>{try{return new URL(c).hostname}catch{return c}})}const Ef={"bottom-right":"bottom-24 right-3 sm:right-6","bottom-left":"bottom-24 left-3 sm:left-6","top-right":"top-24 right-3 sm:right-6","top-left":"top-24 left-3 sm:left-6"};function Cf({messages:s,isLoading:c,isStreaming:u=!1,streamingMessageId:h=null,error:g,canRetry:k=!1,onSend:x,onStop:E,onRetry:T,onClose:M,title:W="Chat",subtitle:H="Ask me anything",welcomeMessage:te="Hi! How can I help you today?",placeholder:ie,position:oe="bottom-right",translations:O,isMobile:Y=!1,attachments:se=null}){const ae=P.useId(),ue=P.useRef(null),X=P.useRef(null),[b,he]=P.useState(null);yf(ue,!0);const{offsetY:ge}=gf(X,M,Y),ne=ge!==0,Le=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1;P.useEffect(()=>{const q=X.current;q&&(q.scrollTop=q.scrollHeight)},[s,c]),P.useEffect(()=>{const q=Re=>{Re.key==="Escape"&&!Re.isComposing&&M()};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[M]);const de=(O==null?void 0:O.closeChat)??"Close chat",Se=(O==null?void 0:O.chatMessages)??"Chat messages",ke=[...s].reverse().find(q=>q.role==="assistant");return y.jsxs("div",{ref:ue,role:"dialog","aria-modal":Y?"true":void 0,"aria-labelledby":ae,className:Y?"claudius-bottom-sheet fixed inset-x-0 bottom-0 z-50 flex h-[90vh] w-full flex-col overflow-hidden rounded-t-claudius-lg bg-claudius-surface shadow-claudius-elevated font-body":`fixed ${Ef[oe]} z-50 flex h-[min(500px,calc(100vh-7rem))] w-[calc(100vw-1.5rem)] max-w-[380px] sm:max-w-[400px] md:max-w-[440px] flex-col overflow-hidden rounded-claudius-lg bg-claudius-surface shadow-claudius-elevated font-body`,style:Y&&!Le?{transform:`translateY(${Math.max(0,ge)}px)`}:void 0,"data-dragging":ne||void 0,children:[Y&&y.jsx("div",{className:"flex justify-center py-2","aria-hidden":"true",children:y.jsx("div",{className:"h-1 w-8 rounded-claudius-full bg-claudius-border"})}),y.jsx(pf,{title:W,subtitle:H,titleId:ae,closeLabel:de,onClose:M}),y.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[b&&y.jsx(df,{sources:b.sources,onClose:()=>he(null)}),y.jsxs("div",{ref:X,role:"log","aria-label":Se,className:"h-full space-y-3 overflow-y-auto px-4 py-4",children:[s.length===0&&!g&&y.jsx("div",{className:"mr-auto flex max-w-[85%]",children:y.jsx("div",{className:"rounded-claudius-bubble rounded-bl-claudius-tail bg-claudius-assistant-bubble px-4 py-2.5 text-sm leading-relaxed text-claudius-assistant-bubble-text",children:te})}),s.map(q=>y.jsx(lf,{role:q.role,content:q.content,isStreaming:q.id===h,sources:q.sources,attachments:q.attachments,toolUses:q.toolUses,toolUsedLabel:O==null?void 0:O.toolUsed,toolDetailsLabel:O==null?void 0:O.toolDetails,isSourceActive:(b==null?void 0:b.messageId)===q.id,onSourceClick:()=>{(b==null?void 0:b.messageId)===q.id?he(null):q.sources&&q.sources.length>0&&he({messageId:q.id,sources:q.sources})}},q.id)),c&&!(h!==null&&s.some(q=>q.id===h&&q.content.length>0))&&y.jsx(mf,{label:(O==null?void 0:O.typingIndicator)??"Assistant is typing"}),g&&y.jsx(hf,{message:g,retryLabel:(O==null?void 0:O.errorRetry)??"Retry",onRetry:k&&T&&!c?T:void 0})]})]}),y.jsx("div",{"data-claudius-live":"assistant","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:ke&&ke.id!==h?kf(ke.content):""}),y.jsx(sf,{onSend:x,isLoading:c,isStreaming:u,onStop:E,placeholder:ie,translations:O,attachments:se})]})}function Tf({message:s,position:c,onOpen:u,onDismiss:h,dismissLabel:g}){const k=c.startsWith("bottom"),x=c.endsWith("right"),E=["claudius-greeting-bubble","fixed z-40 max-w-xs",k?"bottom-20":"top-20",x?"right-4":"left-4"].join(" ");return y.jsxs("div",{className:E,role:"status","aria-live":"polite",children:[y.jsx("button",{type:"button",onClick:u,className:"block w-full rounded-claudius-lg bg-claudius-surface p-4 pr-8 text-left text-sm font-body text-claudius-text shadow-claudius-floating ring-1 ring-claudius-border transition hover:shadow-claudius-floating-hover focus:outline-none focus:ring-2 focus:ring-claudius-accent",children:s}),y.jsx("button",{type:"button",onClick:T=>{T.stopPropagation(),h()},"aria-label":g,className:"absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-claudius-full text-claudius-text-muted hover:bg-claudius-surface-muted focus:outline-none focus:ring-2 focus:ring-claudius-accent",children:y.jsx("span",{"aria-hidden":"true",children:"×"})})]})}const pu={en:fu,es:{title:"Chat",subtitle:"Pregúntame lo que quieras",welcomeMessage:"¡Hola! ¿En qué puedo ayudarte hoy?",closeChat:"Cerrar chat",chatMessages:"Mensajes del chat",typingIndicator:"El asistente está escribiendo",placeholder:"Escribe tu mensaje...",sendMessage:"Enviar mensaje",stopGenerating:"Detener la respuesta",toolUsed:"Herramienta usada:",toolDetails:"Detalles de la herramienta",typeYourMessage:"Escribe tu mensaje",openChat:"Abrir chat",dismissGreeting:"Descartar saludo",attachFile:"Adjuntar un archivo",removeAttachment:"Quitar adjunto",attachmentsLabel:"Adjuntos",dropFilesHint:"Suelta los archivos para adjuntarlos",attachmentTooLarge:"{name} es demasiado grande. El tamaño máximo es {max}.",attachmentTypeNotAllowed:"{name} no es un tipo de archivo compatible.",attachmentTooMany:"Puedes adjuntar hasta {max} archivos por mensaje.",errorGeneric:"Algo salió mal. Inténtalo de nuevo.",errorConnection:"No se pudo conectar. Inténtalo de nuevo.",errorTimeout:"La solicitud tardó demasiado. Inténtalo de nuevo.",errorRateLimitMinute:"Demasiadas solicitudes. Espera un minuto.",errorRateLimitHour:"Has alcanzado el límite por hora. Inténtalo más tarde.",errorAttachmentRejected:"Se rechazó un adjunto. Quítalo e inténtalo de nuevo.",errorAttachmentQuota:"Límite de subida alcanzado. Inténtalo más tarde.",errorRetry:"Reintentar"},fr:{title:"Chat",subtitle:"Posez-moi vos questions",welcomeMessage:"Bonjour ! Comment puis-je vous aider aujourd'hui ?",closeChat:"Fermer le chat",chatMessages:"Messages du chat",typingIndicator:"L'assistant écrit",placeholder:"Saisissez votre message...",sendMessage:"Envoyer le message",stopGenerating:"Arrêter la génération",toolUsed:"Outil utilisé :",toolDetails:"Détails de l'outil",typeYourMessage:"Saisissez votre message",openChat:"Ouvrir le chat",dismissGreeting:"Ignorer le message d'accueil",attachFile:"Joindre un fichier",removeAttachment:"Retirer la pièce jointe",attachmentsLabel:"Pièces jointes",dropFilesHint:"Déposez les fichiers pour les joindre",attachmentTooLarge:"{name} est trop volumineux. La taille maximale est de {max}.",attachmentTypeNotAllowed:"{name} n'est pas un type de fichier pris en charge.",attachmentTooMany:"Vous pouvez joindre jusqu'à {max} fichiers par message.",errorGeneric:"Une erreur s'est produite. Veuillez réessayer.",errorConnection:"Échec de la connexion. Veuillez réessayer.",errorTimeout:"La requête a expiré. Veuillez réessayer.",errorRateLimitMinute:"Trop de requêtes. Veuillez patienter une minute.",errorRateLimitHour:"Limite horaire atteinte. Veuillez réessayer plus tard.",errorAttachmentRejected:"Une pièce jointe a été refusée. Retirez-la et réessayez.",errorAttachmentQuota:"Limite d'envoi atteinte. Veuillez réessayer plus tard.",errorRetry:"Réessayer"},de:{title:"Chat",subtitle:"Fragen Sie mich alles",welcomeMessage:"Hallo! Wie kann ich Ihnen heute helfen?",closeChat:"Chat schließen",chatMessages:"Chat-Nachrichten",typingIndicator:"Der Assistent schreibt",placeholder:"Geben Sie Ihre Nachricht ein...",sendMessage:"Nachricht senden",stopGenerating:"Generierung stoppen",toolUsed:"Verwendetes Tool:",toolDetails:"Tool-Details",typeYourMessage:"Geben Sie Ihre Nachricht ein",openChat:"Chat öffnen",dismissGreeting:"Begrüßung schließen",attachFile:"Datei anhängen",removeAttachment:"Anhang entfernen",attachmentsLabel:"Anhänge",dropFilesHint:"Dateien hier ablegen, um sie anzuhängen",attachmentTooLarge:"{name} ist zu groß. Die maximale Größe beträgt {max}.",attachmentTypeNotAllowed:"{name} ist kein unterstützter Dateityp.",attachmentTooMany:"Sie können bis zu {max} Dateien pro Nachricht anhängen.",errorGeneric:"Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",errorConnection:"Verbindung fehlgeschlagen. Bitte versuchen Sie es erneut.",errorTimeout:"Zeitüberschreitung der Anfrage. Bitte versuchen Sie es erneut.",errorRateLimitMinute:"Zu viele Anfragen. Bitte warten Sie eine Minute.",errorRateLimitHour:"Stündliches Limit erreicht. Bitte versuchen Sie es später erneut.",errorAttachmentRejected:"Ein Anhang wurde abgelehnt. Bitte entfernen Sie ihn und versuchen Sie es erneut.",errorAttachmentQuota:"Upload-Limit erreicht. Bitte versuchen Sie es später erneut.",errorRetry:"Erneut versuchen"}};function hu(s){if(!s)return;const c=s.toLowerCase().split("-")[0];return Object.prototype.hasOwnProperty.call(pu,c)?c:void 0}function Nf(){const s=typeof document<"u"?hu(document.documentElement.lang):void 0;if(s)return s;const c=typeof navigator<"u"?hu(navigator.language):void 0;return c||"en"}function Rf(s={}){const{locale:c,translations:u}=s,h=pu[c??Nf()];return u?{...h,...u}:{...h}}const mu=["accent","accentText","accentSoft","accentTextMuted","surface","surfaceMuted","text","textMuted","border","userBubble","userBubbleText","assistantBubble","assistantBubbleText","field","error","errorSurface","errorText","link","scrim"],_f=["sm","md","lg","full","tail"],jf=["elevated","floating","floatingHover"],Lf=["heading","body"],gu={default:{name:"default"},minimal:{name:"minimal",colors:{accent:"#171717",accentText:"#ffffff",surface:"#ffffff",surfaceMuted:"#f5f5f5",text:"#171717",textMuted:"#737373",border:"#e5e5e5",link:"#171717"},colorsDark:{accent:"#fafafa",accentText:"#171717",surface:"#0a0a0a",surfaceMuted:"#1c1c1c",text:"#fafafa",textMuted:"#a3a3a3",border:"#2e2e2e",field:"#1c1c1c",link:"#fafafa"},radii:{sm:"4px",md:"6px",lg:"10px"},shadows:{elevated:"0 4px 16px rgb(0 0 0 / 0.12)",floating:"0 2px 8px rgb(0 0 0 / 0.12)",floatingHover:"0 4px 12px rgb(0 0 0 / 0.16)"}},playful:{name:"playful",colors:{accent:"#8b5cf6",surfaceMuted:"#f5f3ff",assistantBubbleText:"#4c1d95",link:"#7c3aed"},colorsDark:{accent:"#a78bfa",surfaceMuted:"#2e1065",assistantBubbleText:"#ede9fe",link:"#c4b5fd"},radii:{sm:"12px",md:"16px",lg:"24px",tail:"8px"},shadows:{elevated:"0 24px 48px -12px rgb(139 92 246 / 0.35)",floating:"0 10px 20px -5px rgb(139 92 246 / 0.4)",floatingHover:"0 16px 28px -6px rgb(139 92 246 / 0.5)"},fonts:{heading:"ui-rounded, 'Hiragino Maru Gothic ProN', system-ui",body:"ui-rounded, 'Hiragino Maru Gothic ProN', system-ui"}},corporate:{name:"corporate",colors:{accent:"#1e3a5f",surfaceMuted:"#f3f4f6",text:"#1f2937",textMuted:"#6b7280",border:"#d1d5db",link:"#1d4ed8"},colorsDark:{accent:"#2c5282",link:"#93c5fd"},radii:{sm:"4px",md:"6px",lg:"8px",tail:"2px"},shadows:{elevated:"0 8px 24px rgb(15 23 42 / 0.16)",floating:"0 4px 12px rgb(15 23 42 / 0.18)",floatingHover:"0 6px 16px rgb(15 23 42 / 0.24)"},fonts:{heading:"'Segoe UI', 'Helvetica Neue', Arial, system-ui",body:"'Segoe UI', 'Helvetica Neue', Arial, system-ui"}}};function Mf(s){return Object.prototype.hasOwnProperty.call(gu,s)}const Pf=new Set(["light","dark","auto"]);function zf(s){if(s===void 0)return{mode:"light"};if(typeof s=="string"){if(Pf.has(s))return{mode:s};if(Mf(s)){const c=gu[s];return{mode:c.colorScheme??"light",theme:c}}return{mode:"light",url:s}}return{mode:s.colorScheme??"light",theme:s}}function Df(s){return s.replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`)}function Of(s,c){console.warn(`[Claudius] Ignoring unknown theme token "${c}" in "${s}"`)}function Kn(s,c,u,h,g,k=""){if(g)for(const[x,E]of Object.entries(g)){if(!h.includes(x)){Of(c,x);continue}typeof E=="string"&&(s[`${u}${Df(x)}${k}`]=E)}}function Af(s){const c={};Kn(c,"colors","--cl-color-",mu,s.colors);for(const[u,h]of Object.entries({...c}))c[`${u}-dark`]=h;return Kn(c,"colorsDark","--cl-color-",mu,s.colorsDark,"-dark"),Kn(c,"radii","--cl-radius-",_f,s.radii),Kn(c,"shadows","--cl-shadow-",jf,s.shadows),Kn(c,"fonts","--cl-font-",Lf,s.fonts),c}function If(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function Ff(s){const c=P.useMemo(()=>zf(s),[s]),[u,h]=P.useState(null),g=c.url;P.useEffect(()=>{if(h(null),!g)return;const T=new AbortController;return fetch(g,{signal:T.signal}).then(M=>{if(!M.ok)throw new Error(`HTTP ${M.status}`);return M.json()}).then(M=>{if(!If(M))throw new Error("theme JSON must be an object");h(M)}).catch(M=>{T.signal.aborted||console.error(`[Claudius] Failed to load theme from ${g}:`,M)}),()=>T.abort()},[g]);const k=c.theme??u??null,x=(u==null?void 0:u.colorScheme)??c.mode,E=P.useMemo(()=>k?Af(k):{},[k]);return{mode:x,cssVars:E}}const vu="claudius:triggers:dismissed";function Uf(){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(vu)==="1"}catch{return!1}}function Bf(){if(!(typeof window>"u"))try{window.sessionStorage.setItem(vu,"1")}catch{}}function yu({apiUrl:s,title:c,subtitle:u,welcomeMessage:h,placeholder:g,persistMessages:k,storageKeyPrefix:x,requestTimeoutMs:E,theme:T="light",accentColor:M,position:W="bottom-right",locale:H,translations:te,triggers:ie,plugins:oe,streaming:O=!0,attachments:Y=!1}){const[se,ae]=P.useState(!1),ue=P.useMemo(()=>Nc(Y),[Y]),[X,b]=P.useState(null),[he,ge]=P.useState(Uf),ne=P.useRef(!1),Le=Hc("(max-width: 639px)"),de=P.useMemo(()=>Rf({locale:H,translations:te}),[H,te]),{messages:Se,isLoading:ke,isStreaming:q,streamingMessageId:Re,error:ze,canRetry:Me,sendMessage:me,stop:L,retry:V}=Bc({apiUrl:s,persistMessages:k,storageKeyPrefix:x,timeoutMs:E,translations:de,plugins:oe,streaming:O}),C=P.useRef(null),f=P.useRef(se),{mode:S,cssVars:B}=Ff(T),[J,re]=P.useState(!1);P.useEffect(()=>{if(S!=="auto")return;const De=window.matchMedia("(prefers-color-scheme: dark)");re(De.matches);const Ut=Bt=>re(Bt.matches);return De.addEventListener("change",Ut),()=>De.removeEventListener("change",Ut)},[S]),P.useEffect(()=>{var De;f.current&&!se&&((De=C.current)==null||De.focus()),f.current=se},[se]);const ee=P.useCallback(()=>{ge(!0),Bf()},[]),I=P.useCallback(()=>{ae(!1),ne.current&&(ne.current=!1,ee())},[ee]),K=P.useCallback(()=>{ae(De=>!De)},[]),G=P.useCallback(()=>{ne.current=!0,b(null),ae(!0)},[]),ye=P.useCallback(De=>{b(De)},[]),Ze=P.useCallback(()=>{b(null),G()},[G]),kt=P.useCallback(()=>{b(null),ee()},[ee]);Wc({triggers:ie,enabled:!he&&!se,onOpen:G,onGreeting:ye});const Ft=S==="dark"||S==="auto"&&J,Et={...B,...M?{"--cl-color-accent":M,"--cl-color-accent-dark":M}:{}},Ke=Object.keys(Et).length>0?Et:void 0;return y.jsx("div",{className:"claudius-root",style:Ke,children:y.jsxs("div",{"data-claudius-dark":Ft?"true":"false",children:[se&&Le&&y.jsx("div",{className:"claudius-scrim fixed inset-0 z-40 bg-claudius-scrim",onClick:I,"aria-hidden":"true"}),se&&y.jsx(Cf,{messages:Se,isLoading:ke,isStreaming:q,streamingMessageId:Re,error:ze,canRetry:Me,onSend:me,onStop:L,onRetry:V,onClose:I,title:c??de.title,subtitle:u??de.subtitle,welcomeMessage:h??de.welcomeMessage,placeholder:g??de.placeholder,position:W,translations:de,isMobile:Le,attachments:ue}),!(se&&Le)&&y.jsx(Qc,{ref:C,isOpen:se,onClick:K,position:W,translations:de}),!se&&X&&y.jsx(Tf,{message:X,position:W,onOpen:Ze,onDismiss:kt,dismissLabel:de.dismissGreeting})]})})}const Hf="1.15.0";typeof window<"u"&&(window.ClaudiusWidgetVersion=Hf);function wu(){const s=window.ClaudiusConfig;if(!(s!=null&&s.apiUrl)){console.error("[Claudius] Missing ClaudiusConfig.apiUrl");return}const c=document.createElement("div");c.id="claudius-chat-widget",document.body.appendChild(c),nu.createRoot(c).render(y.jsx(yu,{apiUrl:s.apiUrl,title:s.title,subtitle:s.subtitle,welcomeMessage:s.welcomeMessage,placeholder:s.placeholder,persistMessages:s.persistMessages,storageKeyPrefix:s.storageKeyPrefix,requestTimeoutMs:s.requestTimeoutMs,theme:s.theme,accentColor:s.accentColor,position:s.position,locale:s.locale,translations:s.translations,triggers:s.triggers,attachments:s.attachments}))}class xu extends HTMLElement{constructor(){super(...arguments);un(this,"root",null);un(this,"container",null)}static get observedAttributes(){return["api-url","title","subtitle","welcome-message","placeholder","persist-messages","storage-key-prefix","request-timeout-ms","theme","accent-color","position","attachments"]}connectedCallback(){this.container=document.createElement("div"),this.appendChild(this.container),this.root=nu.createRoot(this.container),this.render()}disconnectedCallback(){this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.remove(),this.container=null)}attributeChangedCallback(){this.render()}render(){if(!this.root)return;const u=this.getAttribute("api-url");if(!u){console.error("[Claudius] Missing api-url attribute on ");return}const h=this.getAttribute("persist-messages"),g=h===null?void 0:h!=="false",k=this.getAttribute("request-timeout-ms"),x=k===null?void 0:Number(k),E=this.getAttribute("attachments"),T=E===null?void 0:E!=="false";this.root.render(y.jsx(yu,{apiUrl:u,title:this.getAttribute("title")??void 0,subtitle:this.getAttribute("subtitle")??void 0,welcomeMessage:this.getAttribute("welcome-message")??void 0,placeholder:this.getAttribute("placeholder")??void 0,persistMessages:g,storageKeyPrefix:this.getAttribute("storage-key-prefix")??void 0,requestTimeoutMs:x!==void 0&&Number.isFinite(x)?x:void 0,theme:this.getAttribute("theme")??void 0,accentColor:this.getAttribute("accent-color")??void 0,position:this.getAttribute("position")??void 0,attachments:T}))}}return typeof customElements<"u"&&!customElements.get("claudius-chat")&&customElements.define("claudius-chat",xu),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",wu):wu(),jt.ClaudiusChat=xu,Object.defineProperty(jt,Symbol.toStringTag,{value:"Module"}),jt})({}); +`))!==-1;){const le=y.slice(0,se);y=y.slice(se+2);const Q=jc(le);if(Q){if(Q.event==="chunk"){const ie=typeof Q.data.text=="string"?Q.data.text:"";ie&&(v+=ie,(G=u.onChunk)==null||G.call(u,ie,v))}else if(Q.event==="tool"){if(typeof Q.data.name=="string"){const ie=Q.data;E.push(ie),(D=u.onToolUse)==null||D.call(u,ie,E)}}else if(Q.event==="done"){const ie=Array.isArray(Q.data.toolUses)?Q.data.toolUses:E;C={reply:typeof Q.data.reply=="string"?Q.data.reply:v,sources:Q.data.sources,...ie.length>0?{toolUses:ie}:{},...Array.isArray(Q.data.attachments)?{attachments:Q.data.attachments}:{}}}else if(Q.event==="error")throw new be(typeof Q.data.error=="string"?Q.data.error:"Something went wrong. Please try again.",0,"STREAM_ERROR")}}}}finally{(z=u.signal)==null||z.removeEventListener("abort",R),d.releaseLock()}if((I=u.signal)!=null&&I.aborted)return{reply:v,aborted:!0,...E.length>0?{toolUses:E}:{}};if(C)return C;throw new be("Connection interrupted. Please try again.",0,"STREAM_ERROR")}async fetchStream(a,u){const d=new AbortController,h=()=>d.abort();u==null||u.addEventListener("abort",h,{once:!0});let y=!1;const v=this.timeoutMs>0?setTimeout(()=>{y=!0,d.abort()},this.timeoutMs):void 0,{headers:E,body:C}=this.buildRequest(a);try{return await fetch(`${this.baseUrl}/api/chat/stream`,{method:"POST",headers:E,body:C,signal:d.signal})}catch(R){throw y?new be("Request timed out. Please try again.",0,"TIMEOUT"):R}finally{v!==void 0&&clearTimeout(v),u==null||u.removeEventListener("abort",h)}}async fetchWithTimeout(a){const{headers:u,body:d}=this.buildRequest(a);if(this.timeoutMs<=0)return fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:u,body:d});const h=new AbortController,y=setTimeout(()=>h.abort(),this.timeoutMs);try{return await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:u,body:d,signal:h.signal})}catch(v){throw h.signal.aborted?new be("Request timed out. Please try again.",0,"TIMEOUT"):v}finally{clearTimeout(y)}}isRetryable(a,u){return u==="TIMEOUT"||u==="NETWORK_ERROR"?!0:a===429||a===503}getRetryDelay(a,u){if(a&&a.status===429){const d=a.headers.get("Retry-After");if(d){const h=Number(d);return Math.min(h*1e3,6e4)}}return u===0?1e3:3e3}delay(a){return new Promise(u=>setTimeout(u,a))}}function jc(s){let a="message";const u=[];for(const d of s.split(` +`))d.startsWith("event:")?a=d.slice(6).trim():d.startsWith("data:")&&u.push(d.slice(5).trimStart());if(u.length===0)return null;try{const d=JSON.parse(u.join(` +`));return typeof d!="object"||d===null?null:{event:a,data:d}}catch{return null}}function ou(s){return typeof s=="string"?{content:s}:s}function bl(s,a,u){console.error(`[claudius] plugin "${s.name}" failed in ${a}:`,u)}async function Lc(s,a,u){let d=a;for(const h of s){if(!h.onBeforeSend)continue;let y=null;const v={...u,respondWith(E){y={type:"respond",message:d,reply:ou(E)}},abort(E){y={type:"abort",reason:E}}};try{const E=await h.onBeforeSend(d,v);if(y)return y;E&&(d=E)}catch(E){bl(h,"onBeforeSend",E)}}return{type:"send",message:d}}async function Mc(s,a,u){let d=a;for(const h of s)if(h.onAfterReceive)try{const y=await h.onAfterReceive(d,u);y&&(d=y)}catch(y){bl(h,"onAfterReceive",y)}return d}async function Pc(s,a,u){for(const d of s){if(!d.onError)continue;let h=null;const y={...u,respondWith(v){h=ou(v)}};try{if(await d.onError(a,y),h)return h}catch(v){bl(d,"onError",v)}}return null}const Or={maxSizeBytes:5*1024*1024,maxCount:5,allowedTypes:["image/jpeg","image/png","image/gif","image/webp","application/pdf"]};function zc(s){return s?s===!0?Or:{maxSizeBytes:s.maxSizeBytes??Or.maxSizeBytes,maxCount:s.maxCount??Or.maxCount,allowedTypes:(s.allowedTypes??Or.allowedTypes).map(a=>a.trim().toLowerCase()).filter(Boolean)}:null}function eo(s){if(!Number.isFinite(s)||s<0)return"0 B";if(s<1024)return`${s} B`;const a=s/1024;if(a<1024)return`${Math.round(a)} KB`;const u=a/1024;return`${Number.isInteger(u)?u:u.toFixed(1)} MB`}const Dc={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",pdf:"application/pdf"};function iu(s){var d;const a=(s.type||"").trim().toLowerCase();if(a)return a;const u=((d=s.name.split(".").pop())==null?void 0:d.toLowerCase())??"";return Dc[u]??""}function Ac(s){return s.startsWith("image/")}function Oc(s){if(Ac(s.mediaType)){if(s.url)try{const a=new URL(s.url);if(a.protocol==="http:"||a.protocol==="https:")return s.url}catch{}if(s.data)return`data:${s.mediaType};base64,${s.data}`}}function Ic(s,a,u){const d=[],h=[];let y=Math.max(0,u.maxCount-a);for(const v of s){const E=iu(v);!E||!u.allowedTypes.includes(E)?h.push({file:v,reason:"type"}):v.size>u.maxSizeBytes||v.size===0?h.push({file:v,reason:"size"}):y<=0?h.push({file:v,reason:"count"}):(d.push(v),y-=1)}return{accepted:d,rejected:h}}function Fc(s){return new Promise((a,u)=>{const d=new FileReader;d.onerror=()=>u(d.error??new Error("Failed to read file")),d.onload=()=>{const h=String(d.result??""),y=h.indexOf(",");a(y>=0?h.slice(y+1):h)},d.readAsDataURL(s)})}let uu=0;function Uc(){return uu+=1,`att-${Date.now().toString(36)}-${uu}`}async function Bc(s){const a=await Fc(s);return{id:Uc(),name:s.name||"attachment",mediaType:iu(s),size:s.size,data:a}}function Hc(s){return s.map(a=>{var u;return(u=a.attachments)!=null&&u.some(d=>d.data)?{...a,attachments:a.attachments.map(d=>{if(!d.data)return d;const h={...d};return delete h.data,h})}:a})}function Vc(s,a){if(!a||a.length===0)return s;const u=new Map(a.map(d=>[d.id,d]));return s.map(d=>{var h;return(h=d.attachments)!=null&&h.some(y=>u.has(y.id))?{...d,attachments:d.attachments.map(y=>{const v=u.get(y.id);if(!v)return y;const E={...y,key:v.key,url:v.url,expiresAt:v.expiresAt};return delete E.data,E})}:d})}const $c=200,Wc="claudius:messages";function Qc(s,a){let u;try{u=new URL(a).host}catch{u=a}return`${s}:${u}`}function to(){try{return typeof sessionStorage<"u"?sessionStorage:null}catch{return null}}function Kc(s){const a=to();if(!a)return[];try{const u=a.getItem(s);if(!u)return[];const d=JSON.parse(u);return Array.isArray(d)?d:[]}catch{return[]}}function Gc({apiUrl:s,persistMessages:a=!0,storageKeyPrefix:u=Wc,timeoutMs:d,translations:h,plugins:y,streaming:v=!0}){const E=N.useMemo(()=>new _c(s,{debounceMs:0,timeoutMs:d}),[s,d]),C=Qc(u,s),R=a?Kc(C):[],[A,$]=N.useState(R),[q,G]=N.useState(!1),[D,z]=N.useState(!1),[I,pe]=N.useState(null),[se,le]=N.useState(null),[Q,ie]=N.useState(!1),re=N.useRef(R.length),de=N.useRef(!1),J=N.useRef(R),Te=N.useRef(null),ye=N.useRef(y??[]);ye.current=y??[];const we=N.useCallback(T=>{if(!a)return;const m=to();if(m)try{const k=Hc(T.slice(-$c));m.setItem(C,JSON.stringify(k))}catch{}},[a,C]),ge=()=>(re.current+=1,`msg-${re.current}`),Ce=N.useCallback((T,m)=>{if(!h)return m??"Something went wrong. Please try again.";switch(T){case"TIMEOUT":return h.errorTimeout;case"NETWORK_ERROR":return h.errorConnection;case"RATE_LIMITED":return m!=null&&m.includes("minute")?h.errorRateLimitMinute:h.errorRateLimitHour;case"ATTACHMENT_QUOTA_EXCEEDED":return h.errorAttachmentQuota;case"ATTACHMENTS_DISABLED":case"ATTACHMENT_INVALID":case"ATTACHMENT_TOO_LARGE":return h.errorAttachmentRejected;case"VALIDATION_ERROR":case"CONFIG_ERROR":case"SERVICE_ERROR":case"UNKNOWN_ERROR":default:return m??h.errorGeneric}},[h]),De=N.useCallback(T=>!(T instanceof be)||T.code==="TIMEOUT"||T.code==="NETWORK_ERROR"||T.code==="RATE_LIMITED"||T.code==="SERVICE_ERROR"||T.code==="UNKNOWN_ERROR"||T.status>=500||T.status===0,[]),Me=N.useCallback(async T=>{var ae,ue;G(!0),de.current=!0,le(null),ie(!1);const m=v&&typeof E.streamMessage=="function";let k=null;const te=B=>{if(k===null){k=ge(),pe(k);const X=[...J.current,{id:k,role:"assistant",content:"",...B}];J.current=X,$(X)}else{const X=k,ne=J.current.map(xe=>xe.id===X?{...xe,...B}:xe);J.current=ne,$(ne)}},Z=()=>{if(k===null)return;const B=k,X=J.current.filter(ne=>ne.id!==B);J.current=X,$(X)};try{let B,X,ne,xe,Fe=!1;if(m){const fe=new AbortController;Te.current=fe,z(!0);const Ue=await E.streamMessage(T,{signal:fe.signal,onChunk:(Pt,$e)=>te({content:$e}),onToolUse:(Pt,$e)=>te({toolUses:[...$e]})});B=Ue.reply,X=Ue.sources,ne=Ue.toolUses,xe=Ue.attachments,Fe=Ue.aborted??!1}else{const fe=await E.sendMessage(T);B=fe.reply,X=fe.sources,ne=fe.toolUses,xe=fe.attachments}if(Fe&&!B){Z();return}let at={id:k??ge(),role:"assistant",content:B,sources:X,toolUses:ne};ye.current.length>0&&!Fe&&(at=await Mc(ye.current,at,{messages:T,apiUrl:s}));const Rt=k!==null?J.current.map(fe=>fe.id===at.id?at:fe):[...T,at],F=Vc(Rt,xe);J.current=F,$(F),we(F)}catch(B){if(B instanceof Jl)return;if(B instanceof be&&((ae=B.code)!=null&&ae.startsWith("ATTACHMENT"))&&T.length>0){const X=T[T.length-1];if(X.role==="user"&&((ue=X.attachments)!=null&&ue.length)){const ne=T.slice(0,-1);J.current=ne,$(ne),we(ne)}}if(k!==null){we(J.current),B instanceof be?le(Ce(B.code,B.message)):le((h==null?void 0:h.errorConnection)??"Failed to connect. Please try again."),ie(!1);return}if(ye.current.length>0){const X=B instanceof Error?B:new Error(String(B)),ne=await Pc(ye.current,X,{messages:T,apiUrl:s});if(ne){const xe={id:ge(),role:"assistant",content:ne.content,sources:ne.sources},Fe=[...T,xe];J.current=Fe,$(Fe),we(Fe),le(null),ie(!1);return}}B instanceof be?le(Ce(B.code,B.message)):le((h==null?void 0:h.errorConnection)??"Failed to connect. Please try again."),ie(De(B))}finally{G(!1),de.current=!1,z(!1),pe(null),Te.current=null}},[s,E,Ce,De,we,v,h]),Re=N.useCallback(()=>{var T;(T=Te.current)==null||T.abort()},[]),W=N.useCallback(async(T,m)=>{const k=T.trim(),te=(m==null?void 0:m.filter(B=>B&&B.id))??[];if(!k&&te.length===0||de.current)return;const Z={id:ge(),role:"user",content:k,...te.length>0?{attachments:te}:{}};let ae=Z;if(ye.current.length>0){const B=await Lc(ye.current,Z,{messages:J.current,apiUrl:s});if(B.type==="abort")return;if(B.type==="respond"){const X={id:ge(),role:"assistant",content:B.reply.content,sources:B.reply.sources},ne=[...J.current,B.message,X];J.current=ne,$(ne),we(ne),le(null),ie(!1);return}ae=B.message}const ue=[...J.current,ae];J.current=ue,$(ue),we(ue),await Me(ue)},[s,we,Me]),P=N.useCallback(async()=>{if(de.current)return;const T=J.current[J.current.length-1];!T||T.role!=="user"||await Me(J.current)},[Me]),Y=N.useCallback(()=>{if(J.current=[],$([]),le(null),ie(!1),a){const T=to();if(!T)return;try{T.removeItem(C)}catch{}}},[a,C]);return{messages:A,isLoading:q,isStreaming:D,streamingMessageId:I,error:se,canRetry:Q,sendMessage:W,stop:Re,retry:P,clearMessages:Y}}function Yc(s){const[a,u]=N.useState(()=>typeof window>"u"?!1:window.matchMedia(s).matches);return N.useEffect(()=>{const d=window.matchMedia(s);u(d.matches);const h=y=>u(y.matches);return d.addEventListener("change",h),()=>d.removeEventListener("change",h)},[s]),a}function Ir(s,a){return s instanceof RegExp?s.test(a):a.toLowerCase().includes(s.toLowerCase())}function Xc(){const s=document.documentElement,a=document.body,u=s.scrollTop||a.scrollTop||0,d=Math.max(s.scrollHeight,a.scrollHeight),h=s.clientHeight||window.innerHeight,y=d-h;return y<=0?100:u/y*100}function qc({triggers:s,enabled:a,onOpen:u,onGreeting:d}){N.useEffect(()=>{if(!a||!s||s.length===0)return;const h=new Set,y=[],v=typeof window<"u"?window.location.href:"",E=(C,R)=>{h.has(C)||(h.add(C),R==="open"?u():d(R.greeting))};return s.forEach((C,R)=>{switch(C.on){case"url":{Ir(C.pattern,v)&&E(R,C.action);break}case"time":{if(C.matchUrl&&!Ir(C.matchUrl,v))return;const A=window.setTimeout(()=>E(R,C.action),Math.max(0,C.seconds*1e3));y.push(()=>window.clearTimeout(A));break}case"scroll":{if(C.matchUrl&&!Ir(C.matchUrl,v))return;const A=()=>{Xc()>=C.percent&&E(R,C.action)};A(),window.addEventListener("scroll",A,{passive:!0}),y.push(()=>window.removeEventListener("scroll",A));break}case"exit-intent":{if(C.matchUrl&&!Ir(C.matchUrl,v))return;const A=$=>{$.clientY<=0&&E(R,C.action)};document.addEventListener("mouseleave",A),y.push(()=>document.removeEventListener("mouseleave",A));break}}}),()=>{y.forEach(C=>C())}},[s,a,u,d])}const Zc={"bottom-right":"bottom-6 right-6","bottom-left":"bottom-6 left-6","top-right":"top-6 right-6","top-left":"top-6 left-6"},Jc=N.forwardRef(function({isOpen:a,onClick:u,position:d="bottom-right",translations:h},y){const v=a?(h==null?void 0:h.closeChat)??"Close chat":(h==null?void 0:h.openChat)??"Open chat";return g.jsx("button",{ref:y,onClick:u,"aria-label":v,className:`fixed ${Zc[d]} z-50 flex h-14 w-14 items-center justify-center rounded-claudius-full bg-claudius-accent text-claudius-accent-text shadow-claudius-floating transition-transform hover:scale-105 focus:outline-none focus:ring-2 focus:ring-claudius-accent focus:ring-offset-2`,children:a?g.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):g.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:g.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})})}),bc=N.memo(function({count:a,isActive:u,onClick:d}){return g.jsxs("button",{onClick:d,"aria-label":"View sources",title:"View sources",className:`group relative flex h-7 w-7 items-center justify-center rounded-claudius-full transition-colors ${u?"bg-claudius-accent text-claudius-accent-text":"text-claudius-text-muted hover:bg-claudius-surface-muted hover:text-claudius-text"}`,children:[g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),g.jsx("polyline",{points:"14 2 14 8 20 8"}),g.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),g.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"})]}),g.jsx("span",{className:"absolute -right-1 -top-1 flex h-4 min-w-4 items-center justify-center rounded-claudius-full bg-claudius-accent px-1 text-[10px] font-bold text-claudius-accent-text",children:a})]})}),ed=["http:","https:"];function no(s){if(!s||typeof s!="string")return null;const a=s.trim();if(!a)return null;try{const u=new URL(a);return ed.includes(u.protocol)?a:null}catch{return null}}function td(){return g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),g.jsx("polyline",{points:"14 2 14 8 20 8"})]})}function su({label:s,onClick:a}){return g.jsx("button",{type:"button",onClick:a,"aria-label":s,className:"absolute -right-1.5 -top-1.5 flex h-5 w-5 items-center justify-center rounded-claudius-full bg-claudius-text text-claudius-surface shadow-claudius-floating hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-accent",children:g.jsxs("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round","aria-hidden":"true",children:[g.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}const au=N.memo(function({attachment:a,variant:u,onRemove:d,removeLabel:h}){const y=Oc(a),v=u==="composer",E=`${a.name} (${eo(a.size)})`,C=a.url?no(a.url):null;if(y){const A=g.jsx("img",{src:y,alt:a.name,title:E,loading:"lazy",className:v?"h-12 w-12 rounded-claudius-sm border border-claudius-border object-cover":"max-h-48 max-w-full rounded-claudius-sm object-contain"});return g.jsxs("div",{className:"relative inline-block",children:[!v&&C?g.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",children:[A,g.jsxs("span",{className:"sr-only",children:[E," (opens in a new tab)"]})]}):A,d&&h&&g.jsx(su,{label:h,onClick:d})]})}const R=g.jsxs("span",{title:E,className:`inline-flex max-w-[220px] items-center gap-1.5 rounded-claudius-sm border px-2 py-1 text-xs ${v?"border-claudius-border bg-claudius-field text-claudius-text":"border-current/30 bg-transparent"}`,children:[g.jsx(td,{}),g.jsx("span",{className:"truncate",children:a.name}),g.jsx("span",{className:"shrink-0 opacity-70",children:eo(a.size)})]});return g.jsxs("div",{className:"relative inline-block",children:[!v&&C?g.jsxs("a",{href:C,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:[R,g.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}):R,d&&h&&g.jsx(su,{label:h,onClick:d})]})});function Fr({label:s,onClick:a,children:u}){return g.jsx("button",{type:"button",onClick:a,"aria-label":s,title:s,className:"flex h-7 w-7 items-center justify-center rounded-claudius-full text-claudius-text-muted transition-colors hover:bg-claudius-surface-muted hover:text-claudius-text",children:g.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:u})})}function nd({state:s,labels:a,onPlay:u,onPause:d,onResume:h,onStop:y}){return s==="idle"?g.jsxs(Fr,{label:a.play,onClick:u,children:[g.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),g.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",fill:"none"}),g.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",fill:"none"})]}):g.jsxs("div",{className:"flex items-center gap-1",children:[s==="paused"?g.jsx(Fr,{label:a.resume,onClick:h,children:g.jsx("polygon",{points:"6 3 20 12 6 21 6 3"})}):g.jsxs(Fr,{label:a.pause,onClick:d,children:[g.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),g.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]}),g.jsx(Fr,{label:a.stop,onClick:y,children:g.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})]})}function rd(s){const a=s.lastIndexOf(` +`),u=a===-1?"":s.slice(0,a+1);let d=a===-1?s:s.slice(a+1);return d=id(d),d=ud(d),u+d}function ld(s){const a=[];for(let u=0;uh(v=>!v),"aria-expanded":y?d:void 0,className:"flex items-center gap-1.5 rounded-claudius-full border border-claudius-border bg-claudius-surface px-2 py-0.5 hover:opacity-80 disabled:cursor-default disabled:hover:opacity-100",children:[g.jsx("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:g.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),g.jsxs("span",{children:[a," ",g.jsx("span",{className:"font-mono text-claudius-text",children:s.name}),s.isError&&g.jsx("span",{className:"text-claudius-error",children:" ✕"})]}),y&&g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"sr-only",children:u}),g.jsx("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:d?"rotate-180":void 0,children:g.jsx("polyline",{points:"6 9 12 15 18 9"})})]})]}),d&&y&&g.jsxs("div",{className:"mt-1 overflow-x-auto rounded-claudius-sm border border-claudius-border bg-claudius-field p-2 font-mono",children:[s.input!==void 0&&g.jsx("pre",{className:"whitespace-pre-wrap break-all",children:JSON.stringify(s.input,null,2)}),s.result!==void 0&&g.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-all border-t border-claudius-border pt-1",children:s.result})]})]})}const cu=/(https?:\/\/[^\s)]+)/,du=/(\*\*[^*]+\*\*)/,fu=/(\*[^*]+\*)/;function ad(s,a){const u=s.match(/[.,;:!?'"]+$/),d=u?s.slice(0,-u[0].length):s,h=u?u[0]:"",y=no(d);return y?g.jsxs(g.Fragment,{children:[g.jsxs("a",{href:y,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium hover:opacity-80 text-claudius-link",children:[y.replace(/^https?:\/\//,""),g.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]},a),h]}):s}function cd(s,a){const u=s.split(du),d=[];return u.forEach((h,y)=>{if(du.test(h)){const v=h.slice(2,-2);d.push(g.jsx("strong",{children:v},`${a}-b${y}`))}else h.split(fu).forEach((E,C)=>{if(fu.test(E)){const R=E.slice(1,-1);d.push(g.jsx("em",{children:R},`${a}-b${y}-i${C}`))}else E.split(cu).forEach((A,$)=>{cu.test(A)?d.push(ad(A,`${a}-b${y}-i${C}-u${$}`)):A&&d.push(A)})})}),d}function dd(s){const a=s.split(` +`);return a.map((u,d)=>g.jsxs("span",{children:[cd(u,`l${d}`),d0,D=d?rd(u):u,z=q||u!==""||!(v!=null&&v.length);return g.jsxs("div",{className:`${q?"ml-auto":"mr-auto"} max-w-[85%]`,children:[z&&g.jsxs("div",{className:`rounded-claudius-bubble px-4 py-2.5 text-sm leading-relaxed font-body ${q?"bg-claudius-user-bubble text-claudius-user-bubble-text rounded-br-claudius-tail":"bg-claudius-assistant-bubble text-claudius-assistant-bubble-text rounded-bl-claudius-tail"}`,children:[G&&g.jsx("ul",{className:`flex flex-wrap gap-2 ${u?"mb-2":""}`,"aria-label":"Attachments",children:y.map(I=>g.jsx("li",{children:g.jsx(au,{attachment:I,variant:"message"})},I.id))}),(u!==""||!G)&&dd(D)]}),!q&&v&&v.length>0&&g.jsx("div",{className:"mt-1 space-y-1",children:v.map((I,pe)=>g.jsx(sd,{toolUse:I,usedLabel:E,detailsLabel:C},`${I.name}-${pe}`))}),!q&&h&&h.length>0&&R&&g.jsx("div",{className:"mt-1",children:g.jsx(bc,{count:h.length,isActive:A??!1,onClick:R})}),!q&&$&&g.jsx("div",{className:"mt-1",children:g.jsx(nd,{...$})})]})}),pu={title:"Chat",subtitle:"Ask me anything",welcomeMessage:"Hi! How can I help you today?",closeChat:"Close chat",chatMessages:"Chat messages",typingIndicator:"Assistant is typing",placeholder:"Type your message...",sendMessage:"Send message",stopGenerating:"Stop generating",toolUsed:"Used tool:",toolDetails:"Tool details",typeYourMessage:"Type your message",openChat:"Open chat",dismissGreeting:"Dismiss greeting",attachFile:"Attach a file",removeAttachment:"Remove attachment",attachmentsLabel:"Attachments",dropFilesHint:"Drop files to attach",attachmentTooLarge:"{name} is too large. The maximum size is {max}.",attachmentTypeNotAllowed:"{name} is not a supported file type.",attachmentTooMany:"You can attach up to {max} files per message.",voiceInput:"Voice input",voiceInputHold:"Hold to talk",voiceListening:"Listening...",voicePermissionDenied:"Microphone access is blocked. Allow it in your browser settings to use voice input.",voiceNoSpeech:"No speech was detected. Please try again.",voiceNoMicrophone:"No microphone was found.",voiceUnavailable:"Voice input is not available right now.",readAloud:"Read aloud",pauseReading:"Pause reading",resumeReading:"Resume reading",stopReading:"Stop reading",errorGeneric:"Something went wrong. Please try again.",errorConnection:"Failed to connect. Please try again.",errorTimeout:"Request timed out. Please try again.",errorRateLimitMinute:"Too many requests. Please wait a minute.",errorRateLimitHour:"Hourly limit reached. Please try again later.",errorAttachmentRejected:"An attachment was rejected. Please remove it and try again.",errorAttachmentQuota:"Upload limit reached. Please try again later.",errorRetry:"Retry"},pd=pu;function hu(s){return s.key===" "||s.key==="Enter"}function hd({mode:s,isListening:a,disabled:u=!1,onStart:d,onStop:h,label:y}){const v=s==="hold",E=N.useRef(!1),C=()=>{u||E.current||(E.current=!0,d())},R=()=>{E.current&&(E.current=!1,h())},A=D=>{v&&D.detail!==0||(a?h():d())},$=D=>{var z,I;!v||D.button!==0||((I=(z=D.currentTarget).setPointerCapture)==null||I.call(z,D.pointerId),C())},q=D=>{!v||!hu(D)||(D.preventDefault(),D.repeat||C())},G=D=>{!v||!hu(D)||(D.preventDefault(),R())};return g.jsx("button",{type:"button",disabled:u,"aria-label":y,"aria-pressed":a,title:y,onClick:A,onPointerDown:$,onPointerUp:R,onPointerCancel:R,onLostPointerCapture:R,onKeyDown:q,onKeyUp:G,onBlur:R,onContextMenu:v?D=>D.preventDefault():void 0,style:v?{WebkitTouchCallout:"none"}:void 0,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm border transition-colors focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50 ${a?"border-claudius-accent bg-claudius-accent text-claudius-accent-text":"border-claudius-border bg-claudius-field text-claudius-text-muted hover:text-claudius-text focus:border-claudius-accent"} ${v?"touch-none select-none":""}`,children:a&&!v?g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:g.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})}):g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),g.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),g.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]})})}function md({active:s}){return g.jsxs("span",{"aria-hidden":"true","data-claudius-voice-level":s?"active":"idle",className:"claudius-voice-level pointer-events-none absolute right-3 top-1/2 flex h-4 -translate-y-1/2 items-center gap-0.5 text-claudius-accent",children:[g.jsx("span",{}),g.jsx("span",{}),g.jsx("span",{}),g.jsx("span",{})]})}function ro(s,a){return s.replace(/\{(\w+)\}/g,(u,d)=>d in a?String(a[d]):u)}const gd={en:"en-US",es:"es-ES",fr:"fr-FR",de:"de-DE"},vd=["toggle","hold"];function mu(s,a){if(!(!s||!s.includes("-")))return s.toLowerCase().split("-")[0]===a?s:void 0}function yd(s,a){const u=a==null?void 0:a.trim();if(u)return u;const d=typeof document<"u"?mu(document.documentElement.lang,s):void 0;if(d)return d;const h=typeof navigator<"u"?mu(navigator.language,s):void 0;return h||gd[s]}function wd(s,a){if(!s)return null;const u=s===!0?{}:s,d={input:u.input??!0,output:u.output??!0,mode:vd.includes(u.mode)?u.mode:"toggle",autoSubmit:u.autoSubmit??!1,lang:yd(a,u.lang)};return d.input||d.output?d:null}function xd(s){const a=s("voice");if(a===null)return;if(a==="false")return!1;const u={},d=R=>{const A=s(R);return A===null?void 0:A!=="false"},h=s("voice-mode");h!==null&&(u.mode=h);const y=d("voice-auto-submit");y!==void 0&&(u.autoSubmit=y);const v=d("voice-input");v!==void 0&&(u.input=v);const E=d("voice-output");E!==void 0&&(u.output=E);const C=s("voice-lang");return C!==null&&(u.lang=C),Object.keys(u).length>0?u:!0}function Sd(s,a,u){const d=a.trim();if(!d)return s;const h=s.trimEnd();return(h?`${h} ${d}`:d).slice(0,u)}function kd(s){const a=[];let u=0;for(let d=0;d{const y=d.trim();y&&u.push(y),d=""};for(const y of kd(s)){if((d+y).trim().length<=a){d+=y;continue}if(h(),y.trim().length<=a){d=y;continue}for(const v of y.trim().split(/\s+/))d&&`${d} ${v}`.length>a&&h(),d=d?`${d} ${v}`:v}return h(),u}function gu(){if(typeof window>"u")return;const s=window;return s.SpeechRecognition??s.webkitSpeechRecognition}function Cd(s){switch(s){case"not-allowed":case"service-not-allowed":return"permission";case"no-speech":return"no-speech";case"audio-capture":return"no-microphone";default:return"unavailable"}}function Rd(s){const[a]=N.useState(()=>gu()!==void 0),[u,d]=N.useState(!1),[h,y]=N.useState(!1),v=N.useRef(null),E=N.useRef(!1),C=N.useRef(s);N.useEffect(()=>{C.current=s});const R=N.useCallback(G=>{G.onstart=null,G.onend=null,G.onerror=null,G.onresult=null,G.onspeechstart=null,G.onspeechend=null,v.current===G&&(v.current=null),d(!1),y(!1)},[]),A=N.useCallback(()=>{const G=v.current;G&&(R(G),G.abort())},[R]),$=N.useCallback(()=>{const G=v.current;if(G){if(!E.current){A();return}G.stop()}},[A]),q=N.useCallback(()=>{var pe,se;const G=gu();if(!G||v.current)return;const D=new G;D.lang=C.current.lang,D.interimResults=!0,D.continuous=!1;let z="",I=!1;D.onstart=()=>{E.current=!0},D.onspeechstart=()=>y(!0),D.onspeechend=()=>y(!1),D.onresult=le=>{var re,de;let Q="",ie="";for(let J=0;J{var Q,ie;le.error!=="aborted"&&(I=!0,(ie=(Q=C.current).onError)==null||ie.call(Q,Cd(le.error)))},D.onend=()=>{var le,Q;R(D),I||(Q=(le=C.current).onEnd)==null||Q.call(le,z)},v.current=D,E.current=!1,d(!0);try{D.start()}catch{R(D),(se=(pe=C.current).onError)==null||se.call(pe,"unavailable")}},[R]);return N.useEffect(()=>A,[A]),{isSupported:a,isListening:u,isSpeechDetected:h,start:q,stop:$,abort:A}}const Yn=2e3,Nd=1800;function vu(s){var u;const a=(u=s.dataTransfer)==null?void 0:u.types;return!!a&&Array.from(a).includes("Files")}function Td({onSend:s,isLoading:a,isStreaming:u=!1,onStop:d,placeholder:h,translations:y,attachments:v=null,voice:E=null,onVoiceStart:C}){const R=y??pd,[A,$]=N.useState(""),[q,G]=N.useState([]),[D,z]=N.useState(null),[I,pe]=N.useState(!1),[se,le]=N.useState(null),Q=N.useRef(null),ie=N.useRef(null),re=N.useRef([]),de=N.useRef(0),J=N.useRef(""),Te=N.useRef(""),ye=F=>{J.current=F,$(F)},we=A.length,ge=we>=Nd,Ce=we>=Yn,De=h??R.placeholder,Me=!!v&&q.length{var F;a||(F=Q.current)==null||F.focus()},[a]);const W=N.useCallback((F,fe)=>{if(!v)return"";switch(fe){case"size":return ro(R.attachmentTooLarge,{name:F,max:eo(v.maxSizeBytes)});case"type":return ro(R.attachmentTypeNotAllowed,{name:F});case"count":return ro(R.attachmentTooMany,{max:v.maxCount})}},[v,R]),P=N.useCallback(async F=>{if(!v||F.length===0)return;const{accepted:fe,rejected:Ue}=Ic(F,re.current.length,v);if(z(Ue.length>0?W(Ue[0].file.name,Ue[0].reason):null),fe.length===0)return;const Pt=await Promise.all(fe.map(Bc));re.current=[...re.current,...Pt],G(re.current)},[v,W]),Y=N.useCallback(F=>{re.current=re.current.filter(fe=>fe.id!==F),G(re.current),z(null)},[]),T=()=>{const F=J.current.trim(),fe=re.current;!F&&fe.length===0||J.current.length>=Yn||(fe.length>0?s(F,fe):s(F),ye(""),re.current=[],G([]),z(null))},m=F=>{switch(F){case"permission":return R.voicePermissionDenied;case"no-speech":return R.voiceNoSpeech;case"no-microphone":return R.voiceNoMicrophone;case"unavailable":return R.voiceUnavailable}},k=Rd({lang:(E==null?void 0:E.lang)??"en-US",onTranscript:F=>ye(Sd(Te.current,F,Yn)),onEnd:F=>{E!=null&&E.autoSubmit&&F.trim()&&T()},onError:F=>le(m(F))}),te=!!(E!=null&&E.input)&&k.isSupported,Z=k.isListening;N.useEffect(()=>{const F=Q.current;Z&&F&&(F.scrollLeft=F.scrollWidth)},[Z,A]);const ae=()=>{le(null),Te.current=J.current,C==null||C(),k.start()},ue=F=>{F.preventDefault(),k.abort(),T()},B=F=>{const fe=F.target.value;fe.length<=Yn&&(k.abort(),le(null),ye(fe))},X=F=>{const fe=Array.from(F.target.files??[]);F.target.value="",P(fe)},ne=F=>{var Ue;if(!v)return;const fe=Array.from(((Ue=F.clipboardData)==null?void 0:Ue.files)??[]);fe.length!==0&&(F.preventDefault(),P(fe))},xe=F=>{!v||!vu(F)||(F.preventDefault(),de.current+=1,pe(!0))},Fe=F=>{!v||!vu(F)||F.preventDefault()},at=()=>{v&&(de.current=Math.max(0,de.current-1),de.current===0&&pe(!1))},Rt=F=>{var fe;v&&(F.preventDefault(),de.current=0,pe(!1),P(Array.from(((fe=F.dataTransfer)==null?void 0:fe.files)??[])))};return g.jsxs("form",{onSubmit:ue,onDragEnter:xe,onDragOver:Fe,onDragLeave:at,onDrop:Rt,"data-drag-over":I||void 0,className:`relative border-t border-claudius-border bg-claudius-surface p-3 ${I?"ring-2 ring-inset ring-claudius-accent":""}`,children:[I&&g.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-claudius-surface text-sm font-medium text-claudius-accent",children:R.dropFilesHint}),v&&q.length>0&&g.jsx("ul",{"aria-label":R.attachmentsLabel,className:"mb-2 flex flex-wrap gap-3 pt-1",children:q.map(F=>g.jsx("li",{children:g.jsx(au,{attachment:F,variant:"composer",onRemove:()=>Y(F.id),removeLabel:`${R.removeAttachment}: ${F.name}`})},F.id))}),g.jsxs("div",{className:"flex gap-2",children:[v&&g.jsxs(g.Fragment,{children:[g.jsx("input",{ref:ie,type:"file",multiple:!0,hidden:!0,tabIndex:-1,accept:v.allowedTypes.join(","),onChange:X,"aria-label":R.attachFile}),g.jsx("button",{type:"button",onClick:()=>{var F;return(F=ie.current)==null?void 0:F.click()},disabled:a||!Me,"aria-label":R.attachFile,title:R.attachFile,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm border border-claudius-border bg-claudius-field text-claudius-text-muted transition-colors hover:text-claudius-text focus:border-claudius-accent focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50",children:g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:g.jsx("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"})})})]}),g.jsxs("div",{className:"relative min-w-0 flex-1",children:[g.jsx("input",{ref:Q,type:"text",value:A,onChange:B,onPaste:ne,placeholder:Z?R.voiceListening:De,disabled:a,"aria-label":R.typeYourMessage,"aria-describedby":ge?"char-count":void 0,className:`h-full w-full rounded-claudius-sm border border-claudius-border bg-claudius-field py-2 pl-3 text-sm font-body text-claudius-text placeholder:text-claudius-text-muted focus:border-claudius-accent focus:outline-none focus:ring-1 focus:ring-claudius-accent disabled:opacity-50 ${Z?"pr-10":"pr-3"}`}),Z&&g.jsx(md,{active:k.isSpeechDetected})]}),te&&E&&g.jsx(hd,{mode:E.mode,isListening:Z,disabled:a,onStart:ae,onStop:k.stop,label:E.mode==="hold"?R.voiceInputHold:R.voiceInput}),Re?g.jsx("button",{type:"button",onClick:d,"aria-label":R.stopGenerating,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm bg-claudius-accent text-claudius-accent-text transition-colors hover:opacity-90",children:g.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:g.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})}):g.jsx("button",{type:"submit",disabled:a||Ce,"aria-label":R.sendMessage,className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-claudius-sm bg-claudius-accent text-claudius-accent-text transition-colors hover:opacity-90 disabled:opacity-50",children:g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("line",{x1:"22",y1:"2",x2:"11",y2:"13"}),g.jsx("polygon",{points:"22 2 15 22 11 13 2 9 22 2"})]})})]}),(D??se)&&g.jsx("div",{role:"alert",className:"mt-1 text-xs text-claudius-error",children:D??se}),ge&&g.jsxs("div",{id:"char-count",className:`mt-1 text-xs text-right ${Ce?"text-claudius-error":"text-claudius-text-muted"}`,"aria-live":"polite",children:[we,"/",Yn]})]})}const _d=["blog","page","external"],jd={blog:"Blog",page:"Page",external:"External"};function Ld(s){try{return new URL(s).hostname}catch{return s}}const Md=N.memo(function({sources:a,onClose:u}){const d=_d.map(y=>({type:y,label:jd[y],items:a.filter(v=>v.type===y)})).filter(y=>y.items.length>0),h=a.length===1?"1 source found":`${a.length} sources found`;return g.jsxs("div",{className:"absolute inset-y-0 left-0 z-10 flex w-[280px] flex-col border-r-2 border-claudius-border bg-claudius-surface rounded-r-claudius-lg transition-transform duration-200 ease-out",children:[g.jsxs("div",{className:"flex items-center justify-between border-b border-claudius-border px-4 py-3",children:[g.jsxs("div",{children:[g.jsx("h3",{className:"text-sm font-heading font-semibold text-claudius-text",children:"Sources"}),g.jsx("p",{className:"text-xs text-claudius-text-muted",children:h})]}),g.jsx("button",{onClick:u,"aria-label":"Close sources",className:"flex h-7 w-7 items-center justify-center rounded-claudius-full text-claudius-text-muted transition-colors hover:bg-claudius-surface-muted hover:text-claudius-text",children:g.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),g.jsx("div",{className:"flex-1 overflow-y-auto px-3 py-3 space-y-4",children:d.map(y=>g.jsxs("div",{children:[g.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-claudius-text-muted",children:y.label}),g.jsx("div",{className:"space-y-2",children:y.items.map(v=>{const E=no(v.url);return E?g.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"block rounded-claudius-md border-2 border-claudius-border bg-claudius-surface-muted p-3 transition-colors hover:bg-claudius-border",children:[g.jsx("p",{className:"truncate text-sm font-medium text-claudius-text",children:v.title}),g.jsx("p",{className:"mt-0.5 text-xs text-claudius-text-muted",children:Ld(E)})]},E):null})})]},y.type))})]})});function Pd({title:s,subtitle:a,titleId:u,closeLabel:d,onClose:h}){return g.jsxs("div",{className:"flex items-center gap-3 bg-claudius-accent px-5 py-4",children:[g.jsx("div",{"aria-hidden":"true",className:"flex h-8 w-8 items-center justify-center rounded-claudius-full bg-claudius-accent-soft text-sm font-bold text-claudius-accent-text",children:s.charAt(0).toUpperCase()}),g.jsxs("div",{className:"flex-1",children:[g.jsx("h2",{id:u,className:"text-sm font-heading font-semibold text-claudius-accent-text",children:s}),g.jsx("p",{className:"text-xs text-claudius-accent-text",children:a})]}),g.jsx("button",{onClick:h,"aria-label":d,className:"flex h-10 w-10 items-center justify-center rounded-claudius-full text-claudius-accent-text-muted transition-colors hover:bg-claudius-accent-soft hover:text-claudius-accent-text",children:g.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[g.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),g.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})}function zd({message:s,retryLabel:a,onRetry:u}){return g.jsxs("div",{role:"alert",className:"mx-auto flex max-w-[90%] flex-col items-center gap-2 rounded-claudius-sm bg-claudius-error-surface px-3 py-2 text-center text-xs text-claudius-error",children:[g.jsx("span",{children:s}),u&&g.jsx("button",{type:"button",onClick:u,className:"rounded-claudius-md bg-claudius-error px-3 py-1 text-xs font-semibold text-claudius-error-text transition-opacity hover:opacity-90 focus:outline-none focus-visible:ring-2 focus-visible:ring-claudius-error focus-visible:ring-offset-1",children:a})]})}function Dd({label:s}){return g.jsx("div",{role:"status","aria-live":"polite","aria-label":s,className:"mr-auto flex max-w-[85%]",children:g.jsxs("div",{className:"flex gap-1 rounded-claudius-bubble rounded-bl-claudius-tail bg-claudius-assistant-bubble px-4 py-3",children:[g.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:0ms]"}),g.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:150ms]"}),g.jsx("span",{className:"h-2 w-2 motion-safe:animate-bounce rounded-claudius-full bg-claudius-text-muted [animation-delay:300ms]"})]})})}function Ad(s,a,u){const[d,h]=N.useState(0),y=N.useRef(0),v=N.useRef(0),E=N.useRef(0),C=N.useRef(!1);return N.useEffect(()=>{const R=s.current;if(!u||!R)return;const A=G=>{if(R.scrollTop>0){C.current=!1;return}C.current=!0,v.current=G.touches[0].clientY,E.current=Date.now()},$=G=>{if(!C.current)return;let D=G.touches[0].clientY-v.current;D<0&&(D=D*.3),y.current=D,h(D)},q=()=>{if(!C.current)return;C.current=!1;const G=y.current,D=(Date.now()-E.current)/1e3,z=R.getBoundingClientRect().height,I=D>.05&&G>0&&G/D>500,pe=G>z*.3;I||pe?a():(y.current=0,h(0))};return R.addEventListener("touchstart",A,{passive:!0}),R.addEventListener("touchmove",$,{passive:!0}),R.addEventListener("touchend",q),()=>{R.removeEventListener("touchstart",A),R.removeEventListener("touchmove",$),R.removeEventListener("touchend",q)}},[s,a,u]),{offsetY:d}}const Od='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Id(s,a){N.useEffect(()=>{const u=s.current;if(!u)return;const d=h=>{if(h.key!=="Tab")return;const y=Array.from(u.querySelectorAll(Od)).filter(R=>!R.hasAttribute("aria-hidden"));if(y.length===0)return;const v=y[0],E=y[y.length-1],C=document.activeElement;h.shiftKey&&C===v?(h.preventDefault(),E.focus()):!h.shiftKey&&C===E&&(h.preventDefault(),v.focus())};return u.addEventListener("keydown",d),()=>u.removeEventListener("keydown",d)},[s,a])}function Xn(){if(!(typeof window>"u")&&!(typeof window.SpeechSynthesisUtterance>"u"))return window.speechSynthesis??void 0}function Fd(s){const[a]=N.useState(()=>Xn()!==void 0),[u,d]=N.useState(null),[h,y]=N.useState(!1),v=N.useRef(0),E=N.useRef(!1),C=N.useRef([]),R=N.useCallback(()=>{v.current+=1,E.current=!1,C.current=[],d(null),y(!1)},[]),A=N.useCallback(()=>{var D;R(),(D=Xn())==null||D.cancel()},[R]),$=N.useCallback((D,z)=>{const I=Xn();if(!I)return;R(),(I.speaking||I.pending)&&I.cancel();const pe=Ed(z);if(pe.length===0)return;const se=v.current,le=()=>v.current===se;C.current=pe.map((Q,ie)=>{const re=new SpeechSynthesisUtterance(Q);return re.lang=s,re.onerror=()=>{le()&&A()},re.onend=()=>{le()&&(E.current&&!I.paused?A():ie===pe.length-1&&R())},re}),d(D);for(const Q of C.current)I.speak(Q)},[s,A,R]),q=N.useCallback(()=>{const D=Xn();D&&(E.current=!0,D.pause(),y(D.paused))},[]),G=N.useCallback(()=>{const D=Xn();D&&(E.current=!1,D.resume(),y(!1))},[]);return N.useEffect(()=>A,[A]),{isSupported:a,activeId:u,isPaused:h,speak:$,pause:q,resume:G,cancel:A}}const Ud=/\*\*([^*]+)\*\*/g,Bd=/\*([^*]+)\*/g,Hd=/https?:\/\/[^\s)]+/g;function yu(s){return s.replace(Ud,"$1").replace(Bd,"$1").replace(Hd,a=>{try{return new URL(a).hostname}catch{return a}})}const Vd={"bottom-right":"bottom-24 right-3 sm:right-6","bottom-left":"bottom-24 left-3 sm:left-6","top-right":"top-24 right-3 sm:right-6","top-left":"top-24 left-3 sm:left-6"};function $d({messages:s,isLoading:a,isStreaming:u=!1,streamingMessageId:d=null,error:h,canRetry:y=!1,onSend:v,onStop:E,onRetry:C,onClose:R,title:A="Chat",subtitle:$="Ask me anything",welcomeMessage:q="Hi! How can I help you today?",placeholder:G,position:D="bottom-right",translations:z,isMobile:I=!1,attachments:pe=null,voice:se=null}){const le=N.useId(),Q=N.useRef(null),ie=N.useRef(null),[re,de]=N.useState(null);Id(Q,!0);const J=Fd((se==null?void 0:se.lang)??"en-US"),Te=!!(se!=null&&se.output)&&J.isSupported,ye={play:(z==null?void 0:z.readAloud)??"Read aloud",pause:(z==null?void 0:z.pauseReading)??"Pause reading",resume:(z==null?void 0:z.resumeReading)??"Resume reading",stop:(z==null?void 0:z.stopReading)??"Stop reading"},{offsetY:we}=Ad(ie,R,I),ge=we!==0,Ce=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1;N.useEffect(()=>{const W=ie.current;W&&(W.scrollTop=W.scrollHeight)},[s,a]),N.useEffect(()=>{const W=P=>{P.key==="Escape"&&!P.isComposing&&R()};return document.addEventListener("keydown",W),()=>document.removeEventListener("keydown",W)},[R]);const De=(z==null?void 0:z.closeChat)??"Close chat",Me=(z==null?void 0:z.chatMessages)??"Chat messages",Re=[...s].reverse().find(W=>W.role==="assistant");return g.jsxs("div",{ref:Q,role:"dialog","aria-modal":I?"true":void 0,"aria-labelledby":le,className:I?"claudius-bottom-sheet fixed inset-x-0 bottom-0 z-50 flex h-[90vh] w-full flex-col overflow-hidden rounded-t-claudius-lg bg-claudius-surface shadow-claudius-elevated font-body":`fixed ${Vd[D]} z-50 flex h-[min(500px,calc(100vh-7rem))] w-[calc(100vw-1.5rem)] max-w-[380px] sm:max-w-[400px] md:max-w-[440px] flex-col overflow-hidden rounded-claudius-lg bg-claudius-surface shadow-claudius-elevated font-body`,style:I&&!Ce?{transform:`translateY(${Math.max(0,we)}px)`}:void 0,"data-dragging":ge||void 0,children:[I&&g.jsx("div",{className:"flex justify-center py-2","aria-hidden":"true",children:g.jsx("div",{className:"h-1 w-8 rounded-claudius-full bg-claudius-border"})}),g.jsx(Pd,{title:A,subtitle:$,titleId:le,closeLabel:De,onClose:R}),g.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[re&&g.jsx(Md,{sources:re.sources,onClose:()=>de(null)}),g.jsxs("div",{ref:ie,role:"log","aria-label":Me,className:"h-full space-y-3 overflow-y-auto px-4 py-4",children:[s.length===0&&!h&&g.jsx("div",{className:"mr-auto flex max-w-[85%]",children:g.jsx("div",{className:"rounded-claudius-bubble rounded-bl-claudius-tail bg-claudius-assistant-bubble px-4 py-2.5 text-sm leading-relaxed text-claudius-assistant-bubble-text",children:q})}),s.map(W=>g.jsx(fd,{role:W.role,content:W.content,isStreaming:W.id===d,sources:W.sources,attachments:W.attachments,toolUses:W.toolUses,toolUsedLabel:z==null?void 0:z.toolUsed,toolDetailsLabel:z==null?void 0:z.toolDetails,isSourceActive:(re==null?void 0:re.messageId)===W.id,onSourceClick:()=>{(re==null?void 0:re.messageId)===W.id?de(null):W.sources&&W.sources.length>0&&de({messageId:W.id,sources:W.sources})},speech:Te&&W.role==="assistant"&&W.id!==d&&W.content.trim()!==""?{state:J.activeId!==W.id?"idle":J.isPaused?"paused":"speaking",labels:ye,onPlay:()=>J.speak(W.id,yu(W.content)),onPause:J.pause,onResume:J.resume,onStop:J.cancel}:void 0},W.id)),a&&!(d!==null&&s.some(W=>W.id===d&&W.content.length>0))&&g.jsx(Dd,{label:(z==null?void 0:z.typingIndicator)??"Assistant is typing"}),h&&g.jsx(zd,{message:h,retryLabel:(z==null?void 0:z.errorRetry)??"Retry",onRetry:y&&C&&!a?C:void 0})]})]}),g.jsx("div",{"data-claudius-live":"assistant","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:Re&&Re.id!==d?yu(Re.content):""}),g.jsx(Td,{onSend:v,isLoading:a,isStreaming:u,onStop:E,placeholder:G,translations:z,attachments:pe,voice:se,onVoiceStart:J.cancel})]})}function Wd({message:s,position:a,onOpen:u,onDismiss:d,dismissLabel:h}){const y=a.startsWith("bottom"),v=a.endsWith("right"),E=["claudius-greeting-bubble","fixed z-40 max-w-xs",y?"bottom-20":"top-20",v?"right-4":"left-4"].join(" ");return g.jsxs("div",{className:E,role:"status","aria-live":"polite",children:[g.jsx("button",{type:"button",onClick:u,className:"block w-full rounded-claudius-lg bg-claudius-surface p-4 pr-8 text-left text-sm font-body text-claudius-text shadow-claudius-floating ring-1 ring-claudius-border transition hover:shadow-claudius-floating-hover focus:outline-none focus:ring-2 focus:ring-claudius-accent",children:s}),g.jsx("button",{type:"button",onClick:C=>{C.stopPropagation(),d()},"aria-label":h,className:"absolute right-1 top-1 flex h-6 w-6 items-center justify-center rounded-claudius-full text-claudius-text-muted hover:bg-claudius-surface-muted focus:outline-none focus:ring-2 focus:ring-claudius-accent",children:g.jsx("span",{"aria-hidden":"true",children:"×"})})]})}const wu={en:pu,es:{title:"Chat",subtitle:"Pregúntame lo que quieras",welcomeMessage:"¡Hola! ¿En qué puedo ayudarte hoy?",closeChat:"Cerrar chat",chatMessages:"Mensajes del chat",typingIndicator:"El asistente está escribiendo",placeholder:"Escribe tu mensaje...",sendMessage:"Enviar mensaje",stopGenerating:"Detener la respuesta",toolUsed:"Herramienta usada:",toolDetails:"Detalles de la herramienta",typeYourMessage:"Escribe tu mensaje",openChat:"Abrir chat",dismissGreeting:"Descartar saludo",attachFile:"Adjuntar un archivo",removeAttachment:"Quitar adjunto",attachmentsLabel:"Adjuntos",dropFilesHint:"Suelta los archivos para adjuntarlos",attachmentTooLarge:"{name} es demasiado grande. El tamaño máximo es {max}.",attachmentTypeNotAllowed:"{name} no es un tipo de archivo compatible.",attachmentTooMany:"Puedes adjuntar hasta {max} archivos por mensaje.",voiceInput:"Entrada de voz",voiceInputHold:"Mantén pulsado para hablar",voiceListening:"Escuchando...",voicePermissionDenied:"El acceso al micrófono está bloqueado. Permítelo en la configuración de tu navegador para usar la entrada de voz.",voiceNoSpeech:"No se detectó ninguna voz. Inténtalo de nuevo.",voiceNoMicrophone:"No se encontró ningún micrófono.",voiceUnavailable:"La entrada de voz no está disponible en este momento.",readAloud:"Leer en voz alta",pauseReading:"Pausar la lectura",resumeReading:"Reanudar la lectura",stopReading:"Detener la lectura",errorGeneric:"Algo salió mal. Inténtalo de nuevo.",errorConnection:"No se pudo conectar. Inténtalo de nuevo.",errorTimeout:"La solicitud tardó demasiado. Inténtalo de nuevo.",errorRateLimitMinute:"Demasiadas solicitudes. Espera un minuto.",errorRateLimitHour:"Has alcanzado el límite por hora. Inténtalo más tarde.",errorAttachmentRejected:"Se rechazó un adjunto. Quítalo e inténtalo de nuevo.",errorAttachmentQuota:"Límite de subida alcanzado. Inténtalo más tarde.",errorRetry:"Reintentar"},fr:{title:"Chat",subtitle:"Posez-moi vos questions",welcomeMessage:"Bonjour ! Comment puis-je vous aider aujourd'hui ?",closeChat:"Fermer le chat",chatMessages:"Messages du chat",typingIndicator:"L'assistant écrit",placeholder:"Saisissez votre message...",sendMessage:"Envoyer le message",stopGenerating:"Arrêter la génération",toolUsed:"Outil utilisé :",toolDetails:"Détails de l'outil",typeYourMessage:"Saisissez votre message",openChat:"Ouvrir le chat",dismissGreeting:"Ignorer le message d'accueil",attachFile:"Joindre un fichier",removeAttachment:"Retirer la pièce jointe",attachmentsLabel:"Pièces jointes",dropFilesHint:"Déposez les fichiers pour les joindre",attachmentTooLarge:"{name} est trop volumineux. La taille maximale est de {max}.",attachmentTypeNotAllowed:"{name} n'est pas un type de fichier pris en charge.",attachmentTooMany:"Vous pouvez joindre jusqu'à {max} fichiers par message.",voiceInput:"Saisie vocale",voiceInputHold:"Maintenez pour parler",voiceListening:"Écoute en cours...",voicePermissionDenied:"L'accès au microphone est bloqué. Autorisez-le dans les paramètres de votre navigateur pour utiliser la saisie vocale.",voiceNoSpeech:"Aucune voix n'a été détectée. Veuillez réessayer.",voiceNoMicrophone:"Aucun microphone n'a été trouvé.",voiceUnavailable:"La saisie vocale n'est pas disponible pour le moment.",readAloud:"Lire à voix haute",pauseReading:"Mettre la lecture en pause",resumeReading:"Reprendre la lecture",stopReading:"Arrêter la lecture",errorGeneric:"Une erreur s'est produite. Veuillez réessayer.",errorConnection:"Échec de la connexion. Veuillez réessayer.",errorTimeout:"La requête a expiré. Veuillez réessayer.",errorRateLimitMinute:"Trop de requêtes. Veuillez patienter une minute.",errorRateLimitHour:"Limite horaire atteinte. Veuillez réessayer plus tard.",errorAttachmentRejected:"Une pièce jointe a été refusée. Retirez-la et réessayez.",errorAttachmentQuota:"Limite d'envoi atteinte. Veuillez réessayer plus tard.",errorRetry:"Réessayer"},de:{title:"Chat",subtitle:"Fragen Sie mich alles",welcomeMessage:"Hallo! Wie kann ich Ihnen heute helfen?",closeChat:"Chat schließen",chatMessages:"Chat-Nachrichten",typingIndicator:"Der Assistent schreibt",placeholder:"Geben Sie Ihre Nachricht ein...",sendMessage:"Nachricht senden",stopGenerating:"Generierung stoppen",toolUsed:"Verwendetes Tool:",toolDetails:"Tool-Details",typeYourMessage:"Geben Sie Ihre Nachricht ein",openChat:"Chat öffnen",dismissGreeting:"Begrüßung schließen",attachFile:"Datei anhängen",removeAttachment:"Anhang entfernen",attachmentsLabel:"Anhänge",dropFilesHint:"Dateien hier ablegen, um sie anzuhängen",attachmentTooLarge:"{name} ist zu groß. Die maximale Größe beträgt {max}.",attachmentTypeNotAllowed:"{name} ist kein unterstützter Dateityp.",attachmentTooMany:"Sie können bis zu {max} Dateien pro Nachricht anhängen.",voiceInput:"Spracheingabe",voiceInputHold:"Zum Sprechen gedrückt halten",voiceListening:"Ich höre zu...",voicePermissionDenied:"Der Zugriff auf das Mikrofon ist blockiert. Erlauben Sie ihn in den Einstellungen Ihres Browsers, um die Spracheingabe zu nutzen.",voiceNoSpeech:"Es wurde keine Sprache erkannt. Bitte versuchen Sie es erneut.",voiceNoMicrophone:"Es wurde kein Mikrofon gefunden.",voiceUnavailable:"Die Spracheingabe ist momentan nicht verfügbar.",readAloud:"Vorlesen",pauseReading:"Vorlesen pausieren",resumeReading:"Vorlesen fortsetzen",stopReading:"Vorlesen beenden",errorGeneric:"Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.",errorConnection:"Verbindung fehlgeschlagen. Bitte versuchen Sie es erneut.",errorTimeout:"Zeitüberschreitung der Anfrage. Bitte versuchen Sie es erneut.",errorRateLimitMinute:"Zu viele Anfragen. Bitte warten Sie eine Minute.",errorRateLimitHour:"Stündliches Limit erreicht. Bitte versuchen Sie es später erneut.",errorAttachmentRejected:"Ein Anhang wurde abgelehnt. Bitte entfernen Sie ihn und versuchen Sie es erneut.",errorAttachmentQuota:"Upload-Limit erreicht. Bitte versuchen Sie es später erneut.",errorRetry:"Erneut versuchen"}};function xu(s){if(!s)return;const a=s.toLowerCase().split("-")[0];return Object.prototype.hasOwnProperty.call(wu,a)?a:void 0}function Su(){const s=typeof document<"u"?xu(document.documentElement.lang):void 0;if(s)return s;const a=typeof navigator<"u"?xu(navigator.language):void 0;return a||"en"}function Qd(s={}){const{locale:a,translations:u}=s,d=wu[a??Su()];return u?{...d,...u}:{...d}}const ku=["accent","accentText","accentSoft","accentTextMuted","surface","surfaceMuted","text","textMuted","border","userBubble","userBubbleText","assistantBubble","assistantBubbleText","field","error","errorSurface","errorText","link","scrim"],Kd=["sm","md","lg","full","tail"],Gd=["elevated","floating","floatingHover"],Yd=["heading","body"],Eu={default:{name:"default"},minimal:{name:"minimal",colors:{accent:"#171717",accentText:"#ffffff",surface:"#ffffff",surfaceMuted:"#f5f5f5",text:"#171717",textMuted:"#737373",border:"#e5e5e5",link:"#171717"},colorsDark:{accent:"#fafafa",accentText:"#171717",surface:"#0a0a0a",surfaceMuted:"#1c1c1c",text:"#fafafa",textMuted:"#a3a3a3",border:"#2e2e2e",field:"#1c1c1c",link:"#fafafa"},radii:{sm:"4px",md:"6px",lg:"10px"},shadows:{elevated:"0 4px 16px rgb(0 0 0 / 0.12)",floating:"0 2px 8px rgb(0 0 0 / 0.12)",floatingHover:"0 4px 12px rgb(0 0 0 / 0.16)"}},playful:{name:"playful",colors:{accent:"#8b5cf6",surfaceMuted:"#f5f3ff",assistantBubbleText:"#4c1d95",link:"#7c3aed"},colorsDark:{accent:"#a78bfa",surfaceMuted:"#2e1065",assistantBubbleText:"#ede9fe",link:"#c4b5fd"},radii:{sm:"12px",md:"16px",lg:"24px",tail:"8px"},shadows:{elevated:"0 24px 48px -12px rgb(139 92 246 / 0.35)",floating:"0 10px 20px -5px rgb(139 92 246 / 0.4)",floatingHover:"0 16px 28px -6px rgb(139 92 246 / 0.5)"},fonts:{heading:"ui-rounded, 'Hiragino Maru Gothic ProN', system-ui",body:"ui-rounded, 'Hiragino Maru Gothic ProN', system-ui"}},corporate:{name:"corporate",colors:{accent:"#1e3a5f",surfaceMuted:"#f3f4f6",text:"#1f2937",textMuted:"#6b7280",border:"#d1d5db",link:"#1d4ed8"},colorsDark:{accent:"#2c5282",link:"#93c5fd"},radii:{sm:"4px",md:"6px",lg:"8px",tail:"2px"},shadows:{elevated:"0 8px 24px rgb(15 23 42 / 0.16)",floating:"0 4px 12px rgb(15 23 42 / 0.18)",floatingHover:"0 6px 16px rgb(15 23 42 / 0.24)"},fonts:{heading:"'Segoe UI', 'Helvetica Neue', Arial, system-ui",body:"'Segoe UI', 'Helvetica Neue', Arial, system-ui"}}};function Xd(s){return Object.prototype.hasOwnProperty.call(Eu,s)}const qd=new Set(["light","dark","auto"]);function Zd(s){if(s===void 0)return{mode:"light"};if(typeof s=="string"){if(qd.has(s))return{mode:s};if(Xd(s)){const a=Eu[s];return{mode:a.colorScheme??"light",theme:a}}return{mode:"light",url:s}}return{mode:s.colorScheme??"light",theme:s}}function Jd(s){return s.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}function bd(s,a){console.warn(`[Claudius] Ignoring unknown theme token "${a}" in "${s}"`)}function qn(s,a,u,d,h,y=""){if(h)for(const[v,E]of Object.entries(h)){if(!d.includes(v)){bd(a,v);continue}typeof E=="string"&&(s[`${u}${Jd(v)}${y}`]=E)}}function ef(s){const a={};qn(a,"colors","--cl-color-",ku,s.colors);for(const[u,d]of Object.entries({...a}))a[`${u}-dark`]=d;return qn(a,"colorsDark","--cl-color-",ku,s.colorsDark,"-dark"),qn(a,"radii","--cl-radius-",Kd,s.radii),qn(a,"shadows","--cl-shadow-",Gd,s.shadows),qn(a,"fonts","--cl-font-",Yd,s.fonts),a}function tf(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function nf(s){const a=N.useMemo(()=>Zd(s),[s]),[u,d]=N.useState(null),h=a.url;N.useEffect(()=>{if(d(null),!h)return;const C=new AbortController;return fetch(h,{signal:C.signal}).then(R=>{if(!R.ok)throw new Error(`HTTP ${R.status}`);return R.json()}).then(R=>{if(!tf(R))throw new Error("theme JSON must be an object");d(R)}).catch(R=>{C.signal.aborted||console.error(`[Claudius] Failed to load theme from ${h}:`,R)}),()=>C.abort()},[h]);const y=a.theme??u??null,v=(u==null?void 0:u.colorScheme)??a.mode,E=N.useMemo(()=>y?ef(y):{},[y]);return{mode:v,cssVars:E}}const Cu="claudius:triggers:dismissed";function rf(){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(Cu)==="1"}catch{return!1}}function lf(){if(!(typeof window>"u"))try{window.sessionStorage.setItem(Cu,"1")}catch{}}function Ru({apiUrl:s,title:a,subtitle:u,welcomeMessage:d,placeholder:h,persistMessages:y,storageKeyPrefix:v,requestTimeoutMs:E,theme:C="light",accentColor:R,position:A="bottom-right",locale:$,translations:q,triggers:G,plugins:D,streaming:z=!0,attachments:I=!1,voice:pe=!1}){const[se,le]=N.useState(!1),Q=N.useMemo(()=>zc(I),[I]),ie=N.useMemo(()=>wd(pe,$??Su()),[pe,$]),[re,de]=N.useState(null),[J,Te]=N.useState(rf),ye=N.useRef(!1),we=Yc("(max-width: 639px)"),ge=N.useMemo(()=>Qd({locale:$,translations:q}),[$,q]),{messages:Ce,isLoading:De,isStreaming:Me,streamingMessageId:Re,error:W,canRetry:P,sendMessage:Y,stop:T,retry:m}=Gc({apiUrl:s,persistMessages:y,storageKeyPrefix:v,timeoutMs:E,translations:ge,plugins:D,streaming:z}),k=N.useRef(null),te=N.useRef(se),{mode:Z,cssVars:ae}=nf(C),[ue,B]=N.useState(!1);N.useEffect(()=>{if(Z!=="auto")return;const $e=window.matchMedia("(prefers-color-scheme: dark)");B($e.matches);const kn=sn=>B(sn.matches);return $e.addEventListener("change",kn),()=>$e.removeEventListener("change",kn)},[Z]),N.useEffect(()=>{var $e;te.current&&!se&&(($e=k.current)==null||$e.focus()),te.current=se},[se]);const X=N.useCallback(()=>{Te(!0),lf()},[]),ne=N.useCallback(()=>{le(!1),ye.current&&(ye.current=!1,X())},[X]),xe=N.useCallback(()=>{le($e=>!$e)},[]),Fe=N.useCallback(()=>{ye.current=!0,de(null),le(!0)},[]),at=N.useCallback($e=>{de($e)},[]),Rt=N.useCallback(()=>{de(null),Fe()},[Fe]),F=N.useCallback(()=>{de(null),X()},[X]);qc({triggers:G,enabled:!J&&!se,onOpen:Fe,onGreeting:at});const fe=Z==="dark"||Z==="auto"&&ue,Ue={...ae,...R?{"--cl-color-accent":R,"--cl-color-accent-dark":R}:{}},Pt=Object.keys(Ue).length>0?Ue:void 0;return g.jsx("div",{className:"claudius-root",style:Pt,children:g.jsxs("div",{"data-claudius-dark":fe?"true":"false",children:[se&&we&&g.jsx("div",{className:"claudius-scrim fixed inset-0 z-40 bg-claudius-scrim",onClick:ne,"aria-hidden":"true"}),se&&g.jsx($d,{messages:Ce,isLoading:De,isStreaming:Me,streamingMessageId:Re,error:W,canRetry:P,onSend:Y,onStop:T,onRetry:m,onClose:ne,title:a??ge.title,subtitle:u??ge.subtitle,welcomeMessage:d??ge.welcomeMessage,placeholder:h??ge.placeholder,position:A,translations:ge,isMobile:we,attachments:Q,voice:ie}),!(se&&we)&&g.jsx(Jc,{ref:k,isOpen:se,onClick:xe,position:A,translations:ge}),!se&&re&&g.jsx(Wd,{message:re,position:A,onOpen:Rt,onDismiss:F,dismissLabel:ge.dismissGreeting})]})})}const of="1.16.0";typeof window<"u"&&(window.ClaudiusWidgetVersion=of);function Nu(){const s=window.ClaudiusConfig;if(!(s!=null&&s.apiUrl)){console.error("[Claudius] Missing ClaudiusConfig.apiUrl");return}const a=document.createElement("div");a.id="claudius-chat-widget",document.body.appendChild(a),lu.createRoot(a).render(g.jsx(Ru,{apiUrl:s.apiUrl,title:s.title,subtitle:s.subtitle,welcomeMessage:s.welcomeMessage,placeholder:s.placeholder,persistMessages:s.persistMessages,storageKeyPrefix:s.storageKeyPrefix,requestTimeoutMs:s.requestTimeoutMs,theme:s.theme,accentColor:s.accentColor,position:s.position,locale:s.locale,translations:s.translations,triggers:s.triggers,attachments:s.attachments,voice:s.voice}))}class Tu extends HTMLElement{constructor(){super(...arguments);un(this,"root",null);un(this,"container",null)}static get observedAttributes(){return["api-url","title","subtitle","welcome-message","placeholder","persist-messages","storage-key-prefix","request-timeout-ms","theme","accent-color","position","attachments","voice","voice-mode","voice-auto-submit","voice-input","voice-output","voice-lang"]}connectedCallback(){this.container=document.createElement("div"),this.appendChild(this.container),this.root=lu.createRoot(this.container),this.render()}disconnectedCallback(){this.root&&(this.root.unmount(),this.root=null),this.container&&(this.container.remove(),this.container=null)}attributeChangedCallback(){this.render()}render(){if(!this.root)return;const u=this.getAttribute("api-url");if(!u){console.error("[Claudius] Missing api-url attribute on ");return}const d=this.getAttribute("persist-messages"),h=d===null?void 0:d!=="false",y=this.getAttribute("request-timeout-ms"),v=y===null?void 0:Number(y),E=this.getAttribute("attachments"),C=E===null?void 0:E!=="false";this.root.render(g.jsx(Ru,{apiUrl:u,title:this.getAttribute("title")??void 0,subtitle:this.getAttribute("subtitle")??void 0,welcomeMessage:this.getAttribute("welcome-message")??void 0,placeholder:this.getAttribute("placeholder")??void 0,persistMessages:h,storageKeyPrefix:this.getAttribute("storage-key-prefix")??void 0,requestTimeoutMs:v!==void 0&&Number.isFinite(v)?v:void 0,theme:this.getAttribute("theme")??void 0,accentColor:this.getAttribute("accent-color")??void 0,position:this.getAttribute("position")??void 0,attachments:C,voice:xd(R=>this.getAttribute(R))}))}}return typeof customElements<"u"&&!customElements.get("claudius-chat")&&customElements.define("claudius-chat",Tu),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Nu):Nu(),Mt.ClaudiusChat=Tu,Object.defineProperty(Mt,Symbol.toStringTag,{value:"Module"}),Mt})({}); diff --git a/create-claudius/package.json b/create-claudius/package.json index ad508ee..0db4aff 100644 --- a/create-claudius/package.json +++ b/create-claudius/package.json @@ -1,6 +1,6 @@ { "name": "create-claudius", - "version": "1.15.0", + "version": "1.16.0", "description": "Scaffold a Claudius AI chat widget project in one command.", "keywords": [ "claudius", diff --git a/docs/package.json b/docs/package.json index 21653fa..d98d949 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "claudius-docs", - "version": "1.15.0", + "version": "1.16.0", "private": true, "type": "module", "scripts": { diff --git a/package.json b/package.json index 792f3fd..c67b97a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claudius", - "version": "1.15.0", + "version": "1.16.0", "description": "Embeddable AI chat widget for PMDS and client sites. React component + standalone script embed, powered by Cloudflare Workers and Claude.", "private": true, "type": "module", diff --git a/widget/package.json b/widget/package.json index 208f5a7..bb89bc2 100644 --- a/widget/package.json +++ b/widget/package.json @@ -1,6 +1,6 @@ { "name": "claudius-chat-widget", - "version": "1.15.0", + "version": "1.16.0", "type": "module", "description": "Embeddable AI chat widget powered by Claude. Drop-in React component or standalone script embed, backed by a Cloudflare Worker.", "keywords": [ diff --git a/worker/package.json b/worker/package.json index cfc316b..a51799e 100644 --- a/worker/package.json +++ b/worker/package.json @@ -1,6 +1,6 @@ { "name": "claudius-chat-worker", - "version": "1.15.0", + "version": "1.16.0", "private": true, "type": "module", "scripts": {