@voxket-ai/voxket-live 1.0.147 → 1.0.149

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,23 +1,3 @@
1
- // Auto-inject Voxket Widget CSS
2
- (function injectVoxketStyles() {
3
- if (typeof document === 'undefined') return;
4
-
5
- const existingStyles = document.querySelector('style[data-voxket-widget-styles]');
6
- if (existingStyles) return;
7
-
8
- const style = document.createElement('style');
9
- style.type = 'text/css';
10
- style.setAttribute('data-voxket-widget-styles', 'true');
11
- style.textContent = "/*!\n Theme: GitHub\n Description: Light theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-light\n Current colors taken from GitHub's CSS\n*/.voxket-widget-root .hljs{color:#24292e;background:#fff}.voxket-widget-root .hljs-doctag,.voxket-widget-root .hljs-keyword,.voxket-widget-root .hljs-meta .hljs-keyword,.voxket-widget-root .hljs-template-tag,.voxket-widget-root .hljs-template-variable,.voxket-widget-root .hljs-type,.voxket-widget-root .hljs-variable.language_{color:#d73a49}.voxket-widget-root .hljs-title,.voxket-widget-root .hljs-title.class_,.voxket-widget-root .hljs-title.class_.inherited__,.voxket-widget-root .hljs-title.function_{color:#6f42c1}.voxket-widget-root .hljs-attr,.voxket-widget-root .hljs-attribute,.voxket-widget-root .hljs-literal,.voxket-widget-root .hljs-meta,.voxket-widget-root .hljs-number,.voxket-widget-root .hljs-operator,.voxket-widget-root .hljs-variable,.voxket-widget-root .hljs-selector-attr,.voxket-widget-root .hljs-selector-class,.voxket-widget-root .hljs-selector-id{color:#005cc5}.voxket-widget-root .hljs-regexp,.voxket-widget-root .hljs-string,.voxket-widget-root .hljs-meta .hljs-string{color:#032f62}.voxket-widget-root .hljs-built_in,.voxket-widget-root .hljs-symbol{color:#e36209}.voxket-widget-root .hljs-comment,.voxket-widget-root .hljs-code,.voxket-widget-root .hljs-formula{color:#6a737d}.voxket-widget-root .hljs-name,.voxket-widget-root .hljs-quote,.voxket-widget-root .hljs-selector-tag,.voxket-widget-root .hljs-selector-pseudo{color:#22863a}.voxket-widget-root .hljs-subst{color:#24292e}.voxket-widget-root .hljs-section{color:#005cc5;font-weight:700}.voxket-widget-root .hljs-bullet{color:#735c0f}.voxket-widget-root .hljs-emphasis{color:#24292e;font-style:italic}.voxket-widget-root .hljs-strong{color:#24292e;font-weight:700}.voxket-widget-root .hljs-addition{color:#22863a;background-color:#f0fff4}.voxket-widget-root .hljs-deletion{color:#b31d28;background-color:#ffeef0}.voxket-widget-root pre code.hljs{display:block;overflow-x:auto;padding:1em}.voxket-widget-root code.hljs{padding:3px 5px}/*!\n Theme: GitHub Dark\n Description: Dark theme as seen on github.com\n Author: github.com\n Maintainer: @Hirse\n Updated: 2021-05-15\n\n Outdated base version: https://github.com/primer/github-syntax-dark\n Current colors taken from GitHub's CSS\n*/.voxket-widget-root .hljs{color:#c9d1d9;background:#0d1117}.voxket-widget-root .hljs-doctag,.voxket-widget-root .hljs-keyword,.voxket-widget-root .hljs-meta .hljs-keyword,.voxket-widget-root .hljs-template-tag,.voxket-widget-root .hljs-template-variable,.voxket-widget-root .hljs-type,.voxket-widget-root .hljs-variable.language_{color:#ff7b72}.voxket-widget-root .hljs-title,.voxket-widget-root .hljs-title.class_,.voxket-widget-root .hljs-title.class_.inherited__,.voxket-widget-root .hljs-title.function_{color:#d2a8ff}.voxket-widget-root .hljs-attr,.voxket-widget-root .hljs-attribute,.voxket-widget-root .hljs-literal,.voxket-widget-root .hljs-meta,.voxket-widget-root .hljs-number,.voxket-widget-root .hljs-operator,.voxket-widget-root .hljs-variable,.voxket-widget-root .hljs-selector-attr,.voxket-widget-root .hljs-selector-class,.voxket-widget-root .hljs-selector-id{color:#79c0ff}.voxket-widget-root .hljs-regexp,.voxket-widget-root .hljs-string,.voxket-widget-root .hljs-meta .hljs-string{color:#a5d6ff}.voxket-widget-root .hljs-built_in,.voxket-widget-root .hljs-symbol{color:#ffa657}.voxket-widget-root .hljs-comment,.voxket-widget-root .hljs-code,.voxket-widget-root .hljs-formula{color:#8b949e}.voxket-widget-root .hljs-name,.voxket-widget-root .hljs-quote,.voxket-widget-root .hljs-selector-tag,.voxket-widget-root .hljs-selector-pseudo{color:#7ee787}.voxket-widget-root .hljs-subst{color:#c9d1d9}.voxket-widget-root .hljs-section{color:#1f6feb;font-weight:700}.voxket-widget-root .hljs-bullet{color:#f2cc60}.voxket-widget-root .hljs-emphasis{color:#c9d1d9;font-style:italic}.voxket-widget-root .hljs-strong{color:#c9d1d9;font-weight:700}.voxket-widget-root .hljs-addition{color:#aff5b4;background-color:#033a16}.voxket-widget-root .hljs-deletion{color:#ffdcd7;background-color:#67060c}/*! tailwindcss v4.1.11 | MIT License | https://tailwindcss.com */@layer properties{@supports ((-webkit-hyphens:none) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,.voxket-widget-root :before,.voxket-widget-root :after,.voxket-widget-root ::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-space-x-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-contain-size:initial;--tw-contain-layout:initial;--tw-contain-paint:initial;--tw-contain-style:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.voxket-widget-root .visible{visibility:visible}.absolute{position:absolute}.fixed{position:fixed}.voxket-widget-root .relative{position:relative}.voxket-widget-root .static{position:static}.voxket-widget-root .sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-2{top:calc(var(--spacing)*-2)}.voxket-widget-root .top-0{top:calc(var(--spacing)*0)}.voxket-widget-root .top-1{top:calc(var(--spacing)*1)}.voxket-widget-root .top-2{top:calc(var(--spacing)*2)}.top-4{top:calc(var(--spacing)*4)}.-right-2{right:calc(var(--spacing)*-2)}.voxket-widget-root .right-0{right:calc(var(--spacing)*0)}.voxket-widget-root .right-2{right:calc(var(--spacing)*2)}.right-4{right:calc(var(--spacing)*4)}.voxket-widget-root .right-6{right:calc(var(--spacing)*6)}.voxket-widget-root .-bottom-2{bottom:calc(var(--spacing)*-2)}.voxket-widget-root .bottom-0{bottom:calc(var(--spacing)*0)}.voxket-widget-root .bottom-2{bottom:calc(var(--spacing)*2)}.bottom-4{bottom:calc(var(--spacing)*4)}.voxket-widget-root .bottom-20{bottom:calc(var(--spacing)*20)}.voxket-widget-root .-left-2{left:calc(var(--spacing)*-2)}.voxket-widget-root .left-0{left:calc(var(--spacing)*0)}.voxket-widget-root .left-1{left:calc(var(--spacing)*1)}.voxket-widget-root .left-2{left:calc(var(--spacing)*2)}.left-4{left:calc(var(--spacing)*4)}.voxket-widget-root .isolate{isolation:isolate}.voxket-widget-root .z-10{z-index:10}.voxket-widget-root .z-20{z-index:20}.voxket-widget-root .z-30{z-index:30}.z-50{z-index:50}.z-\\[9999\\]{z-index:9999}.z-\\[10000\\]{z-index:10000}.voxket-widget-root .order-1{order:1}.voxket-widget-root .order-2{order:2}.voxket-widget-root .col-span-2{grid-column:span 2/span 2}.voxket-widget-root .col-start-1{grid-column-start:1}.voxket-widget-root .col-start-2{grid-column-start:2}.voxket-widget-root .row-span-3{grid-row:span 3/span 3}.voxket-widget-root .row-start-1{grid-row-start:1}.voxket-widget-root .row-start-3{grid-row-start:3}.voxket-widget-root .container{width:100%}@media (min-width:40rem){.voxket-widget-root .container{max-width:40rem}}@media (min-width:48rem){.voxket-widget-root .container{max-width:48rem}}@media (min-width:64rem){.voxket-widget-root .container{max-width:64rem}}@media (min-width:80rem){.voxket-widget-root .container{max-width:80rem}}@media (min-width:96rem){.voxket-widget-root .container{max-width:96rem}}.voxket-widget-root .container\\!{width:100%!important}@media (min-width:40rem){.voxket-widget-root .container\\!{max-width:40rem!important}}@media (min-width:48rem){.voxket-widget-root .container\\!{max-width:48rem!important}}@media (min-width:64rem){.voxket-widget-root .container\\!{max-width:64rem!important}}@media (min-width:80rem){.voxket-widget-root .container\\!{max-width:80rem!important}}@media (min-width:96rem){.voxket-widget-root .container\\!{max-width:96rem!important}}.voxket-widget-root .m-4{margin:calc(var(--spacing)*4)}.voxket-widget-root .-mx-1{margin-inline:calc(var(--spacing)*-1)}.voxket-widget-root .mx-0{margin-inline:calc(var(--spacing)*0)}.voxket-widget-root .mx-0\\.5{margin-inline:calc(var(--spacing)*.5)}.voxket-widget-root .mx-3{margin-inline:calc(var(--spacing)*3)}.voxket-widget-root .mx-4{margin-inline:calc(var(--spacing)*4)}.voxket-widget-root .mx-8{margin-inline:calc(var(--spacing)*8)}.voxket-widget-root .mx-auto{margin-inline:auto}.voxket-widget-root .my-1{margin-block:calc(var(--spacing)*1)}.voxket-widget-root .my-2{margin-block:calc(var(--spacing)*2)}.voxket-widget-root .my-3{margin-block:calc(var(--spacing)*3)}.voxket-widget-root .my-4{margin-block:calc(var(--spacing)*4)}.voxket-widget-root .mt-1{margin-top:calc(var(--spacing)*1)}.voxket-widget-root .mt-2{margin-top:calc(var(--spacing)*2)}.voxket-widget-root .mt-3{margin-top:calc(var(--spacing)*3)}.voxket-widget-root .mt-4{margin-top:calc(var(--spacing)*4)}.voxket-widget-root .mt-6{margin-top:calc(var(--spacing)*6)}.voxket-widget-root .mt-8{margin-top:calc(var(--spacing)*8)}.voxket-widget-root .mt-auto{margin-top:auto}.voxket-widget-root .mr-1{margin-right:calc(var(--spacing)*1)}.voxket-widget-root .mr-2{margin-right:calc(var(--spacing)*2)}.voxket-widget-root .mr-3{margin-right:calc(var(--spacing)*3)}.voxket-widget-root .mb-1{margin-bottom:calc(var(--spacing)*1)}.voxket-widget-root .mb-2{margin-bottom:calc(var(--spacing)*2)}.voxket-widget-root .mb-3{margin-bottom:calc(var(--spacing)*3)}.voxket-widget-root .mb-4{margin-bottom:calc(var(--spacing)*4)}.voxket-widget-root .mb-6{margin-bottom:calc(var(--spacing)*6)}.voxket-widget-root .mb-8{margin-bottom:calc(var(--spacing)*8)}.voxket-widget-root .ml-1{margin-left:calc(var(--spacing)*1)}.voxket-widget-root .ml-2{margin-left:calc(var(--spacing)*2)}.voxket-widget-root .ml-auto{margin-left:auto}.voxket-widget-root .line-clamp-1{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.voxket-widget-root .block{display:block}.voxket-widget-root .flex{display:flex}.voxket-widget-root .grid{display:grid}.voxket-widget-root .hidden{display:none}.voxket-widget-root .inline{display:inline}.voxket-widget-root .inline-block{display:inline-block}.voxket-widget-root .inline-flex{display:inline-flex}.voxket-widget-root .table{display:table}.voxket-widget-root .aspect-square{aspect-ratio:1}.voxket-widget-root .aspect-video{aspect-ratio:var(--aspect-video)}.voxket-widget-root .size-3\\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.voxket-widget-root .size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.voxket-widget-root .size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.voxket-widget-root .h-0{height:calc(var(--spacing)*0)}.voxket-widget-root .h-1{height:calc(var(--spacing)*1)}.voxket-widget-root .h-1\\.5{height:calc(var(--spacing)*1.5)}.voxket-widget-root .h-2{height:calc(var(--spacing)*2)}.voxket-widget-root .h-3{height:calc(var(--spacing)*3)}.voxket-widget-root .h-4{height:calc(var(--spacing)*4)}.voxket-widget-root .h-5{height:calc(var(--spacing)*5)}.voxket-widget-root .h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.voxket-widget-root .h-9{height:calc(var(--spacing)*9)}.voxket-widget-root .h-10{height:calc(var(--spacing)*10)}.voxket-widget-root .h-11{height:calc(var(--spacing)*11)}.h-12{height:calc(var(--spacing)*12)}.voxket-widget-root .h-16{height:calc(var(--spacing)*16)}.voxket-widget-root .h-20{height:calc(var(--spacing)*20)}.voxket-widget-root .h-24{height:calc(var(--spacing)*24)}.voxket-widget-root .h-28{height:calc(var(--spacing)*28)}.voxket-widget-root .h-32{height:calc(var(--spacing)*32)}.voxket-widget-root .h-96{height:calc(var(--spacing)*96)}.voxket-widget-root .h-\\[25rem\\]{height:25rem}.voxket-widget-root .h-\\[30rem\\]{height:30rem}.voxket-widget-root .h-\\[56px\\]{height:56px}.voxket-widget-root .h-\\[60px\\]{height:60px}.voxket-widget-root .h-\\[70px\\]{height:70px}.voxket-widget-root .h-\\[90px\\]{height:90px}.voxket-widget-root .h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.voxket-widget-root .h-auto{height:auto}.voxket-widget-root .h-fit{height:-moz-fit-content;height:fit-content}.voxket-widget-root .h-full{height:100%}.voxket-widget-root .h-px{height:1px}.voxket-widget-root .h-screen{height:100vh}.voxket-widget-root .max-h-\\(--radix-select-content-available-height\\){max-height:var(--radix-select-content-available-height)}.voxket-widget-root .max-h-20{max-height:calc(var(--spacing)*20)}.voxket-widget-root .max-h-48{max-height:calc(var(--spacing)*48)}.voxket-widget-root .max-h-\\[80vh\\]{max-height:80vh}.voxket-widget-root .max-h-\\[85vh\\]{max-height:85vh}.voxket-widget-root .max-h-\\[95vh\\]{max-height:95vh}.voxket-widget-root .max-h-full{max-height:100%}.voxket-widget-root .min-h-0{min-height:calc(var(--spacing)*0)}.voxket-widget-root .min-h-2{min-height:calc(var(--spacing)*2)}.voxket-widget-root .min-h-4{min-height:calc(var(--spacing)*4)}.voxket-widget-root .min-h-\\[3rem\\]{min-height:3rem}.voxket-widget-root .min-h-\\[32px\\]{min-height:32px}.voxket-widget-root .min-h-\\[180px\\]{min-height:180px}.voxket-widget-root .min-h-fit{min-height:-moz-fit-content;min-height:fit-content}.voxket-widget-root .min-h-screen{min-height:100vh}.voxket-widget-root .\\!w-full{width:100%!important}.voxket-widget-root .w-0\\.5{width:calc(var(--spacing)*.5)}.voxket-widget-root .w-1\\.5{width:calc(var(--spacing)*1.5)}.voxket-widget-root .w-2{width:calc(var(--spacing)*2)}.voxket-widget-root .w-3{width:calc(var(--spacing)*3)}.voxket-widget-root .w-4{width:calc(var(--spacing)*4)}.voxket-widget-root .w-5{width:calc(var(--spacing)*5)}.voxket-widget-root .w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.voxket-widget-root .w-10{width:calc(var(--spacing)*10)}.w-12{width:calc(var(--spacing)*12)}.voxket-widget-root .w-16{width:calc(var(--spacing)*16)}.voxket-widget-root .w-20{width:calc(var(--spacing)*20)}.voxket-widget-root .w-24{width:calc(var(--spacing)*24)}.voxket-widget-root .w-28{width:calc(var(--spacing)*28)}.voxket-widget-root .w-32{width:calc(var(--spacing)*32)}.voxket-widget-root .w-40{width:calc(var(--spacing)*40)}.w-80{width:calc(var(--spacing)*80)}.voxket-widget-root .w-96{width:calc(var(--spacing)*96)}.voxket-widget-root .w-\\[32rem\\]{width:32rem}.voxket-widget-root .w-\\[180px\\]{width:180px}.voxket-widget-root .w-auto{width:auto}.voxket-widget-root .w-fit{width:-moz-fit-content;width:fit-content}.voxket-widget-root .w-full{width:100%}.voxket-widget-root .w-screen{width:100vw}.voxket-widget-root .max-w-2xl{max-width:var(--container-2xl)}.voxket-widget-root .max-w-3xl{max-width:var(--container-3xl)}.voxket-widget-root .max-w-4xl{max-width:var(--container-4xl)}.voxket-widget-root .max-w-6xl{max-width:var(--container-6xl)}.voxket-widget-root .max-w-7xl{max-width:var(--container-7xl)}.voxket-widget-root .max-w-\\[85\\%\\]{max-width:85%}.voxket-widget-root .max-w-full{max-width:100%}.voxket-widget-root .max-w-lg{max-width:var(--container-lg)}.voxket-widget-root .max-w-md{max-width:var(--container-md)}.voxket-widget-root .max-w-none{max-width:none}.voxket-widget-root .max-w-sm{max-width:var(--container-sm)}.voxket-widget-root .max-w-xs{max-width:var(--container-xs)}.voxket-widget-root .min-w-0{min-width:calc(var(--spacing)*0)}.voxket-widget-root .min-w-8{min-width:calc(var(--spacing)*8)}.voxket-widget-root .min-w-9{min-width:calc(var(--spacing)*9)}.voxket-widget-root .min-w-10{min-width:calc(var(--spacing)*10)}.voxket-widget-root .min-w-\\[2\\.5rem\\]{min-width:2.5rem}.voxket-widget-root .min-w-\\[8rem\\]{min-width:8rem}.voxket-widget-root .min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.voxket-widget-root .min-w-full{min-width:100%}.voxket-widget-root .flex-1{flex:1}.voxket-widget-root .flex-shrink-0,.voxket-widget-root .shrink-0{flex-shrink:0}.voxket-widget-root .origin-\\(--radix-select-content-transform-origin\\){transform-origin:var(--radix-select-content-transform-origin)}.voxket-widget-root .origin-center{transform-origin:50%}.voxket-widget-root .translate-y-0{--tw-translate-y:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.voxket-widget-root .animate-bounce{animation:var(--animate-bounce)}.voxket-widget-root .animate-pulse{animation:var(--animate-pulse)}.voxket-widget-root .cursor-default{cursor:default}.voxket-widget-root .cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.voxket-widget-root .resize{resize:both}.voxket-widget-root .resize-none{resize:none}.voxket-widget-root .scroll-my-1{scroll-margin-block:calc(var(--spacing)*1)}.voxket-widget-root .list-inside{list-style-position:inside}.voxket-widget-root .list-decimal{list-style-type:decimal}.voxket-widget-root .list-disc{list-style-type:disc}.voxket-widget-root .grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.voxket-widget-root .grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.voxket-widget-root .grid-cols-\\[0_1fr\\]{grid-template-columns:0 1fr}.voxket-widget-root .grid-cols-\\[1fr_1fr\\]{grid-template-columns:1fr 1fr}.voxket-widget-root .grid-rows-\\[90px_1fr_90px\\]{grid-template-rows:90px 1fr 90px}.voxket-widget-root .flex-col{flex-direction:column}.voxket-widget-root .flex-row{flex-direction:row}.voxket-widget-root .flex-row-reverse{flex-direction:row-reverse}.voxket-widget-root .flex-wrap{flex-wrap:wrap}.voxket-widget-root .place-content-center{place-content:center}.voxket-widget-root .place-content-end{place-content:end}.voxket-widget-root .items-center{align-items:center}.voxket-widget-root .items-end{align-items:flex-end}.voxket-widget-root .items-start{align-items:flex-start}.voxket-widget-root .justify-between{justify-content:space-between}.voxket-widget-root .justify-center{justify-content:center}.voxket-widget-root .justify-end{justify-content:flex-end}.voxket-widget-root .justify-start{justify-content:flex-start}.voxket-widget-root .justify-items-start{justify-items:start}.voxket-widget-root .gap-1{gap:calc(var(--spacing)*1)}.voxket-widget-root .gap-1\\.5{gap:calc(var(--spacing)*1.5)}.voxket-widget-root .gap-2{gap:calc(var(--spacing)*2)}.voxket-widget-root .gap-3{gap:calc(var(--spacing)*3)}.voxket-widget-root .gap-4{gap:calc(var(--spacing)*4)}.voxket-widget-root .gap-6{gap:calc(var(--spacing)*6)}.voxket-widget-root .gap-8{gap:calc(var(--spacing)*8)}.voxket-widget-root :where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}.voxket-widget-root :where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}.voxket-widget-root :where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*3)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-y-reverse)))}.voxket-widget-root :where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.voxket-widget-root :where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}.voxket-widget-root :where(.space-y-8>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*8)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*8)*calc(1 - var(--tw-space-y-reverse)))}.voxket-widget-root .gap-x-0\\.5{-moz-column-gap:calc(var(--spacing)*.5);column-gap:calc(var(--spacing)*.5)}.voxket-widget-root .gap-x-2{-moz-column-gap:calc(var(--spacing)*2);column-gap:calc(var(--spacing)*2)}.voxket-widget-root :where(.space-x-1>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*1)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-x-reverse)))}.voxket-widget-root :where(.space-x-2>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*2)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-x-reverse)))}.voxket-widget-root :where(.space-x-3>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*3)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*3)*calc(1 - var(--tw-space-x-reverse)))}.voxket-widget-root :where(.space-x-4>:not(:last-child)){--tw-space-x-reverse:0;margin-inline-start:calc(calc(var(--spacing)*4)*var(--tw-space-x-reverse));margin-inline-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-x-reverse)))}.voxket-widget-root .gap-y-0\\.5{row-gap:calc(var(--spacing)*.5)}.voxket-widget-root .gap-y-2{row-gap:calc(var(--spacing)*2)}.voxket-widget-root .self-center{align-self:center}.voxket-widget-root .justify-self-end{justify-self:flex-end}.voxket-widget-root .justify-self-start{justify-self:flex-start}.voxket-widget-root .truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.voxket-widget-root .overflow-auto{overflow:auto}.voxket-widget-root .overflow-hidden{overflow:hidden}.voxket-widget-root .overflow-x-auto{overflow-x:auto}.voxket-widget-root .overflow-x-hidden{overflow-x:hidden}.voxket-widget-root .overflow-y-auto{overflow-y:auto}.voxket-widget-root .rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.voxket-widget-root .rounded-3xl{border-radius:var(--radius-3xl)}.rounded-full{border-radius:3.40282e38px}.voxket-widget-root .rounded-lg{border-radius:var(--radius-lg)}.voxket-widget-root .rounded-md{border-radius:var(--radius-md)}.voxket-widget-root .rounded-none{border-radius:0}.voxket-widget-root .rounded-sm{border-radius:var(--radius-sm)}.voxket-widget-root .rounded-xl{border-radius:var(--radius-xl)}.voxket-widget-root .rounded-t-4xl{border-top-left-radius:var(--radius-4xl);border-top-right-radius:var(--radius-4xl)}.voxket-widget-root .rounded-t-md{border-top-left-radius:var(--radius-md);border-top-right-radius:var(--radius-md)}.voxket-widget-root .rounded-t-none{border-top-left-radius:0;border-top-right-radius:0}.voxket-widget-root .rounded-br-md{border-bottom-right-radius:var(--radius-md)}.voxket-widget-root .rounded-bl-md{border-bottom-left-radius:var(--radius-md)}.voxket-widget-root .border{border-style:var(--tw-border-style);border-width:1px}.voxket-widget-root .border-0{border-style:var(--tw-border-style);border-width:0}.voxket-widget-root .border-2{border-style:var(--tw-border-style);border-width:2px}.voxket-widget-root .border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.voxket-widget-root .border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.voxket-widget-root .border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.voxket-widget-root .border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.voxket-widget-root .\\!border-none{--tw-border-style:none!important;border-style:none!important}.voxket-widget-root .border-none{--tw-border-style:none;border-style:none}.voxket-widget-root .border-\\[\\#3B82F6\\]\\/40{border-color:#3b82f666}.voxket-widget-root .border-\\[\\#8B5CF6\\]\\/30{border-color:#8b5cf64d}.voxket-widget-root .border-\\[\\#813aa7\\]\\/30{border-color:#813aa74d}.voxket-widget-root .border-\\[\\#5078F2\\]\\/30{border-color:#5078f24d}.voxket-widget-root .border-\\[\\#23233a\\]{border-color:#23233a}.voxket-widget-root .border-\\[\\#232336\\]{border-color:#232336}.voxket-widget-root .border-\\[\\#EC4899\\]\\/20{border-color:#ec489933}.voxket-widget-root .border-blue-100{border-color:var(--color-blue-100)}.voxket-widget-root .border-blue-200{border-color:var(--color-blue-200)}.voxket-widget-root .border-blue-400{border-color:var(--color-blue-400)}.voxket-widget-root .border-blue-500{border-color:var(--color-blue-500)}.voxket-widget-root .border-blue-500\\/20{border-color:#3080ff33}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .border-blue-500\\/20{border-color:color-mix(in oklab,var(--color-blue-500)20%,transparent)}}.voxket-widget-root .border-blue-600{border-color:var(--color-blue-600)}.voxket-widget-root .border-current{border-color:currentColor}.voxket-widget-root .border-gray-200{border-color:var(--color-gray-200)}.voxket-widget-root .border-gray-300{border-color:var(--color-gray-300)}.voxket-widget-root .border-gray-400\\/15{border-color:#99a1af26}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .border-gray-400\\/15{border-color:color-mix(in oklab,var(--color-gray-400)15%,transparent)}}.voxket-widget-root .border-gray-500\\/20{border-color:#6a728233}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .border-gray-500\\/20{border-color:color-mix(in oklab,var(--color-gray-500)20%,transparent)}}.voxket-widget-root .border-gray-600{border-color:var(--color-gray-600)}.voxket-widget-root .border-gray-600\\/30{border-color:#4a55654d}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .border-gray-600\\/30{border-color:color-mix(in oklab,var(--color-gray-600)30%,transparent)}}.border-gray-700{border-color:var(--color-gray-700)}.voxket-widget-root .border-gray-800{border-color:var(--color-gray-800)}.voxket-widget-root .border-gray-900{border-color:var(--color-gray-900)}.voxket-widget-root .border-green-200{border-color:var(--color-green-200)}.voxket-widget-root .border-pink-500\\/10{border-color:#f6339a1a}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .border-pink-500\\/10{border-color:color-mix(in oklab,var(--color-pink-500)10%,transparent)}}.voxket-widget-root .border-purple-500\\/15{border-color:#ac4bff26}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .border-purple-500\\/15{border-color:color-mix(in oklab,var(--color-purple-500)15%,transparent)}}.voxket-widget-root .border-red-200{border-color:var(--color-red-200)}.voxket-widget-root .border-red-800{border-color:var(--color-red-800)}.voxket-widget-root .border-white{border-color:var(--color-white)}.voxket-widget-root .border-white\\/20{border-color:#fff3}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .border-white\\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.voxket-widget-root .border-yellow-200{border-color:var(--color-yellow-200)}.voxket-widget-root .border-t-transparent{border-top-color:#0000}.voxket-widget-root .bg-\\[\\#1E1E2E\\]{background-color:#1e1e2e}.voxket-widget-root .bg-\\[\\#1E1E2E\\]\\/80{background-color:#1e1e2ecc}.voxket-widget-root .bg-\\[\\#1E1E2E\\]\\/90{background-color:#1e1e2ee6}.voxket-widget-root .bg-\\[\\#3B82F6\\]{background-color:#3b82f6}.voxket-widget-root .bg-\\[\\#5c64f6\\]{background-color:#5c64f6}.voxket-widget-root .bg-\\[\\#10B981\\]{background-color:#10b981}.voxket-widget-root .bg-\\[\\#221f3f\\]{background-color:#221f3f}.voxket-widget-root .bg-\\[\\#813aa7\\]{background-color:#813aa7}.voxket-widget-root .bg-\\[\\#5078F2\\]{background-color:#5078f2}.voxket-widget-root .bg-\\[\\#6721a4\\]{background-color:#6721a4}.voxket-widget-root .bg-\\[\\#18182a\\]\\/80{background-color:#18182acc}.voxket-widget-root .bg-\\[\\#18182a\\]\\/90{background-color:#18182ae6}.voxket-widget-root .bg-black{background-color:var(--color-black)}.voxket-widget-root .bg-black\\/0{background-color:#0000}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-black\\/0{background-color:color-mix(in oklab,var(--color-black)0%,transparent)}}.bg-black\\/40{background-color:#0006}@supports (color:color-mix(in lab,red,red)){.bg-black\\/40{background-color:color-mix(in oklab,var(--color-black)40%,transparent)}}.voxket-widget-root .bg-black\\/50{background-color:#00000080}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-black\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.voxket-widget-root .bg-black\\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-black\\/70{background-color:color-mix(in oklab,var(--color-black)70%,transparent)}}.voxket-widget-root .bg-black\\/80{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-black\\/80{background-color:color-mix(in oklab,var(--color-black)80%,transparent)}}.voxket-widget-root .bg-blue-50{background-color:var(--color-blue-50)}.voxket-widget-root .bg-blue-100{background-color:var(--color-blue-100)}.voxket-widget-root .bg-blue-200{background-color:var(--color-blue-200)}.voxket-widget-root .bg-blue-400{background-color:var(--color-blue-400)}.voxket-widget-root .bg-blue-500{background-color:var(--color-blue-500)}.voxket-widget-root .bg-blue-600{background-color:var(--color-blue-600)}.voxket-widget-root .bg-blue-900\\/50{background-color:#1c398e80}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-blue-900\\/50{background-color:color-mix(in oklab,var(--color-blue-900)50%,transparent)}}.voxket-widget-root .bg-current{background-color:currentColor}.voxket-widget-root .bg-gray-50{background-color:var(--color-gray-50)}.voxket-widget-root .bg-gray-50\\/50{background-color:#f9fafb80}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-gray-50\\/50{background-color:color-mix(in oklab,var(--color-gray-50)50%,transparent)}}.voxket-widget-root .bg-gray-100{background-color:var(--color-gray-100)}.voxket-widget-root .bg-gray-200{background-color:var(--color-gray-200)}.voxket-widget-root .bg-gray-300{background-color:var(--color-gray-300)}.voxket-widget-root .bg-gray-400{background-color:var(--color-gray-400)}.voxket-widget-root .bg-gray-500{background-color:var(--color-gray-500)}.voxket-widget-root .bg-gray-600{background-color:var(--color-gray-600)}.voxket-widget-root .bg-gray-600\\/50{background-color:#4a556580}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-gray-600\\/50{background-color:color-mix(in oklab,var(--color-gray-600)50%,transparent)}}.voxket-widget-root .bg-gray-700{background-color:var(--color-gray-700)}.voxket-widget-root .bg-gray-700\\/60{background-color:#36415399}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-gray-700\\/60{background-color:color-mix(in oklab,var(--color-gray-700)60%,transparent)}}.bg-gray-800{background-color:var(--color-gray-800)}.bg-gray-800\\/30{background-color:#1e29394d}@supports (color:color-mix(in lab,red,red)){.bg-gray-800\\/30{background-color:color-mix(in oklab,var(--color-gray-800)30%,transparent)}}.bg-gray-800\\/50{background-color:#1e293980}@supports (color:color-mix(in lab,red,red)){.bg-gray-800\\/50{background-color:color-mix(in oklab,var(--color-gray-800)50%,transparent)}}.bg-gray-800\\/90{background-color:#1e2939e6}@supports (color:color-mix(in lab,red,red)){.bg-gray-800\\/90{background-color:color-mix(in oklab,var(--color-gray-800)90%,transparent)}}.bg-gray-900{background-color:var(--color-gray-900)}.bg-gray-900\\/50{background-color:#10182880}@supports (color:color-mix(in lab,red,red)){.bg-gray-900\\/50{background-color:color-mix(in oklab,var(--color-gray-900)50%,transparent)}}.bg-gray-900\\/80{background-color:#101828cc}@supports (color:color-mix(in lab,red,red)){.bg-gray-900\\/80{background-color:color-mix(in oklab,var(--color-gray-900)80%,transparent)}}.bg-gray-900\\/90{background-color:#101828e6}@supports (color:color-mix(in lab,red,red)){.bg-gray-900\\/90{background-color:color-mix(in oklab,var(--color-gray-900)90%,transparent)}}.bg-gray-900\\/95{background-color:#101828f2}@supports (color:color-mix(in lab,red,red)){.bg-gray-900\\/95{background-color:color-mix(in oklab,var(--color-gray-900)95%,transparent)}}.voxket-widget-root .bg-green-50{background-color:var(--color-green-50)}.voxket-widget-root .bg-green-500{background-color:var(--color-green-500)}.voxket-widget-root .bg-green-600{background-color:var(--color-green-600)}.voxket-widget-root .bg-indigo-600{background-color:var(--color-indigo-600)}.voxket-widget-root .bg-purple-500{background-color:var(--color-purple-500)}.voxket-widget-root .bg-purple-600{background-color:var(--color-purple-600)}.voxket-widget-root .bg-red-50{background-color:var(--color-red-50)}.voxket-widget-root .bg-red-500{background-color:var(--color-red-500)}.voxket-widget-root .bg-red-600{background-color:var(--color-red-600)}.voxket-widget-root .bg-red-600\\/80{background-color:#e40014cc}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-red-600\\/80{background-color:color-mix(in oklab,var(--color-red-600)80%,transparent)}}.voxket-widget-root .bg-red-900\\/20{background-color:#82181a33}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-red-900\\/20{background-color:color-mix(in oklab,var(--color-red-900)20%,transparent)}}.voxket-widget-root .bg-transparent{background-color:#0000}.voxket-widget-root .bg-white{background-color:var(--color-white)}.voxket-widget-root .bg-white\\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-white\\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.voxket-widget-root .bg-white\\/20{background-color:#fff3}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-white\\/20{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.voxket-widget-root .bg-white\\/80{background-color:#fffc}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-white\\/80{background-color:color-mix(in oklab,var(--color-white)80%,transparent)}}.voxket-widget-root .bg-white\\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-white\\/90{background-color:color-mix(in oklab,var(--color-white)90%,transparent)}}.voxket-widget-root .bg-white\\/95{background-color:#fffffff2}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .bg-white\\/95{background-color:color-mix(in oklab,var(--color-white)95%,transparent)}}.voxket-widget-root .bg-yellow-50{background-color:var(--color-yellow-50)}.voxket-widget-root .bg-yellow-500{background-color:var(--color-yellow-500)}.voxket-widget-root .bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.voxket-widget-root .bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.voxket-widget-root .bg-gradient-to-r{--tw-gradient-position:to right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.voxket-widget-root .bg-gradient-to-tr{--tw-gradient-position:to top right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.voxket-widget-root .bg-\\[radial-gradient\\(ellipse_at_center\\, .voxket-widget-root _var\\(--tw-gradient-stops\\)\\)\\]{background-image:radial-gradient(ellipse at center,var(--tw-gradient-stops))}.voxket-widget-root .from-\\[\\#3B82F6\\]{--tw-gradient-from:#3b82f6;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#3B82F6\\]\\/15{--tw-gradient-from:oklab(62.3083% -.0332476 -.185052/.15);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#8B5CF6\\]{--tw-gradient-from:#8b5cf6;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#8B5CF6\\]\\/25{--tw-gradient-from:oklab(60.5631% .0845415 -.201932/.25);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#10B981\\]{--tw-gradient-from:#10b981;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#6721a4\\]{--tw-gradient-from:#6721a4;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#171727\\]{--tw-gradient-from:#171727;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#171727\\]\\/90{--tw-gradient-from:oklab(21.3014% .00727232 -.0304822/.9);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#181825\\]{--tw-gradient-from:#181825;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#EC4899\\]{--tw-gradient-from:#ec4899;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-\\[\\#EC4899\\]\\/20{--tw-gradient-from:oklab(65.592% .210729 -.0210022/.2);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-black{--tw-gradient-from:var(--color-black);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-black\\/90{--tw-gradient-from:#000000e6}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .from-black\\/90{--tw-gradient-from:color-mix(in oklab,var(--color-black)90%,transparent)}}.voxket-widget-root .from-black\\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-blue-500{--tw-gradient-from:var(--color-blue-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-blue-500\\/5{--tw-gradient-from:#3080ff0d}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .from-blue-500\\/5{--tw-gradient-from:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.voxket-widget-root .from-blue-500\\/5{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-blue-600{--tw-gradient-from:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-gray-400{--tw-gradient-from:var(--color-gray-400);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-gray-500{--tw-gradient-from:var(--color-gray-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-gray-500\\/8{--tw-gradient-from:#6a728214}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .from-gray-500\\/8{--tw-gradient-from:color-mix(in oklab,var(--color-gray-500)8%,transparent)}}.voxket-widget-root .from-gray-500\\/8{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-gray-600{--tw-gradient-from:var(--color-gray-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-gray-600\\/10{--tw-gradient-from:#4a55651a}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .from-gray-600\\/10{--tw-gradient-from:color-mix(in oklab,var(--color-gray-600)10%,transparent)}}.voxket-widget-root .from-gray-600\\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-gray-800\\/20{--tw-gradient-from:#1e293933}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .from-gray-800\\/20{--tw-gradient-from:color-mix(in oklab,var(--color-gray-800)20%,transparent)}}.voxket-widget-root .from-gray-800\\/20{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-pink-500{--tw-gradient-from:var(--color-pink-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-pink-500\\/8{--tw-gradient-from:#f6339a14}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .from-pink-500\\/8{--tw-gradient-from:color-mix(in oklab,var(--color-pink-500)8%,transparent)}}.voxket-widget-root .from-pink-500\\/8{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-purple-500\\/10{--tw-gradient-from:#ac4bff1a}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .from-purple-500\\/10{--tw-gradient-from:color-mix(in oklab,var(--color-purple-500)10%,transparent)}}.voxket-widget-root .from-purple-500\\/10{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-white{--tw-gradient-from:var(--color-white);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .from-white\\/90{--tw-gradient-from:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .from-white\\/90{--tw-gradient-from:color-mix(in oklab,var(--color-white)90%,transparent)}}.voxket-widget-root .from-white\\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .via-\\[\\#8B5CF6\\]{--tw-gradient-via:#8b5cf6;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.voxket-widget-root .via-gray-200{--tw-gradient-via:var(--color-gray-200);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.voxket-widget-root .via-purple-600{--tw-gradient-via:var(--color-purple-600);--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.voxket-widget-root .via-transparent{--tw-gradient-via:transparent;--tw-gradient-via-stops:var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-via)var(--tw-gradient-via-position),var(--tw-gradient-to)var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.voxket-widget-root .to-\\[\\#5c64f6\\]{--tw-gradient-to:#5c64f6;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-\\[\\#8B5CF6\\]{--tw-gradient-to:#8b5cf6;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-\\[\\#12121F\\]{--tw-gradient-to:#12121f;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-\\[\\#059669\\]{--tw-gradient-to:#059669;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-\\[\\#232336\\]{--tw-gradient-to:#232336;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-\\[\\#EC4899\\]{--tw-gradient-to:#ec4899;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-gray-50{--tw-gradient-to:var(--color-gray-50);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-gray-300{--tw-gradient-to:var(--color-gray-300);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-gray-500{--tw-gradient-to:var(--color-gray-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-gray-600{--tw-gradient-to:var(--color-gray-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-gray-700{--tw-gradient-to:var(--color-gray-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-gray-900{--tw-gradient-to:var(--color-gray-900);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-pink-600{--tw-gradient-to:var(--color-pink-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-purple-500{--tw-gradient-to:var(--color-purple-500);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-purple-600{--tw-gradient-to:var(--color-purple-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .to-transparent{--tw-gradient-to:transparent;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .bg-clip-text{-webkit-background-clip:text;background-clip:text}.voxket-widget-root .object-contain{-o-object-fit:contain;object-fit:contain}.voxket-widget-root .object-cover{-o-object-fit:cover;object-fit:cover}.voxket-widget-root .p-0{padding:calc(var(--spacing)*0)}.voxket-widget-root .p-1{padding:calc(var(--spacing)*1)}.voxket-widget-root .p-2{padding:calc(var(--spacing)*2)}.voxket-widget-root .p-3{padding:calc(var(--spacing)*3)}.voxket-widget-root .p-4{padding:calc(var(--spacing)*4)}.voxket-widget-root .p-6{padding:calc(var(--spacing)*6)}.voxket-widget-root .p-8{padding:calc(var(--spacing)*8)}.voxket-widget-root .px-0{padding-inline:calc(var(--spacing)*0)}.voxket-widget-root .px-1{padding-inline:calc(var(--spacing)*1)}.voxket-widget-root .px-1\\.5{padding-inline:calc(var(--spacing)*1.5)}.voxket-widget-root .px-2{padding-inline:calc(var(--spacing)*2)}.voxket-widget-root .px-2\\.5{padding-inline:calc(var(--spacing)*2.5)}.voxket-widget-root .px-3{padding-inline:calc(var(--spacing)*3)}.voxket-widget-root .px-4{padding-inline:calc(var(--spacing)*4)}.voxket-widget-root .px-5{padding-inline:calc(var(--spacing)*5)}.voxket-widget-root .px-6{padding-inline:calc(var(--spacing)*6)}.voxket-widget-root .px-10{padding-inline:calc(var(--spacing)*10)}.voxket-widget-root .py-0\\.5{padding-block:calc(var(--spacing)*.5)}.voxket-widget-root .py-1{padding-block:calc(var(--spacing)*1)}.voxket-widget-root .py-1\\.5{padding-block:calc(var(--spacing)*1.5)}.voxket-widget-root .py-2{padding-block:calc(var(--spacing)*2)}.voxket-widget-root .py-3{padding-block:calc(var(--spacing)*3)}.voxket-widget-root .py-4{padding-block:calc(var(--spacing)*4)}.voxket-widget-root .py-8{padding-block:calc(var(--spacing)*8)}.voxket-widget-root .py-12{padding-block:calc(var(--spacing)*12)}.voxket-widget-root .pr-8{padding-right:calc(var(--spacing)*8)}.voxket-widget-root .pb-1{padding-bottom:calc(var(--spacing)*1)}.voxket-widget-root .pb-2{padding-bottom:calc(var(--spacing)*2)}.voxket-widget-root .pl-1{padding-left:calc(var(--spacing)*1)}.voxket-widget-root .pl-2{padding-left:calc(var(--spacing)*2)}.voxket-widget-root .pl-4{padding-left:calc(var(--spacing)*4)}.voxket-widget-root .pl-5{padding-left:calc(var(--spacing)*5)}.voxket-widget-root .text-center{text-align:center}.voxket-widget-root .text-end{text-align:end}.voxket-widget-root .text-left{text-align:left}.voxket-widget-root .text-right{text-align:right}.voxket-widget-root .font-mono{font-family:var(--font-mono)}.voxket-widget-root .text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.voxket-widget-root .text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.voxket-widget-root .text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.voxket-widget-root .text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.voxket-widget-root .text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.voxket-widget-root .text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.voxket-widget-root .text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.voxket-widget-root .text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.voxket-widget-root .text-\\[0\\.85em\\]{font-size:.85em}.voxket-widget-root .leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.voxket-widget-root .leading-snug{--tw-leading:var(--leading-snug);line-height:var(--leading-snug)}.voxket-widget-root .leading-tight{--tw-leading:var(--leading-tight);line-height:var(--leading-tight)}.voxket-widget-root .font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.voxket-widget-root .font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.voxket-widget-root .font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.voxket-widget-root .tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.voxket-widget-root .tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.voxket-widget-root .break-words{overflow-wrap:break-word}.voxket-widget-root .whitespace-nowrap{white-space:nowrap}.voxket-widget-root .whitespace-pre-line{white-space:pre-line}.voxket-widget-root .whitespace-pre-wrap{white-space:pre-wrap}.voxket-widget-root .text-black{color:var(--color-black)}.voxket-widget-root .text-blue-300{color:var(--color-blue-300)}.voxket-widget-root .text-blue-400{color:var(--color-blue-400)}.voxket-widget-root .text-blue-500{color:var(--color-blue-500)}.voxket-widget-root .text-blue-600{color:var(--color-blue-600)}.voxket-widget-root .text-blue-700{color:var(--color-blue-700)}.voxket-widget-root .text-blue-800{color:var(--color-blue-800)}.voxket-widget-root .text-gray-100{color:var(--color-gray-100)}.voxket-widget-root .text-gray-200{color:var(--color-gray-200)}.voxket-widget-root .text-gray-300{color:var(--color-gray-300)}.voxket-widget-root .text-gray-400{color:var(--color-gray-400)}.voxket-widget-root .text-gray-500{color:var(--color-gray-500)}.voxket-widget-root .text-gray-600{color:var(--color-gray-600)}.voxket-widget-root .text-gray-700{color:var(--color-gray-700)}.voxket-widget-root .text-gray-800{color:var(--color-gray-800)}.voxket-widget-root .text-gray-900{color:var(--color-gray-900)}.voxket-widget-root .text-green-700{color:var(--color-green-700)}.voxket-widget-root .text-inherit{color:inherit}.voxket-widget-root .text-orange-500{color:var(--color-orange-500)}.voxket-widget-root .text-red-400{color:var(--color-red-400)}.voxket-widget-root .text-red-500{color:var(--color-red-500)}.voxket-widget-root .text-red-600{color:var(--color-red-600)}.voxket-widget-root .text-red-700{color:var(--color-red-700)}.voxket-widget-root .text-transparent{color:#0000}.text-white{color:var(--color-white)}.voxket-widget-root .text-yellow-400{color:var(--color-yellow-400)}.voxket-widget-root .text-yellow-500{color:var(--color-yellow-500)}.voxket-widget-root .text-yellow-700{color:var(--color-yellow-700)}.voxket-widget-root .uppercase{text-transform:uppercase}.voxket-widget-root .italic{font-style:italic}.voxket-widget-root .underline{text-decoration-line:underline}.voxket-widget-root .underline-offset-4{text-underline-offset:4px}.voxket-widget-root .placeholder-gray-400::-moz-placeholder{color:var(--color-gray-400)}.voxket-widget-root .placeholder-gray-400::placeholder{color:var(--color-gray-400)}.voxket-widget-root .placeholder-gray-500::-moz-placeholder{color:var(--color-gray-500)}.voxket-widget-root .placeholder-gray-500::placeholder{color:var(--color-gray-500)}.voxket-widget-root .opacity-0{opacity:0}.voxket-widget-root .opacity-15{opacity:.15}.voxket-widget-root .opacity-20{opacity:.2}.voxket-widget-root .opacity-30{opacity:.3}.voxket-widget-root .opacity-40{opacity:.4}.voxket-widget-root .opacity-50{opacity:.5}.voxket-widget-root .opacity-60{opacity:.6}.voxket-widget-root .opacity-70{opacity:.7}.voxket-widget-root .opacity-80{opacity:.8}.voxket-widget-root .opacity-100{opacity:1}.voxket-widget-root .shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .\\!ring-0{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}.voxket-widget-root .shadow-black\\/40{--tw-shadow-color:#0006}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .shadow-black\\/40{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-black)40%,transparent)var(--tw-shadow-alpha),transparent)}}.voxket-widget-root .outline-hidden{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.voxket-widget-root .outline-hidden{outline-offset:2px;outline:2px solid #0000}}.voxket-widget-root .outline{outline-style:var(--tw-outline-style);outline-width:1px}.voxket-widget-root .blur-2xl{--tw-blur:blur(var(--blur-2xl));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,)}.voxket-widget-root .blur-sm{--tw-blur:blur(var(--blur-sm));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,)}.voxket-widget-root .blur-xl{--tw-blur:blur(var(--blur-xl));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,)}.voxket-widget-root .\\!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,)!important}.voxket-widget-root .backdrop-blur-lg{--tw-backdrop-blur:blur(var(--blur-lg));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.voxket-widget-root .backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.voxket-widget-root .backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.voxket-widget-root .transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,visibility,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.voxket-widget-root .transition-\\[color\\, .voxket-widget-root border\\, .voxket-widget-root background-color\\]{transition-property:color,border,background-color;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.voxket-widget-root .transition-\\[height\\]{transition-property:height;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.voxket-widget-root .transition-\\[opacity\\, .voxket-widget-root translate\\]{transition-property:opacity,translate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.voxket-widget-root .transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.voxket-widget-root .transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.voxket-widget-root .transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.voxket-widget-root .delay-200{transition-delay:.2s}.voxket-widget-root .duration-150{--tw-duration:.15s;transition-duration:.15s}.voxket-widget-root .duration-200{--tw-duration:.2s;transition-duration:.2s}.voxket-widget-root .duration-250{--tw-duration:.25s;transition-duration:.25s}.voxket-widget-root .duration-300{--tw-duration:.3s;transition-duration:.3s}.voxket-widget-root .duration-700{--tw-duration:.7s;transition-duration:.7s}.voxket-widget-root .ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.voxket-widget-root .ease-linear{--tw-ease:linear;transition-timing-function:linear}.voxket-widget-root .ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.voxket-widget-root .contain-layout{--tw-contain-layout:layout;contain:var(--tw-contain-size,)var(--tw-contain-layout,)var(--tw-contain-paint,)var(--tw-contain-style,)}.voxket-widget-root .\\!outline-none{--tw-outline-style:none!important;outline-style:none!important}.voxket-widget-root .outline-none{--tw-outline-style:none;outline-style:none}.voxket-widget-root .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}@media (hover:hover){.voxket-widget-root .group-hover\\:scale-\\[1\\.02\\]:is(:where(.group):hover *){scale:1.02}.voxket-widget-root .group-hover\\:opacity-100:is(:where(.group):hover *){opacity:1}}.voxket-widget-root .group-data-\\[state\\=off\\]\\/track\\:bg-white:is(:where(.group\\/track)[data-state=off] *),.voxket-widget-root .group-data-\\[state\\=on\\]\\/track\\:bg-white:is(:where(.group\\/track)[data-state=on] *){background-color:var(--color-white)}.voxket-widget-root .focus-within\\:border-blue-500\\/50:focus-within{border-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .focus-within\\:border-blue-500\\/50:focus-within{border-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.voxket-widget-root .focus-within\\:shadow-lg:focus-within{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .focus-within\\:ring-2:focus-within{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .focus-within\\:ring-blue-500\\/30:focus-within{--tw-ring-color:#3080ff4d}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .focus-within\\:ring-blue-500\\/30:focus-within{--tw-ring-color:color-mix(in oklab,var(--color-blue-500)30%,transparent)}}@media (hover:hover){.voxket-widget-root .hover\\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.voxket-widget-root .hover\\:border-gray-300:hover{border-color:var(--color-gray-300)}.voxket-widget-root .hover\\:bg-\\[\\#2563EB\\]:hover{background-color:#2563eb}.voxket-widget-root .hover\\:bg-black\\/10:hover{background-color:#0000001a}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .hover\\:bg-black\\/10:hover{background-color:color-mix(in oklab,var(--color-black)10%,transparent)}}.voxket-widget-root .hover\\:bg-blue-50:hover{background-color:var(--color-blue-50)}.voxket-widget-root .hover\\:bg-blue-600:hover{background-color:var(--color-blue-600)}.voxket-widget-root .hover\\:bg-blue-700:hover{background-color:var(--color-blue-700)}.voxket-widget-root .hover\\:bg-gray-50:hover{background-color:var(--color-gray-50)}.voxket-widget-root .hover\\:bg-gray-100:hover{background-color:var(--color-gray-100)}.voxket-widget-root .hover\\:bg-gray-200:hover{background-color:var(--color-gray-200)}.voxket-widget-root .hover\\:bg-gray-300:hover{background-color:var(--color-gray-300)}.voxket-widget-root .hover\\:bg-gray-600:hover{background-color:var(--color-gray-600)}.voxket-widget-root .hover\\:bg-gray-600\\/60:hover{background-color:#4a556599}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .hover\\:bg-gray-600\\/60:hover{background-color:color-mix(in oklab,var(--color-gray-600)60%,transparent)}}.voxket-widget-root .hover\\:bg-gray-700:hover{background-color:var(--color-gray-700)}.voxket-widget-root .hover\\:bg-gray-700\\/50:hover{background-color:#36415380}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .hover\\:bg-gray-700\\/50:hover{background-color:color-mix(in oklab,var(--color-gray-700)50%,transparent)}}.voxket-widget-root .hover\\:bg-gray-800:hover{background-color:var(--color-gray-800)}.voxket-widget-root .hover\\:bg-green-600:hover{background-color:var(--color-green-600)}.voxket-widget-root .hover\\:bg-green-700:hover{background-color:var(--color-green-700)}.voxket-widget-root .hover\\:bg-purple-600:hover{background-color:var(--color-purple-600)}.voxket-widget-root .hover\\:bg-red-100:hover{background-color:var(--color-red-100)}.voxket-widget-root .hover\\:bg-red-600:hover{background-color:var(--color-red-600)}.voxket-widget-root .hover\\:bg-red-700:hover{background-color:var(--color-red-700)}.voxket-widget-root .hover\\:bg-red-800\\/30:hover{background-color:#9f07124d}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .hover\\:bg-red-800\\/30:hover{background-color:color-mix(in oklab,var(--color-red-800)30%,transparent)}}.voxket-widget-root .hover\\:bg-white:hover{background-color:var(--color-white)}.voxket-widget-root .hover\\:bg-white\\/30:hover{background-color:#ffffff4d}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .hover\\:bg-white\\/30:hover{background-color:color-mix(in oklab,var(--color-white)30%,transparent)}}.voxket-widget-root .hover\\:from-\\[\\#2563EB\\]:hover{--tw-gradient-from:#2563eb;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .hover\\:from-blue-600:hover{--tw-gradient-from:var(--color-blue-600);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .hover\\:to-\\[\\#7C3AED\\]:hover{--tw-gradient-to:#7c3aed;--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .hover\\:to-purple-700:hover{--tw-gradient-to:var(--color-purple-700);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position),var(--tw-gradient-from)var(--tw-gradient-from-position),var(--tw-gradient-to)var(--tw-gradient-to-position))}.voxket-widget-root .hover\\:text-blue-300:hover{color:var(--color-blue-300)}.voxket-widget-root .hover\\:text-blue-800:hover{color:var(--color-blue-800)}.voxket-widget-root .hover\\:text-blue-900:hover{color:var(--color-blue-900)}.voxket-widget-root .hover\\:text-gray-200:hover{color:var(--color-gray-200)}.voxket-widget-root .hover\\:text-gray-300:hover{color:var(--color-gray-300)}.voxket-widget-root .hover\\:text-gray-700:hover{color:var(--color-gray-700)}.voxket-widget-root .hover\\:text-gray-800:hover{color:var(--color-gray-800)}.voxket-widget-root .hover\\:text-white:hover{color:var(--color-white)}.voxket-widget-root .hover\\:underline:hover{text-decoration-line:underline}.voxket-widget-root .hover\\:opacity-80:hover{opacity:.8}.voxket-widget-root .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .hover\\:shadow-xl:hover{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.voxket-widget-root .focus\\:border-blue-500:focus{border-color:var(--color-blue-500)}.voxket-widget-root .focus\\:ring-1:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .focus\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .focus\\:ring-blue-400\\/40:focus{--tw-ring-color:#54a2ff66}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root .focus\\:ring-blue-400\\/40:focus{--tw-ring-color:color-mix(in oklab,var(--color-blue-400)40%,transparent)}}.voxket-widget-root .focus\\:ring-blue-500:focus{--tw-ring-color:var(--color-blue-500)}.voxket-widget-root .focus\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.voxket-widget-root .focus\\:ring-offset-gray-900:focus{--tw-ring-offset-color:var(--color-gray-900)}.voxket-widget-root .focus\\:ring-offset-white:focus{--tw-ring-offset-color:var(--color-white)}.voxket-widget-root .focus\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.voxket-widget-root .focus-visible\\:ring-\\[3px\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .disabled\\:pointer-events-none:disabled{pointer-events:none}.voxket-widget-root .disabled\\:cursor-not-allowed:disabled{cursor:not-allowed}.voxket-widget-root .disabled\\:bg-gray-300:disabled{background-color:var(--color-gray-300)}.voxket-widget-root .disabled\\:bg-gray-600:disabled{background-color:var(--color-gray-600)}.voxket-widget-root .disabled\\:opacity-50:disabled{opacity:.5}.voxket-widget-root .disabled\\:opacity-70:disabled{opacity:.7}.voxket-widget-root .has-\\[\\>svg\\]\\:grid-cols-\\[calc\\(var\\(--spacing\\)\\*4\\)_1fr\\]:has(>svg){grid-template-columns:calc(var(--spacing)*4)1fr}.voxket-widget-root .has-\\[\\>svg\\]\\:gap-x-3:has(>svg){-moz-column-gap:calc(var(--spacing)*3);column-gap:calc(var(--spacing)*3)}.voxket-widget-root .has-\\[\\>svg\\]\\:px-2\\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.voxket-widget-root .has-\\[\\>svg\\]\\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.voxket-widget-root .has-\\[\\>svg\\]\\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.voxket-widget-root .aria-invalid\\:border-0[aria-invalid=true]{border-style:var(--tw-border-style);border-width:0}.voxket-widget-root .aria-invalid\\:ring-0[aria-invalid=true]{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.voxket-widget-root .data-\\[disabled\\]\\:pointer-events-none[data-disabled]{pointer-events:none}.voxket-widget-root .data-\\[disabled\\]\\:opacity-50[data-disabled]{opacity:.5}.voxket-widget-root .data-\\[lk-highlighted\\=true\\]\\:bg-\\[\\#5c64f6\\][data-lk-highlighted=true]{background-color:#5c64f6}.voxket-widget-root .data-\\[lk-muted\\=true\\]\\:bg-\\[\\#222222\\][data-lk-muted=true]{background-color:#222}.voxket-widget-root .data-\\[side\\=bottom\\]\\:translate-y-1[data-side=bottom]{--tw-translate-y:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.voxket-widget-root .data-\\[side\\=left\\]\\:-translate-x-1[data-side=left]{--tw-translate-x:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.voxket-widget-root .data-\\[side\\=right\\]\\:translate-x-1[data-side=right]{--tw-translate-x:calc(var(--spacing)*1);translate:var(--tw-translate-x)var(--tw-translate-y)}.voxket-widget-root .data-\\[side\\=top\\]\\:-translate-y-1[data-side=top]{--tw-translate-y:calc(var(--spacing)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.voxket-widget-root .data-\\[size\\=default\\]\\:h-9[data-size=default]{height:calc(var(--spacing)*9)}.voxket-widget-root .data-\\[size\\=sm\\]\\:h-8[data-size=sm]{height:calc(var(--spacing)*8)}.voxket-widget-root :is(.\\*\\:data-\\[slot\\=select-value\\]\\:line-clamp-1>*)[data-slot=select-value]{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.voxket-widget-root :is(.\\*\\:data-\\[slot\\=select-value\\]\\:flex>*)[data-slot=select-value]{display:flex}.voxket-widget-root :is(.\\*\\:data-\\[slot\\=select-value\\]\\:items-center>*)[data-slot=select-value]{align-items:center}.voxket-widget-root :is(.\\*\\:data-\\[slot\\=select-value\\]\\:gap-2>*)[data-slot=select-value]{gap:calc(var(--spacing)*2)}@media (min-width:40rem){.voxket-widget-root .sm\\:left-0{left:calc(var(--spacing)*0)}.voxket-widget-root .sm\\:h-24{height:calc(var(--spacing)*24)}.voxket-widget-root .sm\\:w-36{width:calc(var(--spacing)*36)}.voxket-widget-root .sm\\:max-w-sm{max-width:var(--container-sm)}}@media (min-width:48rem){.voxket-widget-root .md\\:px-0{padding-inline:calc(var(--spacing)*0)}}@media (min-width:64rem){.voxket-widget-root .lg\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@media (prefers-color-scheme:dark){.voxket-widget-root .dark\\:border-gray-600{border-color:var(--color-gray-600)}.voxket-widget-root .dark\\:border-gray-700{border-color:var(--color-gray-700)}.voxket-widget-root .dark\\:bg-gray-900{background-color:var(--color-gray-900)}.voxket-widget-root .dark\\:bg-white{background-color:var(--color-white)}.voxket-widget-root .dark\\:aria-invalid\\:ring-0[aria-invalid=true]{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}}.voxket-widget-root .\\[\\&_p\\]\\:leading-relaxed p{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.voxket-widget-root .\\[\\&_svg\\]\\:pointer-events-none svg{pointer-events:none}.voxket-widget-root .\\[\\&_svg\\]\\:shrink-0 svg{flex-shrink:0}.voxket-widget-root .\\[\\&_svg\\:not\\(\\[class\\*\\=\\'size-\\'\\]\\)\\]\\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.voxket-widget-root :is(.\\*\\:\\[span\\]\\:last\\:flex>*):is(span):last-child{display:flex}.voxket-widget-root :is(.\\*\\:\\[span\\]\\:last\\:items-center>*):is(span):last-child{align-items:center}.voxket-widget-root :is(.\\*\\:\\[span\\]\\:last\\:gap-2>*):is(span):last-child{gap:calc(var(--spacing)*2)}.voxket-widget-root .\\[\\&\\>svg\\]\\:size-4>svg{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.voxket-widget-root .\\[\\&\\>svg\\]\\:translate-y-0\\.5>svg{--tw-translate-y:calc(var(--spacing)*.5);translate:var(--tw-translate-x)var(--tw-translate-y)}.voxket-widget-root .\\[\\&\\>svg\\]\\:text-current>svg{color:currentColor}.voxket-widget-root .\\[\\&\\>video\\]\\:h-\\[90px\\]>video{height:90px}.voxket-widget-root .\\[\\&\\>video\\]\\:w-auto>video{width:auto}@layer theme{:root,.voxket-widget-root :host{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-500:oklch(70.5% .213 47.604);--color-yellow-50:oklch(98.7% .026 102.212);--color-yellow-200:oklch(94.5% .129 101.54);--color-yellow-400:oklch(85.2% .199 91.936);--color-yellow-500:oklch(79.5% .184 86.047);--color-yellow-700:oklch(55.4% .135 66.442);--color-green-50:oklch(98.2% .018 155.826);--color-green-200:oklch(92.5% .084 155.995);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-blue-50:oklch(97% .014 254.604);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-600:oklch(51.1% .262 276.966);--color-purple-500:oklch(62.7% .265 303.9);--color-purple-600:oklch(55.8% .288 302.321);--color-purple-700:oklch(49.6% .265 301.924);--color-pink-500:oklch(65.6% .241 354.308);--color-pink-600:oklch(59.2% .249 .584);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-800:oklch(27.8% .033 256.848);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5/2.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wider:.05em;--leading-tight:1.25;--leading-snug:1.375;--leading-relaxed:1.625;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--radius-4xl:2rem;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--animate-bounce:bounce 1s infinite;--blur-sm:8px;--blur-md:12px;--blur-lg:16px;--blur-xl:24px;--blur-2xl:40px;--aspect-video:16/9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,.voxket-widget-root :after,.voxket-widget-root :before,.voxket-widget-root ::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}.voxket-widget-root ::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,.voxket-widget-root :host{-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}.voxket-widget-root hr{height:0;color:inherit;border-top-width:1px}.voxket-widget-root abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.voxket-widget-root h1,.voxket-widget-root h2,.voxket-widget-root h3,.voxket-widget-root h4,.voxket-widget-root h5,.voxket-widget-root h6{font-size:inherit;font-weight:inherit}.voxket-widget-root a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}.voxket-widget-root b,.voxket-widget-root strong{font-weight:bolder}.voxket-widget-root code,.voxket-widget-root kbd,.voxket-widget-root samp,.voxket-widget-root pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}.voxket-widget-root small{font-size:80%}.voxket-widget-root sub,.voxket-widget-root sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}.voxket-widget-root sub{bottom:-.25em}.voxket-widget-root sup{top:-.5em}.voxket-widget-root table{text-indent:0;border-color:inherit;border-collapse:collapse}.voxket-widget-root :-moz-focusring{outline:auto}.voxket-widget-root progress{vertical-align:baseline}.voxket-widget-root summary{display:list-item}.voxket-widget-root ol,.voxket-widget-root ul,.voxket-widget-root menu{list-style:none}.voxket-widget-root img,.voxket-widget-root svg,.voxket-widget-root video,.voxket-widget-root canvas,.voxket-widget-root audio,.voxket-widget-root iframe,.voxket-widget-root embed,.voxket-widget-root object{vertical-align:middle;display:block}.voxket-widget-root img,.voxket-widget-root video{max-width:100%;height:auto}.voxket-widget-root button,.voxket-widget-root input,.voxket-widget-root select,.voxket-widget-root optgroup,.voxket-widget-root textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}.voxket-widget-root ::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}.voxket-widget-root :where(select:is([multiple],.voxket-widget-root [size])) optgroup{font-weight:bolder}.voxket-widget-root :where(select:is([multiple],.voxket-widget-root [size])) optgroup option{padding-inline-start:20px}.voxket-widget-root ::file-selector-button{margin-inline-end:4px}.voxket-widget-root ::-moz-placeholder{opacity:1}.voxket-widget-root ::placeholder{opacity:1}@supports (not (-webkit-appearance:-apple-pay-button)) or (contain-intrinsic-size:1px){.voxket-widget-root ::-moz-placeholder{color:currentColor}.voxket-widget-root ::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){.voxket-widget-root ::-moz-placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}.voxket-widget-root ::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}.voxket-widget-root textarea{resize:vertical}.voxket-widget-root ::-webkit-search-decoration{-webkit-appearance:none}.voxket-widget-root ::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}.voxket-widget-root ::-webkit-datetime-edit{display:inline-flex}.voxket-widget-root ::-webkit-datetime-edit-fields-wrapper{padding:0}.voxket-widget-root ::-webkit-datetime-edit{padding-block:0}.voxket-widget-root ::-webkit-datetime-edit-year-field{padding-block:0}.voxket-widget-root ::-webkit-datetime-edit-month-field{padding-block:0}.voxket-widget-root ::-webkit-datetime-edit-day-field{padding-block:0}.voxket-widget-root ::-webkit-datetime-edit-hour-field{padding-block:0}.voxket-widget-root ::-webkit-datetime-edit-minute-field{padding-block:0}.voxket-widget-root ::-webkit-datetime-edit-second-field{padding-block:0}.voxket-widget-root ::-webkit-datetime-edit-millisecond-field{padding-block:0}.voxket-widget-root ::-webkit-datetime-edit-meridiem-field{padding-block:0}.voxket-widget-root :-moz-ui-invalid{box-shadow:none}.voxket-widget-root button,.voxket-widget-root input:where([type=button],.voxket-widget-root [type=reset],.voxket-widget-root [type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}.voxket-widget-root ::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}.voxket-widget-root ::-webkit-inner-spin-button{height:auto}.voxket-widget-root ::-webkit-outer-spin-button{height:auto}.voxket-widget-root [hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components,utilities;.voxket-widget-root ::-webkit-scrollbar{display:none}.voxket-widget-root .scrollbar-hide{scrollbar-width:none;-ms-overflow-style:none}.voxket-widget-root .scrollbar-hide::-webkit-scrollbar{display:none}.voxket-widget-root .chat-scrollable{scrollbar-width:thin;scrollbar-color:#9b9b9b4d transparent;flex-direction:column;display:flex}.voxket-widget-root .chat-scrollable::-webkit-scrollbar{width:6px;display:block}.voxket-widget-root .chat-scrollable::-webkit-scrollbar-track{background:0 0}.voxket-widget-root .chat-scrollable::-webkit-scrollbar-thumb{background-color:#9b9b9b4d;border-radius:3px}.voxket-widget-root .chat-scrollable::-webkit-scrollbar-thumb:hover{background-color:#9b9b9b80}.voxket-widget-root .chat-messages-container{flex-direction:column;justify-content:flex-end;width:100%;max-width:none;min-height:100%;display:flex}@keyframes pulse-ring{0%{opacity:1;transform:scale(1)}50%{opacity:.6;transform:scale(1.2)}to{opacity:0;transform:scale(1.4)}}@keyframes glow{0%,to{box-shadow:0 0 20px #3b82f680}50%{box-shadow:0 0 30px #3b82f6cc}}.voxket-widget-root .pulse-ring{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse-ring}.voxket-widget-root .mic-glow{animation:2s ease-in-out infinite glow}.voxket-widget-root{color-scheme:light dark;color:#ffffffde;border-radius:\"2xl\";font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;background-color:#0000;border-radius:1rem;font-family:system-ui,Avenir,Helvetica,Arial,sans-serif;font-weight:400;line-height:1.5}.voxket-widget-root.theme-light{color:#000000de}.voxket-widget-root.theme-dark,.voxket-widget-root.theme-vox{color:#ffffffde}.voxket-widget-root .animate-spin{animation:1s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.voxket-widget-root button{cursor:pointer}@property --tw-translate-x{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\"*\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\"*\";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-space-x-reverse{syntax:\"*\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:\"*\";inherits:false}@property --tw-gradient-from{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:\"<color>\";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:\"*\";inherits:false}@property --tw-gradient-via-stops{syntax:\"*\";inherits:false}@property --tw-gradient-from-position{syntax:\"<length-percentage>\";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:\"<length-percentage>\";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:\"<length-percentage>\";inherits:false;initial-value:100%}@property --tw-leading{syntax:\"*\";inherits:false}@property --tw-font-weight{syntax:\"*\";inherits:false}@property --tw-tracking{syntax:\"*\";inherits:false}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:\"*\";inherits:false;initial-value:solid}@property --tw-blur{syntax:\"*\";inherits:false}@property --tw-brightness{syntax:\"*\";inherits:false}@property --tw-contrast{syntax:\"*\";inherits:false}@property --tw-grayscale{syntax:\"*\";inherits:false}@property --tw-hue-rotate{syntax:\"*\";inherits:false}@property --tw-invert{syntax:\"*\";inherits:false}@property --tw-opacity{syntax:\"*\";inherits:false}@property --tw-saturate{syntax:\"*\";inherits:false}@property --tw-sepia{syntax:\"*\";inherits:false}@property --tw-drop-shadow{syntax:\"*\";inherits:false}@property --tw-drop-shadow-color{syntax:\"*\";inherits:false}@property --tw-drop-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:\"*\";inherits:false}@property --tw-backdrop-blur{syntax:\"*\";inherits:false}@property --tw-backdrop-brightness{syntax:\"*\";inherits:false}@property --tw-backdrop-contrast{syntax:\"*\";inherits:false}@property --tw-backdrop-grayscale{syntax:\"*\";inherits:false}@property --tw-backdrop-hue-rotate{syntax:\"*\";inherits:false}@property --tw-backdrop-invert{syntax:\"*\";inherits:false}@property --tw-backdrop-opacity{syntax:\"*\";inherits:false}@property --tw-backdrop-saturate{syntax:\"*\";inherits:false}@property --tw-backdrop-sepia{syntax:\"*\";inherits:false}@property --tw-duration{syntax:\"*\";inherits:false}@property --tw-ease{syntax:\"*\";inherits:false}@property --tw-contain-size{syntax:\"*\";inherits:false}@property --tw-contain-layout{syntax:\"*\";inherits:false}@property --tw-contain-paint{syntax:\"*\";inherits:false}@property --tw-contain-style{syntax:\"*\";inherits:false}@property --tw-scale-x{syntax:\"*\";inherits:false;initial-value:1}@property --tw-scale-y{syntax:\"*\";inherits:false;initial-value:1}@property --tw-scale-z{syntax:\"*\";inherits:false;initial-value:1}@keyframes pulse{50%{opacity:.5}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}\n";
12
-
13
- const head = document.head || document.getElementsByTagName('head')[0];
14
- if (head.firstChild) {
15
- head.insertBefore(style, head.firstChild);
16
- } else {
17
- head.appendChild(style);
18
- }
19
- })();
20
-
21
1
  "use strict";var Vg=Object.defineProperty;var zg=(e,t,n)=>t in e?Vg(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var lt=(e,t,n)=>zg(e,typeof t!="symbol"?t+"":t,n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const A=require("react"),h=require("react/jsx-runtime"),se=require("livekit-client"),Ft=require("@livekit/components-react"),Ge=require("lucide-react"),Ba=require("clsx"),Ug=require("@emotion/styled");require("@emotion/react");const Hg=require("react-dom/client");function Wg(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const D=Wg(A),ja=A.createContext({});function $a(e){const t=A.useRef(null);return t.current===null&&(t.current=e()),t.current}const Va=typeof window<"u",yf=Va?A.useLayoutEffect:A.useEffect,So=A.createContext(null);function za(e,t){e.indexOf(t)===-1&&e.push(t)}function Ua(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const yn=(e,t,n)=>n>t?t:n<e?e:n;function Zs(e,t){return t?`${e}. For more information and steps for solving, visit https://motion.dev/troubleshooting/${t}`:e}let Nr=()=>{},xn=()=>{};process.env.NODE_ENV!=="production"&&(Nr=(e,t,n)=>{!e&&typeof console<"u"&&console.warn(Zs(t,n))},xn=(e,t,n)=>{if(!e)throw new Error(Zs(t,n))});const wn={},xf=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function wf(e){return typeof e=="object"&&e!==null}const vf=e=>/^0[^.\s]+$/u.test(e);function Ha(e){let t;return()=>(t===void 0&&(t=e()),t)}const Zt=e=>e,Gg=(e,t)=>n=>t(e(n)),hi=(...e)=>e.reduce(Gg),ni=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class Wa{constructor(){this.subscriptions=[]}add(t){return za(this.subscriptions,t),()=>Ua(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o<i;o++){const s=this.subscriptions[o];s&&s(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const en=e=>e*1e3,cn=e=>e/1e3;function Ef(e,t){return t?e*(1e3/t):0}const mc=new Set;function Ga(e,t,n){e||mc.has(t)||(console.warn(Zs(t,n)),mc.add(t))}const kf=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Kg=1e-7,qg=12;function Yg(e,t,n,r,i){let o,s,a=0;do s=t+(n-t)/2,o=kf(s,r,i)-e,o>0?n=s:t=s;while(Math.abs(o)>Kg&&++a<qg);return s}function pi(e,t,n,r){if(e===t&&n===r)return Zt;const i=o=>Yg(o,0,1,e,n);return o=>o===0||o===1?o:kf(i(o),t,r)}const Sf=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,Cf=e=>t=>1-e(1-t),_f=pi(.33,1.53,.69,.99),Ka=Cf(_f),Tf=Sf(Ka),Nf=e=>(e*=2)<1?.5*Ka(e):.5*(2-Math.pow(2,-10*(e-1))),qa=e=>1-Math.sin(Math.acos(e)),Af=Cf(qa),Rf=Sf(qa),Zg=pi(.42,0,1,1),Xg=pi(0,0,.58,1),Mf=pi(.42,0,.58,1),Qg=e=>Array.isArray(e)&&typeof e[0]!="number",If=e=>Array.isArray(e)&&typeof e[0]=="number",gc={linear:Zt,easeIn:Zg,easeInOut:Mf,easeOut:Xg,circIn:qa,circInOut:Rf,circOut:Af,backIn:Ka,backInOut:Tf,backOut:_f,anticipate:Nf},Jg=e=>typeof e=="string",bc=e=>{if(If(e)){xn(e.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[t,n,r,i]=e;return pi(t,n,r,i)}else if(Jg(e))return xn(gc[e]!==void 0,`Invalid easing type '${e}'`,"invalid-easing-type"),gc[e];return e},Ri=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function eb(e,t){let n=new Set,r=new Set,i=!1,o=!1;const s=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){s.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,f=!1)=>{const g=f&&i?n:r;return d&&s.add(u),g.has(u)||g.add(u),u},cancel:u=>{r.delete(u),s.delete(u)},process:u=>{if(a=u,i){o=!0;return}i=!0,[n,r]=[r,n],n.forEach(l),n.clear(),i=!1,o&&(o=!1,c.process(u))}};return c}const tb=40;function Of(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},o=()=>n=!0,s=Ri.reduce((v,_)=>(v[_]=eb(o),v),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:f,render:p,postRender:g}=s,m=()=>{const v=wn.useManualTiming?i.timestamp:performance.now();n=!1,wn.useManualTiming||(i.delta=r?1e3/60:Math.max(Math.min(v-i.timestamp,tb),1)),i.timestamp=v,i.isProcessing=!0,a.process(i),l.process(i),c.process(i),u.process(i),d.process(i),f.process(i),p.process(i),g.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(m))},x=()=>{n=!0,r=!0,i.isProcessing||e(m)};return{schedule:Ri.reduce((v,_)=>{const k=s[_];return v[_]=(C,M=!1,N=!1)=>(n||x(),k.schedule(C,M,N)),v},{}),cancel:v=>{for(let _=0;_<Ri.length;_++)s[Ri[_]].cancel(v)},state:i,steps:s}}const{schedule:at,cancel:Mn,state:Tt,steps:es}=Of(typeof requestAnimationFrame<"u"?requestAnimationFrame:Zt,!0);let Xi;function nb(){Xi=void 0}const Bt={now:()=>(Xi===void 0&&Bt.set(Tt.isProcessing||wn.useManualTiming?Tt.timestamp:performance.now()),Xi),set:e=>{Xi=e,queueMicrotask(nb)}},Pf=e=>t=>typeof t=="string"&&t.startsWith(e),Ya=Pf("--"),rb=Pf("var(--"),Za=e=>rb(e)?ib.test(e.split("/*")[0].trim()):!1,ib=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ar={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},ri={...Ar,transform:e=>yn(0,1,e)},Mi={...Ar,default:1},qr=e=>Math.round(e*1e5)/1e5,Xa=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function ob(e){return e==null}const sb=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Qa=(e,t)=>n=>!!(typeof n=="string"&&sb.test(n)&&n.startsWith(e)||t&&!ob(n)&&Object.prototype.hasOwnProperty.call(n,t)),Df=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,o,s,a]=r.match(Xa);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(s),alpha:a!==void 0?parseFloat(a):1}},ab=e=>yn(0,255,e),ts={...Ar,transform:e=>Math.round(ab(e))},Un={test:Qa("rgb","red"),parse:Df("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+ts.transform(e)+", "+ts.transform(t)+", "+ts.transform(n)+", "+qr(ri.transform(r))+")"};function lb(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const Xs={test:Qa("#"),parse:lb,transform:Un.transform},mi=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),An=mi("deg"),un=mi("%"),ve=mi("px"),cb=mi("vh"),ub=mi("vw"),yc={...un,parse:e=>un.parse(e)/100,transform:e=>un.transform(e*100)},pr={test:Qa("hsl","hue"),parse:Df("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+un.transform(qr(t))+", "+un.transform(qr(n))+", "+qr(ri.transform(r))+")"},wt={test:e=>Un.test(e)||Xs.test(e)||pr.test(e),parse:e=>Un.test(e)?Un.parse(e):pr.test(e)?pr.parse(e):Xs.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Un.transform(e):pr.transform(e),getAnimatableNone:e=>{const t=wt.parse(e);return t.alpha=0,wt.transform(t)}},db=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function fb(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Xa))==null?void 0:t.length)||0)+(((n=e.match(db))==null?void 0:n.length)||0)>0}const Lf="number",Ff="color",hb="var",pb="var(",xc="${}",mb=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function ii(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let o=0;const a=t.replace(mb,l=>(wt.test(l)?(r.color.push(o),i.push(Ff),n.push(wt.parse(l))):l.startsWith(pb)?(r.var.push(o),i.push(hb),n.push(l)):(r.number.push(o),i.push(Lf),n.push(parseFloat(l))),++o,xc)).split(xc);return{values:n,split:a,indexes:r,types:i}}function Bf(e){return ii(e).values}function jf(e){const{split:t,types:n}=ii(e),r=t.length;return i=>{let o="";for(let s=0;s<r;s++)if(o+=t[s],i[s]!==void 0){const a=n[s];a===Lf?o+=qr(i[s]):a===Ff?o+=wt.transform(i[s]):o+=i[s]}return o}}const gb=e=>typeof e=="number"?0:wt.test(e)?wt.getAnimatableNone(e):e;function bb(e){const t=Bf(e);return jf(e)(t.map(gb))}const In={test:fb,parse:Bf,createTransformer:jf,getAnimatableNone:bb};function ns(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function yb({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,s=0;if(!t)i=o=s=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=ns(l,a,e+1/3),o=ns(l,a,e),s=ns(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(s*255),alpha:r}}function lo(e,t){return n=>n>0?t:e}const ut=(e,t,n)=>e+(t-e)*n,rs=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},xb=[Xs,Un,pr],wb=e=>xb.find(t=>t.test(e));function wc(e){const t=wb(e);if(Nr(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!t)return!1;let n=t.parse(e);return t===pr&&(n=yb(n)),n}const vc=(e,t)=>{const n=wc(e),r=wc(t);if(!n||!r)return lo(e,t);const i={...n};return o=>(i.red=rs(n.red,r.red,o),i.green=rs(n.green,r.green,o),i.blue=rs(n.blue,r.blue,o),i.alpha=ut(n.alpha,r.alpha,o),Un.transform(i))},Qs=new Set(["none","hidden"]);function vb(e,t){return Qs.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function Eb(e,t){return n=>ut(e,t,n)}function Ja(e){return typeof e=="number"?Eb:typeof e=="string"?Za(e)?lo:wt.test(e)?vc:Cb:Array.isArray(e)?$f:typeof e=="object"?wt.test(e)?vc:kb:lo}function $f(e,t){const n=[...e],r=n.length,i=e.map((o,s)=>Ja(o)(o,t[s]));return o=>{for(let s=0;s<r;s++)n[s]=i[s](o);return n}}function kb(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Ja(e[i])(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}}function Sb(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const o=t.types[i],s=e.indexes[o][r[o]],a=e.values[s]??0;n[i]=a,r[o]++}return n}const Cb=(e,t)=>{const n=In.createTransformer(t),r=ii(e),i=ii(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?Qs.has(e)&&!i.values.length||Qs.has(t)&&!r.values.length?vb(e,t):hi($f(Sb(r,i),i.values),n):(Nr(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),lo(e,t))};function Vf(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?ut(e,t,n):Ja(e)(e,t)}const _b=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>at.update(t,n),stop:()=>Mn(t),now:()=>Tt.isProcessing?Tt.timestamp:Bt.now()}},zf=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let o=0;o<i;o++)r+=Math.round(e(o/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},co=2e4;function el(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<co;)t+=n,r=e.next(t);return t>=co?1/0:t}function Tb(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(el(r),co);return{type:"keyframes",ease:o=>r.next(i*o).value/t,duration:cn(i)}}const Nb=5;function Uf(e,t,n){const r=Math.max(t-Nb,0);return Ef(n-e(r),t-r)}const ct={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},is=.001;function Ab({duration:e=ct.duration,bounce:t=ct.bounce,velocity:n=ct.velocity,mass:r=ct.mass}){let i,o;Nr(e<=en(ct.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let s=1-t;s=yn(ct.minDamping,ct.maxDamping,s),e=yn(ct.minDuration,ct.maxDuration,cn(e)),s<1?(i=c=>{const u=c*s,d=u*e,f=u-n,p=Js(c,s),g=Math.exp(-d);return is-f/p*g},o=c=>{const d=c*s*e,f=d*n+n,p=Math.pow(s,2)*Math.pow(c,2)*e,g=Math.exp(-d),m=Js(Math.pow(c,2),s);return(-i(c)+is>0?-1:1)*((f-p)*g)/m}):(i=c=>{const u=Math.exp(-c*e),d=(c-n)*e+1;return-is+u*d},o=c=>{const u=Math.exp(-c*e),d=(n-c)*(e*e);return u*d});const a=5/e,l=Mb(i,o,a);if(e=en(e),isNaN(l))return{stiffness:ct.stiffness,damping:ct.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:s*2*Math.sqrt(r*c),duration:e}}}const Rb=12;function Mb(e,t,n){let r=n;for(let i=1;i<Rb;i++)r=r-e(r)/t(r);return r}function Js(e,t){return e*Math.sqrt(1-t*t)}const Ib=["duration","bounce"],Ob=["stiffness","damping","mass"];function Ec(e,t){return t.some(n=>e[n]!==void 0)}function Pb(e){let t={velocity:ct.velocity,stiffness:ct.stiffness,damping:ct.damping,mass:ct.mass,isResolvedFromDuration:!1,...e};if(!Ec(e,Ob)&&Ec(e,Ib))if(e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,o=2*yn(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:ct.mass,stiffness:i,damping:o}}else{const n=Ab(e);t={...t,...n,mass:ct.mass},t.isResolvedFromDuration=!0}return t}function uo(e=ct.visualDuration,t=ct.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const o=n.keyframes[0],s=n.keyframes[n.keyframes.length-1],a={done:!1,value:o},{stiffness:l,damping:c,mass:u,duration:d,velocity:f,isResolvedFromDuration:p}=Pb({...n,velocity:-cn(n.velocity||0)}),g=f||0,m=c/(2*Math.sqrt(l*u)),x=s-o,y=cn(Math.sqrt(l/u)),E=Math.abs(x)<5;r||(r=E?ct.restSpeed.granular:ct.restSpeed.default),i||(i=E?ct.restDelta.granular:ct.restDelta.default);let v;if(m<1){const k=Js(y,m);v=C=>{const M=Math.exp(-m*y*C);return s-M*((g+m*y*x)/k*Math.sin(k*C)+x*Math.cos(k*C))}}else if(m===1)v=k=>s-Math.exp(-y*k)*(x+(g+y*x)*k);else{const k=y*Math.sqrt(m*m-1);v=C=>{const M=Math.exp(-m*y*C),N=Math.min(k*C,300);return s-M*((g+m*y*x)*Math.sinh(N)+k*x*Math.cosh(N))/k}}const _={calculatedDuration:p&&d||null,next:k=>{const C=v(k);if(p)a.done=k>=d;else{let M=k===0?g:0;m<1&&(M=k===0?en(g):Uf(v,k,C));const N=Math.abs(M)<=r,I=Math.abs(s-C)<=i;a.done=N&&I}return a.value=a.done?s:C,a},toString:()=>{const k=Math.min(el(_),co),C=zf(M=>_.next(k*M).value,k,30);return k+"ms "+C},toTransition:()=>{}};return _}uo.applyToOptions=e=>{const t=Tb(e,100,uo);return e.ease=t.ease,e.duration=en(t.duration),e.type="keyframes",e};function ea({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:s,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],f={done:!1,value:d},p=N=>a!==void 0&&N<a||l!==void 0&&N>l,g=N=>a===void 0?l:l===void 0||Math.abs(a-N)<Math.abs(l-N)?a:l;let m=n*t;const x=d+m,y=s===void 0?x:s(x);y!==x&&(m=y-d);const E=N=>-m*Math.exp(-N/r),v=N=>y+E(N),_=N=>{const I=E(N),b=v(N);f.done=Math.abs(I)<=c,f.value=f.done?y:b};let k,C;const M=N=>{p(f.value)&&(k=N,C=uo({keyframes:[f.value,g(f.value)],velocity:Uf(v,N,f.value),damping:i,stiffness:o,restDelta:c,restSpeed:u}))};return M(0),{calculatedDuration:null,next:N=>{let I=!1;return!C&&k===void 0&&(I=!0,_(N),M(N)),k!==void 0&&N>=k?C.next(N-k):(!I&&_(N),f)}}}function Db(e,t,n){const r=[],i=n||wn.mix||Vf,o=e.length-1;for(let s=0;s<o;s++){let a=i(e[s],e[s+1]);if(t){const l=Array.isArray(t)?t[s]||Zt:t;a=hi(l,a)}r.push(a)}return r}function Lb(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const o=e.length;if(xn(o===t.length,"Both input and output ranges must be the same length","range-length"),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const s=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=Db(t,r,i),l=a.length,c=u=>{if(s&&u<e[0])return t[0];let d=0;if(l>1)for(;d<e.length-2&&!(u<e[d+1]);d++);const f=ni(e[d],e[d+1],u);return a[d](f)};return n?u=>c(yn(e[0],e[o-1],u)):c}function Fb(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=ni(0,t,r);e.push(ut(n,1,i))}}function Bb(e){const t=[0];return Fb(t,e.length-1),t}function jb(e,t){return e.map(n=>n*t)}function $b(e,t){return e.map(()=>t||Mf).splice(0,e.length-1)}function mr({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=Qg(r)?r.map(bc):bc(r),o={done:!1,value:t[0]},s=jb(n&&n.length===t.length?n:Bb(t),e),a=Lb(s,t,{ease:Array.isArray(i)?i:$b(t,i)});return{calculatedDuration:e,next:l=>(o.value=a(l),o.done=l>=e,o)}}const Vb=e=>e!==null;function tl(e,{repeat:t,repeatType:n="loop"},r,i=1){const o=e.filter(Vb),a=i<0||t&&n!=="loop"&&t%2===1?0:o.length-1;return!a||r===void 0?o[a]:r}const zb={decay:ea,inertia:ea,tween:mr,keyframes:mr,spring:uo};function Hf(e){typeof e.type=="string"&&(e.type=zb[e.type])}class nl{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const Ub=e=>e/100;class rl extends nl{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,i;const{motionValue:n}=this.options;n&&n.updatedAt!==Bt.now()&&this.tick(Bt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(r=this.options).onStop)==null||i.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;Hf(t);const{type:n=mr,repeat:r=0,repeatDelay:i=0,repeatType:o,velocity:s=0}=t;let{keyframes:a}=t;const l=n||mr;process.env.NODE_ENV!=="production"&&l!==mr&&xn(a.length<=2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${a}`,"spring-two-frames"),l!==mr&&typeof a[0]!="number"&&(this.mixKeyframes=hi(Ub,Vf(a[0],a[1])),a=[0,100]);const c=l({...t,keyframes:a});o==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-s})),c.calculatedDuration===null&&(c.calculatedDuration=el(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=c}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:o,mirroredGenerator:s,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:u,repeat:d,repeatType:f,repeatDelay:p,type:g,onUpdate:m,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const y=this.currentTime-c*(this.playbackSpeed>=0?1:-1),E=this.playbackSpeed>=0?y<0:y>i;this.currentTime=Math.max(y,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let v=this.currentTime,_=r;if(d){const N=Math.min(this.currentTime,i)/a;let I=Math.floor(N),b=N%1;!b&&N>=1&&(b=1),b===1&&I--,I=Math.min(I,d+1),!!(I%2)&&(f==="reverse"?(b=1-b,p&&(b-=p/a)):f==="mirror"&&(_=s)),v=yn(0,1,b)*a}const k=E?{done:!1,value:u[0]}:_.next(v);o&&(k.value=o(k.value));let{done:C}=k;!E&&l!==null&&(C=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const M=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return M&&g!==ea&&(k.value=tl(u,this.options,x,this.speed)),m&&m(k.value),M&&this.finish(),k}then(t,n){return this.finished.then(t,n)}get duration(){return cn(this.calculatedDuration)}get time(){return cn(this.currentTime)}set time(t){var n;t=en(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Bt.now());const n=this.playbackSpeed!==t;this.playbackSpeed=t,n&&(this.time=cn(this.currentTime))}play(){var i,o;if(this.isStopped)return;const{driver:t=_b,startTime:n}=this.options;this.driver||(this.driver=t(s=>this.tick(s))),(o=(i=this.options).onPlay)==null||o.call(i);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Bt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function Hb(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const Hn=e=>e*180/Math.PI,ta=e=>{const t=Hn(Math.atan2(e[1],e[0]));return na(t)},Wb={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:ta,rotateZ:ta,skewX:e=>Hn(Math.atan(e[1])),skewY:e=>Hn(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},na=e=>(e=e%360,e<0&&(e+=360),e),kc=ta,Sc=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Cc=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),Gb={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Sc,scaleY:Cc,scale:e=>(Sc(e)+Cc(e))/2,rotateX:e=>na(Hn(Math.atan2(e[6],e[5]))),rotateY:e=>na(Hn(Math.atan2(-e[2],e[0]))),rotateZ:kc,rotate:kc,skewX:e=>Hn(Math.atan(e[4])),skewY:e=>Hn(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function ra(e){return e.includes("scale")?1:0}function ia(e,t){if(!e||e==="none")return ra(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=Gb,i=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=Wb,i=a}if(!i)return ra(t);const o=r[t],s=i[1].split(",").map(qb);return typeof o=="function"?o(s):s[o]}const Kb=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return ia(n,t)};function qb(e){return parseFloat(e.trim())}const Rr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Mr=new Set(Rr),_c=e=>e===Ar||e===ve,Yb=new Set(["x","y","z"]),Zb=Rr.filter(e=>!Yb.has(e));function Xb(e){const t=[];return Zb.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const Gn={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>ia(t,"x"),y:(e,{transform:t})=>ia(t,"y")};Gn.translateX=Gn.x;Gn.translateY=Gn.y;const Kn=new Set;let oa=!1,sa=!1,aa=!1;function Wf(){if(sa){const e=Array.from(Kn).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=Xb(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([o,s])=>{var a;(a=r.getValue(o))==null||a.set(s)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}sa=!1,oa=!1,Kn.forEach(e=>e.complete(aa)),Kn.clear()}function Gf(){Kn.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(sa=!0)})}function Qb(){aa=!0,Gf(),Wf(),aa=!1}class il{constructor(t,n,r,i,o,s=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=o,this.isAsync=s}scheduleResolve(){this.state="scheduled",this.isAsync?(Kn.add(this),oa||(oa=!0,at.read(Gf),at.resolveKeyframes(Wf))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const o=i==null?void 0:i.get(),s=t[t.length-1];if(o!==void 0)t[0]=o;else if(r&&n){const a=r.readValue(n,s);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=s),i&&o===void 0&&i.set(t[0])}Hb(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Kn.delete(this)}cancel(){this.state==="scheduled"&&(Kn.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const Jb=e=>e.startsWith("--");function ey(e,t,n){Jb(t)?e.style.setProperty(t,n):e.style[t]=n}const ty=Ha(()=>window.ScrollTimeline!==void 0),ny={};function ry(e,t){const n=Ha(e);return()=>ny[t]??n()}const Kf=ry(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Wr=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Tc={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Wr([0,.65,.55,1]),circOut:Wr([.55,0,1,.45]),backIn:Wr([.31,.01,.66,-.59]),backOut:Wr([.33,1.53,.69,.99])};function qf(e,t){if(e)return typeof e=="function"?Kf()?zf(e,t):"ease-out":If(e)?Wr(e):Array.isArray(e)?e.map(n=>qf(n,t)||Tc.easeOut):Tc[e]}function iy(e,t,n,{delay:r=0,duration:i=300,repeat:o=0,repeatType:s="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=qf(a,i);Array.isArray(d)&&(u.easing=d);const f={delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:o+1,direction:s==="reverse"?"alternate":"normal"};return c&&(f.pseudoElement=c),e.animate(u,f)}function Yf(e){return typeof e=="function"&&"applyToOptions"in e}function oy({type:e,...t}){return Yf(e)&&Kf()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class sy extends nl{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:o,allowFlatten:s=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!o,this.allowFlatten=s,this.options=t,xn(typeof t.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const c=oy(t);this.animation=iy(n,r,i,c,o),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const u=tl(i,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(u):ey(n,r,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,n;this.isPseudoElement||(n=(t=this.animation).commitStyles)==null||n.call(t)}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return cn(Number(t))}get time(){return cn(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=en(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&ty()?(this.animation.timeline=t,Zt):n(this)}}const Zf={anticipate:Nf,backInOut:Tf,circInOut:Rf};function ay(e){return e in Zf}function ly(e){typeof e.ease=="string"&&ay(e.ease)&&(e.ease=Zf[e.ease])}const Nc=10;class cy extends sy{constructor(t){ly(t),Hf(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:o,...s}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new rl({...s,autoplay:!1}),l=en(this.finishedTime??this.time);n.setWithVelocity(a.sample(l-Nc).value,a.sample(l).value,Nc),a.stop()}}const Ac=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(In.test(e)||e==="0")&&!e.startsWith("url("));function uy(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function dy(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],s=Ac(i,t),a=Ac(o,t);return Nr(s===a,`You are trying to animate ${t} from "${i}" to "${o}". "${s?o:i}" is not an animatable value.`,"value-not-animatable"),!s||!a?!1:uy(e)||(n==="spring"||Yf(n))&&r}function la(e){e.duration=0,e.type}const fy=new Set(["opacity","clipPath","filter","transform"]),hy=Ha(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function py(e){var u;const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:o,type:s}=e;if(!(((u=t==null?void 0:t.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:l,transformTemplate:c}=t.owner.getProps();return hy()&&n&&fy.has(n)&&(n!=="transform"||!c)&&!l&&!r&&i!=="mirror"&&o!==0&&s!=="inertia"}const my=40;class gy extends nl{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:o=0,repeatType:s="loop",keyframes:a,name:l,motionValue:c,element:u,...d}){var g;super(),this.stop=()=>{var m,x;this._animation&&(this._animation.stop(),(m=this.stopTimeline)==null||m.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=Bt.now();const f={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:o,repeatType:s,name:l,motionValue:c,element:u,...d},p=(u==null?void 0:u.KeyframeResolver)||il;this.keyframeResolver=new p(a,(m,x,y)=>this.onKeyframesResolved(m,x,f,!y),l,c,u),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(t,n,r,i){this.keyframeResolver=void 0;const{name:o,type:s,velocity:a,delay:l,isHandoff:c,onUpdate:u}=r;this.resolvedAt=Bt.now(),dy(t,o,s,a)||((wn.instantAnimations||!l)&&(u==null||u(tl(t,r,n))),t[0]=t[t.length-1],la(r),r.repeat=0);const f={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>my?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},p=!c&&py(f)?new cy({...f,element:f.motionValue.owner.current}):new rl(f);p.finished.then(()=>this.notifyFinished()).catch(Zt),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),Qb()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const by=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function yy(e){const t=by.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}const xy=4;function Xf(e,t,n=1){xn(n<=xy,`Max CSS variable fallback depth detected in property "${e}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,i]=yy(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const s=o.trim();return xf(s)?parseFloat(s):s}return Za(i)?Xf(i,t,n+1):i}function ol(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const Qf=new Set(["width","height","top","left","right","bottom",...Rr]),wy={test:e=>e==="auto",parse:e=>e},Jf=e=>t=>t.test(e),eh=[Ar,ve,un,An,ub,cb,wy],Rc=e=>eh.find(Jf(e));function vy(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||vf(e):!0}const Ey=new Set(["brightness","contrast","saturate","opacity"]);function ky(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Xa)||[];if(!r)return e;const i=n.replace(r,"");let o=Ey.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const Sy=/\b([a-z-]*)\(.*?\)/gu,ca={...In,getAnimatableNone:e=>{const t=e.match(Sy);return t?t.map(ky).join(" "):e}},Mc={...Ar,transform:Math.round},Cy={rotate:An,rotateX:An,rotateY:An,rotateZ:An,scale:Mi,scaleX:Mi,scaleY:Mi,scaleZ:Mi,skew:An,skewX:An,skewY:An,distance:ve,translateX:ve,translateY:ve,translateZ:ve,x:ve,y:ve,z:ve,perspective:ve,transformPerspective:ve,opacity:ri,originX:yc,originY:yc,originZ:ve},sl={borderWidth:ve,borderTopWidth:ve,borderRightWidth:ve,borderBottomWidth:ve,borderLeftWidth:ve,borderRadius:ve,radius:ve,borderTopLeftRadius:ve,borderTopRightRadius:ve,borderBottomRightRadius:ve,borderBottomLeftRadius:ve,width:ve,maxWidth:ve,height:ve,maxHeight:ve,top:ve,right:ve,bottom:ve,left:ve,padding:ve,paddingTop:ve,paddingRight:ve,paddingBottom:ve,paddingLeft:ve,margin:ve,marginTop:ve,marginRight:ve,marginBottom:ve,marginLeft:ve,backgroundPositionX:ve,backgroundPositionY:ve,...Cy,zIndex:Mc,fillOpacity:ri,strokeOpacity:ri,numOctaves:Mc},_y={...sl,color:wt,backgroundColor:wt,outlineColor:wt,fill:wt,stroke:wt,borderColor:wt,borderTopColor:wt,borderRightColor:wt,borderBottomColor:wt,borderLeftColor:wt,filter:ca,WebkitFilter:ca},th=e=>_y[e];function nh(e,t){let n=th(e);return n!==ca&&(n=In),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const Ty=new Set(["auto","none","0"]);function Ny(e,t,n){let r=0,i;for(;r<e.length&&!i;){const o=e[r];typeof o=="string"&&!Ty.has(o)&&ii(o).values.length&&(i=e[r]),r++}if(i&&n)for(const o of t)e[o]=nh(n,i)}class Ay extends il{constructor(t,n,r,i,o){super(t,n,r,i,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let l=0;l<t.length;l++){let c=t[l];if(typeof c=="string"&&(c=c.trim(),Za(c))){const u=Xf(c,n.current);u!==void 0&&(t[l]=u),l===t.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!Qf.has(r)||t.length!==2)return;const[i,o]=t,s=Rc(i),a=Rc(o);if(s!==a)if(_c(s)&&_c(a))for(let l=0;l<t.length;l++){const c=t[l];typeof c=="string"&&(t[l]=parseFloat(c))}else Gn[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||vy(t[i]))&&r.push(i);r.length&&Ny(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Gn[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){var a;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const o=r.length-1,s=r[o];r[o]=Gn[n](t.measureViewportBox(),window.getComputedStyle(t.current)),s!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=s),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function Ry(e,t,n){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=(n==null?void 0:n[e])??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e)}const rh=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function ih(e){return wf(e)&&"offsetHeight"in e}const Ic=30,My=e=>!isNaN(parseFloat(e));class Iy{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var o;const i=Bt.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((o=this.events.change)==null||o.notify(this.current),this.dependents))for(const s of this.dependents)s.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Bt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=My(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return process.env.NODE_ENV!=="production"&&Ga(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new Wa);const r=this.events[t].add(n);return t==="change"?()=>{r(),at.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Bt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>Ic)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Ic);return Ef(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function kr(e,t){return new Iy(e,t)}const{schedule:al}=Of(queueMicrotask,!1),Jt={x:!1,y:!1};function oh(){return Jt.x||Jt.y}function Oy(e){return e==="x"||e==="y"?Jt[e]?null:(Jt[e]=!0,()=>{Jt[e]=!1}):Jt.x||Jt.y?null:(Jt.x=Jt.y=!0,()=>{Jt.x=Jt.y=!1})}function sh(e,t){const n=Ry(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function Oc(e){return!(e.pointerType==="touch"||oh())}function Py(e,t,n={}){const[r,i,o]=sh(e,n),s=a=>{if(!Oc(a))return;const{target:l}=a,c=t(l,a);if(typeof c!="function"||!l)return;const u=d=>{Oc(d)&&(c(d),l.removeEventListener("pointerleave",u))};l.addEventListener("pointerleave",u,i)};return r.forEach(a=>{a.addEventListener("pointerenter",s,i)}),o}const ah=(e,t)=>t?e===t?!0:ah(e,t.parentElement):!1,ll=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Dy=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Ly(e){return Dy.has(e.tagName)||e.tabIndex!==-1}const Qi=new WeakSet;function Pc(e){return t=>{t.key==="Enter"&&e(t)}}function os(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Fy=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=Pc(()=>{if(Qi.has(n))return;os(n,"down");const i=Pc(()=>{os(n,"up")}),o=()=>os(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",o,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function Dc(e){return ll(e)&&!oh()}function By(e,t,n={}){const[r,i,o]=sh(e,n),s=a=>{const l=a.currentTarget;if(!Dc(a))return;Qi.add(l);const c=t(l,a),u=(p,g)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",f),Qi.has(l)&&Qi.delete(l),Dc(p)&&typeof c=="function"&&c(p,{success:g})},d=p=>{u(p,l===window||l===document||n.useGlobalTarget||ah(l,p.target))},f=p=>{u(p,!1)};window.addEventListener("pointerup",d,i),window.addEventListener("pointercancel",f,i)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",s,i),ih(a)&&(a.addEventListener("focus",c=>Fy(c,i)),!Ly(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),o}function lh(e){return wf(e)&&"ownerSVGElement"in e}function jy(e){return lh(e)&&e.tagName==="svg"}const At=e=>!!(e&&e.getVelocity),$y=[...eh,wt,In],Vy=e=>$y.find(Jf(e)),cl=A.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});class zy extends D.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=n.offsetParent,i=ih(r)&&r.offsetWidth||0,o=this.props.sizeRef.current;o.height=n.offsetHeight||0,o.width=n.offsetWidth||0,o.top=n.offsetTop,o.left=n.offsetLeft,o.right=i-o.width-o.left}return null}componentDidUpdate(){}render(){return this.props.children}}function Uy({children:e,isPresent:t,anchorX:n,root:r}){const i=A.useId(),o=A.useRef(null),s=A.useRef({width:0,height:0,top:0,left:0,right:0}),{nonce:a}=A.useContext(cl);return A.useInsertionEffect(()=>{const{width:l,height:c,top:u,left:d,right:f}=s.current;if(t||!o.current||!l||!c)return;const p=n==="left"?`left: ${d}`:`right: ${f}`;o.current.dataset.motionPopId=i;const g=document.createElement("style");a&&(g.nonce=a);const m=r??document.head;return m.appendChild(g),g.sheet&&g.sheet.insertRule(`
22
2
  [data-motion-pop-id="${i}"] {
23
3
  position: absolute !important;
@@ -156,7 +136,7 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann
156
136
  ${n.promptSlider}
157
137
  ${s===r?"opacity-100":"opacity-0"}
158
138
  whitespace-pre-line break-words
159
- `,style:{minHeight:"2.5rem",display:s===r?"block":"none"},children:o},s))})}function kM({statusMessage:e,theme:t}){const n=Ct(t);return h.jsxs("div",{className:"z-10 flex items-center space-x-2 mt-2 pb-2",children:[h.jsx("div",{className:n.statusIndicator}),h.jsx("span",{className:`text-xs ${n.text.muted}`,children:e})]})}const ig=A.forwardRef(({disabled:e,onStartCall:t,onStartChat:n,onStartVideo:r,prompts:i=['"Book a meeting with the marketing team"',`"What's the status of project Alpha?"`,`"Summarize yesterday's sales report"`,'"Find a good Italian restaurant nearby"','"Remind me to call John tomorrow at 10 AM"'],statusMessage:o="Agent is ready",title:s="Choose how to interact",subTitle:a="Ask me anything or give me a task to complete",theme:l="vox",modalities:c=["voice","chat","video"]},u)=>{const d=Ct(l),f=c.includes("voice"),p=c.includes("chat"),g=c.includes("video"),m=[f,p,g].filter(Boolean).length;return h.jsxs("div",{className:"flex p-8 flex-col items-center h-full justify-center w-full relative","aria-disabled":e,style:{background:"transparent"},children:[h.jsxs("div",{className:"mt-1 relative flex items-center justify-center mb-8 w-full",style:{minHeight:"120px"},children:[h.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[h.jsx("div",{className:d.pulseRings.ring1}),h.jsx("div",{className:d.pulseRings.ring2,style:{animationDelay:"0.5s"}}),h.jsx("div",{className:d.pulseRings.ring3,style:{animationDelay:"1s"}})]}),h.jsx("div",{className:"relative z-10 flex items-center justify-center",children:f&&p&&g?h.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[h.jsx(Zi,{onClick:t,disabled:e,theme:l}),h.jsx(Ks,{onClick:n,disabled:e,theme:l}),h.jsx(qs,{onClick:r||t,disabled:e,theme:l})]}):m>1?h.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[f&&h.jsx(Zi,{onClick:t,disabled:e,theme:l}),p&&h.jsx(Ks,{onClick:n,disabled:e,theme:l}),g&&r&&h.jsx(qs,{onClick:r,disabled:e,theme:l})]}):h.jsx("div",{className:"flex items-center justify-center",children:f?h.jsx(Zi,{onClick:t,disabled:e,theme:l}):p?h.jsx(Ks,{onClick:n,disabled:e,theme:l}):g&&r?h.jsx(qs,{onClick:r,disabled:e,theme:l}):h.jsx(Zi,{onClick:t,disabled:e,theme:l})})})]}),h.jsxs("div",{className:"text-center flex flex-col items-center gap-y-2 mb-6 w-full",children:[h.jsx("h3",{className:`text-xl font-semibold mb-2 ${d.text.accent}`,children:s}),h.jsx("p",{className:`text-sm leading-relaxed px-4 ${d.text.secondary}`,children:a}),m>1&&h.jsxs("div",{className:"flex gap-6 mt-4 text-xs justify-center",children:[f&&h.jsxs("div",{className:"flex flex-col items-center gap-1",children:[h.jsx(ng,{className:"w-4 h-4"}),h.jsx("span",{className:d.text.muted,children:"Voice"})]}),p&&h.jsxs("div",{className:"flex flex-col items-center gap-1",children:[h.jsx(tg,{className:"w-4 h-4"}),h.jsx("span",{className:d.text.muted,children:"Chat"})]}),g&&h.jsxs("div",{className:"flex flex-col items-center gap-1",children:[h.jsx(rg,{className:"w-4 h-4"}),h.jsx("span",{className:d.text.muted,children:"Video"})]})]})]}),h.jsx(EM,{prompts:i,theme:l}),h.jsx(kM,{statusMessage:o,theme:l})]})});ig.displayName="Welcome";class Xl extends D.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("VoxketWidget Error:",t,n)}render(){if(this.state.hasError){if(this.props.fallback){const t=this.props.fallback;return D.createElement(t,{error:this.state.error})}return D.createElement("div",{style:{padding:"20px",border:"1px solid #ff4444",borderRadius:"8px",background:"#fff5f5",color:"#cc0000"}},"VoxketWidget encountered an error. Please check the console for details.")}return this.props.children}}function og({room:e,onSessionEnd:t,onSessionStart:n,enableConsoleLogging:r=!0,enableLocalStorage:i=!0,voxketSessionId:o}={}){const[s,a]=D.useState(null),[l,c]=D.useState([]),[u,d]=D.useState(null),[f,p]=D.useState([]),g=D.useCallback((E,v)=>{const _={timestamp:new Date,event:E,data:v,sessionId:s==null?void 0:s.sessionId,participantId:u==null?void 0:u.identity};if(c(k=>[...k,_]),i){const k=JSON.parse(localStorage.getItem("voxket-session-logs")||"[]");k.push(_),localStorage.setItem("voxket-session-logs",JSON.stringify(k))}return _},[s==null?void 0:s.sessionId,u==null?void 0:u.identity,r,i]);D.useEffect(()=>{if(!e)return;const E=()=>{const b=o||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,R=new Date,O={sessionId:b,startTime:R,totalMessages:0,connectionIssues:0,participantCount:f.length,events:[]};a(O),g("SESSION_STARTED",{sessionId:b,startTime:R}),n==null||n(b)},v=()=>{if(s){const b=new Date,R=b.getTime()-s.startTime.getTime(),O={...s,endTime:b,duration:R,events:l};g("SESSION_ENDED",{sessionId:s.sessionId,duration:`${Math.round(R/1e3)}s`,totalMessages:s.totalMessages,connectionIssues:s.connectionIssues}),t==null||t(O),a(null),c([])}},_=b=>{g("CONNECTION_STATE_CHANGED",{state:b}),b===se.ConnectionState.Reconnecting&&s&&(a(R=>R?{...R,connectionIssues:R.connectionIssues+1}:null),g("CONNECTION_ISSUE",{type:"reconnecting"}))},k=b=>{g("TRACK_PUBLISHED",{trackKind:b.kind,trackSource:b.source})},C=b=>{g("TRACK_UNPUBLISHED",{trackKind:b.kind,trackSource:b.source})},M=(b,R)=>{s&&a(O=>O?{...O,totalMessages:O.totalMessages+1}:null),g("DATA_RECEIVED",{participantId:R==null?void 0:R.identity,dataSize:b.length})},N=b=>{g("PARTICIPANT_CONNECTED",{participantId:b.identity,participantName:b.name}),p(R=>[...R,b]),s&&a(R=>R?{...R,participantCount:R.participantCount+1}:null)},I=b=>{g("PARTICIPANT_DISCONNECTED",{participantId:b.identity,participantName:b.name}),p(R=>R.filter(O=>O.identity!==b.identity))};return e.localParticipant&&d(e.localParticipant),e.on(se.RoomEvent.Connected,E),e.on(se.RoomEvent.Disconnected,v),e.on(se.RoomEvent.ConnectionStateChanged,_),e.on(se.RoomEvent.TrackPublished,k),e.on(se.RoomEvent.TrackUnpublished,C),e.on(se.RoomEvent.DataReceived,M),e.on(se.RoomEvent.ParticipantConnected,N),e.on(se.RoomEvent.ParticipantDisconnected,I),()=>{e.off(se.RoomEvent.Connected,E),e.off(se.RoomEvent.Disconnected,v),e.off(se.RoomEvent.ConnectionStateChanged,_),e.off(se.RoomEvent.TrackPublished,k),e.off(se.RoomEvent.TrackUnpublished,C),e.off(se.RoomEvent.DataReceived,M),e.off(se.RoomEvent.ParticipantConnected,N),e.off(se.RoomEvent.ParticipantDisconnected,I)}},[e,s,l,f.length,g,t,n]);const m=D.useCallback(()=>i?JSON.parse(localStorage.getItem("voxket-session-logs")||"[]"):l,[l,i]),x=D.useCallback(()=>{i&&localStorage.removeItem("voxket-session-logs"),c([])},[i]),y=D.useCallback(()=>{const E=m(),v=JSON.stringify(E,null,2),_="data:application/json;charset=utf-8,"+encodeURIComponent(v),k=`voxket-session-logs-${new Date().toISOString().split("T")[0]}.json`,C=document.createElement("a");C.setAttribute("href",_),C.setAttribute("download",k),C.click()},[m]);return{sessionMetrics:s,sessionLogs:l,logEvent:g,getSessionLogs:m,clearSessionLogs:x,exportSessionLogs:y}}class Ql{constructor(){lt(this,"listeners",{})}on(t,n){return this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n),()=>this.off(t,n)}once(t,n){const r=(...i)=>{this.off(t,r),n(...i)};return this.on(t,r)}off(t,n){const r=this.listeners[t];if(!r)return;const i=r.indexOf(n);i>-1&&r.splice(i,1)}removeAllListeners(t){t?delete this.listeners[t]:this.listeners={}}emit(t,...n){const r=this.listeners[t];if(!r)return;const i=[...r];for(const o of i)try{o(...n)}catch(s){console.error(`Error in event listener for ${String(t)}:`,s)}}listenerCount(t){var n;return((n=this.listeners[t])==null?void 0:n.length)??0}eventNames(){return Object.keys(this.listeners)}}class sg{constructor(t){lt(this,"plugins",new Map);lt(this,"installedPlugins",new Set);lt(this,"context");this.context={client:t,emit:t.emit.bind(t),on:t.on.bind(t),config:{}}}register(t){if(this.plugins.has(t.name))throw new Error(`Plugin '${t.name}' is already registered`);if(t.dependencies){for(const n of t.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin '${t.name}' depends on '${n}' which is not registered`)}this.plugins.set(t.name,t)}async install(t,n){const r=this.plugins.get(t);if(!r)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t))throw new Error(`Plugin '${t}' is already installed`);if(r.dependencies)for(const o of r.dependencies)this.installedPlugins.has(o)||await this.install(o);const i={...this.context,config:{...r.config,...n}};r.install&&await r.install(i),this.installedPlugins.add(t),this.setupPluginEvents(r,i)}async uninstall(t){var r;const n=this.plugins.get(t);if(!n)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t)){for(const[i,o]of this.plugins)if(this.installedPlugins.has(i)&&((r=o.dependencies)!=null&&r.includes(t)))throw new Error(`Cannot uninstall '${t}' because '${i}' depends on it`);n.uninstall&&await n.uninstall(this.context),this.installedPlugins.delete(t)}}isInstalled(t){return this.installedPlugins.has(t)}getInstalledPlugins(){return Array.from(this.installedPlugins)}getAvailablePlugins(){return Array.from(this.plugins.keys())}getPluginInfo(t){return this.plugins.get(t)}setupPluginEvents(t,n){t.onSessionStart&&n.on("session.started",r=>{t.onSessionStart(n,r.id)}),t.onSessionEnd&&n.on("session.ended",r=>{t.onSessionEnd(n,r.id)}),t.onAgentResponse&&n.on("agent.response",r=>{t.onAgentResponse(n,r)})}}function SM(e){return e}function Jl(e,t,n){return{name:e,version:"1.0.0",description:`${t} modality plugin`,install:async r=>{n.onActivate&&await n.onActivate(r)},uninstall:async r=>{n.onDeactivate&&await n.onDeactivate(r)},onAgentResponse:n.onMessage}}const CM={name:"analytics",version:"1.0.0",description:"Built-in analytics tracking",install:async e=>{console.log("Analytics plugin installed"),e.on("session.started",t=>{console.log("Analytics: Session started",t.id)}),e.on("session.ended",(t,n)=>{console.log("Analytics: Session ended",t.id,n)}),e.on("chat.message.sent",t=>{console.log("Analytics: User message sent",t.content.length)})}},_M={name:"debug",version:"1.0.0",description:"Debug logging and development tools",install:async e=>{console.log("Debug plugin installed");const t=e.emit;e.emit=(n,...r)=>(console.log(`[Debug] Event: ${String(n)}`,r),t(n,...r))}},TM={name:"metrics",version:"1.0.0",description:"Advanced metrics collection",install:async e=>{console.log("Metrics plugin installed");const t=new Map;e.on("session.started",n=>{t.set(n.id,{startTime:Date.now(),events:[]})}),e.on("agent.response",n=>{console.log("Metrics: Agent response analyzed",{type:n.type,length:n.content.length,timestamp:n.timestamp})})}},ag=A.createContext(null);function io({config:e,children:t,autoConnect:n=!1,client:r}){const[i,o]=A.useState(null),[s,a]=A.useState(!1),[l,c]=A.useState(!1),[u,d]=A.useState(null),[f,p]=A.useState(null),[g,m]=A.useState("idle"),[x,y]=A.useState(null),[E,v]=A.useState([]),[_,k]=A.useState([]),[C,M]=A.useState([]);A.useEffect(()=>{const W=r||new ki(e);o(W);const w=N(W);return n&&!r&&I(W),()=>{w(),r||W.disconnect().catch(console.error)}},[e,n,r]);const N=W=>{const w=()=>{c(!0),d(null)},V=()=>{a(!0),c(!1),d(null)},Y=()=>{a(!1),c(!1),p(null),m("idle"),v([]),k([]),M([])},S=Ce=>{d(Ce),c(!1)},$=Ce=>{p(Ce),m(Ce.state)},q=Ce=>{m(Ce),f&&p({...f,state:Ce})},B=(Ce,K)=>{p(null),m("idle"),y(K),v([]),k([]),M([])},Q=Ce=>{v(K=>[...K,Ce])},te=Ce=>{v(K=>K.filter(ye=>ye.id!==Ce.id))},ae=Ce=>{k(K=>[...K,Ce])},de=Ce=>{k(K=>[...K,Ce])},De=Ce=>{console.log("📝 VoxketProvider: Received transcription:",Ce),M(K=>K.find(me=>me.id===Ce.id)?(console.log("📝 VoxketProvider: Duplicate transcription detected, skipping:",Ce.id),K):(console.log("📝 VoxketProvider: Adding new transcription:",Ce.id),[...K,Ce]))},U=()=>{console.log("🧹 VoxketProvider: Clearing chat messages and transcriptions"),k([]),M([])};return W.on("connection.connecting",w),W.on("connection.connected",V),W.on("connection.disconnected",Y),W.on("connection.error",S),W.on("session.created",$),W.on("session.state.changed",q),W.on("session.ended",B),W.on("participant.joined",Q),W.on("participant.left",te),W.on("chat.message.received",ae),W.on("chat.message.sent",de),W.on("transcription.received",De),W.on("chat.history.cleared",U),()=>{console.log("📝 VoxketProvider: Cleaning up event listeners"),W.off("connection.connecting",w),W.off("connection.connected",V),W.off("connection.disconnected",Y),W.off("connection.error",S),W.off("session.created",$),W.off("session.state.changed",q),W.off("session.ended",B),W.off("participant.joined",Q),W.off("participant.left",te),W.off("chat.message.received",ae),W.off("chat.message.sent",de),W.off("chat.history.cleared",U),W.off("transcription.received",De)}},I=async W=>{const w=W||i;if(w)try{await w.connect()}catch(V){console.error("Failed to connect:",V)}},P={client:i,isConnected:s,isConnecting:l,connectionError:u,currentSession:f,sessionState:g,sessionMetrics:x,participants:E,chatMessages:_,transcriptions:C,connect:()=>I(),disconnect:async()=>{if(i)try{await i.disconnect()}catch(W){console.error("Failed to disconnect:",W)}},createSession:async(W,w={})=>{if(!i)throw new Error("Client not initialized");const V={agentId:W,participantName:w.participantName||"User",metadata:w.metadata,modalities:w.modalities||["voice"]};return await i.createSession(V)},endSession:async()=>i?await i.endSession():null,sendChatMessage:async W=>{if(!i)throw new Error("Client not initialized");await i.sendChatMessage(W)},setMicrophoneEnabled:async W=>{if(!i)throw new Error("Client not initialized");await i.setMicrophoneEnabled(W)},setCameraEnabled:async W=>{if(!i)throw new Error("Client not initialized");await i.setCameraEnabled(W)},startScreenShare:async()=>{if(!i)throw new Error("Client not initialized");await i.startScreenShare()},stopScreenShare:async()=>{if(!i)throw new Error("Client not initialized");await i.stopScreenShare()}};return h.jsx(ag.Provider,{value:P,children:t})}function fn(){const e=A.useContext(ag);if(!e)throw new Error("useVoxket must be used within a VoxketProvider");return e}class NM extends Ql{constructor(n){super();lt(this,"room",null);lt(this,"registeredMethods",new Map);lt(this,"activeInteractions",new Map);lt(this,"currentInteraction",null);n&&this.setRoom(n)}setRoom(n){this.room=n}async registerFrontendRPC(n,r,i="embedded"){if(console.log(`RpcManager: Starting registration for method '${n}'`),!this.room)throw console.error(`RpcManager: Cannot register '${n}' - no room instance`),new Error("Room not initialized. Cannot register RPC method.");if(!this.room.localParticipant)throw console.error(`RpcManager: Cannot register '${n}' - no local participant`),new Error("Local participant not available for RPC registration");console.log(`RpcManager: Room state: ${this.room.state}`),console.log(`RpcManager: Local participant: ${this.room.localParticipant.identity}`),console.log(`RpcManager: Registering frontend RPC method: ${n}`);const o={methodName:n,component:r,presentationMode:i};this.registeredMethods.set(n,o);try{this.room.registerRpcMethod(n,async s=>{console.log(`RpcManager: RPC method '${n}' called by ${s.callerIdentity}`),console.log("RpcManager: Payload:",s.payload),this.emit("rpc.method.called",{methodName:n,data:s});let a;console.log(`RpcManager: Current registration for '${n}':`,o);let l=s.responseTimeout||30;try{a=JSON.parse(s.payload)}catch{a=s.payload}try{const c=await this.awaitUserInteraction(n,r,i,a,l);return JSON.stringify(c)}catch(c){throw console.error(`RpcManager: Error in RPC method '${n}':`,c),c}}),this.emit("rpc.method.registered",{methodName:n}),console.log(`RpcManager: Successfully registered RPC method: ${n}`)}catch(s){throw console.error(`RpcManager: Failed to register RPC method '${n}':`,s),s}}async awaitUserInteraction(n,r,i,o,s){return new Promise((a,l)=>{const c=`${n}_${Date.now()}`;console.log(`RpcManager: Starting user interaction for method: ${n}, timeout: ${s} seconds`);const u={didSuccess:(f,p)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,f),this.clearInteraction(c),this.currentInteraction=null;const g={success:!0,message:"User interaction completed successfully",data:f,timestamp:new Date,...p?{successView:p}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:g}),a(g)},didFail:f=>{console.log(`RpcManager: User interaction failed for method: ${n}`,f),this.clearInteraction(c);const p={success:!1,message:"User interaction failed",error:f,timestamp:new Date};this.emit("rpc.interaction.completed",{methodName:n,response:p}),a(p)},dismissView:()=>{var p;console.log(`RpcManager: User dismissed interaction for method: ${n}`),console.log("RpcManager: Current interaction before dismiss:",(p=this.currentInteraction)==null?void 0:p.methodName),this.clearInteraction(c),this.currentInteraction=null,console.log("RpcManager: Current interaction after dismiss:",this.currentInteraction);const f={success:!0,data:{dismissed:!0,reason:"User dismissed the interaction"},message:"User interaction dismissed",timestamp:new Date};this.emit("rpc.interaction.dismissed",{methodName:n,response:f}),this.emit("rpc.interaction.completed",{methodName:n,response:f}),setTimeout(()=>{var g;((g=this.currentInteraction)==null?void 0:g.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(f)},didTimeout:f=>{console.log(`RpcManager: User interaction timeout for method: ${n}`),this.clearInteraction(c),this.currentInteraction=null;const p={success:!0,message:`User interaction timed out after ${s} seconds, it should be considered as declined, agent don't need to retry`,timestamp:new Date,...f?{timeoutView:f}:{}};this.emit("rpc.interaction.timeout",{methodName:n,response:p}),setTimeout(()=>{var g;((g=this.currentInteraction)==null?void 0:g.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(p)}},d=setTimeout(()=>{u.didTimeout&&u.didTimeout()},s);this.activeInteractions.set(c,{resolve:f=>a(JSON.parse(f)),reject:l,timeoutId:d}),this.currentInteraction={isVisible:!0,methodName:n,component:r,presentationMode:i,timeout:s,data:o,handler:u},this.emit("rpc.interaction.started",{methodName:n,presentationMode:i}),setTimeout(async()=>{var f;if((f=this.currentInteraction)!=null&&f.handler)try{console.log(`RpcManager: Component created for method: ${n} with data:`,o)}catch(p){console.error("RpcManager: Error loading data into component:",p),u.didFail({error:"Failed to load data into component"})}},100)})}clearInteraction(n){const r=this.activeInteractions.get(n);r&&(console.log(`RpcManager: Clearing interaction: ${n}`),clearTimeout(r.timeoutId),this.activeInteractions.delete(n))}getCurrentInteraction(){return this.currentInteraction}dismissCurrentInteraction(){var n;this.currentInteraction&&(console.log(`RpcManager: Dismissing current interaction: ${this.currentInteraction.methodName}`),(n=this.currentInteraction.handler)==null||n.dismissView(),setTimeout(()=>{this.currentInteraction&&(console.log("RpcManager: Force clearing lingering interaction"),this.currentInteraction=null)},0))}getRegisteredMethods(){return Array.from(this.registeredMethods.keys())}unregisterMethod(n){this.registeredMethods.delete(n),console.log(`RpcManager: Unregistered RPC method: ${n}`)}clear(){for(const[n,r]of this.activeInteractions)clearTimeout(r.timeoutId);this.activeInteractions.clear(),this.registeredMethods.clear(),this.currentInteraction=null,console.log("RpcManager: Cleared all registrations and interactions")}}class Ze extends Error{constructor(t,n,r){super(t),this.code=n,this.details=r,this.name="VoxketError"}}const Nn=new WeakSet,Ys=new WeakSet;class ki extends Ql{constructor(n){super();lt(this,"config");lt(this,"room",null);lt(this,"pluginManager");lt(this,"rpcManager");lt(this,"isConnected",!1);lt(this,"currentSession",null);lt(this,"connectionState",se.ConnectionState.Disconnected);lt(this,"renderedComponents",new Map);lt(this,"textStreamHandlersRegistered",!1);lt(this,"currentAgentInfo",null);lt(this,"chatMessages",[]);lt(this,"activeTranscriptions",new Map);lt(this,"isAgentConnected",!1);lt(this,"agentState","idle");this.config=n,this.pluginManager=new sg(this),this.rpcManager=new NM,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,r;this.isConnected=!0,(r=(n=this.config).onConnected)==null||r.call(n)}),this.on("connection.disconnected",n=>{var r,i;this.isConnected=!1,(i=(r=this.config).onDisconnected)==null||i.call(r,n)}),this.on("connection.error",n=>{var r,i;(i=(r=this.config).onError)==null||i.call(r,n)}),this.on("chat.message.received",n=>{var r,i;this.addChatMessage(n),(i=(r=this.config).onMessageReceived)==null||i.call(r,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var r,i;(i=(r=this.config).onTranscriptionReceived)==null||i.call(r,n)}),this.on("session.state.changed",n=>{var r,i;(i=(r=this.config).onSessionStateChanged)==null||i.call(r,n)}),this.on("session.created",n=>{var r,i;(i=(r=this.config).onSessionStart)==null||i.call(r,n.id)}),this.on("session.ended",(n,r)=>{var i,o;(o=(i=this.config).onSessionEnd)==null||o.call(i,r)}),this.on("participant.joined",n=>{var r,i;(i=(r=this.config).onUserJoined)==null||i.call(r,n.id)}),this.on("participant.left",n=>{var r,i;(i=(r=this.config).onUserLeft)==null||i.call(r,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new se.Room,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(se.RoomEvent.Connected,()=>{var n,r;this.connectionState=se.ConnectionState.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(r=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&r.includes("voice")&&setTimeout(async()=>{var i;try{(i=this.room)!=null&&i.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(o){console.warn("VoxketClient: Failed to enable microphone after room connection:",o)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(se.RoomEvent.Disconnected,n=>{var r;console.log("🔴 VoxketClient: Room disconnected, reason:",n),this.connectionState=se.ConnectionState.Disconnected,this.textStreamHandlersRegistered=!1,this.isAgentConnected=!1,console.log("🤖 VoxketClient: Agent marked as disconnected"),this.clearChatMessages(),n&&console.log("🔍 VoxketClient: Disconnect reason details:",{reason:n.toString(),currentSession:(r=this.currentSession)==null?void 0:r.id,agentConnected:this.isAgentConnected,connectionState:this.connectionState}),this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(se.RoomEvent.ConnectionStateChanged,n=>{this.connectionState=n,n===se.ConnectionState.Connecting&&this.emit("connection.connecting")}),this.room.on(se.RoomEvent.ParticipantConnected,n=>{const r={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",r)}),this.room.on(se.RoomEvent.ParticipantDisconnected,n=>{const r={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",r)}),this.room.on(se.RoomEvent.LocalTrackPublished,n=>{console.log("🎬 VoxketClient: Local track published:",n.source),n.source===se.Track.Source.ScreenShare&&this.emit("track.unmuted",{source:"screenShare",enabled:!0})}),this.room.on(se.RoomEvent.LocalTrackUnpublished,n=>{console.log("🎬 VoxketClient: Local track unpublished:",n.source),n.source===se.Track.Source.ScreenShare&&this.emit("track.muted",{source:"screenShare",enabled:!1})}))}setupTextStreamHandlers(){if(!this.room)return;try{this.room.registerTextStreamHandler("lk.chat",async(r,i)=>{try{const o=await r.readAll(),s={id:`msg_${Date.now()}_${i.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:o,timestamp:new Date,sender:{id:i.identity||"user",name:i.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",s)}catch(o){console.error("VoxketClient: Failed to process lk.chat message:",o)}})}catch(r){console.warn("VoxketClient: lk.chat handler already registered, skipping:",r)}try{console.log("📝 VoxketClient: Registering lk.transcription handler..."),this.room.registerTextStreamHandler("lk.transcription",async(r,i)=>{var o,s,a,l,c,u;console.log("📝 VoxketClient: Received transcription stream from:",i.identity);try{console.log("📝 VoxketClient: Processing transcription stream...");const d=i.identity===((s=(o=this.room)==null?void 0:o.localParticipant)==null?void 0:s.identity),f=Date.now(),p=i.identity,g=this.activeTranscriptions.get(p);let m,x=!0;g&&f-g.timestamp<1e3?(m=g.messageId,x=!1,console.log("📝 VoxketClient: Reusing existing transcription message ID:",m)):(m=`msg_${d?"user":"agent"}_${i.identity}_${f}`,this.activeTranscriptions.set(p,{messageId:m,timestamp:f}),console.log("📝 VoxketClient: Created new transcription message ID:",m));let y="";console.log("📝 VoxketClient: Current agent info:",this.currentAgentInfo);const E=((a=this.currentAgentInfo)==null?void 0:a.name)||i.identity||"AI Assistant";console.log("📝 VoxketClient: Using agent name:",E);const v=d?"participant":"agent",_=d?this.config.participantName||"User":E;console.log("📝 VoxketClient: Transcription sender info:",{participantIdentity:i.identity,localParticipantIdentity:(c=(l=this.room)==null?void 0:l.localParticipant)==null?void 0:c.identity,isFromUser:d,senderType:v,senderName:_});const k={id:m,content:"",timestamp:new Date,sender:{id:i.identity||"unknown",name:_,type:v},metadata:{topic:"lk.transcription",streaming:!0}};x&&this.emit("chat.message.received",k),console.log("📝 VoxketClient: Starting to read transcription stream...");for await(const I of r){console.log("📝 VoxketClient: Received chunk:",I.length,"chars"),y+=I;const b=this.convertMarkdownToText(y),R={...k,content:b,metadata:{...k.metadata,streaming:!0}};this.emit("chat.message.updated",R)}const C=this.convertMarkdownToText(y),M={...k,content:C,metadata:{...k.metadata,streaming:!1}};this.emit("chat.message.updated",M);const N={id:m,text:C,isFinal:!0,startTime:k.timestamp.getTime(),participantId:i.identity||"agent"};this.emit("transcription.received",N),console.log("📝 VoxketClient: Emitted transcription event:",N)}catch(d){console.error("VoxketClient: Failed to process lk.transcription message:",d);try{const f=await r.readAll(),p=((u=this.currentAgentInfo)==null?void 0:u.name)||i.identity||"AI Assistant",g={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:f,timestamp:new Date,sender:{id:i.identity||"agent",name:p,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",g);const m={id:g.id,text:g.content,isFinal:!0,startTime:g.timestamp.getTime(),participantId:i.identity||"agent"};this.emit("transcription.received",m),console.log("📝 VoxketClient: Emitted fallback transcription event:",m)}catch(f){console.error("VoxketClient: Fallback failed for lk.transcription:",f)}}})}catch(r){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",r)}try{this.room.registerTextStreamHandler("suggested_response",async r=>{const i=await r.readAll();let o=[];try{o=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(s){console.warn("VoxketClient: Failed to parse suggested_response:",s,i)}this.emit("suggested.response",o)})}catch(r){console.warn("VoxketClient: suggested_response handler already registered, skipping:",r)}try{this.room.registerTextStreamHandler("agent_state_changed",async(r,i)=>{const o=await r.readAll();console.log("🤖 VoxketClient: agent_state_changed stream received:",o);let s={};try{s=typeof o=="string"?JSON.parse(o.replace(/'/g,'"')):o}catch(a){console.warn("VoxketClient: Failed to parse agent_state_changed:",a,o)}this.isAgentConnected||(this.isAgentConnected=!0,console.log("🤖 VoxketClient: Agent marked as connected (first state change received)"),this.emit("agent.connected",s)),s.new_state==="speaking"?(this.setAgentState("speaking"),this.emit("agent.speaking",s)):s.new_state==="thinking"?(this.setAgentState("thinking"),this.emit("agent.thinking",s)):(s.new_state==="idle"||s.new_state==="listening")&&this.setAgentState("idle")})}catch(r){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",r)}try{this.room.registerTextStreamHandler("images",async(r,i)=>{try{const o=await r.readAll()}catch(o){console.error("VoxketClient: Error processing images stream:",o)}})}catch(r){console.warn("VoxketClient: images handler already registered, skipping:",r)}try{this.room.registerByteStreamHandler("images",async(r,i)=>{var o,s;try{const a=r.info,l={id:`img_${Date.now()}_${i.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`�️ ${a.name||"Image"}`,sender:{id:i.identity||"agent",name:i.identity||"Agent",type:i.identity===((s=(o=this.room)==null?void 0:o.localParticipant)==null?void 0:s.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:a.name,fileSize:a.size,mimeType:a.mimeType,streamId:a.id,downloading:!0}};this.emit("chat.message.received",l),r.onProgress&&(r.onProgress=p=>{const g={...l,metadata:{...l.metadata,downloadProgress:p||0}};this.emit("chat.message.updated",g)});const c=[];for await(const p of r)c.push(p);const u=new Blob(c,{type:a.mimeType||"application/octet-stream"}),d=URL.createObjectURL(u),f={...l,metadata:{...l.metadata,downloading:!1,downloadProgress:1,downloadUrl:d,blob:u}};this.emit("chat.message.updated",f)}catch(a){console.error("VoxketClient: Error processing image attachment:",a)}})}catch(r){console.warn("VoxketClient: image handler already registered, skipping:",r)}["error","warning","status","system","debug","info"].forEach(r=>{try{this.room.registerTextStreamHandler(r,async(i,o)=>{try{const s=await i.readAll();if(console.log(`📝 VoxketClient: Received '${r}' stream:`,s),r==="error"){let a={};try{a=typeof s=="string"?JSON.parse(s):s}catch{a={message:s}}console.warn("� VoxketClient: Agent error:",a),this.emit("agent.error",a)}else this.emit("text.stream.received",{topic:r,data:s,participantInfo:o})}catch(s){console.error(`VoxketClient: Failed to process '${r}' stream:`,s)}})}catch(i){console.warn(`VoxketClient: Handler for '${r}' already registered, skipping:`,i)}});try{this.room.registerTextStreamHandler("*",async(r,i)=>{var o;try{const s=await r.readAll(),a=((o=r.info)==null?void 0:o.topic)||"unknown";console.log(`📝 VoxketClient: Received unhandled text stream for topic '${a}':`,s),this.emit("text.stream.unhandled",{topic:a,data:s,participantInfo:i})}catch(s){console.error("VoxketClient: Failed to process unhandled text stream:",s)}})}catch(r){console.warn("VoxketClient: Generic text stream handler already registered, skipping:",r)}this.textStreamHandlersRegistered=!0}async fetchConnectionDetails(n,r,i){const o=n||this.config.agentId||"default-agent",s=r||this.config.participantName||"User",a=i||this.config.modalities||["voice"];try{const l={agent_id:o,participant_name:s,participant_metadata:{user_id:""},modality:a[0],modalities:a};console.log("🔗 VoxketClient: Creating session with modalities:",a);const c=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok){let f=`HTTP ${c.status}: Failed to fetch connection details`;try{const p=await c.json();p&&(p.error?f=`API Error: ${p.error}`:p.detail?f=`API Error: ${p.detail}`:p.message&&(f=`API Error: ${p.message}`))}catch{try{const g=await c.text();g&&(f=`API Error: ${g}`)}catch{}}throw new Error(f)}const u=await c.json();let d;return u.agent_info&&(d={id:u.agent_info.agent_info.id,name:u.agent_info.agent_info.name,capabilities:u.agent_info.capabilities,modality_supported:u.agent_info.modality_supported,session_settings:u.agent_info.session_settings||{}},this.currentAgentInfo=d),{serverUrl:u.wss_url,participantToken:u.token,voxketSessionId:u.session_id,agentInfo:d}}catch(l){console.error("VoxketClient: fetchConnectionDetails failed:",l);const c=new Ze(`Failed to fetch connection details: ${l instanceof Error?l.message:"Unknown error"}`,"CONNECTION_FAILED",l);throw this.emit("connection.error",c),c}}async connect(n,r,i){var o;try{this.emit("connection.connecting");const s=await this.fetchConnectionDetails(n,r,i);return await((o=this.room)==null?void 0:o.connect(s.serverUrl,s.participantToken)),this.isConnected=!0,s}catch(s){console.error("VoxketClient: Connection failed:",s);const a=new Ze(`Failed to connect to Voxket services: ${s instanceof Error?s.message:"Unknown error"}`,"CONNECTION_FAILED",s);throw this.emit("connection.error",a),a}}async disconnect(){var n;try{console.log("🔌 VoxketClient: Starting disconnect process..."),this.room&&(console.log("🔌 VoxketClient: Disconnecting from room:",{roomState:this.room.state,numParticipants:this.room.numParticipants,sessionId:(n=this.currentSession)==null?void 0:n.id}),await this.room.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),console.log("🔌 VoxketClient: Creating new room instance..."),this.room=new se.Room,this.setupRoomEventListeners(),console.log("✅ VoxketClient: Disconnect completed successfully"),this.emit("connection.disconnected")}catch(r){console.error("❌ VoxketClient: Disconnect failed:",r);const i=new Ze("Failed to disconnect properly","NETWORK_ERROR",r);throw this.emit("connection.error",i),i}}async createSession(n){var r,i,o,s;try{const a=await this.connect(n.agentId,n.participantName,n.modalities),l={id:a.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:a.agentInfo||this.currentAgentInfo};if(this.currentSession=l,this.emit("session.created",l),(r=n.modalities)!=null&&r.includes("voice"))try{await new Promise(c=>setTimeout(c,500)),(i=this.room)!=null&&i.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(c){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",c)}if((o=n.modalities)!=null&&o.includes("video"))try{await new Promise(c=>setTimeout(c,200)),(s=this.room)!=null&&s.localParticipant&&(console.log("🎥 VoxketClient: Attempting to enable camera for video session"),await this.room.localParticipant.setCameraEnabled(!0),this.emit("track.unmuted",{source:"camera",enabled:!0}),console.log("🎥 VoxketClient: Camera enabled successfully"))}catch(c){console.warn("VoxketClient: Failed to enable camera, but continuing with session:",c)}return setTimeout(()=>{var c;this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state),this.forceAgentConnected(),console.log("🤖 VoxketClient: Session marked as active:",{sessionId:this.currentSession.id,modalities:this.currentSession.activeModalities,agentConnected:this.isAgentConnected,hasRoom:!!this.room,remoteParticipants:((c=this.room)==null?void 0:c.remoteParticipants.size)||0}))},1e3),l}catch(a){throw console.error("VoxketClient: Failed to create session:",a),a instanceof Ze?a:a instanceof TypeError&&a.message.includes("fetch")?new Ze("Network connection failed","CONNECTION_FAILED",a):a instanceof Error&&a.message.includes("Failed to fetch connection details")?new Ze(`API connection failed: ${a.message}`,"CONNECTION_FAILED",a):new Ze(`Failed to create session: ${a instanceof Error?a.message:"Unknown error"}`,"SESSION_NOT_FOUND",a)}}async startSession(n,r){const i={agentId:n||this.config.agentId||"default-agent",participantName:(r==null?void 0:r.participantName)||this.config.participantName||"User",modalities:(r==null?void 0:r.modalities)||this.config.modalities||["voice","chat"],metadata:r==null?void 0:r.metadata};return this.createSession(i)}async endSession(){var n,r;if(!this.currentSession)return null;try{const i={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((r=this.room)==null?void 0:r.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,i),await this.disconnect(),i}catch(i){throw new Ze("Failed to end session","SESSION_NOT_FOUND",i)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getIsAgentConnected(){return this.isAgentConnected}forceAgentConnected(){this.isAgentConnected||(this.isAgentConnected=!0,console.log("🤖 VoxketClient: Agent manually marked as connected"),this.emit("agent.connected",{forced:!0}))}getAgentState(){return this.agentState}setAgentState(n){this.agentState!==n&&(this.agentState=n,this.emit("agent.state.changed",{state:n}))}getAgentAudioTrack(){const n=this.getRemoteParticipants();for(const r of n){const i=r.getTrackPublication(se.Track.Source.Microphone);if(i!=null&&i.track)return{source:se.Track.Source.Microphone,participant:r,publication:i}}return null}getAgentVideoTrack(){const n=this.getRemoteParticipants();for(const r of n){const i=r.getTrackPublication(se.Track.Source.Camera);if(i!=null&&i.track)return{source:se.Track.Source.Camera,participant:r,publication:i}}return null}getVideoTrackRefs(){const n=[],r=this.getLocalParticipant();if(r){const o=r.getTrackPublication(se.Track.Source.Camera);o!=null&&o.track&&n.push({source:se.Track.Source.Camera,participant:r,publication:o});const s=r.getTrackPublication(se.Track.Source.ScreenShare);s!=null&&s.track&&n.push({source:se.Track.Source.ScreenShare,participant:r,publication:s})}const i=this.getRemoteParticipants();for(const o of i){const s=o.getTrackPublication(se.Track.Source.Camera);s!=null&&s.track&&n.push({source:se.Track.Source.Camera,participant:o,publication:s});const a=o.getTrackPublication(se.Track.Source.ScreenShare);a!=null&&a.track&&n.push({source:se.Track.Source.ScreenShare,participant:o,publication:a})}return n}getCameraTrackRefs(){return this.getVideoTrackRefs().filter(n=>n.source===se.Track.Source.Camera)}getScreenShareTrackRefs(){return this.getVideoTrackRefs().filter(n=>n.source===se.Track.Source.ScreenShare)}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(i=>i.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const r=this.chatMessages.findIndex(i=>i.id===n.id);r!==-1&&(this.chatMessages[r]=n)}clearChatMessages(){this.chatMessages=[],this.activeTranscriptions.clear(),this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),console.log("🧹 VoxketClient: Cleared chat messages and transcription history"),this.emit("chat.history.cleared")}renderUI(n={}){var s,a,l,c,u,d,f,p,g;const r=this.resolveTarget(n.target||"body"),i=this.getTargetKey(r);if(Ys.has(r)){console.warn("⚠️ VoxketClient: Target is already being processed, skipping renderUI");return}if(Nn.has(r)){console.log("✋ VoxketClient: Target already has a React root in registry, updating existing props...");const m=this.renderedComponents.get(i);if(m&&m.root){const x={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((s=n.modality)==null?void 0:s.includes("chat"))!==!1,suportsVideoInput:((a=n.modality)==null?void 0:a.includes("video"))===!0,suportsScreenShare:((l=n.modality)==null?void 0:l.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};try{m.root.render(A.createElement(io,{config:this.config,autoConnect:n.autoStart||!1,client:this,children:A.createElement(oo,x)})),console.log("✅ VoxketClient: Successfully updated existing widget with new props");return}catch(y){throw console.error("Error re-rendering existing widget:",y),new Error(`Failed to update existing widget: ${y instanceof Error?y.message:"Unknown error"}`)}}else console.warn("⚠️ Registry inconsistency detected, cleaning up"),Nn.delete(r)}let o=this.renderedComponents.get(i);if(o&&o.target===r&&Nn.has(r)){console.log("🔄 VoxketClient: Reusing existing React root for target:",i);const m=o.root,x={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((c=n.modality)==null?void 0:c.includes("chat"))!==!1,suportsVideoInput:((u=n.modality)==null?void 0:u.includes("video"))===!0,suportsScreenShare:((d=n.modality)==null?void 0:d.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};try{m.render(A.createElement(io,{config:this.config,autoConnect:n.autoStart||!1,client:this,children:A.createElement(oo,x)}))}catch(y){throw console.error("Error rendering Voxket widget:",y),new Error(`Failed to render Voxket widget: ${y instanceof Error?y.message:"Unknown error"}`)}return}Ys.add(r);try{if(o){console.log("🧹 VoxketClient: Cleaning up existing component for different target");try{o.root.unmount(),this.renderedComponents.delete(i),Nn.delete(o.target),r.innerHTML=""}catch(y){console.warn("Failed to cleanup existing root:",y)}}if(Nn.has(r)){console.warn("⚠️ VoxketClient: Target already in registry, skipping root creation");return}console.log("🆕 VoxketClient: Creating new React root for target:",i);const m=Hg.createRoot(r);this.renderedComponents.set(i,{root:m,target:r}),Nn.add(r);const x={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((f=n.modality)==null?void 0:f.includes("chat"))!==!1,suportsVideoInput:((p=n.modality)==null?void 0:p.includes("video"))===!0,suportsScreenShare:((g=n.modality)==null?void 0:g.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};if(!m||typeof m.render!="function")throw new Error("Invalid React root. Make sure React 18+ is properly installed and configured.");try{m.render(A.createElement(io,{config:this.config,autoConnect:n.autoStart||!1,client:this,children:A.createElement(oo,x)}))}catch(y){throw console.error("Error rendering Voxket widget:",y),new Error(`Failed to render Voxket widget: ${y instanceof Error?y.message:"Unknown error"}`)}}finally{Ys.delete(r)}}removeUI(n){var i;const r=n?this.resolveTarget(n):null;if(r){const o=this.getTargetKey(r),s=this.renderedComponents.get(o);if(s){console.log("🗑️ VoxketClient: Removing UI for target:",o),this.renderedComponents.delete(o),Nn.delete(r);try{const l=s.target;l&&l.isConnected?(typeof((i=s.root)==null?void 0:i.unmount)=="function"&&(s.root.unmount(),console.log("✅ VoxketClient: UI unmounted for target:",o)),l.hasChildNodes()&&(l.innerHTML="")):console.log("ℹ️ VoxketClient: Target element already disconnected, skipping unmount")}catch(l){console.warn("Failed to unmount React root:",l)}}else console.log("ℹ️ VoxketClient: No component found for target, cleaning registry:",o),Nn.delete(r),r.isConnected&&r.hasChildNodes()&&(r.innerHTML="");r.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(l=>{try{l.remove()}catch(c){console.warn("Failed to remove element:",c)}}),r===document.body&&r.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(c=>{if(c.classList.contains("bg-black")&&(c.classList.contains("backdrop-blur-sm")||c.classList.contains("bg-opacity-30")))try{c.remove()}catch(u){console.warn("Failed to remove fixed element:",u)}})}}removeAllUI(){for(const[n,r]of this.renderedComponents)r.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(r=>{if(r.classList.contains("bg-black")&&(r.classList.contains("backdrop-blur-sm")||r.classList.contains("bg-opacity-30")))try{r.remove()}catch(i){console.warn("Failed to remove overlay:",i)}})}resolveTarget(n){if(typeof n=="string"){const r=document.querySelector(n);if(!r)throw new Error(`Target element not found: ${n}`);return r}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,r){var i;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new Ze("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new Ze("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new Ze("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const o={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:r||{}},s=await((i=this.room)==null?void 0:i.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",o)}catch(o){throw console.error("VoxketClient: Failed to send chat message:",o),new Ze("Failed to send message","NETWORK_ERROR",o)}}async sendChatMessage(n,r){return this.sendMessage(n,r)}async sendAttachments(n,r){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new Ze("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new Ze("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new Ze("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new Ze("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const i=n.filter(o=>o.type.startsWith("image/"));if(i.length===0)throw new Ze("Only image files are allowed","INVALID_PARAMETER");i.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const o=i.map(async(s,a)=>{const c={id:`att_${Date.now()}_${a}`,content:`📎 ${s.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...r,type:"attachment",fileName:s.name,fileSize:s.size,mimeType:s.type,uploading:!0}};this.emit("chat.message.sent",c);const u=await this.room.localParticipant.sendFile(s,{mimeType:s.type,topic:"images",onProgress:f=>{const p={...c,metadata:{...c.metadata,uploadProgress:f}};this.emit("chat.message.updated",p)}});try{const f=new FileReader,p=new Promise((x,y)=>{f.onload=()=>{typeof f.result=="string"?x(f.result):y(new Error("Failed to convert to base64"))},f.onerror=y});f.readAsDataURL(s);const m={type:"image",data:await p,filename:s.name,mimeType:s.type,size:s.size};await this.room.localParticipant.sendText(JSON.stringify(m),{topic:"images",destinationIdentities:[]})}catch(f){console.warn("VoxketClient: Failed to send image data to agent:",f);try{const p=`I've shared an image: ${s.name}`;await this.room.localParticipant.sendText(p,{topic:"lk.chat",destinationIdentities:[]})}catch(p){console.warn("VoxketClient: Failed to send image notification to agent:",p)}}const d={...c,metadata:{...c.metadata,uploading:!1,uploadProgress:1,streamId:u.id}};return this.emit("chat.message.updated",d),u});await Promise.all(o)}catch(o){throw console.error("VoxketClient: Failed to send attachments:",o),new Ze("Failed to send attachments","NETWORK_ERROR",o)}}async sendAttachment(n,r){return this.sendAttachments([n],r)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var r,i;try{const o=(r=this.room)==null?void 0:r.localParticipant.isMicrophoneEnabled,s=n??!o;await((i=this.room)==null?void 0:i.localParticipant.setMicrophoneEnabled(s)),s?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(o){throw console.error("VoxketClient: Failed to toggle microphone:",o),new Ze("Failed to toggle microphone","PERMISSION_DENIED",o)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var r,i;try{const o=(r=this.room)==null?void 0:r.localParticipant.isCameraEnabled,s=n??!o;await((i=this.room)==null?void 0:i.localParticipant.setCameraEnabled(s)),s?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(o){throw console.error("VoxketClient: Failed to toggle camera:",o),new Ze("Failed to toggle camera","PERMISSION_DENIED",o)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0)),this.emit("track.unmuted",{source:"screenShare",enabled:!0})}catch(r){throw new Ze("Failed to start screen share","PERMISSION_DENIED",r)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1)),this.emit("track.muted",{source:"screenShare",enabled:!1})}catch(r){throw new Ze("Failed to stop screen share","PERMISSION_DENIED",r)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="audioinput")}catch(n){throw new Ze("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput")}catch(n){throw new Ze("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var r;try{if(!((r=this.room)!=null&&r.localParticipant))throw new Error("Not connected to room")}catch(i){throw new Ze("Failed to set audio input device","DEVICE_ERROR",i)}}async setVideoInputDevice(n){var r;try{if(!((r=this.room)!=null&&r.localParticipant))throw new Error("Not connected to room")}catch(i){throw new Ze("Failed to set video input device","DEVICE_ERROR",i)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const r=n.permissions;if(!r)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const i=o=>!!r.canPublish&&(r.canPublishSources.length===0||r.canPublishSources.includes(o));return{camera:i(1),microphone:i(2),screenShare:i(3),data:r.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===se.ConnectionState.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,r]of n.trackPublications)if(r.source===se.Track.Source.Microphone)return r.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,r]of n.trackPublications)if(r.source===se.Track.Source.Camera)return r.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return console.log("🎬 VoxketClient: getScreenShareTrack - no local participant"),null;for(const[,r]of n.trackPublications)if(r.source===se.Track.Source.ScreenShare)return console.log("🎬 VoxketClient: getScreenShareTrack - found screen share track:",{trackSid:r.trackSid,isMuted:r.isMuted,hasTrack:!!r.track}),r.track;return console.log("🎬 VoxketClient: getScreenShareTrack - no screen share track found"),null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack(),r=n?!n.isMuted:!1;return console.log("🎬 VoxketClient: isScreenShareEnabled check:",{hasTrack:!!n,trackMuted:n==null?void 0:n.isMuted,enabled:r}),r}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(r=>{n.push({id:r.identity,name:r.name||r.identity,isLocal:!1})}),n}getSessionMetrics(){var n,r;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((r=this.room)==null?void 0:r.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(r){throw new Ze("Failed to start recording","RECORDING_ERROR",r)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(r){throw new Ze("Failed to stop recording","RECORDING_ERROR",r)}}async registerFrontendRPC(n,r,i="embedded"){return this.rpcManager.registerFrontendRPC(n,r,i)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,r){return this.on(n,r)}registerEventEmitter(n,r){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async i=>{try{const o=await i.readAll();r(o)}catch(o){console.error(`Error processing event for topic '${n}':`,o)}})}catch(i){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,i)}}convertMarkdownToText(n){if(!n)return"";let r=n;return r=r.replace(/\*\*(.*?)\*\*/g,"$1"),r=r.replace(/__(.*?)__/g,"$1"),r=r.replace(/\*(.*?)\*/g,"$1"),r=r.replace(/_(.*?)_/g,"$1"),r=r.replace(/~~(.*?)~~/g,"$1"),r=r.replace(/`([^`]+)`/g,"$1"),r=r.replace(/```[\s\S]*?```/g,""),r=r.replace(/^#{1,6}\s+/gm,""),r=r.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),r.trim()}}const AM=Me.create(Fm),RM=Me.create(Vl),MM=Me.create(UN),IM=Me.create(ig);function OM({theme:e,mode:t,loadingText:n}){const r=Ct(e),i=()=>{switch(t){case"voice":return n||"Connecting to voice agent...";case"chat":return n||"Starting chat session...";case"video":return n||"Connecting to video call...";default:return n||"Connecting..."}};return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full w-full p-8",children:[h.jsxs("div",{className:"text-center",children:[h.jsx("h3",{className:`text-lg font-semibold mb-2 ${r.text.accent}`,children:i()}),h.jsx("p",{className:`text-sm ${r.text.muted}`,children:"Please wait a moment..."})]}),h.jsxs("div",{className:"flex space-x-1 mt-4",children:[h.jsx("div",{className:"w-2 h-2 rounded-full animate-bounce bg-blue-500",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 rounded-full animate-bounce bg-blue-500",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 rounded-full animate-bounce bg-blue-500",style:{animationDelay:"300ms"}})]})]})}const PM=Me.create(OM);function DM({onClick:e,text:t="Open Chat",position:n="bottom-right",theme:r}){const i={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},o=Ct(r);return h.jsx(Me.button,{onClick:e,className:`voxket-popup-trigger fixed ${i[n]} z-50 px-4 py-2 rounded-full shadow-lg ${o.popupTrigger} transition-all duration-200 hover:scale-105`,style:{zIndex:2147483647},initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},"data-position":n,children:t})}function bf({children:e,theme:t,displayType:n="widget",onClose:r,popupPosition:i="bottom-right",onExpand:o}){const s=Ct(t);if(D.useEffect(()=>{if(n==="fullscreen")return document.body.classList.add("voxket-fullscreen-active"),()=>{document.body.classList.remove("voxket-fullscreen-active")}},[n]),n==="fullscreen")return h.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/40 bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",style:{zIndex:2147483647},onClick:a=>{a.target===a.currentTarget&&r&&r()},children:h.jsxs("div",{className:"w-full h-full max-w-7xl max-h-[95vh] rounded-2xl relative bg-transparent flex flex-col",onClick:a=>{a.stopPropagation()},children:[r&&h.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),r()},className:"absolute top-4 cursor-pointer right-4 z-[10000] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",style:{zIndex:2147483647},title:"Exit Fullscreen",type:"button",children:h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),h.jsxs("div",{id:"voice-card",className:`voxket-widget-root theme-${t} ${s.card} w-full h-full flex flex-col rounded-xl shadow-2xl relative overflow-hidden`,"data-theme":t,style:{minHeight:"600px",height:"100%",contain:"layout style paint",overscrollBehavior:"contain"},children:[h.jsx("div",{className:s.cardTopGradient}),h.jsx("div",{className:s.cardPurpleBlur}),h.jsx("div",{className:s.cardPinkBlur}),h.jsx("div",{className:"relative z-10 flex flex-col h-full",children:e}),h.jsx("div",{className:s.cardPulse1}),h.jsx("div",{className:s.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const a={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return h.jsx("div",{className:"fixed rounded-2xl inset-0 z-[9999] pointer-events-none",style:{zIndex:2147483647},children:h.jsxs("div",{className:`fixed rounded-2xl ${a[i]} pointer-events-auto`,style:{zIndex:2147483647},children:[r&&h.jsx("button",{onClick:r,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",style:{zIndex:2147483647},children:"×"}),h.jsxs("div",{id:"voice-card",className:`voxket-widget-root theme-${t} ${s.card} rounded-2xl flex flex-col relative overflow-hidden`,"data-theme":t,style:{width:"350px",height:"500px",contain:"layout style paint",overscrollBehavior:"contain"},children:[h.jsx("div",{className:s.cardTopGradient}),h.jsx("div",{className:s.cardPurpleBlur}),h.jsx("div",{className:s.cardPinkBlur}),h.jsx("div",{className:"relative z-10 flex flex-col h-full w-full",children:e}),h.jsx("div",{className:s.cardPulse1}),h.jsx("div",{className:s.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return h.jsxs("div",{id:"voice-card",className:`voxket-widget-root theme-${t} ${s.card} relative overflow-hidden w-full h-full`,"data-theme":t,style:{height:"100%",maxHeight:"100%",contain:"layout style paint",overscrollBehavior:"contain"},children:[h.jsx("div",{className:s.cardTopGradient}),h.jsx("div",{className:s.cardPurpleBlur}),h.jsx("div",{className:s.cardPinkBlur}),h.jsx("div",{className:"relative z-10 flex flex-col h-full w-full",children:e}),h.jsx("div",{className:s.cardPulse1}),h.jsx("div",{className:s.cardPulse2,style:{animationDelay:"1s"}})]})}function LM(e){if(typeof window>"u")return null;const{agentId:t,participantName:n,baseUrl:r,appSecret:i,appId:o,prompts:s,statusMessage:a,welcomeTitle:l,welcomeSubTitle:c,className:u,width:d,height:f,loadingText:p,suportsChatInput:g=!0,suportsVideoInput:m=!0,suportsScreenShare:x=!0,theme:y="vox",onSessionStart:E,onSessionEnd:v,enableSessionLogging:_=!0,onSessionLogsUpdate:k,onSessionMetricsUpdate:C,modalities:M=["voice"],displayType:N="widget",popupPosition:I="bottom-right",popupTriggerText:b="Open Chat",onPopupToggle:R,voxketClient:O,onDisplayTypeChange:L}=e,[j,H]=D.useState(!1),[ie,ee]=D.useState(null),[P,W]=D.useState(()=>{try{if(O)return!!O.getCurrentSession()}catch(ne){console.error("Error checking existing session:",ne)}return!1}),[w,V]=D.useState(!1),[Y,S]=D.useState(t||""),[$,q]=D.useState(n||"User"),[B,Q]=D.useState(()=>{try{if(O)return O.getCurrentSession()}catch(ne){console.error("Error getting current session:",ne)}return null}),[te,ae]=D.useState(()=>{var ne,$e,Ve;try{if(O){const Ke=O.getCurrentSession();if((ne=Ke==null?void 0:Ke.activeModalities)!=null&&ne.includes("chat"))return"chat";if(($e=Ke==null?void 0:Ke.activeModalities)!=null&&$e.includes("voice"))return"voice";if((Ve=Ke==null?void 0:Ke.activeModalities)!=null&&Ve.includes("video"))return"video"}}catch(Ke){console.error("Error determining current mode:",Ke)}return"welcome"}),[de,De]=D.useState(!1);D.useEffect(()=>{N==="fullscreen"&&console.log("🎯 Widget: Switched to fullscreen mode")},[N]),D.useEffect(()=>{P&&!w?console.log("📊 Session started:",{currentMode:te,sessionId:B==null?void 0:B.id}):!P&&!w&&te==="welcome"&&console.log("📊 Returned to welcome screen")},[P,te,w]);const U=D.useMemo(()=>{try{if(O)return console.log("🔄 Using existing VoxketClient to preserve session state"),O;if(!o||!i||!r){const $e=`Missing required props: ${o?"":"appId "}${i?"":"appSecret "}${r?"":"baseUrl"}`;return console.error("❌ VoxketClient creation failed:",$e),ee(new Error($e)),H(!0),null}const ne={appId:o,appSecret:i,baseUrl:r,agentId:Y,participantName:$||"User",modalities:M};return console.log("🔧 Creating new VoxketClient with config:",{appId:o.substring(0,8)+"...",baseUrl:r,agentId:Y,participantName:$||"User",modalities:M}),new ki(ne)}catch(ne){return console.error("❌ Failed to create VoxketClient:",ne),ee(ne),H(!0),null}},[O,o,i,r,Y,$,M]),Ce=M,K=D.useMemo(()=>{try{if(!U)return console.warn("⚠️ No VoxketClient available, creating fallback room"),new se.Room;const ne=U.getRoom();return console.log("🏠 Widget: Room reference updated:",{roomExists:!!ne,roomState:ne==null?void 0:ne.state,sessionStarted:P,currentMode:te}),ne||new se.Room}catch(ne){return console.error("❌ Error getting room from client:",ne),new se.Room}},[U,P,te]);D.useEffect(()=>{if(K){const ne=()=>{console.log("🏠 Widget: Room state changed:",{state:K.state,numParticipants:K.numParticipants,isConnected:K.state==="connected",sessionId:B==null?void 0:B.id})},$e=(Ve,Ke,nn)=>{console.log("🎵 Widget: Track subscribed:",{trackKind:Ve.kind,trackSource:Ve.source,participantSid:nn.sid,participantIdentity:nn.identity,sessionId:B==null?void 0:B.id})};return K.on(se.RoomEvent.Connected,ne),K.on(se.RoomEvent.Disconnected,ne),K.on(se.RoomEvent.TrackSubscribed,$e),()=>{K.off(se.RoomEvent.Connected,ne),K.off(se.RoomEvent.Disconnected,ne),K.off(se.RoomEvent.TrackSubscribed,$e)}}},[K,B==null?void 0:B.id]),D.useEffect(()=>{!w&&te==="welcome"?console.log("🎬 Widget: Welcome screen ready"):P&&te!=="welcome"&&console.log("🎬 Widget: Session mode active:",te)},[te,w,P]),D.useEffect(()=>{(te==="voice"||te==="video"||te==="chat")&&!B&&!P&&!w&&U&&!U.connected&&(console.log("🔄 Auto-correcting: Found orphaned mode without session, returning to welcome"),ae("welcome"),V(!1))},[te,B,P,w,U]);const{sessionMetrics:ye,sessionLogs:me,logEvent:ge}=og({room:K,onSessionStart:E,onSessionEnd:v,enableConsoleLogging:_,enableLocalStorage:_,voxketSessionId:B==null?void 0:B.id});D.useEffect(()=>{k&&k(me)},[me,k]),D.useEffect(()=>{C&&ye&&C(ye)},[ye,C]),D.useEffect(()=>{if(!U)return;const ne=()=>{const $e=U.connected,Ve=U.getCurrentSession();console.log("🔗 Connection state changed:",{isConnected:$e,currentSessionId:Ve==null?void 0:Ve.id,currentMode:te,loading:w,sessionStarted:P}),!$e&&P&&!w&&(console.log("🔴 Connection lost during active session - returning to welcome"),V(!1),W(!1),Q(null),ae("welcome")),$e&&Ve&&w&&(console.log("🟢 Connected with active session - removing loader"),V(!1),W(!0),Q(Ve))};return U.on("connectionStateChanged",ne),U.on("sessionEnded",()=>{console.log("📞 Session ended - returning to welcome"),V(!1),W(!1),Q(null),ae("welcome")}),()=>{U.off("connectionStateChanged",ne),U.off("sessionEnded",()=>{})}},[U,te,w,P]),D.useEffect(()=>{const ne=Ve=>{console.log("🔴 Widget: Room disconnected:",Ve),console.log("🔍 Widget: Current state on disconnect:",{currentMode:te,sessionStarted:P,currentSessionId:B==null?void 0:B.id,loading:w}),V(!1),W(!1),Q(null),ae("welcome"),console.log("🏠 Widget: Automatically returning to welcome screen after disconnect")},$e=Ve=>{console.log("📹 Media devices error:",Ve)};return K.on(se.RoomEvent.MediaDevicesError,$e),K.on(se.RoomEvent.Disconnected,ne),()=>{K.off(se.RoomEvent.Disconnected,ne),K.off(se.RoomEvent.MediaDevicesError,$e)}},[K,te,P,B==null?void 0:B.id,w]);const Ee=async()=>{try{if(!U){console.error("❌ VoxketClient not available"),ee(new Error("VoxketClient not initialized")),H(!0);return}V(!0),ae("voice"),console.log("🎤 Starting voice session...",{agentId:Y,participantName:$}),console.log("🎤 Pre-start state:",{currentMode:"voice",sessionStarted:!1,loading:!0}),ge("USER_STARTED_VOICE_SESSION",{agentId:Y,participantName:$});const ne=await U.startSession(Y,{participantName:$||"User",modalities:["voice",...m?["video"]:[]]});console.log("✅ Voice session started successfully:",ne.id),Q(ne),W(!0),V(!1),E&&E(ne.id)}catch(ne){console.error("❌ Failed to start voice session:",ne),V(!1),W(!1),ae("welcome")}},Te=async()=>{try{if(!U){console.error("❌ VoxketClient not available"),ee(new Error("VoxketClient not initialized")),H(!0);return}V(!0),ae("chat"),console.log("💬 Starting chat session...",{agentId:Y,participantName:$}),ge("USER_STARTED_CHAT_SESSION",{agentId:Y,participantName:$});const ne=await U.startSession(Y,{participantName:$||"User",modalities:["chat"]});console.log("✅ Chat session started successfully:",ne.id),Q(ne),W(!0),V(!1),E&&E(ne.id)}catch(ne){console.error("❌ Failed to start chat session:",ne),V(!1),W(!1),ae("welcome")}},Ne=async()=>{try{if(!U){console.error("❌ VoxketClient not available"),ee(new Error("VoxketClient not initialized")),H(!0);return}V(!0),ae("video"),console.log("📺 Starting video session...",{agentId:Y,participantName:$}),console.log("📺 Pre-start state:",{currentMode:"video",sessionStarted:!1,loading:!0}),ge("USER_STARTED_VIDEO_SESSION",{agentId:Y,participantName:$});const ne=await U.startSession(Y,{participantName:$||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",ne.id),Q(ne),W(!0),V(!1),E&&E(ne.id)}catch(ne){console.error("❌ Failed to start video session:",ne),V(!1),W(!1),ae("welcome")}},we=()=>{console.log("🔄 Widget: handleBackToWelcome called",{currentMode:te,sessionStarted:P,currentSessionId:B==null?void 0:B.id,displayType:N,loading:w}),ae("welcome"),V(!1),L&&L(e.displayType||"widget"),B&&P?(console.log("🧹 Widget: Cleaning up active session"),W(!1),Q(null),U&&(console.log("🔌 Widget: Disconnecting client and cleaning up room"),U.disconnect().catch(ne=>{console.error("❌ Widget: Error during disconnect:",ne)}))):(console.log("📝 Widget: No active session to clean up"),U&&U.connected&&(console.log("🔌 Widget: Force disconnecting client for fresh state"),U.disconnect().catch(ne=>{console.error("❌ Widget: Error during force disconnect:",ne)}))),N==="popup"&&!de&&De(!0),console.log("✅ Widget: handleBackToWelcome completed",{newCurrentMode:"welcome",newLoading:!1,newSessionStarted:!1})},ot=()=>{const ne=!de;De(ne),R&&R(ne),!ne&&!(B&&P)&&(ae("welcome"),W(!1),Q(null))},vt=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),e.onDisplayTypeChange?e.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},He=()=>{if(console.log("🔄 Expand to fullscreen requested"),e.onDisplayTypeChange)e.onDisplayTypeChange("fullscreen");else{console.warn("⚠️ No onDisplayTypeChange callback provided for expand functionality");const ne=document.getElementById("voice-card")||document.querySelector(".voxket-widget-container");ne&&ne.requestFullscreen&&ne.requestFullscreen().catch($e=>{console.warn("⚠️ Fullscreen API not supported or failed:",$e)})}};D.useEffect(()=>{var ne,$e,Ve;if(O&&U){const Ke=U.getCurrentSession();U.connected,Ke&&(console.log("✅ Restoring session state:",Ke.id),Q(Ke),W(!0),V(!1),(ne=Ke.activeModalities)!=null&&ne.includes("chat")?ae("chat"):($e=Ke.activeModalities)!=null&&$e.includes("voice")?ae("voice"):(Ve=Ke.activeModalities)!=null&&Ve.includes("video")&&ae("video"))}},[O,U]),D.useEffect(()=>()=>{!O&&U&&U.disconnect()},[U,O]);let bt=te==="video"?"w-[32rem]":"w-96",F=te==="video"?"h-[30rem]":"h-[25rem]",Z={};if(d&&(d.startsWith("w-")?bt=d:(Z.width=d,bt="")),f&&(f.startsWith("h-")?F=f:(Z.height=f,F="")),N==="popup"&&!de)return console.log("🟡 Showing popup trigger button"),h.jsx(DM,{onClick:ot,text:b,position:I,theme:y});if(j||!U){const ne=(ie==null?void 0:ie.message)||"VoxketWidget encountered an error. Please check your configuration.";return h.jsx("div",{className:`voxket-widget-root theme-${y} flex items-center justify-center p-8 ${u||""}`,style:{width:d||"400px",height:f||"500px",border:"1px solid #ff4444",borderRadius:"8px",background:"#fff5f5",color:"#cc0000"},children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"text-4xl mb-4",children:"⚠️"}),h.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Widget Error"}),h.jsx("p",{className:"text-sm mb-4",children:ne}),h.jsx("button",{onClick:()=>{H(!1),ee(null),window.location.reload()},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",children:"Retry"})]})})}let xe=`voxket-widget-root theme-${y}`,Ae={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};N==="widget"?(xe+=` flex min-h-fit ${bt} ${F} ${u}`,Ae={...Ae,...Z}):(xe=`${u||""}`,Ae={});const Be=h.jsx("div",{className:"h-full w-full flex flex-col overflow-hidden relative z-10",children:h.jsxs(Sr,{mode:"wait",children:[te==="welcome"&&!w&&h.jsx(IM,{agentId:Y,participantName:$||"",onAgentIdChange:S,onParticipantNameChange:q,onStartCall:Ee,onStartChat:Te,onStartVideo:Ne,disabled:P||w,prompts:s,statusMessage:a,title:l,subTitle:c,theme:y,modalities:Ce,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),w&&(te==="voice"||te==="chat"||te==="video")&&h.jsx(PM,{theme:y,mode:te,loadingText:p,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.3,ease:"easeInOut"}},`loading-${te}`),te==="voice"&&!w&&P&&U&&h.jsxs(Ft.RoomContext.Provider,{value:K,children:[h.jsx(Ft.RoomAudioRenderer,{},`audio-${(B==null?void 0:B.id)||"no-session"}`),h.jsx(Ft.StartAudio,{label:"Start Audio"},`start-audio-${(B==null?void 0:B.id)||"no-session"}`),h.jsx(AM,{loadingText:p,participantName:$||"User",sessionStarted:P,disabled:!1,theme:y,client:U,displayType:N,onBack:N==="popup"?ot:we,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"voice-session")]}),te==="chat"&&!w&&P&&U&&h.jsx(RM,{client:U,theme:y,displayType:N,onBack:N==="popup"?ot:we,onEndChat:we,disabled:!1,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),te==="video"&&!w&&P&&U&&h.jsxs(Ft.RoomContext.Provider,{value:K,children:[h.jsx(Ft.RoomAudioRenderer,{},`audio-video-${(B==null?void 0:B.id)||"no-session"}`),h.jsx(Ft.StartAudio,{label:"Start Audio"},`start-audio-video-${(B==null?void 0:B.id)||"no-session"}`),h.jsx(MM,{client:U,theme:y,displayType:N,onBack:N==="popup"?ot:we,onEndCall:we,disabled:!1,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-session")]})]})});return N==="fullscreen"||N==="popup"?h.jsx(bf,{theme:y,displayType:N,popupPosition:I,onClose:N==="fullscreen"?vt:ot,children:Be}):h.jsx("div",{className:xe,style:Ae,children:h.jsx(bf,{theme:y,displayType:N,popupPosition:I,onExpand:He,children:Be})})}function oo(e){return h.jsx(Xl,{children:h.jsx(LM,{...e})})}function FM({logs:e,onClear:t,onExport:n}){const[r,i]=A.useState(!1),[o,s]=A.useState(""),a=e.filter(l=>!o||l.event.toLowerCase().includes(o.toLowerCase()));return r?h.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:h.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[h.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",e.length,")"]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",placeholder:"Filter events...",value:o,onChange:l=>s(l.target.value),className:"px-3 py-1 border rounded text-sm"}),h.jsx("button",{onClick:t,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),h.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),h.jsx("button",{onClick:()=>i(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.length===0?h.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):h.jsx("div",{className:"space-y-2",children:a.map((l,c)=>h.jsxs("div",{className:"border rounded p-3 text-sm",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{className:"font-semibold text-blue-600",children:l.event}),h.jsx("span",{className:"text-gray-500 text-xs",children:new Date(l.timestamp).toLocaleTimeString()})]}),l.sessionId&&h.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",l.sessionId]}),l.data&&h.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:h.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(l.data,null,2)})})]},c))})})]})}):h.jsxs("button",{onClick:()=>i(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",e.length,")"]})}function BM({metrics:e}){return e?h.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[h.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),h.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Session ID:"}),h.jsx("div",{className:"font-mono text-xs",children:e.sessionId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Start Time:"}),h.jsx("div",{children:new Date(e.startTime).toLocaleString()})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Messages:"}),h.jsx("div",{children:e.totalMessages})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Participants:"}),h.jsx("div",{children:e.participantCount})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),h.jsx("div",{children:e.connectionIssues})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Duration:"}),h.jsxs("div",{children:[Math.round((Date.now()-new Date(e.startTime).getTime())/1e3),"s"]})]})]})]}):null}function er(){const{currentSession:e,sessionState:t,sessionMetrics:n,createSession:r,endSession:i}=fn(),o=A.useCallback(async(a,l)=>await r(a,l),[r]),s=A.useCallback(async()=>await i(),[i]);return{session:e,state:t,metrics:n,isActive:e!==null&&t!=="disconnected",isConnecting:t==="connecting",isConnected:t==="connected"||t==="active",start:o,stop:s}}function lg(){const{sessionMetrics:e,currentSession:t}=fn();return{metrics:e,sessionId:t==null?void 0:t.id,duration:e==null?void 0:e.duration,participantCount:e==null?void 0:e.participantCount,messageCount:e==null?void 0:e.messageCount,audioQuality:e==null?void 0:e.audioQuality,networkStats:e==null?void 0:e.networkStats}}function cg(){const{setMicrophoneEnabled:e,client:t}=fn(),[n,r]=A.useState(!1),[i,o]=A.useState(!1),s=A.useCallback(async()=>{if(!i){o(!0);try{const c=!n;await e(c),r(c)}catch(c){console.error("Failed to toggle microphone:",c)}finally{o(!1)}}},[n,i,e]),a=A.useCallback(async()=>{if(!(n||i)){o(!0);try{await e(!0),r(!0)}catch(c){console.error("Failed to enable microphone:",c)}finally{o(!1)}}},[n,i,e]),l=A.useCallback(async()=>{if(!(!n||i)){o(!0);try{await e(!1),r(!1)}catch(c){console.error("Failed to disable microphone:",c)}finally{o(!1)}}},[n,i,e]);return{isEnabled:n,isLoading:i,toggle:s,enable:a,disable:l}}function ug(){const{setCameraEnabled:e}=fn(),[t,n]=A.useState(!1),[r,i]=A.useState(!1),o=A.useCallback(async()=>{if(!r){i(!0);try{const l=!t;await e(l),n(l)}catch(l){console.error("Failed to toggle camera:",l)}finally{i(!1)}}},[t,r,e]),s=A.useCallback(async()=>{if(!(t||r)){i(!0);try{await e(!0),n(!0)}catch(l){console.error("Failed to enable camera:",l)}finally{i(!1)}}},[t,r,e]),a=A.useCallback(async()=>{if(!(!t||r)){i(!0);try{await e(!1),n(!1)}catch(l){console.error("Failed to disable camera:",l)}finally{i(!1)}}},[t,r,e]);return{isEnabled:t,isLoading:r,toggle:o,enable:s,disable:a}}function dg(){const{startScreenShare:e,stopScreenShare:t}=fn(),[n,r]=A.useState(!1),[i,o]=A.useState(!1),s=A.useCallback(async()=>{if(!(n||i)){o(!0);try{await e(),r(!0)}catch(c){console.error("Failed to start screen share:",c)}finally{o(!1)}}},[n,i,e]),a=A.useCallback(async()=>{if(!(!n||i)){o(!0);try{await t(),r(!1)}catch(c){console.error("Failed to stop screen share:",c)}finally{o(!1)}}},[n,i,t]),l=A.useCallback(async()=>{n?await a():await s()},[n,s,a]);return{isSharing:n,isLoading:i,start:s,stop:a,toggle:l}}function jM(){const{client:e}=fn(),[t,n]=A.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),r=A.useMemo(()=>t.tracks.find(m=>m.isLocal),[t.tracks]),i=A.useMemo(()=>t.tracks.filter(m=>!m.isLocal),[t.tracks]),o=A.useCallback(async()=>{try{r!=null&&r.isEnabled?await(e==null?void 0:e.disableCamera()):await(e==null?void 0:e.enableCamera())}catch(m){throw console.error("Failed to toggle camera:",m),m}},[e,r]),s=A.useCallback(async()=>{try{t.tracks.find(x=>x.isScreenShare)?await(e==null?void 0:e.stopScreenShare()):await(e==null?void 0:e.startScreenShare())}catch(m){throw console.error("Failed to toggle screen share:",m),m}},[e,t.tracks]),a=A.useCallback(m=>{n(x=>({...x,layout:m}))},[]),l=A.useCallback(m=>{n(x=>({...x,pinnedTrack:m}))},[]),c=A.useCallback(()=>{n(m=>({...m,pinnedTrack:void 0}))},[]),u=A.useCallback(async()=>{try{await(e==null?void 0:e.startRecording()),n(m=>({...m,isRecording:!0}))}catch(m){throw console.error("Failed to start recording:",m),m}},[e]),d=A.useCallback(async()=>{try{await(e==null?void 0:e.stopRecording()),n(m=>({...m,isRecording:!1}))}catch(m){throw console.error("Failed to stop recording:",m),m}},[e]),f=A.useCallback(m=>t.tracks.find(x=>x.id===m),[t.tracks]),p=A.useCallback(m=>t.tracks.filter(x=>x.participantId===m),[t.tracks]),g=A.useCallback(m=>m.isEnabled&&t.tracks.includes(m),[t.tracks]);return A.useEffect(()=>{if(!e)return;const m=E=>{n(v=>({...v,tracks:[...v.tracks.filter(_=>_.id!==E.id),E]}))},x=E=>{n(v=>{var _;return{...v,tracks:v.tracks.filter(k=>k.id!==E),pinnedTrack:((_=v.pinnedTrack)==null?void 0:_.id)===E?void 0:v.pinnedTrack}})},y=E=>{n(v=>({...v,tracks:v.tracks.map(_=>_.id===E.id?E:_)}))};return e.on("videoTrackAdded",m),e.on("videoTrackRemoved",x),e.on("videoTrackUpdated",y),()=>{e.off("videoTrackAdded",m),e.off("videoTrackRemoved",x),e.off("videoTrackUpdated",y)}},[e]),{tracks:t.tracks,localTrack:r,remoteTraracks:i,pinnedTrack:t.pinnedTrack,layout:t.layout,isRecording:t.isRecording,toggleCamera:o,toggleScreenShare:s,setLayout:a,pinTrack:l,unpinTrack:c,startRecording:u,stopRecording:d,getTrackById:f,getTracksByParticipant:p,isTrackActive:g}}function Ko(){const{chatMessages:e,sendChatMessage:t,currentSession:n}=fn(),[r,i]=A.useState(!1),o=A.useCallback(async c=>{if(!(!c.trim()||r||!n)){i(!0);try{await t(c.trim())}catch(u){throw console.error("Failed to send chat message:",u),u}finally{i(!1)}}},[t,r,n]),{userMessages:s,agentMessages:a,allMessages:l}=A.useMemo(()=>{const c=e.filter(d=>d.sender.type==="participant"),u=e.filter(d=>d.sender.type==="agent");return{userMessages:c,agentMessages:u,allMessages:e}},[e]);return{messages:l,userMessages:s,agentMessages:a,messageCount:l.length,isSending:r,canSend:!!n&&!r,send:o}}function $M(){const{send:e,isSending:t,canSend:n}=Ko(),[r,i]=A.useState(""),o=A.useCallback(async()=>{if(!(!r.trim()||!n))try{await e(r),i("")}catch(a){throw a}},[r,e,n]),s=A.useCallback(a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),o())},[o]);return{value:r,setValue:i,send:o,handleKeyPress:s,isSending:t,canSend:n&&r.trim().length>0}}function ec(){const{isConnected:e,isConnecting:t,connectionError:n,connect:r,disconnect:i}=fn(),o=A.useCallback(async()=>{if(!(e||t))try{await r()}catch(a){throw console.error("Failed to connect:",a),a}},[r,e,t]),s=A.useCallback(async()=>{if(e)try{await i()}catch(a){throw console.error("Failed to disconnect:",a),a}},[i,e]);return{isConnected:e,isConnecting:t,isDisconnected:!e&&!t,error:n,hasError:!!n,connect:o,disconnect:s}}function fg(){const{participants:e}=fn();return{participants:e,count:e.length,localParticipant:e.find(t=>t.isLocal),remoteParticipants:e.filter(t=>!t.isLocal)}}const hg=A.createContext({}),Si=()=>A.useContext(hg);function pg({children:e,...t}){return h.jsx(hg.Provider,{value:t,children:e})}function so({name:e,children:t,fallback:n,className:r}){return h.jsx("div",{className:`voxket-slot voxket-slot--${e} ${r||""}`,children:t||n})}function mg(e,t={}){return Object.assign(e,t)}function gg({showMicrophoneControl:e=!0,showCameraControl:t=!0,showScreenShareControl:n=!0,showSessionActions:r=!0,customControls:i,className:o=""}){const s=er(),a=cg(),l=ug(),c=dg(),u=Si(),d=["voxket-session-controls",`voxket-session-controls--${u.variant||"default"}`,`voxket-session-controls--${u.size||"md"}`,s.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",o].filter(Boolean).join(" ");return!s.isActive&&!r?h.jsx("div",{className:d,children:h.jsx("div",{className:"voxket-controls-inactive",children:h.jsx("p",{children:"Controls available during active session"})})}):h.jsxs("div",{className:d,children:[r&&h.jsx("div",{className:"voxket-session-actions",children:s.isActive?h.jsx("button",{onClick:s.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):h.jsx(VM,{})}),s.isActive&&h.jsxs("div",{className:"voxket-media-controls",children:[e&&h.jsxs("button",{onClick:a.toggle,disabled:a.isLoading,className:`voxket-button voxket-button--media ${a.isEnabled?"voxket-button--active":""}`,title:a.isEnabled?"Mute microphone":"Unmute microphone",children:[h.jsx("span",{className:"voxket-icon",children:"🎤"}),a.isLoading?"Loading...":a.isEnabled?"Mute":"Unmute"]}),t&&h.jsxs("button",{onClick:l.toggle,disabled:l.isLoading,className:`voxket-button voxket-button--media ${l.isEnabled?"voxket-button--active":""}`,title:l.isEnabled?"Stop camera":"Start camera",children:[h.jsx("span",{className:"voxket-icon",children:"📹"}),l.isLoading?"Loading...":l.isEnabled?"Stop Video":"Start Video"]}),n&&h.jsxs("button",{onClick:c.toggle,disabled:c.isLoading,className:`voxket-button voxket-button--media ${c.isSharing?"voxket-button--active":""}`,title:c.isSharing?"Stop screen share":"Start screen share",children:[h.jsx("span",{className:"voxket-icon",children:"🖥️"}),c.isLoading?"Loading...":c.isSharing?"Stop Share":"Share Screen"]})]}),i&&h.jsx("div",{className:"voxket-custom-controls",children:i})]})}function VM(){er();const[e,t]=A.useState(!1),n=async()=>{t(!0);try{console.log("Start session - agentId needed")}catch(r){console.error("Failed to start session:",r)}finally{t(!1)}};return h.jsx("button",{onClick:n,disabled:e,className:"voxket-button voxket-button--primary",children:e?"Starting...":"Start Session"})}function tc({showConnectionStatus:e=!0,showSessionInfo:t=!0,showAgentInfo:n=!0,className:r=""}){const i=er(),o=ec(),s=Si(),a=["voxket-session-header",`voxket-session-header--${s.variant||"default"}`,`voxket-session-header--${s.size||"md"}`,r].filter(Boolean).join(" ");return h.jsxs("div",{className:a,children:[e&&h.jsxs("div",{className:"voxket-connection-status",children:[h.jsx("div",{className:`voxket-status-indicator ${o.isConnected?"connected":"disconnected"}`}),h.jsx("span",{className:"voxket-status-text",children:o.isConnecting?"Connecting...":o.isConnected?"Connected":"Disconnected"})]}),t&&i.session&&h.jsxs("div",{className:"voxket-session-info",children:[h.jsxs("div",{className:"voxket-session-id",children:["Session: ",i.session.id.slice(-8)]}),h.jsxs("div",{className:"voxket-session-state",children:["State: ",i.state]})]}),n&&i.session&&h.jsxs("div",{className:"voxket-agent-info",children:[h.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",i.session.agentId]}),h.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",i.session.activeModalities.join(", ")]})]}),o.error&&h.jsxs("div",{className:"voxket-error-message",children:["Error: ",o.error.message]})]})}function nc({showChat:e=!0,showTranscriptions:t=!1,customContent:n,className:r=""}){const i=er(),o=Ko(),s=Si(),a=["voxket-session-content",`voxket-session-content--${s.variant||"default"}`,`voxket-session-content--${s.size||"md"}`,r].filter(Boolean).join(" ");return i.isActive?h.jsx("div",{className:a,children:n||h.jsxs(h.Fragment,{children:[e&&h.jsxs("div",{className:"voxket-chat-container",children:[h.jsxs("div",{className:"voxket-chat-messages",children:[o.messages.map(l=>h.jsxs("div",{className:`voxket-message voxket-message--${l.sender.type}`,children:[h.jsxs("div",{className:"voxket-message-header",children:[h.jsx("span",{className:"voxket-message-sender",children:l.sender.name}),h.jsx("span",{className:"voxket-message-time",children:l.timestamp.toLocaleTimeString()})]}),h.jsx("div",{className:"voxket-message-content",children:l.content})]},l.id)),o.messages.length===0&&h.jsx("div",{className:"voxket-empty-messages",children:h.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),h.jsx(zM,{})]}),t&&h.jsx("div",{className:"voxket-transcriptions",children:h.jsx("div",{className:"voxket-transcription-placeholder",children:h.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):h.jsx("div",{className:a,children:h.jsx("div",{className:"voxket-inactive-state",children:h.jsxs("div",{className:"voxket-inactive-message",children:[h.jsx("h3",{children:"Start a conversation"}),h.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function zM(){const e=Ko(),[t,n]=A.useState(""),r=async()=>{if(!(!t.trim()||!e.canSend))try{await e.send(t),n("")}catch(o){console.error("Failed to send message:",o)}},i=o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),r())};return h.jsxs("div",{className:"voxket-chat-input",children:[h.jsx("input",{type:"text",value:t,onChange:o=>n(o.target.value),onKeyPress:i,placeholder:"Type your message...",disabled:!e.canSend,className:"voxket-input"}),h.jsx("button",{onClick:r,disabled:!e.canSend||!t.trim(),className:"voxket-send-button",children:e.isSending?"Sending...":"Send"})]})}function rc({showMetrics:e=!0,showParticipants:t=!0,showStatus:n=!0,customFooter:r,className:i=""}){const o=er(),s=lg(),a=fg(),l=Si(),c=["voxket-session-footer",`voxket-session-footer--${l.variant||"default"}`,`voxket-session-footer--${l.size||"md"}`,i].filter(Boolean).join(" ");return o.isActive?h.jsx("div",{className:c,children:r||h.jsxs(h.Fragment,{children:[n&&h.jsxs("div",{className:"voxket-session-status",children:[h.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),h.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),e&&s.metrics&&h.jsxs("div",{className:"voxket-session-metrics",children:[h.jsxs("div",{className:"voxket-metric",children:[h.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),h.jsx("span",{className:"voxket-metric-value",children:UM(s.duration||0)})]}),h.jsxs("div",{className:"voxket-metric",children:[h.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),h.jsx("span",{className:"voxket-metric-value",children:s.metrics.messageCount})]})]}),t&&h.jsxs("div",{className:"voxket-participants-info",children:[h.jsxs("span",{className:"voxket-participants-count",children:[a.count," participant",a.count!==1?"s":""]}),a.remoteParticipants.length>0&&h.jsx("div",{className:"voxket-participant-list",children:a.remoteParticipants.map(u=>h.jsx("span",{className:"voxket-participant-name",children:u.name},u.id))})]})]})}):h.jsx("div",{className:c,children:h.jsx("div",{className:"voxket-footer-inactive",children:h.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function UM(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60);return r>0?`${r}:${(n%60).toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`:`${n}:${(t%60).toString().padStart(2,"0")}`}function HM({agentId:e,sessionConfig:t,autoStart:n=!1,onSessionStart:r,onSessionEnd:i,variant:o="default",size:s="md",theme:a,className:l="",children:c}){var p;const u=er(),d=ec();A.useEffect(()=>{n&&e&&d.isConnected&&!u.isActive&&u.start(e,t).catch(console.error)},[n,e,d.isConnected,u.isActive]),A.useEffect(()=>{var g;(g=u.session)!=null&&g.id&&r&&r(u.session.id)},[(p=u.session)==null?void 0:p.id,r]),A.useEffect(()=>()=>{u.isActive&&i&&u.stop().then(i).catch(console.error)},[]);const f=["voxket-session",`voxket-session--${o}`,`voxket-session--${s}`,u.isActive?"voxket-session--active":"voxket-session--inactive",l].filter(Boolean).join(" ");return h.jsx(pg,{variant:o,size:s,theme:a,className:l,children:h.jsx("div",{className:f,children:c||h.jsxs(h.Fragment,{children:[h.jsx(so,{name:"header",fallback:h.jsx(tc,{})}),h.jsx(so,{name:"content",fallback:h.jsx(nc,{})}),h.jsx(so,{name:"footer",fallback:h.jsx(rc,{})})]})})})}const bg=mg(HM,{Header:tc,Content:nc,Footer:rc,Controls:gg}),Yn={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},La={...Yn,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},Fa={...Yn,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},yg=A.createContext(null),xg=()=>{const e=A.useContext(yg);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};function WM({theme:e="default",themes:t={},children:n,cssVariables:r=!0,className:i=""}){const[o,s]=A.useState(()=>{const f={default:Yn,dark:La,enterprise:Fa,...t};return typeof e=="string"?f[e]||Yn:e}),[a,l]=A.useState(()=>({default:Yn,dark:La,enterprise:Fa,...t})),c=f=>{if(typeof f=="string"){const p=a[f];p&&s(p)}else s(f)},u=f=>{l(p=>({...p,[f.name]:f}))};A.useEffect(()=>{if(r&&typeof document<"u"){const f=document.documentElement;Object.entries(wg(o)).forEach(([p,g])=>{f.style.setProperty(`--voxket-${p}`,g)})}},[o,r]);const d={theme:o,setTheme:c,themes:a,registerTheme:u};return h.jsx(yg.Provider,{value:d,children:h.jsx("div",{className:`voxket-theme voxket-theme--${o.name} ${i}`,children:n})})}function wg(e){const t={},n=(r,i="")=>{for(const[o,s]of Object.entries(r)){const a=i?`${i}-${o}`:o;typeof s=="object"&&s!==null&&!Array.isArray(s)?n(s,a):t[a]=String(s)}};return n(e),t}function GM(e=Yn,t){return{...e,...t,colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography},spacing:{...e.spacing,...t.spacing},borderRadius:{...e.borderRadius,...t.borderRadius},shadows:{...e.shadows,...t.shadows}}}function KM(e){var n;const{theme:t}=xg();return((n=t.components)==null?void 0:n[e])||{}}const qM=Jl("voice-modality","voice",{onActivate:async e=>{const t=e.config;t.enableTranscription&&YM(e),t.enableVoiceActivation&&ZM(e,t),console.log("Voice modality activated",t)},onDeactivate:async e=>{console.log("Voice modality deactivated")},onMessage:async(e,t)=>{t.type==="audio"&&XM(e,t)}});function YM(e,t){e.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),e.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function ZM(e,t){const n=t.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function XM(e,t){console.log("Playing audio response:",t.content)}const QM=Jl("chat-modality","chat",{onActivate:async e=>{const t=e.config;t.enableRichText&&JM(),t.enableFileUpload&&eI(e),t.enableCustomComponents&&tI(),console.log("Chat modality activated",t)},onDeactivate:async e=>{console.log("Chat modality deactivated")},onMessage:async(e,t)=>{const n=e.config;t.type==="ui_component"?nI(e,t):t.type==="text"&&n.enableRichText&&rI(e,t)}});function JM(e){console.log("Rich text support enabled")}function eI(e){console.log("File upload enabled"),e.on("chat.file.uploaded",t=>{console.log("File uploaded:",t.name)})}function tI(e){console.log("Custom components enabled");const t=new Map;t.set("quick-actions",iI),t.set("form",oI),t.set("card",sI),t.set("chart",aI)}function nI(e,t){const{componentType:n,props:r}=t.metadata;console.log("Rendering custom component:",n,r),e.emit("chat.component.render",{type:n,props:r,timestamp:new Date})}function rI(e,t){console.log("Processing rich text message:",t.content)}function iI(e){return{type:"quick-actions",actions:e.actions||[],layout:e.layout||"horizontal"}}function oI(e){return{type:"form",fields:e.fields||[],submitAction:e.submitAction,validation:e.validation}}function sI(e){return{type:"card",title:e.title,content:e.content,actions:e.actions,variant:e.variant||"default"}}function aI(e){return{type:"chart",chartType:e.chartType||"line",data:e.data,options:e.options}}function ao({track:e,participantName:t,showControls:n=!0,showName:r=!0,showMuteIndicator:i=!0,isPinned:o=!1,className:s="",onClick:a,onPin:l,onUnpin:c}){const u=A.useRef(null),[d,f]=A.useState(!1);A.useEffect(()=>{if(!u.current||!e.isEnabled)return;const x=u.current;return x.srcObject=null,()=>{x.srcObject&&(x.srcObject=null)}},[e]);const p=()=>{a==null||a(e)},g=x=>{x.stopPropagation(),o?c==null||c(e):l==null||l(e)},m=["voxket-video-tile",e.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",e.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",o?"voxket-video-tile--pinned":"",e.isEnabled?"":"voxket-video-tile--disabled",d?"voxket-video-tile--hovered":"",s].filter(Boolean).join(" ");return h.jsxs("div",{className:m,onClick:p,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{aspectRatio:e.dimensions?`${e.dimensions.width} / ${e.dimensions.height}`:"16 / 9"},children:[h.jsx("video",{ref:u,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:e.isLocal}),!e.isEnabled&&h.jsxs("div",{className:"voxket-video-placeholder",children:[h.jsx("div",{className:"voxket-video-placeholder-icon",children:e.isScreenShare?"🖥️":"📹"}),h.jsx("p",{className:"voxket-video-placeholder-text",children:e.isScreenShare?"Screen sharing paused":"Camera off"})]}),h.jsxs("div",{className:"voxket-video-overlay",children:[r&&t&&h.jsxs("div",{className:"voxket-video-name",children:[t,e.isLocal&&" (You)"]}),i&&!e.isEnabled&&h.jsx("div",{className:"voxket-video-mute-indicator",children:"🔇"}),n&&(d||o)&&h.jsxs("div",{className:"voxket-video-controls",children:[h.jsx("button",{className:`voxket-video-control-btn ${o?"voxket-video-control-btn--active":""}`,onClick:g,title:o?"Unpin video":"Pin video",children:"📌"}),e.isScreenShare&&h.jsx("div",{className:"voxket-video-indicator",children:"🖥️"}),e.source&&h.jsx("div",{className:"voxket-video-source",children:e.source})]})]}),!e.isEnabled&&h.jsx("div",{className:"voxket-video-loading",children:h.jsx("div",{className:"voxket-spinner"})})]})}function lI({tracks:e,layout:t,className:n="",onLayoutChange:r,onTrackClick:i,maxVisibleTracks:o=9,showPagination:s=!0}){const[a,l]=A.useState(0),[c,u]=A.useState(null),d=A.useMemo(()=>{let E=[...e];t.type==="speaker"&&c&&(E=[c,...e.filter(k=>k.id!==c.id)]);const v=a*o,_=v+o;return E.slice(v,_)},[e,t,c,a,o]),f=Math.ceil(e.length/o),p=A.useMemo(()=>{const E=d.length;switch(t.type){case"grid":const v=Math.ceil(Math.sqrt(E)),_=Math.ceil(E/v);return{display:"grid",gridTemplateColumns:`repeat(${v}, 1fr)`,gridTemplateRows:`repeat(${_}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[t.type,d.length]),g=E=>{u(E)},m=()=>{u(null)},x=E=>{r==null||r({...t,type:E})},y=["voxket-video-grid",`voxket-video-grid--${t.type}`,`voxket-video-grid--${d.length}-tracks`,n].filter(Boolean).join(" ");return e.length===0?h.jsx("div",{className:"voxket-video-grid-empty",children:h.jsxs("div",{className:"voxket-video-grid-empty-content",children:[h.jsx("div",{className:"voxket-video-grid-empty-icon",children:"📹"}),h.jsx("p",{children:"No video tracks available"})]})}):h.jsxs("div",{className:y,children:[h.jsxs("div",{className:"voxket-video-grid-controls",children:[h.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(E=>h.jsx("button",{className:`voxket-layout-btn ${t.type===E?"voxket-layout-btn--active":""}`,onClick:()=>x(E),title:`Switch to ${E} layout`,children:cI(E)},E))}),h.jsxs("div",{className:"voxket-video-count",children:[e.length," participant",e.length!==1?"s":""]})]}),h.jsx("div",{className:"voxket-video-grid-content",style:p,children:t.type==="speaker"&&c?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"voxket-video-speaker-main",children:h.jsx(ao,{track:c,participantName:`Participant ${c.participantId}`,isPinned:!0,onClick:i,onUnpin:m})}),h.jsx("div",{className:"voxket-video-speaker-sidebar",children:d.filter(E=>E.id!==c.id).map(E=>h.jsx(ao,{track:E,participantName:`Participant ${E.participantId}`,showControls:!1,onClick:i,onPin:g},E.id))})]}):d.map(E=>h.jsx(ao,{track:E,participantName:`Participant ${E.participantId}`,isPinned:(c==null?void 0:c.id)===E.id,onClick:i,onPin:g,onUnpin:m},E.id))}),s&&f>1&&h.jsxs("div",{className:"voxket-video-pagination",children:[h.jsx("button",{className:"voxket-pagination-btn",onClick:()=>l(Math.max(0,a-1)),disabled:a===0,children:"←"}),h.jsxs("span",{className:"voxket-pagination-info",children:["Page ",a+1," of ",f]}),h.jsx("button",{className:"voxket-pagination-btn",onClick:()=>l(Math.min(f-1,a+1)),disabled:a===f-1,children:"→"})]})]})}function cI(e){switch(e){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function uI({localTrack:e,onToggleCamera:t,onToggleScreenShare:n,onLayoutChange:r,showLayoutControls:i=!0,showCameraControls:o=!0,showScreenShareControls:s=!0,className:a=""}){const l=["voxket-video-controls",a].filter(Boolean).join(" "),c=u=>{r==null||r({type:u,showLocalVideo:!0,aspectRatio:"16:9"})};return h.jsxs("div",{className:l,children:[o&&h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),h.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isEnabled?"voxket-control-btn--active":""}`,onClick:t,title:e!=null&&e.isEnabled?"Turn off camera":"Turn on camera",children:[h.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isEnabled?"📹":"📷"}),h.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isEnabled?"Camera On":"Camera Off"})]}),(e==null?void 0:e.dimensions)&&h.jsxs("div",{className:"voxket-video-info",children:[e.dimensions.width," × ",e.dimensions.height]})]}),s&&h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),h.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:e!=null&&e.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[h.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isScreenShare?"🛑":"🖥️"}),h.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),i&&h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),h.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"⊞",label:"Grid"},{type:"speaker",icon:"🎤",label:"Speaker"},{type:"sidebar",icon:"⫸",label:"Sidebar"},{type:"gallery",icon:"⊡",label:"Gallery"}].map(({type:u,icon:d,label:f})=>h.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>c(u),title:`Switch to ${f} layout`,children:[h.jsx("span",{className:"voxket-control-icon",children:d}),h.jsx("span",{className:"voxket-control-label",children:f})]},u))})]}),h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),h.jsxs("div",{className:"voxket-video-settings",children:[h.jsxs("div",{className:"voxket-setting-group",children:[h.jsx("label",{className:"voxket-setting-label",children:"Quality"}),h.jsxs("select",{className:"voxket-setting-select",children:[h.jsx("option",{value:"high",children:"High (720p)"}),h.jsx("option",{value:"medium",children:"Medium (480p)"}),h.jsx("option",{value:"low",children:"Low (240p)"})]})]}),h.jsxs("div",{className:"voxket-setting-group",children:[h.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),h.jsxs("select",{className:"voxket-setting-select",children:[h.jsx("option",{value:"30",children:"30 fps"}),h.jsx("option",{value:"15",children:"15 fps"}),h.jsx("option",{value:"10",children:"10 fps"})]})]}),h.jsxs("div",{className:"voxket-setting-group",children:[h.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),h.jsxs("select",{className:"voxket-setting-select",children:[h.jsx("option",{value:"unlimited",children:"Unlimited"}),h.jsx("option",{value:"1000",children:"1 Mbps"}),h.jsx("option",{value:"500",children:"500 Kbps"}),h.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),h.jsxs("div",{className:"voxket-video-stats",children:[h.jsxs("div",{className:"voxket-stat-item",children:[h.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),h.jsx("span",{className:"voxket-stat-value",children:e!=null&&e.dimensions?`${e.dimensions.width}×${e.dimensions.height}`:"N/A"})]}),h.jsxs("div",{className:"voxket-stat-item",children:[h.jsx("span",{className:"voxket-stat-label",children:"Source:"}),h.jsx("span",{className:"voxket-stat-value",children:(e==null?void 0:e.source)||"None"})]}),h.jsxs("div",{className:"voxket-stat-item",children:[h.jsx("span",{className:"voxket-stat-label",children:"Status:"}),h.jsx("span",{className:`voxket-stat-value ${e!=null&&e.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:e!=null&&e.isEnabled?"Active":"Inactive"})]})]})]})]})}const vg=({handler:e,loadData:t,data:n,client:r,addLocalMessage:i})=>{const[o,s]=D.useState(null),[a,l]=D.useState(!0),[c,u]=D.useState(!1),[d]=D.useState(Date.now());D.useEffect(()=>{(async()=>{try{if(l(!0),console.log("📋 AssignmentView: Loading assignment data..."),console.log("📋 AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const x={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};s(x),console.log("📋 AssignmentView: Assignment loaded from RPC data:",x)}}catch(x){console.error("📋 AssignmentView: Error loading assignment:",x),s({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{l(!1)}})()},[n,t]);const f=({message:m,assignment:x})=>{const y=m.toLowerCase().includes("declined"),E=y?"bg-red-50 border-red-200":"bg-green-50 border-green-200",v=y?"text-red-700":"text-green-700",_=y?"❌":"🎉";return h.jsxs("div",{className:`max-w-sm mx-auto ${E} border rounded-lg shadow p-3 flex flex-col items-center`,children:[h.jsx("div",{className:"text-2xl mb-2",children:_}),h.jsx("div",{className:`${v} font-semibold text-sm mb-1`,children:m}),h.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:x.title}),h.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},p=async()=>{if(!(!o||!e)){u(!0);try{const m={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",m),e.didSuccess(m,h.jsx(f,{message:"Assignment accepted!",assignment:o}))}catch(m){console.error("📋 AssignmentView: Error accepting assignment:",m),e.didFail({error:"Failed to accept assignment"})}finally{u(!1)}}},g=async()=>{if(!(!o||!e)){u(!0);try{const m={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",m),e.didSuccess(m,h.jsx(f,{message:"Assignment declined",assignment:o}))}catch(m){console.error("📋 AssignmentView: Error declining assignment:",m),e.didFail({error:"Failed to decline assignment"})}finally{u(!1)}}};return a?h.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:h.jsxs("div",{className:"flex items-center justify-center py-4",children:[h.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),h.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):o?h.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[h.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:h.jsx("div",{className:"flex items-center justify-between",children:h.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:o.title})})}),h.jsxs("div",{className:"p-3 text-black",children:[h.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:h.jsx("p",{className:"text-xs text-black leading-snug",children:o.description})}),h.jsx("div",{className:"mb-3 text-black",children:h.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[h.jsx("span",{className:"text-xs mr-1",children:"📅"}),h.jsxs("span",{children:["Est: ",o.estimated_time_of_completion]})]})}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:p,disabled:c,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:c?h.jsxs("span",{className:"flex items-center justify-center",children:[h.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),h.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),h.jsx("button",{onClick:g,disabled:c,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):h.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:h.jsxs("div",{className:"text-center py-4",children:[h.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"⚠️ Assignment Error"}),h.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function dI(){const[e,t]=D.useState(null),[n,r]=D.useState([]);D.useEffect(()=>{const a=new ki({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return t(a),a.on("rpc.method.called",l=>{console.log("RPC Method Called:",l)}),a.on("rpc.interaction.completed",l=>{console.log("RPC Interaction Completed:",l)}),()=>{a.disconnect()}},[]);const i=async()=>{if(e)try{await e.registerFrontendRPC("give_assignment",vg,"embedded");const a=e.getRegisteredRpcMethods();r(a),console.log("✅ Assignment RPC registered successfully")}catch(a){console.error("❌ Failed to register assignment RPC:",a)}},o=async()=>{if(!e)return;const a=({handler:l,timeout:c})=>{const[u,d]=D.useState(""),f=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],p=m=>{d(m)},g=()=>{const m=f.find(x=>x.id===u);l==null||l.didSuccess({selectedProduct:u,productName:m==null?void 0:m.name,price:m==null?void 0:m.price,timestamp:new Date().toISOString()})};return h.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[h.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),h.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),h.jsx("div",{className:"space-y-3 mb-6",children:f.map(m=>h.jsx("div",{onClick:()=>p(m.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${u===m.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("div",{children:[h.jsx("h4",{className:"font-medium",children:m.name}),h.jsx("p",{className:"text-gray-600 text-sm",children:m.price})]}),h.jsx("div",{className:`w-4 h-4 rounded-full ${u===m.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},m.id))}),h.jsxs("div",{className:"flex justify-end space-x-3",children:[h.jsx("button",{onClick:()=>l==null?void 0:l.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),h.jsx("button",{onClick:g,disabled:!u,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),c&&h.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",c," seconds"]})]})};try{await e.registerFrontendRPC("recommend_product",a,"modal");const l=e.getRegisteredRpcMethods();r(l),console.log("✅ Product Recommendation RPC registered successfully")}catch(l){console.error("❌ Failed to register product recommendation RPC:",l)}},s=async()=>{if(!e)return;const a=({handler:l})=>{const[c,u]=D.useState(0),[d,f]=D.useState(""),p=()=>{l==null||l.didSuccess({rating:c,comment:d,timestamp:new Date().toISOString()})};return h.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[h.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),h.jsxs("div",{className:"mb-4",children:[h.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),h.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(g=>h.jsx("button",{onClick:()=>u(g),className:`text-2xl ${g<=c?"text-yellow-400":"text-gray-300"}`,children:"⭐"},g))})]}),h.jsxs("div",{className:"mb-4",children:[h.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),h.jsx("textarea",{value:d,onChange:g=>f(g.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),h.jsxs("div",{className:"flex justify-end space-x-2",children:[h.jsx("button",{onClick:()=>l==null?void 0:l.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),h.jsx("button",{onClick:p,disabled:c===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await e.registerFrontendRPC("collect_feedback",a,"embedded");const l=e.getRegisteredRpcMethods();r(l),console.log("✅ Feedback RPC registered successfully")}catch(l){console.error("❌ Failed to register feedback RPC:",l)}};return h.jsxs("div",{className:"p-6",children:[h.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),h.jsxs("div",{className:"space-y-4 mb-6",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),h.jsxs("div",{className:"space-x-2",children:[h.jsx("button",{onClick:i,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),h.jsx("button",{onClick:o,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),h.jsx("button",{onClick:s,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?h.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(a=>h.jsx("li",{className:"text-gray-700",children:h.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:a})},a))}):h.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),h.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[h.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),h.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[h.jsxs("li",{children:["Register RPC methods with React components using ",h.jsx("code",{children:"client.registerFrontendRPC()"})]}),h.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),h.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),h.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),h.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),h.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[h.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),h.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),h.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
139
+ `,style:{minHeight:"2.5rem",display:s===r?"block":"none"},children:o},s))})}function kM({statusMessage:e,theme:t}){const n=Ct(t);return h.jsxs("div",{className:"z-10 flex items-center space-x-2 mt-2 pb-2",children:[h.jsx("div",{className:n.statusIndicator}),h.jsx("span",{className:`text-xs ${n.text.muted}`,children:e})]})}const ig=A.forwardRef(({disabled:e,onStartCall:t,onStartChat:n,onStartVideo:r,prompts:i=['"Book a meeting with the marketing team"',`"What's the status of project Alpha?"`,`"Summarize yesterday's sales report"`,'"Find a good Italian restaurant nearby"','"Remind me to call John tomorrow at 10 AM"'],statusMessage:o="Agent is ready",title:s="Choose how to interact",subTitle:a="Ask me anything or give me a task to complete",theme:l="vox",modalities:c=["voice","chat","video"]},u)=>{const d=Ct(l),f=c.includes("voice"),p=c.includes("chat"),g=c.includes("video"),m=[f,p,g].filter(Boolean).length;return h.jsxs("div",{className:"flex p-8 flex-col items-center h-full justify-center w-full relative","aria-disabled":e,style:{background:"transparent"},children:[h.jsxs("div",{className:"mt-1 relative flex items-center justify-center mb-8 w-full",style:{minHeight:"120px"},children:[h.jsxs("div",{className:"absolute inset-0 flex items-center justify-center",children:[h.jsx("div",{className:d.pulseRings.ring1}),h.jsx("div",{className:d.pulseRings.ring2,style:{animationDelay:"0.5s"}}),h.jsx("div",{className:d.pulseRings.ring3,style:{animationDelay:"1s"}})]}),h.jsx("div",{className:"relative z-10 flex items-center justify-center",children:f&&p&&g?h.jsxs("div",{className:"flex gap-4 items-center justify-center",children:[h.jsx(Zi,{onClick:t,disabled:e,theme:l}),h.jsx(Ks,{onClick:n,disabled:e,theme:l}),h.jsx(qs,{onClick:r||t,disabled:e,theme:l})]}):m>1?h.jsxs("div",{className:"flex gap-6 items-center justify-center",children:[f&&h.jsx(Zi,{onClick:t,disabled:e,theme:l}),p&&h.jsx(Ks,{onClick:n,disabled:e,theme:l}),g&&r&&h.jsx(qs,{onClick:r,disabled:e,theme:l})]}):h.jsx("div",{className:"flex items-center justify-center",children:f?h.jsx(Zi,{onClick:t,disabled:e,theme:l}):p?h.jsx(Ks,{onClick:n,disabled:e,theme:l}):g&&r?h.jsx(qs,{onClick:r,disabled:e,theme:l}):h.jsx(Zi,{onClick:t,disabled:e,theme:l})})})]}),h.jsxs("div",{className:"text-center flex flex-col items-center gap-y-2 mb-6 w-full",children:[h.jsx("h3",{className:`text-xl font-semibold mb-2 ${d.text.accent}`,children:s}),h.jsx("p",{className:`text-sm leading-relaxed px-4 ${d.text.secondary}`,children:a}),m>1&&h.jsxs("div",{className:"flex gap-6 mt-4 text-xs justify-center",children:[f&&h.jsxs("div",{className:"flex flex-col items-center gap-1",children:[h.jsx(ng,{className:"w-4 h-4"}),h.jsx("span",{className:d.text.muted,children:"Voice"})]}),p&&h.jsxs("div",{className:"flex flex-col items-center gap-1",children:[h.jsx(tg,{className:"w-4 h-4"}),h.jsx("span",{className:d.text.muted,children:"Chat"})]}),g&&h.jsxs("div",{className:"flex flex-col items-center gap-1",children:[h.jsx(rg,{className:"w-4 h-4"}),h.jsx("span",{className:d.text.muted,children:"Video"})]})]})]}),h.jsx(EM,{prompts:i,theme:l}),h.jsx(kM,{statusMessage:o,theme:l})]})});ig.displayName="Welcome";class Xl extends D.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("VoxketWidget Error:",t,n)}render(){if(this.state.hasError){if(this.props.fallback){const t=this.props.fallback;return D.createElement(t,{error:this.state.error})}return D.createElement("div",{style:{padding:"20px",border:"1px solid #ff4444",borderRadius:"8px",background:"#fff5f5",color:"#cc0000"}},"VoxketWidget encountered an error. Please check the console for details.")}return this.props.children}}function og({room:e,onSessionEnd:t,onSessionStart:n,enableConsoleLogging:r=!0,enableLocalStorage:i=!0,voxketSessionId:o}={}){const[s,a]=D.useState(null),[l,c]=D.useState([]),[u,d]=D.useState(null),[f,p]=D.useState([]),g=D.useCallback((E,v)=>{const _={timestamp:new Date,event:E,data:v,sessionId:s==null?void 0:s.sessionId,participantId:u==null?void 0:u.identity};if(c(k=>[...k,_]),i){const k=JSON.parse(localStorage.getItem("voxket-session-logs")||"[]");k.push(_),localStorage.setItem("voxket-session-logs",JSON.stringify(k))}return _},[s==null?void 0:s.sessionId,u==null?void 0:u.identity,r,i]);D.useEffect(()=>{if(!e)return;const E=()=>{const b=o||`session-${Date.now()}-${Math.random().toString(36).substring(2,9)}`,R=new Date,O={sessionId:b,startTime:R,totalMessages:0,connectionIssues:0,participantCount:f.length,events:[]};a(O),g("SESSION_STARTED",{sessionId:b,startTime:R}),n==null||n(b)},v=()=>{if(s){const b=new Date,R=b.getTime()-s.startTime.getTime(),O={...s,endTime:b,duration:R,events:l};g("SESSION_ENDED",{sessionId:s.sessionId,duration:`${Math.round(R/1e3)}s`,totalMessages:s.totalMessages,connectionIssues:s.connectionIssues}),t==null||t(O),a(null),c([])}},_=b=>{g("CONNECTION_STATE_CHANGED",{state:b}),b===se.ConnectionState.Reconnecting&&s&&(a(R=>R?{...R,connectionIssues:R.connectionIssues+1}:null),g("CONNECTION_ISSUE",{type:"reconnecting"}))},k=b=>{g("TRACK_PUBLISHED",{trackKind:b.kind,trackSource:b.source})},C=b=>{g("TRACK_UNPUBLISHED",{trackKind:b.kind,trackSource:b.source})},M=(b,R)=>{s&&a(O=>O?{...O,totalMessages:O.totalMessages+1}:null),g("DATA_RECEIVED",{participantId:R==null?void 0:R.identity,dataSize:b.length})},N=b=>{g("PARTICIPANT_CONNECTED",{participantId:b.identity,participantName:b.name}),p(R=>[...R,b]),s&&a(R=>R?{...R,participantCount:R.participantCount+1}:null)},I=b=>{g("PARTICIPANT_DISCONNECTED",{participantId:b.identity,participantName:b.name}),p(R=>R.filter(O=>O.identity!==b.identity))};return e.localParticipant&&d(e.localParticipant),e.on(se.RoomEvent.Connected,E),e.on(se.RoomEvent.Disconnected,v),e.on(se.RoomEvent.ConnectionStateChanged,_),e.on(se.RoomEvent.TrackPublished,k),e.on(se.RoomEvent.TrackUnpublished,C),e.on(se.RoomEvent.DataReceived,M),e.on(se.RoomEvent.ParticipantConnected,N),e.on(se.RoomEvent.ParticipantDisconnected,I),()=>{e.off(se.RoomEvent.Connected,E),e.off(se.RoomEvent.Disconnected,v),e.off(se.RoomEvent.ConnectionStateChanged,_),e.off(se.RoomEvent.TrackPublished,k),e.off(se.RoomEvent.TrackUnpublished,C),e.off(se.RoomEvent.DataReceived,M),e.off(se.RoomEvent.ParticipantConnected,N),e.off(se.RoomEvent.ParticipantDisconnected,I)}},[e,s,l,f.length,g,t,n]);const m=D.useCallback(()=>i?JSON.parse(localStorage.getItem("voxket-session-logs")||"[]"):l,[l,i]),x=D.useCallback(()=>{i&&localStorage.removeItem("voxket-session-logs"),c([])},[i]),y=D.useCallback(()=>{const E=m(),v=JSON.stringify(E,null,2),_="data:application/json;charset=utf-8,"+encodeURIComponent(v),k=`voxket-session-logs-${new Date().toISOString().split("T")[0]}.json`,C=document.createElement("a");C.setAttribute("href",_),C.setAttribute("download",k),C.click()},[m]);return{sessionMetrics:s,sessionLogs:l,logEvent:g,getSessionLogs:m,clearSessionLogs:x,exportSessionLogs:y}}class Ql{constructor(){lt(this,"listeners",{})}on(t,n){return this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n),()=>this.off(t,n)}once(t,n){const r=(...i)=>{this.off(t,r),n(...i)};return this.on(t,r)}off(t,n){const r=this.listeners[t];if(!r)return;const i=r.indexOf(n);i>-1&&r.splice(i,1)}removeAllListeners(t){t?delete this.listeners[t]:this.listeners={}}emit(t,...n){const r=this.listeners[t];if(!r)return;const i=[...r];for(const o of i)try{o(...n)}catch(s){console.error(`Error in event listener for ${String(t)}:`,s)}}listenerCount(t){var n;return((n=this.listeners[t])==null?void 0:n.length)??0}eventNames(){return Object.keys(this.listeners)}}class sg{constructor(t){lt(this,"plugins",new Map);lt(this,"installedPlugins",new Set);lt(this,"context");this.context={client:t,emit:t.emit.bind(t),on:t.on.bind(t),config:{}}}register(t){if(this.plugins.has(t.name))throw new Error(`Plugin '${t.name}' is already registered`);if(t.dependencies){for(const n of t.dependencies)if(!this.plugins.has(n))throw new Error(`Plugin '${t.name}' depends on '${n}' which is not registered`)}this.plugins.set(t.name,t)}async install(t,n){const r=this.plugins.get(t);if(!r)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t))throw new Error(`Plugin '${t}' is already installed`);if(r.dependencies)for(const o of r.dependencies)this.installedPlugins.has(o)||await this.install(o);const i={...this.context,config:{...r.config,...n}};r.install&&await r.install(i),this.installedPlugins.add(t),this.setupPluginEvents(r,i)}async uninstall(t){var r;const n=this.plugins.get(t);if(!n)throw new Error(`Plugin '${t}' is not registered`);if(this.installedPlugins.has(t)){for(const[i,o]of this.plugins)if(this.installedPlugins.has(i)&&((r=o.dependencies)!=null&&r.includes(t)))throw new Error(`Cannot uninstall '${t}' because '${i}' depends on it`);n.uninstall&&await n.uninstall(this.context),this.installedPlugins.delete(t)}}isInstalled(t){return this.installedPlugins.has(t)}getInstalledPlugins(){return Array.from(this.installedPlugins)}getAvailablePlugins(){return Array.from(this.plugins.keys())}getPluginInfo(t){return this.plugins.get(t)}setupPluginEvents(t,n){t.onSessionStart&&n.on("session.started",r=>{t.onSessionStart(n,r.id)}),t.onSessionEnd&&n.on("session.ended",r=>{t.onSessionEnd(n,r.id)}),t.onAgentResponse&&n.on("agent.response",r=>{t.onAgentResponse(n,r)})}}function SM(e){return e}function Jl(e,t,n){return{name:e,version:"1.0.0",description:`${t} modality plugin`,install:async r=>{n.onActivate&&await n.onActivate(r)},uninstall:async r=>{n.onDeactivate&&await n.onDeactivate(r)},onAgentResponse:n.onMessage}}const CM={name:"analytics",version:"1.0.0",description:"Built-in analytics tracking",install:async e=>{console.log("Analytics plugin installed"),e.on("session.started",t=>{console.log("Analytics: Session started",t.id)}),e.on("session.ended",(t,n)=>{console.log("Analytics: Session ended",t.id,n)}),e.on("chat.message.sent",t=>{console.log("Analytics: User message sent",t.content.length)})}},_M={name:"debug",version:"1.0.0",description:"Debug logging and development tools",install:async e=>{console.log("Debug plugin installed");const t=e.emit;e.emit=(n,...r)=>(console.log(`[Debug] Event: ${String(n)}`,r),t(n,...r))}},TM={name:"metrics",version:"1.0.0",description:"Advanced metrics collection",install:async e=>{console.log("Metrics plugin installed");const t=new Map;e.on("session.started",n=>{t.set(n.id,{startTime:Date.now(),events:[]})}),e.on("agent.response",n=>{console.log("Metrics: Agent response analyzed",{type:n.type,length:n.content.length,timestamp:n.timestamp})})}},ag=A.createContext(null);function io({config:e,children:t,autoConnect:n=!1,client:r}){const[i,o]=A.useState(null),[s,a]=A.useState(!1),[l,c]=A.useState(!1),[u,d]=A.useState(null),[f,p]=A.useState(null),[g,m]=A.useState("idle"),[x,y]=A.useState(null),[E,v]=A.useState([]),[_,k]=A.useState([]),[C,M]=A.useState([]);A.useEffect(()=>{const W=r||new ki(e);o(W);const w=N(W);return n&&!r&&I(W),()=>{w(),r||W.disconnect().catch(console.error)}},[e,n,r]);const N=W=>{const w=()=>{c(!0),d(null)},V=()=>{a(!0),c(!1),d(null)},Y=()=>{a(!1),c(!1),p(null),m("idle"),v([]),k([]),M([])},S=Ce=>{d(Ce),c(!1)},$=Ce=>{p(Ce),m(Ce.state)},q=Ce=>{m(Ce),f&&p({...f,state:Ce})},B=(Ce,K)=>{p(null),m("idle"),y(K),v([]),k([]),M([])},Q=Ce=>{v(K=>[...K,Ce])},te=Ce=>{v(K=>K.filter(ye=>ye.id!==Ce.id))},ae=Ce=>{k(K=>[...K,Ce])},de=Ce=>{k(K=>[...K,Ce])},De=Ce=>{console.log("📝 VoxketProvider: Received transcription:",Ce),M(K=>K.find(me=>me.id===Ce.id)?(console.log("📝 VoxketProvider: Duplicate transcription detected, skipping:",Ce.id),K):(console.log("📝 VoxketProvider: Adding new transcription:",Ce.id),[...K,Ce]))},U=()=>{console.log("🧹 VoxketProvider: Clearing chat messages and transcriptions"),k([]),M([])};return W.on("connection.connecting",w),W.on("connection.connected",V),W.on("connection.disconnected",Y),W.on("connection.error",S),W.on("session.created",$),W.on("session.state.changed",q),W.on("session.ended",B),W.on("participant.joined",Q),W.on("participant.left",te),W.on("chat.message.received",ae),W.on("chat.message.sent",de),W.on("transcription.received",De),W.on("chat.history.cleared",U),()=>{console.log("📝 VoxketProvider: Cleaning up event listeners"),W.off("connection.connecting",w),W.off("connection.connected",V),W.off("connection.disconnected",Y),W.off("connection.error",S),W.off("session.created",$),W.off("session.state.changed",q),W.off("session.ended",B),W.off("participant.joined",Q),W.off("participant.left",te),W.off("chat.message.received",ae),W.off("chat.message.sent",de),W.off("chat.history.cleared",U),W.off("transcription.received",De)}},I=async W=>{const w=W||i;if(w)try{await w.connect()}catch(V){console.error("Failed to connect:",V)}},P={client:i,isConnected:s,isConnecting:l,connectionError:u,currentSession:f,sessionState:g,sessionMetrics:x,participants:E,chatMessages:_,transcriptions:C,connect:()=>I(),disconnect:async()=>{if(i)try{await i.disconnect()}catch(W){console.error("Failed to disconnect:",W)}},createSession:async(W,w={})=>{if(!i)throw new Error("Client not initialized");const V={agentId:W,participantName:w.participantName||"User",metadata:w.metadata,modalities:w.modalities||["voice"]};return await i.createSession(V)},endSession:async()=>i?await i.endSession():null,sendChatMessage:async W=>{if(!i)throw new Error("Client not initialized");await i.sendChatMessage(W)},setMicrophoneEnabled:async W=>{if(!i)throw new Error("Client not initialized");await i.setMicrophoneEnabled(W)},setCameraEnabled:async W=>{if(!i)throw new Error("Client not initialized");await i.setCameraEnabled(W)},startScreenShare:async()=>{if(!i)throw new Error("Client not initialized");await i.startScreenShare()},stopScreenShare:async()=>{if(!i)throw new Error("Client not initialized");await i.stopScreenShare()}};return h.jsx(ag.Provider,{value:P,children:t})}function fn(){const e=A.useContext(ag);if(!e)throw new Error("useVoxket must be used within a VoxketProvider");return e}class NM extends Ql{constructor(n){super();lt(this,"room",null);lt(this,"registeredMethods",new Map);lt(this,"activeInteractions",new Map);lt(this,"currentInteraction",null);n&&this.setRoom(n)}setRoom(n){this.room=n}async registerFrontendRPC(n,r,i="embedded"){if(console.log(`RpcManager: Starting registration for method '${n}'`),!this.room)throw console.error(`RpcManager: Cannot register '${n}' - no room instance`),new Error("Room not initialized. Cannot register RPC method.");if(!this.room.localParticipant)throw console.error(`RpcManager: Cannot register '${n}' - no local participant`),new Error("Local participant not available for RPC registration");console.log(`RpcManager: Room state: ${this.room.state}`),console.log(`RpcManager: Local participant: ${this.room.localParticipant.identity}`),console.log(`RpcManager: Registering frontend RPC method: ${n}`);const o={methodName:n,component:r,presentationMode:i};this.registeredMethods.set(n,o);try{this.room.registerRpcMethod(n,async s=>{console.log(`RpcManager: RPC method '${n}' called by ${s.callerIdentity}`),console.log("RpcManager: Payload:",s.payload),this.emit("rpc.method.called",{methodName:n,data:s});let a;console.log(`RpcManager: Current registration for '${n}':`,o);let l=s.responseTimeout||30;try{a=JSON.parse(s.payload)}catch{a=s.payload}try{const c=await this.awaitUserInteraction(n,r,i,a,l);return JSON.stringify(c)}catch(c){throw console.error(`RpcManager: Error in RPC method '${n}':`,c),c}}),this.emit("rpc.method.registered",{methodName:n}),console.log(`RpcManager: Successfully registered RPC method: ${n}`)}catch(s){throw console.error(`RpcManager: Failed to register RPC method '${n}':`,s),s}}async awaitUserInteraction(n,r,i,o,s){return new Promise((a,l)=>{const c=`${n}_${Date.now()}`;console.log(`RpcManager: Starting user interaction for method: ${n}, timeout: ${s} seconds`);const u={didSuccess:(f,p)=>{console.log(`RpcManager: User interaction successful for method: ${n}`,f),this.clearInteraction(c),this.currentInteraction=null;const g={success:!0,message:"User interaction completed successfully",data:f,timestamp:new Date,...p?{successView:p}:{}};this.emit("rpc.interaction.completed",{methodName:n,response:g}),a(g)},didFail:f=>{console.log(`RpcManager: User interaction failed for method: ${n}`,f),this.clearInteraction(c);const p={success:!1,message:"User interaction failed",error:f,timestamp:new Date};this.emit("rpc.interaction.completed",{methodName:n,response:p}),a(p)},dismissView:()=>{var p;console.log(`RpcManager: User dismissed interaction for method: ${n}`),console.log("RpcManager: Current interaction before dismiss:",(p=this.currentInteraction)==null?void 0:p.methodName),this.clearInteraction(c),this.currentInteraction=null,console.log("RpcManager: Current interaction after dismiss:",this.currentInteraction);const f={success:!0,data:{dismissed:!0,reason:"User dismissed the interaction"},message:"User interaction dismissed",timestamp:new Date};this.emit("rpc.interaction.dismissed",{methodName:n,response:f}),this.emit("rpc.interaction.completed",{methodName:n,response:f}),setTimeout(()=>{var g;((g=this.currentInteraction)==null?void 0:g.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(f)},didTimeout:f=>{console.log(`RpcManager: User interaction timeout for method: ${n}`),this.clearInteraction(c),this.currentInteraction=null;const p={success:!0,message:`User interaction timed out after ${s} seconds, it should be considered as declined, agent don't need to retry`,timestamp:new Date,...f?{timeoutView:f}:{}};this.emit("rpc.interaction.timeout",{methodName:n,response:p}),setTimeout(()=>{var g;((g=this.currentInteraction)==null?void 0:g.methodName)===n&&(console.log(`RpcManager: Force clearing interaction for ${n}`),this.currentInteraction=null)},0),a(p)}},d=setTimeout(()=>{u.didTimeout&&u.didTimeout()},s);this.activeInteractions.set(c,{resolve:f=>a(JSON.parse(f)),reject:l,timeoutId:d}),this.currentInteraction={isVisible:!0,methodName:n,component:r,presentationMode:i,timeout:s,data:o,handler:u},this.emit("rpc.interaction.started",{methodName:n,presentationMode:i}),setTimeout(async()=>{var f;if((f=this.currentInteraction)!=null&&f.handler)try{console.log(`RpcManager: Component created for method: ${n} with data:`,o)}catch(p){console.error("RpcManager: Error loading data into component:",p),u.didFail({error:"Failed to load data into component"})}},100)})}clearInteraction(n){const r=this.activeInteractions.get(n);r&&(console.log(`RpcManager: Clearing interaction: ${n}`),clearTimeout(r.timeoutId),this.activeInteractions.delete(n))}getCurrentInteraction(){return this.currentInteraction}dismissCurrentInteraction(){var n;this.currentInteraction&&(console.log(`RpcManager: Dismissing current interaction: ${this.currentInteraction.methodName}`),(n=this.currentInteraction.handler)==null||n.dismissView(),setTimeout(()=>{this.currentInteraction&&(console.log("RpcManager: Force clearing lingering interaction"),this.currentInteraction=null)},0))}getRegisteredMethods(){return Array.from(this.registeredMethods.keys())}unregisterMethod(n){this.registeredMethods.delete(n),console.log(`RpcManager: Unregistered RPC method: ${n}`)}clear(){for(const[n,r]of this.activeInteractions)clearTimeout(r.timeoutId);this.activeInteractions.clear(),this.registeredMethods.clear(),this.currentInteraction=null,console.log("RpcManager: Cleared all registrations and interactions")}}class Ze extends Error{constructor(t,n,r){super(t),this.code=n,this.details=r,this.name="VoxketError"}}const Nn=new WeakSet,Ys=new WeakSet;class ki extends Ql{constructor(n){super();lt(this,"config");lt(this,"room",null);lt(this,"pluginManager");lt(this,"rpcManager");lt(this,"isConnected",!1);lt(this,"currentSession",null);lt(this,"connectionState",se.ConnectionState.Disconnected);lt(this,"renderedComponents",new Map);lt(this,"textStreamHandlersRegistered",!1);lt(this,"currentAgentInfo",null);lt(this,"chatMessages",[]);lt(this,"activeTranscriptions",new Map);lt(this,"isAgentConnected",!1);lt(this,"agentState","idle");this.config=n,this.pluginManager=new sg(this),this.rpcManager=new NM,this.setupEventListeners(),this.initializeClient()}setupEventListeners(){this.on("connection.connected",()=>{var n,r;this.isConnected=!0,(r=(n=this.config).onConnected)==null||r.call(n)}),this.on("connection.disconnected",n=>{var r,i;this.isConnected=!1,(i=(r=this.config).onDisconnected)==null||i.call(r,n)}),this.on("connection.error",n=>{var r,i;(i=(r=this.config).onError)==null||i.call(r,n)}),this.on("chat.message.received",n=>{var r,i;this.addChatMessage(n),(i=(r=this.config).onMessageReceived)==null||i.call(r,n)}),this.on("chat.message.updated",n=>{this.updateChatMessage(n)}),this.on("chat.message.sent",n=>{this.addChatMessage(n)}),this.on("transcription.received",n=>{var r,i;(i=(r=this.config).onTranscriptionReceived)==null||i.call(r,n)}),this.on("session.state.changed",n=>{var r,i;(i=(r=this.config).onSessionStateChanged)==null||i.call(r,n)}),this.on("session.created",n=>{var r,i;(i=(r=this.config).onSessionStart)==null||i.call(r,n.id)}),this.on("session.ended",(n,r)=>{var i,o;(o=(i=this.config).onSessionEnd)==null||o.call(i,r)}),this.on("participant.joined",n=>{var r,i;(i=(r=this.config).onUserJoined)==null||i.call(r,n.id)}),this.on("participant.left",n=>{var r,i;(i=(r=this.config).onUserLeft)==null||i.call(r,n.id)}),this.setupRpcEventForwarding()}setupRpcEventForwarding(){if(!this.rpcManager){console.warn("RpcManager not initialized, skipping event forwarding setup");return}this.rpcManager.on("rpc.method.registered",n=>this.emit("rpc.method.registered",n)),this.rpcManager.on("rpc.method.called",n=>this.emit("rpc.method.called",n)),this.rpcManager.on("rpc.interaction.started",n=>this.emit("rpc.interaction.started",n)),this.rpcManager.on("rpc.interaction.completed",n=>this.emit("rpc.interaction.completed",n)),this.rpcManager.on("rpc.interaction.timeout",n=>this.emit("rpc.interaction.timeout",n)),this.rpcManager.on("rpc.interaction.dismissed",n=>this.emit("rpc.interaction.dismissed",n))}initializeClient(){this.room=new se.Room,this.setupRoomEventListeners()}setupRoomEventListeners(){this.room&&(this.room.on(se.RoomEvent.Connected,()=>{var n,r;this.connectionState=se.ConnectionState.Connected,this.emit("connection.connected"),this.rpcManager.setRoom(this.room),(r=(n=this.currentSession)==null?void 0:n.activeModalities)!=null&&r.includes("voice")&&setTimeout(async()=>{var i;try{(i=this.room)!=null&&i.localParticipant&&(this.room.localParticipant.isMicrophoneEnabled?this.emit("track.unmuted",{source:"microphone",enabled:!0}):(await this.room.localParticipant.setMicrophoneEnabled(!0),this.emit("track.unmuted",{source:"microphone",enabled:!0})))}catch(o){console.warn("VoxketClient: Failed to enable microphone after room connection:",o)}},1e3),this.textStreamHandlersRegistered||this.setupTextStreamHandlers()}),this.room.on(se.RoomEvent.Disconnected,n=>{var r;console.log("🔴 VoxketClient: Room disconnected, reason:",n),this.connectionState=se.ConnectionState.Disconnected,this.textStreamHandlersRegistered=!1,this.isAgentConnected=!1,console.log("🤖 VoxketClient: Agent marked as disconnected"),this.clearChatMessages(),n&&console.log("🔍 VoxketClient: Disconnect reason details:",{reason:n.toString(),currentSession:(r=this.currentSession)==null?void 0:r.id,agentConnected:this.isAgentConnected,connectionState:this.connectionState}),this.emit("connection.disconnected",n==null?void 0:n.toString())}),this.room.on(se.RoomEvent.ConnectionStateChanged,n=>{this.connectionState=n,n===se.ConnectionState.Connecting&&this.emit("connection.connecting")}),this.room.on(se.RoomEvent.ParticipantConnected,n=>{const r={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.joined",r)}),this.room.on(se.RoomEvent.ParticipantDisconnected,n=>{const r={id:n.identity,name:n.name||n.identity,isLocal:!1};this.emit("participant.left",r)}),this.room.on(se.RoomEvent.LocalTrackPublished,n=>{console.log("🎬 VoxketClient: Local track published:",n.source),n.source===se.Track.Source.ScreenShare&&this.emit("track.unmuted",{source:"screenShare",enabled:!0})}),this.room.on(se.RoomEvent.LocalTrackUnpublished,n=>{console.log("🎬 VoxketClient: Local track unpublished:",n.source),n.source===se.Track.Source.ScreenShare&&this.emit("track.muted",{source:"screenShare",enabled:!1})}))}setupTextStreamHandlers(){if(!this.room)return;try{this.room.registerTextStreamHandler("lk.chat",async(r,i)=>{try{const o=await r.readAll(),s={id:`msg_${Date.now()}_${i.identity||"user"}_${Math.random().toString(36).substr(2,9)}`,content:o,timestamp:new Date,sender:{id:i.identity||"user",name:i.identity||"User",type:"participant"},metadata:{topic:"lk.chat"}};this.emit("chat.message.received",s)}catch(o){console.error("VoxketClient: Failed to process lk.chat message:",o)}})}catch(r){console.warn("VoxketClient: lk.chat handler already registered, skipping:",r)}try{console.log("📝 VoxketClient: Registering lk.transcription handler..."),this.room.registerTextStreamHandler("lk.transcription",async(r,i)=>{var o,s,a,l,c,u;console.log("📝 VoxketClient: Received transcription stream from:",i.identity);try{console.log("📝 VoxketClient: Processing transcription stream...");const d=i.identity===((s=(o=this.room)==null?void 0:o.localParticipant)==null?void 0:s.identity),f=Date.now(),p=i.identity,g=this.activeTranscriptions.get(p);let m,x=!0;g&&f-g.timestamp<1e3?(m=g.messageId,x=!1,console.log("📝 VoxketClient: Reusing existing transcription message ID:",m)):(m=`msg_${d?"user":"agent"}_${i.identity}_${f}`,this.activeTranscriptions.set(p,{messageId:m,timestamp:f}),console.log("📝 VoxketClient: Created new transcription message ID:",m));let y="";console.log("📝 VoxketClient: Current agent info:",this.currentAgentInfo);const E=((a=this.currentAgentInfo)==null?void 0:a.name)||i.identity||"AI Assistant";console.log("📝 VoxketClient: Using agent name:",E);const v=d?"participant":"agent",_=d?this.config.participantName||"User":E;console.log("📝 VoxketClient: Transcription sender info:",{participantIdentity:i.identity,localParticipantIdentity:(c=(l=this.room)==null?void 0:l.localParticipant)==null?void 0:c.identity,isFromUser:d,senderType:v,senderName:_});const k={id:m,content:"",timestamp:new Date,sender:{id:i.identity||"unknown",name:_,type:v},metadata:{topic:"lk.transcription",streaming:!0}};x&&this.emit("chat.message.received",k),console.log("📝 VoxketClient: Starting to read transcription stream...");for await(const I of r){console.log("📝 VoxketClient: Received chunk:",I.length,"chars"),y+=I;const b=this.convertMarkdownToText(y),R={...k,content:b,metadata:{...k.metadata,streaming:!0}};this.emit("chat.message.updated",R)}const C=this.convertMarkdownToText(y),M={...k,content:C,metadata:{...k.metadata,streaming:!1}};this.emit("chat.message.updated",M);const N={id:m,text:C,isFinal:!0,startTime:k.timestamp.getTime(),participantId:i.identity||"agent"};this.emit("transcription.received",N),console.log("📝 VoxketClient: Emitted transcription event:",N)}catch(d){console.error("VoxketClient: Failed to process lk.transcription message:",d);try{const f=await r.readAll(),p=((u=this.currentAgentInfo)==null?void 0:u.name)||i.identity||"AI Assistant",g={id:`msg_${Date.now()}_agent_transcription_${Math.random().toString(36).substr(2,9)}`,content:f,timestamp:new Date,sender:{id:i.identity||"agent",name:p,type:"agent"},metadata:{topic:"lk.transcription"}};this.emit("chat.message.received",g);const m={id:g.id,text:g.content,isFinal:!0,startTime:g.timestamp.getTime(),participantId:i.identity||"agent"};this.emit("transcription.received",m),console.log("📝 VoxketClient: Emitted fallback transcription event:",m)}catch(f){console.error("VoxketClient: Fallback failed for lk.transcription:",f)}}})}catch(r){console.warn("VoxketClient: lk.transcription handler already registered, skipping:",r)}try{this.room.registerTextStreamHandler("suggested_response",async r=>{const i=await r.readAll();let o=[];try{o=["tes","hello how are you","algebra make me learn that ","what is the meaning of life"]}catch(s){console.warn("VoxketClient: Failed to parse suggested_response:",s,i)}this.emit("suggested.response",o)})}catch(r){console.warn("VoxketClient: suggested_response handler already registered, skipping:",r)}try{this.room.registerTextStreamHandler("agent_state_changed",async(r,i)=>{const o=await r.readAll();console.log("🤖 VoxketClient: agent_state_changed stream received:",o);let s={};try{s=typeof o=="string"?JSON.parse(o.replace(/'/g,'"')):o}catch(a){console.warn("VoxketClient: Failed to parse agent_state_changed:",a,o)}this.isAgentConnected||(this.isAgentConnected=!0,console.log("🤖 VoxketClient: Agent marked as connected (first state change received)"),this.emit("agent.connected",s)),s.new_state==="speaking"?(this.setAgentState("speaking"),this.emit("agent.speaking",s)):s.new_state==="thinking"?(this.setAgentState("thinking"),this.emit("agent.thinking",s)):(s.new_state==="idle"||s.new_state==="listening")&&this.setAgentState("idle")})}catch(r){console.warn("VoxketClient: conversation_item_added handler already registered, skipping:",r)}try{this.room.registerTextStreamHandler("images",async(r,i)=>{try{const o=await r.readAll()}catch(o){console.error("VoxketClient: Error processing images stream:",o)}})}catch(r){console.warn("VoxketClient: images handler already registered, skipping:",r)}try{this.room.registerByteStreamHandler("images",async(r,i)=>{var o,s;try{const a=r.info,l={id:`img_${Date.now()}_${i.identity||"agent"}_${Math.random().toString(36).substr(2,9)}`,content:`�️ ${a.name||"Image"}`,sender:{id:i.identity||"agent",name:i.identity||"Agent",type:i.identity===((s=(o=this.room)==null?void 0:o.localParticipant)==null?void 0:s.identity)?"participant":"agent"},timestamp:new Date,metadata:{type:"attachment",fileName:a.name,fileSize:a.size,mimeType:a.mimeType,streamId:a.id,downloading:!0}};this.emit("chat.message.received",l),r.onProgress&&(r.onProgress=p=>{const g={...l,metadata:{...l.metadata,downloadProgress:p||0}};this.emit("chat.message.updated",g)});const c=[];for await(const p of r)c.push(p);const u=new Blob(c,{type:a.mimeType||"application/octet-stream"}),d=URL.createObjectURL(u),f={...l,metadata:{...l.metadata,downloading:!1,downloadProgress:1,downloadUrl:d,blob:u}};this.emit("chat.message.updated",f)}catch(a){console.error("VoxketClient: Error processing image attachment:",a)}})}catch(r){console.warn("VoxketClient: image handler already registered, skipping:",r)}["error","warning","status","system","debug","info"].forEach(r=>{try{this.room.registerTextStreamHandler(r,async(i,o)=>{try{const s=await i.readAll();if(console.log(`📝 VoxketClient: Received '${r}' stream:`,s),r==="error"){let a={};try{a=typeof s=="string"?JSON.parse(s):s}catch{a={message:s}}console.warn("� VoxketClient: Agent error:",a),this.emit("agent.error",a)}else this.emit("text.stream.received",{topic:r,data:s,participantInfo:o})}catch(s){console.error(`VoxketClient: Failed to process '${r}' stream:`,s)}})}catch(i){console.warn(`VoxketClient: Handler for '${r}' already registered, skipping:`,i)}});try{this.room.registerTextStreamHandler("*",async(r,i)=>{var o;try{const s=await r.readAll(),a=((o=r.info)==null?void 0:o.topic)||"unknown";console.log(`📝 VoxketClient: Received unhandled text stream for topic '${a}':`,s),this.emit("text.stream.unhandled",{topic:a,data:s,participantInfo:i})}catch(s){console.error("VoxketClient: Failed to process unhandled text stream:",s)}})}catch(r){console.warn("VoxketClient: Generic text stream handler already registered, skipping:",r)}this.textStreamHandlersRegistered=!0}async fetchConnectionDetails(n,r,i){const o=n||this.config.agentId||"default-agent",s=r||this.config.participantName||"User",a=i||this.config.modalities||["voice"];try{const l={agent_id:o,participant_name:s,participant_metadata:{user_id:""},modality:a[0],modalities:a};console.log("🔗 VoxketClient: Creating session with modalities:",a);const c=await fetch(`${this.config.baseUrl}/api/live/agent/session`,{method:"POST",headers:{accept:"application/json","X-APP-ID":this.config.appId,"X-APP-SECRET":this.config.appSecret,"Content-Type":"application/json"},body:JSON.stringify(l)});if(!c.ok){let f=`HTTP ${c.status}: Failed to fetch connection details`;try{const p=await c.json();p&&(p.error?f=`API Error: ${p.error}`:p.detail?f=`API Error: ${p.detail}`:p.message&&(f=`API Error: ${p.message}`))}catch{try{const g=await c.text();g&&(f=`API Error: ${g}`)}catch{}}throw new Error(f)}const u=await c.json();let d;return u.agent_info&&(d={id:u.agent_info.agent_info.id,name:u.agent_info.agent_info.name,capabilities:u.agent_info.capabilities,modality_supported:u.agent_info.modality_supported,session_settings:u.agent_info.session_settings||{}},this.currentAgentInfo=d),{serverUrl:u.wss_url,participantToken:u.token,voxketSessionId:u.session_id,agentInfo:d}}catch(l){console.error("VoxketClient: fetchConnectionDetails failed:",l);const c=new Ze(`Failed to fetch connection details: ${l instanceof Error?l.message:"Unknown error"}`,"CONNECTION_FAILED",l);throw this.emit("connection.error",c),c}}async connect(n,r,i){var o;try{this.emit("connection.connecting");const s=await this.fetchConnectionDetails(n,r,i);return await((o=this.room)==null?void 0:o.connect(s.serverUrl,s.participantToken)),this.isConnected=!0,s}catch(s){console.error("VoxketClient: Connection failed:",s);const a=new Ze(`Failed to connect to Voxket services: ${s instanceof Error?s.message:"Unknown error"}`,"CONNECTION_FAILED",s);throw this.emit("connection.error",a),a}}async disconnect(){var n;try{console.log("🔌 VoxketClient: Starting disconnect process..."),this.room&&(console.log("🔌 VoxketClient: Disconnecting from room:",{roomState:this.room.state,numParticipants:this.room.numParticipants,sessionId:(n=this.currentSession)==null?void 0:n.id}),await this.room.disconnect()),this.isConnected=!1,this.currentSession=null,this.currentAgentInfo=null,this.textStreamHandlersRegistered=!1,this.clearChatMessages(),console.log("🔌 VoxketClient: Creating new room instance..."),this.room=new se.Room,this.setupRoomEventListeners(),console.log("✅ VoxketClient: Disconnect completed successfully"),this.emit("connection.disconnected")}catch(r){console.error("❌ VoxketClient: Disconnect failed:",r);const i=new Ze("Failed to disconnect properly","NETWORK_ERROR",r);throw this.emit("connection.error",i),i}}async createSession(n){var r,i,o,s;try{const a=await this.connect(n.agentId,n.participantName,n.modalities),l={id:a.voxketSessionId,agentId:n.agentId,state:"connecting",startedAt:new Date,metadata:n.metadata||{},activeModalities:n.modalities||["voice"],agentInfo:a.agentInfo||this.currentAgentInfo};if(this.currentSession=l,this.emit("session.created",l),(r=n.modalities)!=null&&r.includes("voice"))try{await new Promise(c=>setTimeout(c,500)),(i=this.room)!=null&&i.localParticipant?(await this.room.localParticipant.setMicrophoneEnabled(!0,void 0,{preConnectBuffer:!0}),this.emit("track.unmuted",{source:"microphone",enabled:!0})):console.warn("VoxketClient: No local participant found, microphone not enabled")}catch(c){console.warn("VoxketClient: Failed to enable microphone, but continuing with session:",c)}if((o=n.modalities)!=null&&o.includes("video"))try{await new Promise(c=>setTimeout(c,200)),(s=this.room)!=null&&s.localParticipant&&(console.log("🎥 VoxketClient: Attempting to enable camera for video session"),await this.room.localParticipant.setCameraEnabled(!0),this.emit("track.unmuted",{source:"camera",enabled:!0}),console.log("🎥 VoxketClient: Camera enabled successfully"))}catch(c){console.warn("VoxketClient: Failed to enable camera, but continuing with session:",c)}return setTimeout(()=>{var c;this.currentSession&&(this.currentSession.state="active",this.emit("session.state.changed","active",this.currentSession.state),this.forceAgentConnected(),console.log("🤖 VoxketClient: Session marked as active:",{sessionId:this.currentSession.id,modalities:this.currentSession.activeModalities,agentConnected:this.isAgentConnected,hasRoom:!!this.room,remoteParticipants:((c=this.room)==null?void 0:c.remoteParticipants.size)||0}))},1e3),l}catch(a){throw console.error("VoxketClient: Failed to create session:",a),a instanceof Ze?a:a instanceof TypeError&&a.message.includes("fetch")?new Ze("Network connection failed","CONNECTION_FAILED",a):a instanceof Error&&a.message.includes("Failed to fetch connection details")?new Ze(`API connection failed: ${a.message}`,"CONNECTION_FAILED",a):new Ze(`Failed to create session: ${a instanceof Error?a.message:"Unknown error"}`,"SESSION_NOT_FOUND",a)}}async startSession(n,r){const i={agentId:n||this.config.agentId||"default-agent",participantName:(r==null?void 0:r.participantName)||this.config.participantName||"User",modalities:(r==null?void 0:r.modalities)||this.config.modalities||["voice","chat"],metadata:r==null?void 0:r.metadata};return this.createSession(i)}async endSession(){var n,r;if(!this.currentSession)return null;try{const i={sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((r=this.room)==null?void 0:r.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]};return this.currentSession.endedAt=new Date,this.currentSession.state="disconnected",this.emit("session.ended",this.currentSession,i),await this.disconnect(),i}catch(i){throw new Ze("Failed to end session","SESSION_NOT_FOUND",i)}}getCurrentSession(){return this.currentSession}getCurrentAgentInfo(){return this.currentAgentInfo}getIsAgentConnected(){return this.isAgentConnected}forceAgentConnected(){this.isAgentConnected||(this.isAgentConnected=!0,console.log("🤖 VoxketClient: Agent manually marked as connected"),this.emit("agent.connected",{forced:!0}))}getAgentState(){return this.agentState}setAgentState(n){this.agentState!==n&&(this.agentState=n,this.emit("agent.state.changed",{state:n}))}getAgentAudioTrack(){const n=this.getRemoteParticipants();for(const r of n){const i=r.getTrackPublication(se.Track.Source.Microphone);if(i!=null&&i.track)return{source:se.Track.Source.Microphone,participant:r,publication:i}}return null}getAgentVideoTrack(){const n=this.getRemoteParticipants();for(const r of n){const i=r.getTrackPublication(se.Track.Source.Camera);if(i!=null&&i.track)return{source:se.Track.Source.Camera,participant:r,publication:i}}return null}getVideoTrackRefs(){const n=[],r=this.getLocalParticipant();if(r){const o=r.getTrackPublication(se.Track.Source.Camera);o!=null&&o.track&&n.push({source:se.Track.Source.Camera,participant:r,publication:o});const s=r.getTrackPublication(se.Track.Source.ScreenShare);s!=null&&s.track&&n.push({source:se.Track.Source.ScreenShare,participant:r,publication:s})}const i=this.getRemoteParticipants();for(const o of i){const s=o.getTrackPublication(se.Track.Source.Camera);s!=null&&s.track&&n.push({source:se.Track.Source.Camera,participant:o,publication:s});const a=o.getTrackPublication(se.Track.Source.ScreenShare);a!=null&&a.track&&n.push({source:se.Track.Source.ScreenShare,participant:o,publication:a})}return n}getCameraTrackRefs(){return this.getVideoTrackRefs().filter(n=>n.source===se.Track.Source.Camera)}getScreenShareTrackRefs(){return this.getVideoTrackRefs().filter(n=>n.source===se.Track.Source.ScreenShare)}getChatMessages(){return[...this.chatMessages]}addChatMessage(n){this.chatMessages.some(i=>i.id===n.id)||this.chatMessages.push(n)}updateChatMessage(n){const r=this.chatMessages.findIndex(i=>i.id===n.id);r!==-1&&(this.chatMessages[r]=n)}clearChatMessages(){this.chatMessages=[],this.activeTranscriptions.clear(),this.dismissCurrentInteraction(),this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays(),console.log("🧹 VoxketClient: Cleared chat messages and transcription history"),this.emit("chat.history.cleared")}renderUI(n={}){var s,a,l,c,u,d,f,p,g;const r=this.resolveTarget(n.target||"body"),i=this.getTargetKey(r);if(Ys.has(r)){console.warn("⚠️ VoxketClient: Target is already being processed, skipping renderUI");return}if(Nn.has(r)){console.log("✋ VoxketClient: Target already has a React root in registry, updating existing props...");const m=this.renderedComponents.get(i);if(m&&m.root){const x={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((s=n.modality)==null?void 0:s.includes("chat"))!==!1,suportsVideoInput:((a=n.modality)==null?void 0:a.includes("video"))===!0,suportsScreenShare:((l=n.modality)==null?void 0:l.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};try{m.root.render(A.createElement(io,{config:this.config,autoConnect:n.autoStart||!1,client:this,children:A.createElement(oo,x)})),console.log("✅ VoxketClient: Successfully updated existing widget with new props");return}catch(y){throw console.error("Error re-rendering existing widget:",y),new Error(`Failed to update existing widget: ${y instanceof Error?y.message:"Unknown error"}`)}}else console.warn("⚠️ Registry inconsistency detected, cleaning up"),Nn.delete(r)}let o=this.renderedComponents.get(i);if(o&&o.target===r&&Nn.has(r)){console.log("🔄 VoxketClient: Reusing existing React root for target:",i);const m=o.root,x={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((c=n.modality)==null?void 0:c.includes("chat"))!==!1,suportsVideoInput:((u=n.modality)==null?void 0:u.includes("video"))===!0,suportsScreenShare:((d=n.modality)==null?void 0:d.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};try{m.render(A.createElement(io,{config:this.config,autoConnect:n.autoStart||!1,client:this,children:A.createElement(oo,x)}))}catch(y){throw console.error("Error rendering Voxket widget:",y),new Error(`Failed to render Voxket widget: ${y instanceof Error?y.message:"Unknown error"}`)}return}Ys.add(r);try{if(o){console.log("🧹 VoxketClient: Cleaning up existing component for different target");try{o.root.unmount(),this.renderedComponents.delete(i),Nn.delete(o.target),r.innerHTML=""}catch(y){console.warn("Failed to cleanup existing root:",y)}}if(Nn.has(r)){console.warn("⚠️ VoxketClient: Target already in registry, skipping root creation");return}console.log("🆕 VoxketClient: Creating new React root for target:",i);const m=Hg.createRoot(r);this.renderedComponents.set(i,{root:m,target:r}),Nn.add(r);const x={agentId:n.agentId||this.config.agentId||"default-agent",participantName:n.participantName||this.config.participantName||"User",baseUrl:this.config.baseUrl,appSecret:this.config.appSecret,appId:this.config.appId,className:n.className,theme:typeof n.theme=="string"?n.theme:void 0,modalities:n.modality||this.config.modalities||["voice"],suportsChatInput:((f=n.modality)==null?void 0:f.includes("chat"))!==!1,suportsVideoInput:((p=n.modality)==null?void 0:p.includes("video"))===!0,suportsScreenShare:((g=n.modality)==null?void 0:g.includes("screen_share"))===!0,autoStart:n.autoStart,displayType:n.displayType||"widget",popupPosition:n.popupPosition||"bottom-right",popupTriggerText:n.popupTriggerText||"Open Chat",width:n.width,height:n.height,onDisplayTypeChange:n.onDisplayTypeChange,prompts:n.prompts,statusMessage:n.statusMessage,welcomeTitle:n.welcomeTitle,welcomeSubTitle:n.welcomeSubTitle,loadingText:n.loadingText,voxketClient:this};if(!m||typeof m.render!="function")throw new Error("Invalid React root. Make sure React 18+ is properly installed and configured.");try{m.render(A.createElement(io,{config:this.config,autoConnect:n.autoStart||!1,client:this,children:A.createElement(oo,x)}))}catch(y){throw console.error("Error rendering Voxket widget:",y),new Error(`Failed to render Voxket widget: ${y instanceof Error?y.message:"Unknown error"}`)}}finally{Ys.delete(r)}}removeUI(n){var i;const r=n?this.resolveTarget(n):null;if(r){const o=this.getTargetKey(r),s=this.renderedComponents.get(o);if(s){console.log("🗑️ VoxketClient: Removing UI for target:",o),this.renderedComponents.delete(o),Nn.delete(r);try{const l=s.target;l&&l.isConnected?(typeof((i=s.root)==null?void 0:i.unmount)=="function"&&(s.root.unmount(),console.log("✅ VoxketClient: UI unmounted for target:",o)),l.hasChildNodes()&&(l.innerHTML="")):console.log("ℹ️ VoxketClient: Target element already disconnected, skipping unmount")}catch(l){console.warn("Failed to unmount React root:",l)}}else console.log("ℹ️ VoxketClient: No component found for target, cleaning registry:",o),Nn.delete(r),r.isConnected&&r.hasChildNodes()&&(r.innerHTML="");r.querySelectorAll('[id*="voxket"], [class*="voxket"], .fixed.inset-0.z-50').forEach(l=>{try{l.remove()}catch(c){console.warn("Failed to remove element:",c)}}),r===document.body&&r.querySelectorAll(".fixed.z-50, .fixed.inset-0").forEach(c=>{if(c.classList.contains("bg-black")&&(c.classList.contains("backdrop-blur-sm")||c.classList.contains("bg-opacity-30")))try{c.remove()}catch(u){console.warn("Failed to remove fixed element:",u)}})}}removeAllUI(){for(const[n,r]of this.renderedComponents)r.root.unmount();this.renderedComponents.clear(),this.forceCleanupFullscreenOverlays()}forceCleanupFullscreenOverlays(){document.body.querySelectorAll(".fixed.inset-0.z-50").forEach(r=>{if(r.classList.contains("bg-black")&&(r.classList.contains("backdrop-blur-sm")||r.classList.contains("bg-opacity-30")))try{r.remove()}catch(i){console.warn("Failed to remove overlay:",i)}})}resolveTarget(n){if(typeof n=="string"){const r=document.querySelector(n);if(!r)throw new Error(`Target element not found: ${n}`);return r}return n}getTargetKey(n){return n.id?n.id:n.className?n.tagName+"_"+n.className.replace(/\s+/g,"_"):n.tagName+"_"+n.outerHTML.length%1e3}async sendMessage(n,r){var i;if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new Ze("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new Ze("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new Ze("No local participant","CONNECTION_FAILED");this.dismissCurrentInteraction();try{const o={id:`msg_${Date.now()}`,content:n,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:r||{}},s=await((i=this.room)==null?void 0:i.localParticipant.sendText(n,{topic:"lk.chat",destinationIdentities:[]}));this.emit("chat.message.sent",o)}catch(o){throw console.error("VoxketClient: Failed to send chat message:",o),new Ze("Failed to send message","NETWORK_ERROR",o)}}async sendChatMessage(n,r){return this.sendMessage(n,r)}async sendAttachments(n,r){if(!this.currentSession)throw console.error("VoxketClient: No active session found"),new Ze("No active session","SESSION_NOT_FOUND");if(!this.room)throw console.error("VoxketClient: No room instance found"),new Ze("No room connection","CONNECTION_FAILED");if(!this.room.localParticipant)throw console.error("VoxketClient: No local participant found"),new Ze("No local participant","CONNECTION_FAILED");if(!n||n.length===0)throw new Ze("No files provided","INVALID_PARAMETER");this.dismissCurrentInteraction();const i=n.filter(o=>o.type.startsWith("image/"));if(i.length===0)throw new Ze("Only image files are allowed","INVALID_PARAMETER");i.length!==n.length&&console.warn("VoxketClient: Some non-image files were filtered out");try{const o=i.map(async(s,a)=>{const c={id:`att_${Date.now()}_${a}`,content:`📎 ${s.name}`,sender:{id:"user",name:this.config.participantName||"User",type:"participant"},timestamp:new Date,metadata:{...r,type:"attachment",fileName:s.name,fileSize:s.size,mimeType:s.type,uploading:!0}};this.emit("chat.message.sent",c);const u=await this.room.localParticipant.sendFile(s,{mimeType:s.type,topic:"images",onProgress:f=>{const p={...c,metadata:{...c.metadata,uploadProgress:f}};this.emit("chat.message.updated",p)}});try{const f=new FileReader,p=new Promise((x,y)=>{f.onload=()=>{typeof f.result=="string"?x(f.result):y(new Error("Failed to convert to base64"))},f.onerror=y});f.readAsDataURL(s);const m={type:"image",data:await p,filename:s.name,mimeType:s.type,size:s.size};await this.room.localParticipant.sendText(JSON.stringify(m),{topic:"images",destinationIdentities:[]})}catch(f){console.warn("VoxketClient: Failed to send image data to agent:",f);try{const p=`I've shared an image: ${s.name}`;await this.room.localParticipant.sendText(p,{topic:"lk.chat",destinationIdentities:[]})}catch(p){console.warn("VoxketClient: Failed to send image notification to agent:",p)}}const d={...c,metadata:{...c.metadata,uploading:!1,uploadProgress:1,streamId:u.id}};return this.emit("chat.message.updated",d),u});await Promise.all(o)}catch(o){throw console.error("VoxketClient: Failed to send attachments:",o),new Ze("Failed to send attachments","NETWORK_ERROR",o)}}async sendAttachment(n,r){return this.sendAttachments([n],r)}toggleMicrophone(n){return this.setMicrophoneEnabled(n!==!1)}async setMicrophoneEnabled(n){var r,i;try{const o=(r=this.room)==null?void 0:r.localParticipant.isMicrophoneEnabled,s=n??!o;await((i=this.room)==null?void 0:i.localParticipant.setMicrophoneEnabled(s)),s?this.emit("track.unmuted",{source:"microphone",enabled:!0}):this.emit("track.muted",{source:"microphone",enabled:!1})}catch(o){throw console.error("VoxketClient: Failed to toggle microphone:",o),new Ze("Failed to toggle microphone","PERMISSION_DENIED",o)}}toggleCamera(n){return this.setCameraEnabled(n!==!1)}async setCameraEnabled(n){var r,i;try{const o=(r=this.room)==null?void 0:r.localParticipant.isCameraEnabled,s=n??!o;await((i=this.room)==null?void 0:i.localParticipant.setCameraEnabled(s)),s?this.emit("track.unmuted",{source:"camera",enabled:!0}):this.emit("track.muted",{source:"camera",enabled:!1})}catch(o){throw console.error("VoxketClient: Failed to toggle camera:",o),new Ze("Failed to toggle camera","PERMISSION_DENIED",o)}}async enableCamera(){return this.setCameraEnabled(!0)}async disableCamera(){return this.setCameraEnabled(!1)}async startScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!0)),this.emit("track.unmuted",{source:"screenShare",enabled:!0})}catch(r){throw new Ze("Failed to start screen share","PERMISSION_DENIED",r)}}async stopScreenShare(){var n;try{await((n=this.room)==null?void 0:n.localParticipant.setScreenShareEnabled(!1)),this.emit("track.muted",{source:"screenShare",enabled:!1})}catch(r){throw new Ze("Failed to stop screen share","PERMISSION_DENIED",r)}}async getAudioInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="audioinput")}catch(n){throw new Ze("Failed to get audio input devices","DEVICE_ERROR",n)}}async getVideoInputDevices(){try{return(await navigator.mediaDevices.enumerateDevices()).filter(r=>r.kind==="videoinput")}catch(n){throw new Ze("Failed to get video input devices","DEVICE_ERROR",n)}}async setAudioInputDevice(n){var r;try{if(!((r=this.room)!=null&&r.localParticipant))throw new Error("Not connected to room")}catch(i){throw new Ze("Failed to set audio input device","DEVICE_ERROR",i)}}async setVideoInputDevice(n){var r;try{if(!((r=this.room)!=null&&r.localParticipant))throw new Error("Not connected to room")}catch(i){throw new Ze("Failed to set video input device","DEVICE_ERROR",i)}}getLocalParticipant(){var n;return((n=this.room)==null?void 0:n.localParticipant)??null}getRemoteParticipants(){var n;return Array.from(((n=this.room)==null?void 0:n.remoteParticipants.values())??[])}getPublishPermissions(){const n=this.getLocalParticipant();if(!n)return{camera:!1,microphone:!1,screenShare:!1,data:!1};const r=n.permissions;if(!r)return{camera:!0,microphone:!0,screenShare:!0,data:!0};const i=o=>!!r.canPublish&&(r.canPublishSources.length===0||r.canPublishSources.includes(o));return{camera:i(1),microphone:i(2),screenShare:i(3),data:r.canPublishData??!1}}canPublishSource(n){return this.getPublishPermissions()[n]}getRoom(){return this.room}getConnectionState(){return this.connectionState}get connected(){return this.isConnected&&this.connectionState===se.ConnectionState.Connected}getMicrophoneTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,r]of n.trackPublications)if(r.source===se.Track.Source.Microphone)return r.track;return null}getCameraTrack(){const n=this.getLocalParticipant();if(!n)return null;for(const[,r]of n.trackPublications)if(r.source===se.Track.Source.Camera)return r.track;return null}getScreenShareTrack(){const n=this.getLocalParticipant();if(!n)return console.log("🎬 VoxketClient: getScreenShareTrack - no local participant"),null;for(const[,r]of n.trackPublications)if(r.source===se.Track.Source.ScreenShare)return console.log("🎬 VoxketClient: getScreenShareTrack - found screen share track:",{trackSid:r.trackSid,isMuted:r.isMuted,hasTrack:!!r.track}),r.track;return console.log("🎬 VoxketClient: getScreenShareTrack - no screen share track found"),null}get isMicrophoneEnabled(){const n=this.getMicrophoneTrack();return n?!n.isMuted:!1}get isCameraEnabled(){const n=this.getCameraTrack();return n?!n.isMuted:!1}get isScreenShareEnabled(){const n=this.getScreenShareTrack(),r=n?!n.isMuted:!1;return console.log("🎬 VoxketClient: isScreenShareEnabled check:",{hasTrack:!!n,trackMuted:n==null?void 0:n.isMuted,enabled:r}),r}registerPlugin(n){this.pluginManager.register(n)}getPluginManager(){return this.pluginManager}getParticipants(){if(!this.room)return[];const n=[];return this.room.localParticipant&&n.push({id:this.room.localParticipant.identity,name:this.room.localParticipant.name||this.room.localParticipant.identity,isLocal:!0}),this.room.remoteParticipants.forEach(r=>{n.push({id:r.identity,name:r.name||r.identity,isLocal:!1})}),n}getSessionMetrics(){var n,r;return this.currentSession?{sessionId:this.currentSession.id,duration:Date.now()-(((n=this.currentSession.startedAt)==null?void 0:n.getTime())||0),messageCount:0,participantCount:((r=this.room)==null?void 0:r.remoteParticipants.size)||0,audioQuality:{avgBitrate:64e3,avgLatency:150,packetLoss:.01,jitter:.05},videoQuality:{avgBitrate:5e5,avgLatency:150,packetLoss:.01,jitter:.05},networkStats:{totalBytesReceived:0,totalBytesSent:0,connectionType:"webrtc",avgRoundTripTime:150},events:[]}:null}updateConfig(n){this.config={...this.config,...n}}async startRecording(){var n;try{this.emit("recording.started",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(r){throw new Ze("Failed to start recording","RECORDING_ERROR",r)}}async stopRecording(){var n;try{this.emit("recording.stopped",{sessionId:(n=this.currentSession)==null?void 0:n.id,timestamp:new Date})}catch(r){throw new Ze("Failed to stop recording","RECORDING_ERROR",r)}}async registerFrontendRPC(n,r,i="embedded"){return this.rpcManager.registerFrontendRPC(n,r,i)}getCurrentInteraction(){return this.rpcManager.getCurrentInteraction()}dismissCurrentInteraction(){this.rpcManager.dismissCurrentInteraction()}getRegisteredRpcMethods(){return this.rpcManager.getRegisteredMethods()}unregisterRpcMethod(n){this.rpcManager.unregisterMethod(n)}registerEventListener(n,r){return this.on(n,r)}registerEventEmitter(n,r){if(!this.room)throw new Error("Room not available");try{this.room.registerTextStreamHandler(n,async i=>{try{const o=await i.readAll();r(o)}catch(o){console.error(`Error processing event for topic '${n}':`,o)}})}catch(i){console.warn(`VoxketClient: Handler for topic '${n}' may already be registered:`,i)}}convertMarkdownToText(n){if(!n)return"";let r=n;return r=r.replace(/\*\*(.*?)\*\*/g,"$1"),r=r.replace(/__(.*?)__/g,"$1"),r=r.replace(/\*(.*?)\*/g,"$1"),r=r.replace(/_(.*?)_/g,"$1"),r=r.replace(/~~(.*?)~~/g,"$1"),r=r.replace(/`([^`]+)`/g,"$1"),r=r.replace(/```[\s\S]*?```/g,""),r=r.replace(/^#{1,6}\s+/gm,""),r=r.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1"),r.trim()}}const AM=Me.create(Fm),RM=Me.create(Vl),MM=Me.create(UN),IM=Me.create(ig);function OM({theme:e,mode:t,loadingText:n}){const r=Ct(e),i=()=>{switch(t){case"voice":return n||"Connecting to voice agent...";case"chat":return n||"Starting chat session...";case"video":return n||"Connecting to video call...";default:return n||"Connecting..."}};return h.jsxs("div",{className:"flex flex-col items-center justify-center h-full w-full p-8",children:[h.jsxs("div",{className:"text-center",children:[h.jsx("h3",{className:`text-lg font-semibold mb-2 ${r.text.accent}`,children:i()}),h.jsx("p",{className:`text-sm ${r.text.muted}`,children:"Please wait a moment..."})]}),h.jsxs("div",{className:"flex space-x-1 mt-4",children:[h.jsx("div",{className:"w-2 h-2 rounded-full animate-bounce bg-blue-500",style:{animationDelay:"0ms"}}),h.jsx("div",{className:"w-2 h-2 rounded-full animate-bounce bg-blue-500",style:{animationDelay:"150ms"}}),h.jsx("div",{className:"w-2 h-2 rounded-full animate-bounce bg-blue-500",style:{animationDelay:"300ms"}})]})]})}const PM=Me.create(OM);function DM({onClick:e,text:t="Open Chat",position:n="bottom-right",theme:r}){const i={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"},o=Ct(r);return h.jsx(Me.button,{onClick:e,className:`voxket-popup-trigger fixed ${i[n]} z-50 px-4 py-2 rounded-full shadow-lg ${o.popupTrigger} transition-all duration-200 hover:scale-105`,initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},whileHover:{scale:1.05},whileTap:{scale:.95},"data-position":n,children:t})}function bf({children:e,theme:t,displayType:n="widget",onClose:r,popupPosition:i="bottom-right",onExpand:o}){const s=Ct(t);if(n==="fullscreen")return h.jsx("div",{className:"fixed inset-0 z-[9999] bg-black/40 bg-opacity-30 backdrop-blur-sm flex items-center justify-center p-8",onClick:a=>{a.target===a.currentTarget&&r&&r()},children:h.jsxs("div",{className:"w-full h-full max-w-7xl max-h-[95vh] rounded-2xl relative bg-transparent flex flex-col",onClick:a=>{a.stopPropagation()},children:[r&&h.jsx("button",{onClick:a=>{a.preventDefault(),a.stopPropagation(),r()},className:"absolute top-4 cursor-pointer right-4 z-[10000] w-12 h-12 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 shadow-lg border border-gray-700 backdrop-blur-sm",title:"Exit Fullscreen",type:"button",children:h.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:h.jsx("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})})}),h.jsxs("div",{id:"voice-card",className:`voxket-widget-root theme-${t} ${s.card} w-full h-full flex flex-col rounded-xl shadow-2xl relative overflow-hidden`,"data-theme":t,style:{minHeight:"600px",height:"100%",contain:"layout style paint",overscrollBehavior:"contain"},children:[h.jsx("div",{className:s.cardTopGradient}),h.jsx("div",{className:s.cardPurpleBlur}),h.jsx("div",{className:s.cardPinkBlur}),h.jsx("div",{className:"relative z-10 flex flex-col h-full",children:e}),h.jsx("div",{className:s.cardPulse1}),h.jsx("div",{className:s.cardPulse2,style:{animationDelay:"1s"}})]})]})});if(n==="popup"){const a={"top-left":"top-4 left-4","top-right":"top-4 right-4","bottom-left":"bottom-4 left-4","bottom-right":"bottom-4 right-4"};return h.jsx("div",{className:"fixed rounded-2xl inset-0 z-[9999] pointer-events-none",children:h.jsxs("div",{className:`fixed rounded-2xl ${a[i]} pointer-events-auto`,children:[r&&h.jsx("button",{onClick:r,className:"absolute -top-2 -right-2 z-10 w-8 h-8 rounded-full bg-gray-900 bg-opacity-90 text-white flex items-center justify-center hover:bg-gray-800 transition-all duration-200 text-sm shadow-lg border border-gray-700",children:"×"}),h.jsxs("div",{id:"voice-card",className:`voxket-widget-root theme-${t} ${s.card} rounded-2xl flex flex-col relative overflow-hidden`,"data-theme":t,style:{width:"350px",height:"500px",contain:"layout style paint",overscrollBehavior:"contain"},children:[h.jsx("div",{className:s.cardTopGradient}),h.jsx("div",{className:s.cardPurpleBlur}),h.jsx("div",{className:s.cardPinkBlur}),h.jsx("div",{className:"relative z-10 flex flex-col h-full w-full",children:e}),h.jsx("div",{className:s.cardPulse1}),h.jsx("div",{className:s.cardPulse2,style:{animationDelay:"1s"}})]})]})})}return h.jsxs("div",{id:"voice-card",className:`voxket-widget-root theme-${t} ${s.card} relative overflow-hidden w-full h-full`,"data-theme":t,style:{height:"100%",maxHeight:"100%",contain:"layout style paint",overscrollBehavior:"contain"},children:[h.jsx("div",{className:s.cardTopGradient}),h.jsx("div",{className:s.cardPurpleBlur}),h.jsx("div",{className:s.cardPinkBlur}),h.jsx("div",{className:"relative z-10 flex flex-col h-full w-full",children:e}),h.jsx("div",{className:s.cardPulse1}),h.jsx("div",{className:s.cardPulse2,style:{animationDelay:"1s"}})]})}function LM(e){if(typeof window>"u")return null;const{agentId:t,participantName:n,baseUrl:r,appSecret:i,appId:o,prompts:s,statusMessage:a,welcomeTitle:l,welcomeSubTitle:c,className:u,width:d,height:f,loadingText:p,suportsChatInput:g=!0,suportsVideoInput:m=!0,suportsScreenShare:x=!0,theme:y="vox",onSessionStart:E,onSessionEnd:v,enableSessionLogging:_=!0,onSessionLogsUpdate:k,onSessionMetricsUpdate:C,modalities:M=["voice"],displayType:N="widget",popupPosition:I="bottom-right",popupTriggerText:b="Open Chat",onPopupToggle:R,voxketClient:O,onDisplayTypeChange:L}=e,[j,H]=D.useState(!1),[ie,ee]=D.useState(null),[P,W]=D.useState(()=>{try{if(O)return!!O.getCurrentSession()}catch(ne){console.error("Error checking existing session:",ne)}return!1}),[w,V]=D.useState(!1),[Y,S]=D.useState(t||""),[$,q]=D.useState(n||"User"),[B,Q]=D.useState(()=>{try{if(O)return O.getCurrentSession()}catch(ne){console.error("Error getting current session:",ne)}return null}),[te,ae]=D.useState(()=>{var ne,$e,Ve;try{if(O){const Ke=O.getCurrentSession();if((ne=Ke==null?void 0:Ke.activeModalities)!=null&&ne.includes("chat"))return"chat";if(($e=Ke==null?void 0:Ke.activeModalities)!=null&&$e.includes("voice"))return"voice";if((Ve=Ke==null?void 0:Ke.activeModalities)!=null&&Ve.includes("video"))return"video"}}catch(Ke){console.error("Error determining current mode:",Ke)}return"welcome"}),[de,De]=D.useState(!1);D.useEffect(()=>{N==="fullscreen"&&console.log("🎯 Widget: Switched to fullscreen mode")},[N]),D.useEffect(()=>{P&&!w?console.log("📊 Session started:",{currentMode:te,sessionId:B==null?void 0:B.id}):!P&&!w&&te==="welcome"&&console.log("📊 Returned to welcome screen")},[P,te,w]);const U=D.useMemo(()=>{try{if(O)return console.log("🔄 Using existing VoxketClient to preserve session state"),O;if(!o||!i||!r){const $e=`Missing required props: ${o?"":"appId "}${i?"":"appSecret "}${r?"":"baseUrl"}`;return console.error("❌ VoxketClient creation failed:",$e),ee(new Error($e)),H(!0),null}const ne={appId:o,appSecret:i,baseUrl:r,agentId:Y,participantName:$||"User",modalities:M};return console.log("🔧 Creating new VoxketClient with config:",{appId:o.substring(0,8)+"...",baseUrl:r,agentId:Y,participantName:$||"User",modalities:M}),new ki(ne)}catch(ne){return console.error("❌ Failed to create VoxketClient:",ne),ee(ne),H(!0),null}},[O,o,i,r,Y,$,M]),Ce=M,K=D.useMemo(()=>{try{if(!U)return console.warn("⚠️ No VoxketClient available, creating fallback room"),new se.Room;const ne=U.getRoom();return console.log("🏠 Widget: Room reference updated:",{roomExists:!!ne,roomState:ne==null?void 0:ne.state,sessionStarted:P,currentMode:te}),ne||new se.Room}catch(ne){return console.error("❌ Error getting room from client:",ne),new se.Room}},[U,P,te]);D.useEffect(()=>{if(K){const ne=()=>{console.log("🏠 Widget: Room state changed:",{state:K.state,numParticipants:K.numParticipants,isConnected:K.state==="connected",sessionId:B==null?void 0:B.id})},$e=(Ve,Ke,nn)=>{console.log("🎵 Widget: Track subscribed:",{trackKind:Ve.kind,trackSource:Ve.source,participantSid:nn.sid,participantIdentity:nn.identity,sessionId:B==null?void 0:B.id})};return K.on(se.RoomEvent.Connected,ne),K.on(se.RoomEvent.Disconnected,ne),K.on(se.RoomEvent.TrackSubscribed,$e),()=>{K.off(se.RoomEvent.Connected,ne),K.off(se.RoomEvent.Disconnected,ne),K.off(se.RoomEvent.TrackSubscribed,$e)}}},[K,B==null?void 0:B.id]),D.useEffect(()=>{!w&&te==="welcome"?console.log("🎬 Widget: Welcome screen ready"):P&&te!=="welcome"&&console.log("🎬 Widget: Session mode active:",te)},[te,w,P]),D.useEffect(()=>{(te==="voice"||te==="video"||te==="chat")&&!B&&!P&&!w&&U&&!U.connected&&(console.log("🔄 Auto-correcting: Found orphaned mode without session, returning to welcome"),ae("welcome"),V(!1))},[te,B,P,w,U]);const{sessionMetrics:ye,sessionLogs:me,logEvent:ge}=og({room:K,onSessionStart:E,onSessionEnd:v,enableConsoleLogging:_,enableLocalStorage:_,voxketSessionId:B==null?void 0:B.id});D.useEffect(()=>{k&&k(me)},[me,k]),D.useEffect(()=>{C&&ye&&C(ye)},[ye,C]),D.useEffect(()=>{if(!U)return;const ne=()=>{const $e=U.connected,Ve=U.getCurrentSession();console.log("🔗 Connection state changed:",{isConnected:$e,currentSessionId:Ve==null?void 0:Ve.id,currentMode:te,loading:w,sessionStarted:P}),!$e&&P&&!w&&(console.log("🔴 Connection lost during active session - returning to welcome"),V(!1),W(!1),Q(null),ae("welcome")),$e&&Ve&&w&&(console.log("🟢 Connected with active session - removing loader"),V(!1),W(!0),Q(Ve))};return U.on("connectionStateChanged",ne),U.on("sessionEnded",()=>{console.log("📞 Session ended - returning to welcome"),V(!1),W(!1),Q(null),ae("welcome")}),()=>{U.off("connectionStateChanged",ne),U.off("sessionEnded",()=>{})}},[U,te,w,P]),D.useEffect(()=>{const ne=Ve=>{console.log("🔴 Widget: Room disconnected:",Ve),console.log("🔍 Widget: Current state on disconnect:",{currentMode:te,sessionStarted:P,currentSessionId:B==null?void 0:B.id,loading:w}),V(!1),W(!1),Q(null),ae("welcome"),console.log("🏠 Widget: Automatically returning to welcome screen after disconnect")},$e=Ve=>{console.log("📹 Media devices error:",Ve)};return K.on(se.RoomEvent.MediaDevicesError,$e),K.on(se.RoomEvent.Disconnected,ne),()=>{K.off(se.RoomEvent.Disconnected,ne),K.off(se.RoomEvent.MediaDevicesError,$e)}},[K,te,P,B==null?void 0:B.id,w]);const Ee=async()=>{try{if(!U){console.error("❌ VoxketClient not available"),ee(new Error("VoxketClient not initialized")),H(!0);return}V(!0),ae("voice"),console.log("🎤 Starting voice session...",{agentId:Y,participantName:$}),console.log("🎤 Pre-start state:",{currentMode:"voice",sessionStarted:!1,loading:!0}),ge("USER_STARTED_VOICE_SESSION",{agentId:Y,participantName:$});const ne=await U.startSession(Y,{participantName:$||"User",modalities:["voice",...m?["video"]:[]]});console.log("✅ Voice session started successfully:",ne.id),Q(ne),W(!0),V(!1),E&&E(ne.id)}catch(ne){console.error("❌ Failed to start voice session:",ne),V(!1),W(!1),ae("welcome")}},Te=async()=>{try{if(!U){console.error("❌ VoxketClient not available"),ee(new Error("VoxketClient not initialized")),H(!0);return}V(!0),ae("chat"),console.log("💬 Starting chat session...",{agentId:Y,participantName:$}),ge("USER_STARTED_CHAT_SESSION",{agentId:Y,participantName:$});const ne=await U.startSession(Y,{participantName:$||"User",modalities:["chat"]});console.log("✅ Chat session started successfully:",ne.id),Q(ne),W(!0),V(!1),E&&E(ne.id)}catch(ne){console.error("❌ Failed to start chat session:",ne),V(!1),W(!1),ae("welcome")}},Ne=async()=>{try{if(!U){console.error("❌ VoxketClient not available"),ee(new Error("VoxketClient not initialized")),H(!0);return}V(!0),ae("video"),console.log("📺 Starting video session...",{agentId:Y,participantName:$}),console.log("📺 Pre-start state:",{currentMode:"video",sessionStarted:!1,loading:!0}),ge("USER_STARTED_VIDEO_SESSION",{agentId:Y,participantName:$});const ne=await U.startSession(Y,{participantName:$||"User",modalities:["video","voice"]});console.log("✅ Video session started successfully:",ne.id),Q(ne),W(!0),V(!1),E&&E(ne.id)}catch(ne){console.error("❌ Failed to start video session:",ne),V(!1),W(!1),ae("welcome")}},we=()=>{console.log("🔄 Widget: handleBackToWelcome called",{currentMode:te,sessionStarted:P,currentSessionId:B==null?void 0:B.id,displayType:N,loading:w}),ae("welcome"),V(!1),L&&L(e.displayType||"widget"),B&&P?(console.log("🧹 Widget: Cleaning up active session"),W(!1),Q(null),U&&(console.log("🔌 Widget: Disconnecting client and cleaning up room"),U.disconnect().catch(ne=>{console.error("❌ Widget: Error during disconnect:",ne)}))):(console.log("📝 Widget: No active session to clean up"),U&&U.connected&&(console.log("🔌 Widget: Force disconnecting client for fresh state"),U.disconnect().catch(ne=>{console.error("❌ Widget: Error during force disconnect:",ne)}))),N==="popup"&&!de&&De(!0),console.log("✅ Widget: handleBackToWelcome completed",{newCurrentMode:"welcome",newLoading:!1,newSessionStarted:!1})},ot=()=>{const ne=!de;De(ne),R&&R(ne),!ne&&!(B&&P)&&(ae("welcome"),W(!1),Q(null))},vt=()=>{console.log("🔄 Closing fullscreen, switching to widget display type"),e.onDisplayTypeChange?e.onDisplayTypeChange("widget"):console.warn("⚠️ No onDisplayTypeChange callback provided")},He=()=>{if(console.log("🔄 Expand to fullscreen requested"),e.onDisplayTypeChange)e.onDisplayTypeChange("fullscreen");else{console.warn("⚠️ No onDisplayTypeChange callback provided for expand functionality");const ne=document.getElementById("voice-card")||document.querySelector(".voxket-widget-container");ne&&ne.requestFullscreen&&ne.requestFullscreen().catch($e=>{console.warn("⚠️ Fullscreen API not supported or failed:",$e)})}};D.useEffect(()=>{var ne,$e,Ve;if(O&&U){const Ke=U.getCurrentSession();U.connected,Ke&&(console.log("✅ Restoring session state:",Ke.id),Q(Ke),W(!0),V(!1),(ne=Ke.activeModalities)!=null&&ne.includes("chat")?ae("chat"):($e=Ke.activeModalities)!=null&&$e.includes("voice")?ae("voice"):(Ve=Ke.activeModalities)!=null&&Ve.includes("video")&&ae("video"))}},[O,U]),D.useEffect(()=>()=>{!O&&U&&U.disconnect()},[U,O]);let bt=te==="video"?"w-[32rem]":"w-96",F=te==="video"?"h-[30rem]":"h-[25rem]",Z={};if(d&&(d.startsWith("w-")?bt=d:(Z.width=d,bt="")),f&&(f.startsWith("h-")?F=f:(Z.height=f,F="")),N==="popup"&&!de)return console.log("🟡 Showing popup trigger button"),h.jsx(DM,{onClick:ot,text:b,position:I,theme:y});if(j||!U){const ne=(ie==null?void 0:ie.message)||"VoxketWidget encountered an error. Please check your configuration.";return h.jsx("div",{className:`voxket-widget-root theme-${y} flex items-center justify-center p-8 ${u||""}`,style:{width:d||"400px",height:f||"500px",border:"1px solid #ff4444",borderRadius:"8px",background:"#fff5f5",color:"#cc0000"},children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"text-4xl mb-4",children:"⚠️"}),h.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Widget Error"}),h.jsx("p",{className:"text-sm mb-4",children:ne}),h.jsx("button",{onClick:()=>{H(!1),ee(null),window.location.reload()},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 transition-colors",children:"Retry"})]})})}let xe=`voxket-widget-root theme-${y}`,Ae={scrollMargin:0,scrollPadding:0,contain:"layout style paint"};N==="widget"?(xe+=` flex min-h-fit ${bt} ${F} ${u}`,Ae={...Ae,...Z}):(xe=`${u||""}`,Ae={});const Be=h.jsx("div",{className:"h-full w-full flex flex-col overflow-hidden relative z-10",children:h.jsxs(Sr,{mode:"wait",children:[te==="welcome"&&!w&&h.jsx(IM,{agentId:Y,participantName:$||"",onAgentIdChange:S,onParticipantNameChange:q,onStartCall:Ee,onStartChat:Te,onStartVideo:Ne,disabled:P||w,prompts:s,statusMessage:a,title:l,subTitle:c,theme:y,modalities:Ce,initial:{opacity:0,y:0},animate:{opacity:1,y:0},exit:{opacity:0,y:40},transition:{duration:.3,ease:"easeInOut"}},"welcome"),w&&(te==="voice"||te==="chat"||te==="video")&&h.jsx(PM,{theme:y,mode:te,loadingText:p,initial:{opacity:0,scale:.9},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.9},transition:{duration:.3,ease:"easeInOut"}},`loading-${te}`),te==="voice"&&!w&&P&&U&&h.jsxs(Ft.RoomContext.Provider,{value:K,children:[h.jsx(Ft.RoomAudioRenderer,{},`audio-${(B==null?void 0:B.id)||"no-session"}`),h.jsx(Ft.StartAudio,{label:"Start Audio"},`start-audio-${(B==null?void 0:B.id)||"no-session"}`),h.jsx(AM,{loadingText:p,participantName:$||"User",sessionStarted:P,disabled:!1,theme:y,client:U,displayType:N,onBack:N==="popup"?ot:we,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"voice-session")]}),te==="chat"&&!w&&P&&U&&h.jsx(RM,{client:U,theme:y,displayType:N,onBack:N==="popup"?ot:we,onEndChat:we,disabled:!1,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"chat-view"),te==="video"&&!w&&P&&U&&h.jsxs(Ft.RoomContext.Provider,{value:K,children:[h.jsx(Ft.RoomAudioRenderer,{},`audio-video-${(B==null?void 0:B.id)||"no-session"}`),h.jsx(Ft.StartAudio,{label:"Start Audio"},`start-audio-video-${(B==null?void 0:B.id)||"no-session"}`),h.jsx(MM,{client:U,theme:y,displayType:N,onBack:N==="popup"?ot:we,onEndCall:we,disabled:!1,initial:{opacity:0,y:40},animate:{opacity:1,y:0},exit:{opacity:0,y:-40},transition:{duration:.3,ease:"easeInOut"}},"video-session")]})]})});return N==="fullscreen"||N==="popup"?h.jsx(bf,{theme:y,displayType:N,popupPosition:I,onClose:N==="fullscreen"?vt:ot,children:Be}):h.jsx("div",{className:xe,style:Ae,children:h.jsx(bf,{theme:y,displayType:N,popupPosition:I,onExpand:He,children:Be})})}function oo(e){return h.jsx(Xl,{children:h.jsx(LM,{...e})})}function FM({logs:e,onClear:t,onExport:n}){const[r,i]=A.useState(!1),[o,s]=A.useState(""),a=e.filter(l=>!o||l.event.toLowerCase().includes(o.toLowerCase()));return r?h.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:h.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-4xl w-full max-h-[80vh] flex flex-col m-4",children:[h.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[h.jsxs("h2",{className:"text-lg font-semibold",children:["Session Logs (",e.length,")"]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"text",placeholder:"Filter events...",value:o,onChange:l=>s(l.target.value),className:"px-3 py-1 border rounded text-sm"}),h.jsx("button",{onClick:t,className:"px-3 py-1 bg-red-600 text-white rounded text-sm hover:bg-red-700",children:"Clear"}),h.jsx("button",{onClick:n,className:"px-3 py-1 bg-green-600 text-white rounded text-sm hover:bg-green-700",children:"Export"}),h.jsx("button",{onClick:()=>i(!1),className:"px-3 py-1 bg-gray-600 text-white rounded text-sm hover:bg-gray-700",children:"Close"})]})]}),h.jsx("div",{className:"flex-1 overflow-auto p-4",children:a.length===0?h.jsx("p",{className:"text-gray-500 text-center py-8",children:"No logs found"}):h.jsx("div",{className:"space-y-2",children:a.map((l,c)=>h.jsxs("div",{className:"border rounded p-3 text-sm",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{className:"font-semibold text-blue-600",children:l.event}),h.jsx("span",{className:"text-gray-500 text-xs",children:new Date(l.timestamp).toLocaleTimeString()})]}),l.sessionId&&h.jsxs("div",{className:"text-xs text-gray-600 mb-1",children:["Session: ",l.sessionId]}),l.data&&h.jsx("div",{className:"bg-gray-50 p-2 rounded text-xs",children:h.jsx("pre",{className:"whitespace-pre-wrap overflow-auto",children:JSON.stringify(l.data,null,2)})})]},c))})})]})}):h.jsxs("button",{onClick:()=>i(!0),className:"fixed bottom-4 right-4 bg-blue-600 text-white px-4 py-2 rounded-lg shadow-lg hover:bg-blue-700 transition-colors text-sm z-50",children:["Session Logs (",e.length,")"]})}function BM({metrics:e}){return e?h.jsxs("div",{className:"bg-gray-100 p-4 rounded-lg",children:[h.jsx("h3",{className:"font-semibold mb-2",children:"Current Session"}),h.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Session ID:"}),h.jsx("div",{className:"font-mono text-xs",children:e.sessionId})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Start Time:"}),h.jsx("div",{children:new Date(e.startTime).toLocaleString()})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Messages:"}),h.jsx("div",{children:e.totalMessages})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Participants:"}),h.jsx("div",{children:e.participantCount})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Connection Issues:"}),h.jsx("div",{children:e.connectionIssues})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-gray-600",children:"Duration:"}),h.jsxs("div",{children:[Math.round((Date.now()-new Date(e.startTime).getTime())/1e3),"s"]})]})]})]}):null}function er(){const{currentSession:e,sessionState:t,sessionMetrics:n,createSession:r,endSession:i}=fn(),o=A.useCallback(async(a,l)=>await r(a,l),[r]),s=A.useCallback(async()=>await i(),[i]);return{session:e,state:t,metrics:n,isActive:e!==null&&t!=="disconnected",isConnecting:t==="connecting",isConnected:t==="connected"||t==="active",start:o,stop:s}}function lg(){const{sessionMetrics:e,currentSession:t}=fn();return{metrics:e,sessionId:t==null?void 0:t.id,duration:e==null?void 0:e.duration,participantCount:e==null?void 0:e.participantCount,messageCount:e==null?void 0:e.messageCount,audioQuality:e==null?void 0:e.audioQuality,networkStats:e==null?void 0:e.networkStats}}function cg(){const{setMicrophoneEnabled:e,client:t}=fn(),[n,r]=A.useState(!1),[i,o]=A.useState(!1),s=A.useCallback(async()=>{if(!i){o(!0);try{const c=!n;await e(c),r(c)}catch(c){console.error("Failed to toggle microphone:",c)}finally{o(!1)}}},[n,i,e]),a=A.useCallback(async()=>{if(!(n||i)){o(!0);try{await e(!0),r(!0)}catch(c){console.error("Failed to enable microphone:",c)}finally{o(!1)}}},[n,i,e]),l=A.useCallback(async()=>{if(!(!n||i)){o(!0);try{await e(!1),r(!1)}catch(c){console.error("Failed to disable microphone:",c)}finally{o(!1)}}},[n,i,e]);return{isEnabled:n,isLoading:i,toggle:s,enable:a,disable:l}}function ug(){const{setCameraEnabled:e}=fn(),[t,n]=A.useState(!1),[r,i]=A.useState(!1),o=A.useCallback(async()=>{if(!r){i(!0);try{const l=!t;await e(l),n(l)}catch(l){console.error("Failed to toggle camera:",l)}finally{i(!1)}}},[t,r,e]),s=A.useCallback(async()=>{if(!(t||r)){i(!0);try{await e(!0),n(!0)}catch(l){console.error("Failed to enable camera:",l)}finally{i(!1)}}},[t,r,e]),a=A.useCallback(async()=>{if(!(!t||r)){i(!0);try{await e(!1),n(!1)}catch(l){console.error("Failed to disable camera:",l)}finally{i(!1)}}},[t,r,e]);return{isEnabled:t,isLoading:r,toggle:o,enable:s,disable:a}}function dg(){const{startScreenShare:e,stopScreenShare:t}=fn(),[n,r]=A.useState(!1),[i,o]=A.useState(!1),s=A.useCallback(async()=>{if(!(n||i)){o(!0);try{await e(),r(!0)}catch(c){console.error("Failed to start screen share:",c)}finally{o(!1)}}},[n,i,e]),a=A.useCallback(async()=>{if(!(!n||i)){o(!0);try{await t(),r(!1)}catch(c){console.error("Failed to stop screen share:",c)}finally{o(!1)}}},[n,i,t]),l=A.useCallback(async()=>{n?await a():await s()},[n,s,a]);return{isSharing:n,isLoading:i,start:s,stop:a,toggle:l}}function jM(){const{client:e}=fn(),[t,n]=A.useState({tracks:[],layout:{type:"grid",showLocalVideo:!0,aspectRatio:"16:9"},isRecording:!1}),r=A.useMemo(()=>t.tracks.find(m=>m.isLocal),[t.tracks]),i=A.useMemo(()=>t.tracks.filter(m=>!m.isLocal),[t.tracks]),o=A.useCallback(async()=>{try{r!=null&&r.isEnabled?await(e==null?void 0:e.disableCamera()):await(e==null?void 0:e.enableCamera())}catch(m){throw console.error("Failed to toggle camera:",m),m}},[e,r]),s=A.useCallback(async()=>{try{t.tracks.find(x=>x.isScreenShare)?await(e==null?void 0:e.stopScreenShare()):await(e==null?void 0:e.startScreenShare())}catch(m){throw console.error("Failed to toggle screen share:",m),m}},[e,t.tracks]),a=A.useCallback(m=>{n(x=>({...x,layout:m}))},[]),l=A.useCallback(m=>{n(x=>({...x,pinnedTrack:m}))},[]),c=A.useCallback(()=>{n(m=>({...m,pinnedTrack:void 0}))},[]),u=A.useCallback(async()=>{try{await(e==null?void 0:e.startRecording()),n(m=>({...m,isRecording:!0}))}catch(m){throw console.error("Failed to start recording:",m),m}},[e]),d=A.useCallback(async()=>{try{await(e==null?void 0:e.stopRecording()),n(m=>({...m,isRecording:!1}))}catch(m){throw console.error("Failed to stop recording:",m),m}},[e]),f=A.useCallback(m=>t.tracks.find(x=>x.id===m),[t.tracks]),p=A.useCallback(m=>t.tracks.filter(x=>x.participantId===m),[t.tracks]),g=A.useCallback(m=>m.isEnabled&&t.tracks.includes(m),[t.tracks]);return A.useEffect(()=>{if(!e)return;const m=E=>{n(v=>({...v,tracks:[...v.tracks.filter(_=>_.id!==E.id),E]}))},x=E=>{n(v=>{var _;return{...v,tracks:v.tracks.filter(k=>k.id!==E),pinnedTrack:((_=v.pinnedTrack)==null?void 0:_.id)===E?void 0:v.pinnedTrack}})},y=E=>{n(v=>({...v,tracks:v.tracks.map(_=>_.id===E.id?E:_)}))};return e.on("videoTrackAdded",m),e.on("videoTrackRemoved",x),e.on("videoTrackUpdated",y),()=>{e.off("videoTrackAdded",m),e.off("videoTrackRemoved",x),e.off("videoTrackUpdated",y)}},[e]),{tracks:t.tracks,localTrack:r,remoteTraracks:i,pinnedTrack:t.pinnedTrack,layout:t.layout,isRecording:t.isRecording,toggleCamera:o,toggleScreenShare:s,setLayout:a,pinTrack:l,unpinTrack:c,startRecording:u,stopRecording:d,getTrackById:f,getTracksByParticipant:p,isTrackActive:g}}function Ko(){const{chatMessages:e,sendChatMessage:t,currentSession:n}=fn(),[r,i]=A.useState(!1),o=A.useCallback(async c=>{if(!(!c.trim()||r||!n)){i(!0);try{await t(c.trim())}catch(u){throw console.error("Failed to send chat message:",u),u}finally{i(!1)}}},[t,r,n]),{userMessages:s,agentMessages:a,allMessages:l}=A.useMemo(()=>{const c=e.filter(d=>d.sender.type==="participant"),u=e.filter(d=>d.sender.type==="agent");return{userMessages:c,agentMessages:u,allMessages:e}},[e]);return{messages:l,userMessages:s,agentMessages:a,messageCount:l.length,isSending:r,canSend:!!n&&!r,send:o}}function $M(){const{send:e,isSending:t,canSend:n}=Ko(),[r,i]=A.useState(""),o=A.useCallback(async()=>{if(!(!r.trim()||!n))try{await e(r),i("")}catch(a){throw a}},[r,e,n]),s=A.useCallback(a=>{a.key==="Enter"&&!a.shiftKey&&(a.preventDefault(),o())},[o]);return{value:r,setValue:i,send:o,handleKeyPress:s,isSending:t,canSend:n&&r.trim().length>0}}function ec(){const{isConnected:e,isConnecting:t,connectionError:n,connect:r,disconnect:i}=fn(),o=A.useCallback(async()=>{if(!(e||t))try{await r()}catch(a){throw console.error("Failed to connect:",a),a}},[r,e,t]),s=A.useCallback(async()=>{if(e)try{await i()}catch(a){throw console.error("Failed to disconnect:",a),a}},[i,e]);return{isConnected:e,isConnecting:t,isDisconnected:!e&&!t,error:n,hasError:!!n,connect:o,disconnect:s}}function fg(){const{participants:e}=fn();return{participants:e,count:e.length,localParticipant:e.find(t=>t.isLocal),remoteParticipants:e.filter(t=>!t.isLocal)}}const hg=A.createContext({}),Si=()=>A.useContext(hg);function pg({children:e,...t}){return h.jsx(hg.Provider,{value:t,children:e})}function so({name:e,children:t,fallback:n,className:r}){return h.jsx("div",{className:`voxket-slot voxket-slot--${e} ${r||""}`,children:t||n})}function mg(e,t={}){return Object.assign(e,t)}function gg({showMicrophoneControl:e=!0,showCameraControl:t=!0,showScreenShareControl:n=!0,showSessionActions:r=!0,customControls:i,className:o=""}){const s=er(),a=cg(),l=ug(),c=dg(),u=Si(),d=["voxket-session-controls",`voxket-session-controls--${u.variant||"default"}`,`voxket-session-controls--${u.size||"md"}`,s.isActive?"voxket-session-controls--active":"voxket-session-controls--inactive",o].filter(Boolean).join(" ");return!s.isActive&&!r?h.jsx("div",{className:d,children:h.jsx("div",{className:"voxket-controls-inactive",children:h.jsx("p",{children:"Controls available during active session"})})}):h.jsxs("div",{className:d,children:[r&&h.jsx("div",{className:"voxket-session-actions",children:s.isActive?h.jsx("button",{onClick:s.stop,className:"voxket-button voxket-button--danger",children:"End Session"}):h.jsx(VM,{})}),s.isActive&&h.jsxs("div",{className:"voxket-media-controls",children:[e&&h.jsxs("button",{onClick:a.toggle,disabled:a.isLoading,className:`voxket-button voxket-button--media ${a.isEnabled?"voxket-button--active":""}`,title:a.isEnabled?"Mute microphone":"Unmute microphone",children:[h.jsx("span",{className:"voxket-icon",children:"🎤"}),a.isLoading?"Loading...":a.isEnabled?"Mute":"Unmute"]}),t&&h.jsxs("button",{onClick:l.toggle,disabled:l.isLoading,className:`voxket-button voxket-button--media ${l.isEnabled?"voxket-button--active":""}`,title:l.isEnabled?"Stop camera":"Start camera",children:[h.jsx("span",{className:"voxket-icon",children:"📹"}),l.isLoading?"Loading...":l.isEnabled?"Stop Video":"Start Video"]}),n&&h.jsxs("button",{onClick:c.toggle,disabled:c.isLoading,className:`voxket-button voxket-button--media ${c.isSharing?"voxket-button--active":""}`,title:c.isSharing?"Stop screen share":"Start screen share",children:[h.jsx("span",{className:"voxket-icon",children:"🖥️"}),c.isLoading?"Loading...":c.isSharing?"Stop Share":"Share Screen"]})]}),i&&h.jsx("div",{className:"voxket-custom-controls",children:i})]})}function VM(){er();const[e,t]=A.useState(!1),n=async()=>{t(!0);try{console.log("Start session - agentId needed")}catch(r){console.error("Failed to start session:",r)}finally{t(!1)}};return h.jsx("button",{onClick:n,disabled:e,className:"voxket-button voxket-button--primary",children:e?"Starting...":"Start Session"})}function tc({showConnectionStatus:e=!0,showSessionInfo:t=!0,showAgentInfo:n=!0,className:r=""}){const i=er(),o=ec(),s=Si(),a=["voxket-session-header",`voxket-session-header--${s.variant||"default"}`,`voxket-session-header--${s.size||"md"}`,r].filter(Boolean).join(" ");return h.jsxs("div",{className:a,children:[e&&h.jsxs("div",{className:"voxket-connection-status",children:[h.jsx("div",{className:`voxket-status-indicator ${o.isConnected?"connected":"disconnected"}`}),h.jsx("span",{className:"voxket-status-text",children:o.isConnecting?"Connecting...":o.isConnected?"Connected":"Disconnected"})]}),t&&i.session&&h.jsxs("div",{className:"voxket-session-info",children:[h.jsxs("div",{className:"voxket-session-id",children:["Session: ",i.session.id.slice(-8)]}),h.jsxs("div",{className:"voxket-session-state",children:["State: ",i.state]})]}),n&&i.session&&h.jsxs("div",{className:"voxket-agent-info",children:[h.jsxs("div",{className:"voxket-agent-id",children:["Agent: ",i.session.agentId]}),h.jsxs("div",{className:"voxket-modalities",children:["Modalities: ",i.session.activeModalities.join(", ")]})]}),o.error&&h.jsxs("div",{className:"voxket-error-message",children:["Error: ",o.error.message]})]})}function nc({showChat:e=!0,showTranscriptions:t=!1,customContent:n,className:r=""}){const i=er(),o=Ko(),s=Si(),a=["voxket-session-content",`voxket-session-content--${s.variant||"default"}`,`voxket-session-content--${s.size||"md"}`,r].filter(Boolean).join(" ");return i.isActive?h.jsx("div",{className:a,children:n||h.jsxs(h.Fragment,{children:[e&&h.jsxs("div",{className:"voxket-chat-container",children:[h.jsxs("div",{className:"voxket-chat-messages",children:[o.messages.map(l=>h.jsxs("div",{className:`voxket-message voxket-message--${l.sender.type}`,children:[h.jsxs("div",{className:"voxket-message-header",children:[h.jsx("span",{className:"voxket-message-sender",children:l.sender.name}),h.jsx("span",{className:"voxket-message-time",children:l.timestamp.toLocaleTimeString()})]}),h.jsx("div",{className:"voxket-message-content",children:l.content})]},l.id)),o.messages.length===0&&h.jsx("div",{className:"voxket-empty-messages",children:h.jsx("p",{children:"No messages yet. Start the conversation!"})})]}),h.jsx(zM,{})]}),t&&h.jsx("div",{className:"voxket-transcriptions",children:h.jsx("div",{className:"voxket-transcription-placeholder",children:h.jsx("p",{children:"Voice transcriptions will appear here"})})})]})}):h.jsx("div",{className:a,children:h.jsx("div",{className:"voxket-inactive-state",children:h.jsxs("div",{className:"voxket-inactive-message",children:[h.jsx("h3",{children:"Start a conversation"}),h.jsx("p",{children:"Begin a session to start chatting with the AI agent"})]})})})}function zM(){const e=Ko(),[t,n]=A.useState(""),r=async()=>{if(!(!t.trim()||!e.canSend))try{await e.send(t),n("")}catch(o){console.error("Failed to send message:",o)}},i=o=>{o.key==="Enter"&&!o.shiftKey&&(o.preventDefault(),r())};return h.jsxs("div",{className:"voxket-chat-input",children:[h.jsx("input",{type:"text",value:t,onChange:o=>n(o.target.value),onKeyPress:i,placeholder:"Type your message...",disabled:!e.canSend,className:"voxket-input"}),h.jsx("button",{onClick:r,disabled:!e.canSend||!t.trim(),className:"voxket-send-button",children:e.isSending?"Sending...":"Send"})]})}function rc({showMetrics:e=!0,showParticipants:t=!0,showStatus:n=!0,customFooter:r,className:i=""}){const o=er(),s=lg(),a=fg(),l=Si(),c=["voxket-session-footer",`voxket-session-footer--${l.variant||"default"}`,`voxket-session-footer--${l.size||"md"}`,i].filter(Boolean).join(" ");return o.isActive?h.jsx("div",{className:c,children:r||h.jsxs(h.Fragment,{children:[n&&h.jsxs("div",{className:"voxket-session-status",children:[h.jsx("div",{className:"voxket-status-indicator voxket-status-indicator--active"}),h.jsx("span",{className:"voxket-status-text",children:"Session Active"})]}),e&&s.metrics&&h.jsxs("div",{className:"voxket-session-metrics",children:[h.jsxs("div",{className:"voxket-metric",children:[h.jsx("span",{className:"voxket-metric-label",children:"Duration:"}),h.jsx("span",{className:"voxket-metric-value",children:UM(s.duration||0)})]}),h.jsxs("div",{className:"voxket-metric",children:[h.jsx("span",{className:"voxket-metric-label",children:"Messages:"}),h.jsx("span",{className:"voxket-metric-value",children:s.metrics.messageCount})]})]}),t&&h.jsxs("div",{className:"voxket-participants-info",children:[h.jsxs("span",{className:"voxket-participants-count",children:[a.count," participant",a.count!==1?"s":""]}),a.remoteParticipants.length>0&&h.jsx("div",{className:"voxket-participant-list",children:a.remoteParticipants.map(u=>h.jsx("span",{className:"voxket-participant-name",children:u.name},u.id))})]})]})}):h.jsx("div",{className:c,children:h.jsx("div",{className:"voxket-footer-inactive",children:h.jsx("span",{className:"voxket-status-text",children:"Ready to start session"})})})}function UM(e){const t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60);return r>0?`${r}:${(n%60).toString().padStart(2,"0")}:${(t%60).toString().padStart(2,"0")}`:`${n}:${(t%60).toString().padStart(2,"0")}`}function HM({agentId:e,sessionConfig:t,autoStart:n=!1,onSessionStart:r,onSessionEnd:i,variant:o="default",size:s="md",theme:a,className:l="",children:c}){var p;const u=er(),d=ec();A.useEffect(()=>{n&&e&&d.isConnected&&!u.isActive&&u.start(e,t).catch(console.error)},[n,e,d.isConnected,u.isActive]),A.useEffect(()=>{var g;(g=u.session)!=null&&g.id&&r&&r(u.session.id)},[(p=u.session)==null?void 0:p.id,r]),A.useEffect(()=>()=>{u.isActive&&i&&u.stop().then(i).catch(console.error)},[]);const f=["voxket-session",`voxket-session--${o}`,`voxket-session--${s}`,u.isActive?"voxket-session--active":"voxket-session--inactive",l].filter(Boolean).join(" ");return h.jsx(pg,{variant:o,size:s,theme:a,className:l,children:h.jsx("div",{className:f,children:c||h.jsxs(h.Fragment,{children:[h.jsx(so,{name:"header",fallback:h.jsx(tc,{})}),h.jsx(so,{name:"content",fallback:h.jsx(nc,{})}),h.jsx(so,{name:"footer",fallback:h.jsx(rc,{})})]})})})}const bg=mg(HM,{Header:tc,Content:nc,Footer:rc,Controls:gg}),Yn={name:"default",colors:{primary:"#3B82F6",secondary:"#6B7280",accent:"#8B5CF6",background:"#FFFFFF",surface:"#F9FAFB",text:{primary:"#111827",secondary:"#6B7280",muted:"#9CA3AF",inverse:"#FFFFFF"},status:{success:"#10B981",warning:"#F59E0B",error:"#EF4444",info:"#3B82F6"},border:"#E5E7EB",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},typography:{fontFamily:"system-ui, -apple-system, sans-serif",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700},lineHeight:{tight:1.25,normal:1.5,relaxed:1.75}},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{none:"0",sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},shadows:{sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1)"}},La={...Yn,name:"dark",colors:{primary:"#60A5FA",secondary:"#9CA3AF",accent:"#A78BFA",background:"#111827",surface:"#1F2937",text:{primary:"#F9FAFB",secondary:"#D1D5DB",muted:"#9CA3AF",inverse:"#111827"},status:{success:"#34D399",warning:"#FBBF24",error:"#F87171",info:"#60A5FA"},border:"#374151",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.3)"}},Fa={...Yn,name:"enterprise",colors:{primary:"#1E40AF",secondary:"#64748B",accent:"#7C3AED",background:"#FFFFFF",surface:"#F8FAFC",text:{primary:"#0F172A",secondary:"#475569",muted:"#94A3B8",inverse:"#FFFFFF"},status:{success:"#059669",warning:"#D97706",error:"#DC2626",info:"#1E40AF"},border:"#CBD5E1",shadow:"0 1px 3px 0 rgba(0, 0, 0, 0.1)"},borderRadius:{none:"0",sm:"0.125rem",md:"0.25rem",lg:"0.375rem",full:"9999px"}},yg=A.createContext(null),xg=()=>{const e=A.useContext(yg);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e};function WM({theme:e="default",themes:t={},children:n,cssVariables:r=!0,className:i=""}){const[o,s]=A.useState(()=>{const f={default:Yn,dark:La,enterprise:Fa,...t};return typeof e=="string"?f[e]||Yn:e}),[a,l]=A.useState(()=>({default:Yn,dark:La,enterprise:Fa,...t})),c=f=>{if(typeof f=="string"){const p=a[f];p&&s(p)}else s(f)},u=f=>{l(p=>({...p,[f.name]:f}))};A.useEffect(()=>{if(r&&typeof document<"u"){const f=document.documentElement;Object.entries(wg(o)).forEach(([p,g])=>{f.style.setProperty(`--voxket-${p}`,g)})}},[o,r]);const d={theme:o,setTheme:c,themes:a,registerTheme:u};return h.jsx(yg.Provider,{value:d,children:h.jsx("div",{className:`voxket-theme voxket-theme--${o.name} ${i}`,children:n})})}function wg(e){const t={},n=(r,i="")=>{for(const[o,s]of Object.entries(r)){const a=i?`${i}-${o}`:o;typeof s=="object"&&s!==null&&!Array.isArray(s)?n(s,a):t[a]=String(s)}};return n(e),t}function GM(e=Yn,t){return{...e,...t,colors:{...e.colors,...t.colors},typography:{...e.typography,...t.typography},spacing:{...e.spacing,...t.spacing},borderRadius:{...e.borderRadius,...t.borderRadius},shadows:{...e.shadows,...t.shadows}}}function KM(e){var n;const{theme:t}=xg();return((n=t.components)==null?void 0:n[e])||{}}const qM=Jl("voice-modality","voice",{onActivate:async e=>{const t=e.config;t.enableTranscription&&YM(e),t.enableVoiceActivation&&ZM(e,t),console.log("Voice modality activated",t)},onDeactivate:async e=>{console.log("Voice modality deactivated")},onMessage:async(e,t)=>{t.type==="audio"&&XM(e,t)}});function YM(e,t){e.on("participant.speaking.started",n=>{console.log("Transcription: Started for",n.name)}),e.on("participant.speaking.stopped",n=>{console.log("Transcription: Stopped for",n.name)})}function ZM(e,t){const n=t.silenceThreshold||-50;console.log("Voice activation setup with threshold:",n)}function XM(e,t){console.log("Playing audio response:",t.content)}const QM=Jl("chat-modality","chat",{onActivate:async e=>{const t=e.config;t.enableRichText&&JM(),t.enableFileUpload&&eI(e),t.enableCustomComponents&&tI(),console.log("Chat modality activated",t)},onDeactivate:async e=>{console.log("Chat modality deactivated")},onMessage:async(e,t)=>{const n=e.config;t.type==="ui_component"?nI(e,t):t.type==="text"&&n.enableRichText&&rI(e,t)}});function JM(e){console.log("Rich text support enabled")}function eI(e){console.log("File upload enabled"),e.on("chat.file.uploaded",t=>{console.log("File uploaded:",t.name)})}function tI(e){console.log("Custom components enabled");const t=new Map;t.set("quick-actions",iI),t.set("form",oI),t.set("card",sI),t.set("chart",aI)}function nI(e,t){const{componentType:n,props:r}=t.metadata;console.log("Rendering custom component:",n,r),e.emit("chat.component.render",{type:n,props:r,timestamp:new Date})}function rI(e,t){console.log("Processing rich text message:",t.content)}function iI(e){return{type:"quick-actions",actions:e.actions||[],layout:e.layout||"horizontal"}}function oI(e){return{type:"form",fields:e.fields||[],submitAction:e.submitAction,validation:e.validation}}function sI(e){return{type:"card",title:e.title,content:e.content,actions:e.actions,variant:e.variant||"default"}}function aI(e){return{type:"chart",chartType:e.chartType||"line",data:e.data,options:e.options}}function ao({track:e,participantName:t,showControls:n=!0,showName:r=!0,showMuteIndicator:i=!0,isPinned:o=!1,className:s="",onClick:a,onPin:l,onUnpin:c}){const u=A.useRef(null),[d,f]=A.useState(!1);A.useEffect(()=>{if(!u.current||!e.isEnabled)return;const x=u.current;return x.srcObject=null,()=>{x.srcObject&&(x.srcObject=null)}},[e]);const p=()=>{a==null||a(e)},g=x=>{x.stopPropagation(),o?c==null||c(e):l==null||l(e)},m=["voxket-video-tile",e.isLocal?"voxket-video-tile--local":"voxket-video-tile--remote",e.isScreenShare?"voxket-video-tile--screen-share":"voxket-video-tile--camera",o?"voxket-video-tile--pinned":"",e.isEnabled?"":"voxket-video-tile--disabled",d?"voxket-video-tile--hovered":"",s].filter(Boolean).join(" ");return h.jsxs("div",{className:m,onClick:p,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),style:{aspectRatio:e.dimensions?`${e.dimensions.width} / ${e.dimensions.height}`:"16 / 9"},children:[h.jsx("video",{ref:u,className:"voxket-video-element",autoPlay:!0,playsInline:!0,muted:e.isLocal}),!e.isEnabled&&h.jsxs("div",{className:"voxket-video-placeholder",children:[h.jsx("div",{className:"voxket-video-placeholder-icon",children:e.isScreenShare?"🖥️":"📹"}),h.jsx("p",{className:"voxket-video-placeholder-text",children:e.isScreenShare?"Screen sharing paused":"Camera off"})]}),h.jsxs("div",{className:"voxket-video-overlay",children:[r&&t&&h.jsxs("div",{className:"voxket-video-name",children:[t,e.isLocal&&" (You)"]}),i&&!e.isEnabled&&h.jsx("div",{className:"voxket-video-mute-indicator",children:"🔇"}),n&&(d||o)&&h.jsxs("div",{className:"voxket-video-controls",children:[h.jsx("button",{className:`voxket-video-control-btn ${o?"voxket-video-control-btn--active":""}`,onClick:g,title:o?"Unpin video":"Pin video",children:"📌"}),e.isScreenShare&&h.jsx("div",{className:"voxket-video-indicator",children:"🖥️"}),e.source&&h.jsx("div",{className:"voxket-video-source",children:e.source})]})]}),!e.isEnabled&&h.jsx("div",{className:"voxket-video-loading",children:h.jsx("div",{className:"voxket-spinner"})})]})}function lI({tracks:e,layout:t,className:n="",onLayoutChange:r,onTrackClick:i,maxVisibleTracks:o=9,showPagination:s=!0}){const[a,l]=A.useState(0),[c,u]=A.useState(null),d=A.useMemo(()=>{let E=[...e];t.type==="speaker"&&c&&(E=[c,...e.filter(k=>k.id!==c.id)]);const v=a*o,_=v+o;return E.slice(v,_)},[e,t,c,a,o]),f=Math.ceil(e.length/o),p=A.useMemo(()=>{const E=d.length;switch(t.type){case"grid":const v=Math.ceil(Math.sqrt(E)),_=Math.ceil(E/v);return{display:"grid",gridTemplateColumns:`repeat(${v}, 1fr)`,gridTemplateRows:`repeat(${_}, 1fr)`,gap:"8px"};case"speaker":return{display:"flex",flexDirection:"column",gap:"8px"};case"sidebar":return{display:"flex",gap:"8px"};case"gallery":return{display:"flex",flexWrap:"wrap",gap:"8px",justifyContent:"center"};default:return{}}},[t.type,d.length]),g=E=>{u(E)},m=()=>{u(null)},x=E=>{r==null||r({...t,type:E})},y=["voxket-video-grid",`voxket-video-grid--${t.type}`,`voxket-video-grid--${d.length}-tracks`,n].filter(Boolean).join(" ");return e.length===0?h.jsx("div",{className:"voxket-video-grid-empty",children:h.jsxs("div",{className:"voxket-video-grid-empty-content",children:[h.jsx("div",{className:"voxket-video-grid-empty-icon",children:"📹"}),h.jsx("p",{children:"No video tracks available"})]})}):h.jsxs("div",{className:y,children:[h.jsxs("div",{className:"voxket-video-grid-controls",children:[h.jsx("div",{className:"voxket-video-layout-controls",children:["grid","speaker","sidebar","gallery"].map(E=>h.jsx("button",{className:`voxket-layout-btn ${t.type===E?"voxket-layout-btn--active":""}`,onClick:()=>x(E),title:`Switch to ${E} layout`,children:cI(E)},E))}),h.jsxs("div",{className:"voxket-video-count",children:[e.length," participant",e.length!==1?"s":""]})]}),h.jsx("div",{className:"voxket-video-grid-content",style:p,children:t.type==="speaker"&&c?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"voxket-video-speaker-main",children:h.jsx(ao,{track:c,participantName:`Participant ${c.participantId}`,isPinned:!0,onClick:i,onUnpin:m})}),h.jsx("div",{className:"voxket-video-speaker-sidebar",children:d.filter(E=>E.id!==c.id).map(E=>h.jsx(ao,{track:E,participantName:`Participant ${E.participantId}`,showControls:!1,onClick:i,onPin:g},E.id))})]}):d.map(E=>h.jsx(ao,{track:E,participantName:`Participant ${E.participantId}`,isPinned:(c==null?void 0:c.id)===E.id,onClick:i,onPin:g,onUnpin:m},E.id))}),s&&f>1&&h.jsxs("div",{className:"voxket-video-pagination",children:[h.jsx("button",{className:"voxket-pagination-btn",onClick:()=>l(Math.max(0,a-1)),disabled:a===0,children:"←"}),h.jsxs("span",{className:"voxket-pagination-info",children:["Page ",a+1," of ",f]}),h.jsx("button",{className:"voxket-pagination-btn",onClick:()=>l(Math.min(f-1,a+1)),disabled:a===f-1,children:"→"})]})]})}function cI(e){switch(e){case"grid":return"⊞";case"speaker":return"🎤";case"sidebar":return"⫸";case"gallery":return"⊡";case"picture-in-picture":return"⧉";default:return"⊞"}}function uI({localTrack:e,onToggleCamera:t,onToggleScreenShare:n,onLayoutChange:r,showLayoutControls:i=!0,showCameraControls:o=!0,showScreenShareControls:s=!0,className:a=""}){const l=["voxket-video-controls",a].filter(Boolean).join(" "),c=u=>{r==null||r({type:u,showLocalVideo:!0,aspectRatio:"16:9"})};return h.jsxs("div",{className:l,children:[o&&h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Camera"}),h.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isEnabled?"voxket-control-btn--active":""}`,onClick:t,title:e!=null&&e.isEnabled?"Turn off camera":"Turn on camera",children:[h.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isEnabled?"📹":"📷"}),h.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isEnabled?"Camera On":"Camera Off"})]}),(e==null?void 0:e.dimensions)&&h.jsxs("div",{className:"voxket-video-info",children:[e.dimensions.width," × ",e.dimensions.height]})]}),s&&h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Screen Share"}),h.jsxs("button",{className:`voxket-control-btn ${e!=null&&e.isScreenShare?"voxket-control-btn--active":""}`,onClick:n,title:e!=null&&e.isScreenShare?"Stop screen sharing":"Start screen sharing",children:[h.jsx("span",{className:"voxket-control-icon",children:e!=null&&e.isScreenShare?"🛑":"🖥️"}),h.jsx("span",{className:"voxket-control-label",children:e!=null&&e.isScreenShare?"Stop Sharing":"Share Screen"})]})]}),i&&h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Layout"}),h.jsx("div",{className:"voxket-layout-buttons",children:[{type:"grid",icon:"⊞",label:"Grid"},{type:"speaker",icon:"🎤",label:"Speaker"},{type:"sidebar",icon:"⫸",label:"Sidebar"},{type:"gallery",icon:"⊡",label:"Gallery"}].map(({type:u,icon:d,label:f})=>h.jsxs("button",{className:"voxket-layout-control-btn",onClick:()=>c(u),title:`Switch to ${f} layout`,children:[h.jsx("span",{className:"voxket-control-icon",children:d}),h.jsx("span",{className:"voxket-control-label",children:f})]},u))})]}),h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Video Settings"}),h.jsxs("div",{className:"voxket-video-settings",children:[h.jsxs("div",{className:"voxket-setting-group",children:[h.jsx("label",{className:"voxket-setting-label",children:"Quality"}),h.jsxs("select",{className:"voxket-setting-select",children:[h.jsx("option",{value:"high",children:"High (720p)"}),h.jsx("option",{value:"medium",children:"Medium (480p)"}),h.jsx("option",{value:"low",children:"Low (240p)"})]})]}),h.jsxs("div",{className:"voxket-setting-group",children:[h.jsx("label",{className:"voxket-setting-label",children:"Frame Rate"}),h.jsxs("select",{className:"voxket-setting-select",children:[h.jsx("option",{value:"30",children:"30 fps"}),h.jsx("option",{value:"15",children:"15 fps"}),h.jsx("option",{value:"10",children:"10 fps"})]})]}),h.jsxs("div",{className:"voxket-setting-group",children:[h.jsx("label",{className:"voxket-setting-label",children:"Bandwidth"}),h.jsxs("select",{className:"voxket-setting-select",children:[h.jsx("option",{value:"unlimited",children:"Unlimited"}),h.jsx("option",{value:"1000",children:"1 Mbps"}),h.jsx("option",{value:"500",children:"500 Kbps"}),h.jsx("option",{value:"250",children:"250 Kbps"})]})]})]})]}),h.jsxs("div",{className:"voxket-video-controls-section",children:[h.jsx("h4",{className:"voxket-video-controls-title",children:"Statistics"}),h.jsxs("div",{className:"voxket-video-stats",children:[h.jsxs("div",{className:"voxket-stat-item",children:[h.jsx("span",{className:"voxket-stat-label",children:"Resolution:"}),h.jsx("span",{className:"voxket-stat-value",children:e!=null&&e.dimensions?`${e.dimensions.width}×${e.dimensions.height}`:"N/A"})]}),h.jsxs("div",{className:"voxket-stat-item",children:[h.jsx("span",{className:"voxket-stat-label",children:"Source:"}),h.jsx("span",{className:"voxket-stat-value",children:(e==null?void 0:e.source)||"None"})]}),h.jsxs("div",{className:"voxket-stat-item",children:[h.jsx("span",{className:"voxket-stat-label",children:"Status:"}),h.jsx("span",{className:`voxket-stat-value ${e!=null&&e.isEnabled?"voxket-stat-value--active":"voxket-stat-value--inactive"}`,children:e!=null&&e.isEnabled?"Active":"Inactive"})]})]})]})]})}const vg=({handler:e,loadData:t,data:n,client:r,addLocalMessage:i})=>{const[o,s]=D.useState(null),[a,l]=D.useState(!0),[c,u]=D.useState(!1),[d]=D.useState(Date.now());D.useEffect(()=>{(async()=>{try{if(l(!0),console.log("📋 AssignmentView: Loading assignment data..."),console.log("📋 AssignmentView: Received data from RPC:",n),n&&typeof n=="object"){const x={title:n.title||"Untitled Assignment",description:n.description||"No description provided",estimated_time_of_completion:n.estimated_time_of_completion||"Unknown"};s(x),console.log("📋 AssignmentView: Assignment loaded from RPC data:",x)}}catch(x){console.error("📋 AssignmentView: Error loading assignment:",x),s({title:"Assignment Loading Error",description:"There was an error loading the assignment details. Please try again.",estimated_time_of_completion:"Unknown"})}finally{l(!1)}})()},[n,t]);const f=({message:m,assignment:x})=>{const y=m.toLowerCase().includes("declined"),E=y?"bg-red-50 border-red-200":"bg-green-50 border-green-200",v=y?"text-red-700":"text-green-700",_=y?"❌":"🎉";return h.jsxs("div",{className:`max-w-sm mx-auto ${E} border rounded-lg shadow p-3 flex flex-col items-center`,children:[h.jsx("div",{className:"text-2xl mb-2",children:_}),h.jsx("div",{className:`${v} font-semibold text-sm mb-1`,children:m}),h.jsx("div",{className:"text-xs text-gray-600 text-center mb-1",children:x.title}),h.jsx("div",{className:"text-xs text-gray-500",children:"Thank you for your response!"})]})},p=async()=>{if(!(!o||!e)){u(!0);try{const m={message:"accepted"};console.log("📋 AssignmentView: Assignment accepted:",m),e.didSuccess(m,h.jsx(f,{message:"Assignment accepted!",assignment:o}))}catch(m){console.error("📋 AssignmentView: Error accepting assignment:",m),e.didFail({error:"Failed to accept assignment"})}finally{u(!1)}}},g=async()=>{if(!(!o||!e)){u(!0);try{const m={message:"declined"};console.log("📋 AssignmentView: Assignment declined:",m),e.didSuccess(m,h.jsx(f,{message:"Assignment declined",assignment:o}))}catch(m){console.error("📋 AssignmentView: Error declining assignment:",m),e.didFail({error:"Failed to decline assignment"})}finally{u(!1)}}};return a?h.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:h.jsxs("div",{className:"flex items-center justify-center py-4",children:[h.jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"}),h.jsx("span",{className:"ml-2 text-xs text-gray-600",children:"Loading assignment..."})]})}):o?h.jsxs("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg overflow-hidden",children:[h.jsx("div",{className:"bg-gradient-to-r from-blue-600 to-purple-600 text-white p-3",children:h.jsx("div",{className:"flex items-center justify-between",children:h.jsx("h3",{className:"text-xs font-semibold text-white truncate",children:o.title})})}),h.jsxs("div",{className:"p-3 text-black",children:[h.jsx("div",{className:"bg-gray-50 rounded p-2 mb-3",children:h.jsx("p",{className:"text-xs text-black leading-snug",children:o.description})}),h.jsx("div",{className:"mb-3 text-black",children:h.jsxs("div",{className:"flex items-center text-xs text-gray-600",children:[h.jsx("span",{className:"text-xs mr-1",children:"📅"}),h.jsxs("span",{children:["Est: ",o.estimated_time_of_completion]})]})}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:p,disabled:c,className:"flex-1 bg-green-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:c?h.jsxs("span",{className:"flex items-center justify-center",children:[h.jsx("div",{className:"animate-spin rounded-full h-2 w-2 border-b-2 border-white mr-1"}),h.jsx("span",{className:"text-xs",children:"Processing..."})]}):"Accept"}),h.jsx("button",{onClick:g,disabled:c,className:"flex-1 bg-red-600 text-white py-2 px-3 rounded text-xs font-medium hover:bg-red-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Decline"})]})]})]}):h.jsx("div",{className:"max-w-sm mx-auto bg-white rounded-lg shadow-lg p-3",children:h.jsxs("div",{className:"text-center py-4",children:[h.jsx("div",{className:"text-red-600 text-sm font-semibold mb-2",children:"⚠️ Assignment Error"}),h.jsx("p",{className:"text-xs text-gray-600 mb-3",children:"Failed to load assignment details."})]})})};function dI(){const[e,t]=D.useState(null),[n,r]=D.useState([]);D.useEffect(()=>{const a=new ki({appId:"your-app-id",appSecret:"your-app-secret",baseUrl:"https://your-voxket-api.com",agentId:"your-agent-id",participantName:"User",modalities:["chat"]});return t(a),a.on("rpc.method.called",l=>{console.log("RPC Method Called:",l)}),a.on("rpc.interaction.completed",l=>{console.log("RPC Interaction Completed:",l)}),()=>{a.disconnect()}},[]);const i=async()=>{if(e)try{await e.registerFrontendRPC("give_assignment",vg,"embedded");const a=e.getRegisteredRpcMethods();r(a),console.log("✅ Assignment RPC registered successfully")}catch(a){console.error("❌ Failed to register assignment RPC:",a)}},o=async()=>{if(!e)return;const a=({handler:l,timeout:c})=>{const[u,d]=D.useState(""),f=[{id:"pro",name:"Pro Plan",price:"$29/month"},{id:"enterprise",name:"Enterprise Plan",price:"$99/month"},{id:"basic",name:"Basic Plan",price:"$9/month"}],p=m=>{d(m)},g=()=>{const m=f.find(x=>x.id===u);l==null||l.didSuccess({selectedProduct:u,productName:m==null?void 0:m.name,price:m==null?void 0:m.price,timestamp:new Date().toISOString()})};return h.jsxs("div",{className:"p-6 bg-white rounded-lg",children:[h.jsx("h3",{className:"text-xl font-bold mb-4",children:"Choose Your Plan"}),h.jsx("p",{className:"text-gray-600 mb-4",children:"Select the plan that best fits your needs:"}),h.jsx("div",{className:"space-y-3 mb-6",children:f.map(m=>h.jsx("div",{onClick:()=>p(m.id),className:`p-4 border rounded-lg cursor-pointer transition-all ${u===m.id?"border-blue-500 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("div",{children:[h.jsx("h4",{className:"font-medium",children:m.name}),h.jsx("p",{className:"text-gray-600 text-sm",children:m.price})]}),h.jsx("div",{className:`w-4 h-4 rounded-full ${u===m.id?"bg-blue-500":"border-2 border-gray-300"}`})]})},m.id))}),h.jsxs("div",{className:"flex justify-end space-x-3",children:[h.jsx("button",{onClick:()=>l==null?void 0:l.dismissView(),className:"px-4 py-2 border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Cancel"}),h.jsx("button",{onClick:g,disabled:!u,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Select Plan"})]}),c&&h.jsxs("p",{className:"text-xs text-gray-500 mt-2",children:["Time remaining: ",c," seconds"]})]})};try{await e.registerFrontendRPC("recommend_product",a,"modal");const l=e.getRegisteredRpcMethods();r(l),console.log("✅ Product Recommendation RPC registered successfully")}catch(l){console.error("❌ Failed to register product recommendation RPC:",l)}},s=async()=>{if(!e)return;const a=({handler:l})=>{const[c,u]=D.useState(0),[d,f]=D.useState(""),p=()=>{l==null||l.didSuccess({rating:c,comment:d,timestamp:new Date().toISOString()})};return h.jsxs("div",{className:"p-4 bg-white rounded-lg",children:[h.jsx("h3",{className:"text-lg font-semibold mb-3",children:"How was your experience?"}),h.jsxs("div",{className:"mb-4",children:[h.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Rate your experience:"}),h.jsx("div",{className:"flex space-x-1",children:[1,2,3,4,5].map(g=>h.jsx("button",{onClick:()=>u(g),className:`text-2xl ${g<=c?"text-yellow-400":"text-gray-300"}`,children:"⭐"},g))})]}),h.jsxs("div",{className:"mb-4",children:[h.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Additional comments:"}),h.jsx("textarea",{value:d,onChange:g=>f(g.target.value),className:"w-full p-2 border border-gray-300 rounded text-sm",rows:3,placeholder:"Tell us more about your experience..."})]}),h.jsxs("div",{className:"flex justify-end space-x-2",children:[h.jsx("button",{onClick:()=>l==null?void 0:l.dismissView(),className:"px-3 py-1 text-sm border border-gray-300 text-gray-700 rounded hover:bg-gray-50",children:"Skip"}),h.jsx("button",{onClick:p,disabled:c===0,className:"px-3 py-1 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50",children:"Submit"})]})]})};try{await e.registerFrontendRPC("collect_feedback",a,"embedded");const l=e.getRegisteredRpcMethods();r(l),console.log("✅ Feedback RPC registered successfully")}catch(l){console.error("❌ Failed to register feedback RPC:",l)}};return h.jsxs("div",{className:"p-6",children:[h.jsx("h2",{className:"text-2xl font-bold mb-6",children:"Frontend RPC Examples"}),h.jsxs("div",{className:"space-y-4 mb-6",children:[h.jsxs("div",{children:[h.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Register RPC Methods"}),h.jsxs("div",{className:"space-x-2",children:[h.jsx("button",{onClick:i,className:"px-4 py-2 bg-blue-500 text-white rounded hover:bg-blue-600",children:"Register Assignment RPC"}),h.jsx("button",{onClick:o,className:"px-4 py-2 bg-green-500 text-white rounded hover:bg-green-600",children:"Register Product Recommendation RPC"}),h.jsx("button",{onClick:s,className:"px-4 py-2 bg-purple-500 text-white rounded hover:bg-purple-600",children:"Register Feedback RPC"})]})]}),h.jsxs("div",{children:[h.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Registered Methods"}),n.length>0?h.jsx("ul",{className:"list-disc list-inside space-y-1",children:n.map(a=>h.jsx("li",{className:"text-gray-700",children:h.jsx("code",{className:"bg-gray-100 px-2 py-1 rounded",children:a})},a))}):h.jsx("p",{className:"text-gray-500",children:"No methods registered yet"})]})]}),h.jsxs("div",{className:"bg-gray-50 p-4 rounded-lg",children:[h.jsx("h3",{className:"text-lg font-semibold mb-2",children:"How it works"}),h.jsxs("ol",{className:"list-decimal list-inside space-y-2 text-sm text-gray-700",children:[h.jsxs("li",{children:["Register RPC methods with React components using ",h.jsx("code",{children:"client.registerFrontendRPC()"})]}),h.jsx("li",{children:"When the agent calls an RPC method, the corresponding component will be displayed"}),h.jsx("li",{children:"Users interact with the component, and the response is sent back to the agent"}),h.jsx("li",{children:"Components can be displayed in different modes: embedded, modal, or fullscreen"}),h.jsx("li",{children:"Each component has a timeout and can handle success/failure scenarios"})]})]}),h.jsxs("div",{className:"mt-6 bg-blue-50 p-4 rounded-lg",children:[h.jsx("h3",{className:"text-lg font-semibold mb-2 text-blue-800",children:"Agent Side"}),h.jsx("p",{className:"text-sm text-blue-700 mb-2",children:"On the agent side, you can call these RPC methods like this:"}),h.jsx("pre",{className:"bg-white p-3 rounded text-xs text-gray-800 overflow-x-auto",children:`// Agent calls RPC method
160
140
  const response = await participant.performRpc({
161
141
  method: 'give_assignment',
162
142
  data: JSON.stringify({