@pollinations/ui 0.1.0-alpha.40 → 0.1.0-alpha.42

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 (51) hide show
  1. package/README.md +5 -1
  2. package/dist/app-user-menu/sdk.d.ts +4 -2
  3. package/dist/app-user-menu/sdk.js +15 -14
  4. package/dist/app-user-menu/sdk.js.map +1 -1
  5. package/dist/auth/index.js +8 -8
  6. package/dist/auth/sdk.js +97 -8
  7. package/dist/auth/sdk.js.map +1 -1
  8. package/dist/{chunk-KLAOGE6Y.js → chunk-3UGI5F4I.js} +2 -2
  9. package/dist/{chunk-FZXMS7HJ.js → chunk-4Z7Q5IHS.js} +2 -2
  10. package/dist/{chunk-R3RMENGN.js → chunk-64ALJH5X.js} +3 -3
  11. package/dist/{chunk-WVDV47XQ.js → chunk-DEXJV7HO.js} +30 -2
  12. package/dist/chunk-DEXJV7HO.js.map +1 -0
  13. package/dist/{chunk-EHOK3XKM.js → chunk-FC3UE7XG.js} +25 -2
  14. package/dist/chunk-FC3UE7XG.js.map +1 -0
  15. package/dist/{chunk-OWQ2HDQB.js → chunk-ISOKPVX3.js} +2 -2
  16. package/dist/{chunk-MU7JQOTF.js → chunk-KLXFVVPE.js} +4 -4
  17. package/dist/{chunk-LAZ5O2ZK.js → chunk-O4GD4NTS.js} +2 -2
  18. package/dist/{chunk-MS2GGEMU.js → chunk-OHA5F7YF.js} +5 -5
  19. package/dist/{chunk-QPNEXTZ5.js → chunk-QH75CTQB.js} +2 -2
  20. package/dist/{chunk-WV4XTYMU.js → chunk-SVBJIRQY.js} +2 -2
  21. package/dist/{chunk-KTGSOTNW.js → chunk-WVBUY7NR.js} +4 -4
  22. package/dist/{chunk-B7T42IY2.js → chunk-ZBA2L5L4.js} +2 -2
  23. package/dist/connect.js +14 -14
  24. package/dist/connect.js.map +1 -1
  25. package/dist/gen/index.js +11 -26
  26. package/dist/gen/index.js.map +1 -1
  27. package/dist/{index-BR4r9rhQ.d.ts → index-uotEq_CF.d.ts} +7 -1
  28. package/dist/index.browser.min.js +1 -1
  29. package/dist/index.browser.min.js.map +1 -1
  30. package/dist/index.d.ts +64 -10
  31. package/dist/index.js +1718 -973
  32. package/dist/index.js.map +1 -1
  33. package/dist/markdown.js +6 -6
  34. package/dist/styles.css +1 -1
  35. package/dist/wallet/index.js +5 -5
  36. package/package.json +1 -1
  37. package/dist/chunk-DFYLQTCM.js +0 -107
  38. package/dist/chunk-DFYLQTCM.js.map +0 -1
  39. package/dist/chunk-EHOK3XKM.js.map +0 -1
  40. package/dist/chunk-WVDV47XQ.js.map +0 -1
  41. /package/dist/{chunk-KLAOGE6Y.js.map → chunk-3UGI5F4I.js.map} +0 -0
  42. /package/dist/{chunk-FZXMS7HJ.js.map → chunk-4Z7Q5IHS.js.map} +0 -0
  43. /package/dist/{chunk-R3RMENGN.js.map → chunk-64ALJH5X.js.map} +0 -0
  44. /package/dist/{chunk-OWQ2HDQB.js.map → chunk-ISOKPVX3.js.map} +0 -0
  45. /package/dist/{chunk-MU7JQOTF.js.map → chunk-KLXFVVPE.js.map} +0 -0
  46. /package/dist/{chunk-LAZ5O2ZK.js.map → chunk-O4GD4NTS.js.map} +0 -0
  47. /package/dist/{chunk-MS2GGEMU.js.map → chunk-OHA5F7YF.js.map} +0 -0
  48. /package/dist/{chunk-QPNEXTZ5.js.map → chunk-QH75CTQB.js.map} +0 -0
  49. /package/dist/{chunk-WV4XTYMU.js.map → chunk-SVBJIRQY.js.map} +0 -0
  50. /package/dist/{chunk-KTGSOTNW.js.map → chunk-WVBUY7NR.js.map} +0 -0
  51. /package/dist/{chunk-B7T42IY2.js.map → chunk-ZBA2L5L4.js.map} +0 -0
package/dist/index.js CHANGED
@@ -12,46 +12,47 @@ import {
12
12
  Switch,
13
13
  setColorMode,
14
14
  useColorMode
15
- } from "./chunk-KTGSOTNW.js";
15
+ } from "./chunk-WVBUY7NR.js";
16
16
  import {
17
17
  AccountIdentity,
18
18
  AccountIdentityLink,
19
19
  AccountMenu,
20
20
  BrandMark,
21
21
  DropdownItem
22
- } from "./chunk-R3RMENGN.js";
22
+ } from "./chunk-64ALJH5X.js";
23
23
  import {
24
- TabButton
25
- } from "./chunk-EHOK3XKM.js";
24
+ TabButton,
25
+ modalityTextColor
26
+ } from "./chunk-FC3UE7XG.js";
26
27
  import {
27
28
  ScrollArea
28
- } from "./chunk-LAZ5O2ZK.js";
29
+ } from "./chunk-O4GD4NTS.js";
29
30
  import {
30
31
  ChevronIcon,
31
32
  Dropdown
32
- } from "./chunk-FZXMS7HJ.js";
33
+ } from "./chunk-4Z7Q5IHS.js";
33
34
  import {
34
35
  Chip
35
- } from "./chunk-OWQ2HDQB.js";
36
+ } from "./chunk-ISOKPVX3.js";
36
37
  import {
37
38
  CodeBlock,
38
39
  CopyButton,
39
40
  CopyStateIcon
40
- } from "./chunk-MU7JQOTF.js";
41
+ } from "./chunk-KLXFVVPE.js";
41
42
  import {
42
43
  Heading,
43
44
  Text
44
- } from "./chunk-QPNEXTZ5.js";
45
+ } from "./chunk-QH75CTQB.js";
45
46
  import {
46
47
  Button
47
- } from "./chunk-KLAOGE6Y.js";
48
+ } from "./chunk-3UGI5F4I.js";
48
49
  import {
49
50
  Tooltip
50
- } from "./chunk-B7T42IY2.js";
51
+ } from "./chunk-ZBA2L5L4.js";
51
52
  import {
52
53
  InlineLink,
53
54
  isExternalHref
54
- } from "./chunk-WV4XTYMU.js";
55
+ } from "./chunk-SVBJIRQY.js";
55
56
  import {
56
57
  AccountIcon,
57
58
  AppIcon,
@@ -97,6 +98,7 @@ import {
97
98
  LogOutIcon,
98
99
  MailIcon,
99
100
  McpIcon,
101
+ MediaFileIcon,
100
102
  MegaphoneIcon,
101
103
  MenuIcon,
102
104
  MicIcon,
@@ -135,7 +137,7 @@ import {
135
137
  XIcon,
136
138
  XSocialIcon,
137
139
  cn
138
- } from "./chunk-WVDV47XQ.js";
140
+ } from "./chunk-DEXJV7HO.js";
139
141
 
140
142
  // src/compositions/AppBrand.tsx
141
143
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -281,246 +283,1252 @@ function AppHeader({
281
283
  );
282
284
  }
283
285
 
284
- // src/compositions/Callout.tsx
285
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
286
- function Callout({
287
- title,
288
- body,
289
- children,
290
- tone = "theme",
291
- className
292
- }) {
293
- return /* @__PURE__ */ jsxs3(
294
- Surface,
295
- {
296
- as: "section",
297
- variant: "panel",
298
- className: cn(
299
- "polli:flex polli:flex-wrap polli:items-center polli:justify-between polli:gap-8 polli:rounded-3xl polli:px-6 polli:py-9 polli:sm:gap-10 polli:sm:px-10 polli:sm:py-12",
300
- tone === "dark" ? "dark polli:bg-brand-dark" : void 0,
301
- className
302
- ),
303
- children: [
304
- /* @__PURE__ */ jsxs3("div", { className: "polli:flex polli:max-w-lg polli:flex-col polli:gap-2.5", children: [
305
- /* @__PURE__ */ jsx3(
306
- Heading,
307
- {
308
- size: "section",
309
- className: "polli:text-3xl polli:sm:text-4xl",
310
- children: title
311
- }
312
- ),
313
- /* @__PURE__ */ jsx3(Text, { className: "polli:text-theme-text-strong/75", children: body })
314
- ] }),
315
- /* @__PURE__ */ jsx3("div", { className: "polli:flex polli:flex-wrap polli:items-center polli:gap-3", children })
316
- ]
317
- }
318
- );
319
- }
286
+ // src/compositions/AudioInput.tsx
287
+ import { useCallback as useCallback2, useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
320
288
 
321
- // src/compositions/ChatConversation.tsx
322
- import {
323
- forwardRef
324
- } from "react";
325
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
326
- var ChatConversation = forwardRef(
327
- ({
328
- children,
329
- className,
330
- viewportClassName,
331
- showScrollButton = false,
332
- onScrollToBottom,
333
- scrollButtonLabel = "Scroll to latest message",
334
- ...viewportProps
335
- }, ref) => /* @__PURE__ */ jsxs4("div", { className: cn("polli:relative polli:min-h-0", className), children: [
336
- /* @__PURE__ */ jsx4(
337
- ScrollArea,
338
- {
339
- ...viewportProps,
340
- ref,
341
- className: cn("polli:h-full polli:min-h-0", viewportClassName),
342
- children
343
- }
344
- ),
345
- showScrollButton && onScrollToBottom && /* @__PURE__ */ jsx4(
346
- "button",
347
- {
348
- type: "button",
349
- "aria-label": scrollButtonLabel,
350
- title: scrollButtonLabel,
351
- onClick: onScrollToBottom,
352
- className: "polli-control polli:absolute polli:bottom-3 polli:left-1/2 polli:flex polli:size-9 polli:-translate-x-1/2 polli:cursor-pointer polli:items-center polli:justify-center polli:rounded-full polli:border polli:border-theme-border/60 polli:bg-surface-opaque polli:text-theme-text-strong polli:transition-transform polli:hover:translate-y-0.5",
353
- children: /* @__PURE__ */ jsx4(ArrowRightIcon, { className: "polli:size-4 polli:rotate-90" })
354
- }
355
- )
356
- ] })
357
- );
358
- ChatConversation.displayName = "ChatConversation";
359
- function ChatConversationContent({
360
- className,
361
- ...props
362
- }) {
363
- return /* @__PURE__ */ jsx4(
364
- "div",
365
- {
366
- className: cn(
367
- "polli:flex polli:min-w-0 polli:flex-col polli:gap-5",
368
- className
369
- ),
370
- ...props
371
- }
372
- );
289
+ // src/lib/document-file-drop-guard.ts
290
+ var guards = /* @__PURE__ */ new WeakMap();
291
+ function acquireDocumentFileDropGuard(document2) {
292
+ let guard = guards.get(document2);
293
+ if (!guard) {
294
+ const preventFileNavigation = (event) => {
295
+ const types = event.dataTransfer?.types;
296
+ if (types?.includes("Files")) event.preventDefault();
297
+ };
298
+ guard = { consumers: 0, preventFileNavigation };
299
+ guards.set(document2, guard);
300
+ document2.addEventListener("dragover", preventFileNavigation);
301
+ document2.addEventListener("drop", preventFileNavigation);
302
+ }
303
+ guard.consumers += 1;
304
+ let released = false;
305
+ return () => {
306
+ if (released) return;
307
+ released = true;
308
+ guard.consumers -= 1;
309
+ if (guard.consumers > 0) return;
310
+ document2.removeEventListener("dragover", guard.preventFileNavigation);
311
+ document2.removeEventListener("drop", guard.preventFileNavigation);
312
+ guards.delete(document2);
313
+ };
373
314
  }
374
315
 
375
- // src/compositions/ChatMessage.tsx
376
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
377
- function ChatMessage({
378
- from,
379
- className,
380
- children,
381
- ...props
382
- }) {
383
- return /* @__PURE__ */ jsx5(
384
- "article",
385
- {
386
- "data-role": from,
387
- className: cn(
388
- "polli:group/message polli:flex polli:w-fit polli:max-w-full polli:min-w-0 polli:flex-col polli:gap-3 polli:[overflow-wrap:anywhere] polli:rounded-xl polli:px-4 polli:py-3",
389
- from === "user" ? "polli:ml-auto polli:bg-theme-bg-active polli:text-theme-text-strong" : "polli:mr-auto polli:bg-surface-opaque polli:text-theme-text-base",
390
- className
391
- ),
392
- ...props,
393
- children
316
+ // src/lib/media-action-tile.ts
317
+ function mediaTileTint(modality) {
318
+ if (modality === "mixed") return { "data-theme": "neutral" };
319
+ if (!modality) return void 0;
320
+ return {
321
+ "data-theme": "neutral",
322
+ style: {
323
+ "--polli-media-icon": modalityTextColor(modality)
394
324
  }
395
- );
325
+ };
396
326
  }
397
- function ChatMessageHeader({
398
- from,
399
- label,
400
- icon,
401
- className,
402
- ...props
403
- }) {
404
- const content = label ?? (from === "user" ? "You" : from === "assistant" ? "Agent" : "System");
405
- return /* @__PURE__ */ jsxs5(
406
- "header",
407
- {
408
- className: cn(
409
- "polli:flex polli:items-center polli:gap-2",
410
- className
411
- ),
412
- ...props,
413
- children: [
414
- from === "assistant" && (icon ?? /* @__PURE__ */ jsx5("span", { className: "polli:flex polli:size-6 polli:items-center polli:justify-center polli:rounded-full polli:bg-theme-bg-active polli:text-theme-text-strong", children: /* @__PURE__ */ jsx5(RobotIcon, { className: "polli:size-3.5" }) })),
415
- /* @__PURE__ */ jsx5(
416
- Text,
417
- {
418
- as: "span",
419
- size: "xs",
420
- tone: "muted",
421
- weight: "bold",
422
- className: "polli:uppercase polli:tracking-wide",
423
- children: content
424
- }
425
- )
426
- ]
427
- }
327
+ function mediaActionTileClass(disabled, recording = false) {
328
+ return cn(
329
+ "polli-control polli:relative polli:flex polli:size-20 polli:shrink-0 polli:flex-col polli:items-center polli:justify-center polli:gap-2 polli:rounded-xl polli:border polli:border-dashed polli:border-theme-border polli:bg-theme-bg-pale polli:p-2 polli:text-center polli:font-body polli:text-xs polli:text-theme-text-soft polli:transition-colors polli:[&>svg]:size-6 polli:[&>svg]:shrink-0 polli:[&>svg]:text-[color:var(--polli-media-icon,currentColor)]",
330
+ disabled ? "polli:cursor-not-allowed polli:opacity-60" : "polli:cursor-pointer polli:hover:bg-theme-fill-wash",
331
+ recording && "polli:border-solid polli:border-intent-danger-text polli:text-intent-danger-text"
428
332
  );
429
333
  }
430
- function ChatMessageContent({
431
- className,
432
- ...props
433
- }) {
434
- return /* @__PURE__ */ jsx5(
435
- "div",
436
- {
437
- className: cn(
438
- "polli:min-w-0 polli:[&_pre]:max-w-full polli:[&_pre]:overflow-x-auto polli:[&_table]:max-w-full polli:[&_table]:overflow-x-auto",
439
- className
440
- ),
441
- ...props
334
+
335
+ // src/lib/partition-files.ts
336
+ function matchesAccept(file, accept) {
337
+ if (!accept) return true;
338
+ const tokens = accept.split(",").map((t) => t.trim()).filter(Boolean);
339
+ if (tokens.length === 0) return true;
340
+ return tokens.some((token) => {
341
+ if (token.startsWith(".")) {
342
+ return file.name.toLowerCase().endsWith(token.toLowerCase());
442
343
  }
443
- );
344
+ if (token.endsWith("/*")) {
345
+ const prefix = token.slice(0, token.length - 1);
346
+ return file.type.startsWith(prefix);
347
+ }
348
+ return file.type === token;
349
+ });
444
350
  }
445
- function ChatMessageActions({
446
- className,
447
- ...props
448
- }) {
449
- return /* @__PURE__ */ jsx5(
450
- "footer",
451
- {
452
- className: cn(
453
- "polli:flex polli:flex-wrap polli:items-center polli:gap-1 polli:pt-2",
454
- className
455
- ),
456
- ...props
351
+ function partitionFiles(incoming, current, { maxFiles, maxSizeBytes, accept }) {
352
+ const accepted = [];
353
+ const rejected = [];
354
+ let slots = Math.max(0, maxFiles - current.length);
355
+ for (const file of incoming) {
356
+ if (!matchesAccept(file, accept)) {
357
+ rejected.push({ file, reason: "type" });
358
+ } else if (file.size > maxSizeBytes) {
359
+ rejected.push({ file, reason: "size" });
360
+ } else if (slots <= 0) {
361
+ rejected.push({ file, reason: "count" });
362
+ } else {
363
+ accepted.push(file);
364
+ slots -= 1;
457
365
  }
458
- );
366
+ }
367
+ return { accepted, rejected };
459
368
  }
460
369
 
461
- // src/compositions/ChatPromptInput.tsx
462
- import {
463
- forwardRef as forwardRef3
464
- } from "react";
465
-
466
- // src/primitives/Textarea.tsx
467
- import { forwardRef as forwardRef2 } from "react";
370
+ // src/compositions/AudioRecorder.tsx
371
+ import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
468
372
 
469
- // src/primitives/Field.tsx
470
- import { Field } from "@ark-ui/react/field";
373
+ // src/lib/audio-time.ts
374
+ function audioTime(seconds) {
375
+ return `${Math.floor(seconds / 60)}:${String(Math.floor(seconds % 60)).padStart(2, "0")}`;
376
+ }
471
377
 
472
- // src/primitives/Textarea.tsx
473
- import { jsx as jsx6 } from "react/jsx-runtime";
474
- var Textarea = forwardRef2(
475
- ({ className, error, rows = 4, ...props }, ref) => /* @__PURE__ */ jsx6(
476
- Field.Textarea,
477
- {
478
- ref,
479
- rows,
480
- "aria-invalid": error || void 0,
481
- "data-error": error ? "true" : void 0,
482
- className: cn(
483
- "polli-textarea polli:w-full polli:rounded-lg polli:border polli:px-3 polli:py-2",
484
- "polli:min-h-20 polli:resize-y polli:font-body polli:text-base",
485
- "polli:text-theme-text-strong",
486
- "polli:transition-colors",
487
- "polli:disabled:opacity-50 polli:disabled:cursor-not-allowed",
488
- className
489
- ),
490
- ...props
378
+ // ../../shared/pcm-to-wav.ts
379
+ function pcmToWav(pcm, sampleRate) {
380
+ const wav = new Uint8Array(44 + pcm.byteLength);
381
+ const view = new DataView(wav.buffer);
382
+ const writeAscii = (offset, value) => {
383
+ for (let i = 0; i < value.length; i++) {
384
+ wav[offset + i] = value.charCodeAt(i);
491
385
  }
492
- )
493
- );
494
- Textarea.displayName = "Textarea";
386
+ };
387
+ writeAscii(0, "RIFF");
388
+ view.setUint32(4, 36 + pcm.byteLength, true);
389
+ writeAscii(8, "WAVEfmt ");
390
+ view.setUint32(16, 16, true);
391
+ view.setUint16(20, 1, true);
392
+ view.setUint16(22, 1, true);
393
+ view.setUint32(24, sampleRate, true);
394
+ view.setUint32(28, sampleRate * 2, true);
395
+ view.setUint16(32, 2, true);
396
+ view.setUint16(34, 16, true);
397
+ writeAscii(36, "data");
398
+ view.setUint32(40, pcm.byteLength, true);
399
+ wav.set(pcm, 44);
400
+ return wav;
401
+ }
495
402
 
496
- // src/compositions/ChatPromptInput.tsx
497
- import { Fragment, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
498
- function ChatPromptInput({ className, ...props }) {
499
- return /* @__PURE__ */ jsx7(
500
- "fieldset",
501
- {
502
- className: cn("polli:m-0 polli:min-w-0 polli:p-0", className),
503
- ...props
504
- }
403
+ // src/lib/recorded-wav.ts
404
+ var RECORDING_SAMPLE_RATE = 44100;
405
+ var HEADER_BYTES = 44;
406
+ var recordingNumber = 0;
407
+ function nextRecordingName(extension) {
408
+ const key = "pollinations.ui.recordingNumber";
409
+ try {
410
+ const saved = Number(sessionStorage.getItem(key));
411
+ if (Number.isSafeInteger(saved) && saved > recordingNumber)
412
+ recordingNumber = saved;
413
+ sessionStorage.setItem(key, String(recordingNumber + 1));
414
+ } catch {
415
+ }
416
+ recordingNumber += 1;
417
+ return `Pollinations recording ${String(recordingNumber).padStart(2, "0")}.${extension}`;
418
+ }
419
+ function maxRecordingSamples(maxBytes) {
420
+ return Math.floor((maxBytes - HEADER_BYTES) / 2);
421
+ }
422
+ async function recordedWav(blob, maxBytes) {
423
+ const decoder = new OfflineAudioContext(1, 1, RECORDING_SAMPLE_RATE);
424
+ const audio = await decoder.decodeAudioData(await blob.arrayBuffer());
425
+ const channels = Array.from(
426
+ { length: audio.numberOfChannels },
427
+ (_, n) => audio.getChannelData(n)
428
+ );
429
+ return new File(
430
+ [encodeRecordedWav(channels, audio.sampleRate, maxBytes)],
431
+ nextRecordingName("wav"),
432
+ { type: "audio/wav" }
505
433
  );
506
434
  }
507
- var ChatPromptTextarea = forwardRef3(({ className, ...props }, ref) => /* @__PURE__ */ jsx7(
508
- Textarea,
509
- {
510
- ...props,
511
- ref,
512
- className: cn("polli:resize-none", className)
435
+ function encodeRecordedWav(channels, sampleRate, maxBytes) {
436
+ const samples = Math.min(
437
+ channels[0]?.length ?? 0,
438
+ maxRecordingSamples(maxBytes)
439
+ );
440
+ if (samples < 1) throw new Error("No audio samples fit in the recording.");
441
+ const pcm = new DataView(new ArrayBuffer(samples * 2));
442
+ for (let i = 0; i < samples; i++) {
443
+ let value = 0;
444
+ for (const channel of channels) value += channel[i];
445
+ value = Math.max(-1, Math.min(1, value / channels.length));
446
+ pcm.setInt16(
447
+ 2 * i,
448
+ Math.round(value * (value < 0 ? 32768 : 32767)),
449
+ true
450
+ );
513
451
  }
514
- ));
515
- ChatPromptTextarea.displayName = "ChatPromptTextarea";
516
- function ChatPromptInputFooter({
517
- start,
518
- end,
452
+ return pcmToWav(new Uint8Array(pcm.buffer), sampleRate);
453
+ }
454
+
455
+ // src/compositions/AudioRecorder.tsx
456
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
457
+ function RecordingIndicator({
458
+ stream,
459
+ started,
460
+ video
461
+ }) {
462
+ const preview = useRef(null);
463
+ const meter = useRef(null);
464
+ const [seconds, setSeconds] = useState2(0);
465
+ useEffect2(() => {
466
+ const camera = preview.current;
467
+ if (camera) camera.srcObject = stream;
468
+ let context;
469
+ let sample;
470
+ try {
471
+ if (!video && !window.matchMedia("(prefers-reduced-motion: reduce)").matches && typeof AudioContext !== "undefined") {
472
+ context = new AudioContext();
473
+ const analyser = context.createAnalyser();
474
+ analyser.fftSize = 512;
475
+ context.createMediaStreamSource(stream).connect(analyser);
476
+ void context.resume().catch(() => {
477
+ });
478
+ const samples = new Float32Array(analyser.fftSize);
479
+ sample = () => {
480
+ analyser.getFloatTimeDomainData(samples);
481
+ let sum = 0;
482
+ for (const value of samples) sum += value * value;
483
+ const rms = Math.sqrt(sum / samples.length);
484
+ meter.current?.style.setProperty(
485
+ "--mic-level",
486
+ String(Math.min(1, rms * 8))
487
+ );
488
+ };
489
+ }
490
+ } catch {
491
+ }
492
+ const timer = window.setInterval(
493
+ () => {
494
+ sample?.();
495
+ setSeconds(Math.floor((performance.now() - started) / 1e3));
496
+ },
497
+ sample ? 100 : 250
498
+ );
499
+ return () => {
500
+ if (camera) camera.srcObject = null;
501
+ window.clearInterval(timer);
502
+ if (context) void context.close().catch(() => {
503
+ });
504
+ };
505
+ }, [stream, started, video]);
506
+ return /* @__PURE__ */ jsxs3(Fragment, { children: [
507
+ video ? /* @__PURE__ */ jsx3(
508
+ "video",
509
+ {
510
+ ref: preview,
511
+ autoPlay: true,
512
+ muted: true,
513
+ playsInline: true,
514
+ "aria-label": "Camera preview",
515
+ className: "polli:absolute polli:inset-0 polli:size-full polli:rounded-xl polli:object-cover"
516
+ }
517
+ ) : /* @__PURE__ */ jsxs3(
518
+ "span",
519
+ {
520
+ ref: meter,
521
+ className: "polli-mic-meter",
522
+ "aria-hidden": "true",
523
+ children: [
524
+ /* @__PURE__ */ jsx3("i", {}),
525
+ /* @__PURE__ */ jsx3("i", {}),
526
+ /* @__PURE__ */ jsx3(MicIcon, { className: "polli:size-6" }),
527
+ /* @__PURE__ */ jsx3("i", {}),
528
+ /* @__PURE__ */ jsx3("i", {})
529
+ ]
530
+ }
531
+ ),
532
+ /* @__PURE__ */ jsxs3(
533
+ "span",
534
+ {
535
+ className: video ? "polli:pointer-events-none polli:absolute polli:bottom-1.5 polli:left-1.5 polli:inline-flex polli:items-center polli:gap-1 polli:rounded polli:bg-[rgb(0_0_0/0.65)] polli:px-1 polli:text-[#fff] polli:tabular-nums" : "polli:whitespace-nowrap polli:tabular-nums",
536
+ children: [
537
+ video ? /* @__PURE__ */ jsx3(
538
+ "span",
539
+ {
540
+ "aria-hidden": "true",
541
+ className: "polli:size-2 polli:rounded-[1px] polli:bg-current"
542
+ }
543
+ ) : "Stop ",
544
+ audioTime(seconds)
545
+ ]
546
+ }
547
+ )
548
+ ] });
549
+ }
550
+ function AudioRecorder(props) {
551
+ return /* @__PURE__ */ jsx3(CaptureTile, { ...props, video: false });
552
+ }
553
+ function VideoRecorder(props) {
554
+ return /* @__PURE__ */ jsx3(CaptureTile, { ...props, video: true });
555
+ }
556
+ function CaptureTile({
557
+ onRecord,
558
+ onBusyChange,
559
+ maxBytes,
560
+ disabled = false,
561
+ video,
562
+ label = video ? "Record video" : "Record audio"
563
+ }) {
564
+ const Icon = video ? VideoIcon : MicIcon;
565
+ const recorder = useRef(null);
566
+ const busy = useRef(false);
567
+ const mounted = useRef(false);
568
+ const busyCallback = useRef(onBusyChange);
569
+ useEffect2(() => {
570
+ busyCallback.current = onBusyChange;
571
+ }, [onBusyChange]);
572
+ const [state, setState] = useState2("idle");
573
+ const [available, setAvailable] = useState2(false);
574
+ const [error, setError] = useState2("");
575
+ useEffect2(() => {
576
+ mounted.current = true;
577
+ setAvailable(
578
+ typeof MediaRecorder !== "undefined" && (video || typeof OfflineAudioContext !== "undefined") && !!navigator.mediaDevices?.getUserMedia
579
+ );
580
+ return () => {
581
+ mounted.current = false;
582
+ for (const track of recorder.current?.stream.getTracks() ?? [])
583
+ track.stop();
584
+ if (busy.current) busyCallback.current?.(false);
585
+ };
586
+ }, [video]);
587
+ async function record() {
588
+ setError("");
589
+ setState("requesting");
590
+ busy.current = true;
591
+ busyCallback.current?.(true);
592
+ let stream;
593
+ try {
594
+ stream = await navigator.mediaDevices.getUserMedia({
595
+ audio: video || { channelCount: 1 },
596
+ video
597
+ });
598
+ if (!mounted.current) {
599
+ for (const track of stream.getTracks()) track.stop();
600
+ return;
601
+ }
602
+ const mimeType = video && [
603
+ 'video/mp4;codecs="avc1.42E01E,mp4a.40.2"',
604
+ "video/mp4",
605
+ "video/webm"
606
+ ].find((type) => MediaRecorder.isTypeSupported(type));
607
+ const active = new MediaRecorder(
608
+ stream,
609
+ mimeType ? { mimeType } : void 0
610
+ );
611
+ recorder.current = active;
612
+ const chunks = [];
613
+ let size = 0;
614
+ let failed = false;
615
+ const started = performance.now();
616
+ const maxMilliseconds = maxRecordingSamples(maxBytes) * 1e3 / RECORDING_SAMPLE_RATE;
617
+ active.ondataavailable = ({ data }) => {
618
+ size += data.size;
619
+ if (!video || size <= maxBytes) chunks.push(data);
620
+ if ((video ? size > maxBytes : performance.now() - started >= maxMilliseconds) && active.state === "recording")
621
+ active.stop();
622
+ };
623
+ active.onerror = () => {
624
+ failed = true;
625
+ };
626
+ active.onstop = async () => {
627
+ for (const track of active.stream.getTracks()) track.stop();
628
+ recorder.current = null;
629
+ if (!mounted.current) return;
630
+ setState("preparing");
631
+ try {
632
+ if (failed || !size)
633
+ throw new Error(
634
+ "No usable media was recorded. Try recording again."
635
+ );
636
+ if (video && size > maxBytes)
637
+ throw new Error(
638
+ "Recording exceeded the upload limit. Try a shorter recording."
639
+ );
640
+ const blob = new Blob(chunks, {
641
+ type: active.mimeType.split(";")[0]
642
+ });
643
+ const file = video ? new File(
644
+ [blob],
645
+ nextRecordingName(
646
+ blob.type === "video/mp4" ? "mp4" : "webm"
647
+ ),
648
+ { type: blob.type }
649
+ ) : await recordedWav(blob, maxBytes);
650
+ if (mounted.current) onRecord(file);
651
+ } catch (cause) {
652
+ if (mounted.current)
653
+ setError(
654
+ cause instanceof Error ? cause.message : "Could not read the recording."
655
+ );
656
+ } finally {
657
+ if (mounted.current) {
658
+ setState("idle");
659
+ busy.current = false;
660
+ busyCallback.current?.(false);
661
+ }
662
+ }
663
+ };
664
+ active.start(1e3);
665
+ setState({ stream, started });
666
+ } catch (cause) {
667
+ for (const track of stream?.getTracks() ?? []) track.stop();
668
+ recorder.current = null;
669
+ if (!mounted.current) return;
670
+ setState("idle");
671
+ busy.current = false;
672
+ busyCallback.current?.(false);
673
+ setError(
674
+ cause instanceof DOMException && cause.name === "NotAllowedError" ? video ? "Camera or microphone access was denied. Allow access or import a video." : "Microphone access was denied. Allow it in your browser or upload a file." : cause instanceof Error ? cause.message : "Could not start recording."
675
+ );
676
+ }
677
+ }
678
+ if (!available) return null;
679
+ const waiting = state === "requesting" || state === "preparing";
680
+ return /* @__PURE__ */ jsxs3("div", { className: "polli:flex polli:flex-col polli:items-start polli:gap-2", children: [
681
+ /* @__PURE__ */ jsx3(
682
+ "button",
683
+ {
684
+ type: "button",
685
+ className: mediaActionTileClass(
686
+ disabled || waiting,
687
+ typeof state === "object"
688
+ ),
689
+ ...mediaTileTint(video ? "video" : "audio"),
690
+ "aria-label": typeof state === "object" ? "Stop recording" : void 0,
691
+ disabled: disabled || waiting,
692
+ onClick: () => {
693
+ if (typeof state === "object") {
694
+ if (recorder.current?.state === "recording")
695
+ recorder.current.stop();
696
+ } else void record();
697
+ },
698
+ children: typeof state === "object" ? /* @__PURE__ */ jsx3(RecordingIndicator, { ...state, video }) : /* @__PURE__ */ jsxs3(Fragment, { children: [
699
+ /* @__PURE__ */ jsx3(Icon, {}),
700
+ /* @__PURE__ */ jsx3("span", { children: state === "preparing" ? "Preparing\u2026" : state === "requesting" ? "Waiting\u2026" : label })
701
+ ] })
702
+ }
703
+ ),
704
+ error && /* @__PURE__ */ jsx3(Text, { role: "alert", size: "sm", children: error })
705
+ ] });
706
+ }
707
+
708
+ // src/compositions/UploadedMedia.tsx
709
+ import {
710
+ useCallback,
711
+ useEffect as useEffect4,
712
+ useRef as useRef3,
713
+ useState as useState4
714
+ } from "react";
715
+
716
+ // src/primitives/IconButton.tsx
717
+ import {
718
+ forwardRef
719
+ } from "react";
720
+ import { jsx as jsx4 } from "react/jsx-runtime";
721
+ var intentClasses = {
722
+ danger: "polli:bg-intent-danger-bg-light polli:text-intent-danger-text",
723
+ info: "polli:bg-intent-info-bg-light polli:text-intent-info-text"
724
+ };
725
+ var intentHoverClasses = {
726
+ danger: "polli:hover:bg-intent-danger-bg-hover",
727
+ info: "polli:hover:bg-intent-info-bg-hover"
728
+ };
729
+ var variantClasses = {
730
+ tile: "polli:bg-theme-fill polli:text-theme-on-fill",
731
+ ghost: "polli:bg-transparent polli:text-theme-text-muted"
732
+ };
733
+ var variantHoverClasses = {
734
+ tile: "polli:hover:bg-theme-fill-hover",
735
+ ghost: "polli:hover:bg-transparent polli:hover:text-theme-text-soft"
736
+ };
737
+ var sizeClasses = {
738
+ sm: "polli:h-6 polli:w-6 polli:rounded",
739
+ md: "polli:h-9 polli:w-9 polli:rounded-full"
740
+ };
741
+ var IconButton = forwardRef(
742
+ ({
743
+ intent,
744
+ variant = "tile",
745
+ pressed,
746
+ title,
747
+ tooltip,
748
+ tooltipAlign,
749
+ tooltipClampToViewport,
750
+ children,
751
+ className,
752
+ size = "sm",
753
+ disabled = false,
754
+ href,
755
+ target,
756
+ rel,
757
+ ...buttonProps
758
+ }, ref) => {
759
+ const shared = {
760
+ "aria-label": buttonProps["aria-label"] ?? title,
761
+ "data-intent": intent,
762
+ className: cn(
763
+ "polli-control polli:inline-flex polli:items-center polli:justify-center polli:transition-colors",
764
+ disabled ? "polli:cursor-not-allowed polli:opacity-50" : "polli:cursor-pointer",
765
+ sizeClasses[size],
766
+ intent ? intentClasses[intent] : variantClasses[variant],
767
+ !disabled && (intent ? intentHoverClasses[intent] : variantHoverClasses[variant]),
768
+ className
769
+ )
770
+ };
771
+ const button = href ? /* @__PURE__ */ jsx4(
772
+ "a",
773
+ {
774
+ ...buttonProps,
775
+ ...shared,
776
+ href: disabled ? void 0 : href,
777
+ target,
778
+ rel,
779
+ ...disabled && {
780
+ role: buttonProps.role ?? "link",
781
+ "aria-disabled": true,
782
+ tabIndex: -1,
783
+ onClick: (event) => {
784
+ event.preventDefault();
785
+ event.stopPropagation();
786
+ }
787
+ },
788
+ children
789
+ }
790
+ ) : /* @__PURE__ */ jsx4(
791
+ "button",
792
+ {
793
+ ...buttonProps,
794
+ ...shared,
795
+ ref,
796
+ type: "button",
797
+ disabled,
798
+ "aria-pressed": pressed,
799
+ children
800
+ }
801
+ );
802
+ const tooltipContent = tooltip ?? title;
803
+ if (!tooltipContent) return button;
804
+ return /* @__PURE__ */ jsx4(
805
+ Tooltip,
806
+ {
807
+ triggerAs: "span",
808
+ content: tooltipContent,
809
+ align: tooltipAlign,
810
+ clampToViewport: tooltipClampToViewport,
811
+ tapEnabled: false,
812
+ className: disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer",
813
+ children: button
814
+ }
815
+ );
816
+ }
817
+ );
818
+ IconButton.displayName = "IconButton";
819
+
820
+ // src/compositions/MediaPlayer.tsx
821
+ import {
822
+ useEffect as useEffect3,
823
+ useRef as useRef2,
824
+ useState as useState3
825
+ } from "react";
826
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
827
+ function MediaPlayer({
828
+ src,
829
+ label,
830
+ disabled = false,
831
+ tileModality = "audio",
832
+ onDuration,
833
+ children,
834
+ video = false
835
+ }) {
836
+ const media = useRef2(null);
837
+ const Element = video ? "video" : "audio";
838
+ const [playing, setPlaying] = useState3(false);
839
+ const [position, setPosition] = useState3(0);
840
+ const [duration, setDuration] = useState3(0);
841
+ const [error, setError] = useState3(false);
842
+ useEffect3(() => {
843
+ if (disabled) media.current?.pause();
844
+ }, [disabled]);
845
+ useEffect3(() => {
846
+ if (!src || !onDuration) return;
847
+ const timer = window.setTimeout(() => {
848
+ if (media.current && media.current.readyState < 1) onDuration(null);
849
+ }, 5e3);
850
+ return () => window.clearTimeout(timer);
851
+ }, [src, onDuration]);
852
+ function updateDuration(event) {
853
+ const seconds = event.currentTarget.duration;
854
+ const known = Number.isFinite(seconds) ? seconds : null;
855
+ setDuration(known ?? 0);
856
+ onDuration?.(known);
857
+ }
858
+ return /* @__PURE__ */ jsxs4("div", { className: "polli:relative polli:size-20", children: [
859
+ /* @__PURE__ */ jsx5(
860
+ Element,
861
+ {
862
+ ref: (el) => {
863
+ media.current = el;
864
+ },
865
+ src: src ? video ? `${src}#t=0.001` : src : void 0,
866
+ playsInline: video || void 0,
867
+ className: video ? "polli:pointer-events-none polli:absolute polli:inset-0 polli:size-full polli:rounded-xl polli:object-cover" : void 0,
868
+ preload: "metadata",
869
+ "aria-label": label,
870
+ onLoadStart: () => {
871
+ setPlaying(false);
872
+ setPosition(0);
873
+ setDuration(0);
874
+ setError(false);
875
+ },
876
+ onLoadedMetadata: updateDuration,
877
+ onDurationChange: updateDuration,
878
+ onTimeUpdate: (e) => setPosition(e.currentTarget.currentTime),
879
+ onPlay: (event) => {
880
+ setPlaying(true);
881
+ const current = event.currentTarget;
882
+ if (current.closest(".polli-upload-tile")) {
883
+ for (const other of current.ownerDocument.querySelectorAll(
884
+ ".polli-upload-tile :is(audio, video)"
885
+ )) {
886
+ if (other !== current && !other.paused)
887
+ other.pause();
888
+ }
889
+ }
890
+ },
891
+ onPause: (e) => {
892
+ setPlaying(false);
893
+ if (!e.currentTarget.ended) e.currentTarget.currentTime = 0;
894
+ },
895
+ onEnded: () => setPlaying(false),
896
+ onError: () => {
897
+ setError(true);
898
+ onDuration?.(null);
899
+ }
900
+ }
901
+ ),
902
+ /* @__PURE__ */ jsxs4(
903
+ "button",
904
+ {
905
+ type: "button",
906
+ className: cn(
907
+ mediaActionTileClass(disabled || error),
908
+ "polli:isolate polli:border-solid",
909
+ video && "polli:bg-transparent polli:hover:bg-transparent"
910
+ ),
911
+ ...mediaTileTint(tileModality),
912
+ title: label,
913
+ "aria-label": error ? `Preview unavailable for ${label}` : `${playing ? "Stop" : "Play"} ${label}`,
914
+ disabled: disabled || error,
915
+ onClick: () => {
916
+ const element = media.current;
917
+ if (!element) return;
918
+ if (element.paused) {
919
+ void element.play().catch((cause) => {
920
+ if (!(cause instanceof DOMException && cause.name === "AbortError"))
921
+ setError(true);
922
+ });
923
+ } else {
924
+ element.pause();
925
+ }
926
+ },
927
+ children: [
928
+ children && /* @__PURE__ */ jsx5(
929
+ "span",
930
+ {
931
+ "aria-hidden": "true",
932
+ className: "polli:pointer-events-none polli:absolute polli:inset-0 polli:-z-10 polli:opacity-40",
933
+ children
934
+ }
935
+ ),
936
+ error ? /* @__PURE__ */ jsx5(
937
+ "span",
938
+ {
939
+ className: video ? "polli:rounded polli:bg-[rgb(0_0_0/0.75)] polli:px-1 polli:text-[#fff]" : void 0,
940
+ children: "Preview unavailable"
941
+ }
942
+ ) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
943
+ video ? /* @__PURE__ */ jsx5(
944
+ "span",
945
+ {
946
+ "aria-hidden": "true",
947
+ className: "polli:pointer-events-none polli:absolute polli:bottom-1.5 polli:left-1.5 polli:grid polli:size-5 polli:place-items-center polli:rounded-full polli:bg-[rgb(0_0_0/0.65)] polli:text-[#fff]",
948
+ children: playing ? /* @__PURE__ */ jsx5("span", { className: "polli:size-2 polli:rounded-[1px] polli:bg-current" }) : /* @__PURE__ */ jsx5(PlayIcon, { className: "polli:size-4" })
949
+ }
950
+ ) : playing ? /* @__PURE__ */ jsx5(
951
+ "span",
952
+ {
953
+ "aria-hidden": "true",
954
+ className: "polli:m-1 polli:size-4 polli:rounded-sm polli:bg-[var(--polli-media-icon,currentColor)]"
955
+ }
956
+ ) : /* @__PURE__ */ jsx5(PlayIcon, {}),
957
+ !video && /* @__PURE__ */ jsx5("span", { className: "polli:tabular-nums", children: audioTime(playing ? position : duration) })
958
+ ] })
959
+ ]
960
+ }
961
+ )
962
+ ] });
963
+ }
964
+
965
+ // src/compositions/UploadedMedia.tsx
966
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
967
+ function fileMediaKind(file, fallback) {
968
+ const type = file.type.split("/")[0];
969
+ if (type === "image" || type === "video" || type === "audio") return type;
970
+ if (/\.(mp4|mov|webm|mkv)$/i.test(file.name)) return "video";
971
+ return fallback === "mixed" ? void 0 : fallback;
972
+ }
973
+ function MediaRemoveButton({
974
+ file,
975
+ kind,
976
+ onRemove
977
+ }) {
978
+ if (!onRemove) return null;
979
+ return /* @__PURE__ */ jsx6(
980
+ IconButton,
981
+ {
982
+ variant: "ghost",
983
+ "aria-label": `Remove ${file.name}`,
984
+ "aria-description": kind,
985
+ className: "polli-upload-remove polli:absolute polli:top-1 polli:right-1 polli:z-10 polli:size-7 polli:rounded-full polli:bg-[rgb(0_0_0/0.65)] polli:text-[#fff] polli:hover:bg-[rgb(0_0_0/0.85)] polli:hover:text-[#fff]",
986
+ onClick: onRemove,
987
+ children: /* @__PURE__ */ jsx6(XIcon, { className: "polli:size-3.5" })
988
+ }
989
+ );
990
+ }
991
+ function UploadedClipPlayer({
992
+ file,
993
+ video,
994
+ disabled,
995
+ onDuration
996
+ }) {
997
+ const [url, setUrl] = useState4("");
998
+ useEffect4(() => {
999
+ const src = URL.createObjectURL(file);
1000
+ setUrl(src);
1001
+ return () => URL.revokeObjectURL(src);
1002
+ }, [file]);
1003
+ return /* @__PURE__ */ jsx6(
1004
+ MediaPlayer,
1005
+ {
1006
+ src: url,
1007
+ label: file.name,
1008
+ video,
1009
+ tileModality: video ? "video" : "audio",
1010
+ disabled: disabled || !url,
1011
+ onDuration
1012
+ }
1013
+ );
1014
+ }
1015
+ var PREVIEWABLE_IMAGE_TYPES = /* @__PURE__ */ new Set([
1016
+ "image/gif",
1017
+ "image/jpeg",
1018
+ "image/png",
1019
+ "image/webp"
1020
+ ]);
1021
+ var PREVIEW_SIZE = 80;
1022
+ function isPreviewableImage(file) {
1023
+ return PREVIEWABLE_IMAGE_TYPES.has(file.type);
1024
+ }
1025
+ function PreviewPlaceholder({ icon }) {
1026
+ return /* @__PURE__ */ jsx6("div", { className: "polli:flex polli:size-full polli:items-center polli:justify-center polli:text-[color:var(--polli-media-icon,var(--polli-color-text-soft))]", children: icon });
1027
+ }
1028
+ function FilePreview({
1029
+ file,
1030
+ placeholderIcon
1031
+ }) {
1032
+ const canvasRef = useRef3(null);
1033
+ const [canPreview, setCanPreview] = useState4(
1034
+ () => isPreviewableImage(file)
1035
+ );
1036
+ useEffect4(() => {
1037
+ if (!isPreviewableImage(file)) {
1038
+ setCanPreview(false);
1039
+ return;
1040
+ }
1041
+ let cancelled = false;
1042
+ setCanPreview(true);
1043
+ async function drawPreview() {
1044
+ try {
1045
+ const bitmap = await createImageBitmap(file);
1046
+ if (cancelled) {
1047
+ bitmap.close();
1048
+ return;
1049
+ }
1050
+ const canvas = canvasRef.current;
1051
+ const context = canvas?.getContext("2d");
1052
+ if (!canvas || !context) {
1053
+ bitmap.close();
1054
+ setCanPreview(false);
1055
+ return;
1056
+ }
1057
+ canvas.width = PREVIEW_SIZE;
1058
+ canvas.height = PREVIEW_SIZE;
1059
+ const scale = Math.max(
1060
+ PREVIEW_SIZE / bitmap.width,
1061
+ PREVIEW_SIZE / bitmap.height
1062
+ );
1063
+ const width = bitmap.width * scale;
1064
+ const height = bitmap.height * scale;
1065
+ const x = (PREVIEW_SIZE - width) / 2;
1066
+ const y = (PREVIEW_SIZE - height) / 2;
1067
+ context.clearRect(0, 0, PREVIEW_SIZE, PREVIEW_SIZE);
1068
+ context.drawImage(bitmap, x, y, width, height);
1069
+ bitmap.close();
1070
+ } catch {
1071
+ if (!cancelled) setCanPreview(false);
1072
+ }
1073
+ }
1074
+ void drawPreview();
1075
+ return () => {
1076
+ cancelled = true;
1077
+ };
1078
+ }, [file]);
1079
+ if (!canPreview) {
1080
+ return /* @__PURE__ */ jsx6(PreviewPlaceholder, { icon: placeholderIcon });
1081
+ }
1082
+ return /* @__PURE__ */ jsx6(
1083
+ "canvas",
1084
+ {
1085
+ ref: canvasRef,
1086
+ role: "img",
1087
+ "aria-label": file.name,
1088
+ className: "polli:block polli:size-full",
1089
+ width: PREVIEW_SIZE,
1090
+ height: PREVIEW_SIZE
1091
+ }
1092
+ );
1093
+ }
1094
+ function UploadedFileTile({
1095
+ file,
1096
+ modality,
1097
+ disabled = false,
1098
+ onRemove,
1099
+ onClipDuration,
1100
+ previewIcon,
1101
+ drop
1102
+ }) {
1103
+ const kind = fileMediaKind(file, modality);
1104
+ const reportDuration = useCallback(
1105
+ (seconds) => onClipDuration?.(file, seconds),
1106
+ [file, onClipDuration]
1107
+ );
1108
+ return /* @__PURE__ */ jsxs5(
1109
+ "fieldset",
1110
+ {
1111
+ "aria-label": file.name,
1112
+ title: file.name,
1113
+ onDragOver: drop && ((event) => event.preventDefault()),
1114
+ onDrop: drop && ((event) => {
1115
+ event.preventDefault();
1116
+ if (disabled) return;
1117
+ const { accepted, rejected } = partitionFiles(
1118
+ Array.from(event.dataTransfer.files),
1119
+ drop.value,
1120
+ drop
1121
+ );
1122
+ if (accepted.length)
1123
+ drop.onChange([...drop.value, ...accepted]);
1124
+ if (rejected.length) drop.onReject?.(rejected);
1125
+ }),
1126
+ className: "polli-upload-tile polli:relative polli:m-0 polli:w-20 polli:min-w-0 polli:shrink-0 polli:border-0 polli:p-0",
1127
+ children: [
1128
+ kind === "video" || kind === "audio" ? /* @__PURE__ */ jsx6(
1129
+ UploadedClipPlayer,
1130
+ {
1131
+ file,
1132
+ video: kind === "video",
1133
+ disabled,
1134
+ onDuration: onClipDuration && reportDuration
1135
+ }
1136
+ ) : /* @__PURE__ */ jsx6(
1137
+ "div",
1138
+ {
1139
+ className: "polli:relative polli:box-border polli:size-20 polli:overflow-hidden polli:rounded-xl polli:border-2 polli:border-theme-border polli:bg-theme-bg-pale",
1140
+ ...mediaTileTint(kind),
1141
+ children: /* @__PURE__ */ jsx6(
1142
+ FilePreview,
1143
+ {
1144
+ file,
1145
+ placeholderIcon: previewIcon ?? /* @__PURE__ */ jsx6(ImageIcon, { className: "polli:size-5" })
1146
+ }
1147
+ )
1148
+ }
1149
+ ),
1150
+ /* @__PURE__ */ jsx6("span", { className: "polli:sr-only", children: file.name }),
1151
+ /* @__PURE__ */ jsx6(
1152
+ MediaRemoveButton,
1153
+ {
1154
+ file,
1155
+ kind,
1156
+ onRemove: disabled ? void 0 : onRemove
1157
+ }
1158
+ )
1159
+ ]
1160
+ }
1161
+ );
1162
+ }
1163
+
1164
+ // src/compositions/AudioInput.tsx
1165
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1166
+ function AudioInput({
1167
+ value,
1168
+ onChange,
1169
+ onBusyChange,
1170
+ onClipDuration,
1171
+ onReject,
1172
+ accept = "audio/*",
1173
+ importLabel,
1174
+ inputLabel = importLabel ?? "Choose audio file",
1175
+ tileModality = "audio",
1176
+ maxFiles = 1,
1177
+ maxSizeBytes,
1178
+ disabled = false,
1179
+ actionsOnly = false
1180
+ }) {
1181
+ const picker = useRef4(null);
1182
+ const [busy, setBusy] = useState5(false);
1183
+ const [error, setError] = useState5("");
1184
+ const changeBusy = useCallback2(
1185
+ (active) => {
1186
+ setBusy(active);
1187
+ onBusyChange?.(active);
1188
+ },
1189
+ [onBusyChange]
1190
+ );
1191
+ useEffect5(() => acquireDocumentFileDropGuard(document), []);
1192
+ const canAdd = value.length < maxFiles;
1193
+ function add(files) {
1194
+ if (disabled || !files.length) return;
1195
+ const { accepted, rejected } = partitionFiles(files, value, {
1196
+ accept,
1197
+ maxFiles,
1198
+ maxSizeBytes
1199
+ });
1200
+ if (accepted.length) onChange([...value, ...accepted]);
1201
+ setError("");
1202
+ if (rejected.length) {
1203
+ if (onReject) onReject(rejected);
1204
+ else
1205
+ setError(
1206
+ {
1207
+ size: "File exceeds the size limit.",
1208
+ count: "Too many clips.",
1209
+ type: "Choose a supported file type."
1210
+ }[rejected[0].reason]
1211
+ );
1212
+ }
1213
+ }
1214
+ return /* @__PURE__ */ jsxs6(
1215
+ "fieldset",
1216
+ {
1217
+ "aria-label": "Audio clips",
1218
+ className: actionsOnly ? "polli:contents" : "polli:m-0 polli:w-full polli:min-w-0 polli:border-0 polli:p-0",
1219
+ onDragOver: (e) => e.preventDefault(),
1220
+ onDrop: (e) => {
1221
+ e.preventDefault();
1222
+ if (!busy) add(Array.from(e.dataTransfer.files));
1223
+ },
1224
+ children: [
1225
+ /* @__PURE__ */ jsxs6(
1226
+ "div",
1227
+ {
1228
+ className: actionsOnly ? "polli:contents" : "polli:flex polli:flex-wrap polli:items-start polli:gap-3",
1229
+ children: [
1230
+ !actionsOnly && value.map((file, i) => /* @__PURE__ */ jsx7(
1231
+ UploadedFileTile,
1232
+ {
1233
+ modality: "audio",
1234
+ file,
1235
+ onClipDuration,
1236
+ disabled: disabled || busy,
1237
+ onRemove: () => onChange(value.filter((_, n) => n !== i))
1238
+ },
1239
+ `${file.name}-${file.lastModified}-${i}`
1240
+ )),
1241
+ canAdd && /* @__PURE__ */ jsxs6(Fragment3, { children: [
1242
+ /* @__PURE__ */ jsx7(
1243
+ "input",
1244
+ {
1245
+ hidden: true,
1246
+ ref: picker,
1247
+ type: "file",
1248
+ accept,
1249
+ multiple: maxFiles > 1,
1250
+ disabled: busy || disabled,
1251
+ "aria-label": inputLabel,
1252
+ onChange: (e) => {
1253
+ add(Array.from(e.currentTarget.files ?? []));
1254
+ e.currentTarget.value = "";
1255
+ }
1256
+ }
1257
+ ),
1258
+ !busy && /* @__PURE__ */ jsxs6(
1259
+ "button",
1260
+ {
1261
+ type: "button",
1262
+ "aria-label": inputLabel,
1263
+ className: mediaActionTileClass(disabled),
1264
+ ...mediaTileTint(tileModality),
1265
+ disabled,
1266
+ onClick: () => picker.current?.click(),
1267
+ children: [
1268
+ /* @__PURE__ */ jsx7(MediaFileIcon, { modality: tileModality }),
1269
+ /* @__PURE__ */ jsx7("span", { children: importLabel ?? "Audio" })
1270
+ ]
1271
+ }
1272
+ ),
1273
+ /* @__PURE__ */ jsx7(
1274
+ AudioRecorder,
1275
+ {
1276
+ disabled,
1277
+ maxBytes: maxSizeBytes,
1278
+ onBusyChange: changeBusy,
1279
+ onRecord: (file) => add([file])
1280
+ }
1281
+ )
1282
+ ] })
1283
+ ]
1284
+ }
1285
+ ),
1286
+ error && /* @__PURE__ */ jsx7(Text, { role: "alert", size: "sm", children: error })
1287
+ ]
1288
+ }
1289
+ );
1290
+ }
1291
+
1292
+ // src/compositions/Callout.tsx
1293
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1294
+ function Callout({
1295
+ title,
1296
+ body,
1297
+ children,
1298
+ tone = "theme",
1299
+ className
1300
+ }) {
1301
+ return /* @__PURE__ */ jsxs7(
1302
+ Surface,
1303
+ {
1304
+ as: "section",
1305
+ variant: "panel",
1306
+ className: cn(
1307
+ "polli:flex polli:flex-wrap polli:items-center polli:justify-between polli:gap-8 polli:rounded-3xl polli:px-6 polli:py-9 polli:sm:gap-10 polli:sm:px-10 polli:sm:py-12",
1308
+ tone === "dark" ? "dark polli:bg-brand-dark" : void 0,
1309
+ className
1310
+ ),
1311
+ children: [
1312
+ /* @__PURE__ */ jsxs7("div", { className: "polli:flex polli:max-w-lg polli:flex-col polli:gap-2.5", children: [
1313
+ /* @__PURE__ */ jsx8(
1314
+ Heading,
1315
+ {
1316
+ size: "section",
1317
+ className: "polli:text-3xl polli:sm:text-4xl",
1318
+ children: title
1319
+ }
1320
+ ),
1321
+ /* @__PURE__ */ jsx8(Text, { className: "polli:text-theme-text-strong/75", children: body })
1322
+ ] }),
1323
+ /* @__PURE__ */ jsx8("div", { className: "polli:flex polli:flex-wrap polli:items-center polli:gap-3", children })
1324
+ ]
1325
+ }
1326
+ );
1327
+ }
1328
+
1329
+ // src/compositions/ChatConversation.tsx
1330
+ import {
1331
+ forwardRef as forwardRef2
1332
+ } from "react";
1333
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1334
+ var ChatConversation = forwardRef2(
1335
+ ({
1336
+ children,
1337
+ className,
1338
+ viewportClassName,
1339
+ showScrollButton = false,
1340
+ onScrollToBottom,
1341
+ scrollButtonLabel = "Scroll to latest message",
1342
+ ...viewportProps
1343
+ }, ref) => /* @__PURE__ */ jsxs8("div", { className: cn("polli:relative polli:min-h-0", className), children: [
1344
+ /* @__PURE__ */ jsx9(
1345
+ ScrollArea,
1346
+ {
1347
+ ...viewportProps,
1348
+ ref,
1349
+ className: cn("polli:h-full polli:min-h-0", viewportClassName),
1350
+ children
1351
+ }
1352
+ ),
1353
+ showScrollButton && onScrollToBottom && /* @__PURE__ */ jsx9(
1354
+ "button",
1355
+ {
1356
+ type: "button",
1357
+ "aria-label": scrollButtonLabel,
1358
+ title: scrollButtonLabel,
1359
+ onClick: onScrollToBottom,
1360
+ className: "polli-control polli:absolute polli:bottom-3 polli:left-1/2 polli:flex polli:size-9 polli:-translate-x-1/2 polli:cursor-pointer polli:items-center polli:justify-center polli:rounded-full polli:border polli:border-theme-border/60 polli:bg-surface-opaque polli:text-theme-text-strong polli:transition-transform polli:hover:translate-y-0.5",
1361
+ children: /* @__PURE__ */ jsx9(ArrowRightIcon, { className: "polli:size-4 polli:rotate-90" })
1362
+ }
1363
+ )
1364
+ ] })
1365
+ );
1366
+ ChatConversation.displayName = "ChatConversation";
1367
+ function ChatConversationContent({
1368
+ className,
1369
+ ...props
1370
+ }) {
1371
+ return /* @__PURE__ */ jsx9(
1372
+ "div",
1373
+ {
1374
+ className: cn(
1375
+ "polli:flex polli:min-w-0 polli:flex-col polli:gap-5",
1376
+ className
1377
+ ),
1378
+ ...props
1379
+ }
1380
+ );
1381
+ }
1382
+
1383
+ // src/compositions/ChatMessage.tsx
1384
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1385
+ function ChatMessage({
1386
+ from,
1387
+ className,
1388
+ children,
1389
+ ...props
1390
+ }) {
1391
+ return /* @__PURE__ */ jsx10(
1392
+ "article",
1393
+ {
1394
+ "data-role": from,
1395
+ className: cn(
1396
+ "polli:group/message polli:flex polli:w-fit polli:max-w-full polli:min-w-0 polli:flex-col polli:gap-3 polli:[overflow-wrap:anywhere] polli:rounded-xl polli:px-4 polli:py-3",
1397
+ from === "user" ? "polli:ml-auto polli:bg-theme-bg-active polli:text-theme-text-strong" : "polli:mr-auto polli:bg-surface-opaque polli:text-theme-text-base",
1398
+ className
1399
+ ),
1400
+ ...props,
1401
+ children
1402
+ }
1403
+ );
1404
+ }
1405
+ function ChatMessageHeader({
1406
+ from,
1407
+ label,
1408
+ icon,
1409
+ className,
1410
+ ...props
1411
+ }) {
1412
+ const content = label ?? (from === "user" ? "You" : from === "assistant" ? "Agent" : "System");
1413
+ return /* @__PURE__ */ jsxs9(
1414
+ "header",
1415
+ {
1416
+ className: cn(
1417
+ "polli:flex polli:items-center polli:gap-2",
1418
+ className
1419
+ ),
1420
+ ...props,
1421
+ children: [
1422
+ from === "assistant" && (icon ?? /* @__PURE__ */ jsx10("span", { className: "polli:flex polli:size-6 polli:items-center polli:justify-center polli:rounded-full polli:bg-theme-bg-active polli:text-theme-text-strong", children: /* @__PURE__ */ jsx10(RobotIcon, { className: "polli:size-3.5" }) })),
1423
+ /* @__PURE__ */ jsx10(
1424
+ Text,
1425
+ {
1426
+ as: "span",
1427
+ size: "xs",
1428
+ tone: "muted",
1429
+ weight: "bold",
1430
+ className: "polli:uppercase polli:tracking-wide",
1431
+ children: content
1432
+ }
1433
+ )
1434
+ ]
1435
+ }
1436
+ );
1437
+ }
1438
+ function ChatMessageContent({
1439
+ className,
1440
+ ...props
1441
+ }) {
1442
+ return /* @__PURE__ */ jsx10(
1443
+ "div",
1444
+ {
1445
+ className: cn(
1446
+ "polli:min-w-0 polli:[&_pre]:max-w-full polli:[&_pre]:overflow-x-auto polli:[&_table]:max-w-full polli:[&_table]:overflow-x-auto",
1447
+ className
1448
+ ),
1449
+ ...props
1450
+ }
1451
+ );
1452
+ }
1453
+ function ChatMessageActions({
1454
+ className,
1455
+ ...props
1456
+ }) {
1457
+ return /* @__PURE__ */ jsx10(
1458
+ "footer",
1459
+ {
1460
+ className: cn(
1461
+ "polli:flex polli:flex-wrap polli:items-center polli:gap-1 polli:pt-2",
1462
+ className
1463
+ ),
1464
+ ...props
1465
+ }
1466
+ );
1467
+ }
1468
+
1469
+ // src/compositions/ChatPromptInput.tsx
1470
+ import {
1471
+ forwardRef as forwardRef4
1472
+ } from "react";
1473
+
1474
+ // src/primitives/Textarea.tsx
1475
+ import { forwardRef as forwardRef3 } from "react";
1476
+
1477
+ // src/primitives/Field.tsx
1478
+ import { Field } from "@ark-ui/react/field";
1479
+
1480
+ // src/primitives/Textarea.tsx
1481
+ import { jsx as jsx11 } from "react/jsx-runtime";
1482
+ var Textarea = forwardRef3(
1483
+ ({ className, error, rows = 4, ...props }, ref) => /* @__PURE__ */ jsx11(
1484
+ Field.Textarea,
1485
+ {
1486
+ ref,
1487
+ rows,
1488
+ "aria-invalid": error || void 0,
1489
+ "data-error": error ? "true" : void 0,
1490
+ className: cn(
1491
+ "polli-textarea polli:w-full polli:rounded-lg polli:border polli:px-3 polli:py-2",
1492
+ "polli:min-h-20 polli:resize-y polli:font-body polli:text-base",
1493
+ "polli:text-theme-text-strong",
1494
+ "polli:transition-colors",
1495
+ "polli:disabled:opacity-50 polli:disabled:cursor-not-allowed",
1496
+ className
1497
+ ),
1498
+ ...props
1499
+ }
1500
+ )
1501
+ );
1502
+ Textarea.displayName = "Textarea";
1503
+
1504
+ // src/compositions/ChatPromptInput.tsx
1505
+ import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1506
+ function ChatPromptInput({ className, ...props }) {
1507
+ return /* @__PURE__ */ jsx12(
1508
+ "fieldset",
1509
+ {
1510
+ className: cn("polli:m-0 polli:min-w-0 polli:p-0", className),
1511
+ ...props
1512
+ }
1513
+ );
1514
+ }
1515
+ var ChatPromptTextarea = forwardRef4(({ className, ...props }, ref) => /* @__PURE__ */ jsx12(
1516
+ Textarea,
1517
+ {
1518
+ ...props,
1519
+ ref,
1520
+ className: cn("polli:resize-none", className)
1521
+ }
1522
+ ));
1523
+ ChatPromptTextarea.displayName = "ChatPromptTextarea";
1524
+ function ChatPromptInputFooter({
1525
+ start,
1526
+ end,
519
1527
  children,
520
1528
  className,
521
1529
  ...props
522
1530
  }) {
523
- return /* @__PURE__ */ jsx7(
1531
+ return /* @__PURE__ */ jsx12(
524
1532
  "div",
525
1533
  {
526
1534
  className: cn(
@@ -528,16 +1536,16 @@ function ChatPromptInputFooter({
528
1536
  className
529
1537
  ),
530
1538
  ...props,
531
- children: children ?? /* @__PURE__ */ jsxs6(Fragment, { children: [
532
- /* @__PURE__ */ jsx7("div", { className: "polli:flex polli:flex-wrap polli:items-center polli:gap-2", children: start }),
533
- /* @__PURE__ */ jsx7("div", { className: "polli:ml-auto polli:flex polli:items-center polli:gap-2", children: end })
1539
+ children: children ?? /* @__PURE__ */ jsxs10(Fragment4, { children: [
1540
+ /* @__PURE__ */ jsx12("div", { className: "polli:flex polli:flex-wrap polli:items-center polli:gap-2", children: start }),
1541
+ /* @__PURE__ */ jsx12("div", { className: "polli:ml-auto polli:flex polli:items-center polli:gap-2", children: end })
534
1542
  ] })
535
1543
  }
536
1544
  );
537
1545
  }
538
1546
 
539
1547
  // src/compositions/Collapsible.tsx
540
- import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1548
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
541
1549
  var Collapsible = ({
542
1550
  label,
543
1551
  expanded,
@@ -550,7 +1558,7 @@ var Collapsible = ({
550
1558
  focusClassName,
551
1559
  panelClassName = "polli:border-t polli:border-theme-border polli:px-3 polli:pt-3 polli:pb-3",
552
1560
  ariaLabel
553
- }) => /* @__PURE__ */ jsxs7(
1561
+ }) => /* @__PURE__ */ jsxs11(
554
1562
  "div",
555
1563
  {
556
1564
  className: cn(
@@ -559,7 +1567,7 @@ var Collapsible = ({
559
1567
  disabled && "polli:opacity-50"
560
1568
  ),
561
1569
  children: [
562
- /* @__PURE__ */ jsxs7(
1570
+ /* @__PURE__ */ jsxs11(
563
1571
  "button",
564
1572
  {
565
1573
  type: "button",
@@ -576,8 +1584,8 @@ var Collapsible = ({
576
1584
  disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer"
577
1585
  ),
578
1586
  children: [
579
- /* @__PURE__ */ jsx8("div", { className: "polli:flex-1 polli:min-w-0", children: label }),
580
- /* @__PURE__ */ jsx8(
1587
+ /* @__PURE__ */ jsx13("div", { className: "polli:flex-1 polli:min-w-0", children: label }),
1588
+ /* @__PURE__ */ jsx13(
581
1589
  ChevronIcon,
582
1590
  {
583
1591
  expanded,
@@ -587,18 +1595,18 @@ var Collapsible = ({
587
1595
  ]
588
1596
  }
589
1597
  ),
590
- expanded && /* @__PURE__ */ jsx8("div", { className: panelClassName, children })
1598
+ expanded && /* @__PURE__ */ jsx13("div", { className: panelClassName, children })
591
1599
  ]
592
1600
  }
593
1601
  );
594
1602
 
595
1603
  // src/compositions/ConfirmationDialog.tsx
596
- import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1604
+ import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
597
1605
  var defaultIcons = {
598
- danger: /* @__PURE__ */ jsx9(TrashIcon, {}),
599
- commit: /* @__PURE__ */ jsx9(CheckIcon, {}),
600
- info: /* @__PURE__ */ jsx9(CheckIcon, {}),
601
- neutral: /* @__PURE__ */ jsx9(CheckIcon, {})
1606
+ danger: /* @__PURE__ */ jsx14(TrashIcon, {}),
1607
+ commit: /* @__PURE__ */ jsx14(CheckIcon, {}),
1608
+ info: /* @__PURE__ */ jsx14(CheckIcon, {}),
1609
+ neutral: /* @__PURE__ */ jsx14(CheckIcon, {})
602
1610
  };
603
1611
  function ConfirmationDialog({
604
1612
  open,
@@ -614,19 +1622,19 @@ function ConfirmationDialog({
614
1622
  onCancel,
615
1623
  size = "md"
616
1624
  }) {
617
- const actions = /* @__PURE__ */ jsxs8(Fragment2, { children: [
618
- /* @__PURE__ */ jsx9(
1625
+ const actions = /* @__PURE__ */ jsxs12(Fragment5, { children: [
1626
+ /* @__PURE__ */ jsx14(
619
1627
  Button,
620
1628
  {
621
1629
  type: "button",
622
1630
  intent: "neutral",
623
- icon: /* @__PURE__ */ jsx9(XIcon, {}),
1631
+ icon: /* @__PURE__ */ jsx14(XIcon, {}),
624
1632
  onClick: onCancel,
625
1633
  disabled: cancelDisabled,
626
1634
  children: "Cancel"
627
1635
  }
628
1636
  ),
629
- /* @__PURE__ */ jsx9(
1637
+ /* @__PURE__ */ jsx14(
630
1638
  Button,
631
1639
  {
632
1640
  type: "button",
@@ -638,16 +1646,16 @@ function ConfirmationDialog({
638
1646
  }
639
1647
  )
640
1648
  ] });
641
- return /* @__PURE__ */ jsx9(
1649
+ return /* @__PURE__ */ jsx14(
642
1650
  Dialog,
643
1651
  {
644
1652
  open,
645
1653
  onOpenChange: (next) => !next && !cancelDisabled && onCancel(),
646
1654
  size,
647
1655
  contentClassName: "polli:overflow-hidden",
648
- children: /* @__PURE__ */ jsxs8(DialogBody, { actions, children: [
649
- /* @__PURE__ */ jsx9(DialogHeader, { inBody: true, title }),
650
- description && /* @__PURE__ */ jsx9("p", { className: "polli:text-sm polli:leading-relaxed", children: description }),
1656
+ children: /* @__PURE__ */ jsxs12(DialogBody, { actions, children: [
1657
+ /* @__PURE__ */ jsx14(DialogHeader, { inBody: true, title }),
1658
+ description && /* @__PURE__ */ jsx14("p", { className: "polli:text-sm polli:leading-relaxed", children: description }),
651
1659
  children
652
1660
  ] })
653
1661
  }
@@ -655,8 +1663,8 @@ function ConfirmationDialog({
655
1663
  }
656
1664
 
657
1665
  // src/primitives/Eyebrow.tsx
658
- import { jsx as jsx10 } from "react/jsx-runtime";
659
- var sizeClasses = {
1666
+ import { jsx as jsx15 } from "react/jsx-runtime";
1667
+ var sizeClasses2 = {
660
1668
  page: "polli:text-sm polli:tracking-widest polli:text-theme-text-soft",
661
1669
  card: "polli:text-xs polli:tracking-wider polli:text-theme-text-soft",
662
1670
  chrome: "polli:text-micro polli:tracking-widest polli:text-theme-text-muted"
@@ -669,13 +1677,13 @@ function Eyebrow({
669
1677
  ...rest
670
1678
  }) {
671
1679
  const Component = as || "span";
672
- return /* @__PURE__ */ jsx10(
1680
+ return /* @__PURE__ */ jsx15(
673
1681
  Component,
674
1682
  {
675
1683
  ...rest,
676
1684
  className: cn(
677
1685
  "polli:font-pixel polli:uppercase",
678
- sizeClasses[size],
1686
+ sizeClasses2[size],
679
1687
  className
680
1688
  ),
681
1689
  children
@@ -684,7 +1692,7 @@ function Eyebrow({
684
1692
  }
685
1693
 
686
1694
  // src/compositions/ContentHeader.tsx
687
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1695
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
688
1696
  var titleClasses = {
689
1697
  page: "polli:font-heading polli:text-4xl polli:leading-[1.08] polli:text-theme-text-strong polli:sm:text-5xl polli:lg:text-7xl",
690
1698
  section: "polli:font-subheading polli:text-3xl polli:leading-tight polli:text-theme-text-strong polli:sm:text-4xl"
@@ -702,7 +1710,7 @@ function ContentHeader({
702
1710
  className
703
1711
  }) {
704
1712
  const Title = variant === "page" ? "h1" : "h2";
705
- return /* @__PURE__ */ jsxs9(
1713
+ return /* @__PURE__ */ jsxs13(
706
1714
  "header",
707
1715
  {
708
1716
  className: cn(
@@ -710,10 +1718,10 @@ function ContentHeader({
710
1718
  className
711
1719
  ),
712
1720
  children: [
713
- /* @__PURE__ */ jsxs9("div", { className: "polli:flex polli:max-w-2xl polli:flex-col polli:gap-3", children: [
714
- eyebrow ? /* @__PURE__ */ jsx11(Eyebrow, { size: "page", children: eyebrow }) : null,
715
- /* @__PURE__ */ jsx11(Title, { className: titleClasses[variant], children: title }),
716
- subtitle && /* @__PURE__ */ jsx11(
1721
+ /* @__PURE__ */ jsxs13("div", { className: "polli:flex polli:max-w-2xl polli:flex-col polli:gap-3", children: [
1722
+ eyebrow ? /* @__PURE__ */ jsx16(Eyebrow, { size: "page", children: eyebrow }) : null,
1723
+ /* @__PURE__ */ jsx16(Title, { className: titleClasses[variant], children: title }),
1724
+ subtitle && /* @__PURE__ */ jsx16(
717
1725
  "p",
718
1726
  {
719
1727
  className: cn(
@@ -731,8 +1739,8 @@ function ContentHeader({
731
1739
  }
732
1740
 
733
1741
  // src/compositions/CopyField.tsx
734
- import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
735
- var sizeClasses2 = {
1742
+ import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
1743
+ var sizeClasses3 = {
736
1744
  md: "polli:min-h-10 polli:gap-3 polli:rounded-lg polli:border polli:border-divider polli:bg-theme-bg-pale polli:px-3 polli:py-2 polli:text-theme-text-base polli:hover:text-theme-text-strong",
737
1745
  sm: "polli:min-h-7 polli:gap-2 polli:rounded-[0.875rem] polli:bg-theme-bg-subtle polli:px-3 polli:py-1 polli:text-theme-text-base polli:hover:bg-theme-text-muted/25 polli:hover:text-theme-text-strong"
738
1746
  };
@@ -744,7 +1752,7 @@ function CopyField({
744
1752
  className,
745
1753
  ...copy
746
1754
  }) {
747
- return /* @__PURE__ */ jsx12(
1755
+ return /* @__PURE__ */ jsx17(
748
1756
  CopyButton,
749
1757
  {
750
1758
  ...copy,
@@ -752,13 +1760,13 @@ function CopyField({
752
1760
  "aria-label": label,
753
1761
  className: cn(
754
1762
  "polli:flex polli:w-full polli:cursor-pointer polli:items-center polli:text-left polli:font-mono polli:text-xs polli:transition-colors",
755
- sizeClasses2[size],
1763
+ sizeClasses3[size],
756
1764
  "polli:outline-none polli:focus-visible:outline-2 polli:focus-visible:-outline-offset-1 polli:focus-visible:outline-[var(--polli-color-focus)]",
757
1765
  className
758
1766
  ),
759
- children: (copied) => /* @__PURE__ */ jsxs10(Fragment3, { children: [
760
- /* @__PURE__ */ jsx12("span", { className: "polli:min-w-0 polli:flex-1 polli:wrap-anywhere", children: display ?? (typeof value === "string" ? value : label) }),
761
- /* @__PURE__ */ jsx12(
1767
+ children: (copied) => /* @__PURE__ */ jsxs14(Fragment6, { children: [
1768
+ /* @__PURE__ */ jsx17("span", { className: "polli:min-w-0 polli:flex-1 polli:wrap-anywhere", children: display ?? (typeof value === "string" ? value : label) }),
1769
+ /* @__PURE__ */ jsx17(
762
1770
  "span",
763
1771
  {
764
1772
  "aria-hidden": "true",
@@ -766,7 +1774,7 @@ function CopyField({
766
1774
  "polli:flex polli:shrink-0 polli:[&>svg]:size-full",
767
1775
  size === "sm" ? "polli:size-3.5" : "polli:size-4"
768
1776
  ),
769
- children: /* @__PURE__ */ jsx12(CopyStateIcon, { copied })
1777
+ children: /* @__PURE__ */ jsx17(CopyStateIcon, { copied })
770
1778
  }
771
1779
  )
772
1780
  ] })
@@ -778,16 +1786,16 @@ function CopyField({
778
1786
  import { createListCollection } from "@ark-ui/react/collection";
779
1787
  import { Combobox } from "@ark-ui/react/combobox";
780
1788
  import {
781
- useEffect as useEffect2,
1789
+ useEffect as useEffect6,
782
1790
  useMemo,
783
- useRef
1791
+ useRef as useRef5
784
1792
  } from "react";
785
1793
 
786
1794
  // src/primitives/Input.tsx
787
- import { forwardRef as forwardRef4 } from "react";
788
- import { jsx as jsx13 } from "react/jsx-runtime";
789
- var Input = forwardRef4(
790
- ({ className, error, hideNumberSteppers, ...props }, ref) => /* @__PURE__ */ jsx13(
1795
+ import { forwardRef as forwardRef5 } from "react";
1796
+ import { jsx as jsx18 } from "react/jsx-runtime";
1797
+ var Input = forwardRef5(
1798
+ ({ className, error, hideNumberSteppers, ...props }, ref) => /* @__PURE__ */ jsx18(
791
1799
  Field.Input,
792
1800
  {
793
1801
  ref,
@@ -807,7 +1815,7 @@ var Input = forwardRef4(
807
1815
  );
808
1816
 
809
1817
  // src/compositions/EditableCombobox.tsx
810
- import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
1818
+ import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
811
1819
  function EditableComboboxToken({
812
1820
  label,
813
1821
  value,
@@ -815,7 +1823,7 @@ function EditableComboboxToken({
815
1823
  className,
816
1824
  ...buttonProps
817
1825
  }) {
818
- return /* @__PURE__ */ jsxs11(
1826
+ return /* @__PURE__ */ jsxs15(
819
1827
  "button",
820
1828
  {
821
1829
  type: "button",
@@ -826,12 +1834,12 @@ function EditableComboboxToken({
826
1834
  ),
827
1835
  ...buttonProps,
828
1836
  children: [
829
- /* @__PURE__ */ jsxs11("span", { className: "polli:text-theme-text-muted", children: [
1837
+ /* @__PURE__ */ jsxs15("span", { className: "polli:text-theme-text-muted", children: [
830
1838
  label,
831
1839
  ":"
832
1840
  ] }),
833
- /* @__PURE__ */ jsx14("span", { className: "polli:truncate polli:text-theme-text-base", children: value }),
834
- /* @__PURE__ */ jsx14(ChevronIcon, { className: "polli:h-3 polli:w-3 polli:text-theme-text-muted" })
1841
+ /* @__PURE__ */ jsx19("span", { className: "polli:truncate polli:text-theme-text-base", children: value }),
1842
+ /* @__PURE__ */ jsx19(ChevronIcon, { className: "polli:h-3 polli:w-3 polli:text-theme-text-muted" })
835
1843
  ]
836
1844
  }
837
1845
  );
@@ -853,540 +1861,279 @@ function EditableCombobox({
853
1861
  placeholder,
854
1862
  required,
855
1863
  ...inputProps
856
- }) {
857
- const visibleOptions = useMemo(() => {
858
- const query = value.trim().toLowerCase();
859
- return query === "" ? options : options.filter((option) => option.toLowerCase().includes(query));
860
- }, [options, value]);
861
- const collection = useMemo(
862
- () => createListCollection({
863
- items: visibleOptions,
864
- itemToString: (item) => item,
865
- itemToValue: (item) => item
866
- }),
867
- [visibleOptions]
868
- );
869
- const hasOptions = options.length > 0;
870
- const hasStartContent = Boolean(startContent);
871
- const inputRef = useRef(null);
872
- useEffect2(() => {
873
- if (inputRef.current && inputRef.current.value !== value) {
874
- inputRef.current.value = value;
875
- }
876
- });
877
- return /* @__PURE__ */ jsxs11(
878
- Combobox.Root,
879
- {
880
- collection,
881
- inputValue: value,
882
- value: [],
883
- allowCustomValue: true,
884
- openOnClick: hasOptions,
885
- openOnChange: () => hasOptions,
886
- open,
887
- closeOnSelect,
888
- disabled,
889
- name,
890
- required,
891
- positioning: {
892
- placement: align === "end" ? "bottom-end" : "bottom-start",
893
- sameWidth: true,
894
- strategy: "fixed"
895
- },
896
- onInputValueChange: (details) => onChange(details.inputValue),
897
- onOpenChange: (details) => onOpenChange?.(details.open),
898
- children: [
899
- /* @__PURE__ */ jsxs11(
900
- Combobox.Control,
901
- {
902
- className: cn(
903
- "polli:relative polli:w-full",
904
- hasStartContent && "polli-input-shell polli:flex polli:min-h-10 polli:flex-wrap polli:items-center polli:gap-2 polli:border polli:rounded-lg polli:px-2 polli:py-1"
905
- ),
906
- children: [
907
- startContent,
908
- /* @__PURE__ */ jsx14(Combobox.Input, { asChild: true, children: /* @__PURE__ */ jsx14(
909
- Input,
910
- {
911
- ref: inputRef,
912
- ...inputProps,
913
- name,
914
- placeholder,
915
- className: cn(
916
- hasStartContent ? "polli:min-w-28 polli:flex-1 polli:px-1 polli:py-1" : "polli:w-full polli:pr-10",
917
- className
918
- )
919
- }
920
- ) }),
921
- hasOptions && !hasStartContent && /* @__PURE__ */ jsx14(
922
- Combobox.Trigger,
923
- {
924
- "aria-label": "Show options",
925
- className: "polli-control polli:absolute polli:right-0 polli:top-0 polli:flex polli:h-full polli:w-10 polli:cursor-pointer polli:items-center polli:justify-center polli:rounded-r-lg polli:text-theme-text-muted polli:hover:text-theme-text-strong",
926
- children: /* @__PURE__ */ jsx14(Combobox.Context, { children: (context) => /* @__PURE__ */ jsx14(
927
- ChevronIcon,
928
- {
929
- expanded: context.open,
930
- className: "polli:h-4 polli:w-4 polli:transition-transform"
931
- }
932
- ) })
933
- }
934
- )
935
- ]
936
- }
937
- ),
938
- /* @__PURE__ */ jsx14(Combobox.Positioner, { children: /* @__PURE__ */ jsx14(
939
- Combobox.Content,
940
- {
941
- className: cn(
942
- "polli:z-[120] polli:overflow-hidden polli:rounded-lg polli:bg-surface-menu polli:p-1 polli:shadow-lg polli:focus:outline-none",
943
- contentClassName
944
- ),
945
- children: /* @__PURE__ */ jsx14(ScrollArea, { className: "polli:max-h-64", children: /* @__PURE__ */ jsxs11(Combobox.List, { className: "polli:flex polli:flex-col", children: [
946
- visibleOptions.map((option) => /* @__PURE__ */ jsx14(
947
- Combobox.Item,
948
- {
949
- item: option,
950
- className: cn(
951
- "polli-control polli:flex polli:w-full polli:cursor-pointer polli:items-center polli:rounded-lg polli:bg-transparent polli:px-3 polli:py-2 polli:text-left polli:text-sm polli:font-medium polli:text-theme-text-base polli:transition-colors polli:hover:bg-theme-fill-wash polli:data-[highlighted]:bg-theme-fill-wash",
952
- value === option && "polli:bg-theme-fill polli:text-theme-on-fill polli:hover:bg-theme-fill polli:data-[highlighted]:bg-theme-fill"
953
- ),
954
- children: /* @__PURE__ */ jsx14(Combobox.ItemText, { className: "polli:truncate polli:font-mono", children: option })
955
- },
956
- option
957
- )),
958
- visibleOptions.length === 0 && /* @__PURE__ */ jsx14(Combobox.Empty, { className: "polli:m-0 polli:px-2 polli:py-2 polli:text-sm polli:text-theme-text-soft", children: emptyMessage })
959
- ] }) })
960
- }
961
- ) })
962
- ]
963
- }
964
- );
965
- }
966
-
967
- // src/compositions/EmptyState.tsx
968
- import { jsx as jsx15 } from "react/jsx-runtime";
969
- function EmptyState({ children }) {
970
- return /* @__PURE__ */ jsx15("p", { className: "polli:rounded-card polli:border polli:border-dashed polli:border-theme-border polli:px-5 polli:py-8 polli:text-center polli:font-body polli:text-sm polli:text-theme-text-muted", children });
971
- }
972
-
973
- // src/compositions/ExternalLinkButton.tsx
974
- import { Fragment as Fragment4, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
975
- function ExternalLinkButton(props) {
976
- const {
977
- size = "md",
978
- appearance,
979
- external = "href" in props ? isExternalHref(props.href) : true,
980
- showIcon = true,
981
- icon,
982
- className,
983
- children
984
- } = props;
985
- const content = /* @__PURE__ */ jsxs12(Fragment4, { children: [
986
- icon,
987
- /* @__PURE__ */ jsx16("span", { children }),
988
- external && showIcon ? /* @__PURE__ */ jsx16(
989
- ExternalLinkIcon,
990
- {
991
- className: "polli:h-4 polli:w-4 polli:shrink-0 polli:opacity-60",
992
- "aria-hidden": "true"
993
- }
994
- ) : null
995
- ] });
996
- if ("href" in props) {
997
- const {
998
- href,
999
- target = external ? "_blank" : void 0,
1000
- rel = target === "_blank" ? "noopener noreferrer" : void 0,
1001
- size: _size2,
1002
- appearance: _appearance2,
1003
- external: _external2,
1004
- showIcon: _showIcon2,
1005
- icon: _icon2,
1006
- className: _className2,
1007
- children: _children2,
1008
- ...anchorProps
1009
- } = props;
1010
- return /* @__PURE__ */ jsx16(
1011
- Button,
1012
- {
1013
- as: "a",
1014
- href,
1015
- target,
1016
- rel,
1017
- size,
1018
- appearance,
1019
- className: cn("polli:gap-2", className),
1020
- ...anchorProps,
1021
- children: content
1022
- }
1023
- );
1024
- }
1025
- const {
1026
- type = "button",
1027
- size: _size,
1028
- appearance: _appearance,
1029
- external: _external,
1030
- showIcon: _showIcon,
1031
- icon: _icon,
1032
- className: _className,
1033
- children: _children,
1034
- ...buttonProps
1035
- } = props;
1036
- return /* @__PURE__ */ jsx16(
1037
- Button,
1038
- {
1039
- as: "button",
1040
- type,
1041
- size,
1042
- appearance,
1043
- className: cn("polli:gap-2", className),
1044
- ...buttonProps,
1045
- children: content
1046
- }
1047
- );
1048
- }
1049
-
1050
- // src/compositions/FieldStack.tsx
1051
- import { jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
1052
- var orientationClasses = {
1053
- stacked: "polli:flex polli:flex-col polli:gap-2",
1054
- inline: "polli:grid polli:grid-cols-[6.5rem_minmax(0,1fr)] polli:items-center polli:gap-x-4 polli:gap-y-2 polli:max-sm:grid-cols-[5.5rem_minmax(0,1fr)] polli:max-sm:gap-x-2 polli:[&>*:not(:first-child)]:col-start-2 polli:[&>*:not(:first-child)]:min-w-0"
1055
- };
1056
- function FieldStack({
1057
- label,
1058
- children,
1059
- helper,
1060
- action,
1061
- error,
1062
- alignLabelRow = false,
1063
- orientation = "stacked",
1064
- className,
1065
- labelClassName,
1066
- helperClassName,
1067
- errorClassName
1068
- }) {
1069
- return /* @__PURE__ */ jsxs13(
1070
- Field.Root,
1864
+ }) {
1865
+ const visibleOptions = useMemo(() => {
1866
+ const query = value.trim().toLowerCase();
1867
+ return query === "" ? options : options.filter((option) => option.toLowerCase().includes(query));
1868
+ }, [options, value]);
1869
+ const collection = useMemo(
1870
+ () => createListCollection({
1871
+ items: visibleOptions,
1872
+ itemToString: (item) => item,
1873
+ itemToValue: (item) => item
1874
+ }),
1875
+ [visibleOptions]
1876
+ );
1877
+ const hasOptions = options.length > 0;
1878
+ const hasStartContent = Boolean(startContent);
1879
+ const inputRef = useRef5(null);
1880
+ useEffect6(() => {
1881
+ if (inputRef.current && inputRef.current.value !== value) {
1882
+ inputRef.current.value = value;
1883
+ }
1884
+ });
1885
+ return /* @__PURE__ */ jsxs15(
1886
+ Combobox.Root,
1071
1887
  {
1072
- className: cn(
1073
- orientationClasses[orientation],
1074
- "polli:font-body",
1075
- className
1076
- ),
1077
- invalid: Boolean(error),
1888
+ collection,
1889
+ inputValue: value,
1890
+ value: [],
1891
+ allowCustomValue: true,
1892
+ openOnClick: hasOptions,
1893
+ openOnChange: () => hasOptions,
1894
+ open,
1895
+ closeOnSelect,
1896
+ disabled,
1897
+ name,
1898
+ required,
1899
+ positioning: {
1900
+ placement: align === "end" ? "bottom-end" : "bottom-start",
1901
+ sameWidth: true,
1902
+ strategy: "fixed"
1903
+ },
1904
+ onInputValueChange: (details) => onChange(details.inputValue),
1905
+ onOpenChange: (details) => onOpenChange?.(details.open),
1078
1906
  children: [
1079
- (label || action) && /* @__PURE__ */ jsxs13(
1080
- "div",
1907
+ /* @__PURE__ */ jsxs15(
1908
+ Combobox.Control,
1081
1909
  {
1082
1910
  className: cn(
1083
- "polli:flex polli:items-center polli:justify-between polli:gap-2",
1084
- alignLabelRow && "polli:min-h-8"
1911
+ "polli:relative polli:w-full",
1912
+ hasStartContent && "polli-input-shell polli:flex polli:min-h-10 polli:flex-wrap polli:items-center polli:gap-2 polli:border polli:rounded-lg polli:px-2 polli:py-1"
1085
1913
  ),
1086
1914
  children: [
1087
- label && /* @__PURE__ */ jsx17(
1088
- Field.Label,
1915
+ startContent,
1916
+ /* @__PURE__ */ jsx19(Combobox.Input, { asChild: true, children: /* @__PURE__ */ jsx19(
1917
+ Input,
1089
1918
  {
1919
+ ref: inputRef,
1920
+ ...inputProps,
1921
+ name,
1922
+ placeholder,
1090
1923
  className: cn(
1091
- "polli:text-sm polli:font-semibold polli:leading-5 polli:text-theme-text-strong",
1092
- labelClassName
1093
- ),
1094
- children: label
1924
+ hasStartContent ? "polli:min-w-28 polli:flex-1 polli:px-1 polli:py-1" : "polli:w-full polli:pr-10",
1925
+ className
1926
+ )
1095
1927
  }
1096
- ),
1097
- action
1928
+ ) }),
1929
+ hasOptions && !hasStartContent && /* @__PURE__ */ jsx19(
1930
+ Combobox.Trigger,
1931
+ {
1932
+ "aria-label": "Show options",
1933
+ className: "polli-control polli:absolute polli:right-0 polli:top-0 polli:flex polli:h-full polli:w-10 polli:cursor-pointer polli:items-center polli:justify-center polli:rounded-r-lg polli:text-theme-text-muted polli:hover:text-theme-text-strong",
1934
+ children: /* @__PURE__ */ jsx19(Combobox.Context, { children: (context) => /* @__PURE__ */ jsx19(
1935
+ ChevronIcon,
1936
+ {
1937
+ expanded: context.open,
1938
+ className: "polli:h-4 polli:w-4 polli:transition-transform"
1939
+ }
1940
+ ) })
1941
+ }
1942
+ )
1098
1943
  ]
1099
1944
  }
1100
1945
  ),
1101
- children,
1102
- error ? /* @__PURE__ */ jsx17(
1103
- Field.ErrorText,
1104
- {
1105
- className: cn(
1106
- "polli:text-xs polli:font-medium polli:leading-5 polli:text-intent-danger-text",
1107
- errorClassName
1108
- ),
1109
- children: error
1110
- }
1111
- ) : helper ? /* @__PURE__ */ jsx17(
1112
- Field.HelperText,
1946
+ /* @__PURE__ */ jsx19(Combobox.Positioner, { children: /* @__PURE__ */ jsx19(
1947
+ Combobox.Content,
1113
1948
  {
1114
1949
  className: cn(
1115
- "polli:text-xs polli:font-normal polli:leading-normal polli:text-theme-text-muted",
1116
- helperClassName
1950
+ "polli:z-[120] polli:overflow-hidden polli:rounded-lg polli:bg-surface-menu polli:p-1 polli:shadow-lg polli:focus:outline-none",
1951
+ contentClassName
1117
1952
  ),
1118
- children: helper
1953
+ children: /* @__PURE__ */ jsx19(ScrollArea, { className: "polli:max-h-64", children: /* @__PURE__ */ jsxs15(Combobox.List, { className: "polli:flex polli:flex-col", children: [
1954
+ visibleOptions.map((option) => /* @__PURE__ */ jsx19(
1955
+ Combobox.Item,
1956
+ {
1957
+ item: option,
1958
+ className: cn(
1959
+ "polli-control polli:flex polli:w-full polli:cursor-pointer polli:items-center polli:rounded-lg polli:bg-transparent polli:px-3 polli:py-2 polli:text-left polli:text-sm polli:font-medium polli:text-theme-text-base polli:transition-colors polli:hover:bg-theme-fill-wash polli:data-[highlighted]:bg-theme-fill-wash",
1960
+ value === option && "polli:bg-theme-fill polli:text-theme-on-fill polli:hover:bg-theme-fill polli:data-[highlighted]:bg-theme-fill"
1961
+ ),
1962
+ children: /* @__PURE__ */ jsx19(Combobox.ItemText, { className: "polli:truncate polli:font-mono", children: option })
1963
+ },
1964
+ option
1965
+ )),
1966
+ visibleOptions.length === 0 && /* @__PURE__ */ jsx19(Combobox.Empty, { className: "polli:m-0 polli:px-2 polli:py-2 polli:text-sm polli:text-theme-text-soft", children: emptyMessage })
1967
+ ] }) })
1119
1968
  }
1120
- ) : null
1969
+ ) })
1121
1970
  ]
1122
1971
  }
1123
1972
  );
1124
1973
  }
1125
1974
 
1126
- // src/compositions/FileUpload.tsx
1127
- import {
1128
- useEffect as useEffect3,
1129
- useId,
1130
- useRef as useRef2,
1131
- useState as useState2
1132
- } from "react";
1133
-
1134
- // src/lib/document-file-drop-guard.ts
1135
- var guards = /* @__PURE__ */ new WeakMap();
1136
- function acquireDocumentFileDropGuard(document2) {
1137
- let guard = guards.get(document2);
1138
- if (!guard) {
1139
- const preventFileNavigation = (event) => {
1140
- const types = event.dataTransfer?.types;
1141
- if (types?.includes("Files")) event.preventDefault();
1142
- };
1143
- guard = { consumers: 0, preventFileNavigation };
1144
- guards.set(document2, guard);
1145
- document2.addEventListener("dragover", preventFileNavigation);
1146
- document2.addEventListener("drop", preventFileNavigation);
1147
- }
1148
- guard.consumers += 1;
1149
- let released = false;
1150
- return () => {
1151
- if (released) return;
1152
- released = true;
1153
- guard.consumers -= 1;
1154
- if (guard.consumers > 0) return;
1155
- document2.removeEventListener("dragover", guard.preventFileNavigation);
1156
- document2.removeEventListener("drop", guard.preventFileNavigation);
1157
- guards.delete(document2);
1158
- };
1159
- }
1160
-
1161
- // src/lib/partition-files.ts
1162
- function matchesAccept(file, accept) {
1163
- if (!accept) return true;
1164
- const tokens = accept.split(",").map((t) => t.trim()).filter(Boolean);
1165
- if (tokens.length === 0) return true;
1166
- return tokens.some((token) => {
1167
- if (token.startsWith(".")) {
1168
- return file.name.toLowerCase().endsWith(token.toLowerCase());
1169
- }
1170
- if (token.endsWith("/*")) {
1171
- const prefix = token.slice(0, token.length - 1);
1172
- return file.type.startsWith(prefix);
1173
- }
1174
- return file.type === token;
1175
- });
1176
- }
1177
- function partitionFiles(incoming, current, { maxFiles, maxSizeBytes, accept }) {
1178
- const accepted = [];
1179
- const rejected = [];
1180
- let slots = Math.max(0, maxFiles - current.length);
1181
- for (const file of incoming) {
1182
- if (!matchesAccept(file, accept)) {
1183
- rejected.push({ file, reason: "type" });
1184
- } else if (file.size > maxSizeBytes) {
1185
- rejected.push({ file, reason: "size" });
1186
- } else if (slots <= 0) {
1187
- rejected.push({ file, reason: "count" });
1188
- } else {
1189
- accepted.push(file);
1190
- slots -= 1;
1191
- }
1192
- }
1193
- return { accepted, rejected };
1975
+ // src/compositions/EmptyState.tsx
1976
+ import { jsx as jsx20 } from "react/jsx-runtime";
1977
+ function EmptyState({ children }) {
1978
+ return /* @__PURE__ */ jsx20("p", { className: "polli:rounded-card polli:border polli:border-dashed polli:border-theme-border polli:px-5 polli:py-8 polli:text-center polli:font-body polli:text-sm polli:text-theme-text-muted", children });
1194
1979
  }
1195
1980
 
1196
- // src/primitives/IconButton.tsx
1197
- import {
1198
- forwardRef as forwardRef5
1199
- } from "react";
1200
- import { jsx as jsx18 } from "react/jsx-runtime";
1201
- var intentClasses = {
1202
- danger: "polli:bg-intent-danger-bg-light polli:text-intent-danger-text",
1203
- info: "polli:bg-intent-info-bg-light polli:text-intent-info-text"
1204
- };
1205
- var intentHoverClasses = {
1206
- danger: "polli:hover:bg-intent-danger-bg-hover",
1207
- info: "polli:hover:bg-intent-info-bg-hover"
1208
- };
1209
- var variantClasses = {
1210
- tile: "polli:bg-theme-fill polli:text-theme-on-fill",
1211
- ghost: "polli:bg-transparent polli:text-theme-text-muted"
1212
- };
1213
- var variantHoverClasses = {
1214
- tile: "polli:hover:bg-theme-fill-hover",
1215
- ghost: "polli:hover:bg-transparent polli:hover:text-theme-text-soft"
1216
- };
1217
- var sizeClasses3 = {
1218
- sm: "polli:h-6 polli:w-6 polli:rounded",
1219
- md: "polli:h-9 polli:w-9 polli:rounded-full"
1220
- };
1221
- var IconButton = forwardRef5(
1222
- ({
1223
- intent,
1224
- variant = "tile",
1225
- pressed,
1226
- title,
1227
- tooltip,
1228
- tooltipAlign,
1229
- tooltipClampToViewport,
1230
- children,
1231
- className,
1232
- size = "sm",
1233
- disabled = false,
1234
- href,
1235
- target,
1236
- rel,
1237
- ...buttonProps
1238
- }, ref) => {
1239
- const shared = {
1240
- "aria-label": buttonProps["aria-label"] ?? title,
1241
- "data-intent": intent,
1242
- className: cn(
1243
- "polli-control polli:inline-flex polli:items-center polli:justify-center polli:transition-colors",
1244
- disabled ? "polli:cursor-not-allowed polli:opacity-50" : "polli:cursor-pointer",
1245
- sizeClasses3[size],
1246
- intent ? intentClasses[intent] : variantClasses[variant],
1247
- !disabled && (intent ? intentHoverClasses[intent] : variantHoverClasses[variant]),
1248
- className
1249
- )
1250
- };
1251
- const button = href ? /* @__PURE__ */ jsx18(
1252
- "a",
1253
- {
1254
- ...buttonProps,
1255
- ...shared,
1256
- href: disabled ? void 0 : href,
1257
- target,
1258
- rel,
1259
- ...disabled && {
1260
- role: buttonProps.role ?? "link",
1261
- "aria-disabled": true,
1262
- tabIndex: -1,
1263
- onClick: (event) => {
1264
- event.preventDefault();
1265
- event.stopPropagation();
1266
- }
1267
- },
1268
- children
1269
- }
1270
- ) : /* @__PURE__ */ jsx18(
1271
- "button",
1981
+ // src/compositions/ExternalLinkButton.tsx
1982
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
1983
+ function ExternalLinkButton(props) {
1984
+ const {
1985
+ size = "md",
1986
+ appearance,
1987
+ external = "href" in props ? isExternalHref(props.href) : true,
1988
+ showIcon = true,
1989
+ icon,
1990
+ className,
1991
+ children
1992
+ } = props;
1993
+ const content = /* @__PURE__ */ jsxs16(Fragment7, { children: [
1994
+ icon,
1995
+ /* @__PURE__ */ jsx21("span", { children }),
1996
+ external && showIcon ? /* @__PURE__ */ jsx21(
1997
+ ExternalLinkIcon,
1272
1998
  {
1273
- ...buttonProps,
1274
- ...shared,
1275
- ref,
1276
- type: "button",
1277
- disabled,
1278
- "aria-pressed": pressed,
1279
- children
1999
+ className: "polli:h-4 polli:w-4 polli:shrink-0 polli:opacity-60",
2000
+ "aria-hidden": "true"
1280
2001
  }
1281
- );
1282
- const tooltipContent = tooltip ?? title;
1283
- if (!tooltipContent) return button;
1284
- return /* @__PURE__ */ jsx18(
1285
- Tooltip,
2002
+ ) : null
2003
+ ] });
2004
+ if ("href" in props) {
2005
+ const {
2006
+ href,
2007
+ target = external ? "_blank" : void 0,
2008
+ rel = target === "_blank" ? "noopener noreferrer" : void 0,
2009
+ size: _size2,
2010
+ appearance: _appearance2,
2011
+ external: _external2,
2012
+ showIcon: _showIcon2,
2013
+ icon: _icon2,
2014
+ className: _className2,
2015
+ children: _children2,
2016
+ ...anchorProps
2017
+ } = props;
2018
+ return /* @__PURE__ */ jsx21(
2019
+ Button,
1286
2020
  {
1287
- triggerAs: "span",
1288
- content: tooltipContent,
1289
- align: tooltipAlign,
1290
- clampToViewport: tooltipClampToViewport,
1291
- tapEnabled: false,
1292
- className: disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer",
1293
- children: button
2021
+ as: "a",
2022
+ href,
2023
+ target,
2024
+ rel,
2025
+ size,
2026
+ appearance,
2027
+ className: cn("polli:gap-2", className),
2028
+ ...anchorProps,
2029
+ children: content
1294
2030
  }
1295
2031
  );
1296
2032
  }
1297
- );
1298
- IconButton.displayName = "IconButton";
1299
-
1300
- // src/compositions/FileUpload.tsx
1301
- import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
1302
- var PREVIEWABLE_IMAGE_TYPES = /* @__PURE__ */ new Set([
1303
- "image/gif",
1304
- "image/jpeg",
1305
- "image/png",
1306
- "image/webp"
1307
- ]);
1308
- var PREVIEW_SIZE = 80;
1309
- function isPreviewableImage(file) {
1310
- return PREVIEWABLE_IMAGE_TYPES.has(file.type);
1311
- }
1312
- function PreviewPlaceholder({ icon }) {
1313
- return /* @__PURE__ */ jsx19(
1314
- "div",
2033
+ const {
2034
+ type = "button",
2035
+ size: _size,
2036
+ appearance: _appearance,
2037
+ external: _external,
2038
+ showIcon: _showIcon,
2039
+ icon: _icon,
2040
+ className: _className,
2041
+ children: _children,
2042
+ ...buttonProps
2043
+ } = props;
2044
+ return /* @__PURE__ */ jsx21(
2045
+ Button,
1315
2046
  {
1316
- className: cn(
1317
- "polli:flex polli:items-center polli:justify-center polli:rounded-xl polli:bg-theme-bg-active polli:text-theme-text-soft",
1318
- "polli:h-20 polli:w-20"
1319
- ),
1320
- children: icon
2047
+ as: "button",
2048
+ type,
2049
+ size,
2050
+ appearance,
2051
+ className: cn("polli:gap-2", className),
2052
+ ...buttonProps,
2053
+ children: content
1321
2054
  }
1322
2055
  );
1323
2056
  }
1324
- function FilePreview({
1325
- file,
1326
- placeholderIcon
2057
+
2058
+ // src/compositions/FieldStack.tsx
2059
+ import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
2060
+ var orientationClasses = {
2061
+ stacked: "polli:flex polli:flex-col polli:gap-2",
2062
+ inline: "polli:grid polli:grid-cols-[6.5rem_minmax(0,1fr)] polli:items-center polli:gap-x-4 polli:gap-y-2 polli:max-sm:grid-cols-[5.5rem_minmax(0,1fr)] polli:max-sm:gap-x-2 polli:[&>*:not(:first-child)]:col-start-2 polli:[&>*:not(:first-child)]:min-w-0"
2063
+ };
2064
+ function FieldStack({
2065
+ label,
2066
+ children,
2067
+ helper,
2068
+ action,
2069
+ error,
2070
+ alignLabelRow = false,
2071
+ orientation = "stacked",
2072
+ className,
2073
+ labelClassName,
2074
+ helperClassName,
2075
+ errorClassName
1327
2076
  }) {
1328
- const canvasRef = useRef2(null);
1329
- const [canPreview, setCanPreview] = useState2(
1330
- () => isPreviewableImage(file)
1331
- );
1332
- useEffect3(() => {
1333
- if (!isPreviewableImage(file)) {
1334
- setCanPreview(false);
1335
- return;
1336
- }
1337
- let cancelled = false;
1338
- setCanPreview(true);
1339
- async function drawPreview() {
1340
- try {
1341
- const bitmap = await createImageBitmap(file);
1342
- if (cancelled) {
1343
- bitmap.close();
1344
- return;
1345
- }
1346
- const canvas = canvasRef.current;
1347
- const context = canvas?.getContext("2d");
1348
- if (!canvas || !context) {
1349
- bitmap.close();
1350
- setCanPreview(false);
1351
- return;
1352
- }
1353
- canvas.width = PREVIEW_SIZE;
1354
- canvas.height = PREVIEW_SIZE;
1355
- const scale = Math.max(
1356
- PREVIEW_SIZE / bitmap.width,
1357
- PREVIEW_SIZE / bitmap.height
1358
- );
1359
- const width = bitmap.width * scale;
1360
- const height = bitmap.height * scale;
1361
- const x = (PREVIEW_SIZE - width) / 2;
1362
- const y = (PREVIEW_SIZE - height) / 2;
1363
- context.clearRect(0, 0, PREVIEW_SIZE, PREVIEW_SIZE);
1364
- context.drawImage(bitmap, x, y, width, height);
1365
- bitmap.close();
1366
- } catch {
1367
- if (!cancelled) setCanPreview(false);
1368
- }
1369
- }
1370
- void drawPreview();
1371
- return () => {
1372
- cancelled = true;
1373
- };
1374
- }, [file]);
1375
- if (!canPreview) {
1376
- return /* @__PURE__ */ jsx19(PreviewPlaceholder, { icon: placeholderIcon });
1377
- }
1378
- return /* @__PURE__ */ jsx19(
1379
- "canvas",
2077
+ return /* @__PURE__ */ jsxs17(
2078
+ Field.Root,
1380
2079
  {
1381
- ref: canvasRef,
1382
- role: "img",
1383
- "aria-label": file.name,
1384
- className: "polli:h-20 polli:w-20 polli:rounded-xl",
1385
- width: PREVIEW_SIZE,
1386
- height: PREVIEW_SIZE
2080
+ className: cn(
2081
+ orientationClasses[orientation],
2082
+ "polli:font-body",
2083
+ className
2084
+ ),
2085
+ invalid: Boolean(error),
2086
+ children: [
2087
+ (label || action) && /* @__PURE__ */ jsxs17(
2088
+ "div",
2089
+ {
2090
+ className: cn(
2091
+ "polli:flex polli:items-center polli:justify-between polli:gap-2",
2092
+ alignLabelRow && "polli:min-h-8"
2093
+ ),
2094
+ children: [
2095
+ label && /* @__PURE__ */ jsx22(
2096
+ Field.Label,
2097
+ {
2098
+ className: cn(
2099
+ "polli:text-sm polli:font-semibold polli:leading-5 polli:text-theme-text-strong",
2100
+ labelClassName
2101
+ ),
2102
+ children: label
2103
+ }
2104
+ ),
2105
+ action
2106
+ ]
2107
+ }
2108
+ ),
2109
+ children,
2110
+ error ? /* @__PURE__ */ jsx22(
2111
+ Field.ErrorText,
2112
+ {
2113
+ className: cn(
2114
+ "polli:text-xs polli:font-medium polli:leading-5 polli:text-intent-danger-text",
2115
+ errorClassName
2116
+ ),
2117
+ children: error
2118
+ }
2119
+ ) : helper ? /* @__PURE__ */ jsx22(
2120
+ Field.HelperText,
2121
+ {
2122
+ className: cn(
2123
+ "polli:text-xs polli:font-normal polli:leading-normal polli:text-theme-text-muted",
2124
+ helperClassName
2125
+ ),
2126
+ children: helper
2127
+ }
2128
+ ) : null
2129
+ ]
1387
2130
  }
1388
2131
  );
1389
2132
  }
2133
+
2134
+ // src/compositions/FileUpload.tsx
2135
+ import { useEffect as useEffect7, useId } from "react";
2136
+ import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
1390
2137
  function FileUpload({
1391
2138
  value,
1392
2139
  onChange,
@@ -1394,16 +2141,19 @@ function FileUpload({
1394
2141
  maxFiles = 4,
1395
2142
  maxSizeBytes = 10 * 1024 * 1024,
1396
2143
  accept = "image/*",
1397
- icon = /* @__PURE__ */ jsx19(ImageIcon, { className: "polli:h-6 polli:w-6" }),
1398
- label = /* @__PURE__ */ jsxs14(Fragment5, { children: [
1399
- "Drag images here or ",
1400
- /* @__PURE__ */ jsx19("span", { className: "polli:underline", children: "browse" })
2144
+ tileModality,
2145
+ icon,
2146
+ inputLabel,
2147
+ label = /* @__PURE__ */ jsxs18(Fragment8, { children: [
2148
+ "Drag here or ",
2149
+ /* @__PURE__ */ jsx23("span", { className: "polli:underline", children: "browse" })
1401
2150
  ] }),
1402
- previewIcon = /* @__PURE__ */ jsx19(ImageIcon, { className: "polli:h-5 polli:w-5" }),
2151
+ previewIcon,
1403
2152
  disabled = false,
1404
- className
2153
+ className,
2154
+ actionsOnly = false
1405
2155
  }) {
1406
- useEffect3(() => acquireDocumentFileDropGuard(document), []);
2156
+ useEffect7(() => acquireDocumentFileDropGuard(document), []);
1407
2157
  function addFiles(incoming) {
1408
2158
  if (disabled || incoming.length === 0) return;
1409
2159
  const { accepted, rejected } = partitionFiles(incoming, value, {
@@ -1420,7 +2170,8 @@ function FileUpload({
1420
2170
  addFiles(Array.from(event.target.files ?? []));
1421
2171
  event.target.value = "";
1422
2172
  }
1423
- return /* @__PURE__ */ jsx19(
2173
+ if (actionsOnly && !canAdd && value.length) return null;
2174
+ return /* @__PURE__ */ jsx23(
1424
2175
  "fieldset",
1425
2176
  {
1426
2177
  disabled,
@@ -1434,51 +2185,40 @@ function FileUpload({
1434
2185
  event.preventDefault();
1435
2186
  addFiles(Array.from(event.dataTransfer.files));
1436
2187
  },
1437
- children: /* @__PURE__ */ jsxs14("ul", { className: "polli:m-0 polli:flex polli:flex-wrap polli:gap-3 polli:p-0", children: [
1438
- value.map((file, index) => /* @__PURE__ */ jsxs14(
2188
+ children: /* @__PURE__ */ jsxs18("ul", { className: "polli:m-0 polli:flex polli:flex-wrap polli:gap-3 polli:p-0", children: [
2189
+ !actionsOnly && value.map((file, index) => /* @__PURE__ */ jsx23(
1439
2190
  "li",
1440
2191
  {
1441
- title: file.name,
1442
- className: "polli:relative polli:list-none",
1443
- children: [
1444
- /* @__PURE__ */ jsx19(
1445
- FilePreview,
1446
- {
1447
- file,
1448
- placeholderIcon: previewIcon
1449
- }
1450
- ),
1451
- /* @__PURE__ */ jsx19("span", { className: "polli:sr-only", children: file.name }),
1452
- !disabled && /* @__PURE__ */ jsx19("div", { className: "polli:absolute polli:-top-2 polli:right-1", children: /* @__PURE__ */ jsx19(
1453
- IconButton,
1454
- {
1455
- intent: "danger",
1456
- title: `Remove ${file.name}`,
1457
- onClick: () => onChange(
1458
- value.filter((_, i) => i !== index)
1459
- ),
1460
- children: /* @__PURE__ */ jsx19(XIcon, { className: "polli:h-3 polli:w-3" })
1461
- }
1462
- ) })
1463
- ]
2192
+ className: "polli:list-none",
2193
+ children: /* @__PURE__ */ jsx23(
2194
+ UploadedFileTile,
2195
+ {
2196
+ file,
2197
+ modality: tileModality,
2198
+ previewIcon,
2199
+ disabled,
2200
+ onRemove: () => onChange(
2201
+ value.filter((_, n) => n !== index)
2202
+ )
2203
+ }
2204
+ )
1464
2205
  },
1465
2206
  `${file.name}-${index}`
1466
2207
  )),
1467
- (canAdd || value.length === 0) && /* @__PURE__ */ jsx19("li", { className: "polli:list-none", children: /* @__PURE__ */ jsxs14(
2208
+ (canAdd || value.length === 0) && /* @__PURE__ */ jsx23("li", { className: "polli:list-none", children: /* @__PURE__ */ jsxs18(
1468
2209
  "label",
1469
2210
  {
1470
2211
  htmlFor: inputId,
1471
- className: cn(
1472
- "polli-control polli:flex polli:h-20 polli:w-20 polli:flex-col polli:items-center polli:justify-center polli:gap-2 polli:rounded-xl polli:border polli:border-dashed polli:border-theme-border polli:bg-theme-bg-pale polli:p-2 polli:text-center polli:text-xs polli:text-theme-text-soft polli:transition-colors",
1473
- canAdd ? "polli:cursor-pointer polli:hover:bg-theme-fill-wash polli:hover:text-theme-text-strong" : "polli:cursor-not-allowed"
1474
- ),
2212
+ className: mediaActionTileClass(!canAdd),
2213
+ ...mediaTileTint(tileModality),
1475
2214
  children: [
1476
- value.length ? /* @__PURE__ */ jsx19(PlusIcon, { className: "polli:h-6 polli:w-6" }) : icon,
1477
- /* @__PURE__ */ jsx19("span", { children: value.length ? "Add files" : label }),
1478
- /* @__PURE__ */ jsx19(
2215
+ icon ?? (tileModality ? /* @__PURE__ */ jsx23(MediaFileIcon, { modality: tileModality }) : /* @__PURE__ */ jsx23(ImageIcon, {})),
2216
+ /* @__PURE__ */ jsx23("span", { children: label }),
2217
+ /* @__PURE__ */ jsx23(
1479
2218
  "input",
1480
2219
  {
1481
2220
  id: inputId,
2221
+ "aria-label": inputLabel,
1482
2222
  type: "file",
1483
2223
  accept,
1484
2224
  multiple: maxFiles > 1,
@@ -1496,7 +2236,7 @@ function FileUpload({
1496
2236
  }
1497
2237
 
1498
2238
  // src/compositions/InfoTip.tsx
1499
- import { jsx as jsx20 } from "react/jsx-runtime";
2239
+ import { jsx as jsx24 } from "react/jsx-runtime";
1500
2240
  var InfoTip = ({
1501
2241
  text,
1502
2242
  content,
@@ -1505,7 +2245,7 @@ var InfoTip = ({
1505
2245
  }) => (
1506
2246
  // displayContents drops the inline wrapper so the badge centres on its row
1507
2247
  // instead of sitting on the text baseline.
1508
- /* @__PURE__ */ jsx20(
2248
+ /* @__PURE__ */ jsx24(
1509
2249
  Tooltip,
1510
2250
  {
1511
2251
  content: content ?? text,
@@ -1513,13 +2253,13 @@ var InfoTip = ({
1513
2253
  className: "polli:ml-1",
1514
2254
  displayContents: true,
1515
2255
  tapEnabled,
1516
- children: /* @__PURE__ */ jsx20("span", { className: "polli:inline-flex polli:h-4 polli:w-4 polli:items-center polli:justify-center polli:rounded-full polli:bg-surface-menu polli:font-bold polli:text-[10px] polli:leading-none polli:text-theme-text-muted polli:transition-colors polli:hover:text-theme-text-strong", children: "i" })
2256
+ children: /* @__PURE__ */ jsx24("span", { className: "polli:inline-flex polli:h-4 polli:w-4 polli:items-center polli:justify-center polli:rounded-full polli:bg-surface-menu polli:font-bold polli:text-[10px] polli:leading-none polli:text-theme-text-muted polli:transition-colors polli:hover:text-theme-text-strong", children: "i" })
1517
2257
  }
1518
2258
  )
1519
2259
  );
1520
2260
 
1521
2261
  // src/compositions/KeyChip.tsx
1522
- import { jsx as jsx21, jsxs as jsxs15 } from "react/jsx-runtime";
2262
+ import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
1523
2263
  var chipClassName = "polli:gap-1.5 polli:font-mono polli:font-normal polli:[&>svg]:size-3.5 polli:[&>svg]:shrink-0";
1524
2264
  function KeyChip({
1525
2265
  prefix,
@@ -1529,16 +2269,16 @@ function KeyChip({
1529
2269
  }) {
1530
2270
  const text = `${prefix}\u2026`;
1531
2271
  if (!value) {
1532
- return /* @__PURE__ */ jsx21(Chip, { intent: "neutral", className: cn(chipClassName, className), children: text });
2272
+ return /* @__PURE__ */ jsx25(Chip, { intent: "neutral", className: cn(chipClassName, className), children: text });
1533
2273
  }
1534
- return /* @__PURE__ */ jsx21(
2274
+ return /* @__PURE__ */ jsx25(
1535
2275
  CopyButton,
1536
2276
  {
1537
2277
  value,
1538
2278
  "aria-label": label,
1539
2279
  className: "polli:inline-flex polli:cursor-pointer polli:rounded-lg",
1540
- children: (copied) => /* @__PURE__ */ jsxs15(Chip, { intent: "neutral", className: cn(chipClassName, className), children: [
1541
- /* @__PURE__ */ jsx21(CopyStateIcon, { copied, "aria-hidden": "true" }),
2280
+ children: (copied) => /* @__PURE__ */ jsxs19(Chip, { intent: "neutral", className: cn(chipClassName, className), children: [
2281
+ /* @__PURE__ */ jsx25(CopyStateIcon, { copied, "aria-hidden": "true" }),
1542
2282
  text
1543
2283
  ] })
1544
2284
  }
@@ -1546,7 +2286,7 @@ function KeyChip({
1546
2286
  }
1547
2287
 
1548
2288
  // src/compositions/LinkCard.tsx
1549
- import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
2289
+ import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
1550
2290
  function LinkCard({
1551
2291
  as,
1552
2292
  external,
@@ -1560,7 +2300,7 @@ function LinkCard({
1560
2300
  const Component = as || "a";
1561
2301
  const isExternal = external ?? isExternalHref(linkProps.href);
1562
2302
  const style = linkProps.style;
1563
- return /* @__PURE__ */ jsxs16(
2303
+ return /* @__PURE__ */ jsxs20(
1564
2304
  Surface,
1565
2305
  {
1566
2306
  as: Component,
@@ -1581,7 +2321,7 @@ function LinkCard({
1581
2321
  surfaceClassName
1582
2322
  ),
1583
2323
  children: [
1584
- showIcon && isExternal && /* @__PURE__ */ jsx22(
2324
+ showIcon && isExternal && /* @__PURE__ */ jsx26(
1585
2325
  ExternalLinkIcon,
1586
2326
  {
1587
2327
  "aria-hidden": "true",
@@ -1595,7 +2335,7 @@ function LinkCard({
1595
2335
  }
1596
2336
 
1597
2337
  // src/compositions/MediaPlaceholder.tsx
1598
- import { jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
2338
+ import { jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
1599
2339
  var MediaPlaceholder = ({
1600
2340
  icon,
1601
2341
  label,
@@ -1606,7 +2346,7 @@ var MediaPlaceholder = ({
1606
2346
  className,
1607
2347
  style,
1608
2348
  ...rest
1609
- }) => /* @__PURE__ */ jsxs17(
2349
+ }) => /* @__PURE__ */ jsxs21(
1610
2350
  "div",
1611
2351
  {
1612
2352
  ...rest,
@@ -1621,7 +2361,7 @@ var MediaPlaceholder = ({
1621
2361
  className
1622
2362
  ),
1623
2363
  children: [
1624
- icon && /* @__PURE__ */ jsx23(
2364
+ icon && /* @__PURE__ */ jsx27(
1625
2365
  "div",
1626
2366
  {
1627
2367
  className: cn(
@@ -1632,9 +2372,9 @@ var MediaPlaceholder = ({
1632
2372
  children: icon
1633
2373
  }
1634
2374
  ),
1635
- (label || detail) && /* @__PURE__ */ jsxs17("div", { className: "polli:max-w-sm", children: [
1636
- label && /* @__PURE__ */ jsx23(Text, { as: "p", size: "sm", tone: "strong", weight: "semibold", children: label }),
1637
- detail && /* @__PURE__ */ jsx23(Text, { as: "p", size: "sm", tone: "soft", className: "polli:mt-1", children: detail })
2375
+ (label || detail) && /* @__PURE__ */ jsxs21("div", { className: "polli:max-w-sm", children: [
2376
+ label && /* @__PURE__ */ jsx27(Text, { as: "p", size: "sm", tone: "strong", weight: "semibold", children: label }),
2377
+ detail && /* @__PURE__ */ jsx27(Text, { as: "p", size: "sm", tone: "soft", className: "polli:mt-1", children: detail })
1638
2378
  ] }),
1639
2379
  children
1640
2380
  ]
@@ -1642,7 +2382,7 @@ var MediaPlaceholder = ({
1642
2382
  );
1643
2383
 
1644
2384
  // src/compositions/MultiSelect.tsx
1645
- import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
2385
+ import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
1646
2386
  var TRIGGER_BASE = "polli-control polli:inline-flex polli:min-h-8 polli:min-w-[140px] polli:items-center polli:gap-2 polli:rounded-full polli:px-3 polli:py-1.5 polli:text-xs polli:font-medium polli:transition-all polli:duration-200";
1647
2387
  var ROW_BASE = "polli-control polli:flex polli:w-full polli:items-center polli:gap-3 polli:px-3 polli:py-2 polli:text-left polli:text-xs polli:transition-colors";
1648
2388
  var CHECK_BASE = "polli:flex polli:h-4 polli:w-4 polli:flex-shrink-0 polli:items-center polli:justify-center polli:rounded polli:bg-theme-text-strong/10 polli:text-xs";
@@ -1669,9 +2409,9 @@ var MultiSelect = ({
1669
2409
  };
1670
2410
  const selectAll = () => onChange([]);
1671
2411
  const displayText = disabled ? disabledText : isAllSelected ? placeholder : selected.length === 1 ? options.find((option) => option.value === selected[0])?.label ?? "1 selected" : `${selected.length} selected`;
1672
- const labelNode = label ? /* @__PURE__ */ jsx24("span", { className: "polli:text-xs polli:font-medium polli:text-theme-text-soft", children: label }) : null;
2412
+ const labelNode = label ? /* @__PURE__ */ jsx28("span", { className: "polli:text-xs polli:font-medium polli:text-theme-text-soft", children: label }) : null;
1673
2413
  if (disabled) {
1674
- return /* @__PURE__ */ jsxs18(
2414
+ return /* @__PURE__ */ jsxs22(
1675
2415
  "div",
1676
2416
  {
1677
2417
  className: cn(
@@ -1680,7 +2420,7 @@ var MultiSelect = ({
1680
2420
  ),
1681
2421
  children: [
1682
2422
  labelNode,
1683
- /* @__PURE__ */ jsx24(
2423
+ /* @__PURE__ */ jsx28(
1684
2424
  Tooltip,
1685
2425
  {
1686
2426
  triggerAs: "span",
@@ -1690,7 +2430,7 @@ var MultiSelect = ({
1690
2430
  "polli:inline-flex polli:cursor-not-allowed",
1691
2431
  fullWidth && "polli:min-w-0 polli:flex-1"
1692
2432
  ),
1693
- children: /* @__PURE__ */ jsxs18(
2433
+ children: /* @__PURE__ */ jsxs22(
1694
2434
  "button",
1695
2435
  {
1696
2436
  type: "button",
@@ -1702,8 +2442,8 @@ var MultiSelect = ({
1702
2442
  "polli:cursor-not-allowed polli:bg-theme-fill polli:text-theme-on-fill polli:opacity-50"
1703
2443
  ),
1704
2444
  children: [
1705
- /* @__PURE__ */ jsx24("span", { className: "polli:flex-1 polli:truncate polli:text-left", children: displayText }),
1706
- /* @__PURE__ */ jsx24(
2445
+ /* @__PURE__ */ jsx28("span", { className: "polli:flex-1 polli:truncate polli:text-left", children: displayText }),
2446
+ /* @__PURE__ */ jsx28(
1707
2447
  ChevronIcon,
1708
2448
  {
1709
2449
  expanded: false,
@@ -1719,7 +2459,7 @@ var MultiSelect = ({
1719
2459
  }
1720
2460
  );
1721
2461
  }
1722
- return /* @__PURE__ */ jsxs18(
2462
+ return /* @__PURE__ */ jsxs22(
1723
2463
  "div",
1724
2464
  {
1725
2465
  className: cn(
@@ -1728,12 +2468,12 @@ var MultiSelect = ({
1728
2468
  ),
1729
2469
  children: [
1730
2470
  labelNode,
1731
- /* @__PURE__ */ jsx24(
2471
+ /* @__PURE__ */ jsx28(
1732
2472
  Dropdown,
1733
2473
  {
1734
2474
  align,
1735
2475
  className: "polli:w-[min(20rem,calc(100vw-2rem))]",
1736
- trigger: (open) => /* @__PURE__ */ jsxs18(
2476
+ trigger: (open) => /* @__PURE__ */ jsxs22(
1737
2477
  "button",
1738
2478
  {
1739
2479
  type: "button",
@@ -1744,8 +2484,8 @@ var MultiSelect = ({
1744
2484
  open ? "polli:bg-theme-fill-hover polli:text-theme-on-fill" : "polli:bg-theme-fill polli:text-theme-on-fill polli:hover:bg-theme-fill-hover"
1745
2485
  ),
1746
2486
  children: [
1747
- /* @__PURE__ */ jsx24("span", { className: "polli:flex-1 polli:truncate polli:text-left", children: displayText }),
1748
- /* @__PURE__ */ jsx24(
2487
+ /* @__PURE__ */ jsx28("span", { className: "polli:flex-1 polli:truncate polli:text-left", children: displayText }),
2488
+ /* @__PURE__ */ jsx28(
1749
2489
  ChevronIcon,
1750
2490
  {
1751
2491
  expanded: open,
@@ -1755,8 +2495,8 @@ var MultiSelect = ({
1755
2495
  ]
1756
2496
  }
1757
2497
  ),
1758
- children: /* @__PURE__ */ jsxs18(ScrollArea, { className: "polli:max-h-64", children: [
1759
- /* @__PURE__ */ jsxs18(
2498
+ children: /* @__PURE__ */ jsxs22(ScrollArea, { className: "polli:max-h-64", children: [
2499
+ /* @__PURE__ */ jsxs22(
1760
2500
  "button",
1761
2501
  {
1762
2502
  type: "button",
@@ -1767,7 +2507,7 @@ var MultiSelect = ({
1767
2507
  isAllSelected ? "polli:bg-theme-fill polli:font-medium polli:text-theme-on-fill" : "polli:text-theme-text-base polli:hover:bg-theme-fill-wash"
1768
2508
  ),
1769
2509
  children: [
1770
- /* @__PURE__ */ jsx24(
2510
+ /* @__PURE__ */ jsx28(
1771
2511
  "span",
1772
2512
  {
1773
2513
  "aria-hidden": "true",
@@ -1784,7 +2524,7 @@ var MultiSelect = ({
1784
2524
  ),
1785
2525
  options.map((opt) => {
1786
2526
  const isChecked = selected.includes(opt.value);
1787
- return /* @__PURE__ */ jsxs18(
2527
+ return /* @__PURE__ */ jsxs22(
1788
2528
  "button",
1789
2529
  {
1790
2530
  type: "button",
@@ -1795,7 +2535,7 @@ var MultiSelect = ({
1795
2535
  isChecked ? "polli:bg-theme-fill polli:text-theme-on-fill" : "polli:text-theme-text-base polli:hover:bg-theme-fill-wash"
1796
2536
  ),
1797
2537
  children: [
1798
- /* @__PURE__ */ jsx24(
2538
+ /* @__PURE__ */ jsx28(
1799
2539
  "span",
1800
2540
  {
1801
2541
  "aria-hidden": "true",
@@ -1806,7 +2546,7 @@ var MultiSelect = ({
1806
2546
  children: isChecked && "\u2713"
1807
2547
  }
1808
2548
  ),
1809
- /* @__PURE__ */ jsx24("span", { className: "polli:min-w-0 polli:[overflow-wrap:anywhere]", children: opt.label })
2549
+ /* @__PURE__ */ jsx28("span", { className: "polli:min-w-0 polli:[overflow-wrap:anywhere]", children: opt.label })
1810
2550
  ]
1811
2551
  },
1812
2552
  opt.value
@@ -1821,7 +2561,7 @@ var MultiSelect = ({
1821
2561
  };
1822
2562
 
1823
2563
  // src/compositions/NavItem.tsx
1824
- import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
2564
+ import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
1825
2565
  var base = "polli-control polli:flex polli:items-center polli:gap-2 polli:rounded-full polli:px-3 polli:py-2 polli:text-left polli:text-sm polli:font-medium polli:whitespace-nowrap polli:transition-colors";
1826
2566
  var activeClasses = "polli:bg-theme-fill polli:text-theme-on-fill";
1827
2567
  var inactiveClasses = "polli:text-ink-800 polli:hover:bg-theme-fill-wash";
@@ -1834,7 +2574,7 @@ function NavItem({
1834
2574
  ...rest
1835
2575
  }) {
1836
2576
  const Component = as || "button";
1837
- return /* @__PURE__ */ jsxs19(
2577
+ return /* @__PURE__ */ jsxs23(
1838
2578
  Component,
1839
2579
  {
1840
2580
  "aria-current": active ? "page" : void 0,
@@ -1845,7 +2585,7 @@ function NavItem({
1845
2585
  ),
1846
2586
  ...rest,
1847
2587
  children: [
1848
- Icon ? /* @__PURE__ */ jsx25(Icon, { className: "polli:h-4 polli:w-4 polli:shrink-0" }) : null,
2588
+ Icon ? /* @__PURE__ */ jsx29(Icon, { className: "polli:h-4 polli:w-4 polli:shrink-0" }) : null,
1849
2589
  children
1850
2590
  ]
1851
2591
  }
@@ -1854,12 +2594,12 @@ function NavItem({
1854
2594
 
1855
2595
  // src/compositions/OutageNotice.tsx
1856
2596
  import {
1857
- useEffect as useEffect4,
2597
+ useEffect as useEffect8,
1858
2598
  useLayoutEffect,
1859
- useRef as useRef3,
2599
+ useRef as useRef6,
1860
2600
  useSyncExternalStore
1861
2601
  } from "react";
1862
- import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
2602
+ import { Fragment as Fragment9, jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
1863
2603
  var OUTAGE_MESSAGE = "Pollinations is having a temporary outage. Some services are down for now. Your account, keys and balance are safe, and nothing is lost.";
1864
2604
  function subscribeOnline(listener) {
1865
2605
  window.addEventListener("online", listener);
@@ -1878,7 +2618,7 @@ function useOnline() {
1878
2618
  }
1879
2619
  var notices = /* @__PURE__ */ new Set();
1880
2620
  var listeners = /* @__PURE__ */ new Set();
1881
- var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect4 : useLayoutEffect;
2621
+ var useIsomorphicLayoutEffect = typeof window === "undefined" ? useEffect8 : useLayoutEffect;
1882
2622
  function subscribeNotices(listener) {
1883
2623
  listeners.add(listener);
1884
2624
  return () => listeners.delete(listener);
@@ -1898,7 +2638,7 @@ var OutageNotice = ({
1898
2638
  className
1899
2639
  }) => {
1900
2640
  const online = useOnline();
1901
- const ref = useRef3(null);
2641
+ const ref = useRef6(null);
1902
2642
  useIsomorphicLayoutEffect(() => {
1903
2643
  const notice = ref.current;
1904
2644
  if (!notice) return;
@@ -1922,17 +2662,17 @@ var OutageNotice = ({
1922
2662
  } else {
1923
2663
  message = `${OUTAGE_MESSAGE}${retrying ? " Retrying automatically." : ""}`;
1924
2664
  }
1925
- return /* @__PURE__ */ jsx26("div", { ref, className, children: /* @__PURE__ */ jsxs20(Alert, { intent: "advisory", children: [
2665
+ return /* @__PURE__ */ jsx30("div", { ref, className, children: /* @__PURE__ */ jsxs24(Alert, { intent: "advisory", children: [
1926
2666
  message,
1927
- isTop && online && statusUrl && /* @__PURE__ */ jsxs20(Fragment6, { children: [
2667
+ isTop && online && statusUrl && /* @__PURE__ */ jsxs24(Fragment9, { children: [
1928
2668
  " ",
1929
- /* @__PURE__ */ jsx26(InlineLink, { href: statusUrl, children: "Status page" })
2669
+ /* @__PURE__ */ jsx30(InlineLink, { href: statusUrl, children: "Status page" })
1930
2670
  ] })
1931
2671
  ] }) });
1932
2672
  };
1933
2673
 
1934
2674
  // src/compositions/PeriodPicker.tsx
1935
- import { useEffect as useEffect5, useMemo as useMemo2, useRef as useRef4, useState as useState3 } from "react";
2675
+ import { useEffect as useEffect9, useMemo as useMemo2, useRef as useRef7, useState as useState6 } from "react";
1936
2676
 
1937
2677
  // src/lib/period.ts
1938
2678
  var MS_PER_DAY = 864e5;
@@ -2040,7 +2780,7 @@ function isPeriodSelectable(selection, minDate = /* @__PURE__ */ new Date(0), ma
2040
2780
  }
2041
2781
 
2042
2782
  // src/compositions/PeriodPicker.tsx
2043
- import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
2783
+ import { Fragment as Fragment10, jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
2044
2784
  var WEEKDAY_LABELS = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
2045
2785
  var MONTH_LABELS = [
2046
2786
  "Jan",
@@ -2130,12 +2870,12 @@ var PeriodPicker = ({
2130
2870
  trigger,
2131
2871
  header
2132
2872
  }) => {
2133
- const [open, setOpen] = useState3(false);
2134
- const [viewDate, setViewDate] = useState3(() => periodDate(value));
2135
- const [anchorDate, setAnchorDate] = useState3(() => periodDate(value));
2136
- const emittedSelectionRef = useRef4(null);
2873
+ const [open, setOpen] = useState6(false);
2874
+ const [viewDate, setViewDate] = useState6(() => periodDate(value));
2875
+ const [anchorDate, setAnchorDate] = useState6(() => periodDate(value));
2876
+ const emittedSelectionRef = useRef7(null);
2137
2877
  const { granularity, period } = value;
2138
- useEffect5(() => {
2878
+ useEffect9(() => {
2139
2879
  const currentSelectionKey = selectionKey({ granularity, period });
2140
2880
  if (emittedSelectionRef.current === currentSelectionKey) {
2141
2881
  emittedSelectionRef.current = null;
@@ -2169,13 +2909,13 @@ var PeriodPicker = ({
2169
2909
  setOpen(false);
2170
2910
  };
2171
2911
  const viewLabel = value.granularity === "month" ? String(viewDate.getUTCFullYear()) : formatMonthYear(viewDate, "long");
2172
- return /* @__PURE__ */ jsxs21(
2912
+ return /* @__PURE__ */ jsxs25(
2173
2913
  "div",
2174
2914
  {
2175
2915
  className: trigger ? "polli:contents" : "polli:flex polli:w-full polli:flex-wrap polli:items-center polli:gap-2",
2176
2916
  children: [
2177
- !trigger && /* @__PURE__ */ jsx27("div", { className: "polli:flex polli:flex-wrap polli:gap-1.5", children: ["day", "week", "month"].map(
2178
- (granularity2) => /* @__PURE__ */ jsx27(
2917
+ !trigger && /* @__PURE__ */ jsx31("div", { className: "polli:flex polli:flex-wrap polli:gap-1.5", children: ["day", "week", "month"].map(
2918
+ (granularity2) => /* @__PURE__ */ jsx31(
2179
2919
  TabButton,
2180
2920
  {
2181
2921
  active: value.granularity === granularity2,
@@ -2185,13 +2925,13 @@ var PeriodPicker = ({
2185
2925
  granularity2
2186
2926
  )
2187
2927
  ) }),
2188
- /* @__PURE__ */ jsxs21(
2928
+ /* @__PURE__ */ jsxs25(
2189
2929
  Dropdown,
2190
2930
  {
2191
2931
  open,
2192
2932
  onOpenChange: setOpen,
2193
2933
  className: "polli:w-[320px] polli:max-w-[calc(100vw-2rem)] polli:rounded-xl polli:border polli:border-divider polli:bg-surface-opaque polli:p-3.5 polli:shadow-lg",
2194
- trigger: trigger ?? ((isOpen) => /* @__PURE__ */ jsxs21(
2934
+ trigger: trigger ?? ((isOpen) => /* @__PURE__ */ jsxs25(
2195
2935
  "button",
2196
2936
  {
2197
2937
  type: "button",
@@ -2203,15 +2943,15 @@ var PeriodPicker = ({
2203
2943
  isOpen && "polli:bg-theme-fill-hover"
2204
2944
  ),
2205
2945
  children: [
2206
- /* @__PURE__ */ jsx27("span", { className: "polli:truncate", children: summaryLabel }),
2207
- /* @__PURE__ */ jsx27(ChevronIcon, { expanded: isOpen })
2946
+ /* @__PURE__ */ jsx31("span", { className: "polli:truncate", children: summaryLabel }),
2947
+ /* @__PURE__ */ jsx31(ChevronIcon, { expanded: isOpen })
2208
2948
  ]
2209
2949
  }
2210
2950
  )),
2211
2951
  children: [
2212
2952
  header,
2213
- /* @__PURE__ */ jsxs21("div", { className: "polli:mb-3 polli:flex polli:items-center polli:justify-between", children: [
2214
- /* @__PURE__ */ jsx27(
2953
+ /* @__PURE__ */ jsxs25("div", { className: "polli:mb-3 polli:flex polli:items-center polli:justify-between", children: [
2954
+ /* @__PURE__ */ jsx31(
2215
2955
  "button",
2216
2956
  {
2217
2957
  type: "button",
@@ -2225,8 +2965,8 @@ var PeriodPicker = ({
2225
2965
  children: "<"
2226
2966
  }
2227
2967
  ),
2228
- /* @__PURE__ */ jsx27("div", { className: "polli:text-base polli:font-bold polli:text-theme-text-base", children: viewLabel }),
2229
- /* @__PURE__ */ jsx27(
2968
+ /* @__PURE__ */ jsx31("div", { className: "polli:text-base polli:font-bold polli:text-theme-text-base", children: viewLabel }),
2969
+ /* @__PURE__ */ jsx31(
2230
2970
  "button",
2231
2971
  {
2232
2972
  type: "button",
@@ -2241,7 +2981,7 @@ var PeriodPicker = ({
2241
2981
  }
2242
2982
  )
2243
2983
  ] }),
2244
- value.granularity === "month" ? /* @__PURE__ */ jsx27("div", { className: "polli:grid polli:grid-cols-3 polli:gap-1.5", children: MONTH_LABELS.map((label, monthIndex) => {
2984
+ value.granularity === "month" ? /* @__PURE__ */ jsx31("div", { className: "polli:grid polli:grid-cols-3 polli:gap-1.5", children: MONTH_LABELS.map((label, monthIndex) => {
2245
2985
  const date = new Date(
2246
2986
  Date.UTC(
2247
2987
  viewDate.getUTCFullYear(),
@@ -2260,7 +3000,7 @@ var PeriodPicker = ({
2260
3000
  year: "numeric"
2261
3001
  });
2262
3002
  const selected = date.getUTCFullYear() === selectedWindow.start.getUTCFullYear() && date.getUTCMonth() === selectedWindow.start.getUTCMonth();
2263
- return /* @__PURE__ */ jsx27(
3003
+ return /* @__PURE__ */ jsx31(
2264
3004
  "button",
2265
3005
  {
2266
3006
  type: "button",
@@ -2277,9 +3017,9 @@ var PeriodPicker = ({
2277
3017
  },
2278
3018
  label
2279
3019
  );
2280
- }) }) : /* @__PURE__ */ jsxs21(Fragment7, { children: [
2281
- /* @__PURE__ */ jsx27("div", { className: "polli:mb-1 polli:grid polli:grid-cols-7 polli:gap-1 polli:text-center polli:text-xs polli:font-bold polli:uppercase polli:text-theme-text-muted", children: WEEKDAY_LABELS.map((label) => /* @__PURE__ */ jsx27("div", { children: label }, label)) }),
2282
- /* @__PURE__ */ jsx27("div", { className: "polli:grid polli:grid-cols-7 polli:gap-1", children: dates.map((date) => {
3020
+ }) }) : /* @__PURE__ */ jsxs25(Fragment10, { children: [
3021
+ /* @__PURE__ */ jsx31("div", { className: "polli:mb-1 polli:grid polli:grid-cols-7 polli:gap-1 polli:text-center polli:text-xs polli:font-bold polli:uppercase polli:text-theme-text-muted", children: WEEKDAY_LABELS.map((label) => /* @__PURE__ */ jsx31("div", { children: label }, label)) }),
3022
+ /* @__PURE__ */ jsx31("div", { className: "polli:grid polli:grid-cols-7 polli:gap-1", children: dates.map((date) => {
2283
3023
  const inCurrentMonth = date.getUTCMonth() === viewDate.getUTCMonth();
2284
3024
  const selectable = isPeriodSelectable(
2285
3025
  periodFromDate(value.granularity, date),
@@ -2297,7 +3037,7 @@ var PeriodPicker = ({
2297
3037
  }
2298
3038
  )}`;
2299
3039
  const selected = value.granularity === "day" ? sameUtcDay(date, selectedWindow.start) : date >= selectedWindow.start && date < selectedWindow.end;
2300
- return /* @__PURE__ */ jsx27(
3040
+ return /* @__PURE__ */ jsx31(
2301
3041
  "button",
2302
3042
  {
2303
3043
  type: "button",
@@ -2330,7 +3070,7 @@ var PeriodPicker = ({
2330
3070
  };
2331
3071
 
2332
3072
  // src/compositions/Section.tsx
2333
- import { Fragment as Fragment8, jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
3073
+ import { Fragment as Fragment11, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
2334
3074
  var Section = ({
2335
3075
  title,
2336
3076
  id,
@@ -2343,13 +3083,13 @@ var Section = ({
2343
3083
  children,
2344
3084
  className
2345
3085
  }) => {
2346
- const body = /* @__PURE__ */ jsxs22(Fragment8, { children: [
2347
- intro && /* @__PURE__ */ jsx28(Text, { as: "div", className: "polli:max-w-2xl", children: intro }),
3086
+ const body = /* @__PURE__ */ jsxs26(Fragment11, { children: [
3087
+ intro && /* @__PURE__ */ jsx32(Text, { as: "div", className: "polli:max-w-2xl", children: intro }),
2348
3088
  children
2349
3089
  ] });
2350
- const content = /* @__PURE__ */ jsxs22(Fragment8, { children: [
2351
- /* @__PURE__ */ jsxs22("header", { className: "polli:flex polli:flex-wrap polli:items-center polli:justify-between polli:gap-3", children: [
2352
- /* @__PURE__ */ jsx28(
3090
+ const content = /* @__PURE__ */ jsxs26(Fragment11, { children: [
3091
+ /* @__PURE__ */ jsxs26("header", { className: "polli:flex polli:flex-wrap polli:items-center polli:justify-between polli:gap-3", children: [
3092
+ /* @__PURE__ */ jsx32(
2353
3093
  Heading,
2354
3094
  {
2355
3095
  as: "h2",
@@ -2358,11 +3098,11 @@ var Section = ({
2358
3098
  children: title
2359
3099
  }
2360
3100
  ),
2361
- action && /* @__PURE__ */ jsx28("div", { className: cn("polli:shrink-0", actionClassName), children: action })
3101
+ action && /* @__PURE__ */ jsx32("div", { className: cn("polli:shrink-0", actionClassName), children: action })
2362
3102
  ] }),
2363
3103
  body
2364
3104
  ] });
2365
- return /* @__PURE__ */ jsx28("section", { id, className: cn("polli:scroll-mt-10", className), children: framed ? /* @__PURE__ */ jsx28(
3105
+ return /* @__PURE__ */ jsx32("section", { id, className: cn("polli:scroll-mt-10", className), children: framed ? /* @__PURE__ */ jsx32(
2366
3106
  Surface,
2367
3107
  {
2368
3108
  variant: "panel",
@@ -2372,11 +3112,11 @@ var Section = ({
2372
3112
  ),
2373
3113
  children: content
2374
3114
  }
2375
- ) : /* @__PURE__ */ jsx28("div", { className: "polli:flex polli:flex-col polli:gap-4", children: content }) });
3115
+ ) : /* @__PURE__ */ jsx32("div", { className: "polli:flex polli:flex-col polli:gap-4", children: content }) });
2376
3116
  };
2377
3117
 
2378
3118
  // src/compositions/SocialCount.tsx
2379
- import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
3119
+ import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
2380
3120
  var networks = {
2381
3121
  discord: {
2382
3122
  Icon: DiscordIcon,
@@ -2397,7 +3137,7 @@ function SocialCount({
2397
3137
  }) {
2398
3138
  const Component = as || "a";
2399
3139
  const { Icon, className: colours } = networks[network];
2400
- return /* @__PURE__ */ jsxs23(
3140
+ return /* @__PURE__ */ jsxs27(
2401
3141
  Component,
2402
3142
  {
2403
3143
  ...rest,
@@ -2407,7 +3147,7 @@ function SocialCount({
2407
3147
  className
2408
3148
  ),
2409
3149
  children: [
2410
- showIcon ? /* @__PURE__ */ jsx29(
3150
+ showIcon ? /* @__PURE__ */ jsx33(
2411
3151
  Icon,
2412
3152
  {
2413
3153
  "aria-hidden": "true",
@@ -2421,7 +3161,7 @@ function SocialCount({
2421
3161
  }
2422
3162
 
2423
3163
  // src/compositions/StatCard.tsx
2424
- import { jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
3164
+ import { jsx as jsx34, jsxs as jsxs28 } from "react/jsx-runtime";
2425
3165
  var valueVariantClasses = {
2426
3166
  stat: "polli:min-h-8 polli:text-2xl polli:font-bold polli:leading-tight polli:tabular-nums polli:text-theme-text-base",
2427
3167
  fact: "polli:text-sm polli:leading-6 polli:text-theme-text-soft",
@@ -2436,9 +3176,9 @@ var StatCard = ({
2436
3176
  labelClassName,
2437
3177
  valueClassName,
2438
3178
  detailClassName
2439
- }) => variant === "display" ? /* @__PURE__ */ jsxs24("div", { className: cn("polli:flex polli:flex-col polli:gap-1", className), children: [
2440
- /* @__PURE__ */ jsx30("div", { className: cn(valueVariantClasses.display, valueClassName), children: value }),
2441
- /* @__PURE__ */ jsx30(
3179
+ }) => variant === "display" ? /* @__PURE__ */ jsxs28("div", { className: cn("polli:flex polli:flex-col polli:gap-1", className), children: [
3180
+ /* @__PURE__ */ jsx34("div", { className: cn(valueVariantClasses.display, valueClassName), children: value }),
3181
+ /* @__PURE__ */ jsx34(
2442
3182
  Text,
2443
3183
  {
2444
3184
  as: "div",
@@ -2451,8 +3191,8 @@ var StatCard = ({
2451
3191
  children: label
2452
3192
  }
2453
3193
  )
2454
- ] }) : /* @__PURE__ */ jsxs24("div", { className: cn("polli:text-sm", className), children: [
2455
- /* @__PURE__ */ jsx30(
3194
+ ] }) : /* @__PURE__ */ jsxs28("div", { className: cn("polli:text-sm", className), children: [
3195
+ /* @__PURE__ */ jsx34(
2456
3196
  Text,
2457
3197
  {
2458
3198
  as: "div",
@@ -2466,7 +3206,7 @@ var StatCard = ({
2466
3206
  children: label
2467
3207
  }
2468
3208
  ),
2469
- /* @__PURE__ */ jsx30(
3209
+ /* @__PURE__ */ jsx34(
2470
3210
  "div",
2471
3211
  {
2472
3212
  className: cn(
@@ -2477,7 +3217,7 @@ var StatCard = ({
2477
3217
  children: value
2478
3218
  }
2479
3219
  ),
2480
- detail && /* @__PURE__ */ jsx30(
3220
+ detail && /* @__PURE__ */ jsx34(
2481
3221
  Text,
2482
3222
  {
2483
3223
  as: "div",
@@ -2490,8 +3230,8 @@ var StatCard = ({
2490
3230
  ] });
2491
3231
 
2492
3232
  // src/compositions/ToolCallDetails.tsx
2493
- import { Fragment as Fragment9, useState as useState4 } from "react";
2494
- import { jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
3233
+ import { Fragment as Fragment12, useState as useState7 } from "react";
3234
+ import { jsx as jsx35, jsxs as jsxs29 } from "react/jsx-runtime";
2495
3235
  function formattedValue(value) {
2496
3236
  if (typeof value === "string") return value;
2497
3237
  try {
@@ -2515,8 +3255,8 @@ function linkedValue(value) {
2515
3255
  if (href.endsWith(")")) extraClosingParens--;
2516
3256
  href = href.slice(0, -1);
2517
3257
  }
2518
- return /* @__PURE__ */ jsxs25(Fragment9, { children: [
2519
- /* @__PURE__ */ jsx31(InlineLink, { href, children: href }),
3258
+ return /* @__PURE__ */ jsxs29(Fragment12, { children: [
3259
+ /* @__PURE__ */ jsx35(InlineLink, { href, children: href }),
2520
3260
  segment.slice(href.length)
2521
3261
  ] }, key);
2522
3262
  });
@@ -2525,7 +3265,7 @@ function ToolValue({
2525
3265
  value,
2526
3266
  error = false
2527
3267
  }) {
2528
- return /* @__PURE__ */ jsx31(
3268
+ return /* @__PURE__ */ jsx35(
2529
3269
  "pre",
2530
3270
  {
2531
3271
  className: cn(
@@ -2546,7 +3286,7 @@ var STATUS_LABELS = {
2546
3286
  denied: "Denied"
2547
3287
  };
2548
3288
  function ToolStatus({ status }) {
2549
- const icon = status === "complete" || status === "approval-responded" ? /* @__PURE__ */ jsx31(CheckIcon, { className: "polli:size-3" }) : status === "error" || status === "denied" ? /* @__PURE__ */ jsx31(XIcon, { className: "polli:size-3" }) : /* @__PURE__ */ jsx31(
3289
+ const icon = status === "complete" || status === "approval-responded" ? /* @__PURE__ */ jsx35(CheckIcon, { className: "polli:size-3" }) : status === "error" || status === "denied" ? /* @__PURE__ */ jsx35(XIcon, { className: "polli:size-3" }) : /* @__PURE__ */ jsx35(
2550
3290
  ClockIcon,
2551
3291
  {
2552
3292
  className: cn(
@@ -2555,7 +3295,7 @@ function ToolStatus({ status }) {
2555
3295
  )
2556
3296
  }
2557
3297
  );
2558
- return /* @__PURE__ */ jsxs25(
3298
+ return /* @__PURE__ */ jsxs29(
2559
3299
  "span",
2560
3300
  {
2561
3301
  "data-status": status,
@@ -2580,8 +3320,8 @@ function ToolCallDetails({
2580
3320
  className
2581
3321
  }) {
2582
3322
  const result = error === void 0 ? output : error;
2583
- const [open, setOpen] = useState4(defaultOpen);
2584
- return /* @__PURE__ */ jsxs25(
3323
+ const [open, setOpen] = useState7(defaultOpen);
3324
+ return /* @__PURE__ */ jsxs29(
2585
3325
  "div",
2586
3326
  {
2587
3327
  "data-tool-status": status,
@@ -2590,7 +3330,7 @@ function ToolCallDetails({
2590
3330
  className
2591
3331
  ),
2592
3332
  children: [
2593
- /* @__PURE__ */ jsxs25(
3333
+ /* @__PURE__ */ jsxs29(
2594
3334
  "button",
2595
3335
  {
2596
3336
  type: "button",
@@ -2598,10 +3338,10 @@ function ToolCallDetails({
2598
3338
  onClick: () => setOpen((current) => !current),
2599
3339
  className: "polli-control polli:flex polli:w-full polli:cursor-pointer polli:items-center polli:gap-2 polli:px-3 polli:py-2.5 polli:text-left polli:hover:bg-theme-fill-wash",
2600
3340
  children: [
2601
- /* @__PURE__ */ jsx31("span", { className: "polli:flex polli:size-7 polli:shrink-0 polli:items-center polli:justify-center polli:rounded-lg polli:bg-theme-bg-active polli:text-theme-text-strong", children: /* @__PURE__ */ jsx31(ToolIcon, { className: "polli:size-3.5" }) }),
2602
- /* @__PURE__ */ jsx31("code", { className: "polli:min-w-0 polli:truncate polli:text-xs polli:font-semibold polli:text-theme-text-strong", children: name }),
2603
- /* @__PURE__ */ jsx31(ToolStatus, { status }),
2604
- /* @__PURE__ */ jsx31(
3341
+ /* @__PURE__ */ jsx35("span", { className: "polli:flex polli:size-7 polli:shrink-0 polli:items-center polli:justify-center polli:rounded-lg polli:bg-theme-bg-active polli:text-theme-text-strong", children: /* @__PURE__ */ jsx35(ToolIcon, { className: "polli:size-3.5" }) }),
3342
+ /* @__PURE__ */ jsx35("code", { className: "polli:min-w-0 polli:truncate polli:text-xs polli:font-semibold polli:text-theme-text-strong", children: name }),
3343
+ /* @__PURE__ */ jsx35(ToolStatus, { status }),
3344
+ /* @__PURE__ */ jsx35(
2605
3345
  ChevronIcon,
2606
3346
  {
2607
3347
  expanded: open,
@@ -2611,14 +3351,14 @@ function ToolCallDetails({
2611
3351
  ]
2612
3352
  }
2613
3353
  ),
2614
- open && /* @__PURE__ */ jsxs25("div", { className: "polli:flex polli:flex-col polli:gap-4 polli:border-theme-border/30 polli:border-t polli:bg-theme-bg-pale/35 polli:px-3 polli:py-3", children: [
2615
- input !== void 0 && /* @__PURE__ */ jsxs25("div", { className: "polli:flex polli:flex-col polli:gap-1", children: [
2616
- /* @__PURE__ */ jsx31(Text, { size: "xs", tone: "muted", weight: "bold", children: "Parameters" }),
2617
- /* @__PURE__ */ jsx31(ToolValue, { value: input })
3354
+ open && /* @__PURE__ */ jsxs29("div", { className: "polli:flex polli:flex-col polli:gap-4 polli:border-theme-border/30 polli:border-t polli:bg-theme-bg-pale/35 polli:px-3 polli:py-3", children: [
3355
+ input !== void 0 && /* @__PURE__ */ jsxs29("div", { className: "polli:flex polli:flex-col polli:gap-1", children: [
3356
+ /* @__PURE__ */ jsx35(Text, { size: "xs", tone: "muted", weight: "bold", children: "Parameters" }),
3357
+ /* @__PURE__ */ jsx35(ToolValue, { value: input })
2618
3358
  ] }),
2619
- result !== void 0 && /* @__PURE__ */ jsxs25("div", { className: "polli:flex polli:flex-col polli:gap-1", children: [
2620
- /* @__PURE__ */ jsx31(Text, { size: "xs", tone: "muted", weight: "bold", children: error === void 0 ? "Result" : "Error" }),
2621
- /* @__PURE__ */ jsx31(
3359
+ result !== void 0 && /* @__PURE__ */ jsxs29("div", { className: "polli:flex polli:flex-col polli:gap-1", children: [
3360
+ /* @__PURE__ */ jsx35(Text, { size: "xs", tone: "muted", weight: "bold", children: error === void 0 ? "Result" : "Error" }),
3361
+ /* @__PURE__ */ jsx35(
2622
3362
  ToolValue,
2623
3363
  {
2624
3364
  value: result,
@@ -2653,9 +3393,9 @@ function formatCount(value) {
2653
3393
  }
2654
3394
 
2655
3395
  // src/lib/use-scroll-lock.ts
2656
- import { useEffect as useEffect6 } from "react";
3396
+ import { useEffect as useEffect10 } from "react";
2657
3397
  function useScrollLock(enabled = true) {
2658
- useEffect6(() => {
3398
+ useEffect10(() => {
2659
3399
  if (!enabled) return;
2660
3400
  const originalBody = document.body.style.overflow;
2661
3401
  const originalHtml = document.documentElement.style.overflow;
@@ -2669,13 +3409,13 @@ function useScrollLock(enabled = true) {
2669
3409
  }
2670
3410
 
2671
3411
  // src/primitives/ButtonGroup.tsx
2672
- import { jsx as jsx32 } from "react/jsx-runtime";
3412
+ import { jsx as jsx36 } from "react/jsx-runtime";
2673
3413
  var ButtonGroup = ({
2674
3414
  className,
2675
3415
  children,
2676
3416
  role = "group",
2677
3417
  ...rest
2678
- }) => /* @__PURE__ */ jsx32(
3418
+ }) => /* @__PURE__ */ jsx36(
2679
3419
  "div",
2680
3420
  {
2681
3421
  ...rest,
@@ -2691,8 +3431,8 @@ var ButtonGroup = ({
2691
3431
  // src/primitives/Drawer.tsx
2692
3432
  import { Dialog as ArkDialog } from "@ark-ui/react/dialog";
2693
3433
  import { Portal } from "@ark-ui/react/portal";
2694
- import { useRef as useRef5 } from "react";
2695
- import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
3434
+ import { useRef as useRef8 } from "react";
3435
+ import { jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
2696
3436
  var Drawer = ({
2697
3437
  open,
2698
3438
  onOpenChange,
@@ -2701,16 +3441,16 @@ var Drawer = ({
2701
3441
  side = "left",
2702
3442
  contentClassName
2703
3443
  }) => {
2704
- const contentRef = useRef5(null);
2705
- return /* @__PURE__ */ jsx33(
3444
+ const contentRef = useRef8(null);
3445
+ return /* @__PURE__ */ jsx37(
2706
3446
  ArkDialog.Root,
2707
3447
  {
2708
3448
  open,
2709
3449
  initialFocusEl: () => contentRef.current,
2710
3450
  onOpenChange: (details) => onOpenChange(details.open),
2711
- children: /* @__PURE__ */ jsxs26(Portal, { children: [
2712
- /* @__PURE__ */ jsx33(ArkDialog.Backdrop, { className: "polli:fixed polli:inset-0 polli:z-[100] polli:bg-[#000]/40 polli:backdrop-blur-sm" }),
2713
- /* @__PURE__ */ jsx33(ArkDialog.Positioner, { className: "polli:pointer-events-none polli:fixed polli:inset-0 polli:z-[110] polli:h-dvh polli:overflow-hidden", children: /* @__PURE__ */ jsx33(
3451
+ children: /* @__PURE__ */ jsxs30(Portal, { children: [
3452
+ /* @__PURE__ */ jsx37(ArkDialog.Backdrop, { className: "polli:fixed polli:inset-0 polli:z-[100] polli:bg-[#000]/40 polli:backdrop-blur-sm" }),
3453
+ /* @__PURE__ */ jsx37(ArkDialog.Positioner, { className: "polli:pointer-events-none polli:fixed polli:inset-0 polli:z-[110] polli:h-dvh polli:overflow-hidden", children: /* @__PURE__ */ jsx37(
2714
3454
  ArkDialog.Content,
2715
3455
  {
2716
3456
  ref: contentRef,
@@ -2729,7 +3469,7 @@ var Drawer = ({
2729
3469
  };
2730
3470
 
2731
3471
  // src/primitives/IconTile.tsx
2732
- import { jsx as jsx34 } from "react/jsx-runtime";
3472
+ import { jsx as jsx38 } from "react/jsx-runtime";
2733
3473
  var toneClasses = {
2734
3474
  neutral: "polli:bg-theme-bg-subtle polli:text-theme-text-strong",
2735
3475
  // The wallet's Paid and Quest Pollen colours, for rows about money.
@@ -2742,7 +3482,7 @@ function IconTile({
2742
3482
  tone = "neutral",
2743
3483
  color
2744
3484
  }) {
2745
- return /* @__PURE__ */ jsx34(
3485
+ return /* @__PURE__ */ jsx38(
2746
3486
  "span",
2747
3487
  {
2748
3488
  className: cn(
@@ -2753,15 +3493,15 @@ function IconTile({
2753
3493
  color,
2754
3494
  backgroundColor: `color-mix(in oklab, ${color} 14%, transparent)`
2755
3495
  } : void 0,
2756
- children: /* @__PURE__ */ jsx34(Icon, { "aria-hidden": "true", className: "polli:size-6" })
3496
+ children: /* @__PURE__ */ jsx38(Icon, { "aria-hidden": "true", className: "polli:size-6" })
2757
3497
  }
2758
3498
  );
2759
3499
  }
2760
3500
 
2761
3501
  // src/primitives/LiveDot.tsx
2762
- import { jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
3502
+ import { jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
2763
3503
  function LiveDot({ className }) {
2764
- return /* @__PURE__ */ jsxs27(
3504
+ return /* @__PURE__ */ jsxs31(
2765
3505
  "span",
2766
3506
  {
2767
3507
  "aria-hidden": "true",
@@ -2770,15 +3510,15 @@ function LiveDot({ className }) {
2770
3510
  className
2771
3511
  ),
2772
3512
  children: [
2773
- /* @__PURE__ */ jsx35("span", { className: "polli:absolute polli:inset-0 polli:animate-ping polli:rounded-full polli:bg-intent-success-bg-bright polli:opacity-60 polli:[animation-duration:2.4s] polli:motion-reduce:hidden" }),
2774
- /* @__PURE__ */ jsx35("span", { className: "polli:relative polli:size-2 polli:rounded-full polli:bg-intent-success-bg-bright" })
3513
+ /* @__PURE__ */ jsx39("span", { className: "polli:absolute polli:inset-0 polli:animate-ping polli:rounded-full polli:bg-intent-success-bg-bright polli:opacity-60 polli:[animation-duration:2.4s] polli:motion-reduce:hidden" }),
3514
+ /* @__PURE__ */ jsx39("span", { className: "polli:relative polli:size-2 polli:rounded-full polli:bg-intent-success-bg-bright" })
2775
3515
  ]
2776
3516
  }
2777
3517
  );
2778
3518
  }
2779
3519
 
2780
3520
  // src/primitives/SegmentedControl.tsx
2781
- import { jsx as jsx36 } from "react/jsx-runtime";
3521
+ import { jsx as jsx40 } from "react/jsx-runtime";
2782
3522
  function SegmentedControl({
2783
3523
  options,
2784
3524
  value,
@@ -2786,7 +3526,7 @@ function SegmentedControl({
2786
3526
  ariaLabel,
2787
3527
  className
2788
3528
  }) {
2789
- return /* @__PURE__ */ jsx36(
3529
+ return /* @__PURE__ */ jsx40(
2790
3530
  "fieldset",
2791
3531
  {
2792
3532
  "aria-label": ariaLabel,
@@ -2796,7 +3536,7 @@ function SegmentedControl({
2796
3536
  ),
2797
3537
  children: options.map((option) => {
2798
3538
  const selected = option.value === value;
2799
- return /* @__PURE__ */ jsx36(
3539
+ return /* @__PURE__ */ jsx40(
2800
3540
  "button",
2801
3541
  {
2802
3542
  type: "button",
@@ -2816,7 +3556,7 @@ function SegmentedControl({
2816
3556
  }
2817
3557
 
2818
3558
  // src/primitives/Skeleton.tsx
2819
- import { jsx as jsx37 } from "react/jsx-runtime";
3559
+ import { jsx as jsx41 } from "react/jsx-runtime";
2820
3560
  var shapeClasses = {
2821
3561
  // Stands in for a card or tile.
2822
3562
  card: "polli:rounded-card",
@@ -2826,7 +3566,7 @@ var shapeClasses = {
2826
3566
  media: ""
2827
3567
  };
2828
3568
  function Skeleton({ shape = "card", className }) {
2829
- return /* @__PURE__ */ jsx37(
3569
+ return /* @__PURE__ */ jsx41(
2830
3570
  "span",
2831
3571
  {
2832
3572
  "aria-hidden": "true",
@@ -2841,7 +3581,7 @@ function Skeleton({ shape = "card", className }) {
2841
3581
 
2842
3582
  // src/primitives/Slider.tsx
2843
3583
  import { forwardRef as forwardRef6 } from "react";
2844
- import { jsx as jsx38 } from "react/jsx-runtime";
3584
+ import { jsx as jsx42 } from "react/jsx-runtime";
2845
3585
  var toNumber = (value) => {
2846
3586
  if (typeof value === "number") return value;
2847
3587
  if (typeof value !== "string" || value.trim() === "") return void 0;
@@ -2881,7 +3621,7 @@ var Slider = forwardRef6(
2881
3621
  ...style,
2882
3622
  ...progressPercent === void 0 ? null : { "--polli-slider-progress": `${progressPercent}%` }
2883
3623
  };
2884
- return /* @__PURE__ */ jsx38(
3624
+ return /* @__PURE__ */ jsx42(
2885
3625
  "input",
2886
3626
  {
2887
3627
  ref,
@@ -2899,14 +3639,14 @@ var Slider = forwardRef6(
2899
3639
  );
2900
3640
 
2901
3641
  // src/primitives/StableLabel.tsx
2902
- import { jsxs as jsxs28 } from "react/jsx-runtime";
3642
+ import { jsxs as jsxs32 } from "react/jsx-runtime";
2903
3643
  function StableLabel({
2904
3644
  text,
2905
3645
  options,
2906
3646
  align = "center",
2907
3647
  prefix
2908
3648
  }) {
2909
- return /* @__PURE__ */ jsxs28(
3649
+ return /* @__PURE__ */ jsxs32(
2910
3650
  "span",
2911
3651
  {
2912
3652
  className: cn(
@@ -2914,7 +3654,7 @@ function StableLabel({
2914
3654
  align === "center" ? "polli:justify-items-center" : "polli:justify-items-start polli:sm:justify-items-end"
2915
3655
  ),
2916
3656
  children: [
2917
- options.map((option) => /* @__PURE__ */ jsxs28(
3657
+ options.map((option) => /* @__PURE__ */ jsxs32(
2918
3658
  "span",
2919
3659
  {
2920
3660
  "aria-hidden": "true",
@@ -2926,7 +3666,7 @@ function StableLabel({
2926
3666
  },
2927
3667
  option
2928
3668
  )),
2929
- /* @__PURE__ */ jsxs28("span", { className: "polli:col-start-1 polli:row-start-1 polli:inline-flex polli:items-center polli:gap-1", children: [
3669
+ /* @__PURE__ */ jsxs32("span", { className: "polli:col-start-1 polli:row-start-1 polli:inline-flex polli:items-center polli:gap-1", children: [
2930
3670
  prefix,
2931
3671
  text
2932
3672
  ] })
@@ -2936,7 +3676,7 @@ function StableLabel({
2936
3676
  }
2937
3677
 
2938
3678
  // src/primitives/Table.tsx
2939
- import { Fragment as Fragment10, jsx as jsx39, jsxs as jsxs29 } from "react/jsx-runtime";
3679
+ import { Fragment as Fragment13, jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
2940
3680
  var alignClasses = {
2941
3681
  left: "polli:text-left",
2942
3682
  center: "polli:text-center",
@@ -2947,7 +3687,7 @@ var rowIntentClasses = {
2947
3687
  warning: "polli:bg-intent-warning-bg-light/65",
2948
3688
  danger: "polli:bg-intent-danger-bg-light/65"
2949
3689
  };
2950
- var Table = ({ className, ...rest }) => /* @__PURE__ */ jsx39(
3690
+ var Table = ({ className, ...rest }) => /* @__PURE__ */ jsx43(
2951
3691
  "table",
2952
3692
  {
2953
3693
  ...rest,
@@ -2957,7 +3697,7 @@ var Table = ({ className, ...rest }) => /* @__PURE__ */ jsx39(
2957
3697
  )
2958
3698
  }
2959
3699
  );
2960
- var TableHead = ({ className, ...rest }) => /* @__PURE__ */ jsx39(
3700
+ var TableHead = ({ className, ...rest }) => /* @__PURE__ */ jsx43(
2961
3701
  "thead",
2962
3702
  {
2963
3703
  ...rest,
@@ -2967,7 +3707,7 @@ var TableHead = ({ className, ...rest }) => /* @__PURE__ */ jsx39(
2967
3707
  )
2968
3708
  }
2969
3709
  );
2970
- var TableBody = ({ className, ...rest }) => /* @__PURE__ */ jsx39(
3710
+ var TableBody = ({ className, ...rest }) => /* @__PURE__ */ jsx43(
2971
3711
  "tbody",
2972
3712
  {
2973
3713
  ...rest,
@@ -2978,7 +3718,7 @@ var TableRow = ({
2978
3718
  intent = "default",
2979
3719
  className,
2980
3720
  ...rest
2981
- }) => /* @__PURE__ */ jsx39(
3721
+ }) => /* @__PURE__ */ jsx43(
2982
3722
  "tr",
2983
3723
  {
2984
3724
  ...rest,
@@ -2998,9 +3738,9 @@ var TableHeaderCell = ({
2998
3738
  children,
2999
3739
  ...rest
3000
3740
  }) => {
3001
- const content = /* @__PURE__ */ jsxs29(Fragment10, { children: [
3002
- /* @__PURE__ */ jsx39("span", { children }),
3003
- onSort && /* @__PURE__ */ jsx39(
3741
+ const content = /* @__PURE__ */ jsxs33(Fragment13, { children: [
3742
+ /* @__PURE__ */ jsx43("span", { children }),
3743
+ onSort && /* @__PURE__ */ jsx43(
3004
3744
  "span",
3005
3745
  {
3006
3746
  "aria-hidden": "true",
@@ -3017,15 +3757,15 @@ var TableHeaderCell = ({
3017
3757
  className
3018
3758
  );
3019
3759
  if (!onSort) {
3020
- return /* @__PURE__ */ jsx39("th", { ...rest, className: classes, children: content });
3760
+ return /* @__PURE__ */ jsx43("th", { ...rest, className: classes, children: content });
3021
3761
  }
3022
- return /* @__PURE__ */ jsx39(
3762
+ return /* @__PURE__ */ jsx43(
3023
3763
  "th",
3024
3764
  {
3025
3765
  ...rest,
3026
3766
  "aria-sort": active && sortDirection ? sortDirection === "asc" ? "ascending" : "descending" : "none",
3027
3767
  className: classes,
3028
- children: /* @__PURE__ */ jsx39(
3768
+ children: /* @__PURE__ */ jsx43(
3029
3769
  "button",
3030
3770
  {
3031
3771
  type: "button",
@@ -3047,7 +3787,7 @@ var TableCell = ({
3047
3787
  muted = false,
3048
3788
  className,
3049
3789
  ...rest
3050
- }) => /* @__PURE__ */ jsx39(
3790
+ }) => /* @__PURE__ */ jsx43(
3051
3791
  "td",
3052
3792
  {
3053
3793
  ...rest,
@@ -3062,14 +3802,14 @@ var TableCell = ({
3062
3802
  );
3063
3803
 
3064
3804
  // src/primitives/TableDisclosureButton.tsx
3065
- import { jsx as jsx40, jsxs as jsxs30 } from "react/jsx-runtime";
3805
+ import { jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
3066
3806
  var TableDisclosureButton = ({
3067
3807
  children,
3068
3808
  disabled = false,
3069
3809
  expanded,
3070
3810
  onClick,
3071
3811
  className
3072
- }) => /* @__PURE__ */ jsxs30(
3812
+ }) => /* @__PURE__ */ jsxs34(
3073
3813
  "button",
3074
3814
  {
3075
3815
  type: "button",
@@ -3082,7 +3822,7 @@ var TableDisclosureButton = ({
3082
3822
  className
3083
3823
  ),
3084
3824
  children: [
3085
- /* @__PURE__ */ jsx40(
3825
+ /* @__PURE__ */ jsx44(
3086
3826
  ChevronIcon,
3087
3827
  {
3088
3828
  expanded,
@@ -3105,6 +3845,8 @@ export {
3105
3845
  ArrowLeftIcon,
3106
3846
  ArrowRightIcon,
3107
3847
  AudioIcon,
3848
+ AudioInput,
3849
+ AudioRecorder,
3108
3850
  BeakerIcon,
3109
3851
  BookIcon,
3110
3852
  BotIcon,
@@ -3194,6 +3936,7 @@ export {
3194
3936
  LogOutIcon,
3195
3937
  MailIcon,
3196
3938
  McpIcon,
3939
+ MediaFileIcon,
3197
3940
  MediaPlaceholder,
3198
3941
  MegaphoneIcon,
3199
3942
  MenuIcon,
@@ -3253,8 +3996,10 @@ export {
3253
3996
  Tooltip,
3254
3997
  TrashIcon,
3255
3998
  TrendUpIcon,
3999
+ UploadedFileTile,
3256
4000
  UsageIcon,
3257
4001
  VideoIcon,
4002
+ VideoRecorder,
3258
4003
  WalletIcon,
3259
4004
  WarningIcon,
3260
4005
  XIcon,