@autoai-ui/autoui 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index-C7NbIxYi.js +74 -0
- package/dist/index-CRVe9SlW.cjs +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +5 -3
- package/dist/lib/nextjs.d.ts +9 -0
- package/dist/lib/plugin.d.ts +3 -0
- package/dist/nextjs-standalone.cjs +24 -0
- package/dist/nextjs-standalone.d.ts +1 -0
- package/dist/nextjs-standalone.mjs +32 -0
- package/dist/nextjs.cjs +1 -0
- package/dist/nextjs.d.ts +2 -0
- package/dist/nextjs.mjs +6 -0
- package/dist/plugin.cjs +1 -4
- package/dist/plugin.mjs +27 -403
- package/dist/standalone-Xrc3J06Y.cjs +4 -0
- package/dist/standalone-qbUKaa9E.js +412 -0
- package/package.json +17 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { existsSync as p, writeFileSync as f } from "node:fs";
|
|
2
|
+
import { resolve as a } from "node:path";
|
|
3
|
+
import { Project as d } from "ts-morph";
|
|
4
|
+
import { l as S, a as w } from "./standalone-qbUKaa9E.js";
|
|
5
|
+
function N(s = {}) {
|
|
6
|
+
return (e = {}) => {
|
|
7
|
+
const i = s.runtimeSchemaFile || ".autoui-runtime-schema.json";
|
|
8
|
+
return {
|
|
9
|
+
...e,
|
|
10
|
+
webpack: (o, { isServer: t, dev: r }) => (typeof e.webpack == "function" && (o = e.webpack(o, { isServer: t, dev: r })), !t && r && (o.plugins = o.plugins || [], o.plugins.push(
|
|
11
|
+
new I({
|
|
12
|
+
appId: s.appId,
|
|
13
|
+
version: s.version,
|
|
14
|
+
runtimeSchemaFile: i
|
|
15
|
+
})
|
|
16
|
+
)), o)
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
class I {
|
|
21
|
+
options;
|
|
22
|
+
constructor(e) {
|
|
23
|
+
this.options = {
|
|
24
|
+
appId: e.appId || "unknown",
|
|
25
|
+
version: e.version || "1.0.0",
|
|
26
|
+
runtimeSchemaFile: e.runtimeSchemaFile || ".autoui-runtime-schema.json"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
apply(e) {
|
|
30
|
+
e.hooks.beforeCompile.tapAsync(
|
|
31
|
+
"AutoUISchemaWebpackPlugin",
|
|
32
|
+
async (i, o) => {
|
|
33
|
+
await this.generateSchema(), o();
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
async generateSchema() {
|
|
38
|
+
if (process.env.NODE_ENV === "production") {
|
|
39
|
+
console.log("[AutoUI Next.js Plugin] Skipping schema generation in production build. Using existing schema file.");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const i = process.env.NODE_ENV || "development", t = { ...S(i), ...process.env }, r = this.options.appId === "unknown" ? t.AUTOUI_APP_ID || "unknown" : this.options.appId, g = this.options.version === "1.0.0" ? t.AUTOUI_VERSION || "1.0.0" : this.options.version;
|
|
43
|
+
try {
|
|
44
|
+
let n = a(process.cwd(), "tsconfig.json");
|
|
45
|
+
if (p(n) || (n = a(process.cwd(), "tsconfig.app.json")), !p(n)) {
|
|
46
|
+
console.warn("[AutoUI Next.js Plugin] No tsconfig.json or tsconfig.app.json found, skipping schema extraction");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const l = new d({
|
|
50
|
+
tsConfigFilePath: n
|
|
51
|
+
});
|
|
52
|
+
if (l.getSourceFiles().filter(
|
|
53
|
+
(c) => !c.isDeclarationFile() && !c.getFilePath().includes("node_modules")
|
|
54
|
+
).length === 0) {
|
|
55
|
+
console.warn("[AutoUI Next.js Plugin] No source files found after filtering!");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const u = w(l, r, g);
|
|
59
|
+
if (u.components.length === 0 && u.functions.length === 0)
|
|
60
|
+
return;
|
|
61
|
+
const m = a(process.cwd(), this.options.runtimeSchemaFile), h = a(m, "..");
|
|
62
|
+
if (!p(h)) {
|
|
63
|
+
const { mkdirSync: c } = await import("node:fs");
|
|
64
|
+
c(h, { recursive: !0 });
|
|
65
|
+
}
|
|
66
|
+
f(m, JSON.stringify(u, null, 2), "utf-8"), console.log(`[AutoUI Next.js Plugin] Schema written to ${this.options.runtimeSchemaFile}`);
|
|
67
|
+
} catch (n) {
|
|
68
|
+
console.error("❌ [AutoUI Next.js Plugin] Error in plugin:", n), n instanceof Error && (console.error(` Error message: ${n.message}`), n.stack && console.error(` Stack trace: ${n.stack}`));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
N as w
|
|
74
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var S=Object.create;var g=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var k=(n,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of w(e))!P.call(n,o)&&o!==t&&g(n,o,{get:()=>e[o],enumerable:!(s=I(e,o))||s.enumerable});return n};var U=(n,e,t)=>(t=n!=null?S(v(n)):{},k(e||!n||!n.__esModule?g(t,"default",{value:n,enumerable:!0}):t,n));const a=require("node:fs"),u=require("node:path"),j=require("ts-morph"),d=require("./standalone-Xrc3J06Y.cjs");function A(n={}){return(e={})=>{const t=n.runtimeSchemaFile||".autoui-runtime-schema.json";return{...e,webpack:(s,{isServer:o,dev:r})=>(typeof e.webpack=="function"&&(s=e.webpack(s,{isServer:o,dev:r})),!o&&r&&(s.plugins=s.plugins||[],s.plugins.push(new F({appId:n.appId,version:n.version,runtimeSchemaFile:t}))),s)}}}class F{options;constructor(e){this.options={appId:e.appId||"unknown",version:e.version||"1.0.0",runtimeSchemaFile:e.runtimeSchemaFile||".autoui-runtime-schema.json"}}apply(e){e.hooks.beforeCompile.tapAsync("AutoUISchemaWebpackPlugin",async(t,s)=>{await this.generateSchema(),s()})}async generateSchema(){if(process.env.NODE_ENV==="production"){console.log("[AutoUI Next.js Plugin] Skipping schema generation in production build. Using existing schema file.");return}const t=process.env.NODE_ENV||"development",o={...d.loadEnvVars(t),...process.env},r=this.options.appId==="unknown"?o.AUTOUI_APP_ID||"unknown":this.options.appId,f=this.options.version==="1.0.0"?o.AUTOUI_VERSION||"1.0.0":this.options.version;try{let i=u.resolve(process.cwd(),"tsconfig.json");if(a.existsSync(i)||(i=u.resolve(process.cwd(),"tsconfig.app.json")),!a.existsSync(i)){console.warn("[AutoUI Next.js Plugin] No tsconfig.json or tsconfig.app.json found, skipping schema extraction");return}const p=new j.Project({tsConfigFilePath:i});if(p.getSourceFiles().filter(c=>!c.isDeclarationFile()&&!c.getFilePath().includes("node_modules")).length===0){console.warn("[AutoUI Next.js Plugin] No source files found after filtering!");return}const l=d.generateSchema(p,r,f);if(l.components.length===0&&l.functions.length===0)return;const h=u.resolve(process.cwd(),this.options.runtimeSchemaFile),m=u.resolve(h,"..");if(!a.existsSync(m)){const{mkdirSync:c}=await import("node:fs");c(m,{recursive:!0})}a.writeFileSync(h,JSON.stringify(l,null,2),"utf-8"),console.log(`[AutoUI Next.js Plugin] Schema written to ${this.options.runtimeSchemaFile}`)}catch(i){console.error("❌ [AutoUI Next.js Plugin] Error in plugin:",i),i instanceof Error&&(console.error(` Error message: ${i.message}`),i.stack&&console.error(` Stack trace: ${i.stack}`))}}}exports.withAutoUI=A;
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<%s {...props} />
|
|
5
5
|
React keys must be passed directly to JSX without using spread:
|
|
6
6
|
let props = %s;
|
|
7
|
-
<%s key={someKey} {...props} />`,K,ee,j,ee),be[ee+K]=!0)}if(ee=null,G!==void 0&&(o(G),ee=""+G),a(F)&&(o(F.key),ee=""+F.key),"key"in F){G={};for(var J in F)J!=="key"&&(G[J]=F[J])}else G=F;return ee&&i(G,typeof $=="function"?$.displayName||$.name||"Unknown":$),c($,ee,G,s(),Le,Me)}function f($){d($)?$._store&&($._store.validated=1):typeof $=="object"&&$!==null&&$.$$typeof===k&&($._payload.status==="fulfilled"?d($._payload.value)&&$._payload.value._store&&($._payload.value._store.validated=1):$._store&&($._store.validated=1))}function d($){return typeof $=="object"&&$!==null&&$.$$typeof===S}var m=C,S=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),I=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),P=Symbol.for("react.client.reference"),V=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,N=Array.isArray,D=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function($){return $()}};var X,Q={},we=m.react_stack_bottom_frame.bind(m,r)(),xe=D(n(r)),be={};nt.Fragment=x,nt.jsx=function($,F,G){var K=1e4>V.recentlyCreatedOwnerStacks++;return u($,F,G,!1,K?Error("react-stack-top-frame"):we,K?D(n($)):xe)},nt.jsxs=function($,F,G){var K=1e4>V.recentlyCreatedOwnerStacks++;return u($,F,G,!0,K?Error("react-stack-top-frame"):we,K?D(n($)):xe)}})()),nt}var ho;function zn(){return ho||(ho=1,process.env.NODE_ENV==="production"?bt.exports=Vn():bt.exports=Nn()),bt.exports}var v=zn();function Bo(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(o=Bo(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function ye(){for(var e,t,o=0,n="",s=arguments.length;o<s;o++)(e=arguments[o])&&(t=Bo(e))&&(n&&(n+=" "),n+=t);return n}const Fn=C.forwardRef(({variant:e="default",label:t,className:o,classNames:n={},color:s="currentColor",...r},a)=>{const i=C.useMemo(()=>{switch(e){case"wave":case"dots":return v.jsx("div",{className:ye("spinner-dots-wrapper",n.wrapper),children:[0,1,2].map(l=>v.jsx("i",{className:ye("spinner-dot",n.dots),style:{animationDelay:`${l*.2}s`,backgroundColor:s}},l))});case"simple":return v.jsxs("svg",{className:ye("spinner-simple",n.wrapper),width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",style:{color:s},children:[v.jsx("circle",{className:ye("spinner-simple-circle1",n.circle1),cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:ye("spinner-simple-circle2",n.circle2),fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.37 0 0 5.37 0 12h4z"})]});case"spinner":return v.jsx("div",{className:ye("spinner-bars-wrapper",n.wrapper),children:[...Array(12)].map((l,c)=>v.jsx("i",{className:ye("spinner-bar",n.spinnerBars),style:{transform:`rotate(${c*30}deg) translateY(-8px)`,animationDelay:`${c*.1}s`,backgroundColor:s}},c))});default:return v.jsxs("div",{className:ye("spinner-default",n.wrapper),children:[v.jsx("i",{className:ye("spinner-default-circle1",n.circle1),style:{borderColor:s}}),v.jsx("i",{className:ye("spinner-default-circle2",n.circle2),style:{borderColor:s}})]})}},[e,n,s]);return v.jsxs("div",{ref:a,className:ye("spinner-base",o),"aria-label":t||"Loading",...r,children:[i,t&&v.jsx("span",{className:ye("spinner-label",n.label),children:t})]})}),_o=C.createContext(void 0),Bn=({children:e,value:t,config:o})=>v.jsx(_o.Provider,{value:{...t,config:o},children:e}),Ge=()=>{const e=C.useContext(_o);if(!e)throw new Error("useChatContext must be used within a ChatProvider");return e};function Oe(...e){return e.filter(Boolean).join(" ")}const Ho="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2012H20M12%204V20'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Do="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M183.1%20137.4C170.6%20124.9%20150.3%20124.9%20137.8%20137.4C125.3%20149.9%20125.3%20170.2%20137.8%20182.7L275.2%20320L137.9%20457.4C125.4%20469.9%20125.4%20490.2%20137.9%20502.7C150.4%20515.2%20170.7%20515.2%20183.2%20502.7L320.5%20365.3L457.9%20502.6C470.4%20515.1%20490.7%20515.1%20503.2%20502.6C515.7%20490.1%20515.7%20469.8%20503.2%20457.3L365.8%20320L503.1%20182.6C515.6%20170.1%20515.6%20149.8%20503.1%20137.3C490.6%20124.8%20470.3%20124.8%20457.8%20137.3L320.5%20274.7L183.1%20137.4z'/%3e%3c/svg%3e",Uo="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%206V18M12%206L7%2011M12%206L17%2011'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",_n="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2018L20%2018'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3cpath%20d='M4%2012L20%2012'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3cpath%20d='M4%206L20%206'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e",Hn="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%201024%201024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='%23000000'%20d='M352%20192V95.936a32%2032%200%200%201%2032-32h256a32%2032%200%200%201%2032%2032V192h256a32%2032%200%201%201%200%2064H96a32%2032%200%200%201%200-64h256zm64%200h192v-64H416v64zM192%20960a32%2032%200%200%201-32-32V256h704v672a32%2032%200%200%201-32%2032H192zm224-192a32%2032%200%200%200%2032-32V416a32%2032%200%200%200-64%200v320a32%2032%200%200%200%2032%2032zm192%200a32%2032%200%200%200%2032-32V416a32%2032%200%200%200-64%200v320a32%2032%200%200%200%2032%2032z'/%3e%3c/svg%3e",Dn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M210.2%2053.9C217.6%2050.8%20226%2051.7%20232.7%2056.1L320.5%20114.3L408.3%2056.1C415%2051.7%20423.4%2050.9%20430.8%2053.9C438.2%2056.9%20443.4%2063.5%20445%2071.3L465.9%20174.5L569.1%20195.4C576.9%20197%20583.5%20202.4%20586.5%20209.7C589.5%20217%20588.7%20225.5%20584.3%20232.2L526.1%20320L584.3%20407.8C588.7%20414.5%20589.5%20422.9%20586.5%20430.3C583.5%20437.7%20576.9%20443.1%20569.1%20444.6L465.8%20465.4L445%20568.7C443.4%20576.5%20438%20583.1%20430.7%20586.1C423.4%20589.1%20414.9%20588.3%20408.2%20583.9L320.4%20525.7L232.6%20583.9C225.9%20588.3%20217.5%20589.1%20210.1%20586.1C202.7%20583.1%20197.3%20576.5%20195.8%20568.7L175%20465.4L71.7%20444.5C63.9%20442.9%2057.3%20437.5%2054.3%20430.2C51.3%20422.9%2052.1%20414.4%2056.5%20407.7L114.7%20320L56.5%20232.2C52.1%20225.5%2051.3%20217.1%2054.3%20209.7C57.3%20202.3%2063.9%20196.9%2071.7%20195.4L175%20174.6L195.9%2071.3C197.5%2063.5%20202.9%2056.9%20210.2%2053.9zM239.6%20320C239.6%20275.6%20275.6%20239.6%20320%20239.6C364.4%20239.6%20400.4%20275.6%20400.4%20320C400.4%20364.4%20364.4%20400.4%20320%20400.4C275.6%20400.4%20239.6%20364.4%20239.6%20320zM448.4%20320C448.4%20249.1%20390.9%20191.6%20320%20191.6C249.1%20191.6%20191.6%20249.1%20191.6%20320C191.6%20390.9%20249.1%20448.4%20320%20448.4C390.9%20448.4%20448.4%20390.9%20448.4%20320z'/%3e%3c/svg%3e",Un="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M320%2064C178.6%2064%2064%20178.6%2064%20320C64%20461.4%20178.6%20576%20320%20576C388.8%20576%20451.3%20548.8%20497.3%20504.6C504.6%20497.6%20506.7%20486.7%20502.6%20477.5C498.5%20468.3%20488.9%20462.6%20478.8%20463.4C473.9%20463.8%20469%20464%20464%20464C362.4%20464%20280%20381.6%20280%20280C280%20207.9%20321.5%20145.4%20382.1%20115.2C391.2%20110.7%20396.4%20100.9%20395.2%2090.8C394%2080.7%20386.6%2072.5%20376.7%2070.3C358.4%2066.2%20339.4%2064%20320%2064z'/%3e%3c/svg%3e",Wn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M320%2064C267%2064%20224%20107%20224%20160L224%20288C224%20341%20267%20384%20320%20384C373%20384%20416%20341%20416%20288L416%20160C416%20107%20373%2064%20320%2064zM176%20248C176%20234.7%20165.3%20224%20152%20224C138.7%20224%20128%20234.7%20128%20248L128%20288C128%20385.9%20201.3%20466.7%20296%20478.5L296%20528L248%20528C234.7%20528%20224%20538.7%20224%20552C224%20565.3%20234.7%20576%20248%20576L392%20576C405.3%20576%20416%20565.3%20416%20552C416%20538.7%20405.3%20528%20392%20528L344%20528L344%20478.5C438.7%20466.7%20512%20385.9%20512%20288L512%20248C512%20234.7%20501.3%20224%20488%20224C474.7%20224%20464%20234.7%20464%20248L464%20288C464%20367.5%20399.5%20432%20320%20432C240.5%20432%20176%20367.5%20176%20288L176%20248z'/%3e%3c/svg%3e",Jn=({isOpen:e,onClose:t,triggerRef:o,children:n,styles:s,position:r="top-center"})=>{const a=C.useRef(null);if(C.useEffect(()=>{const c=u=>{a.current&&!a.current.contains(u.target)&&!o.current?.contains(u.target)&&t()};return e&&document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[e,t,o]),!e||!o.current)return null;const i=o.current.getBoundingClientRect();let l={};switch(r){case"top-center":l={width:"50%",transform:"translate(-2.5%, -110%)"};break;case"bottom-left":l={top:i.bottom+6+window.scrollY,left:i.left+window.scrollX};break;case"bottom-right":l={top:i.bottom+6+window.scrollY,left:i.right+window.scrollX,transform:"translateX(-100%)"};break}return v.jsx("div",{ref:a,style:{position:"absolute",zIndex:9999,...l,...s},children:n})};function qn({isSelected:e,disableAnimation:t,...o}){return v.jsx("svg",{"aria-hidden":"true","data-selected":e,role:"presentation",viewBox:"0 0 17 18",...o,children:v.jsx("polyline",{fill:"none",points:"1 9 7 14 15 4",stroke:"currentColor",strokeDasharray:22,strokeDashoffset:e?44:66,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,style:t?{}:{transition:"stroke-dashoffset 200ms ease"}})})}const Gn=({label:e,description:t,shortcut:o,startContent:n,endContent:s,isSelected:r,isDisabled:a,onSelect:i,disableAnimation:l,hideSelectedIcon:c,selectedIcon:u})=>{const f=C.useMemo(()=>{const d=v.jsx(qn,{disableAnimation:l,isSelected:!!r});return typeof u=="function"?u({icon:d,isSelected:r,isDisabled:a}):u||d},[u,r,a,l]);return v.jsxs("li",{className:`hero-menu-item ${r?"selected":""} ${a?"disabled":""}`,onClick:()=>{console.log(1),!a&&i?.()},children:[n&&v.jsx("span",{className:"start",children:n}),v.jsxs("div",{className:"content",children:[v.jsx("span",{className:"label",children:e}),t&&v.jsx("span",{className:"description",children:t})]}),o&&v.jsx("kbd",{className:"shortcut",children:o}),!c&&v.jsx("span",{className:"selected-icon",children:f}),s&&v.jsx("span",{className:"end",children:s})]})},Yn=({items:e,defaultSelectedKey:t,onSelectionChange:o})=>{const[n,s]=C.useState(t),r=a=>{s(a),o?.(a)};return v.jsx("ul",{className:"hero-menu",children:e.map(a=>v.jsx(Gn,{label:a.label,description:a.description,shortcut:a.shortcut,startContent:a.startContent,endContent:a.endContent,isSelected:a.key===n,isDisabled:a.isDisabled,onSelect:()=>{a?.onSelect?.(),r(a.key)}},a.key))})},Xn=({items:e,button:t,popoverStyles:o,defaultSelectedKey:n,closeAfterSelect:s,onSelectionChange:r})=>{const a=C.useRef(null),[i,l]=C.useState(!1),c={ref:a,onClick:()=>{l(u=>!u)},style:{cursor:"pointer"}};return v.jsxs(v.Fragment,{children:[t?C.cloneElement(t,c):v.jsx("button",{ref:a,onClick:()=>l(u=>!u),style:{cursor:"pointer"},children:v.jsx("img",{src:_n,alt:"menu"})}),v.jsx(Jn,{styles:o,isOpen:i,onClose:()=>l(!1),triggerRef:a,children:v.jsx("div",{style:{borderRadius:10,zIndex:9999,boxShadow:"0 4px 12px rgba(0,0,0,0.12)"},children:v.jsx(Yn,{items:e,defaultSelectedKey:n,onSelectionChange:u=>{r?.(u),s?.(u)&&l(!1)}})})})]})},Zn=Mt.forwardRef(function({checked:t,defaultChecked:o,onCheckedChange:n,disabled:s=!1,required:r=!1,name:a,value:i,id:l,label:c,description:u,size:f="md",className:d,trackClassName:m,thumbClassName:S,labelClassName:b,startContent:x,endContent:g,thumb:h,"aria-label":y,"aria-labelledby":I},T){const E=typeof t=="boolean",[p,w]=Mt.useState(!!o),k=E?!!t:p,O=l??Mt.useId(),P=z=>{const N=z.target.checked;E||w(N),n?.(N,z)},V=h?.({checked:k,disabled:s,size:f})??(k?g:x);return v.jsxs("label",{className:Oe("autoui-switch",`autoui-switch--${f}`,s&&"is-disabled",d),htmlFor:O,children:[v.jsxs("span",{className:Oe("autoui-switch__control",m),"aria-hidden":"true",children:[v.jsx("input",{ref:T,id:O,className:"autoui-switch__input",type:"checkbox",checked:k,defaultChecked:o,onChange:P,disabled:s,required:r,name:a,value:i,"aria-label":y,"aria-labelledby":I}),v.jsx("span",{className:Oe("autoui-switch__track")}),v.jsx("span",{className:Oe("autoui-switch__thumb",S),children:V?v.jsx("span",{className:"autoui-switch__thumbContent",children:V}):null})]}),(c||u)&&v.jsxs("span",{className:Oe("autoui-switch__text",b),children:[c&&v.jsx("span",{className:"autoui-switch__label",children:c}),u&&v.jsx("span",{className:"autoui-switch__description",children:u})]})]})}),Qn=()=>{const{handleClear:e,setTheme:t,theme:o}=Ge();return v.jsx(Xn,{popoverStyles:{position:"absolute"},button:v.jsx("button",{type:"button",className:"autoui-chat-input-start",children:v.jsx("img",{src:Ho,alt:"menu",width:20,height:20,style:{filter:"var(--icon-filter-text)"}})}),items:[{startContent:v.jsx("img",{src:Hn,width:16,height:16,style:{filter:"var(--icon-filter-text)"}}),key:"clear",label:"Clear Messages",onSelect:e},{key:"switchTheme",label:v.jsx(Zn,{defaultChecked:o==="light",onCheckedChange:n=>{t?.(n?"light":"dark")},label:"Theme mode",thumb:({checked:n})=>v.jsx(v.Fragment,{children:n?v.jsx("img",{src:Dn,width:14,height:14,style:{filter:"var(--icon-filter-accent)"}}):v.jsx("img",{src:Un,width:14,height:14,style:{filter:"var(--icon-filter-text)"}})})})}],closeAfterSelect:n=>n!=="switchTheme",onSelectionChange:n=>console.log("Selected:",n)})},Kn=({value:e,setValue:t})=>{const{classNames:o}=Ge();return v.jsx("input",{role:"input",className:Oe("autoui-chat-textbox",o?.input),type:"text",value:e,autoFocus:!0,onChange:n=>t(n.target.value),placeholder:"Type a message...","aria-label":"Message input"})},er=()=>{const{classNames:e}=Ge();return v.jsx("button",{role:"inputButton",type:"submit",className:Oe("autoui-chat-send",e?.inputButton),"aria-label":"Send message",children:v.jsx("img",{src:Uo,alt:"arrow up",width:24,height:24,style:{filter:"var(--icon-filter-text)"}})})},tr=({lang:e="en-us"}={})=>{const t=C.useRef(null),[o,n]=C.useState(""),[s,r]=C.useState(!1),a=typeof window<"u"&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window),i=C.useCallback(()=>{if(!a||s)return;const c=window.SpeechRecognition||window.webkitSpeechRecognition;if(!c)return;const u=new c;u.lang=e,u.continuous=!1,u.interimResults=!1,u.onstart=()=>r(!0),u.onend=()=>r(!1),u.onresult=f=>{const d=f.results[0][0].transcript;n(d),r(!1)},u.onerror=()=>{u.stop(),r(!1)},t.current=u,u.start()},[a,s,e]),l=C.useCallback(()=>{t.current?.stop(),r(!1)},[]);return{start:i,stop:l,text:o,listening:s,isSupported:a}},or=({active:e,onClick:t})=>v.jsx("button",{type:"button",className:`chat-mic-btn ${e?"is-active":""}`,onClick:t,"aria-label":"Voice input",children:v.jsx("img",{src:Wn,width:20,height:20,style:{filter:"var(--icon-filter-text)"}})}),nr=()=>{const{classNames:e,handleSend:t}=Ge(),[o,n]=C.useState(""),s=tr({lang:"en-us"});C.useEffect(()=>{s.text&&n(a=>a?`${a} ${s.text}`:s.text)},[s.text]);const r=a=>{a.preventDefault(),t(o),n("")};return v.jsxs("form",{className:Oe("autoui-chat-input",e?.inputWrapper),onSubmit:r,children:[v.jsx(Qn,{}),v.jsx(Kn,{value:o,setValue:n}),s.isSupported&&v.jsx(or,{active:s.listening,onClick:()=>{s.listening?s.stop():s.start()}}),v.jsx(er,{})]})},rr=({message:e})=>{const t=e.role==="user",{classNames:o}=Ge(),n=typeof e.content=="string"||e.content instanceof String;return v.jsx("div",{role:"message",className:ye("autoui-chat-message",t?"user":"assistant",o?.message),"aria-label":t?"User message":"Assistant message",children:v.jsx("div",{className:`autoui-chat-bubble ${n?"autoui-chat-bubble--string":"autoui-chat-bubble--react-node"}`,children:e.content})})},At=0,_e=1,et=2,Wo=4;function go(e){return()=>e}function sr(e){e()}function Jo(e,t){return o=>e(t(o))}function yo(e,t){return()=>e(t)}function ir(e,t){return o=>e(t,o)}function qt(e){return e!==void 0}function ar(...e){return()=>{e.map(sr)}}function tt(){}function Ot(e,t){return t(e),e}function lr(e,t){return t(e)}function ie(...e){return e}function Z(e,t){return e(_e,t)}function U(e,t){e(At,t)}function Gt(e){e(et)}function le(e){return e(Wo)}function M(e,t){return Z(e,ir(t,At))}function je(e,t){const o=e(_e,n=>{o(),t(n)});return o}function wo(e){let t,o;return n=>s=>{t=s,o&&clearTimeout(o),o=setTimeout(()=>{n(t)},e)}}function qo(e,t){return e===t}function se(e=qo){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function _(e){return t=>o=>{e(o)&&t(o)}}function L(e){return t=>Jo(t,e)}function Ve(e){return t=>()=>{t(e)}}function R(e,...t){const o=cr(...t);return(n,s)=>{switch(n){case et:Gt(e);return;case _e:return Z(e,o(s))}}}function Ne(e,t){return o=>n=>{o(t=e(t,n))}}function qe(e){return t=>o=>{e>0?e--:t(o)}}function Fe(e){let t=null,o;return n=>s=>{t=s,!o&&(o=setTimeout(()=>{o=void 0,n(t)},e))}}function W(...e){const t=new Array(e.length);let o=0,n=null;const s=Math.pow(2,e.length)-1;return e.forEach((r,a)=>{const i=Math.pow(2,a);Z(r,l=>{const c=o;o=o|i,t[a]=l,c!==s&&o===s&&n&&(n(),n=null)})}),r=>a=>{const i=()=>{r([a].concat(t))};o===s?i():n=i}}function cr(...e){return t=>e.reduceRight(lr,t)}function ur(e){let t,o;const n=()=>t?.();return function(s,r){switch(s){case _e:return r?o===r?void 0:(n(),o=r,t=Z(e,r),t):(n(),tt);case et:n(),o=null;return}}}function A(e){let t=e;const o=q();return(n,s)=>{switch(n){case At:t=s;break;case _e:{s(t);break}case Wo:return t}return o(n,s)}}function Se(e,t){return Ot(A(t),o=>M(e,o))}function q(){const e=[];return(t,o)=>{switch(t){case At:e.slice().forEach(n=>{n(o)});return;case et:e.splice(0,e.length);return;case _e:return e.push(o),()=>{const n=e.indexOf(o);n>-1&&e.splice(n,1)}}}}function Ie(e){return Ot(q(),t=>M(e,t))}function Y(e,t=[],{singleton:o}={singleton:!0}){return{constructor:e,dependencies:t,id:dr(),singleton:o}}const dr=()=>Symbol();function pr(e){const t=new Map,o=({constructor:n,dependencies:s,id:r,singleton:a})=>{if(a&&t.has(r))return t.get(r);const i=n(s.map(l=>o(l)));return a&&t.set(r,i),i};return o(e)}function de(...e){const t=q(),o=new Array(e.length);let n=0;const s=Math.pow(2,e.length)-1;return e.forEach((r,a)=>{const i=Math.pow(2,a);Z(r,l=>{o[a]=l,n=n|i,n===s&&U(t,o)})}),function(r,a){switch(r){case et:{Gt(t);return}case _e:return n===s&&a(o),Z(t,a)}}}function B(e,t=qo){return R(e,se(t))}function _t(...e){return function(t,o){switch(t){case et:return;case _e:return ar(...e.map(n=>Z(n,o)))}}}var Ce=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ce||{});const fr={0:"debug",3:"error",1:"log",2:"warn"},mr=()=>typeof globalThis>"u"?window:globalThis,He=Y(()=>{const e=A(3);return{log:A((t,o,n=1)=>{var s;const r=(s=mr().VIRTUOSO_LOG_LEVEL)!=null?s:le(e);n>=r&&console[fr[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)}),logLevel:e}},[],{singleton:!0});function Ye(e,t,o){return Yt(e,t,o).callbackRef}function Yt(e,t,o){const n=C.useRef(null);let s=a=>{};const r=C.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(a=>{const i=()=>{const l=a[0].target;l.offsetParent!==null&&e(l)};o?i():requestAnimationFrame(i)}):null,[e,o]);return s=a=>{a&&t?(r?.observe(a),n.current=a):(n.current&&r?.unobserve(n.current),n.current=null)},{callbackRef:s,ref:n}}function hr(e,t,o,n,s,r,a,i,l){const c=C.useCallback(u=>{const f=gr(u.children,t,i?"offsetWidth":"offsetHeight",s);let d=u.parentElement;for(;!d.dataset.virtuosoScroller;)d=d.parentElement;const m=d.lastElementChild.dataset.viewportType==="window";let S;m&&(S=d.ownerDocument.defaultView);const b=a?i?a.scrollLeft:a.scrollTop:m?i?S.scrollX||S.document.documentElement.scrollLeft:S.scrollY||S.document.documentElement.scrollTop:i?d.scrollLeft:d.scrollTop,x=a?i?a.scrollWidth:a.scrollHeight:m?i?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight:i?d.scrollWidth:d.scrollHeight,g=a?i?a.offsetWidth:a.offsetHeight:m?i?S.innerWidth:S.innerHeight:i?d.offsetWidth:d.offsetHeight;n({scrollHeight:x,scrollTop:Math.max(b,0),viewportHeight:g}),r?.(i?xo("column-gap",getComputedStyle(u).columnGap,s):xo("row-gap",getComputedStyle(u).rowGap,s)),f!==null&&e(f)},[e,t,s,r,a,n,i]);return Yt(c,o,l)}function gr(e,t,o,n){const s=e.length;if(s===0)return null;const r=[];for(let a=0;a<s;a++){const i=e.item(a);if(i.dataset.index===void 0)continue;const l=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),u=t(i,o);if(u===0&&n("Zero-sized element, this should not happen",{child:i},Ce.ERROR),u===c)continue;const f=r[r.length-1];r.length===0||f.size!==u||f.endIndex!==l-1?r.push({endIndex:l,size:u,startIndex:l}):r[r.length-1].endIndex++}return r}function xo(e,t,o){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&o(`${e} was not resolved to pixel value correctly`,t,Ce.WARN),t==="normal"?0:parseInt(t??"0",10)}function Go(e,t,o){const n=C.useRef(null),s=C.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),u=c.width;let f,d;if(t){const m=t.getBoundingClientRect(),S=c.top-m.top;d=m.height-Math.max(0,S),f=S+t.scrollTop}else{const m=a.current.ownerDocument.defaultView;d=m.innerHeight-Math.max(0,c.top),f=c.top+m.scrollY}n.current={offsetTop:f,visibleHeight:d,visibleWidth:u},e(n.current)},[e,t]),{callbackRef:r,ref:a}=Yt(s,!0,o),i=C.useCallback(()=>{s(a.current)},[s,a]);return C.useEffect(()=>{var l;if(t){t.addEventListener("scroll",i);const c=new ResizeObserver(()=>{requestAnimationFrame(i)});return c.observe(t),()=>{t.removeEventListener("scroll",i),c.unobserve(t)}}else{const c=(l=a.current)==null?void 0:l.ownerDocument.defaultView;return c?.addEventListener("scroll",i),c?.addEventListener("resize",i),()=>{c?.removeEventListener("scroll",i),c?.removeEventListener("resize",i)}}},[i,t,a]),r}const Te=Y(()=>{const e=q(),t=q(),o=A(0),n=q(),s=A(0),r=q(),a=q(),i=A(0),l=A(0),c=A(0),u=A(0),f=q(),d=q(),m=A(!1),S=A(!1),b=A(!1);return M(R(e,L(({scrollTop:x})=>x)),t),M(R(e,L(({scrollHeight:x})=>x)),a),M(t,s),{deviation:o,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:u,headerHeight:i,horizontalDirection:S,scrollBy:d,scrollContainerState:e,scrollHeight:a,scrollingInProgress:m,scrollTo:f,scrollTop:t,skipAnimationFrameInResizeObserver:b,smoothScrollTargetReached:n,statefulScrollTop:s,viewportHeight:r}},[],{singleton:!0}),lt={lvl:0};function Yo(e,t){const o=e.length;if(o===0)return[];let{index:n,value:s}=t(e[0]);const r=[];for(let a=1;a<o;a++){const{index:i,value:l}=t(e[a]);r.push({end:i-1,start:n,value:s}),n=i,s=l}return r.push({end:1/0,start:n,value:s}),r}function oe(e){return e===lt}function ct(e,t){if(!oe(e))return t===e.k?e.v:t<e.k?ct(e.l,t):ct(e.r,t)}function Pe(e,t,o="k"){if(oe(e))return[-1/0,void 0];if(Number(e[o])===t)return[e.k,e.v];if(Number(e[o])<t){const n=Pe(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return Pe(e.l,t,o)}function $e(e,t,o){return oe(e)?Qo(t,o,1):t===e.k?fe(e,{k:t,v:o}):t<e.k?bo(fe(e,{l:$e(e.l,t,o)})):bo(fe(e,{r:$e(e.r,t,o)}))}function Qe(){return lt}function Ke(e,t,o){if(oe(e))return[];const n=Pe(e,t)[0];return yr(Dt(e,n,o))}function Ht(e,t){if(oe(e))return lt;const{k:o,l:n,r:s}=e;if(t===o){if(oe(n))return s;if(oe(s))return n;{const[r,a]=Zo(n);return Ct(fe(e,{k:r,l:Xo(n),v:a}))}}else return t<o?Ct(fe(e,{l:Ht(n,t)})):Ct(fe(e,{r:Ht(s,t)}))}function We(e){return oe(e)?[]:[...We(e.l),{k:e.k,v:e.v},...We(e.r)]}function Dt(e,t,o){if(oe(e))return[];const{k:n,l:s,r,v:a}=e;let i=[];return n>t&&(i=i.concat(Dt(s,t,o))),n>=t&&n<=o&&i.push({k:n,v:a}),n<=o&&(i=i.concat(Dt(r,t,o))),i}function Ct(e){const{l:t,lvl:o,r:n}=e;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(Vt(t))return Ko(fe(e,{lvl:o-1}));if(!oe(t)&&!oe(t.r))return fe(t.r,{l:fe(t,{r:t.r.l}),lvl:o,r:fe(e,{l:t.r.r,lvl:o-1})});throw new Error("Unexpected empty nodes")}else{if(Vt(e))return Ut(fe(e,{lvl:o-1}));if(!oe(n)&&!oe(n.l)){const s=n.l,r=Vt(s)?n.lvl-1:n.lvl;return fe(s,{l:fe(e,{lvl:o-1,r:s.l}),lvl:s.lvl+1,r:Ut(fe(n,{l:s.r,lvl:r}))})}else throw new Error("Unexpected empty nodes")}}function fe(e,t){return Qo(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Xo(e){return oe(e.r)?e.l:Ct(fe(e,{r:Xo(e.r)}))}function Vt(e){return oe(e)||e.lvl>e.r.lvl}function Zo(e){return oe(e.r)?[e.k,e.v]:Zo(e.r)}function Qo(e,t,o,n=lt,s=lt){return{k:e,l:n,lvl:o,r:s,v:t}}function bo(e){return Ut(Ko(e))}function Ko(e){const{l:t}=e;return!oe(t)&&t.lvl===e.lvl?fe(t,{r:fe(e,{l:t.r})}):e}function Ut(e){const{lvl:t,r:o}=e;return!oe(o)&&!oe(o.r)&&o.lvl===t&&o.r.lvl===t?fe(o,{l:fe(e,{r:o.l}),lvl:t+1}):e}function yr(e){return Yo(e,({k:t,v:o})=>({index:t,value:o}))}function en(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function ut(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Xt=Y(()=>({recalcInProgress:A(!1)}),[],{singleton:!0});function tn(e,t,o){return e[It(e,t,o)]}function It(e,t,o,n=0){let s=e.length-1;for(;n<=s;){const r=Math.floor((n+s)/2),a=e[r],i=o(a,t);if(i===0)return r;if(i===-1){if(s-n<2)return r-1;s=r-1}else{if(s===n)return r;n=r+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function wr(e,t,o,n){const s=It(e,t,n),r=It(e,o,n,s);return e.slice(s,r+1)}function Be(e,t){return Math.round(e.getBoundingClientRect()[t])}function jt(e){return!oe(e.groupOffsetTree)}function Zt({index:e},t){return t===e?0:t<e?-1:1}function xr(){return{groupIndices:[],groupOffsetTree:Qe(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Qe()}}function br(e,t){let o=oe(e)?0:1/0;for(const n of t){const{endIndex:s,size:r,startIndex:a}=n;if(o=Math.min(o,a),oe(e)){e=$e(e,0,r);continue}const i=Ke(e,a-1,s+1);if(i.some(Er(n)))continue;let l=!1,c=!1;for(const{end:u,start:f,value:d}of i)l?(s>=f||r===d)&&(e=Ht(e,f)):(c=d!==r,l=!0),u>s&&s>=f&&d!==r&&(e=$e(e,s+1,d));c&&(e=$e(e,a,r))}return[e,o]}function vr(e){return typeof e.groupIndex<"u"}function Sr({offset:e},t){return t===e?0:t<e?-1:1}function dt(e,t,o){if(t.length===0)return 0;const{index:n,offset:s,size:r}=tn(t,e,Zt),a=e-n,i=r*a+(a-1)*o+s;return i>0?i+o:i}function on(e,t){if(!jt(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function nn(e,t,o){if(vr(e))return t.groupIndices[e.groupIndex]+1;{const n=e.index==="LAST"?o:e.index;let s=on(n,t);return s=Math.max(0,s,Math.min(o,s)),s}}function Tr(e,t,o,n=0){return n>0&&(t=Math.max(t,tn(e,n,Zt).offset)),Yo(wr(e,t,o,Sr),Ir)}function Cr(e,[t,o,n,s]){t.length>0&&n("received item sizes",t,Ce.DEBUG);const r=e.sizeTree;let a=r,i=0;if(o.length>0&&oe(r)&&t.length===2){const d=t[0].size,m=t[1].size;a=o.reduce((S,b)=>$e($e(S,b,d),b+1,m),a)}else[a,i]=br(a,t);if(a===r)return e;const{lastIndex:l,lastOffset:c,lastSize:u,offsetTree:f}=Wt(e.offsetTree,i,a,s);return{groupIndices:o,groupOffsetTree:o.reduce((d,m)=>$e(d,m,dt(m,f,s)),Qe()),lastIndex:l,lastOffset:c,lastSize:u,offsetTree:f,sizeTree:a}}function $r(e){return We(e).map(({k:t,v:o},n,s)=>{const r=s[n+1];return{endIndex:r?r.k-1:1/0,size:o,startIndex:t}})}function vo(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function Wt(e,t,o,n){let s=e,r=0,a=0,i=0,l=0;if(t!==0){l=It(s,t-1,Zt),i=s[l].offset;const c=Pe(o,t-1);r=c[0],a=c[1],s.length&&s[l].size===Pe(o,t)[1]&&(l-=1),s=s.slice(0,l+1)}else s=[];for(const{start:c,value:u}of Ke(o,t,1/0)){const f=c-r,d=f*a+i+f*n;s.push({index:c,offset:d,size:u}),r=c,i=d,a=u}return{lastIndex:r,lastOffset:i,lastSize:a,offsetTree:s}}function Ir(e){return{index:e.index,value:e}}function Er(e){const{endIndex:t,size:o,startIndex:n}=e;return s=>s.start===n&&(s.end===t||s.end===1/0)&&s.value===o}const kr={offsetHeight:"height",offsetWidth:"width"},ze=Y(([{log:e},{recalcInProgress:t}])=>{const o=q(),n=q(),s=Se(n,0),r=q(),a=q(),i=A(0),l=A([]),c=A(void 0),u=A(void 0),f=A(void 0),d=A(void 0),m=A((p,w)=>Be(p,kr[w])),S=A(void 0),b=A(0),x=xr(),g=Se(R(o,W(l,e,b),Ne(Cr,x),se()),x),h=Se(R(l,se(),Ne((p,w)=>({current:w,prev:p.current}),{current:[],prev:[]}),L(({prev:p})=>p)),[]);M(R(l,_(p=>p.length>0),W(g,b),L(([p,w,k])=>{const O=p.reduce((P,V,z)=>$e(P,V,dt(V,w.offsetTree,k)||z),Qe());return{...w,groupIndices:p,groupOffsetTree:O}})),g),M(R(n,W(g),_(([p,{lastIndex:w}])=>p<w),L(([p,{lastIndex:w,lastSize:k}])=>[{endIndex:w,size:k,startIndex:p}])),o),M(c,u);const y=Se(R(c,L(p=>p===void 0)),!0);M(R(u,_(p=>p!==void 0&&oe(le(g).sizeTree)),L(p=>{const w=le(f),k=le(l).length>0;return w?k?[{endIndex:0,size:w,startIndex:0},{endIndex:1,size:p,startIndex:1}]:[]:[{endIndex:0,size:p,startIndex:0}]})),o),M(R(d,_(p=>p!==void 0&&p.length>0&&oe(le(g).sizeTree)),L(p=>{const w=[];let k=p[0],O=0;for(let P=1;P<p.length;P++){const V=p[P];V!==k&&(w.push({endIndex:P-1,size:k,startIndex:O}),k=V,O=P)}return w.push({endIndex:p.length-1,size:k,startIndex:O}),w})),o),M(R(l,W(f,u),_(([,p,w])=>p!==void 0&&w!==void 0),L(([p,w,k])=>{const O=[];for(let P=0;P<p.length;P++){const V=p[P],z=p[P+1];O.push({startIndex:V,endIndex:V,size:w}),z!==void 0&&O.push({startIndex:V+1,endIndex:z-1,size:k})}return O})),o);const I=Ie(R(o,W(g),Ne(({sizes:p},[w,k])=>({changed:k!==p,sizes:k}),{changed:!1,sizes:x}),L(p=>p.changed)));Z(R(i,Ne((p,w)=>({diff:p.prev-w,prev:w}),{diff:0,prev:0}),L(p=>p.diff)),p=>{const{groupIndices:w}=le(g);if(p>0)U(t,!0),U(r,p+vo(p,w));else if(p<0){const k=le(h);k.length>0&&(p-=vo(-p,k)),U(a,p)}}),Z(R(i,W(e)),([p,w])=>{p<0&&w("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},Ce.ERROR)});const T=Ie(r);M(R(r,W(g),L(([p,w])=>{const k=w.groupIndices.length>0,O=[],P=w.lastSize;if(k){const V=ct(w.sizeTree,0);let z=0,N=0;for(;z<p;){const X=w.groupIndices[N],Q=w.groupIndices.length===N+1?1/0:w.groupIndices[N+1]-X-1;O.push({endIndex:X,size:V,startIndex:X}),O.push({endIndex:X+1+Q-1,size:P,startIndex:X+1}),N++,z+=Q+1}const D=We(w.sizeTree);return z!==p&&D.shift(),D.reduce((X,{k:Q,v:we})=>{let xe=X.ranges;return X.prevSize!==0&&(xe=[...X.ranges,{endIndex:Q+p-1,size:X.prevSize,startIndex:X.prevIndex}]),{prevIndex:Q+p,prevSize:we,ranges:xe}},{prevIndex:p,prevSize:0,ranges:O}).ranges}return We(w.sizeTree).reduce((V,{k:z,v:N})=>({prevIndex:z+p,prevSize:N,ranges:[...V.ranges,{endIndex:z+p-1,size:V.prevSize,startIndex:V.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),o);const E=Ie(R(a,W(g,b),L(([p,{offsetTree:w},k])=>{const O=-p;return dt(O,w,k)})));return M(R(a,W(g,b),L(([p,w,k])=>{if(w.groupIndices.length>0){if(oe(w.sizeTree))return w;let O=Qe();const P=le(h);let V=0,z=0,N=0;for(;V<-p;){N=P[z];const D=P[z+1]-N-1;z++,V+=D+1}if(O=We(w.sizeTree).reduce((D,{k:X,v:Q})=>$e(D,Math.max(0,X+p),Q),O),V!==-p){const D=ct(w.sizeTree,N);O=$e(O,0,D);const X=Pe(w.sizeTree,-p+1)[1];O=$e(O,1,X)}return{...w,sizeTree:O,...Wt(w.offsetTree,0,O,k)}}else{const O=We(w.sizeTree).reduce((P,{k:V,v:z})=>$e(P,Math.max(0,V+p),z),Qe());return{...w,sizeTree:O,...Wt(w.offsetTree,0,O,k)}}})),g),{beforeUnshiftWith:T,data:S,defaultItemSize:u,firstItemIndex:i,fixedItemSize:c,fixedGroupSize:f,gap:b,groupIndices:l,heightEstimates:d,itemSize:m,listRefresh:I,shiftWith:a,shiftWithOffset:E,sizeRanges:o,sizes:g,statefulTotalCount:s,totalCount:n,trackItemSizes:y,unshiftWith:r}},ie(He,Xt),{singleton:!0});function Rr(e){return e.reduce((t,o)=>(t.groupIndices.push(t.totalCount),t.totalCount+=o+1,t),{groupIndices:[],totalCount:0})}const rn=Y(([{groupIndices:e,sizes:t,totalCount:o},{headerHeight:n,scrollTop:s}])=>{const r=q(),a=q(),i=Ie(R(r,L(Rr)));return M(R(i,L(l=>l.totalCount)),o),M(R(i,L(l=>l.groupIndices)),e),M(R(de(s,t,n),_(([l,c])=>jt(c)),L(([l,c,u])=>Pe(c.groupOffsetTree,Math.max(l-u,0),"v")[0]),se(),L(l=>[l])),a),{groupCounts:r,topItemsIndexes:a}},ie(ze,Te)),De=Y(([{log:e}])=>{const t=A(!1),o=Ie(R(t,_(n=>n),se()));return Z(t,n=>{n&&le(e)("props updated",{},Ce.DEBUG)}),{didMount:o,propsReady:t}},ie(He),{singleton:!0}),Ar=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function sn(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Ar)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const gt=Y(([{gap:e,listRefresh:t,sizes:o,totalCount:n},{fixedFooterHeight:s,fixedHeaderHeight:r,footerHeight:a,headerHeight:i,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:u,viewportHeight:f},{log:d}])=>{const m=q(),S=q(),b=A(0);let x=null,g=null,h=null;function y(){x&&(x(),x=null),h&&(h(),h=null),g&&(clearTimeout(g),g=null),U(l,!1)}return M(R(m,W(o,f,n,b,i,a,d),W(e,r,s),L(([[I,T,E,p,w,k,O,P],V,z,N])=>{const D=sn(I),{align:X,behavior:Q,offset:we}=D,xe=p-1,be=nn(D,T,xe);let $=dt(be,T.offsetTree,V)+k;X==="end"?($+=z+Pe(T.sizeTree,be)[1]-E+N,be===xe&&($+=O)):X==="center"?$+=(z+Pe(T.sizeTree,be)[1]-E+N)/2:$-=w,we&&($+=we);const F=G=>{y(),G?(P("retrying to scroll to",{location:I},Ce.DEBUG),U(m,I)):(U(S,!0),P("list did not change, scroll successful",{},Ce.DEBUG))};if(y(),Q==="smooth"){let G=!1;h=Z(t,K=>{G=G||K}),x=je(u,()=>{F(G)})}else x=je(R(t,Or(150)),F);return g=setTimeout(()=>{y()},1200),U(l,!0),P("scrolling from index to",{behavior:Q,index:be,top:$},Ce.DEBUG),{behavior:Q,top:$}})),c),{scrollTargetReached:S,scrollToIndex:m,topListHeight:b}},ie(ze,Te,He),{singleton:!0});function Or(e){return t=>{const o=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(o))}}}function Qt(e,t){e==0?t():requestAnimationFrame(()=>{Qt(e-1,t)})}function Kt(e,t){const o=t-1;return typeof e=="number"?e:e.index==="LAST"?o:e.index}const yt=Y(([{defaultItemSize:e,listRefresh:t,sizes:o},{scrollTop:n},{scrollTargetReached:s,scrollToIndex:r},{didMount:a}])=>{const i=A(!0),l=A(0),c=A(!0);return M(R(a,W(l),_(([u,f])=>!!f),Ve(!1)),i),M(R(a,W(l),_(([u,f])=>!!f),Ve(!1)),c),Z(R(de(t,a),W(i,o,e,c),_(([[,u],f,{sizeTree:d},m,S])=>u&&(!oe(d)||qt(m))&&!f&&!S),W(l)),([,u])=>{je(s,()=>{U(c,!0)}),Qt(4,()=>{je(n,()=>{U(i,!0)}),U(r,u)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:i}},ie(ze,Te,gt,De),{singleton:!0});function an(e,t){return Math.abs(e-t)<1.01}const pt="up",rt="down",jr="none",Pr={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Lr=0,wt=Y(([{footerHeight:e,headerHeight:t,scrollBy:o,scrollContainerState:n,scrollTop:s,viewportHeight:r}])=>{const a=A(!1),i=A(!0),l=q(),c=q(),u=A(4),f=A(Lr),d=Se(R(_t(R(B(s),qe(1),Ve(!0)),R(B(s),qe(1),Ve(!1),wo(100))),se()),!1),m=Se(R(_t(R(o,Ve(!0)),R(o,Ve(!1),wo(200))),se()),!1);M(R(de(B(s),B(f)),L(([h,y])=>h<=y),se()),i),M(R(i,Fe(50)),c);const S=Ie(R(de(n,B(r),B(t),B(e),B(u)),Ne((h,[{scrollHeight:y,scrollTop:I},T,E,p,w])=>{const k=I+T-y>-w,O={scrollHeight:y,scrollTop:I,viewportHeight:T};if(k){let V,z;return I>h.state.scrollTop?(V="SCROLLED_DOWN",z=h.state.scrollTop-I):(V="SIZE_DECREASED",z=h.state.scrollTop-I||h.scrollTopDelta),{atBottom:!0,atBottomBecause:V,scrollTopDelta:z,state:O}}let P;return O.scrollHeight>h.state.scrollHeight?P="SIZE_INCREASED":T<h.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":I<h.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:O}},Pr),se((h,y)=>h&&h.atBottom===y.atBottom))),b=Se(R(n,Ne((h,{scrollHeight:y,scrollTop:I,viewportHeight:T})=>{if(an(h.scrollHeight,y))return{changed:!1,jump:0,scrollHeight:y,scrollTop:I};{const E=y-(I+T)<1;return h.scrollTop!==I&&E?{changed:!0,jump:h.scrollTop-I,scrollHeight:y,scrollTop:I}:{changed:!0,jump:0,scrollHeight:y,scrollTop:I}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),_(h=>h.changed),L(h=>h.jump)),0);M(R(S,L(h=>h.atBottom)),a),M(R(a,Fe(50)),l);const x=A(rt);M(R(n,L(({scrollTop:h})=>h),se(),Ne((h,y)=>le(m)?{direction:h.direction,prevScrollTop:y}:{direction:y<h.prevScrollTop?pt:rt,prevScrollTop:y},{direction:rt,prevScrollTop:0}),L(h=>h.direction)),x),M(R(n,Fe(50),Ve(jr)),x);const g=A(0);return M(R(d,_(h=>!h),Ve(0)),g),M(R(s,Fe(100),W(d),_(([h,y])=>!!y),Ne(([h,y],[I])=>[y,I],[0,0]),L(([h,y])=>y-h)),g),{atBottomState:S,atBottomStateChange:l,atBottomThreshold:u,atTopStateChange:c,atTopThreshold:f,isAtBottom:a,isAtTop:i,isScrolling:d,lastJumpDueToItemResize:b,scrollDirection:x,scrollVelocity:g}},ie(Te)),ft="top",mt="bottom",So="none";function To(e,t,o){return typeof e=="number"?o===pt&&t===ft||o===rt&&t===mt?e:0:o===pt?t===ft?e.main:e.reverse:t===mt?e.main:e.reverse}function Co(e,t){var o;return typeof e=="number"?e:(o=e[t])!=null?o:0}const eo=Y(([{deviation:e,fixedHeaderHeight:t,headerHeight:o,scrollTop:n,viewportHeight:s}])=>{const r=q(),a=A(0),i=A(0),l=A(0),c=Se(R(de(B(n),B(s),B(o),B(r,ut),B(l),B(a),B(t),B(e),B(i)),L(([u,f,d,[m,S],b,x,g,h,y])=>{const I=u-h,T=x+g,E=Math.max(d-I,0);let p=So;const w=Co(y,ft),k=Co(y,mt);return m-=h,m+=d+g,S+=d+g,S-=h,m>u+T-w&&(p=pt),S<u-E+f+k&&(p=rt),p!==So?[Math.max(I-d-To(b,ft,p)-w,0),I-E-g+f+To(b,mt,p)+k]:null}),_(u=>u!=null),se(ut)),[0,0]);return{increaseViewportBy:i,listBoundary:r,overscan:l,topListHeight:a,visibleRange:c}},ie(Te),{singleton:!0});function Mr(e,t,o){if(jt(t)){const n=on(e,t);return[{index:Pe(t.groupOffsetTree,n)[0],offset:0,size:0},{data:o?.[0],index:n,offset:0,size:0}]}return[{data:o?.[0],index:e,offset:0,size:0}]}const Nt={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function $t(e,t,o,n,s,r){const{lastIndex:a,lastOffset:i,lastSize:l}=s;let c=0,u=0;if(e.length>0){c=e[0].offset;const b=e[e.length-1];u=b.offset+b.size}const f=o-a,d=i+f*l+(f-1)*n,m=c,S=d-u;return{bottom:u,firstItemIndex:r,items:$o(e,s,r),offsetBottom:S,offsetTop:c,top:m,topItems:$o(t,s,r),topListHeight:t.reduce((b,x)=>x.size+b,0),totalCount:o}}function ln(e,t,o,n,s,r){let a=0;if(o.groupIndices.length>0)for(const u of o.groupIndices){if(u-a>=e)break;a++}const i=e+a,l=Kt(t,i),c=Array.from({length:i}).map((u,f)=>({data:r[f+l],index:f+l,offset:0,size:0}));return $t(c,[],i,s,o,n)}function $o(e,t,o){if(e.length===0)return[];if(!jt(t))return e.map(c=>({...c,index:c.index+o,originalIndex:c.index}));const n=e[0].index,s=e[e.length-1].index,r=[],a=Ke(t.groupOffsetTree,n,s);let i,l=0;for(const c of e){(!i||i.end<c.index)&&(i=a.shift(),l=t.groupIndices.indexOf(i.start));let u;c.index===i.start?u={index:l,type:"group"}:u={groupIndex:l,index:c.index-(l+1)+o},r.push({...u,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return r}function Io(e,t){var o;return e===void 0?0:typeof e=="number"?e:(o=e[t])!=null?o:0}const Xe=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n,totalCount:s},r,{listBoundary:a,topListHeight:i,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:u},{topListHeight:f},d,{didMount:m},{recalcInProgress:S}])=>{const b=A([]),x=A(0),g=q(),h=A(0);M(r.topItemsIndexes,b);const y=Se(R(de(m,S,B(l,ut),B(s),B(n),B(c),u,B(b),B(t),B(o),B(h),e),_(([p,w,,k,,,,,,,,O])=>{const P=O&&O.length!==k;return p&&!w&&!P}),L(([,,[p,w],k,O,P,V,z,N,D,X,Q])=>{var we,xe,be,$;const F=O,{offsetTree:G,sizeTree:K}=F,Le=le(x);if(k===0)return{...Nt,totalCount:k};if(p===0&&w===0)return Le===0?{...Nt,totalCount:k}:ln(Le,P,O,N,D,Q||[]);if(oe(K))return Le>0?null:$t(Mr(Kt(P,k),F,Q),[],k,D,F,N);const Me=[];if(z.length>0){const pe=z[0],ce=z[z.length-1];let me=0;for(const ue of Ke(K,pe,ce)){const te=ue.value,re=Math.max(ue.start,pe),ke=Math.min(ue.end,ce);for(let ge=re;ge<=ke;ge++)Me.push({data:Q?.[ge],index:ge,offset:me,size:te}),me+=te}}if(!V)return $t([],Me,k,D,F,N);const ee=z.length>0?z[z.length-1]+1:0,j=Tr(G,p,w,ee);if(j.length===0)return null;const J=k-1,ne=Ot([],pe=>{for(const ce of j){const me=ce.value;let ue=me.offset,te=ce.start;const re=me.size;if(me.offset<p){te+=Math.floor((p-me.offset+D)/(re+D));const ge=te-ce.start;ue+=ge*re+ge*D}te<ee&&(ue+=(ee-te)*re,te=ee);const ke=Math.min(ce.end,J);for(let ge=te;ge<=ke&&!(ue>=w);ge++)pe.push({data:Q?.[ge],index:ge,offset:ue,size:re}),ue+=re+D}}),he=Io(X,ft),Ee=Io(X,mt);if(ne.length>0&&(he>0||Ee>0)){const pe=ne[0],ce=ne[ne.length-1];if(he>0&&pe.index>ee){const me=Math.min(he,pe.index-ee),ue=[];let te=pe.offset;for(let re=pe.index-1;re>=pe.index-me;re--){const ke=(xe=(we=Ke(K,re,re)[0])==null?void 0:we.value)!=null?xe:pe.size;te-=ke+D,ue.unshift({data:Q?.[re],index:re,offset:te,size:ke})}ne.unshift(...ue)}if(Ee>0&&ce.index<J){const me=Math.min(Ee,J-ce.index);let ue=ce.offset+ce.size+D;for(let te=ce.index+1;te<=ce.index+me;te++){const re=($=(be=Ke(K,te,te)[0])==null?void 0:be.value)!=null?$:ce.size;ne.push({data:Q?.[te],index:te,offset:ue,size:re}),ue+=re+D}}}return $t(ne,Me,k,D,F,N)}),_(p=>p!==null),se()),Nt);M(R(e,_(qt),L(p=>p?.length)),s),M(R(y,L(p=>p.topListHeight)),f),M(f,i),M(R(y,L(p=>[p.top,p.bottom])),a),M(R(y,L(p=>p.items)),g);const I=Ie(R(y,_(({items:p})=>p.length>0),W(s,e),_(([{items:p},w])=>p[p.length-1].originalIndex===w-1),L(([,p,w])=>[p-1,w]),se(ut),L(([p])=>p))),T=Ie(R(y,Fe(200),_(({items:p,topItems:w})=>p.length>0&&p[0].originalIndex===w.length),L(({items:p})=>p[0].index),se())),E=Ie(R(y,_(({items:p})=>p.length>0),L(({items:p})=>{let w=0,k=p.length-1;for(;p[w].type==="group"&&w<k;)w++;for(;p[k].type==="group"&&k>w;)k--;return{endIndex:p[k].index,startIndex:p[w].index}}),se(en)));return{endReached:I,initialItemCount:x,itemsRendered:g,listState:y,minOverscanItemCount:h,rangeChanged:E,startReached:T,topItemsIndexes:b,...d}},ie(ze,rn,eo,yt,gt,wt,De,Xt),{singleton:!0}),cn=Y(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:o,headerHeight:n},{listState:s}])=>{const r=q(),a=Se(R(de(o,e,n,t,s),L(([i,l,c,u,f])=>i+l+c+u+f.offsetBottom+f.bottom)),0);return M(B(a),r),{totalListHeight:a,totalListHeightChanged:r}},ie(Te,Xe),{singleton:!0}),Vr=Y(([{viewportHeight:e},{totalListHeight:t}])=>{const o=A(!1),n=Se(R(de(o,e,t),_(([s])=>s),L(([,s,r])=>Math.max(0,s-r)),Fe(0),se()),0);return{alignToBottom:o,paddingTopAddition:n}},ie(Te,cn),{singleton:!0}),un=Y(()=>({context:A(null)})),Nr=({itemBottom:e,itemTop:t,locationParams:{align:o,behavior:n,...s},viewportBottom:r,viewportTop:a})=>t<a?{...s,align:o??"start",behavior:n}:e>r?{...s,align:o??"end",behavior:n}:null,dn=Y(([{gap:e,sizes:t,totalCount:o},{fixedFooterHeight:n,fixedHeaderHeight:s,headerHeight:r,scrollingInProgress:a,scrollTop:i,viewportHeight:l},{scrollToIndex:c}])=>{const u=q();return M(R(u,W(t,l,o,r,s,n,i),W(e),L(([[f,d,m,S,b,x,g,h],y])=>{const{align:I,behavior:T,calculateViewLocation:E=Nr,done:p,...w}=f,k=nn(f,d,S-1),O=dt(k,d.offsetTree,y)+b+x,P=O+Pe(d.sizeTree,k)[1],V=h+x,z=h+m-g,N=E({itemBottom:P,itemTop:O,locationParams:{align:I,behavior:T,...w},viewportBottom:z,viewportTop:V});return N?p&&je(R(a,_(D=>!D),qe(le(a)?1:2)),p):p&&p(),N}),_(f=>f!==null)),c),{scrollIntoView:u}},ie(ze,Te,gt,Xe,He),{singleton:!0});function Eo(e){return e?e==="smooth"?"smooth":"auto":!1}const zr=(e,t)=>typeof e=="function"?Eo(e(t)):t&&Eo(e),Fr=Y(([{listRefresh:e,totalCount:t,fixedItemSize:o,data:n},{atBottomState:s,isAtBottom:r},{scrollToIndex:a},{scrolledToInitialItem:i},{didMount:l,propsReady:c},{log:u},{scrollingInProgress:f},{context:d},{scrollIntoView:m}])=>{const S=A(!1),b=q();let x=null;function g(T){U(a,{align:"end",behavior:T,index:"LAST"})}Z(R(de(R(B(t),qe(1)),l),W(B(S),r,i,f),L(([[T,E],p,w,k,O])=>{let P=E&&k,V="auto";return P&&(V=zr(p,w||O),P=P&&!!V),{followOutputBehavior:V,shouldFollow:P,totalCount:T}}),_(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:E})=>{x&&(x(),x=null),le(o)?requestAnimationFrame(()=>{le(u)("following output to ",{totalCount:E},Ce.DEBUG),g(T)}):x=je(e,()=>{le(u)("following output to ",{totalCount:E},Ce.DEBUG),g(T),x=null})});function h(T){const E=je(s,p=>{T&&!p.atBottom&&p.notAtBottomBecause==="SIZE_INCREASED"&&!x&&(le(u)("scrolling to bottom due to increased size",{},Ce.DEBUG),g("auto"))});setTimeout(E,100)}Z(R(de(B(S),t,c),_(([T,,E])=>T&&E),Ne(({value:T},[,E])=>({refreshed:T===E,value:E}),{refreshed:!1,value:0}),_(({refreshed:T})=>T),W(S,t)),([,T])=>{le(i)&&h(T!==!1)}),Z(b,()=>{h(le(S)!==!1)}),Z(de(B(S),s),([T,E])=>{T&&!E.atBottom&&E.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")});const y=A(null),I=q();return M(_t(R(B(n),L(T=>{var E;return(E=T?.length)!=null?E:0})),R(B(t))),I),Z(R(de(R(I,qe(1)),l),W(B(y),i,f,d),L(([[T,E],p,w,k,O])=>E&&w&&p?.({context:O,totalCount:T,scrollingInProgress:k})),_(T=>!!T),Fe(0)),T=>{x&&(x(),x=null),le(o)?requestAnimationFrame(()=>{le(u)("scrolling into view",{}),U(m,T)}):x=je(e,()=>{le(u)("scrolling into view",{}),U(m,T),x=null})}),{autoscrollToBottom:b,followOutput:S,scrollIntoViewOnChange:y}},ie(ze,wt,gt,yt,De,He,Te,un,dn)),Br=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n},{initialTopMostItemIndex:s},{initialItemCount:r,listState:a},{didMount:i}])=>(M(R(i,W(r),_(([,l])=>l!==0),W(s,n,t,o,e),L(([[,l],c,u,f,d,m=[]])=>ln(l,c,u,f,d,m))),a),{}),ie(ze,yt,Xe,De),{singleton:!0}),_r=Y(([{didMount:e},{scrollTo:t},{listState:o}])=>{const n=A(0);return Z(R(e,W(n),_(([,s])=>s!==0),L(([,s])=>({top:s}))),s=>{je(R(o,qe(1),_(r=>r.items.length>1)),()=>{requestAnimationFrame(()=>{U(t,s)})})}),{initialScrollTop:n}},ie(De,Te,Xe),{singleton:!0}),pn=Y(([{scrollVelocity:e}])=>{const t=A(!1),o=q(),n=A(!1);return M(R(e,W(n,t,o),_(([s,r])=>!!r),L(([s,r,a,i])=>{const{enter:l,exit:c}=r;if(a){if(c(s,i))return!1}else if(l(s,i))return!0;return a}),se()),t),Z(R(de(t,e,o),W(n)),([[s,r,a],i])=>{s&&i&&i.change&&i.change(r,a)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:o,scrollVelocity:e}},ie(wt),{singleton:!0}),to=Y(([{scrollContainerState:e,scrollTo:t}])=>{const o=q(),n=q(),s=q(),r=A(!1),a=A(void 0);return M(R(de(o,n),L(([{scrollHeight:i,scrollTop:l,viewportHeight:c},{offsetTop:u}])=>({scrollHeight:i,scrollTop:Math.max(0,l-u),viewportHeight:c}))),e),M(R(t,W(n),L(([i,{offsetTop:l}])=>({...i,top:i.top+l}))),s),{customScrollParent:a,useWindowScroll:r,windowScrollContainerState:o,windowScrollTo:s,windowViewportRect:n}},ie(Te)),Hr=Y(([{sizeRanges:e,sizes:t},{headerHeight:o,scrollTop:n},{initialTopMostItemIndex:s},{didMount:r},{useWindowScroll:a,windowScrollContainerState:i,windowViewportRect:l}])=>{const c=q(),u=A(void 0),f=A(null),d=A(null);return M(i,f),M(l,d),Z(R(c,W(t,n,a,f,d,o)),([m,S,b,x,g,h,y])=>{const I=$r(S.sizeTree);x&&g!==null&&h!==null&&(b=g.scrollTop-h.offsetTop),b-=y,m({ranges:I,scrollTop:b})}),M(R(u,_(qt),L(Dr)),s),M(R(r,W(u),_(([,m])=>m!==void 0),se(),L(([,m])=>m.ranges)),e),{getState:c,restoreStateFrom:u}},ie(ze,Te,yt,De,to));function Dr(e){return{align:"start",index:0,offset:e.scrollTop}}const Ur=Y(([{topItemsIndexes:e}])=>{const t=A(0);return M(R(t,_(o=>o>=0),L(o=>Array.from({length:o}).map((n,s)=>s))),e),{topItemCount:t}},ie(Xe));function fn(e){let t=!1,o;return()=>(t||(t=!0,o=e()),o)}const Wr=fn(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Jr=Y(([{deviation:e,scrollBy:t,scrollingInProgress:o,scrollTop:n},{isAtBottom:s,isScrolling:r,lastJumpDueToItemResize:a,scrollDirection:i},{listState:l},{beforeUnshiftWith:c,gap:u,shiftWithOffset:f,sizes:d},{log:m},{recalcInProgress:S}])=>{const b=Ie(R(l,W(a),Ne(([,g,h,y],[{bottom:I,items:T,offsetBottom:E,totalCount:p},w])=>{const k=I+E;let O=0;return h===p&&g.length>0&&T.length>0&&(T[0].originalIndex===0&&g[0].originalIndex===0||(O=k-y,O!==0&&(O+=w))),[O,T,p,k]},[0,[],0,0]),_(([g])=>g!==0),W(n,i,o,s,m,S),_(([,g,h,y,,,I])=>!I&&!y&&g!==0&&h===pt),L(([[g],,,,,h])=>(h("Upward scrolling compensation",{amount:g},Ce.DEBUG),g))));function x(g){g>0?(U(t,{behavior:"auto",top:-g}),U(e,0)):(U(e,0),U(t,{behavior:"auto",top:-g}))}return Z(R(b,W(e,r)),([g,h,y])=>{y&&Wr()?U(e,h-g):x(-g)}),Z(R(de(Se(r,!1),e,S),_(([g,h,y])=>!g&&!y&&h!==0),L(([g,h])=>h),Fe(1)),x),M(R(f,L(g=>({top:-g}))),t),Z(R(c,W(d,u),L(([g,{groupIndices:h,lastSize:y,sizeTree:I},T])=>{function E(p){return p*(y+T)}if(h.length===0)return E(g);{let p=0;const w=ct(I,0);let k=0,O=0;for(;k<g;){k++,p+=w;let P=h.length===O+1?1/0:h[O+1]-h[O]-1;k+P>g&&(p-=w,P=g-k+1),k+=P,p+=E(P),O++}return p}})),g=>{U(e,g),requestAnimationFrame(()=>{U(t,{top:g}),requestAnimationFrame(()=>{U(e,0),U(S,!1)})})}),{deviation:e}},ie(Te,wt,Xe,ze,He,Xt)),qr=Y(([e,t,o,n,s,r,a,i,l,c,u])=>({...e,...t,...o,...n,...s,...r,...a,...i,...l,...c,...u}),ie(eo,Br,De,pn,cn,_r,Vr,to,dn,He,un)),mn=Y(([{data:e,defaultItemSize:t,firstItemIndex:o,fixedItemSize:n,fixedGroupSize:s,gap:r,groupIndices:a,heightEstimates:i,itemSize:l,sizeRanges:c,sizes:u,statefulTotalCount:f,totalCount:d,trackItemSizes:m},{initialItemFinalLocationReached:S,initialTopMostItemIndex:b,scrolledToInitialItem:x},g,h,y,I,{scrollToIndex:T},E,{topItemCount:p},{groupCounts:w},k])=>{const{listState:O,minOverscanItemCount:P,topItemsIndexes:V,rangeChanged:z,...N}=I;return M(z,k.scrollSeekRangeChanged),M(R(k.windowViewportRect,L(D=>D.visibleHeight)),g.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:o,fixedItemHeight:n,fixedGroupHeight:s,gap:r,groupCounts:w,heightEstimates:i,initialItemFinalLocationReached:S,initialTopMostItemIndex:b,scrolledToInitialItem:x,sizeRanges:c,topItemCount:p,topItemsIndexes:V,totalCount:d,...y,groupIndices:a,itemSize:l,listState:O,minOverscanItemCount:P,scrollToIndex:T,statefulTotalCount:f,trackItemSizes:m,rangeChanged:z,...N,...k,...g,sizes:u,...h}},ie(ze,yt,Te,Hr,Fr,Xe,gt,Jr,Ur,rn,qr));function Gr(e,t){const o={},n={};let s=0;const r=e.length;for(;s<r;)n[e[s]]=1,s+=1;for(const a in t)Object.hasOwn(n,a)||(o[a]=t[a]);return o}const vt=typeof document<"u"?C.useLayoutEffect:C.useEffect;function hn(e,t,o){const n=Object.keys(t.required||{}),s=Object.keys(t.optional||{}),r=Object.keys(t.methods||{}),a=Object.keys(t.events||{}),i=C.createContext({});function l(x,g){x.propsReady&&U(x.propsReady,!1);for(const h of n){const y=x[t.required[h]];U(y,g[h])}for(const h of s)if(h in g){const y=x[t.optional[h]];U(y,g[h])}x.propsReady&&U(x.propsReady,!0)}function c(x){return r.reduce((g,h)=>(g[h]=y=>{const I=x[t.methods[h]];U(I,y)},g),{})}function u(x){return a.reduce((g,h)=>(g[h]=ur(x[t.events[h]]),g),{})}const f=C.forwardRef((x,g)=>{const{children:h,...y}=x,[I]=C.useState(()=>Ot(pr(e),p=>{l(p,y)})),[T]=C.useState(yo(u,I));vt(()=>{for(const p of a)p in y&&Z(T[p],y[p]);return()=>{Object.values(T).map(Gt)}},[y,T,I]),vt(()=>{l(I,y)}),C.useImperativeHandle(g,go(c(I)));const E=o;return v.jsx(i.Provider,{value:I,children:o?v.jsx(E,{...Gr([...n,...s,...a],y),children:h}):h})}),d=x=>{const g=C.useContext(i);return C.useCallback(h=>{U(g[x],h)},[g,x])},m=x=>{const g=C.useContext(i)[x],h=C.useCallback(y=>Z(g,y),[g]);return C.useSyncExternalStore(h,()=>le(g),()=>le(g))},S=x=>{const g=C.useContext(i)[x],[h,y]=C.useState(yo(le,g));return vt(()=>Z(g,I=>{I!==h&&y(go(I))}),[g,h]),h},b=C.version.startsWith("18")?m:S;return{Component:f,useEmitter:(x,g)=>{const h=C.useContext(i)[x];vt(()=>Z(h,g),[g,h])},useEmitterValue:b,usePublisher:d}}const gn=C.createContext(void 0),yn=C.createContext(void 0),wn=typeof document<"u"?C.useLayoutEffect:C.useEffect;function zt(e){return"self"in e}function Yr(e){return"body"in e}function xn(e,t,o,n=tt,s,r){const a=C.useRef(null),i=C.useRef(null),l=C.useRef(null),c=C.useCallback(d=>{let m,S,b;const x=d.target;if(Yr(x)||zt(x)){const h=zt(x)?x:x.defaultView;b=r?h.scrollX:h.scrollY,m=r?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight,S=r?h.innerWidth:h.innerHeight}else b=r?x.scrollLeft:x.scrollTop,m=r?x.scrollWidth:x.scrollHeight,S=r?x.offsetWidth:x.offsetHeight;const g=()=>{e({scrollHeight:m,scrollTop:Math.max(b,0),viewportHeight:S})};d.suppressFlushSync?g():Fo.flushSync(g),i.current!==null&&(b===i.current||b<=0||b===m-S)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,r]);C.useEffect(()=>{const d=s||a.current;return n(s||a.current),c({suppressFlushSync:!0,target:d}),d.addEventListener("scroll",c,{passive:!0}),()=>{n(null),d.removeEventListener("scroll",c)}},[a,c,o,n,s]);function u(d){const m=a.current;if(!m||(r?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const S=d.behavior==="smooth";let b,x,g;zt(m)?(x=Math.max(Be(m.document.documentElement,r?"width":"height"),r?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight),b=r?m.innerWidth:m.innerHeight,g=r?window.scrollX:window.scrollY):(x=m[r?"scrollWidth":"scrollHeight"],b=Be(m,r?"width":"height"),g=m[r?"scrollLeft":"scrollTop"]);const h=x-b;if(d.top=Math.ceil(Math.max(Math.min(h,d.top),0)),an(b,x)||d.top===g){e({scrollHeight:x,scrollTop:g,viewportHeight:b}),S&&t(!0);return}S?(i.current=d.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,r&&(d={behavior:d.behavior,left:d.top}),m.scrollTo(d)}function f(d){r&&(d={behavior:d.behavior,left:d.top}),a.current.scrollBy(d)}return{scrollByCallback:f,scrollerRef:a,scrollToCallback:u}}const Ft="-webkit-sticky",ko="sticky",oo=fn(()=>{if(typeof document>"u")return ko;const e=document.createElement("div");return e.style.position=Ft,e.style.position===Ft?Ft:ko});function no(e){return e}const Xr=Y(()=>{const e=A(i=>`Item ${i}`),t=A(i=>`Group ${i}`),o=A({}),n=A(no),s=A("div"),r=A(tt),a=(i,l=null)=>Se(R(o,L(c=>c[i]),se()),l);return{components:o,computeItemKey:n,EmptyPlaceholder:a("EmptyPlaceholder"),FooterComponent:a("Footer"),GroupComponent:a("Group","div"),groupContent:t,HeaderComponent:a("Header"),HeaderFooterTag:s,ItemComponent:a("Item","div"),itemContent:e,ListComponent:a("List","div"),ScrollerComponent:a("Scroller","div"),scrollerRef:r,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TopItemListComponent:a("TopItemList")}}),Zr=Y(([e,t])=>({...e,...t}),ie(mn,Xr)),Qr=({height:e})=>v.jsx("div",{style:{height:e}}),Kr={overflowAnchor:"none",position:oo(),zIndex:1},bn={overflowAnchor:"none"},es={...bn,display:"inline-block",height:"100%"},Ro=C.memo(function({showTopList:e=!1}){const t=H("listState"),o=Re("sizeRanges"),n=H("useWindowScroll"),s=H("customScrollParent"),r=Re("windowScrollContainerState"),a=Re("scrollContainerState"),i=s||n?r:a,l=H("itemContent"),c=H("context"),u=H("groupContent"),f=H("trackItemSizes"),d=H("itemSize"),m=H("log"),S=Re("gap"),b=H("horizontalDirection"),{callbackRef:x}=hr(o,d,f,e?tt:i,m,S,s,b,H("skipAnimationFrameInResizeObserver")),[g,h]=C.useState(0);ro("deviation",N=>{g!==N&&h(N)});const y=H("EmptyPlaceholder"),I=H("ScrollSeekPlaceholder")||Qr,T=H("ListComponent"),E=H("ItemComponent"),p=H("GroupComponent"),w=H("computeItemKey"),k=H("isSeeking"),O=H("groupIndices").length>0,P=H("alignToBottom"),V=H("initialItemFinalLocationReached"),z=e?{}:{boxSizing:"border-box",...b?{display:"inline-block",height:"100%",marginLeft:g!==0?g:P?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:g!==0?g:P?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...V?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&y?v.jsx(y,{...ve(y,c)}):v.jsx(T,{...ve(T,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:x,style:z,children:(e?t.topItems:t.items).map(N=>{const D=N.originalIndex,X=w(D+t.firstItemIndex,N.data,c);return k?C.createElement(I,{...ve(I,c),height:N.size,index:N.index,key:X,type:N.type||"item",...N.type==="group"?{}:{groupIndex:N.groupIndex}}):N.type==="group"?C.createElement(p,{...ve(p,c),"data-index":D,"data-item-index":N.index,"data-known-size":N.size,key:X,style:Kr},u(N.index,c)):C.createElement(E,{...ve(E,c),...rs(E,N.data),"data-index":D,"data-item-group-index":N.groupIndex,"data-item-index":N.index,"data-known-size":N.size,key:X,style:b?es:bn},O?l(N.index,N.groupIndex,N.data,c):l(N.index,N.data,c))})})}),ts={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},os={outline:"none",overflowX:"auto",position:"relative"},Pt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),ns={position:oo(),top:0,width:"100%",zIndex:1};function ve(e,t){if(typeof e!="string")return{context:t}}function rs(e,t){return{item:typeof e=="string"?void 0:t}}const ss=C.memo(function(){const e=H("HeaderComponent"),t=Re("headerHeight"),o=H("HeaderFooterTag"),n=Ye(C.useMemo(()=>r=>{t(Be(r,"height"))},[t]),!0,H("skipAnimationFrameInResizeObserver")),s=H("context");return e?v.jsx(o,{ref:n,children:v.jsx(e,{...ve(e,s)})}):null}),is=C.memo(function(){const e=H("FooterComponent"),t=Re("footerHeight"),o=H("HeaderFooterTag"),n=Ye(C.useMemo(()=>r=>{t(Be(r,"height"))},[t]),!0,H("skipAnimationFrameInResizeObserver")),s=H("context");return e?v.jsx(o,{ref:n,children:v.jsx(e,{...ve(e,s)})}):null});function vn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return C.memo(function({children:n,style:s,context:r,...a}){const i=o("scrollContainerState"),l=t("ScrollerComponent"),c=o("smoothScrollTargetReached"),u=t("scrollerRef"),f=t("horizontalDirection")||!1,{scrollByCallback:d,scrollerRef:m,scrollToCallback:S}=xn(i,c,l,u,void 0,f);return e("scrollTo",S),e("scrollBy",d),v.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:m,style:{...f?os:ts,...s},tabIndex:0,...a,...ve(l,r),children:n})})}function Sn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return C.memo(function({children:n,style:s,context:r,...a}){const i=o("windowScrollContainerState"),l=t("ScrollerComponent"),c=o("smoothScrollTargetReached"),u=t("totalListHeight"),f=t("deviation"),d=t("customScrollParent"),m=C.useRef(null),S=t("scrollerRef"),{scrollByCallback:b,scrollerRef:x,scrollToCallback:g}=xn(i,c,l,S,d);return wn(()=>{var h;return x.current=d||((h=m.current)==null?void 0:h.ownerDocument.defaultView),()=>{x.current=null}},[x,d]),e("windowScrollTo",g),e("scrollBy",b),v.jsx(l,{ref:m,"data-virtuoso-scroller":!0,style:{position:"relative",...s,...u!==0?{height:u+f}:{}},...a,...ve(l,r),children:n})})}const as=({children:e})=>{const t=C.useContext(gn),o=Re("viewportHeight"),n=Re("fixedItemHeight"),s=H("alignToBottom"),r=H("horizontalDirection"),a=C.useMemo(()=>Jo(o,l=>Be(l,r?"width":"height")),[o,r]),i=Ye(a,!0,H("skipAnimationFrameInResizeObserver"));return C.useEffect(()=>{t&&(o(t.viewportHeight),n(t.itemHeight))},[t,o,n]),v.jsx("div",{"data-viewport-type":"element",ref:i,style:Pt(s),children:e})},ls=({children:e})=>{const t=C.useContext(gn),o=Re("windowViewportRect"),n=Re("fixedItemHeight"),s=H("customScrollParent"),r=Go(o,s,H("skipAnimationFrameInResizeObserver")),a=H("alignToBottom");return C.useEffect(()=>{t&&(n(t.itemHeight),o({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,o,n]),v.jsx("div",{"data-viewport-type":"window",ref:r,style:Pt(a),children:e})},cs=({children:e})=>{const t=H("TopItemListComponent")||"div",o=H("headerHeight"),n={...ns,marginTop:`${o}px`},s=H("context");return v.jsx(t,{style:n,...ve(t,s),children:e})},us=C.memo(function(e){const t=H("useWindowScroll"),o=H("topItemsIndexes").length>0,n=H("customScrollParent"),s=H("context");return v.jsxs(n||t?fs:ps,{...e,context:s,children:[o&&v.jsx(cs,{children:v.jsx(Ro,{showTopList:!0})}),v.jsxs(n||t?ls:as,{children:[v.jsx(ss,{}),v.jsx(Ro,{}),v.jsx(is,{})]})]})}),{Component:ds,useEmitter:ro,useEmitterValue:H,usePublisher:Re}=hn(Zr,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},us),ps=vn({useEmitter:ro,useEmitterValue:H,usePublisher:Re}),fs=Sn({useEmitter:ro,useEmitterValue:H,usePublisher:Re}),ms=ds,hs=Y(()=>{const e=A(c=>v.jsxs("td",{children:["Item $",c]})),t=A(null),o=A(c=>v.jsxs("td",{colSpan:1e3,children:["Group ",c]})),n=A(null),s=A(null),r=A({}),a=A(no),i=A(tt),l=(c,u=null)=>Se(R(r,L(f=>f[c]),se()),u);return{components:r,computeItemKey:a,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:s,fixedHeaderContent:n,itemContent:e,groupContent:o,ScrollerComponent:l("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ie(mn,hs);oo();const Ao={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},gs={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Oo,floor:Et,max:st,min:Bt,round:jo}=Math;function Po(e,t,o){return Array.from({length:t-e+1}).map((n,s)=>({data:o===null?null:o[s+e],index:s+e}))}function ys(e){return{...gs,items:e}}function St(e,t){return e&&e.width===t.width&&e.height===t.height}function ws(e,t){return e&&e.column===t.column&&e.row===t.row}const xs=Y(([{increaseViewportBy:e,listBoundary:t,overscan:o,visibleRange:n},{footerHeight:s,headerHeight:r,scrollBy:a,scrollContainerState:i,scrollTo:l,scrollTop:c,smoothScrollTargetReached:u,viewportHeight:f},d,m,{didMount:S,propsReady:b},{customScrollParent:x,useWindowScroll:g,windowScrollContainerState:h,windowScrollTo:y,windowViewportRect:I},T])=>{const E=A(0),p=A(0),w=A(Ao),k=A({height:0,width:0}),O=A({height:0,width:0}),P=q(),V=q(),z=A(0),N=A(null),D=A({column:0,row:0}),X=q(),Q=q(),we=A(!1),xe=A(0),be=A(!0),$=A(!1),F=A(!1);Z(R(S,W(xe),_(([j,J])=>!!J)),()=>{U(be,!1)}),Z(R(de(S,be,O,k,xe,$),_(([j,J,ne,he,,Ee])=>j&&!J&&ne.height!==0&&he.height!==0&&!Ee)),([,,,,j])=>{U($,!0),Qt(1,()=>{U(P,j)}),je(R(c),()=>{U(t,[0,0]),U(be,!0)})}),M(R(Q,_(j=>j!=null&&j.scrollTop>0),Ve(0)),p),Z(R(S,W(Q),_(([,j])=>j!=null)),([,j])=>{j&&(U(k,j.viewport),U(O,j.item),U(D,j.gap),j.scrollTop>0&&(U(we,!0),je(R(c,qe(1)),J=>{U(we,!1)}),U(l,{top:j.scrollTop})))}),M(R(k,L(({height:j})=>j)),f),M(R(de(B(k,St),B(O,St),B(D,(j,J)=>j&&j.column===J.column&&j.row===J.row),B(c)),L(([j,J,ne,he])=>({gap:ne,item:J,scrollTop:he,viewport:j}))),X),M(R(de(B(E),n,B(D,ws),B(O,St),B(k,St),B(N),B(p),B(we),B(be),B(xe)),_(([,,,,,,,j])=>!j),L(([j,[J,ne],he,Ee,pe,ce,me,,ue,te])=>{const{column:re,row:ke}=he,{height:ge,width:Lt}=Ee,{width:io}=pe;if(me===0&&(j===0||io===0))return Ao;if(Lt===0){const po=Kt(te,j),Ln=po+Math.max(me-1,0);return ys(Po(po,Ln,ce))}const xt=Tn(io,Lt,re);let Ze,Ue;ue?J===0&&ne===0&&me>0?(Ze=0,Ue=me-1):(Ze=xt*Et((J+ke)/(ge+ke)),Ue=xt*Oo((ne+ke)/(ge+ke))-1,Ue=Bt(j-1,st(Ue,xt-1)),Ze=Bt(Ue,st(0,Ze))):(Ze=0,Ue=-1);const ao=Po(Ze,Ue,ce),{bottom:lo,top:co}=Lo(pe,he,Ee,ao),uo=Oo(j/xt),Pn=uo*ge+(uo-1)*ke-lo;return{bottom:lo,itemHeight:ge,items:ao,itemWidth:Lt,offsetBottom:Pn,offsetTop:co,top:co}})),w),M(R(N,_(j=>j!==null),L(j=>j.length)),E),M(R(de(k,O,w,D),_(([j,J,{items:ne}])=>ne.length>0&&J.height!==0&&j.height!==0),L(([j,J,{items:ne},he])=>{const{bottom:Ee,top:pe}=Lo(j,he,J,ne);return[pe,Ee]}),se(ut)),t);const G=A(!1);M(R(c,W(G),L(([j,J])=>J||j!==0)),G);const K=Ie(R(de(w,E),_(([{items:j}])=>j.length>0),W(G),_(([[j,J],ne])=>{const he=j.items[j.items.length-1].index===J-1;return(ne||j.bottom>0&&j.itemHeight>0&&j.offsetBottom===0&&j.items.length===J)&&he}),L(([[,j]])=>j-1),se())),Le=Ie(R(B(w),_(({items:j})=>j.length>0&&j[0].index===0),Ve(0),se())),Me=Ie(R(B(w),W(we),_(([{items:j},J])=>j.length>0&&!J),L(([{items:j}])=>({endIndex:j[j.length-1].index,startIndex:j[0].index})),se(en),Fe(0)));M(Me,m.scrollSeekRangeChanged),M(R(P,W(k,O,E,D),L(([j,J,ne,he,Ee])=>{const pe=sn(j),{align:ce,behavior:me,offset:ue}=pe;let te=pe.index;te==="LAST"&&(te=he-1),te=st(0,te,Bt(he-1,te));let re=Jt(J,Ee,ne,te);return ce==="end"?re=jo(re-J.height+ne.height):ce==="center"&&(re=jo(re-J.height/2+ne.height/2)),ue&&(re+=ue),{behavior:me,top:re}})),l);const ee=Se(R(w,L(j=>j.offsetBottom+j.bottom)),0);return M(R(I,L(j=>({height:j.visibleHeight,width:j.visibleWidth}))),k),{customScrollParent:x,data:N,deviation:z,footerHeight:s,gap:D,headerHeight:r,increaseViewportBy:e,initialItemCount:p,itemDimensions:O,overscan:o,restoreStateFrom:Q,scrollBy:a,scrollContainerState:i,scrollHeight:V,scrollTo:l,scrollToIndex:P,scrollTop:c,smoothScrollTargetReached:u,totalCount:E,useWindowScroll:g,viewportDimensions:k,windowScrollContainerState:h,windowScrollTo:y,windowViewportRect:I,...m,gridState:w,horizontalDirection:F,initialTopMostItemIndex:xe,totalListHeight:ee,...d,endReached:K,propsReady:b,rangeChanged:Me,startReached:Le,stateChanged:X,stateRestoreInProgress:we,...T}},ie(eo,Te,wt,pn,De,to,He));function Tn(e,t,o){return st(1,Et((e+o)/(Et(t)+o)))}function Lo(e,t,o,n){const{height:s}=o;if(s===void 0||n.length===0)return{bottom:0,top:0};const r=Jt(e,t,o,n[0].index);return{bottom:Jt(e,t,o,n[n.length-1].index)+s,top:r}}function Jt(e,t,o,n){const s=Tn(e.width,o.width,t.column),r=Et(n/s),a=r*o.height+st(0,r-1)*t.row;return a>0?a+t.row:a}const bs=Y(()=>{const e=A(f=>`Item ${f}`),t=A({}),o=A(null),n=A("virtuoso-grid-item"),s=A("virtuoso-grid-list"),r=A(no),a=A("div"),i=A(tt),l=(f,d=null)=>Se(R(t,L(m=>m[f]),se()),d),c=A(!1),u=A(!1);return M(B(u),c),{components:t,computeItemKey:r,context:o,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:a,itemClassName:n,ItemComponent:l("Item","div"),itemContent:e,listClassName:s,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:u,ScrollerComponent:l("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),vs=Y(([e,t])=>({...e,...t}),ie(xs,bs)),Ss=C.memo(function(){const e=ae("gridState"),t=ae("listClassName"),o=ae("itemClassName"),n=ae("itemContent"),s=ae("computeItemKey"),r=ae("isSeeking"),a=Ae("scrollHeight"),i=ae("ItemComponent"),l=ae("ListComponent"),c=ae("ScrollSeekPlaceholder"),u=ae("context"),f=Ae("itemDimensions"),d=Ae("gap"),m=ae("log"),S=ae("stateRestoreInProgress"),b=Ae("reportReadyState"),x=Ye(C.useMemo(()=>g=>{const h=g.parentElement.parentElement.scrollHeight;a(h);const y=g.firstChild;if(y){const{height:I,width:T}=y.getBoundingClientRect();f({height:I,width:T})}d({column:Mo("column-gap",getComputedStyle(g).columnGap,m),row:Mo("row-gap",getComputedStyle(g).rowGap,m)})},[a,f,d,m]),!0,!1);return wn(()=>{e.itemHeight>0&&e.itemWidth>0&&b(!0)},[e]),S?null:v.jsx(l,{className:t,ref:x,...ve(l,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(g=>{const h=s(g.index,g.data,u);return r?v.jsx(c,{...ve(c,u),height:e.itemHeight,index:g.index,width:e.itemWidth},h):C.createElement(i,{...ve(i,u),className:o,"data-index":g.index,key:h},n(g.index,g.data,u))})})}),Ts=C.memo(function(){const e=ae("HeaderComponent"),t=Ae("headerHeight"),o=ae("headerFooterTag"),n=Ye(C.useMemo(()=>r=>{t(Be(r,"height"))},[t]),!0,!1),s=ae("context");return e?v.jsx(o,{ref:n,children:v.jsx(e,{...ve(e,s)})}):null}),Cs=C.memo(function(){const e=ae("FooterComponent"),t=Ae("footerHeight"),o=ae("headerFooterTag"),n=Ye(C.useMemo(()=>r=>{t(Be(r,"height"))},[t]),!0,!1),s=ae("context");return e?v.jsx(o,{ref:n,children:v.jsx(e,{...ve(e,s)})}):null}),$s=({children:e})=>{const t=C.useContext(yn),o=Ae("itemDimensions"),n=Ae("viewportDimensions"),s=Ye(C.useMemo(()=>r=>{n(r.getBoundingClientRect())},[n]),!0,!1);return C.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),o({height:t.itemHeight,width:t.itemWidth}))},[t,n,o]),v.jsx("div",{ref:s,style:Pt(!1),children:e})},Is=({children:e})=>{const t=C.useContext(yn),o=Ae("windowViewportRect"),n=Ae("itemDimensions"),s=ae("customScrollParent"),r=Go(o,s,!1);return C.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),o({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,o,n]),v.jsx("div",{ref:r,style:Pt(!1),children:e})},Es=C.memo(function({...e}){const t=ae("useWindowScroll"),o=ae("customScrollParent"),n=o||t?Rs:ks,s=o||t?Is:$s,r=ae("context");return v.jsx(n,{...e,...ve(n,r),children:v.jsxs(s,{children:[v.jsx(Ts,{}),v.jsx(Ss,{}),v.jsx(Cs,{})]})})}),{useEmitter:Cn,useEmitterValue:ae,usePublisher:Ae}=hn(vs,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Es),ks=vn({useEmitter:Cn,useEmitterValue:ae,usePublisher:Ae}),Rs=Sn({useEmitter:Cn,useEmitterValue:ae,usePublisher:Ae});function Mo(e,t,o){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&o(`${e} was not resolved to pixel value correctly`,t,Ce.WARN),t==="normal"?0:parseInt(t??"0",10)}const As=({visible:e,onClick:t})=>e?v.jsx("button",{type:"button",className:"chat-scroll-bottom",onClick:t,"aria-label":"Scroll to bottom",children:v.jsx("img",{src:Uo,alt:"arrow up",width:24,height:24,style:{transform:"rotate(180deg)",filter:"var(--icon-filter-text)"}})}):null,Os=()=>{const{messages:e=[],classNames:t,isOpen:o,isLoading:n}=Ge(),[s,r]=C.useState(!1),a=C.useRef(null),i=()=>{a.current?.scrollToIndex({index:e.length-1,behavior:"smooth"})},l=e?.length??1;return C.useEffect(()=>{o&&setTimeout(i,0)},[o]),C.useEffect(()=>{i()},[e?.length]),v.jsxs("div",{className:Oe("autoui-chat-messages",t?.messageList),children:[v.jsx(ms,{ref:a,data:e,overscan:100,followOutput:"smooth",atBottomStateChange:c=>r(!c),components:{EmptyPlaceholder:()=>v.jsxs("div",{className:"empty__palceholder",children:[v.jsx("span",{className:"empty__palceholder--main",children:"Nothing here yet"}),v.jsx("span",{className:"empty__palceholder--secondary",children:"Start the conversation!"})]})},initialTopMostItemIndex:l-1,itemContent:(c,u)=>v.jsx("div",{className:Oe("autoui-message-row",u.role==="user"&&"is-user",u.role==="assistant"&&"is-assistant"),children:v.jsx(rr,{message:u})})}),v.jsx(As,{visible:s,onClick:i}),n&&v.jsx(Fn,{variant:"dots",color:"#0a84ff"})]})};async function js(e){const t=e.getReader(),o=new TextDecoder;let n="",s="";for(;;){const{value:a,done:i}=await t.read();if(i)break;n+=o.decode(a,{stream:!0});const l=n.split(`
|
|
7
|
+
<%s key={someKey} {...props} />`,K,ee,j,ee),be[ee+K]=!0)}if(ee=null,G!==void 0&&(o(G),ee=""+G),a(F)&&(o(F.key),ee=""+F.key),"key"in F){G={};for(var J in F)J!=="key"&&(G[J]=F[J])}else G=F;return ee&&i(G,typeof $=="function"?$.displayName||$.name||"Unknown":$),c($,ee,G,s(),Le,Me)}function f($){d($)?$._store&&($._store.validated=1):typeof $=="object"&&$!==null&&$.$$typeof===k&&($._payload.status==="fulfilled"?d($._payload.value)&&$._payload.value._store&&($._payload.value._store.validated=1):$._store&&($._store.validated=1))}function d($){return typeof $=="object"&&$!==null&&$.$$typeof===S}var m=C,S=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),x=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),h=Symbol.for("react.profiler"),y=Symbol.for("react.consumer"),I=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),O=Symbol.for("react.activity"),P=Symbol.for("react.client.reference"),V=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z=Object.prototype.hasOwnProperty,N=Array.isArray,D=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function($){return $()}};var X,Q={},we=m.react_stack_bottom_frame.bind(m,r)(),xe=D(n(r)),be={};nt.Fragment=x,nt.jsx=function($,F,G){var K=1e4>V.recentlyCreatedOwnerStacks++;return u($,F,G,!1,K?Error("react-stack-top-frame"):we,K?D(n($)):xe)},nt.jsxs=function($,F,G){var K=1e4>V.recentlyCreatedOwnerStacks++;return u($,F,G,!0,K?Error("react-stack-top-frame"):we,K?D(n($)):xe)}})()),nt}var ho;function zn(){return ho||(ho=1,process.env.NODE_ENV==="production"?bt.exports=Vn():bt.exports=Nn()),bt.exports}var v=zn();function Bo(e){var t,o,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(o=Bo(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function ye(){for(var e,t,o=0,n="",s=arguments.length;o<s;o++)(e=arguments[o])&&(t=Bo(e))&&(n&&(n+=" "),n+=t);return n}const Fn=C.forwardRef(({variant:e="default",label:t,className:o,classNames:n={},color:s="currentColor",...r},a)=>{const i=C.useMemo(()=>{switch(e){case"wave":case"dots":return v.jsx("div",{className:ye("spinner-dots-wrapper",n.wrapper),children:[0,1,2].map(l=>v.jsx("i",{className:ye("spinner-dot",n.dots),style:{animationDelay:`${l*.2}s`,backgroundColor:s}},l))});case"simple":return v.jsxs("svg",{className:ye("spinner-simple",n.wrapper),width:"24",height:"24",fill:"none",viewBox:"0 0 24 24",style:{color:s},children:[v.jsx("circle",{className:ye("spinner-simple-circle1",n.circle1),cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),v.jsx("path",{className:ye("spinner-simple-circle2",n.circle2),fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.37 0 0 5.37 0 12h4z"})]});case"spinner":return v.jsx("div",{className:ye("spinner-bars-wrapper",n.wrapper),children:[...Array(12)].map((l,c)=>v.jsx("i",{className:ye("spinner-bar",n.spinnerBars),style:{transform:`rotate(${c*30}deg) translateY(-8px)`,animationDelay:`${c*.1}s`,backgroundColor:s}},c))});default:return v.jsxs("div",{className:ye("spinner-default",n.wrapper),children:[v.jsx("i",{className:ye("spinner-default-circle1",n.circle1),style:{borderColor:s}}),v.jsx("i",{className:ye("spinner-default-circle2",n.circle2),style:{borderColor:s}})]})}},[e,n,s]);return v.jsxs("div",{ref:a,className:ye("spinner-base",o),"aria-label":t||"Loading",...r,children:[i,t&&v.jsx("span",{className:ye("spinner-label",n.label),children:t})]})}),_o=C.createContext(void 0),Bn=({children:e,value:t,config:o})=>v.jsx(_o.Provider,{value:{...t,config:o},children:e}),Ge=()=>{const e=C.useContext(_o);if(!e)throw new Error("useChatContext must be used within a ChatProvider");return e};function Oe(...e){return e.filter(Boolean).join(" ")}const Ho="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2012H20M12%204V20'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",Do="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M183.1%20137.4C170.6%20124.9%20150.3%20124.9%20137.8%20137.4C125.3%20149.9%20125.3%20170.2%20137.8%20182.7L275.2%20320L137.9%20457.4C125.4%20469.9%20125.4%20490.2%20137.9%20502.7C150.4%20515.2%20170.7%20515.2%20183.2%20502.7L320.5%20365.3L457.9%20502.6C470.4%20515.1%20490.7%20515.1%20503.2%20502.6C515.7%20490.1%20515.7%20469.8%20503.2%20457.3L365.8%20320L503.1%20182.6C515.6%20170.1%20515.6%20149.8%20503.1%20137.3C490.6%20124.8%20470.3%20124.8%20457.8%20137.3L320.5%20274.7L183.1%20137.4z'/%3e%3c/svg%3e",Uo="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M12%206V18M12%206L7%2011M12%206L17%2011'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'/%3e%3c/svg%3e",_n="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M4%2018L20%2018'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3cpath%20d='M4%2012L20%2012'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3cpath%20d='M4%206L20%206'%20stroke='%23000000'%20stroke-width='2'%20stroke-linecap='round'/%3e%3c/svg%3e",Hn="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='utf-8'?%3e%3c!--%20Uploaded%20to:%20SVG%20Repo,%20www.svgrepo.com,%20Generator:%20SVG%20Repo%20Mixer%20Tools%20--%3e%3csvg%20width='800px'%20height='800px'%20viewBox='0%200%201024%201024'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill='%23000000'%20d='M352%20192V95.936a32%2032%200%200%201%2032-32h256a32%2032%200%200%201%2032%2032V192h256a32%2032%200%201%201%200%2064H96a32%2032%200%200%201%200-64h256zm64%200h192v-64H416v64zM192%20960a32%2032%200%200%201-32-32V256h704v672a32%2032%200%200%201-32%2032H192zm224-192a32%2032%200%200%200%2032-32V416a32%2032%200%200%200-64%200v320a32%2032%200%200%200%2032%2032zm192%200a32%2032%200%200%200%2032-32V416a32%2032%200%200%200-64%200v320a32%2032%200%200%200%2032%2032z'/%3e%3c/svg%3e",Dn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M210.2%2053.9C217.6%2050.8%20226%2051.7%20232.7%2056.1L320.5%20114.3L408.3%2056.1C415%2051.7%20423.4%2050.9%20430.8%2053.9C438.2%2056.9%20443.4%2063.5%20445%2071.3L465.9%20174.5L569.1%20195.4C576.9%20197%20583.5%20202.4%20586.5%20209.7C589.5%20217%20588.7%20225.5%20584.3%20232.2L526.1%20320L584.3%20407.8C588.7%20414.5%20589.5%20422.9%20586.5%20430.3C583.5%20437.7%20576.9%20443.1%20569.1%20444.6L465.8%20465.4L445%20568.7C443.4%20576.5%20438%20583.1%20430.7%20586.1C423.4%20589.1%20414.9%20588.3%20408.2%20583.9L320.4%20525.7L232.6%20583.9C225.9%20588.3%20217.5%20589.1%20210.1%20586.1C202.7%20583.1%20197.3%20576.5%20195.8%20568.7L175%20465.4L71.7%20444.5C63.9%20442.9%2057.3%20437.5%2054.3%20430.2C51.3%20422.9%2052.1%20414.4%2056.5%20407.7L114.7%20320L56.5%20232.2C52.1%20225.5%2051.3%20217.1%2054.3%20209.7C57.3%20202.3%2063.9%20196.9%2071.7%20195.4L175%20174.6L195.9%2071.3C197.5%2063.5%20202.9%2056.9%20210.2%2053.9zM239.6%20320C239.6%20275.6%20275.6%20239.6%20320%20239.6C364.4%20239.6%20400.4%20275.6%20400.4%20320C400.4%20364.4%20364.4%20400.4%20320%20400.4C275.6%20400.4%20239.6%20364.4%20239.6%20320zM448.4%20320C448.4%20249.1%20390.9%20191.6%20320%20191.6C249.1%20191.6%20191.6%20249.1%20191.6%20320C191.6%20390.9%20249.1%20448.4%20320%20448.4C390.9%20448.4%20448.4%20390.9%20448.4%20320z'/%3e%3c/svg%3e",Un="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M320%2064C178.6%2064%2064%20178.6%2064%20320C64%20461.4%20178.6%20576%20320%20576C388.8%20576%20451.3%20548.8%20497.3%20504.6C504.6%20497.6%20506.7%20486.7%20502.6%20477.5C498.5%20468.3%20488.9%20462.6%20478.8%20463.4C473.9%20463.8%20469%20464%20464%20464C362.4%20464%20280%20381.6%20280%20280C280%20207.9%20321.5%20145.4%20382.1%20115.2C391.2%20110.7%20396.4%20100.9%20395.2%2090.8C394%2080.7%20386.6%2072.5%20376.7%2070.3C358.4%2066.2%20339.4%2064%20320%2064z'/%3e%3c/svg%3e",Wn="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20640%20640'%3e%3c!--!Font%20Awesome%20Free%207.1.0%20by%20@fontawesome%20-%20https://fontawesome.com%20License%20-%20https://fontawesome.com/license/free%20Copyright%202025%20Fonticons,%20Inc.--%3e%3cpath%20d='M320%2064C267%2064%20224%20107%20224%20160L224%20288C224%20341%20267%20384%20320%20384C373%20384%20416%20341%20416%20288L416%20160C416%20107%20373%2064%20320%2064zM176%20248C176%20234.7%20165.3%20224%20152%20224C138.7%20224%20128%20234.7%20128%20248L128%20288C128%20385.9%20201.3%20466.7%20296%20478.5L296%20528L248%20528C234.7%20528%20224%20538.7%20224%20552C224%20565.3%20234.7%20576%20248%20576L392%20576C405.3%20576%20416%20565.3%20416%20552C416%20538.7%20405.3%20528%20392%20528L344%20528L344%20478.5C438.7%20466.7%20512%20385.9%20512%20288L512%20248C512%20234.7%20501.3%20224%20488%20224C474.7%20224%20464%20234.7%20464%20248L464%20288C464%20367.5%20399.5%20432%20320%20432C240.5%20432%20176%20367.5%20176%20288L176%20248z'/%3e%3c/svg%3e",Jn=({isOpen:e,onClose:t,triggerRef:o,children:n,styles:s,position:r="top-center"})=>{const a=C.useRef(null);if(C.useEffect(()=>{const c=u=>{a.current&&!a.current.contains(u.target)&&!o.current?.contains(u.target)&&t()};return e&&document.addEventListener("mousedown",c),()=>{document.removeEventListener("mousedown",c)}},[e,t,o]),!e||!o.current)return null;const i=o.current.getBoundingClientRect();let l={};switch(r){case"top-center":l={width:"50%",transform:"translate(-2.5%, -110%)"};break;case"bottom-left":l={top:i.bottom+6+window.scrollY,left:i.left+window.scrollX};break;case"bottom-right":l={top:i.bottom+6+window.scrollY,left:i.right+window.scrollX,transform:"translateX(-100%)"};break}return v.jsx("div",{ref:a,style:{position:"absolute",zIndex:9999,...l,...s},children:n})};function qn({isSelected:e,disableAnimation:t,...o}){return v.jsx("svg",{"aria-hidden":"true","data-selected":e,role:"presentation",viewBox:"0 0 17 18",...o,children:v.jsx("polyline",{fill:"none",points:"1 9 7 14 15 4",stroke:"currentColor",strokeDasharray:22,strokeDashoffset:e?44:66,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,style:t?{}:{transition:"stroke-dashoffset 200ms ease"}})})}const Gn=({label:e,description:t,shortcut:o,startContent:n,endContent:s,isSelected:r,isDisabled:a,onSelect:i,disableAnimation:l,hideSelectedIcon:c,selectedIcon:u})=>{const f=C.useMemo(()=>{const d=v.jsx(qn,{disableAnimation:l,isSelected:!!r});return typeof u=="function"?u({icon:d,isSelected:r,isDisabled:a}):u||d},[u,r,a,l]);return v.jsxs("li",{className:`hero-menu-item ${r?"selected":""} ${a?"disabled":""}`,onClick:()=>{console.log(1),!a&&i?.()},children:[n&&v.jsx("span",{className:"start",children:n}),v.jsxs("div",{className:"content",children:[v.jsx("span",{className:"label",children:e}),t&&v.jsx("span",{className:"description",children:t})]}),o&&v.jsx("kbd",{className:"shortcut",children:o}),!c&&v.jsx("span",{className:"selected-icon",children:f}),s&&v.jsx("span",{className:"end",children:s})]})},Yn=({items:e,defaultSelectedKey:t,onSelectionChange:o})=>{const[n,s]=C.useState(t),r=a=>{s(a),o?.(a)};return v.jsx("ul",{className:"hero-menu",children:e.map(a=>v.jsx(Gn,{label:a.label,description:a.description,shortcut:a.shortcut,startContent:a.startContent,endContent:a.endContent,isSelected:a.key===n,isDisabled:a.isDisabled,onSelect:()=>{a?.onSelect?.(),r(a.key)}},a.key))})},Xn=({items:e,button:t,popoverStyles:o,defaultSelectedKey:n,closeAfterSelect:s,onSelectionChange:r})=>{const a=C.useRef(null),[i,l]=C.useState(!1),c={ref:a,onClick:()=>{l(u=>!u)},style:{cursor:"pointer"}};return v.jsxs(v.Fragment,{children:[t?C.cloneElement(t,c):v.jsx("button",{ref:a,onClick:()=>l(u=>!u),style:{cursor:"pointer"},children:v.jsx("img",{src:_n,alt:"menu"})}),v.jsx(Jn,{styles:o,isOpen:i,onClose:()=>l(!1),triggerRef:a,children:v.jsx("div",{style:{borderRadius:10,zIndex:9999,boxShadow:"0 4px 12px rgba(0,0,0,0.12)"},children:v.jsx(Yn,{items:e,defaultSelectedKey:n,onSelectionChange:u=>{r?.(u),s?.(u)&&l(!1)}})})})]})},Zn=Mt.forwardRef(function({checked:t,defaultChecked:o,onCheckedChange:n,disabled:s=!1,required:r=!1,name:a,value:i,id:l,label:c,description:u,size:f="md",className:d,trackClassName:m,thumbClassName:S,labelClassName:b,startContent:x,endContent:g,thumb:h,"aria-label":y,"aria-labelledby":I},T){const E=typeof t=="boolean",[p,w]=Mt.useState(!!o),k=E?!!t:p,O=l??Mt.useId(),P=z=>{const N=z.target.checked;E||w(N),n?.(N,z)},V=h?.({checked:k,disabled:s,size:f})??(k?g:x);return v.jsxs("label",{className:Oe("autoui-switch",`autoui-switch--${f}`,s&&"is-disabled",d),htmlFor:O,children:[v.jsxs("span",{className:Oe("autoui-switch__control",m),"aria-hidden":"true",children:[v.jsx("input",{ref:T,id:O,className:"autoui-switch__input",type:"checkbox",checked:k,onChange:P,disabled:s,required:r,name:a,value:i,"aria-label":y,"aria-labelledby":I}),v.jsx("span",{className:Oe("autoui-switch__track")}),v.jsx("span",{className:Oe("autoui-switch__thumb",S),children:V?v.jsx("span",{className:"autoui-switch__thumbContent",children:V}):null})]}),(c||u)&&v.jsxs("span",{className:Oe("autoui-switch__text",b),children:[c&&v.jsx("span",{className:"autoui-switch__label",children:c}),u&&v.jsx("span",{className:"autoui-switch__description",children:u})]})]})}),Qn=()=>{const{handleClear:e,setTheme:t,theme:o}=Ge();return v.jsx(Xn,{popoverStyles:{position:"absolute"},button:v.jsx("button",{type:"button",className:"autoui-chat-input-start",children:v.jsx("img",{src:Ho,alt:"menu",width:20,height:20,style:{filter:"var(--icon-filter-text)"}})}),items:[{startContent:v.jsx("img",{src:Hn,width:16,height:16,style:{filter:"var(--icon-filter-text)"}}),key:"clear",label:"Clear Messages",onSelect:e},{key:"switchTheme",label:v.jsx(Zn,{defaultChecked:o==="light",onCheckedChange:n=>{t?.(n?"light":"dark")},label:"Theme mode",thumb:({checked:n})=>v.jsx(v.Fragment,{children:n?v.jsx("img",{src:Dn,width:14,height:14,style:{filter:"var(--icon-filter-accent)"}}):v.jsx("img",{src:Un,width:14,height:14,style:{filter:"var(--icon-filter-text)"}})})})}],closeAfterSelect:n=>n!=="switchTheme",onSelectionChange:n=>console.log("Selected:",n)})},Kn=({value:e,setValue:t})=>{const{classNames:o}=Ge();return v.jsx("input",{role:"input",className:Oe("autoui-chat-textbox",o?.input),type:"text",value:e,autoFocus:!0,onChange:n=>t(n.target.value),placeholder:"Type a message...","aria-label":"Message input"})},er=()=>{const{classNames:e}=Ge();return v.jsx("button",{role:"inputButton",type:"submit",className:Oe("autoui-chat-send",e?.inputButton),"aria-label":"Send message",children:v.jsx("img",{src:Uo,alt:"arrow up",width:24,height:24,style:{filter:"var(--icon-filter-text)"}})})},tr=({lang:e="en-us"}={})=>{const t=C.useRef(null),[o,n]=C.useState(""),[s,r]=C.useState(!1),a=typeof window<"u"&&("SpeechRecognition"in window||"webkitSpeechRecognition"in window),i=C.useCallback(()=>{if(!a||s)return;const c=window.SpeechRecognition||window.webkitSpeechRecognition;if(!c)return;const u=new c;u.lang=e,u.continuous=!1,u.interimResults=!1,u.onstart=()=>r(!0),u.onend=()=>r(!1),u.onresult=f=>{const d=f.results[0][0].transcript;n(d),r(!1)},u.onerror=()=>{u.stop(),r(!1)},t.current=u,u.start()},[a,s,e]),l=C.useCallback(()=>{t.current?.stop(),r(!1)},[]);return{start:i,stop:l,text:o,listening:s,isSupported:a}},or=({active:e,onClick:t})=>v.jsx("button",{type:"button",className:`chat-mic-btn ${e?"is-active":""}`,onClick:t,"aria-label":"Voice input",children:v.jsx("img",{src:Wn,width:20,height:20,style:{filter:"var(--icon-filter-text)"}})}),nr=()=>{const{classNames:e,handleSend:t}=Ge(),[o,n]=C.useState(""),s=tr({lang:"en-us"});C.useEffect(()=>{s.text&&n(a=>a?`${a} ${s.text}`:s.text)},[s.text]);const r=a=>{a.preventDefault(),t(o),n("")};return v.jsxs("form",{className:Oe("autoui-chat-input",e?.inputWrapper),onSubmit:r,children:[v.jsx(Qn,{}),v.jsx(Kn,{value:o,setValue:n}),s.isSupported&&v.jsx(or,{active:s.listening,onClick:()=>{s.listening?s.stop():s.start()}}),v.jsx(er,{})]})},rr=({message:e})=>{const t=e.role==="user",{classNames:o}=Ge(),n=typeof e.content=="string"||e.content instanceof String;return v.jsx("div",{role:"message",className:ye("autoui-chat-message",t?"user":"assistant",o?.message),"aria-label":t?"User message":"Assistant message",children:v.jsx("div",{className:`autoui-chat-bubble ${n?"autoui-chat-bubble--string":"autoui-chat-bubble--react-node"}`,children:e.content})})},At=0,_e=1,et=2,Wo=4;function go(e){return()=>e}function sr(e){e()}function Jo(e,t){return o=>e(t(o))}function yo(e,t){return()=>e(t)}function ir(e,t){return o=>e(t,o)}function qt(e){return e!==void 0}function ar(...e){return()=>{e.map(sr)}}function tt(){}function Ot(e,t){return t(e),e}function lr(e,t){return t(e)}function ie(...e){return e}function Z(e,t){return e(_e,t)}function U(e,t){e(At,t)}function Gt(e){e(et)}function le(e){return e(Wo)}function M(e,t){return Z(e,ir(t,At))}function je(e,t){const o=e(_e,n=>{o(),t(n)});return o}function wo(e){let t,o;return n=>s=>{t=s,o&&clearTimeout(o),o=setTimeout(()=>{n(t)},e)}}function qo(e,t){return e===t}function se(e=qo){let t;return o=>n=>{e(t,n)||(t=n,o(n))}}function _(e){return t=>o=>{e(o)&&t(o)}}function L(e){return t=>Jo(t,e)}function Ve(e){return t=>()=>{t(e)}}function R(e,...t){const o=cr(...t);return(n,s)=>{switch(n){case et:Gt(e);return;case _e:return Z(e,o(s))}}}function Ne(e,t){return o=>n=>{o(t=e(t,n))}}function qe(e){return t=>o=>{e>0?e--:t(o)}}function Fe(e){let t=null,o;return n=>s=>{t=s,!o&&(o=setTimeout(()=>{o=void 0,n(t)},e))}}function W(...e){const t=new Array(e.length);let o=0,n=null;const s=Math.pow(2,e.length)-1;return e.forEach((r,a)=>{const i=Math.pow(2,a);Z(r,l=>{const c=o;o=o|i,t[a]=l,c!==s&&o===s&&n&&(n(),n=null)})}),r=>a=>{const i=()=>{r([a].concat(t))};o===s?i():n=i}}function cr(...e){return t=>e.reduceRight(lr,t)}function ur(e){let t,o;const n=()=>t?.();return function(s,r){switch(s){case _e:return r?o===r?void 0:(n(),o=r,t=Z(e,r),t):(n(),tt);case et:n(),o=null;return}}}function A(e){let t=e;const o=q();return(n,s)=>{switch(n){case At:t=s;break;case _e:{s(t);break}case Wo:return t}return o(n,s)}}function Se(e,t){return Ot(A(t),o=>M(e,o))}function q(){const e=[];return(t,o)=>{switch(t){case At:e.slice().forEach(n=>{n(o)});return;case et:e.splice(0,e.length);return;case _e:return e.push(o),()=>{const n=e.indexOf(o);n>-1&&e.splice(n,1)}}}}function Ie(e){return Ot(q(),t=>M(e,t))}function Y(e,t=[],{singleton:o}={singleton:!0}){return{constructor:e,dependencies:t,id:dr(),singleton:o}}const dr=()=>Symbol();function pr(e){const t=new Map,o=({constructor:n,dependencies:s,id:r,singleton:a})=>{if(a&&t.has(r))return t.get(r);const i=n(s.map(l=>o(l)));return a&&t.set(r,i),i};return o(e)}function de(...e){const t=q(),o=new Array(e.length);let n=0;const s=Math.pow(2,e.length)-1;return e.forEach((r,a)=>{const i=Math.pow(2,a);Z(r,l=>{o[a]=l,n=n|i,n===s&&U(t,o)})}),function(r,a){switch(r){case et:{Gt(t);return}case _e:return n===s&&a(o),Z(t,a)}}}function B(e,t=qo){return R(e,se(t))}function _t(...e){return function(t,o){switch(t){case et:return;case _e:return ar(...e.map(n=>Z(n,o)))}}}var Ce=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ce||{});const fr={0:"debug",3:"error",1:"log",2:"warn"},mr=()=>typeof globalThis>"u"?window:globalThis,He=Y(()=>{const e=A(3);return{log:A((t,o,n=1)=>{var s;const r=(s=mr().VIRTUOSO_LOG_LEVEL)!=null?s:le(e);n>=r&&console[fr[n]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,o)}),logLevel:e}},[],{singleton:!0});function Ye(e,t,o){return Yt(e,t,o).callbackRef}function Yt(e,t,o){const n=C.useRef(null);let s=a=>{};const r=C.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(a=>{const i=()=>{const l=a[0].target;l.offsetParent!==null&&e(l)};o?i():requestAnimationFrame(i)}):null,[e,o]);return s=a=>{a&&t?(r?.observe(a),n.current=a):(n.current&&r?.unobserve(n.current),n.current=null)},{callbackRef:s,ref:n}}function hr(e,t,o,n,s,r,a,i,l){const c=C.useCallback(u=>{const f=gr(u.children,t,i?"offsetWidth":"offsetHeight",s);let d=u.parentElement;for(;!d.dataset.virtuosoScroller;)d=d.parentElement;const m=d.lastElementChild.dataset.viewportType==="window";let S;m&&(S=d.ownerDocument.defaultView);const b=a?i?a.scrollLeft:a.scrollTop:m?i?S.scrollX||S.document.documentElement.scrollLeft:S.scrollY||S.document.documentElement.scrollTop:i?d.scrollLeft:d.scrollTop,x=a?i?a.scrollWidth:a.scrollHeight:m?i?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight:i?d.scrollWidth:d.scrollHeight,g=a?i?a.offsetWidth:a.offsetHeight:m?i?S.innerWidth:S.innerHeight:i?d.offsetWidth:d.offsetHeight;n({scrollHeight:x,scrollTop:Math.max(b,0),viewportHeight:g}),r?.(i?xo("column-gap",getComputedStyle(u).columnGap,s):xo("row-gap",getComputedStyle(u).rowGap,s)),f!==null&&e(f)},[e,t,s,r,a,n,i]);return Yt(c,o,l)}function gr(e,t,o,n){const s=e.length;if(s===0)return null;const r=[];for(let a=0;a<s;a++){const i=e.item(a);if(i.dataset.index===void 0)continue;const l=parseInt(i.dataset.index),c=parseFloat(i.dataset.knownSize),u=t(i,o);if(u===0&&n("Zero-sized element, this should not happen",{child:i},Ce.ERROR),u===c)continue;const f=r[r.length-1];r.length===0||f.size!==u||f.endIndex!==l-1?r.push({endIndex:l,size:u,startIndex:l}):r[r.length-1].endIndex++}return r}function xo(e,t,o){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&o(`${e} was not resolved to pixel value correctly`,t,Ce.WARN),t==="normal"?0:parseInt(t??"0",10)}function Go(e,t,o){const n=C.useRef(null),s=C.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),u=c.width;let f,d;if(t){const m=t.getBoundingClientRect(),S=c.top-m.top;d=m.height-Math.max(0,S),f=S+t.scrollTop}else{const m=a.current.ownerDocument.defaultView;d=m.innerHeight-Math.max(0,c.top),f=c.top+m.scrollY}n.current={offsetTop:f,visibleHeight:d,visibleWidth:u},e(n.current)},[e,t]),{callbackRef:r,ref:a}=Yt(s,!0,o),i=C.useCallback(()=>{s(a.current)},[s,a]);return C.useEffect(()=>{var l;if(t){t.addEventListener("scroll",i);const c=new ResizeObserver(()=>{requestAnimationFrame(i)});return c.observe(t),()=>{t.removeEventListener("scroll",i),c.unobserve(t)}}else{const c=(l=a.current)==null?void 0:l.ownerDocument.defaultView;return c?.addEventListener("scroll",i),c?.addEventListener("resize",i),()=>{c?.removeEventListener("scroll",i),c?.removeEventListener("resize",i)}}},[i,t,a]),r}const Te=Y(()=>{const e=q(),t=q(),o=A(0),n=q(),s=A(0),r=q(),a=q(),i=A(0),l=A(0),c=A(0),u=A(0),f=q(),d=q(),m=A(!1),S=A(!1),b=A(!1);return M(R(e,L(({scrollTop:x})=>x)),t),M(R(e,L(({scrollHeight:x})=>x)),a),M(t,s),{deviation:o,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:u,headerHeight:i,horizontalDirection:S,scrollBy:d,scrollContainerState:e,scrollHeight:a,scrollingInProgress:m,scrollTo:f,scrollTop:t,skipAnimationFrameInResizeObserver:b,smoothScrollTargetReached:n,statefulScrollTop:s,viewportHeight:r}},[],{singleton:!0}),lt={lvl:0};function Yo(e,t){const o=e.length;if(o===0)return[];let{index:n,value:s}=t(e[0]);const r=[];for(let a=1;a<o;a++){const{index:i,value:l}=t(e[a]);r.push({end:i-1,start:n,value:s}),n=i,s=l}return r.push({end:1/0,start:n,value:s}),r}function oe(e){return e===lt}function ct(e,t){if(!oe(e))return t===e.k?e.v:t<e.k?ct(e.l,t):ct(e.r,t)}function Pe(e,t,o="k"){if(oe(e))return[-1/0,void 0];if(Number(e[o])===t)return[e.k,e.v];if(Number(e[o])<t){const n=Pe(e.r,t,o);return n[0]===-1/0?[e.k,e.v]:n}return Pe(e.l,t,o)}function $e(e,t,o){return oe(e)?Qo(t,o,1):t===e.k?fe(e,{k:t,v:o}):t<e.k?bo(fe(e,{l:$e(e.l,t,o)})):bo(fe(e,{r:$e(e.r,t,o)}))}function Qe(){return lt}function Ke(e,t,o){if(oe(e))return[];const n=Pe(e,t)[0];return yr(Dt(e,n,o))}function Ht(e,t){if(oe(e))return lt;const{k:o,l:n,r:s}=e;if(t===o){if(oe(n))return s;if(oe(s))return n;{const[r,a]=Zo(n);return Ct(fe(e,{k:r,l:Xo(n),v:a}))}}else return t<o?Ct(fe(e,{l:Ht(n,t)})):Ct(fe(e,{r:Ht(s,t)}))}function We(e){return oe(e)?[]:[...We(e.l),{k:e.k,v:e.v},...We(e.r)]}function Dt(e,t,o){if(oe(e))return[];const{k:n,l:s,r,v:a}=e;let i=[];return n>t&&(i=i.concat(Dt(s,t,o))),n>=t&&n<=o&&i.push({k:n,v:a}),n<=o&&(i=i.concat(Dt(r,t,o))),i}function Ct(e){const{l:t,lvl:o,r:n}=e;if(n.lvl>=o-1&&t.lvl>=o-1)return e;if(o>n.lvl+1){if(Vt(t))return Ko(fe(e,{lvl:o-1}));if(!oe(t)&&!oe(t.r))return fe(t.r,{l:fe(t,{r:t.r.l}),lvl:o,r:fe(e,{l:t.r.r,lvl:o-1})});throw new Error("Unexpected empty nodes")}else{if(Vt(e))return Ut(fe(e,{lvl:o-1}));if(!oe(n)&&!oe(n.l)){const s=n.l,r=Vt(s)?n.lvl-1:n.lvl;return fe(s,{l:fe(e,{lvl:o-1,r:s.l}),lvl:s.lvl+1,r:Ut(fe(n,{l:s.r,lvl:r}))})}else throw new Error("Unexpected empty nodes")}}function fe(e,t){return Qo(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Xo(e){return oe(e.r)?e.l:Ct(fe(e,{r:Xo(e.r)}))}function Vt(e){return oe(e)||e.lvl>e.r.lvl}function Zo(e){return oe(e.r)?[e.k,e.v]:Zo(e.r)}function Qo(e,t,o,n=lt,s=lt){return{k:e,l:n,lvl:o,r:s,v:t}}function bo(e){return Ut(Ko(e))}function Ko(e){const{l:t}=e;return!oe(t)&&t.lvl===e.lvl?fe(t,{r:fe(e,{l:t.r})}):e}function Ut(e){const{lvl:t,r:o}=e;return!oe(o)&&!oe(o.r)&&o.lvl===t&&o.r.lvl===t?fe(o,{l:fe(e,{r:o.l}),lvl:t+1}):e}function yr(e){return Yo(e,({k:t,v:o})=>({index:t,value:o}))}function en(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function ut(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const Xt=Y(()=>({recalcInProgress:A(!1)}),[],{singleton:!0});function tn(e,t,o){return e[It(e,t,o)]}function It(e,t,o,n=0){let s=e.length-1;for(;n<=s;){const r=Math.floor((n+s)/2),a=e[r],i=o(a,t);if(i===0)return r;if(i===-1){if(s-n<2)return r-1;s=r-1}else{if(s===n)return r;n=r+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function wr(e,t,o,n){const s=It(e,t,n),r=It(e,o,n,s);return e.slice(s,r+1)}function Be(e,t){return Math.round(e.getBoundingClientRect()[t])}function jt(e){return!oe(e.groupOffsetTree)}function Zt({index:e},t){return t===e?0:t<e?-1:1}function xr(){return{groupIndices:[],groupOffsetTree:Qe(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Qe()}}function br(e,t){let o=oe(e)?0:1/0;for(const n of t){const{endIndex:s,size:r,startIndex:a}=n;if(o=Math.min(o,a),oe(e)){e=$e(e,0,r);continue}const i=Ke(e,a-1,s+1);if(i.some(Er(n)))continue;let l=!1,c=!1;for(const{end:u,start:f,value:d}of i)l?(s>=f||r===d)&&(e=Ht(e,f)):(c=d!==r,l=!0),u>s&&s>=f&&d!==r&&(e=$e(e,s+1,d));c&&(e=$e(e,a,r))}return[e,o]}function vr(e){return typeof e.groupIndex<"u"}function Sr({offset:e},t){return t===e?0:t<e?-1:1}function dt(e,t,o){if(t.length===0)return 0;const{index:n,offset:s,size:r}=tn(t,e,Zt),a=e-n,i=r*a+(a-1)*o+s;return i>0?i+o:i}function on(e,t){if(!jt(t))return e;let o=0;for(;t.groupIndices[o]<=e+o;)o++;return e+o}function nn(e,t,o){if(vr(e))return t.groupIndices[e.groupIndex]+1;{const n=e.index==="LAST"?o:e.index;let s=on(n,t);return s=Math.max(0,s,Math.min(o,s)),s}}function Tr(e,t,o,n=0){return n>0&&(t=Math.max(t,tn(e,n,Zt).offset)),Yo(wr(e,t,o,Sr),Ir)}function Cr(e,[t,o,n,s]){t.length>0&&n("received item sizes",t,Ce.DEBUG);const r=e.sizeTree;let a=r,i=0;if(o.length>0&&oe(r)&&t.length===2){const d=t[0].size,m=t[1].size;a=o.reduce((S,b)=>$e($e(S,b,d),b+1,m),a)}else[a,i]=br(a,t);if(a===r)return e;const{lastIndex:l,lastOffset:c,lastSize:u,offsetTree:f}=Wt(e.offsetTree,i,a,s);return{groupIndices:o,groupOffsetTree:o.reduce((d,m)=>$e(d,m,dt(m,f,s)),Qe()),lastIndex:l,lastOffset:c,lastSize:u,offsetTree:f,sizeTree:a}}function $r(e){return We(e).map(({k:t,v:o},n,s)=>{const r=s[n+1];return{endIndex:r?r.k-1:1/0,size:o,startIndex:t}})}function vo(e,t){let o=0,n=0;for(;o<e;)o+=t[n+1]-t[n]-1,n++;return n-(o===e?0:1)}function Wt(e,t,o,n){let s=e,r=0,a=0,i=0,l=0;if(t!==0){l=It(s,t-1,Zt),i=s[l].offset;const c=Pe(o,t-1);r=c[0],a=c[1],s.length&&s[l].size===Pe(o,t)[1]&&(l-=1),s=s.slice(0,l+1)}else s=[];for(const{start:c,value:u}of Ke(o,t,1/0)){const f=c-r,d=f*a+i+f*n;s.push({index:c,offset:d,size:u}),r=c,i=d,a=u}return{lastIndex:r,lastOffset:i,lastSize:a,offsetTree:s}}function Ir(e){return{index:e.index,value:e}}function Er(e){const{endIndex:t,size:o,startIndex:n}=e;return s=>s.start===n&&(s.end===t||s.end===1/0)&&s.value===o}const kr={offsetHeight:"height",offsetWidth:"width"},ze=Y(([{log:e},{recalcInProgress:t}])=>{const o=q(),n=q(),s=Se(n,0),r=q(),a=q(),i=A(0),l=A([]),c=A(void 0),u=A(void 0),f=A(void 0),d=A(void 0),m=A((p,w)=>Be(p,kr[w])),S=A(void 0),b=A(0),x=xr(),g=Se(R(o,W(l,e,b),Ne(Cr,x),se()),x),h=Se(R(l,se(),Ne((p,w)=>({current:w,prev:p.current}),{current:[],prev:[]}),L(({prev:p})=>p)),[]);M(R(l,_(p=>p.length>0),W(g,b),L(([p,w,k])=>{const O=p.reduce((P,V,z)=>$e(P,V,dt(V,w.offsetTree,k)||z),Qe());return{...w,groupIndices:p,groupOffsetTree:O}})),g),M(R(n,W(g),_(([p,{lastIndex:w}])=>p<w),L(([p,{lastIndex:w,lastSize:k}])=>[{endIndex:w,size:k,startIndex:p}])),o),M(c,u);const y=Se(R(c,L(p=>p===void 0)),!0);M(R(u,_(p=>p!==void 0&&oe(le(g).sizeTree)),L(p=>{const w=le(f),k=le(l).length>0;return w?k?[{endIndex:0,size:w,startIndex:0},{endIndex:1,size:p,startIndex:1}]:[]:[{endIndex:0,size:p,startIndex:0}]})),o),M(R(d,_(p=>p!==void 0&&p.length>0&&oe(le(g).sizeTree)),L(p=>{const w=[];let k=p[0],O=0;for(let P=1;P<p.length;P++){const V=p[P];V!==k&&(w.push({endIndex:P-1,size:k,startIndex:O}),k=V,O=P)}return w.push({endIndex:p.length-1,size:k,startIndex:O}),w})),o),M(R(l,W(f,u),_(([,p,w])=>p!==void 0&&w!==void 0),L(([p,w,k])=>{const O=[];for(let P=0;P<p.length;P++){const V=p[P],z=p[P+1];O.push({startIndex:V,endIndex:V,size:w}),z!==void 0&&O.push({startIndex:V+1,endIndex:z-1,size:k})}return O})),o);const I=Ie(R(o,W(g),Ne(({sizes:p},[w,k])=>({changed:k!==p,sizes:k}),{changed:!1,sizes:x}),L(p=>p.changed)));Z(R(i,Ne((p,w)=>({diff:p.prev-w,prev:w}),{diff:0,prev:0}),L(p=>p.diff)),p=>{const{groupIndices:w}=le(g);if(p>0)U(t,!0),U(r,p+vo(p,w));else if(p<0){const k=le(h);k.length>0&&(p-=vo(-p,k)),U(a,p)}}),Z(R(i,W(e)),([p,w])=>{p<0&&w("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:i},Ce.ERROR)});const T=Ie(r);M(R(r,W(g),L(([p,w])=>{const k=w.groupIndices.length>0,O=[],P=w.lastSize;if(k){const V=ct(w.sizeTree,0);let z=0,N=0;for(;z<p;){const X=w.groupIndices[N],Q=w.groupIndices.length===N+1?1/0:w.groupIndices[N+1]-X-1;O.push({endIndex:X,size:V,startIndex:X}),O.push({endIndex:X+1+Q-1,size:P,startIndex:X+1}),N++,z+=Q+1}const D=We(w.sizeTree);return z!==p&&D.shift(),D.reduce((X,{k:Q,v:we})=>{let xe=X.ranges;return X.prevSize!==0&&(xe=[...X.ranges,{endIndex:Q+p-1,size:X.prevSize,startIndex:X.prevIndex}]),{prevIndex:Q+p,prevSize:we,ranges:xe}},{prevIndex:p,prevSize:0,ranges:O}).ranges}return We(w.sizeTree).reduce((V,{k:z,v:N})=>({prevIndex:z+p,prevSize:N,ranges:[...V.ranges,{endIndex:z+p-1,size:V.prevSize,startIndex:V.prevIndex}]}),{prevIndex:0,prevSize:P,ranges:[]}).ranges})),o);const E=Ie(R(a,W(g,b),L(([p,{offsetTree:w},k])=>{const O=-p;return dt(O,w,k)})));return M(R(a,W(g,b),L(([p,w,k])=>{if(w.groupIndices.length>0){if(oe(w.sizeTree))return w;let O=Qe();const P=le(h);let V=0,z=0,N=0;for(;V<-p;){N=P[z];const D=P[z+1]-N-1;z++,V+=D+1}if(O=We(w.sizeTree).reduce((D,{k:X,v:Q})=>$e(D,Math.max(0,X+p),Q),O),V!==-p){const D=ct(w.sizeTree,N);O=$e(O,0,D);const X=Pe(w.sizeTree,-p+1)[1];O=$e(O,1,X)}return{...w,sizeTree:O,...Wt(w.offsetTree,0,O,k)}}else{const O=We(w.sizeTree).reduce((P,{k:V,v:z})=>$e(P,Math.max(0,V+p),z),Qe());return{...w,sizeTree:O,...Wt(w.offsetTree,0,O,k)}}})),g),{beforeUnshiftWith:T,data:S,defaultItemSize:u,firstItemIndex:i,fixedItemSize:c,fixedGroupSize:f,gap:b,groupIndices:l,heightEstimates:d,itemSize:m,listRefresh:I,shiftWith:a,shiftWithOffset:E,sizeRanges:o,sizes:g,statefulTotalCount:s,totalCount:n,trackItemSizes:y,unshiftWith:r}},ie(He,Xt),{singleton:!0});function Rr(e){return e.reduce((t,o)=>(t.groupIndices.push(t.totalCount),t.totalCount+=o+1,t),{groupIndices:[],totalCount:0})}const rn=Y(([{groupIndices:e,sizes:t,totalCount:o},{headerHeight:n,scrollTop:s}])=>{const r=q(),a=q(),i=Ie(R(r,L(Rr)));return M(R(i,L(l=>l.totalCount)),o),M(R(i,L(l=>l.groupIndices)),e),M(R(de(s,t,n),_(([l,c])=>jt(c)),L(([l,c,u])=>Pe(c.groupOffsetTree,Math.max(l-u,0),"v")[0]),se(),L(l=>[l])),a),{groupCounts:r,topItemsIndexes:a}},ie(ze,Te)),De=Y(([{log:e}])=>{const t=A(!1),o=Ie(R(t,_(n=>n),se()));return Z(t,n=>{n&&le(e)("props updated",{},Ce.DEBUG)}),{didMount:o,propsReady:t}},ie(He),{singleton:!0}),Ar=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function sn(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Ar)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const gt=Y(([{gap:e,listRefresh:t,sizes:o,totalCount:n},{fixedFooterHeight:s,fixedHeaderHeight:r,footerHeight:a,headerHeight:i,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:u,viewportHeight:f},{log:d}])=>{const m=q(),S=q(),b=A(0);let x=null,g=null,h=null;function y(){x&&(x(),x=null),h&&(h(),h=null),g&&(clearTimeout(g),g=null),U(l,!1)}return M(R(m,W(o,f,n,b,i,a,d),W(e,r,s),L(([[I,T,E,p,w,k,O,P],V,z,N])=>{const D=sn(I),{align:X,behavior:Q,offset:we}=D,xe=p-1,be=nn(D,T,xe);let $=dt(be,T.offsetTree,V)+k;X==="end"?($+=z+Pe(T.sizeTree,be)[1]-E+N,be===xe&&($+=O)):X==="center"?$+=(z+Pe(T.sizeTree,be)[1]-E+N)/2:$-=w,we&&($+=we);const F=G=>{y(),G?(P("retrying to scroll to",{location:I},Ce.DEBUG),U(m,I)):(U(S,!0),P("list did not change, scroll successful",{},Ce.DEBUG))};if(y(),Q==="smooth"){let G=!1;h=Z(t,K=>{G=G||K}),x=je(u,()=>{F(G)})}else x=je(R(t,Or(150)),F);return g=setTimeout(()=>{y()},1200),U(l,!0),P("scrolling from index to",{behavior:Q,index:be,top:$},Ce.DEBUG),{behavior:Q,top:$}})),c),{scrollTargetReached:S,scrollToIndex:m,topListHeight:b}},ie(ze,Te,He),{singleton:!0});function Or(e){return t=>{const o=setTimeout(()=>{t(!1)},e);return n=>{n&&(t(!0),clearTimeout(o))}}}function Qt(e,t){e==0?t():requestAnimationFrame(()=>{Qt(e-1,t)})}function Kt(e,t){const o=t-1;return typeof e=="number"?e:e.index==="LAST"?o:e.index}const yt=Y(([{defaultItemSize:e,listRefresh:t,sizes:o},{scrollTop:n},{scrollTargetReached:s,scrollToIndex:r},{didMount:a}])=>{const i=A(!0),l=A(0),c=A(!0);return M(R(a,W(l),_(([u,f])=>!!f),Ve(!1)),i),M(R(a,W(l),_(([u,f])=>!!f),Ve(!1)),c),Z(R(de(t,a),W(i,o,e,c),_(([[,u],f,{sizeTree:d},m,S])=>u&&(!oe(d)||qt(m))&&!f&&!S),W(l)),([,u])=>{je(s,()=>{U(c,!0)}),Qt(4,()=>{je(n,()=>{U(i,!0)}),U(r,u)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:i}},ie(ze,Te,gt,De),{singleton:!0});function an(e,t){return Math.abs(e-t)<1.01}const pt="up",rt="down",jr="none",Pr={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Lr=0,wt=Y(([{footerHeight:e,headerHeight:t,scrollBy:o,scrollContainerState:n,scrollTop:s,viewportHeight:r}])=>{const a=A(!1),i=A(!0),l=q(),c=q(),u=A(4),f=A(Lr),d=Se(R(_t(R(B(s),qe(1),Ve(!0)),R(B(s),qe(1),Ve(!1),wo(100))),se()),!1),m=Se(R(_t(R(o,Ve(!0)),R(o,Ve(!1),wo(200))),se()),!1);M(R(de(B(s),B(f)),L(([h,y])=>h<=y),se()),i),M(R(i,Fe(50)),c);const S=Ie(R(de(n,B(r),B(t),B(e),B(u)),Ne((h,[{scrollHeight:y,scrollTop:I},T,E,p,w])=>{const k=I+T-y>-w,O={scrollHeight:y,scrollTop:I,viewportHeight:T};if(k){let V,z;return I>h.state.scrollTop?(V="SCROLLED_DOWN",z=h.state.scrollTop-I):(V="SIZE_DECREASED",z=h.state.scrollTop-I||h.scrollTopDelta),{atBottom:!0,atBottomBecause:V,scrollTopDelta:z,state:O}}let P;return O.scrollHeight>h.state.scrollHeight?P="SIZE_INCREASED":T<h.state.viewportHeight?P="VIEWPORT_HEIGHT_DECREASING":I<h.state.scrollTop?P="SCROLLING_UPWARDS":P="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:P,state:O}},Pr),se((h,y)=>h&&h.atBottom===y.atBottom))),b=Se(R(n,Ne((h,{scrollHeight:y,scrollTop:I,viewportHeight:T})=>{if(an(h.scrollHeight,y))return{changed:!1,jump:0,scrollHeight:y,scrollTop:I};{const E=y-(I+T)<1;return h.scrollTop!==I&&E?{changed:!0,jump:h.scrollTop-I,scrollHeight:y,scrollTop:I}:{changed:!0,jump:0,scrollHeight:y,scrollTop:I}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),_(h=>h.changed),L(h=>h.jump)),0);M(R(S,L(h=>h.atBottom)),a),M(R(a,Fe(50)),l);const x=A(rt);M(R(n,L(({scrollTop:h})=>h),se(),Ne((h,y)=>le(m)?{direction:h.direction,prevScrollTop:y}:{direction:y<h.prevScrollTop?pt:rt,prevScrollTop:y},{direction:rt,prevScrollTop:0}),L(h=>h.direction)),x),M(R(n,Fe(50),Ve(jr)),x);const g=A(0);return M(R(d,_(h=>!h),Ve(0)),g),M(R(s,Fe(100),W(d),_(([h,y])=>!!y),Ne(([h,y],[I])=>[y,I],[0,0]),L(([h,y])=>y-h)),g),{atBottomState:S,atBottomStateChange:l,atBottomThreshold:u,atTopStateChange:c,atTopThreshold:f,isAtBottom:a,isAtTop:i,isScrolling:d,lastJumpDueToItemResize:b,scrollDirection:x,scrollVelocity:g}},ie(Te)),ft="top",mt="bottom",So="none";function To(e,t,o){return typeof e=="number"?o===pt&&t===ft||o===rt&&t===mt?e:0:o===pt?t===ft?e.main:e.reverse:t===mt?e.main:e.reverse}function Co(e,t){var o;return typeof e=="number"?e:(o=e[t])!=null?o:0}const eo=Y(([{deviation:e,fixedHeaderHeight:t,headerHeight:o,scrollTop:n,viewportHeight:s}])=>{const r=q(),a=A(0),i=A(0),l=A(0),c=Se(R(de(B(n),B(s),B(o),B(r,ut),B(l),B(a),B(t),B(e),B(i)),L(([u,f,d,[m,S],b,x,g,h,y])=>{const I=u-h,T=x+g,E=Math.max(d-I,0);let p=So;const w=Co(y,ft),k=Co(y,mt);return m-=h,m+=d+g,S+=d+g,S-=h,m>u+T-w&&(p=pt),S<u-E+f+k&&(p=rt),p!==So?[Math.max(I-d-To(b,ft,p)-w,0),I-E-g+f+To(b,mt,p)+k]:null}),_(u=>u!=null),se(ut)),[0,0]);return{increaseViewportBy:i,listBoundary:r,overscan:l,topListHeight:a,visibleRange:c}},ie(Te),{singleton:!0});function Mr(e,t,o){if(jt(t)){const n=on(e,t);return[{index:Pe(t.groupOffsetTree,n)[0],offset:0,size:0},{data:o?.[0],index:n,offset:0,size:0}]}return[{data:o?.[0],index:e,offset:0,size:0}]}const Nt={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function $t(e,t,o,n,s,r){const{lastIndex:a,lastOffset:i,lastSize:l}=s;let c=0,u=0;if(e.length>0){c=e[0].offset;const b=e[e.length-1];u=b.offset+b.size}const f=o-a,d=i+f*l+(f-1)*n,m=c,S=d-u;return{bottom:u,firstItemIndex:r,items:$o(e,s,r),offsetBottom:S,offsetTop:c,top:m,topItems:$o(t,s,r),topListHeight:t.reduce((b,x)=>x.size+b,0),totalCount:o}}function ln(e,t,o,n,s,r){let a=0;if(o.groupIndices.length>0)for(const u of o.groupIndices){if(u-a>=e)break;a++}const i=e+a,l=Kt(t,i),c=Array.from({length:i}).map((u,f)=>({data:r[f+l],index:f+l,offset:0,size:0}));return $t(c,[],i,s,o,n)}function $o(e,t,o){if(e.length===0)return[];if(!jt(t))return e.map(c=>({...c,index:c.index+o,originalIndex:c.index}));const n=e[0].index,s=e[e.length-1].index,r=[],a=Ke(t.groupOffsetTree,n,s);let i,l=0;for(const c of e){(!i||i.end<c.index)&&(i=a.shift(),l=t.groupIndices.indexOf(i.start));let u;c.index===i.start?u={index:l,type:"group"}:u={groupIndex:l,index:c.index-(l+1)+o},r.push({...u,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return r}function Io(e,t){var o;return e===void 0?0:typeof e=="number"?e:(o=e[t])!=null?o:0}const Xe=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n,totalCount:s},r,{listBoundary:a,topListHeight:i,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:u},{topListHeight:f},d,{didMount:m},{recalcInProgress:S}])=>{const b=A([]),x=A(0),g=q(),h=A(0);M(r.topItemsIndexes,b);const y=Se(R(de(m,S,B(l,ut),B(s),B(n),B(c),u,B(b),B(t),B(o),B(h),e),_(([p,w,,k,,,,,,,,O])=>{const P=O&&O.length!==k;return p&&!w&&!P}),L(([,,[p,w],k,O,P,V,z,N,D,X,Q])=>{var we,xe,be,$;const F=O,{offsetTree:G,sizeTree:K}=F,Le=le(x);if(k===0)return{...Nt,totalCount:k};if(p===0&&w===0)return Le===0?{...Nt,totalCount:k}:ln(Le,P,O,N,D,Q||[]);if(oe(K))return Le>0?null:$t(Mr(Kt(P,k),F,Q),[],k,D,F,N);const Me=[];if(z.length>0){const pe=z[0],ce=z[z.length-1];let me=0;for(const ue of Ke(K,pe,ce)){const te=ue.value,re=Math.max(ue.start,pe),ke=Math.min(ue.end,ce);for(let ge=re;ge<=ke;ge++)Me.push({data:Q?.[ge],index:ge,offset:me,size:te}),me+=te}}if(!V)return $t([],Me,k,D,F,N);const ee=z.length>0?z[z.length-1]+1:0,j=Tr(G,p,w,ee);if(j.length===0)return null;const J=k-1,ne=Ot([],pe=>{for(const ce of j){const me=ce.value;let ue=me.offset,te=ce.start;const re=me.size;if(me.offset<p){te+=Math.floor((p-me.offset+D)/(re+D));const ge=te-ce.start;ue+=ge*re+ge*D}te<ee&&(ue+=(ee-te)*re,te=ee);const ke=Math.min(ce.end,J);for(let ge=te;ge<=ke&&!(ue>=w);ge++)pe.push({data:Q?.[ge],index:ge,offset:ue,size:re}),ue+=re+D}}),he=Io(X,ft),Ee=Io(X,mt);if(ne.length>0&&(he>0||Ee>0)){const pe=ne[0],ce=ne[ne.length-1];if(he>0&&pe.index>ee){const me=Math.min(he,pe.index-ee),ue=[];let te=pe.offset;for(let re=pe.index-1;re>=pe.index-me;re--){const ke=(xe=(we=Ke(K,re,re)[0])==null?void 0:we.value)!=null?xe:pe.size;te-=ke+D,ue.unshift({data:Q?.[re],index:re,offset:te,size:ke})}ne.unshift(...ue)}if(Ee>0&&ce.index<J){const me=Math.min(Ee,J-ce.index);let ue=ce.offset+ce.size+D;for(let te=ce.index+1;te<=ce.index+me;te++){const re=($=(be=Ke(K,te,te)[0])==null?void 0:be.value)!=null?$:ce.size;ne.push({data:Q?.[te],index:te,offset:ue,size:re}),ue+=re+D}}}return $t(ne,Me,k,D,F,N)}),_(p=>p!==null),se()),Nt);M(R(e,_(qt),L(p=>p?.length)),s),M(R(y,L(p=>p.topListHeight)),f),M(f,i),M(R(y,L(p=>[p.top,p.bottom])),a),M(R(y,L(p=>p.items)),g);const I=Ie(R(y,_(({items:p})=>p.length>0),W(s,e),_(([{items:p},w])=>p[p.length-1].originalIndex===w-1),L(([,p,w])=>[p-1,w]),se(ut),L(([p])=>p))),T=Ie(R(y,Fe(200),_(({items:p,topItems:w})=>p.length>0&&p[0].originalIndex===w.length),L(({items:p})=>p[0].index),se())),E=Ie(R(y,_(({items:p})=>p.length>0),L(({items:p})=>{let w=0,k=p.length-1;for(;p[w].type==="group"&&w<k;)w++;for(;p[k].type==="group"&&k>w;)k--;return{endIndex:p[k].index,startIndex:p[w].index}}),se(en)));return{endReached:I,initialItemCount:x,itemsRendered:g,listState:y,minOverscanItemCount:h,rangeChanged:E,startReached:T,topItemsIndexes:b,...d}},ie(ze,rn,eo,yt,gt,wt,De,Xt),{singleton:!0}),cn=Y(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:o,headerHeight:n},{listState:s}])=>{const r=q(),a=Se(R(de(o,e,n,t,s),L(([i,l,c,u,f])=>i+l+c+u+f.offsetBottom+f.bottom)),0);return M(B(a),r),{totalListHeight:a,totalListHeightChanged:r}},ie(Te,Xe),{singleton:!0}),Vr=Y(([{viewportHeight:e},{totalListHeight:t}])=>{const o=A(!1),n=Se(R(de(o,e,t),_(([s])=>s),L(([,s,r])=>Math.max(0,s-r)),Fe(0),se()),0);return{alignToBottom:o,paddingTopAddition:n}},ie(Te,cn),{singleton:!0}),un=Y(()=>({context:A(null)})),Nr=({itemBottom:e,itemTop:t,locationParams:{align:o,behavior:n,...s},viewportBottom:r,viewportTop:a})=>t<a?{...s,align:o??"start",behavior:n}:e>r?{...s,align:o??"end",behavior:n}:null,dn=Y(([{gap:e,sizes:t,totalCount:o},{fixedFooterHeight:n,fixedHeaderHeight:s,headerHeight:r,scrollingInProgress:a,scrollTop:i,viewportHeight:l},{scrollToIndex:c}])=>{const u=q();return M(R(u,W(t,l,o,r,s,n,i),W(e),L(([[f,d,m,S,b,x,g,h],y])=>{const{align:I,behavior:T,calculateViewLocation:E=Nr,done:p,...w}=f,k=nn(f,d,S-1),O=dt(k,d.offsetTree,y)+b+x,P=O+Pe(d.sizeTree,k)[1],V=h+x,z=h+m-g,N=E({itemBottom:P,itemTop:O,locationParams:{align:I,behavior:T,...w},viewportBottom:z,viewportTop:V});return N?p&&je(R(a,_(D=>!D),qe(le(a)?1:2)),p):p&&p(),N}),_(f=>f!==null)),c),{scrollIntoView:u}},ie(ze,Te,gt,Xe,He),{singleton:!0});function Eo(e){return e?e==="smooth"?"smooth":"auto":!1}const zr=(e,t)=>typeof e=="function"?Eo(e(t)):t&&Eo(e),Fr=Y(([{listRefresh:e,totalCount:t,fixedItemSize:o,data:n},{atBottomState:s,isAtBottom:r},{scrollToIndex:a},{scrolledToInitialItem:i},{didMount:l,propsReady:c},{log:u},{scrollingInProgress:f},{context:d},{scrollIntoView:m}])=>{const S=A(!1),b=q();let x=null;function g(T){U(a,{align:"end",behavior:T,index:"LAST"})}Z(R(de(R(B(t),qe(1)),l),W(B(S),r,i,f),L(([[T,E],p,w,k,O])=>{let P=E&&k,V="auto";return P&&(V=zr(p,w||O),P=P&&!!V),{followOutputBehavior:V,shouldFollow:P,totalCount:T}}),_(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:E})=>{x&&(x(),x=null),le(o)?requestAnimationFrame(()=>{le(u)("following output to ",{totalCount:E},Ce.DEBUG),g(T)}):x=je(e,()=>{le(u)("following output to ",{totalCount:E},Ce.DEBUG),g(T),x=null})});function h(T){const E=je(s,p=>{T&&!p.atBottom&&p.notAtBottomBecause==="SIZE_INCREASED"&&!x&&(le(u)("scrolling to bottom due to increased size",{},Ce.DEBUG),g("auto"))});setTimeout(E,100)}Z(R(de(B(S),t,c),_(([T,,E])=>T&&E),Ne(({value:T},[,E])=>({refreshed:T===E,value:E}),{refreshed:!1,value:0}),_(({refreshed:T})=>T),W(S,t)),([,T])=>{le(i)&&h(T!==!1)}),Z(b,()=>{h(le(S)!==!1)}),Z(de(B(S),s),([T,E])=>{T&&!E.atBottom&&E.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")});const y=A(null),I=q();return M(_t(R(B(n),L(T=>{var E;return(E=T?.length)!=null?E:0})),R(B(t))),I),Z(R(de(R(I,qe(1)),l),W(B(y),i,f,d),L(([[T,E],p,w,k,O])=>E&&w&&p?.({context:O,totalCount:T,scrollingInProgress:k})),_(T=>!!T),Fe(0)),T=>{x&&(x(),x=null),le(o)?requestAnimationFrame(()=>{le(u)("scrolling into view",{}),U(m,T)}):x=je(e,()=>{le(u)("scrolling into view",{}),U(m,T),x=null})}),{autoscrollToBottom:b,followOutput:S,scrollIntoViewOnChange:y}},ie(ze,wt,gt,yt,De,He,Te,un,dn)),Br=Y(([{data:e,firstItemIndex:t,gap:o,sizes:n},{initialTopMostItemIndex:s},{initialItemCount:r,listState:a},{didMount:i}])=>(M(R(i,W(r),_(([,l])=>l!==0),W(s,n,t,o,e),L(([[,l],c,u,f,d,m=[]])=>ln(l,c,u,f,d,m))),a),{}),ie(ze,yt,Xe,De),{singleton:!0}),_r=Y(([{didMount:e},{scrollTo:t},{listState:o}])=>{const n=A(0);return Z(R(e,W(n),_(([,s])=>s!==0),L(([,s])=>({top:s}))),s=>{je(R(o,qe(1),_(r=>r.items.length>1)),()=>{requestAnimationFrame(()=>{U(t,s)})})}),{initialScrollTop:n}},ie(De,Te,Xe),{singleton:!0}),pn=Y(([{scrollVelocity:e}])=>{const t=A(!1),o=q(),n=A(!1);return M(R(e,W(n,t,o),_(([s,r])=>!!r),L(([s,r,a,i])=>{const{enter:l,exit:c}=r;if(a){if(c(s,i))return!1}else if(l(s,i))return!0;return a}),se()),t),Z(R(de(t,e,o),W(n)),([[s,r,a],i])=>{s&&i&&i.change&&i.change(r,a)}),{isSeeking:t,scrollSeekConfiguration:n,scrollSeekRangeChanged:o,scrollVelocity:e}},ie(wt),{singleton:!0}),to=Y(([{scrollContainerState:e,scrollTo:t}])=>{const o=q(),n=q(),s=q(),r=A(!1),a=A(void 0);return M(R(de(o,n),L(([{scrollHeight:i,scrollTop:l,viewportHeight:c},{offsetTop:u}])=>({scrollHeight:i,scrollTop:Math.max(0,l-u),viewportHeight:c}))),e),M(R(t,W(n),L(([i,{offsetTop:l}])=>({...i,top:i.top+l}))),s),{customScrollParent:a,useWindowScroll:r,windowScrollContainerState:o,windowScrollTo:s,windowViewportRect:n}},ie(Te)),Hr=Y(([{sizeRanges:e,sizes:t},{headerHeight:o,scrollTop:n},{initialTopMostItemIndex:s},{didMount:r},{useWindowScroll:a,windowScrollContainerState:i,windowViewportRect:l}])=>{const c=q(),u=A(void 0),f=A(null),d=A(null);return M(i,f),M(l,d),Z(R(c,W(t,n,a,f,d,o)),([m,S,b,x,g,h,y])=>{const I=$r(S.sizeTree);x&&g!==null&&h!==null&&(b=g.scrollTop-h.offsetTop),b-=y,m({ranges:I,scrollTop:b})}),M(R(u,_(qt),L(Dr)),s),M(R(r,W(u),_(([,m])=>m!==void 0),se(),L(([,m])=>m.ranges)),e),{getState:c,restoreStateFrom:u}},ie(ze,Te,yt,De,to));function Dr(e){return{align:"start",index:0,offset:e.scrollTop}}const Ur=Y(([{topItemsIndexes:e}])=>{const t=A(0);return M(R(t,_(o=>o>=0),L(o=>Array.from({length:o}).map((n,s)=>s))),e),{topItemCount:t}},ie(Xe));function fn(e){let t=!1,o;return()=>(t||(t=!0,o=e()),o)}const Wr=fn(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Jr=Y(([{deviation:e,scrollBy:t,scrollingInProgress:o,scrollTop:n},{isAtBottom:s,isScrolling:r,lastJumpDueToItemResize:a,scrollDirection:i},{listState:l},{beforeUnshiftWith:c,gap:u,shiftWithOffset:f,sizes:d},{log:m},{recalcInProgress:S}])=>{const b=Ie(R(l,W(a),Ne(([,g,h,y],[{bottom:I,items:T,offsetBottom:E,totalCount:p},w])=>{const k=I+E;let O=0;return h===p&&g.length>0&&T.length>0&&(T[0].originalIndex===0&&g[0].originalIndex===0||(O=k-y,O!==0&&(O+=w))),[O,T,p,k]},[0,[],0,0]),_(([g])=>g!==0),W(n,i,o,s,m,S),_(([,g,h,y,,,I])=>!I&&!y&&g!==0&&h===pt),L(([[g],,,,,h])=>(h("Upward scrolling compensation",{amount:g},Ce.DEBUG),g))));function x(g){g>0?(U(t,{behavior:"auto",top:-g}),U(e,0)):(U(e,0),U(t,{behavior:"auto",top:-g}))}return Z(R(b,W(e,r)),([g,h,y])=>{y&&Wr()?U(e,h-g):x(-g)}),Z(R(de(Se(r,!1),e,S),_(([g,h,y])=>!g&&!y&&h!==0),L(([g,h])=>h),Fe(1)),x),M(R(f,L(g=>({top:-g}))),t),Z(R(c,W(d,u),L(([g,{groupIndices:h,lastSize:y,sizeTree:I},T])=>{function E(p){return p*(y+T)}if(h.length===0)return E(g);{let p=0;const w=ct(I,0);let k=0,O=0;for(;k<g;){k++,p+=w;let P=h.length===O+1?1/0:h[O+1]-h[O]-1;k+P>g&&(p-=w,P=g-k+1),k+=P,p+=E(P),O++}return p}})),g=>{U(e,g),requestAnimationFrame(()=>{U(t,{top:g}),requestAnimationFrame(()=>{U(e,0),U(S,!1)})})}),{deviation:e}},ie(Te,wt,Xe,ze,He,Xt)),qr=Y(([e,t,o,n,s,r,a,i,l,c,u])=>({...e,...t,...o,...n,...s,...r,...a,...i,...l,...c,...u}),ie(eo,Br,De,pn,cn,_r,Vr,to,dn,He,un)),mn=Y(([{data:e,defaultItemSize:t,firstItemIndex:o,fixedItemSize:n,fixedGroupSize:s,gap:r,groupIndices:a,heightEstimates:i,itemSize:l,sizeRanges:c,sizes:u,statefulTotalCount:f,totalCount:d,trackItemSizes:m},{initialItemFinalLocationReached:S,initialTopMostItemIndex:b,scrolledToInitialItem:x},g,h,y,I,{scrollToIndex:T},E,{topItemCount:p},{groupCounts:w},k])=>{const{listState:O,minOverscanItemCount:P,topItemsIndexes:V,rangeChanged:z,...N}=I;return M(z,k.scrollSeekRangeChanged),M(R(k.windowViewportRect,L(D=>D.visibleHeight)),g.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:o,fixedItemHeight:n,fixedGroupHeight:s,gap:r,groupCounts:w,heightEstimates:i,initialItemFinalLocationReached:S,initialTopMostItemIndex:b,scrolledToInitialItem:x,sizeRanges:c,topItemCount:p,topItemsIndexes:V,totalCount:d,...y,groupIndices:a,itemSize:l,listState:O,minOverscanItemCount:P,scrollToIndex:T,statefulTotalCount:f,trackItemSizes:m,rangeChanged:z,...N,...k,...g,sizes:u,...h}},ie(ze,yt,Te,Hr,Fr,Xe,gt,Jr,Ur,rn,qr));function Gr(e,t){const o={},n={};let s=0;const r=e.length;for(;s<r;)n[e[s]]=1,s+=1;for(const a in t)Object.hasOwn(n,a)||(o[a]=t[a]);return o}const vt=typeof document<"u"?C.useLayoutEffect:C.useEffect;function hn(e,t,o){const n=Object.keys(t.required||{}),s=Object.keys(t.optional||{}),r=Object.keys(t.methods||{}),a=Object.keys(t.events||{}),i=C.createContext({});function l(x,g){x.propsReady&&U(x.propsReady,!1);for(const h of n){const y=x[t.required[h]];U(y,g[h])}for(const h of s)if(h in g){const y=x[t.optional[h]];U(y,g[h])}x.propsReady&&U(x.propsReady,!0)}function c(x){return r.reduce((g,h)=>(g[h]=y=>{const I=x[t.methods[h]];U(I,y)},g),{})}function u(x){return a.reduce((g,h)=>(g[h]=ur(x[t.events[h]]),g),{})}const f=C.forwardRef((x,g)=>{const{children:h,...y}=x,[I]=C.useState(()=>Ot(pr(e),p=>{l(p,y)})),[T]=C.useState(yo(u,I));vt(()=>{for(const p of a)p in y&&Z(T[p],y[p]);return()=>{Object.values(T).map(Gt)}},[y,T,I]),vt(()=>{l(I,y)}),C.useImperativeHandle(g,go(c(I)));const E=o;return v.jsx(i.Provider,{value:I,children:o?v.jsx(E,{...Gr([...n,...s,...a],y),children:h}):h})}),d=x=>{const g=C.useContext(i);return C.useCallback(h=>{U(g[x],h)},[g,x])},m=x=>{const g=C.useContext(i)[x],h=C.useCallback(y=>Z(g,y),[g]);return C.useSyncExternalStore(h,()=>le(g),()=>le(g))},S=x=>{const g=C.useContext(i)[x],[h,y]=C.useState(yo(le,g));return vt(()=>Z(g,I=>{I!==h&&y(go(I))}),[g,h]),h},b=C.version.startsWith("18")?m:S;return{Component:f,useEmitter:(x,g)=>{const h=C.useContext(i)[x];vt(()=>Z(h,g),[g,h])},useEmitterValue:b,usePublisher:d}}const gn=C.createContext(void 0),yn=C.createContext(void 0),wn=typeof document<"u"?C.useLayoutEffect:C.useEffect;function zt(e){return"self"in e}function Yr(e){return"body"in e}function xn(e,t,o,n=tt,s,r){const a=C.useRef(null),i=C.useRef(null),l=C.useRef(null),c=C.useCallback(d=>{let m,S,b;const x=d.target;if(Yr(x)||zt(x)){const h=zt(x)?x:x.defaultView;b=r?h.scrollX:h.scrollY,m=r?h.document.documentElement.scrollWidth:h.document.documentElement.scrollHeight,S=r?h.innerWidth:h.innerHeight}else b=r?x.scrollLeft:x.scrollTop,m=r?x.scrollWidth:x.scrollHeight,S=r?x.offsetWidth:x.offsetHeight;const g=()=>{e({scrollHeight:m,scrollTop:Math.max(b,0),viewportHeight:S})};d.suppressFlushSync?g():Fo.flushSync(g),i.current!==null&&(b===i.current||b<=0||b===m-S)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,r]);C.useEffect(()=>{const d=s||a.current;return n(s||a.current),c({suppressFlushSync:!0,target:d}),d.addEventListener("scroll",c,{passive:!0}),()=>{n(null),d.removeEventListener("scroll",c)}},[a,c,o,n,s]);function u(d){const m=a.current;if(!m||(r?"offsetWidth"in m&&m.offsetWidth===0:"offsetHeight"in m&&m.offsetHeight===0))return;const S=d.behavior==="smooth";let b,x,g;zt(m)?(x=Math.max(Be(m.document.documentElement,r?"width":"height"),r?m.document.documentElement.scrollWidth:m.document.documentElement.scrollHeight),b=r?m.innerWidth:m.innerHeight,g=r?window.scrollX:window.scrollY):(x=m[r?"scrollWidth":"scrollHeight"],b=Be(m,r?"width":"height"),g=m[r?"scrollLeft":"scrollTop"]);const h=x-b;if(d.top=Math.ceil(Math.max(Math.min(h,d.top),0)),an(b,x)||d.top===g){e({scrollHeight:x,scrollTop:g,viewportHeight:b}),S&&t(!0);return}S?(i.current=d.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,r&&(d={behavior:d.behavior,left:d.top}),m.scrollTo(d)}function f(d){r&&(d={behavior:d.behavior,left:d.top}),a.current.scrollBy(d)}return{scrollByCallback:f,scrollerRef:a,scrollToCallback:u}}const Ft="-webkit-sticky",ko="sticky",oo=fn(()=>{if(typeof document>"u")return ko;const e=document.createElement("div");return e.style.position=Ft,e.style.position===Ft?Ft:ko});function no(e){return e}const Xr=Y(()=>{const e=A(i=>`Item ${i}`),t=A(i=>`Group ${i}`),o=A({}),n=A(no),s=A("div"),r=A(tt),a=(i,l=null)=>Se(R(o,L(c=>c[i]),se()),l);return{components:o,computeItemKey:n,EmptyPlaceholder:a("EmptyPlaceholder"),FooterComponent:a("Footer"),GroupComponent:a("Group","div"),groupContent:t,HeaderComponent:a("Header"),HeaderFooterTag:s,ItemComponent:a("Item","div"),itemContent:e,ListComponent:a("List","div"),ScrollerComponent:a("Scroller","div"),scrollerRef:r,ScrollSeekPlaceholder:a("ScrollSeekPlaceholder"),TopItemListComponent:a("TopItemList")}}),Zr=Y(([e,t])=>({...e,...t}),ie(mn,Xr)),Qr=({height:e})=>v.jsx("div",{style:{height:e}}),Kr={overflowAnchor:"none",position:oo(),zIndex:1},bn={overflowAnchor:"none"},es={...bn,display:"inline-block",height:"100%"},Ro=C.memo(function({showTopList:e=!1}){const t=H("listState"),o=Re("sizeRanges"),n=H("useWindowScroll"),s=H("customScrollParent"),r=Re("windowScrollContainerState"),a=Re("scrollContainerState"),i=s||n?r:a,l=H("itemContent"),c=H("context"),u=H("groupContent"),f=H("trackItemSizes"),d=H("itemSize"),m=H("log"),S=Re("gap"),b=H("horizontalDirection"),{callbackRef:x}=hr(o,d,f,e?tt:i,m,S,s,b,H("skipAnimationFrameInResizeObserver")),[g,h]=C.useState(0);ro("deviation",N=>{g!==N&&h(N)});const y=H("EmptyPlaceholder"),I=H("ScrollSeekPlaceholder")||Qr,T=H("ListComponent"),E=H("ItemComponent"),p=H("GroupComponent"),w=H("computeItemKey"),k=H("isSeeking"),O=H("groupIndices").length>0,P=H("alignToBottom"),V=H("initialItemFinalLocationReached"),z=e?{}:{boxSizing:"border-box",...b?{display:"inline-block",height:"100%",marginLeft:g!==0?g:P?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:g!==0?g:P?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...V?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&y?v.jsx(y,{...ve(y,c)}):v.jsx(T,{...ve(T,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:x,style:z,children:(e?t.topItems:t.items).map(N=>{const D=N.originalIndex,X=w(D+t.firstItemIndex,N.data,c);return k?C.createElement(I,{...ve(I,c),height:N.size,index:N.index,key:X,type:N.type||"item",...N.type==="group"?{}:{groupIndex:N.groupIndex}}):N.type==="group"?C.createElement(p,{...ve(p,c),"data-index":D,"data-item-index":N.index,"data-known-size":N.size,key:X,style:Kr},u(N.index,c)):C.createElement(E,{...ve(E,c),...rs(E,N.data),"data-index":D,"data-item-group-index":N.groupIndex,"data-item-index":N.index,"data-known-size":N.size,key:X,style:b?es:bn},O?l(N.index,N.groupIndex,N.data,c):l(N.index,N.data,c))})})}),ts={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},os={outline:"none",overflowX:"auto",position:"relative"},Pt=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),ns={position:oo(),top:0,width:"100%",zIndex:1};function ve(e,t){if(typeof e!="string")return{context:t}}function rs(e,t){return{item:typeof e=="string"?void 0:t}}const ss=C.memo(function(){const e=H("HeaderComponent"),t=Re("headerHeight"),o=H("HeaderFooterTag"),n=Ye(C.useMemo(()=>r=>{t(Be(r,"height"))},[t]),!0,H("skipAnimationFrameInResizeObserver")),s=H("context");return e?v.jsx(o,{ref:n,children:v.jsx(e,{...ve(e,s)})}):null}),is=C.memo(function(){const e=H("FooterComponent"),t=Re("footerHeight"),o=H("HeaderFooterTag"),n=Ye(C.useMemo(()=>r=>{t(Be(r,"height"))},[t]),!0,H("skipAnimationFrameInResizeObserver")),s=H("context");return e?v.jsx(o,{ref:n,children:v.jsx(e,{...ve(e,s)})}):null});function vn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return C.memo(function({children:n,style:s,context:r,...a}){const i=o("scrollContainerState"),l=t("ScrollerComponent"),c=o("smoothScrollTargetReached"),u=t("scrollerRef"),f=t("horizontalDirection")||!1,{scrollByCallback:d,scrollerRef:m,scrollToCallback:S}=xn(i,c,l,u,void 0,f);return e("scrollTo",S),e("scrollBy",d),v.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:m,style:{...f?os:ts,...s},tabIndex:0,...a,...ve(l,r),children:n})})}function Sn({useEmitter:e,useEmitterValue:t,usePublisher:o}){return C.memo(function({children:n,style:s,context:r,...a}){const i=o("windowScrollContainerState"),l=t("ScrollerComponent"),c=o("smoothScrollTargetReached"),u=t("totalListHeight"),f=t("deviation"),d=t("customScrollParent"),m=C.useRef(null),S=t("scrollerRef"),{scrollByCallback:b,scrollerRef:x,scrollToCallback:g}=xn(i,c,l,S,d);return wn(()=>{var h;return x.current=d||((h=m.current)==null?void 0:h.ownerDocument.defaultView),()=>{x.current=null}},[x,d]),e("windowScrollTo",g),e("scrollBy",b),v.jsx(l,{ref:m,"data-virtuoso-scroller":!0,style:{position:"relative",...s,...u!==0?{height:u+f}:{}},...a,...ve(l,r),children:n})})}const as=({children:e})=>{const t=C.useContext(gn),o=Re("viewportHeight"),n=Re("fixedItemHeight"),s=H("alignToBottom"),r=H("horizontalDirection"),a=C.useMemo(()=>Jo(o,l=>Be(l,r?"width":"height")),[o,r]),i=Ye(a,!0,H("skipAnimationFrameInResizeObserver"));return C.useEffect(()=>{t&&(o(t.viewportHeight),n(t.itemHeight))},[t,o,n]),v.jsx("div",{"data-viewport-type":"element",ref:i,style:Pt(s),children:e})},ls=({children:e})=>{const t=C.useContext(gn),o=Re("windowViewportRect"),n=Re("fixedItemHeight"),s=H("customScrollParent"),r=Go(o,s,H("skipAnimationFrameInResizeObserver")),a=H("alignToBottom");return C.useEffect(()=>{t&&(n(t.itemHeight),o({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,o,n]),v.jsx("div",{"data-viewport-type":"window",ref:r,style:Pt(a),children:e})},cs=({children:e})=>{const t=H("TopItemListComponent")||"div",o=H("headerHeight"),n={...ns,marginTop:`${o}px`},s=H("context");return v.jsx(t,{style:n,...ve(t,s),children:e})},us=C.memo(function(e){const t=H("useWindowScroll"),o=H("topItemsIndexes").length>0,n=H("customScrollParent"),s=H("context");return v.jsxs(n||t?fs:ps,{...e,context:s,children:[o&&v.jsx(cs,{children:v.jsx(Ro,{showTopList:!0})}),v.jsxs(n||t?ls:as,{children:[v.jsx(ss,{}),v.jsx(Ro,{}),v.jsx(is,{})]})]})}),{Component:ds,useEmitter:ro,useEmitterValue:H,usePublisher:Re}=hn(Zr,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},us),ps=vn({useEmitter:ro,useEmitterValue:H,usePublisher:Re}),fs=Sn({useEmitter:ro,useEmitterValue:H,usePublisher:Re}),ms=ds,hs=Y(()=>{const e=A(c=>v.jsxs("td",{children:["Item $",c]})),t=A(null),o=A(c=>v.jsxs("td",{colSpan:1e3,children:["Group ",c]})),n=A(null),s=A(null),r=A({}),a=A(no),i=A(tt),l=(c,u=null)=>Se(R(r,L(f=>f[c]),se()),u);return{components:r,computeItemKey:a,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:s,fixedHeaderContent:n,itemContent:e,groupContent:o,ScrollerComponent:l("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ie(mn,hs);oo();const Ao={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},gs={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Oo,floor:Et,max:st,min:Bt,round:jo}=Math;function Po(e,t,o){return Array.from({length:t-e+1}).map((n,s)=>({data:o===null?null:o[s+e],index:s+e}))}function ys(e){return{...gs,items:e}}function St(e,t){return e&&e.width===t.width&&e.height===t.height}function ws(e,t){return e&&e.column===t.column&&e.row===t.row}const xs=Y(([{increaseViewportBy:e,listBoundary:t,overscan:o,visibleRange:n},{footerHeight:s,headerHeight:r,scrollBy:a,scrollContainerState:i,scrollTo:l,scrollTop:c,smoothScrollTargetReached:u,viewportHeight:f},d,m,{didMount:S,propsReady:b},{customScrollParent:x,useWindowScroll:g,windowScrollContainerState:h,windowScrollTo:y,windowViewportRect:I},T])=>{const E=A(0),p=A(0),w=A(Ao),k=A({height:0,width:0}),O=A({height:0,width:0}),P=q(),V=q(),z=A(0),N=A(null),D=A({column:0,row:0}),X=q(),Q=q(),we=A(!1),xe=A(0),be=A(!0),$=A(!1),F=A(!1);Z(R(S,W(xe),_(([j,J])=>!!J)),()=>{U(be,!1)}),Z(R(de(S,be,O,k,xe,$),_(([j,J,ne,he,,Ee])=>j&&!J&&ne.height!==0&&he.height!==0&&!Ee)),([,,,,j])=>{U($,!0),Qt(1,()=>{U(P,j)}),je(R(c),()=>{U(t,[0,0]),U(be,!0)})}),M(R(Q,_(j=>j!=null&&j.scrollTop>0),Ve(0)),p),Z(R(S,W(Q),_(([,j])=>j!=null)),([,j])=>{j&&(U(k,j.viewport),U(O,j.item),U(D,j.gap),j.scrollTop>0&&(U(we,!0),je(R(c,qe(1)),J=>{U(we,!1)}),U(l,{top:j.scrollTop})))}),M(R(k,L(({height:j})=>j)),f),M(R(de(B(k,St),B(O,St),B(D,(j,J)=>j&&j.column===J.column&&j.row===J.row),B(c)),L(([j,J,ne,he])=>({gap:ne,item:J,scrollTop:he,viewport:j}))),X),M(R(de(B(E),n,B(D,ws),B(O,St),B(k,St),B(N),B(p),B(we),B(be),B(xe)),_(([,,,,,,,j])=>!j),L(([j,[J,ne],he,Ee,pe,ce,me,,ue,te])=>{const{column:re,row:ke}=he,{height:ge,width:Lt}=Ee,{width:io}=pe;if(me===0&&(j===0||io===0))return Ao;if(Lt===0){const po=Kt(te,j),Ln=po+Math.max(me-1,0);return ys(Po(po,Ln,ce))}const xt=Tn(io,Lt,re);let Ze,Ue;ue?J===0&&ne===0&&me>0?(Ze=0,Ue=me-1):(Ze=xt*Et((J+ke)/(ge+ke)),Ue=xt*Oo((ne+ke)/(ge+ke))-1,Ue=Bt(j-1,st(Ue,xt-1)),Ze=Bt(Ue,st(0,Ze))):(Ze=0,Ue=-1);const ao=Po(Ze,Ue,ce),{bottom:lo,top:co}=Lo(pe,he,Ee,ao),uo=Oo(j/xt),Pn=uo*ge+(uo-1)*ke-lo;return{bottom:lo,itemHeight:ge,items:ao,itemWidth:Lt,offsetBottom:Pn,offsetTop:co,top:co}})),w),M(R(N,_(j=>j!==null),L(j=>j.length)),E),M(R(de(k,O,w,D),_(([j,J,{items:ne}])=>ne.length>0&&J.height!==0&&j.height!==0),L(([j,J,{items:ne},he])=>{const{bottom:Ee,top:pe}=Lo(j,he,J,ne);return[pe,Ee]}),se(ut)),t);const G=A(!1);M(R(c,W(G),L(([j,J])=>J||j!==0)),G);const K=Ie(R(de(w,E),_(([{items:j}])=>j.length>0),W(G),_(([[j,J],ne])=>{const he=j.items[j.items.length-1].index===J-1;return(ne||j.bottom>0&&j.itemHeight>0&&j.offsetBottom===0&&j.items.length===J)&&he}),L(([[,j]])=>j-1),se())),Le=Ie(R(B(w),_(({items:j})=>j.length>0&&j[0].index===0),Ve(0),se())),Me=Ie(R(B(w),W(we),_(([{items:j},J])=>j.length>0&&!J),L(([{items:j}])=>({endIndex:j[j.length-1].index,startIndex:j[0].index})),se(en),Fe(0)));M(Me,m.scrollSeekRangeChanged),M(R(P,W(k,O,E,D),L(([j,J,ne,he,Ee])=>{const pe=sn(j),{align:ce,behavior:me,offset:ue}=pe;let te=pe.index;te==="LAST"&&(te=he-1),te=st(0,te,Bt(he-1,te));let re=Jt(J,Ee,ne,te);return ce==="end"?re=jo(re-J.height+ne.height):ce==="center"&&(re=jo(re-J.height/2+ne.height/2)),ue&&(re+=ue),{behavior:me,top:re}})),l);const ee=Se(R(w,L(j=>j.offsetBottom+j.bottom)),0);return M(R(I,L(j=>({height:j.visibleHeight,width:j.visibleWidth}))),k),{customScrollParent:x,data:N,deviation:z,footerHeight:s,gap:D,headerHeight:r,increaseViewportBy:e,initialItemCount:p,itemDimensions:O,overscan:o,restoreStateFrom:Q,scrollBy:a,scrollContainerState:i,scrollHeight:V,scrollTo:l,scrollToIndex:P,scrollTop:c,smoothScrollTargetReached:u,totalCount:E,useWindowScroll:g,viewportDimensions:k,windowScrollContainerState:h,windowScrollTo:y,windowViewportRect:I,...m,gridState:w,horizontalDirection:F,initialTopMostItemIndex:xe,totalListHeight:ee,...d,endReached:K,propsReady:b,rangeChanged:Me,startReached:Le,stateChanged:X,stateRestoreInProgress:we,...T}},ie(eo,Te,wt,pn,De,to,He));function Tn(e,t,o){return st(1,Et((e+o)/(Et(t)+o)))}function Lo(e,t,o,n){const{height:s}=o;if(s===void 0||n.length===0)return{bottom:0,top:0};const r=Jt(e,t,o,n[0].index);return{bottom:Jt(e,t,o,n[n.length-1].index)+s,top:r}}function Jt(e,t,o,n){const s=Tn(e.width,o.width,t.column),r=Et(n/s),a=r*o.height+st(0,r-1)*t.row;return a>0?a+t.row:a}const bs=Y(()=>{const e=A(f=>`Item ${f}`),t=A({}),o=A(null),n=A("virtuoso-grid-item"),s=A("virtuoso-grid-list"),r=A(no),a=A("div"),i=A(tt),l=(f,d=null)=>Se(R(t,L(m=>m[f]),se()),d),c=A(!1),u=A(!1);return M(B(u),c),{components:t,computeItemKey:r,context:o,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:a,itemClassName:n,ItemComponent:l("Item","div"),itemContent:e,listClassName:s,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:u,ScrollerComponent:l("Scroller","div"),scrollerRef:i,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),vs=Y(([e,t])=>({...e,...t}),ie(xs,bs)),Ss=C.memo(function(){const e=ae("gridState"),t=ae("listClassName"),o=ae("itemClassName"),n=ae("itemContent"),s=ae("computeItemKey"),r=ae("isSeeking"),a=Ae("scrollHeight"),i=ae("ItemComponent"),l=ae("ListComponent"),c=ae("ScrollSeekPlaceholder"),u=ae("context"),f=Ae("itemDimensions"),d=Ae("gap"),m=ae("log"),S=ae("stateRestoreInProgress"),b=Ae("reportReadyState"),x=Ye(C.useMemo(()=>g=>{const h=g.parentElement.parentElement.scrollHeight;a(h);const y=g.firstChild;if(y){const{height:I,width:T}=y.getBoundingClientRect();f({height:I,width:T})}d({column:Mo("column-gap",getComputedStyle(g).columnGap,m),row:Mo("row-gap",getComputedStyle(g).rowGap,m)})},[a,f,d,m]),!0,!1);return wn(()=>{e.itemHeight>0&&e.itemWidth>0&&b(!0)},[e]),S?null:v.jsx(l,{className:t,ref:x,...ve(l,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(g=>{const h=s(g.index,g.data,u);return r?v.jsx(c,{...ve(c,u),height:e.itemHeight,index:g.index,width:e.itemWidth},h):C.createElement(i,{...ve(i,u),className:o,"data-index":g.index,key:h},n(g.index,g.data,u))})})}),Ts=C.memo(function(){const e=ae("HeaderComponent"),t=Ae("headerHeight"),o=ae("headerFooterTag"),n=Ye(C.useMemo(()=>r=>{t(Be(r,"height"))},[t]),!0,!1),s=ae("context");return e?v.jsx(o,{ref:n,children:v.jsx(e,{...ve(e,s)})}):null}),Cs=C.memo(function(){const e=ae("FooterComponent"),t=Ae("footerHeight"),o=ae("headerFooterTag"),n=Ye(C.useMemo(()=>r=>{t(Be(r,"height"))},[t]),!0,!1),s=ae("context");return e?v.jsx(o,{ref:n,children:v.jsx(e,{...ve(e,s)})}):null}),$s=({children:e})=>{const t=C.useContext(yn),o=Ae("itemDimensions"),n=Ae("viewportDimensions"),s=Ye(C.useMemo(()=>r=>{n(r.getBoundingClientRect())},[n]),!0,!1);return C.useEffect(()=>{t&&(n({height:t.viewportHeight,width:t.viewportWidth}),o({height:t.itemHeight,width:t.itemWidth}))},[t,n,o]),v.jsx("div",{ref:s,style:Pt(!1),children:e})},Is=({children:e})=>{const t=C.useContext(yn),o=Ae("windowViewportRect"),n=Ae("itemDimensions"),s=ae("customScrollParent"),r=Go(o,s,!1);return C.useEffect(()=>{t&&(n({height:t.itemHeight,width:t.itemWidth}),o({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,o,n]),v.jsx("div",{ref:r,style:Pt(!1),children:e})},Es=C.memo(function({...e}){const t=ae("useWindowScroll"),o=ae("customScrollParent"),n=o||t?Rs:ks,s=o||t?Is:$s,r=ae("context");return v.jsx(n,{...e,...ve(n,r),children:v.jsxs(s,{children:[v.jsx(Ts,{}),v.jsx(Ss,{}),v.jsx(Cs,{})]})})}),{useEmitter:Cn,useEmitterValue:ae,usePublisher:Ae}=hn(vs,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},Es),ks=vn({useEmitter:Cn,useEmitterValue:ae,usePublisher:Ae}),Rs=Sn({useEmitter:Cn,useEmitterValue:ae,usePublisher:Ae});function Mo(e,t,o){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&o(`${e} was not resolved to pixel value correctly`,t,Ce.WARN),t==="normal"?0:parseInt(t??"0",10)}const As=({visible:e,onClick:t})=>e?v.jsx("button",{type:"button",className:"chat-scroll-bottom",onClick:t,"aria-label":"Scroll to bottom",children:v.jsx("img",{src:Uo,alt:"arrow up",width:24,height:24,style:{transform:"rotate(180deg)",filter:"var(--icon-filter-text)"}})}):null,Os=()=>{const{messages:e=[],classNames:t,isOpen:o,isLoading:n}=Ge(),[s,r]=C.useState(!1),a=C.useRef(null),i=()=>{a.current?.scrollToIndex({index:e.length-1,behavior:"smooth"})},l=e?.length??1;return C.useEffect(()=>{o&&setTimeout(i,0)},[o]),C.useEffect(()=>{i()},[e?.length]),v.jsxs("div",{className:Oe("autoui-chat-messages",t?.messageList),children:[v.jsx(ms,{ref:a,data:e,overscan:100,followOutput:"smooth",atBottomStateChange:c=>r(!c),components:{EmptyPlaceholder:()=>v.jsxs("div",{className:"empty__palceholder",children:[v.jsx("span",{className:"empty__palceholder--main",children:"Nothing here yet"}),v.jsx("span",{className:"empty__palceholder--secondary",children:"Start the conversation!"})]})},initialTopMostItemIndex:l-1,itemContent:(c,u)=>v.jsx("div",{className:Oe("autoui-message-row",u.role==="user"&&"is-user",u.role==="assistant"&&"is-assistant"),children:v.jsx(rr,{message:u})})}),v.jsx(As,{visible:s,onClick:i}),n&&v.jsx(Fn,{variant:"dots",color:"#0a84ff"})]})};async function js(e){const t=e.getReader(),o=new TextDecoder;let n="",s="";for(;;){const{value:a,done:i}=await t.read();if(i)break;n+=o.decode(a,{stream:!0});const l=n.split(`
|
|
8
8
|
|
|
9
9
|
`);n=l.pop()??"";for(const c of l){if(!c.startsWith("data:"))continue;const u=c.slice(5).trim();if(u==="[DONE]"){t.cancel();break}try{const d=JSON.parse(u).choices?.[0]?.delta?.content;d&&(s+=d)}catch(f){console.error(f)}}}const r=s.match(/\{[\s\S]*\}$/);if(!r)throw new Error("LLM did not return valid JSON InstructionPlan");return JSON.parse(r[0])}const Ps=e=>Object.entries(e.functions).map(([t,o])=>{const n=o.params?Object.entries(o.params).map(([r,a])=>` ${r}: ${a}`).join(`
|
|
10
10
|
`):" (no params)",s=o.canShareDataWithLLM?`
|
|
@@ -206,7 +206,7 @@ CRITICAL RULES FOR newInstructionPlan:
|
|
|
206
206
|
- Example: If TaskStats requires "tasks" prop, use: { "tasks": "{{tasks}}" } NOT { "filter": "food" }
|
|
207
207
|
- Example: If ProductCard has "addToCart" callback, use: { "callbacks": { "onAction": "addToCart" } } or props: { "onAddToCart": "addToCart" }
|
|
208
208
|
|
|
209
|
-
Return JSON only.`.trim()};function qs(e){if(e==null)throw new Error("Invalid LLM response: null or undefined");if(typeof e=="string"){let r=e;const a=r.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);a&&(r=a[1].trim());try{e=JSON.parse(r)}catch{throw new Error(`Invalid LLM response: content is a string but not valid JSON: ${e.substring(0,100)}`)}}if(typeof e!="object"||Array.isArray(e))throw new Error(`Invalid LLM response: expected object but got ${typeof e}${Array.isArray(e)?" (array)":""}`);const{parseTo:t,data:o,newInstructionPlan:n}=e;if(o===void 0)throw new Error("Invalid LLM response: missing data field");let s;if(t==="array")if(Array.isArray(o))s=o;else if(typeof o=="object"&&o!==null&&!Array.isArray(o)){const r=Object.values(o);if(r.length!==1)throw new Error(`LLM data object must contain exactly one value when parseTo is 'array', got ${r.length}`);if(s=r[0],!Array.isArray(s))throw new Error(`Expected array but got ${typeof s}`)}else throw new Error(`Expected array or object containing array, got ${typeof o}`);else if(t==="object"){if(typeof o!="object"||o===null||Array.isArray(o))throw new Error(`Expected object but got ${Array.isArray(o)?"array":typeof o}`);const r=Object.values(o);if(r.length!==1)throw new Error(`LLM data object must contain exactly one value when parseTo is 'object', got ${r.length}`);s=r[0]}else s=o;return{parseTo:t??"primitive",data:s,newInstructionPlan:n??null}}const Gs=async(e,t,o,n,s,r,a,i)=>{try{const l=await Js(e,t,o,n,s,r,a,i);console.log(`📤 [ExtraAnalysis] Sending request to LLM (prompt length: ${l.length} chars)`);const c=t.llm.proxyUrl??"https://autoui-proxy.onrender.com",u=await fetch(`${c}/chat/extraAnalysis`,{method:"POST",headers:{"Content-Type":"application/json","X-AUTOUI-APP-ID":t.appId,...t.llm.sharedSecret&&{"X-AUTOUI-SECRET":t.llm.sharedSecret}},body:JSON.stringify({messages:[{role:"user",content:l}],temperature:t.llm.temperature??.2,appId:t.appId})});if(!u.ok){const b=await u.text();throw console.error(`❌ [ExtraAnalysis] API error ${u.status}:`,b),new Error(`AutoUI proxy error: ${u.status} - ${b}`)}let f=await u.text();console.log("✅ [ExtraAnalysis] Raw response received (text):",f.substring(0,200));const d=f.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);d&&(f=d[1].trim(),console.log("✅ [ExtraAnalysis] Stripped markdown code blocks"));let m;try{m=JSON.parse(f),console.log("✅ [ExtraAnalysis] Parsed JSON response")}catch(b){throw console.error("❌ [ExtraAnalysis] Response is not valid JSON:",b),console.error("❌ [ExtraAnalysis] Response text:",f),new Error(`Invalid JSON response from LLM: ${f.substring(0,200)}`)}if(m&&typeof m=="object"){if("content"in m&&typeof m.content=="string")try{let b=m.content;const x=b.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);x&&(b=x[1].trim(),console.log("✅ [ExtraAnalysis] Stripped markdown code blocks from nested content")),m=JSON.parse(b),console.log("✅ [ExtraAnalysis] Extracted and parsed content from wrapper")}catch{console.warn("⚠️ [ExtraAnalysis] content.content is not JSON, using original")}else if("response"in m)if(typeof m.response=="string"){let b=m.response;const x=b.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);if(x){b=x[1].trim();try{m=JSON.parse(b),console.log("✅ [ExtraAnalysis] Extracted and parsed response from wrapper (stripped markdown)")}catch{m=b,console.log("✅ [ExtraAnalysis] Extracted response from wrapper (as string)")}}else m=m.response,console.log("✅ [ExtraAnalysis] Extracted response from wrapper")}else m=m.response,console.log("✅ [ExtraAnalysis] Extracted response from wrapper");else if("message"in m&&typeof m.message=="string")try{let b=m.message;const x=b.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);x&&(b=x[1].trim(),console.log("✅ [ExtraAnalysis] Stripped markdown code blocks from message")),m=JSON.parse(b),console.log("✅ [ExtraAnalysis] Extracted and parsed message from wrapper")}catch{console.warn("⚠️ [ExtraAnalysis] message is not JSON, using original")}}console.log("✅ [ExtraAnalysis] Final content to parse:",typeof m,m);const S=qs(m);return console.log("✅ [ExtraAnalysis] Parsed response:",{hasData:!!S.data,hasNewPlan:!!S.newInstructionPlan,parseTo:S.parseTo}),S}catch(l){return console.error("❌ [ExtraAnalysis] Error during analysis:",l),{parseTo:i?.parseTo??"primitive",data:e,newInstructionPlan:null}}},Ys=async(e,t,o,n,s,r,a,i,l,c,u,f,d)=>{console.log(`🔍 [AnalyzeDataStep] Starting analysis for step "${n.name}" at index ${s}`),console.log("🔍 [AnalyzeDataStep] Output data type:",typeof t,Array.isArray(t)?"array":"object"),console.log("🔍 [AnalyzeDataStep] Assign key:",o),console.log("🔍 [AnalyzeDataStep] Next step:",r?.type,r?.type==="component"||r?.type==="function"?r.name:"");const m=c.steps.slice(s+1);let S=null;if(o&&m.length>0){const{getExpectedSchemaForAssignKey:b}=await Promise.resolve().then(()=>Ds);S=await b(o,m,e),S?console.log(`📋 [AnalyzeDataStep] Expected schema found for assign key "${o}":`,S):console.log(`ℹ️ [AnalyzeDataStep] No expected schema - no remaining steps consume assign key "${o}"`)}else console.log("ℹ️ [AnalyzeDataStep] No expected schema - no assign key or no remaining steps");try{console.log("🚀 [AnalyzeDataStep] Calling extraAnalysisWithLLM...");const b=await Gs(t,e,a,i,c,n,s,S);console.log("✅ [AnalyzeDataStep] Received analysis result:",{hasData:!!b.data,hasNewPlan:!!b.newInstructionPlan,parseTo:b.parseTo});const x=En(r,o),g=kn(b.data,x);if(console.log("Extra analysis data received from LLM:",b),console.log("Normalized ctx value:",g),o&&(l[o]=g),b.newInstructionPlan!=null&&b.newInstructionPlan!=""){if(console.log("analyzed.newInstructionPlan: ",b.newInstructionPlan),o){const h=JSON.parse(JSON.stringify(b.newInstructionPlan));h.steps&&h.steps.forEach(y=>{y.type==="component"&&y.props&&Object.keys(y.props).forEach(I=>{typeof y.props[I]=="string"&&y.props[I]==="{{data}}"&&(y.props[I]=`{{${o}}}`)})}),Rt(h,e,u,f,d,a,i,l)}else Rt(b.newInstructionPlan,e,u,f,d,a,i,l);return!0}return!1}catch(b){return console.error(b),!0}},Tt=new Map,Vo=new Set;async function Xs(e){const t=e;if(Vo.has(t))return Tt.get(t)||null;Vo.add(t);try{let o;if(t.startsWith("http://")||t.startsWith("https://")){console.log(`📥 [Runtime Validation] Fetching schema from URL: ${t}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch schema: ${n.status} ${n.statusText}`);o=await n.json()}else{const n=[t.startsWith("/")?t:`/${t}`,`/public/${t}`,t];let s=null;for(const r of n)try{console.log(`📥 [Runtime Validation] Trying to fetch schema from: ${r}`);const a=await fetch(r);if(a.ok){o=await a.json(),console.log(`✅ [Runtime Validation] Successfully loaded schema from: ${r}`);break}else s=new Error(`HTTP ${a.status}: ${a.statusText}`)}catch(a){s=a instanceof Error?a:new Error(String(a));continue}if(!o)throw s||new Error(`Failed to load schema from any path: ${n.join(", ")}`)}return o&&o.types&&o.components&&o.functions?(console.log("✅ [Runtime Validation] Runtime schema loaded successfully",{path:t,types:Object.keys(o.types).length,components:o.components.length,functions:o.functions.length}),Tt.set(t,o),o):(console.warn("⚠️ [Runtime Validation] Runtime schema has invalid structure"),Tt.set(t,null),null)}catch(o){return console.warn(`⚠️ [Runtime Validation] Runtime schema file not found at "${t}":`,o),Tt.set(t,null),null}}async function so(e){const t=e?.runtime?.runtimeSchemaPath||".autoui-runtime-schema.json";return await Xs(t)}function Je(e,t){return t.types[e]||null}function at(e,t,o,n,s=""){const r=[],a=s||"value",i=" ".repeat((s.match(/\./g)||[]).length+1);if(console.log(`${i}🔎 [Type Validation] Validating "${a}" against type "${o}"`),console.log(`${i} 📦 Value:`,e),console.log(`${i} 🔍 Value type: ${typeof e}, isArray: ${Array.isArray(e)}, isNull: ${e===null}`),console.log(`${i} 📋 Type definition:`,JSON.stringify(t,null,2)),e==null)return console.log(`${i} ℹ️ Value is ${e===void 0?"undefined":"null"} - skipping (optionality checked at prop/param level)`),r;switch(t.type){case"primitive":if(console.log(`${i} 🔍 Checking primitive type: "${o}"`),o==="string"&&typeof e!="string"){const l=`${a} must be a string, got ${typeof e}`;console.log(`${i} ❌ ${l}`),r.push(l)}else if(o==="number"&&(typeof e!="number"||isNaN(e))){const l=`${a} must be a number, got ${typeof e}`;console.log(`${i} ❌ ${l}`),r.push(l)}else if(o==="boolean"&&typeof e!="boolean"){const l=`${a} must be a boolean, got ${typeof e}`;console.log(`${i} ❌ ${l}`),r.push(l)}else console.log(`${i} ✅ Primitive type check passed`);break;case"enum":if(console.log(`${i} 🔍 Checking enum type with values:`,t.values),t.values&&Array.isArray(t.values))if(t.values.includes(e))console.log(`${i} ✅ Enum value check passed`);else{const l=`${a} must be one of: ${t.values.join(", ")}, got: ${e}`;console.log(`${i} ❌ ${l}`),r.push(l)}break;case"array":if(console.log(`${i} 🔍 Checking array type`),Array.isArray(e)){if(console.log(`${i} ✅ Array type check passed (length: ${e.length})`),t.items){const l=t.items.type;console.log(`${i} 🔍 Validating array items against type: "${l}"`);const c=Je(l,n);c?e.forEach((u,f)=>{console.log(`${i} 📦 Validating item [${f}]:`,u);const d=at(u,c,l,n,`${s}[${f}]`);r.push(...d)}):console.log(`${i} ⚠️ Item type "${l}" not found in schema`)}}else{const l=`${a} must be an array, got ${typeof e}`;if(console.log(`${i} ❌ ${l}`),console.log(`${i} 💡 Value is:`,e),console.log(`${i} 💡 Value constructor:`,e?.constructor?.name),typeof e=="string"){console.log(`${i} 💡 String value might be JSON - attempting to parse...`);try{const c=JSON.parse(e);console.log(`${i} 💡 Parsed successfully! Type: ${typeof c}, isArray: ${Array.isArray(c)}`),Array.isArray(c)&&console.log(`${i} ⚠️ WARNING: Value is a JSON string that should be parsed before validation!`)}catch{console.log(`${i} 💡 String is not valid JSON`)}}r.push(l)}break;case"object":if(console.log(`${i} 🔍 Checking object type`),typeof e!="object"||e===null||Array.isArray(e)){const l=`${a} must be an object, got ${typeof e}`;console.log(`${i} ❌ ${l}`),r.push(l)}else t.properties&&(console.log(`${i} ✅ Object type check passed`),console.log(`${i} 🔍 Validating object properties:`,Object.keys(t.properties)),Object.entries(t.properties).forEach(([l,c])=>{const u=e[l],f=s?`${s}.${l}`:l;if(console.log(`${i} 📦 Property "${l}":`,u),c.required&&u==null){const d=`${f} is required but was ${u===void 0?"undefined":"null"}`;console.log(`${i} ❌ ${d}`),r.push(d)}if(u!=null){const d=Je(c.type,n);if(d){const m=at(u,d,c.type,n,f);r.push(...m)}}}));break;case"union":if(console.log(`${i} 🔍 Checking union type with members:`,t.refs),t.refs&&t.refs.length>0){const l=[];for(const u of t.refs){console.log(`${i} 🔍 Trying union member: "${u}"`);const f=Je(u,n);if(f){const d=at(e,f,u,n,s);if(d.length===0)return console.log(`${i} ✅ Union member "${u}" validated successfully`),[];console.log(`${i} ❌ Union member "${u}" failed:`,d),l.push(...d)}}const c=`${a} does not match any union member. Errors: ${l.join("; ")}`;console.log(`${i} ❌ ${c}`),r.push(c)}break}return r.length===0?console.log(`${i} ✅ Type validation passed for "${a}"`):console.log(`${i} ❌ Type validation failed for "${a}" with ${r.length} error(s)`),r}function Zs(e,t,o){const n=[];console.log(`
|
|
209
|
+
Return JSON only.`.trim()};function qs(e){if(e==null)throw new Error("Invalid LLM response: null or undefined");if(typeof e=="string"){let r=e;const a=r.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);a&&(r=a[1].trim());try{e=JSON.parse(r)}catch{throw new Error(`Invalid LLM response: content is a string but not valid JSON: ${e.substring(0,100)}`)}}if(typeof e!="object"||Array.isArray(e))throw new Error(`Invalid LLM response: expected object but got ${typeof e}${Array.isArray(e)?" (array)":""}`);const{parseTo:t,data:o,newInstructionPlan:n}=e;if(o===void 0)throw new Error("Invalid LLM response: missing data field");let s;if(t==="array")if(Array.isArray(o))s=o;else if(typeof o=="object"&&o!==null&&!Array.isArray(o)){const r=Object.values(o);if(r.length!==1)throw new Error(`LLM data object must contain exactly one value when parseTo is 'array', got ${r.length}`);if(s=r[0],!Array.isArray(s))throw new Error(`Expected array but got ${typeof s}`)}else throw new Error(`Expected array or object containing array, got ${typeof o}`);else if(t==="object"){if(typeof o!="object"||o===null||Array.isArray(o))throw new Error(`Expected object but got ${Array.isArray(o)?"array":typeof o}`);const r=Object.values(o);if(r.length!==1)throw new Error(`LLM data object must contain exactly one value when parseTo is 'object', got ${r.length}`);s=r[0]}else s=o;return{parseTo:t??"primitive",data:s,newInstructionPlan:n??null}}const Gs=async(e,t,o,n,s,r,a,i)=>{try{const l=await Js(e,t,o,n,s,r,a,i);console.log(`📤 [ExtraAnalysis] Sending request to LLM (prompt length: ${l.length} chars)`);const c=t.llm.proxyUrl??"https://autoui-proxy.onrender.com",u=await fetch(`${c}/chat/extraAnalysis`,{method:"POST",headers:{"Content-Type":"application/json","X-AUTOUI-APP-ID":t.appId,...t.llm.sharedSecret&&{"X-AUTOUI-SECRET":t.llm.sharedSecret}},body:JSON.stringify({messages:[{role:"user",content:l}],temperature:t.llm.temperature??.2,appId:t.appId})});if(!u.ok){const b=await u.text();throw console.error(`❌ [ExtraAnalysis] API error ${u.status}:`,b),new Error(`AutoUI proxy error: ${u.status} - ${b}`)}let f=await u.text();console.log("✅ [ExtraAnalysis] Raw response received (text):",f.substring(0,200));const d=f.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);d&&(f=d[1].trim(),console.log("✅ [ExtraAnalysis] Stripped markdown code blocks"));let m;try{m=JSON.parse(f),console.log("✅ [ExtraAnalysis] Parsed JSON response")}catch(b){throw console.error("❌ [ExtraAnalysis] Response is not valid JSON:",b),console.error("❌ [ExtraAnalysis] Response text:",f),new Error(`Invalid JSON response from LLM: ${f.substring(0,200)}`)}if(m&&typeof m=="object"){if("content"in m&&typeof m.content=="string")try{let b=m.content;const x=b.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);x&&(b=x[1].trim(),console.log("✅ [ExtraAnalysis] Stripped markdown code blocks from nested content")),m=JSON.parse(b),console.log("✅ [ExtraAnalysis] Extracted and parsed content from wrapper")}catch{console.warn("⚠️ [ExtraAnalysis] content.content is not JSON, using original")}else if("response"in m)if(typeof m.response=="string"){let b=m.response;const x=b.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);if(x){b=x[1].trim();try{m=JSON.parse(b),console.log("✅ [ExtraAnalysis] Extracted and parsed response from wrapper (stripped markdown)")}catch{m=b,console.log("✅ [ExtraAnalysis] Extracted response from wrapper (as string)")}}else m=m.response,console.log("✅ [ExtraAnalysis] Extracted response from wrapper")}else m=m.response,console.log("✅ [ExtraAnalysis] Extracted response from wrapper");else if("message"in m&&typeof m.message=="string")try{let b=m.message;const x=b.match(/^```(?:json)?\s*([\s\S]*?)\s*```$/);x&&(b=x[1].trim(),console.log("✅ [ExtraAnalysis] Stripped markdown code blocks from message")),m=JSON.parse(b),console.log("✅ [ExtraAnalysis] Extracted and parsed message from wrapper")}catch{console.warn("⚠️ [ExtraAnalysis] message is not JSON, using original")}}console.log("✅ [ExtraAnalysis] Final content to parse:",typeof m,m);const S=qs(m);return console.log("✅ [ExtraAnalysis] Parsed response:",{hasData:!!S.data,hasNewPlan:!!S.newInstructionPlan,parseTo:S.parseTo}),S}catch(l){return console.error("❌ [ExtraAnalysis] Error during analysis:",l),{parseTo:i?.parseTo??"primitive",data:e,newInstructionPlan:null}}},Ys=async(e,t,o,n,s,r,a,i,l,c,u,f,d)=>{console.log(`🔍 [AnalyzeDataStep] Starting analysis for step "${n.name}" at index ${s}`),console.log("🔍 [AnalyzeDataStep] Output data type:",typeof t,Array.isArray(t)?"array":"object"),console.log("🔍 [AnalyzeDataStep] Assign key:",o),console.log("🔍 [AnalyzeDataStep] Next step:",r?.type,r?.type==="component"||r?.type==="function"?r.name:"");const m=c.steps.slice(s+1);let S=null;if(o&&m.length>0){const{getExpectedSchemaForAssignKey:b}=await Promise.resolve().then(()=>Ds);S=await b(o,m,e),S?console.log(`📋 [AnalyzeDataStep] Expected schema found for assign key "${o}":`,S):console.log(`ℹ️ [AnalyzeDataStep] No expected schema - no remaining steps consume assign key "${o}"`)}else console.log("ℹ️ [AnalyzeDataStep] No expected schema - no assign key or no remaining steps");try{console.log("🚀 [AnalyzeDataStep] Calling extraAnalysisWithLLM...");const b=await Gs(t,e,a,i,c,n,s,S);console.log("✅ [AnalyzeDataStep] Received analysis result:",{hasData:!!b.data,hasNewPlan:!!b.newInstructionPlan,parseTo:b.parseTo});const x=En(r,o),g=kn(b.data,x);if(console.log("Extra analysis data received from LLM:",b),console.log("Normalized ctx value:",g),o&&(l[o]=g),b.newInstructionPlan!=null&&b.newInstructionPlan!=""){if(console.log("analyzed.newInstructionPlan: ",b.newInstructionPlan),o){const h=JSON.parse(JSON.stringify(b.newInstructionPlan));h.steps&&h.steps.forEach(y=>{y.type==="component"&&y.props&&Object.keys(y.props).forEach(I=>{typeof y.props[I]=="string"&&y.props[I]==="{{data}}"&&(y.props[I]=`{{${o}}}`)})}),Rt(h,e,u,f,d,a,i,l)}else Rt(b.newInstructionPlan,e,u,f,d,a,i,l);return!0}return!1}catch(b){return console.error(b),!0}},Tt=new Map,Vo=new Set;async function Xs(e){const t=e;if(Vo.has(t))return Tt.get(t)||null;Vo.add(t);try{let o;if(t.startsWith("http://")||t.startsWith("https://")){console.log(`📥 [Runtime Validation] Fetching schema from URL: ${t}`);const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch schema: ${n.status} ${n.statusText}`);o=await n.json()}else{const n=[t.startsWith("/")?t:`/${t}`,t,`/public/${t}`];let s=null;for(const r of n)try{console.log(`📥 [Runtime Validation] Trying to fetch schema from: ${r}`);const a=await fetch(r);if(a.ok){o=await a.json(),console.log(`✅ [Runtime Validation] Successfully loaded schema from: ${r}`);break}else s=new Error(`HTTP ${a.status}: ${a.statusText}`)}catch(a){s=a instanceof Error?a:new Error(String(a));continue}if(!o)throw s||new Error(`Failed to load schema from any path: ${n.join(", ")}`)}return o&&o.types&&o.components&&o.functions?(console.log("✅ [Runtime Validation] Runtime schema loaded successfully",{path:t,types:Object.keys(o.types).length,components:o.components.length,functions:o.functions.length}),Tt.set(t,o),o):(console.warn("⚠️ [Runtime Validation] Runtime schema has invalid structure"),Tt.set(t,null),null)}catch(o){return console.warn(`⚠️ [Runtime Validation] Runtime schema file not found at "${t}":`,o),Tt.set(t,null),null}}async function so(e){const t=e?.runtime?.runtimeSchemaPath||".autoui-runtime-schema.json";return await Xs(t)}function Je(e,t){return t.types[e]||null}function at(e,t,o,n,s=""){const r=[],a=s||"value",i=" ".repeat((s.match(/\./g)||[]).length+1);if(console.log(`${i}🔎 [Type Validation] Validating "${a}" against type "${o}"`),console.log(`${i} 📦 Value:`,e),console.log(`${i} 🔍 Value type: ${typeof e}, isArray: ${Array.isArray(e)}, isNull: ${e===null}`),console.log(`${i} 📋 Type definition:`,JSON.stringify(t,null,2)),e==null)return console.log(`${i} ℹ️ Value is ${e===void 0?"undefined":"null"} - skipping (optionality checked at prop/param level)`),r;switch(t.type){case"primitive":if(console.log(`${i} 🔍 Checking primitive type: "${o}"`),o==="string"&&typeof e!="string"){const l=`${a} must be a string, got ${typeof e}`;console.log(`${i} ❌ ${l}`),r.push(l)}else if(o==="number"&&(typeof e!="number"||isNaN(e))){const l=`${a} must be a number, got ${typeof e}`;console.log(`${i} ❌ ${l}`),r.push(l)}else if(o==="boolean"&&typeof e!="boolean"){const l=`${a} must be a boolean, got ${typeof e}`;console.log(`${i} ❌ ${l}`),r.push(l)}else console.log(`${i} ✅ Primitive type check passed`);break;case"enum":if(console.log(`${i} 🔍 Checking enum type with values:`,t.values),t.values&&Array.isArray(t.values))if(t.values.includes(e))console.log(`${i} ✅ Enum value check passed`);else{const l=`${a} must be one of: ${t.values.join(", ")}, got: ${e}`;console.log(`${i} ❌ ${l}`),r.push(l)}break;case"array":if(console.log(`${i} 🔍 Checking array type`),Array.isArray(e)){if(console.log(`${i} ✅ Array type check passed (length: ${e.length})`),t.items){const l=t.items.type;console.log(`${i} 🔍 Validating array items against type: "${l}"`);const c=Je(l,n);c?e.forEach((u,f)=>{console.log(`${i} 📦 Validating item [${f}]:`,u);const d=at(u,c,l,n,`${s}[${f}]`);r.push(...d)}):console.log(`${i} ⚠️ Item type "${l}" not found in schema`)}}else{const l=`${a} must be an array, got ${typeof e}`;if(console.log(`${i} ❌ ${l}`),console.log(`${i} 💡 Value is:`,e),console.log(`${i} 💡 Value constructor:`,e?.constructor?.name),typeof e=="string"){console.log(`${i} 💡 String value might be JSON - attempting to parse...`);try{const c=JSON.parse(e);console.log(`${i} 💡 Parsed successfully! Type: ${typeof c}, isArray: ${Array.isArray(c)}`),Array.isArray(c)&&console.log(`${i} ⚠️ WARNING: Value is a JSON string that should be parsed before validation!`)}catch{console.log(`${i} 💡 String is not valid JSON`)}}r.push(l)}break;case"object":if(console.log(`${i} 🔍 Checking object type`),typeof e!="object"||e===null||Array.isArray(e)){const l=`${a} must be an object, got ${typeof e}`;console.log(`${i} ❌ ${l}`),r.push(l)}else t.properties&&(console.log(`${i} ✅ Object type check passed`),console.log(`${i} 🔍 Validating object properties:`,Object.keys(t.properties)),Object.entries(t.properties).forEach(([l,c])=>{const u=e[l],f=s?`${s}.${l}`:l;if(console.log(`${i} 📦 Property "${l}":`,u),c.required&&u==null){const d=`${f} is required but was ${u===void 0?"undefined":"null"}`;console.log(`${i} ❌ ${d}`),r.push(d)}if(u!=null){const d=Je(c.type,n);if(d){const m=at(u,d,c.type,n,f);r.push(...m)}}}));break;case"union":if(console.log(`${i} 🔍 Checking union type with members:`,t.refs),t.refs&&t.refs.length>0){const l=[];for(const u of t.refs){console.log(`${i} 🔍 Trying union member: "${u}"`);const f=Je(u,n);if(f){const d=at(e,f,u,n,s);if(d.length===0)return console.log(`${i} ✅ Union member "${u}" validated successfully`),[];console.log(`${i} ❌ Union member "${u}" failed:`,d),l.push(...d)}}const c=`${a} does not match any union member. Errors: ${l.join("; ")}`;console.log(`${i} ❌ ${c}`),r.push(c)}break}return r.length===0?console.log(`${i} ✅ Type validation passed for "${a}"`):console.log(`${i} ❌ Type validation failed for "${a}" with ${r.length} error(s)`),r}function Zs(e,t,o){const n=[];console.log(`
|
|
210
210
|
🔍 [Runtime Validation] ==========================================`),console.log(`🔍 [Runtime Validation] Starting validation for component: "${e}"`),console.log("🔍 [Runtime Validation] Raw props received:",JSON.stringify(t,null,2)),console.log("🔍 [Runtime Validation] Props type check:",Object.entries(t).map(([r,a])=>`${r}: ${typeof a} (${Array.isArray(a)?"array":typeof a})`));const s=o.components.find(r=>r.name===e);return s?(console.log(`✅ [Runtime Validation] Found component schema for "${e}"`),console.log("📋 [Runtime Validation] Component schema:",JSON.stringify(s.props,null,2)),Object.entries(s.props).forEach(([r,a])=>{console.log(`
|
|
211
211
|
📌 [Runtime Validation] Validating prop: "${r}"`),console.log(" 📥 [Runtime Validation] Prop reference:",JSON.stringify(a,null,2));const i=t[r];if(console.log(" 📦 [Runtime Validation] Prop value received:",i),console.log(` 🔎 [Runtime Validation] Prop value type: ${typeof i}`),console.log(` 🔎 [Runtime Validation] Prop value isArray: ${Array.isArray(i)}`),console.log(` 🔎 [Runtime Validation] Prop value isNull: ${i===null}`),console.log(` 🔎 [Runtime Validation] Prop value isUndefined: ${i===void 0}`),typeof i=="string"){console.log(` 📝 [Runtime Validation] String value length: ${i.length}`),console.log(` 📝 [Runtime Validation] String preview: ${i.substring(0,100)}${i.length>100?"...":""}`);try{const l=JSON.parse(i);console.log(" 🔄 [Runtime Validation] String appears to be JSON! Parsed as:",typeof l),Array.isArray(l)&&console.log(` 🔄 [Runtime Validation] Parsed JSON is an array with ${l.length} items`)}catch{console.log(" ℹ️ [Runtime Validation] String is not valid JSON")}}if(a.required&&i==null){const l=`Prop "${r}" is required but was ${i===void 0?"undefined":"null"}`;console.log(` ❌ [Runtime Validation] ${l}`),n.push(l);return}if(i!=null){console.log(` 🔍 [Runtime Validation] Resolving type: "${a.type}"`);const l=Je(a.type,o);if(l){console.log(" ✅ [Runtime Validation] Type definition found:",JSON.stringify(l,null,2)),console.log(" 🔄 [Runtime Validation] Starting type validation...");const c=at(i,l,a.type,o,r);c.length>0?console.log(` ❌ [Runtime Validation] Validation failed with ${c.length} error(s):`,c):console.log(` ✅ [Runtime Validation] Prop "${r}" passed validation`),n.push(...c)}else console.warn(` ⚠️ [Runtime Validation] Type "${a.type}" not found in schema for prop "${r}"`),console.log(" 📋 [Runtime Validation] Available types:",Object.keys(o.types).slice(0,10))}else console.log(` ℹ️ [Runtime Validation] Prop "${r}" is ${i===void 0?"undefined":"null"} - skipping validation`)}),console.log(`
|
|
212
212
|
📊 [Runtime Validation] Validation summary for "${e}":`),n.length===0?console.log(" ✅ All props validated successfully"):console.log(` ❌ Found ${n.length} validation error(s):`,n),console.log(`🔍 [Runtime Validation] ==========================================
|
package/dist/index.mjs
CHANGED
|
@@ -566,7 +566,6 @@ const sr = ({
|
|
|
566
566
|
className: "autoui-switch__input",
|
|
567
567
|
type: "checkbox",
|
|
568
568
|
checked: E,
|
|
569
|
-
defaultChecked: o,
|
|
570
569
|
onChange: j,
|
|
571
570
|
disabled: s,
|
|
572
571
|
required: r,
|
|
@@ -4771,8 +4770,11 @@ async function ai(e) {
|
|
|
4771
4770
|
} else {
|
|
4772
4771
|
const n = [
|
|
4773
4772
|
t.startsWith("/") ? t : `/${t}`,
|
|
4774
|
-
|
|
4775
|
-
t
|
|
4773
|
+
// Root path (works for Next.js public/ and Vite public/)
|
|
4774
|
+
t,
|
|
4775
|
+
// Original path as-is
|
|
4776
|
+
`/public/${t}`
|
|
4777
|
+
// Explicit public path (may work in some setups)
|
|
4776
4778
|
];
|
|
4777
4779
|
let s = null;
|
|
4778
4780
|
for (const r of n)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js plugin entry point
|
|
3
|
+
*
|
|
4
|
+
* This file provides a cleaner import path for Next.js users:
|
|
5
|
+
* import { withAutoUI } from '@autoai-ui/autoui/nextjs';
|
|
6
|
+
*/
|
|
7
|
+
export { withAutoUI } from './build-time/nextjsPlugin';
|
|
8
|
+
export type { AutoUINextJSPluginOptions } from './build-time/nextjsPlugin';
|
|
9
|
+
export { generateSchemaStandalone } from './build-time/nextjsPlugin/standalone';
|
package/dist/lib/plugin.d.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
1
|
export { autouiTypeSchemaPlugin } from './build-time/typeSchemaPlugin';
|
|
2
2
|
export type * from './build-time/typeSchemaPlugin/types';
|
|
3
|
+
export { withAutoUI } from './build-time/nextjsPlugin';
|
|
4
|
+
export type { AutoUINextJSPluginOptions } from './build-time/nextjsPlugin';
|
|
5
|
+
export { generateSchemaStandalone } from './build-time/nextjsPlugin/standalone';
|