@40rty/ams-ui 0.5.1 → 0.5.3

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.
Files changed (33) hide show
  1. package/dist/agent.js +1 -1
  2. package/dist/catalog-data.js +1 -1
  3. package/dist/catalog-entries.js +2 -2
  4. package/dist/{chunk-RKPDCXL4.js → chunk-2HM6EVDV.js} +18 -0
  5. package/dist/chunk-2QRYXSCB.js +5344 -0
  6. package/dist/{chunk-CKGGECAQ.js → chunk-KW2DLXHP.js} +1 -1
  7. package/dist/{chunk-LQLOG2V3.js → chunk-N5XACWEX.js} +1 -1
  8. package/dist/conversation/manifests/conversation/explain.md +13 -0
  9. package/dist/conversation/manifests/conversation/facts.md +13 -0
  10. package/dist/conversation/manifests/conversation/guidedPick.md +13 -0
  11. package/dist/conversation/manifests/conversation/note.md +13 -0
  12. package/dist/conversation/manifests/conversation/paths.md +13 -0
  13. package/dist/conversation/manifests/conversation/shortlist.md +13 -0
  14. package/dist/conversation/manifests/conversation/tradeoff.md +13 -0
  15. package/dist/conversation/manifests/conversation/verdict.md +13 -0
  16. package/dist/conversation.js +947 -0
  17. package/dist/css/conversation/conversation.css +20 -0
  18. package/dist/css/shell/mobile/island.css +2 -2
  19. package/dist/index.js +14 -12
  20. package/dist/shell.js +47 -5295
  21. package/dist/types/agent/presence/PresenceFiller.d.ts +1 -1
  22. package/dist/types/agent/presence/folded.d.ts +1 -1
  23. package/dist/types/components/ecommerce/product/AddToRegistry.d.ts +1 -1
  24. package/dist/types/components/ecommerce/product/PresenceProductRail.d.ts +1 -1
  25. package/dist/types/components/ecommerce/product/ProductGrid.d.ts +1 -1
  26. package/dist/types/components/layout/Modal.d.ts +1 -1
  27. package/dist/types/labels.d.ts +21 -2
  28. package/dist/types/shell/MenuDrawer.d.ts +2 -2
  29. package/dist/types/shell/ShellScaffold.d.ts +1 -1
  30. package/dist/types/shell/mobile/MobileChrome.d.ts +1 -1
  31. package/dist/types/shell/mobile/MorphIsland.d.ts +1 -1
  32. package/dist/types/shell/mobile/hero-entry-point.d.ts +1 -1
  33. package/package.json +7 -2
@@ -0,0 +1,947 @@
1
+ 'use client';
2
+ import {
3
+ AttachButton,
4
+ AttachmentStrip,
5
+ ComposerChipStrip,
6
+ DictationButton,
7
+ usePromptComposer
8
+ } from "./chunk-2QRYXSCB.js";
9
+ import "./chunk-H6MSAD5M.js";
10
+ import "./chunk-JQNZ5UUK.js";
11
+ import {
12
+ useLabels
13
+ } from "./chunk-2HM6EVDV.js";
14
+ import "./chunk-RMJDSHLA.js";
15
+ import {
16
+ AnimatePresence,
17
+ motion,
18
+ useReducedMotion
19
+ } from "./chunk-432XYPDT.js";
20
+ import "./chunk-PHXP2SKS.js";
21
+ import "./chunk-GQURT3IR.js";
22
+
23
+ // src/conversation/ConversationCanvas.tsx
24
+ import { CanvasArrangementProvider, CanvasMotionStyleProvider, SpacefrontCanvas } from "@40rty/ams-sdk";
25
+
26
+ // src/conversation/ResultSheet.tsx
27
+ import * as React from "react";
28
+ import { useConversationPage } from "@40rty/ams-sdk";
29
+ import { jsx } from "react/jsx-runtime";
30
+ function ResultSheet({ children }) {
31
+ const answering = useConversationPage().place === "turn";
32
+ const ref = React.useRef(null);
33
+ React.useEffect(() => {
34
+ const el = ref.current;
35
+ if (el === null) return;
36
+ const onError = (e) => {
37
+ const img = e.target;
38
+ if (!(img instanceof HTMLImageElement)) return;
39
+ console.warn("[ResultSheet] image failed to load; hiding it", img.currentSrc);
40
+ img.style.visibility = "hidden";
41
+ };
42
+ el.addEventListener("error", onError, true);
43
+ return () => el.removeEventListener("error", onError, true);
44
+ }, []);
45
+ return /* @__PURE__ */ jsx("div", { ref, className: answering ? "fourty-convo-sheet min-h-[calc(100svh_-_16px)] overflow-hidden rounded-[var(--fourty-convo-sheet-radius)] bg-[var(--fourty-convo-sheet)] text-[var(--fourty-convo-ink)]" : "", children });
46
+ }
47
+
48
+ // src/conversation/TurnHeader.tsx
49
+ import * as React5 from "react";
50
+ import { useConversationPage as useConversationPage2 } from "@40rty/ams-sdk";
51
+
52
+ // src/conversation/presence-parts.tsx
53
+ import { useScanning } from "@40rty/ams-sdk";
54
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
55
+ var MAX_THUMBS = 5;
56
+ var EASE = [0.22, 1, 0.36, 1];
57
+ function FactChip({ fact, onClear }) {
58
+ const reduce = useReducedMotion();
59
+ return /* @__PURE__ */ jsxs(
60
+ motion.span,
61
+ {
62
+ layout: true,
63
+ className: "relative flex flex-col gap-1 pb-1.5",
64
+ initial: reduce === true ? false : { opacity: 0, y: 4 },
65
+ animate: { opacity: 1, y: 0 },
66
+ transition: { duration: 0.3, ease: EASE },
67
+ children: [
68
+ /* @__PURE__ */ jsx2("span", { className: "text-xs leading-[1.125rem] text-[var(--fourty-convo-muted)]", children: fact.label }),
69
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm font-medium leading-5", children: [
70
+ fact.value,
71
+ onClear !== void 0 && /* @__PURE__ */ jsx2("button", { type: "button", "aria-label": `Clear ${fact.label}`, onClick: onClear, className: "cursor-pointer border-0 bg-transparent p-0 text-[var(--fourty-convo-muted)] hover:text-[var(--fourty-convo-ink)]", children: "\xD7" })
72
+ ] }),
73
+ /* @__PURE__ */ jsx2(
74
+ motion.span,
75
+ {
76
+ "aria-hidden": true,
77
+ className: "absolute bottom-0 left-0 right-0 h-0.5 origin-left bg-[var(--fourty-convo-ink)]",
78
+ initial: reduce === true ? false : { scaleX: 0 },
79
+ animate: { scaleX: 1 },
80
+ transition: { duration: 0.5, ease: EASE, delay: 0.15 }
81
+ }
82
+ )
83
+ ]
84
+ }
85
+ );
86
+ }
87
+ function Facts({ facts: facts2, onForget }) {
88
+ const labels = useLabels().conversation;
89
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-4", children: [
90
+ /* @__PURE__ */ jsx2(AnimatePresence, { initial: false, children: facts2.map((f) => /* @__PURE__ */ jsx2(FactChip, { fact: f, onClear: onForget === void 0 ? void 0 : () => onForget(f) }, f.label.toLowerCase())) }),
91
+ onForget !== void 0 && facts2.length > 1 && /* @__PURE__ */ jsx2("button", { type: "button", onClick: () => facts2.forEach((f) => onForget(f)), className: "cursor-pointer border-0 bg-transparent pb-1.5 text-sm leading-5 text-[var(--fourty-convo-muted)] underline hover:text-[var(--fourty-convo-ink)]", children: labels.clearFacts })
92
+ ] });
93
+ }
94
+ function ThinkingBand({ facts: facts2, status }) {
95
+ const scanning = useScanning();
96
+ const labels = useLabels().conversation;
97
+ const thumbs = scanning === null ? [] : scanning.thumbnails.slice(0, MAX_THUMBS);
98
+ return /* @__PURE__ */ jsxs(
99
+ motion.div,
100
+ {
101
+ initial: { opacity: 0, y: 6 },
102
+ animate: { opacity: 1, y: 0 },
103
+ exit: { opacity: 0 },
104
+ transition: { duration: 0.3, ease: EASE },
105
+ className: "grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-6 py-2",
106
+ children: [
107
+ facts2.length > 0 ? /* @__PURE__ */ jsx2(Facts, { facts: facts2 }) : /* @__PURE__ */ jsx2("span", {}),
108
+ /* @__PURE__ */ jsx2("span", { className: "relative min-w-0 text-2xl font-bold leading-7 text-[var(--fourty-convo-ink)]", "aria-live": "polite", children: /* @__PURE__ */ jsx2(AnimatePresence, { mode: "popLayout", initial: false, children: /* @__PURE__ */ jsxs(
109
+ motion.span,
110
+ {
111
+ className: "line-clamp-2 block",
112
+ initial: { opacity: 0, y: 6 },
113
+ animate: { opacity: 1, y: 0 },
114
+ exit: { opacity: 0, y: -6 },
115
+ transition: { duration: 0.35, ease: EASE },
116
+ children: [
117
+ status,
118
+ /* @__PURE__ */ jsx2("span", { "aria-hidden": true, className: "ml-2 inline-block h-3 w-3 animate-pulse bg-[var(--fourty-convo-accent)]" })
119
+ ]
120
+ },
121
+ status
122
+ ) }) }),
123
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2.5", children: [
124
+ /* @__PURE__ */ jsx2("span", { className: "flex", children: /* @__PURE__ */ jsx2(AnimatePresence, { initial: false, children: thumbs.map((t, i) => /* @__PURE__ */ jsx2(
125
+ motion.img,
126
+ {
127
+ src: t.url,
128
+ alt: "",
129
+ initial: { opacity: 0, scale: 0.6 },
130
+ animate: { opacity: 1, scale: 1 },
131
+ transition: { duration: 0.3, ease: EASE, delay: 0.05 * i },
132
+ className: `h-9 w-9 border-2 border-[var(--fourty-convo-sheet)] bg-[var(--fourty-convo-surface)] object-contain ${i > 0 ? "-ml-3" : ""}`
133
+ },
134
+ t.id
135
+ )) }) }),
136
+ scanning !== null && scanning.count > 0 && /* @__PURE__ */ jsx2("span", { className: "whitespace-nowrap text-[12px] text-[var(--fourty-convo-muted)]", children: labels.lookedAt(scanning.count) })
137
+ ] })
138
+ ]
139
+ }
140
+ );
141
+ }
142
+ function BentoSkeleton() {
143
+ const cells = ["col-span-8 h-[320px]", "col-span-4 h-[320px]", "col-span-12 h-[200px]"];
144
+ return /* @__PURE__ */ jsx2(
145
+ motion.div,
146
+ {
147
+ "aria-busy": "true",
148
+ className: "grid grid-cols-12 gap-4",
149
+ initial: { opacity: 0 },
150
+ animate: { opacity: 1 },
151
+ exit: { opacity: 0, transition: { duration: 0.25, ease: EASE } },
152
+ children: cells.map((c, i) => /* @__PURE__ */ jsx2(
153
+ motion.div,
154
+ {
155
+ initial: { opacity: 0, y: 8 },
156
+ animate: { opacity: 1, y: 0 },
157
+ transition: { duration: 0.35, ease: EASE, delay: 0.08 * i },
158
+ className: `${c} animate-pulse rounded-[var(--fourty-convo-card-radius)] bg-[var(--fourty-convo-surface)]`
159
+ },
160
+ c
161
+ ))
162
+ }
163
+ );
164
+ }
165
+
166
+ // src/conversation/ClosingQuestion.tsx
167
+ import * as React2 from "react";
168
+ import { turnAskSegments } from "@40rty/ams-sdk";
169
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
170
+ function ClosingQuestion({ ask, answerable, onReply }) {
171
+ return /* @__PURE__ */ jsxs2("p", { className: "m-0 flex max-w-[880px] items-baseline gap-3 text-2xl font-bold leading-[1.2] text-[var(--fourty-convo-ink)] [text-wrap:balance] max-[768px]:text-xl", children: [
172
+ /* @__PURE__ */ jsx3("span", { children: turnAskSegments(ask).map(
173
+ (segment, i) => segment.kind === "text" || !answerable ? /* @__PURE__ */ jsx3(React2.Fragment, { children: segment.text }, i) : /* @__PURE__ */ jsx3(
174
+ "button",
175
+ {
176
+ type: "button",
177
+ onClick: () => onReply(segment.text),
178
+ className: "cursor-pointer border-0 bg-transparent p-0 font-[inherit] text-inherit underline decoration-[var(--fourty-convo-accent)] decoration-2 underline-offset-[6px] hover:text-[var(--fourty-convo-accent)]",
179
+ children: segment.text
180
+ },
181
+ i
182
+ )
183
+ ) }),
184
+ /* @__PURE__ */ jsx3("span", { "aria-hidden": true, className: "flex-none text-[var(--fourty-convo-accent)]", children: "\u2192" })
185
+ ] });
186
+ }
187
+
188
+ // src/conversation/turn-text.tsx
189
+ import * as React3 from "react";
190
+ import { useProductCard } from "@40rty/ams-sdk";
191
+ import { Fragment as Fragment3, jsx as jsx4 } from "react/jsx-runtime";
192
+ var CRUMB_MAX_CHARS = 26;
193
+ function crumbLabel(visitorText) {
194
+ const text = visitorText.trim().replace(/[.?!]+$/, "");
195
+ if (text.length <= CRUMB_MAX_CHARS) return text;
196
+ const cut = text.slice(0, CRUMB_MAX_CHARS);
197
+ const space = cut.lastIndexOf(" ");
198
+ return `${space > 10 ? cut.slice(0, space) : cut}\u2026`;
199
+ }
200
+ var wordsOf = (text) => ` ${text.toLowerCase().replace(/[^a-z0-9\s]/g, "").split(/\s+/).filter((w) => w.length > 0).join(" ")} `;
201
+ function productNamed(name, products) {
202
+ const needle = wordsOf(name);
203
+ if (needle.trim().length === 0) return void 0;
204
+ const hits = products.filter((p) => wordsOf(p.title).includes(needle));
205
+ return hits.length === 1 ? hits[0] : void 0;
206
+ }
207
+ function ProductLink({ product, children }) {
208
+ const { onCardClick } = useProductCard(product);
209
+ return /* @__PURE__ */ jsx4(
210
+ "span",
211
+ {
212
+ role: "link",
213
+ tabIndex: 0,
214
+ onClick: onCardClick,
215
+ onKeyDown: (e) => {
216
+ if (e.key === "Enter") onCardClick();
217
+ },
218
+ className: "cursor-pointer font-bold text-[var(--fourty-convo-ink)] underline underline-offset-4 hover:text-[var(--fourty-convo-accent)]",
219
+ children
220
+ }
221
+ );
222
+ }
223
+ function Rich({ text, products }) {
224
+ const parts = text.split("**");
225
+ return /* @__PURE__ */ jsx4(Fragment3, { children: parts.map((part, i) => {
226
+ if (i % 2 === 0) return /* @__PURE__ */ jsx4(React3.Fragment, { children: part }, i);
227
+ const product = products === void 0 ? void 0 : productNamed(part, products);
228
+ if (product !== void 0) return /* @__PURE__ */ jsx4(ProductLink, { product, children: part }, i);
229
+ return /* @__PURE__ */ jsx4("strong", { className: "text-[var(--fourty-convo-ink)]", children: part }, i);
230
+ }) });
231
+ }
232
+ var WORD_EASE = [0.2, 0.75, 0.2, 1];
233
+ var WORD_STAGGER_S = 0.05;
234
+ function RisingWords({ text, products, delayS = 0 }) {
235
+ const shownRef = React3.useRef(0);
236
+ const reduce = useReducedMotion();
237
+ const words = [];
238
+ let gap = false;
239
+ text.split("**").forEach((part, run) => {
240
+ const bold = run % 2 === 1;
241
+ const product = bold ? productNamed(part, products) : void 0;
242
+ for (const m of part.matchAll(/(\s*)(\S+)/g)) {
243
+ words.push({ w: m[2], bold, spaced: words.length > 0 && (gap || m[1].length > 0), run, product });
244
+ gap = false;
245
+ }
246
+ if (/\s$/.test(part)) gap = true;
247
+ });
248
+ const firstNew = shownRef.current;
249
+ React3.useEffect(() => {
250
+ shownRef.current = words.length;
251
+ });
252
+ const word = (i) => {
253
+ const { w, bold, product } = words[i];
254
+ const fresh = i >= firstNew && reduce !== true;
255
+ return /* @__PURE__ */ jsx4(
256
+ motion.span,
257
+ {
258
+ className: `inline-block ${bold ? "font-[var(--font-weight-strong,_700)] text-[var(--fourty-convo-ink)]" : ""} ${product !== void 0 ? "underline underline-offset-[0.12em] [color:inherit]" : ""}`,
259
+ initial: fresh ? { opacity: 0, y: "0.5em", filter: "blur(8px)" } : false,
260
+ animate: { opacity: 1, y: 0, filter: "blur(0px)" },
261
+ transition: { duration: 0.54, ease: WORD_EASE, delay: delayS + (fresh ? (i - firstNew) * WORD_STAGGER_S : 0) },
262
+ children: w
263
+ },
264
+ i
265
+ );
266
+ };
267
+ const out = [];
268
+ for (let i = 0; i < words.length; ) {
269
+ const { product, run, spaced } = words[i];
270
+ if (spaced) out.push(" ");
271
+ if (product === void 0) {
272
+ out.push(word(i));
273
+ i += 1;
274
+ continue;
275
+ }
276
+ const name = [];
277
+ const start = i;
278
+ for (; i < words.length && words[i].run === run; i += 1) {
279
+ if (i > start && words[i].spaced) name.push(" ");
280
+ name.push(word(i));
281
+ }
282
+ out.push(/* @__PURE__ */ jsx4(ProductLink, { product, children: name }, `link-${start}`));
283
+ }
284
+ return /* @__PURE__ */ jsx4(Fragment3, { children: out });
285
+ }
286
+
287
+ // src/conversation/activity-line.ts
288
+ function useActivityLine(activity) {
289
+ const labels = useLabels().conversation;
290
+ if (activity.kind === "voice" || activity.kind === "reasoning") return activity.text;
291
+ if (activity.kind === "searching") return labels.searching(activity.query);
292
+ return labels.working;
293
+ }
294
+
295
+ // src/conversation/use-page-products.ts
296
+ import * as React4 from "react";
297
+ import { collectLayoutGids, useComponentCatalog, useDisplayedLayout, useProducts } from "@40rty/ams-sdk";
298
+ function usePageProducts() {
299
+ const layout = useDisplayedLayout();
300
+ const catalog = useComponentCatalog();
301
+ const ids = React4.useMemo(() => [...collectLayoutGids(layout, catalog)].filter((id) => id.includes("/Product/")), [layout, catalog]);
302
+ return useProducts(ids).data;
303
+ }
304
+
305
+ // src/conversation/TurnHeader.tsx
306
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
307
+ var MAX_CRUMBS = 5;
308
+ function wordCrumbs(crumbs, home, here) {
309
+ return crumbs.map((c) => ({
310
+ key: c.key,
311
+ label: c.kind === "home" ? home : c.kind === "here" ? here : crumbLabel(c.label),
312
+ onClick: c.open
313
+ }));
314
+ }
315
+ function Breadcrumbs({ crumbs }) {
316
+ const shown = crumbs.length > MAX_CRUMBS ? [crumbs[0], { key: "gap", label: "\u2026", onClick: null }, ...crumbs.slice(crumbs.length - (MAX_CRUMBS - 2))] : crumbs;
317
+ return /* @__PURE__ */ jsx5("nav", { "aria-label": "Conversation", className: "flex flex-wrap items-center gap-2 text-sm leading-5 text-[var(--fourty-convo-muted)]", children: shown.map((c, i) => /* @__PURE__ */ jsxs3(React5.Fragment, { children: [
318
+ i > 0 && /* @__PURE__ */ jsx5("span", { "aria-hidden": true, children: "/" }),
319
+ c.onClick === null ? /* @__PURE__ */ jsx5("span", { className: i === shown.length - 1 ? "font-medium text-[var(--fourty-convo-ink)]" : "", children: c.label }) : /* @__PURE__ */ jsx5("button", { type: "button", onClick: c.onClick, className: "cursor-pointer border-0 bg-transparent p-0 text-inherit underline hover:text-[var(--fourty-convo-ink)]", children: c.label })
320
+ ] }, c.key)) });
321
+ }
322
+ function CollapsedTurn({ trail, question, headline, body, right }) {
323
+ const [open, setOpen] = React5.useState(false);
324
+ const products = usePageProducts();
325
+ const reduce = useReducedMotion();
326
+ return /* @__PURE__ */ jsxs3(
327
+ motion.header,
328
+ {
329
+ initial: reduce === true ? false : { opacity: 0, y: -8 },
330
+ animate: { opacity: 1, y: 0 },
331
+ transition: { duration: 0.36, ease: EASE },
332
+ className: "mb-2 flex flex-col gap-3 rounded-lg bg-[var(--fourty-convo-sheet)] px-8 py-4 text-[var(--fourty-convo-ink)] max-[1025px]:px-4",
333
+ children: [
334
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center justify-between gap-4", children: [
335
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-center gap-3", children: [
336
+ /* @__PURE__ */ jsx5("span", { "aria-hidden": true, className: "h-3 w-3 flex-none bg-[var(--fourty-convo-accent)]" }),
337
+ /* @__PURE__ */ jsx5(Breadcrumbs, { crumbs: trail })
338
+ ] }),
339
+ right
340
+ ] }),
341
+ /* @__PURE__ */ jsxs3(
342
+ "button",
343
+ {
344
+ type: "button",
345
+ "aria-expanded": open,
346
+ onClick: () => setOpen((o) => !o),
347
+ className: "flex w-full cursor-pointer items-baseline gap-4 border-0 bg-transparent p-0 pt-1 text-left text-inherit",
348
+ children: [
349
+ /* @__PURE__ */ jsxs3("span", { className: "flex-none text-base font-medium leading-6 text-[var(--fourty-convo-muted)]", children: [
350
+ "\u201C",
351
+ question,
352
+ "\u201D"
353
+ ] }),
354
+ /* @__PURE__ */ jsx5("span", { className: `min-w-0 flex-1 text-xl font-bold leading-7 ${open ? "" : "truncate"}`, children: /* @__PURE__ */ jsx5(Rich, { text: headline }) }),
355
+ /* @__PURE__ */ jsx5("span", { "aria-hidden": true, className: "flex-none text-xl leading-7", children: open ? "\u2212" : "+" })
356
+ ]
357
+ }
358
+ ),
359
+ /* @__PURE__ */ jsx5(AnimatePresence, { initial: false, children: open && body.length > 0 && /* @__PURE__ */ jsx5(
360
+ motion.div,
361
+ {
362
+ initial: reduce === true ? false : { height: 0, opacity: 0 },
363
+ animate: { height: "auto", opacity: 1 },
364
+ exit: { height: 0, opacity: 0 },
365
+ transition: { duration: 0.3, ease: EASE },
366
+ className: "overflow-hidden",
367
+ children: /* @__PURE__ */ jsx5("p", { className: "m-0 max-w-[880px] pb-1 text-base leading-[1.375rem] text-[var(--fourty-convo-muted)]", children: /* @__PURE__ */ jsx5(Rich, { text: body, products }) })
368
+ },
369
+ "answer"
370
+ ) })
371
+ ]
372
+ }
373
+ );
374
+ }
375
+ function TurnHeader() {
376
+ const page = useConversationPage2();
377
+ const reduce = useReducedMotion();
378
+ const products = usePageProducts();
379
+ const labels = useLabels().conversation;
380
+ const { turn, presence } = page;
381
+ const status = useActivityLine(presence.activity);
382
+ if (turn === null) return null;
383
+ const facts2 = presence.facts;
384
+ const startOver = /* @__PURE__ */ jsx5("button", { type: "button", onClick: page.startOver, className: "cursor-pointer border-0 bg-transparent p-0 pb-1.5 text-sm font-medium leading-5 text-[var(--fourty-convo-ink)] underline", children: labels.startOver });
385
+ if (page.place === "away") {
386
+ return /* @__PURE__ */ jsx5(
387
+ CollapsedTurn,
388
+ {
389
+ trail: wordCrumbs(page.crumbs, labels.home, labels.thisPage),
390
+ question: turn.question,
391
+ headline: turn.headline,
392
+ body: turn.body,
393
+ right: /* @__PURE__ */ jsxs3("div", { className: "flex items-end gap-6", children: [
394
+ facts2.length > 0 && /* @__PURE__ */ jsx5(Facts, { facts: facts2, onForget: presence.forgetFact }),
395
+ startOver
396
+ ] })
397
+ },
398
+ `away-${turn.key}`
399
+ );
400
+ }
401
+ const thinking = turn.headline.length === 0 && presence.running;
402
+ return (
403
+ // The platform mobile bar floats over the top 56px (a hero may sit under it): a turn page clears it.
404
+ /* @__PURE__ */ jsxs3(
405
+ motion.header,
406
+ {
407
+ initial: reduce === true ? false : { opacity: 0, y: -14 },
408
+ animate: { opacity: 1, y: 0 },
409
+ transition: { duration: 0.46, ease: EASE },
410
+ className: "relative flex w-full flex-col gap-6 box-border px-8 pb-8 pt-8 max-[1025px]:px-4 max-[1025px]:pt-6 max-[768px]:gap-4",
411
+ children: [
412
+ /* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-end justify-between gap-5", children: [
413
+ /* @__PURE__ */ jsx5(Breadcrumbs, { crumbs: wordCrumbs(page.crumbs, labels.home, labels.thisPage) }),
414
+ /* @__PURE__ */ jsxs3("div", { className: "flex items-end gap-6", children: [
415
+ !thinking && facts2.length > 0 && /* @__PURE__ */ jsxs3("div", { className: "flex items-end gap-4", children: [
416
+ /* @__PURE__ */ jsx5("span", { className: "pb-1.5 text-sm font-medium leading-5 text-[var(--fourty-convo-muted)]", children: labels.whatIKnow }),
417
+ /* @__PURE__ */ jsx5(Facts, { facts: facts2, onForget: presence.forgetFact })
418
+ ] }),
419
+ startOver
420
+ ] })
421
+ ] }),
422
+ /* @__PURE__ */ jsx5("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxs3("span", { className: "text-xl font-medium leading-[1.625rem] text-[var(--fourty-convo-muted)]", children: [
423
+ "\u201C",
424
+ turn.question,
425
+ "\u201D"
426
+ ] }) }),
427
+ /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(AnimatePresence, { mode: "popLayout", initial: false, children: thinking ? /* @__PURE__ */ jsx5(ThinkingBand, { facts: facts2, status }, "thinking") : (
428
+ // The answer reads top to bottom: the headline, then its supporting
429
+ // text, then the closing question. The body streams after the layout,
430
+ // so the page below glides down as it arrives (TurnCanvas).
431
+ /* @__PURE__ */ jsxs3(motion.div, { className: "flex gap-4", initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2 }, children: [
432
+ /* @__PURE__ */ jsx5(
433
+ motion.span,
434
+ {
435
+ "aria-hidden": true,
436
+ className: "mt-4 h-4 w-4 flex-none bg-[var(--fourty-convo-accent)] max-[1025px]:mt-2",
437
+ initial: reduce === true ? false : { scale: 0.4, opacity: 0 },
438
+ animate: { scale: 1, opacity: 1 },
439
+ transition: { duration: 0.46, ease: EASE, delay: 0.04 }
440
+ }
441
+ ),
442
+ /* @__PURE__ */ jsxs3("div", { className: "flex min-w-0 max-w-[1100px] flex-col gap-4", children: [
443
+ /* @__PURE__ */ jsx5("h1", { className: "m-0 text-5xl font-bold leading-12 max-[1025px]:text-[2rem] max-[1025px]:leading-8", children: /* @__PURE__ */ jsx5(RisingWords, { text: turn.headline, products }) }),
444
+ turn.body.length > 0 && /* @__PURE__ */ jsx5(
445
+ motion.p,
446
+ {
447
+ className: "m-0 max-w-[880px] text-xl leading-[1.625rem] text-[var(--fourty-convo-muted)]",
448
+ initial: reduce === true ? false : { opacity: 0, y: 6 },
449
+ animate: { opacity: 1, y: 0 },
450
+ transition: { duration: 0.46, ease: EASE },
451
+ children: /* @__PURE__ */ jsx5(Rich, { text: turn.body, products })
452
+ }
453
+ ),
454
+ turn.ask !== void 0 && /* @__PURE__ */ jsx5(
455
+ motion.div,
456
+ {
457
+ initial: reduce === true ? false : { opacity: 0, y: 6 },
458
+ animate: { opacity: 1, y: 0 },
459
+ transition: { duration: 0.46, ease: EASE },
460
+ children: /* @__PURE__ */ jsx5(ClosingQuestion, { ask: turn.ask, answerable: turn.answerable, onReply: page.reply })
461
+ }
462
+ )
463
+ ] })
464
+ ] }, "answer")
465
+ ) }) }),
466
+ /* @__PURE__ */ jsx5("div", { className: "absolute inset-x-0 top-full px-8 pt-8 max-[1025px]:px-4", children: /* @__PURE__ */ jsx5("div", { children: /* @__PURE__ */ jsx5(AnimatePresence, { initial: false, children: page.phase === "thinking" && !page.hasPage && /* @__PURE__ */ jsx5(BentoSkeleton, {}, "skeleton") }) }) })
467
+ ]
468
+ },
469
+ turn.key
470
+ )
471
+ );
472
+ }
473
+
474
+ // src/conversation/TurnCanvas.tsx
475
+ import { useConversationPage as useConversationPage3 } from "@40rty/ams-sdk";
476
+ import { jsx as jsx6 } from "react/jsx-runtime";
477
+ function TurnCanvas({ children }) {
478
+ const { canvasHidden: hidden } = useConversationPage3();
479
+ const reduce = useReducedMotion();
480
+ return /* @__PURE__ */ jsx6(
481
+ motion.div,
482
+ {
483
+ "aria-hidden": hidden ? true : void 0,
484
+ style: hidden ? { display: "none" } : void 0,
485
+ layout: reduce === true ? void 0 : "position",
486
+ transition: { layout: { duration: 0.6, ease: [0.2, 0.8, 0.2, 1] } },
487
+ children
488
+ }
489
+ );
490
+ }
491
+
492
+ // src/conversation/ConversationCanvas.tsx
493
+ import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
494
+ var CONVERSATION_MOTION = { entrance: "rise", timings: { entranceDurationS: 0.78, rowStaggerS: 0.12 } };
495
+ function ConversationCanvas({ motion: motion2 = CONVERSATION_MOTION }) {
496
+ return /* @__PURE__ */ jsxs4(ResultSheet, { children: [
497
+ /* @__PURE__ */ jsx7(TurnHeader, {}),
498
+ /* @__PURE__ */ jsx7(TurnCanvas, { children: /* @__PURE__ */ jsx7(CanvasArrangementProvider, { arrangement: "bento", turnPages: true, children: /* @__PURE__ */ jsx7(CanvasMotionStyleProvider, { style: motion2, children: /* @__PURE__ */ jsx7(SpacefrontCanvas, {}) }) }) })
499
+ ] });
500
+ }
501
+
502
+ // src/conversation/PageComposer.tsx
503
+ import { useComposerChipSelect, useConversationPage as useConversationPage4 } from "@40rty/ams-sdk";
504
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
505
+ var PAGE_COMPOSER_INPUT_ID = "fourty-page-composer";
506
+ function PageComposer({ placeholder, starters }) {
507
+ const { value, setValue, attachments, dictation, onPaste, canSend, submit } = usePromptComposer();
508
+ const onChipSelect = useComposerChipSelect();
509
+ const { presence } = useConversationPage4();
510
+ const isRunning = presence.running;
511
+ const status = useActivityLine(presence.activity);
512
+ const labels = useLabels().conversation;
513
+ const onKeyDown = (e) => {
514
+ if (e.key === "Enter" && !e.shiftKey) {
515
+ e.preventDefault();
516
+ submit();
517
+ }
518
+ };
519
+ return (
520
+ // It floats over the page: no band behind it, only a soft blur that fades
521
+ // in toward the bottom edge so the page reads under it, and a frosted bar.
522
+ /* @__PURE__ */ jsxs5("div", { className: "relative px-[var(--fourty-canvas-gutter)] pb-5 pt-10", children: [
523
+ /* @__PURE__ */ jsx8("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0 bg-[linear-gradient(to_bottom,transparent,rgb(255_255_255/0.12))] backdrop-blur-[6px] [mask-image:linear-gradient(to_bottom,transparent,black_75%)]" }),
524
+ /* @__PURE__ */ jsxs5("div", { className: "fourty-convo-composer relative mx-auto flex max-w-[920px] flex-col gap-2.5", children: [
525
+ /* @__PURE__ */ jsx8(ComposerChipStrip, { value, starterSuggestions: starters, onStarterClick: setValue, onChipSelect, orientation: "row" }),
526
+ attachments.attachments.length > 0 && /* @__PURE__ */ jsx8(AttachmentStrip, { attachments: attachments.attachments, onRemove: attachments.remove }),
527
+ /* @__PURE__ */ jsx8("div", { className: "flex items-center gap-3 rounded-[var(--fourty-convo-composer-radius)] border border-[rgb(255_255_255/0.6)] bg-[rgb(255_255_255/0.78)] py-2 pl-3.5 pr-2 shadow-[0_12px_40px_rgb(0_0_0/0.18)] backdrop-blur-xl backdrop-saturate-150", children: isRunning ? /* @__PURE__ */ jsxs5(Fragment5, { children: [
528
+ /* @__PURE__ */ jsxs5("span", { "aria-hidden": true, className: "flex flex-none gap-1", children: [
529
+ /* @__PURE__ */ jsx8("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)]" }),
530
+ /* @__PURE__ */ jsx8("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)] [animation-delay:200ms]" }),
531
+ /* @__PURE__ */ jsx8("span", { className: "h-1.5 w-1.5 animate-pulse bg-[var(--fourty-convo-accent)] [animation-delay:400ms]" })
532
+ ] }),
533
+ /* @__PURE__ */ jsx8("span", { className: "relative min-w-0 flex-1 py-2 text-[14.5px] text-[var(--color-text-muted)]", children: /* @__PURE__ */ jsx8(AnimatePresence, { mode: "popLayout", initial: false, children: /* @__PURE__ */ jsx8(motion.span, { className: "block truncate", initial: { opacity: 0, y: 4 }, animate: { opacity: 1, y: 0 }, exit: { opacity: 0, y: -4 }, transition: { duration: 0.3 }, children: status }, status) }) })
534
+ ] }) : /* @__PURE__ */ jsxs5(Fragment5, { children: [
535
+ /* @__PURE__ */ jsx8(AttachButton, { onFiles: attachments.addFiles }),
536
+ /* @__PURE__ */ jsx8(
537
+ "textarea",
538
+ {
539
+ id: PAGE_COMPOSER_INPUT_ID,
540
+ rows: 1,
541
+ value,
542
+ onChange: (e) => setValue(e.target.value),
543
+ onKeyDown,
544
+ onPaste,
545
+ placeholder,
546
+ "aria-label": placeholder,
547
+ className: "min-w-0 flex-1 resize-none border-0 bg-transparent py-2 text-[16px] leading-[1.4] text-[var(--color-text)] outline-none placeholder:text-[var(--color-text-muted)]"
548
+ }
549
+ ),
550
+ /* @__PURE__ */ jsx8(DictationButton, { listening: dictation.listening, supported: dictation.supported, onToggle: dictation.toggle }),
551
+ /* @__PURE__ */ jsx8(
552
+ "button",
553
+ {
554
+ type: "button",
555
+ onClick: submit,
556
+ disabled: !canSend,
557
+ "aria-label": labels.send,
558
+ className: "flex h-10 w-10 flex-none cursor-pointer items-center justify-center rounded-[var(--fourty-chat-send-radius)] border-0 bg-[var(--color-primary)] text-[var(--color-on-dark)] disabled:opacity-40",
559
+ children: /* @__PURE__ */ jsx8("svg", { width: "17", height: "17", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx8("path", { d: "M12 19V5M5 12l7-7 7 7" }) })
560
+ }
561
+ )
562
+ ] }) })
563
+ ] })
564
+ ] })
565
+ );
566
+ }
567
+
568
+ // src/conversation/blocks/blocks.tsx
569
+ import * as React7 from "react";
570
+ import { catalogComponent, useAction } from "@40rty/ams-sdk";
571
+
572
+ // src/conversation/blocks/schemas.ts
573
+ import { z } from "zod";
574
+ import { ProductSchema } from "@40rty/ams-sdk";
575
+ import { resolved, prose } from "@40rty/ams-sdk";
576
+ var option = z.object({
577
+ label: z.string().describe("The answer as the visitor would say it, 1-4 words."),
578
+ hint: z.string().optional().describe("What picking it changes, under 8 words.")
579
+ });
580
+ var guidedPickProps = {
581
+ eyebrow: z.string().optional(),
582
+ question: z.string().describe("ONE question whose answer changes the pick."),
583
+ options: z.array(option).min(2).max(5)
584
+ };
585
+ var verdictProps = {
586
+ product: resolved(ProductSchema, "product", { min: 1, max: 1 }).describe("The one product you would pick."),
587
+ headline: z.string().describe('The pick in one line, e.g. "The 35L is the one."'),
588
+ reasons: z.array(z.string()).min(1).max(4).describe("Why, each tied to what the visitor told you."),
589
+ caveat: z.string().optional().describe("The honest trade-off, if any.")
590
+ };
591
+ var side = z.object({
592
+ label: z.string(),
593
+ points: z.array(z.string()).min(1).max(4)
594
+ });
595
+ var tradeoffProps = {
596
+ title: z.string(),
597
+ left: side,
598
+ right: side,
599
+ lean: z.string().optional().describe("Which side you lean to for THIS visitor, and why, one line."),
600
+ products: resolved(ProductSchema, "product", { min: 1, max: 2 }).optional().describe("Product ids from tool results: the product that shows the left side, then the one that shows the right. Product ids only, never labels.")
601
+ };
602
+ var explainProps = {
603
+ term: z.string().describe('The spec or jargon being explained, e.g. "Flex \xB7 1-10".'),
604
+ definition: prose(z.string()).describe("Plain-language meaning, 1-2 sentences."),
605
+ scale: z.object({
606
+ value: z.number(),
607
+ min: z.number(),
608
+ max: z.number(),
609
+ minLabel: z.string(),
610
+ maxLabel: z.string()
611
+ }).optional().describe("Where the focused product sits on the spec scale."),
612
+ forYou: z.string().optional().describe("What that means for this visitor specifically."),
613
+ products: resolved(ProductSchema, "product", { min: 1, max: 3 }).optional().describe("1-3 product ids from tool results that show this spec. Product ids only, never labels. A guide explainer should always carry them.")
614
+ };
615
+ var shortlistProps = {
616
+ title: z.string(),
617
+ products: resolved(ProductSchema, "product", { min: 1, max: 4 }),
618
+ notes: z.array(z.string()).optional().describe("One short why per product, same order.")
619
+ };
620
+ var factsProps = {
621
+ title: z.string().optional(),
622
+ items: z.array(z.object({ label: z.string(), value: z.string() })).min(1).max(8).describe("Spec facts or what you know about the visitor (level, terrain, budget).")
623
+ };
624
+ var pathsProps = {
625
+ title: z.string().optional(),
626
+ paths: z.array(z.object({ label: z.string(), prompt: z.string().describe("The message sent when clicked.") })).min(2).max(4)
627
+ };
628
+ var noteProps = {
629
+ eyebrow: z.string().optional(),
630
+ text: prose(z.string()).describe("A shop-floor aside, 1-3 sentences.")
631
+ };
632
+
633
+ // src/conversation/blocks/ProductTile.tsx
634
+ import * as React6 from "react";
635
+ import { useHydrationState, useProductCard as useProductCard2 } from "@40rty/ams-sdk";
636
+ import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
637
+ var TileContext = React6.createContext(null);
638
+ function ConversationProvider({ tile, children }) {
639
+ return /* @__PURE__ */ jsx9(TileContext.Provider, { value: tile, children });
640
+ }
641
+ function PlainTile({ product, badge, blurb }) {
642
+ const { primaryImage, priceLabel, onCardClick } = useProductCard2(product);
643
+ return /* @__PURE__ */ jsxs6("button", { type: "button", onClick: onCardClick, className: "flex h-full w-full cursor-pointer flex-col gap-2 border-0 bg-transparent p-0 text-left text-inherit", children: [
644
+ /* @__PURE__ */ jsxs6("span", { className: "relative block aspect-square bg-[var(--fourty-convo-surface)]", children: [
645
+ primaryImage !== void 0 && /* @__PURE__ */ jsx9("img", { src: primaryImage.url, alt: primaryImage.altText, className: "block h-full w-full object-contain p-4" }),
646
+ badge !== void 0 && /* @__PURE__ */ jsx9("span", { className: "absolute left-3 top-3 bg-[var(--fourty-convo-accent)] px-2 py-1 text-xs font-bold text-[var(--fourty-convo-on-accent)]", children: badge })
647
+ ] }),
648
+ /* @__PURE__ */ jsx9("span", { className: "text-base leading-5", children: product.title }),
649
+ blurb !== void 0 && /* @__PURE__ */ jsx9("span", { className: "text-sm leading-5 text-[var(--fourty-convo-muted)]", children: blurb }),
650
+ /* @__PURE__ */ jsx9("span", { className: "text-base", children: priceLabel })
651
+ ] });
652
+ }
653
+ function useReserved(items) {
654
+ const { settled, pendingCount } = useHydrationState();
655
+ if (settled || items.length >= pendingCount) return items;
656
+ const out = [...items];
657
+ while (out.length < pendingCount) out.push(null);
658
+ return out;
659
+ }
660
+ function ProductTile(props) {
661
+ const Tile = React6.useContext(TileContext);
662
+ return /* @__PURE__ */ jsx9("div", { className: "@container h-full", children: Tile === null ? /* @__PURE__ */ jsx9(PlainTile, { ...props }) : /* @__PURE__ */ jsx9(Tile, { ...props }) });
663
+ }
664
+ function TileReserve({ blurb }) {
665
+ return /* @__PURE__ */ jsxs6("div", { "aria-hidden": true, className: "flex h-full flex-col gap-2", children: [
666
+ /* @__PURE__ */ jsx9("div", { className: "aspect-square animate-pulse bg-[var(--fourty-convo-surface)]" }),
667
+ /* @__PURE__ */ jsx9("span", { className: "h-5 w-3/4 animate-pulse bg-[var(--fourty-convo-surface)]" }),
668
+ blurb !== void 0 && /* @__PURE__ */ jsx9("p", { className: "m-0 text-sm leading-5 text-[var(--fourty-convo-muted)]", children: blurb })
669
+ ] });
670
+ }
671
+ function useLanded(reserved) {
672
+ const [landed, setLanded] = React6.useState(false);
673
+ React6.useEffect(() => {
674
+ if (!reserved && !landed) setLanded(true);
675
+ }, [reserved, landed]);
676
+ return landed || !reserved;
677
+ }
678
+
679
+ // src/conversation/blocks/blocks.tsx
680
+ import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
681
+ var PILL = "inline-flex h-12 min-h-12 items-center justify-center whitespace-nowrap rounded-[var(--fourty-convo-radius)] [text-transform:var(--fourty-convo-button-transform)] px-5 text-sm font-medium leading-5 cursor-pointer [transition:background-color_0.3s,color_0.3s,border-color_0.3s,opacity_0.3s]";
682
+ var PILL_SOLID = `${PILL} border border-[var(--fourty-convo-ink)] bg-[var(--fourty-convo-ink)] text-[var(--fourty-convo-sheet)] hover:bg-[var(--fourty-convo-sheet)] hover:text-[var(--fourty-convo-ink)] disabled:cursor-default disabled:opacity-40`;
683
+ var PILL_OUTLINE = `${PILL} border border-current bg-transparent text-current hover:border-[var(--fourty-convo-ink)] hover:bg-[var(--fourty-convo-ink)] hover:text-[var(--fourty-convo-sheet)]`;
684
+ var FEED_GRID = "-mx-8 -mb-8 grid grid-cols-3 gap-px overflow-hidden bg-[var(--fourty-convo-rule)] @max-[900px]:grid-cols-2 @max-[560px]:grid-cols-1 max-[1025px]:-mx-4 max-[1025px]:-mb-4 [&>*]:bg-[var(--fourty-convo-sheet)]";
685
+ var CARD_SKIN = {
686
+ // A tile of the result page's mosaic, its edges the page's hairlines.
687
+ plain: "bg-[var(--fourty-convo-sheet)] text-[var(--fourty-convo-ink)]",
688
+ // The brand's editorial panels: a highlight (a note) and its accent (where next).
689
+ highlight: "bg-[var(--fourty-convo-highlight)] text-[var(--fourty-convo-on-highlight)]",
690
+ accent: "bg-[var(--fourty-convo-accent)] text-[var(--fourty-convo-on-accent)]"
691
+ };
692
+ function Card({ children, tone = "plain" }) {
693
+ return /* @__PURE__ */ jsx10("div", { className: `@container box-border flex h-full flex-col gap-4 p-8 max-[1025px]:p-4 ${CARD_SKIN[tone]}`, children });
694
+ }
695
+ function Eyebrow({ children }) {
696
+ return /* @__PURE__ */ jsx10("p", { className: "m-0 text-sm font-medium leading-5 opacity-60", children });
697
+ }
698
+ function Title({ children }) {
699
+ return /* @__PURE__ */ jsx10("h3", { className: "m-0 text-2xl font-bold leading-7 @[560px]:text-[2rem] @[560px]:leading-[2.1875rem]", children });
700
+ }
701
+ function AskChip({ label, text }) {
702
+ const action = React7.useMemo(() => ({ id: `ask-${label}`, type: "message", payload: { text } }), [label, text]);
703
+ const onClick = useAction(label, action);
704
+ return /* @__PURE__ */ jsx10("button", { type: "button", onClick: onClick !== null ? onClick : void 0, className: PILL_OUTLINE, children: label });
705
+ }
706
+ var arr = (v) => Array.isArray(v) ? v : [];
707
+ function GuidedPick(p) {
708
+ return /* @__PURE__ */ jsxs7(Card, { children: [
709
+ p.eyebrow !== void 0 && /* @__PURE__ */ jsx10(Eyebrow, { children: p.eyebrow }),
710
+ /* @__PURE__ */ jsx10(Title, { children: p.question }),
711
+ /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap gap-2", children: arr(p.options).map((o) => /* @__PURE__ */ jsx10(AskChip, { label: o.hint !== void 0 ? `${o.label} \u2014 ${o.hint}` : o.label, text: o.label }, o.label)) })
712
+ ] });
713
+ }
714
+ function Paths(p) {
715
+ const labels = useLabels().conversation;
716
+ return /* @__PURE__ */ jsxs7(Card, { tone: "accent", children: [
717
+ /* @__PURE__ */ jsx10(Title, { children: p.title !== void 0 ? p.title : labels.pathsTitle }),
718
+ /* @__PURE__ */ jsx10("div", { className: "flex flex-wrap gap-2", children: arr(p.paths).map((x) => /* @__PURE__ */ jsx10(AskChip, { label: x.label, text: x.prompt }, x.label)) })
719
+ ] });
720
+ }
721
+ function Note(p) {
722
+ const labels = useLabels().conversation;
723
+ return /* @__PURE__ */ jsxs7(Card, { tone: "highlight", children: [
724
+ /* @__PURE__ */ jsx10(Eyebrow, { children: p.eyebrow !== void 0 ? p.eyebrow : labels.noteEyebrow }),
725
+ /* @__PURE__ */ jsx10("div", { className: "text-2xl font-bold leading-7 @[560px]:text-[2rem] @[560px]:leading-[2.1875rem]", children: p.text })
726
+ ] });
727
+ }
728
+ function Facts2(p) {
729
+ return /* @__PURE__ */ jsxs7(Card, { children: [
730
+ p.title !== void 0 && /* @__PURE__ */ jsx10(Eyebrow, { children: p.title }),
731
+ /* @__PURE__ */ jsx10("dl", { className: "m-0 grid grid-cols-2 gap-x-4 gap-y-3", children: arr(p.items).map((f) => /* @__PURE__ */ jsxs7("div", { className: "min-w-0", children: [
732
+ /* @__PURE__ */ jsx10("dt", { className: "text-sm leading-5 text-[var(--fourty-convo-muted)]", children: f.label }),
733
+ /* @__PURE__ */ jsx10("dd", { className: "m-0 text-base font-bold leading-6", children: f.value })
734
+ ] }, f.label)) })
735
+ ] });
736
+ }
737
+ function Explain(p) {
738
+ const labels = useLabels().conversation;
739
+ const products = useReserved(arr(p.products));
740
+ const s = p.scale;
741
+ const pct = s !== void 0 && s.max > s.min ? (s.value - s.min) / (s.max - s.min) * 100 : null;
742
+ return /* @__PURE__ */ jsxs7(Card, { children: [
743
+ /* @__PURE__ */ jsx10(Title, { children: p.term }),
744
+ /* @__PURE__ */ jsx10("div", { className: "text-base leading-[1.375rem] text-[var(--fourty-convo-muted)]", children: p.definition }),
745
+ s !== void 0 && pct !== null && /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1", children: [
746
+ /* @__PURE__ */ jsxs7("div", { className: "relative h-2 rounded-full bg-[var(--fourty-convo-surface)]", children: [
747
+ /* @__PURE__ */ jsx10("div", { className: "absolute inset-y-0 left-0 rounded-full bg-[var(--fourty-convo-ink)]", style: { width: `${pct}%` } }),
748
+ /* @__PURE__ */ jsx10(
749
+ "div",
750
+ {
751
+ className: "absolute top-1/2 h-5 w-5 -translate-y-1/2 -translate-x-1/2 rounded-full border-2 border-[var(--fourty-convo-ink)] bg-[var(--fourty-convo-sheet)]",
752
+ style: { left: `${pct}%` }
753
+ }
754
+ )
755
+ ] }),
756
+ /* @__PURE__ */ jsxs7("div", { className: "flex justify-between text-sm leading-5 text-[var(--fourty-convo-muted)]", children: [
757
+ /* @__PURE__ */ jsx10("span", { children: s.minLabel }),
758
+ /* @__PURE__ */ jsx10("span", { children: s.value }),
759
+ /* @__PURE__ */ jsx10("span", { children: s.maxLabel })
760
+ ] })
761
+ ] }),
762
+ p.forYou !== void 0 && /* @__PURE__ */ jsx10("p", { className: "m-0 text-base font-bold leading-6", children: p.forYou }),
763
+ products.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "mt-2 flex flex-col gap-3 pt-2", children: [
764
+ /* @__PURE__ */ jsx10(Eyebrow, { children: labels.explainProducts }),
765
+ /* @__PURE__ */ jsx10("div", { className: "grid grid-cols-3 gap-4", children: products.map((prod, i) => prod === null ? /* @__PURE__ */ jsx10(TileReserve, {}, `reserve-${i}`) : /* @__PURE__ */ jsx10(ProductTile, { product: prod }, prod.id)) })
766
+ ] })
767
+ ] });
768
+ }
769
+ var guidedPick = catalogComponent(
770
+ {
771
+ type: "guidedPick",
772
+ props: guidedPickProps,
773
+ layout: "section",
774
+ size: "full",
775
+ examples: [{ eyebrow: "Step 1 of 2", question: "<the one question whose answer changes the pick>", options: [{ label: "<answer A>", hint: "<what it changes>" }, { label: "<answer B>" }] }]
776
+ },
777
+ GuidedPick
778
+ );
779
+ var paths = catalogComponent(
780
+ {
781
+ type: "paths",
782
+ props: pathsProps,
783
+ layout: "section",
784
+ size: "full",
785
+ examples: [{ title: "Where next", paths: [{ label: "<next step A>", prompt: "<message sent>" }, { label: "<next step B>", prompt: "<message sent>" }] }]
786
+ },
787
+ Paths
788
+ );
789
+ var note = catalogComponent(
790
+ {
791
+ type: "note",
792
+ props: noteProps,
793
+ layout: "section",
794
+ size: "half",
795
+ extendsPage: true,
796
+ examples: [{ text: "<an aside from the floor, 1-3 sentences>" }]
797
+ },
798
+ Note
799
+ );
800
+ var facts = catalogComponent(
801
+ {
802
+ type: "facts",
803
+ props: factsProps,
804
+ layout: "section",
805
+ size: "narrow",
806
+ extendsPage: true,
807
+ examples: [{ title: "What I know so far", items: [{ label: "<fact>", value: "<value>" }, { label: "<fact>", value: "<value>" }] }]
808
+ },
809
+ Facts2
810
+ );
811
+ var explain = catalogComponent(
812
+ {
813
+ type: "explain",
814
+ props: explainProps,
815
+ layout: "section",
816
+ size: "half",
817
+ extendsPage: true,
818
+ examples: [{ term: "<spec \xB7 scale>", definition: "<what it means, plainly>", scale: { value: 4, min: 1, max: 10, minLabel: "<low end>", maxLabel: "<high end>" }, forYou: "<what it means for them>", products: ["gid://shopify/Product/<id-1>", "gid://shopify/Product/<id-2>"] }]
819
+ },
820
+ Explain
821
+ );
822
+
823
+ // src/conversation/blocks/product-blocks.tsx
824
+ import * as React8 from "react";
825
+ import { ItemTransitionGroup } from "@40rty/ams-sdk";
826
+ import { catalogComponent as catalogComponent2 } from "@40rty/ams-sdk";
827
+ import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
828
+ var arr2 = (v) => Array.isArray(v) ? v : [];
829
+ function Verdict(p) {
830
+ const labels = useLabels().conversation;
831
+ const [pick] = useReserved(p.product !== void 0 ? [p.product] : []);
832
+ return /* @__PURE__ */ jsxs8(Card, { children: [
833
+ /* @__PURE__ */ jsx11(Eyebrow, { children: labels.verdict }),
834
+ /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-1 items-start gap-8 @[640px]:grid-cols-[minmax(0,2fr)_minmax(0,3fr)]", children: [
835
+ pick === void 0 ? /* @__PURE__ */ jsx11("div", {}) : pick === null ? /* @__PURE__ */ jsx11(TileReserve, {}) : /* @__PURE__ */ jsx11(ProductTile, { product: pick, badge: labels.ourPick }),
836
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-3", children: [
837
+ /* @__PURE__ */ jsx11(Title, { children: p.headline }),
838
+ /* @__PURE__ */ jsx11("ul", { className: "m-0 flex list-none flex-col p-0", children: arr2(p.reasons).map((r) => /* @__PURE__ */ jsx11("li", { className: "py-1.5 text-base leading-[1.375rem] first:pt-0", children: r }, r)) }),
839
+ p.caveat !== void 0 && /* @__PURE__ */ jsx11("p", { className: "m-0 text-sm leading-5 text-[var(--fourty-convo-muted)]", children: labels.tradeoffCaveat(p.caveat) })
840
+ ] })
841
+ ] })
842
+ ] });
843
+ }
844
+ function Shortlist(p) {
845
+ const notes = arr2(p.notes);
846
+ const products = useReserved(arr2(p.products));
847
+ const landed = useLanded(products.some((x) => x === null));
848
+ return /* @__PURE__ */ jsxs8(Card, { children: [
849
+ /* @__PURE__ */ jsx11(Title, { children: p.title }),
850
+ !landed ? /* @__PURE__ */ jsx11("div", { className: FEED_GRID, children: products.map((prod, i) => /* @__PURE__ */ jsx11(React8.Fragment, { children: prod === null ? /* @__PURE__ */ jsx11(TileReserve, { blurb: i < notes.length ? notes[i] : void 0 }) : /* @__PURE__ */ jsx11(ProductTile, { product: prod, blurb: i < notes.length ? notes[i] : void 0 }) }, prod === null ? `reserve-${i}` : prod.id)) }) : /* @__PURE__ */ jsx11(ItemTransitionGroup, { className: FEED_GRID, items: arr2(p.products), getId: (prod) => prod.id, children: (prod) => {
851
+ const i = arr2(p.products).indexOf(prod);
852
+ return /* @__PURE__ */ jsx11(ProductTile, { product: prod, blurb: i >= 0 && i < notes.length ? notes[i] : void 0 });
853
+ } })
854
+ ] });
855
+ }
856
+ function SideCol({ side: side2, product }) {
857
+ if (side2 === void 0) return /* @__PURE__ */ jsx11("div", {});
858
+ return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-2 min-w-0", children: [
859
+ product === null ? /* @__PURE__ */ jsx11(TileReserve, {}) : product !== void 0 && /* @__PURE__ */ jsx11(ProductTile, { product }),
860
+ /* @__PURE__ */ jsx11("p", { className: "m-0 mt-2 text-xl font-bold leading-[1.625rem]", children: side2.label }),
861
+ /* @__PURE__ */ jsx11("ul", { className: "m-0 flex flex-col gap-1 pl-4 text-base leading-[1.375rem] text-[var(--fourty-convo-muted)]", children: arr2(side2.points).map((pt) => /* @__PURE__ */ jsx11("li", { children: pt }, pt)) })
862
+ ] });
863
+ }
864
+ function Tradeoff(p) {
865
+ const labels = useLabels().conversation;
866
+ const products = useReserved(arr2(p.products));
867
+ return /* @__PURE__ */ jsxs8(Card, { children: [
868
+ /* @__PURE__ */ jsx11(Eyebrow, { children: labels.tradeoff }),
869
+ /* @__PURE__ */ jsx11(Title, { children: p.title }),
870
+ /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-2 gap-6", children: [
871
+ /* @__PURE__ */ jsx11(SideCol, { side: p.left, product: products.length > 0 ? products[0] : void 0 }),
872
+ /* @__PURE__ */ jsx11(SideCol, { side: p.right, product: products.length > 1 ? products[1] : void 0 })
873
+ ] }),
874
+ p.lean !== void 0 && /* @__PURE__ */ jsx11("p", { className: "m-0 pt-2 text-base font-bold leading-6", children: p.lean })
875
+ ] });
876
+ }
877
+ var verdict = catalogComponent2(
878
+ {
879
+ type: "verdict",
880
+ props: verdictProps,
881
+ layout: "section",
882
+ size: "narrow",
883
+ examples: [{ product: "gid://shopify/Product/<id>", headline: "<the pick in one line>", reasons: ["<why, tied to what they said>", "<why>"], caveat: "<the honest trade-off>" }]
884
+ },
885
+ Verdict
886
+ );
887
+ var shortlist = catalogComponent2(
888
+ {
889
+ type: "shortlist",
890
+ props: shortlistProps,
891
+ layout: "section",
892
+ size: "wide",
893
+ examples: [{ title: "Your shortlist", products: ["gid://shopify/Product/<id-1>", "gid://shopify/Product/<id-2>"], notes: ["<one short why>", "<one short why>"] }]
894
+ },
895
+ Shortlist
896
+ );
897
+ var tradeoff = catalogComponent2(
898
+ {
899
+ type: "tradeoff",
900
+ props: tradeoffProps,
901
+ layout: "section",
902
+ size: "half",
903
+ examples: [{ title: "<A or B?>", left: { label: "<A>", points: ["<what A gives>"] }, right: { label: "<B>", points: ["<what B gives>"] }, lean: "<which, for them>", products: ["gid://shopify/Product/<id-a>", "gid://shopify/Product/<id-b>"] }]
904
+ },
905
+ Tradeoff
906
+ );
907
+
908
+ // src/conversation/blocks/index.ts
909
+ var conversationBlocks = [guidedPick, paths, note, facts, explain, verdict, shortlist, tradeoff];
910
+ export {
911
+ BentoSkeleton,
912
+ Card,
913
+ ClosingQuestion,
914
+ ConversationCanvas,
915
+ ConversationProvider,
916
+ Eyebrow,
917
+ FEED_GRID,
918
+ Facts,
919
+ PAGE_COMPOSER_INPUT_ID,
920
+ PILL_OUTLINE,
921
+ PILL_SOLID,
922
+ PageComposer,
923
+ ProductTile,
924
+ ResultSheet,
925
+ Rich,
926
+ RisingWords,
927
+ ThinkingBand,
928
+ TileReserve,
929
+ Title,
930
+ TurnCanvas,
931
+ TurnHeader,
932
+ conversationBlocks,
933
+ crumbLabel,
934
+ explain,
935
+ facts,
936
+ guidedPick,
937
+ note,
938
+ paths,
939
+ productNamed,
940
+ shortlist,
941
+ tradeoff,
942
+ useActivityLine,
943
+ useLanded,
944
+ usePageProducts,
945
+ useReserved,
946
+ verdict
947
+ };