pxengine 0.1.135 → 0.1.137

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -212,6 +212,7 @@ __export(index_exports, {
212
212
  InputWidget: () => InputWidget,
213
213
  InsightDigestCard: () => InsightDigestCard,
214
214
  InsightSummaryCard: () => InsightSummaryCard,
215
+ JOB_SIGNAL_EVENT: () => JOB_SIGNAL_EVENT,
215
216
  KPIStatsCard: () => KPIStatsCard,
216
217
  KbdAtom: () => KbdAtom,
217
218
  KeywordBundlesDisplay: () => KeywordBundlesDisplay,
@@ -272,6 +273,7 @@ __export(index_exports, {
272
273
  ResizablePanel: () => ResizablePanel,
273
274
  ResizablePanelGroup: () => ResizablePanelGroup,
274
275
  RiskSignalCard: () => RiskSignalCard,
276
+ SSE_FALLBACK_POLL_MS: () => SSE_FALLBACK_POLL_MS,
275
277
  ScoreBreakdownCard: () => ScoreBreakdownCard,
276
278
  ScrollArea: () => ScrollArea,
277
279
  ScrollAreaAtom: () => ScrollAreaAtom,
@@ -342,24 +344,28 @@ __export(index_exports, {
342
344
  defaultFetchSelections: () => defaultFetchSelections,
343
345
  defaultPersistSelection: () => defaultPersistSelection,
344
346
  elementToQAField: () => elementToQAField,
347
+ emitJobSignal: () => emitJobSignal,
345
348
  formatQAMessage: () => formatQAMessage,
346
349
  generateFieldsFromData: () => generateFieldsFromData,
347
350
  generateFieldsFromPropDefinitions: () => generateFieldsFromPropDefinitions,
348
351
  getPxAuthToken: () => getPxAuthToken,
349
352
  isInputAtom: () => isInputAtom,
350
353
  notifyPxUnauthorized: () => notifyPxUnauthorized,
354
+ refreshSharedPoll: () => refreshSharedPoll,
351
355
  setPxAuthTokenProvider: () => setPxAuthTokenProvider,
352
356
  setPxUnauthorizedHandler: () => setPxUnauthorizedHandler,
353
357
  submitWidgetToAgent: () => submitWidgetToAgent,
358
+ subscribeJobSignal: () => subscribeJobSignal,
354
359
  th: () => th,
355
360
  useCreatorWidgetPolling: () => useCreatorWidgetPolling,
361
+ useJobSignal: () => useJobSignal,
356
362
  useWidgetTheme: () => useWidgetTheme,
357
363
  withAlpha: () => withAlpha
358
364
  });
359
365
  module.exports = __toCommonJS(index_exports);
360
366
 
361
367
  // src/render/PXEngineRenderer.tsx
362
- var import_react99 = __toESM(require("react"), 1);
368
+ var import_react100 = __toESM(require("react"), 1);
363
369
 
364
370
  // src/atoms/index.ts
365
371
  var atoms_exports = {};
@@ -16119,10 +16125,12 @@ var NextStepCard = ({
16119
16125
  };
16120
16126
 
16121
16127
  // src/molecules/generic/PresentationJobCard/PresentationJobCard.tsx
16122
- var import_react80 = require("react");
16128
+ var import_react81 = require("react");
16129
+ var import_react_dom = require("react-dom");
16123
16130
 
16124
16131
  // src/lib/shared-poll.ts
16125
16132
  var import_react79 = require("react");
16133
+ var SSE_FALLBACK_POLL_MS = 2e4;
16126
16134
  var MAX_RETAINED = 50;
16127
16135
  var RETAIN_TTL_MS = 30 * 60 * 1e3;
16128
16136
  var entries = /* @__PURE__ */ new Map();
@@ -16249,6 +16257,12 @@ function stopSharedPoll(key) {
16249
16257
  entry.stopped = true;
16250
16258
  clearTimer(entry);
16251
16259
  }
16260
+ function refreshSharedPoll(key) {
16261
+ if (!key) return;
16262
+ const entry = entries.get(key);
16263
+ if (!entry || entry.stopped) return;
16264
+ void runPoll(key);
16265
+ }
16252
16266
  function getSharedPollLastData(key) {
16253
16267
  if (!key) return void 0;
16254
16268
  const entry = entries.get(key);
@@ -16285,6 +16299,45 @@ function useSharedPoll(config, onData, onError) {
16285
16299
  }, [key, intervalMs]);
16286
16300
  }
16287
16301
 
16302
+ // src/lib/job-signal.ts
16303
+ var import_react80 = require("react");
16304
+ var JOB_SIGNAL_EVENT = "pxengine:job-signal";
16305
+ var listeners = /* @__PURE__ */ new Set();
16306
+ var windowBridgeInstalled = false;
16307
+ function fanout(jobId) {
16308
+ if (!jobId) return;
16309
+ for (const listener of Array.from(listeners)) {
16310
+ try {
16311
+ listener(jobId);
16312
+ } catch {
16313
+ }
16314
+ }
16315
+ }
16316
+ function ensureWindowBridge() {
16317
+ if (windowBridgeInstalled || typeof window === "undefined") return;
16318
+ windowBridgeInstalled = true;
16319
+ window.addEventListener(JOB_SIGNAL_EVENT, (event) => {
16320
+ const detail = event.detail;
16321
+ const jobId = detail?.jobId;
16322
+ if (typeof jobId === "string" && jobId) fanout(jobId);
16323
+ });
16324
+ }
16325
+ function emitJobSignal(jobId) {
16326
+ fanout(jobId);
16327
+ }
16328
+ function subscribeJobSignal(listener) {
16329
+ ensureWindowBridge();
16330
+ listeners.add(listener);
16331
+ return () => {
16332
+ listeners.delete(listener);
16333
+ };
16334
+ }
16335
+ function useJobSignal(onSignal) {
16336
+ const ref = (0, import_react80.useRef)(onSignal);
16337
+ ref.current = onSignal;
16338
+ (0, import_react80.useEffect)(() => subscribeJobSignal((jobId) => ref.current(jobId)), []);
16339
+ }
16340
+
16288
16341
  // src/molecules/generic/job-card-shared/Chip.tsx
16289
16342
  var import_jsx_runtime148 = require("react/jsx-runtime");
16290
16343
  var Chip = ({
@@ -16378,9 +16431,9 @@ function formatTemplateLabel(templateId) {
16378
16431
  }
16379
16432
  var DECK_CANVAS = { w: 1280, h: 720 };
16380
16433
  function useDeckFitScale(canvasW = DECK_CANVAS.w, canvasH = DECK_CANVAS.h) {
16381
- const containerRef = (0, import_react80.useRef)(null);
16382
- const [scale, setScale] = (0, import_react80.useState)(1);
16383
- (0, import_react80.useLayoutEffect)(() => {
16434
+ const containerRef = (0, import_react81.useRef)(null);
16435
+ const [scale, setScale] = (0, import_react81.useState)(1);
16436
+ (0, import_react81.useLayoutEffect)(() => {
16384
16437
  const el = containerRef.current;
16385
16438
  if (!el) return;
16386
16439
  const update = () => {
@@ -16443,7 +16496,7 @@ var FORMATS = [
16443
16496
  var ExportModal = ({ formats, title, onClose }) => {
16444
16497
  const available = FORMATS.filter((f) => (formats ?? {})[f.key]);
16445
16498
  const filename = (title ?? "").replace(/[^a-z0-9]/gi, "-").toLowerCase();
16446
- const [downloadingKey, setDownloadingKey] = (0, import_react80.useState)(null);
16499
+ const [downloadingKey, setDownloadingKey] = (0, import_react81.useState)(null);
16447
16500
  const handleDownload = async (fmtKey, url, ext) => {
16448
16501
  if (downloadingKey) return;
16449
16502
  const downloadName = `${filename}${ext}`;
@@ -16467,55 +16520,58 @@ var ExportModal = ({ formats, title, onClose }) => {
16467
16520
  setDownloadingKey(null);
16468
16521
  }
16469
16522
  };
16470
- return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
16471
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "absolute inset-0 bg-black/70 backdrop-blur-sm", onClick: onClose }),
16472
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "relative z-10 bg-zinc-900 border border-zinc-800 rounded-2xl w-full max-w-sm p-6 shadow-2xl", children: [
16473
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-start justify-between mb-5", children: [
16474
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "min-w-0 pr-3", children: [
16475
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("h3", { className: "text-sm font-semibold text-zinc-100", children: "Export Presentation" }),
16476
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-zinc-500 mt-0.5 truncate", children: title })
16523
+ return (0, import_react_dom.createPortal)(
16524
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "fixed inset-0 z-[100] flex items-center justify-center p-4", children: [
16525
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "absolute inset-0 bg-black/70 backdrop-blur-sm", onClick: onClose }),
16526
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "relative z-10 bg-zinc-900 border border-zinc-800 rounded-2xl w-full max-w-sm p-6 shadow-2xl", children: [
16527
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-start justify-between mb-5", children: [
16528
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "min-w-0 pr-3", children: [
16529
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("h3", { className: "text-sm font-semibold text-zinc-100", children: "Export Presentation" }),
16530
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-zinc-500 mt-0.5 truncate", children: title })
16531
+ ] }),
16532
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("button", { onClick: onClose, className: "text-zinc-500 hover:text-zinc-200 transition-colors flex-shrink-0 mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CloseIcon, {}) })
16477
16533
  ] }),
16478
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("button", { onClick: onClose, className: "text-zinc-500 hover:text-zinc-200 transition-colors flex-shrink-0 mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CloseIcon, {}) })
16479
- ] }),
16480
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "space-y-2.5", children: [
16481
- available.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-sm text-zinc-500 text-center py-6", children: "No formats available yet" }),
16482
- available.map((fmt) => {
16483
- const url = formats[fmt.key];
16484
- const isDownloading = downloadingKey === fmt.key;
16485
- return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
16486
- "button",
16487
- {
16488
- type: "button",
16489
- disabled: Boolean(downloadingKey),
16490
- onClick: () => handleDownload(fmt.key, url, fmt.ext),
16491
- className: cn(
16492
- "flex w-full items-center gap-3.5 p-3.5 rounded-xl border transition-all text-left",
16493
- "hover:brightness-110 disabled:opacity-60 disabled:cursor-not-allowed",
16494
- fmt.accent.bg
16495
- ),
16496
- children: [
16497
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "text-xl flex-shrink-0", children: fmt.emoji }),
16498
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex-1 min-w-0", children: [
16499
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: cn("text-sm font-semibold", fmt.accent.text), children: isDownloading ? `Downloading ${fmt.label}...` : fmt.label }),
16500
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-zinc-500 mt-0.5 leading-relaxed", children: isDownloading ? "Please wait while the file is being prepared." : fmt.desc })
16501
- ] }),
16502
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: cn("flex-shrink-0", fmt.accent.text), children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(DownloadIcon, {}) })
16503
- ]
16504
- },
16505
- fmt.key
16506
- );
16507
- })
16508
- ] }),
16509
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-zinc-600 mt-4 text-center", children: "Download links expire in 90 days" })
16510
- ] })
16511
- ] });
16534
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "space-y-2.5", children: [
16535
+ available.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-sm text-zinc-500 text-center py-6", children: "No formats available yet" }),
16536
+ available.map((fmt) => {
16537
+ const url = formats[fmt.key];
16538
+ const isDownloading = downloadingKey === fmt.key;
16539
+ return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
16540
+ "button",
16541
+ {
16542
+ type: "button",
16543
+ disabled: Boolean(downloadingKey),
16544
+ onClick: () => handleDownload(fmt.key, url, fmt.ext),
16545
+ className: cn(
16546
+ "flex w-full items-center gap-3.5 p-3.5 rounded-xl border transition-all text-left",
16547
+ "hover:brightness-110 disabled:opacity-60 disabled:cursor-not-allowed",
16548
+ fmt.accent.bg
16549
+ ),
16550
+ children: [
16551
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "text-xl flex-shrink-0", children: fmt.emoji }),
16552
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex-1 min-w-0", children: [
16553
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: cn("text-sm font-semibold", fmt.accent.text), children: isDownloading ? `Downloading ${fmt.label}...` : fmt.label }),
16554
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-zinc-500 mt-0.5 leading-relaxed", children: isDownloading ? "Please wait while the file is being prepared." : fmt.desc })
16555
+ ] }),
16556
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: cn("flex-shrink-0", fmt.accent.text), children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(DownloadIcon, {}) })
16557
+ ]
16558
+ },
16559
+ fmt.key
16560
+ );
16561
+ })
16562
+ ] }),
16563
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-zinc-600 mt-4 text-center", children: "Download links expire in 90 days" })
16564
+ ] })
16565
+ ] }),
16566
+ document.body
16567
+ );
16512
16568
  };
16513
16569
  var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) => {
16514
- const [currentSlide, setCurrentSlide] = (0, import_react80.useState)(initialSlide);
16515
- const [iframeReady, setIframeReady] = (0, import_react80.useState)(false);
16516
- const iframeRef = (0, import_react80.useRef)(null);
16570
+ const [currentSlide, setCurrentSlide] = (0, import_react81.useState)(initialSlide);
16571
+ const [iframeReady, setIframeReady] = (0, import_react81.useState)(false);
16572
+ const iframeRef = (0, import_react81.useRef)(null);
16517
16573
  const { containerRef, scale, canvasW, canvasH } = useDeckFitScale();
16518
- (0, import_react80.useEffect)(() => {
16574
+ (0, import_react81.useEffect)(() => {
16519
16575
  const onKey = (e) => {
16520
16576
  if (e.key === "Escape") onClose();
16521
16577
  };
@@ -16533,7 +16589,7 @@ var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) =>
16533
16589
  window.removeEventListener("message", onMsg);
16534
16590
  };
16535
16591
  }, [onClose, iframeReady]);
16536
- (0, import_react80.useEffect)(() => {
16592
+ (0, import_react81.useEffect)(() => {
16537
16593
  document.body.style.overflow = "hidden";
16538
16594
  return () => {
16539
16595
  document.body.style.overflow = "";
@@ -16552,81 +16608,84 @@ var FullscreenModal = ({ url, title, slideCount, initialSlide = 1, onClose }) =>
16552
16608
  setCurrentSlide(newSlide);
16553
16609
  iframe.contentWindow.postMessage({ type: "goToSlide", slide: newSlide }, "*");
16554
16610
  };
16555
- return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "fixed inset-0 z-50 bg-black flex flex-col", children: [
16556
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center justify-between gap-4 px-4 h-11 bg-zinc-950/90 border-b border-zinc-800/60 flex-shrink-0", children: [
16557
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center gap-3 min-w-0", children: [
16558
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "text-[#DCC99B] flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(SlidesIcon, {}) }),
16559
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "text-sm font-medium text-zinc-300 truncate", children: title }),
16560
- slideCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("span", { className: "text-xs text-zinc-600 flex-shrink-0", children: [
16561
- currentSlide,
16562
- " / ",
16563
- slideCount
16611
+ return (0, import_react_dom.createPortal)(
16612
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "fixed inset-0 z-[100] bg-black flex flex-col", children: [
16613
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center justify-between gap-4 px-4 h-11 bg-zinc-950/90 border-b border-zinc-800/60 flex-shrink-0", children: [
16614
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center gap-3 min-w-0", children: [
16615
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "text-[#DCC99B] flex-shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(SlidesIcon, {}) }),
16616
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "text-sm font-medium text-zinc-300 truncate", children: title }),
16617
+ slideCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("span", { className: "text-xs text-zinc-600 flex-shrink-0", children: [
16618
+ currentSlide,
16619
+ " / ",
16620
+ slideCount
16621
+ ] })
16622
+ ] }),
16623
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
16624
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16625
+ "button",
16626
+ {
16627
+ onClick: () => sendSlideCommand("prevSlide"),
16628
+ disabled: !iframeReady,
16629
+ className: "w-7 h-7 rounded-full border border-zinc-700 bg-zinc-800 hover:border-[#C0AE82] hover:text-[#DCC99B] text-zinc-400 flex items-center justify-center transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
16630
+ "aria-label": "Previous slide",
16631
+ children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(ChevronLeft2, {})
16632
+ }
16633
+ ),
16634
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16635
+ "button",
16636
+ {
16637
+ onClick: () => sendSlideCommand("nextSlide"),
16638
+ disabled: !iframeReady,
16639
+ className: "w-7 h-7 rounded-full border border-zinc-700 bg-zinc-800 hover:border-[#C0AE82] hover:text-[#DCC99B] text-zinc-400 flex items-center justify-center transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
16640
+ "aria-label": "Next slide",
16641
+ children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(ChevronRight2, {})
16642
+ }
16643
+ ),
16644
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
16645
+ "button",
16646
+ {
16647
+ onClick: onClose,
16648
+ className: "flex items-center gap-1.5 px-3 h-7 rounded-lg border border-zinc-700 bg-zinc-800 hover:border-zinc-500 text-zinc-400 hover:text-zinc-200 text-xs transition-colors",
16649
+ children: [
16650
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CloseIcon, {}),
16651
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { children: "ESC" })
16652
+ ]
16653
+ }
16654
+ )
16564
16655
  ] })
16565
16656
  ] }),
16566
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex items-center gap-2 flex-shrink-0", children: [
16567
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16568
- "button",
16569
- {
16570
- onClick: () => sendSlideCommand("prevSlide"),
16571
- disabled: !iframeReady,
16572
- className: "w-7 h-7 rounded-full border border-zinc-700 bg-zinc-800 hover:border-[#C0AE82] hover:text-[#DCC99B] text-zinc-400 flex items-center justify-center transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
16573
- "aria-label": "Previous slide",
16574
- children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(ChevronLeft2, {})
16575
- }
16576
- ),
16577
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16578
- "button",
16579
- {
16580
- onClick: () => sendSlideCommand("nextSlide"),
16581
- disabled: !iframeReady,
16582
- className: "w-7 h-7 rounded-full border border-zinc-700 bg-zinc-800 hover:border-[#C0AE82] hover:text-[#DCC99B] text-zinc-400 flex items-center justify-center transition-colors disabled:opacity-30 disabled:cursor-not-allowed",
16583
- "aria-label": "Next slide",
16584
- children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(ChevronRight2, {})
16585
- }
16586
- ),
16587
- /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(
16588
- "button",
16589
- {
16590
- onClick: onClose,
16591
- className: "flex items-center gap-1.5 px-3 h-7 rounded-lg border border-zinc-700 bg-zinc-800 hover:border-zinc-500 text-zinc-400 hover:text-zinc-200 text-xs transition-colors",
16592
- children: [
16593
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(CloseIcon, {}),
16594
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { children: "ESC" })
16595
- ]
16596
- }
16597
- )
16598
- ] })
16599
- ] }),
16600
- /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { ref: containerRef, className: "flex-1 relative flex items-center justify-center overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16601
- "div",
16602
- {
16603
- className: "relative",
16604
- style: { width: canvasW * scale, height: canvasH * scale },
16605
- children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16606
- "iframe",
16607
- {
16608
- ref: iframeRef,
16609
- src: url,
16610
- title,
16611
- onLoad: () => {
16612
- setIframeReady(true);
16613
- hideDeckChrome(iframeRef.current);
16614
- iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: initialSlide }, "*");
16615
- },
16616
- sandbox: "allow-same-origin allow-scripts",
16617
- allow: "fullscreen",
16618
- className: "absolute top-0 left-0 border-0",
16619
- style: {
16620
- width: canvasW,
16621
- height: canvasH,
16622
- transform: `scale(${scale})`,
16623
- transformOrigin: "top left"
16657
+ /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { ref: containerRef, className: "flex-1 relative flex items-center justify-center overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16658
+ "div",
16659
+ {
16660
+ className: "relative",
16661
+ style: { width: canvasW * scale, height: canvasH * scale },
16662
+ children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
16663
+ "iframe",
16664
+ {
16665
+ ref: iframeRef,
16666
+ src: url,
16667
+ title,
16668
+ onLoad: () => {
16669
+ setIframeReady(true);
16670
+ hideDeckChrome(iframeRef.current);
16671
+ iframeRef.current?.contentWindow?.postMessage({ type: "goToSlide", slide: initialSlide }, "*");
16672
+ },
16673
+ sandbox: "allow-same-origin allow-scripts",
16674
+ allow: "fullscreen",
16675
+ className: "absolute top-0 left-0 border-0",
16676
+ style: {
16677
+ width: canvasW,
16678
+ height: canvasH,
16679
+ transform: `scale(${scale})`,
16680
+ transformOrigin: "top left"
16681
+ }
16624
16682
  }
16625
- }
16626
- )
16627
- }
16628
- ) })
16629
- ] });
16683
+ )
16684
+ }
16685
+ ) })
16686
+ ] }),
16687
+ document.body
16688
+ );
16630
16689
  };
16631
16690
  var PresentationJobCard = ({
16632
16691
  job_id: _job_id,
@@ -16659,74 +16718,74 @@ var PresentationJobCard = ({
16659
16718
  }) => {
16660
16719
  const t = th(theme);
16661
16720
  const accentGradient = theme?.gradient;
16662
- const [status, setStatus] = (0, import_react80.useState)(initialStatus);
16663
- const [title, setTitle] = (0, import_react80.useState)(initialTitle);
16664
- const [slideCount, setSlideCount] = (0, import_react80.useState)(initialSlideCount ?? 0);
16665
- const [formats, setFormats] = (0, import_react80.useState)(initialFormats);
16666
- const [error, setError] = (0, import_react80.useState)(initialError);
16667
- const [progress, setProgress] = (0, import_react80.useState)(initialProgress);
16668
- const [generationMode, setGenerationMode] = (0, import_react80.useState)(
16721
+ const [status, setStatus] = (0, import_react81.useState)(initialStatus);
16722
+ const [title, setTitle] = (0, import_react81.useState)(initialTitle);
16723
+ const [slideCount, setSlideCount] = (0, import_react81.useState)(initialSlideCount ?? 0);
16724
+ const [formats, setFormats] = (0, import_react81.useState)(initialFormats);
16725
+ const [error, setError] = (0, import_react81.useState)(initialError);
16726
+ const [progress, setProgress] = (0, import_react81.useState)(initialProgress);
16727
+ const [generationMode, setGenerationMode] = (0, import_react81.useState)(
16669
16728
  initialGenerationMode || (initialFormats?.html_url ? "template" : "")
16670
16729
  );
16671
- const [templateId, setTemplateId] = (0, import_react80.useState)(initialTemplateId || "");
16672
- const [, setTemplateVersionId] = (0, import_react80.useState)(initialTemplateVersionId || "");
16673
- const [reviewStatus, setReviewStatus] = (0, import_react80.useState)(initialReviewStatus || "");
16674
- const [outline, setOutline] = (0, import_react80.useState)(initialOutline);
16675
- const [slideTemplateOptions, setSlideTemplateOptions] = (0, import_react80.useState)(null);
16676
- const [showExport, setShowExport] = (0, import_react80.useState)(false);
16677
- const [showFullscreen, setShowFullscreen] = (0, import_react80.useState)(false);
16678
- const [copied, setCopied] = (0, import_react80.useState)(false);
16679
- const [approving, setApproving] = (0, import_react80.useState)(false);
16680
- const [regenerating, setRegenerating] = (0, import_react80.useState)(false);
16681
- const [approveError, setApproveError] = (0, import_react80.useState)(null);
16682
- const [messageEdits, setMessageEdits] = (0, import_react80.useState)({});
16683
- const [approvingOutline, setApprovingOutline] = (0, import_react80.useState)(false);
16684
- const [outlineWritePollUrl, setOutlineWritePollUrl] = (0, import_react80.useState)(null);
16685
- const [rowBusyIndex, setRowBusyIndex] = (0, import_react80.useState)(null);
16686
- const [rowError, setRowError] = (0, import_react80.useState)(null);
16687
- const [regenPollUrl, setRegenPollUrl] = (0, import_react80.useState)(null);
16688
- const [currentSlide, setCurrentSlide] = (0, import_react80.useState)(1);
16689
- const [iframeReady, setIframeReady] = (0, import_react80.useState)(false);
16690
- const iframeRef = (0, import_react80.useRef)(null);
16730
+ const [templateId, setTemplateId] = (0, import_react81.useState)(initialTemplateId || "");
16731
+ const [, setTemplateVersionId] = (0, import_react81.useState)(initialTemplateVersionId || "");
16732
+ const [reviewStatus, setReviewStatus] = (0, import_react81.useState)(initialReviewStatus || "");
16733
+ const [outline, setOutline] = (0, import_react81.useState)(initialOutline);
16734
+ const [slideTemplateOptions, setSlideTemplateOptions] = (0, import_react81.useState)(null);
16735
+ const [showExport, setShowExport] = (0, import_react81.useState)(false);
16736
+ const [showFullscreen, setShowFullscreen] = (0, import_react81.useState)(false);
16737
+ const [copied, setCopied] = (0, import_react81.useState)(false);
16738
+ const [approving, setApproving] = (0, import_react81.useState)(false);
16739
+ const [regenerating, setRegenerating] = (0, import_react81.useState)(false);
16740
+ const [approveError, setApproveError] = (0, import_react81.useState)(null);
16741
+ const [messageEdits, setMessageEdits] = (0, import_react81.useState)({});
16742
+ const [approvingOutline, setApprovingOutline] = (0, import_react81.useState)(false);
16743
+ const [outlineWritePollUrl, setOutlineWritePollUrl] = (0, import_react81.useState)(null);
16744
+ const [rowBusyIndex, setRowBusyIndex] = (0, import_react81.useState)(null);
16745
+ const [rowError, setRowError] = (0, import_react81.useState)(null);
16746
+ const [regenPollUrl, setRegenPollUrl] = (0, import_react81.useState)(null);
16747
+ const [currentSlide, setCurrentSlide] = (0, import_react81.useState)(1);
16748
+ const [iframeReady, setIframeReady] = (0, import_react81.useState)(false);
16749
+ const iframeRef = (0, import_react81.useRef)(null);
16691
16750
  const { containerRef: previewFitRef, scale: previewScale, canvasW, canvasH } = useDeckFitScale();
16692
- (0, import_react80.useEffect)(() => {
16751
+ (0, import_react81.useEffect)(() => {
16693
16752
  setStatus(initialStatus);
16694
16753
  }, [initialStatus]);
16695
16754
  const progressPct = initialProgress?.percentage;
16696
16755
  const progressStep = initialProgress?.current_step;
16697
- (0, import_react80.useEffect)(() => {
16756
+ (0, import_react81.useEffect)(() => {
16698
16757
  if (initialProgress) setProgress(initialProgress);
16699
16758
  }, [progressPct, progressStep]);
16700
- (0, import_react80.useEffect)(() => {
16759
+ (0, import_react81.useEffect)(() => {
16701
16760
  if (initialError) setError(initialError);
16702
16761
  }, [initialError]);
16703
- (0, import_react80.useEffect)(() => {
16762
+ (0, import_react81.useEffect)(() => {
16704
16763
  if (initialSlideCount !== void 0) setSlideCount(initialSlideCount);
16705
16764
  }, [initialSlideCount]);
16706
16765
  const htmlUrl = initialFormats?.html_url;
16707
- (0, import_react80.useEffect)(() => {
16766
+ (0, import_react81.useEffect)(() => {
16708
16767
  if (initialFormats) setFormats(initialFormats);
16709
16768
  }, [htmlUrl]);
16710
- (0, import_react80.useEffect)(() => {
16769
+ (0, import_react81.useEffect)(() => {
16711
16770
  if (initialTitle) setTitle(initialTitle);
16712
16771
  }, [initialTitle]);
16713
- (0, import_react80.useEffect)(() => {
16772
+ (0, import_react81.useEffect)(() => {
16714
16773
  if (initialGenerationMode) setGenerationMode(initialGenerationMode);
16715
16774
  }, [initialGenerationMode]);
16716
- (0, import_react80.useEffect)(() => {
16775
+ (0, import_react81.useEffect)(() => {
16717
16776
  if (initialTemplateId) setTemplateId(initialTemplateId);
16718
16777
  }, [initialTemplateId]);
16719
- (0, import_react80.useEffect)(() => {
16778
+ (0, import_react81.useEffect)(() => {
16720
16779
  if (initialTemplateVersionId) setTemplateVersionId(initialTemplateVersionId);
16721
16780
  }, [initialTemplateVersionId]);
16722
- (0, import_react80.useEffect)(() => {
16781
+ (0, import_react81.useEffect)(() => {
16723
16782
  if (initialReviewStatus) setReviewStatus(initialReviewStatus);
16724
16783
  }, [initialReviewStatus]);
16725
16784
  const initialOutlineSlideCount = initialOutline?.slides?.length;
16726
- (0, import_react80.useEffect)(() => {
16785
+ (0, import_react81.useEffect)(() => {
16727
16786
  if (initialOutline) setOutline(initialOutline);
16728
16787
  }, [initialOutlineSlideCount]);
16729
- (0, import_react80.useEffect)(() => {
16788
+ (0, import_react81.useEffect)(() => {
16730
16789
  if (reviewStatus !== "pending_outline_approval" || slideTemplateOptions !== null) return;
16731
16790
  let cancelled = false;
16732
16791
  (async () => {
@@ -16753,10 +16812,10 @@ var PresentationJobCard = ({
16753
16812
  cancelled = true;
16754
16813
  };
16755
16814
  }, [reviewStatus, slideTemplateOptions, templatesUrl, authToken]);
16756
- (0, import_react80.useEffect)(() => {
16815
+ (0, import_react81.useEffect)(() => {
16757
16816
  setIframeReady(false);
16758
16817
  }, [formats.html_url]);
16759
- (0, import_react80.useEffect)(() => {
16818
+ (0, import_react81.useEffect)(() => {
16760
16819
  const handler = (e) => {
16761
16820
  if (e.data?.type === "slideChanged") {
16762
16821
  setCurrentSlide(e.data.slide);
@@ -16782,15 +16841,15 @@ var PresentationJobCard = ({
16782
16841
  };
16783
16842
  const isTerminal = status === "complete" || status === "failed";
16784
16843
  const building = Boolean(outlineWritePollUrl) || approvingOutline;
16785
- const onCompleteRef = (0, import_react80.useRef)(onComplete);
16786
- const onFailedRef = (0, import_react80.useRef)(onFailed);
16787
- const hasNotifiedRef = (0, import_react80.useRef)(false);
16844
+ const onCompleteRef = (0, import_react81.useRef)(onComplete);
16845
+ const onFailedRef = (0, import_react81.useRef)(onFailed);
16846
+ const hasNotifiedRef = (0, import_react81.useRef)(false);
16788
16847
  onCompleteRef.current = onComplete;
16789
16848
  onFailedRef.current = onFailed;
16790
16849
  useSharedPoll(
16791
16850
  {
16792
16851
  key: !isTerminal && pollUrl ? pollUrl : null,
16793
- intervalMs: 3e3,
16852
+ intervalMs: SSE_FALLBACK_POLL_MS,
16794
16853
  fetcher: async () => {
16795
16854
  const headers = {};
16796
16855
  if (authToken) {
@@ -16850,7 +16909,7 @@ var PresentationJobCard = ({
16850
16909
  useSharedPoll(
16851
16910
  {
16852
16911
  key: building && pollUrl ? pollUrl : null,
16853
- intervalMs: 2e3,
16912
+ intervalMs: SSE_FALLBACK_POLL_MS,
16854
16913
  fetcher: async () => {
16855
16914
  const headers = {};
16856
16915
  if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
@@ -16864,7 +16923,7 @@ var PresentationJobCard = ({
16864
16923
  if (data.progress) setProgress(data.progress);
16865
16924
  }
16866
16925
  );
16867
- const applyDeckOutput = (0, import_react80.useCallback)((out, opts) => {
16926
+ const applyDeckOutput = (0, import_react81.useCallback)((out, opts) => {
16868
16927
  if (out.title) setTitle(out.title);
16869
16928
  if (out.slide_count !== void 0) setSlideCount(out.slide_count);
16870
16929
  if (out.formats) setFormats(out.formats);
@@ -16885,7 +16944,7 @@ var PresentationJobCard = ({
16885
16944
  });
16886
16945
  }
16887
16946
  }, [title, slideCount, formats, generationMode, templateId]);
16888
- const refetchSourceAndApply = (0, import_react80.useCallback)(async () => {
16947
+ const refetchSourceAndApply = (0, import_react81.useCallback)(async () => {
16889
16948
  if (!pollUrl) return;
16890
16949
  try {
16891
16950
  const headers = {};
@@ -16900,7 +16959,7 @@ var PresentationJobCard = ({
16900
16959
  useSharedPoll(
16901
16960
  {
16902
16961
  key: outlineWritePollUrl,
16903
- intervalMs: 3e3,
16962
+ intervalMs: SSE_FALLBACK_POLL_MS,
16904
16963
  fetcher: async () => {
16905
16964
  const headers = {};
16906
16965
  if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
@@ -16925,7 +16984,7 @@ var PresentationJobCard = ({
16925
16984
  useSharedPoll(
16926
16985
  {
16927
16986
  key: regenPollUrl,
16928
- intervalMs: 3e3,
16987
+ intervalMs: SSE_FALLBACK_POLL_MS,
16929
16988
  fetcher: async () => {
16930
16989
  const headers = {};
16931
16990
  if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
@@ -16947,6 +17006,16 @@ var PresentationJobCard = ({
16947
17006
  }
16948
17007
  }
16949
17008
  );
17009
+ useJobSignal(
17010
+ (0, import_react81.useCallback)(
17011
+ (completedJobId) => {
17012
+ for (const url of [pollUrl, outlineWritePollUrl, regenPollUrl]) {
17013
+ if (url && url.includes(completedJobId)) refreshSharedPoll(url);
17014
+ }
17015
+ },
17016
+ [pollUrl, outlineWritePollUrl, regenPollUrl]
17017
+ )
17018
+ );
16950
17019
  const buildEditedOutline = () => {
16951
17020
  if (!outline || !Array.isArray(outline.slides)) return void 0;
16952
17021
  let changed = false;
@@ -17639,7 +17708,7 @@ var PresentationJobCard = ({
17639
17708
  };
17640
17709
 
17641
17710
  // src/molecules/generic/ResearchReportJobCard/ResearchReportJobCard.tsx
17642
- var import_react81 = require("react");
17711
+ var import_react82 = require("react");
17643
17712
  var import_jsx_runtime152 = require("react/jsx-runtime");
17644
17713
  var DEFAULT_THEME = {
17645
17714
  primary: "#C0AE82",
@@ -17675,14 +17744,14 @@ function withPdfViewerParams(url) {
17675
17744
  return `${url}#toolbar=0&navpanes=0&scrollbar=0`;
17676
17745
  }
17677
17746
  var FullscreenPreviewModal = ({ url, title, onClose, isPdf }) => {
17678
- (0, import_react81.useEffect)(() => {
17747
+ (0, import_react82.useEffect)(() => {
17679
17748
  const onKey = (e) => {
17680
17749
  if (e.key === "Escape") onClose();
17681
17750
  };
17682
17751
  document.addEventListener("keydown", onKey);
17683
17752
  return () => document.removeEventListener("keydown", onKey);
17684
17753
  }, [onClose]);
17685
- (0, import_react81.useEffect)(() => {
17754
+ (0, import_react82.useEffect)(() => {
17686
17755
  document.body.style.overflow = "hidden";
17687
17756
  return () => {
17688
17757
  document.body.style.overflow = "";
@@ -17712,7 +17781,7 @@ var FullscreenPreviewModal = ({ url, title, onClose, isPdf }) => {
17712
17781
  src: url,
17713
17782
  title,
17714
17783
  className: "absolute inset-0 w-full h-full border-0",
17715
- ...isPdf ? {} : { sandbox: "allow-same-origin" }
17784
+ ...isPdf ? {} : { sandbox: "allow-same-origin allow-scripts" }
17716
17785
  }
17717
17786
  ) })
17718
17787
  ] });
@@ -17739,8 +17808,8 @@ var ReportExportModal = ({ htmlUrl, pdfUrl, title, onClose }) => {
17739
17808
  const urls = { pdf: pdfUrl, html: htmlUrl };
17740
17809
  const available = REPORT_FORMATS.filter((f) => urls[f.key]);
17741
17810
  const filename = (title ?? "").replace(/[^a-z0-9]/gi, "-").toLowerCase();
17742
- const [downloadingKey, setDownloadingKey] = (0, import_react81.useState)(null);
17743
- (0, import_react81.useEffect)(() => {
17811
+ const [downloadingKey, setDownloadingKey] = (0, import_react82.useState)(null);
17812
+ (0, import_react82.useEffect)(() => {
17744
17813
  const onKey = (e) => {
17745
17814
  if (e.key === "Escape") onClose();
17746
17815
  };
@@ -17853,95 +17922,95 @@ var ResearchReportJobCard = (props) => {
17853
17922
  compact = false
17854
17923
  } = props;
17855
17924
  const inferredStatus = initialStatus ?? (initialHtmlUrl ? "complete" : void 0);
17856
- const [status, setStatus] = (0, import_react81.useState)(inferredStatus);
17857
- const [title, setTitle] = (0, import_react81.useState)(initialTitle);
17858
- const [depth, setDepth] = (0, import_react81.useState)(initialDepth || "");
17859
- const [sectionCount, setSectionCount] = (0, import_react81.useState)(initialSectionCount ?? 0);
17860
- const [sourceCount, setSourceCount] = (0, import_react81.useState)(initialSourceCount ?? 0);
17861
- const [wordCount, setWordCount] = (0, import_react81.useState)(initialWordCount ?? 0);
17862
- const [summary, setSummary] = (0, import_react81.useState)(initialSummary || "");
17863
- const [htmlUrl, setHtmlUrl] = (0, import_react81.useState)(initialHtmlUrl || "");
17864
- const [pdfUrl, setPdfUrl] = (0, import_react81.useState)(initialPdfUrl || "");
17865
- const [generationMode, setGenerationMode] = (0, import_react81.useState)(
17925
+ const [status, setStatus] = (0, import_react82.useState)(inferredStatus);
17926
+ const [title, setTitle] = (0, import_react82.useState)(initialTitle);
17927
+ const [depth, setDepth] = (0, import_react82.useState)(initialDepth || "");
17928
+ const [sectionCount, setSectionCount] = (0, import_react82.useState)(initialSectionCount ?? 0);
17929
+ const [sourceCount, setSourceCount] = (0, import_react82.useState)(initialSourceCount ?? 0);
17930
+ const [wordCount, setWordCount] = (0, import_react82.useState)(initialWordCount ?? 0);
17931
+ const [summary, setSummary] = (0, import_react82.useState)(initialSummary || "");
17932
+ const [htmlUrl, setHtmlUrl] = (0, import_react82.useState)(initialHtmlUrl || "");
17933
+ const [pdfUrl, setPdfUrl] = (0, import_react82.useState)(initialPdfUrl || "");
17934
+ const [generationMode, setGenerationMode] = (0, import_react82.useState)(
17866
17935
  initialGenerationMode || (initialHtmlUrl ? "template" : "")
17867
17936
  );
17868
- const [templateId, setTemplateId] = (0, import_react81.useState)(initialTemplateId || "");
17869
- const [templateVersionId, setTemplateVersionId] = (0, import_react81.useState)(initialTemplateVersionId || "");
17870
- const [reviewStatus, setReviewStatus] = (0, import_react81.useState)(
17937
+ const [templateId, setTemplateId] = (0, import_react82.useState)(initialTemplateId || "");
17938
+ const [templateVersionId, setTemplateVersionId] = (0, import_react82.useState)(initialTemplateVersionId || "");
17939
+ const [reviewStatus, setReviewStatus] = (0, import_react82.useState)(
17871
17940
  initialReviewStatus || (initialHtmlUrl ? "pending_review" : "")
17872
17941
  );
17873
- const [outline, setOutline] = (0, import_react81.useState)(initialOutline);
17874
- const [theme, setTheme] = (0, import_react81.useState)(initialTheme || DEFAULT_THEME);
17875
- const [error, setError] = (0, import_react81.useState)(initialError);
17876
- const [progress, setProgress] = (0, import_react81.useState)(initialProgress);
17877
- const [showPreview, setShowPreview] = (0, import_react81.useState)(false);
17878
- const [showExport, setShowExport] = (0, import_react81.useState)(false);
17879
- const [copied, setCopied] = (0, import_react81.useState)(false);
17880
- const [approving, setApproving] = (0, import_react81.useState)(false);
17881
- const [regenerating, setRegenerating] = (0, import_react81.useState)(false);
17882
- const [approveError, setApproveError] = (0, import_react81.useState)(null);
17883
- const [headingEdits, setHeadingEdits] = (0, import_react81.useState)({});
17884
- const [approvingOutline, setApprovingOutline] = (0, import_react81.useState)(false);
17885
- const [rowBusyIndex, setRowBusyIndex] = (0, import_react81.useState)(null);
17886
- const [rowError, setRowError] = (0, import_react81.useState)(null);
17887
- const [outlineWritePollUrl, setOutlineWritePollUrl] = (0, import_react81.useState)(null);
17888
- const [regenPollUrl, setRegenPollUrl] = (0, import_react81.useState)(null);
17889
- const onCompleteRef = (0, import_react81.useRef)(onComplete);
17890
- const onFailedRef = (0, import_react81.useRef)(onFailed);
17891
- const hasNotifiedRef = (0, import_react81.useRef)(false);
17942
+ const [outline, setOutline] = (0, import_react82.useState)(initialOutline);
17943
+ const [theme, setTheme] = (0, import_react82.useState)(initialTheme || DEFAULT_THEME);
17944
+ const [error, setError] = (0, import_react82.useState)(initialError);
17945
+ const [progress, setProgress] = (0, import_react82.useState)(initialProgress);
17946
+ const [showPreview, setShowPreview] = (0, import_react82.useState)(false);
17947
+ const [showExport, setShowExport] = (0, import_react82.useState)(false);
17948
+ const [copied, setCopied] = (0, import_react82.useState)(false);
17949
+ const [approving, setApproving] = (0, import_react82.useState)(false);
17950
+ const [regenerating, setRegenerating] = (0, import_react82.useState)(false);
17951
+ const [approveError, setApproveError] = (0, import_react82.useState)(null);
17952
+ const [headingEdits, setHeadingEdits] = (0, import_react82.useState)({});
17953
+ const [approvingOutline, setApprovingOutline] = (0, import_react82.useState)(false);
17954
+ const [rowBusyIndex, setRowBusyIndex] = (0, import_react82.useState)(null);
17955
+ const [rowError, setRowError] = (0, import_react82.useState)(null);
17956
+ const [outlineWritePollUrl, setOutlineWritePollUrl] = (0, import_react82.useState)(null);
17957
+ const [regenPollUrl, setRegenPollUrl] = (0, import_react82.useState)(null);
17958
+ const onCompleteRef = (0, import_react82.useRef)(onComplete);
17959
+ const onFailedRef = (0, import_react82.useRef)(onFailed);
17960
+ const hasNotifiedRef = (0, import_react82.useRef)(false);
17892
17961
  onCompleteRef.current = onComplete;
17893
17962
  onFailedRef.current = onFailed;
17894
- (0, import_react81.useEffect)(() => {
17963
+ (0, import_react82.useEffect)(() => {
17895
17964
  const newStatus = initialStatus ?? (initialHtmlUrl ? "complete" : void 0);
17896
17965
  setStatus(newStatus);
17897
17966
  }, [initialStatus, initialHtmlUrl]);
17898
- (0, import_react81.useEffect)(() => {
17967
+ (0, import_react82.useEffect)(() => {
17899
17968
  if (initialTitle) setTitle(initialTitle);
17900
17969
  }, [initialTitle]);
17901
- (0, import_react81.useEffect)(() => {
17970
+ (0, import_react82.useEffect)(() => {
17902
17971
  if (initialHtmlUrl) setHtmlUrl(initialHtmlUrl);
17903
17972
  }, [initialHtmlUrl]);
17904
- (0, import_react81.useEffect)(() => {
17973
+ (0, import_react82.useEffect)(() => {
17905
17974
  if (initialGenerationMode) setGenerationMode(initialGenerationMode);
17906
17975
  }, [initialGenerationMode]);
17907
- (0, import_react81.useEffect)(() => {
17976
+ (0, import_react82.useEffect)(() => {
17908
17977
  if (initialTemplateId) setTemplateId(initialTemplateId);
17909
17978
  }, [initialTemplateId]);
17910
- (0, import_react81.useEffect)(() => {
17979
+ (0, import_react82.useEffect)(() => {
17911
17980
  if (initialTemplateVersionId) setTemplateVersionId(initialTemplateVersionId);
17912
17981
  }, [initialTemplateVersionId]);
17913
- (0, import_react81.useEffect)(() => {
17982
+ (0, import_react82.useEffect)(() => {
17914
17983
  if (initialReviewStatus) setReviewStatus(initialReviewStatus);
17915
17984
  }, [initialReviewStatus]);
17916
17985
  const initialOutlineSectionCount = initialOutline?.sections?.length;
17917
- (0, import_react81.useEffect)(() => {
17986
+ (0, import_react82.useEffect)(() => {
17918
17987
  if (initialOutline) setOutline(initialOutline);
17919
17988
  }, [initialOutlineSectionCount]);
17920
- (0, import_react81.useEffect)(() => {
17989
+ (0, import_react82.useEffect)(() => {
17921
17990
  if (initialDepth) setDepth(initialDepth);
17922
17991
  }, [initialDepth]);
17923
- (0, import_react81.useEffect)(() => {
17992
+ (0, import_react82.useEffect)(() => {
17924
17993
  if (initialSectionCount !== void 0) setSectionCount(initialSectionCount);
17925
17994
  }, [initialSectionCount]);
17926
- (0, import_react81.useEffect)(() => {
17995
+ (0, import_react82.useEffect)(() => {
17927
17996
  if (initialSourceCount !== void 0) setSourceCount(initialSourceCount);
17928
17997
  }, [initialSourceCount]);
17929
- (0, import_react81.useEffect)(() => {
17998
+ (0, import_react82.useEffect)(() => {
17930
17999
  if (initialWordCount !== void 0) setWordCount(initialWordCount);
17931
18000
  }, [initialWordCount]);
17932
- (0, import_react81.useEffect)(() => {
18001
+ (0, import_react82.useEffect)(() => {
17933
18002
  if (initialSummary) setSummary(initialSummary);
17934
18003
  }, [initialSummary]);
17935
18004
  const themePrimary = initialTheme?.primary;
17936
- (0, import_react81.useEffect)(() => {
18005
+ (0, import_react82.useEffect)(() => {
17937
18006
  if (initialTheme) setTheme(initialTheme);
17938
18007
  }, [themePrimary]);
17939
- (0, import_react81.useEffect)(() => {
18008
+ (0, import_react82.useEffect)(() => {
17940
18009
  if (initialError) setError(initialError);
17941
18010
  }, [initialError]);
17942
18011
  const progressPct = initialProgress?.percentage;
17943
18012
  const progressStep = initialProgress?.current_step;
17944
- (0, import_react81.useEffect)(() => {
18013
+ (0, import_react82.useEffect)(() => {
17945
18014
  if (initialProgress) setProgress(initialProgress);
17946
18015
  }, [progressPct, progressStep]);
17947
18016
  const isTerminal = status === "complete" || status === "failed";
@@ -17951,7 +18020,7 @@ var ResearchReportJobCard = (props) => {
17951
18020
  useSharedPoll(
17952
18021
  {
17953
18022
  key: !isTerminal && pollUrl ? pollUrl : null,
17954
- intervalMs: 3e3,
18023
+ intervalMs: SSE_FALLBACK_POLL_MS,
17955
18024
  fetcher: async () => {
17956
18025
  const headers = {};
17957
18026
  if (authToken) {
@@ -18007,7 +18076,7 @@ var ResearchReportJobCard = (props) => {
18007
18076
  useSharedPoll(
18008
18077
  {
18009
18078
  key: building && pollUrl ? pollUrl : null,
18010
- intervalMs: 2e3,
18079
+ intervalMs: SSE_FALLBACK_POLL_MS,
18011
18080
  fetcher: async () => {
18012
18081
  const headers = {};
18013
18082
  if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
@@ -18021,7 +18090,7 @@ var ResearchReportJobCard = (props) => {
18021
18090
  if (data.progress) setProgress(data.progress);
18022
18091
  }
18023
18092
  );
18024
- const applyRegeneratedOutput = (0, import_react81.useCallback)(
18093
+ const applyRegeneratedOutput = (0, import_react82.useCallback)(
18025
18094
  (out) => {
18026
18095
  if (out.html_url) setHtmlUrl(out.html_url);
18027
18096
  setPdfUrl(out.pdf_url || "");
@@ -18054,7 +18123,7 @@ var ResearchReportJobCard = (props) => {
18054
18123
  useSharedPoll(
18055
18124
  {
18056
18125
  key: regenPollUrl,
18057
- intervalMs: 3e3,
18126
+ intervalMs: SSE_FALLBACK_POLL_MS,
18058
18127
  fetcher: async () => {
18059
18128
  const headers = {};
18060
18129
  if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
@@ -18076,7 +18145,7 @@ var ResearchReportJobCard = (props) => {
18076
18145
  }
18077
18146
  }
18078
18147
  );
18079
- const refetchSourceAndApply = (0, import_react81.useCallback)(async () => {
18148
+ const refetchSourceAndApply = (0, import_react82.useCallback)(async () => {
18080
18149
  if (!pollUrl) return;
18081
18150
  try {
18082
18151
  const headers = {};
@@ -18109,7 +18178,7 @@ var ResearchReportJobCard = (props) => {
18109
18178
  useSharedPoll(
18110
18179
  {
18111
18180
  key: outlineWritePollUrl,
18112
- intervalMs: 3e3,
18181
+ intervalMs: SSE_FALLBACK_POLL_MS,
18113
18182
  fetcher: async () => {
18114
18183
  const headers = {};
18115
18184
  if (authToken) headers["Authorization"] = `Bearer ${authToken}`;
@@ -18131,6 +18200,16 @@ var ResearchReportJobCard = (props) => {
18131
18200
  }
18132
18201
  }
18133
18202
  );
18203
+ useJobSignal(
18204
+ (0, import_react82.useCallback)(
18205
+ (completedJobId) => {
18206
+ for (const url of [pollUrl, outlineWritePollUrl, regenPollUrl]) {
18207
+ if (url && url.includes(completedJobId)) refreshSharedPoll(url);
18208
+ }
18209
+ },
18210
+ [pollUrl, outlineWritePollUrl, regenPollUrl]
18211
+ )
18212
+ );
18134
18213
  const buildEditedOutline = () => {
18135
18214
  if (!outline || !Array.isArray(outline.sections)) return void 0;
18136
18215
  let changed = false;
@@ -18744,7 +18823,7 @@ var ResearchReportJobCard = (props) => {
18744
18823
  {
18745
18824
  src: htmlUrl,
18746
18825
  title,
18747
- sandbox: "allow-same-origin",
18826
+ sandbox: "allow-same-origin allow-scripts",
18748
18827
  className: "absolute inset-0 block h-full w-full border-0 pointer-events-none"
18749
18828
  }
18750
18829
  ),
@@ -18804,7 +18883,7 @@ var ResearchReportJobCard = (props) => {
18804
18883
  };
18805
18884
 
18806
18885
  // src/molecules/generic/WebSearchJobCard/WebSearchJobCard.tsx
18807
- var import_react82 = require("react");
18886
+ var import_react83 = require("react");
18808
18887
  var import_jsx_runtime153 = require("react/jsx-runtime");
18809
18888
  var SearchIcon = () => /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
18810
18889
  /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
@@ -18833,46 +18912,46 @@ var WebSearchJobCard = ({
18833
18912
  onFailed,
18834
18913
  compact = false
18835
18914
  }) => {
18836
- const [status, setStatus] = (0, import_react82.useState)(initialStatus);
18837
- const [query, setQuery] = (0, import_react82.useState)(initialQuery || initialTitle || "");
18838
- const [resultCount, setResultCount] = (0, import_react82.useState)(initialResultCount ?? 0);
18839
- const [searchCount, setSearchCount] = (0, import_react82.useState)(initialSearchCount ?? 0);
18840
- const [summary, setSummary] = (0, import_react82.useState)(initialSummary || "");
18841
- const [results, setResults] = (0, import_react82.useState)(initialResults || []);
18842
- const [error, setError] = (0, import_react82.useState)(initialError);
18843
- const [progress, setProgress] = (0, import_react82.useState)(initialProgress);
18844
- const onCompleteRef = (0, import_react82.useRef)(onComplete);
18845
- const onFailedRef = (0, import_react82.useRef)(onFailed);
18846
- const hasNotifiedRef = (0, import_react82.useRef)(false);
18915
+ const [status, setStatus] = (0, import_react83.useState)(initialStatus);
18916
+ const [query, setQuery] = (0, import_react83.useState)(initialQuery || initialTitle || "");
18917
+ const [resultCount, setResultCount] = (0, import_react83.useState)(initialResultCount ?? 0);
18918
+ const [searchCount, setSearchCount] = (0, import_react83.useState)(initialSearchCount ?? 0);
18919
+ const [summary, setSummary] = (0, import_react83.useState)(initialSummary || "");
18920
+ const [results, setResults] = (0, import_react83.useState)(initialResults || []);
18921
+ const [error, setError] = (0, import_react83.useState)(initialError);
18922
+ const [progress, setProgress] = (0, import_react83.useState)(initialProgress);
18923
+ const onCompleteRef = (0, import_react83.useRef)(onComplete);
18924
+ const onFailedRef = (0, import_react83.useRef)(onFailed);
18925
+ const hasNotifiedRef = (0, import_react83.useRef)(false);
18847
18926
  onCompleteRef.current = onComplete;
18848
18927
  onFailedRef.current = onFailed;
18849
- (0, import_react82.useEffect)(() => {
18928
+ (0, import_react83.useEffect)(() => {
18850
18929
  setStatus(initialStatus);
18851
18930
  }, [initialStatus]);
18852
- (0, import_react82.useEffect)(() => {
18931
+ (0, import_react83.useEffect)(() => {
18853
18932
  if (initialQuery) setQuery(initialQuery);
18854
18933
  }, [initialQuery]);
18855
- (0, import_react82.useEffect)(() => {
18934
+ (0, import_react83.useEffect)(() => {
18856
18935
  if (initialTitle && !initialQuery) setQuery(initialTitle);
18857
18936
  }, [initialTitle, initialQuery]);
18858
- (0, import_react82.useEffect)(() => {
18937
+ (0, import_react83.useEffect)(() => {
18859
18938
  if (initialResultCount !== void 0) setResultCount(initialResultCount);
18860
18939
  }, [initialResultCount]);
18861
- (0, import_react82.useEffect)(() => {
18940
+ (0, import_react83.useEffect)(() => {
18862
18941
  if (initialSearchCount !== void 0) setSearchCount(initialSearchCount);
18863
18942
  }, [initialSearchCount]);
18864
- (0, import_react82.useEffect)(() => {
18943
+ (0, import_react83.useEffect)(() => {
18865
18944
  if (initialSummary) setSummary(initialSummary);
18866
18945
  }, [initialSummary]);
18867
- (0, import_react82.useEffect)(() => {
18946
+ (0, import_react83.useEffect)(() => {
18868
18947
  if (initialResults) setResults(initialResults);
18869
18948
  }, [initialResults]);
18870
- (0, import_react82.useEffect)(() => {
18949
+ (0, import_react83.useEffect)(() => {
18871
18950
  if (initialError) setError(initialError);
18872
18951
  }, [initialError]);
18873
18952
  const progressPct = initialProgress?.percentage;
18874
18953
  const progressStep = initialProgress?.current_step;
18875
- (0, import_react82.useEffect)(() => {
18954
+ (0, import_react83.useEffect)(() => {
18876
18955
  if (initialProgress) setProgress(initialProgress);
18877
18956
  }, [progressPct, progressStep]);
18878
18957
  const isTerminal = status === "complete" || status === "failed";
@@ -19057,10 +19136,10 @@ var WebSearchJobCard = ({
19057
19136
  };
19058
19137
 
19059
19138
  // src/molecules/creator-discovery/CampaignSeedCard/CampaignSeedCard.tsx
19060
- var import_react84 = __toESM(require("react"), 1);
19139
+ var import_react85 = __toESM(require("react"), 1);
19061
19140
 
19062
19141
  // src/molecules/creator-discovery/SearchSpecCard/CustomFieldRenderers.tsx
19063
- var import_react83 = require("react");
19142
+ var import_react84 = require("react");
19064
19143
 
19065
19144
  // src/lib/countries.ts
19066
19145
  var countries = [
@@ -19272,10 +19351,10 @@ var CountrySelectEdit = ({
19272
19351
  value,
19273
19352
  onChange
19274
19353
  }) => {
19275
- const [isDropdownOpen, setIsDropdownOpen] = (0, import_react83.useState)(false);
19276
- const [searchTerm, setSearchTerm] = (0, import_react83.useState)("");
19277
- const dropdownRef = (0, import_react83.useRef)(null);
19278
- (0, import_react83.useEffect)(() => {
19354
+ const [isDropdownOpen, setIsDropdownOpen] = (0, import_react84.useState)(false);
19355
+ const [searchTerm, setSearchTerm] = (0, import_react84.useState)("");
19356
+ const dropdownRef = (0, import_react84.useRef)(null);
19357
+ (0, import_react84.useEffect)(() => {
19279
19358
  const handleClickOutside = (event) => {
19280
19359
  if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
19281
19360
  setIsDropdownOpen(false);
@@ -19284,7 +19363,7 @@ var CountrySelectEdit = ({
19284
19363
  document.addEventListener("mousedown", handleClickOutside);
19285
19364
  return () => document.removeEventListener("mousedown", handleClickOutside);
19286
19365
  }, []);
19287
- const inputValue = (0, import_react83.useMemo)(() => {
19366
+ const inputValue = (0, import_react84.useMemo)(() => {
19288
19367
  if (Array.isArray(value)) return value;
19289
19368
  if (typeof value === "string" && value.trim() !== "") {
19290
19369
  const foundCountry = countries.find(
@@ -19385,7 +19464,7 @@ var CountrySelectEdit = ({
19385
19464
  ] });
19386
19465
  };
19387
19466
  var CountrySelectDisplay = ({ value }) => {
19388
- const displayValues = (0, import_react83.useMemo)(() => {
19467
+ const displayValues = (0, import_react84.useMemo)(() => {
19389
19468
  if (Array.isArray(value)) return value;
19390
19469
  if (typeof value === "string" && value.trim() !== "") return [value];
19391
19470
  return [];
@@ -19561,7 +19640,7 @@ var PlatformSelectEdit = ({
19561
19640
  value,
19562
19641
  onChange
19563
19642
  }) => {
19564
- const selectedPlatforms = (0, import_react83.useMemo)(() => {
19643
+ const selectedPlatforms = (0, import_react84.useMemo)(() => {
19565
19644
  if (Array.isArray(value)) return value;
19566
19645
  if (typeof value === "string" && value.trim() !== "") {
19567
19646
  return value.split(",").map((s) => s.trim()).filter(Boolean);
@@ -19580,7 +19659,7 @@ var PlatformSelectEdit = ({
19580
19659
  onChange([...selectedPlatforms, platform]);
19581
19660
  }
19582
19661
  };
19583
- const options = (0, import_react83.useMemo)(() => {
19662
+ const options = (0, import_react84.useMemo)(() => {
19584
19663
  return DEFAULT_PLATFORMS;
19585
19664
  }, []);
19586
19665
  return /* @__PURE__ */ (0, import_jsx_runtime154.jsx)("div", { className: "flex flex-wrap gap-4 py-2", children: options.map((platform) => /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(
@@ -19606,7 +19685,7 @@ var PlatformSelectEdit = ({
19606
19685
  )) });
19607
19686
  };
19608
19687
  var PlatformSelectDisplay = ({ value }) => {
19609
- const displayValues = (0, import_react83.useMemo)(() => {
19688
+ const displayValues = (0, import_react84.useMemo)(() => {
19610
19689
  if (Array.isArray(value)) return value;
19611
19690
  if (typeof value === "string" && value.trim() !== "") {
19612
19691
  return value.split(",").map((s) => s.trim()).filter(Boolean);
@@ -19766,7 +19845,7 @@ function buildCampaignSeedFields(data) {
19766
19845
  return generated;
19767
19846
  });
19768
19847
  }
19769
- var CampaignSeedCard = import_react84.default.memo(
19848
+ var CampaignSeedCard = import_react85.default.memo(
19770
19849
  ({
19771
19850
  selectionStatus,
19772
19851
  isLatestMessage = true,
@@ -19778,7 +19857,7 @@ var CampaignSeedCard = import_react84.default.memo(
19778
19857
  sendMessage,
19779
19858
  ...formCardProps
19780
19859
  }) => {
19781
- const fields = (0, import_react84.useMemo)(() => {
19860
+ const fields = (0, import_react85.useMemo)(() => {
19782
19861
  return providedFields || buildCampaignSeedFields(data);
19783
19862
  }, [providedFields, data]);
19784
19863
  const handleProceed = () => {
@@ -19812,7 +19891,7 @@ var CampaignSeedCard = import_react84.default.memo(
19812
19891
  CampaignSeedCard.displayName = "CampaignSeedCard";
19813
19892
 
19814
19893
  // src/molecules/creator-discovery/SearchSpecCard/SearchSpecCard.tsx
19815
- var import_react85 = __toESM(require("react"), 1);
19894
+ var import_react86 = __toESM(require("react"), 1);
19816
19895
  var import_jsx_runtime156 = require("react/jsx-runtime");
19817
19896
  var ObjectDisplay2 = ({ value }) => {
19818
19897
  if (!value || typeof value !== "object") return null;
@@ -19928,7 +20007,7 @@ function buildSearchSpecFields(data) {
19928
20007
  return generated;
19929
20008
  });
19930
20009
  }
19931
- var SearchSpecCard = import_react85.default.memo(
20010
+ var SearchSpecCard = import_react86.default.memo(
19932
20011
  ({
19933
20012
  selectionStatus,
19934
20013
  isLatestMessage = true,
@@ -19942,7 +20021,7 @@ var SearchSpecCard = import_react85.default.memo(
19942
20021
  ...formCardProps
19943
20022
  }) => {
19944
20023
  const resolvedData = data || specData;
19945
- const fields = (0, import_react85.useMemo)(() => {
20024
+ const fields = (0, import_react86.useMemo)(() => {
19946
20025
  return providedFields || buildSearchSpecFields(resolvedData ?? {});
19947
20026
  }, [providedFields, resolvedData]);
19948
20027
  const handleProceed = () => {
@@ -19978,7 +20057,7 @@ var SearchSpecCard = import_react85.default.memo(
19978
20057
  SearchSpecCard.displayName = "SearchSpecCard";
19979
20058
 
19980
20059
  // src/molecules/creator-discovery/MCQCard/MCQCard.tsx
19981
- var import_react86 = __toESM(require("react"), 1);
20060
+ var import_react87 = __toESM(require("react"), 1);
19982
20061
 
19983
20062
  // src/lib/auth-provider.ts
19984
20063
  var _provider = null;
@@ -20148,7 +20227,7 @@ function inferSelectionLimits(text, optionCount) {
20148
20227
  }
20149
20228
  return null;
20150
20229
  }
20151
- var MCQCard = import_react86.default.memo(
20230
+ var MCQCard = import_react87.default.memo(
20152
20231
  ({
20153
20232
  question,
20154
20233
  options,
@@ -20206,12 +20285,12 @@ var MCQCard = import_react86.default.memo(
20206
20285
  if (propsSelectedOption) return [propsSelectedOption];
20207
20286
  return [];
20208
20287
  };
20209
- const [selectedKeys, setSelectedKeys] = import_react86.default.useState(seedSelection);
20210
- const [isProceeded, setIsProceeded] = import_react86.default.useState(
20288
+ const [selectedKeys, setSelectedKeys] = import_react87.default.useState(seedSelection);
20289
+ const [isProceeded, setIsProceeded] = import_react87.default.useState(
20211
20290
  Boolean(propsSelectedOption || propsSelectedOptions && propsSelectedOptions.length)
20212
20291
  );
20213
- const fetchedSessionRef = import_react86.default.useRef("");
20214
- import_react86.default.useEffect(() => {
20292
+ const fetchedSessionRef = import_react87.default.useRef("");
20293
+ import_react87.default.useEffect(() => {
20215
20294
  if (propsSelectedOption) {
20216
20295
  setSelectedKeys([propsSelectedOption]);
20217
20296
  setIsProceeded(true);
@@ -20220,7 +20299,7 @@ var MCQCard = import_react86.default.memo(
20220
20299
  setIsProceeded(true);
20221
20300
  }
20222
20301
  }, [propsSelectedOption, propsSelectedOptions]);
20223
- const buildQuestionKey = import_react86.default.useCallback((sid, q) => {
20302
+ const buildQuestionKey = import_react87.default.useCallback((sid, q) => {
20224
20303
  let hash = 2166136261;
20225
20304
  for (let i = 0; i < q.length; i++) {
20226
20305
  hash ^= q.charCodeAt(i);
@@ -20228,7 +20307,7 @@ var MCQCard = import_react86.default.memo(
20228
20307
  }
20229
20308
  return `mcq_${sid}_${hash.toString(36)}`;
20230
20309
  }, []);
20231
- import_react86.default.useEffect(() => {
20310
+ import_react87.default.useEffect(() => {
20232
20311
  if (!sessionId || !resolvedQuestion) return;
20233
20312
  const fetchKey = `${sessionId}::${resolvedQuestion}`;
20234
20313
  if (fetchedSessionRef.current === fetchKey) return;
@@ -20900,9 +20979,9 @@ var CreatorActionHeader = ({
20900
20979
  };
20901
20980
 
20902
20981
  // src/molecules/creator-discovery/CreatorSearchBox/CreatorSearch.tsx
20903
- var import_react87 = __toESM(require("react"), 1);
20982
+ var import_react88 = __toESM(require("react"), 1);
20904
20983
  var import_jsx_runtime168 = require("react/jsx-runtime");
20905
- var CreatorSearch = import_react87.default.memo(
20984
+ var CreatorSearch = import_react88.default.memo(
20906
20985
  ({
20907
20986
  selectionStatus,
20908
20987
  isLatestMessage = true,
@@ -20911,7 +20990,7 @@ var CreatorSearch = import_react87.default.memo(
20911
20990
  data,
20912
20991
  ...formCardProps
20913
20992
  }) => {
20914
- const fields = (0, import_react87.useMemo)(() => {
20993
+ const fields = (0, import_react88.useMemo)(() => {
20915
20994
  const baseFields = providedFields || generateFieldsFromData(data);
20916
20995
  return baseFields.map((field) => {
20917
20996
  if (field.key === "platforms") {
@@ -20991,10 +21070,10 @@ var CreatorSearch = import_react87.default.memo(
20991
21070
  CreatorSearch.displayName = "CreatorSearch";
20992
21071
 
20993
21072
  // src/molecules/creator-discovery/CampaignConceptCard/CampaignConceptCard.tsx
20994
- var import_react88 = __toESM(require("react"), 1);
21073
+ var import_react89 = __toESM(require("react"), 1);
20995
21074
  var import_framer_motion = require("framer-motion");
20996
21075
  var import_jsx_runtime169 = require("react/jsx-runtime");
20997
- var CampaignConceptCard = import_react88.default.memo(
21076
+ var CampaignConceptCard = import_react89.default.memo(
20998
21077
  ({
20999
21078
  index,
21000
21079
  isRecommended,
@@ -21010,7 +21089,7 @@ var CampaignConceptCard = import_react88.default.memo(
21010
21089
  onAction,
21011
21090
  ...formCardProps
21012
21091
  }) => {
21013
- const [internalIsOpen, setInternalIsOpen] = (0, import_react88.useState)(false);
21092
+ const [internalIsOpen, setInternalIsOpen] = (0, import_react89.useState)(false);
21014
21093
  const isOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalIsOpen;
21015
21094
  const handleToggle = () => {
21016
21095
  if (onToggle) {
@@ -21029,7 +21108,7 @@ var CampaignConceptCard = import_react88.default.memo(
21029
21108
  });
21030
21109
  };
21031
21110
  const effectiveIsLatest = isLatestMessage && !hasUserResponded;
21032
- const fields = (0, import_react88.useMemo)(() => {
21111
+ const fields = (0, import_react89.useMemo)(() => {
21033
21112
  const baseFields = providedFields || generateFieldsFromData(data);
21034
21113
  const FIELD_ORDER = [
21035
21114
  "description",
@@ -21341,14 +21420,14 @@ var CampaignConceptCard = import_react88.default.memo(
21341
21420
  CampaignConceptCard.displayName = "CampaignConceptCard";
21342
21421
 
21343
21422
  // src/molecules/creator-discovery/CreatorWidget/CreatorWidget.tsx
21344
- var import_react96 = require("react");
21423
+ var import_react97 = require("react");
21345
21424
 
21346
21425
  // src/molecules/creator-discovery/CreatorWidget/CreatorImageList.tsx
21347
- var import_react89 = require("react");
21426
+ var import_react90 = require("react");
21348
21427
  var import_jsx_runtime170 = require("react/jsx-runtime");
21349
21428
  function useMediaQuery(query) {
21350
- const [matches, setMatches] = (0, import_react89.useState)(false);
21351
- (0, import_react89.useEffect)(() => {
21429
+ const [matches, setMatches] = (0, import_react90.useState)(false);
21430
+ (0, import_react90.useEffect)(() => {
21352
21431
  const media = window.matchMedia(query);
21353
21432
  const listener = () => setMatches(media.matches);
21354
21433
  listener();
@@ -21431,7 +21510,7 @@ function CreatorImageList({
21431
21510
  }
21432
21511
 
21433
21512
  // src/molecules/creator-discovery/CreatorWidget/CreatorProgressBar.tsx
21434
- var import_react90 = require("react");
21513
+ var import_react91 = require("react");
21435
21514
  var import_framer_motion2 = require("framer-motion");
21436
21515
  var import_jsx_runtime171 = require("react/jsx-runtime");
21437
21516
  function truncateName(name, maxLength) {
@@ -21439,8 +21518,8 @@ function truncateName(name, maxLength) {
21439
21518
  return name.substring(0, maxLength) + "...";
21440
21519
  }
21441
21520
  function ProgressBar({ overallPercentage }) {
21442
- const [showTooltip, setShowTooltip] = (0, import_react90.useState)(true);
21443
- (0, import_react90.useEffect)(() => {
21521
+ const [showTooltip, setShowTooltip] = (0, import_react91.useState)(true);
21522
+ (0, import_react91.useEffect)(() => {
21444
21523
  if (overallPercentage && overallPercentage >= 100) {
21445
21524
  setShowTooltip(false);
21446
21525
  }
@@ -21601,8 +21680,8 @@ function CreatorCompactView({
21601
21680
  }
21602
21681
 
21603
21682
  // src/molecules/creator-discovery/CreatorWidget/CreatorExpandedPanel.tsx
21604
- var import_react94 = require("react");
21605
- var import_react_dom2 = __toESM(require("react-dom"), 1);
21683
+ var import_react95 = require("react");
21684
+ var import_react_dom3 = __toESM(require("react-dom"), 1);
21606
21685
  var import_framer_motion5 = require("framer-motion");
21607
21686
 
21608
21687
  // src/molecules/creator-discovery/CreatorWidget/defaultFetchers.ts
@@ -22075,7 +22154,7 @@ function getPlatformIconColor(platform) {
22075
22154
  }
22076
22155
 
22077
22156
  // src/molecules/creator-discovery/CreatorWidget/PostCard.tsx
22078
- var import_react91 = require("react");
22157
+ var import_react92 = require("react");
22079
22158
  var import_jsx_runtime176 = require("react/jsx-runtime");
22080
22159
  var formatFollowerCount = (count) => {
22081
22160
  if (count >= 1e6) {
@@ -22089,8 +22168,8 @@ var formatFollowerCount = (count) => {
22089
22168
  return Math.floor(count).toString();
22090
22169
  };
22091
22170
  function PostCard({ post, platformUsername }) {
22092
- const [expanded, setExpanded] = (0, import_react91.useState)(false);
22093
- const [errored, setErrored] = (0, import_react91.useState)(false);
22171
+ const [expanded, setExpanded] = (0, import_react92.useState)(false);
22172
+ const [errored, setErrored] = (0, import_react92.useState)(false);
22094
22173
  const thumbnail = post.thumbnail_url || post.thumbnail || post.image || "";
22095
22174
  const likes = post.engagement?.likes ?? post.likes ?? null;
22096
22175
  const comments = post.engagement?.comments ?? post.comments ?? null;
@@ -22300,8 +22379,8 @@ function PlatformPostsSection({
22300
22379
  }
22301
22380
 
22302
22381
  // src/molecules/creator-discovery/CreatorWidget/BrandCollaborationsList.tsx
22303
- var import_react92 = require("react");
22304
- var import_react_dom = __toESM(require("react-dom"), 1);
22382
+ var import_react93 = require("react");
22383
+ var import_react_dom2 = __toESM(require("react-dom"), 1);
22305
22384
  var import_framer_motion3 = require("framer-motion");
22306
22385
  var import_jsx_runtime178 = require("react/jsx-runtime");
22307
22386
  var getSentimentRank = (score) => {
@@ -22347,7 +22426,7 @@ function BrandMentionDetails({
22347
22426
  (m) => m.normalizedBrand?.toLowerCase() === selectedBrand?.toLowerCase() || m.brand?.toLowerCase() === selectedBrand?.toLowerCase()
22348
22427
  ) || [];
22349
22428
  if (typeof window === "undefined") return null;
22350
- return import_react_dom.default.createPortal(
22429
+ return import_react_dom2.default.createPortal(
22351
22430
  /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(import_framer_motion3.AnimatePresence, { mode: "sync", children: open && /* @__PURE__ */ (0, import_jsx_runtime178.jsxs)(import_jsx_runtime178.Fragment, { children: [
22352
22431
  /* @__PURE__ */ (0, import_jsx_runtime178.jsx)(
22353
22432
  import_framer_motion3.motion.div,
@@ -22502,8 +22581,8 @@ function BrandMentionDetails({
22502
22581
  function BrandCollaborationsList({
22503
22582
  brandBreakdown
22504
22583
  }) {
22505
- const [openDetails, setOpenDetails] = (0, import_react92.useState)(false);
22506
- const [selectedBrand, setSelectedBrand] = (0, import_react92.useState)("");
22584
+ const [openDetails, setOpenDetails] = (0, import_react93.useState)(false);
22585
+ const [selectedBrand, setSelectedBrand] = (0, import_react93.useState)("");
22507
22586
  if (!brandBreakdown?.insights?.brandBreakdown || brandBreakdown.insights.brandBreakdown.length === 0) {
22508
22587
  return null;
22509
22588
  }
@@ -22562,7 +22641,7 @@ function BrandCollaborationsList({
22562
22641
  }
22563
22642
 
22564
22643
  // src/molecules/creator-discovery/CreatorWidget/CreatorGridView.tsx
22565
- var import_react93 = require("react");
22644
+ var import_react94 = require("react");
22566
22645
  var import_framer_motion4 = require("framer-motion");
22567
22646
  var import_jsx_runtime179 = require("react/jsx-runtime");
22568
22647
  var formatFollowerCount3 = (count) => {
@@ -22611,25 +22690,25 @@ var itemsExplanation = [
22611
22690
  { key: "brandSafety", label: "Brand Safety" }
22612
22691
  ];
22613
22692
  function CreatorGridViewCard({ creator }) {
22614
- const [isExpanded, setIsExpanded] = (0, import_react93.useState)(false);
22615
- const [showFullDescription, setShowFullDescription] = (0, import_react93.useState)(false);
22616
- const [isDescriptionOverflowing, setIsDescriptionOverflowing] = (0, import_react93.useState)(false);
22617
- const descriptionRef = (0, import_react93.useRef)(null);
22618
- const cardRef = (0, import_react93.useRef)(null);
22619
- const checkDescriptionOverflow = (0, import_react93.useCallback)(() => {
22693
+ const [isExpanded, setIsExpanded] = (0, import_react94.useState)(false);
22694
+ const [showFullDescription, setShowFullDescription] = (0, import_react94.useState)(false);
22695
+ const [isDescriptionOverflowing, setIsDescriptionOverflowing] = (0, import_react94.useState)(false);
22696
+ const descriptionRef = (0, import_react94.useRef)(null);
22697
+ const cardRef = (0, import_react94.useRef)(null);
22698
+ const checkDescriptionOverflow = (0, import_react94.useCallback)(() => {
22620
22699
  const el = descriptionRef.current;
22621
22700
  if (!el) return;
22622
22701
  setIsDescriptionOverflowing(el.scrollHeight > el.clientHeight + 1);
22623
22702
  }, []);
22624
- (0, import_react93.useEffect)(() => {
22703
+ (0, import_react94.useEffect)(() => {
22625
22704
  checkDescriptionOverflow();
22626
22705
  }, [checkDescriptionOverflow, isExpanded, showFullDescription]);
22627
- (0, import_react93.useEffect)(() => {
22706
+ (0, import_react94.useEffect)(() => {
22628
22707
  const onResize = () => checkDescriptionOverflow();
22629
22708
  window.addEventListener("resize", onResize);
22630
22709
  return () => window.removeEventListener("resize", onResize);
22631
22710
  }, [checkDescriptionOverflow]);
22632
- const platformStats = (0, import_react93.useMemo)(() => {
22711
+ const platformStats = (0, import_react94.useMemo)(() => {
22633
22712
  return [
22634
22713
  {
22635
22714
  platform: "instagram",
@@ -23058,7 +23137,7 @@ function BrandMentionPerformance({ creator }) {
23058
23137
  ] });
23059
23138
  }
23060
23139
  function CreatorFitSummary({ creator, showBrandPerformance }) {
23061
- const [contentExpanded, setContentExpanded] = (0, import_react94.useState)(false);
23140
+ const [contentExpanded, setContentExpanded] = (0, import_react95.useState)(false);
23062
23141
  const hasDeepAnalysis = creator?.sentiment?.deepAnalysis?.deepAnalysis;
23063
23142
  const title = hasDeepAnalysis ? "CREATOR DEEP ANALYSIS" : "CREATOR FIT SUMMARY";
23064
23143
  const content = hasDeepAnalysis ? creator.sentiment.deepAnalysis.deepAnalysis : creator?.sentiment?.aiReasoning || "No data available.";
@@ -23078,7 +23157,7 @@ function CreatorFitSummary({ creator, showBrandPerformance }) {
23078
23157
  ] });
23079
23158
  }
23080
23159
  function ProfileSection({ creator, isValidationComplete }) {
23081
- const [descriptionExpanded, setDescriptionExpanded] = (0, import_react94.useState)(false);
23160
+ const [descriptionExpanded, setDescriptionExpanded] = (0, import_react95.useState)(false);
23082
23161
  const username = creator.platformMetrics?.instagramMetrics?.username ? `@${creator.platformMetrics.instagramMetrics.username}` : creator.platformMetrics?.youtubeMetrics?.channelName ? `@${creator.platformMetrics.youtubeMetrics.channelName}` : creator.platformMetrics?.tiktokMetrics?.username ? `@${creator.platformMetrics.tiktokMetrics.username}` : "";
23083
23162
  const iso2 = normalizeToIso2(creator.country);
23084
23163
  const meta = codeToMeta[iso2];
@@ -23168,7 +23247,7 @@ function CreatorCard({
23168
23247
  creator,
23169
23248
  isValidationComplete
23170
23249
  }) {
23171
- const [detailsExpanded, setDetailsExpanded] = (0, import_react94.useState)(false);
23250
+ const [detailsExpanded, setDetailsExpanded] = (0, import_react95.useState)(false);
23172
23251
  const hasValidBrandMention = (() => {
23173
23252
  const insights = creator?.brandCollaborations?.insights;
23174
23253
  if (!insights) return false;
@@ -23210,7 +23289,7 @@ function CreatorDisplay({
23210
23289
  creators,
23211
23290
  isValidationComplete
23212
23291
  }) {
23213
- const [viewMode, setViewMode] = (0, import_react94.useState)("list");
23292
+ const [viewMode, setViewMode] = (0, import_react95.useState)("list");
23214
23293
  return /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("div", { className: "px-4", children: [
23215
23294
  /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("div", { className: "flex justify-end items-center my-3 gap-1", children: [
23216
23295
  /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)("span", { className: "text-xs text-gray600 mr-2", children: [
@@ -23301,10 +23380,10 @@ function CreatorExpandedPanel({
23301
23380
  searchSpec,
23302
23381
  fetchCreatorDetails
23303
23382
  }) {
23304
- const [creators, setCreators] = (0, import_react94.useState)([]);
23305
- const [loading, setLoading] = (0, import_react94.useState)(false);
23383
+ const [creators, setCreators] = (0, import_react95.useState)([]);
23384
+ const [loading, setLoading] = (0, import_react95.useState)(false);
23306
23385
  const fetcher = fetchCreatorDetails ?? defaultFetchCreatorDetails;
23307
- const loadCreators = (0, import_react94.useCallback)(async () => {
23386
+ const loadCreators = (0, import_react95.useCallback)(async () => {
23308
23387
  if (!creatorIds.length) return;
23309
23388
  setLoading(true);
23310
23389
  try {
@@ -23316,13 +23395,13 @@ function CreatorExpandedPanel({
23316
23395
  setLoading(false);
23317
23396
  }
23318
23397
  }, [creatorIds, sessionId, version, fetcher]);
23319
- (0, import_react94.useEffect)(() => {
23398
+ (0, import_react95.useEffect)(() => {
23320
23399
  if (isOpen && creatorIds.length > 0) {
23321
23400
  loadCreators();
23322
23401
  }
23323
23402
  }, [isOpen, loadCreators]);
23324
23403
  if (typeof window === "undefined") return null;
23325
- return import_react_dom2.default.createPortal(
23404
+ return import_react_dom3.default.createPortal(
23326
23405
  /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_framer_motion5.AnimatePresence, { mode: "sync", children: isOpen && /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(import_jsx_runtime180.Fragment, { children: [
23327
23406
  /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(
23328
23407
  import_framer_motion5.motion.div,
@@ -23370,7 +23449,7 @@ function CreatorExpandedPanel({
23370
23449
  }
23371
23450
 
23372
23451
  // src/molecules/creator-discovery/CreatorWidget/useCreatorWidgetPolling.ts
23373
- var import_react95 = require("react");
23452
+ var import_react96 = require("react");
23374
23453
  var DEFAULT_POLLING_CONFIG = {
23375
23454
  pollInterval: 5e3,
23376
23455
  maxDuration: 15 * 60 * 1e3,
@@ -23401,11 +23480,11 @@ function useCreatorWidgetPolling({
23401
23480
  }) {
23402
23481
  const fetchVersions = fetchVersionsProp ?? defaultFetchVersions;
23403
23482
  const fetchStatus = fetchStatusProp ?? defaultFetchStatus;
23404
- const config = (0, import_react95.useMemo)(
23483
+ const config = (0, import_react96.useMemo)(
23405
23484
  () => ({ ...DEFAULT_POLLING_CONFIG, ...pollingConfig }),
23406
23485
  [pollingConfig]
23407
23486
  );
23408
- const hydrated = (0, import_react95.useMemo)(() => {
23487
+ const hydrated = (0, import_react96.useMemo)(() => {
23409
23488
  if (!sessionId) {
23410
23489
  return {
23411
23490
  versionData: null,
@@ -23427,33 +23506,33 @@ function useCreatorWidgetPolling({
23427
23506
  }, [sessionId, currentVersion]);
23428
23507
  const hydratedStatus = hydrated.statusPayload?.status?.status;
23429
23508
  const hydratedTerminal = isTerminalStatus(hydratedStatus);
23430
- const [versionData, setVersionData] = (0, import_react95.useState)(
23509
+ const [versionData, setVersionData] = (0, import_react96.useState)(
23431
23510
  hydrated.versionData
23432
23511
  );
23433
- const [totalVersions, setTotalVersions] = (0, import_react95.useState)(
23512
+ const [totalVersions, setTotalVersions] = (0, import_react96.useState)(
23434
23513
  hydrated.versionData?.totalVersions || 0
23435
23514
  );
23436
- const [selectedVersion, setSelectedVersion] = (0, import_react95.useState)();
23437
- const [isLoadingVersion, setIsLoadingVersion] = (0, import_react95.useState)(!hydrated.versionData);
23438
- const [isValidationComplete, setIsValidationComplete] = (0, import_react95.useState)(
23515
+ const [selectedVersion, setSelectedVersion] = (0, import_react96.useState)();
23516
+ const [isLoadingVersion, setIsLoadingVersion] = (0, import_react96.useState)(!hydrated.versionData);
23517
+ const [isValidationComplete, setIsValidationComplete] = (0, import_react96.useState)(
23439
23518
  hydratedTerminal && hydratedStatus !== "failed"
23440
23519
  );
23441
- const [versionStatus, setVersionStatus] = (0, import_react95.useState)(
23520
+ const [versionStatus, setVersionStatus] = (0, import_react96.useState)(
23442
23521
  hydratedStatus || (hydrated.versionData ? "in-progress" : "checking")
23443
23522
  );
23444
- const [statusDetails, setStatusDetails] = (0, import_react95.useState)(
23523
+ const [statusDetails, setStatusDetails] = (0, import_react96.useState)(
23445
23524
  hydrated.statusPayload?.status
23446
23525
  );
23447
- const [timeDisplay, setTimeDisplay] = (0, import_react95.useState)("");
23448
- const [loadingStatus, setLoadingStatus] = (0, import_react95.useState)(
23526
+ const [timeDisplay, setTimeDisplay] = (0, import_react96.useState)("");
23527
+ const [loadingStatus, setLoadingStatus] = (0, import_react96.useState)(
23449
23528
  !(hydrated.versionData && hydratedTerminal)
23450
23529
  );
23451
- const remainingTimeRef = (0, import_react95.useRef)(0);
23452
- const countdownRef = (0, import_react95.useRef)(null);
23453
- const versionDataRef = (0, import_react95.useRef)(versionData);
23530
+ const remainingTimeRef = (0, import_react96.useRef)(0);
23531
+ const countdownRef = (0, import_react96.useRef)(null);
23532
+ const versionDataRef = (0, import_react96.useRef)(versionData);
23454
23533
  versionDataRef.current = versionData;
23455
23534
  const requestedVersion = selectedVersion ?? currentVersion ?? versionData?.currentVersion;
23456
- const updateStatus = (0, import_react95.useCallback)(
23535
+ const updateStatus = (0, import_react96.useCallback)(
23457
23536
  (status) => {
23458
23537
  setVersionStatus(status);
23459
23538
  onStatusChange?.(status);
@@ -23491,17 +23570,17 @@ function useCreatorWidgetPolling({
23491
23570
  );
23492
23571
  const activeVersion = selectedVersion ?? requestedVersion;
23493
23572
  const statusKey = sessionId && activeVersion != null ? statusPollKey(sessionId, activeVersion) : null;
23494
- const errorCountRef = (0, import_react95.useRef)(0);
23495
- const deadlineRef = (0, import_react95.useRef)(0);
23496
- const doneRef = (0, import_react95.useRef)(hydratedTerminal);
23497
- const stopCountdown = (0, import_react95.useCallback)(() => {
23573
+ const errorCountRef = (0, import_react96.useRef)(0);
23574
+ const deadlineRef = (0, import_react96.useRef)(0);
23575
+ const doneRef = (0, import_react96.useRef)(hydratedTerminal);
23576
+ const stopCountdown = (0, import_react96.useCallback)(() => {
23498
23577
  if (countdownRef.current) {
23499
23578
  clearInterval(countdownRef.current);
23500
23579
  countdownRef.current = null;
23501
23580
  }
23502
23581
  setTimeDisplay("");
23503
23582
  }, []);
23504
- (0, import_react95.useEffect)(() => {
23583
+ (0, import_react96.useEffect)(() => {
23505
23584
  if (statusKey == null) return;
23506
23585
  const cached = getSharedPollLastData(statusKey);
23507
23586
  const cachedStatus = cached?.status?.status;
@@ -23582,7 +23661,7 @@ function useCreatorWidgetPolling({
23582
23661
  setLoadingStatus(false);
23583
23662
  }
23584
23663
  );
23585
- const versionNumbers = (0, import_react95.useMemo)(() => {
23664
+ const versionNumbers = (0, import_react96.useMemo)(() => {
23586
23665
  if (!totalVersions) return [];
23587
23666
  return Array.from({ length: totalVersions }, (_, i) => i + 1);
23588
23667
  }, [totalVersions]);
@@ -23622,7 +23701,7 @@ function CreatorWidgetInner({
23622
23701
  onAction,
23623
23702
  className
23624
23703
  }) {
23625
- const [isExpanded, setIsExpanded] = (0, import_react96.useState)(false);
23704
+ const [isExpanded, setIsExpanded] = (0, import_react97.useState)(false);
23626
23705
  const {
23627
23706
  versionNumbers,
23628
23707
  selectedVersion,
@@ -23643,11 +23722,11 @@ function CreatorWidgetInner({
23643
23722
  pollingConfig,
23644
23723
  onStatusChange
23645
23724
  });
23646
- const handleVersionSelect = (0, import_react96.useCallback)(
23725
+ const handleVersionSelect = (0, import_react97.useCallback)(
23647
23726
  (version) => setSelectedVersion(version),
23648
23727
  [setSelectedVersion]
23649
23728
  );
23650
- const handleViewCreators = (0, import_react96.useCallback)(() => {
23729
+ const handleViewCreators = (0, import_react97.useCallback)(() => {
23651
23730
  setIsExpanded(true);
23652
23731
  onAction?.({
23653
23732
  type: "view-creators",
@@ -23688,10 +23767,10 @@ function CreatorWidgetInner({
23688
23767
  )
23689
23768
  ] });
23690
23769
  }
23691
- var CreatorWidget = (0, import_react96.memo)(CreatorWidgetInner);
23770
+ var CreatorWidget = (0, import_react97.memo)(CreatorWidgetInner);
23692
23771
 
23693
23772
  // src/molecules/analytics/AnalyticsChart.tsx
23694
- var import_react97 = require("react");
23773
+ var import_react98 = require("react");
23695
23774
 
23696
23775
  // src/molecules/analytics/buildOptions.ts
23697
23776
  function deepMerge(base, override) {
@@ -24023,13 +24102,13 @@ function AnalyticsChart({
24023
24102
  loading: loadingProp,
24024
24103
  error: errorProp
24025
24104
  }) {
24026
- const [mounted, setMounted] = (0, import_react97.useState)(false);
24027
- const [fetchedConfig, setFetchedConfig] = (0, import_react97.useState)(null);
24028
- const [fetching, setFetching] = (0, import_react97.useState)(false);
24029
- const [fetchError, setFetchError] = (0, import_react97.useState)(null);
24030
- const containerRef = (0, import_react97.useRef)(null);
24031
- const chartRef = (0, import_react97.useRef)(null);
24032
- const declarative = (0, import_react97.useMemo)(
24105
+ const [mounted, setMounted] = (0, import_react98.useState)(false);
24106
+ const [fetchedConfig, setFetchedConfig] = (0, import_react98.useState)(null);
24107
+ const [fetching, setFetching] = (0, import_react98.useState)(false);
24108
+ const [fetchError, setFetchError] = (0, import_react98.useState)(null);
24109
+ const containerRef = (0, import_react98.useRef)(null);
24110
+ const chartRef = (0, import_react98.useRef)(null);
24111
+ const declarative = (0, import_react98.useMemo)(
24033
24112
  () => resolveDeclarativeConfig({
24034
24113
  chartConfig,
24035
24114
  chartType,
@@ -24063,16 +24142,16 @@ function AnalyticsChart({
24063
24142
  height
24064
24143
  ]
24065
24144
  );
24066
- const builtConfig = (0, import_react97.useMemo)(() => {
24145
+ const builtConfig = (0, import_react98.useMemo)(() => {
24067
24146
  if (!declarative) return null;
24068
24147
  const palette = buildChartPalette(theme, mode);
24069
24148
  const options = buildChartOptions(declarative, palette);
24070
24149
  return extraOptions ? deepMerge(options, extraOptions) : options;
24071
24150
  }, [declarative, theme, mode, extraOptions]);
24072
- (0, import_react97.useEffect)(() => {
24151
+ (0, import_react98.useEffect)(() => {
24073
24152
  setMounted(true);
24074
24153
  }, []);
24075
- (0, import_react97.useEffect)(() => {
24154
+ (0, import_react98.useEffect)(() => {
24076
24155
  if (!chartId || configProp || builtConfig) return;
24077
24156
  let cancelled = false;
24078
24157
  setFetching(true);
@@ -24094,7 +24173,7 @@ function AnalyticsChart({
24094
24173
  };
24095
24174
  }, [chartId, apiBase, authToken, configProp, builtConfig]);
24096
24175
  const activeConfig = configProp ?? builtConfig ?? fetchedConfig;
24097
- (0, import_react97.useEffect)(() => {
24176
+ (0, import_react98.useEffect)(() => {
24098
24177
  if (!mounted || !activeConfig || !containerRef.current) return;
24099
24178
  const container = containerRef.current;
24100
24179
  let cancelled = false;
@@ -24114,7 +24193,7 @@ function AnalyticsChart({
24114
24193
  cancelled = true;
24115
24194
  };
24116
24195
  }, [mounted, activeConfig]);
24117
- (0, import_react97.useEffect)(() => {
24196
+ (0, import_react98.useEffect)(() => {
24118
24197
  return () => {
24119
24198
  if (chartRef.current) {
24120
24199
  try {
@@ -24125,7 +24204,7 @@ function AnalyticsChart({
24125
24204
  }
24126
24205
  };
24127
24206
  }, []);
24128
- (0, import_react97.useEffect)(() => {
24207
+ (0, import_react98.useEffect)(() => {
24129
24208
  if (!mounted || !containerRef.current) return;
24130
24209
  const obs = new ResizeObserver(() => {
24131
24210
  try {
@@ -24607,7 +24686,7 @@ function EmptyContent({ className, ...props }) {
24607
24686
  }
24608
24687
 
24609
24688
  // src/components/ui/field.tsx
24610
- var import_react98 = require("react");
24689
+ var import_react99 = require("react");
24611
24690
  var import_class_variance_authority10 = require("class-variance-authority");
24612
24691
  var import_jsx_runtime185 = require("react/jsx-runtime");
24613
24692
  function FieldSet({ className, ...props }) {
@@ -24790,7 +24869,7 @@ function FieldError({
24790
24869
  errors,
24791
24870
  ...props
24792
24871
  }) {
24793
- const content = (0, import_react98.useMemo)(() => {
24872
+ const content = (0, import_react99.useMemo)(() => {
24794
24873
  if (children) {
24795
24874
  return children;
24796
24875
  }
@@ -26071,18 +26150,18 @@ var FORM_INPUT_ATOM_NAMES = /* @__PURE__ */ new Set([
26071
26150
  "InputOTPAtom",
26072
26151
  "ToggleAtom"
26073
26152
  ]);
26074
- var PXEngineRenderer = import_react99.default.memo(function PXEngineRenderer2({
26153
+ var PXEngineRenderer = import_react100.default.memo(function PXEngineRenderer2({
26075
26154
  schema,
26076
26155
  onAction,
26077
26156
  disabled,
26078
26157
  theme,
26079
26158
  onFormSubmit
26080
26159
  }) {
26081
- const contextTheme = import_react99.default.useContext(WidgetThemeContext);
26160
+ const contextTheme = import_react100.default.useContext(WidgetThemeContext);
26082
26161
  const effectiveTheme = theme ?? contextTheme;
26083
- const formValuesRef = import_react99.default.useRef({});
26084
- const [, forceUpdate] = import_react99.default.useReducer((x) => x + 1, 0);
26085
- const handleInputValueChange = import_react99.default.useCallback((key, value) => {
26162
+ const formValuesRef = import_react100.default.useRef({});
26163
+ const [, forceUpdate] = import_react100.default.useReducer((x) => x + 1, 0);
26164
+ const handleInputValueChange = import_react100.default.useCallback((key, value) => {
26086
26165
  formValuesRef.current[key] = value;
26087
26166
  forceUpdate();
26088
26167
  }, []);
@@ -26090,12 +26169,12 @@ var PXEngineRenderer = import_react99.default.memo(function PXEngineRenderer2({
26090
26169
  const root = schema.root || schema;
26091
26170
  const renderRecursive = (component, index) => {
26092
26171
  if (Array.isArray(component)) {
26093
- return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_react99.default.Fragment, { children: component.map((child, idx) => renderRecursive(child, idx)) }, index !== void 0 ? `array-${index}` : "array-root");
26172
+ return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_react100.default.Fragment, { children: component.map((child, idx) => renderRecursive(child, idx)) }, index !== void 0 ? `array-${index}` : "array-root");
26094
26173
  }
26095
26174
  if (typeof component === "string" || typeof component === "number") {
26096
26175
  return component;
26097
26176
  }
26098
- if (import_react99.default.isValidElement(component)) {
26177
+ if (import_react100.default.isValidElement(component)) {
26099
26178
  return component;
26100
26179
  }
26101
26180
  if (!component || typeof component !== "object") return null;
@@ -26402,6 +26481,7 @@ PXEngineRenderer.displayName = "PXEngineRenderer";
26402
26481
  InputWidget,
26403
26482
  InsightDigestCard,
26404
26483
  InsightSummaryCard,
26484
+ JOB_SIGNAL_EVENT,
26405
26485
  KPIStatsCard,
26406
26486
  KbdAtom,
26407
26487
  KeywordBundlesDisplay,
@@ -26462,6 +26542,7 @@ PXEngineRenderer.displayName = "PXEngineRenderer";
26462
26542
  ResizablePanel,
26463
26543
  ResizablePanelGroup,
26464
26544
  RiskSignalCard,
26545
+ SSE_FALLBACK_POLL_MS,
26465
26546
  ScoreBreakdownCard,
26466
26547
  ScrollArea,
26467
26548
  ScrollAreaAtom,
@@ -26532,17 +26613,21 @@ PXEngineRenderer.displayName = "PXEngineRenderer";
26532
26613
  defaultFetchSelections,
26533
26614
  defaultPersistSelection,
26534
26615
  elementToQAField,
26616
+ emitJobSignal,
26535
26617
  formatQAMessage,
26536
26618
  generateFieldsFromData,
26537
26619
  generateFieldsFromPropDefinitions,
26538
26620
  getPxAuthToken,
26539
26621
  isInputAtom,
26540
26622
  notifyPxUnauthorized,
26623
+ refreshSharedPoll,
26541
26624
  setPxAuthTokenProvider,
26542
26625
  setPxUnauthorizedHandler,
26543
26626
  submitWidgetToAgent,
26627
+ subscribeJobSignal,
26544
26628
  th,
26545
26629
  useCreatorWidgetPolling,
26630
+ useJobSignal,
26546
26631
  useWidgetTheme,
26547
26632
  withAlpha
26548
26633
  });