@realtimex/realtimex-alchemy 1.0.38 → 1.0.40

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/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.40] - 2026-01-24
9
+
10
+ ### Improved
11
+ - **UI**: Standardized the styling of disabled input fields in Account Settings (Email field) to match the new `bg-black/5` convention, ensuring consistent visual language and readability across the app.
12
+
13
+ ## [1.0.39] - 2026-01-24
14
+
15
+ ### Fixed
16
+ - **UI**: Fixed visibility issues with search inputs and dropdowns in the System Logs "Found Signals" view. Inputs now use a distinct background (`bg-black/5`) and explicit text color to ensure readability in all themes, especially Light Mode.
17
+
8
18
  ## [1.0.38] - 2026-01-24
9
19
 
10
20
  ### Added
@@ -0,0 +1 @@
1
+ *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Outfit,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}body{background-color:var(--bg);color:var(--fg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Outfit,system-ui,sans-serif}::-moz-selection{background-color:var(--selection-bg)}::selection{background-color:var(--selection-bg)}.glass{background-color:var(--glass-bg);border-radius:1rem;border-width:1px;border-color:var(--border);--tw-backdrop-blur: blur(24px);-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)}.glow-primary{box-shadow:0 0 20px var(--glow-color)}.custom-scrollbar::-webkit-scrollbar{width:6px}.custom-scrollbar::-webkit-scrollbar-track{background-color:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--border)}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#f7f8ff33}input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus,input:-webkit-autofill:active{-webkit-box-shadow:0 0 0 1000px var(--surface) inset!important;-webkit-text-fill-color:var(--fg)!important;caret-color:var(--fg)!important}.scrollbar-on-hover::-webkit-scrollbar{width:6px;height:6px}.scrollbar-on-hover::-webkit-scrollbar-track{background-color:transparent}.scrollbar-on-hover::-webkit-scrollbar-thumb{background-color:transparent;-webkit-transition:background-color .2s;transition:background-color .2s}.scrollbar-on-hover:hover::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--border)}.scrollbar-on-hover:hover::-webkit-scrollbar-thumb:hover{background-color:#f7f8ff33}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.-right-1{right:-.25rem}.-top-1{top:-.25rem}.bottom-32{bottom:8rem}.bottom-6{bottom:1.5rem}.left-3{left:.75rem}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-6{right:1.5rem}.top-0{top:0}.top-1\/2{top:50%}.top-12{top:3rem}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.z-0{z-index:0}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.col-span-2{grid-column:span 2 / span 2}.m-4{margin:1rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-0{margin-right:0}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-\[85vh\]{height:85vh}.h-full{height:100%}.h-screen{height:100vh}.max-h-96{max-height:24rem}.max-h-\[200px\]{max-height:200px}.max-h-\[600px\]{max-height:600px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(80vh-88px\)\]{max-height:calc(80vh - 88px)}.min-h-\[24px\]{min-height:24px}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-\[120px\]{width:120px}.w-\[450px\]{width:450px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[20px\]{min-width:20px}.min-w-\[300px\]{min-width:300px}.min-w-\[40px\]{min-width:40px}.min-w-max{min-width:-moz-max-content;min-width:max-content}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[240px\]{max-width:240px}.max-w-\[85\%\]{max-width:85%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-\[2\]{flex:2}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-1\/2{--tw-translate-x: 50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-tl-none{border-top-left-radius:0}.rounded-tr-none{border-top-right-radius:0}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-amber-500\/10{border-color:#f59e0b1a}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-400\/30{border-color:#60a5fa4d}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-border{border-color:var(--border)}.border-cyan-500\/30{border-color:#06b6d44d}.border-emerald-500\/20{border-color:#10b98133}.border-gray-400\/30{border-color:#9ca3af4d}.border-gray-500\/30{border-color:#6b72804d}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-orange-500\/20{border-color:#f9731633}.border-orange-500\/30{border-color:#f973164d}.border-primary{border-color:var(--primary)}.border-purple-500\/30{border-color:#a855f74d}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-teal-500\/30{border-color:#14b8a64d}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/30{border-color:#ffffff4d}.border-white\/5{border-color:#ffffff0d}.border-yellow-400\/30{border-color:#facc154d}.border-yellow-500\/20{border-color:#eab30833}.border-yellow-500\/30{border-color:#eab3084d}.border-t-primary{border-top-color:var(--primary)}.border-t-transparent{border-top-color:transparent}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.bg-accent{background-color:var(--accent)}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-bg{background-color:var(--bg)}.bg-black\/20{background-color:#0003}.bg-black\/40{background-color:#0006}.bg-black\/5{background-color:#0000000d}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-blue-400\/20{background-color:#60a5fa33}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-cyan-500\/20{background-color:#06b6d433}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-gray-400\/20{background-color:#9ca3af33}.bg-gray-500\/20{background-color:#6b728033}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-orange-400{--tw-bg-opacity: 1;background-color:rgb(251 146 60 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/20{background-color:#f9731633}.bg-primary{background-color:var(--primary)}.bg-purple-500\/20{background-color:#a855f733}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-success{background-color:var(--success)}.bg-surface{background-color:var(--surface)}.bg-teal-500\/20{background-color:#14b8a633}.bg-transparent{background-color:transparent}.bg-white\/5{background-color:#ffffff0d}.bg-yellow-400\/20{background-color:#facc1533}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-bg{--tw-gradient-from: var(--bg) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary{--tw-gradient-from: var(--primary) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-accent{--tw-gradient-to: var(--accent) var(--tw-gradient-to-position)}.to-purple-600{--tw-gradient-to: #9333ea var(--tw-gradient-to-position)}.to-red-500{--tw-gradient-to: #ef4444 var(--tw-gradient-to-position)}.to-red-600{--tw-gradient-to: #dc2626 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-12{padding-bottom:3rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-9{padding-left:2.25rem}.pr-10{padding-right:2.5rem}.pr-4{padding-right:1rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.italic{font-style:italic}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-\[0\.4em\]{letter-spacing:.4em}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent{color:var(--accent)}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-error{color:var(--error)}.text-fg{color:var(--fg)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-primary{color:var(--primary)}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-success{color:var(--success)}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.accent-primary{accent-color:var(--primary)}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_rgba\(239\,68\,68\,0\.1\)\]{--tw-shadow: 0 0 15px rgba(239,68,68,.1);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_20px_rgba\(234\,179\,8\,0\.1\)\]{--tw-shadow: 0 0 20px rgba(234,179,8,.1);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-md{--tw-blur: blur(12px);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)}.blur-xl{--tw-blur: blur(24px);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)}.grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}:root{--bg: oklch(15% .02 280);--fg: oklch(98% .01 280);--primary: oklch(65% .25 280);--accent: oklch(85% .2 90);--surface: oklch(20% .02 280);--border: oklch(35% .03 280 / .6);--success: oklch(75% .15 150);--error: oklch(65% .2 25);--glass-bg: oklch(25% .03 280 / .4);--glow-color: oklch(65% .25 280 / .3);--selection-bg: oklch(65% .25 280 / .3);--border-hover: oklch(50% .15 280 / .8)}:root[data-theme=light]{--bg: oklch(96% .005 280);--fg: oklch(15% .02 280);--primary: oklch(50% .25 280);--accent: oklch(60% .2 50);--surface: oklch(100% 0 0);--border: oklch(75% .02 280 / .8);--success: oklch(45% .15 150);--error: oklch(50% .2 25);--glass-bg: oklch(100% 0 0 / .7);--glow-color: oklch(50% .25 280 / .2);--selection-bg: oklch(50% .25 280 / .25);--border-hover: oklch(60% .15 280 / .9)}@keyframes pulse-gold{0%{box-shadow:0 0 #fac70066;box-shadow:0 0 oklch(85% .2 90 / .4)}70%{box-shadow:0 0 0 10px #fac70000;box-shadow:0 0 0 10px oklch(85% .2 90 / 0)}to{box-shadow:0 0 #fac70000;box-shadow:0 0 oklch(85% .2 90 / 0)}}.animate-pulse-gold{animation:pulse-gold 2s infinite}h1,h2,h3,h4{letter-spacing:-.025em}.font-mono{font-family:JetBrains Mono,monospace}.before\:mr-2:before{content:var(--tw-content);margin-right:.5rem}.before\:text-primary:before{content:var(--tw-content);color:var(--primary)}.before\:content-\[\'•\'\]:before{--tw-content: "•";content:var(--tw-content)}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.autofill\:bg-surface:-webkit-autofill{background-color:var(--surface)}.autofill\:bg-surface:autofill{background-color:var(--surface)}.autofill\:text-fg:-webkit-autofill{color:var(--fg)}.autofill\:text-fg:autofill{color:var(--fg)}.focus-within\:ring-2:focus-within{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:z-10:hover{z-index:10}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.01\]:hover{--tw-scale-x: 1.01;--tw-scale-y: 1.01;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[var\(--border-hover\)\]:hover{border-color:var(--border-hover)}.hover\:bg-black\/10:hover{background-color:#0000001a}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-error:hover{background-color:var(--error)}.hover\:bg-orange-500:hover{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-surface:hover{background-color:var(--surface)}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-yellow-500\/20:hover{background-color:#eab30833}.hover\:text-accent:hover{color:var(--accent)}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-error:hover{color:var(--error)}.hover\:text-fg:hover{color:var(--fg)}.hover\:text-primary:hover{color:var(--primary)}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:text-yellow-500:hover{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:border-\[var\(--border-hover\)\]:focus{border-color:var(--border-hover)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-green-500\/30:focus{--tw-ring-color: rgb(34 197 94 / .3)}.focus\:ring-red-500\/30:focus{--tw-ring-color: rgb(239 68 68 / .3)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:grayscale:disabled{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:hover\:scale-100:hover:disabled{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:block{display:block}.group\/btn:hover .group-hover\/btn\:translate-x-0\.5{--tw-translate-x: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:text-accent{color:var(--accent)}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-primary{color:var(--primary)}.group:hover .group-hover\:opacity-100{opacity:1}@media(min-width:640px){.sm\:h-12{height:3rem}.sm\:w-12{width:3rem}}@media(min-width:768px){.md\:w-2\/3{width:66.666667%}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(min-width:1024px){.lg\:w-1\/2{width:50%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}
@@ -74,7 +74,7 @@ localhost:
74
74
  facebook.com
75
75
  twitter.com
76
76
  instagram.com
77
- linkedin.com/feed`,className:"w-full h-40 px-4 py-3 rounded-xl border border-border bg-surface text-fg text-sm placeholder:text-fg/40 focus:outline-none focus:border-[var(--border-hover)] transition-all resize-none"}),h.jsx("p",{className:"text-xs text-fg/50 ml-1",children:"Examples: google.com/search, localhost:, facebook.com, twitter.com"})]}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:Be,disabled:ie,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[ie?h.jsx($n,{size:18,className:"animate-spin"}):h.jsx(ms,{size:18}),"Save Blacklist"]})})]})]})})]})]})})]})}const rb=P.createContext(null);function EP({children:e}){const[t,n]=P.useState(!1),r=()=>n(!0),o=()=>n(!1);return h.jsx(rb.Provider,{value:{isExpanded:t,setIsExpanded:n,openTerminal:r,closeTerminal:o},children:e})}function jP(){const e=P.useContext(rb);if(!e)throw new Error("useTerminal must be used within a TerminalProvider");return e}function TP({isExpanded:e,onToggle:t,onNavigate:n,liftUp:r}={}){const[o,a]=P.useState([]),{isExpanded:l,setIsExpanded:c}=jP(),[d,p]=P.useState({}),m=e!==void 0?e:l,y=t||(()=>c(!l)),x=r?"bottom-32":"bottom-6";P.useEffect(()=>{w();const k=ce.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},_=>{const j=_.new;j.event_type==="error"&&p(C=>({...C,[j.id]:!0})),a(C=>{const L=[j,...C];return L.length>50?L.slice(0,50):L})}).subscribe();return()=>{ce.removeChannel(k)}},[]);const w=async()=>{const{data:k}=await ce.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);k&&a(k)},b=k=>{p(_=>({..._,[k]:!_[k]}))},E=(k,_,j,C)=>{if(_==="debug")return h.jsx(nS,{size:14,className:"text-fg/40"});if(j?.is_completion||C?.is_completion)return h.jsx(vs,{size:14,className:"text-success"});switch(k){case"analysis":return h.jsx(Rx,{size:14,className:"text-primary"});case"action":return h.jsx(Bn,{size:14,className:"text-accent"});case"error":return h.jsx(zg,{size:14,className:"text-error"});case"system":return h.jsx(Yl,{size:14,className:"text-success"});default:return h.jsx(Ix,{size:14,className:"text-fg/40"})}};return m?h.jsxs($e.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},className:"fixed bottom-6 right-6 z-50 w-[450px] max-h-[600px] glass shadow-2xl flex flex-col overflow-hidden border-primary/10",children:[h.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Jd,{size:18,className:"text-primary"}),h.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:"Alchemist Engine"}),h.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold bg-success/10 text-success px-2 py-0.5 rounded-full border border-success/10 animate-pulse ml-2",children:[h.jsx(Yk,{size:10})," LIVE"]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>a([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:"Clear"}),h.jsx("button",{onClick:y,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:h.jsx(kS,{size:18})})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[o.length===0&&h.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:"Idle. Awaiting signal mining events..."}),o.map(k=>h.jsxs("div",{className:"relative flex items-start gap-3 group",children:[h.jsx("div",{className:`mt-1 flex-shrink-0 w-6 h-6 rounded-full bg-surface border flex items-center justify-center ${k.metadata?.is_completion||k.details?.is_completion?"border-success/50 bg-success/5":"border-white/5"}`,children:E(k.event_type,k.level,k.metadata,k.details)}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(k.created_at||Date.now()).toLocaleTimeString()}),h.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${k.level==="error"?"text-error":k.level==="warn"?"text-orange-400":k.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:k.agent_state}),k.metadata?.actionable&&n&&h.jsxs("button",{onClick:()=>n("logs",k.metadata?.actionable),className:"ml-auto flex items-center gap-1 bg-primary/10 text-primary border border-primary/20 px-1.5 py-0.5 rounded text-[10px] uppercase font-bold tracking-wider hover:bg-primary/20 transition-all font-mono",children:[k.metadata.actionable.label,h.jsx(mi,{size:10,className:"-rotate-90"})]}),k.duration_ms&&!k.metadata?.actionable&&h.jsxs("span",{className:"ml-auto text-[10px] font-mono bg-bg/50 px-1.5 py-0.5 rounded flex items-center gap-1 text-fg/40",children:[h.jsx(gi,{size:10}),k.duration_ms,"ms"]})]}),k.metadata?.is_completion||k.details?.is_completion?h.jsxs("div",{className:"bg-success/5 border border-success/20 rounded-lg p-3 space-y-2 mt-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-success font-bold uppercase text-[9px] tracking-[0.2em]",children:[h.jsx(vs,{className:"w-3.5 h-3.5"}),"Mining Run Completed"]}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 pt-1",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:"Signals"}),h.jsx("p",{className:"text-sm font-bold text-primary",children:k.metadata?.signals_found||k.details?.signals_found||0})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:"URLs"}),h.jsx("p",{className:"text-sm font-bold",children:k.metadata?.total_urls||k.details?.total_urls||0})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:"Skipped"}),h.jsx("p",{className:"text-sm font-bold text-fg/60",children:k.metadata?.skipped||k.details?.skipped||0})]})]}),(k.metadata?.errors||k.details?.errors)>0&&h.jsxs("div",{className:"pt-1 border-t border-success/10 flex items-center justify-between mt-1",children:[h.jsxs("p",{className:"text-[10px] text-error font-bold flex items-center gap-1.5",children:[h.jsx(zg,{size:12}),k.metadata?.errors||k.details?.errors," URLs failed to process"]}),n&&h.jsxs("button",{onClick:()=>n("logs",{filter:"errors"}),className:"flex items-center gap-1 text-[9px] uppercase font-bold text-error bg-error/10 border border-error/20 px-2 py-1 rounded hover:bg-error/20 transition-all group/btn",children:["View Logs",h.jsx(jl,{size:10,className:"group-hover/btn:translate-x-0.5 transition-transform"})]})]})]}):h.jsx("p",{className:`text-sm break-words leading-relaxed ${k.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:k.message}),(k.details||k.metadata)&&h.jsxs("div",{className:"mt-2 text-xs",children:[h.jsxs("button",{onClick:()=>b(k.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[d[k.id]?h.jsx(Ox,{size:12}):h.jsx(mi,{size:12}),d[k.id]?"Hide Details":"View Details"]}),h.jsx(Zt,{children:d[k.id]&&h.jsx($e.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:h.jsx("pre",{className:"mt-2 p-3 bg-bg/50 rounded border border-white/5 font-mono text-[10px] overflow-x-auto text-fg/70",children:JSON.stringify({...k.details,...k.metadata},null,2)})})})]})]})]},k.id))]})]}):h.jsxs("button",{onClick:y,className:`fixed ${x} right-6 z-50 glass p-4 flex items-center gap-3 hover:bg-surface transition-all shadow-xl group border-primary/10`,children:[h.jsxs("div",{className:"relative",children:[h.jsx(Jd,{size:20,className:"text-primary"}),o.length>0&&h.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[h.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),h.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),h.jsx("span",{className:"text-xs font-bold uppercase tracking-widest hidden group-hover:block animate-in fade-in slide-in-from-right-2",children:"Live Engine Log"})]})}const sb="1.0.0",CP="20260125000004";async function NP(e){try{const{data:t,error:n}=await e.rpc("get_latest_migration_timestamp");return n?n.code==="42883"?{version:null,latestMigrationTimestamp:"0"}:{version:null,latestMigrationTimestamp:null}:{version:sb,latestMigrationTimestamp:t||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function AP(e){const t=sb,n=CP,r=await NP(e);if(r.latestMigrationTimestamp&&r.latestMigrationTimestamp.trim()!==""){const o=n,a=r.latestMigrationTimestamp;return o>a?{needsMigration:!0,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:a,message:`New migrations available. Database is at ${a}, app has ${o}.`}:{needsMigration:!1,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:a,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:t,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function PP(){const[e,t]=P.useState("profile"),[n,r]=P.useState(!1);return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsxs("header",{className:"px-8 py-6 border-b border-border",children:[h.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Account Configuration"}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Manage your Alchemist profile and essence links."})]}),h.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[h.jsxs("aside",{className:"w-64 border-r border-border p-4 space-y-1",children:[h.jsx(Rd,{active:e==="profile",onClick:()=>t("profile"),icon:h.jsx(Xl,{size:18}),label:"Profile"}),h.jsx(Rd,{active:e==="security",onClick:()=>t("security"),icon:h.jsx(Lx,{size:18}),label:"Security"}),h.jsx(Rd,{active:e==="supabase",onClick:()=>t("supabase"),icon:h.jsx(Do,{size:18}),label:"Supabase"})]}),h.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[e==="profile"&&h.jsx(RP,{}),e==="security"&&h.jsx(OP,{}),e==="supabase"&&h.jsx(IP,{})]})]})]})}function RP(){const[e,t]=P.useState(""),[n,r]=P.useState(""),[o,a]=P.useState(""),[l,c]=P.useState(!1),[d,p]=P.useState(!1),[m,y]=P.useState(null),[x,w]=P.useState(!0);P.useEffect(()=>{b()},[]);const b=async()=>{const{data:{user:_}}=await ce.auth.getUser();if(!_)return;a(_.email||"");const{data:j}=await ce.from("profiles").select("*").eq("id",_.id).maybeSingle();j&&(t(j.first_name||""),r(j.last_name||""),y(j.avatar_url));const{data:C}=await ce.from("alchemy_settings").select("sound_enabled").eq("user_id",_.id).maybeSingle();C&&w(C.sound_enabled??!0)},E=async()=>{c(!0);const{data:{user:_}}=await ce.auth.getUser();_&&(await ce.from("profiles").upsert({id:_.id,first_name:e,last_name:n,full_name:e&&n?`${e} ${n}`:e||n||null}),await ce.from("alchemy_settings").update({sound_enabled:x}).eq("user_id",_.id),c(!1))},k=async _=>{const j=_.target.files?.[0];if(j){p(!0);try{const{data:{user:C}}=await ce.auth.getUser();if(!C)return;const L=j.name.split(".").pop(),U=`${C.id}/avatar-${Date.now()}.${L}`,{error:O}=await ce.storage.from("avatars").upload(U,j,{upsert:!0});if(O)throw O;const{data:{publicUrl:q}}=ce.storage.from("avatars").getPublicUrl(U);await ce.from("profiles").update({avatar_url:q}).eq("id",C.id),y(q)}catch(C){console.error("Avatar upload failed:",C)}finally{p(!1)}}};return h.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"flex items-start gap-8",children:[h.jsxs("div",{className:"relative group",children:[h.jsx("div",{className:"w-32 h-32 rounded-3xl bg-surface border border-border flex items-center justify-center overflow-hidden shadow-xl",children:m?h.jsx("img",{src:m,alt:"Avatar",className:"w-full h-full object-cover"}):h.jsx(Xl,{size:48,className:"text-fg/20"})}),h.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer rounded-3xl",children:[h.jsx(sS,{size:24,className:"text-white"}),h.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:k,disabled:d})]}),d&&h.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:h.jsx($n,{size:24,className:"text-primary animate-spin"})})]}),h.jsxs("div",{className:"flex-1 space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsx(Wl,{label:"First Name",value:e,onChange:t,placeholder:"Zosimos"}),h.jsx(Wl,{label:"Last Name",value:n,onChange:r,placeholder:"of Panopolis"})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address (Locked)"}),h.jsx("input",{type:"email",value:o,readOnly:!0,className:"w-full bg-surface/50 border border-border rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),h.jsxs("section",{className:"glass p-6 space-y-4",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[x?h.jsx(qg,{size:20,className:"text-primary"}):h.jsx(Hg,{size:20,className:"text-fg/40"}),"Sound Effects"]}),h.jsx("p",{className:"text-xs text-fg/40",children:"Enable audio feedback for sync events and signal discoveries."}),h.jsx("button",{onClick:()=>w(!x),className:`w-full p-4 rounded-xl border-2 transition-all ${x?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border text-fg/40"}`,children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-semibold text-sm",children:x?"Enabled":"Disabled"}),x?h.jsx(qg,{size:18}):h.jsx(Hg,{size:18})]})})]}),h.jsxs("section",{className:"glass p-6 space-y-4",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(Bg,{size:20,className:"text-error"}),"Sign Out"]}),h.jsx("p",{className:"text-xs text-fg/40",children:"End your current session and return to the login screen."}),h.jsx("button",{onClick:()=>ce.auth.signOut(),className:"w-full p-4 rounded-xl border-2 bg-error/10 border-error/30 text-error hover:bg-error hover:text-white transition-all",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-semibold text-sm",children:"Logout"}),h.jsx(Bg,{size:18})]})})]}),h.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:h.jsxs("button",{onClick:E,disabled:l,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[l?h.jsx($n,{size:18,className:"animate-spin"}):h.jsx(ms,{size:18}),"Preserve Profile"]})})]})}function OP(){const[e,t]=P.useState(""),[n,r]=P.useState(""),[o,a]=P.useState(!1),[l,c]=P.useState(null),[d,p]=P.useState(!1),m=async()=>{if(!e||e!==n){c("Complexity keys do not match.");return}if(e.length<8){c("Entropy too low. Minimum 8 characters.");return}a(!0),c(null),p(!1);const{error:y}=await ce.auth.updateUser({password:e});y?c(y.message):(p(!0),t(""),r("")),a(!1)};return h.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:h.jsxs("div",{className:"glass p-6 space-y-6",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(gS,{size:20,className:"text-error"})," Update Entropy Key"]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx(Wl,{label:"New Password",type:"password",value:e,onChange:t,placeholder:"••••••••"}),h.jsx(Wl,{label:"Confirm Password",type:"password",value:n,onChange:r,placeholder:"••••••••"})]}),l&&h.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:l}),d&&h.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:"Key rotation successful."}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:m,disabled:o,className:"px-6 py-3 bg-error/10 text-error hover:bg-error hover:text-white font-bold rounded-xl border border-error/20 transition-all flex items-center gap-2",children:[o?h.jsx($n,{size:18,className:"animate-spin"}):h.jsx(Lx,{size:18}),"Rotate Key"]})})]})})}function IP(){const[e,t]=P.useState(!1),[n,r]=P.useState(null),o=Nf(),a=pP();P.useEffect(()=>{o&&AP(ce).then(r)},[]);const l=()=>{confirm("Sever connection to this essence? This will reset local resonance.")&&(hP(),window.location.reload())};return h.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"space-y-6",children:[h.jsx("div",{className:"flex items-center justify-between",children:h.jsxs("div",{children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(Do,{size:20,className:"text-primary"})," Essence Resonance"]}),h.jsx("p",{className:"text-xs text-fg/40 font-medium",children:"Bring Your Own Keys (BYOK) for intelligence persistence."})]})}),h.jsx("div",{className:"glass p-8 space-y-8",children:o?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[h.jsx(vs,{className:"w-6 h-6 text-emerald-500 mt-1"}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:"Established Link"}),n?.latestMigrationTimestamp&&h.jsxs("span",{className:"text-[10px] font-mono bg-emerald-500/10 text-emerald-500 px-2 py-0.5 rounded-full border border-emerald-500/20",children:["v",n.latestMigrationTimestamp]})]}),h.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:o.url})]})]}),a==="env"&&h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[h.jsx(Br,{size:16,className:"text-amber-500"}),h.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:"Active from environment variables. UI override enabled."})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("button",{onClick:()=>t(!0),className:"px-4 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[h.jsx(Yl,{size:14})," Realign Link"]}),a==="ui"&&h.jsxs("button",{onClick:l,className:"px-4 py-3 glass border-error/10 hover:bg-error/10 text-error/60 hover:text-error text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[h.jsx(Mx,{size:14})," Sever Link"]})]}),h.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[h.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:"Anon Secret Fragment"}),h.jsxs("div",{className:"p-3 bg-surface/50 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-border",children:[o.anonKey.substring(0,32),"..."]})]})]}):h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[h.jsx(Do,{size:48,className:"text-fg/10"}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:"No Essence Resonance"}),h.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:"The Alchemist requires a cloud core to store intelligence fragments."})]}),h.jsx("button",{onClick:()=>t(!0),className:"px-8 py-3 bg-primary text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] transition-all uppercase tracking-widest text-xs",children:"Initiate Link"})]})})]}),h.jsx(eb,{open:e,onComplete:()=>t(!1),canClose:!0})]})}function Rd({active:e,icon:t,label:n,onClick:r}){return h.jsxs("button",{onClick:r,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${e?"glass bg-primary/10 text-primary border-primary/20 shadow-sm":"text-fg/40 hover:bg-surface hover:text-fg"}`,children:[e?Oo.cloneElement(t,{className:"text-primary"}):t,h.jsx("span",{className:"font-semibold text-sm",children:n})]})}function Wl({label:e,value:t,onChange:n,placeholder:r,type:o="text"}){return h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e}),h.jsx("input",{type:o,value:t,onChange:a=>n(a.target.value),className:"w-full bg-surface border border-border rounded-xl py-3 px-4 text-sm text-fg placeholder:text-fg/40 focus:border-[var(--border-hover)] outline-none transition-all",placeholder:r})]})}function DP({signal:e,onClose:t}){const[n,r]=Oo.useState(!1);if(!e)return null;const o=()=>{const c=`# ${e.title}
77
+ linkedin.com/feed`,className:"w-full h-40 px-4 py-3 rounded-xl border border-border bg-surface text-fg text-sm placeholder:text-fg/40 focus:outline-none focus:border-[var(--border-hover)] transition-all resize-none"}),h.jsx("p",{className:"text-xs text-fg/50 ml-1",children:"Examples: google.com/search, localhost:, facebook.com, twitter.com"})]}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:Be,disabled:ie,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[ie?h.jsx($n,{size:18,className:"animate-spin"}):h.jsx(ms,{size:18}),"Save Blacklist"]})})]})]})})]})]})})]})}const rb=P.createContext(null);function EP({children:e}){const[t,n]=P.useState(!1),r=()=>n(!0),o=()=>n(!1);return h.jsx(rb.Provider,{value:{isExpanded:t,setIsExpanded:n,openTerminal:r,closeTerminal:o},children:e})}function jP(){const e=P.useContext(rb);if(!e)throw new Error("useTerminal must be used within a TerminalProvider");return e}function TP({isExpanded:e,onToggle:t,onNavigate:n,liftUp:r}={}){const[o,a]=P.useState([]),{isExpanded:l,setIsExpanded:c}=jP(),[d,p]=P.useState({}),m=e!==void 0?e:l,y=t||(()=>c(!l)),x=r?"bottom-32":"bottom-6";P.useEffect(()=>{w();const k=ce.channel("processing_events_feed").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events"},_=>{const j=_.new;j.event_type==="error"&&p(C=>({...C,[j.id]:!0})),a(C=>{const L=[j,...C];return L.length>50?L.slice(0,50):L})}).subscribe();return()=>{ce.removeChannel(k)}},[]);const w=async()=>{const{data:k}=await ce.from("processing_events").select("*").order("created_at",{ascending:!1}).limit(30);k&&a(k)},b=k=>{p(_=>({..._,[k]:!_[k]}))},E=(k,_,j,C)=>{if(_==="debug")return h.jsx(nS,{size:14,className:"text-fg/40"});if(j?.is_completion||C?.is_completion)return h.jsx(vs,{size:14,className:"text-success"});switch(k){case"analysis":return h.jsx(Rx,{size:14,className:"text-primary"});case"action":return h.jsx(Bn,{size:14,className:"text-accent"});case"error":return h.jsx(zg,{size:14,className:"text-error"});case"system":return h.jsx(Yl,{size:14,className:"text-success"});default:return h.jsx(Ix,{size:14,className:"text-fg/40"})}};return m?h.jsxs($e.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},className:"fixed bottom-6 right-6 z-50 w-[450px] max-h-[600px] glass shadow-2xl flex flex-col overflow-hidden border-primary/10",children:[h.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/50",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Jd,{size:18,className:"text-primary"}),h.jsx("span",{className:"text-xs font-bold uppercase tracking-widest",children:"Alchemist Engine"}),h.jsxs("div",{className:"flex items-center gap-1.5 text-[9px] font-bold bg-success/10 text-success px-2 py-0.5 rounded-full border border-success/10 animate-pulse ml-2",children:[h.jsx(Yk,{size:10})," LIVE"]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("button",{onClick:()=>a([]),className:"text-[10px] uppercase font-bold text-fg/40 hover:text-fg px-2 py-1 transition-colors",children:"Clear"}),h.jsx("button",{onClick:y,className:"text-fg/40 hover:text-fg p-1 transition-colors",children:h.jsx(kS,{size:18})})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 custom-scrollbar bg-black/20",children:[o.length===0&&h.jsx("div",{className:"text-center py-12 text-fg/20 italic text-xs",children:"Idle. Awaiting signal mining events..."}),o.map(k=>h.jsxs("div",{className:"relative flex items-start gap-3 group",children:[h.jsx("div",{className:`mt-1 flex-shrink-0 w-6 h-6 rounded-full bg-surface border flex items-center justify-center ${k.metadata?.is_completion||k.details?.is_completion?"border-success/50 bg-success/5":"border-white/5"}`,children:E(k.event_type,k.level,k.metadata,k.details)}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx("span",{className:"text-xs font-mono text-fg/60 shrink-0",children:new Date(k.created_at||Date.now()).toLocaleTimeString()}),h.jsx("span",{className:`text-xs font-bold uppercase tracking-wider ${k.level==="error"?"text-error":k.level==="warn"?"text-orange-400":k.event_type==="analysis"?"text-primary":"text-fg/90"}`,children:k.agent_state}),k.metadata?.actionable&&n&&h.jsxs("button",{onClick:()=>n("logs",k.metadata?.actionable),className:"ml-auto flex items-center gap-1 bg-primary/10 text-primary border border-primary/20 px-1.5 py-0.5 rounded text-[10px] uppercase font-bold tracking-wider hover:bg-primary/20 transition-all font-mono",children:[k.metadata.actionable.label,h.jsx(mi,{size:10,className:"-rotate-90"})]}),k.duration_ms&&!k.metadata?.actionable&&h.jsxs("span",{className:"ml-auto text-[10px] font-mono bg-bg/50 px-1.5 py-0.5 rounded flex items-center gap-1 text-fg/40",children:[h.jsx(gi,{size:10}),k.duration_ms,"ms"]})]}),k.metadata?.is_completion||k.details?.is_completion?h.jsxs("div",{className:"bg-success/5 border border-success/20 rounded-lg p-3 space-y-2 mt-2",children:[h.jsxs("div",{className:"flex items-center gap-2 text-success font-bold uppercase text-[9px] tracking-[0.2em]",children:[h.jsx(vs,{className:"w-3.5 h-3.5"}),"Mining Run Completed"]}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 pt-1",children:[h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:"Signals"}),h.jsx("p",{className:"text-sm font-bold text-primary",children:k.metadata?.signals_found||k.details?.signals_found||0})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:"URLs"}),h.jsx("p",{className:"text-sm font-bold",children:k.metadata?.total_urls||k.details?.total_urls||0})]}),h.jsxs("div",{className:"space-y-0.5",children:[h.jsx("p",{className:"text-[10px] text-fg/40 uppercase",children:"Skipped"}),h.jsx("p",{className:"text-sm font-bold text-fg/60",children:k.metadata?.skipped||k.details?.skipped||0})]})]}),(k.metadata?.errors||k.details?.errors)>0&&h.jsxs("div",{className:"pt-1 border-t border-success/10 flex items-center justify-between mt-1",children:[h.jsxs("p",{className:"text-[10px] text-error font-bold flex items-center gap-1.5",children:[h.jsx(zg,{size:12}),k.metadata?.errors||k.details?.errors," URLs failed to process"]}),n&&h.jsxs("button",{onClick:()=>n("logs",{filter:"errors"}),className:"flex items-center gap-1 text-[9px] uppercase font-bold text-error bg-error/10 border border-error/20 px-2 py-1 rounded hover:bg-error/20 transition-all group/btn",children:["View Logs",h.jsx(jl,{size:10,className:"group-hover/btn:translate-x-0.5 transition-transform"})]})]})]}):h.jsx("p",{className:`text-sm break-words leading-relaxed ${k.level==="debug"?"text-fg/50 font-mono text-xs":""}`,children:k.message}),(k.details||k.metadata)&&h.jsxs("div",{className:"mt-2 text-xs",children:[h.jsxs("button",{onClick:()=>b(k.id),className:"flex items-center gap-1 text-fg/40 hover:text-primary transition-colors",children:[d[k.id]?h.jsx(Ox,{size:12}):h.jsx(mi,{size:12}),d[k.id]?"Hide Details":"View Details"]}),h.jsx(Zt,{children:d[k.id]&&h.jsx($e.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden",children:h.jsx("pre",{className:"mt-2 p-3 bg-bg/50 rounded border border-white/5 font-mono text-[10px] overflow-x-auto text-fg/70",children:JSON.stringify({...k.details,...k.metadata},null,2)})})})]})]})]},k.id))]})]}):h.jsxs("button",{onClick:y,className:`fixed ${x} right-6 z-50 glass p-4 flex items-center gap-3 hover:bg-surface transition-all shadow-xl group border-primary/10`,children:[h.jsxs("div",{className:"relative",children:[h.jsx(Jd,{size:20,className:"text-primary"}),o.length>0&&h.jsxs("span",{className:"absolute -top-1 -right-1 flex h-2 w-2",children:[h.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-primary opacity-75"}),h.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-primary"})]})]}),h.jsx("span",{className:"text-xs font-bold uppercase tracking-widest hidden group-hover:block animate-in fade-in slide-in-from-right-2",children:"Live Engine Log"})]})}const sb="1.0.0",CP="20260125000004";async function NP(e){try{const{data:t,error:n}=await e.rpc("get_latest_migration_timestamp");return n?n.code==="42883"?{version:null,latestMigrationTimestamp:"0"}:{version:null,latestMigrationTimestamp:null}:{version:sb,latestMigrationTimestamp:t||null}}catch{return{version:null,latestMigrationTimestamp:null}}}async function AP(e){const t=sb,n=CP,r=await NP(e);if(r.latestMigrationTimestamp&&r.latestMigrationTimestamp.trim()!==""){const o=n,a=r.latestMigrationTimestamp;return o>a?{needsMigration:!0,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:a,message:`New migrations available. Database is at ${a}, app has ${o}.`}:{needsMigration:!1,appVersion:t,dbVersion:r.version,latestMigrationTimestamp:a,message:"Database schema is up-to-date."}}return{needsMigration:!0,appVersion:t,dbVersion:null,latestMigrationTimestamp:null,message:"Database schema unknown. Migration required."}}function PP(){const[e,t]=P.useState("profile"),[n,r]=P.useState(!1);return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsxs("header",{className:"px-8 py-6 border-b border-border",children:[h.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Account Configuration"}),h.jsx("p",{className:"text-sm text-fg/50 font-medium",children:"Manage your Alchemist profile and essence links."})]}),h.jsxs("div",{className:"flex-1 flex overflow-hidden",children:[h.jsxs("aside",{className:"w-64 border-r border-border p-4 space-y-1",children:[h.jsx(Rd,{active:e==="profile",onClick:()=>t("profile"),icon:h.jsx(Xl,{size:18}),label:"Profile"}),h.jsx(Rd,{active:e==="security",onClick:()=>t("security"),icon:h.jsx(Lx,{size:18}),label:"Security"}),h.jsx(Rd,{active:e==="supabase",onClick:()=>t("supabase"),icon:h.jsx(Do,{size:18}),label:"Supabase"})]}),h.jsxs("main",{className:"flex-1 overflow-y-auto custom-scrollbar p-8",children:[e==="profile"&&h.jsx(RP,{}),e==="security"&&h.jsx(OP,{}),e==="supabase"&&h.jsx(IP,{})]})]})]})}function RP(){const[e,t]=P.useState(""),[n,r]=P.useState(""),[o,a]=P.useState(""),[l,c]=P.useState(!1),[d,p]=P.useState(!1),[m,y]=P.useState(null),[x,w]=P.useState(!0);P.useEffect(()=>{b()},[]);const b=async()=>{const{data:{user:_}}=await ce.auth.getUser();if(!_)return;a(_.email||"");const{data:j}=await ce.from("profiles").select("*").eq("id",_.id).maybeSingle();j&&(t(j.first_name||""),r(j.last_name||""),y(j.avatar_url));const{data:C}=await ce.from("alchemy_settings").select("sound_enabled").eq("user_id",_.id).maybeSingle();C&&w(C.sound_enabled??!0)},E=async()=>{c(!0);const{data:{user:_}}=await ce.auth.getUser();_&&(await ce.from("profiles").upsert({id:_.id,first_name:e,last_name:n,full_name:e&&n?`${e} ${n}`:e||n||null}),await ce.from("alchemy_settings").update({sound_enabled:x}).eq("user_id",_.id),c(!1))},k=async _=>{const j=_.target.files?.[0];if(j){p(!0);try{const{data:{user:C}}=await ce.auth.getUser();if(!C)return;const L=j.name.split(".").pop(),U=`${C.id}/avatar-${Date.now()}.${L}`,{error:O}=await ce.storage.from("avatars").upload(U,j,{upsert:!0});if(O)throw O;const{data:{publicUrl:q}}=ce.storage.from("avatars").getPublicUrl(U);await ce.from("profiles").update({avatar_url:q}).eq("id",C.id),y(q)}catch(C){console.error("Avatar upload failed:",C)}finally{p(!1)}}};return h.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"flex items-start gap-8",children:[h.jsxs("div",{className:"relative group",children:[h.jsx("div",{className:"w-32 h-32 rounded-3xl bg-surface border border-border flex items-center justify-center overflow-hidden shadow-xl",children:m?h.jsx("img",{src:m,alt:"Avatar",className:"w-full h-full object-cover"}):h.jsx(Xl,{size:48,className:"text-fg/20"})}),h.jsxs("label",{className:"absolute inset-0 flex items-center justify-center bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer rounded-3xl",children:[h.jsx(sS,{size:24,className:"text-white"}),h.jsx("input",{type:"file",className:"hidden",accept:"image/*",onChange:k,disabled:d})]}),d&&h.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 rounded-3xl",children:h.jsx($n,{size:24,className:"text-primary animate-spin"})})]}),h.jsxs("div",{className:"flex-1 space-y-4",children:[h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsx(Wl,{label:"First Name",value:e,onChange:t,placeholder:"Zosimos"}),h.jsx(Wl,{label:"Last Name",value:n,onChange:r,placeholder:"of Panopolis"})]}),h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:"Email Address (Locked)"}),h.jsx("input",{type:"email",value:o,readOnly:!0,className:"w-full bg-black/5 border border-border rounded-xl py-3 px-4 text-sm text-fg/40 cursor-not-allowed"})]})]})]}),h.jsxs("section",{className:"glass p-6 space-y-4",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[x?h.jsx(qg,{size:20,className:"text-primary"}):h.jsx(Hg,{size:20,className:"text-fg/40"}),"Sound Effects"]}),h.jsx("p",{className:"text-xs text-fg/40",children:"Enable audio feedback for sync events and signal discoveries."}),h.jsx("button",{onClick:()=>w(!x),className:`w-full p-4 rounded-xl border-2 transition-all ${x?"bg-primary/10 border-primary/30 text-primary":"bg-surface border-border text-fg/40"}`,children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-semibold text-sm",children:x?"Enabled":"Disabled"}),x?h.jsx(qg,{size:18}):h.jsx(Hg,{size:18})]})})]}),h.jsxs("section",{className:"glass p-6 space-y-4",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(Bg,{size:20,className:"text-error"}),"Sign Out"]}),h.jsx("p",{className:"text-xs text-fg/40",children:"End your current session and return to the login screen."}),h.jsx("button",{onClick:()=>ce.auth.signOut(),className:"w-full p-4 rounded-xl border-2 bg-error/10 border-error/30 text-error hover:bg-error hover:text-white transition-all",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-semibold text-sm",children:"Logout"}),h.jsx(Bg,{size:18})]})})]}),h.jsx("div",{className:"flex justify-end pt-4 border-t border-border",children:h.jsxs("button",{onClick:E,disabled:l,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] active:scale-95 transition-all flex items-center gap-2",children:[l?h.jsx($n,{size:18,className:"animate-spin"}):h.jsx(ms,{size:18}),"Preserve Profile"]})})]})}function OP(){const[e,t]=P.useState(""),[n,r]=P.useState(""),[o,a]=P.useState(!1),[l,c]=P.useState(null),[d,p]=P.useState(!1),m=async()=>{if(!e||e!==n){c("Complexity keys do not match.");return}if(e.length<8){c("Entropy too low. Minimum 8 characters.");return}a(!0),c(null),p(!1);const{error:y}=await ce.auth.updateUser({password:e});y?c(y.message):(p(!0),t(""),r("")),a(!1)};return h.jsx("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:h.jsxs("div",{className:"glass p-6 space-y-6",children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(gS,{size:20,className:"text-error"})," Update Entropy Key"]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx(Wl,{label:"New Password",type:"password",value:e,onChange:t,placeholder:"••••••••"}),h.jsx(Wl,{label:"Confirm Password",type:"password",value:n,onChange:r,placeholder:"••••••••"})]}),l&&h.jsx("p",{className:"text-xs text-error font-mono bg-error/5 p-3 rounded-lg border border-error/10",children:l}),d&&h.jsx("p",{className:"text-xs text-success font-mono bg-success/5 p-3 rounded-lg border border-success/10",children:"Key rotation successful."}),h.jsx("div",{className:"flex justify-end pt-2",children:h.jsxs("button",{onClick:m,disabled:o,className:"px-6 py-3 bg-error/10 text-error hover:bg-error hover:text-white font-bold rounded-xl border border-error/20 transition-all flex items-center gap-2",children:[o?h.jsx($n,{size:18,className:"animate-spin"}):h.jsx(Lx,{size:18}),"Rotate Key"]})})]})})}function IP(){const[e,t]=P.useState(!1),[n,r]=P.useState(null),o=Nf(),a=pP();P.useEffect(()=>{o&&AP(ce).then(r)},[]);const l=()=>{confirm("Sever connection to this essence? This will reset local resonance.")&&(hP(),window.location.reload())};return h.jsxs("div",{className:"max-w-2xl space-y-8 animate-in fade-in slide-in-from-bottom-2 duration-500",children:[h.jsxs("section",{className:"space-y-6",children:[h.jsx("div",{className:"flex items-center justify-between",children:h.jsxs("div",{children:[h.jsxs("h3",{className:"text-lg font-bold flex items-center gap-2",children:[h.jsx(Do,{size:20,className:"text-primary"})," Essence Resonance"]}),h.jsx("p",{className:"text-xs text-fg/40 font-medium",children:"Bring Your Own Keys (BYOK) for intelligence persistence."})]})}),h.jsx("div",{className:"glass p-8 space-y-8",children:o?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-start gap-4 p-4 glass bg-emerald-500/5 border border-emerald-500/20 rounded-2xl",children:[h.jsx(vs,{className:"w-6 h-6 text-emerald-500 mt-1"}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("p",{className:"font-bold text-fg italic uppercase tracking-tighter",children:"Established Link"}),n?.latestMigrationTimestamp&&h.jsxs("span",{className:"text-[10px] font-mono bg-emerald-500/10 text-emerald-500 px-2 py-0.5 rounded-full border border-emerald-500/20",children:["v",n.latestMigrationTimestamp]})]}),h.jsx("p",{className:"text-xs font-mono text-fg/40 break-all",children:o.url})]})]}),a==="env"&&h.jsxs("div",{className:"flex items-center gap-3 p-3 bg-amber-500/5 border border-amber-500/10 rounded-xl",children:[h.jsx(Br,{size:16,className:"text-amber-500"}),h.jsx("p",{className:"text-[10px] text-amber-500 font-bold uppercase tracking-widest leading-none",children:"Active from environment variables. UI override enabled."})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("button",{onClick:()=>t(!0),className:"px-4 py-3 glass hover:bg-surface text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[h.jsx(Yl,{size:14})," Realign Link"]}),a==="ui"&&h.jsxs("button",{onClick:l,className:"px-4 py-3 glass border-error/10 hover:bg-error/10 text-error/60 hover:text-error text-xs font-bold uppercase tracking-widest transition-all flex items-center justify-center gap-2",children:[h.jsx(Mx,{size:14})," Sever Link"]})]}),h.jsxs("div",{className:"space-y-1 pt-4 border-t border-border/10",children:[h.jsx("label",{className:"text-[9px] font-bold uppercase tracking-widest text-fg/20 ml-1",children:"Anon Secret Fragment"}),h.jsxs("div",{className:"p-3 bg-surface/50 rounded-xl font-mono text-[11px] text-fg/30 break-all border border-border",children:[o.anonKey.substring(0,32),"..."]})]})]}):h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center space-y-6",children:[h.jsx(Do,{size:48,className:"text-fg/10"}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("p",{className:"font-bold italic uppercase tracking-tighter",children:"No Essence Resonance"}),h.jsx("p",{className:"text-xs text-fg/40 max-w-[240px]",children:"The Alchemist requires a cloud core to store intelligence fragments."})]}),h.jsx("button",{onClick:()=>t(!0),className:"px-8 py-3 bg-primary text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-[1.02] transition-all uppercase tracking-widest text-xs",children:"Initiate Link"})]})})]}),h.jsx(eb,{open:e,onComplete:()=>t(!1),canClose:!0})]})}function Rd({active:e,icon:t,label:n,onClick:r}){return h.jsxs("button",{onClick:r,className:`w-full flex items-center gap-3 px-4 py-3 rounded-xl transition-all ${e?"glass bg-primary/10 text-primary border-primary/20 shadow-sm":"text-fg/40 hover:bg-surface hover:text-fg"}`,children:[e?Oo.cloneElement(t,{className:"text-primary"}):t,h.jsx("span",{className:"font-semibold text-sm",children:n})]})}function Wl({label:e,value:t,onChange:n,placeholder:r,type:o="text"}){return h.jsxs("div",{className:"space-y-1",children:[h.jsx("label",{className:"text-[10px] font-bold uppercase text-fg/30 ml-1",children:e}),h.jsx("input",{type:o,value:t,onChange:a=>n(a.target.value),className:"w-full bg-surface border border-border rounded-xl py-3 px-4 text-sm text-fg placeholder:text-fg/40 focus:border-[var(--border-hover)] outline-none transition-all",placeholder:r})]})}function DP({signal:e,onClose:t}){const[n,r]=Oo.useState(!1);if(!e)return null;const o=()=>{const c=`# ${e.title}
78
78
 
79
79
  **Category**: ${e.category||"Research"}
80
80
  **Intelligence Score**: ${e.score}/100
@@ -106,7 +106,7 @@ ${e.entities.map(y=>`- ${y}`).join(`
106
106
  `:""}
107
107
  ${e.content?`
108
108
  ## Full Content
109
- ${e.content}`:""}`,d=new Blob([c],{type:"text/markdown"}),p=URL.createObjectURL(d),m=document.createElement("a");m.href=p,m.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,m.click(),URL.revokeObjectURL(p)},l=()=>{const c=JSON.stringify(e,null,2),d=new Blob([c],{type:"application/json"}),p=URL.createObjectURL(d),m=document.createElement("a");m.href=p,m.download=`signal_${e.id}.json`,m.click(),URL.revokeObjectURL(p)};return h.jsx(Zt,{children:h.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-bg/80 backdrop-blur-sm",onClick:t,children:h.jsxs($e.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:c=>c.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[h.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[h.jsx("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold rounded border border-primary/20 uppercase tracking-wider",children:e.category||"Research"}),h.jsx("span",{className:`text-3xl font-black ${e.score>=80?"text-accent":"text-fg/40"}`,children:e.score})]}),h.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:e.title}),h.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(e.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:h.jsx(tr,{size:24})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[e.url&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),h.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 glass hover:bg-surface transition-all rounded-xl text-sm font-mono text-primary hover:text-accent group",children:[h.jsx(bi,{size:16,className:"flex-shrink-0"}),h.jsx("span",{className:"truncate",children:e.url}),h.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),e.entities&&e.entities.length>0&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),h.jsx("div",{className:"flex flex-wrap gap-2",children:e.entities.map(c=>h.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:c},c))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),h.jsx("div",{className:"p-4 glass rounded-xl",children:h.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:e.summary})})]}),e.content&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),h.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:h.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:e.content})})]})]}),h.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[h.jsxs("button",{onClick:o,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[n?h.jsx(Io,{size:16,className:"text-success"}):h.jsx(uS,{size:16}),n?"Copied!":"Copy"]}),h.jsxs("button",{onClick:a,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[h.jsx(Ug,{size:16}),"Markdown"]}),h.jsxs("button",{onClick:l,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[h.jsx(Ug,{size:16}),"JSON"]})]})]})})})}function LP({isOpen:e,onClose:t}){const{showToast:n}=nb(),[r,o]=P.useState(""),[a,l]=P.useState(50),[c,d]=P.useState(!1),[p,m]=P.useState(!1);P.useEffect(()=>{e&&y()},[e]);const y=async()=>{const{data:{user:b}}=await ce.auth.getUser();if(!b)return;const{data:E}=await ce.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(E){l(E.max_urls_per_sync||50);const k=E.sync_start_date||E.last_sync_checkpoint;if(k){const _=new Date(k),j=L=>L<10?"0"+L:L,C=_.getFullYear()+"-"+j(_.getMonth()+1)+"-"+j(_.getDate())+"T"+j(_.getHours())+":"+j(_.getMinutes());o(C)}else o("")}},x=async()=>{d(!0);try{const{data:{user:b}}=await ce.auth.getUser();if(!b){n("Please log in to save settings","error"),d(!1);return}const{error:E}=await ce.from("alchemy_settings").update({max_urls_per_sync:a,sync_start_date:r?new Date(r).toISOString():null}).eq("user_id",b.id);E?n(`Failed to save: ${E.message}`,"error"):(n("Sync settings saved successfully","success"),t())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{d(!1)}},w=async()=>{m(!0);try{const{data:{user:b}}=await ce.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),m(!1);return}const{error:E}=await ce.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",b.id);E?n(`Failed to reset: ${E.message}`,"error"):n("Checkpoint reset successfully","success")}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{m(!1)}};return e?h.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:h.jsxs("div",{className:"bg-surface border border-border/20 rounded-2xl shadow-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[h.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:h.jsx(tr,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"p-6 space-y-6",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[h.jsx(rS,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),h.jsx("input",{type:"datetime-local",value:r,onChange:b=>o(b.target.value),className:"w-full bg-black/20 border border-border/10 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all"}),h.jsx("p",{className:"text-xs text-fg/50",children:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward."})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[h.jsx(fS,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),h.jsx("span",{className:"text-sm font-mono text-primary",children:a})]}),h.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:a,onChange:b=>l(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),h.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[h.jsx("span",{children:"Quick (5)"}),h.jsx("span",{children:"Balanced (50)"}),h.jsx("span",{children:"Thorough (200)"})]})]}),h.jsxs("div",{className:"pt-4 border-t border-border/10",children:[h.jsxs("button",{onClick:w,disabled:p,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[h.jsx(_S,{size:16,className:p?"animate-spin":""}),p?"Resetting...":"Reset Checkpoint"]}),h.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date'})]}),h.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:h.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.'})})]}),h.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[h.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 bg-surface hover:bg-black/10 border border-border/10 rounded-xl font-medium transition-all",children:"Cancel"}),h.jsxs("button",{onClick:x,disabled:c,className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[h.jsx(ms,{size:18,className:c?"animate-spin":""}),c?"Saving...":"Save Settings"]})]})]})}):null}const Ko=[{id:"ai",name:"AI & ML",icon:Rx,color:"blue",priority:1},{id:"business",name:"Business",icon:tS,color:"purple",priority:1},{id:"politics",name:"Politics",icon:yS,color:"red",priority:1},{id:"technology",name:"Technology",icon:zh,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:cS,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:Zk,color:"orange",priority:1},{id:"science",name:"Science",icon:bS,color:"teal",priority:1}],Pf={id:"other",name:"Other",icon:Gd,color:"gray",priority:3},MP=[...Ko,Pf];function zP(e){const t={blue:"bg-blue-500/20 text-blue-400 border-blue-500/30",purple:"bg-purple-500/20 text-purple-400 border-purple-500/30",red:"bg-red-500/20 text-red-400 border-red-500/30",cyan:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",green:"bg-green-500/20 text-green-400 border-green-500/30",orange:"bg-orange-500/20 text-orange-400 border-orange-500/30",teal:"bg-teal-500/20 text-teal-400 border-teal-500/30",gray:"bg-gray-500/20 text-gray-400 border-gray-500/30"};return t[e]||t.gray}function ib(e,t){if(t){const n=Ko.find(r=>r.id===t.toLowerCase());if(n)return n.id}for(const n of e){const r=n.toLowerCase(),o=Ko.find(a=>r.includes(a.id)||r.includes(a.name.toLowerCase()));if(o)return o.id}return null}function UP({count:e}){return e<=1?null:h.jsxs("div",{className:"absolute top-3 right-3 px-3 py-1.5 bg-gradient-to-r from-orange-500 to-red-500 rounded-full shadow-lg flex items-center gap-1.5 z-10",title:`Found in ${e} different sources`,children:[h.jsx("span",{className:"text-lg",children:"🔥"}),h.jsxs("span",{className:"text-white font-bold text-sm",children:[e," ",e===1?"source":"sources"]})]})}function FP({urls:e,timestamps:t=[]}){const[n,r]=P.useState(!1);return e.length<=1?null:h.jsxs("div",{className:"mt-4 border-t border-border pt-4",children:[h.jsxs("button",{onClick:()=>r(!n),className:"flex items-center justify-between w-full text-sm text-fg/60 hover:text-fg transition-colors",children:[h.jsxs("span",{className:"font-medium",children:["View all sources (",e.length,")"]}),h.jsx(mi,{size:16,className:`transition-transform duration-200 ${n?"rotate-180":""}`})]}),n&&h.jsx("div",{className:"mt-3 space-y-2 animate-in fade-in slide-in-from-top-2 duration-200",children:e.map((o,a)=>h.jsxs("div",{className:"flex items-start gap-2 text-xs p-2 rounded-lg hover:bg-surface/50 transition-colors",children:[h.jsx(bi,{size:12,className:"text-primary mt-0.5 flex-shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-fg/70 hover:text-primary underline truncate block",children:o}),t[a]&&h.jsx("span",{className:"text-fg/40 text-[10px]",children:new Date(t[a]).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})]},a))})]})}function ob({signal:e,onOpen:t,onFavourite:n,onNote:r,onBoost:o,onDismiss:a}){const[l,c]=P.useState(!1),d=x=>x>=80?"text-yellow-400 border-yellow-400/30":x>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",p=x=>x>=80?"HIGH":x>=50?"MEDIUM":"LOW",m=(x,w)=>{const b=ib(w||[],x);if(b){const E=Ko.find(k=>k.id===b);if(E)return E}return Pf},y=x=>{const w=new Date(x),E=new Date().getTime()-w.getTime(),k=Math.floor(E/6e4),_=Math.floor(E/36e5),j=Math.floor(E/864e5);return k<60?`${k}m ago`:_<24?`${_}h ago`:j<7?`${j}d ago`:w.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return h.jsxs($e.div,{whileHover:{scale:1.01,translateY:-2},onHoverStart:()=>c(!0),onHoverEnd:()=>c(!1),className:`relative bg-surface/50 backdrop-blur-sm border rounded-xl p-5 flex flex-col gap-4 transition-all duration-300 ${e.is_favorite?"border-yellow-500/30 shadow-[0_0_20px_rgba(234,179,8,0.1)]":e.is_dismissed?"opacity-50 grayscale":"border-border"}`,children:[h.jsx(UP,{count:e.mention_count||1}),h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs("div",{className:`flex flex-col items-center justify-center w-14 h-14 rounded-2xl border ${d(e.score)} bg-surface`,children:[h.jsx("span",{className:"text-xl font-bold",children:e.score}),h.jsx("span",{className:"text-[9px] font-bold tracking-wider opacity-70",children:p(e.score)})]}),h.jsxs("div",{children:[(()=>{const x=m(e.category,e.tags),w=x.icon;return h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsxs("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold uppercase tracking-wider rounded border border-primary/20 flex items-center gap-1.5 w-fit",children:[h.jsx(w,{size:10}),x.name]}),e.is_boosted&&h.jsxs("span",{className:"px-2 py-0.5 bg-accent/10 text-accent text-[10px] font-bold uppercase tracking-wider rounded border border-accent/20 flex items-center gap-1 w-fit",children:[h.jsx(Vg,{size:10}),"Boosted"]}),e.is_dismissed&&h.jsxs("span",{className:"px-2 py-0.5 bg-red-500/10 text-red-400 text-[10px] font-bold uppercase tracking-wider rounded border border-red-500/20 flex items-center gap-1 w-fit",children:[h.jsx(Fg,{size:10}),"Dismissed"]})]})})(),h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-fg/40 font-mono",children:[h.jsx(gi,{size:10}),y(e.created_at),(e.mention_count||1)>1&&h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"•"}),h.jsxs("span",{children:[e.mention_count," sources"]})]})]})]})]}),n&&h.jsx("button",{onClick:()=>n(e.id,!!e.is_favorite),className:`p-2 rounded-lg transition-all ${e.is_favorite?"bg-yellow-500/10 text-yellow-500 hover:bg-yellow-500/20":"bg-white/5 text-fg/40 hover:bg-white/10 hover:text-yellow-500"}`,title:e.is_favorite?"Remove from favourites":"Add to favourites",children:h.jsx(NS,{size:18,fill:e.is_favorite?"currentColor":"none"})})]}),h.jsxs("div",{className:"flex-1",children:[h.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-base font-bold text-fg/90 hover:text-primary transition-colors line-clamp-2 mb-2 leading-tight block",onClick:x=>{x.preventDefault(),t?.(e.url)},children:e.title}),h.jsx("p",{className:"text-xs text-fg/60 line-clamp-3 leading-relaxed",children:e.summary}),e.user_notes&&h.jsxs("div",{className:"mt-3 p-3 bg-yellow-500/5 border border-yellow-500/20 rounded-lg flex gap-2",children:[h.jsx(Wd,{size:14,className:"text-yellow-500 shrink-0 mt-0.5"}),h.jsxs("p",{className:"text-xs text-fg/80 italic font-medium line-clamp-2",children:['"',e.user_notes,'"']})]})]}),e.entities&&e.entities.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.entities.slice(0,4).map((x,w)=>h.jsx("span",{className:"px-2 py-0.5 bg-white/5 text-fg/50 text-[10px] rounded border border-white/5",children:x},w)),e.entities.length>4&&h.jsxs("span",{className:"px-2 py-0.5 text-fg/30 text-[10px]",children:["+",e.entities.length-4]})]}),h.jsx(FP,{urls:e.metadata?.source_urls||[],timestamps:e.metadata?.timestamps||[]}),h.jsxs("div",{className:"grid grid-cols-5 gap-2 pt-2 border-t border-border/40",children:[h.jsxs("button",{onClick:()=>t?.(e.url),className:"flex items-center justify-center gap-1.5 px-3 py-2 bg-white/5 hover:bg-white/10 rounded-lg transition-colors text-xs font-semibold text-fg/70",title:"Open Source",children:[h.jsx(bi,{size:14}),"Open"]}),r&&h.jsxs("button",{onClick:()=>r(e.id,e.user_notes||null,e.title),className:`flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.user_notes?"bg-blue-500/10 text-blue-400 hover:bg-blue-500/20":"bg-white/5 text-fg/70 hover:bg-white/10 hover:text-blue-400"}`,title:"Add/Edit Note",children:[h.jsx(Wd,{size:14}),"Note"]}),o&&h.jsxs("button",{onClick:()=>o(e.id,!!e.is_boosted),className:`col-span-2 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.is_boosted?"bg-accent/20 text-accent hover:bg-accent/30 shadow-sm border border-accent/20":"bg-white/5 text-fg/70 hover:bg-accent/10 hover:text-accent group"}`,title:"Boost this topic for future discovery",children:[h.jsx(Vg,{size:14,className:e.is_boosted?"fill-current":"group-hover:text-accent"}),e.is_boosted?"Boosted":"Boost Topic"]}),a&&h.jsx("button",{onClick:()=>a(e.id,!!e.is_dismissed),className:`flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.is_dismissed?"bg-red-500/10 text-red-400 hover:bg-red-500/20":"bg-white/5 text-fg/70 hover:bg-white/10 hover:text-red-400"}`,title:"Dismiss (Not Interested)",children:h.jsx(Fg,{size:14})})]})]})}function ab({isOpen:e,onClose:t,initialNote:n,title:r,onSave:o}){const[a,l]=P.useState(n||""),[c,d]=P.useState(!1);P.useEffect(()=>{l(n||"")},[n,e]);const p=async()=>{d(!0);try{await o(a),t()}catch(m){console.error("Failed to save note:",m)}finally{d(!1)}};return h.jsx(Zt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60]"}),h.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none",children:h.jsxs($e.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-lg overflow-hidden pointer-events-auto",children:[h.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("h3",{className:"font-bold flex items-center gap-2",children:[h.jsx(Wd,{size:18,className:"text-primary"}),"Add Note"]}),h.jsx("button",{onClick:t,className:"p-1 hover:bg-surface rounded text-fg/40 hover:text-fg transition-colors",children:h.jsx(tr,{size:18})})]}),h.jsxs("div",{className:"p-4 space-y-3",children:[h.jsxs("p",{className:"text-xs text-fg/50 line-clamp-1 font-mono",children:["Target: ",r]}),h.jsx("textarea",{value:a,onChange:m=>l(m.target.value),placeholder:"Enter your thoughts, ideas, or action items regarding this signal...",className:"w-full h-40 bg-surface/50 border border-border/20 rounded-lg p-3 text-sm focus:border-primary/50 focus:ring-1 focus:ring-primary/20 outline-none resize-none placeholder:text-fg/20",autoFocus:!0})]}),h.jsxs("div",{className:"p-4 border-t border-border bg-surface/10 flex justify-end gap-2",children:[h.jsx("button",{onClick:t,className:"px-4 py-2 hover:bg-surface rounded-lg text-xs font-bold text-fg/60 transition-colors",disabled:c,children:"Cancel"}),h.jsx("button",{onClick:p,disabled:c,className:"px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg text-xs font-bold flex items-center gap-2 transition-colors disabled:opacity-50",children:c?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Saving..."]}):h.jsxs(h.Fragment,{children:[h.jsx(ms,{size:14}),"Save Note"]})})]})]})})]})})}function $P({initialState:e}){const[t,n]=P.useState([]),[r,o]=P.useState(!0),[a,l]=P.useState(null),[c,d]=P.useState(null),[p,m]=P.useState([]),[y,x]=P.useState([]),[w,b]=P.useState([]),[E,k]=P.useState(!1),[_,j]=P.useState(!1),[C,L]=P.useState(!1),[U,O]=P.useState(!1),[q,V]=P.useState(null),[X,ge]=P.useState(0),[ie,oe]=P.useState(""),[Se,re]=P.useState(null),[Q,we]=P.useState("all"),[me,K]=P.useState(!1),[ae,T]=P.useState([]),[I,H]=P.useState([]),[N,ne]=P.useState([]),[ye,ue]=P.useState({errors:0,signals:0});P.useEffect(()=>{Be()},[]),P.useEffect(()=>{U&&Ne(X)},[U,X,Se,Q]),P.useEffect(()=>{const se=setTimeout(()=>{U&&Ne(0)},500);return()=>clearTimeout(se)},[ie]),P.useEffect(()=>{e&&(e.type==="blacklist_suggestion"&&(T(e.data?.suggestions||[]),j(!0)),e.filter==="errors"&&(L(!0),he()))},[e]),P.useEffect(()=>{if(t.length>0){const se=t.reduce((Le,B)=>Le+B.errors,0),Ee=t.reduce((Le,B)=>Le+B.signals_found,0);ue({errors:se,signals:Ee})}},[t]);const he=async()=>{const{data:{user:se}}=await ce.auth.getUser();if(!se)return;const{data:Ee,error:Le}=await ce.from("processing_events").select("*").eq("user_id",se.id).eq("event_type","error").order("created_at",{ascending:!1}).limit(50);!Le&&Ee&&H(Ee)},Ne=async(se=0)=>{K(!0);const{data:{user:Ee}}=await ce.auth.getUser();if(!Ee)return;const Le=20,B=se*Le,le=B+Le-1;let pe=ce.from("signals").select("*").eq("user_id",Ee.id).order("created_at",{ascending:!1}).range(B,le);Se&&(pe=pe.eq("category",Se)),Q==="high"?pe=pe.gte("score",80):Q==="medium"?pe=pe.gte("score",50).lt("score",80):Q==="low"&&(pe=pe.lt("score",50)),ie&&(pe=pe.or(`title.ilike.%${ie}%,url.ilike.%${ie}%`));const{data:Ye,error:tt}=await pe;!tt&&Ye&&ne(Ye),K(!1)},Be=async()=>{o(!0);try{const{data:{user:se}}=await ce.auth.getUser();if(!se)return;const{data:Ee,error:Le}=await ce.from("processing_events").select("*").eq("user_id",se.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(Le){console.error("Error fetching sync runs:",Le);return}const B=(Ee||[]).map(le=>{const pe=le.metadata||{},Ye=pe.errors||0,tt=pe.signals_found||0,xn=pe.skipped||0;return{id:le.id,started_at:le.created_at,completed_at:le.created_at,duration_ms:le.duration_ms||0,signals_found:tt,urls_processed:pe.total_urls||0,skipped:xn,errors:Ye,status:Ye>0?"partial":tt>0?"success":"failed"}});n(B)}catch(se){console.error("Failed to fetch sync runs:",se)}finally{o(!1)}},We=async se=>{k(!0);try{const{data:{user:Ee}}=await ce.auth.getUser();if(!Ee)return;const Le=t.find(Y=>Y.id===se);if(!Le)return;const B=new Date(new Date(Le.started_at).getTime()-Le.duration_ms),le=new Date(Le.completed_at),{data:pe,error:Ye}=await ce.from("processing_events").select("*").eq("user_id",Ee.id).gte("created_at",B.toISOString()).lte("created_at",le.toISOString()).order("created_at",{ascending:!0});if(Ye){console.error("Error fetching run events:",Ye);return}m(pe||[]);const tt=[],xn=(pe||[]).filter(Y=>Y.agent_state==="Mining"&&Y.message.includes("Mining source:"));for(const Y of xn){const je=Y.message.match(/Mining source: (.+) \((.+)\)/);if(je){const De=je[1],Me=je[2],nt=(pe||[]).find(Dt=>Dt.agent_state==="Mining"&&Dt.message.includes("Found")&&Dt.message.includes(De)&&Dt.created_at>Y.created_at),Ct=nt?.message.match(/Found (\d+) URLs/),_t=Ct?parseInt(Ct[1]):0;tt.push({label:De,browser:Me,urls_found:_t,duration_ms:nt?.duration_ms||0,status:Y.event_type==="error"?"error":"success"})}}x(tt);const sr=[],W=(pe||[]).filter(Y=>Y.agent_state==="Reading");for(const Y of W){const je=Y.message.match(/Reading content from: (.+)/);if(!je)continue;const De=je[1];let Me=tt.length>0?tt[0].label:"Unknown";const nt=tt.filter(Je=>Je.urls_found>0);(nt.length===1||nt.length>1)&&(Me=nt[0].label),console.log(`[SystemLogs] URL ${De} assigned to source: ${Me}`);const Ct=(pe||[]).find(Je=>Je.agent_state==="Signal"&&Je.created_at>Y.created_at&&Je.message.includes("Found signal")),_t=(pe||[]).find(Je=>Je.agent_state==="Skipped"&&Je.created_at>Y.created_at&&Je.message.includes("Irrelevant content")),Dt=(pe||[]).find(Je=>Je.event_type==="error"&&Je.created_at>Y.created_at);if(Ct){const Je=Ct.message.match(/\((\d+)%\)/),pt=Je?parseInt(Je[1]):0;sr.push({url:De,result:"signal",score:pt,category:Ct.details?.category||"Unknown",duration_ms:Ct.duration_ms,source_label:Me})}else if(_t){const Je=_t.message.match(/\((\d+)%\): (.+)/),pt=Je?parseInt(Je[1]):0,vn=Je?Je[2]:"Irrelevant";sr.push({url:De,result:"skipped",score:pt,reason:vn,duration_ms:_t.duration_ms,source_label:Me})}else Dt&&sr.push({url:De,result:"error",reason:Dt.message,source_label:Me})}b(sr)}catch(Ee){console.error("Failed to fetch run details:",Ee)}finally{k(!1)}},It=se=>{a===se?(l(null),d(null),x([]),b([])):(l(se),d(null),We(se))},rr=se=>{d(c===se?null:se)},yn=se=>{if(se<1e3)return`${se}ms`;const Ee=Math.floor(se/1e3);if(Ee<60)return`${Ee}s`;const Le=Math.floor(Ee/60),B=Ee%60;return`${Le}m ${B}s`},qn=se=>{switch(se){case"success":return h.jsx(vs,{className:"w-5 h-5 text-success"});case"failed":return h.jsx(os,{className:"w-5 h-5 text-error"});case"partial":return h.jsx(Br,{className:"w-5 h-5 text-warning"});default:return h.jsx(gi,{className:"w-5 h-5 text-fg/40"})}},Nn=se=>{switch(se){case"signal":return h.jsx(Bn,{className:"w-4 h-4 text-primary"});case"skipped":return h.jsx(TS,{className:"w-4 h-4 text-fg/40"});case"error":return h.jsx(os,{className:"w-4 h-4 text-error"});default:return null}};return r?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[h.jsxs("div",{className:"mb-6",children:[h.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),h.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6",children:[h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group relative overflow-hidden",onClick:()=>j(!0),children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:"Potential Blacklist"}),h.jsx(Br,{size:16,className:"text-orange-400"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:ae.length>0?ae.length:"--"}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:"Candidates for blocking"}),ae.length>0&&h.jsxs("div",{className:"absolute top-2 right-2 flex h-2 w-2",children:[h.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-orange-400 opacity-75"}),h.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-orange-400"})]})]}),h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group",onClick:()=>{L(!0),he()},children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:"Recent Errors"}),h.jsx(os,{size:16,className:"text-error"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:ye.errors}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:"Failed URL processes"})]}),h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group",onClick:()=>{O(!0),Ne()},children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:"Total Signals"}),h.jsx(Bn,{size:16,className:"text-primary"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:ye.signals}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:"Successfully mined"})]})]})]}),h.jsxs(Zt,{children:[_&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs($e.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(Br,{className:"text-orange-400"}),"Blacklist Suggestions"]}),h.jsx("p",{className:"text-sm text-fg/60",children:"Review domains suggested for blacklisting based on low scores."})]}),h.jsx("button",{onClick:()=>j(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(os,{size:20,className:"text-fg/40"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10 space-y-4",children:ae.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx("div",{className:"bg-surface/50 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4",children:h.jsx(vs,{size:32,className:"text-success"})}),h.jsx("p",{className:"font-medium",children:"No suggestions right now"}),h.jsx("p",{className:"text-xs opacity-70 mt-1",children:"Your signal quality looks good!"})]}):ae.map((se,Ee)=>h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 flex items-center justify-between group hover:border-primary/20 transition-all",children:[h.jsxs("div",{children:[h.jsx("div",{className:"font-mono text-sm font-bold text-fg/90",children:se.domain}),h.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[h.jsxs("span",{className:"text-[10px] bg-surface px-1.5 py-0.5 rounded text-fg/50",children:[se.signalCount," signals"]}),h.jsxs("span",{className:"text-[10px] bg-surface px-1.5 py-0.5 rounded text-fg/50",children:["Avg Score: ",se.avgScore]}),h.jsx("span",{className:"text-[10px] text-orange-400 font-medium",children:se.reason==="low_score"?"Consistently Low Quality":"Repetitive Pattern"})]})]}),h.jsx("button",{onClick:async()=>{const{data:{user:Le}}=await ce.auth.getUser();if(Le){const{data:B}=await ce.from("alchemy_settings").select("blacklist_domains").eq("user_id",Le.id).single(),le=B?.blacklist_domains||[];le.includes(se.domain)||await ce.from("alchemy_settings").update({blacklist_domains:[...le,se.domain]}).eq("user_id",Le.id),T(pe=>pe.filter(Ye=>Ye.domain!==se.domain))}},className:"px-4 py-2 bg-orange-500/10 text-orange-500 hover:bg-orange-500 hover:text-white rounded-lg text-xs font-bold transition-all border border-orange-500/20",children:"Blacklist Domain"})]},Ee))})]})}),C&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs($e.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(os,{className:"text-error"}),"Recent Errors"]}),h.jsx("p",{className:"text-sm text-fg/60",children:"Log of recent failures and issues."})]}),h.jsx("button",{onClick:()=>L(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(os,{size:20,className:"text-fg/40"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10 space-y-3",children:I.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx(vs,{size:32,className:"mx-auto mb-4 text-success opacity-50"}),h.jsx("p",{children:"No recent errors found."})]}):I.map((se,Ee)=>h.jsxs("div",{className:"glass p-4 rounded-xl border border-error/20 bg-error/5 flex items-start gap-3",children:[h.jsx(Br,{size:16,className:"text-error mt-0.5 shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{className:"text-xs font-mono text-fg/40",children:new Date(se.created_at).toLocaleString()}),h.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-error",children:se.agent_state})]}),h.jsx("p",{className:"text-sm font-mono text-fg/90 break-words",children:se.message}),se.details&&Object.keys(se.details).length>0&&h.jsx("pre",{className:"mt-2 p-2 bg-black/20 rounded text-[10px] text-fg/60 overflow-x-auto",children:JSON.stringify(se.details,null,2)})]})]},Ee))})]})})]}),h.jsx(Zt,{children:U&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs($e.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border bg-surface/30 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(Bn,{className:"text-primary"}),"Found Signals"]}),h.jsx("p",{className:"text-sm text-fg/60",children:"Browse and manage your mined signals history."})]}),h.jsx("button",{onClick:()=>O(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(os,{size:20,className:"text-fg/40"})})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("div",{className:"relative flex-1",children:[h.jsx("input",{type:"text",placeholder:"Search signals...",className:"w-full bg-surface/50 border border-border/20 rounded-lg pl-9 pr-4 py-2 text-sm focus:ring-2 focus:ring-primary/20 focus:border-primary/50 outline-none",value:ie,onChange:se=>{oe(se.target.value),ge(0)},onKeyDown:se=>se.key==="Enter"&&Ne(0)}),h.jsx(Il,{className:"absolute left-3 top-2.5 w-4 h-4 text-fg/40"})]}),h.jsxs("select",{className:"bg-surface/50 border border-border/20 rounded-lg px-3 py-2 text-sm outline-none focus:border-primary/50",value:Q||"all",onChange:se=>{we(se.target.value),ge(0)},children:[h.jsx("option",{value:"all",children:"Any Score"}),h.jsx("option",{value:"high",children:"High (80%+)"}),h.jsx("option",{value:"medium",children:"Medium (50-79%)"}),h.jsx("option",{value:"low",children:"Low (<50%)"})]}),h.jsxs("select",{className:"bg-surface/50 border border-border/20 rounded-lg px-3 py-2 text-sm outline-none focus:border-primary/50",value:Se||"",onChange:se=>{re(se.target.value||null),ge(0)},children:[h.jsx("option",{value:"",children:"All Categories"}),h.jsx("option",{value:"AI & ML",children:"AI & ML"}),h.jsx("option",{value:"Technology",children:"Technology"}),h.jsx("option",{value:"Business",children:"Business"}),h.jsx("option",{value:"Finance",children:"Finance"}),h.jsx("option",{value:"Politics",children:"Politics"}),h.jsx("option",{value:"Science",children:"Science"}),h.jsx("option",{value:"Crypto",children:"Crypto"}),h.jsx("option",{value:"Other",children:"Other"})]}),h.jsxs("div",{className:"flex items-center gap-2 border-l border-border/10 pl-4",children:[h.jsx("button",{disabled:X===0,onClick:()=>ge(se=>Math.max(0,se-1)),className:"p-2 hover:bg-surface rounded-lg disabled:opacity-30 transition-colors",children:h.jsx(iS,{size:20})}),h.jsxs("span",{className:"text-xs font-mono text-fg/50 w-16 text-center",children:["Page ",X+1]}),h.jsx("button",{disabled:N.length<20,onClick:()=>ge(se=>se+1),className:"p-2 hover:bg-surface rounded-lg disabled:opacity-30 transition-colors",children:h.jsx(jl,{size:20})})]})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10",children:me?h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):N.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-fg/40 gap-4",children:[h.jsx("div",{className:"w-16 h-16 rounded-full bg-surface/50 flex items-center justify-center",children:h.jsx(Bn,{size:32,className:"opacity-50"})}),h.jsx("p",{children:"No signals found matching your criteria."})]}):h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:N.map(se=>h.jsx(ob,{signal:se,onOpen:Ee=>window.open(Ee,"_blank"),onFavourite:async(Ee,Le)=>{const B=!Le;ne(le=>le.map(pe=>pe.id===Ee?{...pe,is_favorite:B}:pe)),await ce.from("signals").update({is_favorite:B}).eq("id",Ee)},onBoost:async(Ee,Le)=>{const B=!Le;ne(le=>le.map(pe=>pe.id===Ee?{...pe,is_boosted:B}:pe)),await ce.from("signals").update({is_boosted:B}).eq("id",Ee)},onDismiss:async(Ee,Le)=>{const B=!Le;ne(le=>le.map(pe=>pe.id===Ee?{...pe,is_dismissed:B}:pe)),await ce.from("signals").update({is_dismissed:B}).eq("id",Ee)},onNote:(Ee,Le,B)=>V({id:Ee,note:Le,title:B})},se.id))})})]})})}),q&&h.jsx(ab,{isOpen:!!q,onClose:()=>V(null),title:q.title,initialNote:q.note,onSave:async se=>{q&&(ne(Ee=>Ee.map(Le=>Le.id===q.id?{...Le,user_notes:se}:Le)),await ce.from("signals").update({user_notes:se}).eq("id",q.id),V(null))}}),h.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:t.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx(gi,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),h.jsx("p",{children:"No sync runs yet"})]}):h.jsx("div",{className:"space-y-2",children:t.map(se=>h.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[h.jsxs("button",{onClick:()=>It(se.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[a===se.id?h.jsx(mi,{className:"w-5 h-5 text-primary shrink-0"}):h.jsx(jl,{className:"w-5 h-5 text-fg/40 shrink-0"}),qn(se.status),h.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),h.jsx("div",{className:"text-sm font-mono",children:new Date(se.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),h.jsx("div",{className:"text-sm font-mono",children:yn(se.duration_ms)})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),h.jsx("div",{className:"text-sm font-semibold text-primary",children:se.signals_found})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),h.jsx("div",{className:"text-sm font-semibold text-fg/60",children:se.skipped})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),h.jsx("div",{className:"text-sm font-semibold",children:se.urls_processed})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),h.jsx("div",{className:`text-sm font-semibold ${se.errors>0?"text-error":"text-fg/40"}`,children:se.errors})]})]})]}),h.jsx(Zt,{children:a===se.id&&h.jsx($e.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border overflow-hidden",children:h.jsx("div",{className:"p-4 bg-surface/30 space-y-2",children:E?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?h.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((Ee,Le)=>h.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>rr(Ee.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[c===Ee.label?h.jsx(mi,{className:"w-4 h-4 text-primary shrink-0"}):h.jsx(jl,{className:"w-4 h-4 text-fg/40 shrink-0"}),h.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[h.jsxs("div",{className:"flex-1",children:[h.jsx("div",{className:"text-sm font-semibold",children:Ee.label}),h.jsx("div",{className:"text-xs text-fg/40",children:Ee.browser})]}),h.jsxs("div",{className:"text-right",children:[h.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),h.jsx("div",{className:"text-sm font-semibold",children:Ee.urls_found})]}),h.jsxs("div",{className:"text-right",children:[h.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),h.jsx("div",{className:"text-sm font-mono",children:yn(Ee.duration_ms)})]})]})]}),h.jsx(Zt,{children:c===Ee.label&&h.jsx($e.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border overflow-hidden",children:h.jsx("div",{className:"p-3 bg-surface/50 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:w.filter(B=>B.source_label===Ee.label).length===0?h.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):w.filter(B=>B.source_label===Ee.label).map((B,le)=>h.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[Nn(B.result),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:B.url}),B.result==="signal"&&h.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",B.score,"%) - ",B.category]}),B.result==="skipped"&&h.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",B.score,"%) - ",B.reason]}),B.result==="error"&&h.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",B.reason]})]}),h.jsx("a",{href:B.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:pe=>pe.stopPropagation(),children:h.jsx(bi,{className:"w-3 h-3 text-fg/40"})})]},le))})})})]},Le))})})})]},se.id))})})]})}function BP({signals:e,limit:t=10,onSignalClick:n}){const r=e.slice(0,t),[o,a]=P.useState(()=>{const d=localStorage.getItem("newSignalsFeedExpanded");return d!==null?d==="true":!0});P.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const l=d=>d>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":d>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",c=d=>{const p=new Date(d),y=new Date().getTime()-p.getTime(),x=Math.floor(y/6e4),w=Math.floor(y/36e5);return x<1?"Just now":x<60?`${x}m ago`:w<24?`${w}h ago`:p.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return r.length===0?null:h.jsxs("div",{className:"mb-3",children:[h.jsxs("button",{onClick:()=>a(!o),className:"w-full flex items-center justify-between mb-2 px-1 py-1 hover:bg-surface/30 rounded-lg transition-colors",children:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:["New Signals (",r.length,")"]})}),o?h.jsx(Ox,{size:16,className:"text-fg/40"}):h.jsx(mi,{size:16,className:"text-fg/40"})]}),h.jsx(Zt,{children:o&&h.jsx($e.div,{initial:{height:0,opacity:0,overflow:"hidden"},animate:{height:"auto",opacity:1,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden"},transition:{duration:.2},className:"py-3",children:h.jsx("div",{className:"overflow-x-auto pb-2 -mx-4 px-4 scrollbar-on-hover",children:h.jsx("div",{className:"flex gap-3 min-w-max",children:r.map(d=>h.jsxs($e.button,{onClick:()=>n(d.id),whileHover:{scale:1.05},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-3 hover:border-[var(--border-hover)] transition-all duration-300 text-left group relative z-0 hover:z-10",children:[h.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${l(d.score)}`,children:h.jsx("span",{className:"text-xl font-bold",children:d.score})}),h.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:d.title}),h.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[h.jsx(gi,{size:10}),h.jsx("span",{children:c(d.created_at)})]})]},d.id))})})})})]})}function VP({category:e,signalCount:t,latestTimestamp:n,onClick:r}){const o=l=>{const c=new Date(l),p=new Date().getTime()-c.getTime(),m=Math.floor(p/6e4),y=Math.floor(p/36e5),x=Math.floor(p/864e5);return m<60?`${m}m ago`:y<24?`${y}h ago`:x<7?`${x}d ago`:c.toLocaleDateString("en-US",{month:"short",day:"numeric"})},a=e.icon;return h.jsxs($e.button,{whileHover:{scale:1.05},whileTap:{scale:.98},onClick:r,className:"bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-6 cursor-pointer hover:border-[var(--border-hover)] transition-all duration-300 text-left w-full relative z-0 hover:z-10",children:[h.jsx("div",{className:"mb-4",children:h.jsx(a,{size:40,className:"text-current opacity-80"})}),h.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:e.name}),h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${zP(e.color)}`,children:[t," ",t===1?"signal":"signals"]}),h.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[h.jsx(gi,{size:12}),o(n)]})]})]})}const qP=3;function HP({signals:e,onCategoryClick:t}){const{categories:n,categoryCounts:r}=P.useMemo(()=>{const o=new Map,a=new Map;e.forEach(p=>{const m=p.tags||[],y=ib(m,p.category);if(y){const x=o.get(y)||{count:0,latest:p.created_at};o.set(y,{count:x.count+1,latest:p.created_at>x.latest?p.created_at:x.latest})}else m.forEach(x=>{const w=x.toLowerCase().trim();if(w){a.set(w,(a.get(w)||0)+1);const b=o.get(w)||{count:0,latest:p.created_at};o.set(w,{count:b.count+1,latest:p.created_at>b.latest?p.created_at:b.latest})}})});const l=Array.from(a.entries()).filter(([p,m])=>m>=qP).map(([p,m])=>({id:p,name:p.charAt(0).toUpperCase()+p.slice(1),icon:pS,color:"gray",priority:2}));return{categories:[...Ko,...l,Pf].filter(p=>{const m=o.get(p.id);return m&&m.count>0}).sort((p,m)=>p.priority-m.priority),categoryCounts:o}},[e]);return n.length===0?h.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[h.jsx("p",{className:"font-medium italic",children:"No categories yet."}),h.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 p-2",children:n.map(o=>{const a=r.get(o.id);return h.jsx(VP,{category:o,signalCount:a.count,latestTimestamp:a.latest,onClick:()=>t(o.id)},o.id)})})}function WP({isOpen:e,onClose:t,categoryId:n,signals:r,onOpenUrl:o,onFavourite:a,onNote:l,onBoost:c,onDismiss:d}){const p=MP.find(k=>k.id===n),[m,y]=P.useState(null),x=r.filter(k=>{const _=k.tags||[],j=k.category?.toLowerCase()===n,C=_.some(L=>L.toLowerCase().includes(n));return j||C}),w=k=>{o?o(k):window.open(k,"_blank","noopener,noreferrer")},b=(k,_,j)=>{y({id:k,note:_,title:j})},E=async k=>{m&&l&&(await l(m.id,k),y(null))};return h.jsx(Zt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),h.jsxs($e.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed right-0 top-0 h-full w-full md:w-2/3 lg:w-1/2 bg-bg border-l border-border z-50 overflow-y-auto custom-scrollbar",children:[h.jsx("div",{className:"sticky top-0 z-10 bg-bg/95 backdrop-blur-md border-b border-border p-6 shadow-sm",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[p?.icon&&h.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-surface/50 rounded-xl border border-white/5",children:h.jsx(p.icon,{size:28,className:"text-primary"})}),h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold",children:p?.name}),h.jsxs("p",{className:"text-sm text-fg/50 font-mono",children:[x.length," ",x.length===1?"signal":"signals"]})]})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors text-fg/60 hover:text-fg","aria-label":"Close drawer",children:h.jsx(tr,{size:24})})]})}),h.jsx("div",{className:"p-6 space-y-4",children:x.length===0?h.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/30 gap-2",children:[p?.icon&&h.jsx(p.icon,{size:48,className:"opacity-20"}),h.jsx("p",{className:"italic",children:"No signals in this category yet."})]}):x.map(k=>h.jsx(ob,{signal:k,onOpen:w,onFavourite:a,onNote:b,onBoost:c,onDismiss:d},k.id))})]}),m&&h.jsx(ab,{isOpen:!!m,onClose:()=>y(null),title:m.title,initialNote:m.note,onSave:E})]})})}function KP({onOpenUrl:e,onCopyText:t}){const[n,r]=P.useState([]),[o,a]=P.useState(!0),[l,c]=P.useState(null),[d,p]=P.useState(""),[m,y]=P.useState(null);P.useEffect(()=>{(async()=>{a(!0);let E=ce.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);m&&(E=E.ilike("category",m)),d&&(E=E.or(`title.ilike.%${d}%,summary.ilike.%${d}%,url.ilike.%${d}%`));const{data:k,error:_}=await E;_?console.error("Error fetching signals:",_):r(k||[]),a(!1)})();const b=ce.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{r(k=>[E.new,...k])}).subscribe();return()=>{b.unsubscribe()}},[d,m]);const x=w=>{e?e(w):window.open(w,"_blank","noopener,noreferrer")};return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsx("div",{className:"px-4 pt-2",children:h.jsx(BP,{signals:n,limit:10,onSignalClick:w=>{const b=n.find(E=>E.id===w);b&&b.category&&c(b.category.toLowerCase())}})}),h.jsxs("div",{className:"px-4 pt-1 pb-2 space-y-3",children:[h.jsxs("div",{className:"relative",children:[h.jsx(Il,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),h.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:d,onChange:w=>p(w.target.value),className:"w-full bg-surface border border-border/20 rounded-xl py-3 pl-10 pr-10 text-sm text-fg placeholder:text-fg/40 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 outline-none transition-all"}),d&&h.jsx("button",{onClick:()=>p(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:h.jsx(tr,{size:16})})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx(dS,{className:"w-3.5 h-3.5 text-fg/40"}),h.jsx("button",{onClick:()=>y(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${m===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:"All"}),["AI & ML","Business","Politics","Technology","Finance","Crypto","Science","Other"].map(w=>h.jsx("button",{onClick:()=>y(w),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${m===w?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:w},w))]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 scrollbar-on-hover",children:o?h.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):h.jsx(HP,{signals:n,onCategoryClick:w=>c(w)})}),h.jsx(WP,{isOpen:!!l,onClose:()=>c(null),categoryId:l||"",signals:n,onOpenUrl:x,onFavourite:async(w,b)=>{const E=!b;r(_=>_.map(j=>j.id===w?{...j,is_favorite:E}:j));const{error:k}=await ce.from("signals").update({is_favorite:E}).eq("id",w);k&&(console.error("Failed to update favorite:",k),r(_=>_.map(j=>j.id===w?{...j,is_favorite:b}:j)))},onNote:async(w,b)=>{r(k=>k.map(_=>_.id===w?{..._,user_notes:b}:_));const{error:E}=await ce.from("signals").update({user_notes:b}).eq("id",w);E&&console.error("Failed to update note:",E)},onBoost:async(w,b)=>{const E=!b;r(_=>_.map(j=>j.id===w?{...j,is_boosted:E}:j));const{error:k}=await ce.from("signals").update({is_boosted:E}).eq("id",w);k&&(console.error("Failed to update boost:",k),r(_=>_.map(j=>j.id===w?{...j,is_boosted:b}:j)))},onDismiss:async(w,b)=>{const E=!b;r(_=>_.map(j=>j.id===w?{...j,is_dismissed:E}:j));const{error:k}=await ce.from("signals").update({is_dismissed:E}).eq("id",w);k&&(console.error("Failed to update dismiss:",k),r(_=>_.map(j=>j.id===w?{...j,is_dismissed:b}:j)))}})]})}function GP({activeSessionId:e,onSelectSession:t}){const[n,r]=P.useState([]),[o,a]=P.useState(!0);P.useEffect(()=>{l()},[]);const l=async()=>{try{const{data:{session:d}}=await ce.auth.getSession();if(!d)return;const p=await He.get("/api/chat/sessions",{headers:{"x-user-id":d.user.id}});p.data.success&&r(p.data.sessions)}catch(d){console.error("Failed to fetch sessions",d)}finally{a(!1)}},c=async(d,p)=>{d.stopPropagation();try{const{error:m}=await ce.from("chat_sessions").delete().eq("id",p);m||(r(y=>y.filter(x=>x.id!==p)),e===p&&t(null))}catch(m){console.error(m)}};return h.jsxs("div",{className:"w-64 glass flex flex-col rounded-2xl border border-border/40 overflow-hidden",children:[h.jsx("div",{className:"p-3 border-b border-border/10",children:h.jsxs("button",{onClick:()=>t(null),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-primary/10 hover:bg-primary/20 text-primary rounded-xl transition-all font-semibold text-sm border border-primary/20",children:[h.jsx(Dx,{size:16}),"New Chat"]})}),h.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:o?h.jsx("div",{className:"p-4 text-center text-xs text-fg/40",children:"Loading..."}):n.length===0?h.jsxs("div",{className:"p-8 text-center",children:[h.jsx(Kd,{size:24,className:"mx-auto text-fg/20 mb-2"}),h.jsx("p",{className:"text-xs text-fg/40",children:"No history yet"})]}):n.map(d=>h.jsxs("div",{onClick:()=>t(d.id),className:`group flex items-center justify-between px-3 py-3 rounded-lg cursor-pointer transition-all text-sm ${e===d.id?"bg-surface border border-border/50 text-fg shadow-sm":"text-fg/60 hover:bg-surface/50 hover:text-fg border border-transparent"}`,children:[h.jsxs("div",{className:"flex items-center gap-2.5 overflow-hidden",children:[h.jsx(Kd,{size:14,className:e===d.id?"text-primary":"opacity-50"}),h.jsx("span",{className:"truncate",children:d.title})]}),h.jsx("button",{onClick:p=>c(p,d.id),className:"opacity-0 group-hover:opacity-100 p-1.5 hover:bg-red-500/10 hover:text-red-400 rounded transition-all",children:h.jsx(Mx,{size:12})})]},d.id))})]})}function JP(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const YP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QP={};function K0(e,t){return(QP.jsx?XP:YP).test(e)}const ZP=/[ \t\n\f\r]/g;function eR(e){return typeof e=="object"?e.type==="text"?G0(e.value):!1:G0(e)}function G0(e){return e.replace(ZP,"")===""}class sa{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}sa.prototype.normal={};sa.prototype.property={};sa.prototype.space=void 0;function lb(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new sa(n,r,t)}function Th(e){return e.toLowerCase()}class rn{constructor(t,n){this.attribute=n,this.property=t}}rn.prototype.attribute="";rn.prototype.booleanish=!1;rn.prototype.boolean=!1;rn.prototype.commaOrSpaceSeparated=!1;rn.prototype.commaSeparated=!1;rn.prototype.defined=!1;rn.prototype.mustUseProperty=!1;rn.prototype.number=!1;rn.prototype.overloadedBoolean=!1;rn.prototype.property="";rn.prototype.spaceSeparated=!1;rn.prototype.space=void 0;let tR=0;const Ue=_s(),vt=_s(),Ch=_s(),ee=_s(),Ze=_s(),fi=_s(),dn=_s();function _s(){return 2**++tR}const Nh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ue,booleanish:vt,commaOrSpaceSeparated:dn,commaSeparated:fi,number:ee,overloadedBoolean:Ch,spaceSeparated:Ze},Symbol.toStringTag,{value:"Module"})),Od=Object.keys(Nh);class Rf extends rn{constructor(t,n,r,o){let a=-1;if(super(t,n),J0(this,"space",o),typeof r=="number")for(;++a<Od.length;){const l=Od[a];J0(this,Od[a],(r&Nh[l])===Nh[l])}}}Rf.prototype.defined=!0;function J0(e,t,n){n&&(e[t]=n)}function ji(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const a=new Rf(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Th(r)]=r,n[Th(a.attribute)]=r}return new sa(t,n,e.space)}const ub=ji({properties:{ariaActiveDescendant:null,ariaAtomic:vt,ariaAutoComplete:null,ariaBusy:vt,ariaChecked:vt,ariaColCount:ee,ariaColIndex:ee,ariaColSpan:ee,ariaControls:Ze,ariaCurrent:null,ariaDescribedBy:Ze,ariaDetails:null,ariaDisabled:vt,ariaDropEffect:Ze,ariaErrorMessage:null,ariaExpanded:vt,ariaFlowTo:Ze,ariaGrabbed:vt,ariaHasPopup:null,ariaHidden:vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ze,ariaLevel:ee,ariaLive:null,ariaModal:vt,ariaMultiLine:vt,ariaMultiSelectable:vt,ariaOrientation:null,ariaOwns:Ze,ariaPlaceholder:null,ariaPosInSet:ee,ariaPressed:vt,ariaReadOnly:vt,ariaRelevant:null,ariaRequired:vt,ariaRoleDescription:Ze,ariaRowCount:ee,ariaRowIndex:ee,ariaRowSpan:ee,ariaSelected:vt,ariaSetSize:ee,ariaSort:null,ariaValueMax:ee,ariaValueMin:ee,ariaValueNow:ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function cb(e,t){return t in e?e[t]:t}function db(e,t){return cb(e,t.toLowerCase())}const nR=ji({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fi,acceptCharset:Ze,accessKey:Ze,action:null,allow:null,allowFullScreen:Ue,allowPaymentRequest:Ue,allowUserMedia:Ue,alt:null,as:null,async:Ue,autoCapitalize:null,autoComplete:Ze,autoFocus:Ue,autoPlay:Ue,blocking:Ze,capture:null,charSet:null,checked:Ue,cite:null,className:Ze,cols:ee,colSpan:null,content:null,contentEditable:vt,controls:Ue,controlsList:Ze,coords:ee|fi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ue,defer:Ue,dir:null,dirName:null,disabled:Ue,download:Ch,draggable:vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ue,formTarget:null,headers:Ze,height:ee,hidden:Ch,high:ee,href:null,hrefLang:null,htmlFor:Ze,httpEquiv:Ze,id:null,imageSizes:null,imageSrcSet:null,inert:Ue,inputMode:null,integrity:null,is:null,isMap:Ue,itemId:null,itemProp:Ze,itemRef:Ze,itemScope:Ue,itemType:Ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ue,low:ee,manifest:null,max:null,maxLength:ee,media:null,method:null,min:null,minLength:ee,multiple:Ue,muted:Ue,name:null,nonce:null,noModule:Ue,noValidate:Ue,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ue,optimum:ee,pattern:null,ping:Ze,placeholder:null,playsInline:Ue,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ue,referrerPolicy:null,rel:Ze,required:Ue,reversed:Ue,rows:ee,rowSpan:ee,sandbox:Ze,scope:null,scoped:Ue,seamless:Ue,selected:Ue,shadowRootClonable:Ue,shadowRootDelegatesFocus:Ue,shadowRootMode:null,shape:null,size:ee,sizes:null,slot:null,span:ee,spellCheck:vt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ee,step:null,style:null,tabIndex:ee,target:null,title:null,translate:null,type:null,typeMustMatch:Ue,useMap:null,value:vt,width:ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ze,axis:null,background:null,bgColor:null,border:ee,borderColor:null,bottomMargin:ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ue,declare:Ue,event:null,face:null,frame:null,frameBorder:null,hSpace:ee,leftMargin:ee,link:null,longDesc:null,lowSrc:null,marginHeight:ee,marginWidth:ee,noResize:Ue,noHref:Ue,noShade:Ue,noWrap:Ue,object:null,profile:null,prompt:null,rev:null,rightMargin:ee,rules:null,scheme:null,scrolling:vt,standby:null,summary:null,text:null,topMargin:ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ue,disableRemotePlayback:Ue,prefix:null,property:null,results:ee,security:null,unselectable:null},space:"html",transform:db}),rR=ji({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:dn,accentHeight:ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ee,amplitude:ee,arabicForm:null,ascent:ee,attributeName:null,attributeType:null,azimuth:ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ee,by:null,calcMode:null,capHeight:ee,className:Ze,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ee,diffuseConstant:ee,direction:null,display:null,dur:null,divisor:ee,dominantBaseline:null,download:Ue,dx:null,dy:null,edgeMode:null,editable:null,elevation:ee,enableBackground:null,end:null,event:null,exponent:ee,externalResourcesRequired:null,fill:null,fillOpacity:ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:fi,g2:fi,glyphName:fi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ee,horizOriginX:ee,horizOriginY:ee,id:null,ideographic:ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ee,k:ee,k1:ee,k2:ee,k3:ee,k4:ee,kernelMatrix:dn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ee,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ee,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ee,overlineThickness:ee,paintOrder:null,panose1:null,path:null,pathLength:ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ee,pointsAtY:ee,pointsAtZ:ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:dn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:dn,rev:dn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:dn,requiredFeatures:dn,requiredFonts:dn,requiredFormats:dn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ee,specularExponent:ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ee,strikethroughThickness:ee,string:null,stroke:null,strokeDashArray:dn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ee,strokeOpacity:ee,strokeWidth:null,style:null,surfaceScale:ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:dn,tabIndex:ee,tableValues:null,target:null,targetX:ee,targetY:ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:dn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ee,underlineThickness:ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ee,values:null,vAlphabetic:ee,vMathematical:ee,vectorEffect:null,vHanging:ee,vIdeographic:ee,version:null,vertAdvY:ee,vertOriginX:ee,vertOriginY:ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:cb}),hb=ji({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),fb=ji({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:db}),pb=ji({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),sR={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},iR=/[A-Z]/g,Y0=/-[a-z]/g,oR=/^data[-\w.:]+$/i;function aR(e,t){const n=Th(t);let r=t,o=rn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&oR.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(Y0,uR);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!Y0.test(a)){let l=a.replace(iR,lR);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=Rf}return new o(r,t)}function lR(e){return"-"+e.toLowerCase()}function uR(e){return e.charAt(1).toUpperCase()}const cR=lb([ub,nR,hb,fb,pb],"html"),Of=lb([ub,rR,hb,fb,pb],"svg");function dR(e){return e.join(" ").trim()}var ti={},Id,X0;function hR(){if(X0)return Id;X0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
109
+ ${e.content}`:""}`,d=new Blob([c],{type:"text/markdown"}),p=URL.createObjectURL(d),m=document.createElement("a");m.href=p,m.download=`${e.title.replace(/[^a-z0-9]/gi,"_").toLowerCase()}.md`,m.click(),URL.revokeObjectURL(p)},l=()=>{const c=JSON.stringify(e,null,2),d=new Blob([c],{type:"application/json"}),p=URL.createObjectURL(d),m=document.createElement("a");m.href=p,m.download=`signal_${e.id}.json`,m.click(),URL.revokeObjectURL(p)};return h.jsx(Zt,{children:h.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-bg/80 backdrop-blur-sm",onClick:t,children:h.jsxs($e.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},onClick:c=>c.stopPropagation(),className:"w-full max-w-4xl max-h-[90vh] glass flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border/10 flex items-start justify-between",children:[h.jsxs("div",{className:"flex-1 min-w-0 pr-4",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[h.jsx("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold rounded border border-primary/20 uppercase tracking-wider",children:e.category||"Research"}),h.jsx("span",{className:`text-3xl font-black ${e.score>=80?"text-accent":"text-fg/40"}`,children:e.score})]}),h.jsx("h2",{className:"text-2xl font-bold leading-tight mb-2",children:e.title}),h.jsxs("p",{className:"text-xs text-fg/40 font-mono",children:["Discovered ",new Date(e.date).toLocaleDateString([],{month:"long",day:"numeric",year:"numeric"})]})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg text-fg/40 hover:text-fg transition-all",children:h.jsx(tr,{size:24})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto custom-scrollbar p-6 space-y-6",children:[e.url&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Original Source"}),h.jsxs("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-3 glass hover:bg-surface transition-all rounded-xl text-sm font-mono text-primary hover:text-accent group",children:[h.jsx(bi,{size:16,className:"flex-shrink-0"}),h.jsx("span",{className:"truncate",children:e.url}),h.jsx("span",{className:"ml-auto text-xs opacity-0 group-hover:opacity-100 transition-opacity",children:"Open →"})]})]}),e.entities&&e.entities.length>0&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Entities"}),h.jsx("div",{className:"flex flex-wrap gap-2",children:e.entities.map(c=>h.jsx("span",{className:"px-3 py-1.5 bg-surface/50 border border-border/20 rounded-lg text-sm font-medium",children:c},c))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"AI Summary"}),h.jsx("div",{className:"p-4 glass rounded-xl",children:h.jsx("p",{className:"text-sm leading-relaxed text-fg/80",children:e.summary})})]}),e.content&&h.jsxs("div",{className:"space-y-2",children:[h.jsx("label",{className:"text-xs font-bold uppercase tracking-widest text-fg/40",children:"Full Content"}),h.jsx("div",{className:"p-4 glass rounded-xl max-h-96 overflow-y-auto custom-scrollbar",children:h.jsx("p",{className:"text-sm leading-relaxed text-fg/60 whitespace-pre-wrap",children:e.content})})]})]}),h.jsxs("div",{className:"p-6 border-t border-border/10 flex items-center gap-3",children:[h.jsxs("button",{onClick:o,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[n?h.jsx(Io,{size:16,className:"text-success"}):h.jsx(uS,{size:16}),n?"Copied!":"Copy"]}),h.jsxs("button",{onClick:a,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[h.jsx(Ug,{size:16}),"Markdown"]}),h.jsxs("button",{onClick:l,className:"flex-1 py-3 glass hover:bg-surface transition-all rounded-xl text-sm font-bold uppercase tracking-widest flex items-center justify-center gap-2",children:[h.jsx(Ug,{size:16}),"JSON"]})]})]})})})}function LP({isOpen:e,onClose:t}){const{showToast:n}=nb(),[r,o]=P.useState(""),[a,l]=P.useState(50),[c,d]=P.useState(!1),[p,m]=P.useState(!1);P.useEffect(()=>{e&&y()},[e]);const y=async()=>{const{data:{user:b}}=await ce.auth.getUser();if(!b)return;const{data:E}=await ce.from("alchemy_settings").select("*").eq("user_id",b.id).maybeSingle();if(E){l(E.max_urls_per_sync||50);const k=E.sync_start_date||E.last_sync_checkpoint;if(k){const _=new Date(k),j=L=>L<10?"0"+L:L,C=_.getFullYear()+"-"+j(_.getMonth()+1)+"-"+j(_.getDate())+"T"+j(_.getHours())+":"+j(_.getMinutes());o(C)}else o("")}},x=async()=>{d(!0);try{const{data:{user:b}}=await ce.auth.getUser();if(!b){n("Please log in to save settings","error"),d(!1);return}const{error:E}=await ce.from("alchemy_settings").update({max_urls_per_sync:a,sync_start_date:r?new Date(r).toISOString():null}).eq("user_id",b.id);E?n(`Failed to save: ${E.message}`,"error"):(n("Sync settings saved successfully","success"),t())}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{d(!1)}},w=async()=>{m(!0);try{const{data:{user:b}}=await ce.auth.getUser();if(!b){n("Please log in to reset checkpoint","error"),m(!1);return}const{error:E}=await ce.from("alchemy_settings").update({last_sync_checkpoint:null}).eq("user_id",b.id);E?n(`Failed to reset: ${E.message}`,"error"):n("Checkpoint reset successfully","success")}catch(b){n(`Unexpected error: ${b.message}`,"error")}finally{m(!1)}};return e?h.jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:h.jsxs("div",{className:"bg-surface border border-border/20 rounded-2xl shadow-2xl max-w-lg w-full max-h-[90vh] overflow-y-auto",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border/10",children:[h.jsx("h2",{className:"text-xl font-bold",children:"Sync Settings"}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-black/10 rounded-lg transition-colors",children:h.jsx(tr,{className:"w-5 h-5"})})]}),h.jsxs("div",{className:"p-6 space-y-6",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[h.jsx(rS,{className:"w-4 h-4 text-primary"}),"Sync From (Optional)"]}),h.jsx("input",{type:"datetime-local",value:r,onChange:b=>o(b.target.value),className:"w-full bg-black/20 border border-border/10 rounded-xl py-3 px-4 text-sm focus:border-primary/30 outline-none transition-all"}),h.jsx("p",{className:"text-xs text-fg/50",children:"Leave empty to sync only new URLs since last sync (incremental). Set a date to process URLs from that point forward."})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsxs("div",{className:"flex justify-between items-center",children:[h.jsxs("label",{className:"text-sm font-semibold flex items-center gap-2",children:[h.jsx(fS,{className:"w-4 h-4 text-primary"}),"URLs per Sync"]}),h.jsx("span",{className:"text-sm font-mono text-primary",children:a})]}),h.jsx("input",{type:"range",min:"5",max:"200",step:"5",value:a,onChange:b=>l(Number(b.target.value)),className:"w-full h-2 bg-black/20 rounded-lg appearance-none cursor-pointer accent-primary"}),h.jsxs("div",{className:"flex justify-between text-xs text-fg/30 font-medium",children:[h.jsx("span",{children:"Quick (5)"}),h.jsx("span",{children:"Balanced (50)"}),h.jsx("span",{children:"Thorough (200)"})]})]}),h.jsxs("div",{className:"pt-4 border-t border-border/10",children:[h.jsxs("button",{onClick:w,disabled:p,className:"w-full px-4 py-2.5 bg-warning/10 hover:bg-warning/20 border border-warning/20 text-warning font-medium rounded-xl transition-all flex items-center justify-center gap-2 text-sm disabled:opacity-50",children:[h.jsx(_S,{size:16,className:p?"animate-spin":""}),p?"Resetting...":"Reset Checkpoint"]}),h.jsx("p",{className:"text-xs text-fg/40 mt-2 text-center",children:'Clear the sync checkpoint to force a full re-sync from your "Sync From" date'})]}),h.jsx("div",{className:"p-4 bg-primary/5 rounded-xl",children:h.jsx("p",{className:"text-xs text-primary/60 leading-relaxed",children:'The Alchemist tracks your progress automatically. Use "Sync From" to backfill history or "Reset Checkpoint" to start fresh.'})})]}),h.jsxs("div",{className:"flex gap-3 p-6 border-t border-border/10",children:[h.jsx("button",{onClick:t,className:"flex-1 px-4 py-2.5 bg-surface hover:bg-black/10 border border-border/10 rounded-xl font-medium transition-all",children:"Cancel"}),h.jsxs("button",{onClick:x,disabled:c,className:"flex-1 px-4 py-2.5 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg hover:scale-[1.02] active:scale-95 transition-all flex items-center justify-center gap-2 disabled:opacity-50",children:[h.jsx(ms,{size:18,className:c?"animate-spin":""}),c?"Saving...":"Save Settings"]})]})]})}):null}const Ko=[{id:"ai",name:"AI & ML",icon:Rx,color:"blue",priority:1},{id:"business",name:"Business",icon:tS,color:"purple",priority:1},{id:"politics",name:"Politics",icon:yS,color:"red",priority:1},{id:"technology",name:"Technology",icon:zh,color:"cyan",priority:1},{id:"finance",name:"Finance",icon:cS,color:"green",priority:1},{id:"crypto",name:"Crypto",icon:Zk,color:"orange",priority:1},{id:"science",name:"Science",icon:bS,color:"teal",priority:1}],Pf={id:"other",name:"Other",icon:Gd,color:"gray",priority:3},MP=[...Ko,Pf];function zP(e){const t={blue:"bg-blue-500/20 text-blue-400 border-blue-500/30",purple:"bg-purple-500/20 text-purple-400 border-purple-500/30",red:"bg-red-500/20 text-red-400 border-red-500/30",cyan:"bg-cyan-500/20 text-cyan-400 border-cyan-500/30",green:"bg-green-500/20 text-green-400 border-green-500/30",orange:"bg-orange-500/20 text-orange-400 border-orange-500/30",teal:"bg-teal-500/20 text-teal-400 border-teal-500/30",gray:"bg-gray-500/20 text-gray-400 border-gray-500/30"};return t[e]||t.gray}function ib(e,t){if(t){const n=Ko.find(r=>r.id===t.toLowerCase());if(n)return n.id}for(const n of e){const r=n.toLowerCase(),o=Ko.find(a=>r.includes(a.id)||r.includes(a.name.toLowerCase()));if(o)return o.id}return null}function UP({count:e}){return e<=1?null:h.jsxs("div",{className:"absolute top-3 right-3 px-3 py-1.5 bg-gradient-to-r from-orange-500 to-red-500 rounded-full shadow-lg flex items-center gap-1.5 z-10",title:`Found in ${e} different sources`,children:[h.jsx("span",{className:"text-lg",children:"🔥"}),h.jsxs("span",{className:"text-white font-bold text-sm",children:[e," ",e===1?"source":"sources"]})]})}function FP({urls:e,timestamps:t=[]}){const[n,r]=P.useState(!1);return e.length<=1?null:h.jsxs("div",{className:"mt-4 border-t border-border pt-4",children:[h.jsxs("button",{onClick:()=>r(!n),className:"flex items-center justify-between w-full text-sm text-fg/60 hover:text-fg transition-colors",children:[h.jsxs("span",{className:"font-medium",children:["View all sources (",e.length,")"]}),h.jsx(mi,{size:16,className:`transition-transform duration-200 ${n?"rotate-180":""}`})]}),n&&h.jsx("div",{className:"mt-3 space-y-2 animate-in fade-in slide-in-from-top-2 duration-200",children:e.map((o,a)=>h.jsxs("div",{className:"flex items-start gap-2 text-xs p-2 rounded-lg hover:bg-surface/50 transition-colors",children:[h.jsx(bi,{size:12,className:"text-primary mt-0.5 flex-shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"text-fg/70 hover:text-primary underline truncate block",children:o}),t[a]&&h.jsx("span",{className:"text-fg/40 text-[10px]",children:new Date(t[a]).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})})]})]},a))})]})}function ob({signal:e,onOpen:t,onFavourite:n,onNote:r,onBoost:o,onDismiss:a}){const[l,c]=P.useState(!1),d=x=>x>=80?"text-yellow-400 border-yellow-400/30":x>=50?"text-blue-400 border-blue-400/30":"text-gray-400 border-gray-400/30",p=x=>x>=80?"HIGH":x>=50?"MEDIUM":"LOW",m=(x,w)=>{const b=ib(w||[],x);if(b){const E=Ko.find(k=>k.id===b);if(E)return E}return Pf},y=x=>{const w=new Date(x),E=new Date().getTime()-w.getTime(),k=Math.floor(E/6e4),_=Math.floor(E/36e5),j=Math.floor(E/864e5);return k<60?`${k}m ago`:_<24?`${_}h ago`:j<7?`${j}d ago`:w.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return h.jsxs($e.div,{whileHover:{scale:1.01,translateY:-2},onHoverStart:()=>c(!0),onHoverEnd:()=>c(!1),className:`relative bg-surface/50 backdrop-blur-sm border rounded-xl p-5 flex flex-col gap-4 transition-all duration-300 ${e.is_favorite?"border-yellow-500/30 shadow-[0_0_20px_rgba(234,179,8,0.1)]":e.is_dismissed?"opacity-50 grayscale":"border-border"}`,children:[h.jsx(UP,{count:e.mention_count||1}),h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsxs("div",{className:`flex flex-col items-center justify-center w-14 h-14 rounded-2xl border ${d(e.score)} bg-surface`,children:[h.jsx("span",{className:"text-xl font-bold",children:e.score}),h.jsx("span",{className:"text-[9px] font-bold tracking-wider opacity-70",children:p(e.score)})]}),h.jsxs("div",{children:[(()=>{const x=m(e.category,e.tags),w=x.icon;return h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsxs("span",{className:"px-2 py-0.5 bg-primary/10 text-primary text-[10px] font-bold uppercase tracking-wider rounded border border-primary/20 flex items-center gap-1.5 w-fit",children:[h.jsx(w,{size:10}),x.name]}),e.is_boosted&&h.jsxs("span",{className:"px-2 py-0.5 bg-accent/10 text-accent text-[10px] font-bold uppercase tracking-wider rounded border border-accent/20 flex items-center gap-1 w-fit",children:[h.jsx(Vg,{size:10}),"Boosted"]}),e.is_dismissed&&h.jsxs("span",{className:"px-2 py-0.5 bg-red-500/10 text-red-400 text-[10px] font-bold uppercase tracking-wider rounded border border-red-500/20 flex items-center gap-1 w-fit",children:[h.jsx(Fg,{size:10}),"Dismissed"]})]})})(),h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-fg/40 font-mono",children:[h.jsx(gi,{size:10}),y(e.created_at),(e.mention_count||1)>1&&h.jsxs(h.Fragment,{children:[h.jsx("span",{children:"•"}),h.jsxs("span",{children:[e.mention_count," sources"]})]})]})]})]}),n&&h.jsx("button",{onClick:()=>n(e.id,!!e.is_favorite),className:`p-2 rounded-lg transition-all ${e.is_favorite?"bg-yellow-500/10 text-yellow-500 hover:bg-yellow-500/20":"bg-white/5 text-fg/40 hover:bg-white/10 hover:text-yellow-500"}`,title:e.is_favorite?"Remove from favourites":"Add to favourites",children:h.jsx(NS,{size:18,fill:e.is_favorite?"currentColor":"none"})})]}),h.jsxs("div",{className:"flex-1",children:[h.jsx("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"text-base font-bold text-fg/90 hover:text-primary transition-colors line-clamp-2 mb-2 leading-tight block",onClick:x=>{x.preventDefault(),t?.(e.url)},children:e.title}),h.jsx("p",{className:"text-xs text-fg/60 line-clamp-3 leading-relaxed",children:e.summary}),e.user_notes&&h.jsxs("div",{className:"mt-3 p-3 bg-yellow-500/5 border border-yellow-500/20 rounded-lg flex gap-2",children:[h.jsx(Wd,{size:14,className:"text-yellow-500 shrink-0 mt-0.5"}),h.jsxs("p",{className:"text-xs text-fg/80 italic font-medium line-clamp-2",children:['"',e.user_notes,'"']})]})]}),e.entities&&e.entities.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.entities.slice(0,4).map((x,w)=>h.jsx("span",{className:"px-2 py-0.5 bg-white/5 text-fg/50 text-[10px] rounded border border-white/5",children:x},w)),e.entities.length>4&&h.jsxs("span",{className:"px-2 py-0.5 text-fg/30 text-[10px]",children:["+",e.entities.length-4]})]}),h.jsx(FP,{urls:e.metadata?.source_urls||[],timestamps:e.metadata?.timestamps||[]}),h.jsxs("div",{className:"grid grid-cols-5 gap-2 pt-2 border-t border-border/40",children:[h.jsxs("button",{onClick:()=>t?.(e.url),className:"flex items-center justify-center gap-1.5 px-3 py-2 bg-white/5 hover:bg-white/10 rounded-lg transition-colors text-xs font-semibold text-fg/70",title:"Open Source",children:[h.jsx(bi,{size:14}),"Open"]}),r&&h.jsxs("button",{onClick:()=>r(e.id,e.user_notes||null,e.title),className:`flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.user_notes?"bg-blue-500/10 text-blue-400 hover:bg-blue-500/20":"bg-white/5 text-fg/70 hover:bg-white/10 hover:text-blue-400"}`,title:"Add/Edit Note",children:[h.jsx(Wd,{size:14}),"Note"]}),o&&h.jsxs("button",{onClick:()=>o(e.id,!!e.is_boosted),className:`col-span-2 flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.is_boosted?"bg-accent/20 text-accent hover:bg-accent/30 shadow-sm border border-accent/20":"bg-white/5 text-fg/70 hover:bg-accent/10 hover:text-accent group"}`,title:"Boost this topic for future discovery",children:[h.jsx(Vg,{size:14,className:e.is_boosted?"fill-current":"group-hover:text-accent"}),e.is_boosted?"Boosted":"Boost Topic"]}),a&&h.jsx("button",{onClick:()=>a(e.id,!!e.is_dismissed),className:`flex items-center justify-center gap-1.5 px-3 py-2 rounded-lg transition-colors text-xs font-semibold ${e.is_dismissed?"bg-red-500/10 text-red-400 hover:bg-red-500/20":"bg-white/5 text-fg/70 hover:bg-white/10 hover:text-red-400"}`,title:"Dismiss (Not Interested)",children:h.jsx(Fg,{size:14})})]})]})}function ab({isOpen:e,onClose:t,initialNote:n,title:r,onSave:o}){const[a,l]=P.useState(n||""),[c,d]=P.useState(!1);P.useEffect(()=>{l(n||"")},[n,e]);const p=async()=>{d(!0);try{await o(a),t()}catch(m){console.error("Failed to save note:",m)}finally{d(!1)}};return h.jsx(Zt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-[60]"}),h.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center p-4 pointer-events-none",children:h.jsxs($e.div,{initial:{opacity:0,scale:.95,y:10},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:10},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-lg overflow-hidden pointer-events-auto",children:[h.jsxs("div",{className:"p-4 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("h3",{className:"font-bold flex items-center gap-2",children:[h.jsx(Wd,{size:18,className:"text-primary"}),"Add Note"]}),h.jsx("button",{onClick:t,className:"p-1 hover:bg-surface rounded text-fg/40 hover:text-fg transition-colors",children:h.jsx(tr,{size:18})})]}),h.jsxs("div",{className:"p-4 space-y-3",children:[h.jsxs("p",{className:"text-xs text-fg/50 line-clamp-1 font-mono",children:["Target: ",r]}),h.jsx("textarea",{value:a,onChange:m=>l(m.target.value),placeholder:"Enter your thoughts, ideas, or action items regarding this signal...",className:"w-full h-40 bg-surface/50 border border-border/20 rounded-lg p-3 text-sm focus:border-primary/50 focus:ring-1 focus:ring-primary/20 outline-none resize-none placeholder:text-fg/20",autoFocus:!0})]}),h.jsxs("div",{className:"p-4 border-t border-border bg-surface/10 flex justify-end gap-2",children:[h.jsx("button",{onClick:t,className:"px-4 py-2 hover:bg-surface rounded-lg text-xs font-bold text-fg/60 transition-colors",disabled:c,children:"Cancel"}),h.jsx("button",{onClick:p,disabled:c,className:"px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg text-xs font-bold flex items-center gap-2 transition-colors disabled:opacity-50",children:c?h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"w-3 h-3 border-2 border-white/30 border-t-white rounded-full animate-spin"}),"Saving..."]}):h.jsxs(h.Fragment,{children:[h.jsx(ms,{size:14}),"Save Note"]})})]})]})})]})})}function $P({initialState:e}){const[t,n]=P.useState([]),[r,o]=P.useState(!0),[a,l]=P.useState(null),[c,d]=P.useState(null),[p,m]=P.useState([]),[y,x]=P.useState([]),[w,b]=P.useState([]),[E,k]=P.useState(!1),[_,j]=P.useState(!1),[C,L]=P.useState(!1),[U,O]=P.useState(!1),[q,V]=P.useState(null),[X,ge]=P.useState(0),[ie,oe]=P.useState(""),[Se,re]=P.useState(null),[Q,we]=P.useState("all"),[me,K]=P.useState(!1),[ae,T]=P.useState([]),[I,H]=P.useState([]),[N,ne]=P.useState([]),[ye,ue]=P.useState({errors:0,signals:0});P.useEffect(()=>{Be()},[]),P.useEffect(()=>{U&&Ne(X)},[U,X,Se,Q]),P.useEffect(()=>{const se=setTimeout(()=>{U&&Ne(0)},500);return()=>clearTimeout(se)},[ie]),P.useEffect(()=>{e&&(e.type==="blacklist_suggestion"&&(T(e.data?.suggestions||[]),j(!0)),e.filter==="errors"&&(L(!0),he()))},[e]),P.useEffect(()=>{if(t.length>0){const se=t.reduce((Le,B)=>Le+B.errors,0),Ee=t.reduce((Le,B)=>Le+B.signals_found,0);ue({errors:se,signals:Ee})}},[t]);const he=async()=>{const{data:{user:se}}=await ce.auth.getUser();if(!se)return;const{data:Ee,error:Le}=await ce.from("processing_events").select("*").eq("user_id",se.id).eq("event_type","error").order("created_at",{ascending:!1}).limit(50);!Le&&Ee&&H(Ee)},Ne=async(se=0)=>{K(!0);const{data:{user:Ee}}=await ce.auth.getUser();if(!Ee)return;const Le=20,B=se*Le,le=B+Le-1;let pe=ce.from("signals").select("*").eq("user_id",Ee.id).order("created_at",{ascending:!1}).range(B,le);Se&&(pe=pe.eq("category",Se)),Q==="high"?pe=pe.gte("score",80):Q==="medium"?pe=pe.gte("score",50).lt("score",80):Q==="low"&&(pe=pe.lt("score",50)),ie&&(pe=pe.or(`title.ilike.%${ie}%,url.ilike.%${ie}%`));const{data:Ye,error:tt}=await pe;!tt&&Ye&&ne(Ye),K(!1)},Be=async()=>{o(!0);try{const{data:{user:se}}=await ce.auth.getUser();if(!se)return;const{data:Ee,error:Le}=await ce.from("processing_events").select("*").eq("user_id",se.id).eq("agent_state","Completed").order("created_at",{ascending:!1}).limit(50);if(Le){console.error("Error fetching sync runs:",Le);return}const B=(Ee||[]).map(le=>{const pe=le.metadata||{},Ye=pe.errors||0,tt=pe.signals_found||0,xn=pe.skipped||0;return{id:le.id,started_at:le.created_at,completed_at:le.created_at,duration_ms:le.duration_ms||0,signals_found:tt,urls_processed:pe.total_urls||0,skipped:xn,errors:Ye,status:Ye>0?"partial":tt>0?"success":"failed"}});n(B)}catch(se){console.error("Failed to fetch sync runs:",se)}finally{o(!1)}},We=async se=>{k(!0);try{const{data:{user:Ee}}=await ce.auth.getUser();if(!Ee)return;const Le=t.find(Y=>Y.id===se);if(!Le)return;const B=new Date(new Date(Le.started_at).getTime()-Le.duration_ms),le=new Date(Le.completed_at),{data:pe,error:Ye}=await ce.from("processing_events").select("*").eq("user_id",Ee.id).gte("created_at",B.toISOString()).lte("created_at",le.toISOString()).order("created_at",{ascending:!0});if(Ye){console.error("Error fetching run events:",Ye);return}m(pe||[]);const tt=[],xn=(pe||[]).filter(Y=>Y.agent_state==="Mining"&&Y.message.includes("Mining source:"));for(const Y of xn){const je=Y.message.match(/Mining source: (.+) \((.+)\)/);if(je){const De=je[1],Me=je[2],nt=(pe||[]).find(Dt=>Dt.agent_state==="Mining"&&Dt.message.includes("Found")&&Dt.message.includes(De)&&Dt.created_at>Y.created_at),Ct=nt?.message.match(/Found (\d+) URLs/),_t=Ct?parseInt(Ct[1]):0;tt.push({label:De,browser:Me,urls_found:_t,duration_ms:nt?.duration_ms||0,status:Y.event_type==="error"?"error":"success"})}}x(tt);const sr=[],W=(pe||[]).filter(Y=>Y.agent_state==="Reading");for(const Y of W){const je=Y.message.match(/Reading content from: (.+)/);if(!je)continue;const De=je[1];let Me=tt.length>0?tt[0].label:"Unknown";const nt=tt.filter(Je=>Je.urls_found>0);(nt.length===1||nt.length>1)&&(Me=nt[0].label),console.log(`[SystemLogs] URL ${De} assigned to source: ${Me}`);const Ct=(pe||[]).find(Je=>Je.agent_state==="Signal"&&Je.created_at>Y.created_at&&Je.message.includes("Found signal")),_t=(pe||[]).find(Je=>Je.agent_state==="Skipped"&&Je.created_at>Y.created_at&&Je.message.includes("Irrelevant content")),Dt=(pe||[]).find(Je=>Je.event_type==="error"&&Je.created_at>Y.created_at);if(Ct){const Je=Ct.message.match(/\((\d+)%\)/),pt=Je?parseInt(Je[1]):0;sr.push({url:De,result:"signal",score:pt,category:Ct.details?.category||"Unknown",duration_ms:Ct.duration_ms,source_label:Me})}else if(_t){const Je=_t.message.match(/\((\d+)%\): (.+)/),pt=Je?parseInt(Je[1]):0,vn=Je?Je[2]:"Irrelevant";sr.push({url:De,result:"skipped",score:pt,reason:vn,duration_ms:_t.duration_ms,source_label:Me})}else Dt&&sr.push({url:De,result:"error",reason:Dt.message,source_label:Me})}b(sr)}catch(Ee){console.error("Failed to fetch run details:",Ee)}finally{k(!1)}},It=se=>{a===se?(l(null),d(null),x([]),b([])):(l(se),d(null),We(se))},rr=se=>{d(c===se?null:se)},yn=se=>{if(se<1e3)return`${se}ms`;const Ee=Math.floor(se/1e3);if(Ee<60)return`${Ee}s`;const Le=Math.floor(Ee/60),B=Ee%60;return`${Le}m ${B}s`},qn=se=>{switch(se){case"success":return h.jsx(vs,{className:"w-5 h-5 text-success"});case"failed":return h.jsx(os,{className:"w-5 h-5 text-error"});case"partial":return h.jsx(Br,{className:"w-5 h-5 text-warning"});default:return h.jsx(gi,{className:"w-5 h-5 text-fg/40"})}},Nn=se=>{switch(se){case"signal":return h.jsx(Bn,{className:"w-4 h-4 text-primary"});case"skipped":return h.jsx(TS,{className:"w-4 h-4 text-fg/40"});case"error":return h.jsx(os,{className:"w-4 h-4 text-error"});default:return null}};return r?h.jsx("div",{className:"flex items-center justify-center h-full",children:h.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden p-8",children:[h.jsxs("div",{className:"mb-6",children:[h.jsx("h2",{className:"text-2xl font-bold",children:"System Logs"}),h.jsx("p",{className:"text-sm text-fg/50",children:"Detailed history of sync runs, sources, and URL processing"}),h.jsxs("div",{className:"grid grid-cols-3 gap-4 mt-6",children:[h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group relative overflow-hidden",onClick:()=>j(!0),children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:"Potential Blacklist"}),h.jsx(Br,{size:16,className:"text-orange-400"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:ae.length>0?ae.length:"--"}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:"Candidates for blocking"}),ae.length>0&&h.jsxs("div",{className:"absolute top-2 right-2 flex h-2 w-2",children:[h.jsx("span",{className:"animate-ping absolute inline-flex h-full w-full rounded-full bg-orange-400 opacity-75"}),h.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-orange-400"})]})]}),h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group",onClick:()=>{L(!0),he()},children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:"Recent Errors"}),h.jsx(os,{size:16,className:"text-error"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:ye.errors}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:"Failed URL processes"})]}),h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 hover:bg-surface/50 transition-colors cursor-pointer group",onClick:()=>{O(!0),Ne()},children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsx("span",{className:"text-xs font-bold uppercase tracking-wider text-fg/40",children:"Total Signals"}),h.jsx(Bn,{size:16,className:"text-primary"})]}),h.jsx("div",{className:"text-2xl font-black text-fg/90",children:ye.signals}),h.jsx("div",{className:"text-[10px] text-fg/40 mt-1",children:"Successfully mined"})]})]})]}),h.jsxs(Zt,{children:[_&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs($e.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(Br,{className:"text-orange-400"}),"Blacklist Suggestions"]}),h.jsx("p",{className:"text-sm text-fg/60",children:"Review domains suggested for blacklisting based on low scores."})]}),h.jsx("button",{onClick:()=>j(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(os,{size:20,className:"text-fg/40"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10 space-y-4",children:ae.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx("div",{className:"bg-surface/50 w-16 h-16 rounded-full flex items-center justify-center mx-auto mb-4",children:h.jsx(vs,{size:32,className:"text-success"})}),h.jsx("p",{className:"font-medium",children:"No suggestions right now"}),h.jsx("p",{className:"text-xs opacity-70 mt-1",children:"Your signal quality looks good!"})]}):ae.map((se,Ee)=>h.jsxs("div",{className:"glass p-4 rounded-xl border border-border/10 flex items-center justify-between group hover:border-primary/20 transition-all",children:[h.jsxs("div",{children:[h.jsx("div",{className:"font-mono text-sm font-bold text-fg/90",children:se.domain}),h.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[h.jsxs("span",{className:"text-[10px] bg-surface px-1.5 py-0.5 rounded text-fg/50",children:[se.signalCount," signals"]}),h.jsxs("span",{className:"text-[10px] bg-surface px-1.5 py-0.5 rounded text-fg/50",children:["Avg Score: ",se.avgScore]}),h.jsx("span",{className:"text-[10px] text-orange-400 font-medium",children:se.reason==="low_score"?"Consistently Low Quality":"Repetitive Pattern"})]})]}),h.jsx("button",{onClick:async()=>{const{data:{user:Le}}=await ce.auth.getUser();if(Le){const{data:B}=await ce.from("alchemy_settings").select("blacklist_domains").eq("user_id",Le.id).single(),le=B?.blacklist_domains||[];le.includes(se.domain)||await ce.from("alchemy_settings").update({blacklist_domains:[...le,se.domain]}).eq("user_id",Le.id),T(pe=>pe.filter(Ye=>Ye.domain!==se.domain))}},className:"px-4 py-2 bg-orange-500/10 text-orange-500 hover:bg-orange-500 hover:text-white rounded-lg text-xs font-bold transition-all border border-orange-500/20",children:"Blacklist Domain"})]},Ee))})]})}),C&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs($e.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(os,{className:"text-error"}),"Recent Errors"]}),h.jsx("p",{className:"text-sm text-fg/60",children:"Log of recent failures and issues."})]}),h.jsx("button",{onClick:()=>L(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(os,{size:20,className:"text-fg/40"})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10 space-y-3",children:I.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx(vs,{size:32,className:"mx-auto mb-4 text-success opacity-50"}),h.jsx("p",{children:"No recent errors found."})]}):I.map((se,Ee)=>h.jsxs("div",{className:"glass p-4 rounded-xl border border-error/20 bg-error/5 flex items-start gap-3",children:[h.jsx(Br,{size:16,className:"text-error mt-0.5 shrink-0"}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center justify-between mb-1",children:[h.jsx("span",{className:"text-xs font-mono text-fg/40",children:new Date(se.created_at).toLocaleString()}),h.jsx("span",{className:"text-[10px] font-bold uppercase tracking-wider text-error",children:se.agent_state})]}),h.jsx("p",{className:"text-sm font-mono text-fg/90 break-words",children:se.message}),se.details&&Object.keys(se.details).length>0&&h.jsx("pre",{className:"mt-2 p-2 bg-black/20 rounded text-[10px] text-fg/60 overflow-x-auto",children:JSON.stringify(se.details,null,2)})]})]},Ee))})]})})]}),h.jsx(Zt,{children:U&&h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 backdrop-blur-sm",children:h.jsxs($e.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.95},className:"bg-bg border border-border rounded-xl shadow-2xl w-full max-w-5xl h-[85vh] flex flex-col overflow-hidden",children:[h.jsxs("div",{className:"p-6 border-b border-border bg-surface/30 space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsxs("h3",{className:"text-xl font-bold flex items-center gap-2",children:[h.jsx(Bn,{className:"text-primary"}),"Found Signals"]}),h.jsx("p",{className:"text-sm text-fg/60",children:"Browse and manage your mined signals history."})]}),h.jsx("button",{onClick:()=>O(!1),className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(os,{size:20,className:"text-fg/40"})})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("div",{className:"relative flex-1",children:[h.jsx("input",{type:"text",placeholder:"Search signals...",className:"w-full bg-black/5 border border-border/20 rounded-lg pl-9 pr-4 py-2 text-sm text-fg focus:ring-2 focus:ring-primary/20 focus:border-primary/50 outline-none",value:ie,onChange:se=>{oe(se.target.value),ge(0)},onKeyDown:se=>se.key==="Enter"&&Ne(0)}),h.jsx(Il,{className:"absolute left-3 top-2.5 w-4 h-4 text-fg/40"})]}),h.jsxs("select",{className:"bg-black/5 border border-border/20 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:border-primary/50",value:Q||"all",onChange:se=>{we(se.target.value),ge(0)},children:[h.jsx("option",{value:"all",children:"Any Score"}),h.jsx("option",{value:"high",children:"High (80%+)"}),h.jsx("option",{value:"medium",children:"Medium (50-79%)"}),h.jsx("option",{value:"low",children:"Low (<50%)"})]}),h.jsxs("select",{className:"bg-black/5 border border-border/20 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:border-primary/50",value:Se||"",onChange:se=>{re(se.target.value||null),ge(0)},children:[h.jsx("option",{value:"",children:"All Categories"}),h.jsx("option",{value:"AI & ML",children:"AI & ML"}),h.jsx("option",{value:"Technology",children:"Technology"}),h.jsx("option",{value:"Business",children:"Business"}),h.jsx("option",{value:"Finance",children:"Finance"}),h.jsx("option",{value:"Politics",children:"Politics"}),h.jsx("option",{value:"Science",children:"Science"}),h.jsx("option",{value:"Crypto",children:"Crypto"}),h.jsx("option",{value:"Other",children:"Other"})]}),h.jsxs("div",{className:"flex items-center gap-2 border-l border-border/10 pl-4",children:[h.jsx("button",{disabled:X===0,onClick:()=>ge(se=>Math.max(0,se-1)),className:"p-2 hover:bg-surface rounded-lg disabled:opacity-30 transition-colors",children:h.jsx(iS,{size:20})}),h.jsxs("span",{className:"text-xs font-mono text-fg/50 w-16 text-center",children:["Page ",X+1]}),h.jsx("button",{disabled:N.length<20,onClick:()=>ge(se=>se+1),className:"p-2 hover:bg-surface rounded-lg disabled:opacity-30 transition-colors",children:h.jsx(jl,{size:20})})]})]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-6 bg-surface/10",children:me?h.jsx("div",{className:"h-full flex items-center justify-center",children:h.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):N.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center text-fg/40 gap-4",children:[h.jsx("div",{className:"w-16 h-16 rounded-full bg-surface/50 flex items-center justify-center",children:h.jsx(Bn,{size:32,className:"opacity-50"})}),h.jsx("p",{children:"No signals found matching your criteria."})]}):h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:N.map(se=>h.jsx(ob,{signal:se,onOpen:Ee=>window.open(Ee,"_blank"),onFavourite:async(Ee,Le)=>{const B=!Le;ne(le=>le.map(pe=>pe.id===Ee?{...pe,is_favorite:B}:pe)),await ce.from("signals").update({is_favorite:B}).eq("id",Ee)},onBoost:async(Ee,Le)=>{const B=!Le;ne(le=>le.map(pe=>pe.id===Ee?{...pe,is_boosted:B}:pe)),await ce.from("signals").update({is_boosted:B}).eq("id",Ee)},onDismiss:async(Ee,Le)=>{const B=!Le;ne(le=>le.map(pe=>pe.id===Ee?{...pe,is_dismissed:B}:pe)),await ce.from("signals").update({is_dismissed:B}).eq("id",Ee)},onNote:(Ee,Le,B)=>V({id:Ee,note:Le,title:B})},se.id))})})]})})}),q&&h.jsx(ab,{isOpen:!!q,onClose:()=>V(null),title:q.title,initialNote:q.note,onSave:async se=>{q&&(ne(Ee=>Ee.map(Le=>Le.id===q.id?{...Le,user_notes:se}:Le)),await ce.from("signals").update({user_notes:se}).eq("id",q.id),V(null))}}),h.jsx("div",{className:"flex-1 overflow-y-auto custom-scrollbar",children:t.length===0?h.jsxs("div",{className:"text-center py-12 text-fg/40",children:[h.jsx(gi,{className:"w-12 h-12 mx-auto mb-4 opacity-50"}),h.jsx("p",{children:"No sync runs yet"})]}):h.jsx("div",{className:"space-y-2",children:t.map(se=>h.jsxs("div",{className:"glass rounded-xl overflow-hidden",children:[h.jsxs("button",{onClick:()=>It(se.id),className:"w-full p-4 flex items-center gap-4 hover:bg-surface/50 transition-colors text-left",children:[a===se.id?h.jsx(mi,{className:"w-5 h-5 text-primary shrink-0"}):h.jsx(jl,{className:"w-5 h-5 text-fg/40 shrink-0"}),qn(se.status),h.jsxs("div",{className:"flex-1 grid grid-cols-6 gap-4 items-center",children:[h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Timestamp"}),h.jsx("div",{className:"text-sm font-mono",children:new Date(se.started_at).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Duration"}),h.jsx("div",{className:"text-sm font-mono",children:yn(se.duration_ms)})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Signals"}),h.jsx("div",{className:"text-sm font-semibold text-primary",children:se.signals_found})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Skipped"}),h.jsx("div",{className:"text-sm font-semibold text-fg/60",children:se.skipped})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"URLs"}),h.jsx("div",{className:"text-sm font-semibold",children:se.urls_processed})]}),h.jsxs("div",{children:[h.jsx("div",{className:"text-xs text-fg/40 uppercase tracking-wider",children:"Errors"}),h.jsx("div",{className:`text-sm font-semibold ${se.errors>0?"text-error":"text-fg/40"}`,children:se.errors})]})]})]}),h.jsx(Zt,{children:a===se.id&&h.jsx($e.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border overflow-hidden",children:h.jsx("div",{className:"p-4 bg-surface/30 space-y-2",children:E?h.jsx("div",{className:"flex items-center justify-center py-8",children:h.jsx("div",{className:"w-8 h-8 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):y.length===0?h.jsx("div",{className:"text-center py-4 text-fg/40 text-sm",children:"No source details available"}):y.map((Ee,Le)=>h.jsxs("div",{className:"glass rounded-lg overflow-hidden",children:[h.jsxs("button",{onClick:()=>rr(Ee.label),className:"w-full p-3 flex items-center gap-3 hover:bg-surface/50 transition-colors text-left",children:[c===Ee.label?h.jsx(mi,{className:"w-4 h-4 text-primary shrink-0"}):h.jsx(jl,{className:"w-4 h-4 text-fg/40 shrink-0"}),h.jsxs("div",{className:"flex-1 flex items-center gap-4",children:[h.jsxs("div",{className:"flex-1",children:[h.jsx("div",{className:"text-sm font-semibold",children:Ee.label}),h.jsx("div",{className:"text-xs text-fg/40",children:Ee.browser})]}),h.jsxs("div",{className:"text-right",children:[h.jsx("div",{className:"text-xs text-fg/40",children:"URLs Found"}),h.jsx("div",{className:"text-sm font-semibold",children:Ee.urls_found})]}),h.jsxs("div",{className:"text-right",children:[h.jsx("div",{className:"text-xs text-fg/40",children:"Duration"}),h.jsx("div",{className:"text-sm font-mono",children:yn(Ee.duration_ms)})]})]})]}),h.jsx(Zt,{children:c===Ee.label&&h.jsx($e.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2},className:"border-t border-border overflow-hidden",children:h.jsx("div",{className:"p-3 bg-surface/50 max-h-96 overflow-y-auto custom-scrollbar space-y-1",children:w.filter(B=>B.source_label===Ee.label).length===0?h.jsx("div",{className:"text-center py-4 text-fg/40 text-xs",children:"No URL details available for this source"}):w.filter(B=>B.source_label===Ee.label).map((B,le)=>h.jsxs("div",{className:"flex items-center gap-2 p-2 rounded bg-surface/30 hover:bg-surface/50 transition-colors",children:[Nn(B.result),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsx("div",{className:"text-xs font-mono truncate text-fg/80",children:B.url}),B.result==="signal"&&h.jsxs("div",{className:"text-[10px] text-primary",children:["Signal (",B.score,"%) - ",B.category]}),B.result==="skipped"&&h.jsxs("div",{className:"text-[10px] text-fg/40",children:["Skipped (",B.score,"%) - ",B.reason]}),B.result==="error"&&h.jsxs("div",{className:"text-[10px] text-error",children:["Error: ",B.reason]})]}),h.jsx("a",{href:B.url,target:"_blank",rel:"noopener noreferrer",className:"p-1 hover:bg-surface rounded",onClick:pe=>pe.stopPropagation(),children:h.jsx(bi,{className:"w-3 h-3 text-fg/40"})})]},le))})})})]},Le))})})})]},se.id))})})]})}function BP({signals:e,limit:t=10,onSignalClick:n}){const r=e.slice(0,t),[o,a]=P.useState(()=>{const d=localStorage.getItem("newSignalsFeedExpanded");return d!==null?d==="true":!0});P.useEffect(()=>{localStorage.setItem("newSignalsFeedExpanded",String(o))},[o]);const l=d=>d>=80?"bg-yellow-400/20 text-yellow-400 border-yellow-400/30":d>=50?"bg-blue-400/20 text-blue-400 border-blue-400/30":"bg-gray-400/20 text-gray-400 border-gray-400/30",c=d=>{const p=new Date(d),y=new Date().getTime()-p.getTime(),x=Math.floor(y/6e4),w=Math.floor(y/36e5);return x<1?"Just now":x<60?`${x}m ago`:w<24?`${w}h ago`:p.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return r.length===0?null:h.jsxs("div",{className:"mb-3",children:[h.jsxs("button",{onClick:()=>a(!o),className:"w-full flex items-center justify-between mb-2 px-1 py-1 hover:bg-surface/30 rounded-lg transition-colors",children:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsxs("h3",{className:"text-sm font-semibold text-fg/70 uppercase tracking-wide",children:["New Signals (",r.length,")"]})}),o?h.jsx(Ox,{size:16,className:"text-fg/40"}):h.jsx(mi,{size:16,className:"text-fg/40"})]}),h.jsx(Zt,{children:o&&h.jsx($e.div,{initial:{height:0,opacity:0,overflow:"hidden"},animate:{height:"auto",opacity:1,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden"},transition:{duration:.2},className:"py-3",children:h.jsx("div",{className:"overflow-x-auto pb-2 -mx-4 px-4 scrollbar-on-hover",children:h.jsx("div",{className:"flex gap-3 min-w-max",children:r.map(d=>h.jsxs($e.button,{onClick:()=>n(d.id),whileHover:{scale:1.05},whileTap:{scale:.98},className:"flex-shrink-0 w-[120px] bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-3 hover:border-[var(--border-hover)] transition-all duration-300 text-left group relative z-0 hover:z-10",children:[h.jsx("div",{className:`w-12 h-12 rounded-full border-2 flex items-center justify-center mx-auto mb-2 ${l(d.score)}`,children:h.jsx("span",{className:"text-xl font-bold",children:d.score})}),h.jsx("p",{className:"text-xs text-fg line-clamp-2 mb-2 group-hover:text-blue-400 transition-colors",children:d.title}),h.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-fg/40",children:[h.jsx(gi,{size:10}),h.jsx("span",{children:c(d.created_at)})]})]},d.id))})})})})]})}function VP({category:e,signalCount:t,latestTimestamp:n,onClick:r}){const o=l=>{const c=new Date(l),p=new Date().getTime()-c.getTime(),m=Math.floor(p/6e4),y=Math.floor(p/36e5),x=Math.floor(p/864e5);return m<60?`${m}m ago`:y<24?`${y}h ago`:x<7?`${x}d ago`:c.toLocaleDateString("en-US",{month:"short",day:"numeric"})},a=e.icon;return h.jsxs($e.button,{whileHover:{scale:1.05},whileTap:{scale:.98},onClick:r,className:"bg-surface/50 backdrop-blur-sm border border-border rounded-lg p-6 cursor-pointer hover:border-[var(--border-hover)] transition-all duration-300 text-left w-full relative z-0 hover:z-10",children:[h.jsx("div",{className:"mb-4",children:h.jsx(a,{size:40,className:"text-current opacity-80"})}),h.jsx("h3",{className:"text-lg font-semibold mb-3 text-fg",children:e.name}),h.jsxs("div",{className:"flex items-center justify-between text-sm",children:[h.jsxs("span",{className:`px-2 py-1 rounded text-xs font-medium ${zP(e.color)}`,children:[t," ",t===1?"signal":"signals"]}),h.jsxs("span",{className:"text-fg/40 flex items-center gap-1 text-xs",children:[h.jsx(gi,{size:12}),o(n)]})]})]})}const qP=3;function HP({signals:e,onCategoryClick:t}){const{categories:n,categoryCounts:r}=P.useMemo(()=>{const o=new Map,a=new Map;e.forEach(p=>{const m=p.tags||[],y=ib(m,p.category);if(y){const x=o.get(y)||{count:0,latest:p.created_at};o.set(y,{count:x.count+1,latest:p.created_at>x.latest?p.created_at:x.latest})}else m.forEach(x=>{const w=x.toLowerCase().trim();if(w){a.set(w,(a.get(w)||0)+1);const b=o.get(w)||{count:0,latest:p.created_at};o.set(w,{count:b.count+1,latest:p.created_at>b.latest?p.created_at:b.latest})}})});const l=Array.from(a.entries()).filter(([p,m])=>m>=qP).map(([p,m])=>({id:p,name:p.charAt(0).toUpperCase()+p.slice(1),icon:pS,color:"gray",priority:2}));return{categories:[...Ko,...l,Pf].filter(p=>{const m=o.get(p.id);return m&&m.count>0}).sort((p,m)=>p.priority-m.priority),categoryCounts:o}},[e]);return n.length===0?h.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/20",children:[h.jsx("p",{className:"font-medium italic",children:"No categories yet."}),h.jsx("p",{className:"text-sm mt-2",children:"Signals will be organized here once discovered."})]}):h.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 p-2",children:n.map(o=>{const a=r.get(o.id);return h.jsx(VP,{category:o,signalCount:a.count,latestTimestamp:a.latest,onClick:()=>t(o.id)},o.id)})})}function WP({isOpen:e,onClose:t,categoryId:n,signals:r,onOpenUrl:o,onFavourite:a,onNote:l,onBoost:c,onDismiss:d}){const p=MP.find(k=>k.id===n),[m,y]=P.useState(null),x=r.filter(k=>{const _=k.tags||[],j=k.category?.toLowerCase()===n,C=_.some(L=>L.toLowerCase().includes(n));return j||C}),w=k=>{o?o(k):window.open(k,"_blank","noopener,noreferrer")},b=(k,_,j)=>{y({id:k,note:_,title:j})},E=async k=>{m&&l&&(await l(m.id,k),y(null))};return h.jsx(Zt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-40"}),h.jsxs($e.div,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"spring",damping:30,stiffness:300},className:"fixed right-0 top-0 h-full w-full md:w-2/3 lg:w-1/2 bg-bg border-l border-border z-50 overflow-y-auto custom-scrollbar",children:[h.jsx("div",{className:"sticky top-0 z-10 bg-bg/95 backdrop-blur-md border-b border-border p-6 shadow-sm",children:h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[p?.icon&&h.jsx("div",{className:"w-10 h-10 flex items-center justify-center bg-surface/50 rounded-xl border border-white/5",children:h.jsx(p.icon,{size:28,className:"text-primary"})}),h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold",children:p?.name}),h.jsxs("p",{className:"text-sm text-fg/50 font-mono",children:[x.length," ",x.length===1?"signal":"signals"]})]})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors text-fg/60 hover:text-fg","aria-label":"Close drawer",children:h.jsx(tr,{size:24})})]})}),h.jsx("div",{className:"p-6 space-y-4",children:x.length===0?h.jsxs("div",{className:"h-64 flex flex-col items-center justify-center text-fg/30 gap-2",children:[p?.icon&&h.jsx(p.icon,{size:48,className:"opacity-20"}),h.jsx("p",{className:"italic",children:"No signals in this category yet."})]}):x.map(k=>h.jsx(ob,{signal:k,onOpen:w,onFavourite:a,onNote:b,onBoost:c,onDismiss:d},k.id))})]}),m&&h.jsx(ab,{isOpen:!!m,onClose:()=>y(null),title:m.title,initialNote:m.note,onSave:E})]})})}function KP({onOpenUrl:e,onCopyText:t}){const[n,r]=P.useState([]),[o,a]=P.useState(!0),[l,c]=P.useState(null),[d,p]=P.useState(""),[m,y]=P.useState(null);P.useEffect(()=>{(async()=>{a(!0);let E=ce.from("signals").select("*").order("created_at",{ascending:!1}).limit(50);m&&(E=E.ilike("category",m)),d&&(E=E.or(`title.ilike.%${d}%,summary.ilike.%${d}%,url.ilike.%${d}%`));const{data:k,error:_}=await E;_?console.error("Error fetching signals:",_):r(k||[]),a(!1)})();const b=ce.channel("signals").on("postgres_changes",{event:"INSERT",schema:"public",table:"signals"},E=>{r(k=>[E.new,...k])}).subscribe();return()=>{b.unsubscribe()}},[d,m]);const x=w=>{e?e(w):window.open(w,"_blank","noopener,noreferrer")};return h.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[h.jsx("div",{className:"px-4 pt-2",children:h.jsx(BP,{signals:n,limit:10,onSignalClick:w=>{const b=n.find(E=>E.id===w);b&&b.category&&c(b.category.toLowerCase())}})}),h.jsxs("div",{className:"px-4 pt-1 pb-2 space-y-3",children:[h.jsxs("div",{className:"relative",children:[h.jsx(Il,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-fg/40"}),h.jsx("input",{type:"text",placeholder:"Search signals by title, summary, or URL...",value:d,onChange:w=>p(w.target.value),className:"w-full bg-surface border border-border/20 rounded-xl py-3 pl-10 pr-10 text-sm text-fg placeholder:text-fg/40 focus:border-primary/50 focus:ring-2 focus:ring-primary/20 outline-none transition-all"}),d&&h.jsx("button",{onClick:()=>p(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-fg/40 hover:text-fg transition-colors",title:"Clear search",children:h.jsx(tr,{size:16})})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[h.jsx(dS,{className:"w-3.5 h-3.5 text-fg/40"}),h.jsx("button",{onClick:()=>y(null),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${m===null?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:"All"}),["AI & ML","Business","Politics","Technology","Finance","Crypto","Science","Other"].map(w=>h.jsx("button",{onClick:()=>y(w),className:`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${m===w?"bg-primary text-white shadow-sm":"bg-surface hover:bg-surface/80 text-fg/60 hover:text-fg border border-border/20"}`,children:w},w))]})]}),h.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-12 scrollbar-on-hover",children:o?h.jsx("div",{className:"h-64 flex items-center justify-center text-fg/30",children:h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-400"})}):h.jsx(HP,{signals:n,onCategoryClick:w=>c(w)})}),h.jsx(WP,{isOpen:!!l,onClose:()=>c(null),categoryId:l||"",signals:n,onOpenUrl:x,onFavourite:async(w,b)=>{const E=!b;r(_=>_.map(j=>j.id===w?{...j,is_favorite:E}:j));const{error:k}=await ce.from("signals").update({is_favorite:E}).eq("id",w);k&&(console.error("Failed to update favorite:",k),r(_=>_.map(j=>j.id===w?{...j,is_favorite:b}:j)))},onNote:async(w,b)=>{r(k=>k.map(_=>_.id===w?{..._,user_notes:b}:_));const{error:E}=await ce.from("signals").update({user_notes:b}).eq("id",w);E&&console.error("Failed to update note:",E)},onBoost:async(w,b)=>{const E=!b;r(_=>_.map(j=>j.id===w?{...j,is_boosted:E}:j));const{error:k}=await ce.from("signals").update({is_boosted:E}).eq("id",w);k&&(console.error("Failed to update boost:",k),r(_=>_.map(j=>j.id===w?{...j,is_boosted:b}:j)))},onDismiss:async(w,b)=>{const E=!b;r(_=>_.map(j=>j.id===w?{...j,is_dismissed:E}:j));const{error:k}=await ce.from("signals").update({is_dismissed:E}).eq("id",w);k&&(console.error("Failed to update dismiss:",k),r(_=>_.map(j=>j.id===w?{...j,is_dismissed:b}:j)))}})]})}function GP({activeSessionId:e,onSelectSession:t}){const[n,r]=P.useState([]),[o,a]=P.useState(!0);P.useEffect(()=>{l()},[]);const l=async()=>{try{const{data:{session:d}}=await ce.auth.getSession();if(!d)return;const p=await He.get("/api/chat/sessions",{headers:{"x-user-id":d.user.id}});p.data.success&&r(p.data.sessions)}catch(d){console.error("Failed to fetch sessions",d)}finally{a(!1)}},c=async(d,p)=>{d.stopPropagation();try{const{error:m}=await ce.from("chat_sessions").delete().eq("id",p);m||(r(y=>y.filter(x=>x.id!==p)),e===p&&t(null))}catch(m){console.error(m)}};return h.jsxs("div",{className:"w-64 glass flex flex-col rounded-2xl border border-border/40 overflow-hidden",children:[h.jsx("div",{className:"p-3 border-b border-border/10",children:h.jsxs("button",{onClick:()=>t(null),className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-primary/10 hover:bg-primary/20 text-primary rounded-xl transition-all font-semibold text-sm border border-primary/20",children:[h.jsx(Dx,{size:16}),"New Chat"]})}),h.jsx("div",{className:"flex-1 overflow-y-auto p-2 space-y-1",children:o?h.jsx("div",{className:"p-4 text-center text-xs text-fg/40",children:"Loading..."}):n.length===0?h.jsxs("div",{className:"p-8 text-center",children:[h.jsx(Kd,{size:24,className:"mx-auto text-fg/20 mb-2"}),h.jsx("p",{className:"text-xs text-fg/40",children:"No history yet"})]}):n.map(d=>h.jsxs("div",{onClick:()=>t(d.id),className:`group flex items-center justify-between px-3 py-3 rounded-lg cursor-pointer transition-all text-sm ${e===d.id?"bg-surface border border-border/50 text-fg shadow-sm":"text-fg/60 hover:bg-surface/50 hover:text-fg border border-transparent"}`,children:[h.jsxs("div",{className:"flex items-center gap-2.5 overflow-hidden",children:[h.jsx(Kd,{size:14,className:e===d.id?"text-primary":"opacity-50"}),h.jsx("span",{className:"truncate",children:d.title})]}),h.jsx("button",{onClick:p=>c(p,d.id),className:"opacity-0 group-hover:opacity-100 p-1.5 hover:bg-red-500/10 hover:text-red-400 rounded transition-all",children:h.jsx(Mx,{size:12})})]},d.id))})]})}function JP(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const YP=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,XP=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,QP={};function K0(e,t){return(QP.jsx?XP:YP).test(e)}const ZP=/[ \t\n\f\r]/g;function eR(e){return typeof e=="object"?e.type==="text"?G0(e.value):!1:G0(e)}function G0(e){return e.replace(ZP,"")===""}class sa{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}sa.prototype.normal={};sa.prototype.property={};sa.prototype.space=void 0;function lb(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new sa(n,r,t)}function Th(e){return e.toLowerCase()}class rn{constructor(t,n){this.attribute=n,this.property=t}}rn.prototype.attribute="";rn.prototype.booleanish=!1;rn.prototype.boolean=!1;rn.prototype.commaOrSpaceSeparated=!1;rn.prototype.commaSeparated=!1;rn.prototype.defined=!1;rn.prototype.mustUseProperty=!1;rn.prototype.number=!1;rn.prototype.overloadedBoolean=!1;rn.prototype.property="";rn.prototype.spaceSeparated=!1;rn.prototype.space=void 0;let tR=0;const Ue=_s(),vt=_s(),Ch=_s(),ee=_s(),Ze=_s(),fi=_s(),dn=_s();function _s(){return 2**++tR}const Nh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ue,booleanish:vt,commaOrSpaceSeparated:dn,commaSeparated:fi,number:ee,overloadedBoolean:Ch,spaceSeparated:Ze},Symbol.toStringTag,{value:"Module"})),Od=Object.keys(Nh);class Rf extends rn{constructor(t,n,r,o){let a=-1;if(super(t,n),J0(this,"space",o),typeof r=="number")for(;++a<Od.length;){const l=Od[a];J0(this,Od[a],(r&Nh[l])===Nh[l])}}}Rf.prototype.defined=!0;function J0(e,t,n){n&&(e[t]=n)}function ji(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const a=new Rf(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Th(r)]=r,n[Th(a.attribute)]=r}return new sa(t,n,e.space)}const ub=ji({properties:{ariaActiveDescendant:null,ariaAtomic:vt,ariaAutoComplete:null,ariaBusy:vt,ariaChecked:vt,ariaColCount:ee,ariaColIndex:ee,ariaColSpan:ee,ariaControls:Ze,ariaCurrent:null,ariaDescribedBy:Ze,ariaDetails:null,ariaDisabled:vt,ariaDropEffect:Ze,ariaErrorMessage:null,ariaExpanded:vt,ariaFlowTo:Ze,ariaGrabbed:vt,ariaHasPopup:null,ariaHidden:vt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Ze,ariaLevel:ee,ariaLive:null,ariaModal:vt,ariaMultiLine:vt,ariaMultiSelectable:vt,ariaOrientation:null,ariaOwns:Ze,ariaPlaceholder:null,ariaPosInSet:ee,ariaPressed:vt,ariaReadOnly:vt,ariaRelevant:null,ariaRequired:vt,ariaRoleDescription:Ze,ariaRowCount:ee,ariaRowIndex:ee,ariaRowSpan:ee,ariaSelected:vt,ariaSetSize:ee,ariaSort:null,ariaValueMax:ee,ariaValueMin:ee,ariaValueNow:ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function cb(e,t){return t in e?e[t]:t}function db(e,t){return cb(e,t.toLowerCase())}const nR=ji({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:fi,acceptCharset:Ze,accessKey:Ze,action:null,allow:null,allowFullScreen:Ue,allowPaymentRequest:Ue,allowUserMedia:Ue,alt:null,as:null,async:Ue,autoCapitalize:null,autoComplete:Ze,autoFocus:Ue,autoPlay:Ue,blocking:Ze,capture:null,charSet:null,checked:Ue,cite:null,className:Ze,cols:ee,colSpan:null,content:null,contentEditable:vt,controls:Ue,controlsList:Ze,coords:ee|fi,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ue,defer:Ue,dir:null,dirName:null,disabled:Ue,download:Ch,draggable:vt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ue,formTarget:null,headers:Ze,height:ee,hidden:Ch,high:ee,href:null,hrefLang:null,htmlFor:Ze,httpEquiv:Ze,id:null,imageSizes:null,imageSrcSet:null,inert:Ue,inputMode:null,integrity:null,is:null,isMap:Ue,itemId:null,itemProp:Ze,itemRef:Ze,itemScope:Ue,itemType:Ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ue,low:ee,manifest:null,max:null,maxLength:ee,media:null,method:null,min:null,minLength:ee,multiple:Ue,muted:Ue,name:null,nonce:null,noModule:Ue,noValidate:Ue,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ue,optimum:ee,pattern:null,ping:Ze,placeholder:null,playsInline:Ue,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ue,referrerPolicy:null,rel:Ze,required:Ue,reversed:Ue,rows:ee,rowSpan:ee,sandbox:Ze,scope:null,scoped:Ue,seamless:Ue,selected:Ue,shadowRootClonable:Ue,shadowRootDelegatesFocus:Ue,shadowRootMode:null,shape:null,size:ee,sizes:null,slot:null,span:ee,spellCheck:vt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ee,step:null,style:null,tabIndex:ee,target:null,title:null,translate:null,type:null,typeMustMatch:Ue,useMap:null,value:vt,width:ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Ze,axis:null,background:null,bgColor:null,border:ee,borderColor:null,bottomMargin:ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ue,declare:Ue,event:null,face:null,frame:null,frameBorder:null,hSpace:ee,leftMargin:ee,link:null,longDesc:null,lowSrc:null,marginHeight:ee,marginWidth:ee,noResize:Ue,noHref:Ue,noShade:Ue,noWrap:Ue,object:null,profile:null,prompt:null,rev:null,rightMargin:ee,rules:null,scheme:null,scrolling:vt,standby:null,summary:null,text:null,topMargin:ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ue,disableRemotePlayback:Ue,prefix:null,property:null,results:ee,security:null,unselectable:null},space:"html",transform:db}),rR=ji({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:dn,accentHeight:ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ee,amplitude:ee,arabicForm:null,ascent:ee,attributeName:null,attributeType:null,azimuth:ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ee,by:null,calcMode:null,capHeight:ee,className:Ze,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ee,diffuseConstant:ee,direction:null,display:null,dur:null,divisor:ee,dominantBaseline:null,download:Ue,dx:null,dy:null,edgeMode:null,editable:null,elevation:ee,enableBackground:null,end:null,event:null,exponent:ee,externalResourcesRequired:null,fill:null,fillOpacity:ee,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:fi,g2:fi,glyphName:fi,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ee,horizOriginX:ee,horizOriginY:ee,id:null,ideographic:ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ee,k:ee,k1:ee,k2:ee,k3:ee,k4:ee,kernelMatrix:dn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ee,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ee,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ee,overlineThickness:ee,paintOrder:null,panose1:null,path:null,pathLength:ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ee,pointsAtY:ee,pointsAtZ:ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:dn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:dn,rev:dn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:dn,requiredFeatures:dn,requiredFonts:dn,requiredFormats:dn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ee,specularExponent:ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ee,strikethroughThickness:ee,string:null,stroke:null,strokeDashArray:dn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ee,strokeOpacity:ee,strokeWidth:null,style:null,surfaceScale:ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:dn,tabIndex:ee,tableValues:null,target:null,targetX:ee,targetY:ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:dn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ee,underlineThickness:ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ee,values:null,vAlphabetic:ee,vMathematical:ee,vectorEffect:null,vHanging:ee,vIdeographic:ee,version:null,vertAdvY:ee,vertOriginX:ee,vertOriginY:ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:cb}),hb=ji({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),fb=ji({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:db}),pb=ji({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),sR={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},iR=/[A-Z]/g,Y0=/-[a-z]/g,oR=/^data[-\w.:]+$/i;function aR(e,t){const n=Th(t);let r=t,o=rn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&oR.test(t)){if(t.charAt(4)==="-"){const a=t.slice(5).replace(Y0,uR);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{const a=t.slice(4);if(!Y0.test(a)){let l=a.replace(iR,lR);l.charAt(0)!=="-"&&(l="-"+l),t="data"+l}}o=Rf}return new o(r,t)}function lR(e){return"-"+e.toLowerCase()}function uR(e){return e.charAt(1).toUpperCase()}const cR=lb([ub,nR,hb,fb,pb],"html"),Of=lb([ub,rR,hb,fb,pb],"svg");function dR(e){return e.join(" ").trim()}var ti={},Id,X0;function hR(){if(X0)return Id;X0=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,o=/^:\s*/,a=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,l=/^[;\s]*/,c=/^\s+|\s+$/g,d=`
110
110
  `,p="/",m="*",y="",x="comment",w="declaration";function b(k,_){if(typeof k!="string")throw new TypeError("First argument must be a string");if(!k)return[];_=_||{};var j=1,C=1;function L(re){var Q=re.match(t);Q&&(j+=Q.length);var we=re.lastIndexOf(d);C=~we?re.length-we:C+re.length}function U(){var re={line:j,column:C};return function(Q){return Q.position=new O(re),X(),Q}}function O(re){this.start=re,this.end={line:j,column:C},this.source=_.source}O.prototype.content=k;function q(re){var Q=new Error(_.source+":"+j+":"+C+": "+re);if(Q.reason=re,Q.filename=_.source,Q.line=j,Q.column=C,Q.source=k,!_.silent)throw Q}function V(re){var Q=re.exec(k);if(Q){var we=Q[0];return L(we),k=k.slice(we.length),Q}}function X(){V(n)}function ge(re){var Q;for(re=re||[];Q=ie();)Q!==!1&&re.push(Q);return re}function ie(){var re=U();if(!(p!=k.charAt(0)||m!=k.charAt(1))){for(var Q=2;y!=k.charAt(Q)&&(m!=k.charAt(Q)||p!=k.charAt(Q+1));)++Q;if(Q+=2,y===k.charAt(Q-1))return q("End of comment missing");var we=k.slice(2,Q-2);return C+=2,L(we),k=k.slice(Q),C+=2,re({type:x,comment:we})}}function oe(){var re=U(),Q=V(r);if(Q){if(ie(),!V(o))return q("property missing ':'");var we=V(a),me=re({type:w,property:E(Q[0].replace(e,y)),value:we?E(we[0].replace(e,y)):y});return V(l),me}}function Se(){var re=[];ge(re);for(var Q;Q=oe();)Q!==!1&&(re.push(Q),ge(re));return re}return X(),Se()}function E(k){return k?k.replace(c,y):y}return Id=b,Id}var Q0;function fR(){if(Q0)return ti;Q0=1;var e=ti&&ti.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(ti,"__esModule",{value:!0}),ti.default=n;const t=e(hR());function n(r,o){let a=null;if(!r||typeof r!="string")return a;const l=(0,t.default)(r),c=typeof o=="function";return l.forEach(d=>{if(d.type!=="declaration")return;const{property:p,value:m}=d;c?o(p,m,d):m&&(a=a||{},a[p]=m)}),a}return ti}var po={},Z0;function pR(){if(Z0)return po;Z0=1,Object.defineProperty(po,"__esModule",{value:!0}),po.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,o=/^-(ms)-/,a=function(p){return!p||n.test(p)||e.test(p)},l=function(p,m){return m.toUpperCase()},c=function(p,m){return"".concat(m,"-")},d=function(p,m){return m===void 0&&(m={}),a(p)?p:(p=p.toLowerCase(),m.reactCompat?p=p.replace(o,c):p=p.replace(r,c),p.replace(t,l))};return po.camelCase=d,po}var mo,ex;function mR(){if(ex)return mo;ex=1;var e=mo&&mo.__importDefault||function(o){return o&&o.__esModule?o:{default:o}},t=e(fR()),n=pR();function r(o,a){var l={};return!o||typeof o!="string"||(0,t.default)(o,function(c,d){c&&d&&(l[(0,n.camelCase)(c,a)]=d)}),l}return r.default=r,mo=r,mo}var gR=mR();const yR=Jl(gR),mb=gb("end"),If=gb("start");function gb(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function xR(e){const t=If(e),n=mb(e);if(t&&n)return{start:t,end:n}}function Ao(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?tx(e.position):"start"in e||"end"in e?tx(e):"line"in e||"column"in e?Ah(e):""}function Ah(e){return nx(e&&e.line)+":"+nx(e&&e.column)}function tx(e){return Ah(e&&e.start)+"-"+Ah(e&&e.end)}function nx(e){return e&&typeof e=="number"?e:1}class Vt extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let o="",a={},l=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?o=t:!a.cause&&t&&(l=!0,o=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){const d=r.indexOf(":");d===-1?a.ruleId=r:(a.source=r.slice(0,d),a.ruleId=r.slice(d+1))}if(!a.place&&a.ancestors&&a.ancestors){const d=a.ancestors[a.ancestors.length-1];d&&(a.place=d.position)}const c=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=c?c.column:void 0,this.fatal=void 0,this.file="",this.message=o,this.line=c?c.line:void 0,this.name=Ao(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=l&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Vt.prototype.file="";Vt.prototype.name="";Vt.prototype.reason="";Vt.prototype.message="";Vt.prototype.stack="";Vt.prototype.column=void 0;Vt.prototype.line=void 0;Vt.prototype.ancestors=void 0;Vt.prototype.cause=void 0;Vt.prototype.fatal=void 0;Vt.prototype.place=void 0;Vt.prototype.ruleId=void 0;Vt.prototype.source=void 0;const Df={}.hasOwnProperty,vR=new Map,wR=/[A-Z]/g,bR=new Set(["table","tbody","thead","tfoot","tr"]),kR=new Set(["td","th"]),yb="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function SR(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=PR(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=AR(n,t.jsx,t.jsxs)}const o={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Of:cR,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=xb(o,e,void 0);return a&&typeof a!="string"?a:o.create(e,o.Fragment,{children:a||void 0},void 0)}function xb(e,t,n){if(t.type==="element")return _R(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return ER(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return TR(e,t,n);if(t.type==="mdxjsEsm")return jR(e,t);if(t.type==="root")return CR(e,t,n);if(t.type==="text")return NR(e,t)}function _R(e,t,n){const r=e.schema;let o=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(o=Of,e.schema=o),e.ancestors.push(t);const a=wb(e,t.tagName,!1),l=RR(e,t);let c=Mf(e,t);return bR.has(t.tagName)&&(c=c.filter(function(d){return typeof d=="string"?!eR(d):!0})),vb(e,l,a,t),Lf(l,c),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function ER(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Go(e,t.position)}function jR(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Go(e,t.position)}function TR(e,t,n){const r=e.schema;let o=r;t.name==="svg"&&r.space==="html"&&(o=Of,e.schema=o),e.ancestors.push(t);const a=t.name===null?e.Fragment:wb(e,t.name,!0),l=OR(e,t),c=Mf(e,t);return vb(e,l,a,t),Lf(l,c),e.ancestors.pop(),e.schema=r,e.create(t,a,l,n)}function CR(e,t,n){const r={};return Lf(r,Mf(e,t)),e.create(t,e.Fragment,r,n)}function NR(e,t){return t.value}function vb(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Lf(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function AR(e,t,n){return r;function r(o,a,l,c){const p=Array.isArray(l.children)?n:t;return c?p(a,l,c):p(a,l)}}function PR(e,t){return n;function n(r,o,a,l){const c=Array.isArray(a.children),d=If(r);return t(o,a,l,c,{columnNumber:d?d.column-1:void 0,fileName:e,lineNumber:d?d.line:void 0},void 0)}}function RR(e,t){const n={};let r,o;for(o in t.properties)if(o!=="children"&&Df.call(t.properties,o)){const a=IR(e,o,t.properties[o]);if(a){const[l,c]=a;e.tableCellAlignToStyle&&l==="align"&&typeof c=="string"&&kR.has(t.tagName)?r=c:n[l]=c}}if(r){const a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function OR(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const a=r.data.estree.body[0];a.type;const l=a.expression;l.type;const c=l.properties[0];c.type,Object.assign(n,e.evaluater.evaluateExpression(c.argument))}else Go(e,t.position);else{const o=r.name;let a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const c=r.value.data.estree.body[0];c.type,a=e.evaluater.evaluateExpression(c.expression)}else Go(e,t.position);else a=r.value===null?!0:r.value;n[o]=a}return n}function Mf(e,t){const n=[];let r=-1;const o=e.passKeys?new Map:vR;for(;++r<t.children.length;){const a=t.children[r];let l;if(e.passKeys){const d=a.type==="element"?a.tagName:a.type==="mdxJsxFlowElement"||a.type==="mdxJsxTextElement"?a.name:void 0;if(d){const p=o.get(d)||0;l=d+"-"+p,o.set(d,p+1)}}const c=xb(e,a,l);c!==void 0&&n.push(c)}return n}function IR(e,t,n){const r=aR(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?JP(n):dR(n)),r.property==="style"){let o=typeof n=="object"?n:DR(e,String(n));return e.stylePropertyNameCase==="css"&&(o=LR(o)),["style",o]}return[e.elementAttributeNameCase==="react"&&r.space?sR[r.property]||r.property:r.attribute,n]}}function DR(e,t){try{return yR(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,o=new Vt("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw o.file=e.filePath||void 0,o.url=yb+"#cannot-parse-style-attribute",o}}function wb(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const o=t.split(".");let a=-1,l;for(;++a<o.length;){const c=K0(o[a])?{type:"Identifier",name:o[a]}:{type:"Literal",value:o[a]};l=l?{type:"MemberExpression",object:l,property:c,computed:!!(a&&c.type==="Literal"),optional:!1}:c}r=l}else r=K0(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const o=r.value;return Df.call(e.components,o)?e.components[o]:o}if(e.evaluater)return e.evaluater.evaluateExpression(r);Go(e)}function Go(e,t){const n=new Vt("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=yb+"#cannot-handle-mdx-estrees-without-createevaluater",n}function LR(e){const t={};let n;for(n in e)Df.call(e,n)&&(t[MR(n)]=e[n]);return t}function MR(e){let t=e.replace(wR,zR);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function zR(e){return"-"+e.toLowerCase()}const Dd={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},UR={};function FR(e,t){const n=UR,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return bb(e,r,o)}function bb(e,t,n){if($R(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return rx(e.children,t,n)}return Array.isArray(e)?rx(e,t,n):""}function rx(e,t,n){const r=[];let o=-1;for(;++o<e.length;)r[o]=bb(e[o],t,n);return r.join("")}function $R(e){return!!(e&&typeof e=="object")}const sx=document.createElement("i");function zf(e){const t="&"+e+";";sx.innerHTML=t;const n=sx.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function nr(e,t,n,r){const o=e.length;let a=0,l;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)l=Array.from(r),l.unshift(t,n),e.splice(...l);else for(n&&e.splice(t,n);a<r.length;)l=r.slice(a,a+1e4),l.unshift(t,0),e.splice(...l),a+=1e4,t+=1e4}function Cn(e,t){return e.length>0?(nr(e,e.length,0,t),e):t}const ix={}.hasOwnProperty;function BR(e){const t={};let n=-1;for(;++n<e.length;)VR(t,e[n]);return t}function VR(e,t){let n;for(n in t){const o=(ix.call(e,n)?e[n]:void 0)||(e[n]={}),a=t[n];let l;if(a)for(l in a){ix.call(o,l)||(o[l]=[]);const c=a[l];qR(o[l],Array.isArray(c)?c:c?[c]:[])}}}function qR(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);nr(e,0,0,r)}function kb(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function pi(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Qn=Wr(/[A-Za-z]/),pn=Wr(/[\dA-Za-z]/),HR=Wr(/[#-'*+\--9=?A-Z^-~]/);function Ph(e){return e!==null&&(e<32||e===127)}const Rh=Wr(/\d/),WR=Wr(/[\dA-Fa-f]/),KR=Wr(/[!-/:-@[-`{-~]/);function Ie(e){return e!==null&&e<-2}function nn(e){return e!==null&&(e<0||e===32)}function Ke(e){return e===-2||e===-1||e===32}const GR=Wr(new RegExp("\\p{P}|\\p{S}","u")),JR=Wr(/\s/);function Wr(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Ti(e){const t=[];let n=-1,r=0,o=0;for(;++n<e.length;){const a=e.charCodeAt(n);let l="";if(a===37&&pn(e.charCodeAt(n+1))&&pn(e.charCodeAt(n+2)))o=2;else if(a<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(a))||(l=String.fromCharCode(a));else if(a>55295&&a<57344){const c=e.charCodeAt(n+1);a<56320&&c>56319&&c<57344?(l=String.fromCharCode(a,c),o=1):l="�"}else l=String.fromCharCode(a);l&&(t.push(e.slice(r,n),encodeURIComponent(l)),r=n+o+1,l=""),o&&(n+=o,o=0)}return t.join("")+e.slice(r)}function et(e,t,n,r){const o=r?r-1:Number.POSITIVE_INFINITY;let a=0;return l;function l(d){return Ke(d)?(e.enter(n),c(d)):t(d)}function c(d){return Ke(d)&&a++<o?(e.consume(d),c):(e.exit(n),t(d))}}const YR={tokenize:XR};function XR(e){const t=e.attempt(this.parser.constructs.contentInitial,r,o);let n;return t;function r(c){if(c===null){e.consume(c);return}return e.enter("lineEnding"),e.consume(c),e.exit("lineEnding"),et(e,t,"linePrefix")}function o(c){return e.enter("paragraph"),a(c)}function a(c){const d=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=d),n=d,l(c)}function l(c){if(c===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(c);return}return Ie(c)?(e.consume(c),e.exit("chunkText"),a):(e.consume(c),l)}}const QR={tokenize:ZR},ox={tokenize:eO};function ZR(e){const t=this,n=[];let r=0,o,a,l;return c;function c(C){if(r<n.length){const L=n[r];return t.containerState=L[1],e.attempt(L[0].continuation,d,p)(C)}return p(C)}function d(C){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&j();const L=t.events.length;let U=L,O;for(;U--;)if(t.events[U][0]==="exit"&&t.events[U][1].type==="chunkFlow"){O=t.events[U][1].end;break}_(r);let q=L;for(;q<t.events.length;)t.events[q][1].end={...O},q++;return nr(t.events,U+1,0,t.events.slice(L)),t.events.length=q,p(C)}return c(C)}function p(C){if(r===n.length){if(!o)return x(C);if(o.currentConstruct&&o.currentConstruct.concrete)return b(C);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(ox,m,y)(C)}function m(C){return o&&j(),_(r),x(C)}function y(C){return t.parser.lazy[t.now().line]=r!==n.length,l=t.now().offset,b(C)}function x(C){return t.containerState={},e.attempt(ox,w,b)(C)}function w(C){return r++,n.push([t.currentConstruct,t.containerState]),x(C)}function b(C){if(C===null){o&&j(),_(0),e.consume(C);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:a}),E(C)}function E(C){if(C===null){k(e.exit("chunkFlow"),!0),_(0),e.consume(C);return}return Ie(C)?(e.consume(C),k(e.exit("chunkFlow")),r=0,t.interrupt=void 0,c):(e.consume(C),E)}function k(C,L){const U=t.sliceStream(C);if(L&&U.push(null),C.previous=a,a&&(a.next=C),a=C,o.defineSkip(C.start),o.write(U),t.parser.lazy[C.start.line]){let O=o.events.length;for(;O--;)if(o.events[O][1].start.offset<l&&(!o.events[O][1].end||o.events[O][1].end.offset>l))return;const q=t.events.length;let V=q,X,ge;for(;V--;)if(t.events[V][0]==="exit"&&t.events[V][1].type==="chunkFlow"){if(X){ge=t.events[V][1].end;break}X=!0}for(_(r),O=q;O<t.events.length;)t.events[O][1].end={...ge},O++;nr(t.events,V+1,0,t.events.slice(q)),t.events.length=O}}function _(C){let L=n.length;for(;L-- >C;){const U=n[L];t.containerState=U[1],U[0].exit.call(t,e)}n.length=C}function j(){o.write([null]),a=void 0,o=void 0,t.containerState._closeFlow=void 0}}function eO(e,t,n){return et(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function ax(e){if(e===null||nn(e)||JR(e))return 1;if(GR(e))return 2}function Uf(e,t,n){const r=[];let o=-1;for(;++o<e.length;){const a=e[o].resolveAll;a&&!r.includes(a)&&(t=a(t,n),r.push(a))}return t}const Oh={name:"attention",resolveAll:tO,tokenize:nO};function tO(e,t){let n=-1,r,o,a,l,c,d,p,m;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;d=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const y={...e[r][1].end},x={...e[n][1].start};lx(y,-d),lx(x,d),l={type:d>1?"strongSequence":"emphasisSequence",start:y,end:{...e[r][1].end}},c={type:d>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:x},a={type:d>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:d>1?"strong":"emphasis",start:{...l.start},end:{...c.end}},e[r][1].end={...l.start},e[n][1].start={...c.end},p=[],e[r][1].end.offset-e[r][1].start.offset&&(p=Cn(p,[["enter",e[r][1],t],["exit",e[r][1],t]])),p=Cn(p,[["enter",o,t],["enter",l,t],["exit",l,t],["enter",a,t]]),p=Cn(p,Uf(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),p=Cn(p,[["exit",a,t],["enter",c,t],["exit",c,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(m=2,p=Cn(p,[["enter",e[n][1],t],["exit",e[n][1],t]])):m=0,nr(e,r-1,n-r+3,p),n=r+p.length-m-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function nO(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=ax(r);let a;return l;function l(d){return a=d,e.enter("attentionSequence"),c(d)}function c(d){if(d===a)return e.consume(d),c;const p=e.exit("attentionSequence"),m=ax(d),y=!m||m===2&&o||n.includes(d),x=!o||o===2&&m||n.includes(r);return p._open=!!(a===42?y:y&&(o||!x)),p._close=!!(a===42?x:x&&(m||!y)),t(d)}}function lx(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const rO={name:"autolink",tokenize:sO};function sO(e,t,n){let r=0;return o;function o(w){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),a}function a(w){return Qn(w)?(e.consume(w),l):w===64?n(w):p(w)}function l(w){return w===43||w===45||w===46||pn(w)?(r=1,c(w)):p(w)}function c(w){return w===58?(e.consume(w),r=0,d):(w===43||w===45||w===46||pn(w))&&r++<32?(e.consume(w),c):(r=0,p(w))}function d(w){return w===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):w===null||w===32||w===60||Ph(w)?n(w):(e.consume(w),d)}function p(w){return w===64?(e.consume(w),m):HR(w)?(e.consume(w),p):n(w)}function m(w){return pn(w)?y(w):n(w)}function y(w){return w===46?(e.consume(w),r=0,m):w===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(w),e.exit("autolinkMarker"),e.exit("autolink"),t):x(w)}function x(w){if((w===45||pn(w))&&r++<63){const b=w===45?x:y;return e.consume(w),b}return n(w)}}const fu={partial:!0,tokenize:iO};function iO(e,t,n){return r;function r(a){return Ke(a)?et(e,o,"linePrefix")(a):o(a)}function o(a){return a===null||Ie(a)?t(a):n(a)}}const Sb={continuation:{tokenize:aO},exit:lO,name:"blockQuote",tokenize:oO};function oO(e,t,n){const r=this;return o;function o(l){if(l===62){const c=r.containerState;return c.open||(e.enter("blockQuote",{_container:!0}),c.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(l),e.exit("blockQuoteMarker"),a}return n(l)}function a(l){return Ke(l)?(e.enter("blockQuotePrefixWhitespace"),e.consume(l),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(l))}}function aO(e,t,n){const r=this;return o;function o(l){return Ke(l)?et(e,a,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l):a(l)}function a(l){return e.attempt(Sb,t,n)(l)}}function lO(e){e.exit("blockQuote")}const _b={name:"characterEscape",tokenize:uO};function uO(e,t,n){return r;function r(a){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(a),e.exit("escapeMarker"),o}function o(a){return KR(a)?(e.enter("characterEscapeValue"),e.consume(a),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(a)}}const Eb={name:"characterReference",tokenize:cO};function cO(e,t,n){const r=this;let o=0,a,l;return c;function c(y){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),d}function d(y){return y===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(y),e.exit("characterReferenceMarkerNumeric"),p):(e.enter("characterReferenceValue"),a=31,l=pn,m(y))}function p(y){return y===88||y===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(y),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),a=6,l=WR,m):(e.enter("characterReferenceValue"),a=7,l=Rh,m(y))}function m(y){if(y===59&&o){const x=e.exit("characterReferenceValue");return l===pn&&!zf(r.sliceSerialize(x))?n(y):(e.enter("characterReferenceMarker"),e.consume(y),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return l(y)&&o++<a?(e.consume(y),m):n(y)}}const ux={partial:!0,tokenize:hO},cx={concrete:!0,name:"codeFenced",tokenize:dO};function dO(e,t,n){const r=this,o={partial:!0,tokenize:U};let a=0,l=0,c;return d;function d(O){return p(O)}function p(O){const q=r.events[r.events.length-1];return a=q&&q[1].type==="linePrefix"?q[2].sliceSerialize(q[1],!0).length:0,c=O,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),m(O)}function m(O){return O===c?(l++,e.consume(O),m):l<3?n(O):(e.exit("codeFencedFenceSequence"),Ke(O)?et(e,y,"whitespace")(O):y(O))}function y(O){return O===null||Ie(O)?(e.exit("codeFencedFence"),r.interrupt?t(O):e.check(ux,E,L)(O)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),x(O))}function x(O){return O===null||Ie(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),y(O)):Ke(O)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),et(e,w,"whitespace")(O)):O===96&&O===c?n(O):(e.consume(O),x)}function w(O){return O===null||Ie(O)?y(O):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),b(O))}function b(O){return O===null||Ie(O)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),y(O)):O===96&&O===c?n(O):(e.consume(O),b)}function E(O){return e.attempt(o,L,k)(O)}function k(O){return e.enter("lineEnding"),e.consume(O),e.exit("lineEnding"),_}function _(O){return a>0&&Ke(O)?et(e,j,"linePrefix",a+1)(O):j(O)}function j(O){return O===null||Ie(O)?e.check(ux,E,L)(O):(e.enter("codeFlowValue"),C(O))}function C(O){return O===null||Ie(O)?(e.exit("codeFlowValue"),j(O)):(e.consume(O),C)}function L(O){return e.exit("codeFenced"),t(O)}function U(O,q,V){let X=0;return ge;function ge(Q){return O.enter("lineEnding"),O.consume(Q),O.exit("lineEnding"),ie}function ie(Q){return O.enter("codeFencedFence"),Ke(Q)?et(O,oe,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Q):oe(Q)}function oe(Q){return Q===c?(O.enter("codeFencedFenceSequence"),Se(Q)):V(Q)}function Se(Q){return Q===c?(X++,O.consume(Q),Se):X>=l?(O.exit("codeFencedFenceSequence"),Ke(Q)?et(O,re,"whitespace")(Q):re(Q)):V(Q)}function re(Q){return Q===null||Ie(Q)?(O.exit("codeFencedFence"),q(Q)):V(Q)}}}function hO(e,t,n){const r=this;return o;function o(l){return l===null?n(l):(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}const Ld={name:"codeIndented",tokenize:pO},fO={partial:!0,tokenize:mO};function pO(e,t,n){const r=this;return o;function o(p){return e.enter("codeIndented"),et(e,a,"linePrefix",5)(p)}function a(p){const m=r.events[r.events.length-1];return m&&m[1].type==="linePrefix"&&m[2].sliceSerialize(m[1],!0).length>=4?l(p):n(p)}function l(p){return p===null?d(p):Ie(p)?e.attempt(fO,l,d)(p):(e.enter("codeFlowValue"),c(p))}function c(p){return p===null||Ie(p)?(e.exit("codeFlowValue"),l(p)):(e.consume(p),c)}function d(p){return e.exit("codeIndented"),t(p)}}function mO(e,t,n){const r=this;return o;function o(l){return r.parser.lazy[r.now().line]?n(l):Ie(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),o):et(e,a,"linePrefix",5)(l)}function a(l){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):Ie(l)?o(l):n(l)}}const gO={name:"codeText",previous:xO,resolve:yO,tokenize:vO};function yO(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function xO(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function vO(e,t,n){let r=0,o,a;return l;function l(y){return e.enter("codeText"),e.enter("codeTextSequence"),c(y)}function c(y){return y===96?(e.consume(y),r++,c):(e.exit("codeTextSequence"),d(y))}function d(y){return y===null?n(y):y===32?(e.enter("space"),e.consume(y),e.exit("space"),d):y===96?(a=e.enter("codeTextSequence"),o=0,m(y)):Ie(y)?(e.enter("lineEnding"),e.consume(y),e.exit("lineEnding"),d):(e.enter("codeTextData"),p(y))}function p(y){return y===null||y===32||y===96||Ie(y)?(e.exit("codeTextData"),d(y)):(e.consume(y),p)}function m(y){return y===96?(e.consume(y),o++,m):o===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(y)):(a.type="codeTextData",p(y))}}class wO{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const o=n||0;this.setCursor(Math.trunc(t));const a=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&go(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),go(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),go(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);go(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);go(this.left,n.reverse())}}}function go(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function jb(e){const t={};let n=-1,r,o,a,l,c,d,p;const m=new wO(e);for(;++n<m.length;){for(;n in t;)n=t[n];if(r=m.get(n),n&&r[1].type==="chunkFlow"&&m.get(n-1)[1].type==="listItemPrefix"&&(d=r[1]._tokenizer.events,a=0,a<d.length&&d[a][1].type==="lineEndingBlank"&&(a+=2),a<d.length&&d[a][1].type==="content"))for(;++a<d.length&&d[a][1].type!=="content";)d[a][1].type==="chunkText"&&(d[a][1]._isInFirstContentOfListItem=!0,a++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,bO(m,n)),n=t[n],p=!0);else if(r[1]._container){for(a=n,o=void 0;a--;)if(l=m.get(a),l[1].type==="lineEnding"||l[1].type==="lineEndingBlank")l[0]==="enter"&&(o&&(m.get(o)[1].type="lineEndingBlank"),l[1].type="lineEnding",o=a);else if(!(l[1].type==="linePrefix"||l[1].type==="listItemIndent"))break;o&&(r[1].end={...m.get(o)[1].start},c=m.slice(o,n),c.unshift(r),m.splice(o,n-o+1,c))}}return nr(e,0,Number.POSITIVE_INFINITY,m.slice(0)),!p}function bO(e,t){const n=e.get(t)[1],r=e.get(t)[2];let o=t-1;const a=[];let l=n._tokenizer;l||(l=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(l._contentTypeTextTrailing=!0));const c=l.events,d=[],p={};let m,y,x=-1,w=n,b=0,E=0;const k=[E];for(;w;){for(;e.get(++o)[1]!==w;);a.push(o),w._tokenizer||(m=r.sliceStream(w),w.next||m.push(null),y&&l.defineSkip(w.start),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=!0),l.write(m),w._isInFirstContentOfListItem&&(l._gfmTasklistFirstContentOfListItem=void 0)),y=w,w=w.next}for(w=n;++x<c.length;)c[x][0]==="exit"&&c[x-1][0]==="enter"&&c[x][1].type===c[x-1][1].type&&c[x][1].start.line!==c[x][1].end.line&&(E=x+1,k.push(E),w._tokenizer=void 0,w.previous=void 0,w=w.next);for(l.events=[],w?(w._tokenizer=void 0,w.previous=void 0):k.pop(),x=k.length;x--;){const _=c.slice(k[x],k[x+1]),j=a.pop();d.push([j,j+_.length-1]),e.splice(j,2,_)}for(d.reverse(),x=-1;++x<d.length;)p[b+d[x][0]]=b+d[x][1],b+=d[x][1]-d[x][0]-1;return p}const kO={resolve:_O,tokenize:EO},SO={partial:!0,tokenize:jO};function _O(e){return jb(e),e}function EO(e,t){let n;return r;function r(c){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(c)}function o(c){return c===null?a(c):Ie(c)?e.check(SO,l,a)(c):(e.consume(c),o)}function a(c){return e.exit("chunkContent"),e.exit("content"),t(c)}function l(c){return e.consume(c),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function jO(e,t,n){const r=this;return o;function o(l){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),et(e,a,"linePrefix")}function a(l){if(l===null||Ie(l))return n(l);const c=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?t(l):e.interrupt(r.parser.constructs.flow,n,t)(l)}}function Tb(e,t,n,r,o,a,l,c,d){const p=d||Number.POSITIVE_INFINITY;let m=0;return y;function y(_){return _===60?(e.enter(r),e.enter(o),e.enter(a),e.consume(_),e.exit(a),x):_===null||_===32||_===41||Ph(_)?n(_):(e.enter(r),e.enter(l),e.enter(c),e.enter("chunkString",{contentType:"string"}),E(_))}function x(_){return _===62?(e.enter(a),e.consume(_),e.exit(a),e.exit(o),e.exit(r),t):(e.enter(c),e.enter("chunkString",{contentType:"string"}),w(_))}function w(_){return _===62?(e.exit("chunkString"),e.exit(c),x(_)):_===null||_===60||Ie(_)?n(_):(e.consume(_),_===92?b:w)}function b(_){return _===60||_===62||_===92?(e.consume(_),w):w(_)}function E(_){return!m&&(_===null||_===41||nn(_))?(e.exit("chunkString"),e.exit(c),e.exit(l),e.exit(r),t(_)):m<p&&_===40?(e.consume(_),m++,E):_===41?(e.consume(_),m--,E):_===null||_===32||_===40||Ph(_)?n(_):(e.consume(_),_===92?k:E)}function k(_){return _===40||_===41||_===92?(e.consume(_),E):E(_)}}function Cb(e,t,n,r,o,a){const l=this;let c=0,d;return p;function p(w){return e.enter(r),e.enter(o),e.consume(w),e.exit(o),e.enter(a),m}function m(w){return c>999||w===null||w===91||w===93&&!d||w===94&&!c&&"_hiddenFootnoteSupport"in l.parser.constructs?n(w):w===93?(e.exit(a),e.enter(o),e.consume(w),e.exit(o),e.exit(r),t):Ie(w)?(e.enter("lineEnding"),e.consume(w),e.exit("lineEnding"),m):(e.enter("chunkString",{contentType:"string"}),y(w))}function y(w){return w===null||w===91||w===93||Ie(w)||c++>999?(e.exit("chunkString"),m(w)):(e.consume(w),d||(d=!Ke(w)),w===92?x:y)}function x(w){return w===91||w===92||w===93?(e.consume(w),c++,y):y(w)}}function Nb(e,t,n,r,o,a){let l;return c;function c(x){return x===34||x===39||x===40?(e.enter(r),e.enter(o),e.consume(x),e.exit(o),l=x===40?41:x,d):n(x)}function d(x){return x===l?(e.enter(o),e.consume(x),e.exit(o),e.exit(r),t):(e.enter(a),p(x))}function p(x){return x===l?(e.exit(a),d(l)):x===null?n(x):Ie(x)?(e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),et(e,p,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===l||x===null||Ie(x)?(e.exit("chunkString"),p(x)):(e.consume(x),x===92?y:m)}function y(x){return x===l||x===92?(e.consume(x),m):m(x)}}function Po(e,t){let n;return r;function r(o){return Ie(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):Ke(o)?et(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}const TO={name:"definition",tokenize:NO},CO={partial:!0,tokenize:AO};function NO(e,t,n){const r=this;let o;return a;function a(w){return e.enter("definition"),l(w)}function l(w){return Cb.call(r,e,c,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(w)}function c(w){return o=pi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),w===58?(e.enter("definitionMarker"),e.consume(w),e.exit("definitionMarker"),d):n(w)}function d(w){return nn(w)?Po(e,p)(w):p(w)}function p(w){return Tb(e,m,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(w)}function m(w){return e.attempt(CO,y,y)(w)}function y(w){return Ke(w)?et(e,x,"whitespace")(w):x(w)}function x(w){return w===null||Ie(w)?(e.exit("definition"),r.parser.defined.push(o),t(w)):n(w)}}function AO(e,t,n){return r;function r(c){return nn(c)?Po(e,o)(c):n(c)}function o(c){return Nb(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(c)}function a(c){return Ke(c)?et(e,l,"whitespace")(c):l(c)}function l(c){return c===null||Ie(c)?t(c):n(c)}}const PO={name:"hardBreakEscape",tokenize:RO};function RO(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),o}function o(a){return Ie(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}const OO={name:"headingAtx",resolve:IO,tokenize:DO};function IO(e,t){let n=e.length-2,r=3,o,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},nr(e,r,n-r+1,[["enter",o,t],["enter",a,t],["exit",a,t],["exit",o,t]])),e}function DO(e,t,n){let r=0;return o;function o(m){return e.enter("atxHeading"),a(m)}function a(m){return e.enter("atxHeadingSequence"),l(m)}function l(m){return m===35&&r++<6?(e.consume(m),l):m===null||nn(m)?(e.exit("atxHeadingSequence"),c(m)):n(m)}function c(m){return m===35?(e.enter("atxHeadingSequence"),d(m)):m===null||Ie(m)?(e.exit("atxHeading"),t(m)):Ke(m)?et(e,c,"whitespace")(m):(e.enter("atxHeadingText"),p(m))}function d(m){return m===35?(e.consume(m),d):(e.exit("atxHeadingSequence"),c(m))}function p(m){return m===null||m===35||nn(m)?(e.exit("atxHeadingText"),c(m)):(e.consume(m),p)}}const LO=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],dx=["pre","script","style","textarea"],MO={concrete:!0,name:"htmlFlow",resolveTo:FO,tokenize:$O},zO={partial:!0,tokenize:VO},UO={partial:!0,tokenize:BO};function FO(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function $O(e,t,n){const r=this;let o,a,l,c,d;return p;function p(N){return m(N)}function m(N){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(N),y}function y(N){return N===33?(e.consume(N),x):N===47?(e.consume(N),a=!0,E):N===63?(e.consume(N),o=3,r.interrupt?t:T):Qn(N)?(e.consume(N),l=String.fromCharCode(N),k):n(N)}function x(N){return N===45?(e.consume(N),o=2,w):N===91?(e.consume(N),o=5,c=0,b):Qn(N)?(e.consume(N),o=4,r.interrupt?t:T):n(N)}function w(N){return N===45?(e.consume(N),r.interrupt?t:T):n(N)}function b(N){const ne="CDATA[";return N===ne.charCodeAt(c++)?(e.consume(N),c===ne.length?r.interrupt?t:oe:b):n(N)}function E(N){return Qn(N)?(e.consume(N),l=String.fromCharCode(N),k):n(N)}function k(N){if(N===null||N===47||N===62||nn(N)){const ne=N===47,ye=l.toLowerCase();return!ne&&!a&&dx.includes(ye)?(o=1,r.interrupt?t(N):oe(N)):LO.includes(l.toLowerCase())?(o=6,ne?(e.consume(N),_):r.interrupt?t(N):oe(N)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(N):a?j(N):C(N))}return N===45||pn(N)?(e.consume(N),l+=String.fromCharCode(N),k):n(N)}function _(N){return N===62?(e.consume(N),r.interrupt?t:oe):n(N)}function j(N){return Ke(N)?(e.consume(N),j):ge(N)}function C(N){return N===47?(e.consume(N),ge):N===58||N===95||Qn(N)?(e.consume(N),L):Ke(N)?(e.consume(N),C):ge(N)}function L(N){return N===45||N===46||N===58||N===95||pn(N)?(e.consume(N),L):U(N)}function U(N){return N===61?(e.consume(N),O):Ke(N)?(e.consume(N),U):C(N)}function O(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),d=N,q):Ke(N)?(e.consume(N),O):V(N)}function q(N){return N===d?(e.consume(N),d=null,X):N===null||Ie(N)?n(N):(e.consume(N),q)}function V(N){return N===null||N===34||N===39||N===47||N===60||N===61||N===62||N===96||nn(N)?U(N):(e.consume(N),V)}function X(N){return N===47||N===62||Ke(N)?C(N):n(N)}function ge(N){return N===62?(e.consume(N),ie):n(N)}function ie(N){return N===null||Ie(N)?oe(N):Ke(N)?(e.consume(N),ie):n(N)}function oe(N){return N===45&&o===2?(e.consume(N),we):N===60&&o===1?(e.consume(N),me):N===62&&o===4?(e.consume(N),I):N===63&&o===3?(e.consume(N),T):N===93&&o===5?(e.consume(N),ae):Ie(N)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(zO,H,Se)(N)):N===null||Ie(N)?(e.exit("htmlFlowData"),Se(N)):(e.consume(N),oe)}function Se(N){return e.check(UO,re,H)(N)}function re(N){return e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),Q}function Q(N){return N===null||Ie(N)?Se(N):(e.enter("htmlFlowData"),oe(N))}function we(N){return N===45?(e.consume(N),T):oe(N)}function me(N){return N===47?(e.consume(N),l="",K):oe(N)}function K(N){if(N===62){const ne=l.toLowerCase();return dx.includes(ne)?(e.consume(N),I):oe(N)}return Qn(N)&&l.length<8?(e.consume(N),l+=String.fromCharCode(N),K):oe(N)}function ae(N){return N===93?(e.consume(N),T):oe(N)}function T(N){return N===62?(e.consume(N),I):N===45&&o===2?(e.consume(N),T):oe(N)}function I(N){return N===null||Ie(N)?(e.exit("htmlFlowData"),H(N)):(e.consume(N),I)}function H(N){return e.exit("htmlFlow"),t(N)}}function BO(e,t,n){const r=this;return o;function o(l){return Ie(l)?(e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),a):n(l)}function a(l){return r.parser.lazy[r.now().line]?n(l):t(l)}}function VO(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(fu,t,n)}}const qO={name:"htmlText",tokenize:HO};function HO(e,t,n){const r=this;let o,a,l;return c;function c(T){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(T),d}function d(T){return T===33?(e.consume(T),p):T===47?(e.consume(T),U):T===63?(e.consume(T),C):Qn(T)?(e.consume(T),V):n(T)}function p(T){return T===45?(e.consume(T),m):T===91?(e.consume(T),a=0,b):Qn(T)?(e.consume(T),j):n(T)}function m(T){return T===45?(e.consume(T),w):n(T)}function y(T){return T===null?n(T):T===45?(e.consume(T),x):Ie(T)?(l=y,me(T)):(e.consume(T),y)}function x(T){return T===45?(e.consume(T),w):y(T)}function w(T){return T===62?we(T):T===45?x(T):y(T)}function b(T){const I="CDATA[";return T===I.charCodeAt(a++)?(e.consume(T),a===I.length?E:b):n(T)}function E(T){return T===null?n(T):T===93?(e.consume(T),k):Ie(T)?(l=E,me(T)):(e.consume(T),E)}function k(T){return T===93?(e.consume(T),_):E(T)}function _(T){return T===62?we(T):T===93?(e.consume(T),_):E(T)}function j(T){return T===null||T===62?we(T):Ie(T)?(l=j,me(T)):(e.consume(T),j)}function C(T){return T===null?n(T):T===63?(e.consume(T),L):Ie(T)?(l=C,me(T)):(e.consume(T),C)}function L(T){return T===62?we(T):C(T)}function U(T){return Qn(T)?(e.consume(T),O):n(T)}function O(T){return T===45||pn(T)?(e.consume(T),O):q(T)}function q(T){return Ie(T)?(l=q,me(T)):Ke(T)?(e.consume(T),q):we(T)}function V(T){return T===45||pn(T)?(e.consume(T),V):T===47||T===62||nn(T)?X(T):n(T)}function X(T){return T===47?(e.consume(T),we):T===58||T===95||Qn(T)?(e.consume(T),ge):Ie(T)?(l=X,me(T)):Ke(T)?(e.consume(T),X):we(T)}function ge(T){return T===45||T===46||T===58||T===95||pn(T)?(e.consume(T),ge):ie(T)}function ie(T){return T===61?(e.consume(T),oe):Ie(T)?(l=ie,me(T)):Ke(T)?(e.consume(T),ie):X(T)}function oe(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),o=T,Se):Ie(T)?(l=oe,me(T)):Ke(T)?(e.consume(T),oe):(e.consume(T),re)}function Se(T){return T===o?(e.consume(T),o=void 0,Q):T===null?n(T):Ie(T)?(l=Se,me(T)):(e.consume(T),Se)}function re(T){return T===null||T===34||T===39||T===60||T===61||T===96?n(T):T===47||T===62||nn(T)?X(T):(e.consume(T),re)}function Q(T){return T===47||T===62||nn(T)?X(T):n(T)}function we(T){return T===62?(e.consume(T),e.exit("htmlTextData"),e.exit("htmlText"),t):n(T)}function me(T){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),K}function K(T){return Ke(T)?et(e,ae,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):ae(T)}function ae(T){return e.enter("htmlTextData"),l(T)}}const Ff={name:"labelEnd",resolveAll:JO,resolveTo:YO,tokenize:XO},WO={tokenize:QO},KO={tokenize:ZO},GO={tokenize:e4};function JO(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&nr(e,0,e.length,n),e}function YO(e,t){let n=e.length,r=0,o,a,l,c;for(;n--;)if(o=e[n][1],a){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(l){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(a=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(l=n);const d={type:e[a][1].type==="labelLink"?"link":"image",start:{...e[a][1].start},end:{...e[e.length-1][1].end}},p={type:"label",start:{...e[a][1].start},end:{...e[l][1].end}},m={type:"labelText",start:{...e[a+r+2][1].end},end:{...e[l-2][1].start}};return c=[["enter",d,t],["enter",p,t]],c=Cn(c,e.slice(a+1,a+r+3)),c=Cn(c,[["enter",m,t]]),c=Cn(c,Uf(t.parser.constructs.insideSpan.null,e.slice(a+r+4,l-3),t)),c=Cn(c,[["exit",m,t],e[l-2],e[l-1],["exit",p,t]]),c=Cn(c,e.slice(l+1)),c=Cn(c,[["exit",d,t]]),nr(e,a,e.length,c),e}function XO(e,t,n){const r=this;let o=r.events.length,a,l;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){a=r.events[o][1];break}return c;function c(x){return a?a._inactive?y(x):(l=r.parser.defined.includes(pi(r.sliceSerialize({start:a.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(x),e.exit("labelMarker"),e.exit("labelEnd"),d):n(x)}function d(x){return x===40?e.attempt(WO,m,l?m:y)(x):x===91?e.attempt(KO,m,l?p:y)(x):l?m(x):y(x)}function p(x){return e.attempt(GO,m,y)(x)}function m(x){return t(x)}function y(x){return a._balanced=!0,n(x)}}function QO(e,t,n){return r;function r(y){return e.enter("resource"),e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),o}function o(y){return nn(y)?Po(e,a)(y):a(y)}function a(y){return y===41?m(y):Tb(e,l,c,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(y)}function l(y){return nn(y)?Po(e,d)(y):m(y)}function c(y){return n(y)}function d(y){return y===34||y===39||y===40?Nb(e,p,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(y):m(y)}function p(y){return nn(y)?Po(e,m)(y):m(y)}function m(y){return y===41?(e.enter("resourceMarker"),e.consume(y),e.exit("resourceMarker"),e.exit("resource"),t):n(y)}}function ZO(e,t,n){const r=this;return o;function o(c){return Cb.call(r,e,a,l,"reference","referenceMarker","referenceString")(c)}function a(c){return r.parser.defined.includes(pi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(c):n(c)}function l(c){return n(c)}}function e4(e,t,n){return r;function r(a){return e.enter("reference"),e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),o}function o(a){return a===93?(e.enter("referenceMarker"),e.consume(a),e.exit("referenceMarker"),e.exit("reference"),t):n(a)}}const t4={name:"labelStartImage",resolveAll:Ff.resolveAll,tokenize:n4};function n4(e,t,n){const r=this;return o;function o(c){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(c),e.exit("labelImageMarker"),a}function a(c){return c===91?(e.enter("labelMarker"),e.consume(c),e.exit("labelMarker"),e.exit("labelImage"),l):n(c)}function l(c){return c===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(c):t(c)}}const r4={name:"labelStartLink",resolveAll:Ff.resolveAll,tokenize:s4};function s4(e,t,n){const r=this;return o;function o(l){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelLink"),a}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const Md={name:"lineEnding",tokenize:i4};function i4(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),et(e,t,"linePrefix")}}const Ol={name:"thematicBreak",tokenize:o4};function o4(e,t,n){let r=0,o;return a;function a(p){return e.enter("thematicBreak"),l(p)}function l(p){return o=p,c(p)}function c(p){return p===o?(e.enter("thematicBreakSequence"),d(p)):r>=3&&(p===null||Ie(p))?(e.exit("thematicBreak"),t(p)):n(p)}function d(p){return p===o?(e.consume(p),r++,d):(e.exit("thematicBreakSequence"),Ke(p)?et(e,c,"whitespace")(p):c(p))}}const Qt={continuation:{tokenize:c4},exit:h4,name:"list",tokenize:u4},a4={partial:!0,tokenize:f4},l4={partial:!0,tokenize:d4};function u4(e,t,n){const r=this,o=r.events[r.events.length-1];let a=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,l=0;return c;function c(w){const b=r.containerState.type||(w===42||w===43||w===45?"listUnordered":"listOrdered");if(b==="listUnordered"?!r.containerState.marker||w===r.containerState.marker:Rh(w)){if(r.containerState.type||(r.containerState.type=b,e.enter(b,{_container:!0})),b==="listUnordered")return e.enter("listItemPrefix"),w===42||w===45?e.check(Ol,n,p)(w):p(w);if(!r.interrupt||w===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),d(w)}return n(w)}function d(w){return Rh(w)&&++l<10?(e.consume(w),d):(!r.interrupt||l<2)&&(r.containerState.marker?w===r.containerState.marker:w===41||w===46)?(e.exit("listItemValue"),p(w)):n(w)}function p(w){return e.enter("listItemMarker"),e.consume(w),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||w,e.check(fu,r.interrupt?n:m,e.attempt(a4,x,y))}function m(w){return r.containerState.initialBlankLine=!0,a++,x(w)}function y(w){return Ke(w)?(e.enter("listItemPrefixWhitespace"),e.consume(w),e.exit("listItemPrefixWhitespace"),x):n(w)}function x(w){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(w)}}function c4(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(fu,o,a);function o(c){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,et(e,t,"listItemIndent",r.containerState.size+1)(c)}function a(c){return r.containerState.furtherBlankLines||!Ke(c)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,l(c)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(l4,t,l)(c))}function l(c){return r.containerState._closeFlow=!0,r.interrupt=void 0,et(e,e.attempt(Qt,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(c)}}function d4(e,t,n){const r=this;return et(e,o,"listItemIndent",r.containerState.size+1);function o(a){const l=r.events[r.events.length-1];return l&&l[1].type==="listItemIndent"&&l[2].sliceSerialize(l[1],!0).length===r.containerState.size?t(a):n(a)}}function h4(e){e.exit(this.containerState.type)}function f4(e,t,n){const r=this;return et(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(a){const l=r.events[r.events.length-1];return!Ke(a)&&l&&l[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}const hx={name:"setextUnderline",resolveTo:p4,tokenize:m4};function p4(e,t){let n=e.length,r,o,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);const l={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",a?(e.splice(o,0,["enter",l,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=l,e.push(["exit",l,t]),e}function m4(e,t,n){const r=this;let o;return a;function a(p){let m=r.events.length,y;for(;m--;)if(r.events[m][1].type!=="lineEnding"&&r.events[m][1].type!=="linePrefix"&&r.events[m][1].type!=="content"){y=r.events[m][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||y)?(e.enter("setextHeadingLine"),o=p,l(p)):n(p)}function l(p){return e.enter("setextHeadingLineSequence"),c(p)}function c(p){return p===o?(e.consume(p),c):(e.exit("setextHeadingLineSequence"),Ke(p)?et(e,d,"lineSuffix")(p):d(p))}function d(p){return p===null||Ie(p)?(e.exit("setextHeadingLine"),t(p)):n(p)}}const g4={tokenize:y4};function y4(e){const t=this,n=e.attempt(fu,r,e.attempt(this.parser.constructs.flowInitial,o,et(e,e.attempt(this.parser.constructs.flow,o,e.attempt(kO,o)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const x4={resolveAll:Pb()},v4=Ab("string"),w4=Ab("text");function Ab(e){return{resolveAll:Pb(e==="text"?b4:void 0),tokenize:t};function t(n){const r=this,o=this.parser.constructs[e],a=n.attempt(o,l,c);return l;function l(m){return p(m)?a(m):c(m)}function c(m){if(m===null){n.consume(m);return}return n.enter("data"),n.consume(m),d}function d(m){return p(m)?(n.exit("data"),a(m)):(n.consume(m),d)}function p(m){if(m===null)return!0;const y=o[m];let x=-1;if(y)for(;++x<y.length;){const w=y[x];if(!w.previous||w.previous.call(r,r.previous))return!0}return!1}}}function Pb(e){return t;function t(n,r){let o=-1,a;for(;++o<=n.length;)a===void 0?n[o]&&n[o][1].type==="data"&&(a=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==a+2&&(n[a][1].end=n[o-1][1].end,n.splice(a+2,o-a-2),o=a+2),a=void 0);return e?e(n,r):n}}function b4(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],o=t.sliceStream(r);let a=o.length,l=-1,c=0,d;for(;a--;){const p=o[a];if(typeof p=="string"){for(l=p.length;p.charCodeAt(l-1)===32;)c++,l--;if(l)break;l=-1}else if(p===-2)d=!0,c++;else if(p!==-1){a++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(c=0),c){const p={type:n===e.length||d||c<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:a?l:r.start._bufferIndex+l,_index:r.start._index+a,line:r.end.line,column:r.end.column-c,offset:r.end.offset-c},end:{...r.end}};r.end={...p.start},r.start.offset===r.end.offset?Object.assign(r,p):(e.splice(n,0,["enter",p,t],["exit",p,t]),n+=2)}n++}return e}const k4={42:Qt,43:Qt,45:Qt,48:Qt,49:Qt,50:Qt,51:Qt,52:Qt,53:Qt,54:Qt,55:Qt,56:Qt,57:Qt,62:Sb},S4={91:TO},_4={[-2]:Ld,[-1]:Ld,32:Ld},E4={35:OO,42:Ol,45:[hx,Ol],60:MO,61:hx,95:Ol,96:cx,126:cx},j4={38:Eb,92:_b},T4={[-5]:Md,[-4]:Md,[-3]:Md,33:t4,38:Eb,42:Oh,60:[rO,qO],91:r4,92:[PO,_b],93:Ff,95:Oh,96:gO},C4={null:[Oh,x4]},N4={null:[42,95]},A4={null:[]},P4=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:N4,contentInitial:S4,disable:A4,document:k4,flow:E4,flowInitial:_4,insideSpan:C4,string:j4,text:T4},Symbol.toStringTag,{value:"Module"}));function R4(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const o={},a=[];let l=[],c=[];const d={attempt:q(U),check:q(O),consume:j,enter:C,exit:L,interrupt:q(O,{interrupt:!0})},p={code:null,containerState:{},defineSkip:E,events:[],now:b,parser:e,previous:null,sliceSerialize:x,sliceStream:w,write:y};let m=t.tokenize.call(p,d);return t.resolveAll&&a.push(t),p;function y(ie){return l=Cn(l,ie),k(),l[l.length-1]!==null?[]:(V(t,0),p.events=Uf(a,p.events,p),p.events)}function x(ie,oe){return I4(w(ie),oe)}function w(ie){return O4(l,ie)}function b(){const{_bufferIndex:ie,_index:oe,line:Se,column:re,offset:Q}=r;return{_bufferIndex:ie,_index:oe,line:Se,column:re,offset:Q}}function E(ie){o[ie.line]=ie.column,ge()}function k(){let ie;for(;r._index<l.length;){const oe=l[r._index];if(typeof oe=="string")for(ie=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===ie&&r._bufferIndex<oe.length;)_(oe.charCodeAt(r._bufferIndex));else _(oe)}}function _(ie){m=m(ie)}function j(ie){Ie(ie)?(r.line++,r.column=1,r.offset+=ie===-3?2:1,ge()):ie!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===l[r._index].length&&(r._bufferIndex=-1,r._index++)),p.previous=ie}function C(ie,oe){const Se=oe||{};return Se.type=ie,Se.start=b(),p.events.push(["enter",Se,p]),c.push(Se),Se}function L(ie){const oe=c.pop();return oe.end=b(),p.events.push(["exit",oe,p]),oe}function U(ie,oe){V(ie,oe.from)}function O(ie,oe){oe.restore()}function q(ie,oe){return Se;function Se(re,Q,we){let me,K,ae,T;return Array.isArray(re)?H(re):"tokenize"in re?H([re]):I(re);function I(ue){return he;function he(Ne){const Be=Ne!==null&&ue[Ne],We=Ne!==null&&ue.null,It=[...Array.isArray(Be)?Be:Be?[Be]:[],...Array.isArray(We)?We:We?[We]:[]];return H(It)(Ne)}}function H(ue){return me=ue,K=0,ue.length===0?we:N(ue[K])}function N(ue){return he;function he(Ne){return T=X(),ae=ue,ue.partial||(p.currentConstruct=ue),ue.name&&p.parser.constructs.disable.null.includes(ue.name)?ye():ue.tokenize.call(oe?Object.assign(Object.create(p),oe):p,d,ne,ye)(Ne)}}function ne(ue){return ie(ae,T),Q}function ye(ue){return T.restore(),++K<me.length?N(me[K]):we}}}function V(ie,oe){ie.resolveAll&&!a.includes(ie)&&a.push(ie),ie.resolve&&nr(p.events,oe,p.events.length-oe,ie.resolve(p.events.slice(oe),p)),ie.resolveTo&&(p.events=ie.resolveTo(p.events,p))}function X(){const ie=b(),oe=p.previous,Se=p.currentConstruct,re=p.events.length,Q=Array.from(c);return{from:re,restore:we};function we(){r=ie,p.previous=oe,p.currentConstruct=Se,p.events.length=re,c=Q,ge()}}function ge(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function O4(e,t){const n=t.start._index,r=t.start._bufferIndex,o=t.end._index,a=t.end._bufferIndex;let l;if(n===o)l=[e[n].slice(r,a)];else{if(l=e.slice(n,o),r>-1){const c=l[0];typeof c=="string"?l[0]=c.slice(r):l.shift()}a>0&&l.push(e[o].slice(0,a))}return l}function I4(e,t){let n=-1;const r=[];let o;for(;++n<e.length;){const a=e[n];let l;if(typeof a=="string")l=a;else switch(a){case-5:{l="\r";break}case-4:{l=`
111
111
  `;break}case-3:{l=`\r
112
112
  `;break}case-2:{l=t?" ":" ";break}case-1:{if(!t&&o)continue;l=" ";break}default:l=String.fromCharCode(a)}o=a===-2,r.push(l)}return r.join("")}function D4(e){const r={constructs:BR([P4,...(e||{}).extensions||[]]),content:o(YR),defined:[],document:o(QR),flow:o(g4),lazy:{},string:o(v4),text:o(w4)};return r;function o(a){return l;function l(c){return R4(r,a,c)}}}function L4(e){for(;!jb(e););return e}const fx=/[\0\t\n\r]/g;function M4(){let e=1,t="",n=!0,r;return o;function o(a,l,c){const d=[];let p,m,y,x,w;for(a=t+(typeof a=="string"?a.toString():new TextDecoder(l||void 0).decode(a)),y=0,t="",n&&(a.charCodeAt(0)===65279&&y++,n=void 0);y<a.length;){if(fx.lastIndex=y,p=fx.exec(a),x=p&&p.index!==void 0?p.index:a.length,w=a.charCodeAt(x),!p){t=a.slice(y);break}if(w===10&&y===x&&r)d.push(-3),r=void 0;else switch(r&&(d.push(-5),r=void 0),y<x&&(d.push(a.slice(y,x)),e+=x-y),w){case 0:{d.push(65533),e++;break}case 9:{for(m=Math.ceil(e/4)*4,d.push(-2);e++<m;)d.push(-1);break}case 10:{d.push(-4),e=1;break}default:r=!0,e=1}y=x+1}return c&&(r&&d.push(-5),t&&d.push(t),d.push(null)),d}}const z4=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function U4(e){return e.replace(z4,F4)}function F4(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const o=n.charCodeAt(1),a=o===120||o===88;return kb(n.slice(a?2:1),a?16:10)}return zf(n)||e}const Rb={}.hasOwnProperty;function $4(e,t,n){return typeof t!="string"&&(n=t,t=void 0),B4(n)(L4(D4(n).document().write(M4()(e,t,!0))))}function B4(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(B),autolinkProtocol:X,autolinkEmail:X,atxHeading:a(Nn),blockQuote:a(We),characterEscape:X,characterReference:X,codeFenced:a(It),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(It,l),codeText:a(rr,l),codeTextData:X,data:X,codeFlowValue:X,definition:a(yn),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(qn),hardBreakEscape:a(se),hardBreakTrailing:a(se),htmlFlow:a(Ee,l),htmlFlowData:X,htmlText:a(Ee,l),htmlTextData:X,image:a(Le),label:l,link:a(B),listItem:a(pe),listItemValue:x,listOrdered:a(le,y),listUnordered:a(le),paragraph:a(Ye),reference:N,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(Nn),strong:a(tt),thematicBreak:a(sr)},exit:{atxHeading:d(),atxHeadingSequence:U,autolink:d(),autolinkEmail:Be,autolinkProtocol:Ne,blockQuote:d(),characterEscapeValue:ge,characterReferenceMarkerHexadecimal:ye,characterReferenceMarkerNumeric:ye,characterReferenceValue:ue,characterReference:he,codeFenced:d(k),codeFencedFence:E,codeFencedFenceInfo:w,codeFencedFenceMeta:b,codeFlowValue:ge,codeIndented:d(_),codeText:d(Q),codeTextData:ge,data:ge,definition:d(),definitionDestinationString:L,definitionLabelString:j,definitionTitleString:C,emphasis:d(),hardBreakEscape:d(oe),hardBreakTrailing:d(oe),htmlFlow:d(Se),htmlFlowData:ge,htmlText:d(re),htmlTextData:ge,image:d(me),label:ae,labelText:K,lineEnding:ie,link:d(we),listItem:d(),listOrdered:d(),listUnordered:d(),paragraph:d(),referenceString:ne,resourceDestinationString:T,resourceTitleString:I,resource:H,setextHeading:d(V),setextHeadingLineSequence:q,setextHeadingText:O,strong:d(),thematicBreak:d()}};Ob(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(W){let Y={type:"root",children:[]};const je={stack:[Y],tokenStack:[],config:t,enter:c,exit:p,buffer:l,resume:m,data:n},De=[];let Me=-1;for(;++Me<W.length;)if(W[Me][1].type==="listOrdered"||W[Me][1].type==="listUnordered")if(W[Me][0]==="enter")De.push(Me);else{const nt=De.pop();Me=o(W,nt,Me)}for(Me=-1;++Me<W.length;){const nt=t[W[Me][0]];Rb.call(nt,W[Me][1].type)&&nt[W[Me][1].type].call(Object.assign({sliceSerialize:W[Me][2].sliceSerialize},je),W[Me][1])}if(je.tokenStack.length>0){const nt=je.tokenStack[je.tokenStack.length-1];(nt[1]||px).call(je,void 0,nt[0])}for(Y.position={start:zr(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:zr(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Me=-1;++Me<t.transforms.length;)Y=t.transforms[Me](Y)||Y;return Y}function o(W,Y,je){let De=Y-1,Me=-1,nt=!1,Ct,_t,Dt,Je;for(;++De<=je;){const pt=W[De];switch(pt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{pt[0]==="enter"?Me++:Me--,Je=void 0;break}case"lineEndingBlank":{pt[0]==="enter"&&(Ct&&!Je&&!Me&&!Dt&&(Dt=De),Je=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Je=void 0}if(!Me&&pt[0]==="enter"&&pt[1].type==="listItemPrefix"||Me===-1&&pt[0]==="exit"&&(pt[1].type==="listUnordered"||pt[1].type==="listOrdered")){if(Ct){let vn=De;for(_t=void 0;vn--;){const sn=W[vn];if(sn[1].type==="lineEnding"||sn[1].type==="lineEndingBlank"){if(sn[0]==="exit")continue;_t&&(W[_t][1].type="lineEndingBlank",nt=!0),sn[1].type="lineEnding",_t=vn}else if(!(sn[1].type==="linePrefix"||sn[1].type==="blockQuotePrefix"||sn[1].type==="blockQuotePrefixWhitespace"||sn[1].type==="blockQuoteMarker"||sn[1].type==="listItemIndent"))break}Dt&&(!_t||Dt<_t)&&(Ct._spread=!0),Ct.end=Object.assign({},_t?W[_t][1].start:pt[1].end),W.splice(_t||De,0,["exit",Ct,pt[2]]),De++,je++}if(pt[1].type==="listItemPrefix"){const vn={type:"listItem",_spread:!1,start:Object.assign({},pt[1].start),end:void 0};Ct=vn,W.splice(De,0,["enter",vn,pt[2]]),De++,je++,Dt=void 0,Je=!0}}}return W[Y][1]._spread=nt,je}function a(W,Y){return je;function je(De){c.call(this,W(De),De),Y&&Y.call(this,De)}}function l(){this.stack.push({type:"fragment",children:[]})}function c(W,Y,je){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([Y,je||void 0]),W.position={start:zr(Y.start),end:void 0}}function d(W){return Y;function Y(je){W&&W.call(this,je),p.call(this,je)}}function p(W,Y){const je=this.stack.pop(),De=this.tokenStack.pop();if(De)De[0].type!==W.type&&(Y?Y.call(this,W,De[0]):(De[1]||px).call(this,W,De[0]));else throw new Error("Cannot close `"+W.type+"` ("+Ao({start:W.start,end:W.end})+"): it’s not open");je.position.end=zr(W.end)}function m(){return FR(this.stack.pop())}function y(){this.data.expectingFirstListItemValue=!0}function x(W){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function w(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=W}function b(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=W}function E(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function k(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function _(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.value=W.replace(/(\r?\n|\r)$/g,"")}function j(W){const Y=this.resume(),je=this.stack[this.stack.length-1];je.label=Y,je.identifier=pi(this.sliceSerialize(W)).toLowerCase()}function C(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.title=W}function L(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.url=W}function U(W){const Y=this.stack[this.stack.length-1];if(!Y.depth){const je=this.sliceSerialize(W).length;Y.depth=je}}function O(){this.data.setextHeadingSlurpLineEnding=!0}function q(W){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function V(){this.data.setextHeadingSlurpLineEnding=void 0}function X(W){const je=this.stack[this.stack.length-1].children;let De=je[je.length-1];(!De||De.type!=="text")&&(De=xn(),De.position={start:zr(W.start),end:void 0},je.push(De)),this.stack.push(De)}function ge(W){const Y=this.stack.pop();Y.value+=this.sliceSerialize(W),Y.position.end=zr(W.end)}function ie(W){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const je=Y.children[Y.children.length-1];je.position.end=zr(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(X.call(this,W),ge.call(this,W))}function oe(){this.data.atHardBreak=!0}function Se(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.value=W}function re(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.value=W}function Q(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.value=W}function we(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=Y,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function me(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=Y,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function K(W){const Y=this.sliceSerialize(W),je=this.stack[this.stack.length-2];je.label=U4(Y),je.identifier=pi(Y).toLowerCase()}function ae(){const W=this.stack[this.stack.length-1],Y=this.resume(),je=this.stack[this.stack.length-1];if(this.data.inReference=!0,je.type==="link"){const De=W.children;je.children=De}else je.alt=Y}function T(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.url=W}function I(){const W=this.resume(),Y=this.stack[this.stack.length-1];Y.title=W}function H(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function ne(W){const Y=this.resume(),je=this.stack[this.stack.length-1];je.label=Y,je.identifier=pi(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function ye(W){this.data.characterReferenceType=W.type}function ue(W){const Y=this.sliceSerialize(W),je=this.data.characterReferenceType;let De;je?(De=kb(Y,je==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):De=zf(Y);const Me=this.stack[this.stack.length-1];Me.value+=De}function he(W){const Y=this.stack.pop();Y.position.end=zr(W.end)}function Ne(W){ge.call(this,W);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(W)}function Be(W){ge.call(this,W);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(W)}function We(){return{type:"blockquote",children:[]}}function It(){return{type:"code",lang:null,meta:null,value:""}}function rr(){return{type:"inlineCode",value:""}}function yn(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qn(){return{type:"emphasis",children:[]}}function Nn(){return{type:"heading",depth:0,children:[]}}function se(){return{type:"break"}}function Ee(){return{type:"html",value:""}}function Le(){return{type:"image",title:null,url:"",alt:null}}function B(){return{type:"link",title:null,url:"",children:[]}}function le(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function pe(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function Ye(){return{type:"paragraph",children:[]}}function tt(){return{type:"strong",children:[]}}function xn(){return{type:"text",value:""}}function sr(){return{type:"thematicBreak"}}}function zr(e){return{line:e.line,column:e.column,offset:e.offset}}function Ob(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?Ob(e,r):V4(e,r)}}function V4(e,t){let n;for(n in t)if(Rb.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function px(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ao({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ao({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ao({start:t.start,end:t.end})+") is still open")}function q4(e){const t=this;t.parser=n;function n(r){return $4(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function H4(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function W4(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
@@ -121,4 +121,4 @@ ${e.content}`:""}`,d=new Blob([c],{type:"text/markdown"}),p=URL.createObjectURL(
121
121
  `}),n}function kx(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function Sx(e,t){const n=II(e,t),r=n.one(e,void 0),o=SI(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return o&&a.children.push({type:"text",value:`
122
122
  `},o),a}function UI(e,t){return e&&"run"in e?async function(n,r){const o=Sx(n,{file:r,...t});await e.run(o,r)}:function(n,r){return Sx(n,{file:r,...e||t})}}function _x(e){if(e)throw e}var zd,Ex;function FI(){if(Ex)return zd;Ex=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,o=function(p){return typeof Array.isArray=="function"?Array.isArray(p):t.call(p)==="[object Array]"},a=function(p){if(!p||t.call(p)!=="[object Object]")return!1;var m=e.call(p,"constructor"),y=p.constructor&&p.constructor.prototype&&e.call(p.constructor.prototype,"isPrototypeOf");if(p.constructor&&!m&&!y)return!1;var x;for(x in p);return typeof x>"u"||e.call(p,x)},l=function(p,m){n&&m.name==="__proto__"?n(p,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):p[m.name]=m.newValue},c=function(p,m){if(m==="__proto__")if(e.call(p,m)){if(r)return r(p,m).value}else return;return p[m]};return zd=function d(){var p,m,y,x,w,b,E=arguments[0],k=1,_=arguments.length,j=!1;for(typeof E=="boolean"&&(j=E,E=arguments[1]||{},k=2),(E==null||typeof E!="object"&&typeof E!="function")&&(E={});k<_;++k)if(p=arguments[k],p!=null)for(m in p)y=c(E,m),x=c(p,m),E!==x&&(j&&x&&(a(x)||(w=o(x)))?(w?(w=!1,b=y&&o(y)?y:[]):b=y&&a(y)?y:{},l(E,{name:m,newValue:d(j,b,x)})):typeof x<"u"&&l(E,{name:m,newValue:x}));return E},zd}var $I=FI();const Ud=Jl($I);function Dh(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function BI(){const e=[],t={run:n,use:r};return t;function n(...o){let a=-1;const l=o.pop();if(typeof l!="function")throw new TypeError("Expected function as last argument, not "+l);c(null,...o);function c(d,...p){const m=e[++a];let y=-1;if(d){l(d);return}for(;++y<o.length;)(p[y]===null||p[y]===void 0)&&(p[y]=o[y]);o=p,m?VI(m,c)(...p):l(null,...p)}}function r(o){if(typeof o!="function")throw new TypeError("Expected `middelware` to be a function, not "+o);return e.push(o),t}}function VI(e,t){let n;return r;function r(...l){const c=e.length>l.length;let d;c&&l.push(o);try{d=e.apply(this,l)}catch(p){const m=p;if(c&&n)throw m;return o(m)}c||(d&&d.then&&typeof d.then=="function"?d.then(a,o):d instanceof Error?o(d):a(d))}function o(l,...c){n||(n=!0,t(l,...c))}function a(l){o(null,l)}}const Xn={basename:qI,dirname:HI,extname:WI,join:KI,sep:"/"};function qI(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ia(e);let n=0,r=-1,o=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;o--;)if(e.codePointAt(o)===47){if(a){n=o+1;break}}else r<0&&(a=!0,r=o+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let l=-1,c=t.length-1;for(;o--;)if(e.codePointAt(o)===47){if(a){n=o+1;break}}else l<0&&(a=!0,l=o+1),c>-1&&(e.codePointAt(o)===t.codePointAt(c--)?c<0&&(r=o):(c=-1,r=l));return n===r?r=l:r<0&&(r=e.length),e.slice(n,r)}function HI(e){if(ia(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function WI(e){ia(e);let t=e.length,n=-1,r=0,o=-1,a=0,l;for(;t--;){const c=e.codePointAt(t);if(c===47){if(l){r=t+1;break}continue}n<0&&(l=!0,n=t+1),c===46?o<0?o=t:a!==1&&(a=1):o>-1&&(a=-1)}return o<0||n<0||a===0||a===1&&o===n-1&&o===r+1?"":e.slice(o,n)}function KI(...e){let t=-1,n;for(;++t<e.length;)ia(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":GI(n)}function GI(e){ia(e);const t=e.codePointAt(0)===47;let n=JI(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function JI(e,t){let n="",r=0,o=-1,a=0,l=-1,c,d;for(;++l<=e.length;){if(l<e.length)c=e.codePointAt(l);else{if(c===47)break;c=47}if(c===47){if(!(o===l-1||a===1))if(o!==l-1&&a===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(d=n.lastIndexOf("/"),d!==n.length-1){d<0?(n="",r=0):(n=n.slice(0,d),r=n.length-1-n.lastIndexOf("/")),o=l,a=0;continue}}else if(n.length>0){n="",r=0,o=l,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(o+1,l):n=e.slice(o+1,l),r=l-o-1;o=l,a=0}else c===46&&a>-1?a++:a=-1}return n}function ia(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const YI={cwd:XI};function XI(){return"/"}function Lh(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function QI(e){if(typeof e=="string")e=new URL(e);else if(!Lh(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return ZI(e)}function ZI(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const o=new TypeError("File URL path must not include encoded / characters");throw o.code="ERR_INVALID_FILE_URL_PATH",o}}return decodeURIComponent(t)}const Fd=["history","path","basename","stem","extname","dirname"];class Bb{constructor(t){let n;t?Lh(t)?n={path:t}:typeof t=="string"||eD(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":YI.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Fd.length;){const a=Fd[r];a in n&&n[a]!==void 0&&n[a]!==null&&(this[a]=a==="history"?[...n[a]]:n[a])}let o;for(o in n)Fd.includes(o)||(this[o]=n[o])}get basename(){return typeof this.path=="string"?Xn.basename(this.path):void 0}set basename(t){Bd(t,"basename"),$d(t,"basename"),this.path=Xn.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Xn.dirname(this.path):void 0}set dirname(t){jx(this.basename,"dirname"),this.path=Xn.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Xn.extname(this.path):void 0}set extname(t){if($d(t,"extname"),jx(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Xn.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Lh(t)&&(t=QI(t)),Bd(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Xn.basename(this.path,this.extname):void 0}set stem(t){Bd(t,"stem"),$d(t,"stem"),this.path=Xn.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const o=this.message(t,n,r);throw o.fatal=!0,o}info(t,n,r){const o=this.message(t,n,r);return o.fatal=void 0,o}message(t,n,r){const o=new Vt(t,n,r);return this.path&&(o.name=this.path+":"+o.name,o.file=this.path),o.fatal=!1,this.messages.push(o),o}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function $d(e,t){if(e&&e.includes(Xn.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Xn.sep+"`")}function Bd(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jx(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function eD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const tD=(function(e){const r=this.constructor.prototype,o=r[e],a=function(){return o.apply(a,arguments)};return Object.setPrototypeOf(a,r),a}),nD={}.hasOwnProperty;class Hf extends tD{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=BI()}copy(){const t=new Hf;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ud(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Hd("data",this.frozen),this.namespace[t]=n,this):nD.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Hd("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const o=n.call(t,...r);typeof o=="function"&&this.transformers.use(o)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=El(t),r=this.parser||this.Parser;return Vd("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Vd("process",this.parser||this.Parser),qd("process",this.compiler||this.Compiler),n?o(void 0,n):new Promise(o);function o(a,l){const c=El(t),d=r.parse(c);r.run(d,c,function(m,y,x){if(m||!y||!x)return p(m);const w=y,b=r.stringify(w,x);iD(b)?x.value=b:x.result=b,p(m,x)});function p(m,y){m||!y?l(m):a?a(y):n(void 0,y)}}}processSync(t){let n=!1,r;return this.freeze(),Vd("processSync",this.parser||this.Parser),qd("processSync",this.compiler||this.Compiler),this.process(t,o),Cx("processSync","process",n),r;function o(a,l){n=!0,_x(a),r=l}}run(t,n,r){Tx(t),this.freeze();const o=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?a(void 0,r):new Promise(a);function a(l,c){const d=El(n);o.run(t,d,p);function p(m,y,x){const w=y||t;m?c(m):l?l(w):r(void 0,w,x)}}}runSync(t,n){let r=!1,o;return this.run(t,n,a),Cx("runSync","run",r),o;function a(l,c){_x(l),o=c,r=!0}}stringify(t,n){this.freeze();const r=El(n),o=this.compiler||this.Compiler;return qd("stringify",o),Tx(t),o(t,r)}use(t,...n){const r=this.attachers,o=this.namespace;if(Hd("use",this.frozen),t!=null)if(typeof t=="function")d(t,n);else if(typeof t=="object")Array.isArray(t)?c(t):l(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function a(p){if(typeof p=="function")d(p,[]);else if(typeof p=="object")if(Array.isArray(p)){const[m,...y]=p;d(m,y)}else l(p);else throw new TypeError("Expected usable value, not `"+p+"`")}function l(p){if(!("plugins"in p)&&!("settings"in p))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");c(p.plugins),p.settings&&(o.settings=Ud(!0,o.settings,p.settings))}function c(p){let m=-1;if(p!=null)if(Array.isArray(p))for(;++m<p.length;){const y=p[m];a(y)}else throw new TypeError("Expected a list of plugins, not `"+p+"`")}function d(p,m){let y=-1,x=-1;for(;++y<r.length;)if(r[y][0]===p){x=y;break}if(x===-1)r.push([p,...m]);else if(m.length>0){let[w,...b]=m;const E=r[x][1];Dh(E)&&Dh(w)&&(w=Ud(!0,E,w)),r[x]=[p,w,...b]}}}}const rD=new Hf().freeze();function Vd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function qd(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Hd(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function Tx(e){if(!Dh(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Cx(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function El(e){return sD(e)?e:new Bb(e)}function sD(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function iD(e){return typeof e=="string"||oD(e)}function oD(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const aD="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",Nx=[],Ax={allowDangerousHtml:!0},lD=/^(https?|ircs?|mailto|xmpp)$/i,uD=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Vb(e){const t=cD(e),n=dD(e);return hD(t.runSync(t.parse(n),n),e)}function cD(e){const t=e.rehypePlugins||Nx,n=e.remarkPlugins||Nx,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...Ax}:Ax;return rD().use(q4).use(n).use(UI,r).use(t)}function dD(e){const t=e.children||"",n=new Bb;return typeof t=="string"&&(n.value=t),n}function hD(e,t){const n=t.allowedElements,r=t.allowElement,o=t.components,a=t.disallowedElements,l=t.skipHtml,c=t.unwrapDisallowed,d=t.urlTransform||fD;for(const m of uD)Object.hasOwn(t,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+aD+m.id,void 0);return $b(e,p),SR(e,{Fragment:h.Fragment,components:o,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function p(m,y,x){if(m.type==="raw"&&x&&typeof y=="number")return l?x.children.splice(y,1):x.children[y]={type:"text",value:m.value},y;if(m.type==="element"){let w;for(w in Dd)if(Object.hasOwn(Dd,w)&&Object.hasOwn(m.properties,w)){const b=m.properties[w],E=Dd[w];(E===null||E.includes(m.tagName))&&(m.properties[w]=d(String(b||""),w,m))}}if(m.type==="element"){let w=n?!n.includes(m.tagName):a?a.includes(m.tagName):!1;if(!w&&r&&typeof y=="number"&&(w=!r(m,y,x)),w&&x&&typeof y=="number")return c&&m.children?x.children.splice(y,1,...m.children):x.children.splice(y,1),y}}}function fD(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),o=e.indexOf("/");return t===-1||o!==-1&&t>o||n!==-1&&t>n||r!==-1&&t>r||lD.test(e.slice(0,t))?e:""}function pD({message:e}){const t=e.role==="user";return h.jsx("div",{className:`flex w-full ${t?"justify-end":"justify-start"}`,children:h.jsxs("div",{className:`flex gap-3 max-w-[85%] ${t?"flex-row-reverse":"flex-row"}`,children:[h.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center shrink-0 ${t?"bg-primary text-white":"bg-gradient-to-br from-indigo-500 to-purple-600 text-white shadow-lg glow-primary"}`,children:t?h.jsx(Xl,{size:16}):h.jsx(eS,{size:16})}),h.jsxs("div",{className:`flex flex-col ${t?"items-end":"items-start"}`,children:[h.jsx("div",{className:`px-5 py-3.5 rounded-2xl text-sm leading-relaxed shadow-sm ${t?"bg-primary/10 text-fg border border-primary/20 rounded-tr-none":"bg-surface/80 backdrop-blur-md text-fg border border-border/40 rounded-tl-none"}`,children:t?h.jsx("p",{className:"whitespace-pre-wrap",children:e.content}):h.jsx("div",{className:"markdown-body",children:h.jsx(Vb,{components:{p:({node:n,...r})=>h.jsx("p",{className:"mb-2 last:mb-0",...r}),a:({node:n,...r})=>h.jsx("a",{className:"text-primary hover:underline",...r}),ul:({node:n,...r})=>h.jsx("ul",{className:"list-disc ml-4 mb-2",...r}),ol:({node:n,...r})=>h.jsx("ol",{className:"list-decimal ml-4 mb-2",...r}),code:({node:n,...r})=>h.jsx("code",{className:"bg-black/20 rounded px-1 py-0.5 font-mono text-xs",...r})},children:e.content})})}),h.jsx("span",{className:"text-[10px] text-fg/30 mt-1 px-1",children:new Date(e.created_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})})]})]})})}function mD({sessionId:e,onContextUpdate:t,onNewSession:n,onSessionCreated:r}){const[o,a]=P.useState([]),[l,c]=P.useState(""),[d,p]=P.useState(!1),[m,y]=P.useState(!1),x=P.useRef(null),w=P.useRef(null);P.useEffect(()=>{e?b(e):(a([]),t([]))},[e,t]),P.useEffect(()=>{x.current&&x.current.scrollIntoView({behavior:"smooth"})},[o,m]);const b=async _=>{try{const{data:{session:j}}=await ce.auth.getSession();if(!j)return;const C=await He.get(`/api/chat/sessions/${_}/messages`,{headers:{"x-user-id":j.user.id}});if(C.data.success){a(C.data.messages);const L=C.data.messages[C.data.messages.length-1];L&&L.role==="assistant"&&L.context_sources&&t(L.context_sources)}}catch(j){console.error("Failed to fetch messages",j)}},E=async _=>{if(_?.preventDefault(),!l.trim()||d)return;const j=l.trim();c(""),w.current&&(w.current.style.height="auto");const{data:{session:C}}=await ce.auth.getSession();if(!C)return;const L=C.user.id;p(!0),y(!0);try{let U=e;if(!U){const V=await He.post("/api/chat/sessions",{},{headers:{"x-user-id":L}});if(V.data.success)U=V.data.session.id,r(U);else throw new Error("Failed to create session")}const O={id:"temp-"+Date.now(),role:"user",content:j,created_at:new Date().toISOString()};a(V=>[...V,O]);const q=await He.post("/api/chat/message",{sessionId:U,content:j},{headers:{"x-user-id":L}});if(q.data.success){const V=q.data.message;a(X=>[...X,V]),V.context_sources&&t(V.context_sources)}}catch(U){console.error("Message failed",U),a(O=>[...O,{id:"err-"+Date.now(),role:"assistant",content:"Sorry, I encountered an error processing your request.",created_at:new Date().toISOString()}])}finally{p(!1),y(!1)}},k=_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),E())};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-6",children:[o.length===0?h.jsxs("div",{className:"h-full flex flex-col items-center justify-center p-8 text-center opacity-60",children:[h.jsx("div",{className:"w-16 h-16 bg-primary/10 rounded-2xl flex items-center justify-center mb-4 text-primary animate-pulse",children:h.jsx(CS,{size:32})}),h.jsx("h3",{className:"text-xl font-bold mb-2",children:"Ask Alchemist"}),h.jsx("p",{className:"text-sm max-w-md mx-auto mb-8",children:"I can help you recall information, summarize topics, and find insights from your browsing history."}),h.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3 max-w-lg w-full",children:["What have I read about React recently?","Summarize the latest AI news I visited.","Do I have any notes on Finance?","Find articles about 'Performance'"].map((_,j)=>h.jsx("button",{onClick:()=>c(_),className:"text-left p-3 text-xs bg-surface/50 hover:bg-surface border border-border/30 rounded-xl transition-all hover:scale-[1.02]",children:_},j))})]}):h.jsxs(h.Fragment,{children:[o.map((_,j)=>h.jsx(pD,{message:_},_.id||j)),m&&h.jsx($e.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},className:"flex justify-start w-full",children:h.jsxs("div",{className:"bg-surface/50 border border-border/30 rounded-2xl px-4 py-3 flex items-center gap-3",children:[h.jsxs("div",{className:"flex gap-1",children:[h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0s"}}),h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0.1s"}}),h.jsx("span",{className:"w-1.5 h-1.5 bg-primary/60 rounded-full animate-bounce",style:{animationDelay:"0.2s"}})]}),h.jsx("span",{className:"text-xs text-fg/50 font-mono",children:"Exploring memory..."})]})})]}),h.jsx("div",{ref:x})]}),h.jsx("div",{className:"p-4 bg-surface/30 border-t border-border/10 backdrop-blur-md",children:h.jsx("form",{onSubmit:E,className:"relative max-w-4xl mx-auto",children:h.jsxs("div",{className:"relative flex items-end gap-2 bg-surface/80 border border-border/40 rounded-2xl px-2 py-2 shadow-sm focus-within:ring-2 focus-within:ring-primary/50 focus-within:border-primary/50 transition-all",children:[h.jsx("textarea",{ref:w,value:l,onChange:_=>{c(_.target.value),_.target.style.height="auto",_.target.style.height=_.target.scrollHeight+"px"},onKeyDown:k,placeholder:"Ask about your history...",rows:1,className:"w-full bg-transparent border-none focus:ring-0 focus:outline-none py-2 pl-2 text-fg resize-none min-h-[24px] max-h-[200px] placeholder:text-fg/40",disabled:d}),h.jsx("button",{type:"submit",disabled:!l.trim()||d,className:"p-2 mb-0.5 bg-primary text-white rounded-xl shadow-lg hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed transition-all shrink-0",children:d?h.jsx(Yl,{size:18,className:"animate-spin"}):h.jsx(ES,{size:18})})]})})})]})}function gD({sources:e,onClose:t}){return!e||e.length===0?null:h.jsxs($e.div,{initial:{opacity:0,x:20,width:0},animate:{opacity:1,x:0,width:300},exit:{opacity:0,x:20,width:0},className:"glass rounded-2xl border border-border/40 overflow-hidden flex flex-col",children:[h.jsxs("div",{className:"p-4 border-b border-border/10 flex items-center justify-between bg-surface/30",children:[h.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold text-fg/80",children:[h.jsx(Px,{size:16,className:"text-secondary"}),h.jsx("span",{children:"Relevant Context"})]}),h.jsx("button",{onClick:t,className:"p-1 hover:bg-surface rounded-md text-fg/40 hover:text-fg transition-colors",children:h.jsx(tr,{size:14})})]}),h.jsx("div",{className:"flex-1 overflow-y-auto p-3 space-y-3",children:e.map((n,r)=>h.jsxs("div",{className:"p-3 bg-surface/40 hover:bg-surface/60 border border-border/20 rounded-xl transition-all group",children:[h.jsxs("div",{className:"flex justify-between items-start mb-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"flex items-center justify-center w-4 h-4 bg-primary/10 text-primary text-[10px] font-bold rounded",children:r+1}),h.jsxs("span",{className:`text-[10px] font-bold px-1.5 py-0.5 rounded border ${n.score>=80?"bg-yellow-500/10 text-yellow-500 border-yellow-500/20":"bg-blue-500/10 text-blue-400 border-blue-500/20"}`,children:[n.score,"% Match"]})]}),h.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"opacity-0 group-hover:opacity-100 text-fg/40 hover:text-primary transition-opacity",children:h.jsx(bi,{size:12})})]}),h.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs font-bold text-fg/90 block mb-1 hover:text-primary transition-colors line-clamp-2",children:n.title}),h.jsx("p",{className:"text-[10px] text-fg/50 line-clamp-3 leading-relaxed",children:n.summary})]},r))}),h.jsxs("div",{className:"p-3 border-t border-border/10 bg-surface/30 text-[10px] text-center text-fg/30",children:["Alchemist used these ",e.length," signals to answer"]})]})}function yD(){const[e,t]=P.useState(null),[n,r]=P.useState([]),[o,a]=P.useState(!0);return h.jsxs("div",{className:"flex h-full gap-4 overflow-hidden",children:[h.jsx(GP,{activeSessionId:e,onSelectSession:t}),h.jsx("div",{className:"flex-1 flex flex-col min-w-0 glass rounded-2xl overflow-hidden border border-border/40 relative",children:h.jsx(mD,{sessionId:e,onContextUpdate:l=>{r(l),l.length>0&&a(!0)},onNewSession:()=>t(null),onSessionCreated:l=>t(l)})}),o&&h.jsx(gD,{sources:n,onClose:()=>a(!1)})]})}function xD({isOpen:e,onClose:t}){const[n,r]=P.useState(""),[o,a]=P.useState(!0);P.useEffect(()=>{e&&l()},[e]);const l=async()=>{a(!0);try{const d=await(await fetch("/CHANGELOG.md")).text();r(d)}catch(c){console.error("Failed to load changelog:",c),r(`# Error
123
123
 
124
- Failed to load changelog.`)}finally{a(!1)}};return h.jsx(Zt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50"}),h.jsx($e.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",damping:25,stiffness:300},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:h.jsxs("div",{className:"glass w-full max-w-3xl max-h-[80vh] overflow-hidden pointer-events-auto shadow-2xl",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(Px,{size:24,className:"text-primary"}),h.jsx("h2",{className:"text-xl font-bold",children:"Release Notes"})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(tr,{size:20,className:"text-fg/60"})})]}),h.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar max-h-[calc(80vh-88px)]",children:o?h.jsx("div",{className:"flex items-center justify-center py-12",children:h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent"})}):h.jsx(Vb,{components:{h1:({children:c})=>h.jsx("h1",{className:"text-2xl font-bold text-fg mb-6 mt-0",children:c}),h2:({children:c})=>h.jsx("h2",{className:"text-xl font-bold text-fg mt-8 mb-3 pb-2 border-b border-border first:mt-0",children:c}),h3:({children:c})=>h.jsx("h3",{className:"text-lg font-bold text-primary mt-6 mb-2",children:c}),p:({children:c})=>h.jsx("p",{className:"text-sm text-fg/70 mb-3 leading-relaxed",children:c}),ul:({children:c})=>h.jsx("ul",{className:"list-none space-y-1 mb-4 ml-0",children:c}),li:({children:c})=>h.jsx("li",{className:"text-sm text-fg/80 ml-4 mb-1 before:content-['•'] before:mr-2 before:text-primary",children:c}),a:({href:c,children:d})=>h.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 underline transition-colors",children:d}),code:({children:c})=>h.jsx("code",{className:"bg-surface/50 text-accent px-1.5 py-0.5 rounded text-xs font-mono border border-border",children:c}),strong:({children:c})=>h.jsx("strong",{className:"font-bold text-fg",children:c})},children:n})})]})})]})})}class vD{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}playTone(t,n,r=.3){if(this.enabled)try{const o=this.getAudioContext(),a=o.createOscillator(),l=o.createGain();a.connect(l),l.connect(o.destination),a.frequency.value=t,a.type="sine",l.gain.setValueAtTime(r,o.currentTime),l.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),a.start(o.currentTime),a.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(t,n=.3){if(!this.enabled)return;let r=0;t.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},r),r+=o.delay})}syncStart(){this.playSequence([{freq:261.63,duration:.15,delay:0},{freq:329.63,duration:.15,delay:100},{freq:392,duration:.2,delay:100}],.2)}signalFound(){this.playSequence([{freq:392,duration:.1,delay:0},{freq:523.25,duration:.15,delay:80}],.25)}syncComplete(){this.playSequence([{freq:261.63,duration:.12,delay:0},{freq:329.63,duration:.12,delay:80},{freq:392,duration:.12,delay:80},{freq:523.25,duration:.2,delay:80}],.2)}error(){this.playSequence([{freq:329.63,duration:.15,delay:0},{freq:261.63,duration:.2,delay:100}],.3)}click(){this.playTone(440,.05,.15)}}const xo=new vD;function wD(){const[e,t]=P.useState([]),[n,r]=P.useState([]),[o,a]=P.useState("discovery"),[l,c]=P.useState(!1),[d,p]=P.useState(null),[m,y]=P.useState(!0),[x,w]=P.useState(!W0),[b,E]=P.useState(!0),[k,_]=P.useState(!1),[j,C]=P.useState(!1),[L,U]=P.useState(null),[O,q]=P.useState(!1),[V,X]=P.useState(!1),[ge,ie]=P.useState(!1),[oe,Se]=P.useState(!0),[re,Q]=P.useState(()=>localStorage.getItem("theme")||"dark"),[we,me]=P.useState(null),K=P.useRef(null);P.useMemo(()=>{const ne=n.length;let ye=0,ue=0,he=null;for(const We of n){ye+=We.score,We.score>ue&&(ue=We.score);const It=new Date(We.date);(!he||It>new Date(he.date))&&(he=We)}const Ne=ne?Math.round(ye/ne):0,Be=he?new Date(he.date):null;return{total:ne,average:Ne,top:ue,latestTimestamp:Be,latestTitle:he?.title??he?.category??null}},[n]),P.useEffect(()=>{(async()=>{if(!W0){w(!0),y(!1);return}try{const{data:ue,error:he}=await ce.from("init_state").select("is_initialized").single();he?(console.warn("[App] Init check error (might be fresh DB):",he),he.code==="42P01"&&E(!1)):E(ue.is_initialized>0);const{data:{session:Ne}}=await ce.auth.getSession();p(Ne?.user??null)}catch(ue){console.error("[App] Status check failed:",ue)}finally{y(!1)}})();const{data:{subscription:ye}}=ce.auth.onAuthStateChange((ue,he)=>{p(he?.user??null)});return()=>ye.unsubscribe()},[]),P.useEffect(()=>{document.documentElement.setAttribute("data-theme",re),localStorage.setItem("theme",re)},[re]);const[ae,T]=P.useState({});P.useEffect(()=>{(async()=>{if(!d)return;const{data:ye}=await ce.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",d.id).maybeSingle();ye&&T(ye)})()},[d,O]),P.useEffect(()=>{if(!d)return;(async()=>{const{data:ue}=await ce.from("alchemy_settings").select("sound_enabled").eq("user_id",d.id).maybeSingle();if(ue){const he=ue.sound_enabled??!0;Se(he),xo.setEnabled(he)}})();const ye=ce.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${d.id}`},ue=>{const he=ue.new;he.agent_state==="Mining"&&!V&&(X(!0),ie(!0),oe&&xo.syncStart()),he.agent_state==="Signal"&&oe&&xo.signalFound(),he.agent_state==="Completed"&&(X(!1),oe&&(he.metadata?.errors>0?xo.error():xo.syncComplete()),setTimeout(()=>{ie(!1)},5e3),I())}).subscribe();return()=>{ce.removeChannel(ye)}},[d,V,oe]),P.useEffect(()=>{const ne=new EventSource("/events");return ne.onmessage=ye=>{const ue=JSON.parse(ye.data);ue.type==="history"?t(he=>[...ue.data,...he].slice(0,100)):t(he=>[ue,...he].slice(0,100))},I(),()=>ne.close()},[d]),P.useEffect(()=>{K.current&&K.current.scrollIntoView({behavior:"smooth"})},[e]);const I=async()=>{try{if(d){const{data:ye,error:ue}=await ce.from("signals").select("*").order("created_at",{ascending:!1});if(!ue&&ye){r(ye.map(he=>({id:he.id,title:he.title,score:he.score,summary:he.summary,date:he.created_at,category:he.category,entities:he.entities})));return}}const ne=await He.get("/api/signals");r(ne.data)}catch(ne){console.error("Failed to fetch signals",ne)}},H=async()=>{c(!0);try{await He.post("/api/mine"),I()}catch(ne){console.error("Mining failed:",ne)}finally{c(!1)}},N=(ne,ye)=>{ne==="logs"?(me(ye),a("logs")):a(ne)};return m?h.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:h.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):x?h.jsx(eb,{onComplete:()=>w(!1)}):d?h.jsx(bP,{children:h.jsx(EP,{children:h.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[h.jsxs($e.aside,{animate:{width:k?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[h.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${k?"justify-center":""}`,children:[h.jsx("div",{className:"w-10 h-10 min-w-[40px] bg-gradient-to-br from-primary to-accent rounded-xl flex items-center justify-center shadow-lg glow-primary",children:h.jsx(Bn,{className:"text-white fill-current",size:24})}),!k&&h.jsx($e.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),h.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[h.jsx(vo,{active:o==="discovery",onClick:()=>a("discovery"),icon:h.jsx(xS,{size:20}),label:"Discovery",collapsed:k}),h.jsx(vo,{active:o==="chat",onClick:()=>a("chat"),icon:h.jsx(Kd,{size:20}),label:"Chat",collapsed:k}),h.jsx(vo,{active:o==="engine",onClick:()=>a("engine"),icon:h.jsx(zh,{size:20}),label:"Engine",collapsed:k}),h.jsx(vo,{active:o==="logs",onClick:()=>a("logs"),icon:h.jsx(Jd,{size:20}),label:"System Logs",collapsed:k}),h.jsx(vo,{active:o==="account",onClick:()=>a("account"),icon:h.jsx(Xl,{size:20}),label:"Account",collapsed:k})]}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("button",{onClick:()=>Q(re==="dark"?"light":"dark"),className:`w-full flex items-center ${k?"justify-center":"gap-3"} px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium`,title:k?re==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:re==="dark"?h.jsx(AS,{size:18}):h.jsx(SS,{size:18})}),!k&&h.jsx($e.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:re==="dark"?"Light Mode":"Dark Mode"})]})}),h.jsxs("div",{className:"px-3 pb-3",children:[h.jsx("button",{onClick:()=>_(!k),className:`w-full flex items-center px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${k?"justify-center":"gap-3"}`,children:k?h.jsx(aS,{size:20}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:h.jsx(oS,{size:20})}),h.jsx("span",{children:"Collapse"})]})}),h.jsxs("button",{onClick:()=>C(!0),className:"w-full flex items-center justify-center gap-2 px-3 py-2 mt-2 text-[10px] font-mono text-fg/30 hover:text-primary hover:bg-surface/30 rounded-lg transition-all group",title:"View Changelog",children:[!k&&h.jsxs(h.Fragment,{children:[h.jsx(Gd,{size:12,className:"group-hover:text-primary transition-colors"}),h.jsxs("span",{children:["v","1.0.38"]})]}),k&&h.jsx(Gd,{size:14,className:"group-hover:text-primary transition-colors"})]})]})]}),h.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),h.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("button",{onClick:()=>q(!0),className:"px-6 py-3 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[h.jsx(jS,{size:16}),h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("span",{children:"Sync Settings"}),h.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:ae.sync_start_date?`From: ${new Date(ae.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:ae.last_sync_checkpoint?`Checkpoint: ${new Date(ae.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:"All time"})]})]}),h.jsxs("button",{onClick:H,disabled:V,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-105 active:scale-95 transition-all flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",children:[h.jsx(Yl,{size:18,className:V?"animate-spin":""}),V?"Syncing...":"Sync History"]})]})]}),h.jsx(KP,{onOpenUrl:ne=>window.open(ne,"_blank","noopener,noreferrer"),onCopyText:ne=>{navigator.clipboard.writeText(ne)}})]}),o==="chat"&&h.jsx(yD,{}),o==="engine"&&h.jsx(_P,{}),o==="account"&&h.jsx(PP,{}),o==="logs"&&h.jsx($P,{initialState:we}),h.jsx(TP,{isExpanded:ge,onToggle:()=>ie(!ge),onNavigate:N,liftUp:o==="chat"})]}),h.jsx(DP,{signal:L,onClose:()=>U(null)}),h.jsx(LP,{isOpen:O,onClose:()=>q(!1)}),h.jsx(xD,{isOpen:j,onClose:()=>C(!1)})]})})}):h.jsx(xP,{onAuthSuccess:()=>I(),isInitialized:b})}function vo({active:e,icon:t,label:n,onClick:r,collapsed:o}){return h.jsx("button",{onClick:r,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${e?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?Oo.cloneElement(t,{className:e?"text-primary":""}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:Oo.cloneElement(t,{className:e?"text-primary":""})}),h.jsx($e.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function bD(){He.interceptors.request.use(async e=>{try{const{data:{session:t}}=await ce.auth.getSession();t?.access_token&&(e.headers.Authorization=`Bearer ${t.access_token}`);const n=Nf();n&&(e.headers["x-supabase-url"]=n.url,e.headers["x-supabase-key"]=n.anonKey)}catch(t){console.error("[Axios] Error injecting headers:",t)}return e})}bD();Kk.createRoot(document.getElementById("root")).render(h.jsx(Oo.StrictMode,{children:h.jsx(wD,{})}));
124
+ Failed to load changelog.`)}finally{a(!1)}};return h.jsx(Zt,{children:e&&h.jsxs(h.Fragment,{children:[h.jsx($e.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},onClick:t,className:"fixed inset-0 bg-black/60 backdrop-blur-sm z-50"}),h.jsx($e.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:20},transition:{type:"spring",damping:25,stiffness:300},className:"fixed inset-0 z-50 flex items-center justify-center p-4 pointer-events-none",children:h.jsxs("div",{className:"glass w-full max-w-3xl max-h-[80vh] overflow-hidden pointer-events-auto shadow-2xl",children:[h.jsxs("div",{className:"flex items-center justify-between p-6 border-b border-border",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(Px,{size:24,className:"text-primary"}),h.jsx("h2",{className:"text-xl font-bold",children:"Release Notes"})]}),h.jsx("button",{onClick:t,className:"p-2 hover:bg-surface rounded-lg transition-colors",children:h.jsx(tr,{size:20,className:"text-fg/60"})})]}),h.jsx("div",{className:"p-6 overflow-y-auto custom-scrollbar max-h-[calc(80vh-88px)]",children:o?h.jsx("div",{className:"flex items-center justify-center py-12",children:h.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-2 border-primary border-t-transparent"})}):h.jsx(Vb,{components:{h1:({children:c})=>h.jsx("h1",{className:"text-2xl font-bold text-fg mb-6 mt-0",children:c}),h2:({children:c})=>h.jsx("h2",{className:"text-xl font-bold text-fg mt-8 mb-3 pb-2 border-b border-border first:mt-0",children:c}),h3:({children:c})=>h.jsx("h3",{className:"text-lg font-bold text-primary mt-6 mb-2",children:c}),p:({children:c})=>h.jsx("p",{className:"text-sm text-fg/70 mb-3 leading-relaxed",children:c}),ul:({children:c})=>h.jsx("ul",{className:"list-none space-y-1 mb-4 ml-0",children:c}),li:({children:c})=>h.jsx("li",{className:"text-sm text-fg/80 ml-4 mb-1 before:content-['•'] before:mr-2 before:text-primary",children:c}),a:({href:c,children:d})=>h.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:text-primary/80 underline transition-colors",children:d}),code:({children:c})=>h.jsx("code",{className:"bg-surface/50 text-accent px-1.5 py-0.5 rounded text-xs font-mono border border-border",children:c}),strong:({children:c})=>h.jsx("strong",{className:"font-bold text-fg",children:c})},children:n})})]})})]})})}class vD{audioContext=null;enabled=!0;constructor(){}getAudioContext(){return this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext)),this.audioContext}setEnabled(t){this.enabled=t}isEnabled(){return this.enabled}playTone(t,n,r=.3){if(this.enabled)try{const o=this.getAudioContext(),a=o.createOscillator(),l=o.createGain();a.connect(l),l.connect(o.destination),a.frequency.value=t,a.type="sine",l.gain.setValueAtTime(r,o.currentTime),l.gain.exponentialRampToValueAtTime(.01,o.currentTime+n),a.start(o.currentTime),a.stop(o.currentTime+n)}catch(o){console.warn("[Sound] Failed to play tone:",o)}}playSequence(t,n=.3){if(!this.enabled)return;let r=0;t.forEach(o=>{setTimeout(()=>{this.playTone(o.freq,o.duration,n)},r),r+=o.delay})}syncStart(){this.playSequence([{freq:261.63,duration:.15,delay:0},{freq:329.63,duration:.15,delay:100},{freq:392,duration:.2,delay:100}],.2)}signalFound(){this.playSequence([{freq:392,duration:.1,delay:0},{freq:523.25,duration:.15,delay:80}],.25)}syncComplete(){this.playSequence([{freq:261.63,duration:.12,delay:0},{freq:329.63,duration:.12,delay:80},{freq:392,duration:.12,delay:80},{freq:523.25,duration:.2,delay:80}],.2)}error(){this.playSequence([{freq:329.63,duration:.15,delay:0},{freq:261.63,duration:.2,delay:100}],.3)}click(){this.playTone(440,.05,.15)}}const xo=new vD;function wD(){const[e,t]=P.useState([]),[n,r]=P.useState([]),[o,a]=P.useState("discovery"),[l,c]=P.useState(!1),[d,p]=P.useState(null),[m,y]=P.useState(!0),[x,w]=P.useState(!W0),[b,E]=P.useState(!0),[k,_]=P.useState(!1),[j,C]=P.useState(!1),[L,U]=P.useState(null),[O,q]=P.useState(!1),[V,X]=P.useState(!1),[ge,ie]=P.useState(!1),[oe,Se]=P.useState(!0),[re,Q]=P.useState(()=>localStorage.getItem("theme")||"dark"),[we,me]=P.useState(null),K=P.useRef(null);P.useMemo(()=>{const ne=n.length;let ye=0,ue=0,he=null;for(const We of n){ye+=We.score,We.score>ue&&(ue=We.score);const It=new Date(We.date);(!he||It>new Date(he.date))&&(he=We)}const Ne=ne?Math.round(ye/ne):0,Be=he?new Date(he.date):null;return{total:ne,average:Ne,top:ue,latestTimestamp:Be,latestTitle:he?.title??he?.category??null}},[n]),P.useEffect(()=>{(async()=>{if(!W0){w(!0),y(!1);return}try{const{data:ue,error:he}=await ce.from("init_state").select("is_initialized").single();he?(console.warn("[App] Init check error (might be fresh DB):",he),he.code==="42P01"&&E(!1)):E(ue.is_initialized>0);const{data:{session:Ne}}=await ce.auth.getSession();p(Ne?.user??null)}catch(ue){console.error("[App] Status check failed:",ue)}finally{y(!1)}})();const{data:{subscription:ye}}=ce.auth.onAuthStateChange((ue,he)=>{p(he?.user??null)});return()=>ye.unsubscribe()},[]),P.useEffect(()=>{document.documentElement.setAttribute("data-theme",re),localStorage.setItem("theme",re)},[re]);const[ae,T]=P.useState({});P.useEffect(()=>{(async()=>{if(!d)return;const{data:ye}=await ce.from("alchemy_settings").select("sync_start_date, last_sync_checkpoint").eq("user_id",d.id).maybeSingle();ye&&T(ye)})()},[d,O]),P.useEffect(()=>{if(!d)return;(async()=>{const{data:ue}=await ce.from("alchemy_settings").select("sound_enabled").eq("user_id",d.id).maybeSingle();if(ue){const he=ue.sound_enabled??!0;Se(he),xo.setEnabled(he)}})();const ye=ce.channel("processing_events").on("postgres_changes",{event:"INSERT",schema:"public",table:"processing_events",filter:`user_id=eq.${d.id}`},ue=>{const he=ue.new;he.agent_state==="Mining"&&!V&&(X(!0),ie(!0),oe&&xo.syncStart()),he.agent_state==="Signal"&&oe&&xo.signalFound(),he.agent_state==="Completed"&&(X(!1),oe&&(he.metadata?.errors>0?xo.error():xo.syncComplete()),setTimeout(()=>{ie(!1)},5e3),I())}).subscribe();return()=>{ce.removeChannel(ye)}},[d,V,oe]),P.useEffect(()=>{const ne=new EventSource("/events");return ne.onmessage=ye=>{const ue=JSON.parse(ye.data);ue.type==="history"?t(he=>[...ue.data,...he].slice(0,100)):t(he=>[ue,...he].slice(0,100))},I(),()=>ne.close()},[d]),P.useEffect(()=>{K.current&&K.current.scrollIntoView({behavior:"smooth"})},[e]);const I=async()=>{try{if(d){const{data:ye,error:ue}=await ce.from("signals").select("*").order("created_at",{ascending:!1});if(!ue&&ye){r(ye.map(he=>({id:he.id,title:he.title,score:he.score,summary:he.summary,date:he.created_at,category:he.category,entities:he.entities})));return}}const ne=await He.get("/api/signals");r(ne.data)}catch(ne){console.error("Failed to fetch signals",ne)}},H=async()=>{c(!0);try{await He.post("/api/mine"),I()}catch(ne){console.error("Mining failed:",ne)}finally{c(!1)}},N=(ne,ye)=>{ne==="logs"?(me(ye),a("logs")):a(ne)};return m?h.jsx("div",{className:"flex items-center justify-center h-screen bg-bg",children:h.jsx("div",{className:"w-12 h-12 border-4 border-primary/20 border-t-primary rounded-full animate-spin"})}):x?h.jsx(eb,{onComplete:()=>w(!1)}):d?h.jsx(bP,{children:h.jsx(EP,{children:h.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-bg text-fg",children:[h.jsxs($e.aside,{animate:{width:k?72:240},className:"glass m-4 mr-0 flex flex-col relative",children:[h.jsxs("div",{className:`px-4 py-3 pb-4 flex items-center gap-3 ${k?"justify-center":""}`,children:[h.jsx("div",{className:"w-10 h-10 min-w-[40px] bg-gradient-to-br from-primary to-accent rounded-xl flex items-center justify-center shadow-lg glow-primary",children:h.jsx(Bn,{className:"text-white fill-current",size:24})}),!k&&h.jsx($e.h1,{initial:{opacity:0},animate:{opacity:1},className:"text-xl font-bold tracking-tight",children:"Alchemist"})]}),h.jsxs("nav",{className:"flex-1 flex flex-col gap-1 px-3",children:[h.jsx(vo,{active:o==="discovery",onClick:()=>a("discovery"),icon:h.jsx(xS,{size:20}),label:"Discovery",collapsed:k}),h.jsx(vo,{active:o==="chat",onClick:()=>a("chat"),icon:h.jsx(Kd,{size:20}),label:"Chat",collapsed:k}),h.jsx(vo,{active:o==="engine",onClick:()=>a("engine"),icon:h.jsx(zh,{size:20}),label:"Engine",collapsed:k}),h.jsx(vo,{active:o==="logs",onClick:()=>a("logs"),icon:h.jsx(Jd,{size:20}),label:"System Logs",collapsed:k}),h.jsx(vo,{active:o==="account",onClick:()=>a("account"),icon:h.jsx(Xl,{size:20}),label:"Account",collapsed:k})]}),h.jsx("div",{className:"px-3 pb-2",children:h.jsxs("button",{onClick:()=>Q(re==="dark"?"light":"dark"),className:`w-full flex items-center ${k?"justify-center":"gap-3"} px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium`,title:k?re==="dark"?"Switch to Light Mode":"Switch to Dark Mode":"",children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:re==="dark"?h.jsx(AS,{size:18}):h.jsx(SS,{size:18})}),!k&&h.jsx($e.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"whitespace-nowrap",children:re==="dark"?"Light Mode":"Dark Mode"})]})}),h.jsxs("div",{className:"px-3 pb-3",children:[h.jsx("button",{onClick:()=>_(!k),className:`w-full flex items-center px-4 py-2.5 rounded-lg text-fg/40 hover:text-fg hover:bg-surface/50 transition-all text-xs font-medium ${k?"justify-center":"gap-3"}`,children:k?h.jsx(aS,{size:20}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:h.jsx(oS,{size:20})}),h.jsx("span",{children:"Collapse"})]})}),h.jsxs("button",{onClick:()=>C(!0),className:"w-full flex items-center justify-center gap-2 px-3 py-2 mt-2 text-[10px] font-mono text-fg/30 hover:text-primary hover:bg-surface/30 rounded-lg transition-all group",title:"View Changelog",children:[!k&&h.jsxs(h.Fragment,{children:[h.jsx(Gd,{size:12,className:"group-hover:text-primary transition-colors"}),h.jsxs("span",{children:["v","1.0.40"]})]}),k&&h.jsx(Gd,{size:14,className:"group-hover:text-primary transition-colors"})]})]})]}),h.jsxs("main",{className:"flex-1 flex flex-col p-4 gap-4 overflow-hidden relative",children:[o==="discovery"&&h.jsxs(h.Fragment,{children:[h.jsxs("header",{className:"flex justify-between items-center px-4 py-2",children:[h.jsxs("div",{children:[h.jsx("h2",{className:"text-2xl font-bold",children:"Discovery"}),h.jsx("p",{className:"text-sm text-fg/50",children:"Passive intelligence mining from your browser history."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs("button",{onClick:()=>q(!0),className:"px-6 py-3 glass hover:bg-surface transition-colors flex items-center gap-2 text-sm font-medium",children:[h.jsx(jS,{size:16}),h.jsxs("div",{className:"flex flex-col items-start",children:[h.jsx("span",{children:"Sync Settings"}),h.jsx("span",{className:"text-[10px] text-fg/40 font-mono",children:ae.sync_start_date?`From: ${new Date(ae.sync_start_date).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:ae.last_sync_checkpoint?`Checkpoint: ${new Date(ae.last_sync_checkpoint).toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}`:"All time"})]})]}),h.jsxs("button",{onClick:H,disabled:V,className:"px-6 py-3 bg-gradient-to-r from-primary to-accent text-white font-bold rounded-xl shadow-lg glow-primary hover:scale-105 active:scale-95 transition-all flex items-center gap-2 disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:scale-100",children:[h.jsx(Yl,{size:18,className:V?"animate-spin":""}),V?"Syncing...":"Sync History"]})]})]}),h.jsx(KP,{onOpenUrl:ne=>window.open(ne,"_blank","noopener,noreferrer"),onCopyText:ne=>{navigator.clipboard.writeText(ne)}})]}),o==="chat"&&h.jsx(yD,{}),o==="engine"&&h.jsx(_P,{}),o==="account"&&h.jsx(PP,{}),o==="logs"&&h.jsx($P,{initialState:we}),h.jsx(TP,{isExpanded:ge,onToggle:()=>ie(!ge),onNavigate:N,liftUp:o==="chat"})]}),h.jsx(DP,{signal:L,onClose:()=>U(null)}),h.jsx(LP,{isOpen:O,onClose:()=>q(!1)}),h.jsx(xD,{isOpen:j,onClose:()=>C(!1)})]})})}):h.jsx(xP,{onAuthSuccess:()=>I(),isInitialized:b})}function vo({active:e,icon:t,label:n,onClick:r,collapsed:o}){return h.jsx("button",{onClick:r,title:o?n:"",className:`w-full flex items-center ${o?"justify-center":"gap-3"} px-4 py-3 rounded-xl transition-all ${e?"bg-primary/10 text-primary shadow-sm":"text-fg/60 hover:bg-surface hover:text-fg"}`,children:o?Oo.cloneElement(t,{className:e?"text-primary":""}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"min-w-[20px] flex justify-center",children:Oo.cloneElement(t,{className:e?"text-primary":""})}),h.jsx($e.span,{initial:{opacity:0,x:-10},animate:{opacity:1,x:0},className:"font-semibold text-sm whitespace-nowrap",children:n})]})})}function bD(){He.interceptors.request.use(async e=>{try{const{data:{session:t}}=await ce.auth.getSession();t?.access_token&&(e.headers.Authorization=`Bearer ${t.access_token}`);const n=Nf();n&&(e.headers["x-supabase-url"]=n.url,e.headers["x-supabase-key"]=n.anonKey)}catch(t){console.error("[Axios] Error injecting headers:",t)}return e})}bD();Kk.createRoot(document.getElementById("root")).render(h.jsx(Oo.StrictMode,{children:h.jsx(wD,{})}));
package/dist/index.html CHANGED
@@ -9,8 +9,8 @@
9
9
  <link rel="preconnect" href="https://fonts.googleapis.com">
10
10
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
11
11
  <link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Outfit:wght@300;400;600;800&display=swap" rel="stylesheet">
12
- <script type="module" crossorigin src="/assets/index-CB7XcdOj.js"></script>
13
- <link rel="stylesheet" crossorigin href="/assets/index-Bfsk1m57.css">
12
+ <script type="module" crossorigin src="/assets/index-DHpzssGy.js"></script>
13
+ <link rel="stylesheet" crossorigin href="/assets/index-Ck7Fq1Iu.css">
14
14
  </head>
15
15
  <body>
16
16
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@realtimex/realtimex-alchemy",
3
- "version": "1.0.38",
3
+ "version": "1.0.40",
4
4
  "description": "Passive Intelligence engine for RealTimeX Alchemy. Transmute your reading time into high-density insights.",
5
5
  "type": "module",
6
6
  "main": "dist/api/index.js",
@@ -1 +0,0 @@
1
- *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:Outfit,system-ui,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:JetBrains Mono,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}body{background-color:var(--bg);color:var(--fg);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-family:Outfit,system-ui,sans-serif}::-moz-selection{background-color:var(--selection-bg)}::selection{background-color:var(--selection-bg)}.glass{background-color:var(--glass-bg);border-radius:1rem;border-width:1px;border-color:var(--border);--tw-backdrop-blur: blur(24px);-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)}.glow-primary{box-shadow:0 0 20px var(--glow-color)}.custom-scrollbar::-webkit-scrollbar{width:6px}.custom-scrollbar::-webkit-scrollbar-track{background-color:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--border)}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background-color:#f7f8ff33}input:-webkit-autofill,input:-webkit-autofill:hover,input:-webkit-autofill:focus,input:-webkit-autofill:active{-webkit-box-shadow:0 0 0 1000px var(--surface) inset!important;-webkit-text-fill-color:var(--fg)!important;caret-color:var(--fg)!important}.scrollbar-on-hover::-webkit-scrollbar{width:6px;height:6px}.scrollbar-on-hover::-webkit-scrollbar-track{background-color:transparent}.scrollbar-on-hover::-webkit-scrollbar-thumb{background-color:transparent;-webkit-transition:background-color .2s;transition:background-color .2s}.scrollbar-on-hover:hover::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--border)}.scrollbar-on-hover:hover::-webkit-scrollbar-thumb:hover{background-color:#f7f8ff33}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.-right-1{right:-.25rem}.-top-1{top:-.25rem}.bottom-32{bottom:8rem}.bottom-6{bottom:1.5rem}.left-3{left:.75rem}.right-0{right:0}.right-2{right:.5rem}.right-3{right:.75rem}.right-6{right:1.5rem}.top-0{top:0}.top-1\/2{top:50%}.top-12{top:3rem}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.z-0{z-index:0}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[60\]{z-index:60}.z-\[70\]{z-index:70}.col-span-2{grid-column:span 2 / span 2}.m-4{margin:1rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-auto{margin-left:auto;margin-right:auto}.mb-0\.5{margin-bottom:.125rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-0{margin-left:0}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-4{margin-left:1rem}.ml-auto{margin-left:auto}.mr-0{margin-right:0}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.mt-auto{margin-top:auto}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.line-clamp-3{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-8{height:2rem}.h-\[85vh\]{height:85vh}.h-full{height:100%}.h-screen{height:100vh}.max-h-96{max-height:24rem}.max-h-\[200px\]{max-height:200px}.max-h-\[600px\]{max-height:600px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(80vh-88px\)\]{max-height:calc(80vh - 88px)}.min-h-\[24px\]{min-height:24px}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-8{width:2rem}.w-\[120px\]{width:120px}.w-\[450px\]{width:450px}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-screen{width:100vw}.min-w-0{min-width:0px}.min-w-\[20px\]{min-width:20px}.min-w-\[300px\]{min-width:300px}.min-w-\[40px\]{min-width:40px}.min-w-max{min-width:-moz-max-content;min-width:max-content}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-5xl{max-width:64rem}.max-w-7xl{max-width:80rem}.max-w-\[240px\]{max-width:240px}.max-w-\[85\%\]{max-width:85%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.flex-\[2\]{flex:2}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-1\/2{--tw-translate-x: 50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-90{--tw-rotate: -90deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}@keyframes ping{75%,to{transform:scale(2);opacity:0}}.animate-ping{animation:ping 1s cubic-bezier(0,0,.2,1) infinite}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-2\.5{gap:.625rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-8{gap:2rem}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.rounded-tl-none{border-top-left-radius:0}.rounded-tr-none{border-top-right-radius:0}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-none{border-style:none}.border-amber-500\/10{border-color:#f59e0b1a}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-blue-400\/30{border-color:#60a5fa4d}.border-blue-500\/20{border-color:#3b82f633}.border-blue-500\/30{border-color:#3b82f64d}.border-border{border-color:var(--border)}.border-cyan-500\/30{border-color:#06b6d44d}.border-emerald-500\/20{border-color:#10b98133}.border-gray-400\/30{border-color:#9ca3af4d}.border-gray-500\/30{border-color:#6b72804d}.border-green-500\/20{border-color:#22c55e33}.border-green-500\/30{border-color:#22c55e4d}.border-orange-500\/20{border-color:#f9731633}.border-orange-500\/30{border-color:#f973164d}.border-primary{border-color:var(--primary)}.border-purple-500\/30{border-color:#a855f74d}.border-red-500\/20{border-color:#ef444433}.border-red-500\/30{border-color:#ef44444d}.border-teal-500\/30{border-color:#14b8a64d}.border-transparent{border-color:transparent}.border-white\/10{border-color:#ffffff1a}.border-white\/30{border-color:#ffffff4d}.border-white\/5{border-color:#ffffff0d}.border-yellow-400\/30{border-color:#facc154d}.border-yellow-500\/20{border-color:#eab30833}.border-yellow-500\/30{border-color:#eab3084d}.border-t-primary{border-top-color:var(--primary)}.border-t-transparent{border-top-color:transparent}.border-t-white{--tw-border-opacity: 1;border-top-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.bg-accent{background-color:var(--accent)}.bg-amber-500\/5{background-color:#f59e0b0d}.bg-bg{background-color:var(--bg)}.bg-black\/20{background-color:#0003}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-blue-400\/20{background-color:#60a5fa33}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/20{background-color:#3b82f633}.bg-cyan-500\/20{background-color:#06b6d433}.bg-emerald-500\/10{background-color:#10b9811a}.bg-emerald-500\/20{background-color:#10b98133}.bg-emerald-500\/5{background-color:#10b9810d}.bg-gray-400\/20{background-color:#9ca3af33}.bg-gray-500\/20{background-color:#6b728033}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-500\/10{background-color:#22c55e1a}.bg-green-500\/20{background-color:#22c55e33}.bg-orange-400{--tw-bg-opacity: 1;background-color:rgb(251 146 60 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-500\/10{background-color:#f973161a}.bg-orange-500\/20{background-color:#f9731633}.bg-primary{background-color:var(--primary)}.bg-purple-500\/20{background-color:#a855f733}.bg-red-500\/10{background-color:#ef44441a}.bg-red-500\/20{background-color:#ef444433}.bg-success{background-color:var(--success)}.bg-surface{background-color:var(--surface)}.bg-teal-500\/20{background-color:#14b8a633}.bg-transparent{background-color:transparent}.bg-white\/5{background-color:#ffffff0d}.bg-yellow-400\/20{background-color:#facc1533}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-bg{--tw-gradient-from: var(--bg) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary{--tw-gradient-from: var(--primary) var(--tw-gradient-from-position);--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.to-accent{--tw-gradient-to: var(--accent) var(--tw-gradient-to-position)}.to-purple-600{--tw-gradient-to: #9333ea var(--tw-gradient-to-position)}.to-red-500{--tw-gradient-to: #ef4444 var(--tw-gradient-to-position)}.to-red-600{--tw-gradient-to: #dc2626 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-3\.5{padding-top:.875rem;padding-bottom:.875rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-12{padding-bottom:3rem}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pb-4{padding-bottom:1rem}.pl-10{padding-left:2.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-9{padding-left:2.25rem}.pr-10{padding-right:2.5rem}.pr-4{padding-right:1rem}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-4{padding-top:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-mono{font-family:JetBrains Mono,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[9px\]{font-size:9px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.lowercase{text-transform:lowercase}.italic{font-style:italic}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-\[0\.2em\]{letter-spacing:.2em}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-\[0\.4em\]{letter-spacing:.4em}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent{color:var(--accent)}.text-amber-500{--tw-text-opacity: 1;color:rgb(245 158 11 / var(--tw-text-opacity, 1))}.text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-cyan-500{--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.text-emerald-500{--tw-text-opacity: 1;color:rgb(16 185 129 / var(--tw-text-opacity, 1))}.text-error{color:var(--error)}.text-fg{color:var(--fg)}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-orange-400{--tw-text-opacity: 1;color:rgb(251 146 60 / var(--tw-text-opacity, 1))}.text-orange-500{--tw-text-opacity: 1;color:rgb(249 115 22 / var(--tw-text-opacity, 1))}.text-primary{color:var(--primary)}.text-purple-400{--tw-text-opacity: 1;color:rgb(192 132 252 / var(--tw-text-opacity, 1))}.text-purple-500{--tw-text-opacity: 1;color:rgb(168 85 247 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-success{color:var(--success)}.text-teal-400{--tw-text-opacity: 1;color:rgb(45 212 191 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.accent-primary{accent-color:var(--primary)}.opacity-0{opacity:0}.opacity-20{opacity:.2}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_15px_rgba\(239\,68\,68\,0\.1\)\]{--tw-shadow: 0 0 15px rgba(239,68,68,.1);--tw-shadow-colored: 0 0 15px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-\[0_0_20px_rgba\(234\,179\,8\,0\.1\)\]{--tw-shadow: 0 0 20px rgba(234,179,8,.1);--tw-shadow-colored: 0 0 20px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.blur-md{--tw-blur: blur(12px);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)}.blur-xl{--tw-blur: blur(24px);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)}.grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}:root{--bg: oklch(15% .02 280);--fg: oklch(98% .01 280);--primary: oklch(65% .25 280);--accent: oklch(85% .2 90);--surface: oklch(20% .02 280);--border: oklch(35% .03 280 / .6);--success: oklch(75% .15 150);--error: oklch(65% .2 25);--glass-bg: oklch(25% .03 280 / .4);--glow-color: oklch(65% .25 280 / .3);--selection-bg: oklch(65% .25 280 / .3);--border-hover: oklch(50% .15 280 / .8)}:root[data-theme=light]{--bg: oklch(96% .005 280);--fg: oklch(15% .02 280);--primary: oklch(50% .25 280);--accent: oklch(60% .2 50);--surface: oklch(100% 0 0);--border: oklch(75% .02 280 / .8);--success: oklch(45% .15 150);--error: oklch(50% .2 25);--glass-bg: oklch(100% 0 0 / .7);--glow-color: oklch(50% .25 280 / .2);--selection-bg: oklch(50% .25 280 / .25);--border-hover: oklch(60% .15 280 / .9)}@keyframes pulse-gold{0%{box-shadow:0 0 #fac70066;box-shadow:0 0 oklch(85% .2 90 / .4)}70%{box-shadow:0 0 0 10px #fac70000;box-shadow:0 0 0 10px oklch(85% .2 90 / 0)}to{box-shadow:0 0 #fac70000;box-shadow:0 0 oklch(85% .2 90 / 0)}}.animate-pulse-gold{animation:pulse-gold 2s infinite}h1,h2,h3,h4{letter-spacing:-.025em}.font-mono{font-family:JetBrains Mono,monospace}.before\:mr-2:before{content:var(--tw-content);margin-right:.5rem}.before\:text-primary:before{content:var(--tw-content);color:var(--primary)}.before\:content-\[\'•\'\]:before{--tw-content: "•";content:var(--tw-content)}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}.autofill\:bg-surface:-webkit-autofill{background-color:var(--surface)}.autofill\:bg-surface:autofill{background-color:var(--surface)}.autofill\:text-fg:-webkit-autofill{color:var(--fg)}.autofill\:text-fg:autofill{color:var(--fg)}.focus-within\:ring-2:focus-within{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:z-10:hover{z-index:10}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.01\]:hover{--tw-scale-x: 1.01;--tw-scale-y: 1.01;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-\[var\(--border-hover\)\]:hover{border-color:var(--border-hover)}.hover\:bg-black\/10:hover{background-color:#0000001a}.hover\:bg-blue-500\/20:hover{background-color:#3b82f633}.hover\:bg-error:hover{background-color:var(--error)}.hover\:bg-orange-500:hover{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/20:hover{background-color:#ef444433}.hover\:bg-surface:hover{background-color:var(--surface)}.hover\:bg-white\/10:hover{background-color:#ffffff1a}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:bg-yellow-500\/20:hover{background-color:#eab30833}.hover\:text-accent:hover{color:var(--accent)}.hover\:text-blue-400:hover{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.hover\:text-error:hover{color:var(--error)}.hover\:text-fg:hover{color:var(--fg)}.hover\:text-primary:hover{color:var(--primary)}.hover\:text-red-400:hover{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:text-yellow-500:hover{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:border-\[var\(--border-hover\)\]:focus{border-color:var(--border-hover)}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-0:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-green-500\/30:focus{--tw-ring-color: rgb(34 197 94 / .3)}.focus\:ring-red-500\/30:focus{--tw-ring-color: rgb(239 68 68 / .3)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:grayscale:disabled{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.disabled\:hover\:scale-100:hover:disabled{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:block{display:block}.group\/btn:hover .group-hover\/btn\:translate-x-0\.5{--tw-translate-x: .125rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:text-accent{color:var(--accent)}.group:hover .group-hover\:text-blue-400{--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.group:hover .group-hover\:text-primary{color:var(--primary)}.group:hover .group-hover\:opacity-100{opacity:1}@media(min-width:640px){.sm\:h-12{height:3rem}.sm\:w-12{width:3rem}}@media(min-width:768px){.md\:w-2\/3{width:66.666667%}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}}@media(min-width:1024px){.lg\:w-1\/2{width:50%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}}