@ohhwells/bridge 0.1.177 → 0.1.179-next.473

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
@@ -1009,6 +1009,11 @@ function findImages(deps, section) {
1009
1009
  if (url && style.objectFit === "cover") out.push({ el, url, urlLayer: -1 });
1010
1010
  continue;
1011
1011
  }
1012
+ if (el.tagName === "VIDEO") {
1013
+ const url = el.poster;
1014
+ if (url && style.objectFit === "cover") out.push({ el, url, urlLayer: -1 });
1015
+ continue;
1016
+ }
1012
1017
  const layers = bgLayers(style);
1013
1018
  const urlLayer = layers.findIndex((l) => urlOf(l) !== null);
1014
1019
  if (urlLayer >= 0) out.push({ el, url: urlOf(layers[urlLayer]), urlLayer });
@@ -1430,7 +1435,8 @@ function toneOverlayLogos(deps, root, photoSections, boxes) {
1430
1435
  if (root.matches(OVERLAY_LOGO_SELECTOR)) logos.unshift(root);
1431
1436
  for (const logo of logos) {
1432
1437
  if (onOwnSurface(deps, logo, root)) {
1433
- logo.removeAttribute(OVERLAY_TONE_ATTR);
1438
+ if (paintOver(deps.style(logo), { r: 0, g: 0, b: 0, a: 0 }).painted) logo.removeAttribute(OVERLAY_TONE_ATTR);
1439
+ else clearOverlayTone(logo);
1434
1440
  continue;
1435
1441
  }
1436
1442
  const box = deps.rect(logo);
@@ -1581,13 +1587,14 @@ var WATCHED_ATTRS = [
1581
1587
  "class",
1582
1588
  "src",
1583
1589
  "srcset",
1590
+ "poster",
1584
1591
  "data-ohw-style-bg",
1585
1592
  "data-ohw-style-bgcolor",
1586
1593
  "data-ohw-style-cardbg",
1587
1594
  // The editor's Default / Hover toggle forces :hover rules through this attribute.
1588
1595
  "data-ohw-active-state"
1589
1596
  ];
1590
- var VISIBILITY_TRANSITIONS = /* @__PURE__ */ new Set(["opacity", "visibility"]);
1597
+ var RESCAN_TRANSITIONS = /* @__PURE__ */ new Set(["opacity", "visibility", "background-color", "background"]);
1591
1598
  function outermostSection(node) {
1592
1599
  let el = node instanceof Element ? node : node?.parentElement ?? null;
1593
1600
  let top = null;
@@ -1652,7 +1659,7 @@ function mountBackgroundTone(doc = document) {
1652
1659
  });
1653
1660
  const onResize = () => schedule();
1654
1661
  const onTransitionEnd = (event) => {
1655
- if (!VISIBILITY_TRANSITIONS.has(event.propertyName)) return;
1662
+ if (!RESCAN_TRANSITIONS.has(event.propertyName)) return;
1656
1663
  const section = outermostSection(event.target);
1657
1664
  if (section) schedule(section);
1658
1665
  };
@@ -8227,6 +8234,21 @@ function pricingCardFeatureCount(tree, index) {
8227
8234
  const target = findPricingCollection(tree)?.children?.[index];
8228
8235
  return target ? pricingFeatureList(target).length : 0;
8229
8236
  }
8237
+ function prevailingFeatureIcon(features) {
8238
+ const counts = /* @__PURE__ */ new Map();
8239
+ for (const row of features) {
8240
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
8241
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
8242
+ entry.count += 1;
8243
+ counts.set(key, entry);
8244
+ }
8245
+ let best = null;
8246
+ for (const entry of counts.values()) {
8247
+ if (!best || entry.count > best.count) best = entry;
8248
+ }
8249
+ if (!best) return {};
8250
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
8251
+ }
8230
8252
  function addPricingCardFeature(tree, index, text) {
8231
8253
  return withPricingCollection(tree, (collection) => {
8232
8254
  const children = collection.children;
@@ -8235,7 +8257,7 @@ function addPricingCardFeature(tree, index, text) {
8235
8257
  const features = pricingFeatureList(target);
8236
8258
  if (features.length >= PRICING_FEATURES_MAX) return false;
8237
8259
  target.slots = target.slots ?? {};
8238
- target.slots.features = [...features, { text }];
8260
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
8239
8261
  return true;
8240
8262
  });
8241
8263
  }
@@ -9770,7 +9792,7 @@ var AI_MOBILE_CSS = [
9770
9792
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
9771
9793
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
9772
9794
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
9773
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
9795
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
9774
9796
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
9775
9797
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
9776
9798
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -9786,8 +9808,10 @@ var AI_MOBILE_CSS = [
9786
9808
  "[data-ai-section]{overflow-x:hidden}",
9787
9809
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
9788
9810
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
9789
- // still got a 20px band of section background down both sides on a phone.
9790
- "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
9811
+ // still got a 20px band of section background down both sides on a phone. The footer's own
9812
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
9813
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
9814
+ "[data-ai-container]{padding:0 20px !important}",
9791
9815
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
9792
9816
  "[data-ai-cell]{width:100%;min-width:0}",
9793
9817
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -9992,6 +10016,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
9992
10016
  function textAttrs(ctx, path) {
9993
10017
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
9994
10018
  }
10019
+ var AI_RESPONSIVE_CSS = [
10020
+ "@media (max-width: 960px) {",
10021
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
10022
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
10023
+ "}",
10024
+ "@media (max-width: 640px) {",
10025
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
10026
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
10027
+ // Group containers flatten to a column on phones; span placements come along for free.
10028
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
10029
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
10030
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
10031
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
10032
+ // layered text used to be.
10033
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
10034
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
10035
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
10036
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
10037
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
10038
+ // other rule had already been taught to stand down.
10039
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
10040
+ " [data-ai-responsive] { overflow-x: hidden; }",
10041
+ " [data-ai-responsive] img { max-width: 100%; }",
10042
+ "}"
10043
+ ].join("\n");
9995
10044
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
9996
10045
  function MediaBox({
9997
10046
  refValue,
@@ -10046,7 +10095,7 @@ function MediaBox({
10046
10095
  position: fill ? "absolute" : void 0,
10047
10096
  inset: fill ? 0 : void 0,
10048
10097
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
10049
- height: fill ? "100%" : void 0,
10098
+ height: fill ? "100%" : fixedSize ? height : void 0,
10050
10099
  aspectRatio: fill ? void 0 : aspectRatio,
10051
10100
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
10052
10101
  borderRadius: radius,
@@ -11548,7 +11597,7 @@ function CollectionBlock({ node, ctx, path }) {
11548
11597
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
11549
11598
  "div",
11550
11599
  {
11551
- "data-ai-grid": "",
11600
+ "data-ai-grid": String(itemsPerRow),
11552
11601
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
11553
11602
  style: {
11554
11603
  display: "grid",
@@ -11850,7 +11899,7 @@ function renderNode(node, ctx, path, ambientAlign) {
11850
11899
  },
11851
11900
  children: [
11852
11901
  i > 0 && ctx.heroOverlapFullBleed ? (
11853
- // The section's `data-ai-container` gave up its max-width/gutter so the base
11902
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
11854
11903
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
11855
11904
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
11856
11905
  // the full section width instead of reading at the usual content width.
@@ -12264,6 +12313,7 @@ function AiTreeRenderer({
12264
12313
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
12265
12314
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
12266
12315
  ...bgAttrs,
12316
+ "data-ai-responsive": "",
12267
12317
  style: {
12268
12318
  position: "relative",
12269
12319
  padding: `${padCss} 0`,
@@ -12277,12 +12327,13 @@ function AiTreeRenderer({
12277
12327
  ...fillHeight ? { display: "grid" } : {}
12278
12328
  },
12279
12329
  children: [
12280
- isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
12330
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
12281
12331
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
12332
+ isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
12282
12333
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
12283
12334
  "div",
12284
12335
  {
12285
- "data-ai-container": "",
12336
+ "data-ai-section-inner": "",
12286
12337
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
12287
12338
  style: {
12288
12339
  position: "relative",
@@ -12299,7 +12350,7 @@ function AiTreeRenderer({
12299
12350
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
12300
12351
  "div",
12301
12352
  {
12302
- "data-ai-row": "",
12353
+ "data-ai-columns": "",
12303
12354
  style: {
12304
12355
  display: "grid",
12305
12356
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -12961,9 +13012,10 @@ function applyAiSectionsToDom(state, options) {
12961
13012
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
12962
13013
  continue;
12963
13014
  }
12964
- const isNewMount = !existing || !existing.container.isConnected;
12965
13015
  let container = existing?.container;
13016
+ let isNewMount = false;
12966
13017
  if (!container || !container.isConnected) {
13018
+ isNewMount = true;
12967
13019
  existing?.root.unmount();
12968
13020
  container?.remove();
12969
13021
  container = document.createElement("div");
@@ -13301,6 +13353,34 @@ function minSpanForFooterBlock(type) {
13301
13353
  return 3;
13302
13354
  }
13303
13355
  }
13356
+ function readLiveSocialItems() {
13357
+ const root = getFooterRoot();
13358
+ const row = root?.querySelector("[data-ohw-socials-row]");
13359
+ if (!row) return [];
13360
+ const items = [];
13361
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
13362
+ const href = anchor.getAttribute("href")?.trim() ?? "";
13363
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
13364
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
13365
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
13366
+ items.push({ platform, href });
13367
+ }
13368
+ return items;
13369
+ }
13370
+ function syncSocialRowsFromDom(tree) {
13371
+ const root = getFooterRoot();
13372
+ if (!root) return;
13373
+ const row = root.querySelector("[data-ohw-socials-row]");
13374
+ const live = readLiveSocialItems();
13375
+ if (row && live.length === 0) return;
13376
+ for (const col of tree.columns) {
13377
+ col.blocks = col.blocks.flatMap((block) => {
13378
+ if (block.type !== "social-row") return [block];
13379
+ if (!row) return [];
13380
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
13381
+ });
13382
+ }
13383
+ }
13304
13384
  function collectBrandBlocks(tree) {
13305
13385
  const brand = [];
13306
13386
  for (const col of tree.columns) {
@@ -13546,6 +13626,7 @@ function textOf2(el) {
13546
13626
  }
13547
13627
  function syncFooterTreeLinksFromDom(tree) {
13548
13628
  const next = cloneTree2(tree);
13629
+ syncSocialRowsFromDom(next);
13549
13630
  const domCols = listFooterColumns().map((col) => {
13550
13631
  const heading = getFooterColumnHeadingEl(col);
13551
13632
  const title = heading ? textOf2(heading) : void 0;
@@ -19371,7 +19452,7 @@ function apiBase() {
19371
19452
  function bridgeVersion() {
19372
19453
  try {
19373
19454
  if (true) {
19374
- return "0.1.177";
19455
+ return "0.1.179-next.473";
19375
19456
  }
19376
19457
  } catch {
19377
19458
  }
@@ -19385,7 +19466,7 @@ function stampBridgeVersionOnDocument() {
19385
19466
  return;
19386
19467
  }
19387
19468
  try {
19388
- const v = true ? "0.1.177" : "";
19469
+ const v = true ? "0.1.179-next.473" : "";
19389
19470
  if (v) {
19390
19471
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
19391
19472
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -20066,6 +20147,7 @@ function MediaOverlay({
20066
20147
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
20067
20148
  );
20068
20149
  }, [isVideo]);
20150
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
20069
20151
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
20070
20152
  const box = {
20071
20153
  position: "fixed",
@@ -20164,10 +20246,9 @@ function MediaOverlay({
20164
20246
  className: "flex items-center justify-center cursor-pointer",
20165
20247
  style: {
20166
20248
  ...box,
20167
- // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
20168
- // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
20169
- // in-document, pointer-events does it natively. The button below opts back in, so
20170
- // Replace still works.
20249
+ // Bare media takes the click: the first selects it, the next opens the picker. Text on
20250
+ // top and cueOnly let clicks fall through. Navbar, logo and buttons over a hero image
20251
+ // never reach here: probeImageAt dismisses the overlay before it can cover them.
20171
20252
  pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
20172
20253
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
20173
20254
  // than hovered. Hover keeps the existing tinted preview.
@@ -20195,15 +20276,18 @@ function MediaOverlay({
20195
20276
  },
20196
20277
  children: [
20197
20278
  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 }),
20198
- isVideo ? "Replace video" : "Replace image"
20279
+ replaceLabel
20199
20280
  ]
20200
20281
  }
20201
20282
  ),
20202
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
20283
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
20203
20284
  "div",
20204
20285
  {
20205
20286
  className: "flex items-center gap-1.5",
20206
- style: { pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto" },
20287
+ style: {
20288
+ // Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
20289
+ pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
20290
+ },
20207
20291
  onClick: (e) => e.stopPropagation(),
20208
20292
  children: [
20209
20293
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
@@ -20212,7 +20296,7 @@ function MediaOverlay({
20212
20296
  "data-ohw-media-overlay": "",
20213
20297
  variant: "outline",
20214
20298
  size: "sm",
20215
- "aria-label": isVideo ? "Replace video" : "Replace image",
20299
+ "aria-label": replaceLabel,
20216
20300
  className: "gap-1.5 cursor-pointer hover:bg-background",
20217
20301
  style: {
20218
20302
  ...OVERLAY_BUTTON_STYLE,
@@ -20233,7 +20317,7 @@ function MediaOverlay({
20233
20317
  },
20234
20318
  children: [
20235
20319
  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 }),
20236
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
20320
+ replaceMode === "full" ? replaceLabel : null
20237
20321
  ]
20238
20322
  }
20239
20323
  ),
@@ -20891,7 +20975,7 @@ function AiSectionOverlay({
20891
20975
 
20892
20976
  // src/ui/ai-section/AiMediaStripOverlay.tsx
20893
20977
  var import_react14 = require("react");
20894
- var import_lucide_react8 = require("lucide-react");
20978
+ var import_lucide_react9 = require("lucide-react");
20895
20979
 
20896
20980
  // src/lib/ai-media-strip-tree.ts
20897
20981
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -21005,14 +21089,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
21005
21089
  return true;
21006
21090
  });
21007
21091
  }
21008
- function setMediaStripItemAlt(tree, index, alt) {
21009
- return withMediaStrip(tree, (block) => {
21010
- const items = block.items;
21011
- if (index < 0 || index >= items.length) return false;
21012
- items[index] = { ...items[index], alt };
21013
- return true;
21014
- });
21015
- }
21016
21092
  function setMediaStripItemLink(tree, index, link) {
21017
21093
  return withMediaStrip(tree, (block) => {
21018
21094
  const items = block.items;
@@ -21030,11 +21106,117 @@ function setMediaStripItemLink(tree, index, link) {
21030
21106
  });
21031
21107
  }
21032
21108
 
21033
- // src/ui/ai-section/AiMediaStripOverlay.tsx
21109
+ // src/ui/dialog.tsx
21110
+ var React9 = __toESM(require("react"), 1);
21111
+ var import_radix_ui6 = require("radix-ui");
21112
+ var import_lucide_react8 = require("lucide-react");
21034
21113
  var import_jsx_runtime20 = require("react/jsx-runtime");
21035
- var PRIMARY3 = "#0885FE";
21036
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
21037
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
21114
+ function Dialog2({
21115
+ ...props
21116
+ }) {
21117
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
21118
+ }
21119
+ function DialogPortal({
21120
+ ...props
21121
+ }) {
21122
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
21123
+ }
21124
+ function DialogOverlay({
21125
+ className,
21126
+ ...props
21127
+ }) {
21128
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21129
+ import_radix_ui6.Dialog.Overlay,
21130
+ {
21131
+ "data-slot": "dialog-overlay",
21132
+ "data-ohw-link-modal-root": "",
21133
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21134
+ ...props
21135
+ }
21136
+ );
21137
+ }
21138
+ var DialogContent = React9.forwardRef(
21139
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21140
+ const positionMode = container ? "absolute" : "fixed";
21141
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
21142
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21143
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
21144
+ import_radix_ui6.Dialog.Content,
21145
+ {
21146
+ ref,
21147
+ "data-slot": "dialog-content",
21148
+ className: cn(
21149
+ positionMode,
21150
+ "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",
21151
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21152
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21153
+ className
21154
+ ),
21155
+ onMouseDown: (e) => e.stopPropagation(),
21156
+ ...props,
21157
+ children: [
21158
+ children,
21159
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21160
+ import_radix_ui6.Dialog.Close,
21161
+ {
21162
+ type: "button",
21163
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21164
+ "aria-label": "Close",
21165
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
21166
+ }
21167
+ ) : null
21168
+ ]
21169
+ }
21170
+ )
21171
+ ] });
21172
+ }
21173
+ );
21174
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
21175
+ function DialogHeader({
21176
+ className,
21177
+ ...props
21178
+ }) {
21179
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21180
+ }
21181
+ function DialogFooter({
21182
+ className,
21183
+ ...props
21184
+ }) {
21185
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21186
+ "div",
21187
+ {
21188
+ className: cn("flex items-center justify-end gap-2", className),
21189
+ ...props
21190
+ }
21191
+ );
21192
+ }
21193
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21194
+ import_radix_ui6.Dialog.Title,
21195
+ {
21196
+ ref,
21197
+ className: cn(
21198
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21199
+ className
21200
+ ),
21201
+ ...props
21202
+ }
21203
+ ));
21204
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
21205
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21206
+ import_radix_ui6.Dialog.Description,
21207
+ {
21208
+ ref,
21209
+ className: cn("text-sm text-muted-foreground", className),
21210
+ ...props
21211
+ }
21212
+ ));
21213
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
21214
+ var DialogClose = import_radix_ui6.Dialog.Close;
21215
+
21216
+ // src/ui/ai-section/AiMediaStripOverlay.tsx
21217
+ var import_jsx_runtime21 = require("react/jsx-runtime");
21218
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
21219
+ 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]";
21038
21220
  function findMediaStripItemElement(sectionId, index) {
21039
21221
  const sectionEl2 = findByInstanceId(sectionId);
21040
21222
  if (!sectionEl2) return null;
@@ -21044,14 +21226,35 @@ function findMediaStripItemElement(sectionId, index) {
21044
21226
  }
21045
21227
  return null;
21046
21228
  }
21047
- function readRect2(ref) {
21048
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
21229
+ function itemRefFromTarget(target) {
21230
+ if (!(target instanceof Element)) return null;
21231
+ if (target.closest(CHROME_SELECTOR)) return null;
21232
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
21233
+ if (!itemEl) return null;
21234
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
21235
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
21236
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
21237
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
21238
+ if (!sectionId || Number.isNaN(index)) return null;
21239
+ return { sectionId, index };
21240
+ }
21241
+ function sameRef(a, b) {
21242
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
21243
+ }
21244
+ function rectOf(el) {
21049
21245
  if (!el) return null;
21050
21246
  const r2 = el.getBoundingClientRect();
21051
21247
  if (r2.width <= 0 || r2.height <= 0) return null;
21052
21248
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
21053
21249
  }
21054
- function useLiveItemRect(ref) {
21250
+ function readRect2(ref) {
21251
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
21252
+ }
21253
+ function readStripRect(ref) {
21254
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
21255
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
21256
+ }
21257
+ function useLiveItemRect(ref, strip = false) {
21055
21258
  const [rect, setRect] = (0, import_react14.useState)(null);
21056
21259
  (0, import_react14.useEffect)(() => {
21057
21260
  if (!ref) {
@@ -21059,7 +21262,7 @@ function useLiveItemRect(ref) {
21059
21262
  return;
21060
21263
  }
21061
21264
  const update = () => {
21062
- const next = readRect2(ref);
21265
+ const next = strip ? readStripRect(ref) : readRect2(ref);
21063
21266
  setRect(
21064
21267
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
21065
21268
  );
@@ -21074,9 +21277,49 @@ function useLiveItemRect(ref) {
21074
21277
  window.removeEventListener("resize", update);
21075
21278
  clearInterval(interval);
21076
21279
  };
21077
- }, [ref?.sectionId, ref?.index]);
21280
+ }, [ref?.sectionId, ref?.index, strip]);
21078
21281
  return rect;
21079
21282
  }
21283
+ var TOOLBAR_STRIP_GAP = 52;
21284
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
21285
+ var TOOLBAR_EDGE_MARGIN2 = 4;
21286
+ function StripToolbarSlot({ stripRect, children }) {
21287
+ const slotRef = (0, import_react14.useRef)(null);
21288
+ const [shift, setShift] = (0, import_react14.useState)(0);
21289
+ const centerX = stripRect.left + stripRect.width / 2;
21290
+ (0, import_react14.useLayoutEffect)(() => {
21291
+ const slot = slotRef.current;
21292
+ if (!slot) return;
21293
+ const clamp = () => {
21294
+ const w = slot.offsetWidth;
21295
+ if (w <= 0) return;
21296
+ const half = w / 2;
21297
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
21298
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
21299
+ };
21300
+ clamp();
21301
+ const ro = new ResizeObserver(clamp);
21302
+ ro.observe(slot);
21303
+ return () => ro.disconnect();
21304
+ }, [centerX, children]);
21305
+ const mobile = window.innerWidth <= 480;
21306
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21307
+ "div",
21308
+ {
21309
+ ref: slotRef,
21310
+ "data-ohw-bridge": "",
21311
+ "data-ohw-item-interaction": "",
21312
+ className: "pointer-events-auto fixed",
21313
+ style: {
21314
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
21315
+ left: centerX + shift,
21316
+ transform: "translate(-50%, -100%)",
21317
+ zIndex: 2147483645
21318
+ },
21319
+ children
21320
+ }
21321
+ );
21322
+ }
21080
21323
  function requestValidateTree(postToParent2, tree) {
21081
21324
  return new Promise((resolve) => {
21082
21325
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -21113,116 +21356,72 @@ function requestAssetPick(postToParent2) {
21113
21356
  postToParent2({ type: "ow:asset-pick", id });
21114
21357
  });
21115
21358
  }
21116
- function Pill({
21359
+ function ToolbarAction({
21117
21360
  label,
21118
21361
  onClick,
21119
- disabled,
21120
- active
21362
+ disabled = false,
21363
+ active = false,
21364
+ children
21121
21365
  }) {
21122
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21123
- "button",
21124
- {
21125
- type: "button",
21126
- onClick,
21127
- disabled,
21128
- style: {
21129
- height: 28,
21130
- padding: "0 10px",
21131
- display: "inline-flex",
21132
- alignItems: "center",
21133
- gap: 4,
21134
- borderRadius: 999,
21135
- border: "none",
21136
- cursor: disabled ? "default" : "pointer",
21137
- background: active ? OHW_BLUE_DARK : "#ffffff",
21138
- color: active ? "#ffffff" : OHW_BLUE_DARK,
21139
- opacity: disabled ? 0.4 : 1,
21140
- fontSize: 12,
21141
- lineHeight: "16px",
21142
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
21143
- whiteSpace: "nowrap",
21144
- flex: "0 0 auto"
21145
- },
21146
- children: label
21147
- }
21148
- );
21366
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
21367
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
21368
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
21369
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
21370
+ ] });
21149
21371
  }
21150
- function AltInput({ value, onCommit }) {
21151
- const [draft, setDraft] = (0, import_react14.useState)(value);
21152
- (0, import_react14.useEffect)(() => setDraft(value), [value]);
21153
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
21154
- "div",
21155
- {
21156
- style: {
21157
- display: "flex",
21158
- alignItems: "center",
21159
- gap: 6,
21160
- height: 28,
21161
- padding: "0 12px",
21162
- borderRadius: 999,
21163
- background: "#ffffff",
21164
- width: "100%",
21165
- maxWidth: 260,
21166
- boxSizing: "border-box"
21167
- },
21168
- children: [
21169
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21170
- "span",
21171
- {
21172
- style: {
21173
- flex: "0 0 auto",
21174
- color: OHW_BLUE_DARK,
21175
- fontSize: 10,
21176
- fontWeight: 700,
21177
- textTransform: "uppercase",
21178
- letterSpacing: 0.4
21179
- },
21180
- children: "Alt"
21181
- }
21182
- ),
21183
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21184
- "input",
21372
+ function ToolbarSeparator() {
21373
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
21374
+ }
21375
+ function OptionMenu({
21376
+ label,
21377
+ value,
21378
+ options,
21379
+ onChange
21380
+ }) {
21381
+ const current = options.find((o) => o.value === value) ?? options[0];
21382
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
21383
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
21384
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
21385
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
21386
+ "button",
21387
+ {
21388
+ type: "button",
21389
+ "aria-label": label,
21390
+ 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",
21391
+ children: [
21392
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
21393
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
21394
+ ]
21395
+ }
21396
+ ) }),
21397
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
21398
+ const selected = option.value === value;
21399
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
21400
+ DropdownMenuItem,
21185
21401
  {
21186
- type: "text",
21187
- value: draft,
21188
- onChange: (e) => setDraft(e.target.value),
21189
- onBlur: () => {
21190
- if (draft !== value) onCommit(draft);
21191
- },
21192
- onKeyDown: (e) => {
21193
- if (e.key === "Enter") e.currentTarget.blur();
21194
- if (e.key === "Escape") {
21195
- setDraft(value);
21196
- e.currentTarget.blur();
21197
- }
21198
- },
21199
- placeholder: "Describe this image",
21200
- "aria-label": "Image alt text",
21201
- style: {
21202
- flex: 1,
21203
- minWidth: 0,
21204
- border: "none",
21205
- outline: "none",
21206
- background: "transparent",
21207
- fontSize: 12,
21208
- lineHeight: "16px",
21209
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
21210
- color: "#1f2937"
21211
- }
21212
- }
21213
- )
21214
- ]
21215
- }
21216
- );
21402
+ role: "menuitemradio",
21403
+ "aria-checked": selected,
21404
+ onSelect: () => onChange(option.value),
21405
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
21406
+ children: [
21407
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
21408
+ selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
21409
+ ]
21410
+ },
21411
+ option.value
21412
+ );
21413
+ }) })
21414
+ ] })
21415
+ ] });
21217
21416
  }
21218
21417
  var VARIANTS = [
21219
21418
  { value: "logos", label: "Logos" },
21220
21419
  { value: "reel", label: "Reel" }
21221
21420
  ];
21222
21421
  var ALIGNS = [
21223
- { value: "left", label: "Left" },
21224
- { value: "center", label: "Center" },
21225
- { value: "right", label: "Right" }
21422
+ { value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
21423
+ { value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
21424
+ { value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
21226
21425
  ];
21227
21426
  var HOVERS = [
21228
21427
  { value: "none", label: "None" },
@@ -21230,104 +21429,104 @@ var HOVERS = [
21230
21429
  { value: "zoom", label: "Zoom" },
21231
21430
  { value: "fade", label: "Fade" }
21232
21431
  ];
21233
- var TREATMENTS = [
21234
- { value: "color", label: "Color" },
21235
- { value: "grayscale", label: "Grayscale" }
21236
- ];
21237
21432
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
21238
- function LinkInput({ value, onCommit }) {
21239
- const [draft, setDraft] = (0, import_react14.useState)(value);
21433
+ function LinkModal({
21434
+ href,
21435
+ linkTarget,
21436
+ onClose,
21437
+ onSave
21438
+ }) {
21439
+ const [draft, setDraft] = (0, import_react14.useState)(href);
21440
+ const [newTab, setNewTab] = (0, import_react14.useState)(linkTarget !== "same-tab");
21240
21441
  const [invalid, setInvalid] = (0, import_react14.useState)(false);
21241
- (0, import_react14.useEffect)(() => {
21242
- setDraft(value);
21243
- setInvalid(false);
21244
- }, [value]);
21245
- const commit2 = () => {
21442
+ const save = () => {
21246
21443
  const next = draft.trim();
21247
- if (next === value) return setInvalid(false);
21248
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
21249
- setInvalid(false);
21250
- onCommit(next);
21251
- };
21252
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
21253
- "div",
21254
- {
21255
- style: {
21256
- display: "flex",
21257
- alignItems: "center",
21258
- gap: 6,
21259
- height: 28,
21260
- padding: "0 12px",
21261
- borderRadius: 999,
21262
- background: "#ffffff",
21263
- width: "100%",
21264
- maxWidth: 260,
21265
- boxSizing: "border-box",
21266
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
21267
- },
21268
- children: [
21269
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21270
- "span",
21271
- {
21272
- style: {
21273
- flex: "0 0 auto",
21274
- color: OHW_BLUE_DARK,
21275
- fontSize: 10,
21276
- fontWeight: 700,
21277
- textTransform: "uppercase",
21278
- letterSpacing: 0.4
21279
- },
21280
- children: "Link"
21281
- }
21282
- ),
21283
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21284
- "input",
21285
- {
21286
- type: "text",
21287
- inputMode: "url",
21288
- value: draft,
21289
- onChange: (e) => setDraft(e.target.value),
21290
- onBlur: commit2,
21291
- onKeyDown: (e) => {
21292
- if (e.key === "Enter") e.currentTarget.blur();
21293
- if (e.key === "Escape") {
21294
- setDraft(value);
21295
- setInvalid(false);
21296
- e.currentTarget.blur();
21297
- }
21298
- },
21299
- placeholder: "https://example.com",
21300
- "aria-label": "Image link URL",
21301
- "aria-invalid": invalid,
21302
- style: {
21303
- flex: 1,
21304
- minWidth: 0,
21305
- border: "none",
21306
- outline: "none",
21307
- background: "transparent",
21308
- fontSize: 12,
21309
- lineHeight: "16px",
21310
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
21311
- color: "#1f2937"
21312
- }
21313
- }
21314
- )
21315
- ]
21444
+ if (next && !HTTP_URL_RE.test(next)) {
21445
+ setInvalid(true);
21446
+ return;
21316
21447
  }
21317
- );
21448
+ onSave(next, newTab ? "new-tab" : "same-tab");
21449
+ onClose();
21450
+ };
21451
+ 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: [
21452
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
21453
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
21454
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21455
+ "input",
21456
+ {
21457
+ autoFocus: true,
21458
+ type: "text",
21459
+ inputMode: "url",
21460
+ value: draft,
21461
+ onChange: (e) => {
21462
+ setDraft(e.target.value);
21463
+ setInvalid(false);
21464
+ },
21465
+ onKeyDown: (e) => {
21466
+ if (e.key === "Enter") save();
21467
+ },
21468
+ placeholder: "https://example.com",
21469
+ "aria-label": "Image link URL",
21470
+ "aria-invalid": invalid,
21471
+ className: cn(
21472
+ "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",
21473
+ invalid && "border-destructive focus:border-destructive"
21474
+ )
21475
+ }
21476
+ ),
21477
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
21478
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
21479
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
21480
+ "Open in new tab"
21481
+ ] })
21482
+ ] }),
21483
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
21484
+ href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21485
+ "button",
21486
+ {
21487
+ type: "button",
21488
+ onClick: () => {
21489
+ onSave("", "new-tab");
21490
+ onClose();
21491
+ },
21492
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
21493
+ children: "Remove link"
21494
+ }
21495
+ ),
21496
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21497
+ "button",
21498
+ {
21499
+ type: "button",
21500
+ onClick: onClose,
21501
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
21502
+ children: "Cancel"
21503
+ }
21504
+ ),
21505
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21506
+ "button",
21507
+ {
21508
+ type: "button",
21509
+ onClick: save,
21510
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
21511
+ children: "Save"
21512
+ }
21513
+ )
21514
+ ] })
21515
+ ] }) });
21318
21516
  }
21319
21517
  function MediaStripToolbar({
21320
21518
  entry,
21321
21519
  index,
21322
21520
  pending,
21323
21521
  error,
21522
+ itemEditOn,
21523
+ onToggleItemEdit,
21324
21524
  onSetVariant,
21325
21525
  onSetAlign,
21326
21526
  onSetHover,
21327
21527
  onSetTreatment,
21328
21528
  onResize,
21329
- onSetAlt,
21330
- onSetLink,
21529
+ onOpenLink,
21331
21530
  onAddItem,
21332
21531
  onRemoveItem,
21333
21532
  onChangeImage,
@@ -21336,81 +21535,102 @@ function MediaStripToolbar({
21336
21535
  }) {
21337
21536
  const items = mediaStripItems(entry.tree);
21338
21537
  const itemCount = items.length;
21339
- const currentAlt = items[index]?.alt ?? "";
21340
- const currentHref2 = items[index]?.href ?? "";
21341
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
21342
21538
  const slots = findMediaStripSlots(entry.tree);
21343
21539
  const variant = slots?.variant === "reel" ? "reel" : "logos";
21344
21540
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
21345
21541
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
21346
21542
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
21347
21543
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
21348
- const isMobile = window.innerWidth <= 480;
21349
- const rowStyle = isMobile ? {
21350
- display: "flex",
21351
- gap: 6,
21352
- flexWrap: "nowrap",
21353
- justifyContent: "center",
21354
- overflowX: "auto",
21355
- WebkitOverflowScrolling: "touch",
21356
- width: "100%",
21357
- scrollbarWidth: "none"
21358
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
21359
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
21544
+ const mobile = window.innerWidth <= 480;
21545
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
21546
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
21360
21547
  "div",
21361
21548
  {
21362
21549
  "data-ohw-bridge": "",
21363
21550
  "data-ohw-toolbar": "",
21364
21551
  onMouseDown: (e) => e.stopPropagation(),
21365
- style: {
21366
- display: "flex",
21367
- flexDirection: "column",
21368
- gap: 6,
21369
- alignItems: "center",
21370
- background: OHW_BLUE,
21371
- padding: 8,
21372
- borderRadius: 12,
21373
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
21374
- pointerEvents: pending ? "none" : "auto",
21375
- opacity: pending ? 0.6 : 1,
21376
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
21377
- },
21552
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
21553
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
21378
21554
  children: [
21379
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
21380
- VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
21381
- ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
21382
- ] }),
21383
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
21384
- HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
21385
- TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
21386
- ] }),
21387
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21388
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
21389
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
21390
- sizeValue,
21391
- "px"
21392
- ] }),
21393
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
21394
- ] }),
21395
- /* @__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 }) }),
21396
- /* @__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) }) }),
21397
- currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
21398
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
21399
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
21400
- ] }),
21401
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
21402
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
21403
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
21404
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
21405
- ] }),
21406
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
21407
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
21408
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
21409
- ] }),
21410
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21555
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
21556
+ "div",
21557
+ {
21558
+ className: cn(
21559
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
21560
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
21561
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
21562
+ ),
21563
+ children: [
21564
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
21565
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21566
+ CustomToolbarButton,
21567
+ {
21568
+ type: "button",
21569
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
21570
+ "aria-pressed": itemEditOn,
21571
+ onClick: onToggleItemEdit,
21572
+ className: "group size-8",
21573
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21574
+ import_lucide_react9.Star,
21575
+ {
21576
+ size: 16,
21577
+ fill: "currentColor",
21578
+ strokeWidth: 0,
21579
+ className: cn(
21580
+ "transition-colors",
21581
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
21582
+ ),
21583
+ style: { pointerEvents: "none" }
21584
+ }
21585
+ )
21586
+ }
21587
+ ) }),
21588
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
21589
+ ] }),
21590
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
21591
+ /* @__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" } }) }),
21592
+ /* @__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" } }) }),
21593
+ /* @__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" } }) }),
21594
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21595
+ ToolbarAction,
21596
+ {
21597
+ label: gatedLabel("Move right"),
21598
+ onClick: onMoveRight,
21599
+ disabled: !itemEditOn || index >= itemCount - 1,
21600
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
21601
+ }
21602
+ ),
21603
+ /* @__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" } }) }),
21604
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
21605
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
21606
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
21607
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21608
+ ToolbarAction,
21609
+ {
21610
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
21611
+ active: treatment === "grayscale",
21612
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
21613
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
21614
+ }
21615
+ ),
21616
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
21617
+ 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)),
21618
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
21619
+ /* @__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" } }) }),
21620
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
21621
+ sizeValue,
21622
+ "px"
21623
+ ] }),
21624
+ /* @__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" } }) }),
21625
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
21626
+ /* @__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" } }) })
21627
+ ]
21628
+ }
21629
+ ),
21630
+ 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 })
21411
21631
  ]
21412
21632
  }
21413
- );
21633
+ ) });
21414
21634
  }
21415
21635
  function findMediaStripSlots(tree) {
21416
21636
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -21429,31 +21649,23 @@ function AiMediaStripOverlay({
21429
21649
  }) {
21430
21650
  const [hover, setHover] = (0, import_react14.useState)(null);
21431
21651
  const [active, setActive] = (0, import_react14.useState)(null);
21652
+ const [itemEditOn, setItemEditOn] = (0, import_react14.useState)(false);
21653
+ const [linkOpen, setLinkOpen] = (0, import_react14.useState)(false);
21432
21654
  const [pending, setPending] = (0, import_react14.useState)(false);
21433
21655
  const [error, setError] = (0, import_react14.useState)(null);
21434
21656
  const activeRef = (0, import_react14.useRef)(null);
21435
21657
  activeRef.current = active;
21658
+ const linkOpenRef = (0, import_react14.useRef)(false);
21659
+ linkOpenRef.current = linkOpen;
21436
21660
  (0, import_react14.useEffect)(() => {
21437
21661
  const onMove = (e) => {
21662
+ const ref = itemRefFromTarget(e.target);
21438
21663
  const t = e.target;
21439
- if (!(t instanceof HTMLElement)) return;
21440
- 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]")) {
21441
- return;
21442
- }
21443
- const itemEl = t.closest("[data-ohw-media-strip-item]");
21444
- if (!itemEl) {
21445
- setHover(null);
21446
- return;
21447
- }
21448
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
21449
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
21450
- const sectionId = unit ? instanceIdOf(unit) || null : null;
21451
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
21452
- if (!sectionId || Number.isNaN(index)) {
21453
- setHover(null);
21454
- return;
21455
- }
21456
- setHover({ sectionId, index });
21664
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
21665
+ setHover((prev) => {
21666
+ const next = ref && !overEditable ? ref : null;
21667
+ return sameRef(prev, next) ? prev : next;
21668
+ });
21457
21669
  };
21458
21670
  const onLeave = () => setHover(null);
21459
21671
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -21465,23 +21677,25 @@ function AiMediaStripOverlay({
21465
21677
  }, []);
21466
21678
  (0, import_react14.useEffect)(() => {
21467
21679
  const onClick = (e) => {
21468
- const current = activeRef.current;
21469
- if (!current) return;
21470
21680
  const t = e.target;
21471
- if (!(t instanceof HTMLElement)) return;
21472
- if (t.closest("[data-ohw-item-interaction]")) return;
21473
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
21474
- if (itemEl && itemEl.contains(t)) return;
21475
- setActive(null);
21681
+ if (!(t instanceof Element)) return;
21682
+ if (t.closest(CHROME_SELECTOR)) return;
21683
+ const ref = itemRefFromTarget(t);
21684
+ if (sameRef(activeRef.current, ref)) return;
21685
+ if (ref) clearInteractionChromeRef.current();
21686
+ setItemEditOn(false);
21476
21687
  setError(null);
21688
+ setActive(ref);
21477
21689
  };
21478
21690
  document.addEventListener("click", onClick, true);
21479
21691
  return () => document.removeEventListener("click", onClick, true);
21480
- }, []);
21692
+ }, [clearInteractionChromeRef]);
21481
21693
  (0, import_react14.useEffect)(() => {
21482
21694
  const onBlur = () => {
21483
21695
  if (!activeRef.current) return;
21484
21696
  setActive(null);
21697
+ setItemEditOn(false);
21698
+ setLinkOpen(false);
21485
21699
  setError(null);
21486
21700
  };
21487
21701
  window.addEventListener("blur", onBlur);
@@ -21491,7 +21705,10 @@ function AiMediaStripOverlay({
21491
21705
  const onKeyDown = (e) => {
21492
21706
  if (e.key !== "Escape") return;
21493
21707
  if (!activeRef.current) return;
21708
+ if (linkOpenRef.current) return;
21709
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
21494
21710
  setActive(null);
21711
+ setItemEditOn(false);
21495
21712
  setError(null);
21496
21713
  };
21497
21714
  document.addEventListener("keydown", onKeyDown);
@@ -21525,137 +21742,133 @@ function AiMediaStripOverlay({
21525
21742
  tree: nextTree,
21526
21743
  label: entry.label,
21527
21744
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
21528
- ...entry.brand ? { brand: entry.brand } : {}
21745
+ ...entry.brand ? { brand: entry.brand } : {},
21746
+ // The user is already looking at the strip they just edited — recentering the viewport
21747
+ // on every edit reads as the section jumping around.
21748
+ skipScrollIntoView: true
21529
21749
  });
21530
21750
  return true;
21531
21751
  },
21532
21752
  [findEntry, postToParent2, applyTreeLocalRef]
21533
21753
  );
21534
21754
  const activeEntry = active ? findEntry(active.sectionId) : null;
21535
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
21536
21755
  const activeItemRect = useLiveItemRect(active);
21537
- const TOOLBAR_APPROX_H = 170;
21538
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21539
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
21540
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21541
- "button",
21542
- {
21543
- type: "button",
21544
- "data-ohw-toolbar": "",
21545
- onClick: () => {
21546
- clearInteractionChromeRef.current();
21547
- setActive(hover);
21548
- },
21549
- "aria-label": "Configure media item",
21550
- style: {
21551
- position: "fixed",
21552
- top: hoverHandleRect.top + 8,
21553
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
21554
- width: 28,
21555
- height: 28,
21556
- borderRadius: 8,
21557
- border: `1.5px dashed ${PRIMARY3}`,
21558
- background: "#ffffff",
21559
- color: PRIMARY3,
21560
- display: "flex",
21561
- alignItems: "center",
21562
- justifyContent: "center",
21563
- cursor: "pointer",
21564
- zIndex: 2147483643,
21565
- fontSize: 14,
21566
- fontWeight: 700
21567
- },
21568
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
21569
- }
21570
- ),
21571
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21572
- ItemInteractionLayer,
21573
- {
21574
- rect: activeItemRect,
21575
- state: toolbarState,
21576
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
21577
- MediaStripToolbar,
21578
- {
21579
- entry: activeEntry,
21580
- index: active.index,
21581
- pending,
21582
- error,
21583
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
21584
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
21585
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
21586
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
21587
- onResize: (delta) => {
21588
- const slots = findMediaStripSlots(activeEntry.tree);
21589
- const variant = slots?.variant === "reel" ? "reel" : "logos";
21590
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
21591
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
21592
- },
21593
- onSetAlt: (alt) => {
21594
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
21595
- },
21596
- onSetLink: (href, linkTarget) => {
21756
+ const activeStripRect = useLiveItemRect(active, true);
21757
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
21758
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
21759
+ const activeItem = active ? activeItems[active.index] : void 0;
21760
+ const activeHref = activeItem?.href ?? "";
21761
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
21762
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
21763
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
21764
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
21765
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
21766
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21767
+ MediaStripToolbar,
21768
+ {
21769
+ entry: activeEntry,
21770
+ index: active.index,
21771
+ pending,
21772
+ error,
21773
+ itemEditOn,
21774
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
21775
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
21776
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
21777
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
21778
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
21779
+ onResize: (delta) => {
21780
+ const slots = findMediaStripSlots(activeEntry.tree);
21781
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
21782
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
21783
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
21784
+ },
21785
+ onOpenLink: () => setLinkOpen(true),
21786
+ onAddItem: () => {
21787
+ void requestAssetPick(postToParent2).then((picked) => {
21788
+ if (!picked) return;
21789
+ const item = { assetId: picked.assetId, alt: "Logo" };
21597
21790
  void runMutation(
21598
21791
  active.sectionId,
21599
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
21600
- );
21601
- },
21602
- onAddItem: () => {
21603
- void requestAssetPick(postToParent2).then((picked) => {
21604
- if (!picked) return;
21605
- const item = { assetId: picked.assetId, alt: "Logo" };
21606
- void runMutation(
21607
- active.sectionId,
21608
- (tree) => addMediaStripItem(tree, item, active.index),
21609
- { [picked.assetId]: picked.url }
21610
- ).then((applied) => {
21611
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
21612
- });
21613
- });
21614
- },
21615
- onChangeImage: () => {
21616
- void requestAssetPick(postToParent2).then((picked) => {
21617
- if (!picked) return;
21618
- void runMutation(
21619
- active.sectionId,
21620
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
21621
- { [picked.assetId]: picked.url }
21622
- );
21792
+ (tree) => addMediaStripItem(tree, item, active.index),
21793
+ { [picked.assetId]: picked.url }
21794
+ ).then((applied) => {
21795
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
21623
21796
  });
21624
- },
21625
- onRemoveItem: () => {
21626
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
21627
- (applied) => {
21628
- if (applied) setActive(null);
21629
- }
21630
- );
21631
- },
21632
- onMoveLeft: () => {
21633
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
21634
- (applied) => {
21635
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
21636
- }
21637
- );
21638
- },
21639
- onMoveRight: () => {
21640
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
21641
- (applied) => {
21642
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
21643
- }
21797
+ });
21798
+ },
21799
+ onChangeImage: () => {
21800
+ void requestAssetPick(postToParent2).then((picked) => {
21801
+ if (!picked) return;
21802
+ void runMutation(
21803
+ active.sectionId,
21804
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
21805
+ { [picked.assetId]: picked.url }
21644
21806
  );
21645
- }
21807
+ });
21808
+ },
21809
+ onRemoveItem: () => {
21810
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
21811
+ (applied) => {
21812
+ if (applied) setActive(null);
21813
+ }
21814
+ );
21815
+ },
21816
+ onMoveLeft: () => {
21817
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
21818
+ (applied) => {
21819
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
21820
+ }
21821
+ );
21822
+ },
21823
+ onMoveRight: () => {
21824
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
21825
+ (applied) => {
21826
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
21827
+ }
21828
+ );
21646
21829
  }
21647
- )
21648
- }
21649
- )
21830
+ }
21831
+ ) }),
21832
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21833
+ "div",
21834
+ {
21835
+ "data-ohw-bridge": "",
21836
+ "data-ohw-item-interaction": "",
21837
+ "aria-hidden": true,
21838
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
21839
+ style: {
21840
+ top: activeItemRect.top + activeItemRect.height + 10,
21841
+ left: activeItemRect.left - 5,
21842
+ background: PRIMARY3,
21843
+ zIndex: 2147483644
21844
+ },
21845
+ children: "Media item"
21846
+ }
21847
+ ),
21848
+ linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21849
+ LinkModal,
21850
+ {
21851
+ href: activeHref,
21852
+ linkTarget: activeTarget,
21853
+ onClose: () => setLinkOpen(false),
21854
+ onSave: (href, linkTarget) => {
21855
+ void runMutation(
21856
+ active.sectionId,
21857
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
21858
+ );
21859
+ }
21860
+ }
21861
+ )
21862
+ ] })
21650
21863
  ] });
21651
21864
  }
21652
21865
 
21653
21866
  // src/ui/ai-section/AiPricingCardOverlay.tsx
21654
21867
  var import_react15 = require("react");
21655
- var import_lucide_react9 = require("lucide-react");
21656
- var import_jsx_runtime21 = require("react/jsx-runtime");
21868
+ var import_lucide_react10 = require("lucide-react");
21869
+ var import_jsx_runtime22 = require("react/jsx-runtime");
21657
21870
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
21658
- 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]";
21871
+ 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]";
21659
21872
  function findPricingCardElement(sectionId, index) {
21660
21873
  const sectionEl2 = findByInstanceId(sectionId);
21661
21874
  if (!sectionEl2) return null;
@@ -21667,7 +21880,7 @@ function findPricingCardElement(sectionId, index) {
21667
21880
  }
21668
21881
  function cardRefFromTarget(target) {
21669
21882
  if (!(target instanceof Element)) return null;
21670
- if (target.closest(CHROME_SELECTOR)) return null;
21883
+ if (target.closest(CHROME_SELECTOR2)) return null;
21671
21884
  const cardEl = target.closest("[data-ohw-pricing-card]");
21672
21885
  if (!cardEl) return null;
21673
21886
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -21677,21 +21890,21 @@ function cardRefFromTarget(target) {
21677
21890
  if (!sectionId || Number.isNaN(index)) return null;
21678
21891
  return { sectionId, index };
21679
21892
  }
21680
- function sameRef(a, b) {
21893
+ function sameRef2(a, b) {
21681
21894
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
21682
21895
  }
21683
- function rectOf(el) {
21896
+ function rectOf2(el) {
21684
21897
  if (!el) return null;
21685
21898
  const r2 = el.getBoundingClientRect();
21686
21899
  if (r2.width <= 0 || r2.height <= 0) return null;
21687
21900
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
21688
21901
  }
21689
21902
  function readRect3(ref) {
21690
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
21903
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
21691
21904
  }
21692
21905
  function readGridRect(ref) {
21693
21906
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
21694
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
21907
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
21695
21908
  }
21696
21909
  function useLiveCardRect(ref, grid = false) {
21697
21910
  const [rect, setRect] = (0, import_react15.useState)(null);
@@ -21721,7 +21934,7 @@ function useLiveCardRect(ref, grid = false) {
21721
21934
  }
21722
21935
  var TOOLBAR_GRID_GAP = 52;
21723
21936
  var TOOLBAR_GRID_GAP_MOBILE = 42;
21724
- var TOOLBAR_EDGE_MARGIN2 = 4;
21937
+ var TOOLBAR_EDGE_MARGIN3 = 4;
21725
21938
  function GridToolbarSlot({ gridRect, children }) {
21726
21939
  const slotRef = (0, import_react15.useRef)(null);
21727
21940
  const [shift, setShift] = (0, import_react15.useState)(0);
@@ -21733,7 +21946,7 @@ function GridToolbarSlot({ gridRect, children }) {
21733
21946
  const w = slot.offsetWidth;
21734
21947
  if (w <= 0) return;
21735
21948
  const half = w / 2;
21736
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
21949
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
21737
21950
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
21738
21951
  };
21739
21952
  clamp();
@@ -21742,7 +21955,7 @@ function GridToolbarSlot({ gridRect, children }) {
21742
21955
  return () => ro.disconnect();
21743
21956
  }, [centerX, children]);
21744
21957
  const mobile = window.innerWidth <= 480;
21745
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21958
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21746
21959
  "div",
21747
21960
  {
21748
21961
  ref: slotRef,
@@ -21777,7 +21990,7 @@ function requestValidateTree2(postToParent2, tree) {
21777
21990
  });
21778
21991
  }
21779
21992
  function StyleSwatch({ style }) {
21780
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21993
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21781
21994
  "span",
21782
21995
  {
21783
21996
  "aria-hidden": true,
@@ -21791,35 +22004,35 @@ function StyleSwatch({ style }) {
21791
22004
  );
21792
22005
  }
21793
22006
  function ButtonGlyph() {
21794
- 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: [
21795
- /* @__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" }),
21796
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
22007
+ 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: [
22008
+ /* @__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" }),
22009
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
21797
22010
  ] });
21798
22011
  }
21799
22012
  function FeatureGlyph({ mode }) {
21800
- 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: [
21801
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
21802
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
21803
- /* @__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" }),
21804
- /* @__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" }),
21805
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
21806
- mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
22013
+ 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: [
22014
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
22015
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
22016
+ /* @__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" }),
22017
+ /* @__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" }),
22018
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
22019
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
21807
22020
  ] });
21808
22021
  }
21809
- function ToolbarAction({
22022
+ function ToolbarAction2({
21810
22023
  label,
21811
22024
  onClick,
21812
22025
  disabled = false,
21813
22026
  children
21814
22027
  }) {
21815
- const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
21816
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
21817
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
21818
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
22028
+ const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
22029
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
22030
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
22031
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
21819
22032
  ] });
21820
22033
  }
21821
- function ToolbarSeparator() {
21822
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
22034
+ function ToolbarSeparator2() {
22035
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
21823
22036
  }
21824
22037
  function CardStyleMenu({
21825
22038
  value,
@@ -21827,7 +22040,7 @@ function CardStyleMenu({
21827
22040
  disabled = false
21828
22041
  }) {
21829
22042
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
21830
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
22043
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21831
22044
  "button",
21832
22045
  {
21833
22046
  type: "button",
@@ -21838,28 +22051,28 @@ function CardStyleMenu({
21838
22051
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
21839
22052
  ),
21840
22053
  children: [
21841
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
21842
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
21843
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
22054
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
22055
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
22056
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
21844
22057
  ]
21845
22058
  }
21846
22059
  );
21847
22060
  if (disabled) {
21848
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
21849
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
21850
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
21851
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
21852
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
22061
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
22062
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
22063
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
22064
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
22065
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
21853
22066
  ] })
21854
22067
  ] });
21855
22068
  }
21856
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
21857
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
21858
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
21859
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
21860
- /* @__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) => {
22069
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
22070
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
22071
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
22072
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
22073
+ /* @__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) => {
21861
22074
  const selected = style.value === value;
21862
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
22075
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21863
22076
  DropdownMenuItem,
21864
22077
  {
21865
22078
  role: "menuitemradio",
@@ -21867,9 +22080,9 @@ function CardStyleMenu({
21867
22080
  onSelect: () => onChange(style.value),
21868
22081
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
21869
22082
  children: [
21870
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
21871
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
21872
- selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
22083
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
22084
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
22085
+ selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
21873
22086
  ]
21874
22087
  },
21875
22088
  style.value
@@ -21899,7 +22112,7 @@ function PricingCardToolbar({
21899
22112
  const style = pricingCardStyle(entry.tree, index);
21900
22113
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
21901
22114
  const mobile = window.innerWidth <= 480;
21902
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
22115
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21903
22116
  "div",
21904
22117
  {
21905
22118
  "data-ohw-bridge": "",
@@ -21911,7 +22124,7 @@ function PricingCardToolbar({
21911
22124
  ),
21912
22125
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
21913
22126
  children: [
21914
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
22127
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21915
22128
  "div",
21916
22129
  {
21917
22130
  className: cn(
@@ -21920,8 +22133,8 @@ function PricingCardToolbar({
21920
22133
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
21921
22134
  ),
21922
22135
  children: [
21923
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
21924
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22136
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
22137
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21925
22138
  CustomToolbarButton,
21926
22139
  {
21927
22140
  type: "button",
@@ -21929,8 +22142,8 @@ function PricingCardToolbar({
21929
22142
  "aria-pressed": featuredTag,
21930
22143
  onClick: () => onSetFeaturedTag(!featuredTag),
21931
22144
  className: "group size-8",
21932
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21933
- import_lucide_react9.Star,
22145
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22146
+ import_lucide_react10.Star,
21934
22147
  {
21935
22148
  size: 16,
21936
22149
  fill: "currentColor",
@@ -21944,25 +22157,25 @@ function PricingCardToolbar({
21944
22157
  )
21945
22158
  }
21946
22159
  ) }),
21947
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
22160
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
21948
22161
  ] }),
21949
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
21950
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
21951
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
21952
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
21953
- /* @__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: [
21954
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
21955
- /* @__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" })
22162
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
22163
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
22164
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
22165
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
22166
+ /* @__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: [
22167
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
22168
+ /* @__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" })
21956
22169
  ] }) }),
21957
- /* @__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" }) }),
21958
- /* @__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" }) }),
21959
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
21960
- /* @__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" } }) }),
21961
- /* @__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" } }) })
22170
+ /* @__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" }) }),
22171
+ /* @__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" }) }),
22172
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
22173
+ /* @__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" } }) }),
22174
+ /* @__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" } }) })
21962
22175
  ]
21963
22176
  }
21964
22177
  ),
21965
- 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 })
22178
+ 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 })
21966
22179
  ]
21967
22180
  }
21968
22181
  ) });
@@ -21996,7 +22209,7 @@ function AiPricingCardOverlay({
21996
22209
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
21997
22210
  setHover((prev) => {
21998
22211
  const next = ref && !overEditable ? ref : null;
21999
- return sameRef(prev, next) ? prev : next;
22212
+ return sameRef2(prev, next) ? prev : next;
22000
22213
  });
22001
22214
  };
22002
22215
  const onLeave = () => setHover(null);
@@ -22011,10 +22224,10 @@ function AiPricingCardOverlay({
22011
22224
  const onClick = (e) => {
22012
22225
  const t = e.target;
22013
22226
  if (!(t instanceof Element)) return;
22014
- if (t.closest(CHROME_SELECTOR)) return;
22227
+ if (t.closest(CHROME_SELECTOR2)) return;
22015
22228
  const ref = cardRefFromTarget(t);
22016
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
22017
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
22229
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
22230
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
22018
22231
  };
22019
22232
  document.addEventListener("click", onClick, true);
22020
22233
  return () => document.removeEventListener("click", onClick, true);
@@ -22079,12 +22292,12 @@ function AiPricingCardOverlay({
22079
22292
  const activeEntry = active ? findEntry(active.sectionId) : null;
22080
22293
  const activeCardRect = useLiveCardRect(active);
22081
22294
  const activeGridRect = useLiveCardRect(active, true);
22082
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
22083
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
22084
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
22085
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
22086
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
22087
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22295
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
22296
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
22297
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
22298
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
22299
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
22300
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22088
22301
  PricingCardToolbar,
22089
22302
  {
22090
22303
  entry: activeEntry,
@@ -22112,7 +22325,7 @@ function AiPricingCardOverlay({
22112
22325
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
22113
22326
  }
22114
22327
  ) }),
22115
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
22328
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22116
22329
  "div",
22117
22330
  {
22118
22331
  "data-ohw-bridge": "",
@@ -22134,7 +22347,7 @@ function AiPricingCardOverlay({
22134
22347
 
22135
22348
  // src/ui/ai-section/AiVideoOverlay.tsx
22136
22349
  var import_react16 = require("react");
22137
- var import_lucide_react10 = require("lucide-react");
22350
+ var import_lucide_react11 = require("lucide-react");
22138
22351
 
22139
22352
  // src/lib/ai-video-tree.ts
22140
22353
  function resolveVideoBlock(tree, path) {
@@ -22177,10 +22390,10 @@ function clearVideo(tree, path) {
22177
22390
  }
22178
22391
 
22179
22392
  // src/ui/ai-section/AiVideoOverlay.tsx
22180
- var import_jsx_runtime22 = require("react/jsx-runtime");
22393
+ var import_jsx_runtime23 = require("react/jsx-runtime");
22181
22394
  var PRIMARY5 = "#0885FE";
22182
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
22183
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
22395
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
22396
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
22184
22397
  function findVideoBlockElement(sectionId, path) {
22185
22398
  const sectionEl2 = findByInstanceId(sectionId);
22186
22399
  if (!sectionEl2) return null;
@@ -22240,12 +22453,12 @@ function requestValidateTree3(postToParent2, tree) {
22240
22453
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
22241
22454
  });
22242
22455
  }
22243
- function Pill2({
22456
+ function Pill({
22244
22457
  label,
22245
22458
  onClick,
22246
22459
  disabled
22247
22460
  }) {
22248
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22461
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22249
22462
  "button",
22250
22463
  {
22251
22464
  type: "button",
@@ -22261,7 +22474,7 @@ function Pill2({
22261
22474
  border: "none",
22262
22475
  cursor: disabled ? "default" : "pointer",
22263
22476
  background: "#ffffff",
22264
- color: OHW_BLUE_DARK2,
22477
+ color: OHW_BLUE_DARK,
22265
22478
  opacity: disabled ? 0.4 : 1,
22266
22479
  fontSize: 12,
22267
22480
  lineHeight: "16px",
@@ -22304,8 +22517,8 @@ function VideoUrlInput({ value, onCommit }) {
22304
22517
  onCommit(id);
22305
22518
  }
22306
22519
  };
22307
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
22308
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22520
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
22521
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
22309
22522
  "div",
22310
22523
  {
22311
22524
  style: {
@@ -22321,12 +22534,12 @@ function VideoUrlInput({ value, onCommit }) {
22321
22534
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
22322
22535
  },
22323
22536
  children: [
22324
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22537
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22325
22538
  "span",
22326
22539
  {
22327
22540
  style: {
22328
22541
  flex: "0 0 auto",
22329
- color: OHW_BLUE_DARK2,
22542
+ color: OHW_BLUE_DARK,
22330
22543
  fontSize: 10,
22331
22544
  lineHeight: "16px",
22332
22545
  fontWeight: 700,
@@ -22336,7 +22549,7 @@ function VideoUrlInput({ value, onCommit }) {
22336
22549
  children: "Video"
22337
22550
  }
22338
22551
  ),
22339
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22552
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22340
22553
  "input",
22341
22554
  {
22342
22555
  type: "text",
@@ -22373,7 +22586,7 @@ function VideoUrlInput({ value, onCommit }) {
22373
22586
  ]
22374
22587
  }
22375
22588
  ),
22376
- 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." })
22589
+ 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." })
22377
22590
  ] });
22378
22591
  }
22379
22592
  function VideoToolbar({
@@ -22383,7 +22596,7 @@ function VideoToolbar({
22383
22596
  onSetVideoId,
22384
22597
  onRemove
22385
22598
  }) {
22386
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
22599
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
22387
22600
  "div",
22388
22601
  {
22389
22602
  "data-ohw-bridge": "",
@@ -22395,7 +22608,7 @@ function VideoToolbar({
22395
22608
  gap: 6,
22396
22609
  alignItems: "center",
22397
22610
  width: 280,
22398
- background: OHW_BLUE2,
22611
+ background: OHW_BLUE,
22399
22612
  padding: 8,
22400
22613
  borderRadius: 12,
22401
22614
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -22403,9 +22616,9 @@ function VideoToolbar({
22403
22616
  opacity: pending ? 0.6 : 1
22404
22617
  },
22405
22618
  children: [
22406
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
22407
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
22408
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
22619
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
22620
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
22621
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
22409
22622
  ]
22410
22623
  }
22411
22624
  );
@@ -22525,8 +22738,8 @@ function AiVideoOverlay({
22525
22738
  const activeBlockRect = useLiveBlockRect(active);
22526
22739
  const TOOLBAR_APPROX_H = 90;
22527
22740
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
22528
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
22529
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22741
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
22742
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22530
22743
  "button",
22531
22744
  {
22532
22745
  type: "button",
@@ -22554,15 +22767,15 @@ function AiVideoOverlay({
22554
22767
  fontSize: 14,
22555
22768
  fontWeight: 700
22556
22769
  },
22557
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
22770
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
22558
22771
  }
22559
22772
  ),
22560
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22773
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22561
22774
  ItemInteractionLayer,
22562
22775
  {
22563
22776
  rect: activeBlockRect,
22564
22777
  state: toolbarState,
22565
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
22778
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22566
22779
  VideoToolbar,
22567
22780
  {
22568
22781
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -22586,7 +22799,7 @@ function AiVideoOverlay({
22586
22799
 
22587
22800
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
22588
22801
  var import_react17 = require("react");
22589
- var import_lucide_react11 = require("lucide-react");
22802
+ var import_lucide_react12 = require("lucide-react");
22590
22803
 
22591
22804
  // src/lib/ai-carousel-tree.ts
22592
22805
  function isCarouselBlock(node) {
@@ -22637,10 +22850,10 @@ function setCarouselAutoplay(tree, on) {
22637
22850
  }
22638
22851
 
22639
22852
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
22640
- var import_jsx_runtime23 = require("react/jsx-runtime");
22853
+ var import_jsx_runtime24 = require("react/jsx-runtime");
22641
22854
  var PRIMARY6 = "#0885FE";
22642
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
22643
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
22855
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
22856
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
22644
22857
  function findCarouselItemElement(sectionId, index) {
22645
22858
  const sectionEl2 = findByInstanceId(sectionId);
22646
22859
  if (!sectionEl2) return null;
@@ -22719,8 +22932,8 @@ function requestAssetPick2(postToParent2) {
22719
22932
  postToParent2({ type: "ow:asset-pick", id });
22720
22933
  });
22721
22934
  }
22722
- function Pill3({ label, onClick, disabled }) {
22723
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22935
+ function Pill2({ label, onClick, disabled }) {
22936
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22724
22937
  "button",
22725
22938
  {
22726
22939
  type: "button",
@@ -22736,7 +22949,7 @@ function Pill3({ label, onClick, disabled }) {
22736
22949
  border: "none",
22737
22950
  cursor: disabled ? "default" : "pointer",
22738
22951
  background: "#ffffff",
22739
- color: OHW_BLUE_DARK3,
22952
+ color: OHW_BLUE_DARK2,
22740
22953
  opacity: disabled ? 0.4 : 1,
22741
22954
  fontSize: 12,
22742
22955
  lineHeight: "16px",
@@ -22754,7 +22967,7 @@ function TogglePill({
22754
22967
  onToggle,
22755
22968
  disabled
22756
22969
  }) {
22757
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
22970
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
22758
22971
  "button",
22759
22972
  {
22760
22973
  type: "button",
@@ -22773,7 +22986,7 @@ function TogglePill({
22773
22986
  border: "none",
22774
22987
  cursor: disabled ? "default" : "pointer",
22775
22988
  background: "#ffffff",
22776
- color: OHW_BLUE_DARK3,
22989
+ color: OHW_BLUE_DARK2,
22777
22990
  opacity: disabled ? 0.4 : 1,
22778
22991
  fontSize: 12,
22779
22992
  lineHeight: "16px",
@@ -22783,7 +22996,7 @@ function TogglePill({
22783
22996
  },
22784
22997
  children: [
22785
22998
  label,
22786
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
22999
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22787
23000
  "span",
22788
23001
  {
22789
23002
  "aria-hidden": true,
@@ -22796,10 +23009,10 @@ function TogglePill({
22796
23009
  // Off is a grey track, not a washed-out blue: the pill's own white background already
22797
23010
  // carries the brand colour in the text, and a pale blue track next to it read as
22798
23011
  // "disabled control" rather than "switch that is off".
22799
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
23012
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
22800
23013
  transition: "background 120ms ease"
22801
23014
  },
22802
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23015
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
22803
23016
  "span",
22804
23017
  {
22805
23018
  style: {
@@ -22828,7 +23041,7 @@ function CarouselSlideToolbar({
22828
23041
  onChangeImage,
22829
23042
  onToggleAutoplay
22830
23043
  }) {
22831
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
23044
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
22832
23045
  "div",
22833
23046
  {
22834
23047
  "data-ohw-bridge": "",
@@ -22839,7 +23052,7 @@ function CarouselSlideToolbar({
22839
23052
  flexDirection: "column",
22840
23053
  gap: 6,
22841
23054
  alignItems: "center",
22842
- background: OHW_BLUE3,
23055
+ background: OHW_BLUE2,
22843
23056
  padding: 8,
22844
23057
  borderRadius: 12,
22845
23058
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -22851,11 +23064,11 @@ function CarouselSlideToolbar({
22851
23064
  pointerEvents: pending ? "none" : "auto"
22852
23065
  },
22853
23066
  children: [
22854
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
22855
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
22856
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
23067
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
23068
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
23069
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
22857
23070
  ] }),
22858
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
23071
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
22859
23072
  ]
22860
23073
  }
22861
23074
  );
@@ -22995,8 +23208,8 @@ function AiFadeCarouselOverlay({
22995
23208
  const activeItemRect = useLiveItemRect2(active);
22996
23209
  const TOOLBAR_APPROX_H = 90;
22997
23210
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
22998
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
22999
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23211
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
23212
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23000
23213
  "button",
23001
23214
  {
23002
23215
  type: "button",
@@ -23025,10 +23238,10 @@ function AiFadeCarouselOverlay({
23025
23238
  fontSize: 14,
23026
23239
  fontWeight: 700
23027
23240
  },
23028
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
23241
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
23029
23242
  }
23030
23243
  ),
23031
- swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23244
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23032
23245
  "div",
23033
23246
  {
23034
23247
  ref: skeletonRef,
@@ -23046,15 +23259,15 @@ function AiFadeCarouselOverlay({
23046
23259
  zIndex: 2147483646,
23047
23260
  pointerEvents: "none"
23048
23261
  },
23049
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
23262
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
23050
23263
  }
23051
23264
  ),
23052
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23265
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23053
23266
  ItemInteractionLayer,
23054
23267
  {
23055
23268
  rect: activeItemRect,
23056
23269
  state: toolbarState,
23057
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
23270
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23058
23271
  CarouselSlideToolbar,
23059
23272
  {
23060
23273
  pending,
@@ -23292,113 +23505,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
23292
23505
  // src/ui/link-modal/LinkPopover.tsx
23293
23506
  var import_react21 = require("react");
23294
23507
 
23295
- // src/ui/dialog.tsx
23296
- var React9 = __toESM(require("react"), 1);
23297
- var import_radix_ui6 = require("radix-ui");
23298
- var import_lucide_react12 = require("lucide-react");
23299
- var import_jsx_runtime24 = require("react/jsx-runtime");
23300
- function Dialog2({
23301
- ...props
23302
- }) {
23303
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
23304
- }
23305
- function DialogPortal({
23306
- ...props
23307
- }) {
23308
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
23309
- }
23310
- function DialogOverlay({
23311
- className,
23312
- ...props
23313
- }) {
23314
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23315
- import_radix_ui6.Dialog.Overlay,
23316
- {
23317
- "data-slot": "dialog-overlay",
23318
- "data-ohw-link-modal-root": "",
23319
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
23320
- ...props
23321
- }
23322
- );
23323
- }
23324
- var DialogContent = React9.forwardRef(
23325
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
23326
- const positionMode = container ? "absolute" : "fixed";
23327
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
23328
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
23329
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
23330
- import_radix_ui6.Dialog.Content,
23331
- {
23332
- ref,
23333
- "data-slot": "dialog-content",
23334
- className: cn(
23335
- positionMode,
23336
- "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",
23337
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
23338
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
23339
- className
23340
- ),
23341
- onMouseDown: (e) => e.stopPropagation(),
23342
- ...props,
23343
- children: [
23344
- children,
23345
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23346
- import_radix_ui6.Dialog.Close,
23347
- {
23348
- type: "button",
23349
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
23350
- "aria-label": "Close",
23351
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
23352
- }
23353
- ) : null
23354
- ]
23355
- }
23356
- )
23357
- ] });
23358
- }
23359
- );
23360
- DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
23361
- function DialogHeader({
23362
- className,
23363
- ...props
23364
- }) {
23365
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
23366
- }
23367
- function DialogFooter({
23368
- className,
23369
- ...props
23370
- }) {
23371
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23372
- "div",
23373
- {
23374
- className: cn("flex items-center justify-end gap-2", className),
23375
- ...props
23376
- }
23377
- );
23378
- }
23379
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23380
- import_radix_ui6.Dialog.Title,
23381
- {
23382
- ref,
23383
- className: cn(
23384
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
23385
- className
23386
- ),
23387
- ...props
23388
- }
23389
- ));
23390
- DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
23391
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
23392
- import_radix_ui6.Dialog.Description,
23393
- {
23394
- ref,
23395
- className: cn("text-sm text-muted-foreground", className),
23396
- ...props
23397
- }
23398
- ));
23399
- DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
23400
- var DialogClose = import_radix_ui6.Dialog.Close;
23401
-
23402
23508
  // src/ui/link-modal/LinkEditorPanel.tsx
23403
23509
  var import_lucide_react16 = require("lucide-react");
23404
23510
 
@@ -24502,6 +24608,7 @@ function shouldUseDevFixtures() {
24502
24608
  function getLogoElement(el) {
24503
24609
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
24504
24610
  if (marked) return marked;
24611
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
24505
24612
  const root = el.closest("nav, [data-ohw-nav-root], footer");
24506
24613
  if (!root) return null;
24507
24614
  const anchor = el.closest("a");
@@ -27318,7 +27425,7 @@ function getNavigationSelectionParent(el) {
27318
27425
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
27319
27426
  return resolveFooterLinksContainerFrom(el);
27320
27427
  }
27321
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
27428
+ 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)) {
27322
27429
  return getNavigationRoot(el);
27323
27430
  }
27324
27431
  return null;
@@ -27540,7 +27647,6 @@ var ICONS = {
27540
27647
  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"/>',
27541
27648
  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"/>'
27542
27649
  };
27543
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
27544
27650
  var SELECTION_CHROME_GAP2 = 4;
27545
27651
  var TOOLBAR_STROKE_GAP2 = 4;
27546
27652
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -27638,7 +27744,7 @@ function applyVisibleViewport(el, parentScroll) {
27638
27744
  el.style.top = `${top}px`;
27639
27745
  el.style.height = `${height}px`;
27640
27746
  }
27641
- var TOOLBAR_EDGE_MARGIN3 = 4;
27747
+ var TOOLBAR_EDGE_MARGIN4 = 4;
27642
27748
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
27643
27749
  const isAbove = transform.includes("translateY(-100%)");
27644
27750
  let visualTop = isAbove ? top - approxH : top;
@@ -27665,8 +27771,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
27665
27771
  function clampToolbarLeft(centerX, toolbarWidth) {
27666
27772
  const half = toolbarWidth / 2;
27667
27773
  return Math.max(
27668
- TOOLBAR_EDGE_MARGIN3 + half,
27669
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
27774
+ TOOLBAR_EDGE_MARGIN4 + half,
27775
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
27670
27776
  );
27671
27777
  }
27672
27778
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -28578,21 +28684,6 @@ function OhhwellsBridge() {
28578
28684
  const [isItemDragging, setIsItemDragging] = (0, import_react26.useState)(false);
28579
28685
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react26.useState)(false);
28580
28686
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
28581
- const [floatingPanel, setFloatingPanel] = (0, import_react26.useState)(null);
28582
- const floatingPanelOpenRef = (0, import_react26.useRef)(false);
28583
- floatingPanelOpenRef.current = floatingPanel !== null;
28584
- const floatingPanelRef = (0, import_react26.useRef)(null);
28585
- floatingPanelRef.current = floatingPanel;
28586
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react26.useState)(null);
28587
- const buttonCollectionDragRef = (0, import_react26.useRef)(null);
28588
- const buttonDropInsertIndexRef = (0, import_react26.useRef)(null);
28589
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react26.useState)([]);
28590
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react26.useState)(null);
28591
- const buttonPointerDragRef = (0, import_react26.useRef)(null);
28592
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react26.useState)(0);
28593
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react26.useState)(null);
28594
- const [editorViewport, setEditorViewport] = (0, import_react26.useState)("desktop");
28595
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react26.useState)(null);
28596
28687
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react26.useState)(null);
28597
28688
  const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react26.useState)(null);
28598
28689
  const footerDragRef = (0, import_react26.useRef)(null);
@@ -28619,6 +28710,21 @@ function OhhwellsBridge() {
28619
28710
  const stylesRef = (0, import_react26.useRef)("");
28620
28711
  const appliedDrawerRef = (0, import_react26.useRef)(null);
28621
28712
  const pendingDeleteUndoRef = (0, import_react26.useRef)(null);
28713
+ const [floatingPanel, setFloatingPanel] = (0, import_react26.useState)(null);
28714
+ const floatingPanelOpenRef = (0, import_react26.useRef)(false);
28715
+ const floatingPanelRef = (0, import_react26.useRef)(null);
28716
+ floatingPanelRef.current = floatingPanel;
28717
+ const setFloatingPanelRef = (0, import_react26.useRef)(setFloatingPanel);
28718
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react26.useState)(null);
28719
+ const buttonCollectionDragRef = (0, import_react26.useRef)(null);
28720
+ const buttonDropInsertIndexRef = (0, import_react26.useRef)(null);
28721
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react26.useState)([]);
28722
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react26.useState)(null);
28723
+ const buttonPointerDragRef = (0, import_react26.useRef)(null);
28724
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react26.useState)(0);
28725
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react26.useState)(null);
28726
+ const [editorViewport, setEditorViewport] = (0, import_react26.useState)("desktop");
28727
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react26.useState)(null);
28622
28728
  const [sitePages, setSitePages] = (0, import_react26.useState)([]);
28623
28729
  const collectionItemsRef = (0, import_react26.useRef)(/* @__PURE__ */ new Map());
28624
28730
  const [sectionsByPath, setSectionsByPath] = (0, import_react26.useState)({});
@@ -28628,7 +28734,18 @@ function OhhwellsBridge() {
28628
28734
  const linkPopoverOpenRef = (0, import_react26.useRef)(false);
28629
28735
  const linkPopoverGraceUntilRef = (0, import_react26.useRef)(0);
28630
28736
  setLinkPopoverRef.current = setLinkPopover;
28737
+ setFloatingPanelRef.current = setFloatingPanel;
28631
28738
  linkPopoverSessionRef.current = linkPopover;
28739
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
28740
+ (0, import_react26.useEffect)(() => {
28741
+ const syncViewport = () => {
28742
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
28743
+ setEditorViewport((prev) => prev === next ? prev : next);
28744
+ };
28745
+ syncViewport();
28746
+ window.addEventListener("resize", syncViewport);
28747
+ return () => window.removeEventListener("resize", syncViewport);
28748
+ }, []);
28632
28749
  (0, import_react26.useEffect)(() => {
28633
28750
  setSectionOrderPersistHandler((entries) => {
28634
28751
  const currentPath = window.location.pathname;
@@ -30371,6 +30488,7 @@ function OhhwellsBridge() {
30371
30488
  applyAiFooterFromContent(content);
30372
30489
  if (typeof content[STYLE_STORE_KEY] === "string") {
30373
30490
  stylesRef.current = content[STYLE_STORE_KEY];
30491
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
30374
30492
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
30375
30493
  }
30376
30494
  applyBrandChrome(content);
@@ -30381,12 +30499,12 @@ function OhhwellsBridge() {
30381
30499
  if (key === "__ohw_sections") continue;
30382
30500
  if (key === AI_SECTIONS_KEY) continue;
30383
30501
  if (key === AI_FOOTER_KEY) continue;
30502
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
30503
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
30384
30504
  if (key === BRAND_KIT_KEY) continue;
30385
30505
  if (key === STYLE_STORE_KEY) continue;
30386
30506
  if (BRAND_CHROME_KEYS.has(key)) continue;
30387
- if (key === LOGO_PLACEHOLDER_KEY) continue;
30388
30507
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
30389
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
30390
30508
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
30391
30509
  continue;
30392
30510
  }
@@ -30621,17 +30739,18 @@ function OhhwellsBridge() {
30621
30739
  }
30622
30740
  applyAiFooterFromContent(content);
30623
30741
  if (typeof content[STYLE_STORE_KEY] === "string") {
30742
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
30624
30743
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
30625
30744
  }
30626
30745
  for (const [key, val] of Object.entries(content)) {
30627
30746
  if (key === "__ohw_sections") continue;
30628
30747
  if (key === AI_SECTIONS_KEY) continue;
30629
30748
  if (key === AI_FOOTER_KEY) continue;
30749
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
30750
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
30630
30751
  if (key === BRAND_KIT_KEY) continue;
30631
30752
  if (key === STYLE_STORE_KEY) continue;
30632
30753
  if (BRAND_CHROME_KEYS.has(key)) continue;
30633
- if (key === LOGO_PLACEHOLDER_KEY) continue;
30634
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
30635
30754
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
30636
30755
  continue;
30637
30756
  }
@@ -30903,26 +31022,11 @@ function OhhwellsBridge() {
30903
31022
  const t2 = setTimeout(measure, 500);
30904
31023
  const ro = new ResizeObserver(schedule);
30905
31024
  ro.observe(document.body);
30906
- let lastWidth = window.innerWidth;
30907
- let resizeTimers = [];
30908
- const clearResizeTimers = () => {
30909
- resizeTimers.forEach(clearTimeout);
30910
- resizeTimers = [];
30911
- };
30912
- const handleResize = () => {
30913
- if (window.innerWidth === lastWidth) return;
30914
- lastWidth = window.innerWidth;
30915
- clearResizeTimers();
30916
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
30917
- };
30918
- window.addEventListener("resize", handleResize);
30919
31025
  return () => {
30920
31026
  clearTimeout(t1);
30921
31027
  clearTimeout(t2);
30922
31028
  if (raf != null) cancelAnimationFrame(raf);
30923
31029
  ro.disconnect();
30924
- clearResizeTimers();
30925
- window.removeEventListener("resize", handleResize);
30926
31030
  };
30927
31031
  }, [pathname, isEditMode, postToParent2]);
30928
31032
  (0, import_react26.useEffect)(() => {
@@ -31219,6 +31323,13 @@ function OhhwellsBridge() {
31219
31323
  if (target.closest("[data-ohw-state-toggle]")) return;
31220
31324
  if (target.closest("[data-ohw-max-badge]")) return;
31221
31325
  if (isInsideLinkEditor(target)) return;
31326
+ if (isInsideFloatingPanel(target)) return;
31327
+ if (target.closest("[data-ohw-form-toolbar]")) return;
31328
+ if (target.closest(
31329
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
31330
+ )) {
31331
+ return;
31332
+ }
31222
31333
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
31223
31334
  clearMediaSelectionRef.current();
31224
31335
  }
@@ -31242,8 +31353,6 @@ function OhhwellsBridge() {
31242
31353
  return;
31243
31354
  }
31244
31355
  }
31245
- if (isInsideFloatingPanel(target)) return;
31246
- if (target.closest("[data-ohw-form-toolbar]")) return;
31247
31356
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
31248
31357
  if (collectionItem) {
31249
31358
  e.preventDefault();
@@ -31255,11 +31364,6 @@ function OhhwellsBridge() {
31255
31364
  });
31256
31365
  return;
31257
31366
  }
31258
- if (target.closest(
31259
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
31260
- )) {
31261
- return;
31262
- }
31263
31367
  {
31264
31368
  const formEl = getFormElement(target);
31265
31369
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -31423,9 +31527,13 @@ function OhhwellsBridge() {
31423
31527
  if (isIconEditable(editable) && !getSocialItem(editable)) {
31424
31528
  e.preventDefault();
31425
31529
  e.stopPropagation();
31426
- selectIconElementRef.current(editable);
31427
31530
  const aiIcon = editable.hasAttribute("data-ai-icon");
31428
31531
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
31532
+ if (aiIcon) {
31533
+ aiSectionApiRef.current?.selectFromElement(editable);
31534
+ } else {
31535
+ selectIconElementRef.current(editable);
31536
+ }
31429
31537
  postToParentRef.current({
31430
31538
  type: "ow:icon-pick",
31431
31539
  key: editable.dataset.ohwKey ?? "",
@@ -31653,6 +31761,9 @@ function OhhwellsBridge() {
31653
31761
  setHoveredItemRect(null);
31654
31762
  hoveredNavContainerRef.current = null;
31655
31763
  setHoveredNavContainerRect(null);
31764
+ siblingHintElRef.current = null;
31765
+ setSiblingHintRect(null);
31766
+ setSiblingHintRects([]);
31656
31767
  return;
31657
31768
  }
31658
31769
  {
@@ -31775,7 +31886,6 @@ function OhhwellsBridge() {
31775
31886
  hoveredNavContainerRef.current = null;
31776
31887
  setHoveredNavContainerRect(null);
31777
31888
  hoveredItemElRef.current = editable;
31778
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
31779
31889
  }
31780
31890
  }
31781
31891
  }
@@ -32482,7 +32592,11 @@ function OhhwellsBridge() {
32482
32592
  };
32483
32593
  const handleMouseMove = (e) => {
32484
32594
  const { clientX, clientY } = e;
32485
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
32595
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
32596
+ dismissImageHover();
32597
+ clearImageHover();
32598
+ return;
32599
+ }
32486
32600
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
32487
32601
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
32488
32602
  formHoverElRef.current = null;
@@ -32511,7 +32625,12 @@ function OhhwellsBridge() {
32511
32625
  setHoveredItemRect(null);
32512
32626
  hoveredNavContainerRef.current = null;
32513
32627
  setHoveredNavContainerRect(null);
32628
+ siblingHintElRef.current = null;
32629
+ setSiblingHintRect(null);
32630
+ setSiblingHintRects([]);
32514
32631
  dismissImageHover();
32632
+ clearImageHover();
32633
+ setSectionGap(null);
32515
32634
  return;
32516
32635
  }
32517
32636
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -32523,7 +32642,11 @@ function OhhwellsBridge() {
32523
32642
  if (e.data?.type !== "ow:pointer-sync") return;
32524
32643
  const { clientX, clientY } = e.data;
32525
32644
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
32526
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
32645
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
32646
+ dismissImageHover();
32647
+ clearImageHover();
32648
+ return;
32649
+ }
32527
32650
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
32528
32651
  if (probeSocialsRowAt(clientX, clientY)) return;
32529
32652
  probeSectionGapAt(clientX, clientY);
@@ -32903,6 +33026,7 @@ function OhhwellsBridge() {
32903
33026
  applyAiFooterFromContent(content);
32904
33027
  if (typeof content[STYLE_STORE_KEY] === "string") {
32905
33028
  stylesRef.current = content[STYLE_STORE_KEY];
33029
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
32906
33030
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
32907
33031
  }
32908
33032
  applyBrandChrome(content);
@@ -32917,12 +33041,12 @@ function OhhwellsBridge() {
32917
33041
  }
32918
33042
  if (key === AI_SECTIONS_KEY) continue;
32919
33043
  if (key === AI_FOOTER_KEY) continue;
33044
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
33045
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
32920
33046
  if (key === BRAND_KIT_KEY) continue;
32921
33047
  if (key === STYLE_STORE_KEY) continue;
32922
33048
  if (BRAND_CHROME_KEYS.has(key)) continue;
32923
- if (key === LOGO_PLACEHOLDER_KEY) continue;
32924
33049
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
32925
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
32926
33050
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
32927
33051
  continue;
32928
33052
  }
@@ -33595,6 +33719,12 @@ function OhhwellsBridge() {
33595
33719
  closeLinkPopoverRef.current();
33596
33720
  return;
33597
33721
  }
33722
+ if (floatingPanelOpenRef.current) {
33723
+ setFloatingPanelRef.current(null);
33724
+ deselectRef.current();
33725
+ deactivateRef.current();
33726
+ return;
33727
+ }
33598
33728
  deselectRef.current();
33599
33729
  deactivateRef.current();
33600
33730
  clearMediaSelectionRef.current();
@@ -34424,10 +34554,10 @@ function OhhwellsBridge() {
34424
34554
  window.removeEventListener("message", handleDuplicateSection);
34425
34555
  window.removeEventListener("message", handleDeactivate);
34426
34556
  window.removeEventListener("message", handleSelectNav);
34427
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
34428
34557
  window.removeEventListener("message", handleToastAction);
34429
34558
  window.removeEventListener("message", handleFormCount);
34430
34559
  window.removeEventListener("message", handleUiEscape);
34560
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
34431
34561
  autoSaveTimers.current.forEach(clearTimeout);
34432
34562
  autoSaveTimers.current.clear();
34433
34563
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -34721,7 +34851,7 @@ function OhhwellsBridge() {
34721
34851
  postToParent2({
34722
34852
  type: "ow:ready",
34723
34853
  version: "1",
34724
- bridgeVersion: "0.1.177",
34854
+ bridgeVersion: "0.1.179-next.473",
34725
34855
  path: pathname,
34726
34856
  nodes: collectEditableNodes(editContentRef.current),
34727
34857
  sections