@ugurdemirel/landcraft 0.1.21 → 0.1.22
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../utils/cn.cjs"),h=require("../../icons.cjs"),b=require("./ToolCard.cjs");function j({title:s,subtitle:r,logo:n,logoSrc:t,logoAlt:o,logoClassName:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("../../utils/cn.cjs"),h=require("../../icons.cjs"),b=require("./ToolCard.cjs");function j({title:s,subtitle:r,logo:n,logoSrc:t,logoAlt:o,logoClassName:u,footer:x,logLabel:m,logRef:f,height:p="70dvh",children:g}){const l=n??(t?e.jsx("img",{src:t,alt:o??(typeof s=="string"?s:"Logo"),className:a.cn("h-8 w-8 rounded-lg object-cover",u)}):void 0);return e.jsxs("div",{style:{height:p},className:"flex flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-overlay",children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3 sm:px-5",children:[e.jsxs("div",{className:"flex gap-1.5","aria-hidden":!0,children:[e.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-foreground/15"}),e.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-foreground/15"}),e.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-foreground/15"})]}),l?e.jsx("span",{className:"flex shrink-0 items-center",children:l}):null,s??r?e.jsxs("div",{className:"min-w-0",children:[s?e.jsx("p",{className:"truncate text-sm font-semibold tracking-tight",children:s}):null,r?e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:r}):null]}):null]}),e.jsx("div",{role:"log",ref:f,"aria-live":"polite","aria-label":m,className:"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5",children:e.jsx("div",{className:"flex flex-col gap-4",children:g})}),x]})}function N({controls:s,progress:r,composing:n}){const t=s??r;return e.jsxs("div",{className:"shrink-0 border-t border-border px-4 py-3 sm:px-5",children:[t?e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s,r]}):null,e.jsxs("div",{"aria-hidden":!0,className:"flex cursor-not-allowed items-center gap-2 rounded-xl border border-border bg-surface-strong/40 px-3.5 py-2.5 text-sm text-muted-foreground select-none",children:[n!==void 0?e.jsxs("span",{className:"flex-1 truncate text-foreground",children:[n,e.jsx("span",{className:"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-foreground"})]}):e.jsx("span",{className:"flex-1 truncate",children:"Ask anything…"}),e.jsx(h.Send,{className:a.cn("h-4 w-4 shrink-0",n?"text-foreground":void 0)})]})]})}function i({text:s,partial:r=!1}){return e.jsx("div",{className:"flex justify-end",children:e.jsxs("p",{className:"max-w-[85%] rounded-2xl rounded-br-md bg-foreground px-3.5 py-2.5 text-sm leading-6 text-background",children:[s,r?e.jsx("span",{className:"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-background"}):null]})})}function d({text:s,partial:r=!1}){return e.jsx("div",{className:"flex justify-start",children:e.jsxs("p",{className:"max-w-[90%] rounded-2xl rounded-bl-md bg-primary px-3.5 py-2.5 text-sm leading-6 text-on-primary",children:[s,r?e.jsx("span",{className:"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-on-primary"}):null]})})}function c({label:s,active:r=!0}){const n=["[animation-delay:-0.3s]","[animation-delay:-0.15s]",""];return e.jsxs("div",{className:"flex items-center gap-2 text-[13px] text-muted-foreground",children:[e.jsx("span",{className:"flex gap-1","aria-hidden":!0,children:n.map((t,o)=>e.jsx("span",{className:a.cn("h-1.5 w-1.5 rounded-full bg-current",r&&"animate-bounce",r&&t)},o))}),e.jsx("span",{className:r?"animate-pulse":void 0,children:s})]})}function y(){return e.jsx("p",{className:"py-10 text-center text-sm text-muted-foreground",children:"This demo has no steps yet."})}function v({current:s,total:r,done:n}){return e.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:n?"Demo complete":`Step ${Math.min(s,r)} of ${r}`})}function w({step:s}){return s.type==="user"?e.jsx(i,{text:s.text}):s.type==="assistant"?e.jsx(d,{text:s.text}):s.type==="thinking"?e.jsx(c,{label:s.label??"Thinking…",active:!1}):e.jsx(b.ToolCard,{name:s.name,args:s.args,result:s.result,status:s.status==="error"?"error":"success"})}function k({className:s,...r}){return e.jsx("button",{type:"button",className:a.cn("inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border px-3 text-xs font-semibold text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",s),...r})}exports.AssistantMessage=d;exports.ControlButton=k;exports.DemoFooter=N;exports.DemoWindow=j;exports.EmptyState=y;exports.FinishedStep=w;exports.StepProgress=v;exports.ThinkingRow=c;exports.UserMessage=i;
|
|
2
2
|
//# sourceMappingURL=parts.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parts.cjs","sources":["../../../../src/components/AgentDemo/parts.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Send } from \"../../icons\";\nimport type { AgentScriptStep } from \"./types\";\nimport { ToolCard } from \"./ToolCard\";\n\nexport function DemoWindow({\n title,\n subtitle,\n logo,\n logoSrc,\n logoAlt,\n logoClassName,\n footer,\n logLabel,\n logRef,\n height = \"70dvh\",\n children,\n}: {\n title?: ReactNode;\n subtitle?: ReactNode;\n logo?: ReactNode;\n logoSrc?: string;\n logoAlt?: string;\n logoClassName?: string;\n footer?: ReactNode;\n logLabel: string;\n logRef?: Ref<HTMLDivElement>;\n height?: string;\n children: ReactNode;\n}) {\n const logoNode =\n logo ??\n (logoSrc ? (\n <img\n src={logoSrc}\n alt={logoAlt ?? (typeof title === \"string\" ? title : \"Logo\")}\n className={cn(\"h-8 w-8 rounded-lg object-cover\", logoClassName)}\n />\n ) : undefined);\n return (\n <div\n style={{ height }}\n className=\"flex flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-overlay\"\n >\n <div className=\"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3 sm:px-5\">\n <div className=\"flex gap-1.5\" aria-hidden>\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n </div>\n {logoNode ? <span className=\"flex shrink-0 items-center\">{logoNode}</span> : null}\n {title ?? subtitle ? (\n <div className=\"min-w-0\">\n {title ? (\n <p className=\"truncate text-sm font-semibold tracking-tight\">{title}</p>\n ) : null}\n {subtitle ? (\n <p className=\"truncate text-xs text-muted-foreground\">{subtitle}</p>\n ) : null}\n </div>\n ) : null}\n </div>\n\n <div\n role=\"log\"\n ref={logRef}\n aria-live=\"polite\"\n aria-label={logLabel}\n className=\"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5\"\n >\n <div className=\"flex flex-col gap-4\">{children}</div>\n </div>\n\n {footer}\n </div>\n );\n}\n\nexport function DemoFooter({\n controls,\n progress,\n composing,\n}: {\n controls?: ReactNode;\n progress?: ReactNode;\n composing?: string;\n}) {\n const hasMeta = controls ?? progress;\n return (\n <div className=\"shrink-0 border-t border-border px-4 py-3 sm:px-5\">\n {hasMeta ? (\n <div className=\"mb-3 flex items-center gap-2\">\n {controls}\n {progress}\n </div>\n ) : null}\n <div\n aria-hidden\n className=\"flex cursor-not-allowed items-center gap-2 rounded-xl border border-border bg-surface-strong/40 px-3.5 py-2.5 text-sm text-muted-foreground select-none\"\n >\n {composing !== undefined ? (\n <span className=\"flex-1 truncate text-foreground\">\n {composing}\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-foreground\" />\n </span>\n ) : (\n <span className=\"flex-1 truncate\">Ask anything…</span>\n )}\n <Send\n className={cn(\"h-4 w-4 shrink-0\", composing ? \"text-foreground\" : undefined)}\n />\n </div>\n </div>\n );\n}\n\nexport function UserMessage({ text, partial = false }: { text: string; partial?: boolean }) {\n return (\n <div className=\"flex justify-end\">\n <p className=\"max-w-[85%] rounded-2xl rounded-br-md bg-primary px-3.5 py-2.5 text-sm leading-6 text-on-primary\">\n {text}\n {partial ? (\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-on-primary\" />\n ) : null}\n </p>\n </div>\n );\n}\n\nexport function AssistantMessage({ text, partial = false }: { text: string; partial?: boolean }) {\n return (\n <div className=\"flex justify-start\">\n <p className=\"max-w-[90%] rounded-2xl rounded-bl-md bg-primary-soft px-3.5 py-2.5 text-sm leading-6 text-foreground\">\n {text}\n {partial ? (\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-foreground\" />\n ) : null}\n </p>\n </div>\n );\n}\n\nexport function ThinkingRow({ label, active = true }: { label: string; active?: boolean }) {\n const dots = [\"[animation-delay:-0.3s]\", \"[animation-delay:-0.15s]\", \"\"];\n return (\n <div className=\"flex items-center gap-2 text-[13px] text-muted-foreground\">\n <span className=\"flex gap-1\" aria-hidden>\n {dots.map((delay, i) => (\n <span\n key={i}\n className={cn(\n \"h-1.5 w-1.5 rounded-full bg-current\",\n active && \"animate-bounce\",\n active && delay,\n )}\n />\n ))}\n </span>\n <span className={active ? \"animate-pulse\" : undefined}>{label}</span>\n </div>\n );\n}\n\nexport function EmptyState() {\n return (\n <p className=\"py-10 text-center text-sm text-muted-foreground\">\n This demo has no steps yet.\n </p>\n );\n}\n\nexport function StepProgress({ current, total, done }: { current: number; total: number; done: boolean }) {\n return (\n <span className=\"text-xs tabular-nums text-muted-foreground\">\n {done ? \"Demo complete\" : `Step ${Math.min(current, total)} of ${total}`}\n </span>\n );\n}\n\n/** Render one script step in its finished state (used by the transcript and completed player steps). */\nexport function FinishedStep({ step }: { step: AgentScriptStep }) {\n if (step.type === \"user\") return <UserMessage text={step.text} />;\n if (step.type === \"assistant\") return <AssistantMessage text={step.text} />;\n if (step.type === \"thinking\") return <ThinkingRow label={step.label ?? \"Thinking…\"} active={false} />;\n return (\n <ToolCard\n name={step.name}\n args={step.args}\n result={step.result}\n status={step.status === \"error\" ? \"error\" : \"success\"}\n />\n );\n}\n\nexport function ControlButton({\n className,\n ...props\n}: ButtonHTMLAttributes<HTMLButtonElement>) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border px-3 text-xs font-semibold text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"names":["DemoWindow","title","subtitle","logo","logoSrc","logoAlt","logoClassName","footer","logLabel","logRef","height","children","logoNode","jsx","cn","jsxs","DemoFooter","controls","progress","composing","hasMeta","Send","UserMessage","text","partial","AssistantMessage","ThinkingRow","label","active","dots","delay","i","EmptyState","StepProgress","current","total","done","FinishedStep","step","ToolCard","ControlButton","className","props"],"mappings":"8MAMO,SAASA,EAAW,CACzB,MAAAC,EACA,SAAAC,EACA,KAAAC,EACA,QAAAC,EACA,QAAAC,EACA,cAAAC,EACA,OAAAC,EACA,SAAAC,EACA,OAAAC,EACA,OAAAC,EAAS,QACT,SAAAC,CACF,EAYG,CACD,MAAMC,EACJT,IACCC,EACCS,EAAAA,IAAC,MAAA,CACC,IAAKT,EACL,IAAKC,IAAY,OAAOJ,GAAU,SAAWA,EAAQ,QACrD,UAAWa,EAAAA,GAAG,kCAAmCR,CAAa,CAAA,CAAA,EAE9D,QACN,OACES,EAAAA,KAAC,MAAA,CACC,MAAO,CAAE,OAAAL,CAAA,EACT,UAAU,2GAEV,SAAA,CAAAK,EAAAA,KAAC,MAAA,CAAI,UAAU,4EACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAA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AAK,UAAU,6CACb,WAAO,gBAAkB,QAAQ,KAAK,IAAIqB,EAASC,CAAK,CAAC,OAAOA,CAAK,GACxE,CAEJ,CAGO,SAASE,EAAa,CAAE,KAAAC,GAAmC,CAChE,OAAIA,EAAK,OAAS,aAAgBhB,EAAA,CAAY,KAAMgB,EAAK,KAAM,EAC3DA,EAAK,OAAS,kBAAqBb,EAAA,CAAiB,KAAMa,EAAK,KAAM,EACrEA,EAAK,OAAS,WAAmBzB,EAAAA,IAACa,EAAA,CAAY,MAAOY,EAAK,OAAS,YAAa,OAAQ,EAAA,CAAO,EAEjGzB,EAAAA,IAAC0B,EAAAA,SAAA,CACC,KAAMD,EAAK,KACX,KAAMA,EAAK,KACX,OAAQA,EAAK,OACb,OAAQA,EAAK,SAAW,QAAU,QAAU,SAAA,CAAA,CAGlD,CAEO,SAASE,EAAc,CAC5B,UAAAC,EACA,GAAGC,CACL,EAA4C,CAC1C,OACE7B,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAWC,EAAAA,GACT,mQACA2B,CAAA,EAED,GAAGC,CAAA,CAAA,CAGV"}
|
|
1
|
+
{"version":3,"file":"parts.cjs","sources":["../../../../src/components/AgentDemo/parts.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Send } from \"../../icons\";\nimport type { AgentScriptStep } from \"./types\";\nimport { ToolCard } from \"./ToolCard\";\n\nexport function DemoWindow({\n title,\n subtitle,\n logo,\n logoSrc,\n logoAlt,\n logoClassName,\n footer,\n logLabel,\n logRef,\n height = \"70dvh\",\n children,\n}: {\n title?: ReactNode;\n subtitle?: ReactNode;\n logo?: ReactNode;\n logoSrc?: string;\n logoAlt?: string;\n logoClassName?: string;\n footer?: ReactNode;\n logLabel: string;\n logRef?: Ref<HTMLDivElement>;\n height?: string;\n children: ReactNode;\n}) {\n const logoNode =\n logo ??\n (logoSrc ? (\n <img\n src={logoSrc}\n alt={logoAlt ?? (typeof title === \"string\" ? title : \"Logo\")}\n className={cn(\"h-8 w-8 rounded-lg object-cover\", logoClassName)}\n />\n ) : undefined);\n return (\n <div\n style={{ height }}\n className=\"flex flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-overlay\"\n >\n <div className=\"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3 sm:px-5\">\n <div className=\"flex gap-1.5\" aria-hidden>\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n </div>\n {logoNode ? <span className=\"flex shrink-0 items-center\">{logoNode}</span> : null}\n {title ?? subtitle ? (\n <div className=\"min-w-0\">\n {title ? (\n <p className=\"truncate text-sm font-semibold tracking-tight\">{title}</p>\n ) : null}\n {subtitle ? (\n <p className=\"truncate text-xs text-muted-foreground\">{subtitle}</p>\n ) : null}\n </div>\n ) : null}\n </div>\n\n <div\n role=\"log\"\n ref={logRef}\n aria-live=\"polite\"\n aria-label={logLabel}\n className=\"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5\"\n >\n <div className=\"flex flex-col gap-4\">{children}</div>\n </div>\n\n {footer}\n </div>\n );\n}\n\nexport function DemoFooter({\n controls,\n progress,\n composing,\n}: {\n controls?: ReactNode;\n progress?: ReactNode;\n composing?: string;\n}) {\n const hasMeta = controls ?? progress;\n return (\n <div className=\"shrink-0 border-t border-border px-4 py-3 sm:px-5\">\n {hasMeta ? (\n <div className=\"mb-3 flex items-center gap-2\">\n {controls}\n {progress}\n </div>\n ) : null}\n <div\n aria-hidden\n className=\"flex cursor-not-allowed items-center gap-2 rounded-xl border border-border bg-surface-strong/40 px-3.5 py-2.5 text-sm text-muted-foreground select-none\"\n >\n {composing !== undefined ? (\n <span className=\"flex-1 truncate text-foreground\">\n {composing}\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-foreground\" />\n </span>\n ) : (\n <span className=\"flex-1 truncate\">Ask anything…</span>\n )}\n <Send\n className={cn(\"h-4 w-4 shrink-0\", composing ? \"text-foreground\" : undefined)}\n />\n </div>\n </div>\n );\n}\n\nexport function UserMessage({ text, partial = false }: { text: string; partial?: boolean }) {\n return (\n <div className=\"flex justify-end\">\n <p className=\"max-w-[85%] rounded-2xl rounded-br-md bg-foreground px-3.5 py-2.5 text-sm leading-6 text-background\">\n {text}\n {partial ? (\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-background\" />\n ) : null}\n </p>\n </div>\n );\n}\n\nexport function AssistantMessage({ text, partial = false }: { text: string; partial?: boolean }) {\n return (\n <div className=\"flex justify-start\">\n <p className=\"max-w-[90%] rounded-2xl rounded-bl-md bg-primary px-3.5 py-2.5 text-sm leading-6 text-on-primary\">\n {text}\n {partial ? (\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-on-primary\" />\n ) : null}\n </p>\n </div>\n );\n}\n\nexport function ThinkingRow({ label, active = true }: { label: string; active?: boolean }) {\n const dots = [\"[animation-delay:-0.3s]\", \"[animation-delay:-0.15s]\", \"\"];\n return (\n <div className=\"flex items-center gap-2 text-[13px] text-muted-foreground\">\n <span className=\"flex gap-1\" aria-hidden>\n {dots.map((delay, i) => (\n <span\n key={i}\n className={cn(\n \"h-1.5 w-1.5 rounded-full bg-current\",\n active && \"animate-bounce\",\n active && delay,\n )}\n />\n ))}\n </span>\n <span className={active ? \"animate-pulse\" : undefined}>{label}</span>\n </div>\n );\n}\n\nexport function EmptyState() {\n return (\n <p className=\"py-10 text-center text-sm text-muted-foreground\">\n This demo has no steps yet.\n </p>\n );\n}\n\nexport function StepProgress({ current, total, done }: { current: number; total: number; done: boolean }) {\n return (\n <span className=\"text-xs tabular-nums text-muted-foreground\">\n {done ? \"Demo complete\" : `Step ${Math.min(current, total)} of ${total}`}\n </span>\n );\n}\n\n/** Render one script step in its finished state (used by the transcript and completed player steps). */\nexport function FinishedStep({ step }: { step: AgentScriptStep }) {\n if (step.type === \"user\") return <UserMessage text={step.text} />;\n if (step.type === \"assistant\") return <AssistantMessage text={step.text} />;\n if (step.type === \"thinking\") return <ThinkingRow label={step.label ?? \"Thinking…\"} active={false} />;\n return (\n <ToolCard\n name={step.name}\n args={step.args}\n result={step.result}\n status={step.status === \"error\" ? \"error\" : \"success\"}\n />\n );\n}\n\nexport function ControlButton({\n className,\n ...props\n}: ButtonHTMLAttributes<HTMLButtonElement>) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border px-3 text-xs font-semibold text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"names":["DemoWindow","title","subtitle","logo","logoSrc","logoAlt","logoClassName","footer","logLabel","logRef","height","children","logoNode","jsx","cn","jsxs","DemoFooter","controls","progress","composing","hasMeta","Send","UserMessage","text","partial","AssistantMessage","ThinkingRow","label","active","dots","delay","i","EmptyState","StepProgress","current","total","done","FinishedStep","step","ToolCard","ControlButton","className","props"],"mappings":"8MAMO,SAASA,EAAW,CACzB,MAAAC,EACA,SAAAC,EACA,KAAAC,EACA,QAAAC,EACA,QAAAC,EACA,cAAAC,EACA,OAAAC,EACA,SAAAC,EACA,OAAAC,EACA,OAAAC,EAAS,QACT,SAAAC,CACF,EAYG,CACD,MAAMC,EACJT,IACCC,EACCS,EAAAA,IAAC,MAAA,CACC,IAAKT,EACL,IAAKC,IAAY,OAAOJ,GAAU,SAAWA,EAAQ,QACrD,UAAWa,EAAAA,GAAG,kCAAmCR,CAAa,CAAA,CAAA,EAE9D,QACN,OACES,EAAAA,KAAC,MAAA,CACC,MAAO,CAAE,OAAAL,CAAA,EACT,UAAU,2GAEV,SAAA,CAAAK,EAAAA,KAAC,MAAA,CAAI,UAAU,4EACb,SAAA,CAAAA,EAAAA,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A,IAAC,OAAA,CAAK,UAAU,6CACb,WAAO,gBAAkB,QAAQ,KAAK,IAAIqB,EAASC,CAAK,CAAC,OAAOA,CAAK,GACxE,CAEJ,CAGO,SAASE,EAAa,CAAE,KAAAC,GAAmC,CAChE,OAAIA,EAAK,OAAS,aAAgBhB,EAAA,CAAY,KAAMgB,EAAK,KAAM,EAC3DA,EAAK,OAAS,kBAAqBb,EAAA,CAAiB,KAAMa,EAAK,KAAM,EACrEA,EAAK,OAAS,WAAmBzB,EAAAA,IAACa,EAAA,CAAY,MAAOY,EAAK,OAAS,YAAa,OAAQ,EAAA,CAAO,EAEjGzB,EAAAA,IAAC0B,EAAAA,SAAA,CACC,KAAMD,EAAK,KACX,KAAMA,EAAK,KACX,OAAQA,EAAK,OACb,OAAQA,EAAK,SAAW,QAAU,QAAU,SAAA,CAAA,CAGlD,CAEO,SAASE,EAAc,CAC5B,UAAAC,EACA,GAAGC,CACL,EAA4C,CAC1C,OACE7B,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAWC,EAAAA,GACT,mQACA2B,CAAA,EAED,GAAGC,CAAA,CAAA,CAGV"}
|
|
@@ -12,8 +12,8 @@ function j({
|
|
|
12
12
|
footer: u,
|
|
13
13
|
logLabel: c,
|
|
14
14
|
logRef: m,
|
|
15
|
-
height:
|
|
16
|
-
children:
|
|
15
|
+
height: x = "70dvh",
|
|
16
|
+
children: f
|
|
17
17
|
}) {
|
|
18
18
|
const d = t ?? (s ? /* @__PURE__ */ r(
|
|
19
19
|
"img",
|
|
@@ -26,7 +26,7 @@ function j({
|
|
|
26
26
|
return /* @__PURE__ */ a(
|
|
27
27
|
"div",
|
|
28
28
|
{
|
|
29
|
-
style: { height:
|
|
29
|
+
style: { height: x },
|
|
30
30
|
className: "flex flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-overlay",
|
|
31
31
|
children: [
|
|
32
32
|
/* @__PURE__ */ a("div", { className: "flex shrink-0 items-center gap-3 border-b border-border px-4 py-3 sm:px-5", children: [
|
|
@@ -49,7 +49,7 @@ function j({
|
|
|
49
49
|
"aria-live": "polite",
|
|
50
50
|
"aria-label": c,
|
|
51
51
|
className: "min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5",
|
|
52
|
-
children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-4", children:
|
|
52
|
+
children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-4", children: f })
|
|
53
53
|
}
|
|
54
54
|
),
|
|
55
55
|
u
|
|
@@ -89,15 +89,15 @@ function M({
|
|
|
89
89
|
] });
|
|
90
90
|
}
|
|
91
91
|
function h({ text: e, partial: n = !1 }) {
|
|
92
|
-
return /* @__PURE__ */ r("div", { className: "flex justify-end", children: /* @__PURE__ */ a("p", { className: "max-w-[85%] rounded-2xl rounded-br-md bg-
|
|
92
|
+
return /* @__PURE__ */ r("div", { className: "flex justify-end", children: /* @__PURE__ */ a("p", { className: "max-w-[85%] rounded-2xl rounded-br-md bg-foreground px-3.5 py-2.5 text-sm leading-6 text-background", children: [
|
|
93
93
|
e,
|
|
94
|
-
n ? /* @__PURE__ */ r("span", { className: "ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-
|
|
94
|
+
n ? /* @__PURE__ */ r("span", { className: "ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-background" }) : null
|
|
95
95
|
] }) });
|
|
96
96
|
}
|
|
97
97
|
function b({ text: e, partial: n = !1 }) {
|
|
98
|
-
return /* @__PURE__ */ r("div", { className: "flex justify-start", children: /* @__PURE__ */ a("p", { className: "max-w-[90%] rounded-2xl rounded-bl-md bg-primary
|
|
98
|
+
return /* @__PURE__ */ r("div", { className: "flex justify-start", children: /* @__PURE__ */ a("p", { className: "max-w-[90%] rounded-2xl rounded-bl-md bg-primary px-3.5 py-2.5 text-sm leading-6 text-on-primary", children: [
|
|
99
99
|
e,
|
|
100
|
-
n ? /* @__PURE__ */ r("span", { className: "ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-
|
|
100
|
+
n ? /* @__PURE__ */ r("span", { className: "ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-on-primary" }) : null
|
|
101
101
|
] }) });
|
|
102
102
|
}
|
|
103
103
|
function N({ label: e, active: n = !0 }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parts.js","sources":["../../../../src/components/AgentDemo/parts.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Send } from \"../../icons\";\nimport type { AgentScriptStep } from \"./types\";\nimport { ToolCard } from \"./ToolCard\";\n\nexport function DemoWindow({\n title,\n subtitle,\n logo,\n logoSrc,\n logoAlt,\n logoClassName,\n footer,\n logLabel,\n logRef,\n height = \"70dvh\",\n children,\n}: {\n title?: ReactNode;\n subtitle?: ReactNode;\n logo?: ReactNode;\n logoSrc?: string;\n logoAlt?: string;\n logoClassName?: string;\n footer?: ReactNode;\n logLabel: string;\n logRef?: Ref<HTMLDivElement>;\n height?: string;\n children: ReactNode;\n}) {\n const logoNode =\n logo ??\n (logoSrc ? (\n <img\n src={logoSrc}\n alt={logoAlt ?? (typeof title === \"string\" ? title : \"Logo\")}\n className={cn(\"h-8 w-8 rounded-lg object-cover\", logoClassName)}\n />\n ) : undefined);\n return (\n <div\n style={{ height }}\n className=\"flex flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-overlay\"\n >\n <div className=\"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3 sm:px-5\">\n <div className=\"flex gap-1.5\" aria-hidden>\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n </div>\n {logoNode ? <span className=\"flex shrink-0 items-center\">{logoNode}</span> : null}\n {title ?? subtitle ? (\n <div className=\"min-w-0\">\n {title ? (\n <p className=\"truncate text-sm font-semibold tracking-tight\">{title}</p>\n ) : null}\n {subtitle ? (\n <p className=\"truncate text-xs text-muted-foreground\">{subtitle}</p>\n ) : null}\n </div>\n ) : null}\n </div>\n\n <div\n role=\"log\"\n ref={logRef}\n aria-live=\"polite\"\n aria-label={logLabel}\n className=\"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5\"\n >\n <div className=\"flex flex-col gap-4\">{children}</div>\n </div>\n\n {footer}\n </div>\n );\n}\n\nexport function DemoFooter({\n controls,\n progress,\n composing,\n}: {\n controls?: ReactNode;\n progress?: ReactNode;\n composing?: string;\n}) {\n const hasMeta = controls ?? progress;\n return (\n <div className=\"shrink-0 border-t border-border px-4 py-3 sm:px-5\">\n {hasMeta ? (\n <div className=\"mb-3 flex items-center gap-2\">\n {controls}\n {progress}\n </div>\n ) : null}\n <div\n aria-hidden\n className=\"flex cursor-not-allowed items-center gap-2 rounded-xl border border-border bg-surface-strong/40 px-3.5 py-2.5 text-sm text-muted-foreground select-none\"\n >\n {composing !== undefined ? (\n <span className=\"flex-1 truncate text-foreground\">\n {composing}\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-foreground\" />\n </span>\n ) : (\n <span className=\"flex-1 truncate\">Ask anything…</span>\n )}\n <Send\n className={cn(\"h-4 w-4 shrink-0\", composing ? \"text-foreground\" : undefined)}\n />\n </div>\n </div>\n );\n}\n\nexport function UserMessage({ text, partial = false }: { text: string; partial?: boolean }) {\n return (\n <div className=\"flex justify-end\">\n <p className=\"max-w-[85%] rounded-2xl rounded-br-md bg-primary px-3.5 py-2.5 text-sm leading-6 text-on-primary\">\n {text}\n {partial ? (\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-on-primary\" />\n ) : null}\n </p>\n </div>\n );\n}\n\nexport function AssistantMessage({ text, partial = false }: { text: string; partial?: boolean }) {\n return (\n <div className=\"flex justify-start\">\n <p className=\"max-w-[90%] rounded-2xl rounded-bl-md bg-primary-soft px-3.5 py-2.5 text-sm leading-6 text-foreground\">\n {text}\n {partial ? (\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-foreground\" />\n ) : null}\n </p>\n </div>\n );\n}\n\nexport function ThinkingRow({ label, active = true }: { label: string; active?: boolean }) {\n const dots = [\"[animation-delay:-0.3s]\", \"[animation-delay:-0.15s]\", \"\"];\n return (\n <div className=\"flex items-center gap-2 text-[13px] text-muted-foreground\">\n <span className=\"flex gap-1\" aria-hidden>\n {dots.map((delay, i) => (\n <span\n key={i}\n className={cn(\n \"h-1.5 w-1.5 rounded-full bg-current\",\n active && \"animate-bounce\",\n active && delay,\n )}\n />\n ))}\n </span>\n <span className={active ? \"animate-pulse\" : undefined}>{label}</span>\n </div>\n );\n}\n\nexport function EmptyState() {\n return (\n <p className=\"py-10 text-center text-sm text-muted-foreground\">\n This demo has no steps yet.\n </p>\n );\n}\n\nexport function StepProgress({ current, total, done }: { current: number; total: number; done: boolean }) {\n return (\n <span className=\"text-xs tabular-nums text-muted-foreground\">\n {done ? \"Demo complete\" : `Step ${Math.min(current, total)} of ${total}`}\n </span>\n );\n}\n\n/** Render one script step in its finished state (used by the transcript and completed player steps). */\nexport function FinishedStep({ step }: { step: AgentScriptStep }) {\n if (step.type === \"user\") return <UserMessage text={step.text} />;\n if (step.type === \"assistant\") return <AssistantMessage text={step.text} />;\n if (step.type === \"thinking\") return <ThinkingRow label={step.label ?? \"Thinking…\"} active={false} />;\n return (\n <ToolCard\n name={step.name}\n args={step.args}\n result={step.result}\n status={step.status === \"error\" ? \"error\" : \"success\"}\n />\n );\n}\n\nexport function ControlButton({\n className,\n ...props\n}: ButtonHTMLAttributes<HTMLButtonElement>) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border px-3 text-xs font-semibold text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"names":["DemoWindow","title","subtitle","logo","logoSrc","logoAlt","logoClassName","footer","logLabel","logRef","height","children","logoNode","jsx","cn","jsxs","DemoFooter","controls","progress","composing","Send","UserMessage","text","partial","AssistantMessage","ThinkingRow","label","active","delay","i","EmptyState","StepProgress","current","total","done","FinishedStep","step","ToolCard","ControlButton","className","props"],"mappings":";;;;AAMO,SAASA,EAAW;AAAA,EACzB,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,UAAAC;AACF,GAYG;AACD,QAAMC,IACJT,MACCC,IACC,gBAAAS;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKT;AAAA,MACL,KAAKC,MAAY,OAAOJ,KAAU,WAAWA,IAAQ;AAAA,MACrD,WAAWa,EAAG,mCAAmCR,CAAa;AAAA,IAAA;AAAA,EAAA,IAE9D;AACN,SACE,gBAAAS;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO,EAAE,QAAAL,EAAA;AAAA,MACT,WAAU;AAAA,MAEV,UAAA;AAAA,QAAA,gBAAAK,EAAC,OAAA,EAAI,WAAU,6EACb,UAAA;AAAA,UAAA,gBAAAA,EAAC,OAAA,EAAI,WAAU,gBAAe,eAAW,IACvC,UAAA;AAAA,YAAA,gBAAAF,EAAC,QAAA,EAAK,WAAU,4CAAA,CAA4C;AAAA,YAC5D,gBAAAA,EAAC,QAAA,EAAK,WAAU,4CAAA,CAA4C;AAAA,YAC5D,gBAAAA,EAAC,QAAA,EAAK,WAAU,4CAAA,CAA4C;AAAA,UAAA,GAC9D;AAAA,UACCD,IAAW,gBAAAC,EAAC,QAAA,EAAK,WAAU,8BAA8B,aAAS,IAAU;AAAA,UAC5EZ,KA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AAC,GAAO,MAAAC,KAA2D;AACxG,SACE,gBAAArB,EAAC,QAAA,EAAK,WAAU,8CACb,cAAO,kBAAkB,QAAQ,KAAK,IAAImB,GAASC,CAAK,CAAC,OAAOA,CAAK,IACxE;AAEJ;AAGO,SAASE,EAAa,EAAE,MAAAC,KAAmC;AAChE,SAAIA,EAAK,SAAS,2BAAgBf,GAAA,EAAY,MAAMe,EAAK,MAAM,IAC3DA,EAAK,SAAS,gCAAqBZ,GAAA,EAAiB,MAAMY,EAAK,MAAM,IACrEA,EAAK,SAAS,aAAmB,gBAAAvB,EAACY,GAAA,EAAY,OAAOW,EAAK,SAAS,aAAa,QAAQ,GAAA,CAAO,IAEjG,gBAAAvB;AAAA,IAACwB;AAAA,IAAA;AAAA,MACC,MAAMD,EAAK;AAAA,MACX,MAAMA,EAAK;AAAA,MACX,QAAQA,EAAK;AAAA,MACb,QAAQA,EAAK,WAAW,UAAU,UAAU;AAAA,IAAA;AAAA,EAAA;AAGlD;AAEO,SAASE,EAAc;AAAA,EAC5B,WAAAC;AAAA,EACA,GAAGC;AACL,GAA4C;AAC1C,SACE,gBAAA3B;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAWC;AAAA,QACT;AAAA,QACAyB;AAAA,MAAA;AAAA,MAED,GAAGC;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
1
|
+
{"version":3,"file":"parts.js","sources":["../../../../src/components/AgentDemo/parts.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Send } from \"../../icons\";\nimport type { AgentScriptStep } from \"./types\";\nimport { ToolCard } from \"./ToolCard\";\n\nexport function DemoWindow({\n title,\n subtitle,\n logo,\n logoSrc,\n logoAlt,\n logoClassName,\n footer,\n logLabel,\n logRef,\n height = \"70dvh\",\n children,\n}: {\n title?: ReactNode;\n subtitle?: ReactNode;\n logo?: ReactNode;\n logoSrc?: string;\n logoAlt?: string;\n logoClassName?: string;\n footer?: ReactNode;\n logLabel: string;\n logRef?: Ref<HTMLDivElement>;\n height?: string;\n children: ReactNode;\n}) {\n const logoNode =\n logo ??\n (logoSrc ? (\n <img\n src={logoSrc}\n alt={logoAlt ?? (typeof title === \"string\" ? title : \"Logo\")}\n className={cn(\"h-8 w-8 rounded-lg object-cover\", logoClassName)}\n />\n ) : undefined);\n return (\n <div\n style={{ height }}\n className=\"flex flex-col overflow-hidden rounded-2xl border border-border bg-surface text-foreground shadow-overlay\"\n >\n <div className=\"flex shrink-0 items-center gap-3 border-b border-border px-4 py-3 sm:px-5\">\n <div className=\"flex gap-1.5\" aria-hidden>\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n <span className=\"h-2.5 w-2.5 rounded-full bg-foreground/15\" />\n </div>\n {logoNode ? <span className=\"flex shrink-0 items-center\">{logoNode}</span> : null}\n {title ?? subtitle ? (\n <div className=\"min-w-0\">\n {title ? (\n <p className=\"truncate text-sm font-semibold tracking-tight\">{title}</p>\n ) : null}\n {subtitle ? (\n <p className=\"truncate text-xs text-muted-foreground\">{subtitle}</p>\n ) : null}\n </div>\n ) : null}\n </div>\n\n <div\n role=\"log\"\n ref={logRef}\n aria-live=\"polite\"\n aria-label={logLabel}\n className=\"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5\"\n >\n <div className=\"flex flex-col gap-4\">{children}</div>\n </div>\n\n {footer}\n </div>\n );\n}\n\nexport function DemoFooter({\n controls,\n progress,\n composing,\n}: {\n controls?: ReactNode;\n progress?: ReactNode;\n composing?: string;\n}) {\n const hasMeta = controls ?? progress;\n return (\n <div className=\"shrink-0 border-t border-border px-4 py-3 sm:px-5\">\n {hasMeta ? (\n <div className=\"mb-3 flex items-center gap-2\">\n {controls}\n {progress}\n </div>\n ) : null}\n <div\n aria-hidden\n className=\"flex cursor-not-allowed items-center gap-2 rounded-xl border border-border bg-surface-strong/40 px-3.5 py-2.5 text-sm text-muted-foreground select-none\"\n >\n {composing !== undefined ? (\n <span className=\"flex-1 truncate text-foreground\">\n {composing}\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-foreground\" />\n </span>\n ) : (\n <span className=\"flex-1 truncate\">Ask anything…</span>\n )}\n <Send\n className={cn(\"h-4 w-4 shrink-0\", composing ? \"text-foreground\" : undefined)}\n />\n </div>\n </div>\n );\n}\n\nexport function UserMessage({ text, partial = false }: { text: string; partial?: boolean }) {\n return (\n <div className=\"flex justify-end\">\n <p className=\"max-w-[85%] rounded-2xl rounded-br-md bg-foreground px-3.5 py-2.5 text-sm leading-6 text-background\">\n {text}\n {partial ? (\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-background\" />\n ) : null}\n </p>\n </div>\n );\n}\n\nexport function AssistantMessage({ text, partial = false }: { text: string; partial?: boolean }) {\n return (\n <div className=\"flex justify-start\">\n <p className=\"max-w-[90%] rounded-2xl rounded-bl-md bg-primary px-3.5 py-2.5 text-sm leading-6 text-on-primary\">\n {text}\n {partial ? (\n <span className=\"ml-0.5 inline-block h-4 w-[2px] translate-y-[3px] animate-pulse bg-on-primary\" />\n ) : null}\n </p>\n </div>\n );\n}\n\nexport function ThinkingRow({ label, active = true }: { label: string; active?: boolean }) {\n const dots = [\"[animation-delay:-0.3s]\", \"[animation-delay:-0.15s]\", \"\"];\n return (\n <div className=\"flex items-center gap-2 text-[13px] text-muted-foreground\">\n <span className=\"flex gap-1\" aria-hidden>\n {dots.map((delay, i) => (\n <span\n key={i}\n className={cn(\n \"h-1.5 w-1.5 rounded-full bg-current\",\n active && \"animate-bounce\",\n active && delay,\n )}\n />\n ))}\n </span>\n <span className={active ? \"animate-pulse\" : undefined}>{label}</span>\n </div>\n );\n}\n\nexport function EmptyState() {\n return (\n <p className=\"py-10 text-center text-sm text-muted-foreground\">\n This demo has no steps yet.\n </p>\n );\n}\n\nexport function StepProgress({ current, total, done }: { current: number; total: number; done: boolean }) {\n return (\n <span className=\"text-xs tabular-nums text-muted-foreground\">\n {done ? \"Demo complete\" : `Step ${Math.min(current, total)} of ${total}`}\n </span>\n );\n}\n\n/** Render one script step in its finished state (used by the transcript and completed player steps). */\nexport function FinishedStep({ step }: { step: AgentScriptStep }) {\n if (step.type === \"user\") return <UserMessage text={step.text} />;\n if (step.type === \"assistant\") return <AssistantMessage text={step.text} />;\n if (step.type === \"thinking\") return <ThinkingRow label={step.label ?? \"Thinking…\"} active={false} />;\n return (\n <ToolCard\n name={step.name}\n args={step.args}\n result={step.result}\n status={step.status === \"error\" ? \"error\" : \"success\"}\n />\n );\n}\n\nexport function ControlButton({\n className,\n ...props\n}: ButtonHTMLAttributes<HTMLButtonElement>) {\n return (\n <button\n type=\"button\"\n className={cn(\n \"inline-flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border border-border px-3 text-xs font-semibold text-foreground transition-colors duration-150 hover:border-foreground/25 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"names":["DemoWindow","title","subtitle","logo","logoSrc","logoAlt","logoClassName","footer","logLabel","logRef","height","children","logoNode","jsx","cn","jsxs","DemoFooter","controls","progress","composing","Send","UserMessage","text","partial","AssistantMessage","ThinkingRow","label","active","delay","i","EmptyState","StepProgress","current","total","done","FinishedStep","step","ToolCard","ControlButton","className","props"],"mappings":";;;;AAMO,SAASA,EAAW;AAAA,EACzB,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC,IAAS;AAAA,EACT,UAAAC;AACF,GAYG;AACD,QAAMC,IACJT,MACCC,IACC,gBAAAS;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKT;AAAA,MACL,KAAKC,MAA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