From 854586ddc42e32ab1158fa982770bb35b905217f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 20 Sep 2026 15:04:41 +0000 Subject: [PATCH 1/2] chore(main): release 1.17.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 32 ++++++++++++++++++++++++++++++++ create-claudius/package.json | 2 +- docs/package.json | 2 +- package.json | 2 +- widget/package.json | 2 +- worker/package.json | 2 +- 7 files changed, 38 insertions(+), 6 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index f0af317..46e7a46 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.16.1" + ".": "1.17.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 0726e6a..194b88a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,38 @@ 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.17.0](https://github.com/PMDevSolutions/Claudius/compare/v1.16.1...v1.17.0) (2026-09-20) + + +### Features + +* **scripts:** conversationExport in client config schema, validation, and snippets ([b6e4347](https://github.com/PMDevSolutions/Claudius/commit/b6e434757b2cf7bbda72ec814bdc7e208799f967)) +* **widget:** accessible header menu ([ae759d0](https://github.com/PMDevSolutions/Claudius/commit/ae759d096a97006ad11c014096bfc06fbf48857c)) +* **widget:** clipboard and download helpers ([c64b453](https://github.com/PMDevSolutions/Claudius/commit/c64b4531c0881b4f476c8651fcf6118230ea8e82)) +* **widget:** conversation export (Markdown, JSON, copy to clipboard) ([35e85b9](https://github.com/PMDevSolutions/Claudius/commit/35e85b9937de8af025ae0304cfe3abdc15815840)) +* **widget:** conversation export strings in en, es, fr, de ([95bb6c6](https://github.com/PMDevSolutions/Claudius/commit/95bb6c6af1a66ed0c0cee6458a2dee383517af21)) +* **widget:** conversationExport in ClaudiusConfig and <claudius-chat> ([e91b492](https://github.com/PMDevSolutions/Claudius/commit/e91b492b34cccb8206aaca29079f47b8fbda55da)) +* **widget:** conversationExport option and header menu wiring ([368319b](https://github.com/PMDevSolutions/Claudius/commit/368319bac89bade59e9b0affa95ff67cdfb21580)) +* **widget:** Markdown and JSON conversation serializers ([f012dc4](https://github.com/PMDevSolutions/Claudius/commit/f012dc4a949f1c774e64c94ac41a45741923d4b8)) +* **widget:** message text protections for Markdown export ([e5cc07f](https://github.com/PMDevSolutions/Claudius/commit/e5cc07fdee4b9207e40792d60867512923e0b0c9)) +* **widget:** record createdAt on chat messages ([c6049d2](https://github.com/PMDevSolutions/Claudius/commit/c6049d299d52b06dd67480038b7055fb6b68389f)) +* **widget:** useConversationExport hook ([62ca757](https://github.com/PMDevSolutions/Claudius/commit/62ca7574c72f0512391f1560ed0d046a342d5a90)) + + +### Bug Fixes + +* **widget:** keep code intact when a message ends inside an open fence ([e001999](https://github.com/PMDevSolutions/Claudius/commit/e001999adf2d6d8bb650782e8e5625f3d31c7a5b)) + + +### Refactoring + +* **widget:** accept only true for the conversation-export attribute ([59b6e85](https://github.com/PMDevSolutions/Claudius/commit/59b6e854aced8987e4dc3f929eeadf3902948bb3)) +* **widget:** harden the transcript serializer ([75f02da](https://github.com/PMDevSolutions/Claudius/commit/75f02da7013b633b4828fe00719db5a0fd06e366)) +* **widget:** keep a blur with no relatedTarget from closing the menu ([c1fbf00](https://github.com/PMDevSolutions/Claudius/commit/c1fbf0040a1df89db4b395e456b0519fc9f3c975)) +* **widget:** let the clipboard fallback fail without throwing ([a6bb805](https://github.com/PMDevSolutions/Claudius/commit/a6bb80598fd1e82c8f2d9b8e95b383d3afef3fff)) +* **widget:** prove what the mounted guard actually prevents ([c776849](https://github.com/PMDevSolutions/Claudius/commit/c776849329db4a6abbd554d8a70c95481f6ee219)) +* **widget:** shorten the German copy-failure message ([9301008](https://github.com/PMDevSolutions/Claudius/commit/9301008ddac80e41d537d31f5b2075538d6ed5cd)) + ## [1.16.1](https://github.com/PMDevSolutions/Claudius/compare/v1.16.0...v1.16.1) (2026-09-19) diff --git a/create-claudius/package.json b/create-claudius/package.json index c206a3b..fa33d9a 100644 --- a/create-claudius/package.json +++ b/create-claudius/package.json @@ -1,6 +1,6 @@ { "name": "create-claudius", - "version": "1.16.1", + "version": "1.17.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 f92dc0c..efc4fd3 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "claudius-docs", - "version": "1.16.1", + "version": "1.17.0", "private": true, "type": "module", "scripts": { diff --git a/package.json b/package.json index be49b27..c6c2b74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "claudius", - "version": "1.16.1", + "version": "1.17.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 bfd75b6..96e2aec 100644 --- a/widget/package.json +++ b/widget/package.json @@ -1,6 +1,6 @@ { "name": "claudius-chat-widget", - "version": "1.16.1", + "version": "1.17.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 a129bee..c572331 100644 --- a/worker/package.json +++ b/worker/package.json @@ -1,6 +1,6 @@ { "name": "claudius-chat-worker", - "version": "1.16.1", + "version": "1.17.0", "private": true, "type": "module", "scripts": { From 8d7f80f6bf0638b4be0aef63b3b23706697887ae Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 20 Sep 2026 15:04:59 +0000 Subject: [PATCH 2/2] chore: rebuild cdn bundle for release --- cdn/claudius.css | 2 +- cdn/claudius.iife.js | 42 ++++++++++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/cdn/claudius.css b/cdn/claudius.css index a696dde..d2a049e 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}.invisible{visibility:hidden}.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{--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(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-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\:ring-offset-claudius-surface:focus{--tw-ring-offset-color: var(--cl-color-surface, #ffffff)}.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}.invisible{visibility:hidden}.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-0{right:0}.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-2{top:.5rem}.top-20{top:5rem}.top-24{top:6rem}.top-6{top:1.5rem}.top-full{top:100%}.z-10{z-index:10}.z-20{z-index:20}.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}.min-h-\[40px\]{min-height:40px}.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}.min-w-\[12rem\]{min-width:12rem}.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-nowrap{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{--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(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-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\:bg-claudius-surface-muted:focus{background-color:var(--claudius-light, var(--cl-color-surface-muted, #f1f5f9))}.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\:ring-offset-claudius-surface:focus{--tw-ring-offset-color: var(--cl-color-surface, #ffffff)}.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}.aria-disabled\:cursor-default[aria-disabled=true]{cursor:default}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-disabled\:hover\:bg-transparent:hover[aria-disabled=true]{background-color:transparent}@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 626fb54..c9c8751 100644 --- a/cdn/claudius.iife.js +++ b/cdn/claudius.iife.js @@ -1,4 +1,4 @@ -var Claudius=(function(zt){"use strict";var rh=Object.defineProperty;var lh=(zt,yt,Tt)=>yt in zt?rh(zt,yt,{enumerable:!0,configurable:!0,writable:!0,value:Tt}):zt[yt]=Tt;var pn=(zt,yt,Tt)=>lh(zt,typeof yt!="symbol"?yt+"":yt,Tt);var yt={exports:{}},Tt={},Zl={exports:{}},fe={};/** +var Claudius=(function(Ot){"use strict";var Ph=Object.defineProperty;var Ah=(Ot,xt,jt)=>xt in Ot?Ph(Ot,xt,{enumerable:!0,configurable:!0,writable:!0,value:jt}):Ot[xt]=jt;var hn=(Ot,xt,jt)=>Ah(Ot,typeof xt!="symbol"?xt+"":xt,jt);var xt={exports:{}},jt={},ro={exports:{}},fe={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var Claudius=(function(zt){"use strict";var rh=Object.defineProperty;var lh=(zt, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Ji;function yc(){if(Ji)return fe;Ji=1;var s=Symbol.for("react.element"),a=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),f=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),v=Symbol.for("react.context"),k=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),T=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),F=Symbol.iterator;function q(m){return m===null||typeof m!="object"?null:(m=F&&m[F]||m["@@iterator"],typeof m=="function"?m:null)}var Y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,z={};function I(m,C,ee){this.props=m,this.context=C,this.refs=z,this.updater=ee||Y}I.prototype.isReactComponent={},I.prototype.setState=function(m,C){if(typeof m!="object"&&typeof m!="function"&&m!=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,m,C,"setState")},I.prototype.forceUpdate=function(m){this.updater.enqueueForceUpdate(this,m,"forceUpdate")};function de(){}de.prototype=I.prototype;function ue(m,C,ee){this.props=m,this.context=C,this.refs=z,this.updater=ee||Y}var le=ue.prototype=new de;le.constructor=ue,A(le,I.prototype),le.isPureReactComponent=!0;var W=Array.isArray,ie=Object.prototype.hasOwnProperty,ae={current:null},se={key:!0,ref:!0,__self:!0,__source:!0};function X(m,C,ee){var ne,ce={},re=null,H=null;if(C!=null)for(ne in C.ref!==void 0&&(H=C.ref),C.key!==void 0&&(re=""+C.key),C)ie.call(C,ne)&&!se.hasOwnProperty(ne)&&(ce[ne]=C[ne]);var K=arguments.length-2;if(K===1)ce.children=ee;else if(1>>1,C=D[m];if(0>>1;mp(ce,N))rep(H,ce)?(D[m]=H,D[re]=N,m=re):(D[m]=ce,D[ne]=N,m=ne);else if(rep(H,N))D[m]=H,D[re]=N,m=re;else break e}}return Z}function p(D,Z){var N=D.sortIndex-Z.sortIndex;return N!==0?N:D.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var y=performance;s.unstable_now=function(){return y.now()}}else{var v=Date,k=v.now();s.unstable_now=function(){return v.now()-k}}var E=[],T=[],M=1,F=null,q=3,Y=!1,A=!1,z=!1,I=typeof setTimeout=="function"?setTimeout:null,de=typeof clearTimeout=="function"?clearTimeout:null,ue=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(D){for(var Z=u(T);Z!==null;){if(Z.callback===null)f(T);else if(Z.startTime<=D)f(T),Z.sortIndex=Z.expirationTime,a(E,Z);else break;Z=u(T)}}function W(D){if(z=!1,le(D),!A)if(u(E)!==null)A=!0,Ce(ie);else{var Z=u(T);Z!==null&&Q(W,Z.startTime-D)}}function ie(D,Z){A=!1,z&&(z=!1,de(X),X=-1),Y=!0;var N=q;try{for(le(Z),F=u(E);F!==null&&(!(F.expirationTime>Z)||D&&!ge());){var m=F.callback;if(typeof m=="function"){F.callback=null,q=F.priorityLevel;var C=m(F.expirationTime<=Z);Z=s.unstable_now(),typeof C=="function"?F.callback=C:F===u(E)&&f(E),le(Z)}else f(E);F=u(E)}if(F!==null)var ee=!0;else{var ne=u(T);ne!==null&&Q(W,ne.startTime-Z),ee=!1}return ee}finally{F=null,q=N,Y=!1}}var ae=!1,se=null,X=-1,ke=5,xe=-1;function ge(){return!(s.unstable_now()-xeD||125m?(D.sortIndex=N,a(T,D),u(E)===null&&D===u(T)&&(z?(de(X),X=-1):z=!0,Q(W,N-m))):(D.sortIndex=C,a(E,D),A||Y||(A=!0,Ce(ie))),D},s.unstable_shouldYield=ge,s.unstable_wrapCallback=function(D){var Z=q;return function(){var N=q;q=Z;try{return D.apply(this,arguments)}finally{q=N}}}})(to)),to}var ru;function kc(){return ru||(ru=1,eo.exports=Sc()),eo.exports}/** + */var ou;function Pc(){return ou||(ou=1,(function(u){function a(z,X){var C=z.length;z.push(X);e:for(;0>>1,T=z[m];if(0>>1;mf(se,C))nef(ie,se)?(z[m]=ie,z[ne]=C,m=ne):(z[m]=se,z[le]=C,m=le);else if(nef(ie,C))z[m]=ie,z[ne]=C,m=ne;else break e}}return X}function f(z,X){var C=z.sortIndex-X.sortIndex;return C!==0?C:z.id-X.id}if(typeof performance=="object"&&typeof performance.now=="function"){var p=performance;u.unstable_now=function(){return p.now()}}else{var v=Date,k=v.now();u.unstable_now=function(){return v.now()-k}}var S=[],N=[],j=1,O=null,V=3,I=!1,D=!1,P=!1,F=typeof setTimeout=="function"?setTimeout:null,$=typeof clearTimeout=="function"?clearTimeout:null,J=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function B(z){for(var X=i(N);X!==null;){if(X.callback===null)c(N);else if(X.startTime<=z)c(N),X.sortIndex=X.expirationTime,a(S,X);else break;X=i(N)}}function Q(z){if(P=!1,B(z),!D)if(i(S)!==null)D=!0,_e(ue);else{var X=i(N);X!==null&&ge(Q,X.startTime-z)}}function ue(z,X){D=!1,P&&(P=!1,$(Z),Z=-1),I=!0;var C=V;try{for(B(X),O=i(S);O!==null&&(!(O.expirationTime>X)||z&&!Se());){var m=O.callback;if(typeof m=="function"){O.callback=null,V=O.priorityLevel;var T=m(O.expirationTime<=X);X=u.unstable_now(),typeof T=="function"?O.callback=T:O===i(S)&&c(S),B(X)}else c(S);O=i(S)}if(O!==null)var re=!0;else{var le=i(N);le!==null&&ge(Q,le.startTime-X),re=!1}return re}finally{O=null,V=C,I=!1}}var de=!1,ae=null,Z=-1,xe=5,pe=-1;function Se(){return!(u.unstable_now()-pez||125m?(z.sortIndex=C,a(N,z),i(S)===null&&z===i(N)&&(P?($(Z),Z=-1):P=!0,ge(Q,C-m))):(z.sortIndex=T,a(S,z),D||I||(D=!0,_e(ue))),z},u.unstable_shouldYield=Se,u.unstable_wrapCallback=function(z){var X=V;return function(){var C=V;V=X;try{return z.apply(this,arguments)}finally{V=C}}}})(uo)),uo}var iu;function Ac(){return iu||(iu=1,io.exports=Pc()),io.exports}/** * @license React * react-dom.production.min.js * @@ -30,18 +30,28 @@ var Claudius=(function(zt){"use strict";var rh=Object.defineProperty;var lh=(zt, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var lu;function Ec(){if(lu)return Je;lu=1;var s=Jl(),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"),E=Object.prototype.hasOwnProperty,T=/^[: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]*$/,M={},F={};function q(e){return E.call(F,e)?!0:E.call(M,e)?!1:T.test(e)?F[e]=!0:(M[e]=!0,!1)}function Y(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 A(e,t,n,r){if(t===null||typeof t>"u"||Y(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 de=/[\-:]([a-z])/g;function ue(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(de,ue);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(de,ue);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(de,ue);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||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),S=Object.prototype.hasOwnProperty,N=/^[: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]*$/,j={},O={};function V(e){return S.call(O,e)?!0:S.call(j,e)?!1:N.test(e)?O[e]=!0:(j[e]=!0,!1)}function I(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"||I(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 P(e,t,n,r,l,o,s){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=s}var F={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){F[e]=new P(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];F[t]=new P(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){F[e]=new P(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){F[e]=new P(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){F[e]=new P(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){F[e]=new P(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){F[e]=new P(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){F[e]=new P(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){F[e]=new P(e,5,!1,e.toLowerCase(),null,!1,!1)});var $=/[\-:]([a-z])/g;function J(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($,J);F[t]=new P(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($,J);F[t]=new P(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($,J);F[t]=new P(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){F[e]=new P(e,1,!1,e.toLowerCase(),null,!1,!1)}),F.xlinkHref=new P("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){F[e]=new P(e,1,!1,e.toLowerCase(),null,!0,!0)});function B(e,t,n,r){var l=F.hasOwnProperty(t)?F[t]:null;(l!==null?l.type!==0:r||!(2c||l[i]!==o[c]){var d=` -`+l[i].replace(" at new "," at ");return e.displayName&&d.includes("")&&(d=d.replace("",e.displayName)),d}while(1<=i&&0<=c);break}}}finally{ee=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?C(e):""}function ce(e){switch(e.tag){case 5:return C(e.type);case 16:return C("Lazy");case 13:return C("Suspense");case 19:return C("SuspenseList");case 0:case 2:case 15:return e=ne(e.type,!1),e;case 11:return e=ne(e.type.render,!1),e;case 1:return e=ne(e.type,!0),e;default:return""}}function re(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 se:return"Fragment";case ae:return"Portal";case ke:return"Profiler";case X:return"StrictMode";case Ee:return"Suspense";case Me:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ge:return(e.displayName||"Context")+".Consumer";case xe:return(e._context.displayName||"Context")+".Provider";case he:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case _e:return t=e.displayName||null,t!==null?t:re(e.type)||"Memo";case Ce:t=e._payload,e=e._init;try{return re(e(t))}catch{}}return null}function H(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 re(t);case 8:return t===X?"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 te(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ye(e){var t=te(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 Ue(e){e._valueTracker||(e._valueTracker=ye(e))}function ct(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=te(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function wt(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 ft(e,t){var n=t.checked;return N({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function $e(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 ot(e,t){t=t.checked,t!=null&&le(e,"checked",t,!1)}function Dt(e,t){ot(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")?Qt(e,t.type,n):t.hasOwnProperty("defaultValue")&&Qt(e,t.type,K(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Oe(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 Qt(e,t,n){(t!=="number"||wt(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var At=Array.isArray;function Kt(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=$r.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function tr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var nr={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},ud=["Webkit","ms","Moz","O"];Object.keys(nr).forEach(function(e){ud.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),nr[t]=nr[e]})});function zu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||nr.hasOwnProperty(e)&&nr[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 sd=N({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 ao(e,t){if(t){if(sd[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 co(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 fo=null;function po(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ho=null,Tn=null,_n=null;function Au(e){if(e=Cr(e)){if(typeof ho!="function")throw Error(u(280));var t=e.stateNode;t&&(t=dl(t),ho(e.stateNode,e.type,t))}}function Ou(e){Tn?_n?_n.push(e):_n=[e]:Tn=e}function Iu(){if(Tn){var e=Tn,t=_n;if(_n=Tn=null,Au(e),t)for(e=0;e>>=0,e===0?32:31-(wd(e)/xd|0)|0}var Yr=64,Xr=4194304;function ir(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 qr(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=ir(c):(o&=i,o!==0&&(r=ir(o)))}else i=n&~l,i!==0?r=ir(i):o!==0&&(r=ir(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 ur(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-xt(t),e[t]=n}function Cd(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=mr),fs=" ",ds=!1;function ps(e,t){switch(e){case"keyup":return Jd.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 Mn=!1;function ep(e,t){switch(e){case"compositionend":return hs(t);case"keypress":return t.which!==32?null:(ds=!0,fs);case"textInput":return e=t.data,e===fs&&ds?null:e;default:return null}}function tp(e,t){if(Mn)return e==="compositionend"||!Po&&ps(e,t)?(e=os(),tl=No=Zt=null,Mn=!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=wt();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=wt(e.document)}return t}function Ao(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&&Ao(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,Pn=null,Oo=null,wr=null,Io=!1;function Rs(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Io||Pn==null||Pn!==wt(r)||(r=Pn,"selectionStart"in r&&Ao(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}),wr&&yr(wr,r)||(wr=r,r=al(Oo,"onSelect"),0In||(e.current=Xo[In],Xo[In]=null,In--)}function Se(e,t){In++,Xo[In]=e.current,e.current=t}var tn={},Ke=en(tn),et=en(!1),gn=tn;function Fn(e,t){var n=e.type.contextTypes;if(!n)return tn;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 pl(){Ne(et),Ne(Ke)}function Bs(e,t,n){if(Ke.current!==tn)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,H(e)||"Unknown",l));return N({},n,r)}function hl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||tn,gn=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,gn),r.__reactInternalMemoizedMergedChildContext=e,Ne(et),Ne(Ke),Se(Ke,e)):Ne(et),Se(et,n)}var Ft=null,ml=!1,qo=!1;function $s(e){Ft===null?Ft=[e]:Ft.push(e)}function kp(e){ml=!0,$s(e)}function nn(){if(!qo&&Ft!==null){qo=!0;var e=0,t=ve;try{var n=Ft;for(ve=1;e>=i,l-=i,Ut=1<<32-xt(t)+l|n<oe?(Ve=b,b=null):Ve=b.sibling;var me=_(w,b,x[oe],P);if(me===null){b===null&&(b=Ve);break}e&&b&&me.alternate===null&&t(w,b),h=o(me,h,oe),J===null?G=me:J.sibling=me,J=me,b=Ve}if(oe===x.length)return n(w,b),Te&&yn(w,oe),G;if(b===null){for(;oeoe?(Ve=b,b=null):Ve=b.sibling;var dn=_(w,b,me.value,P);if(dn===null){b===null&&(b=Ve);break}e&&b&&dn.alternate===null&&t(w,b),h=o(dn,h,oe),J===null?G=dn:J.sibling=dn,J=dn,b=Ve}if(me.done)return n(w,b),Te&&yn(w,oe),G;if(b===null){for(;!me.done;oe++,me=x.next())me=L(w,me.value,P),me!==null&&(h=o(me,h,oe),J===null?G=me:J.sibling=me,J=me);return Te&&yn(w,oe),G}for(b=r(w,b);!me.done;oe++,me=x.next())me=O(b,w,oe,me.value,P),me!==null&&(e&&me.alternate!==null&&b.delete(me.key===null?oe:me.key),h=o(me,h,oe),J===null?G=me:J.sibling=me,J=me);return e&&b.forEach(function(nh){return t(w,nh)}),Te&&yn(w,oe),G}function De(w,h,x,P){if(typeof x=="object"&&x!==null&&x.type===se&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case ie:e:{for(var G=x.key,J=h;J!==null;){if(J.key===G){if(G=x.type,G===se){if(J.tag===7){n(w,J.sibling),h=l(J,x.props.children),h.return=w,w=h;break e}}else if(J.elementType===G||typeof G=="object"&&G!==null&&G.$$typeof===Ce&&Xs(G)===J.type){n(w,J.sibling),h=l(J,x.props),h.ref=Rr(w,J,x),h.return=w,w=h;break e}n(w,J);break}else t(w,J);J=J.sibling}x.type===se?(h=Nn(x.props.children,w.mode,P,x.key),h.return=w,w=h):(P=$l(x.type,x.key,x.props,null,w.mode,P),P.ref=Rr(w,h,x),P.return=w,w=P)}return i(w);case ae:e:{for(J=x.key;h!==null;){if(h.key===J)if(h.tag===4&&h.stateNode.containerInfo===x.containerInfo&&h.stateNode.implementation===x.implementation){n(w,h.sibling),h=l(h,x.children||[]),h.return=w,w=h;break e}else{n(w,h);break}else t(w,h);h=h.sibling}h=Gi(x,w.mode,P),h.return=w,w=h}return i(w);case Ce:return J=x._init,De(w,h,J(x._payload),P)}if(At(x))return V(w,h,x,P);if(Z(x))return $(w,h,x,P);wl(w,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,h!==null&&h.tag===6?(n(w,h.sibling),h=l(h,x),h.return=w,w=h):(n(w,h),h=Ki(x,w.mode,P),h.return=w,w=h),i(w)):n(w,h)}return De}var Vn=qs(!0),Zs=qs(!1),xl=en(null),Sl=null,$n=null,ni=null;function ri(){ni=$n=Sl=null}function li(e){var t=xl.current;Ne(xl),e._currentValue=t}function oi(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 Wn(e,t){Sl=e,ni=$n=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(nt=!0),e.firstContext=null)}function ht(e){var t=e._currentValue;if(ni!==e)if(e={context:e,memoizedValue:t,next:null},$n===null){if(Sl===null)throw Error(u(308));$n=e,Sl.dependencies={lanes:0,firstContext:e}}else $n=$n.next=e;return t}var wn=null;function ii(e){wn===null?wn=[e]:wn.push(e)}function Js(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,ii(t)):(n.next=l.next,l.next=n),t.interleaved=n,Ht(e,r)}function Ht(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 rn=!1;function ui(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 Vt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ln(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(pe&2)!==0){var l=r.pending;return l===null?t.next=t:(t.next=l.next,l.next=t),r.pending=t,Ht(e,n)}return l=r.interleaved,l===null?(t.next=t,ii(r)):(t.next=l.next,l.next=t),r.interleaved=t,Ht(e,n)}function kl(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,So(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 El(e,t,n,r){var l=e.updateQueue;rn=!1;var o=l.firstBaseUpdate,i=l.lastBaseUpdate,c=l.shared.pending;if(c!==null){l.shared.pending=null;var d=c,S=d.next;d.next=null,i===null?o=S:i.next=S,i=d;var j=e.alternate;j!==null&&(j=j.updateQueue,c=j.lastBaseUpdate,c!==i&&(c===null?j.firstBaseUpdate=S:c.next=S,j.lastBaseUpdate=d))}if(o!==null){var L=l.baseState;i=0,j=S=d=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 V=e,$=c;switch(_=t,O=n,$.tag){case 1:if(V=$.payload,typeof V=="function"){L=V.call(O,L,_);break e}L=V;break e;case 3:V.flags=V.flags&-65537|128;case 0:if(V=$.payload,_=typeof V=="function"?V.call(O,L,_):V,_==null)break e;L=N({},L,_);break e;case 2:rn=!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,d=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&&(d=L),l.baseState=d,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);kn|=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=di.transition;di.transition={};try{e(!1),t()}finally{ve=n,di.transition=r}}function xa(){return mt().memoizedState}function Np(e,t,n){var r=an(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();Nt(n,e,r,l),Ea(n,t,r)}}function Tp(e,t,n){var r=an(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,St(c,i)){var d=t.interleaved;d===null?(l.next=l,ii(t)):(l.next=d.next,d.next=l),t.interleaved=l;return}}catch{}finally{}n=Js(e,t,l,r),n!==null&&(l=Ze(),Nt(n,e,r,l),Ea(n,t,r))}}function Sa(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function ka(e,t){jr=Nl=!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,So(e,n)}}var jl={readContext:ht,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:ht,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:ht,useEffect:da,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Tl(4194308,4,ma.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Tl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Tl(4,2,e,t)},useMemo:function(e,t){var n=Mt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Mt();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,Le,e),[r.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:ca,useDebugValue:wi,useDeferredValue:function(e){return Mt().memoizedState=e},useTransition:function(){var e=ca(!1),t=e[0];return e=Rp.bind(null,e[1]),Mt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Le,l=Mt();if(Te){if(n===void 0)throw Error(u(407));n=n()}else{if(n=t(),He===null)throw Error(u(349));(Sn&30)!==0||oa(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,da(ua.bind(null,r,o,e),[e]),r.flags|=2048,Pr(9,ia.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Mt(),t=He.identifierPrefix;if(Te){var n=Bt,r=Ut;n=(r&~(1<<32-xt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Lr++,0d||l[s]!==o[d]){var h=` +`+l[s].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=s&&0<=d);break}}}finally{re=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?T(e):""}function se(e){switch(e.tag){case 5:return T(e.type);case 16:return T("Lazy");case 13:return T("Suspense");case 19:return T("SuspenseList");case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return""}}function ne(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 ae:return"Fragment";case de:return"Portal";case xe:return"Profiler";case Z:return"StrictMode";case ve:return"Suspense";case Re:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Se:return(e.displayName||"Context")+".Consumer";case pe:return(e._context.displayName||"Context")+".Provider";case Ce:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ye:return t=e.displayName||null,t!==null?t:ne(e.type)||"Memo";case _e:t=e._payload,e=e._init;try{return ne(e(t))}catch{}}return null}function ie(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 ne(t);case 8:return t===Z?"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 q(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ce(e){var t=q(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(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ae(e){e._valueTracker||(e._valueTracker=ce(e))}function Ze(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=q(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 Fe(e,t){var n=t.checked;return C({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Kt(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 _t(e,t){t=t.checked,t!=null&&B(e,"checked",t,!1)}function Oe(e,t){_t(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")?Mt(e,t.type,n):t.hasOwnProperty("defaultValue")&&Mt(e,t.type,K(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function pt(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 Mt(e,t,n){(t!=="number"||ft(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ut=Array.isArray;function Ue(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=Yr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function rr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var lr={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},Of=["Webkit","ms","Moz","O"];Object.keys(lr).forEach(function(e){Of.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),lr[t]=lr[e]})});function Wu(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||lr.hasOwnProperty(e)&&lr[e]?(""+t).trim():t+"px"}function Qu(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,l=Wu(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,l):e[n]=l}}var If=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 po(e,t){if(t){if(If[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(i(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(i(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(i(61))}if(t.style!=null&&typeof t.style!="object")throw Error(i(62))}}function ho(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 mo=null;function go(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vo=null,_n=null,Mn=null;function Ku(e){if(e=Tr(e)){if(typeof vo!="function")throw Error(i(280));var t=e.stateNode;t&&(t=yl(t),vo(e.stateNode,e.type,t))}}function bu(e){_n?Mn?Mn.push(e):Mn=[e]:_n=e}function Gu(){if(_n){var e=_n,t=Mn;if(Mn=_n=null,Ku(e),t)for(e=0;e>>=0,e===0?32:31-(Gf(e)/Yf|0)|0}var el=64,tl=4194304;function sr(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 nl(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,l=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var d=s&~l;d!==0?r=sr(d):(o&=s,o!==0&&(r=sr(o)))}else s=n&~l,s!==0?r=sr(s):o!==0&&(r=sr(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 ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-St(t),e[t]=n}function qf(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=vr),ks=" ",Es=!1;function Cs(e,t){switch(e){case"keyup":return Np.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Rs(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var An=!1;function _p(e,t){switch(e){case"compositionend":return Rs(t);case"keypress":return t.which!==32?null:(Es=!0,ks);case"textInput":return e=t.data,e===ks&&Es?null:e;default:return null}}function Mp(e,t){if(An)return e==="compositionend"||!zo&&Cs(e,t)?(e=gs(),ul=_o=Jt=null,An=!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=Ps(n)}}function Ds(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ds(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function zs(){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 Fo(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 Up(e){var t=zs(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Ds(n.ownerDocument.documentElement,n)){if(r!==null&&Fo(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=As(n,o);var s=As(n,r);l&&s&&(e.rangeCount!==1||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.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,Dn=null,Uo=null,Sr=null,Bo=!1;function Os(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bo||Dn==null||Dn!==ft(r)||(r=Dn,"selectionStart"in r&&Fo(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}),Sr&&xr(Sr,r)||(Sr=r,r=ml(Uo,"onSelect"),0Un||(e.current=Jo[Un],Jo[Un]=null,Un--)}function Ee(e,t){Un++,Jo[Un]=e.current,e.current=t}var nn={},be=tn(nn),nt=tn(!1),vn=nn;function Bn(e,t){var n=e.type.contextTypes;if(!n)return nn;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 rt(e){return e=e.childContextTypes,e!=null}function wl(){Ne(nt),Ne(be)}function Zs(e,t,n){if(be.current!==nn)throw Error(i(168));Ee(be,t),Ee(nt,n)}function Js(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(i(108,ie(e)||"Unknown",l));return C({},n,r)}function xl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||nn,vn=be.current,Ee(be,e),Ee(nt,nt.current),!0}function qs(e,t,n){var r=e.stateNode;if(!r)throw Error(i(169));n?(e=Js(e,t,vn),r.__reactInternalMemoizedMergedChildContext=e,Ne(nt),Ne(be),Ee(be,e)):Ne(nt),Ee(nt,n)}var Ut=null,Sl=!1,qo=!1;function ea(e){Ut===null?Ut=[e]:Ut.push(e)}function Zp(e){Sl=!0,ea(e)}function rn(){if(!qo&&Ut!==null){qo=!0;var e=0,t=we;try{var n=Ut;for(we=1;e>=s,l-=s,Bt=1<<32-St(t)+l|n<oe?(We=te,te=null):We=te.sibling;var me=_(w,te,x[oe],A);if(me===null){te===null&&(te=We);break}e&&te&&me.alternate===null&&t(w,te),g=o(me,g,oe),ee===null?Y=me:ee.sibling=me,ee=me,te=We}if(oe===x.length)return n(w,te),je&&wn(w,oe),Y;if(te===null){for(;oeoe?(We=te,te=null):We=te.sibling;var pn=_(w,te,me.value,A);if(pn===null){te===null&&(te=We);break}e&&te&&pn.alternate===null&&t(w,te),g=o(pn,g,oe),ee===null?Y=pn:ee.sibling=pn,ee=pn,te=We}if(me.done)return n(w,te),je&&wn(w,oe),Y;if(te===null){for(;!me.done;oe++,me=x.next())me=L(w,me.value,A),me!==null&&(g=o(me,g,oe),ee===null?Y=me:ee.sibling=me,ee=me);return je&&wn(w,oe),Y}for(te=r(w,te);!me.done;oe++,me=x.next())me=U(te,w,oe,me.value,A),me!==null&&(e&&me.alternate!==null&&te.delete(me.key===null?oe:me.key),g=o(me,g,oe),ee===null?Y=me:ee.sibling=me,ee=me);return e&&te.forEach(function(Lh){return t(w,Lh)}),je&&wn(w,oe),Y}function ze(w,g,x,A){if(typeof x=="object"&&x!==null&&x.type===ae&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case ue:e:{for(var Y=x.key,ee=g;ee!==null;){if(ee.key===Y){if(Y=x.type,Y===ae){if(ee.tag===7){n(w,ee.sibling),g=l(ee,x.props.children),g.return=w,w=g;break e}}else if(ee.elementType===Y||typeof Y=="object"&&Y!==null&&Y.$$typeof===_e&&ia(Y)===ee.type){n(w,ee.sibling),g=l(ee,x.props),g.ref=Nr(w,ee,x),g.return=w,w=g;break e}n(w,ee);break}else t(w,ee);ee=ee.sibling}x.type===ae?(g=Nn(x.props.children,w.mode,A,x.key),g.return=w,w=g):(A=Yl(x.type,x.key,x.props,null,w.mode,A),A.ref=Nr(w,g,x),A.return=w,w=A)}return s(w);case de:e:{for(ee=x.key;g!==null;){if(g.key===ee)if(g.tag===4&&g.stateNode.containerInfo===x.containerInfo&&g.stateNode.implementation===x.implementation){n(w,g.sibling),g=l(g,x.children||[]),g.return=w,w=g;break e}else{n(w,g);break}else t(w,g);g=g.sibling}g=Xi(x,w.mode,A),g.return=w,w=g}return s(w);case _e:return ee=x._init,ze(w,g,ee(x._payload),A)}if(ut(x))return b(w,g,x,A);if(X(x))return G(w,g,x,A);Rl(w,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,g!==null&&g.tag===6?(n(w,g.sibling),g=l(g,x),g.return=w,w=g):(n(w,g),g=Yi(x,w.mode,A),g.return=w,w=g),s(w)):n(w,g)}return ze}var Wn=ua(!0),sa=ua(!1),Tl=tn(null),Nl=null,Qn=null,oi=null;function ii(){oi=Qn=Nl=null}function ui(e){var t=Tl.current;Ne(Tl),e._currentValue=t}function si(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 Kn(e,t){Nl=e,oi=Qn=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(lt=!0),e.firstContext=null)}function gt(e){var t=e._currentValue;if(oi!==e)if(e={context:e,memoizedValue:t,next:null},Qn===null){if(Nl===null)throw Error(i(308));Qn=e,Nl.dependencies={lanes:0,firstContext:e}}else Qn=Qn.next=e;return t}var xn=null;function ai(e){xn===null?xn=[e]:xn.push(e)}function aa(e,t,n,r){var l=t.interleaved;return l===null?(n.next=n,ai(t)):(n.next=l.next,l.next=n),t.interleaved=n,$t(e,r)}function $t(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 ln=!1;function ci(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ca(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 Vt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function on(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,$t(e,n)}return l=r.interleaved,l===null?(t.next=t,ai(r)):(t.next=l.next,l.next=t),r.interleaved=t,$t(e,n)}function jl(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,Co(e,n)}}function da(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 s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?l=o=s:o=o.next=s,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 _l(e,t,n,r){var l=e.updateQueue;ln=!1;var o=l.firstBaseUpdate,s=l.lastBaseUpdate,d=l.shared.pending;if(d!==null){l.shared.pending=null;var h=d,E=h.next;h.next=null,s===null?o=E:s.next=E,s=h;var M=e.alternate;M!==null&&(M=M.updateQueue,d=M.lastBaseUpdate,d!==s&&(d===null?M.firstBaseUpdate=E:d.next=E,M.lastBaseUpdate=h))}if(o!==null){var L=l.baseState;s=0,M=E=h=null,d=o;do{var _=d.lane,U=d.eventTime;if((r&_)===_){M!==null&&(M=M.next={eventTime:U,lane:0,tag:d.tag,payload:d.payload,callback:d.callback,next:null});e:{var b=e,G=d;switch(_=t,U=n,G.tag){case 1:if(b=G.payload,typeof b=="function"){L=b.call(U,L,_);break e}L=b;break e;case 3:b.flags=b.flags&-65537|128;case 0:if(b=G.payload,_=typeof b=="function"?b.call(U,L,_):b,_==null)break e;L=C({},L,_);break e;case 2:ln=!0}}d.callback!==null&&d.lane!==0&&(e.flags|=64,_=l.effects,_===null?l.effects=[d]:_.push(d))}else U={eventTime:U,lane:_,tag:d.tag,payload:d.payload,callback:d.callback,next:null},M===null?(E=M=U,h=L):M=M.next=U,s|=_;if(d=d.next,d===null){if(d=l.shared.pending,d===null)break;_=d,d=_.next,_.next=null,l.lastBaseUpdate=_,l.shared.pending=null}}while(!0);if(M===null&&(h=L),l.baseState=h,l.firstBaseUpdate=E,l.lastBaseUpdate=M,t=l.shared.interleaved,t!==null){l=t;do s|=l.lane,l=l.next;while(l!==t)}else o===null&&(l.shared.lanes=0);En|=s,e.lanes=s,e.memoizedState=L}}function fa(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=mi.transition;mi.transition={};try{e(!1),t()}finally{we=n,mi.transition=r}}function La(){return vt().memoizedState}function th(e,t,n){var r=cn(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Pa(e))Aa(t,n);else if(n=aa(e,t,n,r),n!==null){var l=qe();Nt(n,e,r,l),Da(n,t,r)}}function nh(e,t,n){var r=cn(e),l={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Pa(e))Aa(t,l);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,d=o(s,n);if(l.hasEagerState=!0,l.eagerState=d,kt(d,s)){var h=t.interleaved;h===null?(l.next=l,ai(t)):(l.next=h.next,h.next=l),t.interleaved=l;return}}catch{}finally{}n=aa(e,t,l,r),n!==null&&(l=qe(),Nt(n,e,r,l),Da(n,t,r))}}function Pa(e){var t=e.alternate;return e===Le||t!==null&&t===Le}function Aa(e,t){Lr=Pl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Da(e,t,n){if((n&4194240)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Co(e,n)}}var zl={readContext:gt,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},rh={readContext:gt,useCallback:function(e,t){return Dt().memoizedState=[e,t===void 0?null:t],e},useContext:gt,useEffect:Ea,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Al(4194308,4,Ta.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Al(4194308,4,e,t)},useInsertionEffect:function(e,t){return Al(4,2,e,t)},useMemo:function(e,t){var n=Dt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Dt();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=th.bind(null,Le,e),[r.memoizedState,e]},useRef:function(e){var t=Dt();return e={current:e},t.memoizedState=e},useState:Sa,useDebugValue:ki,useDeferredValue:function(e){return Dt().memoizedState=e},useTransition:function(){var e=Sa(!1),t=e[0];return e=eh.bind(null,e[1]),Dt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Le,l=Dt();if(je){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Ve===null)throw Error(i(349));(kn&30)!==0||ga(r,t,n)}l.memoizedState=n;var o={value:n,getSnapshot:t};return l.queue=o,Ea(ya.bind(null,r,o,e),[e]),r.flags|=2048,Dr(9,va.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Dt(),t=Ve.identifierPrefix;if(je){var n=Ht,r=Bt;n=(r&~(1<<32-St(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Pr++,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[jt]=t,e[Er]=r,$a(e,t,!1,!1),t.stateNode=e;e:{switch(i=co(n,r),n){case"dialog":Re("cancel",e),Re("close",e),l=r;break;case"iframe":case"object":case"embed":Re("load",e),l=r;break;case"video":case"audio":for(l=0;lXn&&(t.flags|=128,r=!0,zr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Cl(i),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!i.alternate&&!Te)return Ye(t),null}else 2*ze()-o.renderingStartTime>Xn&&n!==1073741824&&(t.flags|=128,r=!0,zr(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=ze(),t.sibling=null,n=je.current,Se(je,r?n&1|2:n&1),t):(Ye(t),null);case 22:case 23:return $i(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(at&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(Jo(t),t.tag){case 1:return tt(t.type)&&pl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qn(),Ne(et),Ne(Ke),fi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return ai(t),null;case 13:if(Ne(je),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(u(340));Hn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ne(je),null;case 4:return Qn(),null;case 10:return li(t.type._context),null;case 22:case 23:return $i(),null;case 24:return null;default:return null}}var zl=!1,Xe=!1,Ip=typeof WeakSet=="function"?WeakSet:Set,B=null;function Gn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pe(e,t,r)}else n.current=null}function Mi(e,t,n){try{n()}catch(r){Pe(e,t,r)}}var Ka=!1;function Fp(e,t){if($o=br,e=Cs(),Ao(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,d=-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||(d=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&&(d=i),(O=L.nextSibling)!==null)break;L=_,_=L.parentNode}L=O}n=c===-1||d===-1?null:{start:c,end:d}}else n=null}n=n||{start:0,end:0}}else n=null;for(Wo={focusedElem:e,selectionRange:n},br=!1,B=t;B!==null;)if(t=B,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,B=e;else for(;B!==null;){t=B;try{var V=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(V!==null){var $=V.memoizedProps,De=V.memoizedState,w=t.stateNode,h=w.getSnapshotBeforeUpdate(t.elementType===t.type?$:Et(t.type,$),De);w.__reactInternalSnapshotBeforeUpdate=h}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(P){Pe(t,t.return,P)}if(e=t.sibling,e!==null){e.return=t.return,B=e;break}B=t.return}return V=Ka,Ka=!1,V}function Dr(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&&Mi(t,n,o)}l=l.next}while(l!==r)}}function Dl(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 Pi(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[jt],delete t[Er],delete t[Yo],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 zi(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=fl));else if(r!==4&&(e=e.child,e!==null))for(zi(e,t,n),e=e.sibling;e!==null;)zi(e,t,n),e=e.sibling}function Di(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(Di(e,t,n),e=e.sibling;e!==null;)Di(e,t,n),e=e.sibling}var We=null,Ct=!1;function on(e,t,n){for(n=n.child;n!==null;)qa(e,t,n),n=n.sibling}function qa(e,t,n){if(_t&&typeof _t.onCommitFiberUnmount=="function")try{_t.onCommitFiberUnmount(Gr,n)}catch{}switch(n.tag){case 5:Xe||Gn(n,t);case 6:var r=We,l=Ct;We=null,on(e,t,n),We=r,Ct=l,We!==null&&(Ct?(e=We,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):We.removeChild(n.stateNode));break;case 18:We!==null&&(Ct?(e=We,n=n.stateNode,e.nodeType===8?Go(e.parentNode,n):e.nodeType===1&&Go(e,n),dr(e)):Go(We,n.stateNode));break;case 4:r=We,l=Ct,We=n.stateNode.containerInfo,Ct=!0,on(e,t,n),We=r,Ct=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)&&Mi(n,t,i),l=l.next}while(l!==r)}on(e,t,n);break;case 1:if(!Xe&&(Gn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(c){Pe(n,t,c)}on(e,t,n);break;case 21:on(e,t,n);break;case 22:n.mode&1?(Xe=(r=Xe)||n.memoizedState!==null,on(e,t,n),Xe=r):on(e,t,n);break;default:on(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 Rt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=i),r&=~o}if(r=l,r=ze()-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,sn===null)var r=!1;else{if(e=sn,sn=null,Ul=0,(pe&6)!==0)throw Error(u(331));var l=pe;for(pe|=4,B=e.current;B!==null;){var o=B,i=o.child;if((B.flags&16)!==0){var c=o.deletions;if(c!==null){for(var d=0;dze()-Ii?Cn(e,0):Oi|=n),lt(e,t)}function cc(e,t){t===0&&((e.mode&1)===0?t=1:(t=Xr,Xr<<=1,(Xr&130023424)===0&&(Xr=4194304)));var n=Ze();e=Ht(e,t),e!==null&&(ur(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 fc;fc=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,Te&&(t.flags&1048576)!==0&&Ws(t,vl,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Pl(e,t),e=t.pendingProps;var l=Fn(t,Ke.current);Wn(t,n),l=hi(null,t,r,e,l,n);var o=mi();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,hl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ui(t),l.updater=Ll,t.stateNode=l,l._reactInternals=t,Si(t,r,e,n),t=Ri(null,t,r,!0,o,n)):(t.tag=0,Te&&o&&Zo(t),qe(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Pl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Xp(r),e=Et(r,e),l){case 0:t=Ci(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,Et(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:Et(r,l),Ci(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Et(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),El(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=Kn(Error(u(423)),t),t=Ua(e,t,r,n,l);break e}else if(r!==l){l=Kn(Error(u(424)),t),t=Ua(e,t,r,n,l);break e}else for(st=bt(t.stateNode.containerInfo.firstChild),ut=t,Te=!0,kt=null,n=Zs(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Hn(),r===l){t=$t(e,t,n);break e}qe(e,t,r,n)}t=t.child}return t;case 5:return na(t),e===null&&ei(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,i=l.children,Qo(r,l)?i=null:o!==null&&Qo(r,o)&&(t.flags|=32),Oa(e,t),qe(e,t,i,n),t.child;case 6:return e===null&&ei(t),null;case 13:return Ba(e,t,n);case 4:return si(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Vn(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:Et(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(xl,r._currentValue),r._currentValue=i,o!==null)if(St(o.value,i)){if(o.children===l.children&&!et.current){t=$t(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 d=c.firstContext;d!==null;){if(d.context===r){if(o.tag===1){d=Vt(-1,n&-n),d.tag=2;var S=o.updateQueue;if(S!==null){S=S.shared;var j=S.pending;j===null?d.next=d:(d.next=j.next,j.next=d),S.pending=d}}o.lanes|=n,d=o.alternate,d!==null&&(d.lanes|=n),oi(o.return,n,t),c.lanes|=n;break}d=d.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),oi(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,Wn(t,n),l=ht(l),r=r(l),t.flags|=1,qe(e,t,r,n),t.child;case 14:return r=t.type,l=Et(r,t.pendingProps),l=Et(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:Et(r,l),Pl(e,t),t.tag=1,tt(r)?(e=!0,hl(t)):e=!1,Wn(t,n),Ra(t,r,l),Si(t,r,l,n),Ri(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 dc(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 vt(e,t,n,r){return new Yp(e,t,n,r)}function Qi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Xp(e){if(typeof e=="function")return Qi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===he)return 11;if(e===_e)return 14}return 2}function fn(e,t){var n=e.alternate;return n===null?(n=vt(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 $l(e,t,n,r,l,o){var i=2;if(r=e,typeof e=="function")Qi(e)&&(i=1);else if(typeof e=="string")i=5;else e:switch(e){case se:return Nn(n.children,l,o,t);case X:i=8,l|=8;break;case ke:return e=vt(12,n,t,l|2),e.elementType=ke,e.lanes=o,e;case Ee:return e=vt(13,n,t,l),e.elementType=Ee,e.lanes=o,e;case Me:return e=vt(19,n,t,l),e.elementType=Me,e.lanes=o,e;case Q:return Wl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xe:i=10;break e;case ge:i=9;break e;case he:i=11;break e;case _e:i=14;break e;case Ce:i=16,r=null;break e}throw Error(u(130,e==null?e:typeof e,""))}return t=vt(i,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Nn(e,t,n,r){return e=vt(7,e,r,t),e.lanes=n,e}function Wl(e,t,n,r){return e=vt(22,e,r,t),e.elementType=Q,e.lanes=n,e.stateNode={isHidden:!1},e}function Ki(e,t,n){return e=vt(6,e,null,t),e.lanes=n,e}function Gi(e,t,n){return t=vt(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=xo(0),this.expirationTimes=xo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Yi(e,t,n,r,l,o,i,c,d){return e=new qp(e,t,n,c,d),t===1?(t=1,o===!0&&(t|=8)):t=0,o=vt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ui(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(),bl.exports=Ec(),bl.exports}var iu;function Rc(){if(iu)return Ur;iu=1;var s=Cc();return Ur.createRoot=s.createRoot,Ur.hydrateRoot=s.hydrateRoot,Ur}var uu=Rc(),R=Jl();class be extends Error{constructor(a,u,f,p){super(a),this.status=u,this.code=f,this.retryAfter=p,this.name="ChatApiError"}}class no extends Error{constructor(){super("Request debounced"),this.name="DebounceError"}}const Nc=3e4;function Tc(s,a){const u=atob(s),f=new Uint8Array(u.length);for(let p=0;p0&&Date.now()-this.lastSendTime({})),v=p.headers.get("Retry-After"),k=v?Number(v):void 0;if(u=new be(y.error??`Request failed with status ${p.status}`,p.status,y.code,k),!this.isRetryable(p.status))throw u;if(f{var v;return(v=y.attachments)==null?void 0:v.some(k=>!!k.data)}))return{headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:a})};const f=new FormData,p=a.map(y=>y.attachments?{...y,attachments:y.attachments.map(v=>{const k={...v};return delete k.data,k})}:y);f.append("payload",JSON.stringify({messages:p}));for(const y of a)for(const v of y.attachments??[])v.data&&f.append(v.id,Tc(v.data,v.mediaType),v.name);return{body:f}}async streamMessage(a,u={}){var p;if(typeof ReadableStream>"u")return this.sendMessage(a);if(this.debounceMs>0&&Date.now()-this.lastSendTime({})),T=v.headers.get("Retry-After");if(f=new be(E.error??`Request failed with status ${v.status}`,v.status,E.code,T?Number(T):void 0),!this.isRetryable(v.status))throw f;y{f.cancel().catch(()=>{})};(M=u.signal)==null||M.addEventListener("abort",T,{once:!0});try{for(;;){let de;try{de=await f.read()}catch(le){if((F=u.signal)!=null&&F.aborted)break;throw le}if((q=u.signal)!=null&&q.aborted||de.done)break;y+=p.decode(de.value,{stream:!0});let ue;for(;(ue=y.indexOf(` +`+o.stack}return{value:e,source:t,stack:l,digest:null}}function Ri(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Ti(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var ih=typeof WeakMap=="function"?WeakMap:Map;function Fa(e,t,n){n=Vt(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Vl||(Vl=!0,Hi=r),Ti(e,t)},n}function Ua(e,t,n){n=Vt(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var l=t.value;n.payload=function(){return r(l)},n.callback=function(){Ti(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Ti(e,t),typeof r!="function"&&(sn===null?sn=new Set([this]):sn.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function Ba(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new ih;var l=new Set;r.set(t,l)}else l=r.get(t),l===void 0&&(l=new Set,r.set(t,l));l.has(n)||(l.add(n),e=xh.bind(null,e,t,n),t.then(e,e))}function Ha(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function $a(e,t,n,r,l){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Vt(-1,1),t.tag=2,on(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=l,e)}var uh=Q.ReactCurrentOwner,lt=!1;function Je(e,t,n,r){t.child=e===null?sa(t,null,n,r):Wn(t,e.child,n,r)}function Va(e,t,n,r,l){n=n.render;var o=t.ref;return Kn(t,l),r=vi(e,t,n,r,o,l),n=yi(),e!==null&&!lt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Wt(e,t,l)):(je&&n&&ei(t),t.flags|=1,Je(e,t,r,l),t.child)}function Wa(e,t,n,r,l){if(e===null){var o=n.type;return typeof o=="function"&&!Gi(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,Qa(e,t,o,r,l)):(e=Yl(n.type,null,r,t,t.mode,l),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,(e.lanes&l)===0){var s=o.memoizedProps;if(n=n.compare,n=n!==null?n:xr,n(s,r)&&e.ref===t.ref)return Wt(e,t,l)}return t.flags|=1,e=fn(o,r),e.ref=t.ref,e.return=t,t.child=e}function Qa(e,t,n,r,l){if(e!==null){var o=e.memoizedProps;if(xr(o,r)&&e.ref===t.ref)if(lt=!1,t.pendingProps=r=o,(e.lanes&l)!==0)(e.flags&131072)!==0&&(lt=!0);else return t.lanes=e.lanes,Wt(e,t,l)}return Ni(e,t,n,r,l)}function Ka(e,t,n){var r=t.pendingProps,l=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ee(Xn,dt),dt|=n;else{if((n&1073741824)===0)return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ee(Xn,dt),dt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,Ee(Xn,dt),dt|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,Ee(Xn,dt),dt|=r;return Je(e,t,l,n),t.child}function ba(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ni(e,t,n,r,l){var o=rt(n)?vn:be.current;return o=Bn(t,o),Kn(t,l),n=vi(e,t,n,r,o,l),r=yi(),e!==null&&!lt?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~l,Wt(e,t,l)):(je&&r&&ei(t),t.flags|=1,Je(e,t,n,l),t.child)}function Ga(e,t,n,r,l){if(rt(n)){var o=!0;xl(t)}else o=!1;if(Kn(t,l),t.stateNode===null)Fl(e,t),Oa(t,n,r),Ci(t,n,r,l),r=!0;else if(e===null){var s=t.stateNode,d=t.memoizedProps;s.props=d;var h=s.context,E=n.contextType;typeof E=="object"&&E!==null?E=gt(E):(E=rt(n)?vn:be.current,E=Bn(t,E));var M=n.getDerivedStateFromProps,L=typeof M=="function"||typeof s.getSnapshotBeforeUpdate=="function";L||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(d!==r||h!==E)&&Ia(t,s,r,E),ln=!1;var _=t.memoizedState;s.state=_,_l(t,r,s,l),h=t.memoizedState,d!==r||_!==h||nt.current||ln?(typeof M=="function"&&(Ei(t,n,M,r),h=t.memoizedState),(d=ln||za(t,n,d,r,_,h,E))?(L||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=h),s.props=r,s.state=h,s.context=E,r=d):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,ca(e,t),d=t.memoizedProps,E=t.type===t.elementType?d:Ct(t.type,d),s.props=E,L=t.pendingProps,_=s.context,h=n.contextType,typeof h=="object"&&h!==null?h=gt(h):(h=rt(n)?vn:be.current,h=Bn(t,h));var U=n.getDerivedStateFromProps;(M=typeof U=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(d!==L||_!==h)&&Ia(t,s,r,h),ln=!1,_=t.memoizedState,s.state=_,_l(t,r,s,l);var b=t.memoizedState;d!==L||_!==b||nt.current||ln?(typeof U=="function"&&(Ei(t,n,U,r),b=t.memoizedState),(E=ln||za(t,n,E,r,_,b,h)||!1)?(M||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,b,h),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,b,h)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||d===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=b),s.props=r,s.state=b,s.context=h,r=E):(typeof s.componentDidUpdate!="function"||d===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||d===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),r=!1)}return ji(e,t,n,r,o,l)}function ji(e,t,n,r,l,o){ba(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return l&&qs(t,n,!1),Wt(e,t,o);r=t.stateNode,uh.current=t;var d=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=Wn(t,e.child,null,o),t.child=Wn(t,null,d,o)):Je(e,t,d,o),t.memoizedState=r.state,l&&qs(t,n,!0),t.child}function Ya(e){var t=e.stateNode;t.pendingContext?Zs(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Zs(e,t.context,!1),di(e,t.containerInfo)}function Xa(e,t,n,r,l){return Vn(),li(l),t.flags|=256,Je(e,t,n,r),t.child}var _i={dehydrated:null,treeContext:null,retryLane:0};function Mi(e){return{baseLanes:e,cachePool:null,transitions:null}}function Za(e,t,n){var r=t.pendingProps,l=Me.current,o=!1,s=(t.flags&128)!==0,d;if((d=s)||(d=e!==null&&e.memoizedState===null?!1:(l&2)!==0),d?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(l|=1),Ee(Me,l&1),e===null)return ri(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(s=r.children,e=r.fallback,o?(r=t.mode,o=t.child,s={mode:"hidden",children:s},(r&1)===0&&o!==null?(o.childLanes=0,o.pendingProps=s):o=Xl(s,r,0,null),e=Nn(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Mi(n),t.memoizedState=_i,e):Li(t,s));if(l=e.memoizedState,l!==null&&(d=l.dehydrated,d!==null))return sh(e,t,s,r,d,l,n);if(o){o=r.fallback,s=t.mode,l=e.child,d=l.sibling;var h={mode:"hidden",children:r.children};return(s&1)===0&&t.child!==l?(r=t.child,r.childLanes=0,r.pendingProps=h,t.deletions=null):(r=fn(l,h),r.subtreeFlags=l.subtreeFlags&14680064),d!==null?o=fn(d,o):(o=Nn(o,s,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,s=e.child.memoizedState,s=s===null?Mi(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=e.childLanes&~n,t.memoizedState=_i,r}return o=e.child,e=o.sibling,r=fn(o,{mode:"visible",children:r.children}),(t.mode&1)===0&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Li(e,t){return t=Xl({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Il(e,t,n,r){return r!==null&&li(r),Wn(t,e.child,null,n),e=Li(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sh(e,t,n,r,l,o,s){if(n)return t.flags&256?(t.flags&=-257,r=Ri(Error(i(422))),Il(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,l=t.mode,r=Xl({mode:"visible",children:r.children},l,0,null),o=Nn(o,l,s,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,(t.mode&1)!==0&&Wn(t,e.child,null,s),t.child.memoizedState=Mi(s),t.memoizedState=_i,o);if((t.mode&1)===0)return Il(e,t,s,null);if(l.data==="$!"){if(r=l.nextSibling&&l.nextSibling.dataset,r)var d=r.dgst;return r=d,o=Error(i(419)),r=Ri(o,r,void 0),Il(e,t,s,r)}if(d=(s&e.childLanes)!==0,lt||d){if(r=Ve,r!==null){switch(s&-s){case 4:l=2;break;case 16:l=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:l=32;break;case 536870912:l=268435456;break;default:l=0}l=(l&(r.suspendedLanes|s))!==0?0:l,l!==0&&l!==o.retryLane&&(o.retryLane=l,$t(e,l),Nt(r,e,l,-1))}return bi(),r=Ri(Error(i(421))),Il(e,t,s,r)}return l.data==="$?"?(t.flags|=128,t.child=e.child,t=Sh.bind(null,e),l._reactRetry=t,null):(e=o.treeContext,ct=en(l.nextSibling),at=t,je=!0,Et=null,e!==null&&(ht[mt++]=Bt,ht[mt++]=Ht,ht[mt++]=yn,Bt=e.id,Ht=e.overflow,yn=t),t=Li(t,r.children),t.flags|=4096,t)}function Ja(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),si(e.return,t,n)}function Pi(e,t,n,r,l){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:l}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=l)}function qa(e,t,n){var r=t.pendingProps,l=r.revealOrder,o=r.tail;if(Je(e,t,r.children,n),r=Me.current,(r&2)!==0)r=r&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Ja(e,n,t);else if(e.tag===19)Ja(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ee(Me,r),(t.mode&1)===0)t.memoizedState=null;else switch(l){case"forwards":for(n=t.child,l=null;n!==null;)e=n.alternate,e!==null&&Ml(e)===null&&(l=n),n=n.sibling;n=l,n===null?(l=t.child,t.child=null):(l=n.sibling,n.sibling=null),Pi(t,!1,l,n,o);break;case"backwards":for(n=null,l=t.child,t.child=null;l!==null;){if(e=l.alternate,e!==null&&Ml(e)===null){t.child=l;break}e=l.sibling,l.sibling=n,n=l,l=e}Pi(t,!0,n,null,o);break;case"together":Pi(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Fl(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Wt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),En|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=fn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=fn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function ah(e,t,n){switch(t.tag){case 3:Ya(t),Vn();break;case 5:pa(t);break;case 1:rt(t.type)&&xl(t);break;case 4:di(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,l=t.memoizedProps.value;Ee(Tl,r._currentValue),r._currentValue=l;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ee(Me,Me.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?Za(e,t,n):(Ee(Me,Me.current&1),e=Wt(e,t,n),e!==null?e.sibling:null);Ee(Me,Me.current&1);break;case 19:if(r=(n&t.childLanes)!==0,(e.flags&128)!==0){if(r)return qa(e,t,n);t.flags|=128}if(l=t.memoizedState,l!==null&&(l.rendering=null,l.tail=null,l.lastEffect=null),Ee(Me,Me.current),r)break;return null;case 22:case 23:return t.lanes=0,Ka(e,t,n)}return Wt(e,t,n)}var ec,Ai,tc,nc;ec=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Ai=function(){},tc=function(e,t,n,r){var l=e.memoizedProps;if(l!==r){e=t.stateNode,Sn(At.current);var o=null;switch(n){case"input":l=Fe(e,l),r=Fe(e,r),o=[];break;case"select":l=C({},l,{value:void 0}),r=C({},r,{value:void 0}),o=[];break;case"textarea":l=bt(e,l),r=bt(e,r),o=[];break;default:typeof l.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=vl)}po(n,r);var s;n=null;for(E in l)if(!r.hasOwnProperty(E)&&l.hasOwnProperty(E)&&l[E]!=null)if(E==="style"){var d=l[E];for(s in d)d.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else E!=="dangerouslySetInnerHTML"&&E!=="children"&&E!=="suppressContentEditableWarning"&&E!=="suppressHydrationWarning"&&E!=="autoFocus"&&(f.hasOwnProperty(E)?o||(o=[]):(o=o||[]).push(E,null));for(E in r){var h=r[E];if(d=l!=null?l[E]:void 0,r.hasOwnProperty(E)&&h!==d&&(h!=null||d!=null))if(E==="style")if(d){for(s in d)!d.hasOwnProperty(s)||h&&h.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in h)h.hasOwnProperty(s)&&d[s]!==h[s]&&(n||(n={}),n[s]=h[s])}else n||(o||(o=[]),o.push(E,n)),n=h;else E==="dangerouslySetInnerHTML"?(h=h?h.__html:void 0,d=d?d.__html:void 0,h!=null&&d!==h&&(o=o||[]).push(E,h)):E==="children"?typeof h!="string"&&typeof h!="number"||(o=o||[]).push(E,""+h):E!=="suppressContentEditableWarning"&&E!=="suppressHydrationWarning"&&(f.hasOwnProperty(E)?(h!=null&&E==="onScroll"&&Te("scroll",e),o||d===h||(o=[])):(o=o||[]).push(E,h))}n&&(o=o||[]).push("style",n);var E=o;(t.updateQueue=E)&&(t.flags|=4)}},nc=function(e,t,n,r){n!==r&&(t.flags|=4)};function zr(e,t){if(!je)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Ye(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags&14680064,r|=l.flags&14680064,l.return=e,l=l.sibling;else for(l=e.child;l!==null;)n|=l.lanes|l.childLanes,r|=l.subtreeFlags,r|=l.flags,l.return=e,l=l.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function ch(e,t,n){var r=t.pendingProps;switch(ti(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ye(t),null;case 1:return rt(t.type)&&wl(),Ye(t),null;case 3:return r=t.stateNode,bn(),Ne(nt),Ne(be),hi(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Cl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Et!==null&&(Wi(Et),Et=null))),Ai(e,t),Ye(t),null;case 5:fi(t);var l=Sn(Mr.current);if(n=t.type,e!==null&&t.stateNode!=null)tc(e,t,n,r,l),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Ye(t),null}if(e=Sn(At.current),Cl(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[Pt]=t,r[Rr]=o,e=(t.mode&1)!==0,n){case"dialog":Te("cancel",r),Te("close",r);break;case"iframe":case"object":case"embed":Te("load",r);break;case"video":case"audio":for(l=0;l<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[Pt]=t,e[Rr]=r,ec(e,t,!1,!1),t.stateNode=e;e:{switch(s=ho(n,r),n){case"dialog":Te("cancel",e),Te("close",e),l=r;break;case"iframe":case"object":case"embed":Te("load",e),l=r;break;case"video":case"audio":for(l=0;lZn&&(t.flags|=128,r=!0,zr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Ml(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!je)return Ye(t),null}else 2*De()-o.renderingStartTime>Zn&&n!==1073741824&&(t.flags|=128,r=!0,zr(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=De(),t.sibling=null,n=Me.current,Ee(Me,r?n&1|2:n&1),t):(Ye(t),null);case 22:case 23:return Ki(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&(t.mode&1)!==0?(dt&1073741824)!==0&&(Ye(t),t.subtreeFlags&6&&(t.flags|=8192)):Ye(t),null;case 24:return null;case 25:return null}throw Error(i(156,t.tag))}function dh(e,t){switch(ti(t),t.tag){case 1:return rt(t.type)&&wl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bn(),Ne(nt),Ne(be),hi(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return fi(t),null;case 13:if(Ne(Me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Vn()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ne(Me),null;case 4:return bn(),null;case 10:return ui(t.type._context),null;case 22:case 23:return Ki(),null;case 24:return null;default:return null}}var Ul=!1,Xe=!1,fh=typeof WeakSet=="function"?WeakSet:Set,W=null;function Yn(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Pe(e,t,r)}else n.current=null}function Di(e,t,n){try{n()}catch(r){Pe(e,t,r)}}var rc=!1;function ph(e,t){if(Ko=ol,e=zs(),Fo(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 s=0,d=-1,h=-1,E=0,M=0,L=e,_=null;t:for(;;){for(var U;L!==n||l!==0&&L.nodeType!==3||(d=s+l),L!==o||r!==0&&L.nodeType!==3||(h=s+r),L.nodeType===3&&(s+=L.nodeValue.length),(U=L.firstChild)!==null;)_=L,L=U;for(;;){if(L===e)break t;if(_===n&&++E===l&&(d=s),_===o&&++M===r&&(h=s),(U=L.nextSibling)!==null)break;L=_,_=L.parentNode}L=U}n=d===-1||h===-1?null:{start:d,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(bo={focusedElem:e,selectionRange:n},ol=!1,W=t;W!==null;)if(t=W,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,W=e;else for(;W!==null;){t=W;try{var b=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(b!==null){var G=b.memoizedProps,ze=b.memoizedState,w=t.stateNode,g=w.getSnapshotBeforeUpdate(t.elementType===t.type?G:Ct(t.type,G),ze);w.__reactInternalSnapshotBeforeUpdate=g}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(i(163))}}catch(A){Pe(t,t.return,A)}if(e=t.sibling,e!==null){e.return=t.return,W=e;break}W=t.return}return b=rc,rc=!1,b}function Or(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&&Di(t,n,o)}l=l.next}while(l!==r)}}function Bl(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 zi(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 lc(e){var t=e.alternate;t!==null&&(e.alternate=null,lc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Pt],delete t[Rr],delete t[Zo],delete t[Yp],delete t[Xp])),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 oc(e){return e.tag===5||e.tag===3||e.tag===4}function ic(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||oc(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 Oi(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=vl));else if(r!==4&&(e=e.child,e!==null))for(Oi(e,t,n),e=e.sibling;e!==null;)Oi(e,t,n),e=e.sibling}function Ii(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(Ii(e,t,n),e=e.sibling;e!==null;)Ii(e,t,n),e=e.sibling}var Qe=null,Rt=!1;function un(e,t,n){for(n=n.child;n!==null;)uc(e,t,n),n=n.sibling}function uc(e,t,n){if(Lt&&typeof Lt.onCommitFiberUnmount=="function")try{Lt.onCommitFiberUnmount(qr,n)}catch{}switch(n.tag){case 5:Xe||Yn(n,t);case 6:var r=Qe,l=Rt;Qe=null,un(e,t,n),Qe=r,Rt=l,Qe!==null&&(Rt?(e=Qe,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Qe.removeChild(n.stateNode));break;case 18:Qe!==null&&(Rt?(e=Qe,n=n.stateNode,e.nodeType===8?Xo(e.parentNode,n):e.nodeType===1&&Xo(e,n),hr(e)):Xo(Qe,n.stateNode));break;case 4:r=Qe,l=Rt,Qe=n.stateNode.containerInfo,Rt=!0,un(e,t,n),Qe=r,Rt=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,s=o.destroy;o=o.tag,s!==void 0&&((o&2)!==0||(o&4)!==0)&&Di(n,t,s),l=l.next}while(l!==r)}un(e,t,n);break;case 1:if(!Xe&&(Yn(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(d){Pe(n,t,d)}un(e,t,n);break;case 21:un(e,t,n);break;case 22:n.mode&1?(Xe=(r=Xe)||n.memoizedState!==null,un(e,t,n),Xe=r):un(e,t,n);break;default:un(e,t,n)}}function sc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new fh),t.forEach(function(r){var l=kh.bind(null,e,r);n.has(r)||(n.add(r),r.then(l,l))})}}function Tt(e,t){var n=t.deletions;if(n!==null)for(var r=0;rl&&(l=s),r&=~o}if(r=l,r=De()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*mh(r/1960))-r,10e?16:e,an===null)var r=!1;else{if(e=an,an=null,Ql=0,(he&6)!==0)throw Error(i(331));var l=he;for(he|=4,W=e.current;W!==null;){var o=W,s=o.child;if((W.flags&16)!==0){var d=o.deletions;if(d!==null){for(var h=0;hDe()-Bi?Rn(e,0):Ui|=n),it(e,t)}function Sc(e,t){t===0&&((e.mode&1)===0?t=1:(t=tl,tl<<=1,(tl&130023424)===0&&(tl=4194304)));var n=qe();e=$t(e,t),e!==null&&(ar(e,t,n),it(e,n))}function Sh(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Sc(e,n)}function kh(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(i(314))}r!==null&&r.delete(t),Sc(e,n)}var kc;kc=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||nt.current)lt=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return lt=!1,ah(e,t,n);lt=(e.flags&131072)!==0}else lt=!1,je&&(t.flags&1048576)!==0&&ta(t,El,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Fl(e,t),e=t.pendingProps;var l=Bn(t,be.current);Kn(t,n),l=vi(null,t,r,e,l,n);var o=yi();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,rt(r)?(o=!0,xl(t)):o=!1,t.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,ci(t),l.updater=Ol,t.stateNode=l,l._reactInternals=t,Ci(t,r,e,n),t=ji(null,t,r,!0,o,n)):(t.tag=0,je&&o&&ei(t),Je(null,t,l,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Fl(e,t),e=t.pendingProps,l=r._init,r=l(r._payload),t.type=r,l=t.tag=Ch(r),e=Ct(r,e),l){case 0:t=Ni(null,t,r,e,n);break e;case 1:t=Ga(null,t,r,e,n);break e;case 11:t=Va(null,t,r,e,n);break e;case 14:t=Wa(null,t,r,Ct(r.type,e),n);break e}throw Error(i(306,r,""))}return t;case 0:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Ni(e,t,r,l,n);case 1:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Ga(e,t,r,l,n);case 3:e:{if(Ya(t),e===null)throw Error(i(387));r=t.pendingProps,o=t.memoizedState,l=o.element,ca(e,t),_l(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){l=Gn(Error(i(423)),t),t=Xa(e,t,r,n,l);break e}else if(r!==l){l=Gn(Error(i(424)),t),t=Xa(e,t,r,n,l);break e}else for(ct=en(t.stateNode.containerInfo.firstChild),at=t,je=!0,Et=null,n=sa(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Vn(),r===l){t=Wt(e,t,n);break e}Je(e,t,r,n)}t=t.child}return t;case 5:return pa(t),e===null&&ri(t),r=t.type,l=t.pendingProps,o=e!==null?e.memoizedProps:null,s=l.children,Go(r,l)?s=null:o!==null&&Go(r,o)&&(t.flags|=32),ba(e,t),Je(e,t,s,n),t.child;case 6:return e===null&&ri(t),null;case 13:return Za(e,t,n);case 4:return di(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Wn(t,null,r,n):Je(e,t,r,n),t.child;case 11:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Va(e,t,r,l,n);case 7:return Je(e,t,t.pendingProps,n),t.child;case 8:return Je(e,t,t.pendingProps.children,n),t.child;case 12:return Je(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,l=t.pendingProps,o=t.memoizedProps,s=l.value,Ee(Tl,r._currentValue),r._currentValue=s,o!==null)if(kt(o.value,s)){if(o.children===l.children&&!nt.current){t=Wt(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var d=o.dependencies;if(d!==null){s=o.child;for(var h=d.firstContext;h!==null;){if(h.context===r){if(o.tag===1){h=Vt(-1,n&-n),h.tag=2;var E=o.updateQueue;if(E!==null){E=E.shared;var M=E.pending;M===null?h.next=h:(h.next=M.next,M.next=h),E.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),si(o.return,n,t),d.lanes|=n;break}h=h.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(i(341));s.lanes|=n,d=s.alternate,d!==null&&(d.lanes|=n),si(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}Je(e,t,l.children,n),t=t.child}return t;case 9:return l=t.type,r=t.pendingProps.children,Kn(t,n),l=gt(l),r=r(l),t.flags|=1,Je(e,t,r,n),t.child;case 14:return r=t.type,l=Ct(r,t.pendingProps),l=Ct(r.type,l),Wa(e,t,r,l,n);case 15:return Qa(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,l=t.pendingProps,l=t.elementType===r?l:Ct(r,l),Fl(e,t),t.tag=1,rt(r)?(e=!0,xl(t)):e=!1,Kn(t,n),Oa(t,r,l),Ci(t,r,l,n),ji(null,t,r,!0,e,n);case 19:return qa(e,t,n);case 22:return Ka(e,t,n)}throw Error(i(156,t.tag))};function Ec(e,t){return ns(e,t)}function Eh(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 wt(e,t,n,r){return new Eh(e,t,n,r)}function Gi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ch(e){if(typeof e=="function")return Gi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ce)return 11;if(e===ye)return 14}return 2}function fn(e,t){var n=e.alternate;return n===null?(n=wt(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 Yl(e,t,n,r,l,o){var s=2;if(r=e,typeof e=="function")Gi(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case ae:return Nn(n.children,l,o,t);case Z:s=8,l|=8;break;case xe:return e=wt(12,n,t,l|2),e.elementType=xe,e.lanes=o,e;case ve:return e=wt(13,n,t,l),e.elementType=ve,e.lanes=o,e;case Re:return e=wt(19,n,t,l),e.elementType=Re,e.lanes=o,e;case ge:return Xl(n,l,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pe:s=10;break e;case Se:s=9;break e;case Ce:s=11;break e;case ye:s=14;break e;case _e:s=16,r=null;break e}throw Error(i(130,e==null?e:typeof e,""))}return t=wt(s,n,t,l),t.elementType=e,t.type=r,t.lanes=o,t}function Nn(e,t,n,r){return e=wt(7,e,r,t),e.lanes=n,e}function Xl(e,t,n,r){return e=wt(22,e,r,t),e.elementType=ge,e.lanes=n,e.stateNode={isHidden:!1},e}function Yi(e,t,n){return e=wt(6,e,null,t),e.lanes=n,e}function Xi(e,t,n){return t=wt(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Rh(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=Eo(0),this.expirationTimes=Eo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Eo(0),this.identifierPrefix=r,this.onRecoverableError=l,this.mutableSourceEagerHydrationData=null}function Zi(e,t,n,r,l,o,s,d,h){return e=new Rh(e,t,n,d,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=wt(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ci(o),e}function Th(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(u)}catch(a){console.error(a)}}return u(),oo.exports=Dc(),oo.exports}var au;function Oc(){if(au)return Hr;au=1;var u=zc();return Hr.createRoot=u.createRoot,Hr.hydrateRoot=u.hydrateRoot,Hr}var cu=Oc(),R=lo();class tt extends Error{constructor(a,i,c,f){super(a),this.status=i,this.code=c,this.retryAfter=f,this.name="ChatApiError"}}class so extends Error{constructor(){super("Request debounced"),this.name="DebounceError"}}const Ic=3e4;function Fc(u,a){const i=atob(u),c=new Uint8Array(i.length);for(let f=0;f0&&Date.now()-this.lastSendTime({})),v=f.headers.get("Retry-After"),k=v?Number(v):void 0;if(i=new tt(p.error??`Request failed with status ${f.status}`,f.status,p.code,k),!this.isRetryable(f.status))throw i;if(c{var v;return(v=p.attachments)==null?void 0:v.some(k=>!!k.data)}))return{headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:a})};const c=new FormData,f=a.map(p=>p.attachments?{...p,attachments:p.attachments.map(v=>{const k={...v};return delete k.data,k})}:p);c.append("payload",JSON.stringify({messages:f}));for(const p of a)for(const v of p.attachments??[])v.data&&c.append(v.id,Fc(v.data,v.mediaType),v.name);return{body:c}}async streamMessage(a,i={}){var f;if(typeof ReadableStream>"u")return this.sendMessage(a);if(this.debounceMs>0&&Date.now()-this.lastSendTime({})),N=v.headers.get("Retry-After");if(c=new tt(S.error??`Request failed with status ${v.status}`,v.status,S.code,N?Number(N):void 0),!this.isRetryable(v.status))throw c;p{c.cancel().catch(()=>{})};(j=i.signal)==null||j.addEventListener("abort",N,{once:!0});try{for(;;){let $;try{$=await c.read()}catch(B){if((O=i.signal)!=null&&O.aborted)break;throw B}if((V=i.signal)!=null&&V.aborted||$.done)break;p+=f.decode($.value,{stream:!0});let J;for(;(J=p.indexOf(` -`))!==-1;){const le=y.slice(0,ue);y=y.slice(ue+2);const W=jc(le);if(W){if(W.event==="chunk"){const ie=typeof W.data.text=="string"?W.data.text:"";ie&&(v+=ie,(Y=u.onChunk)==null||Y.call(u,ie,v))}else if(W.event==="tool"){if(typeof W.data.name=="string"){const ie=W.data;k.push(ie),(A=u.onToolUse)==null||A.call(u,ie,k)}}else if(W.event==="done"){const ie=Array.isArray(W.data.toolUses)?W.data.toolUses:k;E={reply:typeof W.data.reply=="string"?W.data.reply:v,sources:W.data.sources,...ie.length>0?{toolUses:ie}:{},...Array.isArray(W.data.attachments)?{attachments:W.data.attachments}:{}}}else if(W.event==="error")throw new be(typeof W.data.error=="string"?W.data.error:"Something went wrong. Please try again.",0,"STREAM_ERROR")}}}}finally{(z=u.signal)==null||z.removeEventListener("abort",T),f.releaseLock()}if((I=u.signal)!=null&&I.aborted)return{reply:v,aborted:!0,...k.length>0?{toolUses:k}:{}};if(E)return E;throw new be("Connection interrupted. Please try again.",0,"STREAM_ERROR")}async fetchStream(a,u){const f=new AbortController,p=()=>f.abort();u==null||u.addEventListener("abort",p,{once:!0});let y=!1;const v=this.timeoutMs>0?setTimeout(()=>{y=!0,f.abort()},this.timeoutMs):void 0,{headers:k,body:E}=this.buildRequest(a);try{return await fetch(`${this.baseUrl}/api/chat/stream`,{method:"POST",headers:k,body:E,signal:f.signal})}catch(T){throw y?new be("Request timed out. Please try again.",0,"TIMEOUT"):T}finally{v!==void 0&&clearTimeout(v),u==null||u.removeEventListener("abort",p)}}async fetchWithTimeout(a){const{headers:u,body:f}=this.buildRequest(a);if(this.timeoutMs<=0)return fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:u,body:f});const p=new AbortController,y=setTimeout(()=>p.abort(),this.timeoutMs);try{return await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:u,body:f,signal:p.signal})}catch(v){throw p.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 f=a.headers.get("Retry-After");if(f){const p=Number(f);return Math.min(p*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 f of s.split(` -`))f.startsWith("event:")?a=f.slice(6).trim():f.startsWith("data:")&&u.push(f.slice(5).trimStart());if(u.length===0)return null;try{const f=JSON.parse(u.join(` -`));return typeof f!="object"||f===null?null:{event:a,data:f}}catch{return null}}function su(s){return typeof s=="string"?{content:s}:s}function ro(s,a,u){console.error(`[claudius] plugin "${s.name}" failed in ${a}:`,u)}async function Lc(s,a,u){let f=a;for(const p of s){if(!p.onBeforeSend)continue;let y=null;const v={...u,respondWith(k){y={type:"respond",message:f,reply:su(k)}},abort(k){y={type:"abort",reason:k}}};try{const k=await p.onBeforeSend(f,v);if(y)return y;k&&(f=k)}catch(k){ro(p,"onBeforeSend",k)}}return{type:"send",message:f}}async function Mc(s,a,u){let f=a;for(const p of s)if(p.onAfterReceive)try{const y=await p.onAfterReceive(f,u);y&&(f=y)}catch(y){ro(p,"onAfterReceive",y)}return f}async function Pc(s,a,u){for(const f of s){if(!f.onError)continue;let p=null;const y={...u,respondWith(v){p=su(v)}};try{if(await f.onError(a,y),p)return p}catch(v){ro(f,"onError",v)}}return null}const Br={maxSizeBytes:5*1024*1024,maxCount:5,allowedTypes:["image/jpeg","image/png","image/gif","image/webp","application/pdf"]};function zc(s){return s?s===!0?Br:{maxSizeBytes:s.maxSizeBytes??Br.maxSizeBytes,maxCount:s.maxCount??Br.maxCount,allowedTypes:(s.allowedTypes??Br.allowedTypes).map(a=>a.trim().toLowerCase()).filter(Boolean)}:null}function lo(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 au(s){var f;const a=(s.type||"").trim().toLowerCase();if(a)return a;const u=((f=s.name.split(".").pop())==null?void 0:f.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 f=[],p=[];let y=Math.max(0,u.maxCount-a);for(const v of s){const k=au(v);!k||!u.allowedTypes.includes(k)?p.push({file:v,reason:"type"}):v.size>u.maxSizeBytes||v.size===0?p.push({file:v,reason:"size"}):y<=0?p.push({file:v,reason:"count"}):(f.push(v),y-=1)}return{accepted:f,rejected:p}}function Fc(s){return new Promise((a,u)=>{const f=new FileReader;f.onerror=()=>u(f.error??new Error("Failed to read file")),f.onload=()=>{const p=String(f.result??""),y=p.indexOf(",");a(y>=0?p.slice(y+1):p)},f.readAsDataURL(s)})}let cu=0;function Uc(){return cu+=1,`att-${Date.now().toString(36)}-${cu}`}async function Bc(s){const a=await Fc(s);return{id:Uc(),name:s.name||"attachment",mediaType:au(s),size:s.size,data:a}}function Hc(s){return s.map(a=>{var u;return(u=a.attachments)!=null&&u.some(f=>f.data)?{...a,attachments:a.attachments.map(f=>{if(!f.data)return f;const p={...f};return delete p.data,p})}:a})}function Vc(s,a){if(!a||a.length===0)return s;const u=new Map(a.map(f=>[f.id,f]));return s.map(f=>{var p;return(p=f.attachments)!=null&&p.some(y=>u.has(y.id))?{...f,attachments:f.attachments.map(y=>{const v=u.get(y.id);if(!v)return y;const k={...y,key:v.key,url:v.url,expiresAt:v.expiresAt};return delete k.data,k})}:f})}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 oo(){try{return typeof sessionStorage<"u"?sessionStorage:null}catch{return null}}function Kc(s){const a=oo();if(!a)return[];try{const u=a.getItem(s);if(!u)return[];const f=JSON.parse(u);return Array.isArray(f)?f:[]}catch{return[]}}function Gc({apiUrl:s,persistMessages:a=!0,storageKeyPrefix:u=Wc,timeoutMs:f,translations:p,plugins:y,streaming:v=!0}){const k=R.useMemo(()=>new _c(s,{debounceMs:0,timeoutMs:f}),[s,f]),E=Qc(u,s),T=a?Kc(E):[],[M,F]=R.useState(T),[q,Y]=R.useState(!1),[A,z]=R.useState(!1),[I,de]=R.useState(null),[ue,le]=R.useState(null),[W,ie]=R.useState(!1),ae=R.useRef(T.length),se=R.useRef(!1),X=R.useRef(T),ke=R.useRef(null),xe=R.useRef(y??[]);xe.current=y??[];const ge=R.useCallback(N=>{if(!a)return;const m=oo();if(m)try{const C=Hc(N.slice(-$c));m.setItem(E,JSON.stringify(C))}catch{}},[a,E]),he=()=>(ae.current+=1,`msg-${ae.current}`),Ee=R.useCallback((N,m)=>{if(!p)return m??"Something went wrong. Please try again.";switch(N){case"TIMEOUT":return p.errorTimeout;case"NETWORK_ERROR":return p.errorConnection;case"RATE_LIMITED":return m!=null&&m.includes("minute")?p.errorRateLimitMinute:p.errorRateLimitHour;case"ATTACHMENT_QUOTA_EXCEEDED":return p.errorAttachmentQuota;case"ATTACHMENTS_DISABLED":case"ATTACHMENT_INVALID":case"ATTACHMENT_TOO_LARGE":return p.errorAttachmentRejected;case"VALIDATION_ERROR":case"CONFIG_ERROR":case"SERVICE_ERROR":case"UNKNOWN_ERROR":default:return m??p.errorGeneric}},[p]),Me=R.useCallback(N=>!(N instanceof be)||N.code==="TIMEOUT"||N.code==="NETWORK_ERROR"||N.code==="RATE_LIMITED"||N.code==="SERVICE_ERROR"||N.code==="UNKNOWN_ERROR"||N.status>=500||N.status===0,[]),_e=R.useCallback(async N=>{var ce,re;Y(!0),se.current=!0,le(null),ie(!1);const m=v&&typeof k.streamMessage=="function";let C=null;const ee=H=>{if(C===null){C=he(),de(C);const K=[...X.current,{id:C,role:"assistant",content:"",...H}];X.current=K,F(K)}else{const K=C,te=X.current.map(ye=>ye.id===K?{...ye,...H}:ye);X.current=te,F(te)}},ne=()=>{if(C===null)return;const H=C,K=X.current.filter(te=>te.id!==H);X.current=K,F(K)};try{let H,K,te,ye,Ue=!1;if(m){const $e=new AbortController;ke.current=$e,z(!0);const ot=await k.streamMessage(N,{signal:$e.signal,onChunk:(Dt,Oe)=>ee({content:Oe}),onToolUse:(Dt,Oe)=>ee({toolUses:[...Oe]})});H=ot.reply,K=ot.sources,te=ot.toolUses,ye=ot.attachments,Ue=ot.aborted??!1}else{const $e=await k.sendMessage(N);H=$e.reply,K=$e.sources,te=$e.toolUses,ye=$e.attachments}if(Ue&&!H){ne();return}let ct={id:C??he(),role:"assistant",content:H,sources:K,toolUses:te};xe.current.length>0&&!Ue&&(ct=await Mc(xe.current,ct,{messages:N,apiUrl:s}));const wt=C!==null?X.current.map($e=>$e.id===ct.id?ct:$e):[...N,ct],ft=Vc(wt,ye);X.current=ft,F(ft),ge(ft)}catch(H){if(H instanceof no)return;if(H instanceof be&&((ce=H.code)!=null&&ce.startsWith("ATTACHMENT"))&&N.length>0){const K=N[N.length-1];if(K.role==="user"&&((re=K.attachments)!=null&&re.length)){const te=N.slice(0,-1);X.current=te,F(te),ge(te)}}if(C!==null){ge(X.current),H instanceof be?le(Ee(H.code,H.message)):le((p==null?void 0:p.errorConnection)??"Failed to connect. Please try again."),ie(!1);return}if(xe.current.length>0){const K=H instanceof Error?H:new Error(String(H)),te=await Pc(xe.current,K,{messages:N,apiUrl:s});if(te){const ye={id:he(),role:"assistant",content:te.content,sources:te.sources},Ue=[...N,ye];X.current=Ue,F(Ue),ge(Ue),le(null),ie(!1);return}}H instanceof be?le(Ee(H.code,H.message)):le((p==null?void 0:p.errorConnection)??"Failed to connect. Please try again."),ie(Me(H))}finally{Y(!1),se.current=!1,z(!1),de(null),ke.current=null}},[s,k,Ee,Me,ge,v,p]),Ce=R.useCallback(()=>{var N;(N=ke.current)==null||N.abort()},[]),Q=R.useCallback(async(N,m)=>{const C=N.trim(),ee=(m==null?void 0:m.filter(H=>H&&H.id))??[];if(!C&&ee.length===0||se.current)return;const ne={id:he(),role:"user",content:C,...ee.length>0?{attachments:ee}:{}};let ce=ne;if(xe.current.length>0){const H=await Lc(xe.current,ne,{messages:X.current,apiUrl:s});if(H.type==="abort")return;if(H.type==="respond"){const K={id:he(),role:"assistant",content:H.reply.content,sources:H.reply.sources},te=[...X.current,H.message,K];X.current=te,F(te),ge(te),le(null),ie(!1);return}ce=H.message}const re=[...X.current,ce];X.current=re,F(re),ge(re),await _e(re)},[s,ge,_e]),D=R.useCallback(async()=>{if(se.current)return;const N=X.current[X.current.length-1];!N||N.role!=="user"||await _e(X.current)},[_e]),Z=R.useCallback(()=>{if(X.current=[],F([]),le(null),ie(!1),a){const N=oo();if(!N)return;try{N.removeItem(E)}catch{}}},[a,E]);return{messages:M,isLoading:q,isStreaming:A,streamingMessageId:I,error:ue,canRetry:W,sendMessage:Q,stop:Ce,retry:D,clearMessages:Z}}function Yc(s){const[a,u]=R.useState(()=>typeof window>"u"?!1:window.matchMedia(s).matches);return R.useEffect(()=>{const f=window.matchMedia(s);u(f.matches);const p=y=>u(y.matches);return f.addEventListener("change",p),()=>f.removeEventListener("change",p)},[s]),a}function Hr(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,f=Math.max(s.scrollHeight,a.scrollHeight),p=s.clientHeight||window.innerHeight,y=f-p;return y<=0?100:u/y*100}function qc({triggers:s,enabled:a,onOpen:u,onGreeting:f}){R.useEffect(()=>{if(!a||!s||s.length===0)return;const p=new Set,y=[],v=typeof window<"u"?window.location.href:"",k=(E,T)=>{p.has(E)||(p.add(E),T==="open"?u():f(T.greeting))};return s.forEach((E,T)=>{switch(E.on){case"url":{Hr(E.pattern,v)&&k(T,E.action);break}case"time":{if(E.matchUrl&&!Hr(E.matchUrl,v))return;const M=window.setTimeout(()=>k(T,E.action),Math.max(0,E.seconds*1e3));y.push(()=>window.clearTimeout(M));break}case"scroll":{if(E.matchUrl&&!Hr(E.matchUrl,v))return;const M=()=>{Xc()>=E.percent&&k(T,E.action)};M(),window.addEventListener("scroll",M,{passive:!0}),y.push(()=>window.removeEventListener("scroll",M));break}case"exit-intent":{if(E.matchUrl&&!Hr(E.matchUrl,v))return;const M=F=>{F.clientY<=0&&k(T,E.action)};document.addEventListener("mouseleave",M),y.push(()=>document.removeEventListener("mouseleave",M));break}}}),()=>{y.forEach(E=>E())}},[s,a,u,f])}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=R.forwardRef(function({isOpen:a,onClick:u,position:f="bottom-right",translations:p},y){const v=a?(p==null?void 0:p.closeChat)??"Close chat":(p==null?void 0:p.openChat)??"Open chat";return g.jsx("button",{ref:y,onClick:u,"aria-label":v,className:`fixed ${Zc[f]} 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=R.memo(function({count:a,isActive:u,onClick:f}){return g.jsxs("button",{onClick:f,"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})]})}),ef=["http:","https:"];function io(s){if(!s||typeof s!="string")return null;const a=s.trim();if(!a)return null;try{const u=new URL(a);return ef.includes(u.protocol)?a:null}catch{return null}}function tf(){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 fu({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 du=R.memo(function({attachment:a,variant:u,onRemove:f,removeLabel:p}){const y=Oc(a),v=u==="composer",k=`${a.name} (${lo(a.size)})`,E=a.url?io(a.url):null;if(y){const M=g.jsx("img",{src:y,alt:a.name,title:k,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&&E?g.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",children:[M,g.jsxs("span",{className:"sr-only",children:[k," (opens in a new tab)"]})]}):M,f&&p&&g.jsx(fu,{label:p,onClick:f})]})}const T=g.jsxs("span",{title:k,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(tf,{}),g.jsx("span",{className:"truncate",children:a.name}),g.jsx("span",{className:"shrink-0 opacity-70",children:lo(a.size)})]});return g.jsxs("div",{className:"relative inline-block",children:[!v&&E?g.jsxs("a",{href:E,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:[T,g.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}):T,f&&p&&g.jsx(fu,{label:p,onClick:f})]})}),pu=R.forwardRef(function({label:a,onClick:u,children:f},p){return g.jsx("button",{ref:p,type:"button",onClick:u,"aria-label":a,title:a,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:f})})});function nf({state:s,labels:a,onPlay:u,onPause:f,onResume:p,onStop:y}){var M;const v=R.useRef(null),k=R.useRef(null),E=!!((M=v.current)!=null&&M.contains(document.activeElement));R.useEffect(()=>{var F,q;s==="idle"&&E&&!((F=v.current)!=null&&F.contains(document.activeElement))&&((q=k.current)==null||q.focus())},[s,E]);const T=s==="idle"?{label:a.play,onClick:u}:s==="paused"?{label:a.resume,onClick:p}:{label:a.pause,onClick:f};return g.jsxs("div",{ref:v,className:"flex items-center gap-1",children:[g.jsx(pu,{ref:k,...T,children:s==="idle"?g.jsxs(g.Fragment,{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"})]}):s==="paused"?g.jsx("polygon",{points:"6 3 20 12 6 21 6 3"}):g.jsxs(g.Fragment,{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"})]})}),s!=="idle"&&g.jsx(pu,{label:a.stop,onClick:y,children:g.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})]})}function rf(s){const a=s.lastIndexOf(` -`),u=a===-1?"":s.slice(0,a+1);let f=a===-1?s:s.slice(a+1);return f=uf(f),f=sf(f),u+f}function lf(s){const a=[];for(let u=0;up(v=>!v),"aria-expanded":y?f: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:f?"rotate-180":void 0,children:g.jsx("polyline",{points:"6 9 12 15 18 9"})})]})]}),f&&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 hu=/(https?:\/\/[^\s)]+)/,mu=/(\*\*[^*]+\*\*)/,gu=/(\*[^*]+\*)/;function cf(s,a){const u=s.match(/[.,;:!?'"]+$/),f=u?s.slice(0,-u[0].length):s,p=u?u[0]:"",y=io(f);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),p]}):s}function ff(s,a){const u=s.split(mu),f=[];return u.forEach((p,y)=>{if(mu.test(p)){const v=p.slice(2,-2);f.push(g.jsx("strong",{children:v},`${a}-b${y}`))}else p.split(gu).forEach((k,E)=>{if(gu.test(k)){const T=k.slice(1,-1);f.push(g.jsx("em",{children:T},`${a}-b${y}-i${E}`))}else k.split(hu).forEach((M,F)=>{hu.test(M)?f.push(cf(M,`${a}-b${y}-i${E}-u${F}`)):M&&f.push(M)})})}),f}function df(s){const a=s.split(` -`);return a.map((u,f)=>g.jsxs("span",{children:[ff(u,`l${f}`),f0,A=f?rf(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:[Y&&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(du,{attachment:I,variant:"message"})},I.id))}),(u!==""||!Y)&&df(A)]}),!q&&v&&v.length>0&&g.jsx("div",{className:"mt-1 space-y-1",children:v.map((I,de)=>g.jsx(af,{toolUse:I,usedLabel:k,detailsLabel:E},`${I.name}-${de}`))}),!q&&p&&p.length>0&&T&&g.jsx("div",{className:"mt-1",children:g.jsx(bc,{count:p.length,isActive:M??!1,onClick:T})}),!q&&F&&g.jsx("div",{className:"mt-1",children:g.jsx(nf,{...F})})]})}),vu={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"},hf=vu;function yu(s){return s.key===" "||s.key==="Enter"}function mf({mode:s,isListening:a,disabled:u=!1,onStart:f,onStop:p,label:y}){const v=s==="hold",k=R.useRef(!1),E=()=>{u||k.current||(k.current=!0,f({held:!0}))},T=()=>{k.current&&(k.current=!1,p())},M=A=>{v&&A.detail!==0||(a?p():f({held:!1}))},F=A=>{var z,I;!v||A.button!==0||((I=(z=A.currentTarget).setPointerCapture)==null||I.call(z,A.pointerId),E())},q=A=>{!v||!yu(A)||(A.preventDefault(),A.repeat||E())},Y=A=>{!v||!yu(A)||(A.preventDefault(),T())};return g.jsx("button",{type:"button",disabled:u,"aria-label":y,"aria-pressed":a,title:y,onClick:M,onPointerDown:F,onPointerUp:T,onPointerCancel:T,onLostPointerCapture:T,onKeyDown:q,onKeyUp:Y,onBlur:T,onContextMenu:v?A=>A.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 focus:ring-2 focus:ring-offset-2 focus:ring-offset-claudius-surface":"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 gf({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 uo(s,a){return s.replace(/\{(\w+)\}/g,(u,f)=>f in a?String(a[f]):u)}const vf={en:"en-US",es:"es-ES",fr:"fr-FR",de:"de-DE"},yf=["toggle","hold"];function wu(s,a){if(!(!s||!s.includes("-")))return s.toLowerCase().split("-")[0]===a?s:void 0}function wf(s,a){const u=a==null?void 0:a.trim();if(u)return u;const f=typeof document<"u"?wu(document.documentElement.lang,s):void 0;if(f)return f;const p=typeof navigator<"u"?wu(navigator.language,s):void 0;return p||vf[s]}function xf(s,a){const u=typeof s=="object"&&s!==null&&!Array.isArray(s);if(s!==!0&&!u)return null;const f=s===!0?{}:s,p={input:f.input??!0,output:f.output??!0,mode:yf.includes(f.mode)?f.mode:"toggle",autoSubmit:f.autoSubmit??!1,lang:wf(a,f.lang)};return p.input||p.output?p:null}function Sf(s){const a=s("voice");if(a===null)return;if(a==="false")return!1;const u={},f=T=>{const M=s(T);return M===null?void 0:M!=="false"},p=s("voice-mode");p!==null&&(u.mode=p);const y=f("voice-auto-submit");y!==void 0&&(u.autoSubmit=y);const v=f("voice-input");v!==void 0&&(u.input=v);const k=f("voice-output");k!==void 0&&(u.output=k);const E=s("voice-lang");return E!==null&&(u.lang=E),Object.keys(u).length>0?u:!0}function kf(s,a,u){const f=a.trim();if(!f)return s;const p=s.trimEnd();return(p?`${p} ${f}`:f).slice(0,u)}function Ef(s){const a=[];let u=0;for(let f=0;f{const y=f.trim();y&&u.push(y),f=""};for(const y of Ef(s)){if((f+y).trim().length<=a){f+=y;continue}if(p(),y.trim().length<=a){f=y;continue}for(let v of y.trim().split(/\s+/)){for(f&&`${f} ${v}`.length>a&&p();v.length>a;)u.push(v.slice(0,a)),v=v.slice(a);f=f?`${f} ${v}`:v}}return p(),u}function xu(){if(typeof window>"u")return;const s=window;return s.SpeechRecognition??s.webkitSpeechRecognition}function Rf(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 Nf(s){const[a]=R.useState(()=>xu()!==void 0),[u,f]=R.useState(!1),[p,y]=R.useState(!1),v=R.useRef(null),k=R.useRef(!1),E=R.useRef(s);R.useEffect(()=>{E.current=s});const T=R.useCallback(Y=>{Y.onstart=null,Y.onend=null,Y.onerror=null,Y.onresult=null,Y.onspeechstart=null,Y.onspeechend=null,v.current===Y&&(v.current=null),f(!1),y(!1)},[]),M=R.useCallback(()=>{const Y=v.current;Y&&(T(Y),Y.abort())},[T]),F=R.useCallback(()=>{const Y=v.current;return Y?(k.current?Y.stop():M(),!0):!1},[M]),q=R.useCallback(()=>{var de,ue;const Y=xu();if(!Y||v.current)return!1;const A=new Y;A.lang=E.current.lang,A.interimResults=!0,A.continuous=!1;let z="";const I=()=>{k.current=!0};A.onstart=I,A.onspeechstart=()=>{I(),y(!0)},A.onspeechend=()=>y(!1),A.onresult=le=>{var ae,se;let W="",ie="";for(let X=0;X{var W,ie;le.error!=="aborted"&&((ie=(W=E.current).onError)==null||ie.call(W,Rf(le.error))),T(A),A.abort()},A.onend=()=>{var le,W;T(A),(W=(le=E.current).onEnd)==null||W.call(le,z)},v.current=A,k.current=!1,f(!0);try{A.start()}catch{return T(A),(ue=(de=E.current).onError)==null||ue.call(de,"unavailable"),!1}return!0},[T]);return R.useEffect(()=>M,[M]),{isSupported:a,isListening:u,isSpeechDetected:p,start:q,stop:F,abort:M}}const Zn=2e3,Tf=1800;function Su(s){var u;const a=(u=s.dataTransfer)==null?void 0:u.types;return!!a&&Array.from(a).includes("Files")}function _f({onSend:s,isLoading:a,isStreaming:u=!1,onStop:f,placeholder:p,translations:y,attachments:v=null,voice:k=null,onVoiceStart:E,isReadingAloud:T=!1}){const M=y??hf,[F,q]=R.useState(""),[Y,A]=R.useState([]),[z,I]=R.useState(null),[de,ue]=R.useState(!1),[le,W]=R.useState(null),ie=R.useRef(null),ae=R.useRef(null),se=R.useRef([]),X=R.useRef(0),ke=R.useRef(""),xe=R.useRef(""),ge=R.useRef(!1),he=R.useRef(!1),Ee=R.useRef(!1),Me=U=>{ke.current=U,q(U)},_e=F.length,Ce=_e>=Tf,Q=_e>=Zn,D=p??M.placeholder,Z=!!v&&Y.length{var U;a||(U=ie.current)==null||U.focus()},[a]);const m=R.useCallback((U,we)=>{if(!v)return"";switch(we){case"size":return uo(M.attachmentTooLarge,{name:U,max:lo(v.maxSizeBytes)});case"type":return uo(M.attachmentTypeNotAllowed,{name:U});case"count":return uo(M.attachmentTooMany,{max:v.maxCount})}},[v,M]),C=R.useCallback(async U=>{if(!v||U.length===0)return;const{accepted:we,rejected:Ot}=Ic(U,se.current.length,v);if(I(Ot.length>0?m(Ot[0].file.name,Ot[0].reason):null),we.length===0)return;const Vr=await Promise.all(we.map(Bc));se.current=[...se.current,...Vr],A(se.current)},[v,m]),ee=R.useCallback(U=>{se.current=se.current.filter(we=>we.id!==U),A(se.current),I(null)},[]),ne=()=>{const U=ke.current.trim(),we=se.current;!U&&we.length===0||ke.current.length>=Zn||(we.length>0?s(U,we):s(U),Me(""),se.current=[],A([]),I(null),W(null))},ce=U=>{switch(U){case"permission":return M.voicePermissionDenied;case"no-speech":return M.voiceNoSpeech;case"no-microphone":return M.voiceNoMicrophone;case"unavailable":return M.voiceUnavailable}},re=Nf({lang:(k==null?void 0:k.lang)??"en-US",onTranscript:U=>Me(kf(xe.current,U,Zn)),onEnd:U=>{const we=U.trim()!=="";if(we&&(he.current=!0),!ge.current){te();return}we&&ye()},onError:U=>{U==="no-speech"&&he.current||(Ee.current=!0,W(ce(U)))}}),H=!!(k!=null&&k.input)&&re.isSupported,K=re.isListening;R.useEffect(()=>{const U=ie.current;K&&U&&(U.scrollLeft=U.scrollWidth)},[K,F]);const te=()=>{k!=null&&k.autoSubmit&&he.current&&!Ee.current&&ne()},ye=()=>{const U=ke.current;re.start()&&(xe.current=U)},Ue=({held:U})=>{W(null),ge.current=U,he.current=!1,Ee.current=!1,E==null||E(),ye()},ct=()=>{const U=ge.current;ge.current=!1,!re.stop()&&U&&te()},wt=()=>{ge.current=!1,re.abort()},{abort:ft}=re;R.useEffect(()=>{!a&&!T||(ge.current=!1,ft())},[a,T,ft]);const $e=U=>{U.preventDefault(),wt(),ne()},ot=U=>{const we=U.target.value;we.length<=Zn&&(wt(),W(null),Me(we))},Dt=U=>{const we=Array.from(U.target.files??[]);U.target.value="",C(we)},Oe=U=>{var Ot;if(!v)return;const we=Array.from(((Ot=U.clipboardData)==null?void 0:Ot.files)??[]);we.length!==0&&(U.preventDefault(),C(we))},Qt=U=>{!v||!Su(U)||(U.preventDefault(),X.current+=1,ue(!0))},At=U=>{!v||!Su(U)||U.preventDefault()},Kt=()=>{v&&(X.current=Math.max(0,X.current-1),X.current===0&&ue(!1))},er=U=>{var we;v&&(U.preventDefault(),X.current=0,ue(!1),C(Array.from(((we=U.dataTransfer)==null?void 0:we.files)??[])))};return g.jsxs("form",{onSubmit:$e,onDragEnter:Qt,onDragOver:At,onDragLeave:Kt,onDrop:er,"data-drag-over":de||void 0,className:`relative border-t border-claudius-border bg-claudius-surface p-3 ${de?"ring-2 ring-inset ring-claudius-accent":""}`,children:[de&&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:M.dropFilesHint}),v&&Y.length>0&&g.jsx("ul",{"aria-label":M.attachmentsLabel,className:"mb-2 flex flex-wrap gap-3 pt-1",children:Y.map(U=>g.jsx("li",{children:g.jsx(du,{attachment:U,variant:"composer",onRemove:()=>ee(U.id),removeLabel:`${M.removeAttachment}: ${U.name}`})},U.id))}),g.jsxs("div",{className:"flex gap-2",children:[v&&g.jsxs(g.Fragment,{children:[g.jsx("input",{ref:ae,type:"file",multiple:!0,hidden:!0,tabIndex:-1,accept:v.allowedTypes.join(","),onChange:Dt,"aria-label":M.attachFile}),g.jsx("button",{type:"button",onClick:()=>{var U;return(U=ae.current)==null?void 0:U.click()},disabled:a||!Z,"aria-label":M.attachFile,title:M.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:ie,type:"text",value:F,onChange:ot,onPaste:Oe,placeholder:K?M.voiceListening:D,disabled:a,"aria-label":M.typeYourMessage,"aria-describedby":Ce?"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 ${K?"pr-10":"pr-3"}`}),K&&g.jsx(gf,{active:re.isSpeechDetected})]}),H&&k&&g.jsx(mf,{mode:k.mode,isListening:K,disabled:a,onStart:Ue,onStop:ct,label:k.mode==="hold"?M.voiceInputHold:M.voiceInput}),N?g.jsx("button",{type:"button",onClick:f,"aria-label":M.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||Q,"aria-label":M.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"})]})})]}),(z??le)&&g.jsx("div",{role:"alert",className:"mt-1 text-xs text-claudius-error",children:z??le}),Ce&&g.jsxs("div",{id:"char-count",className:`mt-1 text-xs text-right ${Q?"text-claudius-error":"text-claudius-text-muted"}`,"aria-live":"polite",children:[_e,"/",Zn]})]})}const jf=["blog","page","external"],Lf={blog:"Blog",page:"Page",external:"External"};function Mf(s){try{return new URL(s).hostname}catch{return s}}const Pf=R.memo(function({sources:a,onClose:u}){const f=jf.map(y=>({type:y,label:Lf[y],items:a.filter(v=>v.type===y)})).filter(y=>y.items.length>0),p=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:p})]}),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:f.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 k=io(v.url);return k?g.jsxs("a",{href:k,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:Mf(k)})]},k):null})})]},y.type))})]})});function zf({title:s,subtitle:a,titleId:u,closeLabel:f,onClose:p}){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:p,"aria-label":f,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 Df({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 Af({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 Of(s,a,u){const[f,p]=R.useState(0),y=R.useRef(0),v=R.useRef(0),k=R.useRef(0),E=R.useRef(!1);return R.useEffect(()=>{const T=s.current;if(!u||!T)return;const M=Y=>{if(T.scrollTop>0){E.current=!1;return}E.current=!0,v.current=Y.touches[0].clientY,k.current=Date.now()},F=Y=>{if(!E.current)return;let A=Y.touches[0].clientY-v.current;A<0&&(A=A*.3),y.current=A,p(A)},q=()=>{if(!E.current)return;E.current=!1;const Y=y.current,A=(Date.now()-k.current)/1e3,z=T.getBoundingClientRect().height,I=A>.05&&Y>0&&Y/A>500,de=Y>z*.3;I||de?a():(y.current=0,p(0))};return T.addEventListener("touchstart",M,{passive:!0}),T.addEventListener("touchmove",F,{passive:!0}),T.addEventListener("touchend",q),()=>{T.removeEventListener("touchstart",M),T.removeEventListener("touchmove",F),T.removeEventListener("touchend",q)}},[s,a,u]),{offsetY:f}}const If='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Ff(s,a){R.useEffect(()=>{const u=s.current;if(!u)return;const f=p=>{if(p.key!=="Tab")return;const y=Array.from(u.querySelectorAll(If)).filter(T=>!T.hasAttribute("aria-hidden"));if(y.length===0)return;const v=y[0],k=y[y.length-1],E=document.activeElement;p.shiftKey&&E===v?(p.preventDefault(),k.focus()):!p.shiftKey&&E===k&&(p.preventDefault(),v.focus())};return u.addEventListener("keydown",f),()=>u.removeEventListener("keydown",f)},[s,a])}function Jn(){if(!(typeof window>"u")&&!(typeof window.SpeechSynthesisUtterance>"u"))return window.speechSynthesis??void 0}function Uf(s){const[a]=R.useState(()=>Jn()!==void 0),[u,f]=R.useState(null),[p,y]=R.useState(!1),v=R.useRef(0),k=R.useRef(!1),E=R.useRef([]),T=R.useCallback(()=>{v.current+=1,k.current=!1,E.current=[],f(null),y(!1)},[]),M=R.useCallback(()=>{const A=E.current.length>0;T();const z=Jn();!A||!z||(z.cancel(),z.paused&&z.resume())},[T]),F=R.useCallback((A,z)=>{const I=Jn();if(!I)return;T(),(I.speaking||I.pending)&&I.cancel(),I.paused&&I.resume();const de=Cf(z);if(de.length===0)return;const ue=v.current,le=()=>v.current===ue;E.current=de.map((W,ie)=>{const ae=new SpeechSynthesisUtterance(W);return ae.lang=s,ae.onerror=se=>{if(!le())return;(se.error==="interrupted"||se.error==="canceled")&&!k.current?T():M()},ae.onpause=()=>{le()&&y(!0)},ae.onresume=()=>{le()&&y(!1)},ae.onend=()=>{le()&&(k.current&&!I.paused?M():ie===de.length-1&&T())},ae}),f(A);for(const W of E.current)I.speak(W)},[s,M,T]),q=R.useCallback(()=>{const A=Jn();A&&(k.current=!0,A.pause(),A.paused&&y(!0))},[]),Y=R.useCallback(()=>{const A=Jn();A&&(k.current=!1,A.resume(),y(!1))},[]);return R.useEffect(()=>M,[M]),{isSupported:a,activeId:u,isPaused:p,speak:F,pause:q,resume:Y,cancel:M}}const Bf=/\*\*([^*]+)\*\*/g,Hf=/\*([^*]+)\*/g,Vf=/https?:\/\/[^\s)]+/g;function ku(s){return s.replace(Bf,"$1").replace(Hf,"$1").replace(Vf,a=>{var p;const u=((p=a.match(/[.,;:!?'"]+$/))==null?void 0:p[0])??"",f=u?a.slice(0,-u.length):a;try{return new URL(f).hostname+u}catch{return a}})}const $f={"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 Wf({messages:s,isLoading:a,isStreaming:u=!1,streamingMessageId:f=null,error:p,canRetry:y=!1,onSend:v,onStop:k,onRetry:E,onClose:T,title:M="Chat",subtitle:F="Ask me anything",welcomeMessage:q="Hi! How can I help you today?",placeholder:Y,position:A="bottom-right",translations:z,isMobile:I=!1,attachments:de=null,voice:ue=null}){const le=R.useId(),W=R.useRef(null),ie=R.useRef(null),[ae,se]=R.useState(null);Ff(W,!0);const X=Uf((ue==null?void 0:ue.lang)??"en-US"),ke=!!(ue!=null&&ue.output)&&X.isSupported,xe={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:ge}=Of(ie,T,I),he=ge!==0,Ee=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1;R.useEffect(()=>{const Q=ie.current;Q&&(Q.scrollTop=Q.scrollHeight)},[s,a]),R.useEffect(()=>{const Q=D=>{D.key==="Escape"&&!D.isComposing&&T()};return document.addEventListener("keydown",Q),()=>document.removeEventListener("keydown",Q)},[T]);const Me=(z==null?void 0:z.closeChat)??"Close chat",_e=(z==null?void 0:z.chatMessages)??"Chat messages",Ce=[...s].reverse().find(Q=>Q.role==="assistant");return g.jsxs("div",{ref:W,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 ${$f[A]} 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&&!Ee?{transform:`translateY(${Math.max(0,ge)}px)`}:void 0,"data-dragging":he||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(zf,{title:M,subtitle:F,titleId:le,closeLabel:Me,onClose:T}),g.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[ae&&g.jsx(Pf,{sources:ae.sources,onClose:()=>se(null)}),g.jsxs("div",{ref:ie,role:"log","aria-label":_e,className:"h-full space-y-3 overflow-y-auto px-4 py-4",children:[s.length===0&&!p&&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(Q=>g.jsx(pf,{role:Q.role,content:Q.content,isStreaming:Q.id===f,sources:Q.sources,attachments:Q.attachments,toolUses:Q.toolUses,toolUsedLabel:z==null?void 0:z.toolUsed,toolDetailsLabel:z==null?void 0:z.toolDetails,isSourceActive:(ae==null?void 0:ae.messageId)===Q.id,onSourceClick:()=>{(ae==null?void 0:ae.messageId)===Q.id?se(null):Q.sources&&Q.sources.length>0&&se({messageId:Q.id,sources:Q.sources})},speech:ke&&Q.role==="assistant"&&Q.id!==f&&Q.content.trim()!==""?{state:X.activeId!==Q.id?"idle":X.isPaused?"paused":"speaking",labels:xe,onPlay:()=>X.speak(Q.id,ku(Q.content)),onPause:X.pause,onResume:X.resume,onStop:X.cancel}:void 0},Q.id)),a&&!(f!==null&&s.some(Q=>Q.id===f&&Q.content.length>0))&&g.jsx(Af,{label:(z==null?void 0:z.typingIndicator)??"Assistant is typing"}),p&&g.jsx(Df,{message:p,retryLabel:(z==null?void 0:z.errorRetry)??"Retry",onRetry:y&&E&&!a?E:void 0})]})]}),g.jsx("div",{"data-claudius-live":"assistant","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:Ce&&Ce.id!==f?ku(Ce.content):""}),g.jsx(_f,{onSend:v,isLoading:a,isStreaming:u,onStop:k,placeholder:Y,translations:z,attachments:de,voice:ue,onVoiceStart:X.cancel,isReadingAloud:X.activeId!==null})]})}function Qf({message:s,position:a,onOpen:u,onDismiss:f,dismissLabel:p}){const y=a.startsWith("bottom"),v=a.endsWith("right"),k=["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:k,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:E=>{E.stopPropagation(),f()},"aria-label":p,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 Eu={en:vu,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 Cu(s){if(!s)return;const a=s.toLowerCase().split("-")[0];return Object.prototype.hasOwnProperty.call(Eu,a)?a:void 0}function Ru(){const s=typeof document<"u"?Cu(document.documentElement.lang):void 0;if(s)return s;const a=typeof navigator<"u"?Cu(navigator.language):void 0;return a||"en"}function Kf(s={}){const{locale:a,translations:u}=s,f=Eu[a??Ru()];return u?{...f,...u}:{...f}}const Nu=["accent","accentText","accentSoft","accentTextMuted","surface","surfaceMuted","text","textMuted","border","userBubble","userBubbleText","assistantBubble","assistantBubbleText","field","error","errorSurface","errorText","link","scrim"],Gf=["sm","md","lg","full","tail"],Yf=["elevated","floating","floatingHover"],Xf=["heading","body"],Tu={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 qf(s){return Object.prototype.hasOwnProperty.call(Tu,s)}const Zf=new Set(["light","dark","auto"]);function Jf(s){if(s===void 0)return{mode:"light"};if(typeof s=="string"){if(Zf.has(s))return{mode:s};if(qf(s)){const a=Tu[s];return{mode:a.colorScheme??"light",theme:a}}return{mode:"light",url:s}}return{mode:s.colorScheme??"light",theme:s}}function bf(s){return s.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}function ed(s,a){console.warn(`[Claudius] Ignoring unknown theme token "${a}" in "${s}"`)}function bn(s,a,u,f,p,y=""){if(p)for(const[v,k]of Object.entries(p)){if(!f.includes(v)){ed(a,v);continue}typeof k=="string"&&(s[`${u}${bf(v)}${y}`]=k)}}function td(s){const a={};bn(a,"colors","--cl-color-",Nu,s.colors);for(const[u,f]of Object.entries({...a}))a[`${u}-dark`]=f;return bn(a,"colorsDark","--cl-color-",Nu,s.colorsDark,"-dark"),bn(a,"radii","--cl-radius-",Gf,s.radii),bn(a,"shadows","--cl-shadow-",Yf,s.shadows),bn(a,"fonts","--cl-font-",Xf,s.fonts),a}function nd(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function rd(s){const a=R.useMemo(()=>Jf(s),[s]),[u,f]=R.useState(null),p=a.url;R.useEffect(()=>{if(f(null),!p)return;const E=new AbortController;return fetch(p,{signal:E.signal}).then(T=>{if(!T.ok)throw new Error(`HTTP ${T.status}`);return T.json()}).then(T=>{if(!nd(T))throw new Error("theme JSON must be an object");f(T)}).catch(T=>{E.signal.aborted||console.error(`[Claudius] Failed to load theme from ${p}:`,T)}),()=>E.abort()},[p]);const y=a.theme??u??null,v=(u==null?void 0:u.colorScheme)??a.mode,k=R.useMemo(()=>y?td(y):{},[y]);return{mode:v,cssVars:k}}const _u="claudius:triggers:dismissed";function ld(){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(_u)==="1"}catch{return!1}}function od(){if(!(typeof window>"u"))try{window.sessionStorage.setItem(_u,"1")}catch{}}function ju({apiUrl:s,title:a,subtitle:u,welcomeMessage:f,placeholder:p,persistMessages:y,storageKeyPrefix:v,requestTimeoutMs:k,theme:E="light",accentColor:T,position:M="bottom-right",locale:F,translations:q,triggers:Y,plugins:A,streaming:z=!0,attachments:I=!1,voice:de=!1}){const[ue,le]=R.useState(!1),W=R.useMemo(()=>zc(I),[I]),ie=R.useMemo(()=>xf(de,F??Ru()),[de,F]),[ae,se]=R.useState(null),[X,ke]=R.useState(ld),xe=R.useRef(!1),ge=Yc("(max-width: 639px)"),he=R.useMemo(()=>Kf({locale:F,translations:q}),[F,q]),{messages:Ee,isLoading:Me,isStreaming:_e,streamingMessageId:Ce,error:Q,canRetry:D,sendMessage:Z,stop:N,retry:m}=Gc({apiUrl:s,persistMessages:y,storageKeyPrefix:v,timeoutMs:k,translations:he,plugins:A,streaming:z}),C=R.useRef(null),ee=R.useRef(ue),{mode:ne,cssVars:ce}=rd(E),[re,H]=R.useState(!1);R.useEffect(()=>{if(ne!=="auto")return;const Oe=window.matchMedia("(prefers-color-scheme: dark)");H(Oe.matches);const Qt=At=>H(At.matches);return Oe.addEventListener("change",Qt),()=>Oe.removeEventListener("change",Qt)},[ne]),R.useEffect(()=>{var Oe;ee.current&&!ue&&((Oe=C.current)==null||Oe.focus()),ee.current=ue},[ue]);const K=R.useCallback(()=>{ke(!0),od()},[]),te=R.useCallback(()=>{le(!1),xe.current&&(xe.current=!1,K())},[K]),ye=R.useCallback(()=>{le(Oe=>!Oe)},[]),Ue=R.useCallback(()=>{xe.current=!0,se(null),le(!0)},[]),ct=R.useCallback(Oe=>{se(Oe)},[]),wt=R.useCallback(()=>{se(null),Ue()},[Ue]),ft=R.useCallback(()=>{se(null),K()},[K]);qc({triggers:Y,enabled:!X&&!ue,onOpen:Ue,onGreeting:ct});const $e=ne==="dark"||ne==="auto"&&re,ot={...ce,...T?{"--cl-color-accent":T,"--cl-color-accent-dark":T}:{}},Dt=Object.keys(ot).length>0?ot:void 0;return g.jsx("div",{className:"claudius-root",style:Dt,children:g.jsxs("div",{"data-claudius-dark":$e?"true":"false",children:[ue&&ge&&g.jsx("div",{className:"claudius-scrim fixed inset-0 z-40 bg-claudius-scrim",onClick:te,"aria-hidden":"true"}),ue&&g.jsx(Wf,{messages:Ee,isLoading:Me,isStreaming:_e,streamingMessageId:Ce,error:Q,canRetry:D,onSend:Z,onStop:N,onRetry:m,onClose:te,title:a??he.title,subtitle:u??he.subtitle,welcomeMessage:f??he.welcomeMessage,placeholder:p??he.placeholder,position:M,translations:he,isMobile:ge,attachments:W,voice:ie}),!(ue&&ge)&&g.jsx(Jc,{ref:C,isOpen:ue,onClick:ye,position:M,translations:he}),!ue&&ae&&g.jsx(Qf,{message:ae,position:M,onOpen:wt,onDismiss:ft,dismissLabel:he.dismissGreeting})]})})}const id="1.16.1";typeof window<"u"&&(window.ClaudiusWidgetVersion=id);function Lu(){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),uu.createRoot(a).render(g.jsx(ju,{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 Mu extends HTMLElement{constructor(){super(...arguments);pn(this,"root",null);pn(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=uu.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 f=this.getAttribute("persist-messages"),p=f===null?void 0:f!=="false",y=this.getAttribute("request-timeout-ms"),v=y===null?void 0:Number(y),k=this.getAttribute("attachments"),E=k===null?void 0:k!=="false";this.root.render(g.jsx(ju,{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:p,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:E,voice:Sf(T=>this.getAttribute(T))}))}}return typeof customElements<"u"&&!customElements.get("claudius-chat")&&customElements.define("claudius-chat",Mu),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Lu):Lu(),zt.ClaudiusChat=Mu,Object.defineProperty(zt,Symbol.toStringTag,{value:"Module"}),zt})({}); +`))!==-1;){const B=p.slice(0,J);p=p.slice(J+2);const Q=Bc(B);if(Q){if(Q.event==="chunk"){const ue=typeof Q.data.text=="string"?Q.data.text:"";ue&&(v+=ue,(I=i.onChunk)==null||I.call(i,ue,v))}else if(Q.event==="tool"){if(typeof Q.data.name=="string"){const ue=Q.data;k.push(ue),(D=i.onToolUse)==null||D.call(i,ue,k)}}else if(Q.event==="done"){const ue=Array.isArray(Q.data.toolUses)?Q.data.toolUses:k;S={reply:typeof Q.data.reply=="string"?Q.data.reply:v,sources:Q.data.sources,...ue.length>0?{toolUses:ue}:{},...Array.isArray(Q.data.attachments)?{attachments:Q.data.attachments}:{}}}else if(Q.event==="error")throw new tt(typeof Q.data.error=="string"?Q.data.error:"Something went wrong. Please try again.",0,"STREAM_ERROR")}}}}finally{(P=i.signal)==null||P.removeEventListener("abort",N),c.releaseLock()}if((F=i.signal)!=null&&F.aborted)return{reply:v,aborted:!0,...k.length>0?{toolUses:k}:{}};if(S)return S;throw new tt("Connection interrupted. Please try again.",0,"STREAM_ERROR")}async fetchStream(a,i){const c=new AbortController,f=()=>c.abort();i==null||i.addEventListener("abort",f,{once:!0});let p=!1;const v=this.timeoutMs>0?setTimeout(()=>{p=!0,c.abort()},this.timeoutMs):void 0,{headers:k,body:S}=this.buildRequest(a);try{return await fetch(`${this.baseUrl}/api/chat/stream`,{method:"POST",headers:k,body:S,signal:c.signal})}catch(N){throw p?new tt("Request timed out. Please try again.",0,"TIMEOUT"):N}finally{v!==void 0&&clearTimeout(v),i==null||i.removeEventListener("abort",f)}}async fetchWithTimeout(a){const{headers:i,body:c}=this.buildRequest(a);if(this.timeoutMs<=0)return fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:i,body:c});const f=new AbortController,p=setTimeout(()=>f.abort(),this.timeoutMs);try{return await fetch(`${this.baseUrl}/api/chat`,{method:"POST",headers:i,body:c,signal:f.signal})}catch(v){throw f.signal.aborted?new tt("Request timed out. Please try again.",0,"TIMEOUT"):v}finally{clearTimeout(p)}}isRetryable(a,i){return i==="TIMEOUT"||i==="NETWORK_ERROR"?!0:a===429||a===503}getRetryDelay(a,i){if(a&&a.status===429){const c=a.headers.get("Retry-After");if(c){const f=Number(c);return Math.min(f*1e3,6e4)}}return i===0?1e3:3e3}delay(a){return new Promise(i=>setTimeout(i,a))}}function Bc(u){let a="message";const i=[];for(const c of u.split(` +`))c.startsWith("event:")?a=c.slice(6).trim():c.startsWith("data:")&&i.push(c.slice(5).trimStart());if(i.length===0)return null;try{const c=JSON.parse(i.join(` +`));return typeof c!="object"||c===null?null:{event:a,data:c}}catch{return null}}function du(u){return typeof u=="string"?{content:u}:u}function ao(u,a,i){console.error(`[claudius] plugin "${u.name}" failed in ${a}:`,i)}async function Hc(u,a,i){let c=a;for(const f of u){if(!f.onBeforeSend)continue;let p=null;const v={...i,respondWith(k){p={type:"respond",message:c,reply:du(k)}},abort(k){p={type:"abort",reason:k}}};try{const k=await f.onBeforeSend(c,v);if(p)return p;k&&(c=k)}catch(k){ao(f,"onBeforeSend",k)}}return{type:"send",message:c}}async function $c(u,a,i){let c=a;for(const f of u)if(f.onAfterReceive)try{const p=await f.onAfterReceive(c,i);p&&(c=p)}catch(p){ao(f,"onAfterReceive",p)}return c}async function Vc(u,a,i){for(const c of u){if(!c.onError)continue;let f=null;const p={...i,respondWith(v){f=du(v)}};try{if(await c.onError(a,p),f)return f}catch(v){ao(c,"onError",v)}}return null}const $r={maxSizeBytes:5*1024*1024,maxCount:5,allowedTypes:["image/jpeg","image/png","image/gif","image/webp","application/pdf"]};function Wc(u){return u?u===!0?$r:{maxSizeBytes:u.maxSizeBytes??$r.maxSizeBytes,maxCount:u.maxCount??$r.maxCount,allowedTypes:(u.allowedTypes??$r.allowedTypes).map(a=>a.trim().toLowerCase()).filter(Boolean)}:null}function Vr(u){if(!Number.isFinite(u)||u<0)return"0 B";if(u<1024)return`${u} B`;const a=u/1024;if(a<1024)return`${Math.round(a)} KB`;const i=a/1024;return`${Number.isInteger(i)?i:i.toFixed(1)} MB`}const Qc={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",pdf:"application/pdf"};function fu(u){var c;const a=(u.type||"").trim().toLowerCase();if(a)return a;const i=((c=u.name.split(".").pop())==null?void 0:c.toLowerCase())??"";return Qc[i]??""}function Kc(u){return u.startsWith("image/")}function bc(u){if(Kc(u.mediaType)){if(u.url)try{const a=new URL(u.url);if(a.protocol==="http:"||a.protocol==="https:")return u.url}catch{}if(u.data)return`data:${u.mediaType};base64,${u.data}`}}function Gc(u,a,i){const c=[],f=[];let p=Math.max(0,i.maxCount-a);for(const v of u){const k=fu(v);!k||!i.allowedTypes.includes(k)?f.push({file:v,reason:"type"}):v.size>i.maxSizeBytes||v.size===0?f.push({file:v,reason:"size"}):p<=0?f.push({file:v,reason:"count"}):(c.push(v),p-=1)}return{accepted:c,rejected:f}}function Yc(u){return new Promise((a,i)=>{const c=new FileReader;c.onerror=()=>i(c.error??new Error("Failed to read file")),c.onload=()=>{const f=String(c.result??""),p=f.indexOf(",");a(p>=0?f.slice(p+1):f)},c.readAsDataURL(u)})}let pu=0;function Xc(){return pu+=1,`att-${Date.now().toString(36)}-${pu}`}async function Zc(u){const a=await Yc(u);return{id:Xc(),name:u.name||"attachment",mediaType:fu(u),size:u.size,data:a}}function hu(u){return u.map(a=>{var i;return(i=a.attachments)!=null&&i.some(c=>c.data)?{...a,attachments:a.attachments.map(c=>{if(!c.data)return c;const f={...c};return delete f.data,f})}:a})}function Jc(u,a){if(!a||a.length===0)return u;const i=new Map(a.map(c=>[c.id,c]));return u.map(c=>{var f;return(f=c.attachments)!=null&&f.some(p=>i.has(p.id))?{...c,attachments:c.attachments.map(p=>{const v=i.get(p.id);if(!v)return p;const k={...p,key:v.key,url:v.url,expiresAt:v.expiresAt};return delete k.data,k})}:c})}const qc=200,ed="claudius:messages",qn=()=>new Date().toISOString();function td(u,a){let i;try{i=new URL(a).host}catch{i=a}return`${u}:${i}`}function co(){try{return typeof sessionStorage<"u"?sessionStorage:null}catch{return null}}function nd(u){const a=co();if(!a)return[];try{const i=a.getItem(u);if(!i)return[];const c=JSON.parse(i);return Array.isArray(c)?c:[]}catch{return[]}}function rd({apiUrl:u,persistMessages:a=!0,storageKeyPrefix:i=ed,timeoutMs:c,translations:f,plugins:p,streaming:v=!0}){const k=R.useMemo(()=>new Uc(u,{debounceMs:0,timeoutMs:c}),[u,c]),S=td(i,u),N=a?nd(S):[],[j,O]=R.useState(N),[V,I]=R.useState(!1),[D,P]=R.useState(!1),[F,$]=R.useState(null),[J,B]=R.useState(null),[Q,ue]=R.useState(!1),de=R.useRef(N.length),ae=R.useRef(!1),Z=R.useRef(N),xe=R.useRef(null),pe=R.useRef(p??[]);pe.current=p??[];const Se=R.useCallback(C=>{if(!a)return;const m=co();if(m)try{const T=hu(C.slice(-qc));m.setItem(S,JSON.stringify(T))}catch{}},[a,S]),Ce=()=>(de.current+=1,`msg-${de.current}`),ve=R.useCallback((C,m)=>{if(!f)return m??"Something went wrong. Please try again.";switch(C){case"TIMEOUT":return f.errorTimeout;case"NETWORK_ERROR":return f.errorConnection;case"RATE_LIMITED":return m!=null&&m.includes("minute")?f.errorRateLimitMinute:f.errorRateLimitHour;case"ATTACHMENT_QUOTA_EXCEEDED":return f.errorAttachmentQuota;case"ATTACHMENTS_DISABLED":case"ATTACHMENT_INVALID":case"ATTACHMENT_TOO_LARGE":return f.errorAttachmentRejected;case"VALIDATION_ERROR":case"CONFIG_ERROR":case"SERVICE_ERROR":case"UNKNOWN_ERROR":default:return m??f.errorGeneric}},[f]),Re=R.useCallback(C=>!(C instanceof tt)||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,[]),ye=R.useCallback(async C=>{var se,ne,ie;I(!0),ae.current=!0,B(null),ue(!1);const m=v&&typeof k.streamMessage=="function";let T=null;const re=K=>{if(T===null){T=Ce(),$(T);const q=[...Z.current,{id:T,role:"assistant",content:"",createdAt:qn(),...K}];Z.current=q,O(q)}else{const q=T,ce=Z.current.map(Ae=>Ae.id===q?{...Ae,...K}:Ae);Z.current=ce,O(ce)}},le=()=>{if(T===null)return;const K=T,q=Z.current.filter(ce=>ce.id!==K);Z.current=q,O(q)};try{let K,q,ce,Ae,Ze=!1;if(m){const Oe=new AbortController;xe.current=Oe,P(!0);const pt=await k.streamMessage(C,{signal:Oe.signal,onChunk:(Mt,ut)=>re({content:ut}),onToolUse:(Mt,ut)=>re({toolUses:[...ut]})});K=pt.reply,q=pt.sources,ce=pt.toolUses,Ae=pt.attachments,Ze=pt.aborted??!1}else{const Oe=await k.sendMessage(C);K=Oe.reply,q=Oe.sources,ce=Oe.toolUses,Ae=Oe.attachments}if(Ze&&!K){le();return}const ft=((se=Z.current.find(Oe=>Oe.id===T))==null?void 0:se.createdAt)??qn();let Fe={id:T??Ce(),role:"assistant",content:K,createdAt:ft,sources:q,toolUses:ce};pe.current.length>0&&!Ze&&(Fe=await $c(pe.current,Fe,{messages:C,apiUrl:u}),Fe.createdAt||(Fe={...Fe,createdAt:ft}));const Kt=T!==null?Z.current.map(Oe=>Oe.id===Fe.id?Fe:Oe):[...C,Fe],_t=Jc(Kt,Ae);Z.current=_t,O(_t),Se(_t)}catch(K){if(K instanceof so)return;if(K instanceof tt&&((ne=K.code)!=null&&ne.startsWith("ATTACHMENT"))&&C.length>0){const q=C[C.length-1];if(q.role==="user"&&((ie=q.attachments)!=null&&ie.length)){const ce=C.slice(0,-1);Z.current=ce,O(ce),Se(ce)}}if(T!==null){Se(Z.current),K instanceof tt?B(ve(K.code,K.message)):B((f==null?void 0:f.errorConnection)??"Failed to connect. Please try again."),ue(!1);return}if(pe.current.length>0){const q=K instanceof Error?K:new Error(String(K)),ce=await Vc(pe.current,q,{messages:C,apiUrl:u});if(ce){const Ae={id:Ce(),role:"assistant",content:ce.content,createdAt:qn(),sources:ce.sources},Ze=[...C,Ae];Z.current=Ze,O(Ze),Se(Ze),B(null),ue(!1);return}}K instanceof tt?B(ve(K.code,K.message)):B((f==null?void 0:f.errorConnection)??"Failed to connect. Please try again."),ue(Re(K))}finally{I(!1),ae.current=!1,P(!1),$(null),xe.current=null}},[u,k,ve,Re,Se,v,f]),_e=R.useCallback(()=>{var C;(C=xe.current)==null||C.abort()},[]),ge=R.useCallback(async(C,m)=>{const T=C.trim(),re=(m==null?void 0:m.filter(ie=>ie&&ie.id))??[];if(!T&&re.length===0||ae.current)return;const le={id:Ce(),role:"user",content:T,createdAt:qn(),...re.length>0?{attachments:re}:{}};let se=le;if(pe.current.length>0){const ie=await Hc(pe.current,le,{messages:Z.current,apiUrl:u});if(ie.type==="abort")return;const K=q=>q.createdAt?q:{...q,createdAt:le.createdAt};if(ie.type==="respond"){const q={id:Ce(),role:"assistant",content:ie.reply.content,createdAt:qn(),sources:ie.reply.sources},ce=[...Z.current,K(ie.message),q];Z.current=ce,O(ce),Se(ce),B(null),ue(!1);return}se=K(ie.message)}const ne=[...Z.current,se];Z.current=ne,O(ne),Se(ne),await ye(ne)},[u,Se,ye]),z=R.useCallback(async()=>{if(ae.current)return;const C=Z.current[Z.current.length-1];!C||C.role!=="user"||await ye(Z.current)},[ye]),X=R.useCallback(()=>{if(Z.current=[],O([]),B(null),ue(!1),a){const C=co();if(!C)return;try{C.removeItem(S)}catch{}}},[a,S]);return{messages:j,isLoading:V,isStreaming:D,streamingMessageId:F,error:J,canRetry:Q,sendMessage:ge,stop:_e,retry:z,clearMessages:X}}function ld(u){const[a,i]=R.useState(()=>typeof window>"u"?!1:window.matchMedia(u).matches);return R.useEffect(()=>{const c=window.matchMedia(u);i(c.matches);const f=p=>i(p.matches);return c.addEventListener("change",f),()=>c.removeEventListener("change",f)},[u]),a}function Wr(u,a){return u instanceof RegExp?u.test(a):a.toLowerCase().includes(u.toLowerCase())}function od(){const u=document.documentElement,a=document.body,i=u.scrollTop||a.scrollTop||0,c=Math.max(u.scrollHeight,a.scrollHeight),f=u.clientHeight||window.innerHeight,p=c-f;return p<=0?100:i/p*100}function id({triggers:u,enabled:a,onOpen:i,onGreeting:c}){R.useEffect(()=>{if(!a||!u||u.length===0)return;const f=new Set,p=[],v=typeof window<"u"?window.location.href:"",k=(S,N)=>{f.has(S)||(f.add(S),N==="open"?i():c(N.greeting))};return u.forEach((S,N)=>{switch(S.on){case"url":{Wr(S.pattern,v)&&k(N,S.action);break}case"time":{if(S.matchUrl&&!Wr(S.matchUrl,v))return;const j=window.setTimeout(()=>k(N,S.action),Math.max(0,S.seconds*1e3));p.push(()=>window.clearTimeout(j));break}case"scroll":{if(S.matchUrl&&!Wr(S.matchUrl,v))return;const j=()=>{od()>=S.percent&&k(N,S.action)};j(),window.addEventListener("scroll",j,{passive:!0}),p.push(()=>window.removeEventListener("scroll",j));break}case"exit-intent":{if(S.matchUrl&&!Wr(S.matchUrl,v))return;const j=O=>{O.clientY<=0&&k(N,S.action)};document.addEventListener("mouseleave",j),p.push(()=>document.removeEventListener("mouseleave",j));break}}}),()=>{p.forEach(S=>S())}},[u,a,i,c])}const ud={"bottom-right":"bottom-6 right-6","bottom-left":"bottom-6 left-6","top-right":"top-6 right-6","top-left":"top-6 left-6"},sd=R.forwardRef(function({isOpen:a,onClick:i,position:c="bottom-right",translations:f},p){const v=a?(f==null?void 0:f.closeChat)??"Close chat":(f==null?void 0:f.openChat)??"Open chat";return y.jsx("button",{ref:p,onClick:i,"aria-label":v,className:`fixed ${ud[c]} 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?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"})})})}),ad=R.memo(function({count:a,isActive:i,onClick:c}){return y.jsxs("button",{onClick:c,"aria-label":"View sources",title:"View sources",className:`group relative flex h-7 w-7 items-center justify-center rounded-claudius-full transition-colors ${i?"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:a})]})}),cd=["http:","https:"];function Qr(u){if(!u||typeof u!="string")return null;const a=u.trim();if(!a)return null;try{const i=new URL(a);return cd.includes(i.protocol)?a:null}catch{return null}}function dd(){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 mu({label:u,onClick:a}){return y.jsx("button",{type:"button",onClick:a,"aria-label":u,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 gu=R.memo(function({attachment:a,variant:i,onRemove:c,removeLabel:f}){const p=bc(a),v=i==="composer",k=`${a.name} (${Vr(a.size)})`,S=a.url?Qr(a.url):null;if(p){const j=y.jsx("img",{src:p,alt:a.name,title:k,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 y.jsxs("div",{className:"relative inline-block",children:[!v&&S?y.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",children:[j,y.jsxs("span",{className:"sr-only",children:[k," (opens in a new tab)"]})]}):j,c&&f&&y.jsx(mu,{label:f,onClick:c})]})}const N=y.jsxs("span",{title:k,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:[y.jsx(dd,{}),y.jsx("span",{className:"truncate",children:a.name}),y.jsx("span",{className:"shrink-0 opacity-70",children:Vr(a.size)})]});return y.jsxs("div",{className:"relative inline-block",children:[!v&&S?y.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:[N,y.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]}):N,c&&f&&y.jsx(mu,{label:f,onClick:c})]})}),vu=R.forwardRef(function({label:a,onClick:i,children:c},f){return y.jsx("button",{ref:f,type:"button",onClick:i,"aria-label":a,title:a,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.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:c})})});function fd({state:u,labels:a,onPlay:i,onPause:c,onResume:f,onStop:p}){var j;const v=R.useRef(null),k=R.useRef(null),S=!!((j=v.current)!=null&&j.contains(document.activeElement));R.useEffect(()=>{var O,V;u==="idle"&&S&&!((O=v.current)!=null&&O.contains(document.activeElement))&&((V=k.current)==null||V.focus())},[u,S]);const N=u==="idle"?{label:a.play,onClick:i}:u==="paused"?{label:a.resume,onClick:f}:{label:a.pause,onClick:c};return y.jsxs("div",{ref:v,className:"flex items-center gap-1",children:[y.jsx(vu,{ref:k,...N,children:u==="idle"?y.jsxs(y.Fragment,{children:[y.jsx("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),y.jsx("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07",fill:"none"}),y.jsx("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14",fill:"none"})]}):u==="paused"?y.jsx("polygon",{points:"6 3 20 12 6 21 6 3"}):y.jsxs(y.Fragment,{children:[y.jsx("rect",{x:"6",y:"4",width:"4",height:"16",rx:"1"}),y.jsx("rect",{x:"14",y:"4",width:"4",height:"16",rx:"1"})]})}),u!=="idle"&&y.jsx(vu,{label:a.stop,onClick:p,children:y.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1.5"})})]})}function pd(u){const a=u.lastIndexOf(` +`),i=a===-1?"":u.slice(0,a+1);let c=a===-1?u:u.slice(a+1);return c=gd(c),c=vd(c),i+c}function hd(u){const a=[];for(let i=0;if(v=>!v),"aria-expanded":p?c: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:[a," ",y.jsx("span",{className:"font-mono text-claudius-text",children:u.name}),u.isError&&y.jsx("span",{className:"text-claudius-error",children:" ✕"})]}),p&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"sr-only",children:i}),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:c?"rotate-180":void 0,children:y.jsx("polyline",{points:"6 9 12 15 18 9"})})]})]}),c&&p&&y.jsxs("div",{className:"mt-1 overflow-x-auto rounded-claudius-sm border border-claudius-border bg-claudius-field p-2 font-mono",children:[u.input!==void 0&&y.jsx("pre",{className:"whitespace-pre-wrap break-all",children:JSON.stringify(u.input,null,2)}),u.result!==void 0&&y.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-all border-t border-claudius-border pt-1",children:u.result})]})]})}const yu=/(https?:\/\/[^\s)]+)/,wu=/(\*\*[^*]+\*\*)/,xu=/(\*[^*]+\*)/;function wd(u,a){const i=u.match(/[.,;:!?'"]+$/),c=i?u.slice(0,-i[0].length):u,f=i?i[0]:"",p=Qr(c);return p?y.jsxs(y.Fragment,{children:[y.jsxs("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"underline font-medium hover:opacity-80 text-claudius-link",children:[p.replace(/^https?:\/\//,""),y.jsx("span",{className:"sr-only",children:" (opens in a new tab)"})]},a),f]}):u}function xd(u,a){const i=u.split(wu),c=[];return i.forEach((f,p)=>{if(wu.test(f)){const v=f.slice(2,-2);c.push(y.jsx("strong",{children:v},`${a}-b${p}`))}else f.split(xu).forEach((k,S)=>{if(xu.test(k)){const N=k.slice(1,-1);c.push(y.jsx("em",{children:N},`${a}-b${p}-i${S}`))}else k.split(yu).forEach((j,O)=>{yu.test(j)?c.push(wd(j,`${a}-b${p}-i${S}-u${O}`)):j&&c.push(j)})})}),c}function Sd(u){const a=u.split(` +`);return a.map((i,c)=>y.jsxs("span",{children:[xd(i,`l${c}`),c0,D=c?pd(i):i,P=V||i!==""||!(v!=null&&v.length);return y.jsxs("div",{className:`${V?"ml-auto":"mr-auto"} max-w-[85%]`,children:[P&&y.jsxs("div",{className:`rounded-claudius-bubble px-4 py-2.5 text-sm leading-relaxed font-body ${V?"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:[I&&y.jsx("ul",{className:`flex flex-wrap gap-2 ${i?"mb-2":""}`,"aria-label":"Attachments",children:p.map(F=>y.jsx("li",{children:y.jsx(gu,{attachment:F,variant:"message"})},F.id))}),(i!==""||!I)&&Sd(D)]}),!V&&v&&v.length>0&&y.jsx("div",{className:"mt-1 space-y-1",children:v.map((F,$)=>y.jsx(yd,{toolUse:F,usedLabel:k,detailsLabel:S},`${F.name}-${$}`))}),!V&&f&&f.length>0&&N&&y.jsx("div",{className:"mt-1",children:y.jsx(ad,{count:f.length,isActive:j??!1,onClick:N})}),!V&&O&&y.jsx("div",{className:"mt-1",children:y.jsx(fd,{...O})})]})}),Su={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",moreOptions:"More options",copyAsMarkdown:"Copy as Markdown",downloadAsMarkdown:"Download as Markdown",downloadAsJson:"Download as JSON",copiedToClipboard:"Copied to clipboard",copyFailed:"Could not copy. Try downloading instead.",transcriptTitle:"Chat transcript",transcriptExported:"Exported {date}",transcriptUser:"User",transcriptAssistant:"Assistant",transcriptAttachments:"Attachments:",transcriptSources:"Sources:",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"},ku=Su;function Eu(u){return u.key===" "||u.key==="Enter"}function Ed({mode:u,isListening:a,disabled:i=!1,onStart:c,onStop:f,label:p}){const v=u==="hold",k=R.useRef(!1),S=()=>{i||k.current||(k.current=!0,c({held:!0}))},N=()=>{k.current&&(k.current=!1,f())},j=D=>{v&&D.detail!==0||(a?f():c({held:!1}))},O=D=>{var P,F;!v||D.button!==0||((F=(P=D.currentTarget).setPointerCapture)==null||F.call(P,D.pointerId),S())},V=D=>{!v||!Eu(D)||(D.preventDefault(),D.repeat||S())},I=D=>{!v||!Eu(D)||(D.preventDefault(),N())};return y.jsx("button",{type:"button",disabled:i,"aria-label":p,"aria-pressed":a,title:p,onClick:j,onPointerDown:O,onPointerUp:N,onPointerCancel:N,onLostPointerCapture:N,onKeyDown:V,onKeyUp:I,onBlur:N,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 focus:ring-2 focus:ring-offset-2 focus:ring-offset-claudius-surface":"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?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.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("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),y.jsx("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),y.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]})})}function Cd({active:u}){return y.jsxs("span",{"aria-hidden":"true","data-claudius-voice-level":u?"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:[y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{}),y.jsx("span",{})]})}function Kr(u,a){return u.replace(/\{(\w+)\}/g,(i,c)=>c in a?String(a[c]):i)}const Rd={en:"en-US",es:"es-ES",fr:"fr-FR",de:"de-DE"},Td=["toggle","hold"];function Cu(u,a){if(!(!u||!u.includes("-")))return u.toLowerCase().split("-")[0]===a?u:void 0}function Ru(u,a){const i=a==null?void 0:a.trim();if(i)return i;const c=typeof document<"u"?Cu(document.documentElement.lang,u):void 0;if(c)return c;const f=typeof navigator<"u"?Cu(navigator.language,u):void 0;return f||Rd[u]}function Nd(u,a){const i=typeof u=="object"&&u!==null&&!Array.isArray(u);if(u!==!0&&!i)return null;const c=u===!0?{}:u,f={input:c.input??!0,output:c.output??!0,mode:Td.includes(c.mode)?c.mode:"toggle",autoSubmit:c.autoSubmit??!1,lang:Ru(a,c.lang)};return f.input||f.output?f:null}function jd(u){const a=u("voice");if(a===null)return;if(a==="false")return!1;const i={},c=N=>{const j=u(N);return j===null?void 0:j!=="false"},f=u("voice-mode");f!==null&&(i.mode=f);const p=c("voice-auto-submit");p!==void 0&&(i.autoSubmit=p);const v=c("voice-input");v!==void 0&&(i.input=v);const k=c("voice-output");k!==void 0&&(i.output=k);const S=u("voice-lang");return S!==null&&(i.lang=S),Object.keys(i).length>0?i:!0}function _d(u,a,i){const c=a.trim();if(!c)return u;const f=u.trimEnd();return(f?`${f} ${c}`:c).slice(0,i)}function Md(u){const a=[];let i=0;for(let c=0;c{const p=c.trim();p&&i.push(p),c=""};for(const p of Md(u)){if((c+p).trim().length<=a){c+=p;continue}if(f(),p.trim().length<=a){c=p;continue}for(let v of p.trim().split(/\s+/)){for(c&&`${c} ${v}`.length>a&&f();v.length>a;)i.push(v.slice(0,a)),v=v.slice(a);c=c?`${c} ${v}`:v}}return f(),i}function Tu(){if(typeof window>"u")return;const u=window;return u.SpeechRecognition??u.webkitSpeechRecognition}function Pd(u){switch(u){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 Ad(u){const[a]=R.useState(()=>Tu()!==void 0),[i,c]=R.useState(!1),[f,p]=R.useState(!1),v=R.useRef(null),k=R.useRef(!1),S=R.useRef(u);R.useEffect(()=>{S.current=u});const N=R.useCallback(I=>{I.onstart=null,I.onend=null,I.onerror=null,I.onresult=null,I.onspeechstart=null,I.onspeechend=null,v.current===I&&(v.current=null),c(!1),p(!1)},[]),j=R.useCallback(()=>{const I=v.current;I&&(N(I),I.abort())},[N]),O=R.useCallback(()=>{const I=v.current;return I?(k.current?I.stop():j(),!0):!1},[j]),V=R.useCallback(()=>{var $,J;const I=Tu();if(!I||v.current)return!1;const D=new I;D.lang=S.current.lang,D.interimResults=!0,D.continuous=!1;let P="";const F=()=>{k.current=!0};D.onstart=F,D.onspeechstart=()=>{F(),p(!0)},D.onspeechend=()=>p(!1),D.onresult=B=>{var de,ae;let Q="",ue="";for(let Z=0;Z{var Q,ue;B.error!=="aborted"&&((ue=(Q=S.current).onError)==null||ue.call(Q,Pd(B.error))),N(D),D.abort()},D.onend=()=>{var B,Q;N(D),(Q=(B=S.current).onEnd)==null||Q.call(B,P)},v.current=D,k.current=!1,c(!0);try{D.start()}catch{return N(D),(J=($=S.current).onError)==null||J.call($,"unavailable"),!1}return!0},[N]);return R.useEffect(()=>j,[j]),{isSupported:a,isListening:i,isSpeechDetected:f,start:V,stop:O,abort:j}}const er=2e3,Dd=1800;function Nu(u){var i;const a=(i=u.dataTransfer)==null?void 0:i.types;return!!a&&Array.from(a).includes("Files")}function zd({onSend:u,isLoading:a,isStreaming:i=!1,onStop:c,placeholder:f,translations:p,attachments:v=null,voice:k=null,onVoiceStart:S,isReadingAloud:N=!1}){const j=p??ku,[O,V]=R.useState(""),[I,D]=R.useState([]),[P,F]=R.useState(null),[$,J]=R.useState(!1),[B,Q]=R.useState(null),ue=R.useRef(null),de=R.useRef(null),ae=R.useRef([]),Z=R.useRef(0),xe=R.useRef(""),pe=R.useRef(""),Se=R.useRef(!1),Ce=R.useRef(!1),ve=R.useRef(!1),Re=H=>{xe.current=H,V(H)},ye=O.length,_e=ye>=Dd,ge=ye>=er,z=f??j.placeholder,X=!!v&&I.length{var H;a||(H=ue.current)==null||H.focus()},[a]);const m=R.useCallback((H,ke)=>{if(!v)return"";switch(ke){case"size":return Kr(j.attachmentTooLarge,{name:H,max:Vr(v.maxSizeBytes)});case"type":return Kr(j.attachmentTypeNotAllowed,{name:H});case"count":return Kr(j.attachmentTooMany,{max:v.maxCount})}},[v,j]),T=R.useCallback(async H=>{if(!v||H.length===0)return;const{accepted:ke,rejected:It}=Gc(H,ae.current.length,v);if(F(It.length>0?m(It[0].file.name,It[0].reason):null),ke.length===0)return;const Gr=await Promise.all(ke.map(Zc));ae.current=[...ae.current,...Gr],D(ae.current)},[v,m]),re=R.useCallback(H=>{ae.current=ae.current.filter(ke=>ke.id!==H),D(ae.current),F(null)},[]),le=()=>{const H=xe.current.trim(),ke=ae.current;!H&&ke.length===0||xe.current.length>=er||(ke.length>0?u(H,ke):u(H),Re(""),ae.current=[],D([]),F(null),Q(null))},se=H=>{switch(H){case"permission":return j.voicePermissionDenied;case"no-speech":return j.voiceNoSpeech;case"no-microphone":return j.voiceNoMicrophone;case"unavailable":return j.voiceUnavailable}},ne=Ad({lang:(k==null?void 0:k.lang)??"en-US",onTranscript:H=>Re(_d(pe.current,H,er)),onEnd:H=>{const ke=H.trim()!=="";if(ke&&(Ce.current=!0),!Se.current){q();return}ke&&ce()},onError:H=>{H==="no-speech"&&Ce.current||(ve.current=!0,Q(se(H)))}}),ie=!!(k!=null&&k.input)&&ne.isSupported,K=ne.isListening;R.useEffect(()=>{const H=ue.current;K&&H&&(H.scrollLeft=H.scrollWidth)},[K,O]);const q=()=>{k!=null&&k.autoSubmit&&Ce.current&&!ve.current&&le()},ce=()=>{const H=xe.current;ne.start()&&(pe.current=H)},Ae=({held:H})=>{Q(null),Se.current=H,Ce.current=!1,ve.current=!1,S==null||S(),ce()},Ze=()=>{const H=Se.current;Se.current=!1,!ne.stop()&&H&&q()},ft=()=>{Se.current=!1,ne.abort()},{abort:Fe}=ne;R.useEffect(()=>{!a&&!N||(Se.current=!1,Fe())},[a,N,Fe]);const Kt=H=>{H.preventDefault(),ft(),le()},_t=H=>{const ke=H.target.value;ke.length<=er&&(ft(),Q(null),Re(ke))},Oe=H=>{const ke=Array.from(H.target.files??[]);H.target.value="",T(ke)},pt=H=>{var It;if(!v)return;const ke=Array.from(((It=H.clipboardData)==null?void 0:It.files)??[]);ke.length!==0&&(H.preventDefault(),T(ke))},Mt=H=>{!v||!Nu(H)||(H.preventDefault(),Z.current+=1,J(!0))},ut=H=>{!v||!Nu(H)||H.preventDefault()},Ue=()=>{v&&(Z.current=Math.max(0,Z.current-1),Z.current===0&&J(!1))},bt=H=>{var ke;v&&(H.preventDefault(),Z.current=0,J(!1),T(Array.from(((ke=H.dataTransfer)==null?void 0:ke.files)??[])))};return y.jsxs("form",{onSubmit:Kt,onDragEnter:Mt,onDragOver:ut,onDragLeave:Ue,onDrop:bt,"data-drag-over":$||void 0,className:`relative border-t border-claudius-border bg-claudius-surface p-3 ${$?"ring-2 ring-inset ring-claudius-accent":""}`,children:[$&&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:j.dropFilesHint}),v&&I.length>0&&y.jsx("ul",{"aria-label":j.attachmentsLabel,className:"mb-2 flex flex-wrap gap-3 pt-1",children:I.map(H=>y.jsx("li",{children:y.jsx(gu,{attachment:H,variant:"composer",onRemove:()=>re(H.id),removeLabel:`${j.removeAttachment}: ${H.name}`})},H.id))}),y.jsxs("div",{className:"flex gap-2",children:[v&&y.jsxs(y.Fragment,{children:[y.jsx("input",{ref:de,type:"file",multiple:!0,hidden:!0,tabIndex:-1,accept:v.allowedTypes.join(","),onChange:Oe,"aria-label":j.attachFile}),y.jsx("button",{type:"button",onClick:()=>{var H;return(H=de.current)==null?void 0:H.click()},disabled:a||!X,"aria-label":j.attachFile,title:j.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.jsxs("div",{className:"relative min-w-0 flex-1",children:[y.jsx("input",{ref:ue,type:"text",value:O,onChange:_t,onPaste:pt,placeholder:K?j.voiceListening:z,disabled:a,"aria-label":j.typeYourMessage,"aria-describedby":_e?"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 ${K?"pr-10":"pr-3"}`}),K&&y.jsx(Cd,{active:ne.isSpeechDetected})]}),ie&&k&&y.jsx(Ed,{mode:k.mode,isListening:K,disabled:a,onStart:Ae,onStop:Ze,label:k.mode==="hold"?j.voiceInputHold:j.voiceInput}),C?y.jsx("button",{type:"button",onClick:c,"aria-label":j.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:a||ge,"aria-label":j.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"})]})})]}),(P??B)&&y.jsx("div",{role:"alert",className:"mt-1 text-xs text-claudius-error",children:P??B}),_e&&y.jsxs("div",{id:"char-count",className:`mt-1 text-xs text-right ${ge?"text-claudius-error":"text-claudius-text-muted"}`,"aria-live":"polite",children:[ye,"/",er]})]})}const Od=["blog","page","external"],Id={blog:"Blog",page:"Page",external:"External"};function Fd(u){try{return new URL(u).hostname}catch{return u}}const Ud=R.memo(function({sources:a,onClose:i}){const c=Od.map(p=>({type:p,label:Id[p],items:a.filter(v=>v.type===p)})).filter(p=>p.items.length>0),f=a.length===1?"1 source found":`${a.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:f})]}),y.jsx("button",{onClick:i,"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:c.map(p=>y.jsxs("div",{children:[y.jsx("h4",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-claudius-text-muted",children:p.label}),y.jsx("div",{className:"space-y-2",children:p.items.map(v=>{const k=Qr(v.url);return k?y.jsxs("a",{href:k,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:v.title}),y.jsx("p",{className:"mt-0.5 text-xs text-claudius-text-muted",children:Fd(k)})]},k):null})})]},p.type))})]})});function Bd({title:u,subtitle:a,titleId:i,closeLabel:c,onClose:f,actions:p}){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:u.charAt(0).toUpperCase()}),y.jsxs("div",{className:"flex-1",children:[y.jsx("h2",{id:i,className:"text-sm font-heading font-semibold text-claudius-accent-text",children:u}),y.jsx("p",{className:"text-xs text-claudius-accent-text",children:a})]}),p,y.jsx("button",{onClick:f,"aria-label":c,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 Hd({message:u,retryLabel:a,onRetry:i}){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:u}),i&&y.jsx("button",{type:"button",onClick:i,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 $d({label:u}){return y.jsx("div",{role:"status","aria-live":"polite","aria-label":u,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 Vd({label:u,items:a,onOpen:i}){const[c,f]=R.useState(!1),p=R.useId(),v=R.useId(),k=R.useRef(null),S=R.useRef(null),N=R.useRef([]),j=R.useRef(null),O=$=>{j.current=$,f(!0),i==null||i()},V=$=>{var J;f(!1),(J=S.current)==null||J.focus()};R.useEffect(()=>{var J;if(!c)return;j.current!==null&&((J=N.current[j.current])==null||J.focus(),j.current=null);const $=B=>{var Q;(Q=k.current)!=null&&Q.contains(B.target)||f(!1)};return document.addEventListener("pointerdown",$),()=>document.removeEventListener("pointerdown",$)},[c]);const I=$=>{var B;const J=a.length;(B=N.current[($+J)%J])==null||B.focus()},D=$=>{$.key==="ArrowDown"?($.preventDefault(),O(0)):$.key==="ArrowUp"&&($.preventDefault(),O(a.length-1))},P=$=>{const J=N.current.findIndex(B=>B===document.activeElement);switch($.key){case"ArrowDown":$.preventDefault(),I(J+1);break;case"ArrowUp":$.preventDefault(),I(J===-1?a.length-1:J-1);break;case"Home":$.preventDefault(),I(0);break;case"End":$.preventDefault(),I(a.length-1);break;case"Escape":$.preventDefault(),$.stopPropagation(),V();break;case"Tab":$.shiftKey&&($.preventDefault(),V());break}},F=$=>{var B;const J=$.relatedTarget;J&&((B=k.current)!=null&&B.contains(J)||f(!1))};return y.jsxs("div",{ref:k,className:"relative",children:[y.jsx("button",{ref:S,id:p,type:"button","aria-label":u,"aria-haspopup":"menu","aria-expanded":c,"aria-controls":c?v:void 0,onClick:()=>c?V():O(0),onKeyDown: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:y.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[y.jsx("circle",{cx:"12",cy:"5",r:"1.75"}),y.jsx("circle",{cx:"12",cy:"12",r:"1.75"}),y.jsx("circle",{cx:"12",cy:"19",r:"1.75"})]})}),c&&y.jsx("div",{id:v,role:"menu","aria-labelledby":p,tabIndex:-1,onKeyDown:P,onBlur:F,className:"absolute right-0 top-full z-20 mt-1 min-w-[12rem] rounded-claudius-md border border-claudius-border bg-claudius-surface py-1 shadow-claudius-elevated",children:a.map(($,J)=>y.jsx("button",{ref:B=>{N.current[J]=B},type:"button",role:"menuitem",tabIndex:-1,"aria-disabled":$.disabled||void 0,onClick:()=>{$.disabled||(V(),$.onSelect())},className:"flex min-h-[40px] w-full items-center whitespace-nowrap px-4 text-left text-sm text-claudius-text hover:bg-claudius-surface-muted focus:bg-claudius-surface-muted aria-disabled:cursor-default aria-disabled:opacity-50 aria-disabled:hover:bg-transparent",children:$.label},$.id))})]})}function Wd(u,a,i){const[c,f]=R.useState(0),p=R.useRef(0),v=R.useRef(0),k=R.useRef(0),S=R.useRef(!1);return R.useEffect(()=>{const N=u.current;if(!i||!N)return;const j=I=>{if(N.scrollTop>0){S.current=!1;return}S.current=!0,v.current=I.touches[0].clientY,k.current=Date.now()},O=I=>{if(!S.current)return;let D=I.touches[0].clientY-v.current;D<0&&(D=D*.3),p.current=D,f(D)},V=()=>{if(!S.current)return;S.current=!1;const I=p.current,D=(Date.now()-k.current)/1e3,P=N.getBoundingClientRect().height,F=D>.05&&I>0&&I/D>500,$=I>P*.3;F||$?a():(p.current=0,f(0))};return N.addEventListener("touchstart",j,{passive:!0}),N.addEventListener("touchmove",O,{passive:!0}),N.addEventListener("touchend",V),()=>{N.removeEventListener("touchstart",j),N.removeEventListener("touchmove",O),N.removeEventListener("touchend",V)}},[u,a,i]),{offsetY:c}}const Qd='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function Kd(u,a){R.useEffect(()=>{const i=u.current;if(!i)return;const c=f=>{if(f.key!=="Tab")return;const p=Array.from(i.querySelectorAll(Qd)).filter(N=>!N.hasAttribute("aria-hidden"));if(p.length===0)return;const v=p[0],k=p[p.length-1],S=document.activeElement;f.shiftKey&&S===v?(f.preventDefault(),k.focus()):!f.shiftKey&&S===k&&(f.preventDefault(),v.focus())};return i.addEventListener("keydown",c),()=>i.removeEventListener("keydown",c)},[u,a])}function tr(){if(!(typeof window>"u")&&!(typeof window.SpeechSynthesisUtterance>"u"))return window.speechSynthesis??void 0}function bd(u){const[a]=R.useState(()=>tr()!==void 0),[i,c]=R.useState(null),[f,p]=R.useState(!1),v=R.useRef(0),k=R.useRef(!1),S=R.useRef([]),N=R.useCallback(()=>{v.current+=1,k.current=!1,S.current=[],c(null),p(!1)},[]),j=R.useCallback(()=>{const D=S.current.length>0;N();const P=tr();!D||!P||(P.cancel(),P.paused&&P.resume())},[N]),O=R.useCallback((D,P)=>{const F=tr();if(!F)return;N(),(F.speaking||F.pending)&&F.cancel(),F.paused&&F.resume();const $=Ld(P);if($.length===0)return;const J=v.current,B=()=>v.current===J;S.current=$.map((Q,ue)=>{const de=new SpeechSynthesisUtterance(Q);return de.lang=u,de.onerror=ae=>{if(!B())return;(ae.error==="interrupted"||ae.error==="canceled")&&!k.current?N():j()},de.onpause=()=>{B()&&p(!0)},de.onresume=()=>{B()&&p(!1)},de.onend=()=>{B()&&(k.current&&!F.paused?j():ue===$.length-1&&N())},de}),c(D);for(const Q of S.current)F.speak(Q)},[u,j,N]),V=R.useCallback(()=>{const D=tr();D&&(k.current=!0,D.pause(),D.paused&&p(!0))},[]),I=R.useCallback(()=>{const D=tr();D&&(k.current=!1,D.resume(),p(!1))},[]);return R.useEffect(()=>j,[j]),{isSupported:a,activeId:i,isPaused:f,speak:O,pause:V,resume:I,cancel:j}}const Gd=/^([ \t]*)(`{3,}|~{3,})(.*)$/,Yd=/^( {0,3})<(?![A-Za-z][A-Za-z0-9+.-]{1,31}:[^<>\s]*>|[^\s<>@]+@[^\s<>]+>)(?=[A-Za-z!?/])/,Xd=/^(?: {4}|\t)/;function ju(u){let a=0;for(const i of u)if(i===" ")a+=1;else if(i===" ")a+=4-a%4;else break;return a}function _u(u){let a=u.length;for(;a>0&&(u[a-1]===" "||u[a-1]===" ");)a-=1;return a===u.length?u:u.slice(0,a)}function Zd(u){const a=Gd.exec(u);if(!a)return null;const[,i,c,f]=a;return c[0]==="`"&&f.includes("`")?null:{indent:i,indentColumns:ju(i),char:c[0],length:c.length}}function Jd(u,a){const i=u.trim();if(i.length0&&i[i.length-1].trim()==="";)i.pop();i.length>0&&(i[i.length-1]=_u(i[i.length-1]))}return i.join(` +`)}const ef=/[\u00a0\u202f]/g;function tf(u){if(u.formatDate)return u.formatDate;const a=f=>new Intl.DateTimeFormat(f,{dateStyle:"medium",timeStyle:"short",timeZone:u.timeZone});let i=null;try{i=a(u.locale)}catch{try{i=a(void 0)}catch{i=null}}const c=i;return c?f=>c.format(f):f=>f.toISOString()}function nf(u){const a=tf(u);return i=>a(i).replace(ef," ")}function rf(u,a){var i;try{return((i=new Intl.DateTimeFormat("en",{timeZone:a,timeZoneName:"longOffset"}).formatToParts(u).find(f=>f.type==="timeZoneName"))==null?void 0:i.value)??""}catch{return""}}function Mu(u){const a=u.replace(/\s+/g," ").trim();if(a==="")return"";const i=Math.max(0,...(a.match(/`+/g)??[]).map(p=>p.length)),c="`".repeat(i+1),f=a.startsWith("`")||a.endsWith("`")?" ":"";return`${c}${f}${a}${f}${c}`}const lf={"(":"%28",")":"%29","<":"%3C",">":"%3E","\\":"%5C"};function of(u,a){const i=jn(u.title||u.url).replace(/\s+/g," ").trim().replace(/[\\[\]<]/g,"\\$&"),c=Qr(jn(u.url));if(!c)return`${a+1}. ${i}`;const f=c.replace(/[()<>\\]/g,p=>lf[p]).replace(/\s/g,"%20");return`${a+1}. [${i}](${f})`}function uf(u){const a=Mu(jn(u.name)),i=Vr(Number(u.size));return`- ${a} (${jn(u.mediaType)}, ${i})`}function jn(u){return typeof u=="string"?u:String(u??"")}function br(u){return Array.isArray(u)?u.filter(a=>a!==null&&typeof a=="object"):[]}function sf(u,a){const{labels:i}=a,c=nf(a),f=a.now??new Date,p=rf(f,a.timeZone),v=c(f)+(p?` (${p})`:""),k=[`# ${i.title}`,Kr(i.exported,{date:v})];for(const S of u){if(S===null||typeof S!="object")continue;const N=S.role==="user"?i.user:i.assistant,j=S.createdAt?new Date(S.createdAt):null,O=j&&!Number.isNaN(j.getTime())?` · ${c(j)}`:"";k.push(`## ${N}${O}`);const V=qd(jn(S.content));V&&k.push(V);const I=br(S.attachments);I.length&&k.push(i.attachments,I.map(uf).join(` +`));const D=br(S.toolUses);D.length&&k.push(D.map(F=>`${i.toolUsed} ${Mu(jn(F.name))}`).join(` +`));const P=br(S.sources);P.length&&k.push(i.sources,P.map(of).join(` +`))}return k.join(` + +`)+` +`}function af(u){const a=u.filter(i=>i!==null&&typeof i=="object").map(i=>i.attachments===void 0?i:{...i,attachments:br(i.attachments)});return JSON.stringify(hu(a),null,2)+` +`}function Lu(u,a={}){const i=a.now??new Date;let c;try{const f=new Intl.DateTimeFormat("en",{timeZone:a.timeZone,year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(i),p=v=>{var k;return((k=f.find(S=>S.type===v))==null?void 0:k.value)??""};c=`${p("year")}-${p("month")}-${p("day")}`}catch{c=i.toISOString().slice(0,10)}return`chat-transcript-${c}.${u}`}function cf(u){const a=document.activeElement;let i=null;try{return i=document.createElement("textarea"),i.value=u,i.setAttribute("readonly",""),i.setAttribute("aria-hidden","true"),i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.opacity="0",document.body.appendChild(i),i.focus({preventScroll:!0}),i.select(),document.execCommand("copy")}catch{return!1}finally{i==null||i.remove(),a==null||a.focus()}}async function df(u){var a;try{if((a=navigator.clipboard)!=null&&a.writeText)return await navigator.clipboard.writeText(u),!0}catch{}return cf(u)}const ff=4e4;function Pu(u,a,i){const c=URL.createObjectURL(new Blob([a],{type:i})),f=document.createElement("a");f.href=c,f.download=u,f.style.display="none",document.body.appendChild(f),f.click(),f.remove(),setTimeout(()=>URL.revokeObjectURL(c),ff)}const pf=4e3;function hf({enabled:u,messages:a,busy:i,locale:c,translations:f}){const p=f??ku,[v,k]=R.useState(null),S=R.useRef(null),N=R.useRef(!0);R.useEffect(()=>(N.current=!0,()=>{N.current=!1,S.current&&clearTimeout(S.current)}),[]);const j=R.useCallback(()=>{S.current&&clearTimeout(S.current),S.current=null,k(null)},[]),O=R.useCallback(I=>{N.current&&(S.current&&clearTimeout(S.current),k(I),S.current=setTimeout(()=>{S.current=null,k(null)},pf))},[]);return{items:R.useMemo(()=>{if(!u)return[];const I=i||a.length===0,D=()=>sf(a,{locale:c,labels:{title:p.transcriptTitle,exported:p.transcriptExported,user:p.transcriptUser,assistant:p.transcriptAssistant,attachments:p.transcriptAttachments,sources:p.transcriptSources,toolUsed:p.toolUsed}});return[{id:"copy-markdown",label:p.copyAsMarkdown,disabled:I,onSelect:()=>{df(D()).then(P=>O(P?p.copiedToClipboard:p.copyFailed))}},{id:"download-markdown",label:p.downloadAsMarkdown,disabled:I,onSelect:()=>Pu(Lu("md"),D(),"text/markdown;charset=utf-8")},{id:"download-json",label:p.downloadAsJson,disabled:I,onSelect:()=>Pu(Lu("json"),af(a),"application/json")}]},[u,i,a,c,p,O]),status:v,clearStatus:j}}const mf=/\*\*([^*]+)\*\*/g,gf=/\*([^*]+)\*/g,vf=/https?:\/\/[^\s)]+/g;function Au(u){return u.replace(mf,"$1").replace(gf,"$1").replace(vf,a=>{var f;const i=((f=a.match(/[.,;:!?'"]+$/))==null?void 0:f[0])??"",c=i?a.slice(0,-i.length):a;try{return new URL(c).hostname+i}catch{return a}})}const yf={"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 wf({messages:u,isLoading:a,isStreaming:i=!1,streamingMessageId:c=null,error:f,canRetry:p=!1,onSend:v,onStop:k,onRetry:S,onClose:N,title:j="Chat",subtitle:O="Ask me anything",welcomeMessage:V="Hi! How can I help you today?",placeholder:I,position:D="bottom-right",translations:P,isMobile:F=!1,attachments:$=null,voice:J=null,conversationExport:B=!1,locale:Q="en-US"}){const ue=R.useId(),de=R.useRef(null),ae=R.useRef(null),[Z,xe]=R.useState(null);Kd(de,!0);const pe=bd((J==null?void 0:J.lang)??"en-US"),Se=!!(J!=null&&J.output)&&pe.isSupported,Ce={play:(P==null?void 0:P.readAloud)??"Read aloud",pause:(P==null?void 0:P.pauseReading)??"Pause reading",resume:(P==null?void 0:P.resumeReading)??"Resume reading",stop:(P==null?void 0:P.stopReading)??"Stop reading"},ve=hf({enabled:B,messages:u,busy:a,locale:Q,translations:P}),{offsetY:Re}=Wd(ae,N,F),ye=Re!==0,_e=typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1;R.useEffect(()=>{const C=ae.current;C&&(C.scrollTop=C.scrollHeight)},[u,a]),R.useEffect(()=>{const C=m=>{m.key==="Escape"&&!m.isComposing&&!m.defaultPrevented&&N()};return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[N]);const ge=(P==null?void 0:P.closeChat)??"Close chat",z=(P==null?void 0:P.chatMessages)??"Chat messages",X=[...u].reverse().find(C=>C.role==="assistant");return y.jsxs("div",{ref:de,role:"dialog","aria-modal":F?"true":void 0,"aria-labelledby":ue,className:F?"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 ${yf[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:F&&!_e?{transform:`translateY(${Math.max(0,Re)}px)`}:void 0,"data-dragging":ye||void 0,children:[F&&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(Bd,{title:j,subtitle:O,titleId:ue,closeLabel:ge,onClose:N,actions:B?y.jsx(Vd,{label:(P==null?void 0:P.moreOptions)??"More options",items:ve.items,onOpen:ve.clearStatus}):void 0}),y.jsxs("div",{className:"relative flex-1 overflow-hidden",children:[Z&&y.jsx(Ud,{sources:Z.sources,onClose:()=>xe(null)}),B&&y.jsx("div",{role:"status",className:"pointer-events-none absolute inset-x-0 top-2 z-10 flex justify-center px-4",children:ve.status&&y.jsx("span",{className:"rounded-claudius-full bg-claudius-text px-3 py-1 text-xs text-claudius-surface shadow-claudius-elevated",children:ve.status})}),y.jsxs("div",{ref:ae,role:"log","aria-label":z,className:"h-full space-y-3 overflow-y-auto px-4 py-4",children:[u.length===0&&!f&&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:V})}),u.map(C=>y.jsx(kd,{role:C.role,content:C.content,isStreaming:C.id===c,sources:C.sources,attachments:C.attachments,toolUses:C.toolUses,toolUsedLabel:P==null?void 0:P.toolUsed,toolDetailsLabel:P==null?void 0:P.toolDetails,isSourceActive:(Z==null?void 0:Z.messageId)===C.id,onSourceClick:()=>{(Z==null?void 0:Z.messageId)===C.id?xe(null):C.sources&&C.sources.length>0&&xe({messageId:C.id,sources:C.sources})},speech:Se&&C.role==="assistant"&&C.id!==c&&C.content.trim()!==""?{state:pe.activeId!==C.id?"idle":pe.isPaused?"paused":"speaking",labels:Ce,onPlay:()=>pe.speak(C.id,Au(C.content)),onPause:pe.pause,onResume:pe.resume,onStop:pe.cancel}:void 0},C.id)),a&&!(c!==null&&u.some(C=>C.id===c&&C.content.length>0))&&y.jsx($d,{label:(P==null?void 0:P.typingIndicator)??"Assistant is typing"}),f&&y.jsx(Hd,{message:f,retryLabel:(P==null?void 0:P.errorRetry)??"Retry",onRetry:p&&S&&!a?S:void 0})]})]}),y.jsx("div",{"data-claudius-live":"assistant","aria-live":"polite","aria-atomic":"true",className:"sr-only",children:X&&X.id!==c?Au(X.content):""}),y.jsx(zd,{onSend:v,isLoading:a,isStreaming:i,onStop:k,placeholder:I,translations:P,attachments:$,voice:J,onVoiceStart:pe.cancel,isReadingAloud:pe.activeId!==null})]})}function xf({message:u,position:a,onOpen:i,onDismiss:c,dismissLabel:f}){const p=a.startsWith("bottom"),v=a.endsWith("right"),k=["claudius-greeting-bubble","fixed z-40 max-w-xs",p?"bottom-20":"top-20",v?"right-4":"left-4"].join(" ");return y.jsxs("div",{className:k,role:"status","aria-live":"polite",children:[y.jsx("button",{type:"button",onClick:i,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:u}),y.jsx("button",{type:"button",onClick:S=>{S.stopPropagation(),c()},"aria-label":f,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 Du={en:Su,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",moreOptions:"Más opciones",copyAsMarkdown:"Copiar como Markdown",downloadAsMarkdown:"Descargar como Markdown",downloadAsJson:"Descargar como JSON",copiedToClipboard:"Copiado al portapapeles",copyFailed:"No se pudo copiar. Prueba a descargarlo.",transcriptTitle:"Transcripción del chat",transcriptExported:"Exportado el {date}",transcriptUser:"Usuario",transcriptAssistant:"Asistente",transcriptAttachments:"Adjuntos:",transcriptSources:"Fuentes:",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",moreOptions:"Plus d'options",copyAsMarkdown:"Copier en Markdown",downloadAsMarkdown:"Télécharger en Markdown",downloadAsJson:"Télécharger en JSON",copiedToClipboard:"Copié dans le presse-papiers",copyFailed:"Impossible de copier. Essayez plutôt de télécharger.",transcriptTitle:"Transcription du chat",transcriptExported:"Exporté le {date}",transcriptUser:"Utilisateur",transcriptAssistant:"Assistant",transcriptAttachments:"Pièces jointes :",transcriptSources:"Sources :",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",moreOptions:"Weitere Optionen",copyAsMarkdown:"Als Markdown kopieren",downloadAsMarkdown:"Als Markdown herunterladen",downloadAsJson:"Als JSON herunterladen",copiedToClipboard:"In die Zwischenablage kopiert",copyFailed:"Kopieren nicht möglich. Bitte stattdessen herunterladen.",transcriptTitle:"Chat-Protokoll",transcriptExported:"Exportiert am {date}",transcriptUser:"Nutzer",transcriptAssistant:"Assistent",transcriptAttachments:"Anhänge:",transcriptSources:"Quellen:",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 zu(u){if(!u)return;const a=u.toLowerCase().split("-")[0];return Object.prototype.hasOwnProperty.call(Du,a)?a:void 0}function Ou(){const u=typeof document<"u"?zu(document.documentElement.lang):void 0;if(u)return u;const a=typeof navigator<"u"?zu(navigator.language):void 0;return a||"en"}function Sf(u={}){const{locale:a,translations:i}=u,c=Du[a??Ou()];return i?{...c,...i}:{...c}}const Iu=["accent","accentText","accentSoft","accentTextMuted","surface","surfaceMuted","text","textMuted","border","userBubble","userBubbleText","assistantBubble","assistantBubbleText","field","error","errorSurface","errorText","link","scrim"],kf=["sm","md","lg","full","tail"],Ef=["elevated","floating","floatingHover"],Cf=["heading","body"],Fu={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 Rf(u){return Object.prototype.hasOwnProperty.call(Fu,u)}const Tf=new Set(["light","dark","auto"]);function Nf(u){if(u===void 0)return{mode:"light"};if(typeof u=="string"){if(Tf.has(u))return{mode:u};if(Rf(u)){const a=Fu[u];return{mode:a.colorScheme??"light",theme:a}}return{mode:"light",url:u}}return{mode:u.colorScheme??"light",theme:u}}function jf(u){return u.replace(/[A-Z]/g,a=>`-${a.toLowerCase()}`)}function _f(u,a){console.warn(`[Claudius] Ignoring unknown theme token "${a}" in "${u}"`)}function nr(u,a,i,c,f,p=""){if(f)for(const[v,k]of Object.entries(f)){if(!c.includes(v)){_f(a,v);continue}typeof k=="string"&&(u[`${i}${jf(v)}${p}`]=k)}}function Mf(u){const a={};nr(a,"colors","--cl-color-",Iu,u.colors);for(const[i,c]of Object.entries({...a}))a[`${i}-dark`]=c;return nr(a,"colorsDark","--cl-color-",Iu,u.colorsDark,"-dark"),nr(a,"radii","--cl-radius-",kf,u.radii),nr(a,"shadows","--cl-shadow-",Ef,u.shadows),nr(a,"fonts","--cl-font-",Cf,u.fonts),a}function Lf(u){return typeof u=="object"&&u!==null&&!Array.isArray(u)}function Pf(u){const a=R.useMemo(()=>Nf(u),[u]),[i,c]=R.useState(null),f=a.url;R.useEffect(()=>{if(c(null),!f)return;const S=new AbortController;return fetch(f,{signal:S.signal}).then(N=>{if(!N.ok)throw new Error(`HTTP ${N.status}`);return N.json()}).then(N=>{if(!Lf(N))throw new Error("theme JSON must be an object");c(N)}).catch(N=>{S.signal.aborted||console.error(`[Claudius] Failed to load theme from ${f}:`,N)}),()=>S.abort()},[f]);const p=a.theme??i??null,v=(i==null?void 0:i.colorScheme)??a.mode,k=R.useMemo(()=>p?Mf(p):{},[p]);return{mode:v,cssVars:k}}const Uu="claudius:triggers:dismissed";function Af(){if(typeof window>"u")return!1;try{return window.sessionStorage.getItem(Uu)==="1"}catch{return!1}}function Df(){if(!(typeof window>"u"))try{window.sessionStorage.setItem(Uu,"1")}catch{}}function Bu({apiUrl:u,title:a,subtitle:i,welcomeMessage:c,placeholder:f,persistMessages:p,storageKeyPrefix:v,requestTimeoutMs:k,theme:S="light",accentColor:N,position:j="bottom-right",locale:O,translations:V,triggers:I,plugins:D,streaming:P=!0,attachments:F=!1,voice:$=!1,conversationExport:J=!1}){const[B,Q]=R.useState(!1),ue=R.useMemo(()=>Wc(F),[F]),de=R.useMemo(()=>O??Ou(),[O]),ae=R.useMemo(()=>Nd($,de),[$,de]),Z=R.useMemo(()=>Ru(de),[de]),[xe,pe]=R.useState(null),[Se,Ce]=R.useState(Af),ve=R.useRef(!1),Re=ld("(max-width: 639px)"),ye=R.useMemo(()=>Sf({locale:O,translations:V}),[O,V]),{messages:_e,isLoading:ge,isStreaming:z,streamingMessageId:X,error:C,canRetry:m,sendMessage:T,stop:re,retry:le}=rd({apiUrl:u,persistMessages:p,storageKeyPrefix:v,timeoutMs:k,translations:ye,plugins:D,streaming:P}),se=R.useRef(null),ne=R.useRef(B),{mode:ie,cssVars:K}=Pf(S),[q,ce]=R.useState(!1);R.useEffect(()=>{if(ie!=="auto")return;const Ue=window.matchMedia("(prefers-color-scheme: dark)");ce(Ue.matches);const bt=H=>ce(H.matches);return Ue.addEventListener("change",bt),()=>Ue.removeEventListener("change",bt)},[ie]),R.useEffect(()=>{var Ue;ne.current&&!B&&((Ue=se.current)==null||Ue.focus()),ne.current=B},[B]);const Ae=R.useCallback(()=>{Ce(!0),Df()},[]),Ze=R.useCallback(()=>{Q(!1),ve.current&&(ve.current=!1,Ae())},[Ae]),ft=R.useCallback(()=>{Q(Ue=>!Ue)},[]),Fe=R.useCallback(()=>{ve.current=!0,pe(null),Q(!0)},[]),Kt=R.useCallback(Ue=>{pe(Ue)},[]),_t=R.useCallback(()=>{pe(null),Fe()},[Fe]),Oe=R.useCallback(()=>{pe(null),Ae()},[Ae]);id({triggers:I,enabled:!Se&&!B,onOpen:Fe,onGreeting:Kt});const pt=ie==="dark"||ie==="auto"&&q,Mt={...K,...N?{"--cl-color-accent":N,"--cl-color-accent-dark":N}:{}},ut=Object.keys(Mt).length>0?Mt:void 0;return y.jsx("div",{className:"claudius-root",style:ut,children:y.jsxs("div",{"data-claudius-dark":pt?"true":"false",children:[B&&Re&&y.jsx("div",{className:"claudius-scrim fixed inset-0 z-40 bg-claudius-scrim",onClick:Ze,"aria-hidden":"true"}),B&&y.jsx(wf,{messages:_e,isLoading:ge,isStreaming:z,streamingMessageId:X,error:C,canRetry:m,onSend:T,onStop:re,onRetry:le,onClose:Ze,title:a??ye.title,subtitle:i??ye.subtitle,welcomeMessage:c??ye.welcomeMessage,placeholder:f??ye.placeholder,position:j,translations:ye,isMobile:Re,attachments:ue,voice:ae,conversationExport:J===!0,locale:Z}),!(B&&Re)&&y.jsx(sd,{ref:se,isOpen:B,onClick:ft,position:j,translations:ye}),!B&&xe&&y.jsx(xf,{message:xe,position:j,onOpen:_t,onDismiss:Oe,dismissLabel:ye.dismissGreeting})]})})}const zf="1.17.0";typeof window<"u"&&(window.ClaudiusWidgetVersion=zf);function Hu(){const u=window.ClaudiusConfig;if(!(u!=null&&u.apiUrl)){console.error("[Claudius] Missing ClaudiusConfig.apiUrl");return}const a=document.createElement("div");a.id="claudius-chat-widget",document.body.appendChild(a),cu.createRoot(a).render(y.jsx(Bu,{apiUrl:u.apiUrl,title:u.title,subtitle:u.subtitle,welcomeMessage:u.welcomeMessage,placeholder:u.placeholder,persistMessages:u.persistMessages,storageKeyPrefix:u.storageKeyPrefix,requestTimeoutMs:u.requestTimeoutMs,theme:u.theme,accentColor:u.accentColor,position:u.position,locale:u.locale,translations:u.translations,triggers:u.triggers,attachments:u.attachments,voice:u.voice,conversationExport:u.conversationExport}))}class $u extends HTMLElement{constructor(){super(...arguments);hn(this,"root",null);hn(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","conversation-export","voice","voice-mode","voice-auto-submit","voice-input","voice-output","voice-lang"]}connectedCallback(){this.container=document.createElement("div"),this.appendChild(this.container),this.root=cu.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 i=this.getAttribute("api-url");if(!i){console.error("[Claudius] Missing api-url attribute on ");return}const c=this.getAttribute("persist-messages"),f=c===null?void 0:c!=="false",p=this.getAttribute("request-timeout-ms"),v=p===null?void 0:Number(p),k=this.getAttribute("attachments"),S=k===null?void 0:k!=="false",N=this.getAttribute("conversation-export"),j=N==null?void 0:N.trim().toLowerCase(),O=N===null?void 0:j===""||j==="true";this.root.render(y.jsx(Bu,{apiUrl:i,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:f,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:S,conversationExport:O,voice:jd(V=>this.getAttribute(V))}))}}return typeof customElements<"u"&&!customElements.get("claudius-chat")&&customElements.define("claudius-chat",$u),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",Hu):Hu(),Ot.ClaudiusChat=$u,Object.defineProperty(Ot,Symbol.toStringTag,{value:"Module"}),Ot})({});