@ohhwells/bridge 0.1.164-next.439 → 0.1.165

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
@@ -1214,21 +1214,21 @@ function chromeFrom(sample) {
1214
1214
  };
1215
1215
  }
1216
1216
  function filledPrimary(seed) {
1217
- const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1218
- const luminance = relativeLuminance(paint2);
1217
+ const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1218
+ const luminance = relativeLuminance(paint);
1219
1219
  return {
1220
- background: toCss({ ...paint2, a: 1 }),
1220
+ background: toCss({ ...paint, a: 1 }),
1221
1221
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1222
1222
  borderColor: TRANSPARENT,
1223
1223
  borderWidth: "0px"
1224
1224
  };
1225
1225
  }
1226
1226
  function generatedSecondary(primary) {
1227
- const paint2 = accentColor(primary);
1227
+ const paint = accentColor(primary);
1228
1228
  return {
1229
1229
  background: TRANSPARENT,
1230
- color: paint2,
1231
- borderColor: paint2,
1230
+ color: paint,
1231
+ borderColor: paint,
1232
1232
  borderWidth: "1px"
1233
1233
  };
1234
1234
  }
@@ -1241,9 +1241,9 @@ function generatedGhost(primary) {
1241
1241
  };
1242
1242
  }
1243
1243
  function normalizeOutlineChrome(outline, primary) {
1244
- const paint2 = accentColor(primary);
1244
+ const paint = accentColor(primary);
1245
1245
  const text = parseColor(outline.color);
1246
- const paintRgb = parseColor(paint2);
1246
+ const paintRgb = parseColor(paint);
1247
1247
  const primaryLabel = parseColor(primary.color);
1248
1248
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1249
1249
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1252,8 +1252,8 @@ function normalizeOutlineChrome(outline, primary) {
1252
1252
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1253
1253
  return {
1254
1254
  ...outline,
1255
- color: paint2,
1256
- borderColor: hasBorder ? paint2 : outline.borderColor
1255
+ color: paint,
1256
+ borderColor: hasBorder ? paint : outline.borderColor
1257
1257
  };
1258
1258
  }
1259
1259
  function generateButtonVariants(samples) {
@@ -6548,24 +6548,6 @@ function deleteSectionFromState(state, sectionId) {
6548
6548
  if (removed.includes(sectionId)) return state;
6549
6549
  return { ...state, v: 1, sections: state.sections, removed: [...removed, sectionId] };
6550
6550
  }
6551
- function moveSectionInState(state, sectionId, targetPath) {
6552
- const entry = state.sections.find((section) => section.id === sectionId);
6553
- if (!entry) return null;
6554
- const moved = {
6555
- id: entry.id,
6556
- label: entry.label,
6557
- path: targetPath,
6558
- afterSection: null,
6559
- tree: entry.tree,
6560
- media: entry.media,
6561
- ...entry.brand ? { brand: entry.brand } : {}
6562
- };
6563
- return {
6564
- ...state,
6565
- v: 1,
6566
- sections: state.sections.map((section) => section.id === sectionId ? moved : section)
6567
- };
6568
- }
6569
6551
  function reapRemovedAiSections(state, store, removedIds, excludeIds = /* @__PURE__ */ new Set()) {
6570
6552
  const generated = new Set(state.sections.map((entry) => entry.id));
6571
6553
  const reapedIds = [...new Set(removedIds)].filter((id) => generated.has(id) && !excludeIds.has(id));
@@ -6794,21 +6776,6 @@ function pricingCardFeatureCount(tree, index) {
6794
6776
  const target = findPricingCollection(tree)?.children?.[index];
6795
6777
  return target ? pricingFeatureList(target).length : 0;
6796
6778
  }
6797
- function prevailingFeatureIcon(features) {
6798
- const counts = /* @__PURE__ */ new Map();
6799
- for (const row of features) {
6800
- const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6801
- const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6802
- entry.count += 1;
6803
- counts.set(key, entry);
6804
- }
6805
- let best = null;
6806
- for (const entry of counts.values()) {
6807
- if (!best || entry.count > best.count) best = entry;
6808
- }
6809
- if (!best) return {};
6810
- return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6811
- }
6812
6779
  function addPricingCardFeature(tree, index, text) {
6813
6780
  return withPricingCollection(tree, (collection) => {
6814
6781
  const children = collection.children;
@@ -6817,7 +6784,7 @@ function addPricingCardFeature(tree, index, text) {
6817
6784
  const features = pricingFeatureList(target);
6818
6785
  if (features.length >= PRICING_FEATURES_MAX) return false;
6819
6786
  target.slots = target.slots ?? {};
6820
- target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6787
+ target.slots.features = [...features, { text }];
6821
6788
  return true;
6822
6789
  });
6823
6790
  }
@@ -7461,120 +7428,6 @@ function findSelectableNavContainer(doc = document) {
7461
7428
  );
7462
7429
  }
7463
7430
 
7464
- // src/lib/youtube.ts
7465
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7466
- function extractYouTubeId(input) {
7467
- const trimmed = input.trim();
7468
- if (!trimmed) return null;
7469
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7470
- let url;
7471
- try {
7472
- url = new URL(trimmed);
7473
- } catch {
7474
- return null;
7475
- }
7476
- const host = url.hostname.replace(/^www\./, "");
7477
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7478
- return null;
7479
- }
7480
- let candidate = null;
7481
- if (host === "youtu.be") {
7482
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
7483
- } else if (url.pathname === "/watch") {
7484
- candidate = url.searchParams.get("v");
7485
- } else {
7486
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7487
- candidate = match ? match[1] : null;
7488
- }
7489
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7490
- }
7491
-
7492
- // src/lib/section-embed.ts
7493
- var SECTION_EMBED_SUFFIX = "__ohw_embed";
7494
- function readStoredEmbed(value) {
7495
- if (value.startsWith("start\n")) {
7496
- return { raw: value.slice("start\n".length), at: "start" };
7497
- }
7498
- return { raw: value, at: "end" };
7499
- }
7500
- function embedFrameSrc(value) {
7501
- const videoId = extractYouTubeId(value);
7502
- if (videoId) {
7503
- return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7504
- }
7505
- let url;
7506
- try {
7507
- url = new URL(value);
7508
- } catch {
7509
- return null;
7510
- }
7511
- const host = url.hostname.replace(/^www\./, "").toLowerCase();
7512
- if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7513
- const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7514
- const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7515
- return { src, title: "Map" };
7516
- }
7517
- if (host === "maps.app.goo.gl") {
7518
- return { src: value, title: "Map" };
7519
- }
7520
- if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7521
- return { src: value, title: "Calendar" };
7522
- }
7523
- if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7524
- return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7525
- }
7526
- if (host === "forms.gle") {
7527
- return { src: value, title: "Form" };
7528
- }
7529
- return null;
7530
- }
7531
- function place(section, box, at) {
7532
- if (at === "start") {
7533
- section.insertBefore(box, section.firstChild);
7534
- return;
7535
- }
7536
- section.appendChild(box);
7537
- }
7538
- function paint(section, key, src, title, at) {
7539
- const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7540
- const frame = existing?.querySelector("iframe");
7541
- if (existing && frame) {
7542
- if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7543
- frame.title = title;
7544
- place(section, existing, at);
7545
- return;
7546
- }
7547
- existing?.remove();
7548
- const box = document.createElement("div");
7549
- box.setAttribute("data-ohw-section-embed", key);
7550
- box.style.cssText = at === "start" ? "width:100%;max-width:960px;margin:0 auto 32px;padding:32px 24px 0;box-sizing:border-box;" : "width:100%;max-width:960px;margin:32px auto 0;padding:0 24px 32px;box-sizing:border-box;";
7551
- const frameWrap = document.createElement("div");
7552
- frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7553
- const iframe = document.createElement("iframe");
7554
- iframe.src = src;
7555
- iframe.title = title;
7556
- iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7557
- iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7558
- iframe.setAttribute("allowfullscreen", "");
7559
- frameWrap.appendChild(iframe);
7560
- box.appendChild(frameWrap);
7561
- place(section, box, at);
7562
- }
7563
- function applySectionEmbeds(content) {
7564
- for (const [key, val] of Object.entries(content)) {
7565
- if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7566
- const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7567
- const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7568
- const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7569
- const frame = stored ? embedFrameSrc(stored.raw) : null;
7570
- if (!section || !stored || !frame) {
7571
- section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7572
- continue;
7573
- }
7574
- paint(section, key, frame.src, frame.title, stored.at);
7575
- }
7576
- }
7577
-
7578
7431
  // src/ui/ai-tree/aiSectionsManager.tsx
7579
7432
  var import_react_dom = require("react-dom");
7580
7433
  var import_client = require("react-dom/client");
@@ -8148,7 +8001,7 @@ var AI_MOBILE_CSS = [
8148
8001
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
8149
8002
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
8150
8003
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
8151
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
8004
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8152
8005
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
8153
8006
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
8154
8007
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8164,10 +8017,8 @@ var AI_MOBILE_CSS = [
8164
8017
  "[data-ai-section]{overflow-x:hidden}",
8165
8018
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8166
8019
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
8167
- // still got a 20px band of section background down both sides on a phone. The footer's own
8168
- // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8169
- "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8170
- "[data-ai-container]{padding:0 20px !important}",
8020
+ // still got a 20px band of section background down both sides on a phone.
8021
+ "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8171
8022
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8172
8023
  "[data-ai-cell]{width:100%;min-width:0}",
8173
8024
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8372,31 +8223,6 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8372
8223
  function textAttrs(ctx, path) {
8373
8224
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8374
8225
  }
8375
- var AI_RESPONSIVE_CSS = [
8376
- "@media (max-width: 960px) {",
8377
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8378
- ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8379
- "}",
8380
- "@media (max-width: 640px) {",
8381
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8382
- " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8383
- // Group containers flatten to a column on phones; span placements come along for free.
8384
- // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8385
- // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8386
- // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8387
- // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8388
- // layered text used to be.
8389
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8390
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8391
- // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8392
- // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8393
- // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8394
- // other rule had already been taught to stand down.
8395
- " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8396
- " [data-ai-responsive] { overflow-x: hidden; }",
8397
- " [data-ai-responsive] img { max-width: 100%; }",
8398
- "}"
8399
- ].join("\n");
8400
8226
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8401
8227
  function MediaBox({
8402
8228
  refValue,
@@ -8451,7 +8277,7 @@ function MediaBox({
8451
8277
  position: fill ? "absolute" : void 0,
8452
8278
  inset: fill ? 0 : void 0,
8453
8279
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8454
- height: fill ? "100%" : fixedSize ? height : void 0,
8280
+ height: fill ? "100%" : void 0,
8455
8281
  aspectRatio: fill ? void 0 : aspectRatio,
8456
8282
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8457
8283
  borderRadius: radius,
@@ -9947,7 +9773,7 @@ function CollectionBlock({ node, ctx, path }) {
9947
9773
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
9948
9774
  "div",
9949
9775
  {
9950
- "data-ai-grid": String(itemsPerRow),
9776
+ "data-ai-grid": "",
9951
9777
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9952
9778
  style: {
9953
9779
  display: "grid",
@@ -10249,7 +10075,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10249
10075
  },
10250
10076
  children: [
10251
10077
  i > 0 && ctx.heroOverlapFullBleed ? (
10252
- // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10078
+ // The section's `data-ai-container` gave up its max-width/gutter so the base
10253
10079
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10254
10080
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10255
10081
  // the full section width instead of reading at the usual content width.
@@ -10668,7 +10494,6 @@ function AiTreeRenderer({
10668
10494
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10669
10495
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10670
10496
  ...bgAttrs,
10671
- "data-ai-responsive": "",
10672
10497
  style: {
10673
10498
  position: "relative",
10674
10499
  padding: `${padCss} 0`,
@@ -10682,13 +10507,12 @@ function AiTreeRenderer({
10682
10507
  ...fillHeight ? { display: "grid" } : {}
10683
10508
  },
10684
10509
  children: [
10685
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
10686
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
10687
10510
  isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10511
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
10688
10512
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10689
10513
  "div",
10690
10514
  {
10691
- "data-ai-section-inner": "",
10515
+ "data-ai-container": "",
10692
10516
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10693
10517
  style: {
10694
10518
  position: "relative",
@@ -10705,7 +10529,7 @@ function AiTreeRenderer({
10705
10529
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10706
10530
  "div",
10707
10531
  {
10708
- "data-ai-columns": "",
10532
+ "data-ai-row": "",
10709
10533
  style: {
10710
10534
  display: "grid",
10711
10535
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11367,10 +11191,9 @@ function applyAiSectionsToDom(state, options) {
11367
11191
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11368
11192
  continue;
11369
11193
  }
11194
+ const isNewMount = !existing || !existing.container.isConnected;
11370
11195
  let container = existing?.container;
11371
- let isNewMount = false;
11372
11196
  if (!container || !container.isConnected) {
11373
- isNewMount = true;
11374
11197
  existing?.root.unmount();
11375
11198
  container?.remove();
11376
11199
  container = document.createElement("div");
@@ -11708,34 +11531,6 @@ function minSpanForFooterBlock(type) {
11708
11531
  return 3;
11709
11532
  }
11710
11533
  }
11711
- function readLiveSocialItems() {
11712
- const root = getFooterRoot();
11713
- const row = root?.querySelector("[data-ohw-socials-row]");
11714
- if (!row) return [];
11715
- const items = [];
11716
- for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11717
- const href = anchor.getAttribute("href")?.trim() ?? "";
11718
- const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11719
- const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11720
- if (!platform || !/^https?:\/\//i.test(href)) continue;
11721
- items.push({ platform, href });
11722
- }
11723
- return items;
11724
- }
11725
- function syncSocialRowsFromDom(tree) {
11726
- const root = getFooterRoot();
11727
- if (!root) return;
11728
- const row = root.querySelector("[data-ohw-socials-row]");
11729
- const live = readLiveSocialItems();
11730
- if (row && live.length === 0) return;
11731
- for (const col of tree.columns) {
11732
- col.blocks = col.blocks.flatMap((block) => {
11733
- if (block.type !== "social-row") return [block];
11734
- if (!row) return [];
11735
- return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11736
- });
11737
- }
11738
- }
11739
11534
  function collectBrandBlocks(tree) {
11740
11535
  const brand = [];
11741
11536
  for (const col of tree.columns) {
@@ -11981,7 +11776,6 @@ function textOf2(el) {
11981
11776
  }
11982
11777
  function syncFooterTreeLinksFromDom(tree) {
11983
11778
  const next = cloneTree(tree);
11984
- syncSocialRowsFromDom(next);
11985
11779
  const domCols = listFooterColumns().map((col) => {
11986
11780
  const heading = getFooterColumnHeadingEl(col);
11987
11781
  const title = heading ? textOf2(heading) : void 0;
@@ -17686,7 +17480,7 @@ function apiBase() {
17686
17480
  function bridgeVersion() {
17687
17481
  try {
17688
17482
  if (true) {
17689
- return "0.1.164-next.439";
17483
+ return "0.1.165";
17690
17484
  }
17691
17485
  } catch {
17692
17486
  }
@@ -17700,7 +17494,7 @@ function stampBridgeVersionOnDocument() {
17700
17494
  return;
17701
17495
  }
17702
17496
  try {
17703
- const v = true ? "0.1.164-next.439" : "";
17497
+ const v = true ? "0.1.165" : "";
17704
17498
  if (v) {
17705
17499
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17706
17500
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18378,7 +18172,6 @@ function MediaOverlay({
18378
18172
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18379
18173
  );
18380
18174
  }, [isVideo]);
18381
- const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18382
18175
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18383
18176
  const box = {
18384
18177
  position: "fixed",
@@ -18477,10 +18270,11 @@ function MediaOverlay({
18477
18270
  className: "flex items-center justify-center cursor-pointer",
18478
18271
  style: {
18479
18272
  ...box,
18480
- // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18481
- // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18482
- // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18483
- pointerEvents: "none",
18273
+ // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18274
+ // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18275
+ // in-document, pointer-events does it natively. The button below opts back in, so
18276
+ // Replace still works.
18277
+ pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18484
18278
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18485
18279
  // than hovered. Hover keeps the existing tinted preview.
18486
18280
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18507,17 +18301,17 @@ function MediaOverlay({
18507
18301
  },
18508
18302
  children: [
18509
18303
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18510
- replaceLabel
18304
+ isVideo ? "Replace video" : "Replace image"
18511
18305
  ]
18512
18306
  }
18513
18307
  ),
18514
- showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18308
+ replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18515
18309
  Button,
18516
18310
  {
18517
18311
  "data-ohw-media-overlay": "",
18518
18312
  variant: "outline",
18519
18313
  size: "sm",
18520
- "aria-label": replaceLabel,
18314
+ "aria-label": isVideo ? "Replace video" : "Replace image",
18521
18315
  className: "gap-1.5 cursor-pointer hover:bg-background",
18522
18316
  style: {
18523
18317
  ...OVERLAY_BUTTON_STYLE,
@@ -18540,7 +18334,7 @@ function MediaOverlay({
18540
18334
  },
18541
18335
  children: [
18542
18336
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18543
- replaceMode === "full" ? replaceLabel : null
18337
+ replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18544
18338
  ]
18545
18339
  }
18546
18340
  )
@@ -19134,7 +18928,7 @@ function AiSectionOverlay({
19134
18928
 
19135
18929
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19136
18930
  var import_react12 = require("react");
19137
- var import_lucide_react9 = require("lucide-react");
18931
+ var import_lucide_react8 = require("lucide-react");
19138
18932
 
19139
18933
  // src/lib/ai-media-strip-tree.ts
19140
18934
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19248,6 +19042,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
19248
19042
  return true;
19249
19043
  });
19250
19044
  }
19045
+ function setMediaStripItemAlt(tree, index, alt) {
19046
+ return withMediaStrip(tree, (block) => {
19047
+ const items = block.items;
19048
+ if (index < 0 || index >= items.length) return false;
19049
+ items[index] = { ...items[index], alt };
19050
+ return true;
19051
+ });
19052
+ }
19251
19053
  function setMediaStripItemLink(tree, index, link) {
19252
19054
  return withMediaStrip(tree, (block) => {
19253
19055
  const items = block.items;
@@ -19265,117 +19067,11 @@ function setMediaStripItemLink(tree, index, link) {
19265
19067
  });
19266
19068
  }
19267
19069
 
19268
- // src/ui/dialog.tsx
19269
- var React9 = __toESM(require("react"), 1);
19270
- var import_radix_ui6 = require("radix-ui");
19271
- var import_lucide_react8 = require("lucide-react");
19272
- var import_jsx_runtime20 = require("react/jsx-runtime");
19273
- function Dialog2({
19274
- ...props
19275
- }) {
19276
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
19277
- }
19278
- function DialogPortal({
19279
- ...props
19280
- }) {
19281
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
19282
- }
19283
- function DialogOverlay({
19284
- className,
19285
- ...props
19286
- }) {
19287
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19288
- import_radix_ui6.Dialog.Overlay,
19289
- {
19290
- "data-slot": "dialog-overlay",
19291
- "data-ohw-link-modal-root": "",
19292
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19293
- ...props
19294
- }
19295
- );
19296
- }
19297
- var DialogContent = React9.forwardRef(
19298
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19299
- const positionMode = container ? "absolute" : "fixed";
19300
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
19301
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19302
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19303
- import_radix_ui6.Dialog.Content,
19304
- {
19305
- ref,
19306
- "data-slot": "dialog-content",
19307
- className: cn(
19308
- positionMode,
19309
- "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
19310
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19311
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19312
- className
19313
- ),
19314
- onMouseDown: (e) => e.stopPropagation(),
19315
- ...props,
19316
- children: [
19317
- children,
19318
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19319
- import_radix_ui6.Dialog.Close,
19320
- {
19321
- type: "button",
19322
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19323
- "aria-label": "Close",
19324
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
19325
- }
19326
- ) : null
19327
- ]
19328
- }
19329
- )
19330
- ] });
19331
- }
19332
- );
19333
- DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
19334
- function DialogHeader({
19335
- className,
19336
- ...props
19337
- }) {
19338
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19339
- }
19340
- function DialogFooter({
19341
- className,
19342
- ...props
19343
- }) {
19344
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19345
- "div",
19346
- {
19347
- className: cn("flex items-center justify-end gap-2", className),
19348
- ...props
19349
- }
19350
- );
19351
- }
19352
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19353
- import_radix_ui6.Dialog.Title,
19354
- {
19355
- ref,
19356
- className: cn(
19357
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19358
- className
19359
- ),
19360
- ...props
19361
- }
19362
- ));
19363
- DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
19364
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19365
- import_radix_ui6.Dialog.Description,
19366
- {
19367
- ref,
19368
- className: cn("text-sm text-muted-foreground", className),
19369
- ...props
19370
- }
19371
- ));
19372
- DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
19373
- var DialogClose = import_radix_ui6.Dialog.Close;
19374
-
19375
19070
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19376
- var import_jsx_runtime21 = require("react/jsx-runtime");
19377
- var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19378
- var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
19071
+ var import_jsx_runtime20 = require("react/jsx-runtime");
19072
+ var PRIMARY3 = "#0885FE";
19073
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19074
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19379
19075
  function findMediaStripItemElement(sectionId, index) {
19380
19076
  const sectionEl = findByInstanceId(sectionId);
19381
19077
  if (!sectionEl) return null;
@@ -19385,35 +19081,14 @@ function findMediaStripItemElement(sectionId, index) {
19385
19081
  }
19386
19082
  return null;
19387
19083
  }
19388
- function itemRefFromTarget(target) {
19389
- if (!(target instanceof Element)) return null;
19390
- if (target.closest(CHROME_SELECTOR)) return null;
19391
- const itemEl = target.closest("[data-ohw-media-strip-item]");
19392
- if (!itemEl) return null;
19393
- const sectionEl = itemEl.closest("[data-ohw-section]");
19394
- const unit = sectionEl ? movableUnit(sectionEl) : null;
19395
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19396
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19397
- if (!sectionId || Number.isNaN(index)) return null;
19398
- return { sectionId, index };
19399
- }
19400
- function sameRef(a, b) {
19401
- return a?.sectionId === b?.sectionId && a?.index === b?.index;
19402
- }
19403
- function rectOf(el) {
19084
+ function readRect2(ref) {
19085
+ const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19404
19086
  if (!el) return null;
19405
19087
  const r2 = el.getBoundingClientRect();
19406
19088
  if (r2.width <= 0 || r2.height <= 0) return null;
19407
19089
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19408
19090
  }
19409
- function readRect2(ref) {
19410
- return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19411
- }
19412
- function readStripRect(ref) {
19413
- const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19414
- return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19415
- }
19416
- function useLiveItemRect(ref, strip = false) {
19091
+ function useLiveItemRect(ref) {
19417
19092
  const [rect, setRect] = (0, import_react12.useState)(null);
19418
19093
  (0, import_react12.useEffect)(() => {
19419
19094
  if (!ref) {
@@ -19421,7 +19096,7 @@ function useLiveItemRect(ref, strip = false) {
19421
19096
  return;
19422
19097
  }
19423
19098
  const update = () => {
19424
- const next = strip ? readStripRect(ref) : readRect2(ref);
19099
+ const next = readRect2(ref);
19425
19100
  setRect(
19426
19101
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19427
19102
  );
@@ -19436,49 +19111,9 @@ function useLiveItemRect(ref, strip = false) {
19436
19111
  window.removeEventListener("resize", update);
19437
19112
  clearInterval(interval);
19438
19113
  };
19439
- }, [ref?.sectionId, ref?.index, strip]);
19114
+ }, [ref?.sectionId, ref?.index]);
19440
19115
  return rect;
19441
19116
  }
19442
- var TOOLBAR_STRIP_GAP = 52;
19443
- var TOOLBAR_STRIP_GAP_MOBILE = 42;
19444
- var TOOLBAR_EDGE_MARGIN2 = 4;
19445
- function StripToolbarSlot({ stripRect, children }) {
19446
- const slotRef = (0, import_react12.useRef)(null);
19447
- const [shift, setShift] = (0, import_react12.useState)(0);
19448
- const centerX = stripRect.left + stripRect.width / 2;
19449
- (0, import_react12.useLayoutEffect)(() => {
19450
- const slot = slotRef.current;
19451
- if (!slot) return;
19452
- const clamp = () => {
19453
- const w = slot.offsetWidth;
19454
- if (w <= 0) return;
19455
- const half = w / 2;
19456
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19457
- setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19458
- };
19459
- clamp();
19460
- const ro = new ResizeObserver(clamp);
19461
- ro.observe(slot);
19462
- return () => ro.disconnect();
19463
- }, [centerX, children]);
19464
- const mobile = window.innerWidth <= 480;
19465
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19466
- "div",
19467
- {
19468
- ref: slotRef,
19469
- "data-ohw-bridge": "",
19470
- "data-ohw-item-interaction": "",
19471
- className: "pointer-events-auto fixed",
19472
- style: {
19473
- top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19474
- left: centerX + shift,
19475
- transform: "translate(-50%, -100%)",
19476
- zIndex: 2147483645
19477
- },
19478
- children
19479
- }
19480
- );
19481
- }
19482
19117
  function requestValidateTree(postToParent2, tree) {
19483
19118
  return new Promise((resolve) => {
19484
19119
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19515,72 +19150,116 @@ function requestAssetPick(postToParent2) {
19515
19150
  postToParent2({ type: "ow:asset-pick", id });
19516
19151
  });
19517
19152
  }
19518
- function ToolbarAction({
19153
+ function Pill({
19519
19154
  label,
19520
19155
  onClick,
19521
- disabled = false,
19522
- active = false,
19523
- children
19524
- }) {
19525
- const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19526
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19527
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19528
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19529
- ] });
19530
- }
19531
- function ToolbarSeparator() {
19532
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19533
- }
19534
- function OptionMenu({
19535
- label,
19536
- value,
19537
- options,
19538
- onChange
19156
+ disabled,
19157
+ active
19539
19158
  }) {
19540
- const current = options.find((o) => o.value === value) ?? options[0];
19541
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19542
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
19543
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
19544
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19545
- "button",
19546
- {
19547
- type: "button",
19548
- "aria-label": label,
19549
- className: "inline-flex h-8 min-w-[76px] items-center gap-[7px] rounded-[6px] bg-transparent px-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted data-[state=open]:bg-muted",
19550
- children: [
19551
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
19552
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
19553
- ]
19554
- }
19555
- ) }),
19556
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19557
- const selected = option.value === value;
19558
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19559
- DropdownMenuItem,
19159
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19160
+ "button",
19161
+ {
19162
+ type: "button",
19163
+ onClick,
19164
+ disabled,
19165
+ style: {
19166
+ height: 28,
19167
+ padding: "0 10px",
19168
+ display: "inline-flex",
19169
+ alignItems: "center",
19170
+ gap: 4,
19171
+ borderRadius: 999,
19172
+ border: "none",
19173
+ cursor: disabled ? "default" : "pointer",
19174
+ background: active ? OHW_BLUE_DARK : "#ffffff",
19175
+ color: active ? "#ffffff" : OHW_BLUE_DARK,
19176
+ opacity: disabled ? 0.4 : 1,
19177
+ fontSize: 12,
19178
+ lineHeight: "16px",
19179
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19180
+ whiteSpace: "nowrap",
19181
+ flex: "0 0 auto"
19182
+ },
19183
+ children: label
19184
+ }
19185
+ );
19186
+ }
19187
+ function AltInput({ value, onCommit }) {
19188
+ const [draft, setDraft] = (0, import_react12.useState)(value);
19189
+ (0, import_react12.useEffect)(() => setDraft(value), [value]);
19190
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19191
+ "div",
19192
+ {
19193
+ style: {
19194
+ display: "flex",
19195
+ alignItems: "center",
19196
+ gap: 6,
19197
+ height: 28,
19198
+ padding: "0 12px",
19199
+ borderRadius: 999,
19200
+ background: "#ffffff",
19201
+ width: "100%",
19202
+ maxWidth: 260,
19203
+ boxSizing: "border-box"
19204
+ },
19205
+ children: [
19206
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19207
+ "span",
19560
19208
  {
19561
- role: "menuitemradio",
19562
- "aria-checked": selected,
19563
- onSelect: () => onChange(option.value),
19564
- className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19565
- children: [
19566
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
19567
- selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
19568
- ]
19569
- },
19570
- option.value
19571
- );
19572
- }) })
19573
- ] })
19574
- ] });
19209
+ style: {
19210
+ flex: "0 0 auto",
19211
+ color: OHW_BLUE_DARK,
19212
+ fontSize: 10,
19213
+ fontWeight: 700,
19214
+ textTransform: "uppercase",
19215
+ letterSpacing: 0.4
19216
+ },
19217
+ children: "Alt"
19218
+ }
19219
+ ),
19220
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19221
+ "input",
19222
+ {
19223
+ type: "text",
19224
+ value: draft,
19225
+ onChange: (e) => setDraft(e.target.value),
19226
+ onBlur: () => {
19227
+ if (draft !== value) onCommit(draft);
19228
+ },
19229
+ onKeyDown: (e) => {
19230
+ if (e.key === "Enter") e.currentTarget.blur();
19231
+ if (e.key === "Escape") {
19232
+ setDraft(value);
19233
+ e.currentTarget.blur();
19234
+ }
19235
+ },
19236
+ placeholder: "Describe this image",
19237
+ "aria-label": "Image alt text",
19238
+ style: {
19239
+ flex: 1,
19240
+ minWidth: 0,
19241
+ border: "none",
19242
+ outline: "none",
19243
+ background: "transparent",
19244
+ fontSize: 12,
19245
+ lineHeight: "16px",
19246
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19247
+ color: "#1f2937"
19248
+ }
19249
+ }
19250
+ )
19251
+ ]
19252
+ }
19253
+ );
19575
19254
  }
19576
19255
  var VARIANTS = [
19577
19256
  { value: "logos", label: "Logos" },
19578
19257
  { value: "reel", label: "Reel" }
19579
19258
  ];
19580
19259
  var ALIGNS = [
19581
- { value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
19582
- { value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
19583
- { value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
19260
+ { value: "left", label: "Left" },
19261
+ { value: "center", label: "Center" },
19262
+ { value: "right", label: "Right" }
19584
19263
  ];
19585
19264
  var HOVERS = [
19586
19265
  { value: "none", label: "None" },
@@ -19588,104 +19267,104 @@ var HOVERS = [
19588
19267
  { value: "zoom", label: "Zoom" },
19589
19268
  { value: "fade", label: "Fade" }
19590
19269
  ];
19270
+ var TREATMENTS = [
19271
+ { value: "color", label: "Color" },
19272
+ { value: "grayscale", label: "Grayscale" }
19273
+ ];
19591
19274
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19592
- function LinkModal({
19593
- href,
19594
- linkTarget,
19595
- onClose,
19596
- onSave
19597
- }) {
19598
- const [draft, setDraft] = (0, import_react12.useState)(href);
19599
- const [newTab, setNewTab] = (0, import_react12.useState)(linkTarget !== "same-tab");
19275
+ function LinkInput({ value, onCommit }) {
19276
+ const [draft, setDraft] = (0, import_react12.useState)(value);
19600
19277
  const [invalid, setInvalid] = (0, import_react12.useState)(false);
19601
- const save = () => {
19278
+ (0, import_react12.useEffect)(() => {
19279
+ setDraft(value);
19280
+ setInvalid(false);
19281
+ }, [value]);
19282
+ const commit2 = () => {
19602
19283
  const next = draft.trim();
19603
- if (next && !HTTP_URL_RE.test(next)) {
19604
- setInvalid(true);
19605
- return;
19606
- }
19607
- onSave(next, newTab ? "new-tab" : "same-tab");
19608
- onClose();
19284
+ if (next === value) return setInvalid(false);
19285
+ if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19286
+ setInvalid(false);
19287
+ onCommit(next);
19609
19288
  };
19610
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
19611
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
19612
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
19613
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19614
- "input",
19615
- {
19616
- autoFocus: true,
19617
- type: "text",
19618
- inputMode: "url",
19619
- value: draft,
19620
- onChange: (e) => {
19621
- setDraft(e.target.value);
19622
- setInvalid(false);
19623
- },
19624
- onKeyDown: (e) => {
19625
- if (e.key === "Enter") save();
19626
- },
19627
- placeholder: "https://example.com",
19628
- "aria-label": "Image link URL",
19629
- "aria-invalid": invalid,
19630
- className: cn(
19631
- "h-9 w-full rounded-[6px] border border-border bg-background px-3 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/70 focus:border-bridge-primary",
19632
- invalid && "border-destructive focus:border-destructive"
19633
- )
19634
- }
19635
- ),
19636
- invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19637
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19638
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19639
- "Open in new tab"
19640
- ] })
19641
- ] }),
19642
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
19643
- href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19644
- "button",
19645
- {
19646
- type: "button",
19647
- onClick: () => {
19648
- onSave("", "new-tab");
19649
- onClose();
19650
- },
19651
- className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19652
- children: "Remove link"
19653
- }
19654
- ),
19655
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19656
- "button",
19657
- {
19658
- type: "button",
19659
- onClick: onClose,
19660
- className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19661
- children: "Cancel"
19662
- }
19663
- ),
19664
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19665
- "button",
19666
- {
19667
- type: "button",
19668
- onClick: save,
19669
- className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19670
- children: "Save"
19671
- }
19672
- )
19673
- ] })
19674
- ] }) });
19289
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19290
+ "div",
19291
+ {
19292
+ style: {
19293
+ display: "flex",
19294
+ alignItems: "center",
19295
+ gap: 6,
19296
+ height: 28,
19297
+ padding: "0 12px",
19298
+ borderRadius: 999,
19299
+ background: "#ffffff",
19300
+ width: "100%",
19301
+ maxWidth: 260,
19302
+ boxSizing: "border-box",
19303
+ boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19304
+ },
19305
+ children: [
19306
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19307
+ "span",
19308
+ {
19309
+ style: {
19310
+ flex: "0 0 auto",
19311
+ color: OHW_BLUE_DARK,
19312
+ fontSize: 10,
19313
+ fontWeight: 700,
19314
+ textTransform: "uppercase",
19315
+ letterSpacing: 0.4
19316
+ },
19317
+ children: "Link"
19318
+ }
19319
+ ),
19320
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19321
+ "input",
19322
+ {
19323
+ type: "text",
19324
+ inputMode: "url",
19325
+ value: draft,
19326
+ onChange: (e) => setDraft(e.target.value),
19327
+ onBlur: commit2,
19328
+ onKeyDown: (e) => {
19329
+ if (e.key === "Enter") e.currentTarget.blur();
19330
+ if (e.key === "Escape") {
19331
+ setDraft(value);
19332
+ setInvalid(false);
19333
+ e.currentTarget.blur();
19334
+ }
19335
+ },
19336
+ placeholder: "https://example.com",
19337
+ "aria-label": "Image link URL",
19338
+ "aria-invalid": invalid,
19339
+ style: {
19340
+ flex: 1,
19341
+ minWidth: 0,
19342
+ border: "none",
19343
+ outline: "none",
19344
+ background: "transparent",
19345
+ fontSize: 12,
19346
+ lineHeight: "16px",
19347
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19348
+ color: "#1f2937"
19349
+ }
19350
+ }
19351
+ )
19352
+ ]
19353
+ }
19354
+ );
19675
19355
  }
19676
19356
  function MediaStripToolbar({
19677
19357
  entry,
19678
19358
  index,
19679
19359
  pending,
19680
19360
  error,
19681
- itemEditOn,
19682
- onToggleItemEdit,
19683
19361
  onSetVariant,
19684
19362
  onSetAlign,
19685
19363
  onSetHover,
19686
19364
  onSetTreatment,
19687
19365
  onResize,
19688
- onOpenLink,
19366
+ onSetAlt,
19367
+ onSetLink,
19689
19368
  onAddItem,
19690
19369
  onRemoveItem,
19691
19370
  onChangeImage,
@@ -19694,102 +19373,81 @@ function MediaStripToolbar({
19694
19373
  }) {
19695
19374
  const items = mediaStripItems(entry.tree);
19696
19375
  const itemCount = items.length;
19376
+ const currentAlt = items[index]?.alt ?? "";
19377
+ const currentHref2 = items[index]?.href ?? "";
19378
+ const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19697
19379
  const slots = findMediaStripSlots(entry.tree);
19698
19380
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19699
19381
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19700
19382
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19701
19383
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19702
19384
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19703
- const mobile = window.innerWidth <= 480;
19704
- const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19705
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19385
+ const isMobile = window.innerWidth <= 480;
19386
+ const rowStyle = isMobile ? {
19387
+ display: "flex",
19388
+ gap: 6,
19389
+ flexWrap: "nowrap",
19390
+ justifyContent: "center",
19391
+ overflowX: "auto",
19392
+ WebkitOverflowScrolling: "touch",
19393
+ width: "100%",
19394
+ scrollbarWidth: "none"
19395
+ } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19396
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19706
19397
  "div",
19707
19398
  {
19708
19399
  "data-ohw-bridge": "",
19709
19400
  "data-ohw-toolbar": "",
19710
19401
  onMouseDown: (e) => e.stopPropagation(),
19711
- className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19712
- style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19402
+ style: {
19403
+ display: "flex",
19404
+ flexDirection: "column",
19405
+ gap: 6,
19406
+ alignItems: "center",
19407
+ background: OHW_BLUE,
19408
+ padding: 8,
19409
+ borderRadius: 12,
19410
+ boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19411
+ pointerEvents: pending ? "none" : "auto",
19412
+ opacity: pending ? 0.6 : 1,
19413
+ maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19414
+ },
19713
19415
  children: [
19714
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19715
- "div",
19716
- {
19717
- className: cn(
19718
- "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19719
- "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19720
- mobile ? "flex-wrap justify-center" : "flex-nowrap"
19721
- ),
19722
- children: [
19723
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19724
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19725
- CustomToolbarButton,
19726
- {
19727
- type: "button",
19728
- "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19729
- "aria-pressed": itemEditOn,
19730
- onClick: onToggleItemEdit,
19731
- className: "group size-8",
19732
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19733
- import_lucide_react9.Star,
19734
- {
19735
- size: 16,
19736
- fill: "currentColor",
19737
- strokeWidth: 0,
19738
- className: cn(
19739
- "transition-colors",
19740
- itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19741
- ),
19742
- style: { pointerEvents: "none" }
19743
- }
19744
- )
19745
- }
19746
- ) }),
19747
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19748
- ] }),
19749
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19750
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
19751
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
19752
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
19753
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19754
- ToolbarAction,
19755
- {
19756
- label: gatedLabel("Move right"),
19757
- onClick: onMoveRight,
19758
- disabled: !itemEditOn || index >= itemCount - 1,
19759
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
19760
- }
19761
- ),
19762
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19763
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19764
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19765
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19766
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19767
- ToolbarAction,
19768
- {
19769
- label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19770
- active: treatment === "grayscale",
19771
- onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19772
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
19773
- }
19774
- ),
19775
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19776
- ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
19777
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19778
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19779
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19780
- sizeValue,
19781
- "px"
19782
- ] }),
19783
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
19784
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19785
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19786
- ]
19787
- }
19788
- ),
19789
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19416
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19417
+ VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19418
+ ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19419
+ ] }),
19420
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19421
+ HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19422
+ TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19423
+ ] }),
19424
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19425
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19426
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19427
+ sizeValue,
19428
+ "px"
19429
+ ] }),
19430
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
19431
+ ] }),
19432
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19433
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19434
+ currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19435
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19436
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19437
+ ] }),
19438
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19439
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
19440
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
19441
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19442
+ ] }),
19443
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19444
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19445
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19446
+ ] }),
19447
+ error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19790
19448
  ]
19791
19449
  }
19792
- ) });
19450
+ );
19793
19451
  }
19794
19452
  function findMediaStripSlots(tree) {
19795
19453
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19808,23 +19466,31 @@ function AiMediaStripOverlay({
19808
19466
  }) {
19809
19467
  const [hover, setHover] = (0, import_react12.useState)(null);
19810
19468
  const [active, setActive] = (0, import_react12.useState)(null);
19811
- const [itemEditOn, setItemEditOn] = (0, import_react12.useState)(false);
19812
- const [linkOpen, setLinkOpen] = (0, import_react12.useState)(false);
19813
19469
  const [pending, setPending] = (0, import_react12.useState)(false);
19814
19470
  const [error, setError] = (0, import_react12.useState)(null);
19815
19471
  const activeRef = (0, import_react12.useRef)(null);
19816
19472
  activeRef.current = active;
19817
- const linkOpenRef = (0, import_react12.useRef)(false);
19818
- linkOpenRef.current = linkOpen;
19819
19473
  (0, import_react12.useEffect)(() => {
19820
19474
  const onMove = (e) => {
19821
- const ref = itemRefFromTarget(e.target);
19822
19475
  const t = e.target;
19823
- const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19824
- setHover((prev) => {
19825
- const next = ref && !overEditable ? ref : null;
19826
- return sameRef(prev, next) ? prev : next;
19827
- });
19476
+ if (!(t instanceof HTMLElement)) return;
19477
+ if (t.closest("[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review]")) {
19478
+ return;
19479
+ }
19480
+ const itemEl = t.closest("[data-ohw-media-strip-item]");
19481
+ if (!itemEl) {
19482
+ setHover(null);
19483
+ return;
19484
+ }
19485
+ const sectionEl = itemEl.closest("[data-ohw-section]");
19486
+ const unit = sectionEl ? movableUnit(sectionEl) : null;
19487
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19488
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19489
+ if (!sectionId || Number.isNaN(index)) {
19490
+ setHover(null);
19491
+ return;
19492
+ }
19493
+ setHover({ sectionId, index });
19828
19494
  };
19829
19495
  const onLeave = () => setHover(null);
19830
19496
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19836,25 +19502,23 @@ function AiMediaStripOverlay({
19836
19502
  }, []);
19837
19503
  (0, import_react12.useEffect)(() => {
19838
19504
  const onClick = (e) => {
19505
+ const current = activeRef.current;
19506
+ if (!current) return;
19839
19507
  const t = e.target;
19840
- if (!(t instanceof Element)) return;
19841
- if (t.closest(CHROME_SELECTOR)) return;
19842
- const ref = itemRefFromTarget(t);
19843
- if (sameRef(activeRef.current, ref)) return;
19844
- if (ref) clearInteractionChromeRef.current();
19845
- setItemEditOn(false);
19508
+ if (!(t instanceof HTMLElement)) return;
19509
+ if (t.closest("[data-ohw-item-interaction]")) return;
19510
+ const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19511
+ if (itemEl && itemEl.contains(t)) return;
19512
+ setActive(null);
19846
19513
  setError(null);
19847
- setActive(ref);
19848
19514
  };
19849
19515
  document.addEventListener("click", onClick, true);
19850
19516
  return () => document.removeEventListener("click", onClick, true);
19851
- }, [clearInteractionChromeRef]);
19517
+ }, []);
19852
19518
  (0, import_react12.useEffect)(() => {
19853
19519
  const onBlur = () => {
19854
19520
  if (!activeRef.current) return;
19855
19521
  setActive(null);
19856
- setItemEditOn(false);
19857
- setLinkOpen(false);
19858
19522
  setError(null);
19859
19523
  };
19860
19524
  window.addEventListener("blur", onBlur);
@@ -19864,10 +19528,7 @@ function AiMediaStripOverlay({
19864
19528
  const onKeyDown = (e) => {
19865
19529
  if (e.key !== "Escape") return;
19866
19530
  if (!activeRef.current) return;
19867
- if (linkOpenRef.current) return;
19868
- if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19869
19531
  setActive(null);
19870
- setItemEditOn(false);
19871
19532
  setError(null);
19872
19533
  };
19873
19534
  document.addEventListener("keydown", onKeyDown);
@@ -19901,133 +19562,137 @@ function AiMediaStripOverlay({
19901
19562
  tree: nextTree,
19902
19563
  label: entry.label,
19903
19564
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19904
- ...entry.brand ? { brand: entry.brand } : {},
19905
- // The user is already looking at the strip they just edited — recentering the viewport
19906
- // on every edit reads as the section jumping around.
19907
- skipScrollIntoView: true
19565
+ ...entry.brand ? { brand: entry.brand } : {}
19908
19566
  });
19909
19567
  return true;
19910
19568
  },
19911
19569
  [findEntry, postToParent2, applyTreeLocalRef]
19912
19570
  );
19913
19571
  const activeEntry = active ? findEntry(active.sectionId) : null;
19572
+ const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19914
19573
  const activeItemRect = useLiveItemRect(active);
19915
- const activeStripRect = useLiveItemRect(active, true);
19916
- const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
19917
- const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
19918
- const activeItem = active ? activeItems[active.index] : void 0;
19919
- const activeHref = activeItem?.href ?? "";
19920
- const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19921
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
19922
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
19923
- activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
19924
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
19925
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19926
- MediaStripToolbar,
19927
- {
19928
- entry: activeEntry,
19929
- index: active.index,
19930
- pending,
19931
- error,
19932
- itemEditOn,
19933
- onToggleItemEdit: () => setItemEditOn((on) => !on),
19934
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19935
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19936
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19937
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19938
- onResize: (delta) => {
19939
- const slots = findMediaStripSlots(activeEntry.tree);
19940
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19941
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19942
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19943
- },
19944
- onOpenLink: () => setLinkOpen(true),
19945
- onAddItem: () => {
19946
- void requestAssetPick(postToParent2).then((picked) => {
19947
- if (!picked) return;
19948
- const item = { assetId: picked.assetId, alt: "Logo" };
19574
+ const TOOLBAR_APPROX_H = 170;
19575
+ const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19576
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
19577
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19578
+ "button",
19579
+ {
19580
+ type: "button",
19581
+ "data-ohw-toolbar": "",
19582
+ onClick: () => {
19583
+ clearInteractionChromeRef.current();
19584
+ setActive(hover);
19585
+ },
19586
+ "aria-label": "Configure media item",
19587
+ style: {
19588
+ position: "fixed",
19589
+ top: hoverHandleRect.top + 8,
19590
+ left: hoverHandleRect.left + hoverHandleRect.width - 36,
19591
+ width: 28,
19592
+ height: 28,
19593
+ borderRadius: 8,
19594
+ border: `1.5px dashed ${PRIMARY3}`,
19595
+ background: "#ffffff",
19596
+ color: PRIMARY3,
19597
+ display: "flex",
19598
+ alignItems: "center",
19599
+ justifyContent: "center",
19600
+ cursor: "pointer",
19601
+ zIndex: 2147483643,
19602
+ fontSize: 14,
19603
+ fontWeight: 700
19604
+ },
19605
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
19606
+ }
19607
+ ),
19608
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19609
+ ItemInteractionLayer,
19610
+ {
19611
+ rect: activeItemRect,
19612
+ state: toolbarState,
19613
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19614
+ MediaStripToolbar,
19615
+ {
19616
+ entry: activeEntry,
19617
+ index: active.index,
19618
+ pending,
19619
+ error,
19620
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19621
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19622
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19623
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19624
+ onResize: (delta) => {
19625
+ const slots = findMediaStripSlots(activeEntry.tree);
19626
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19627
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19628
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19629
+ },
19630
+ onSetAlt: (alt) => {
19631
+ void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19632
+ },
19633
+ onSetLink: (href, linkTarget) => {
19949
19634
  void runMutation(
19950
19635
  active.sectionId,
19951
- (tree) => addMediaStripItem(tree, item, active.index),
19952
- { [picked.assetId]: picked.url }
19953
- ).then((applied) => {
19954
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19636
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19637
+ );
19638
+ },
19639
+ onAddItem: () => {
19640
+ void requestAssetPick(postToParent2).then((picked) => {
19641
+ if (!picked) return;
19642
+ const item = { assetId: picked.assetId, alt: "Logo" };
19643
+ void runMutation(
19644
+ active.sectionId,
19645
+ (tree) => addMediaStripItem(tree, item, active.index),
19646
+ { [picked.assetId]: picked.url }
19647
+ ).then((applied) => {
19648
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19649
+ });
19955
19650
  });
19956
- });
19957
- },
19958
- onChangeImage: () => {
19959
- void requestAssetPick(postToParent2).then((picked) => {
19960
- if (!picked) return;
19961
- void runMutation(
19962
- active.sectionId,
19963
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19964
- { [picked.assetId]: picked.url }
19651
+ },
19652
+ onChangeImage: () => {
19653
+ void requestAssetPick(postToParent2).then((picked) => {
19654
+ if (!picked) return;
19655
+ void runMutation(
19656
+ active.sectionId,
19657
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19658
+ { [picked.assetId]: picked.url }
19659
+ );
19660
+ });
19661
+ },
19662
+ onRemoveItem: () => {
19663
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19664
+ (applied) => {
19665
+ if (applied) setActive(null);
19666
+ }
19965
19667
  );
19966
- });
19967
- },
19968
- onRemoveItem: () => {
19969
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19970
- (applied) => {
19971
- if (applied) setActive(null);
19972
- }
19973
- );
19974
- },
19975
- onMoveLeft: () => {
19976
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19977
- (applied) => {
19978
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19979
- }
19980
- );
19981
- },
19982
- onMoveRight: () => {
19983
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19984
- (applied) => {
19985
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19986
- }
19987
- );
19988
- }
19989
- }
19990
- ) }),
19991
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19992
- "div",
19993
- {
19994
- "data-ohw-bridge": "",
19995
- "data-ohw-item-interaction": "",
19996
- "aria-hidden": true,
19997
- className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
19998
- style: {
19999
- top: activeItemRect.top + activeItemRect.height + 10,
20000
- left: activeItemRect.left - 5,
20001
- background: PRIMARY3,
20002
- zIndex: 2147483644
20003
- },
20004
- children: "Media item"
20005
- }
20006
- ),
20007
- linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20008
- LinkModal,
20009
- {
20010
- href: activeHref,
20011
- linkTarget: activeTarget,
20012
- onClose: () => setLinkOpen(false),
20013
- onSave: (href, linkTarget) => {
20014
- void runMutation(
20015
- active.sectionId,
20016
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20017
- );
19668
+ },
19669
+ onMoveLeft: () => {
19670
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19671
+ (applied) => {
19672
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19673
+ }
19674
+ );
19675
+ },
19676
+ onMoveRight: () => {
19677
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19678
+ (applied) => {
19679
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19680
+ }
19681
+ );
19682
+ }
20018
19683
  }
20019
- }
20020
- )
20021
- ] })
19684
+ )
19685
+ }
19686
+ )
20022
19687
  ] });
20023
19688
  }
20024
19689
 
20025
19690
  // src/ui/ai-section/AiPricingCardOverlay.tsx
20026
19691
  var import_react13 = require("react");
20027
- var import_lucide_react10 = require("lucide-react");
20028
- var import_jsx_runtime22 = require("react/jsx-runtime");
19692
+ var import_lucide_react9 = require("lucide-react");
19693
+ var import_jsx_runtime21 = require("react/jsx-runtime");
20029
19694
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
20030
- var CHROME_SELECTOR2 = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
19695
+ var CHROME_SELECTOR = "[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-link-modal-root], [data-ohw-section-picker], [data-ohw-ai-review], [data-ohw-more-menu]";
20031
19696
  function findPricingCardElement(sectionId, index) {
20032
19697
  const sectionEl = findByInstanceId(sectionId);
20033
19698
  if (!sectionEl) return null;
@@ -20039,7 +19704,7 @@ function findPricingCardElement(sectionId, index) {
20039
19704
  }
20040
19705
  function cardRefFromTarget(target) {
20041
19706
  if (!(target instanceof Element)) return null;
20042
- if (target.closest(CHROME_SELECTOR2)) return null;
19707
+ if (target.closest(CHROME_SELECTOR)) return null;
20043
19708
  const cardEl = target.closest("[data-ohw-pricing-card]");
20044
19709
  if (!cardEl) return null;
20045
19710
  const sectionEl = cardEl.closest("[data-ohw-section]");
@@ -20049,21 +19714,21 @@ function cardRefFromTarget(target) {
20049
19714
  if (!sectionId || Number.isNaN(index)) return null;
20050
19715
  return { sectionId, index };
20051
19716
  }
20052
- function sameRef2(a, b) {
19717
+ function sameRef(a, b) {
20053
19718
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
20054
19719
  }
20055
- function rectOf2(el) {
19720
+ function rectOf(el) {
20056
19721
  if (!el) return null;
20057
19722
  const r2 = el.getBoundingClientRect();
20058
19723
  if (r2.width <= 0 || r2.height <= 0) return null;
20059
19724
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20060
19725
  }
20061
19726
  function readRect3(ref) {
20062
- return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19727
+ return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20063
19728
  }
20064
19729
  function readGridRect(ref) {
20065
19730
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
20066
- return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19731
+ return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20067
19732
  }
20068
19733
  function useLiveCardRect(ref, grid = false) {
20069
19734
  const [rect, setRect] = (0, import_react13.useState)(null);
@@ -20093,7 +19758,7 @@ function useLiveCardRect(ref, grid = false) {
20093
19758
  }
20094
19759
  var TOOLBAR_GRID_GAP = 52;
20095
19760
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20096
- var TOOLBAR_EDGE_MARGIN3 = 4;
19761
+ var TOOLBAR_EDGE_MARGIN2 = 4;
20097
19762
  function GridToolbarSlot({ gridRect, children }) {
20098
19763
  const slotRef = (0, import_react13.useRef)(null);
20099
19764
  const [shift, setShift] = (0, import_react13.useState)(0);
@@ -20105,7 +19770,7 @@ function GridToolbarSlot({ gridRect, children }) {
20105
19770
  const w = slot.offsetWidth;
20106
19771
  if (w <= 0) return;
20107
19772
  const half = w / 2;
20108
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19773
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20109
19774
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
20110
19775
  };
20111
19776
  clamp();
@@ -20114,7 +19779,7 @@ function GridToolbarSlot({ gridRect, children }) {
20114
19779
  return () => ro.disconnect();
20115
19780
  }, [centerX, children]);
20116
19781
  const mobile = window.innerWidth <= 480;
20117
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19782
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20118
19783
  "div",
20119
19784
  {
20120
19785
  ref: slotRef,
@@ -20149,7 +19814,7 @@ function requestValidateTree2(postToParent2, tree) {
20149
19814
  });
20150
19815
  }
20151
19816
  function StyleSwatch({ style }) {
20152
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19817
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20153
19818
  "span",
20154
19819
  {
20155
19820
  "aria-hidden": true,
@@ -20163,35 +19828,35 @@ function StyleSwatch({ style }) {
20163
19828
  );
20164
19829
  }
20165
19830
  function ButtonGlyph() {
20166
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20167
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20168
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19831
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19832
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19833
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20169
19834
  ] });
20170
19835
  }
20171
19836
  function FeatureGlyph({ mode }) {
20172
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20173
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20174
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20175
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20176
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20177
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20178
- mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19837
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19838
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19839
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19840
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19841
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19842
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19843
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20179
19844
  ] });
20180
19845
  }
20181
- function ToolbarAction2({
19846
+ function ToolbarAction({
20182
19847
  label,
20183
19848
  onClick,
20184
19849
  disabled = false,
20185
19850
  children
20186
19851
  }) {
20187
- const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20188
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20189
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
20190
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19852
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19853
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19854
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
19855
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20191
19856
  ] });
20192
19857
  }
20193
- function ToolbarSeparator2() {
20194
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19858
+ function ToolbarSeparator() {
19859
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20195
19860
  }
20196
19861
  function CardStyleMenu({
20197
19862
  value,
@@ -20199,7 +19864,7 @@ function CardStyleMenu({
20199
19864
  disabled = false
20200
19865
  }) {
20201
19866
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20202
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19867
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20203
19868
  "button",
20204
19869
  {
20205
19870
  type: "button",
@@ -20210,28 +19875,28 @@ function CardStyleMenu({
20210
19875
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20211
19876
  ),
20212
19877
  children: [
20213
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
20214
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20215
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
19878
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
19879
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
19880
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20216
19881
  ]
20217
19882
  }
20218
19883
  );
20219
19884
  if (disabled) {
20220
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20221
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20222
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20223
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
20224
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
19885
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19886
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
19887
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19888
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
19889
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20225
19890
  ] })
20226
19891
  ] });
20227
19892
  }
20228
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20229
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20230
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
20231
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20232
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
19893
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19894
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
19895
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
19896
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
19897
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20233
19898
  const selected = style.value === value;
20234
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19899
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20235
19900
  DropdownMenuItem,
20236
19901
  {
20237
19902
  role: "menuitemradio",
@@ -20239,9 +19904,9 @@ function CardStyleMenu({
20239
19904
  onSelect: () => onChange(style.value),
20240
19905
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20241
19906
  children: [
20242
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
20243
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
20244
- selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
19907
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
19908
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
19909
+ selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
20245
19910
  ]
20246
19911
  },
20247
19912
  style.value
@@ -20271,7 +19936,7 @@ function PricingCardToolbar({
20271
19936
  const style = pricingCardStyle(entry.tree, index);
20272
19937
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20273
19938
  const mobile = window.innerWidth <= 480;
20274
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19939
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20275
19940
  "div",
20276
19941
  {
20277
19942
  "data-ohw-bridge": "",
@@ -20283,7 +19948,7 @@ function PricingCardToolbar({
20283
19948
  ),
20284
19949
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20285
19950
  children: [
20286
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
19951
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20287
19952
  "div",
20288
19953
  {
20289
19954
  className: cn(
@@ -20292,8 +19957,8 @@ function PricingCardToolbar({
20292
19957
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20293
19958
  ),
20294
19959
  children: [
20295
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20296
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
19960
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
19961
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20297
19962
  CustomToolbarButton,
20298
19963
  {
20299
19964
  type: "button",
@@ -20301,8 +19966,8 @@ function PricingCardToolbar({
20301
19966
  "aria-pressed": featuredTag,
20302
19967
  onClick: () => onSetFeaturedTag(!featuredTag),
20303
19968
  className: "group size-8",
20304
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20305
- import_lucide_react10.Star,
19969
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19970
+ import_lucide_react9.Star,
20306
19971
  {
20307
19972
  size: 16,
20308
19973
  fill: "currentColor",
@@ -20316,25 +19981,25 @@ function PricingCardToolbar({
20316
19981
  )
20317
19982
  }
20318
19983
  ) }),
20319
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
19984
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20320
19985
  ] }),
20321
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20322
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20323
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20324
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
20325
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
20326
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
20327
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
19986
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19987
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
19988
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19989
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
19990
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "relative inline-flex", children: [
19991
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
19992
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20328
19993
  ] }) }),
20329
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
20330
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
20331
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20332
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20333
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
19994
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "add" }) }),
19995
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "remove" }) }),
19996
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
19997
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
19998
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) })
20334
19999
  ]
20335
20000
  }
20336
20001
  ),
20337
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20002
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20338
20003
  ]
20339
20004
  }
20340
20005
  ) });
@@ -20368,7 +20033,7 @@ function AiPricingCardOverlay({
20368
20033
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20369
20034
  setHover((prev) => {
20370
20035
  const next = ref && !overEditable ? ref : null;
20371
- return sameRef2(prev, next) ? prev : next;
20036
+ return sameRef(prev, next) ? prev : next;
20372
20037
  });
20373
20038
  };
20374
20039
  const onLeave = () => setHover(null);
@@ -20383,10 +20048,10 @@ function AiPricingCardOverlay({
20383
20048
  const onClick = (e) => {
20384
20049
  const t = e.target;
20385
20050
  if (!(t instanceof Element)) return;
20386
- if (t.closest(CHROME_SELECTOR2)) return;
20051
+ if (t.closest(CHROME_SELECTOR)) return;
20387
20052
  const ref = cardRefFromTarget(t);
20388
- setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20389
- if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20053
+ setActive((prev) => sameRef(prev, ref) ? prev : ref);
20054
+ if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20390
20055
  };
20391
20056
  document.addEventListener("click", onClick, true);
20392
20057
  return () => document.removeEventListener("click", onClick, true);
@@ -20451,12 +20116,12 @@ function AiPricingCardOverlay({
20451
20116
  const activeEntry = active ? findEntry(active.sectionId) : null;
20452
20117
  const activeCardRect = useLiveCardRect(active);
20453
20118
  const activeGridRect = useLiveCardRect(active, true);
20454
- const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20455
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20456
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20457
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20458
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20459
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20119
+ const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20120
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20121
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20122
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20123
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20124
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20460
20125
  PricingCardToolbar,
20461
20126
  {
20462
20127
  entry: activeEntry,
@@ -20484,7 +20149,7 @@ function AiPricingCardOverlay({
20484
20149
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20485
20150
  }
20486
20151
  ) }),
20487
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20152
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20488
20153
  "div",
20489
20154
  {
20490
20155
  "data-ohw-bridge": "",
@@ -20506,7 +20171,7 @@ function AiPricingCardOverlay({
20506
20171
 
20507
20172
  // src/ui/ai-section/AiVideoOverlay.tsx
20508
20173
  var import_react14 = require("react");
20509
- var import_lucide_react11 = require("lucide-react");
20174
+ var import_lucide_react10 = require("lucide-react");
20510
20175
 
20511
20176
  // src/lib/ai-video-tree.ts
20512
20177
  function resolveVideoBlock(tree, path) {
@@ -20548,11 +20213,39 @@ function clearVideo(tree, path) {
20548
20213
  });
20549
20214
  }
20550
20215
 
20216
+ // src/lib/youtube.ts
20217
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20218
+ function extractYouTubeId(input) {
20219
+ const trimmed = input.trim();
20220
+ if (!trimmed) return null;
20221
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20222
+ let url;
20223
+ try {
20224
+ url = new URL(trimmed);
20225
+ } catch {
20226
+ return null;
20227
+ }
20228
+ const host = url.hostname.replace(/^www\./, "");
20229
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20230
+ return null;
20231
+ }
20232
+ let candidate = null;
20233
+ if (host === "youtu.be") {
20234
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
20235
+ } else if (url.pathname === "/watch") {
20236
+ candidate = url.searchParams.get("v");
20237
+ } else {
20238
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20239
+ candidate = match ? match[1] : null;
20240
+ }
20241
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20242
+ }
20243
+
20551
20244
  // src/ui/ai-section/AiVideoOverlay.tsx
20552
- var import_jsx_runtime23 = require("react/jsx-runtime");
20245
+ var import_jsx_runtime22 = require("react/jsx-runtime");
20553
20246
  var PRIMARY5 = "#0885FE";
20554
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20555
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20247
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20248
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20556
20249
  function findVideoBlockElement(sectionId, path) {
20557
20250
  const sectionEl = findByInstanceId(sectionId);
20558
20251
  if (!sectionEl) return null;
@@ -20612,12 +20305,12 @@ function requestValidateTree3(postToParent2, tree) {
20612
20305
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20613
20306
  });
20614
20307
  }
20615
- function Pill({
20308
+ function Pill2({
20616
20309
  label,
20617
20310
  onClick,
20618
20311
  disabled
20619
20312
  }) {
20620
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20313
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20621
20314
  "button",
20622
20315
  {
20623
20316
  type: "button",
@@ -20633,7 +20326,7 @@ function Pill({
20633
20326
  border: "none",
20634
20327
  cursor: disabled ? "default" : "pointer",
20635
20328
  background: "#ffffff",
20636
- color: OHW_BLUE_DARK,
20329
+ color: OHW_BLUE_DARK2,
20637
20330
  opacity: disabled ? 0.4 : 1,
20638
20331
  fontSize: 12,
20639
20332
  lineHeight: "16px",
@@ -20676,8 +20369,8 @@ function VideoUrlInput({ value, onCommit }) {
20676
20369
  onCommit(id);
20677
20370
  }
20678
20371
  };
20679
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20680
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20372
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20373
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20681
20374
  "div",
20682
20375
  {
20683
20376
  style: {
@@ -20693,12 +20386,12 @@ function VideoUrlInput({ value, onCommit }) {
20693
20386
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20694
20387
  },
20695
20388
  children: [
20696
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20389
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20697
20390
  "span",
20698
20391
  {
20699
20392
  style: {
20700
20393
  flex: "0 0 auto",
20701
- color: OHW_BLUE_DARK,
20394
+ color: OHW_BLUE_DARK2,
20702
20395
  fontSize: 10,
20703
20396
  lineHeight: "16px",
20704
20397
  fontWeight: 700,
@@ -20708,7 +20401,7 @@ function VideoUrlInput({ value, onCommit }) {
20708
20401
  children: "Video"
20709
20402
  }
20710
20403
  ),
20711
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20404
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20712
20405
  "input",
20713
20406
  {
20714
20407
  type: "text",
@@ -20745,7 +20438,7 @@ function VideoUrlInput({ value, onCommit }) {
20745
20438
  ]
20746
20439
  }
20747
20440
  ),
20748
- invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20441
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20749
20442
  ] });
20750
20443
  }
20751
20444
  function VideoToolbar({
@@ -20755,7 +20448,7 @@ function VideoToolbar({
20755
20448
  onSetVideoId,
20756
20449
  onRemove
20757
20450
  }) {
20758
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20451
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20759
20452
  "div",
20760
20453
  {
20761
20454
  "data-ohw-bridge": "",
@@ -20767,7 +20460,7 @@ function VideoToolbar({
20767
20460
  gap: 6,
20768
20461
  alignItems: "center",
20769
20462
  width: 280,
20770
- background: OHW_BLUE,
20463
+ background: OHW_BLUE2,
20771
20464
  padding: 8,
20772
20465
  borderRadius: 12,
20773
20466
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20775,9 +20468,9 @@ function VideoToolbar({
20775
20468
  opacity: pending ? 0.6 : 1
20776
20469
  },
20777
20470
  children: [
20778
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20779
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20780
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20471
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20472
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20473
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20781
20474
  ]
20782
20475
  }
20783
20476
  );
@@ -20897,8 +20590,8 @@ function AiVideoOverlay({
20897
20590
  const activeBlockRect = useLiveBlockRect(active);
20898
20591
  const TOOLBAR_APPROX_H = 90;
20899
20592
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20900
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
20901
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20593
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20594
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20902
20595
  "button",
20903
20596
  {
20904
20597
  type: "button",
@@ -20926,15 +20619,15 @@ function AiVideoOverlay({
20926
20619
  fontSize: 14,
20927
20620
  fontWeight: 700
20928
20621
  },
20929
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
20622
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
20930
20623
  }
20931
20624
  ),
20932
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20625
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20933
20626
  ItemInteractionLayer,
20934
20627
  {
20935
20628
  rect: activeBlockRect,
20936
20629
  state: toolbarState,
20937
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20630
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20938
20631
  VideoToolbar,
20939
20632
  {
20940
20633
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20958,7 +20651,7 @@ function AiVideoOverlay({
20958
20651
 
20959
20652
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20960
20653
  var import_react15 = require("react");
20961
- var import_lucide_react12 = require("lucide-react");
20654
+ var import_lucide_react11 = require("lucide-react");
20962
20655
 
20963
20656
  // src/lib/ai-carousel-tree.ts
20964
20657
  function isCarouselBlock(node) {
@@ -21009,10 +20702,10 @@ function setCarouselAutoplay(tree, on) {
21009
20702
  }
21010
20703
 
21011
20704
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
21012
- var import_jsx_runtime24 = require("react/jsx-runtime");
20705
+ var import_jsx_runtime23 = require("react/jsx-runtime");
21013
20706
  var PRIMARY6 = "#0885FE";
21014
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21015
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20707
+ var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20708
+ var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21016
20709
  function findCarouselItemElement(sectionId, index) {
21017
20710
  const sectionEl = findByInstanceId(sectionId);
21018
20711
  if (!sectionEl) return null;
@@ -21091,8 +20784,8 @@ function requestAssetPick2(postToParent2) {
21091
20784
  postToParent2({ type: "ow:asset-pick", id });
21092
20785
  });
21093
20786
  }
21094
- function Pill2({ label, onClick, disabled }) {
21095
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20787
+ function Pill3({ label, onClick, disabled }) {
20788
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21096
20789
  "button",
21097
20790
  {
21098
20791
  type: "button",
@@ -21108,7 +20801,7 @@ function Pill2({ label, onClick, disabled }) {
21108
20801
  border: "none",
21109
20802
  cursor: disabled ? "default" : "pointer",
21110
20803
  background: "#ffffff",
21111
- color: OHW_BLUE_DARK2,
20804
+ color: OHW_BLUE_DARK3,
21112
20805
  opacity: disabled ? 0.4 : 1,
21113
20806
  fontSize: 12,
21114
20807
  lineHeight: "16px",
@@ -21126,7 +20819,7 @@ function TogglePill({
21126
20819
  onToggle,
21127
20820
  disabled
21128
20821
  }) {
21129
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
20822
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21130
20823
  "button",
21131
20824
  {
21132
20825
  type: "button",
@@ -21145,7 +20838,7 @@ function TogglePill({
21145
20838
  border: "none",
21146
20839
  cursor: disabled ? "default" : "pointer",
21147
20840
  background: "#ffffff",
21148
- color: OHW_BLUE_DARK2,
20841
+ color: OHW_BLUE_DARK3,
21149
20842
  opacity: disabled ? 0.4 : 1,
21150
20843
  fontSize: 12,
21151
20844
  lineHeight: "16px",
@@ -21155,7 +20848,7 @@ function TogglePill({
21155
20848
  },
21156
20849
  children: [
21157
20850
  label,
21158
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20851
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21159
20852
  "span",
21160
20853
  {
21161
20854
  "aria-hidden": true,
@@ -21168,10 +20861,10 @@ function TogglePill({
21168
20861
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21169
20862
  // carries the brand colour in the text, and a pale blue track next to it read as
21170
20863
  // "disabled control" rather than "switch that is off".
21171
- background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20864
+ background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21172
20865
  transition: "background 120ms ease"
21173
20866
  },
21174
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
20867
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21175
20868
  "span",
21176
20869
  {
21177
20870
  style: {
@@ -21200,7 +20893,7 @@ function CarouselSlideToolbar({
21200
20893
  onChangeImage,
21201
20894
  onToggleAutoplay
21202
20895
  }) {
21203
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
20896
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21204
20897
  "div",
21205
20898
  {
21206
20899
  "data-ohw-bridge": "",
@@ -21211,7 +20904,7 @@ function CarouselSlideToolbar({
21211
20904
  flexDirection: "column",
21212
20905
  gap: 6,
21213
20906
  alignItems: "center",
21214
- background: OHW_BLUE2,
20907
+ background: OHW_BLUE3,
21215
20908
  padding: 8,
21216
20909
  borderRadius: 12,
21217
20910
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21223,11 +20916,11 @@ function CarouselSlideToolbar({
21223
20916
  pointerEvents: pending ? "none" : "auto"
21224
20917
  },
21225
20918
  children: [
21226
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21227
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
21228
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
20919
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
20920
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
20921
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21229
20922
  ] }),
21230
- error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20923
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21231
20924
  ]
21232
20925
  }
21233
20926
  );
@@ -21367,8 +21060,8 @@ function AiFadeCarouselOverlay({
21367
21060
  const activeItemRect = useLiveItemRect2(active);
21368
21061
  const TOOLBAR_APPROX_H = 90;
21369
21062
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21370
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
21371
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21063
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21064
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21372
21065
  "button",
21373
21066
  {
21374
21067
  type: "button",
@@ -21397,10 +21090,10 @@ function AiFadeCarouselOverlay({
21397
21090
  fontSize: 14,
21398
21091
  fontWeight: 700
21399
21092
  },
21400
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
21093
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
21401
21094
  }
21402
21095
  ),
21403
- swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21096
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21404
21097
  "div",
21405
21098
  {
21406
21099
  ref: skeletonRef,
@@ -21418,15 +21111,15 @@ function AiFadeCarouselOverlay({
21418
21111
  zIndex: 2147483646,
21419
21112
  pointerEvents: "none"
21420
21113
  },
21421
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
21114
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
21422
21115
  }
21423
21116
  ),
21424
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21117
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21425
21118
  ItemInteractionLayer,
21426
21119
  {
21427
21120
  rect: activeItemRect,
21428
21121
  state: toolbarState,
21429
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21122
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21430
21123
  CarouselSlideToolbar,
21431
21124
  {
21432
21125
  pending,
@@ -21617,6 +21310,113 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21617
21310
  // src/ui/link-modal/LinkPopover.tsx
21618
21311
  var import_react19 = require("react");
21619
21312
 
21313
+ // src/ui/dialog.tsx
21314
+ var React9 = __toESM(require("react"), 1);
21315
+ var import_radix_ui6 = require("radix-ui");
21316
+ var import_lucide_react12 = require("lucide-react");
21317
+ var import_jsx_runtime24 = require("react/jsx-runtime");
21318
+ function Dialog2({
21319
+ ...props
21320
+ }) {
21321
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
21322
+ }
21323
+ function DialogPortal({
21324
+ ...props
21325
+ }) {
21326
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
21327
+ }
21328
+ function DialogOverlay({
21329
+ className,
21330
+ ...props
21331
+ }) {
21332
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21333
+ import_radix_ui6.Dialog.Overlay,
21334
+ {
21335
+ "data-slot": "dialog-overlay",
21336
+ "data-ohw-link-modal-root": "",
21337
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21338
+ ...props
21339
+ }
21340
+ );
21341
+ }
21342
+ var DialogContent = React9.forwardRef(
21343
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21344
+ const positionMode = container ? "absolute" : "fixed";
21345
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
21346
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21347
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21348
+ import_radix_ui6.Dialog.Content,
21349
+ {
21350
+ ref,
21351
+ "data-slot": "dialog-content",
21352
+ className: cn(
21353
+ positionMode,
21354
+ "left-1/2 top-1/2 z-[2147483647] flex w-full max-w-[448px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-visible",
21355
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21356
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21357
+ className
21358
+ ),
21359
+ onMouseDown: (e) => e.stopPropagation(),
21360
+ ...props,
21361
+ children: [
21362
+ children,
21363
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21364
+ import_radix_ui6.Dialog.Close,
21365
+ {
21366
+ type: "button",
21367
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21368
+ "aria-label": "Close",
21369
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
21370
+ }
21371
+ ) : null
21372
+ ]
21373
+ }
21374
+ )
21375
+ ] });
21376
+ }
21377
+ );
21378
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
21379
+ function DialogHeader({
21380
+ className,
21381
+ ...props
21382
+ }) {
21383
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21384
+ }
21385
+ function DialogFooter({
21386
+ className,
21387
+ ...props
21388
+ }) {
21389
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21390
+ "div",
21391
+ {
21392
+ className: cn("flex items-center justify-end gap-2", className),
21393
+ ...props
21394
+ }
21395
+ );
21396
+ }
21397
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21398
+ import_radix_ui6.Dialog.Title,
21399
+ {
21400
+ ref,
21401
+ className: cn(
21402
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21403
+ className
21404
+ ),
21405
+ ...props
21406
+ }
21407
+ ));
21408
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
21409
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21410
+ import_radix_ui6.Dialog.Description,
21411
+ {
21412
+ ref,
21413
+ className: cn("text-sm text-muted-foreground", className),
21414
+ ...props
21415
+ }
21416
+ ));
21417
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
21418
+ var DialogClose = import_radix_ui6.Dialog.Close;
21419
+
21620
21420
  // src/ui/link-modal/LinkEditorPanel.tsx
21621
21421
  var import_lucide_react16 = require("lucide-react");
21622
21422
 
@@ -22720,7 +22520,6 @@ function shouldUseDevFixtures() {
22720
22520
  function getLogoElement(el) {
22721
22521
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22722
22522
  if (marked) return marked;
22723
- if (el.closest('[data-ohw-editable="icon"]')) return null;
22724
22523
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22725
22524
  if (!root) return null;
22726
22525
  const anchor = el.closest("a");
@@ -25530,7 +25329,7 @@ function getNavigationSelectionParent(el) {
25530
25329
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25531
25330
  return resolveFooterLinksContainerFrom(el);
25532
25331
  }
25533
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isFooterLinksContainer(el) || isInferredFooterGroup2(el)) {
25332
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25534
25333
  return getNavigationRoot(el);
25535
25334
  }
25536
25335
  return null;
@@ -25752,6 +25551,7 @@ var ICONS = {
25752
25551
  insertUnorderedList: '<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>',
25753
25552
  insertOrderedList: '<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
25754
25553
  };
25554
+ var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25755
25555
  var SELECTION_CHROME_GAP2 = 4;
25756
25556
  var TOOLBAR_STROKE_GAP2 = 4;
25757
25557
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25849,7 +25649,7 @@ function applyVisibleViewport(el, parentScroll) {
25849
25649
  el.style.top = `${top}px`;
25850
25650
  el.style.height = `${height}px`;
25851
25651
  }
25852
- var TOOLBAR_EDGE_MARGIN4 = 4;
25652
+ var TOOLBAR_EDGE_MARGIN3 = 4;
25853
25653
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25854
25654
  const isAbove = transform.includes("translateY(-100%)");
25855
25655
  let visualTop = isAbove ? top - approxH : top;
@@ -25876,8 +25676,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25876
25676
  function clampToolbarLeft(centerX, toolbarWidth) {
25877
25677
  const half = toolbarWidth / 2;
25878
25678
  return Math.max(
25879
- TOOLBAR_EDGE_MARGIN4 + half,
25880
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25679
+ TOOLBAR_EDGE_MARGIN3 + half,
25680
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
25881
25681
  );
25882
25682
  }
25883
25683
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26759,6 +26559,21 @@ function OhhwellsBridge() {
26759
26559
  const [isItemDragging, setIsItemDragging] = (0, import_react24.useState)(false);
26760
26560
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react24.useState)(false);
26761
26561
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26562
+ const [floatingPanel, setFloatingPanel] = (0, import_react24.useState)(null);
26563
+ const floatingPanelOpenRef = (0, import_react24.useRef)(false);
26564
+ floatingPanelOpenRef.current = floatingPanel !== null;
26565
+ const floatingPanelRef = (0, import_react24.useRef)(null);
26566
+ floatingPanelRef.current = floatingPanel;
26567
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react24.useState)(null);
26568
+ const buttonCollectionDragRef = (0, import_react24.useRef)(null);
26569
+ const buttonDropInsertIndexRef = (0, import_react24.useRef)(null);
26570
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
26571
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
26572
+ const buttonPointerDragRef = (0, import_react24.useRef)(null);
26573
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
26574
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
26575
+ const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
26576
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
26762
26577
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react24.useState)(null);
26763
26578
  const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react24.useState)(null);
26764
26579
  const footerDragRef = (0, import_react24.useRef)(null);
@@ -26785,21 +26600,6 @@ function OhhwellsBridge() {
26785
26600
  const stylesRef = (0, import_react24.useRef)("");
26786
26601
  const appliedDrawerRef = (0, import_react24.useRef)(null);
26787
26602
  const pendingDeleteUndoRef = (0, import_react24.useRef)(null);
26788
- const [floatingPanel, setFloatingPanel] = (0, import_react24.useState)(null);
26789
- const floatingPanelOpenRef = (0, import_react24.useRef)(false);
26790
- const floatingPanelRef = (0, import_react24.useRef)(null);
26791
- floatingPanelRef.current = floatingPanel;
26792
- const setFloatingPanelRef = (0, import_react24.useRef)(setFloatingPanel);
26793
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react24.useState)(null);
26794
- const buttonCollectionDragRef = (0, import_react24.useRef)(null);
26795
- const buttonDropInsertIndexRef = (0, import_react24.useRef)(null);
26796
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
26797
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
26798
- const buttonPointerDragRef = (0, import_react24.useRef)(null);
26799
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
26800
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
26801
- const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
26802
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
26803
26603
  const [sitePages, setSitePages] = (0, import_react24.useState)([]);
26804
26604
  const collectionItemsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
26805
26605
  const [sectionsByPath, setSectionsByPath] = (0, import_react24.useState)({});
@@ -26809,18 +26609,7 @@ function OhhwellsBridge() {
26809
26609
  const linkPopoverOpenRef = (0, import_react24.useRef)(false);
26810
26610
  const linkPopoverGraceUntilRef = (0, import_react24.useRef)(0);
26811
26611
  setLinkPopoverRef.current = setLinkPopover;
26812
- setFloatingPanelRef.current = setFloatingPanel;
26813
26612
  linkPopoverSessionRef.current = linkPopover;
26814
- floatingPanelOpenRef.current = Boolean(floatingPanel);
26815
- (0, import_react24.useEffect)(() => {
26816
- const syncViewport = () => {
26817
- const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26818
- setEditorViewport((prev) => prev === next ? prev : next);
26819
- };
26820
- syncViewport();
26821
- window.addEventListener("resize", syncViewport);
26822
- return () => window.removeEventListener("resize", syncViewport);
26823
- }, []);
26824
26613
  (0, import_react24.useEffect)(() => {
26825
26614
  setSectionOrderPersistHandler((entries) => {
26826
26615
  const currentPath = window.location.pathname;
@@ -28554,7 +28343,6 @@ function OhhwellsBridge() {
28554
28343
  applyAiFooterFromContent(content);
28555
28344
  if (typeof content[STYLE_STORE_KEY] === "string") {
28556
28345
  stylesRef.current = content[STYLE_STORE_KEY];
28557
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28558
28346
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28559
28347
  }
28560
28348
  applyBrandChrome(content);
@@ -28565,16 +28353,15 @@ function OhhwellsBridge() {
28565
28353
  if (key === "__ohw_sections") continue;
28566
28354
  if (key === AI_SECTIONS_KEY) continue;
28567
28355
  if (key === AI_FOOTER_KEY) continue;
28568
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28569
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28570
28356
  if (key === BRAND_KIT_KEY) continue;
28571
28357
  if (key === STYLE_STORE_KEY) continue;
28572
28358
  if (BRAND_CHROME_KEYS.has(key)) continue;
28359
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28573
28360
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28361
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28574
28362
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28575
28363
  continue;
28576
28364
  }
28577
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28578
28365
  if (applyVideoSettingNode(key, val)) continue;
28579
28366
  if (applyCarouselNode(key, val)) continue;
28580
28367
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28614,7 +28401,6 @@ function OhhwellsBridge() {
28614
28401
  });
28615
28402
  applyLinkByKey(key, val);
28616
28403
  }
28617
- applySectionEmbeds(content);
28618
28404
  applyLogoFromContent(content);
28619
28405
  applyLogoSizes(content);
28620
28406
  reconcileNavbarItemsFromContent(content);
@@ -28803,22 +28589,20 @@ function OhhwellsBridge() {
28803
28589
  }
28804
28590
  applyAiFooterFromContent(content);
28805
28591
  if (typeof content[STYLE_STORE_KEY] === "string") {
28806
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28807
28592
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28808
28593
  }
28809
28594
  for (const [key, val] of Object.entries(content)) {
28810
28595
  if (key === "__ohw_sections") continue;
28811
28596
  if (key === AI_SECTIONS_KEY) continue;
28812
28597
  if (key === AI_FOOTER_KEY) continue;
28813
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28814
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28815
28598
  if (key === BRAND_KIT_KEY) continue;
28816
28599
  if (key === STYLE_STORE_KEY) continue;
28817
28600
  if (BRAND_CHROME_KEYS.has(key)) continue;
28601
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28602
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28818
28603
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28819
28604
  continue;
28820
28605
  }
28821
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28822
28606
  if (applyVideoSettingNode(key, val)) continue;
28823
28607
  if (applyCarouselNode(key, val)) continue;
28824
28608
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28843,7 +28627,6 @@ function OhhwellsBridge() {
28843
28627
  });
28844
28628
  applyLinkByKey(key, val);
28845
28629
  }
28846
- applySectionEmbeds(content);
28847
28630
  applyLogoFromContent(content);
28848
28631
  reconcileNavbarItemsFromContent(content);
28849
28632
  reconcileFooterOrderFromContent(content);
@@ -29083,11 +28866,26 @@ function OhhwellsBridge() {
29083
28866
  const t2 = setTimeout(measure, 500);
29084
28867
  const ro = new ResizeObserver(schedule);
29085
28868
  ro.observe(document.body);
28869
+ let lastWidth = window.innerWidth;
28870
+ let resizeTimers = [];
28871
+ const clearResizeTimers = () => {
28872
+ resizeTimers.forEach(clearTimeout);
28873
+ resizeTimers = [];
28874
+ };
28875
+ const handleResize = () => {
28876
+ if (window.innerWidth === lastWidth) return;
28877
+ lastWidth = window.innerWidth;
28878
+ clearResizeTimers();
28879
+ resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
28880
+ };
28881
+ window.addEventListener("resize", handleResize);
29086
28882
  return () => {
29087
28883
  clearTimeout(t1);
29088
28884
  clearTimeout(t2);
29089
28885
  if (raf != null) cancelAnimationFrame(raf);
29090
28886
  ro.disconnect();
28887
+ clearResizeTimers();
28888
+ window.removeEventListener("resize", handleResize);
29091
28889
  };
29092
28890
  }, [pathname, isEditMode, postToParent2]);
29093
28891
  (0, import_react24.useEffect)(() => {
@@ -29384,13 +29182,6 @@ function OhhwellsBridge() {
29384
29182
  if (target.closest("[data-ohw-state-toggle]")) return;
29385
29183
  if (target.closest("[data-ohw-max-badge]")) return;
29386
29184
  if (isInsideLinkEditor(target)) return;
29387
- if (isInsideFloatingPanel(target)) return;
29388
- if (target.closest("[data-ohw-form-toolbar]")) return;
29389
- if (target.closest(
29390
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29391
- )) {
29392
- return;
29393
- }
29394
29185
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29395
29186
  clearMediaSelectionRef.current();
29396
29187
  }
@@ -29414,6 +29205,8 @@ function OhhwellsBridge() {
29414
29205
  return;
29415
29206
  }
29416
29207
  }
29208
+ if (isInsideFloatingPanel(target)) return;
29209
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29417
29210
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29418
29211
  if (collectionItem) {
29419
29212
  e.preventDefault();
@@ -29425,6 +29218,11 @@ function OhhwellsBridge() {
29425
29218
  });
29426
29219
  return;
29427
29220
  }
29221
+ if (target.closest(
29222
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29223
+ )) {
29224
+ return;
29225
+ }
29428
29226
  {
29429
29227
  const formEl = getFormElement(target);
29430
29228
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29578,13 +29376,9 @@ function OhhwellsBridge() {
29578
29376
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29579
29377
  e.preventDefault();
29580
29378
  e.stopPropagation();
29379
+ selectIconElementRef.current(editable);
29581
29380
  const aiIcon = editable.hasAttribute("data-ai-icon");
29582
29381
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29583
- if (aiIcon) {
29584
- aiSectionApiRef.current?.selectFromElement(editable);
29585
- } else {
29586
- selectIconElementRef.current(editable);
29587
- }
29588
29382
  postToParentRef.current({
29589
29383
  type: "ow:icon-pick",
29590
29384
  key: editable.dataset.ohwKey ?? "",
@@ -29812,9 +29606,6 @@ function OhhwellsBridge() {
29812
29606
  setHoveredItemRect(null);
29813
29607
  hoveredNavContainerRef.current = null;
29814
29608
  setHoveredNavContainerRect(null);
29815
- siblingHintElRef.current = null;
29816
- setSiblingHintRect(null);
29817
- setSiblingHintRects([]);
29818
29609
  return;
29819
29610
  }
29820
29611
  {
@@ -29935,6 +29726,7 @@ function OhhwellsBridge() {
29935
29726
  hoveredNavContainerRef.current = null;
29936
29727
  setHoveredNavContainerRect(null);
29937
29728
  hoveredItemElRef.current = editable;
29729
+ setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29938
29730
  }
29939
29731
  }
29940
29732
  }
@@ -30644,11 +30436,7 @@ function OhhwellsBridge() {
30644
30436
  };
30645
30437
  const handleMouseMove = (e) => {
30646
30438
  const { clientX, clientY } = e;
30647
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30648
- dismissImageHover();
30649
- clearImageHover();
30650
- return;
30651
- }
30439
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30652
30440
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30653
30441
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30654
30442
  formHoverElRef.current = null;
@@ -30677,12 +30465,7 @@ function OhhwellsBridge() {
30677
30465
  setHoveredItemRect(null);
30678
30466
  hoveredNavContainerRef.current = null;
30679
30467
  setHoveredNavContainerRect(null);
30680
- siblingHintElRef.current = null;
30681
- setSiblingHintRect(null);
30682
- setSiblingHintRects([]);
30683
30468
  dismissImageHover();
30684
- clearImageHover();
30685
- setSectionGap(null);
30686
30469
  return;
30687
30470
  }
30688
30471
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30694,11 +30477,7 @@ function OhhwellsBridge() {
30694
30477
  if (e.data?.type !== "ow:pointer-sync") return;
30695
30478
  const { clientX, clientY } = e.data;
30696
30479
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30697
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30698
- dismissImageHover();
30699
- clearImageHover();
30700
- return;
30701
- }
30480
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30702
30481
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30703
30482
  if (probeSocialsRowAt(clientX, clientY)) return;
30704
30483
  probeSectionGapAt(clientX, clientY);
@@ -31078,7 +30857,6 @@ function OhhwellsBridge() {
31078
30857
  applyAiFooterFromContent(content);
31079
30858
  if (typeof content[STYLE_STORE_KEY] === "string") {
31080
30859
  stylesRef.current = content[STYLE_STORE_KEY];
31081
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31082
30860
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31083
30861
  }
31084
30862
  applyBrandChrome(content);
@@ -31093,16 +30871,15 @@ function OhhwellsBridge() {
31093
30871
  }
31094
30872
  if (key === AI_SECTIONS_KEY) continue;
31095
30873
  if (key === AI_FOOTER_KEY) continue;
31096
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31097
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31098
30874
  if (key === BRAND_KIT_KEY) continue;
31099
30875
  if (key === STYLE_STORE_KEY) continue;
31100
30876
  if (BRAND_CHROME_KEYS.has(key)) continue;
30877
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31101
30878
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30879
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31102
30880
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31103
30881
  continue;
31104
30882
  }
31105
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31106
30883
  if (applyVideoSettingNode(key, val)) continue;
31107
30884
  if (applyCarouselNode(key, val)) continue;
31108
30885
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31128,7 +30905,6 @@ function OhhwellsBridge() {
31128
30905
  });
31129
30906
  applyLinkByKey(key, val);
31130
30907
  }
31131
- applySectionEmbeds(content);
31132
30908
  applyLogoFromContent(content);
31133
30909
  applyLogoSizes(content);
31134
30910
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31356,31 +31132,6 @@ function OhhwellsBridge() {
31356
31132
  postAiSectionsChanged();
31357
31133
  };
31358
31134
  window.addEventListener("message", handleAiDeleteSection);
31359
- const handleAiMoveSection = (e) => {
31360
- if (e.data?.type !== "ow:ai-move-section") return;
31361
- const sectionId = typeof e.data.sectionId === "string" ? e.data.sectionId : "";
31362
- const targetPage = typeof e.data.targetPage === "string" ? e.data.targetPage : "";
31363
- if (!sectionId || !targetPage) return;
31364
- const previous = aiSectionsRef.current;
31365
- const nextState = moveSectionInState(parseAiSectionsState(previous), sectionId, targetPage);
31366
- if (!nextState) return;
31367
- clearInteractionChrome();
31368
- const nextValue = serializeAiSectionsState(nextState);
31369
- aiSectionsRef.current = nextValue;
31370
- applyAiSectionsToDom(nextState);
31371
- const newHeight = document.body.scrollHeight;
31372
- if (newHeight > 50) postToParentRef.current({ type: "ow:height", height: newHeight });
31373
- postToParentRef.current({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: nextValue }] });
31374
- postToParentRef.current({
31375
- type: "ow:ai-section-moved",
31376
- sectionId,
31377
- targetPage,
31378
- previous,
31379
- value: nextValue
31380
- });
31381
- postAiSectionsChanged();
31382
- };
31383
- window.addEventListener("message", handleAiMoveSection);
31384
31135
  const handleAiSetSections = (e) => {
31385
31136
  if (e.data?.type !== "ow:ai-set-sections") return;
31386
31137
  const value = typeof e.data.value === "string" ? e.data.value : "";
@@ -31761,12 +31512,6 @@ function OhhwellsBridge() {
31761
31512
  closeLinkPopoverRef.current();
31762
31513
  return;
31763
31514
  }
31764
- if (floatingPanelOpenRef.current) {
31765
- setFloatingPanelRef.current(null);
31766
- deselectRef.current();
31767
- deactivateRef.current();
31768
- return;
31769
- }
31770
31515
  deselectRef.current();
31771
31516
  deactivateRef.current();
31772
31517
  clearMediaSelectionRef.current();
@@ -32586,7 +32331,6 @@ function OhhwellsBridge() {
32586
32331
  window.removeEventListener("message", handleAiApplyTree);
32587
32332
  window.removeEventListener("message", handleAiApplyFooter);
32588
32333
  window.removeEventListener("message", handleAiDeleteSection);
32589
- window.removeEventListener("message", handleAiMoveSection);
32590
32334
  window.removeEventListener("message", handleAiSetSections);
32591
32335
  window.removeEventListener("message", handleAiSetBrand);
32592
32336
  window.removeEventListener("message", handleAiSetStyles);
@@ -32603,10 +32347,10 @@ function OhhwellsBridge() {
32603
32347
  window.removeEventListener("message", handleDuplicateSection);
32604
32348
  window.removeEventListener("message", handleDeactivate);
32605
32349
  window.removeEventListener("message", handleSelectNav);
32350
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32606
32351
  window.removeEventListener("message", handleToastAction);
32607
32352
  window.removeEventListener("message", handleFormCount);
32608
32353
  window.removeEventListener("message", handleUiEscape);
32609
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32610
32354
  autoSaveTimers.current.forEach(clearTimeout);
32611
32355
  autoSaveTimers.current.clear();
32612
32356
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32900,7 +32644,7 @@ function OhhwellsBridge() {
32900
32644
  postToParent2({
32901
32645
  type: "ow:ready",
32902
32646
  version: "1",
32903
- bridgeVersion: "0.1.164-next.439",
32647
+ bridgeVersion: "0.1.165",
32904
32648
  path: pathname,
32905
32649
  nodes: collectEditableNodes(editContentRef.current),
32906
32650
  sections