@aparte/n8n-chat 1.0.2 → 1.1.0

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 (66) hide show
  1. package/README.md +24 -3
  2. package/dist/cdn/chunks/{chunk-LGVX5DQP.js → chunk-3ZPEJRUN.js} +2 -2
  3. package/dist/cdn/chunks/{chunk-LGVX5DQP.js.map → chunk-3ZPEJRUN.js.map} +1 -1
  4. package/dist/cdn/chunks/{chunk-PPDOW5CO.js → chunk-HR2ND5EK.js} +2 -2
  5. package/dist/cdn/chunks/{chunk-PPDOW5CO.js.map → chunk-HR2ND5EK.js.map} +1 -1
  6. package/dist/cdn/chunks/{chunk-HASLYSSG.js → chunk-KXLJFCTW.js} +2 -2
  7. package/dist/cdn/chunks/{chunk-HASLYSSG.js.map → chunk-KXLJFCTW.js.map} +1 -1
  8. package/dist/cdn/chunks/{chunk-4MZPEZPE.js → chunk-QGJMBP66.js} +30 -30
  9. package/dist/cdn/chunks/chunk-QGJMBP66.js.map +7 -0
  10. package/dist/cdn/chunks/{chunk-XY3GEFGN.js → chunk-QLQPHZ4I.js} +2 -2
  11. package/dist/cdn/chunks/{chunk-XY3GEFGN.js.map → chunk-QLQPHZ4I.js.map} +1 -1
  12. package/dist/cdn/chunks/{chunk-KPADIE5S.js → chunk-Z3UL76XU.js} +1 -1
  13. package/dist/cdn/chunks/{chunk-KPADIE5S.js.map → chunk-Z3UL76XU.js.map} +1 -1
  14. package/dist/cdn/chunks/{de-VHSIFTGU.js → de-SOZWA4P4.js} +2 -2
  15. package/dist/cdn/chunks/{de-VHSIFTGU.js.map → de-SOZWA4P4.js.map} +3 -3
  16. package/dist/cdn/chunks/{es-CSDZBDZK.js → es-WUHNDTG7.js} +2 -2
  17. package/dist/cdn/chunks/{es-CSDZBDZK.js.map → es-WUHNDTG7.js.map} +3 -3
  18. package/dist/cdn/chunks/{fr-A7LKKK4U.js → fr-QOUVY5FA.js} +2 -2
  19. package/dist/cdn/chunks/{fr-A7LKKK4U.js.map → fr-QOUVY5FA.js.map} +3 -3
  20. package/dist/cdn/chunks/{highlight-KR6IJJGG.js → highlight-ZJAA24RG.js} +2 -2
  21. package/dist/cdn/chunks/{highlight-KR6IJJGG.js.map → highlight-ZJAA24RG.js.map} +1 -1
  22. package/dist/cdn/chunks/{it-4UDH2XVX.js → it-JOAAJHQH.js} +2 -2
  23. package/dist/cdn/chunks/{it-4UDH2XVX.js.map → it-JOAAJHQH.js.map} +3 -3
  24. package/dist/cdn/chunks/{items-FFNVAESC.js → items-6EVOWL4Q.js} +2 -2
  25. package/dist/cdn/chunks/{items-FFNVAESC.js.map → items-6EVOWL4Q.js.map} +1 -1
  26. package/dist/cdn/chunks/{ja-5FMFPBXT.js → ja-VUZC7PKR.js} +2 -2
  27. package/dist/cdn/chunks/{ja-5FMFPBXT.js.map → ja-VUZC7PKR.js.map} +3 -3
  28. package/dist/cdn/chunks/{ko-KXXFK5U7.js → ko-O3YDRWQK.js} +2 -2
  29. package/dist/cdn/chunks/{ko-KXXFK5U7.js.map → ko-O3YDRWQK.js.map} +3 -3
  30. package/dist/cdn/chunks/{link-3AMG5PIK.js → link-77UEHUXF.js} +2 -2
  31. package/dist/cdn/chunks/{link-3AMG5PIK.js.map → link-77UEHUXF.js.map} +1 -1
  32. package/dist/cdn/chunks/{media-F3HYZLYR.js → media-PN3A7I2Y.js} +2 -2
  33. package/dist/cdn/chunks/{media-F3HYZLYR.js.map → media-PN3A7I2Y.js.map} +1 -1
  34. package/dist/cdn/chunks/{order-L6GKT5I6.js → order-PC45M52X.js} +2 -2
  35. package/dist/cdn/chunks/{order-L6GKT5I6.js.map → order-PC45M52X.js.map} +1 -1
  36. package/dist/cdn/chunks/{place-J7BDZGKL.js → place-HVNXQ2XT.js} +2 -2
  37. package/dist/cdn/chunks/{place-J7BDZGKL.js.map → place-HVNXQ2XT.js.map} +1 -1
  38. package/dist/cdn/chunks/{plan-BAI6GY4A.js → plan-VVVGWRRY.js} +2 -2
  39. package/dist/cdn/chunks/{plan-BAI6GY4A.js.map → plan-VVVGWRRY.js.map} +1 -1
  40. package/dist/cdn/chunks/{product-VOKQKP4K.js → product-344AZESV.js} +2 -2
  41. package/dist/cdn/chunks/{product-VOKQKP4K.js.map → product-344AZESV.js.map} +1 -1
  42. package/dist/cdn/chunks/{pt-BR-T2PIW5LH.js → pt-BR-VRSALGOW.js} +2 -2
  43. package/dist/cdn/chunks/{pt-BR-T2PIW5LH.js.map → pt-BR-VRSALGOW.js.map} +3 -3
  44. package/dist/cdn/chunks/{ru-CWHLBHXX.js → ru-QHPM4IVN.js} +2 -2
  45. package/dist/cdn/chunks/{ru-CWHLBHXX.js.map → ru-QHPM4IVN.js.map} +3 -3
  46. package/dist/cdn/chunks/{score-IPBHXWWN.js → score-3VE4ZDCR.js} +2 -2
  47. package/dist/cdn/chunks/{score-IPBHXWWN.js.map → score-3VE4ZDCR.js.map} +1 -1
  48. package/dist/cdn/chunks/{stats-V6H3J3WL.js → stats-A6ATSHOO.js} +2 -2
  49. package/dist/cdn/chunks/{stats-V6H3J3WL.js.map → stats-A6ATSHOO.js.map} +1 -1
  50. package/dist/cdn/chunks/{stock-UNSEZYGA.js → stock-KPAFYPNA.js} +2 -2
  51. package/dist/cdn/chunks/{stock-UNSEZYGA.js.map → stock-KPAFYPNA.js.map} +1 -1
  52. package/dist/cdn/chunks/{weather-4IMAIRYF.js → weather-OHQUZ3YG.js} +2 -2
  53. package/dist/cdn/chunks/{weather-4IMAIRYF.js.map → weather-OHQUZ3YG.js.map} +1 -1
  54. package/dist/cdn/chunks/{zh-CN-UEBLECMR.js → zh-CN-U7Y6ABLD.js} +2 -2
  55. package/dist/cdn/chunks/{zh-CN-UEBLECMR.js.map → zh-CN-U7Y6ABLD.js.map} +3 -3
  56. package/dist/cdn/latest.js +4 -4
  57. package/dist/cdn/n8n-chat.js +42 -42
  58. package/dist/cdn/n8n-chat.js.map +4 -4
  59. package/dist/create-chat.d.ts +18 -1
  60. package/dist/index.js +40 -26
  61. package/dist/index.js.map +1 -1
  62. package/dist/strings.d.ts +3 -1
  63. package/dist/style.css +65 -13
  64. package/dist/theme.css +64 -12
  65. package/package.json +7 -7
  66. package/dist/cdn/chunks/chunk-4MZPEZPE.js.map +0 -7
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../node_modules/.pnpm/@aparte+plugin-cards@1.1.2_@aparte+core@1.1.2/node_modules/@aparte/plugin-cards/src/link/icons.ts", "../../../node_modules/.pnpm/@aparte+plugin-cards@1.1.2_@aparte+core@1.1.2/node_modules/@aparte/plugin-cards/src/link/link.css", "../../../node_modules/.pnpm/@aparte+plugin-cards@1.1.2_@aparte+core@1.1.2/node_modules/@aparte/plugin-cards/src/link/index.ts"],
3
+ "sources": ["../../../node_modules/.pnpm/@aparte+plugin-cards@1.3.0_@aparte+core@1.3.0/node_modules/@aparte/plugin-cards/src/link/icons.ts", "../../../node_modules/.pnpm/@aparte+plugin-cards@1.3.0_@aparte+core@1.3.0/node_modules/@aparte/plugin-cards/src/link/link.css", "../../../node_modules/.pnpm/@aparte+plugin-cards@1.3.0_@aparte+core@1.3.0/node_modules/@aparte/plugin-cards/src/link/index.ts"],
4
4
  "sourcesContent": ["/**\n * The link card's glyphs: the chain that names the card, one small badge per kind of page\n * (an article, a video, a code repository, a product), and the play disc a video's preview\n * wears.\n *\n * Drawn on a 24 × 24 grid in `currentColor`, so the sheet colours them through `color` and\n * a theme follows. Constants of this package — the only markup the card parses.\n */\nimport type { LinkType } from './index.js';\n\nconst svg = (body: string) =>\n `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.7\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">${body}</svg>`; // safe-text: this package's own SVG, built from its glyph constants\n\n/** Two links of a chain: a link, and the card's one-line state glyph. */\nexport const CHAIN = svg('<path d=\"M10 14a4.2 4.2 0 0 0 6 0l3-3a4.2 4.2 0 0 0-6-6l-1 1\"/><path d=\"M14 10a4.2 4.2 0 0 0-6 0l-3 3a4.2 4.2 0 0 0 6 6l1-1\"/>');\n\n/** The play triangle, filled: it sits on a disc over a video's preview. */\nexport const PLAY = '<svg viewBox=\"0 0 24 24\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8.5 5.6v12.8a1 1 0 0 0 1.5.86l10.2-6.4a1 1 0 0 0 0-1.72L10 4.74a1 1 0 0 0-1.5.86z\"/></svg>';\n\nconst TYPE_GLYPHS: Record<Exclude<LinkType, 'website'>, string> = {\n // A page of lines.\n article: svg('<path d=\"M6.5 3.5h8l3.5 3.5v12.5a1 1 0 0 1-1 1H6.5a1 1 0 0 1-1-1v-15a1 1 0 0 1 1-1z\"/><path d=\"M14 3.5V7h4M8.5 11.5h7M8.5 14.5h7M8.5 17.5h4.5\"/>'),\n // A screen with the triangle.\n video: svg('<rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"3\"/><path d=\"m10.2 9.4 4.4 2.6-4.4 2.6z\"/>'),\n // A branch: two commits and the line between them.\n repo: svg('<circle cx=\"7\" cy=\"6\" r=\"2\"/><circle cx=\"7\" cy=\"18\" r=\"2\"/><circle cx=\"17\" cy=\"8\" r=\"2\"/><path d=\"M7 8v8M17 10c0 3.5-4 3.5-8.5 6.5\"/>'),\n // A price tag.\n product: svg('<path d=\"M3.8 12.6 11.4 5a2 2 0 0 1 1.4-.6h5.3a1.5 1.5 0 0 1 1.5 1.5v5.3a2 2 0 0 1-.6 1.4l-7.6 7.6a1.5 1.5 0 0 1-2.1 0l-5.5-5.5a1.5 1.5 0 0 1 0-2.1z\"/><circle cx=\"15.6\" cy=\"8.4\" r=\"1.3\"/>'),\n};\n\n/** The badge glyph for a kind of page; a plain website has none. */\nexport function typeGlyph(type: Exclude<LinkType, 'website'>): string {\n return TYPE_GLYPHS[type];\n}\n", "export default \"/* =========================================\\n The link card — @aparte/plugin-cards/link\\n =========================================\\n Three variants of one card, chosen by `data-variant` on its root:\\n card the page's picture on top (16:9), its site line (icon, name, author, date,\\n kind), the title on two lines, the description on three. The whole card is\\n the link. Several links are stacked rows, as in `compact`.\\n compact one row: the site's mark with its kind in the corner, the title, the site and\\n the date, the picture as a small square at the end.\\n quote the block chat apps draw under an unfurled link: a coloured rule down its\\n side, the site, the title, the description, the author and date, the picture\\n beside it when there is room, under it when there is not.\\n Every colour is a core token or a `--aparte-link-preview-*` one here: six hues a site's initial\\n and a quote's rule are drawn in (picked from the host, so one site keeps its colour), and\\n the accent a page's own `theme-color` replaces. The block is `aparte-link-preview`, not\\n `aparte-link`: that name is core's text-link recipe, and wearing it would repaint every\\n card as one underlined link.\\n */\\n\\n.aparte-link-card {\\n --aparte-link-preview-hue-0: #2f6fdf;\\n --aparte-link-preview-hue-1: #d6336c;\\n --aparte-link-preview-hue-2: #2f9e44;\\n --aparte-link-preview-hue-3: #e8710a;\\n --aparte-link-preview-hue-4: #7048e8;\\n --aparte-link-preview-hue-5: #0c9488;\\n --aparte-link-preview-media-ratio: 16 / 9;\\n --aparte-link-preview-thumb-size: 3.25rem;\\n --aparte-link-preview-rule-width: 4px;\\n}\\n\\n.aparte-link-card[data-variant=\\\"card\\\"]:has(> .aparte-link-preview--card) { --aparte-rich-card-max-inline-size: 22rem; }\\n.aparte-link-card[data-variant=\\\"quote\\\"] { --aparte-rich-card-max-inline-size: 30rem; }\\n\\n/* A quote draws its own block, so the card around it steps back. */\\n.aparte-link-card[data-variant=\\\"quote\\\"]:is([data-state=\\\"ready\\\"], [data-state=\\\"loading\\\"]) {\\n overflow: visible;\\n border-color: transparent;\\n background: transparent;\\n}\\n\\n/* Each tint reads its hue once; everything inside says `--aparte-link-preview-hue`. */\\n.aparte-link-card [data-hue=\\\"0\\\"] { --aparte-link-preview-hue: var(--aparte-link-preview-hue-0); }\\n.aparte-link-card [data-hue=\\\"1\\\"] { --aparte-link-preview-hue: var(--aparte-link-preview-hue-1); }\\n.aparte-link-card [data-hue=\\\"2\\\"] { --aparte-link-preview-hue: var(--aparte-link-preview-hue-2); }\\n.aparte-link-card [data-hue=\\\"3\\\"] { --aparte-link-preview-hue: var(--aparte-link-preview-hue-3); }\\n.aparte-link-card [data-hue=\\\"4\\\"] { --aparte-link-preview-hue: var(--aparte-link-preview-hue-4); }\\n.aparte-link-card [data-hue=\\\"5\\\"] { --aparte-link-preview-hue: var(--aparte-link-preview-hue-5); }\\n\\n/* ── What every variant shares ───────────────────────────────────────── */\\n\\n.aparte-link-preview {\\n position: relative;\\n display: flex;\\n min-inline-size: 0;\\n color: var(--aparte-text);\\n}\\n\\n.aparte-link-preview__dot {\\n flex: none;\\n color: var(--aparte-text-muted);\\n opacity: 0.7;\\n}\\n\\n.aparte-link-preview__title {\\n font-size: var(--aparte-font-size-base);\\n font-weight: var(--aparte-font-weight-semibold);\\n letter-spacing: -0.005em;\\n line-height: 1.3;\\n overflow-wrap: anywhere;\\n}\\n\\n.aparte-link-preview__anchor {\\n color: inherit;\\n text-decoration: none;\\n border-radius: var(--aparte-radius-xs);\\n}\\n\\n/* The title's link covers its whole card, row or block: one target, one name. The ring is\\n then drawn around the target, inset, because the card clips what passes its edge. */\\n.aparte-link-preview__anchor::after {\\n content: \\\"\\\";\\n position: absolute;\\n inset: 0;\\n z-index: 2;\\n border-radius: inherit;\\n}\\n\\n.aparte-link-preview__anchor:focus-visible { outline: none; }\\n\\n.aparte-link-preview__anchor:focus-visible::after {\\n outline: var(--aparte-focus-outline-width) solid var(--aparte-border-focus);\\n outline-offset: calc(var(--aparte-focus-outline-width) * -1);\\n}\\n\\n.aparte-link-preview:hover .aparte-link-preview__anchor {\\n text-decoration: underline;\\n text-decoration-thickness: 1px;\\n text-underline-offset: 0.18em;\\n}\\n\\n.aparte-link-preview__description {\\n display: -webkit-box;\\n margin: 0;\\n overflow: hidden;\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-md);\\n line-height: 1.45;\\n overflow-wrap: anywhere;\\n -webkit-box-orient: vertical;\\n -webkit-line-clamp: 3;\\n}\\n\\n/* The site line: its mark, its name, who wrote it, when — and the kind of page at the end. */\\n.aparte-link-preview__site {\\n display: flex;\\n align-items: center;\\n gap: var(--aparte-space-3);\\n min-inline-size: 0;\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-sm);\\n}\\n\\n.aparte-link-preview__site-text,\\n.aparte-link-preview__meta,\\n.aparte-link-preview__byline {\\n display: flex;\\n align-items: center;\\n gap: var(--aparte-space-2);\\n min-inline-size: 0;\\n overflow: hidden;\\n white-space: nowrap;\\n}\\n\\n.aparte-link-preview__site-name {\\n overflow: hidden;\\n color: var(--aparte-text);\\n font-weight: var(--aparte-font-weight-medium);\\n text-overflow: ellipsis;\\n}\\n\\n.aparte-link-preview__author {\\n overflow: hidden;\\n text-overflow: ellipsis;\\n}\\n\\n.aparte-link-preview__date { flex: none; }\\n\\n/* ── The site's mark: its icon over its initial on a tint ────────────── */\\n\\n.aparte-link-preview__icon {\\n position: relative;\\n display: inline-grid;\\n flex: none;\\n place-items: center;\\n overflow: hidden;\\n border-radius: var(--aparte-radius-sm);\\n background: color-mix(in oklab, var(--aparte-link-preview-hue) 16%, var(--aparte-surface-1));\\n /* The hue, pulled toward the text: readable on the tint in either theme. */\\n color: color-mix(in oklab, var(--aparte-link-preview-hue) 72%, var(--aparte-text));\\n font-weight: var(--aparte-font-weight-bold, 700);\\n line-height: 1;\\n}\\n\\n.aparte-link-preview__icon--sm {\\n inline-size: 1.125rem;\\n block-size: 1.125rem;\\n font-size: 0.625rem;\\n}\\n\\n.aparte-link-preview__icon--lg {\\n inline-size: 2.5rem;\\n block-size: 2.5rem;\\n border-radius: var(--aparte-radius-md);\\n font-size: var(--aparte-font-size-base);\\n}\\n\\n/* An icon of its own sits on the card's ground, not on the tint; the initial stays behind it. */\\n.aparte-link-preview__icon[data-favicon] {\\n background: var(--aparte-surface-1);\\n box-shadow: inset 0 0 0 var(--aparte-border-width) var(--aparte-border);\\n}\\n\\n.aparte-link-preview__favicon {\\n position: absolute;\\n inset: 0;\\n inline-size: 100%;\\n block-size: 100%;\\n object-fit: contain;\\n background: var(--aparte-surface-1);\\n}\\n\\n.aparte-link-preview__icon--lg > .aparte-link-preview__favicon { padding: 0.4rem; }\\n\\n/* ── The kind of page ────────────────────────────────────────────────── */\\n\\n.aparte-link-preview__type {\\n display: inline-flex;\\n flex: none;\\n align-items: center;\\n gap: var(--aparte-space-1);\\n margin-inline-start: auto;\\n padding: var(--aparte-space-1) var(--aparte-space-3) var(--aparte-space-1) var(--aparte-space-2);\\n border-radius: var(--aparte-radius-full);\\n background: color-mix(in oklab, var(--aparte-text) 6%, transparent);\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-xs);\\n font-weight: var(--aparte-font-weight-medium);\\n line-height: 1.3;\\n}\\n\\n.aparte-link-preview__type-glyph { --aparte-rich-card-glyph-size: 0.85rem; }\\n\\n/* ── card ────────────────────────────────────────────────────────────── */\\n\\n.aparte-link-preview--card {\\n flex-direction: column;\\n transition: background-color var(--aparte-duration-fast, 0.12s) ease;\\n}\\n\\n.aparte-link-preview__media {\\n position: relative;\\n aspect-ratio: var(--aparte-link-preview-media-ratio);\\n overflow: hidden;\\n border-block-end: var(--aparte-border-width) solid var(--aparte-border);\\n background: var(--aparte-surface-2);\\n}\\n\\n.aparte-link-preview__img {\\n display: block;\\n inline-size: 100%;\\n block-size: 100%;\\n object-fit: cover;\\n transition: transform var(--aparte-duration-slower, 0.3s) ease;\\n}\\n\\n.aparte-link-preview--card:hover .aparte-link-preview__media > .aparte-link-preview__img { transform: scale(1.03); }\\n\\n/* A video page: the play disc over its picture. */\\n.aparte-link-preview__play {\\n position: absolute;\\n inset-block-start: 50%;\\n inset-inline-start: 50%;\\n display: grid;\\n place-items: center;\\n inline-size: 3.25rem;\\n block-size: 3.25rem;\\n border-radius: var(--aparte-radius-full);\\n background: rgb(0 0 0 / 0.55);\\n color: #ffffff;\\n box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25) inset, 0 6px 20px -6px rgb(0 0 0 / 0.6);\\n backdrop-filter: blur(6px);\\n translate: -50% -50%;\\n transition: background-color var(--aparte-duration-base, 0.15s) ease;\\n}\\n\\n.aparte-link-preview__play:dir(rtl) { translate: 50% -50%; }\\n.aparte-link-preview__play-glyph { --aparte-rich-card-glyph-size: 1.4rem; margin-inline-start: 0.15rem; }\\n.aparte-link-preview__play:dir(rtl) .aparte-link-preview__play-glyph { margin-inline: 0 0.15rem; transform: scaleX(-1); }\\n.aparte-link-preview--card:hover .aparte-link-preview__play { background: var(--aparte-primary); }\\n\\n.aparte-link-preview__body {\\n display: flex;\\n flex-direction: column;\\n gap: var(--aparte-space-3);\\n min-inline-size: 0;\\n padding: var(--aparte-space-5) var(--aparte-space-6) var(--aparte-space-6);\\n}\\n\\n.aparte-link-preview--card .aparte-link-preview__title {\\n display: -webkit-box;\\n overflow: hidden;\\n -webkit-box-orient: vertical;\\n -webkit-line-clamp: 2;\\n}\\n\\n.aparte-link-preview--card:hover { background: color-mix(in oklab, var(--aparte-text) 2.5%, transparent); }\\n\\n/* ── compact: rows ───────────────────────────────────────────────────── */\\n\\n.aparte-link-preview--row {\\n align-items: center;\\n gap: var(--aparte-space-5);\\n padding: var(--aparte-space-4) var(--aparte-space-6);\\n transition: background-color var(--aparte-duration-fast, 0.12s) ease;\\n}\\n\\n.aparte-link-preview--row:hover { background: color-mix(in oklab, var(--aparte-text) 4%, transparent); }\\n\\n.aparte-link-preview__mark {\\n position: relative;\\n flex: none;\\n display: inline-flex;\\n}\\n\\n/* The kind of page, as a small disc on the mark's corner. */\\n.aparte-link-preview__corner {\\n position: absolute;\\n inset-block-end: -0.3rem;\\n inset-inline-end: -0.3rem;\\n display: grid;\\n place-items: center;\\n inline-size: 1.15rem;\\n block-size: 1.15rem;\\n border-radius: var(--aparte-radius-full);\\n background: var(--aparte-surface-1);\\n box-shadow: 0 0 0 var(--aparte-border-width) var(--aparte-border);\\n color: var(--aparte-text-muted);\\n}\\n\\n.aparte-link-preview__corner-glyph { --aparte-rich-card-glyph-size: 0.7rem; }\\n\\n.aparte-link-preview__text {\\n display: flex;\\n flex: 1;\\n flex-direction: column;\\n gap: var(--aparte-space-1);\\n min-inline-size: 0;\\n}\\n\\n.aparte-link-preview--row .aparte-link-preview__title {\\n overflow: hidden;\\n font-size: var(--aparte-font-size-md);\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n\\n.aparte-link-preview--row .aparte-link-preview__meta {\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-sm);\\n}\\n\\n.aparte-link-preview--row .aparte-link-preview__site-name {\\n color: inherit;\\n font-weight: var(--aparte-font-weight-normal);\\n}\\n\\n.aparte-link-preview__thumb {\\n flex: none;\\n inline-size: var(--aparte-link-preview-thumb-size);\\n block-size: var(--aparte-link-preview-thumb-size);\\n overflow: hidden;\\n border-radius: var(--aparte-radius-md);\\n background: var(--aparte-surface-2);\\n box-shadow: inset 0 0 0 var(--aparte-border-width) var(--aparte-border);\\n}\\n\\n.aparte-link-preview__list {\\n margin: 0;\\n padding: 0;\\n list-style: none;\\n}\\n\\n.aparte-link-preview__list > li + li { border-block-start: var(--aparte-border-width) solid var(--aparte-border); }\\n\\n.aparte-link-preview__heading {\\n display: flex;\\n align-items: center;\\n gap: var(--aparte-space-3);\\n min-inline-size: 0;\\n padding: var(--aparte-space-5) var(--aparte-space-6) var(--aparte-space-4);\\n border-block-end: var(--aparte-border-width) solid var(--aparte-border);\\n font-size: var(--aparte-font-size-md);\\n font-weight: var(--aparte-font-weight-semibold);\\n}\\n\\n.aparte-link-preview__heading-glyph {\\n --aparte-rich-card-glyph-size: 1rem;\\n color: var(--aparte-text-muted);\\n}\\n\\n.aparte-link-preview__heading-text {\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n\\n/* ── quote: the unfurled block ───────────────────────────────────────── */\\n\\n.aparte-link-preview--quote {\\n /* The page's own colour when it gives one, else its host's hue. */\\n --aparte-link-preview-accent-default: var(--aparte-link-preview-hue, var(--aparte-primary));\\n container-type: inline-size;\\n flex-direction: column;\\n gap: var(--aparte-space-5);\\n padding: var(--aparte-space-5) var(--aparte-space-6) var(--aparte-space-6);\\n border: var(--aparte-border-width) solid var(--aparte-border);\\n border-inline-start: var(--aparte-link-preview-rule-width) solid var(--aparte-link-preview-accent, var(--aparte-link-preview-accent-default));\\n border-radius: var(--aparte-radius-md);\\n background: color-mix(in oklab, var(--aparte-link-preview-accent, var(--aparte-link-preview-accent-default)) 4%, var(--aparte-surface-1));\\n transition: background-color var(--aparte-duration-fast, 0.12s) ease;\\n}\\n\\n.aparte-link-preview--quote:hover {\\n background: color-mix(in oklab, var(--aparte-link-preview-accent, var(--aparte-link-preview-accent-default)) 8%, var(--aparte-surface-1));\\n}\\n\\n.aparte-link-preview__quote-text {\\n display: flex;\\n flex: 1;\\n flex-direction: column;\\n gap: var(--aparte-space-2);\\n min-inline-size: 0;\\n}\\n\\n.aparte-link-preview--quote .aparte-link-preview__site { margin-block-end: var(--aparte-space-1); }\\n\\n/* The title is a link: core's link colour, the one every link in the chat is written in. */\\n.aparte-link-preview--quote .aparte-link-preview__title {\\n color: var(--aparte-link-color, var(--aparte-primary-ink, var(--aparte-text)));\\n}\\n\\n.aparte-link-preview--quote .aparte-link-preview__description { -webkit-line-clamp: 4; }\\n\\n.aparte-link-preview__byline {\\n margin-block-start: var(--aparte-space-1);\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-sm);\\n}\\n\\n/* Narrow: the picture under the words, wide. */\\n.aparte-link-preview__quote-media {\\n overflow: hidden;\\n aspect-ratio: var(--aparte-link-preview-media-ratio);\\n border-radius: var(--aparte-radius-md);\\n background: var(--aparte-surface-2);\\n}\\n\\n/* With room: the picture beside the words, a square — the shape of a link's thumbnail. */\\n@container (min-width: 24rem) {\\n .aparte-link-preview--quote:has(> .aparte-link-preview__quote-media) {\\n flex-direction: row;\\n align-items: flex-start;\\n }\\n\\n .aparte-link-preview__quote-media {\\n flex: none;\\n inline-size: 6.5rem;\\n aspect-ratio: 1;\\n }\\n}\\n\\n.aparte-link-preview__stack {\\n display: grid;\\n gap: var(--aparte-space-4);\\n margin: 0;\\n padding: 0;\\n list-style: none;\\n}\\n\\n/* ── Loading ─────────────────────────────────────────────────────────── */\\n\\n.aparte-link-card[data-state=\\\"loading\\\"] .aparte-link-preview__sk-media {\\n block-size: auto;\\n border-radius: 0;\\n}\\n\\n.aparte-link-card[data-state=\\\"loading\\\"] .aparte-link-preview__sk-icon {\\n flex: none;\\n inline-size: 1.125rem;\\n block-size: 1.125rem;\\n border-radius: var(--aparte-radius-sm);\\n}\\n\\n.aparte-link-card[data-state=\\\"loading\\\"] .aparte-link-preview__sk-mark {\\n flex: none;\\n inline-size: 2.5rem;\\n block-size: 2.5rem;\\n border-radius: var(--aparte-radius-md);\\n}\\n\\n.aparte-link-card[data-state=\\\"loading\\\"] .aparte-link-preview__sk-site { inline-size: 40%; }\\n.aparte-link-card[data-state=\\\"loading\\\"] .aparte-link-preview__sk-title { inline-size: 75%; block-size: 1rem; }\\n.aparte-link-card[data-state=\\\"loading\\\"] .aparte-link-preview__sk-line { inline-size: 92%; }\\n.aparte-link-card[data-state=\\\"loading\\\"] .aparte-link-preview__sk-line--short { inline-size: 60%; }\\n\\n/* ── Small screens, and stillness ────────────────────────────────────── */\\n\\n@media (max-width: 380px) {\\n .aparte-link-preview__body { padding: var(--aparte-space-4) var(--aparte-space-5) var(--aparte-space-5); }\\n .aparte-link-preview--row { gap: var(--aparte-space-4); padding: var(--aparte-space-4) var(--aparte-space-5); }\\n .aparte-link-preview--quote { padding: var(--aparte-space-4) var(--aparte-space-5) var(--aparte-space-5); }\\n .aparte-link-card { --aparte-link-preview-thumb-size: 2.75rem; }\\n}\\n\\n@media (prefers-reduced-motion: reduce) {\\n .aparte-link-preview--card:hover .aparte-link-preview__media > .aparte-link-preview__img { transform: none; }\\n}\\n\"", "/**\n * @aparte/plugin-cards/link — a web page, previewed: its picture, its site, its title and\n * what it says it is about, the whole card one link to it.\n *\n * import { setupLinkCard } from '@aparte/plugin-cards/link';\n *\n * setupLinkCard({ tool: 'unfurl' }); // one page's Open Graph, as it is\n * setupLinkCard({ tool: 'web_search', map: (r) => r.items }); // search results\n *\n * One link, several (`[...]`), or `{ title, links: [...] }`. Three variants of one card:\n * `card` (the picture on top, the site, the title, the description), `compact` (one row: the\n * site's icon, the title, a small picture at the end) and `quote` (the block chat apps draw\n * under an unfurled link, with a coloured rule down its side). Your tool keeps its own\n * fields: `readLinks` reads Open Graph and Twitter keys, unfurlers' nested shapes and search\n * results (Google's Custom Search, SerpAPI, Brave, Tavily, Exa), and `map` says the rest.\n *\n * The card fetches nothing the tool's data does not name: no page, and no address of its\n * own making — no favicon service is asked, no icon guessed at `/favicon.ico`. A picture or an\n * icon the data names loads as the chat's image policy allows (`setImagePolicy`), wherever it\n * is hosted (Brave's results name icons on Brave's own proxy); one the policy holds waits\n * behind the card's \"Show images\" button. A site without an icon in the data, or while its\n * icon is held, gets its initial on a tinted square, and a page without a picture gets no\n * picture.\n *\n * Every value is text. Search engines highlight the query in their snippets with markup\n * (Brave's `<strong>`): those tags are dropped and the usual entities decoded, and what is\n * left goes in as text — never parsed.\n */\nimport type { AparteConfig } from '@aparte/core';\nimport { defineCard, type CardContext, type CardSetupOptions } from '../kit/define.js';\nimport { el, glyph, num, str, webUrl, type Loose } from '../kit/dom.js';\nimport { formatNumber, toDate } from '../kit/format.js';\nimport { intlTag, word, type CardWord } from '../kit/strings.js';\nimport { CHAIN, PLAY, typeGlyph } from './icons.js';\nimport linkStyles from './link.css?raw';\n\nexport type LinkType = 'article' | 'video' | 'repo' | 'product' | 'website';\nexport type LinkVariant = 'card' | 'compact' | 'quote';\n\n/**\n * A link as `map` returns it. Only `url` is needed; every other field adds a line when it is\n * there and nothing when it is not. `readLinks` also reads the usual aliases (listed on each\n * field).\n */\nexport interface LinkInput {\n /** An `http(s)` page. Also `link`, `href`, `og:url`. */\n url: string;\n /** Falls back to the page's host. Also `og:title`, `twitter:title`, `meta.title`, `name`. */\n title?: string;\n /** Also `og:description`, `snippet`, `summary`, `content`. */\n description?: string;\n /** Also `og:image`, `twitter:image`, `thumbnail`, `open_graph.images[0].url`, `pagemap.cse_image[0].src`. */\n image?: string;\n /** Falls back to the host without `www.`. Also `og:site_name`, `site`, `publisher`, `source`. */\n siteName?: string;\n /** The site's icon, loaded as the image policy allows. Without it, or while it is held, the site's initial on a tinted square — no icon address is made up. Also `icon`, `logo`, Brave's `meta_url.favicon`. */\n favicon?: string;\n /** Also `byline`, `article:author`, `authors[0]`. */\n author?: string;\n /** An ISO date or an epoch. Also `datePublished`, `published_date`, `date`, `article:published_time`. */\n publishedAt?: string | number | Date;\n /** The badge it wears. Read from `og:type` and the host (GitHub → repo, YouTube → video) when absent. */\n type?: LinkType;\n /** A colour for the quote's side rule: `#rgb` or `#rrggbb`. Also `theme-color`. */\n themeColor?: string;\n}\n\n/** A link as the card draws it, once read. */\nexport interface Link {\n url: string;\n /** The page's host without `www.` — what stands in for a missing title or site name. */\n host: string;\n title?: string;\n description?: string;\n image?: string;\n siteName?: string;\n favicon?: string;\n author?: string;\n publishedAt?: Date;\n type: LinkType;\n themeColor?: string;\n}\n\n/** The card's data: one link or several, and the collection's title. */\nexport interface LinkData {\n title?: string;\n links: Link[];\n}\n\nexport type LinkCardOptions = CardSetupOptions<LinkData, LinkVariant>;\n\nconst L = {\n cardsLinkTitle: { en: 'Link', fr: 'Lien', de: 'Link', es: 'Enlace', it: 'Link', ja: 'リンク', ko: '링크', pt: 'Link', ru: 'Ссылка', zh: '链接' },\n cardsLinkCount: { en: '{n} links', fr: '{n} liens', de: '{n} Links', es: '{n} enlaces', it: '{n} link', ja: 'リンク{n}件', ko: '링크 {n}개', pt: '{n} links', ru: 'Ссылок: {n}', zh: '{n} 个链接' },\n cardsLinkArticle: { en: 'Article', fr: 'Article', de: 'Artikel', es: 'Artículo', it: 'Articolo', ja: '記事', ko: '기사', pt: 'Artigo', ru: 'Статья', zh: '文章' },\n cardsLinkVideo: { en: 'Video', fr: 'Vidéo', de: 'Video', es: 'Vídeo', it: 'Video', ja: '動画', ko: '동영상', pt: 'Vídeo', ru: 'Видео', zh: '视频' },\n cardsLinkRepo: { en: 'Repository', fr: 'Dépôt', de: 'Repository', es: 'Repositorio', it: 'Repository', ja: 'リポジトリ', ko: '저장소', pt: 'Repositório', ru: 'Репозиторий', zh: '代码仓库' },\n cardsLinkProduct: { en: 'Product', fr: 'Produit', de: 'Produkt', es: 'Producto', it: 'Prodotto', ja: '商品', ko: '상품', pt: 'Produto', ru: 'Товар', zh: '商品' },\n} satisfies Record<string, CardWord>;\n\nconst TYPE_WORD = { article: 'cardsLinkArticle', video: 'cardsLinkVideo', repo: 'cardsLinkRepo', product: 'cardsLinkProduct' } as const;\n\n/** The most links one card holds: a result page of fifty is a page, not a card. */\nconst MAX_LINKS = 10;\n/** A description longer than this is cut before it reaches the page; the sheet clamps what is left to its lines. */\nconst MAX_DESCRIPTION = 400;\n/** How many tints a site's initial can stand on: the sheet's six hues. */\nconst HUES = 6;\n\n// ── Reading ──────────────────────────────────────────────────────────────────\n\ntype Bag = Loose;\n\nconst bag = (value: unknown): Bag | undefined =>\n value && typeof value === 'object' && !Array.isArray(value) ? value as Bag : undefined;\n\n/** An address given as a string, as `{ url | src | href | secure_url }`, or as the first of a list of either. */\nfunction linkOf(value: unknown): unknown {\n const first = Array.isArray(value) ? value[0] : value;\n const o = bag(first);\n return o ? o['url'] ?? o['src'] ?? o['href'] ?? o['secure_url'] ?? o['uri'] : first;\n}\n\n/**\n * A page or picture address: `http(s)`, protocol-relative, or a bare host (\"example.com/x\",\n * what a search result's `displayLink` is), read as `https`.\n */\nfunction address(value: unknown, guessScheme = false): string | undefined {\n let s = str(linkOf(value));\n if (!s) return undefined;\n if (s.startsWith('//')) s = `https:${s}`;\n else if (!/^https?:\\/\\//i.test(s)) {\n if (!guessScheme || !/^[\\w-]+(\\.[\\w-]+)+(\\/|$)/.test(s)) return undefined;\n s = `https://${s}`;\n }\n return webUrl(s) ?? undefined;\n}\n\n/** A name given as a string, as `{ name }`, or as the first of a list of either. */\nfunction textOf(value: unknown): string | undefined {\n const first = Array.isArray(value) ? value[0] : value;\n const o = bag(first);\n return o ? str(o['name'] ?? o['title'] ?? o['text']) : str(first);\n}\n\n/**\n * A search engine's snippet as plain text: its highlighting tags dropped (Brave wraps the\n * query's words in `<strong>`, others in `<b>` or `<em>`), then the usual entities decoded —\n * in that order, so `&lt;b&gt;` comes out as the text `<b>`, not as a tag to drop. Only those\n * inline tags: a title that NAMES a tag (\"Why <div> is not a button\") keeps it. The result\n * still goes in as text.\n */\nfunction plain(text: string | undefined): string | undefined {\n if (!text) return text;\n const entities: Record<string, string> = { '&lt;': '<', '&gt;': '>', '&quot;': '\"', '&#39;': \"'\", '&#x27;': \"'\", '&amp;': '&' };\n return text\n .replace(/<\\/?(?:strong|b|em|i|mark)>/gi, '')\n .replace(/&(?:lt|gt|quot|#39|#x27|amp);/gi, (entity) => entities[entity.toLowerCase()]!)\n .trim() || undefined;\n}\n\n/** The first value under any of `keys`, in any of `sources`, in that order — source by source. */\nfunction pick(sources: Array<Bag | undefined>, keys: string[]): unknown {\n for (const source of sources) {\n if (!source) continue;\n for (const key of keys) {\n const value = source[key];\n if (value !== undefined && value !== null && value !== '') return value;\n }\n }\n return undefined;\n}\n\n/** A publication date: a Date, an epoch, or a text with a year in it — \"2 days ago\" is no date. */\nfunction dateOf(value: unknown): Date | undefined {\n if (value instanceof Date) return toDate(value) ?? undefined;\n const n = num(value);\n if (n !== undefined) return n >= 1e9 ? toDate(n) ?? undefined : undefined;\n const s = str(value);\n return s && /\\d{4}/.test(s) ? toDate(s) ?? undefined : undefined;\n}\n\nconst TYPE_RULES: Array<[Exclude<LinkType, 'website'>, RegExp]> = [\n ['video', /video|movie|episode|tv[_ .]?show|\\bclip\\b/],\n ['article', /article|blog|news|post|story/],\n ['repo', /repo|repository|code|software/],\n ['product', /product|offer/],\n];\n\nfunction typeOf(value: unknown, url: URL): LinkType {\n const s = str(value)?.toLowerCase();\n if (s) {\n for (const [type, rule] of TYPE_RULES) if (rule.test(s)) return type;\n if (s === 'website') return 'website';\n }\n const host = url.hostname.replace(/^(www|m)\\./, '');\n const path = url.pathname.split('/').filter(Boolean);\n if (/^(github\\.com|gitlab\\.com|codeberg\\.org|bitbucket\\.org)$/.test(host) && path.length >= 2) return 'repo';\n if (host === 'youtu.be' || /(^|\\.)(youtube\\.com|vimeo\\.com|twitch\\.tv|dailymotion\\.com)$/.test(host)) return 'video';\n return 'website';\n}\n\nfunction readLink(raw: unknown): Link | null {\n const r = bag(typeof raw === 'string' ? { url: raw } : raw);\n if (!r) return null;\n const og = bag(r['open_graph'] ?? r['openGraph'] ?? r['og']);\n const meta = bag(r['meta']);\n const twitter = bag(r['twitter_card'] ?? r['twitterCard'] ?? r['twitter']);\n const pagemap = bag(r['pagemap']);\n const tags = bag(Array.isArray(pagemap?.['metatags']) ? pagemap!['metatags'][0] : undefined);\n const sources = [r, og, meta, tags, twitter];\n\n const url = address(pick(sources, ['url', 'link', 'href', 'og:url', 'ogUrl', 'canonical', 'uri']))\n ?? address(r['displayLink'] ?? r['displayed_link'], true);\n if (!url) return null;\n const parsed = new URL(url);\n const host = parsed.hostname.replace(/^www\\./, '');\n\n const imageCandidates = [\n r['image'], r['imageUrl'], r['image_url'], r['og:image'], r['ogImage'], og?.['image'], og?.['images'],\n r['twitter:image'], r['twitterImage'], twitter?.['image'], twitter?.['images'], r['thumbnail'], r['thumbnail_url'], r['thumbnailUrl'],\n tags?.['og:image'], tags?.['twitter:image'], pagemap?.['cse_image'], pagemap?.['cse_thumbnail'], meta?.['image'],\n ];\n const description = plain(str(pick(sources, ['description', 'snippet', 'summary', 'excerpt', 'og:description', 'ogDescription', 'twitter:description', 'twitterDescription', 'content', 'abstract']))\n ?.replace(/\\s+/g, ' '));\n const color = str(pick([r, tags], ['themeColor', 'theme-color', 'theme_color', 'color']));\n return {\n url,\n host,\n title: plain(textOf(pick(sources, ['title', 'og:title', 'ogTitle', 'twitter:title', 'twitterTitle', 'headline', 'name']))),\n description: description && description.length > MAX_DESCRIPTION ? `${description.slice(0, MAX_DESCRIPTION - 1).trimEnd()}…` : description,\n image: imageCandidates.map((v) => address(v)).find(Boolean),\n siteName: textOf(pick(sources, ['siteName', 'site_name', 'og:site_name', 'ogSiteName', 'site', 'publisher', 'source', 'provider_name', 'providerName']) ?? r['profile']),\n favicon: [r['favicon'], r['icon'], r['logo'], r['faviconUrl'], r['favicon_url'], r['meta_url']?.['favicon'], r['profile']?.['img'], meta?.['favicon']]\n .map((v) => address(v)).find(Boolean),\n author: textOf(pick(sources, ['author', 'byline', 'article:author', 'creator', 'authors'])),\n publishedAt: dateOf(pick(sources, ['publishedAt', 'published_at', 'datePublished', 'published_date', 'publishedDate', 'article:published_time', 'publishedTime', 'date', 'pubDate', 'page_age', 'createdAt', 'created_at'])\n ?? og?.['article']?.['published_time']),\n type: typeOf(pick(sources, ['type', 'og:type', 'ogType', 'kind']), parsed),\n themeColor: color && /^#(?:[0-9a-f]{3}){1,2}$/i.test(color) ? color : undefined,\n };\n}\n\n/**\n * The card's data from what `map` returns: one link (an object, or its address), an array,\n * or a collection (`{ title?, links | results | items | organic_results | sources }`, and\n * Brave's `web.results`). At most ten; `null` when not one has an `http(s)` address.\n */\nexport function readLinks(raw: unknown): LinkData | null {\n const value = typeof raw === 'string' ? [raw] : raw;\n if (!value || typeof value !== 'object') return null;\n let title: string | undefined;\n let list: unknown[];\n if (Array.isArray(value)) {\n list = value;\n } else {\n const r = value as Bag;\n const nested = [r['links'], r['results'], r['items'], r['organic_results'], r['sources'], r['search_results'], r['web']?.['results']].find(Array.isArray);\n if (nested) {\n list = nested;\n title = str(r['title']);\n } else {\n list = [value];\n }\n }\n const links = list.map(readLink).filter((l): l is Link => l !== null).slice(0, MAX_LINKS);\n return links.length ? { ...(title ? { title } : {}), links } : null;\n}\n\n// ── Drawing ──────────────────────────────────────────────────────────────────\n\nconst titleOf = (link: Link) => link.title ?? link.host;\nconst siteOf = (link: Link) => link.siteName ?? link.host;\n\n/** A host's tint, the same every time it is drawn: a sum of its letters, folded onto the six. */\nfunction hueOf(host: string): number {\n let sum = 0;\n for (const char of host) sum = (sum * 31 + char.charCodeAt(0)) % 9973;\n return sum % HUES;\n}\n\n/** \"Mar 3\", or \"Mar 3, 2024\" when it is not this year — as the chat's language writes it. */\nfunction publishedText(config: AparteConfig, date: Date, now = new Date()): string {\n return new Intl.DateTimeFormat(intlTag(config), {\n month: 'short', day: 'numeric', year: date.getFullYear() === now.getFullYear() ? undefined : 'numeric',\n }).format(date);\n}\n\n/** The middle dot between two facts on a line — drawn, not read. */\nconst dot = () => el('span', { class: 'aparte-link-preview__dot', attrs: { 'aria-hidden': 'true' }, text: '·' });\n\nfunction joined(className: string, parts: Array<Node | null>): HTMLElement | null {\n const present = parts.filter((p): p is Node => p !== null);\n if (!present.length) return null;\n const line = el('span', { class: className });\n present.forEach((part, i) => {\n if (i) line.append(dot());\n line.append(part);\n });\n return line;\n}\n\nfunction dateNode(ctx: CardContext, link: Link): HTMLElement | null {\n if (!link.publishedAt) return null;\n const date = link.publishedAt;\n const node = el('time', { class: 'aparte-link-preview__date', attrs: { datetime: date.toISOString() } });\n ctx.bind(node, () => publishedText(ctx.config, date));\n return node;\n}\n\n/**\n * The site's mark: its own icon when the data gives one, over its initial on a tint — the\n * initial is what shows when there is no icon, or when the icon fails to load. Decoration:\n * the site's name is written beside it.\n */\nfunction iconOf(ctx: CardContext, link: Link, size: 'sm' | 'lg'): HTMLElement {\n const initial = Array.from(siteOf(link))[0]!.toUpperCase();\n const box = el('span', { class: `aparte-link-preview__icon aparte-link-preview__icon--${size}`, attrs: { 'aria-hidden': 'true', 'data-hue': hueOf(link.host) } },\n el('span', { class: 'aparte-link-preview__initial', text: initial }));\n const img = link.favicon ? ctx.image(link.favicon, { class: 'aparte-link-preview__favicon', attrs: { alt: '', loading: 'lazy', decoding: 'async' } }) : null;\n if (img) {\n img.addEventListener('error', () => {\n img.remove();\n box.removeAttribute('data-favicon');\n }, { once: true });\n box.setAttribute('data-favicon', '');\n box.append(img);\n }\n return box;\n}\n\n/** The kind of page, as a glyph and a word — a plain website wears none. */\nfunction typeBadge(ctx: CardContext, link: Link): HTMLElement | null {\n if (link.type === 'website') return null;\n const key = TYPE_WORD[link.type];\n const label = el('span', { class: 'aparte-link-preview__type-label' });\n ctx.word(label, key, L[key]);\n return el('span', { class: 'aparte-link-preview__type', attrs: { 'data-type': link.type } },\n glyph(typeGlyph(link.type), 'aparte-rich-card__glyph aparte-link-preview__type-glyph'), label);\n}\n\n/**\n * The title, as THE link: its `::after` is stretched over the whole card or row, so every\n * part of it opens the page and a reader hears one link, named by the title.\n */\nfunction titleNode(link: Link): HTMLElement {\n return el('div', { class: 'aparte-link-preview__title' },\n el('a', { class: 'aparte-link-preview__anchor', attrs: { href: link.url, target: '_blank', rel: 'noopener noreferrer' }, text: titleOf(link) }));\n}\n\nfunction descriptionOf(link: Link): HTMLElement | null {\n return link.description ? el('p', { class: 'aparte-link-preview__description', text: link.description }) : null;\n}\n\n/**\n * The page's picture, in a box of its own. Decoration — the title names the link — so its\n * alternative text is empty. A picture that fails to load takes its box with it: a preview\n * without a picture is a preview, a grey hole is not.\n */\nfunction mediaOf(ctx: CardContext, link: Link, className: string): HTMLElement | null {\n // A picture the policy holds is a preview without one: no box.\n const img = link.image ? ctx.image(link.image, { class: 'aparte-link-preview__img', attrs: { alt: '', loading: 'lazy', decoding: 'async' } }) : null;\n if (!img) return null;\n const box = el('div', { class: className, attrs: { 'data-loading': '' } });\n img.addEventListener('load', () => box.removeAttribute('data-loading'), { once: true });\n img.addEventListener('error', () => box.remove(), { once: true });\n box.append(img);\n return box;\n}\n\n/** `card`: the picture on top, the site line, the title, the description. */\nfunction cardOf(ctx: CardContext, link: Link): HTMLElement {\n const media = mediaOf(ctx, link, 'aparte-link-preview__media');\n if (media && link.type === 'video') {\n media.append(el('span', { class: 'aparte-link-preview__play', attrs: { 'aria-hidden': 'true' } }, glyph(PLAY, 'aparte-rich-card__glyph aparte-link-preview__play-glyph')));\n }\n const site = el('div', { class: 'aparte-link-preview__site' }, iconOf(ctx, link, 'sm'),\n joined('aparte-link-preview__site-text', [\n el('span', { class: 'aparte-link-preview__site-name', text: siteOf(link) }),\n link.author ? el('span', { class: 'aparte-link-preview__author', text: link.author }) : null,\n dateNode(ctx, link),\n ]),\n typeBadge(ctx, link));\n const body = el('div', { class: 'aparte-link-preview__body' }, site, titleNode(link), descriptionOf(link));\n return el('article', { class: 'aparte-link-preview aparte-link-preview--card', attrs: { 'data-type': link.type } }, media, body);\n}\n\n/** `compact`: one row — the site's mark (with its kind in the corner), the title, the site, a small picture. */\nfunction rowOf(ctx: CardContext, link: Link, tag: 'div' | 'li'): HTMLElement {\n const mark = el('span', { class: 'aparte-link-preview__mark' }, iconOf(ctx, link, 'lg'));\n if (link.type !== 'website') {\n const corner = el('span', { class: 'aparte-link-preview__corner', attrs: { role: 'img', 'data-type': link.type } },\n glyph(typeGlyph(link.type), 'aparte-rich-card__glyph aparte-link-preview__corner-glyph'));\n ctx.bind(corner, () => word(ctx.config, TYPE_WORD[link.type as keyof typeof TYPE_WORD], L[TYPE_WORD[link.type as keyof typeof TYPE_WORD]]), 'aria-label');\n mark.append(corner);\n }\n const meta = joined('aparte-link-preview__meta', [el('span', { class: 'aparte-link-preview__site-name', text: siteOf(link) }), dateNode(ctx, link)]);\n const text = el('div', { class: 'aparte-link-preview__text' }, titleNode(link), meta);\n return el(tag, { class: 'aparte-link-preview aparte-link-preview--row', attrs: { 'data-type': link.type } }, mark, text, mediaOf(ctx, link, 'aparte-link-preview__thumb'));\n}\n\n/** `quote`: the block a chat app draws under an unfurled link — a coloured rule, the site, the title, the words, the picture beside. */\nfunction quoteOf(ctx: CardContext, link: Link, tag: 'div' | 'li'): HTMLElement {\n const site = el('div', { class: 'aparte-link-preview__site' }, iconOf(ctx, link, 'sm'),\n el('span', { class: 'aparte-link-preview__site-name', text: siteOf(link) }), typeBadge(ctx, link));\n const byline = joined('aparte-link-preview__byline', [link.author ? el('span', { class: 'aparte-link-preview__author', text: link.author }) : null, dateNode(ctx, link)]);\n const text = el('div', { class: 'aparte-link-preview__quote-text' }, site, titleNode(link), descriptionOf(link), byline);\n const node = el(tag, { class: 'aparte-link-preview aparte-link-preview--quote', attrs: { 'data-type': link.type, 'data-hue': hueOf(link.host) } },\n text, mediaOf(ctx, link, 'aparte-link-preview__quote-media'));\n // A colour the reader checked (#rgb, #rrggbb), set as a property — never a style string.\n if (link.themeColor) node.style.setProperty('--aparte-link-preview-accent', link.themeColor);\n return node;\n}\n\nfunction countLabel(config: AparteConfig, data: Partial<LinkData>): string {\n return data.title ?? word(config, 'cardsLinkCount', L.cardsLinkCount, { n: formatNumber(config, data.links?.length ?? 0) });\n}\n\nfunction headingOf(ctx: CardContext, data: LinkData): HTMLElement {\n const text = el('span', { class: 'aparte-link-preview__heading-text' });\n ctx.bind(text, () => countLabel(ctx.config, data));\n return el('div', { class: 'aparte-link-preview__heading' }, glyph(CHAIN, 'aparte-rich-card__glyph aparte-link-preview__heading-glyph'), text);\n}\n\nfunction render(data: LinkData, ctx: CardContext<LinkVariant>): Node[] {\n const [first] = data.links as [Link];\n if (data.links.length === 1) {\n if (ctx.variant === 'compact') return [rowOf(ctx, first, 'div')];\n if (ctx.variant === 'quote') return [quoteOf(ctx, first, 'div')];\n return [cardOf(ctx, first)];\n }\n if (ctx.variant === 'quote') {\n const stack = el('ul', { class: 'aparte-link-preview__stack' }, ...data.links.map((l) => quoteOf(ctx, l, 'li')));\n ctx.bind(stack, () => countLabel(ctx.config, data), 'aria-label');\n return [stack];\n }\n // Several cards would be a wall of pictures in a chat: several links are rows, stacked,\n // in `card` as in `compact`.\n const list = el('ul', { class: 'aparte-link-preview__list' }, ...data.links.map((l) => rowOf(ctx, l, 'li')));\n ctx.bind(list, () => countLabel(ctx.config, data), 'aria-label');\n return [headingOf(ctx, data), list];\n}\n\nfunction skeleton(partial: Partial<LinkData> | null, ctx: CardContext<LinkVariant>): Node[] {\n const block = (cls: string, kind: 'text' | 'rect' = 'rect') =>\n el('span', { class: `aparte-skeleton aparte-skeleton--${kind} ${cls}`, attrs: { 'aria-hidden': 'true' } });\n const known = partial?.links?.[0];\n const title = known?.title ?? partial?.title;\n const titleLine = title ? el('div', { class: 'aparte-link-preview__title', text: title }) : block('aparte-link-preview__sk-title', 'text');\n const siteLine = el('div', { class: 'aparte-link-preview__site' }, block('aparte-link-preview__sk-icon'),\n known ? el('span', { class: 'aparte-link-preview__site-name', text: siteOf(known) }) : block('aparte-link-preview__sk-site', 'text'));\n if (ctx.variant === 'compact') {\n return [el('div', { class: 'aparte-link-preview aparte-link-preview--row' }, block('aparte-link-preview__sk-mark'),\n el('div', { class: 'aparte-link-preview__text' }, titleLine, known ? el('span', { class: 'aparte-link-preview__meta', text: siteOf(known) }) : block('aparte-link-preview__sk-site', 'text')))];\n }\n const lines = [block('aparte-link-preview__sk-line', 'text'), block('aparte-link-preview__sk-line aparte-link-preview__sk-line--short', 'text')];\n if (ctx.variant === 'quote') {\n return [el('div', { class: 'aparte-link-preview aparte-link-preview--quote' }, el('div', { class: 'aparte-link-preview__quote-text' }, siteLine, titleLine, ...lines))];\n }\n return [el('article', { class: 'aparte-link-preview aparte-link-preview--card' }, block('aparte-link-preview__media aparte-link-preview__sk-media'),\n el('div', { class: 'aparte-link-preview__body' }, siteLine, titleLine, ...lines))];\n}\n\nfunction label(data: Partial<LinkData> | null, ctx: CardContext): string {\n const links = data?.links ?? [];\n if (links.length === 1) return titleOf(links[0]!);\n if (links.length > 1) return countLabel(ctx.config, data!);\n return data?.title ?? word(ctx.config, 'cardsLinkTitle', L.cardsLinkTitle);\n}\n\n/** One line a link: \"Title — Site (https://…)\". */\nfunction fallback(data: LinkData): string {\n const lines = data.links.map((l) => `${titleOf(l)} — ${siteOf(l)} (${l.url})`);\n return data.title ? `${data.title}:\\n${lines.join('\\n')}` : lines.join('\\n');\n}\n\n/** What a running call already says: the page it unfurls, else what it searches for. */\nfunction partial(input: Record<string, unknown>): Partial<LinkData> | null {\n const one = readLink({ url: input['url'] ?? input['link'] ?? input['href'] });\n if (one) return { links: [one] };\n const query = str(input['query'] ?? input['q'] ?? input['search'] ?? input['title']);\n return query ? { title: query } : null;\n}\n\n/** The link card — for `linkCard.segment(data)`. Plug it in with `setupLinkCard`. */\nexport const linkCard = defineCard<LinkData, LinkVariant>({\n name: 'link',\n variants: ['card', 'compact', 'quote'],\n styles: linkStyles,\n icon: CHAIN,\n normalize: readLinks,\n render,\n skeleton,\n label,\n fallback,\n partial,\n});\n\n/** Draw a tool's links as this card — returns the function that stops it. */\nexport function setupLinkCard(options: LinkCardOptions = {}): () => void {\n return linkCard.setup(options);\n}\n"],
5
5
  "mappings": "+JAUA,IAAMA,EAAOC,GACT,mKAAmKA,CAAI,SAG9JC,EAAQF,EAAI,gIAAgI,EAG5IG,EAAO,uLAEdC,EAA4D,CAE9D,QAASJ,EAAI,kJAAkJ,EAE/J,MAAOA,EAAI,yFAAyF,EAEpG,KAAMA,EAAI,uIAAuI,EAEjJ,QAASA,EAAI,6LAA6L,CAC9M,EAGO,SAASK,EAAUC,EAA4C,CAClE,OAAOF,EAAYE,CAAI,CAC3B,CCjCA,IAAAC,EAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,OAAS,EAAU+C,EAAWvB,EAAI,OAAQwB,CAAK,EAClDA,GAAM,OAASJ,EAAKpB,EAAI,OAAQ,iBAAkB5E,EAAE,cAAc,CAC7E,CAGA,SAASkH,GAASd,EAAwB,CACtC,IAAMa,EAAQb,EAAK,MAAM,IAAK/C,GAAM,GAAGC,EAAQD,CAAC,CAAC,WAAMG,EAAOH,CAAC,CAAC,KAAKA,EAAE,GAAG,GAAG,EAC7E,OAAO+C,EAAK,MAAQ,GAAGA,EAAK,KAAK;EAAMa,EAAM,KAAK;CAAI,CAAC,GAAKA,EAAM,KAAK;CAAI,CAC/E,CAGA,SAASP,GAAQS,EAA0D,CACvE,IAAMC,EAAMjF,EAAS,CAAE,IAAKgF,EAAM,KAAUA,EAAM,MAAWA,EAAM,IAAM,CAAG,EAC5E,GAAIC,EAAK,MAAO,CAAE,MAAO,CAACA,CAAG,CAAA,EAC7B,IAAMC,EAAQxG,EAAIsG,EAAM,OAAYA,EAAM,GAAQA,EAAM,QAAaA,EAAM,KAAQ,EACnF,OAAOE,EAAQ,CAAE,MAAOA,CAAA,EAAU,IACtC,CAGO,IAAMC,GAAWC,EAAkC,CACtD,KAAM,OACN,SAAU,CAAC,OAAQ,UAAW,OAAO,EACrC,OAAQxH,EACR,KAAML,EACN,UAAWsD,GACX,OAAAuD,GACA,SAAAE,GACA,MAAArB,GACA,SAAA8B,GACA,QAAAR,EACJ,CAAC,EAGM,SAASc,GAAcC,EAA2B,CAAA,EAAgB,CACrE,OAAOH,GAAS,MAAMG,CAAO,CACjC",
6
6
  "names": ["svg", "body", "CHAIN", "PLAY", "TYPE_GLYPHS", "typeGlyph", "type", "linkStyles", "L", "TYPE_WORD", "MAX_LINKS", "MAX_DESCRIPTION", "HUES", "bag", "value", "linkOf", "first", "o", "address", "guessScheme", "s", "str", "webUrl", "textOf", "plain", "text", "entities", "entity", "pick", "sources", "keys", "source", "key", "dateOf", "toDate", "n", "num", "TYPE_RULES", "typeOf", "url", "rule", "host", "path", "readLink", "raw", "r", "og", "meta", "twitter", "pagemap", "tags", "parsed", "imageCandidates", "description", "color", "v", "readLinks", "title", "list", "nested", "links", "l", "titleOf", "link", "siteOf", "hueOf", "sum", "char", "publishedText", "config", "date", "now", "intlTag", "dot", "el", "joined", "className", "parts", "present", "p", "line", "part", "i", "dateNode", "ctx", "node", "iconOf", "size", "initial", "box", "img", "typeBadge", "label", "glyph", "titleNode", "descriptionOf", "mediaOf", "cardOf", "media", "site", "rowOf", "tag", "mark", "corner", "word", "quoteOf", "byline", "countLabel", "data", "formatNumber", "headingOf", "render", "stack", "skeleton", "partial", "block", "cls", "kind", "known", "titleLine", "siteLine", "lines", "fallback", "input", "one", "query", "linkCard", "defineCard", "setupLinkCard", "options"]
@@ -1,4 +1,4 @@
1
- import{a as X}from"./chunk-HASLYSSG.js";import{a as r,b as v,c as q,d as B,e as U,f as g,i as _,j as C,o as G,q as b,v as N}from"./chunk-PPDOW5CO.js";import"./chunk-4MZPEZPE.js";import"./chunk-XAWE4EAK.js";var w=e=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">${e}</svg>`,la=w('<rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><circle cx="9" cy="9.5" r="1.6"/><path d="m4 17.5 4.6-4.6a1.4 1.4 0 0 1 2 0l3.4 3.4 1.6-1.6a1.4 1.4 0 0 1 2 0l2.9 2.9"/>'),pa=w('<rect x="3.5" y="5" width="17" height="14" rx="2.5"/><path d="M7.5 5v14M16.5 5v14M3.5 9.5h4M3.5 14.5h4M16.5 9.5h4M16.5 14.5h4"/>'),ca=w('<path d="M9.5 17.5V6l10-2v11.5"/><circle cx="7" cy="17.5" r="2.5"/><circle cx="17" cy="15.5" r="2.5"/>'),Z=w('<rect x="7" y="3.5" width="13.5" height="11.5" rx="2.2"/><path d="M17 18.5a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2"/><path d="m7.5 13 3-3 2.5 2.5 1.5-1.5 3.5 3.5"/>'),aa='<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M8.5 5.6v12.8a1 1 0 0 0 1.5.86l10.2-6.4a1 1 0 0 0 0-1.72L10 4.74a1 1 0 0 0-1.5.86z"/></svg>',ma=w('<path d="M14.5 4.5h5v5M9.5 19.5h-5v-5M19.5 4.5l-6 6M4.5 19.5l6-6"/>'),ea=w('<path d="M13.5 4.5h6v6M19.5 4.5l-8 8"/><path d="M17.5 13.5v4a2 2 0 0 1-2 2h-9a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h4"/>'),ua=w('<path d="M4.5 8h3l1.6-2.3h5.8L16.5 8h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z"/><circle cx="12" cy="13" r="3.3"/>');function na(e){return e==="video"?pa:e==="audio"?ca:la}var _a=`/* =========================================
1
+ import{a as X}from"./chunk-KXLJFCTW.js";import{a as r,b as v,c as q,d as B,e as U,f as g,i as _,j as C,o as G,q as b,v as N}from"./chunk-HR2ND5EK.js";import"./chunk-QGJMBP66.js";import"./chunk-XAWE4EAK.js";var w=e=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">${e}</svg>`,la=w('<rect x="3.5" y="4.5" width="17" height="15" rx="2.5"/><circle cx="9" cy="9.5" r="1.6"/><path d="m4 17.5 4.6-4.6a1.4 1.4 0 0 1 2 0l3.4 3.4 1.6-1.6a1.4 1.4 0 0 1 2 0l2.9 2.9"/>'),pa=w('<rect x="3.5" y="5" width="17" height="14" rx="2.5"/><path d="M7.5 5v14M16.5 5v14M3.5 9.5h4M3.5 14.5h4M16.5 9.5h4M16.5 14.5h4"/>'),ca=w('<path d="M9.5 17.5V6l10-2v11.5"/><circle cx="7" cy="17.5" r="2.5"/><circle cx="17" cy="15.5" r="2.5"/>'),Z=w('<rect x="7" y="3.5" width="13.5" height="11.5" rx="2.2"/><path d="M17 18.5a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2"/><path d="m7.5 13 3-3 2.5 2.5 1.5-1.5 3.5 3.5"/>'),aa='<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M8.5 5.6v12.8a1 1 0 0 0 1.5.86l10.2-6.4a1 1 0 0 0 0-1.72L10 4.74a1 1 0 0 0-1.5.86z"/></svg>',ma=w('<path d="M14.5 4.5h5v5M9.5 19.5h-5v-5M19.5 4.5l-6 6M4.5 19.5l6-6"/>'),ea=w('<path d="M13.5 4.5h6v6M19.5 4.5l-8 8"/><path d="M17.5 13.5v4a2 2 0 0 1-2 2h-9a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h4"/>'),ua=w('<path d="M4.5 8h3l1.6-2.3h5.8L16.5 8h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z"/><circle cx="12" cy="13" r="3.3"/>');function na(e){return e==="video"?pa:e==="audio"?ca:la}var _a=`/* =========================================
2
2
  The media card \u2014 @aparte/plugin-cards/media
3
3
  =========================================
4
4
  Three variants of one card, chosen by \`data-variant\` on its root:
@@ -794,4 +794,4 @@ import{a as X}from"./chunk-HASLYSSG.js";import{a as r,b as v,c as q,d as B,e as
794
794
  ${n.join(`
795
795
  `)}`:n.join(`
796
796
  `)}function Wa(e){let a=g(e.prompt??e.query??e.q??e.search??e.title);return a?{title:a}:null}var Pa=G({name:"media",variants:["single","gallery","strip"],styles:_a,icon:Z,normalize:Aa,render:Sa,skeleton:Ua,label:Na,fallback:Da,partial:Wa});function qa(e={}){return Pa.setup(e)}export{ia as formatDuration,Pa as mediaCard,xa as readDuration,Aa as readMedia,qa as setupMediaCard};
797
- //# sourceMappingURL=media-F3HYZLYR.js.map
797
+ //# sourceMappingURL=media-PN3A7I2Y.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../node_modules/.pnpm/@aparte+plugin-cards@1.1.2_@aparte+core@1.1.2/node_modules/@aparte/plugin-cards/src/media/icons.ts", "../../../node_modules/.pnpm/@aparte+plugin-cards@1.1.2_@aparte+core@1.1.2/node_modules/@aparte/plugin-cards/src/media/media.css", "../../../node_modules/.pnpm/@aparte+plugin-cards@1.1.2_@aparte+core@1.1.2/node_modules/@aparte/plugin-cards/src/media/index.ts"],
3
+ "sources": ["../../../node_modules/.pnpm/@aparte+plugin-cards@1.3.0_@aparte+core@1.3.0/node_modules/@aparte/plugin-cards/src/media/icons.ts", "../../../node_modules/.pnpm/@aparte+plugin-cards@1.3.0_@aparte+core@1.3.0/node_modules/@aparte/plugin-cards/src/media/media.css", "../../../node_modules/.pnpm/@aparte+plugin-cards@1.3.0_@aparte+core@1.3.0/node_modules/@aparte/plugin-cards/src/media/index.ts"],
4
4
  "sourcesContent": ["/**\n * The media card's glyphs: one line drawing per kind of medium (for the placeholder a\n * tile shows before, or instead of, its picture), the play triangle a video wears, the\n * stack of frames a gallery is named with, and the small marks of a caption line.\n *\n * Drawn on a 24 × 24 grid in `currentColor`, so the sheet colours them through `color`\n * and a theme follows. Constants of this package — the only markup the card parses.\n */\nimport type { MediaKind } from './index.js';\n\nconst svg = (body: string) =>\n `<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.6\" stroke-linecap=\"round\" stroke-linejoin=\"round\" xmlns=\"http://www.w3.org/2000/svg\">${body}</svg>`; // safe-text: this package's own SVG, built from its glyph constants\n\n/** A framed landscape: an image. */\nexport const IMAGE = svg('<rect x=\"3.5\" y=\"4.5\" width=\"17\" height=\"15\" rx=\"2.5\"/><circle cx=\"9\" cy=\"9.5\" r=\"1.6\"/><path d=\"m4 17.5 4.6-4.6a1.4 1.4 0 0 1 2 0l3.4 3.4 1.6-1.6a1.4 1.4 0 0 1 2 0l2.9 2.9\"/>');\n\n/** A strip of film: a video. */\nexport const FILM = svg('<rect x=\"3.5\" y=\"5\" width=\"17\" height=\"14\" rx=\"2.5\"/><path d=\"M7.5 5v14M16.5 5v14M3.5 9.5h4M3.5 14.5h4M16.5 9.5h4M16.5 14.5h4\"/>');\n\n/** A note: a sound. */\nexport const NOTE = svg('<path d=\"M9.5 17.5V6l10-2v11.5\"/><circle cx=\"7\" cy=\"17.5\" r=\"2.5\"/><circle cx=\"17\" cy=\"15.5\" r=\"2.5\"/>');\n\n/** Two frames, one behind the other: a gallery, and the card's one-line state glyph. */\nexport const FRAMES = svg('<rect x=\"7\" y=\"3.5\" width=\"13.5\" height=\"11.5\" rx=\"2.2\"/><path d=\"M17 18.5a2 2 0 0 1-2 2H5.5a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2\"/><path d=\"m7.5 13 3-3 2.5 2.5 1.5-1.5 3.5 3.5\"/>');\n\n/** The play triangle, filled: it sits on a disc over a picture. */\nexport const PLAY = '<svg viewBox=\"0 0 24 24\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"M8.5 5.6v12.8a1 1 0 0 0 1.5.86l10.2-6.4a1 1 0 0 0 0-1.72L10 4.74a1 1 0 0 0-1.5.86z\"/></svg>';\n\n/** Four corners pulled out: \"see it larger\", in the corner of a picture you can open. */\nexport const EXPAND = svg('<path d=\"M14.5 4.5h5v5M9.5 19.5h-5v-5M19.5 4.5l-6 6M4.5 19.5l6-6\"/>');\n\n/** A box with an arrow leaving it: a page that opens elsewhere. */\nexport const EXTERNAL = svg('<path d=\"M13.5 4.5h6v6M19.5 4.5l-8 8\"/><path d=\"M17.5 13.5v4a2 2 0 0 1-2 2h-9a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h4\"/>');\n\n/** A camera body: who took or made the picture. */\nexport const CAMERA = svg('<path d=\"M4.5 8h3l1.6-2.3h5.8L16.5 8h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-15a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1z\"/><circle cx=\"12\" cy=\"13\" r=\"3.3\"/>');\n\n/** The glyph for a kind of medium. */\nexport function kindGlyph(kind: MediaKind): string {\n return kind === 'video' ? FILM : kind === 'audio' ? NOTE : IMAGE;\n}\n", "export default \"/* =========================================\\n The media card — @aparte/plugin-cards/media\\n =========================================\\n Three variants of one card, chosen by `data-variant` on its root:\\n single one medium, large: an image at its own shape within a height (a button that\\n opens the lightbox), a video in the browser's player, a sound under a header\\n with its cover and a waveform, a YouTube page as a poster that links out.\\n One medium is drawn this way whatever the variant.\\n gallery a mosaic: two to six tiles, the first larger from three, \\\"+n\\\" on the last\\n when there are more. Several media in `single` are drawn this way too.\\n strip square thumbnails that scroll sideways.\\n Every tile opens the lightbox: a native <dialog> wearing core's `.aparte-dialog`, its\\n picture on a dark stage.\\n Every colour is a core token or a `--aparte-media-*` one here. The stage is black in\\n either theme — what a photo is looked at on — and so is the scrim over a picture: they\\n sit on images, not on the page's ground.\\n */\\n\\n.aparte-media-card {\\n /* The tallest a picture is drawn on the card. */\\n --aparte-media-max-block: 22rem;\\n /* The seams of the mosaic. */\\n --aparte-media-gap: 2px;\\n /* The tint of a placeholder, a cover without a picture, the waveform. */\\n --aparte-media-tint: var(--aparte-primary);\\n --aparte-media-stage: #0b0b0d;\\n --aparte-media-on-stage: #ffffff;\\n --aparte-media-scrim: rgb(0 0 0 / 0.55);\\n --aparte-media-lightbox-block: min(72dvh, 44rem);\\n}\\n\\n.aparte-media-card:has(> .aparte-media--single) { --aparte-rich-card-max-inline-size: 24rem; }\\n.aparte-media-card:has(> .aparte-media--strip) { --aparte-rich-card-max-inline-size: 30rem; }\\n\\n.aparte-media {\\n min-inline-size: 0;\\n margin: 0;\\n color: var(--aparte-text);\\n}\\n\\n/* ── What stands behind a picture ────────────────────────────────────── */\\n\\n.aparte-media__placeholder {\\n position: absolute;\\n inset: 0;\\n z-index: 0;\\n display: grid;\\n place-items: center;\\n background:\\n radial-gradient(circle at 30% 20%, color-mix(in oklab, var(--aparte-media-tint) 14%, transparent), transparent 60%),\\n color-mix(in oklab, var(--aparte-media-tint) 8%, var(--aparte-surface-2));\\n color: color-mix(in oklab, var(--aparte-media-tint) 55%, var(--aparte-text-muted));\\n}\\n\\n.aparte-media__placeholder-glyph { --aparte-rich-card-glyph-size: 1.75rem; opacity: 0.85; }\\n\\n.aparte-media__img {\\n position: relative;\\n z-index: 1;\\n display: block;\\n}\\n\\n/* ── One image, at its own shape ─────────────────────────────────────── */\\n\\n.aparte-media--single {\\n display: flex;\\n flex-direction: column;\\n padding: var(--aparte-space-4) var(--aparte-space-4) var(--aparte-space-5);\\n}\\n\\n.aparte-media__frame {\\n position: relative;\\n display: block;\\n inline-size: 100%;\\n margin: 0;\\n padding: 0;\\n overflow: hidden;\\n isolation: isolate;\\n border: 0;\\n border-radius: var(--aparte-radius-lg);\\n background: var(--aparte-surface-2);\\n color: inherit;\\n font: inherit;\\n}\\n\\n/* Nothing known of its shape: the picture sets the frame's size, within the card and the height. */\\n.aparte-media__frame[data-kind=\\\"image\\\"] {\\n align-self: center;\\n inline-size: fit-content;\\n max-inline-size: 100%;\\n cursor: zoom-in;\\n}\\n\\n.aparte-media__frame[data-kind=\\\"image\\\"] > .aparte-media__img {\\n inline-size: auto;\\n block-size: auto;\\n max-inline-size: 100%;\\n max-block-size: var(--aparte-media-max-block);\\n}\\n\\n/* Its shape known: the frame is drawn at it from the start — as wide as the card allows,\\n narrower when the height would pass the limit — and the picture fills it. */\\n.aparte-media__frame[data-kind=\\\"image\\\"][data-sized] {\\n inline-size: min(100%, calc(var(--aparte-media-max-block) * var(--aparte-media-ratio-n)));\\n aspect-ratio: var(--aparte-media-ratio);\\n}\\n\\n.aparte-media__frame[data-kind=\\\"image\\\"][data-sized] > .aparte-media__img {\\n inline-size: 100%;\\n block-size: 100%;\\n max-block-size: none;\\n object-fit: cover;\\n}\\n\\n/* Loading with no shape known, or failed: a box of a reasonable size around the placeholder. */\\n.aparte-media__frame[data-kind=\\\"image\\\"]:not([data-sized]):is([data-loading], [data-broken]) {\\n inline-size: 100%;\\n min-block-size: 10rem;\\n}\\n\\n.aparte-media__frame[data-kind=\\\"image\\\"] > .aparte-media__img {\\n transition: transform var(--aparte-duration-slower, 0.3s) ease, filter var(--aparte-duration-slower, 0.3s) ease;\\n}\\n\\n.aparte-media__frame[data-kind=\\\"image\\\"]:hover > .aparte-media__img { transform: scale(1.025); }\\n\\n.aparte-media__frame:focus-visible {\\n outline: var(--aparte-focus-outline-width) solid var(--aparte-border-focus);\\n outline-offset: var(--aparte-focus-outline-offset);\\n}\\n\\n/* \\\"See it larger\\\": a frosted disc in the corner, shown on hover and focus. */\\n.aparte-media__zoom {\\n --aparte-rich-card-glyph-size: 2rem;\\n position: absolute;\\n inset-block-start: var(--aparte-space-4);\\n inset-inline-end: var(--aparte-space-4);\\n z-index: 2;\\n padding: 0.4rem;\\n border-radius: var(--aparte-radius-full);\\n background: var(--aparte-media-scrim);\\n color: var(--aparte-media-on-stage);\\n backdrop-filter: blur(6px);\\n opacity: 0;\\n transition: opacity var(--aparte-duration-base, 0.15s) ease;\\n}\\n\\n.aparte-media__frame:hover > .aparte-media__zoom,\\n.aparte-media__frame:focus-visible > .aparte-media__zoom { opacity: 1; }\\n\\n.aparte-media__frame[data-broken] > .aparte-media__zoom { display: none; }\\n\\n/* ── A video ─────────────────────────────────────────────────────────── */\\n\\n.aparte-media__frame--video,\\n.aparte-media__external,\\n.aparte-media__lb-video {\\n aspect-ratio: var(--aparte-media-ratio, 16 / 9);\\n max-block-size: var(--aparte-media-max-block);\\n background: var(--aparte-media-stage);\\n}\\n\\n.aparte-media__video {\\n display: block;\\n inline-size: 100%;\\n block-size: 100%;\\n object-fit: contain;\\n background: var(--aparte-media-stage);\\n}\\n\\n/* A page that plays it elsewhere: its poster, a disc with the triangle, the site, the length. */\\n.aparte-media__external {\\n color: var(--aparte-media-on-stage);\\n text-decoration: none;\\n}\\n\\n.aparte-media__external > .aparte-media__img {\\n position: absolute;\\n inset: 0;\\n inline-size: 100%;\\n block-size: 100%;\\n object-fit: cover;\\n transition: transform var(--aparte-duration-slower, 0.3s) ease;\\n}\\n\\n.aparte-media__external:hover > .aparte-media__img { transform: scale(1.03); }\\n\\n.aparte-media__external:focus-visible {\\n outline: var(--aparte-focus-outline-width) solid var(--aparte-border-focus);\\n outline-offset: var(--aparte-focus-outline-offset);\\n}\\n\\n.aparte-media__play {\\n position: absolute;\\n inset-block-start: 50%;\\n inset-inline-start: 50%;\\n z-index: 2;\\n display: grid;\\n place-items: center;\\n inline-size: 3.5rem;\\n block-size: 3.5rem;\\n border-radius: var(--aparte-radius-full);\\n background: var(--aparte-media-scrim);\\n color: var(--aparte-media-on-stage);\\n box-shadow: 0 0 0 1px rgb(255 255 255 / 0.25) inset, 0 6px 20px -6px rgb(0 0 0 / 0.6);\\n backdrop-filter: blur(6px);\\n translate: -50% -50%;\\n transition: background-color var(--aparte-duration-base, 0.15s) ease, scale var(--aparte-duration-base, 0.15s) ease;\\n}\\n\\n/* `translate` is physical: in a right-to-left page the start edge is the right one. */\\n.aparte-media__play:dir(rtl) { translate: 50% -50%; }\\n\\n.aparte-media__play-glyph { --aparte-rich-card-glyph-size: 1.5rem; margin-inline-start: 0.15rem; }\\n.aparte-media__play:dir(rtl) .aparte-media__play-glyph { margin-inline: 0 0.15rem; transform: scaleX(-1); }\\n\\n.aparte-media__play--sm { inline-size: 2.5rem; block-size: 2.5rem; }\\n.aparte-media__play--sm .aparte-media__play-glyph { --aparte-rich-card-glyph-size: 1.1rem; }\\n\\n.aparte-media__external:hover .aparte-media__play,\\n.aparte-media__tile:hover .aparte-media__play {\\n background: var(--aparte-primary);\\n scale: 1.08;\\n}\\n\\n.aparte-media__site,\\n.aparte-media__duration {\\n position: absolute;\\n inset-block-end: var(--aparte-space-4);\\n z-index: 2;\\n display: inline-flex;\\n align-items: center;\\n gap: var(--aparte-space-2);\\n padding: var(--aparte-space-1) var(--aparte-space-3);\\n border-radius: var(--aparte-radius-sm);\\n background: var(--aparte-media-scrim);\\n color: var(--aparte-media-on-stage);\\n font-size: var(--aparte-font-size-xs);\\n font-weight: var(--aparte-font-weight-semibold);\\n line-height: 1.3;\\n white-space: nowrap;\\n}\\n\\n.aparte-media__site { inset-inline-start: var(--aparte-space-4); }\\n.aparte-media__duration { inset-inline-end: var(--aparte-space-4); }\\n.aparte-media__site-glyph { --aparte-rich-card-glyph-size: 0.8rem; }\\n\\n/* ── A sound ─────────────────────────────────────────────────────────── */\\n\\n.aparte-media__audio {\\n display: grid;\\n gap: var(--aparte-space-4);\\n padding: var(--aparte-space-3) var(--aparte-space-2) 0;\\n}\\n\\n.aparte-media__audio-head {\\n display: flex;\\n align-items: center;\\n gap: var(--aparte-space-5);\\n min-inline-size: 0;\\n}\\n\\n.aparte-media__cover {\\n position: relative;\\n flex: none;\\n inline-size: 3.5rem;\\n block-size: 3.5rem;\\n overflow: hidden;\\n border-radius: var(--aparte-radius-lg);\\n box-shadow: 0 4px 14px -8px color-mix(in oklab, var(--aparte-media-tint) 70%, black);\\n}\\n\\n.aparte-media__cover > .aparte-media__img {\\n position: absolute;\\n inset: 0;\\n inline-size: 100%;\\n block-size: 100%;\\n object-fit: cover;\\n}\\n\\n.aparte-media__cover > .aparte-media__placeholder {\\n background: linear-gradient(135deg, color-mix(in oklab, var(--aparte-media-tint) 30%, var(--aparte-surface-1)), color-mix(in oklab, var(--aparte-media-tint) 10%, var(--aparte-surface-2)));\\n}\\n\\n.aparte-media__audio-text {\\n display: flex;\\n flex: 1;\\n flex-direction: column;\\n gap: var(--aparte-space-1);\\n min-inline-size: 0;\\n}\\n\\n.aparte-media__audio-title,\\n.aparte-media__audio-credit {\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n\\n.aparte-media__audio-title {\\n font-size: var(--aparte-font-size-base);\\n font-weight: var(--aparte-font-weight-semibold);\\n}\\n\\n.aparte-media__audio-credit,\\n.aparte-media__audio-length {\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-sm);\\n}\\n\\n.aparte-media__audio-length { flex: none; }\\n\\n/* A waveform that is only decoration: bars cut by a mask, their tops following a fixed\\n envelope cut by a polygon. It shows no real level, so it says nothing to a reader. */\\n.aparte-media__wave {\\n display: block;\\n block-size: 2.25rem;\\n background: linear-gradient(90deg,\\n var(--aparte-media-tint) 0%,\\n color-mix(in oklab, var(--aparte-media-tint) 70%, transparent) 50%,\\n color-mix(in oklab, var(--aparte-media-tint) 28%, transparent) 50%,\\n color-mix(in oklab, var(--aparte-media-tint) 28%, transparent) 100%);\\n background-size: 200% 100%;\\n background-position: 100% 0;\\n -webkit-mask-image: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 6px);\\n mask-image: repeating-linear-gradient(90deg, #000 0 3px, transparent 3px 6px);\\n clip-path: polygon(\\n 0% 35%, 5% 22.5%, 10% 30%, 15% 10%, 20% 20%, 25% 2.5%, 30% 15%, 35% 27.5%, 40% 7.5%, 45% 25%, 50% 12.5%,\\n 55% 32.5%, 60% 5%, 65% 20%, 70% 30%, 75% 15%, 80% 25%, 85% 10%, 90% 27.5%, 95% 35%, 100% 37.5%,\\n 100% 62.5%, 95% 65%, 90% 72.5%, 85% 90%, 80% 75%, 75% 85%, 70% 70%, 65% 80%, 60% 95%, 55% 67.5%,\\n 50% 87.5%, 45% 75%, 40% 92.5%, 35% 72.5%, 30% 85%, 25% 97.5%, 20% 80%, 15% 90%, 10% 70%, 5% 77.5%, 0% 65%);\\n}\\n\\n/* While it plays, the colour sweeps across the bars. */\\n.aparte-media__audio[data-playing] .aparte-media__wave {\\n animation: aparte-media-wave 2.4s linear infinite;\\n}\\n\\n@keyframes aparte-media-wave {\\n from { background-position: 100% 0; }\\n to { background-position: 0% 0; }\\n}\\n\\n.aparte-media__player {\\n display: block;\\n inline-size: 100%;\\n block-size: 2.5rem;\\n}\\n\\n/* ── Under a medium ──────────────────────────────────────────────────── */\\n\\n.aparte-media__figcaption {\\n display: flex;\\n flex-direction: column;\\n gap: var(--aparte-space-1);\\n min-inline-size: 0;\\n padding: var(--aparte-space-4) var(--aparte-space-2) 0;\\n}\\n\\n.aparte-media__title {\\n font-size: var(--aparte-font-size-base);\\n font-weight: var(--aparte-font-weight-semibold);\\n letter-spacing: -0.005em;\\n line-height: 1.3;\\n overflow-wrap: anywhere;\\n}\\n\\n.aparte-media__caption {\\n display: -webkit-box;\\n margin: 0;\\n overflow: hidden;\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-md);\\n line-height: 1.45;\\n overflow-wrap: anywhere;\\n -webkit-box-orient: vertical;\\n -webkit-line-clamp: 4;\\n}\\n\\n.aparte-media__meta {\\n display: flex;\\n flex-wrap: wrap;\\n align-items: center;\\n gap: var(--aparte-space-2) var(--aparte-space-5);\\n margin-block-start: var(--aparte-space-2);\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-sm);\\n}\\n\\n.aparte-media__credit {\\n display: inline-flex;\\n align-items: center;\\n gap: var(--aparte-space-2);\\n min-inline-size: 0;\\n}\\n\\n.aparte-media__source {\\n display: inline-flex;\\n align-items: center;\\n gap: var(--aparte-space-1);\\n border-radius: var(--aparte-radius-xs);\\n color: var(--aparte-primary-ink, var(--aparte-text));\\n font-weight: var(--aparte-font-weight-medium);\\n text-decoration: none;\\n}\\n\\n.aparte-media__source:hover {\\n text-decoration: underline;\\n text-decoration-thickness: 1px;\\n text-underline-offset: 0.18em;\\n}\\n\\n.aparte-media__source:focus-visible {\\n outline: var(--aparte-focus-outline-width) solid var(--aparte-border-focus);\\n outline-offset: var(--aparte-focus-outline-offset);\\n}\\n\\n.aparte-media__line-glyph { --aparte-rich-card-glyph-size: 0.95rem; }\\n.aparte-media__source .aparte-media__line-glyph { --aparte-rich-card-glyph-size: 0.8rem; }\\n\\n/* ── Tiles: the mosaic's and the strip's ─────────────────────────────── */\\n\\n.aparte-media__tile {\\n position: relative;\\n display: block;\\n inline-size: 100%;\\n block-size: 100%;\\n margin: 0;\\n padding: 0;\\n overflow: hidden;\\n border: 0;\\n background: var(--aparte-surface-2);\\n color: inherit;\\n font: inherit;\\n cursor: zoom-in;\\n}\\n\\n.aparte-media__tile > .aparte-media__img {\\n position: absolute;\\n inset: 0;\\n inline-size: 100%;\\n block-size: 100%;\\n object-fit: cover;\\n transition: transform var(--aparte-duration-slower, 0.3s) ease, filter var(--aparte-duration-slower, 0.3s) ease;\\n}\\n\\n.aparte-media__tile:hover > .aparte-media__img {\\n transform: scale(1.05);\\n filter: brightness(1.05);\\n}\\n\\n/* The focus ring is drawn inside the tile, over the picture: tiles touch each other and the\\n card's edge, so a ring outside would be cut. Two rings, so it reads on any picture. */\\n.aparte-media__tile::after {\\n content: \\\"\\\";\\n position: absolute;\\n inset: 0;\\n z-index: 4;\\n border-radius: inherit;\\n pointer-events: none;\\n}\\n\\n.aparte-media__tile:focus-visible { outline: none; }\\n\\n.aparte-media__tile:focus-visible::after {\\n box-shadow:\\n inset 0 0 0 var(--aparte-focus-outline-width) var(--aparte-border-focus),\\n inset 0 0 0 calc(var(--aparte-focus-outline-width) * 2) var(--aparte-surface-1);\\n}\\n\\n.aparte-media__tile[data-kind=\\\"audio\\\"] { cursor: pointer; }\\n\\n.aparte-media__tile-title {\\n position: absolute;\\n inset-inline: var(--aparte-space-3);\\n inset-block-end: var(--aparte-space-3);\\n z-index: 2;\\n overflow: hidden;\\n color: var(--aparte-text);\\n font-size: var(--aparte-font-size-xs);\\n font-weight: var(--aparte-font-weight-semibold);\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n\\n.aparte-media__tile .aparte-media__duration {\\n inset-block-end: var(--aparte-space-3);\\n inset-inline-end: var(--aparte-space-3);\\n}\\n\\n/* \\\"+3\\\": how many more the lightbox holds, over the last tile. */\\n.aparte-media__more {\\n position: absolute;\\n inset: 0;\\n z-index: 3;\\n display: grid;\\n place-items: center;\\n background: var(--aparte-media-scrim);\\n color: var(--aparte-media-on-stage);\\n font-size: var(--aparte-font-size-2xl);\\n font-weight: var(--aparte-font-weight-semibold);\\n letter-spacing: -0.01em;\\n backdrop-filter: blur(1.5px);\\n transition: background-color var(--aparte-duration-base, 0.15s) ease;\\n}\\n\\n.aparte-media__tile:hover > .aparte-media__more { background: rgb(0 0 0 / 0.42); }\\n\\n/* ── Gallery: the mosaic ─────────────────────────────────────────────── */\\n\\n.aparte-media--gallery {\\n display: flex;\\n flex-direction: column;\\n}\\n\\n/* A six-column grid laid out per count, so every count fills its box with no hole:\\n 2 two squares\\n 3 a large square, two small ones stacked beside it\\n 4 a wide one over three\\n 5 two over three\\n 6 a large square, two beside it, three under it */\\n.aparte-media__grid {\\n display: grid;\\n grid-template-columns: repeat(6, minmax(0, 1fr));\\n gap: var(--aparte-media-gap);\\n margin: 0;\\n padding: 0;\\n list-style: none;\\n aspect-ratio: 3 / 2;\\n}\\n\\n.aparte-media__grid > * {\\n display: flex;\\n grid-column: span 2;\\n min-inline-size: 0;\\n min-block-size: 0;\\n}\\n\\n.aparte-media__grid > * > .aparte-media__tile { flex: 1; }\\n\\n.aparte-media__grid[data-count=\\\"2\\\"] { grid-template-rows: minmax(0, 1fr); aspect-ratio: 2 / 1; }\\n.aparte-media__grid[data-count=\\\"2\\\"] > * { grid-column: span 3; }\\n\\n.aparte-media__grid[data-count=\\\"3\\\"] { grid-template-rows: repeat(2, minmax(0, 1fr)); }\\n.aparte-media__grid[data-count=\\\"3\\\"] > :first-child { grid-column: span 4; grid-row: span 2; }\\n\\n.aparte-media__grid[data-count=\\\"4\\\"] { grid-template-rows: minmax(0, 2fr) minmax(0, 1fr); aspect-ratio: 4 / 3; }\\n.aparte-media__grid[data-count=\\\"4\\\"] > :first-child { grid-column: span 6; }\\n\\n.aparte-media__grid[data-count=\\\"5\\\"] { grid-template-rows: repeat(2, minmax(0, 1fr)); }\\n.aparte-media__grid[data-count=\\\"5\\\"] > :nth-child(-n + 2) { grid-column: span 3; }\\n\\n.aparte-media__grid[data-count=\\\"6\\\"] { grid-template-rows: repeat(3, minmax(0, 1fr)); aspect-ratio: 1; }\\n.aparte-media__grid[data-count=\\\"6\\\"] > :first-child { grid-column: span 4; grid-row: span 2; }\\n\\n/* The collection's line: under the mosaic, over the strip. */\\n.aparte-media__heading {\\n display: flex;\\n align-items: center;\\n gap: var(--aparte-space-3);\\n min-inline-size: 0;\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-md);\\n}\\n\\n.aparte-media--gallery > .aparte-media__heading { padding: var(--aparte-space-4) var(--aparte-space-6) var(--aparte-space-5); }\\n\\n.aparte-media__heading-title {\\n overflow: hidden;\\n color: var(--aparte-text);\\n font-weight: var(--aparte-font-weight-semibold);\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n\\n.aparte-media__heading-title + .aparte-media__count::before {\\n content: \\\"·\\\";\\n margin-inline-end: var(--aparte-space-3);\\n}\\n\\n.aparte-media__count { flex: none; }\\n\\n/* ── Strip: square thumbnails in the kit's carousel ──────────────────── */\\n\\n.aparte-media--strip {\\n display: grid;\\n gap: var(--aparte-space-5);\\n padding: var(--aparte-space-5) var(--aparte-space-6) var(--aparte-space-6);\\n}\\n\\n.aparte-media--strip .aparte-rich-card__carousel {\\n --aparte-rich-card-slide-size: 7rem;\\n --aparte-rich-card-slide-gap: var(--aparte-space-4);\\n}\\n\\n.aparte-media__thumb {\\n display: flex;\\n flex-direction: column;\\n gap: var(--aparte-space-2);\\n min-inline-size: 0;\\n}\\n\\n.aparte-media__thumb > .aparte-media__tile {\\n block-size: auto;\\n aspect-ratio: 1;\\n border-radius: var(--aparte-radius-lg);\\n box-shadow: 0 0 0 var(--aparte-border-width) color-mix(in oklab, var(--aparte-text) 8%, transparent);\\n transition: translate var(--aparte-duration-base, 0.15s) ease, box-shadow var(--aparte-duration-base, 0.15s) ease;\\n}\\n\\n.aparte-media__thumb > .aparte-media__tile:hover {\\n translate: 0 -2px;\\n box-shadow: 0 10px 20px -14px rgb(0 0 0 / 0.55);\\n}\\n\\n.aparte-media__thumb-title {\\n overflow: hidden;\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-sm);\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n\\n/* ── The lightbox ────────────────────────────────────────────────────── */\\n\\n/* Two classes: it must win over the recipe's `--lg` whatever order the sheets land in. */\\n.aparte-dialog.aparte-media__lightbox { --aparte-dialog-width: 56rem; }\\n\\n.aparte-media__lb-head { padding-block-end: var(--aparte-space-4); }\\n\\n.aparte-media__lb-heading {\\n display: flex;\\n flex: 1;\\n align-items: baseline;\\n gap: var(--aparte-space-4);\\n min-inline-size: 0;\\n}\\n\\n.aparte-media__lb-title {\\n flex: 0 1 auto;\\n overflow: hidden;\\n text-overflow: ellipsis;\\n white-space: nowrap;\\n}\\n\\n.aparte-media__lb-counter {\\n flex: none;\\n color: var(--aparte-text-muted);\\n font-size: var(--aparte-font-size-sm);\\n font-variant-numeric: tabular-nums;\\n}\\n\\n/* The stage: the picture on black, as large as the window lets it be. */\\n.aparte-media__lb-body {\\n position: relative;\\n display: grid;\\n min-block-size: 12rem;\\n background: var(--aparte-media-stage);\\n}\\n\\n.aparte-media__lb-stage {\\n display: grid;\\n place-items: center;\\n min-inline-size: 0;\\n max-block-size: var(--aparte-media-lightbox-block);\\n}\\n\\n.aparte-media__lb-picture {\\n position: relative;\\n display: grid;\\n place-items: center;\\n inline-size: 100%;\\n min-block-size: 12rem;\\n}\\n\\n.aparte-media__lb-picture > .aparte-media__placeholder {\\n background: none;\\n color: rgb(255 255 255 / 0.4);\\n}\\n\\n.aparte-media__lb-picture:not([data-loading], [data-broken]) > .aparte-media__placeholder { display: none; }\\n\\n.aparte-media__lb-img {\\n position: relative;\\n z-index: 1;\\n display: block;\\n inline-size: auto;\\n block-size: auto;\\n max-inline-size: 100%;\\n max-block-size: var(--aparte-media-lightbox-block);\\n object-fit: contain;\\n}\\n\\n.aparte-media__lb-video {\\n inline-size: 100%;\\n max-block-size: var(--aparte-media-lightbox-block);\\n}\\n\\n.aparte-media__lb-stage > .aparte-media__external {\\n inline-size: 100%;\\n max-block-size: var(--aparte-media-lightbox-block);\\n border-radius: 0;\\n}\\n\\n.aparte-media__lb-stage > .aparte-media__audio {\\n inline-size: min(100% - var(--aparte-space-8) * 2, 28rem);\\n margin: var(--aparte-space-8);\\n padding: var(--aparte-space-6);\\n border-radius: var(--aparte-radius-xl);\\n background: var(--aparte-surface-1);\\n}\\n\\n.aparte-media__lb-nav {\\n position: absolute;\\n inset-block-start: 50%;\\n z-index: 2;\\n translate: 0 -50%;\\n box-shadow: 0 2px 12px -2px rgb(0 0 0 / 0.45);\\n}\\n\\n.aparte-media__lb-nav--prev { inset-inline-start: var(--aparte-space-5); }\\n.aparte-media__lb-nav--next { inset-inline-end: var(--aparte-space-5); }\\n.aparte-media__lb-nav:dir(rtl) { transform: scaleX(-1); }\\n\\n/* At either end the button stays where it is, and stays focusable — a disabled button\\n would drop the keyboard's focus out of the dialog — but says it leads nowhere. */\\n.aparte-media__lb-nav[aria-disabled=\\\"true\\\"] {\\n opacity: 0.35;\\n cursor: default;\\n}\\n\\n.aparte-media__lb-caption {\\n display: flex;\\n flex-direction: column;\\n gap: var(--aparte-space-1);\\n padding: var(--aparte-space-5) var(--aparte-space-6) var(--aparte-space-6);\\n}\\n\\n.aparte-media__lb-caption[hidden] { display: none; }\\n\\n.aparte-media__lb-caption > .aparte-media__caption { -webkit-line-clamp: 6; }\\n\\n/* ── Loading ─────────────────────────────────────────────────────────── */\\n\\n.aparte-media-card[data-state=\\\"loading\\\"] .aparte-media__sk-frame {\\n block-size: auto;\\n aspect-ratio: 4 / 3;\\n border-radius: var(--aparte-radius-lg);\\n}\\n\\n.aparte-media-card[data-state=\\\"loading\\\"] .aparte-media__sk-cell {\\n block-size: auto;\\n border-radius: 0;\\n}\\n\\n.aparte-media-card[data-state=\\\"loading\\\"] .aparte-media__sk-line { inline-size: 60%; }\\n.aparte-media-card[data-state=\\\"loading\\\"] .aparte-media__sk-line--short { inline-size: 35%; }\\n\\n.aparte-media__sk-row {\\n display: flex;\\n gap: var(--aparte-space-4);\\n overflow: hidden;\\n}\\n\\n.aparte-media-card[data-state=\\\"loading\\\"] .aparte-media__sk-thumb {\\n flex: none;\\n inline-size: 7rem;\\n block-size: 7rem;\\n border-radius: var(--aparte-radius-lg);\\n}\\n\\n/* ── Small screens, and stillness ────────────────────────────────────── */\\n\\n@media (max-width: 380px) {\\n .aparte-media-card { --aparte-media-max-block: 18rem; }\\n .aparte-media--single { padding: var(--aparte-space-3) var(--aparte-space-3) var(--aparte-space-4); }\\n .aparte-media--strip { padding: var(--aparte-space-4) var(--aparte-space-5) var(--aparte-space-5); }\\n .aparte-media--strip .aparte-rich-card__carousel { --aparte-rich-card-slide-size: 6rem; }\\n .aparte-media__play { inline-size: 3rem; block-size: 3rem; }\\n .aparte-media__lb-nav--prev { inset-inline-start: var(--aparte-space-3); }\\n .aparte-media__lb-nav--next { inset-inline-end: var(--aparte-space-3); }\\n}\\n\\n@media (prefers-reduced-motion: reduce) {\\n .aparte-media__frame:hover > .aparte-media__img,\\n .aparte-media__tile:hover > .aparte-media__img,\\n .aparte-media__external:hover > .aparte-media__img { transform: none; }\\n .aparte-media__thumb > .aparte-media__tile:hover { translate: none; }\\n .aparte-media__external:hover .aparte-media__play,\\n .aparte-media__tile:hover .aparte-media__play { scale: none; }\\n .aparte-media__audio[data-playing] .aparte-media__wave { animation: none; }\\n}\\n\"", "/**\n * @aparte/plugin-cards/media — a tool's pictures, videos and sounds, drawn as a card: one\n * photo large, a gallery as a mosaic, a row of thumbnails, a lightbox to see each one big.\n *\n * import { setupMediaCard } from '@aparte/plugin-cards/media';\n *\n * setupMediaCard({ tool: 'generate_image' }); // DALL·E's `{ data: [{ url }] }` as it is\n * setupMediaCard({ tool: 'search_photos', map: (r) => r.results }); // Unsplash, Pexels…\n *\n * One medium, several (`[...]`), or `{ title, items: [...] }`. Three variants of one card:\n * `single` (the first medium large, its caption under it), `gallery` (a mosaic, the first\n * larger, \"+3\" on the last tile) and `strip` (square thumbnails that scroll sideways). Every\n * picture opens in a lightbox: the browser's own `<dialog>`, wearing core's `.aparte-dialog`.\n *\n * Nothing here plays a third party: a video is the native `<video>`, a sound the native\n * `<audio>`, and a YouTube or Vimeo page is a poster that LINKS to it — no iframe, no\n * player script. What the browser fetches is what the tool's data names — the medium, its\n * poster — and nothing else: no thumbnail is derived from a video's address, no service\n * is asked about a link. An HLS or DASH stream (`.m3u8`, `.mpd`) plays in the native\n * `<video>` only where the browser says it can (Safari, for HLS); elsewhere it would need a\n * player script, so it is a poster that links out, like a YouTube page.\n */\nimport type { AparteConfig } from '@aparte/core';\nimport { carousel } from '../kit/carousel.js';\nimport { defineCard, type CardContext, type CardSetupOptions } from '../kit/define.js';\nimport { el, glyph, num, safeUrl, str, webUrl, type Loose } from '../kit/dom.js';\nimport { formatNumber, formatUnit } from '../kit/format.js';\nimport { KIT_WORDS, word, type CardWord } from '../kit/strings.js';\nimport { CAMERA, EXPAND, EXTERNAL, FRAMES, PLAY, kindGlyph } from './icons.js';\nimport mediaStyles from './media.css?raw';\n\nexport type MediaKind = 'image' | 'video' | 'audio';\nexport type MediaVariant = 'single' | 'gallery' | 'strip';\n\n/**\n * A medium as `map` returns it. Only `src` is needed; every other field adds something when\n * it is there and nothing when it is not. `readMedia` also reads the usual aliases (listed\n * on each field).\n */\nexport interface MediumInput {\n /** Read from the address's extension or `mimeType` when absent. Also `type`, `mediaType`. */\n kind?: MediaKind;\n /** An `http(s)` address. Also `url`, `link`, `href`, `image`, `imageUrl`, `thumbnail`, Unsplash's `urls.regular`. */\n src: string;\n /** The still shown before a video plays, the cover of a sound, a smaller copy of an image for its tile. Also `thumb`, `preview`. */\n poster?: string;\n title?: string;\n /** Also `description`, and an image model's `revised_prompt`. */\n caption?: string;\n /** Who made it, or where it comes from. Also `author`, `source`, `photographer`, Unsplash's `user.name`. */\n credit?: string;\n /** What the picture shows, for a reader who cannot see it. Also `alt_description`. */\n alt?: string;\n /** With `height`, reserves the picture's shape before it loads — nothing jumps when it does. */\n width?: number;\n height?: number;\n /** In seconds; `\"3:42\"` and ISO 8601 (`\"PT3M42S\"`) are read too. */\n duration?: number | string;\n mimeType?: string;\n /** The page the medium comes from. */\n url?: string;\n}\n\n/** A medium as the card draws it, once read. */\nexport interface Medium {\n kind: MediaKind;\n src: string;\n /**\n * Set when `src` is a video's page on a site that plays it itself (\"YouTube\", \"Vimeo\"):\n * drawn as a poster that links out, never embedded.\n */\n site?: string;\n poster?: string;\n title?: string;\n caption?: string;\n credit?: string;\n alt?: string;\n width?: number;\n height?: number;\n duration?: number;\n mimeType?: string;\n url?: string;\n}\n\n/** The card's data: one medium or several, and the collection's title. */\nexport interface MediaData {\n title?: string;\n items: Medium[];\n}\n\nexport type MediaCardOptions = CardSetupOptions<MediaData, MediaVariant>;\n\nconst M = {\n cardsMediaTitle: { en: 'Media', fr: 'Médias', de: 'Medien', es: 'Multimedia', it: 'Contenuti multimediali', ja: 'メディア', ko: '미디어', pt: 'Mídia', ru: 'Медиа', zh: '媒体' },\n cardsMediaPhotoCount: { en: '{n} photos', fr: '{n} photos', de: '{n} Fotos', es: '{n} fotos', it: '{n} foto', ja: '写真{n}枚', ko: '사진 {n}장', pt: '{n} fotos', ru: 'Фото: {n}', zh: '{n} 张照片' },\n cardsMediaVideoCount: { en: '{n} videos', fr: '{n} vidéos', de: '{n} Videos', es: '{n} vídeos', it: '{n} video', ja: '動画{n}本', ko: '동영상 {n}개', pt: '{n} vídeos', ru: 'Видео: {n}', zh: '{n} 个视频' },\n cardsMediaCount: { en: '{n} items', fr: '{n} éléments', de: '{n} Elemente', es: '{n} elementos', it: '{n} elementi', ja: 'メディア{n}件', ko: '미디어 {n}개', pt: '{n} itens', ru: 'Файлов: {n}', zh: '{n} 个媒体' },\n cardsMediaImage: { en: 'Image', fr: 'Image', de: 'Bild', es: 'Imagen', it: 'Immagine', ja: '画像', ko: '이미지', pt: 'Imagem', ru: 'Изображение', zh: '图片' },\n cardsMediaVideo: { en: 'Video', fr: 'Vidéo', de: 'Video', es: 'Vídeo', it: 'Video', ja: '動画', ko: '동영상', pt: 'Vídeo', ru: 'Видео', zh: '视频' },\n cardsMediaAudio: { en: 'Audio', fr: 'Audio', de: 'Audio', es: 'Audio', it: 'Audio', ja: '音声', ko: '오디오', pt: 'Áudio', ru: 'Аудио', zh: '音频' },\n cardsMediaMore: { en: '{n} more', fr: '{n} de plus', de: '{n} weitere', es: '{n} más', it: 'altri {n}', ja: 'ほか{n}件', ko: '{n}개 더', pt: 'mais {n}', ru: 'ещё {n}', zh: '另外 {n} 个' },\n cardsMediaView: { en: 'View larger', fr: 'Agrandir', de: 'Vergrößern', es: 'Ampliar', it: 'Ingrandisci', ja: '拡大表示', ko: '크게 보기', pt: 'Ampliar', ru: 'Увеличить', zh: '放大查看' },\n cardsMediaClose: { en: 'Close', fr: 'Fermer', de: 'Schließen', es: 'Cerrar', it: 'Chiudi', ja: '閉じる', ko: '닫기', pt: 'Fechar', ru: 'Закрыть', zh: '关闭' },\n cardsMediaWatchOn: { en: 'Watch on {site}', fr: 'Regarder sur {site}', de: 'Auf {site} ansehen', es: 'Ver en {site}', it: 'Guarda su {site}', ja: '{site}で見る', ko: '{site}에서 보기', pt: 'Assistir no {site}', ru: 'Смотреть на {site}', zh: '在 {site} 上观看' },\n} satisfies Record<string, CardWord>;\n\nconst KIND_WORD = { image: 'cardsMediaImage', video: 'cardsMediaVideo', audio: 'cardsMediaAudio' } as const;\n\n/** The most media one card holds; a search that returns a hundred is a page, not a card. */\nconst MAX_MEDIA = 24;\n/** The tiles a gallery's mosaic shows; the last says how many more the lightbox holds. */\nconst GALLERY_TILES = 6;\n\n// ── Reading ──────────────────────────────────────────────────────────────────\n\nconst IMAGE_EXT = /\\.(jpe?g|png|gif|webp|avif|svg|bmp|ico|heic|heif|jxl)$/i;\nconst VIDEO_EXT = /\\.(mp4|m4v|webm|mov|ogv|mkv|m3u8|mpd)$/i;\nconst AUDIO_EXT = /\\.(mp3|m4a|aac|wav|ogg|oga|opus|flac|weba)$/i;\n\n/** A video site whose page plays the video itself: linked to, never embedded. */\nfunction videoSite(url: string): string | undefined {\n const host = new URL(url).hostname.replace(/^(www|m)\\./, '');\n if (host === 'youtu.be' || /(^|\\.)youtube(-nocookie)?\\.com$/.test(host)) return 'YouTube';\n if (/(^|\\.)vimeo\\.com$/.test(host)) return 'Vimeo';\n return undefined;\n}\n\n/** The kind a tool's word or MIME type says: \"photo\", \"image/png\", \"podcast\". */\nfunction kindOfWord(value: unknown): MediaKind | undefined {\n const s = str(value)?.toLowerCase();\n if (!s) return undefined;\n if (/^image\\/|^(image|photo|picture|img|gif|illustration|drawing)s?$/.test(s)) return 'image';\n if (/^video\\/|^application\\/(x-mpegurl|vnd\\.apple\\.mpegurl|dash\\+xml)$|^(video|movie|clip|film)s?$/.test(s)) return 'video';\n if (/^audio\\/|^(audio|sound|music|song|track|podcast|voice|recording)s?$/.test(s)) return 'audio';\n return undefined;\n}\n\n/**\n * A stream's type, when the medium is one: HLS or DASH, by its MIME type or its extension.\n * A playlist, not a file — Chrome and Firefox play neither in a `<video>` without a player\n * script, which this card does not load.\n */\nfunction streamType(m: Medium): string | undefined {\n if (m.mimeType && /^application\\/(x-mpegurl|vnd\\.apple\\.mpegurl|dash\\+xml)$/i.test(m.mimeType)) return m.mimeType;\n const path = new URL(m.src).pathname;\n if (/\\.m3u8$/i.test(path)) return 'application/vnd.apple.mpegurl';\n if (/\\.mpd$/i.test(path)) return 'application/dash+xml';\n return undefined;\n}\n\n/** Whether the browser's own `<video>` plays this medium: asked, for a stream (Safari says \"maybe\" to HLS). */\nfunction playsHere(m: Medium): boolean {\n const type = streamType(m);\n return !type || document.createElement('video').canPlayType(type) !== '';\n}\n\nfunction kindOfUrl(url: string): MediaKind | undefined {\n const path = new URL(url).pathname;\n if (IMAGE_EXT.test(path)) return 'image';\n if (VIDEO_EXT.test(path)) return 'video';\n if (AUDIO_EXT.test(path)) return 'audio';\n return undefined;\n}\n\n/**\n * A length in seconds from what tools write: a number, `\"3:42\"`, `\"1:02:03\"`, ISO 8601's\n * `\"PT3M42S\"` (YouTube's API). `undefined` for anything else.\n */\nexport function readDuration(value: unknown): number | undefined {\n const n = num(value);\n if (n !== undefined) return n >= 0 ? n : undefined;\n const s = str(value);\n if (!s) return undefined;\n const clock = /^(?:(\\d+):)?(\\d{1,2}):(\\d{2})(?:\\.\\d+)?$/.exec(s);\n if (clock) {\n const [h, m, sec] = [Number(clock[1] ?? 0), Number(clock[2]), Number(clock[3])];\n if (sec > 59 || (clock[1] !== undefined && m > 59)) return undefined;\n return h * 3600 + m * 60 + sec;\n }\n const iso = /^PT(?:(\\d+(?:\\.\\d+)?)H)?(?:(\\d+(?:\\.\\d+)?)M)?(?:(\\d+(?:\\.\\d+)?)S)?$/i.exec(s);\n if (iso && (iso[1] || iso[2] || iso[3])) return Number(iso[1] ?? 0) * 3600 + Number(iso[2] ?? 0) * 60 + Number(iso[3] ?? 0);\n return undefined;\n}\n\nfunction textOf(value: unknown): string | undefined {\n if (value && typeof value === 'object') {\n const o = value as Record<string, unknown>;\n return str(o['name'] ?? o['title'] ?? o['text'] ?? o['username']);\n }\n return str(value);\n}\n\n/** An address given as a string, or as an object that holds one — Pexels' `src` is `{ large, original, … }`. */\nfunction linkOf(value: unknown): unknown {\n const first = Array.isArray(value) ? value[0] : value;\n if (!first || typeof first !== 'object') return first;\n const o = first as Record<string, unknown>;\n for (const key of ['url', 'src', 'href', 'uri', 'link', 'regular', 'large2x', 'large', 'medium', 'original', 'full', 'small']) {\n if (typeof o[key] === 'string') return o[key];\n }\n return undefined;\n}\n\n/**\n * An address a medium can be loaded from: `http(s)`, protocol-relative, or a path on this\n * site. A bare word (\"nope\", Google's photo names) would resolve against the page and load\n * something that is not there.\n */\nfunction address(value: unknown): string | undefined {\n const s = str(linkOf(value));\n if (!s || !(/^https?:\\/\\//i.test(s) || s.startsWith('/'))) return undefined;\n // A path on the app's own server (`/uploads/cat.png`) on purpose: media an app serves\n // itself. `webUrl` refuses relative addresses, so this one is resolved here.\n if (s.startsWith('/') && !s.startsWith('//')) {\n const own = safeUrl(s);\n return own && /^https?:/i.test(own) ? own : undefined;\n }\n return webUrl(s.startsWith('//') ? `https:${s}` : s) ?? undefined;\n}\n\nconst positive = (value: unknown) => {\n const n = num(value);\n return n !== undefined && n > 0 ? n : undefined;\n};\n\nfunction readMedium(raw: unknown): Medium | null {\n const value = typeof raw === 'string' ? { src: raw } : raw;\n if (!value || typeof value !== 'object' || Array.isArray(value)) return null;\n const r = value as Loose;\n const urls = r['urls'] && typeof r['urls'] === 'object' ? r['urls'] : {};\n const videoFile = Array.isArray(r['video_files']) ? r['video_files'].find((f: Loose) => address(f?.['link'])) : undefined;\n // Where the medium is, from the key surest of it. `url` and `link` come late: beside a\n // proper source they are the page the medium comes from (Unsplash, Pexels).\n const sources: Array<[string, unknown]> = [\n ['src', r['src']], ['videoFile', videoFile?.['link']], ['image', r['image']], ['imageUrl', r['imageUrl'] ?? r['image_url']],\n ['urls', urls['regular'] ?? urls['full'] ?? urls['small'] ?? urls['raw']], ['contentUrl', r['contentUrl'] ?? r['fileUrl'] ?? r['file_url']],\n ['url', r['url']], ['link', r['link']], ['href', r['href']], ['thumbnail', r['thumbnail']],\n ];\n let src: string | undefined;\n let from = '';\n for (const [key, candidate] of sources) {\n const url = address(candidate);\n if (url) {\n src = url;\n from = key;\n break;\n }\n }\n if (!src) return null;\n\n const page = [r['page'], r['pageUrl'], r['page_url'], r['links']?.['html'], from === 'url' ? undefined : r['url'], from === 'link' ? undefined : r['link'], r['sourceUrl'], r['source_url']]\n .map(address)\n .find((v) => v && v !== src);\n const poster = [r['poster'], r['thumb'], r['preview'], r['previewUrl'], r['preview_url'], urls['small'], from === 'thumbnail' ? undefined : r['thumbnail'], videoFile ? r['image'] : undefined, r['cover'], r['artwork']]\n .map(address)\n .find((v) => v && v !== src);\n const mimeType = str(r['mimeType'] ?? r['mime_type'] ?? r['mime'] ?? r['contentType'] ?? r['content_type'] ?? r['encodingFormat'] ?? videoFile?.['file_type']);\n const site = videoSite(src);\n const kind: MediaKind = site\n ? 'video'\n : kindOfWord(r['kind'] ?? r['mediaType'] ?? r['media_type'] ?? r['type']) ?? kindOfWord(mimeType) ?? (videoFile ? 'video' : undefined) ?? kindOfUrl(src) ?? 'image';\n // A credit that is an address is a page, not a name.\n const creditText = textOf(r['credit'] ?? r['author'] ?? r['photographer'] ?? r['artist'] ?? r['creator'] ?? r['user'] ?? r['source'] ?? r['attribution'] ?? r['channelTitle'] ?? r['channel']);\n const width = positive(r['width'] ?? r['w']);\n const height = positive(r['height'] ?? r['h']);\n const ms = positive(r['duration_ms'] ?? r['durationMs']);\n const duration = ms !== undefined ? ms / 1000 : readDuration(r['duration'] ?? r['length'] ?? r['durationSeconds'] ?? r['duration_seconds']);\n return {\n kind,\n src,\n ...(site ? { site } : {}),\n poster,\n title: textOf(r['title'] ?? r['name']),\n caption: textOf(r['caption'] ?? r['description'] ?? r['revised_prompt'] ?? r['revisedPrompt'] ?? r['summary']),\n credit: creditText && !/^https?:\\/\\//i.test(creditText) ? creditText : undefined,\n alt: str(r['alt'] ?? r['altText'] ?? r['alt_text'] ?? r['alt_description'] ?? r['revised_prompt']),\n // Both or neither: one side alone says nothing of the shape.\n ...(width && height ? { width, height } : {}),\n duration,\n mimeType: mimeType?.includes('/') ? mimeType : undefined,\n url: page,\n };\n}\n\n/**\n * The card's data from what `map` returns: one medium (an object, or its address), an array,\n * or a collection (`{ title?, items | media | images | photos | videos | results | data }` —\n * the last is an image model's answer). At most 24; `null` when not one has an `http(s)` source.\n */\nexport function readMedia(raw: unknown): MediaData | null {\n const value = typeof raw === 'string' ? [raw] : raw;\n if (!value || typeof value !== 'object') return null;\n let title: string | undefined;\n let list: unknown[];\n if (Array.isArray(value)) {\n list = value;\n } else {\n const r = value as Record<string, unknown>;\n const nested = ['items', 'media', 'images', 'photos', 'videos', 'results', 'data', 'files'].map((k) => r[k]).find(Array.isArray);\n if (nested) {\n list = nested;\n title = str(r['title']);\n } else {\n list = [value];\n }\n }\n const items = list.map(readMedium).filter((m): m is Medium => m !== null).slice(0, MAX_MEDIA);\n return items.length ? { ...(title ? { title } : {}), items } : null;\n}\n\n/** A length as a player writes it, in the chat's digits: `3:42`, `1:02:03`. */\nexport function formatDuration(config: AparteConfig, seconds: number): string {\n const total = Math.round(seconds);\n const h = Math.floor(total / 3600);\n const m = Math.floor((total % 3600) / 60);\n const s = total % 60;\n const plain = (v: number) => formatNumber(config, v, { useGrouping: false });\n const two = (v: number) => formatNumber(config, v, { minimumIntegerDigits: 2, useGrouping: false });\n return h ? `${plain(h)}:${two(m)}:${two(s)}` : `${plain(m)}:${two(s)}`;\n}\n\n/** The same length said in words, for a label: \"3 min 42 sec\". */\nfunction spokenDuration(config: AparteConfig, seconds: number): string {\n const total = Math.round(seconds);\n const parts: Array<[number, string]> = [[Math.floor(total / 3600), 'hour'], [Math.floor((total % 3600) / 60), 'minute'], [total % 60, 'second']];\n const said = parts.filter(([v]) => v > 0).map(([v, unit]) => formatUnit(config, v, unit));\n return said.length ? said.join(' ') : formatUnit(config, 0, 'second');\n}\n\n/** ISO 8601 for `<time datetime>`: `PT3M42S`. */\nfunction isoDuration(seconds: number): string {\n const total = Math.round(seconds);\n return `PT${Math.floor(total / 3600)}H${Math.floor((total % 3600) / 60)}M${total % 60}S`;\n}\n\n// ── Drawing ──────────────────────────────────────────────────────────────────\n\nconst kindWord = (config: AparteConfig, kind: MediaKind) => word(config, KIND_WORD[kind], M[KIND_WORD[kind]]);\n\n/** What a medium is called: its title, else what it shows, else \"Image 3\" (\"Image\" alone for one). */\nfunction nameOf(config: AparteConfig, m: Medium, index?: number): string {\n const own = m.title ?? m.alt ?? m.caption;\n if (own) return own;\n return index === undefined ? kindWord(config, m.kind) : `${kindWord(config, m.kind)} ${formatNumber(config, index + 1)}`;\n}\n\n/** A picture's alternative text: what it shows first, then what it is called. */\nconst altOf = (config: AparteConfig, m: Medium, index?: number) => m.alt ?? nameOf(config, m, index);\n\nfunction countLabel(config: AparteConfig, items: Medium[]): string {\n const n = formatNumber(config, items.length);\n if (items.every((m) => m.kind === 'image')) return word(config, 'cardsMediaPhotoCount', M.cardsMediaPhotoCount, { n });\n if (items.every((m) => m.kind === 'video')) return word(config, 'cardsMediaVideoCount', M.cardsMediaVideoCount, { n });\n return word(config, 'cardsMediaCount', M.cardsMediaCount, { n });\n}\n\n/** The kind's glyph, on a soft tint, behind where the picture goes: what shows before it loads, or instead of it. */\nfunction placeholder(kind: MediaKind): HTMLElement {\n return el('span', { class: 'aparte-media__placeholder', attrs: { 'aria-hidden': 'true' } },\n glyph(kindGlyph(kind), 'aparte-rich-card__glyph aparte-media__placeholder-glyph'));\n}\n\n/**\n * A picture in `holder`, lazy and decoded off the main thread. One that fails to load is\n * removed, and the holder's placeholder is what shows. `alt` null: the picture is\n * decoration, its holder is named some other way. `null` when the image policy holds it:\n * the placeholder shows then too, and the holder is not left waiting for a load that\n * will not come.\n */\nfunction picture(ctx: CardContext, holder: HTMLElement, src: string, alt: (() => string) | null, className = 'aparte-media__img'): HTMLImageElement | null {\n const img = ctx.image(src, { class: className, attrs: { loading: 'lazy', decoding: 'async' } });\n if (!img) {\n holder.removeAttribute('data-loading');\n return null;\n }\n if (alt) ctx.bind(img, alt, 'alt');\n else img.setAttribute('alt', '');\n img.addEventListener('load', () => holder.removeAttribute('data-loading'), { once: true });\n img.addEventListener('error', () => {\n img.remove();\n holder.removeAttribute('data-loading');\n holder.setAttribute('data-broken', '');\n }, { once: true });\n return img;\n}\n\n/**\n * The medium's shape, when its data gives it: the frame is drawn that size before a byte\n * arrives, so nothing below it jumps. Numbers the reader checked, set as properties — never\n * a style string.\n */\nfunction reserve(holder: HTMLElement, m: Medium): void {\n if (!m.width || !m.height) return;\n holder.style.setProperty('--aparte-media-ratio', `${m.width} / ${m.height}`);\n holder.style.setProperty('--aparte-media-ratio-n', String(m.width / m.height));\n holder.setAttribute('data-sized', '');\n}\n\nfunction durationOf(ctx: CardContext, seconds: number, className: string, hidden = false): HTMLElement {\n const node = el('time', { class: className, attrs: { datetime: isoDuration(seconds), 'aria-hidden': hidden ? 'true' : undefined } });\n ctx.bind(node, () => formatDuration(ctx.config, seconds));\n return node;\n}\n\nconst hostOf = (url: string) => new URL(url).hostname.replace(/^www\\./, '');\n\n/** One image, as large as its shape allows; a button that opens it larger still. */\nfunction imageFrame(ctx: CardContext, m: Medium, open: (from: HTMLElement) => void): HTMLElement {\n const frame = el('button', { class: 'aparte-media__frame', attrs: { type: 'button', 'aria-haspopup': 'dialog', 'data-kind': 'image', 'data-loading': '' } });\n reserve(frame, m);\n frame.append(placeholder('image'));\n const img = picture(ctx, frame, m.src, () => altOf(ctx.config, m));\n if (img) frame.append(img);\n frame.append(glyph(EXPAND, 'aparte-rich-card__glyph aparte-media__zoom'));\n ctx.bind(frame, () => word(ctx.config, 'cardsMediaView', M.cardsMediaView), 'title');\n frame.addEventListener('click', () => open(frame));\n return frame;\n}\n\n/** A video the browser plays: its own controls, only its length fetched until asked. */\nfunction videoFrame(ctx: CardContext, m: Medium, className = 'aparte-media__frame aparte-media__frame--video'): HTMLElement {\n const frame = el('div', { class: className, attrs: { 'data-kind': 'video' } });\n reserve(frame, m);\n // A video the policy holds is not fetched at all, not even its length: the kind's\n // placeholder stands in until the reader shows it.\n // The poster is asked about too, held or not, so one \"Show images\" shows both.\n const playable = ctx.loads(m.src);\n const poster = m.poster && ctx.loads(m.poster) ? m.poster : undefined;\n if (!playable) {\n frame.append(placeholder('video'));\n return frame;\n }\n const video = el('video', {\n class: 'aparte-media__video',\n attrs: { controls: true, preload: 'metadata', playsinline: true, src: m.src, poster },\n });\n ctx.bind(video, () => nameOf(ctx.config, m), 'aria-label');\n frame.append(video);\n return frame;\n}\n\n/**\n * A YouTube or Vimeo page — or a stream this browser cannot play, linked to the page that\n * plays it when the tool names one, else to the stream itself: its poster, a play disc and\n * the site's name. A link out, never a player.\n */\nfunction externalFrame(ctx: CardContext, m: Medium): HTMLElement {\n const href = m.site ? m.src : (m.url ?? m.src);\n const site = m.site ?? hostOf(href);\n const frame = el('a', {\n class: 'aparte-media__frame aparte-media__external',\n attrs: { href, target: '_blank', rel: 'noopener noreferrer', 'data-kind': 'video' },\n });\n reserve(frame, m);\n frame.append(placeholder('video'));\n const poster = m.poster ? picture(ctx, frame, m.poster, null) : null;\n if (poster) frame.append(poster);\n frame.append(\n el('span', { class: 'aparte-media__play', attrs: { 'aria-hidden': 'true' } }, glyph(PLAY, 'aparte-rich-card__glyph aparte-media__play-glyph')),\n el('span', { class: 'aparte-media__site', attrs: { 'aria-hidden': 'true' } }, glyph(EXTERNAL, 'aparte-rich-card__glyph aparte-media__site-glyph'), site),\n );\n if (m.duration !== undefined) frame.append(durationOf(ctx, m.duration, 'aparte-media__duration', true));\n ctx.bind(frame, () => `${nameOf(ctx.config, m)} — ${word(ctx.config, 'cardsMediaWatchOn', M.cardsMediaWatchOn, { site })}`, 'aria-label');\n return frame;\n}\n\n/**\n * A sound: its cover (or a note on a tint), its title and who made it, its length, a\n * waveform that is only decoration — drawn by the sheet, it shows no real level — and the\n * browser's own player under it. The waveform moves while the sound plays.\n */\nfunction audioBlock(ctx: CardContext, m: Medium): HTMLElement {\n const cover = el('span', { class: 'aparte-media__cover', attrs: { 'data-kind': 'audio' } }, placeholder('audio'));\n const art = m.poster ? picture(ctx, cover, m.poster, null) : null;\n if (art) cover.append(art);\n const title = el('div', { class: 'aparte-media__audio-title' });\n ctx.bind(title, () => m.title ?? kindWord(ctx.config, 'audio'));\n const text = el('div', { class: 'aparte-media__audio-text' }, title,\n m.credit ? el('div', { class: 'aparte-media__audio-credit', text: m.credit }) : null);\n const head = el('div', { class: 'aparte-media__audio-head' }, cover, text,\n m.duration !== undefined ? durationOf(ctx, m.duration, 'aparte-media__audio-length') : null);\n // A sound the policy holds has no player, so nothing is requested: the cover and the title stay.\n const audio = ctx.loads(m.src) ? el('audio', { class: 'aparte-media__player', attrs: { controls: true, preload: 'metadata', src: m.src } }) : null;\n if (audio) ctx.bind(audio, () => nameOf(ctx.config, m), 'aria-label');\n const block = el('div', { class: 'aparte-media__audio', attrs: { 'data-kind': 'audio' } },\n head, el('span', { class: 'aparte-media__wave', attrs: { 'aria-hidden': 'true' } }), audio);\n if (audio) {\n audio.addEventListener('play', () => block.setAttribute('data-playing', ''));\n for (const stop of ['pause', 'ended', 'emptied']) audio.addEventListener(stop, () => block.removeAttribute('data-playing'));\n }\n return block;\n}\n\n/**\n * Under a medium: its title, its caption, and a line with who made it and the page it comes\n * from. `withTitle` false where the title is already drawn (a sound's header, the lightbox's).\n */\nfunction captionOf(m: Medium, withTitle: boolean, tag: 'figcaption' | 'div' = 'figcaption'): HTMLElement | null {\n const title = withTitle && m.title ? el('div', { class: 'aparte-media__title', text: m.title }) : null;\n const caption = m.caption && m.caption !== m.title ? el('p', { class: 'aparte-media__caption', text: m.caption }) : null;\n const credit = m.credit && m.kind !== 'audio'\n ? el('span', { class: 'aparte-media__credit' }, glyph(m.kind === 'image' ? CAMERA : kindGlyph(m.kind), 'aparte-rich-card__glyph aparte-media__line-glyph'), el('span', { text: m.credit }))\n : null;\n const source = m.url\n ? el('a', { class: 'aparte-media__source', attrs: { href: m.url, target: '_blank', rel: 'noopener noreferrer' } },\n el('span', { text: hostOf(m.url) }), glyph(EXTERNAL, 'aparte-rich-card__glyph aparte-media__line-glyph'))\n : null;\n const meta = credit || source ? el('div', { class: 'aparte-media__meta' }, credit, source) : null;\n if (!title && !caption && !meta) return null;\n return el(tag, { class: 'aparte-media__figcaption' }, title, caption, meta);\n}\n\n/** What a medium shows where it is drawn whole — on the card alone, or on the lightbox's stage. */\nfunction stageOf(ctx: CardContext, m: Medium, open: ((from: HTMLElement) => void) | null, index?: number): HTMLElement {\n if (m.kind === 'audio') return audioBlock(ctx, m);\n if (m.site || (m.kind === 'video' && !playsHere(m))) return externalFrame(ctx, m);\n if (m.kind === 'video') return videoFrame(ctx, m, open ? undefined : 'aparte-media__lb-video');\n if (open) return imageFrame(ctx, m, open);\n // In the lightbox: no lazy loading, it is the one picture on screen.\n const box = el('div', { class: 'aparte-media__lb-picture', attrs: { 'data-loading': '' } }, placeholder('image'));\n const img = picture(ctx, box, m.src, () => altOf(ctx.config, m, index), 'aparte-media__lb-img');\n if (img) {\n img.removeAttribute('loading');\n box.append(img);\n }\n return box;\n}\n\n/** A medium's tile in a mosaic or a row: a button that opens the lightbox on it. */\nfunction tileOf(ctx: CardContext, m: Medium, index: number, more: number, open: (index: number, from: HTMLElement) => void): HTMLButtonElement {\n const tile = el('button', { class: 'aparte-media__tile', attrs: { type: 'button', 'aria-haspopup': 'dialog', 'data-kind': m.kind } });\n tile.append(placeholder(m.kind));\n // An image's tile may load its smaller copy; a video's and a sound's show their still, if any.\n const still = m.kind === 'image' ? (m.poster ?? m.src) : m.poster;\n const face = still ? picture(ctx, tile, still, null, 'aparte-media__img') : null;\n if (face) tile.append(face);\n if (m.kind === 'video') {\n tile.append(el('span', { class: 'aparte-media__play aparte-media__play--sm', attrs: { 'aria-hidden': 'true' } },\n glyph(PLAY, 'aparte-rich-card__glyph aparte-media__play-glyph')));\n }\n if (m.kind === 'audio' && m.title) tile.append(el('span', { class: 'aparte-media__tile-title', attrs: { 'aria-hidden': 'true' }, text: m.title }));\n if (m.duration !== undefined && m.kind !== 'image') tile.append(durationOf(ctx, m.duration, 'aparte-media__duration', true));\n if (more > 0) {\n const plus = el('span', { class: 'aparte-media__more', attrs: { 'aria-hidden': 'true' } });\n ctx.bind(plus, () => `+${formatNumber(ctx.config, more)}`);\n tile.append(plus);\n }\n // The tile's name says everything its face shows: what it is, how long, how many behind it.\n ctx.bind(tile, () => {\n const parts = [nameOf(ctx.config, m, index)];\n if (m.kind !== 'image' && (m.title ?? m.alt ?? m.caption)) parts.push(kindWord(ctx.config, m.kind));\n if (m.duration !== undefined && m.kind !== 'image') parts.push(spokenDuration(ctx.config, m.duration));\n if (more > 0) parts.push(word(ctx.config, 'cardsMediaMore', M.cardsMediaMore, { n: formatNumber(ctx.config, more) }));\n return parts.join(', ');\n }, 'aria-label');\n tile.addEventListener('click', () => open(index, tile));\n return tile;\n}\n\n/** The collection's name line: its title, and how many there are. */\nfunction headingOf(ctx: CardContext, data: MediaData): HTMLElement {\n const count = el('span', { class: 'aparte-media__count' });\n ctx.bind(count, () => countLabel(ctx.config, data.items));\n return el('div', { class: 'aparte-media__heading' }, glyph(FRAMES, 'aparte-rich-card__glyph aparte-media__line-glyph'),\n data.title ? el('span', { class: 'aparte-media__heading-title', text: data.title }) : null, count);\n}\n\nlet lightboxes = 0;\n\n/** A text kept in the chat's language, and set again by `update()` when what it reads has moved. */\nfunction live(ctx: CardContext, target: Element, compute: () => string, attr?: string): () => void {\n ctx.bind(target, compute, attr);\n return () => (attr ? target.setAttribute(attr, compute()) : (target.textContent = compute()));\n}\n\n/**\n * The lightbox: one `<dialog>` per card, made the first time it is opened, shown modally —\n * the browser traps the focus in it, closes it on Escape and puts the page behind it out of\n * reach; core's `.aparte-dialog` draws it and closes it from its backdrop. Arrows step\n * through the media (mirrored in a right-to-left page), Home and End jump to the ends, and\n * the focus goes back to the tile that opened it. Returns the function that opens it.\n */\nfunction lightbox(ctx: CardContext, items: Medium[], host: () => HTMLElement): (index: number, from: HTMLElement) => void {\n let dialog: HTMLDialogElement | null = null;\n let index = 0;\n let opener: HTMLElement | null = null;\n let stage!: HTMLElement;\n let caption!: HTMLElement;\n const refresh: Array<() => void> = [];\n const navs: Array<[HTMLButtonElement, -1 | 1]> = [];\n const many = items.length > 1;\n\n function shut(): void {\n if (!dialog) return;\n if (typeof dialog.close === 'function') {\n dialog.close();\n } else {\n dialog.removeAttribute('open');\n dialog.dispatchEvent(new Event('close'));\n }\n }\n\n function show(i: number): void {\n index = Math.max(0, Math.min(items.length - 1, i));\n const m = items[index]!;\n stage.setAttribute('data-kind', m.kind);\n stage.replaceChildren(stageOf(ctx, m, null, many ? index : undefined));\n caption.replaceChildren(...(captionOf(m, false, 'div')?.childNodes ?? []));\n caption.hidden = !caption.childNodes.length;\n for (const update of refresh) update();\n // `aria-disabled`, not `disabled`: a disabled button drops the keyboard's focus.\n for (const [button, dir] of navs) button.setAttribute('aria-disabled', String(dir < 0 ? index === 0 : index === items.length - 1));\n }\n\n /** Step to `i`, if it is another medium: the ends do not redraw what is on the stage. */\n function go(i: number): void {\n if (i >= 0 && i < items.length && i !== index) show(i);\n }\n\n function navButton(dir: -1 | 1): HTMLButtonElement {\n const button = el('button', {\n class: `aparte-btn aparte-btn--icon aparte-btn--circle aparte-btn--surface aparte-media__lb-nav aparte-media__lb-nav--${dir < 0 ? 'prev' : 'next'}`,\n attrs: { type: 'button' },\n });\n button.innerHTML = ctx.config.getIcon(dir < 0 ? 'prevBranch' : 'nextBranch');\n ctx.bind(button, () => word(ctx.config, dir < 0 ? 'cardsPrevious' : 'cardsNext', dir < 0 ? KIT_WORDS.cardsPrevious : KIT_WORDS.cardsNext), 'aria-label');\n button.addEventListener('click', () => go(index + dir));\n navs.push([button, dir]);\n return button;\n }\n\n function onKey(event: KeyboardEvent): void {\n // A player's own keys seek and turn the volume: they are not ours to take.\n if ((event.target as Element | null)?.closest?.('video, audio')) return;\n const rtl = typeof getComputedStyle === 'function' && getComputedStyle(dialog!).direction === 'rtl';\n let to: number | undefined;\n if (event.key === 'ArrowRight' || event.key === 'ArrowLeft') to = index + (event.key === 'ArrowRight' ? 1 : -1) * (rtl ? -1 : 1);\n else if (event.key === 'Home') to = 0;\n else if (event.key === 'End') to = items.length - 1;\n else if (event.key === 'Escape' && typeof dialog!.showModal !== 'function') {\n // A browser without a modal dialog has no Escape of its own.\n event.preventDefault();\n shut();\n return;\n }\n if (to === undefined) return;\n event.preventDefault();\n go(to);\n }\n\n function build(): HTMLDialogElement {\n const id = `aparte-media-lightbox-${++lightboxes}`;\n const title = el('h2', { class: 'aparte-dialog__title aparte-media__lb-title', attrs: { id } });\n refresh.push(live(ctx, title, () => nameOf(ctx.config, items[index]!, many ? index : undefined)));\n const heading = el('div', { class: 'aparte-media__lb-heading' }, title);\n if (many) {\n const counter = el('span', { class: 'aparte-media__lb-counter' });\n refresh.push(live(ctx, counter, () => word(ctx.config, 'cardsSlide', KIT_WORDS.cardsSlide, {\n n: formatNumber(ctx.config, index + 1), total: formatNumber(ctx.config, items.length),\n })));\n heading.append(counter);\n }\n const close = el('button', { class: 'aparte-btn aparte-btn--icon aparte-btn--sm aparte-btn--ghost aparte-dialog__close aparte-media__lb-close', attrs: { type: 'button' } });\n close.innerHTML = ctx.config.getIcon('close');\n ctx.bind(close, () => word(ctx.config, 'cardsMediaClose', M.cardsMediaClose), 'aria-label');\n close.addEventListener('click', shut);\n stage = el('div', { class: 'aparte-media__lb-stage' });\n caption = el('div', { class: 'aparte-media__lb-caption' });\n const body = el('div', { class: 'aparte-media__lb-body' }, stage);\n if (many) body.append(navButton(-1), navButton(1));\n const node = el('dialog', { class: 'aparte-dialog aparte-dialog--lg aparte-media__lightbox', attrs: { 'aria-labelledby': id } },\n el('div', { class: 'aparte-dialog__header aparte-media__lb-head' }, heading, close), body, caption);\n node.addEventListener('keydown', onKey);\n node.addEventListener('close', () => {\n // A video left playing behind a closed dialog would go on talking.\n for (const media of stage.querySelectorAll<HTMLMediaElement>('video, audio')) if (!media.paused) media.pause();\n opener?.focus();\n });\n return node;\n }\n\n return (i, from) => {\n if (!dialog) {\n dialog = build();\n host().append(dialog);\n }\n opener = from;\n show(i);\n if (typeof dialog.showModal === 'function') {\n if (!dialog.open) dialog.showModal();\n } else {\n dialog.setAttribute('open', '');\n }\n };\n}\n\n/**\n * Every address a medium can make the card fetch, wherever it is drawn: its file (a page a\n * video only links to is not one) and its still.\n */\nfunction fetchedBy(m: Medium): string[] {\n const linkedOnly = m.kind !== 'audio' && (m.site || (m.kind === 'video' && !playsHere(m)));\n return [linkedOnly ? undefined : m.src, m.poster].filter((address): address is string => !!address);\n}\n\nfunction render(data: MediaData, ctx: CardContext<MediaVariant>): Node[] {\n const [first] = data.items as [Medium];\n // Asked about up front, all of them: the lightbox draws a medium only when it opens, which\n // is after the card's \"Show images\" was drawn — a full-size picture from another host than\n // its tile would otherwise wait there with nothing that could show it.\n for (const m of data.items) for (const address of fetchedBy(m)) ctx.loads(address);\n let root: HTMLElement | undefined;\n const open = lightbox(ctx, data.items, () => root!);\n if (data.items.length === 1) {\n // One medium is drawn large whatever the variant: a mosaic or a row of one is a frame.\n root = el('figure', { class: 'aparte-media aparte-media--single', attrs: { 'data-kind': first.kind } },\n stageOf(ctx, first, (from) => open(0, from)), captionOf(first, first.kind !== 'audio'));\n return [root];\n }\n if (ctx.variant === 'strip') {\n const slides = data.items.map((m, i) => el('div', { class: 'aparte-media__thumb' }, tileOf(ctx, m, i, 0, open),\n m.title ? el('span', { class: 'aparte-media__thumb-title', attrs: { 'aria-hidden': 'true' }, text: m.title } ) : null));\n root = el('div', { class: 'aparte-media aparte-media--strip' }, headingOf(ctx, data),\n carousel(ctx, slides, { label: () => data.title ?? countLabel(ctx.config, data.items) }));\n return [root];\n }\n // Several media in `single` are a gallery too: drawing the first and dropping the rest\n // would hide what the tool returned.\n const shown = data.items.slice(0, GALLERY_TILES);\n const more = data.items.length - shown.length;\n const grid = el('ul', { class: 'aparte-media__grid', attrs: { 'data-count': shown.length } },\n ...shown.map((m, i) => el('li', { class: 'aparte-media__cell' }, tileOf(ctx, m, i, i === shown.length - 1 ? more : 0, open))));\n ctx.bind(grid, () => data.title ?? countLabel(ctx.config, data.items), 'aria-label');\n root = el('div', { class: 'aparte-media aparte-media--gallery' }, grid, headingOf(ctx, data));\n return [root];\n}\n\nfunction skeleton(partial: Partial<MediaData> | null, ctx: CardContext<MediaVariant>): Node[] {\n const block = (cls: string, kind: 'text' | 'rect' = 'rect') =>\n el('span', { class: `aparte-skeleton aparte-skeleton--${kind} ${cls}`, attrs: { 'aria-hidden': 'true' } });\n const known = partial?.title ?? partial?.items?.[0]?.title;\n if (ctx.variant === 'gallery') {\n return [el('div', { class: 'aparte-media aparte-media--gallery' },\n el('div', { class: 'aparte-media__grid', attrs: { 'data-count': 4 } }, ...Array.from({ length: 4 }, () => block('aparte-media__sk-cell'))),\n el('div', { class: 'aparte-media__heading' }, known ? el('span', { class: 'aparte-media__heading-title', text: known }) : block('aparte-media__sk-line', 'text')))];\n }\n if (ctx.variant === 'strip') {\n return [el('div', { class: 'aparte-media aparte-media--strip' },\n el('div', { class: 'aparte-media__heading' }, known ? el('span', { class: 'aparte-media__heading-title', text: known }) : block('aparte-media__sk-line', 'text')),\n el('div', { class: 'aparte-media__sk-row' }, ...Array.from({ length: 4 }, () => block('aparte-media__sk-thumb'))))];\n }\n return [el('div', { class: 'aparte-media aparte-media--single' }, block('aparte-media__sk-frame'),\n el('div', { class: 'aparte-media__figcaption' },\n known ? el('div', { class: 'aparte-media__title', text: known }) : block('aparte-media__sk-line', 'text'),\n block('aparte-media__sk-line aparte-media__sk-line--short', 'text')))];\n}\n\nfunction label(data: Partial<MediaData> | null, ctx: CardContext): string {\n const items = data?.items ?? [];\n if (items.length === 1) return nameOf(ctx.config, items[0]!);\n if (items.length > 1) return data!.title ?? countLabel(ctx.config, items);\n return data?.title ?? word(ctx.config, 'cardsMediaTitle', M.cardsMediaTitle);\n}\n\n/** One line a medium: \"Sunset over Lille — Jane Doe (3:42): https://…\", the address a model can use. */\nfunction fallback(data: MediaData, ctx: CardContext): string {\n const lines = data.items.map((m, i) => {\n const name = nameOf(ctx.config, m, data.items.length > 1 ? i : undefined);\n const credit = m.credit ? ` — ${m.credit}` : '';\n const length = m.duration !== undefined ? ` (${formatDuration(ctx.config, m.duration)})` : '';\n return `${name}${credit}${length}: ${m.src}`;\n });\n return data.title ? `${data.title}:\\n${lines.join('\\n')}` : lines.join('\\n');\n}\n\n/** What a running call already says: the prompt an image is made from, the search it answers. */\nfunction partial(input: Record<string, unknown>): Partial<MediaData> | null {\n const title = str(input['prompt'] ?? input['query'] ?? input['q'] ?? input['search'] ?? input['title']);\n return title ? { title } : null;\n}\n\n/** The media card — for `mediaCard.segment(data)`. Plug it in with `setupMediaCard`. */\nexport const mediaCard = defineCard<MediaData, MediaVariant>({\n name: 'media',\n variants: ['single', 'gallery', 'strip'],\n styles: mediaStyles,\n icon: FRAMES,\n normalize: readMedia,\n render,\n skeleton,\n label,\n fallback,\n partial,\n});\n\n/** Draw a tool's media as this card — returns the function that stops it. */\nexport function setupMediaCard(options: MediaCardOptions = {}): () => void {\n return mediaCard.setup(options);\n}\n"],
5
5
  "mappings": "8MAUA,IAAMA,EAAOC,GACT,mKAAmKA,CAAI,SAG9JC,GAAQF,EAAI,iLAAiL,EAG7LG,GAAOH,EAAI,kIAAkI,EAG7II,GAAOJ,EAAI,wGAAwG,EAGnHK,EAASL,EAAI,8KAA8K,EAG3LM,GAAO,uLAGPC,GAASP,EAAI,qEAAqE,EAGlFQ,GAAWR,EAAI,mHAAmH,EAGlIS,GAAST,EAAI,6IAA6I,EAGhK,SAASU,GAAUC,EAAyB,CAC/C,OAAOA,IAAS,QAAUR,GAAOQ,IAAS,QAAUP,GAAOF,EAC/D,CCxCA,IAAAU,GAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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EAAM,QAAaA,EAAM,KAAQ,EACtG,OAAOvH,EAAQ,CAAE,MAAAA,CAAA,EAAU,IAC/B,CAGO,IAAMwH,GAAYC,EAAoC,CACzD,KAAM,QACN,SAAU,CAAC,SAAU,UAAW,OAAO,EACvC,OAAQpL,GACR,KAAMP,EACN,UAAWiE,GACX,OAAAyG,GACA,SAAAM,GACA,MAAAI,GACA,SAAAC,GACA,QAAAJ,EACJ,CAAC,EAGM,SAASW,GAAeC,EAA4B,CAAA,EAAgB,CACvE,OAAOH,GAAU,MAAMG,CAAO,CAClC",
6
6
  "names": ["svg", "body", "IMAGE", "FILM", "NOTE", "FRAMES", "PLAY", "EXPAND", "EXTERNAL", "CAMERA", "kindGlyph", "kind", "mediaStyles", "M", "KIND_WORD", "MAX_MEDIA", "GALLERY_TILES", "IMAGE_EXT", "VIDEO_EXT", "AUDIO_EXT", "videoSite", "url", "host", "kindOfWord", "value", "s", "str", "streamType", "m", "path", "playsHere", "type", "kindOfUrl", "readDuration", "n", "num", "clock", "h", "sec", "iso", "textOf", "o", "linkOf", "first", "key", "address", "own", "safeUrl", "webUrl", "positive", "readMedium", "raw", "r", "urls", "videoFile", "f", "sources", "src", "from", "candidate", "page", "v", "poster", "mimeType", "site", "creditText", "width", "height", "ms", "duration", "readMedia", "title", "list", "nested", "k", "items", "formatDuration", "config", "seconds", "total", "plain", "formatNumber", "two", "spokenDuration", "said", "unit", "formatUnit", "isoDuration", "kindWord", "word", "nameOf", "index", "altOf", "countLabel", "placeholder", "el", "glyph", "picture", "ctx", "holder", "alt", "className", "img", "reserve", "durationOf", "hidden", "node", "hostOf", "imageFrame", "open", "frame", "videoFrame", "playable", "video", "externalFrame", "href", "audioBlock", "cover", "art", "text", "head", "audio", "block", "stop", "captionOf", "withTitle", "tag", "caption", "credit", "source", "meta", "stageOf", "box", "tileOf", "more", "tile", "still", "face", "plus", "parts", "headingOf", "data", "count", "lightboxes", "live", "target", "compute", "attr", "lightbox", "dialog", "opener", "stage", "refresh", "navs", "many", "shut", "show", "i", "update", "button", "dir", "go", "navButton", "KIT_WORDS", "onKey", "event", "rtl", "to", "build", "id", "heading", "counter", "close", "media", "fetchedBy", "render", "root", "slides", "carousel", "shown", "grid", "skeleton", "partial", "cls", "known", "label", "fallback", "lines", "name", "length", "input", "mediaCard", "defineCard", "setupMediaCard", "options"]
@@ -1,4 +1,4 @@
1
- import{a as o,b as w,d as N,e as Y,f as p,h as R,i as he,o as ve,p as Z,q as E,r as ke,s as X,t as be}from"./chunk-PPDOW5CO.js";import"./chunk-4MZPEZPE.js";import"./chunk-XAWE4EAK.js";var z=e=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">${e}</svg>`,we=z('<path d="M5.5 8h13l-1 11.2a1.8 1.8 0 0 1-1.8 1.6H8.3a1.8 1.8 0 0 1-1.8-1.6z"/><path d="M9 10.5V6.8a3 3 0 0 1 6 0v3.7"/>'),Ie=z('<rect x="3.5" y="5" width="17" height="15.5" rx="2.2"/><path d="M3.5 9.8h17M8 3v4M16 3v4"/><path d="M7.5 13.6h2M11 13.6h2M14.5 13.6h2M7.5 16.8h2M11 16.8h2"/>'),Me=z('<path d="M3.8 7.6 12 3.5l8.2 4.1v8.8L12 20.5l-8.2-4.1z"/><path d="M3.8 7.6 12 11.7l8.2-4.1M12 11.7v8.8"/>'),Fe=z('<path d="M2.8 6.5h10.4v9.3H2.8z"/><path d="M13.2 9.5h4.1l3 3.2v3.1h-7.1"/><circle cx="7" cy="17.3" r="1.7"/><circle cx="17" cy="17.3" r="1.7"/>'),Le=z('<rect x="2.8" y="5.5" width="18.4" height="13" rx="2"/><path d="M2.8 9.6h18.4M6.5 15h3.5"/>'),Ge=z('<path d="M12 21s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0c0 5.4-6.5 11-6.5 11z"/><circle cx="12" cy="10" r="2.3"/>'),$e=z('<circle cx="9" cy="8.5" r="3"/><path d="M3.5 19c.6-3.2 2.8-5 5.5-5s4.9 1.8 5.5 5"/><circle cx="16.8" cy="9.3" r="2.4"/><path d="M15.8 14.2c2.4-.3 4.3 1.3 4.8 4.3"/>'),He=z('<circle cx="12" cy="8.5" r="3.5"/><path d="M5 20c.8-3.7 3.6-5.8 7-5.8s6.2 2.1 7 5.8"/>'),Ve=z('<path d="M4 10.5 12 4l8 6.5V20H4z"/><path d="M9.5 20v-5.5h5V20"/>'),qe=z('<circle cx="12" cy="12" r="8.5"/><path d="M12 11v5"/><circle cx="12" cy="8" r=".6" fill="currentColor"/>'),Oe=z('<path d="M9.5 6l6 6-6 6"/>'),Ue=z('<path d="M4.5 12h15M14 6.5l5.5 5.5-5.5 5.5"/>'),We={success:"M22 32.5l7 7 13.5-14.5",info:"M32 22v10.5l7 4.5",danger:"M24.5 24.5l15 15M39.5 24.5l-15 15",neutral:"M25.5 27.5h9.5a6.5 6.5 0 0 1 0 13h-8M30 22.5l-5 5 5 5"};function Ke(e){return`<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><circle class="aparte-order__seal-halo" cx="32" cy="32" r="31"/><circle class="aparte-order__seal-disc" cx="32" cy="32" r="22"/><path class="aparte-order__seal-mark" pathLength="1" d="${We[e]}"/></svg>`}var Ye=`/* =========================================
1
+ import{a as o,b as w,d as N,e as Y,f as p,h as R,i as he,o as ve,p as Z,q as E,r as ke,s as X,t as be}from"./chunk-HR2ND5EK.js";import"./chunk-QGJMBP66.js";import"./chunk-XAWE4EAK.js";var z=e=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg">${e}</svg>`,we=z('<path d="M5.5 8h13l-1 11.2a1.8 1.8 0 0 1-1.8 1.6H8.3a1.8 1.8 0 0 1-1.8-1.6z"/><path d="M9 10.5V6.8a3 3 0 0 1 6 0v3.7"/>'),Ie=z('<rect x="3.5" y="5" width="17" height="15.5" rx="2.2"/><path d="M3.5 9.8h17M8 3v4M16 3v4"/><path d="M7.5 13.6h2M11 13.6h2M14.5 13.6h2M7.5 16.8h2M11 16.8h2"/>'),Me=z('<path d="M3.8 7.6 12 3.5l8.2 4.1v8.8L12 20.5l-8.2-4.1z"/><path d="M3.8 7.6 12 11.7l8.2-4.1M12 11.7v8.8"/>'),Fe=z('<path d="M2.8 6.5h10.4v9.3H2.8z"/><path d="M13.2 9.5h4.1l3 3.2v3.1h-7.1"/><circle cx="7" cy="17.3" r="1.7"/><circle cx="17" cy="17.3" r="1.7"/>'),Le=z('<rect x="2.8" y="5.5" width="18.4" height="13" rx="2"/><path d="M2.8 9.6h18.4M6.5 15h3.5"/>'),Ge=z('<path d="M12 21s-6.5-5.6-6.5-11a6.5 6.5 0 0 1 13 0c0 5.4-6.5 11-6.5 11z"/><circle cx="12" cy="10" r="2.3"/>'),$e=z('<circle cx="9" cy="8.5" r="3"/><path d="M3.5 19c.6-3.2 2.8-5 5.5-5s4.9 1.8 5.5 5"/><circle cx="16.8" cy="9.3" r="2.4"/><path d="M15.8 14.2c2.4-.3 4.3 1.3 4.8 4.3"/>'),He=z('<circle cx="12" cy="8.5" r="3.5"/><path d="M5 20c.8-3.7 3.6-5.8 7-5.8s6.2 2.1 7 5.8"/>'),Ve=z('<path d="M4 10.5 12 4l8 6.5V20H4z"/><path d="M9.5 20v-5.5h5V20"/>'),qe=z('<circle cx="12" cy="12" r="8.5"/><path d="M12 11v5"/><circle cx="12" cy="8" r=".6" fill="currentColor"/>'),Oe=z('<path d="M9.5 6l6 6-6 6"/>'),Ue=z('<path d="M4.5 12h15M14 6.5l5.5 5.5-5.5 5.5"/>'),We={success:"M22 32.5l7 7 13.5-14.5",info:"M32 22v10.5l7 4.5",danger:"M24.5 24.5l15 15M39.5 24.5l-15 15",neutral:"M25.5 27.5h9.5a6.5 6.5 0 0 1 0 13h-8M30 22.5l-5 5 5 5"};function Ke(e){return`<svg viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg"><circle class="aparte-order__seal-halo" cx="32" cy="32" r="31"/><circle class="aparte-order__seal-disc" cx="32" cy="32" r="22"/><path class="aparte-order__seal-mark" pathLength="1" d="${We[e]}"/></svg>`}var Ye=`/* =========================================
2
2
  The order card \u2014 @aparte/plugin-cards/order
3
3
  =========================================
4
4
  Three variants of one card, chosen by \`data-variant\` on its root:
@@ -836,4 +836,4 @@ import{a as o,b as w,d as N,e as Y,f as p,h as R,i as he,o as ve,p as Z,q as E,r
836
836
  `):void 0;if(!f(e))return;let r=f(e.address)?e.address:e,a=v=>p(i(r,v)),t=a(["city","locality","town"]),n=a(["zip","postal_code","postalCode","postcode"]),d=a(["province_code","state","province","region"]),s=a(["country","country_code","countryCode"]),c=mr.has(T(s))?[[t,d].filter(_).join(", "),n].filter(v=>v).join(" "):[n,t].filter(_).join(" "),h=[re(e)??re(r),a(["company"]),a(["address1","address_1","line1","street","street1"]),a(["address2","address_2","line2","street2"]),c||void 0,s].filter(_);return h.length?h.join(`
837
837
  `):void 0}function _r(e){if(typeof e=="string")return e.trim()&&!xe(e.trim())?e.trim():void 0;if(!f(e))return;let r=[re(e),p(i(e,["email"])),p(i(e,["phone"]))].filter(_);return r.length?r.join(`
838
838
  `):void 0}function gr(e){let r=[];if(Array.isArray(e))for(let a of e){let t=p(i(a,["label","name","key","title"])),n=p(i(a,["value","text"]));t&&n&&r.push({label:t,value:n})}else if(f(e))for(let[a,t]of Object.entries(e)){let n=p(t);a.trim()&&n&&r.push({label:a.trim(),value:n})}return r.slice(0,er)}function hr(e){if(Array.isArray(e)&&(e={from:e[0],to:e[1]}),f(e)&&!(e instanceof Date)){let t=S(i(e,["from","start","earliest","min"])),n=S(i(e,["to","end","latest","max"]));return t?n&&n.date>t.date?{from:t,to:n}:{from:t}:n?{from:n}:void 0}let r=S(e);if(r)return{from:r};let a=p(e);return a?{text:a}:void 0}function vr(e){let r=ee(e.fulfillments),a=[e.delivery,e.shipment,e.fulfillment,r?.[0],e.tracking].find(f),t=c=>Array.isArray(c)?c[0]:c,n=hr(i(a,["estimate","estimatedDelivery","estimated_delivery","eta","expected","expectedDate","expected_date","date"])??i(e,["estimatedDelivery","estimated_delivery","deliveryEstimate","delivery_estimate","deliveryDate","delivery_date","eta"])??(typeof e.delivery=="string"?e.delivery:void 0)),d=p(i(a,["carrier","company","tracking_company","trackingCompany","service"])??i(e,["carrier","tracking_company","trackingCompany","shippingCarrier","shipping_carrier"])),s=p(t(i(a,["trackingNumber","tracking_number","tracking_numbers","number"])??i(e,["trackingNumber","tracking_number"]))),l=N(t(i(a,["trackingUrl","tracking_url","tracking_urls","trackingLink","tracking_link","url"])??i(e,["trackingUrl","tracking_url","trackingLink","tracking_link"])));if(!(!n&&!d&&!s&&!l))return{...n?{estimate:n}:{},...d?{carrier:d}:{},...s?{trackingNumber:s}:{},...l?{trackingUrl:l}:{}}}var kr=["start","startTime","start_time","startDate","start_date","checkIn","check_in","checkin","from","datetime","dateTime","time"],br=["end","endTime","end_time","endDate","end_date","checkOut","check_out","checkout","to","until"];function yr(e){let r=[e.booking,e.reservation].find(f)??e,a=S(i(r,kr)),t=a?void 0:sr(r),n=a??t,d=t!==void 0&&r===e,s=S(i(r,br)),l=s&&(!n||s.date>=n.date)?s:void 0,c=i(r,["location","venue","place","address","where"]),h=f(c)?[p(i(c,["name","title"])),p(i(c,["address","formatted_address"]))].filter(_).join(", ")||void 0:p(c),v=i(r,["guests","partySize","party_size","people","persons","covers","attendees"]),k=Array.isArray(v)?v.length:Y(v),b=k!==void 0&&k>0?Math.floor(k):void 0;return!n&&!h&&b===void 0?{booking:void 0,tookDate:d}:{booking:{...n?{start:n}:{},...l?{end:l}:{},...h?{location:h}:{},...b!==void 0?{guests:b}:{}},tookDate:d}}function zr(e){let r=T(i(e,["kind","type","object"]));return["booking","reservation","appointment","lodgingreservation","foodestablishmentreservation","eventreservation"].includes(r)?"booking":["order","purchase","checkoutsession"].includes(r)?"order":f(e.booking)||f(e.reservation)||i(e,["checkIn","check_in","startTime","start_time","startDate","start_date"])!==void 0?"booking":"order"}function wr(e){if(!f(e))return null;let r=e,a=zr(r),t=r.minorUnits===!0||r.minor_units===!0,n=X(i(r,["currency","currency_code","currencyCode","presentment_currency"])),d=t?ar(n):1,s=u=>{let y=je(u,d);return n??=y.currency,y.amount},l=(u,y)=>{if(f(u))for(let P of y){let ge=u[P]===void 0||u[P]===null?void 0:s(u[P]);if(ge!==void 0)return ge}},c=(["items","line_items","lineItems","products","lines"].map(u=>ee(r[u])).find(_)??[]).map(u=>pr(u,s)).filter(_),h=c.slice(0,Je),v=f(r.total_details)?r.total_details:void 0,k=ee(r.shipping_lines),b=l(r,["subtotal","sub_total","subtotal_price","subtotalPrice","amount_subtotal","items_total","itemsTotal"]),ie=l(r,["discount","total_discount","total_discounts","totalDiscounts","discount_total","discountTotal"])??l(v,["amount_discount"]),D=l(r,["shipping","shipping_total","shippingTotal","shipping_cost","shippingCost","shipping_price","shippingPrice","total_shipping","delivery_fee","deliveryFee"])??l(v,["amount_shipping"])??l(r.shipping_cost,["amount_total"]);if(D===void 0&&k?.length){let u=k.map(y=>l(y,["price","amount"])).filter(_);u.length&&(D=u.reduce((y,P)=>y+P,0))}let H=l(r,["tax","taxes","total_tax","totalTax","tax_total","taxTotal","vat"])??l(v,["amount_tax"]),B=l(r,["total","total_price","totalPrice","amount_total","amountTotal","grand_total","grandTotal","amount"]),V=c.filter(u=>u.quantity!==0);b===void 0&&V.length&&V.every(u=>u.total!==void 0)&&(b=V.reduce((u,y)=>u+y.total,0));let q=ie!==void 0?Math.abs(ie):void 0;B===void 0&&b!==void 0&&(B=b-(q??0)+(D??0)+(H??0));let U=p(i(r,["reference","order_number","orderNumber","number","confirmation_number","confirmationNumber","confirmation_code","confirmationCode","booking_reference","bookingReference","booking_id","bookingId","order_id","orderId","id"]))?.replace(/^#\s*/,"")||void 0,W=p(i(r,["title","heading"])),se=p(r.headline),de=lr(r),{booking:K,tookDate:Re}=a==="booking"?yr(r):{booking:void 0,tookDate:!1},le=["date","created_at","createdAt","placed_at","placedAt","order_date","orderDate","date_created","dateCreated","processed_at","created"],ce=Te(i(r,Re?le.slice(1):le))?.date,pe=vr(r),ue=Se(i(r,["payment","paymentMethod","payment_method","payment_method_title","paymentMethodTitle","payment_method_details","card","payment_gateway_names"])),me=_r(i(r,["customer_details","customerDetails","customer","customer_name","customerName","buyer","contact"])),fe=a==="order"?fr(i(r,["shippingAddress","shipping_address","shipping_details","shippingDetails","deliveryAddress","delivery_address","address"])??(f(r.shipping)&&ur.some(u=>u in r.shipping)?r.shipping:void 0)):void 0,_e=N(i(r,["url","orderUrl","order_url","order_status_url","orderStatusUrl","statusUrl","status_url","receipt_url","receiptUrl","manageUrl","manage_url","link","href"]));if(!h.length&&!U&&B===void 0&&!K&&!W)return null;let Ee=c.every(u=>Number.isInteger(u.quantity));return{kind:a,...W?{title:W}:{},...se?{headline:se}:{},...U?{reference:U}:{},...de?{status:de}:{},...ce?{date:ce}:{},items:h,lineCount:c.length,itemCount:Ee?c.reduce((u,y)=>u+y.quantity,0):c.length,...n?{currency:n}:{},...b!==void 0?{subtotal:b}:{},...q!==void 0?{discount:q}:{},...D!==void 0?{shipping:D}:{},...H!==void 0?{tax:H}:{},...B!==void 0?{total:B}:{},...ue?{payment:ue}:{},...me?{customer:me}:{},...fe?{shippingAddress:fe}:{},...pe?{delivery:pe}:{},facts:gr(i(r,["facts","details","extra","extras","note_attributes"])),...K?{booking:K}:{},..._e?{url:_e}:{}}}var g=(e,r,a)=>he(e,r,F[r],a),O=(e,r,a)=>ke(e,a,r.currency);function j(e,r,a,t){let n=new Intl.PluralRules(R(e)).select(t);return g(e,n==="one"?r:a,{n:E(e,t)})}var ae=e=>/^\d+$/.test(e)?`#${e}`:e;function A(e,r,a){if(r?.title)return r.title;let t=r?.kind==="booking";if(r?.reference){let n=a?ae(r.reference):r.reference;return g(e,t?"cardsOrderBookingNumbered":"cardsOrderNumbered",{reference:n})}return g(e,t?"cardsOrderBooking":"cardsOrderOrder")}function Ae(e,r){let a=r.status;if(!a)return"";if("text"in a)return a.text;let t=`cardsOrderBookingStatus_${a.status}`,n=r.kind==="booking"&&t in F?t:`cardsOrderStatus_${a.status}`;return g(e,n)}function Or(e,r){if(r.headline)return r.headline;let a=r.status&&"status"in r.status?r.status.status:"confirmed";if(r.kind!=="booking")return g(e,`cardsOrderHeadline_${a}`);let t=Qe[a]??a;return g(e,`cardsOrderBookingHeadline_${t}`)}var x=(e,r)=>new Intl.DateTimeFormat(R(e),r),xr=(e,r)=>x(e,{dateStyle:"medium"}).format(r);function De(e,r=new Date){return{weekday:"short",day:"numeric",month:"short",...e.getFullYear()!==r.getFullYear()?{year:"numeric"}:{}}}var L={hour:"numeric",minute:"2-digit"};function te(e,r,a){return typeof e.formatRange=="function"?e.formatRange(r,a):`${e.format(r)} \u2013 ${e.format(a)}`}function ne(e,r,a){let t=!r.allDay||a!==void 0&&!a.allDay,n=x(e,{...De(r.date),...t?L:{}});return a&&a.date.getTime()!==r.date.getTime()?te(n,r.date,a.date):n.format(r.date)}var ye=e=>new Date(e.getFullYear(),e.getMonth(),e.getDate()).getTime();function G(e,r){return Math.max(0,Math.round((ye(r)-ye(e))/864e5))}var J=(e,r)=>{let a=o("span",{class:"aparte-sr-only"});return e.word(a,r,F[r]),a},m=(e,r,a,t)=>{let n=o(r,{class:a});return e.bind(n,t),n};function $(e){return w(e?.kind==="booking"?Ie:we,"aparte-rich-card__glyph aparte-order__kind")}function oe(e,r){if(!r.status)return null;let a="status"in r.status?r.status.status:void 0,t=o("span",{class:`aparte-badge aparte-badge--${a?Ze[a]:"neutral"} aparte-badge--sm aparte-order__status`,attrs:{"data-status":a??"other"}},o("span",{class:"aparte-order__status-dot",attrs:{"aria-hidden":"true"}}));return t.append(m(e,"span","aparte-order__status-text",()=>Ae(e.config,r))),t}function Be(e,r,a=!1){if(!r.url)return null;let t=r.kind==="booking"?"cardsOrderViewBooking":"cardsOrderView",n=e.action({label:g(e.config,t),url:r.url,id:"view",primary:a},r,"aparte-order__view");return n&&e.word(n,t,F[t]),n}function Pe(e,r){let a=r.delivery?.trackingUrl;if(!a)return null;let t=e.action({label:g(e.config,"cardsOrderTrack"),url:a,id:"track"},r,"aparte-order__track");return t&&e.word(t,"cardsOrderTrack",F.cardsOrderTrack),t}function jr(e,r){let a=o("div",{class:"aparte-order__heading"},m(e,"div","aparte-order__title",()=>A(e.config,r,!0)));if(r.date){let t=r.date,n=o("time",{class:"aparte-order__date",attrs:{datetime:t.toISOString()}});e.bind(n,()=>g(e.config,r.kind==="booking"?"cardsOrderBooked":"cardsOrderPlaced",{date:xr(e.config,t)})),a.append(n)}return o("div",{class:"aparte-order__head"},$(r),a,oe(e,r))}function Tr(e,r){let a=o("div",{class:"aparte-order__thumb"},w(Me,"aparte-rich-card__glyph aparte-order__thumb-glyph")),t=r.image?e.image(r.image.src,{class:"aparte-order__image",attrs:{alt:r.image.alt??r.title,loading:"lazy",decoding:"async"}}):null;return t?(t.addEventListener("error",()=>{t.hidden=!0,a.setAttribute("data-empty","")},{once:!0}),a.append(t),a):(a.setAttribute("data-empty",""),a)}function Cr(e,r,a,t){let n=o("div",{class:"aparte-order__line-meta"},a.subtitle?o("span",{class:"aparte-order__line-variant",text:a.subtitle}):null,a.quantity!==1&&a.price!==void 0?m(e,"span","aparte-order__line-each",()=>g(e.config,"cardsOrderEach",{price:O(e.config,r,a.price)})):null);return o("li",{class:"aparte-order__line"},t?Tr(e,a):null,o("div",{class:"aparte-order__line-main"},o("div",{class:"aparte-order__line-title",text:a.title}),n.childNodes.length?n:null),a.quantity!==1?m(e,"span","aparte-order__qty",()=>`\xD7\u2009${E(e.config,a.quantity)}`):null,a.total!==void 0?m(e,"span","aparte-order__line-total",()=>O(e.config,r,a.total)):null)}function Sr(e,r){if(!r.items.length)return null;let a=r.items.some(s=>s.image),t=s=>{let l=o("ul",{class:"aparte-order__lines",attrs:{role:"list","data-thumbs":a}},...s.map(c=>Cr(e,r,c,a)));return e.bind(l,()=>g(e.config,"cardsOrderLines"),"aria-label"),l},n=o("div",{class:"aparte-order__section aparte-order__items"},t(r.items.slice(0,Q))),d=r.lineCount-Q;if(d>0){let s=o("summary",{class:"aparte-order__more-toggle"},w(Oe,"aparte-rich-card__glyph aparte-order__more-chevron"),m(e,"span","aparte-order__more-text",()=>g(e.config,"cardsOrderMore",{n:E(e.config,d)}))),l=o("details",{class:"aparte-order__more"},s,t(r.items.slice(Q))),c=r.lineCount-r.items.length;c>0&&l.append(m(e,"div","aparte-order__dropped",()=>g(e.config,"cardsOrderMore",{n:E(e.config,c)}))),n.append(l)}return n}function I(e,r,a,t){return o("div",{class:`aparte-order__sum aparte-order__sum--${t}`},m(e,"dt","aparte-order__sum-label",()=>g(e.config,r)),m(e,"dd","aparte-order__sum-value",a))}function Ar(e,r){let{config:a}=e,t=r.discount!==void 0||r.shipping!==void 0||r.tax!==void 0,n=[r.subtotal!==void 0&&t?I(e,"cardsOrderSubtotal",()=>O(a,r,r.subtotal),"subtotal"):null,r.discount?I(e,"cardsOrderDiscount",()=>`\u2212${O(a,r,r.discount)}`,"discount"):null,r.shipping!==void 0?I(e,"cardsOrderShipping",()=>r.shipping===0?g(a,"cardsOrderFree"):O(a,r,r.shipping),r.shipping===0?"free":"shipping"):null,r.tax!==void 0?I(e,"cardsOrderTax",()=>O(a,r,r.tax),"tax"):null,r.total!==void 0?I(e,"cardsOrderTotal",()=>O(a,r,r.total),"total"):null].filter(_);return n.length?o("dl",{class:"aparte-order__section aparte-order__totals"},...n):null}function M(e,r,a,...t){let n=o("dt",{class:"aparte-order__info-label"},w(r,"aparte-rich-card__glyph aparte-order__info-glyph"));return n.append(m(e,"span","aparte-order__info-label-text",a)),o("div",{class:"aparte-order__info"},n,o("dd",{class:"aparte-order__info-value"},...t))}function Ne(e,r){if("text"in r)return r.text;let a=x(e,De(r.from.date));return r.to?te(a,r.from.date,r.to.date):a.format(r.from.date)}function Dr(e,r){let a=r.delivery;if(!a)return null;let t=a.estimate,n=[a.carrier,a.trackingNumber].filter(_).join(" \xB7 "),d=o("div",{class:"aparte-order__delivery-text"},t?m(e,"div","aparte-order__estimate",()=>Ne(e.config,t)):null,n?o("div",{class:"aparte-order__carrier",text:n}):null);return M(e,Fe,()=>g(e.config,"cardsOrderDelivery"),d,Pe(e,r))}function Br(e,r){let a=(n,d="")=>o("span",{class:`aparte-order__info-text${d?` ${d}`:""}`,text:n}),t=[r.payment?M(e,Le,()=>g(e.config,"cardsOrderPayment"),a(r.payment)):null,Dr(e,r),r.shippingAddress?M(e,Ve,()=>g(e.config,"cardsOrderAddress"),a(r.shippingAddress,"aparte-order__multiline")):null,r.customer?M(e,He,()=>g(e.config,"cardsOrderCustomer"),a(r.customer,"aparte-order__multiline")):null,...r.facts.map(n=>M(e,qe,()=>n.label,a(n.value)))].filter(_);return t.length?o("dl",{class:"aparte-order__section aparte-order__infos"},...t):null}function ze(e,r){return o("time",{class:"aparte-order__leaf",attrs:{datetime:r.date.toISOString()}},m(e,"span","aparte-order__leaf-month",()=>x(e.config,{month:"short"}).format(r.date)),m(e,"span","aparte-order__leaf-day",()=>x(e.config,{day:"numeric"}).format(r.date)),m(e,"span","aparte-order__leaf-weekday",()=>x(e.config,{weekday:"short"}).format(r.date)))}function Pr(e,r){let a=r.booking;if(!a)return null;let{config:t}=e,n=o("div",{class:"aparte-order__section aparte-order__booking"}),{start:d,end:s}=a;if(d)if(s!==void 0&&G(d.date,s.date)>0){let h=G(d.date,s.date),v=(k,b)=>o("div",{class:"aparte-order__stay-side"},J(e,b),ze(e,k),k.allDay?null:m(e,"span","aparte-order__stay-time",()=>x(t,L).format(k.date)));n.append(o("div",{class:"aparte-order__stay"},v(d,"cardsOrderStart"),o("div",{class:"aparte-order__stay-span"},w(Ue,"aparte-rich-card__glyph aparte-order__stay-arrow"),m(e,"span","aparte-order__nights",()=>j(t,"cardsOrderNight","cardsOrderNights",h))),v(s,"cardsOrderEnd")))}else{let h=d.allDay?null:m(e,"span","aparte-order__day-hours",()=>s&&!s.allDay&&s.date>d.date?te(x(t,L),d.date,s.date):x(t,L).format(d.date));n.append(o("div",{class:"aparte-order__day"},ze(e,d),o("div",{class:"aparte-order__day-text"},m(e,"span","aparte-order__day-name",()=>{let v=x(t,{weekday:"long",day:"numeric",month:"long",...d.date.getFullYear()!==new Date().getFullYear()?{year:"numeric"}:{}}).format(d.date);return v.charAt(0).toLocaleUpperCase(R(t))+v.slice(1)}),h)))}let l=[a.location?o("div",{class:"aparte-order__place"},o("dt",{class:"aparte-order__place-label"},w(Ge,"aparte-rich-card__glyph aparte-order__info-glyph"),J(e,"cardsOrderWhere")),o("dd",{class:"aparte-order__place-value",text:a.location})):null,a.guests!==void 0?o("div",{class:"aparte-order__place"},o("dt",{class:"aparte-order__place-label"},w($e,"aparte-rich-card__glyph aparte-order__info-glyph"),J(e,"cardsOrderGuestsLabel")),m(e,"dd","aparte-order__place-value",()=>j(t,"cardsOrderGuest","cardsOrderGuests",a.guests))):null].filter(_);return l.length&&n.append(o("dl",{class:"aparte-order__places"},...l)),n.childNodes.length?n:null}function Nr(e,r){let a=Be(e,r);return[jr(e,r),Pr(e,r),Sr(e,r),Ar(e,r),Br(e,r),a?o("div",{class:"aparte-order__foot"},a):null].filter(_)}function Rr(e,r){let{config:a}=e,t=d=>m(e,"span","aparte-order__row-part",d),n=r.booking;return[n?.start?t(()=>ne(a,n.start,n.end)):null,n?.guests!==void 0?t(()=>j(a,"cardsOrderGuest","cardsOrderGuests",n.guests)):null,r.itemCount>0?t(()=>j(a,"cardsOrderItem","cardsOrderItems",r.itemCount)):null,r.total!==void 0?t(()=>O(a,r,r.total)):null].filter(_)}function Er(e,r){let a=o("div",{class:"aparte-order__title"});if(r.url){let n=o("a",{class:"aparte-order__link",attrs:{href:r.url,target:"_blank",rel:"noopener noreferrer"}});e.bind(n,()=>A(e.config,r,!0)),a.append(n)}else e.bind(a,()=>A(e.config,r,!0));let t=Rr(e,r);return[o("div",{class:"aparte-order__row",attrs:{"data-linked":r.url!==void 0}},$(r),o("div",{class:"aparte-order__row-main"},a,t.length?o("div",{class:"aparte-order__row-meta"},...t):null),oe(e,r),r.url?w(Oe,"aparte-rich-card__glyph aparte-order__chevron"):null)]}function C(e,r,a,t,n){let d=typeof r=="function"?r:()=>g(e.config,r);return o("div",{class:`aparte-order__keyfact aparte-order__keyfact--${t}`},m(e,"dt","aparte-order__keyfact-label",d),o("dd",{class:"aparte-order__keyfact-value"},m(e,"span","aparte-order__keyfact-text",a),n?m(e,"span","aparte-order__keyfact-note",n):null))}function Ir(e,r){let{config:a}=e,t=r.status&&"status"in r.status?r.status.status:void 0,n=t?Xe[t]:"success",d=[r.title&&r.reference?r.title:null,r.reference?ae(r.reference):r.title??null].filter(_),s=r.booking,l=r.delivery?.estimate,c=[r.total!==void 0?C(e,"cardsOrderTotal",()=>O(a,r,r.total),"total",r.itemCount>0?()=>j(a,"cardsOrderItem","cardsOrderItems",r.itemCount):void 0):null,l?C(e,"cardsOrderDelivery",()=>Ne(a,l),"delivery",r.delivery?.carrier?()=>r.delivery.carrier:void 0):null,s?.start?C(e,"cardsOrderWhen",()=>ne(a,s.start,s.end),"when",s.end&&G(s.start.date,s.end.date)>0?()=>j(a,"cardsOrderNight","cardsOrderNights",G(s.start.date,s.end.date)):void 0):null,s?.location?C(e,"cardsOrderWhere",()=>s.location,"where"):null,s?.guests!==void 0?C(e,"cardsOrderGuestsLabel",()=>j(a,"cardsOrderGuest","cardsOrderGuests",s.guests),"guests"):null,...r.facts.slice(0,rr).map(k=>C(e,()=>k.label,()=>k.value,"own"))].filter(_),h=[Be(e,r,!0),Pe(e,r)].filter(_),v=r.status&&"text"in r.status?oe(e,r):null;return[o("div",{class:"aparte-order__confirm",attrs:{"data-tone":n}},w(Ke(n),"aparte-order__seal"),m(e,"div","aparte-order__headline",()=>Or(a,r)),d.length?o("div",{class:"aparte-order__ref",text:d.join(" \xB7 ")}):null,v,c.length?o("dl",{class:"aparte-order__keyfacts"},...c):null,h.length?o("div",{class:"aparte-order__confirm-actions"},...h):null)]}function Mr(e,r){return r.variant==="compact"?Er(r,e):r.variant==="confirmation"?Ir(r,e):Nr(r,e)}function Fr(e,r){let a=(d,s="text")=>o("span",{class:`aparte-skeleton aparte-skeleton--${s} ${d}`,attrs:{"aria-hidden":"true"}}),t=e?.reference||e?.title?m(r,"div","aparte-order__title",()=>A(r.config,e,!0)):a("aparte-order__sk-title");if(r.variant==="compact")return[o("div",{class:"aparte-order__row"},$(e),o("div",{class:"aparte-order__row-main"},t,a("aparte-order__sk-meta")),a("aparte-order__sk-pill","rect"))];if(r.variant==="confirmation")return[o("div",{class:"aparte-order__confirm aparte-order__confirm--skeleton"},a("aparte-order__sk-seal","circle"),a("aparte-order__sk-headline"),e?.reference?o("div",{class:"aparte-order__ref",text:ae(e.reference)}):a("aparte-order__sk-ref"),o("div",{class:"aparte-order__keyfacts"},a("aparte-order__sk-fact","rect"),a("aparte-order__sk-fact","rect")))];let n=()=>o("div",{class:"aparte-order__line aparte-order__line--skeleton"},a("aparte-order__sk-thumb","rect"),o("div",{class:"aparte-order__line-main"},a("aparte-order__sk-line"),a("aparte-order__sk-line aparte-order__sk-line--short")),a("aparte-order__sk-price"));return[o("div",{class:"aparte-order__head"},$(e),o("div",{class:"aparte-order__heading"},t,a("aparte-order__sk-date")),a("aparte-order__sk-pill","rect")),o("div",{class:"aparte-order__section aparte-order__items"},o("div",{class:"aparte-order__lines",attrs:{"data-thumbs":""}},n(),n(),n())),o("div",{class:"aparte-order__section aparte-order__totals"},o("div",{class:"aparte-order__sum"},a("aparte-order__sk-label"),a("aparte-order__sk-price")),o("div",{class:"aparte-order__sum aparte-order__sum--total"},a("aparte-order__sk-label"),a("aparte-order__sk-price")))]}function Lr(e,r){let{config:a}=r,t=e.booking,n=e.status?"status"in e.status?Ae(a,e).toLocaleLowerCase(R(a)):e.status.text:void 0,d=[t?.start?ne(a,t.start,t.end):void 0,t?.location,t?.guests!==void 0?j(a,"cardsOrderGuest","cardsOrderGuests",t.guests):void 0,e.itemCount>0?j(a,"cardsOrderItem","cardsOrderItems",e.itemCount):void 0,e.total!==void 0?g(a,"cardsOrderFallbackTotal",{amount:O(a,e,e.total)}):void 0,n].filter(_),s=A(a,e,!1);return d.length?`${s} \u2014 ${d.join(", ")}`:s}var Gr=ve({name:"order",variants:["receipt","compact","confirmation"],styles:Ye,icon:we,normalize:wr,render:Mr,skeleton:Fr,label:(e,r)=>A(r.config,e,!1),fallback:Lr,partial:e=>{let r=p(e.reference??e.orderNumber??e.order_number??e.orderId??e.order_id??e.bookingId??e.booking_id??e.confirmation??e.number??e.id)?.replace(/^#\s*/,""),a=["bookingId","booking_id","reservationId","reservation_id"].some(t=>e[t]!==void 0)||T(e.kind)==="booking";return!r&&!a?null:{kind:a?"booking":"order",...r?{reference:r}:{}}}});function Hr(e={}){return Gr.setup(e)}export{G as nightsOf,Gr as orderCard,wr as readOrder,Te as readWhen,Hr as setupOrderCard};
839
- //# sourceMappingURL=order-L6GKT5I6.js.map
839
+ //# sourceMappingURL=order-PC45M52X.js.map