@ohhwells/bridge 0.1.169-next.450 → 0.1.170

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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
 
3
3
  // src/OhhwellsBridge.tsx
4
- import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect7, useRef as useRef14, useState as useState18 } from "react";
4
+ import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect6, useRef as useRef14, useState as useState18 } from "react";
5
5
  import { createRoot as createRoot3 } from "react-dom/client";
6
6
  import { flushSync as flushSync3 } from "react-dom";
7
7
 
@@ -1127,21 +1127,21 @@ function chromeFrom(sample) {
1127
1127
  };
1128
1128
  }
1129
1129
  function filledPrimary(seed) {
1130
- const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1131
- const luminance = relativeLuminance(paint2);
1130
+ const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1131
+ const luminance = relativeLuminance(paint);
1132
1132
  return {
1133
- background: toCss({ ...paint2, a: 1 }),
1133
+ background: toCss({ ...paint, a: 1 }),
1134
1134
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1135
1135
  borderColor: TRANSPARENT,
1136
1136
  borderWidth: "0px"
1137
1137
  };
1138
1138
  }
1139
1139
  function generatedSecondary(primary) {
1140
- const paint2 = accentColor(primary);
1140
+ const paint = accentColor(primary);
1141
1141
  return {
1142
1142
  background: TRANSPARENT,
1143
- color: paint2,
1144
- borderColor: paint2,
1143
+ color: paint,
1144
+ borderColor: paint,
1145
1145
  borderWidth: "1px"
1146
1146
  };
1147
1147
  }
@@ -1154,9 +1154,9 @@ function generatedGhost(primary) {
1154
1154
  };
1155
1155
  }
1156
1156
  function normalizeOutlineChrome(outline, primary) {
1157
- const paint2 = accentColor(primary);
1157
+ const paint = accentColor(primary);
1158
1158
  const text = parseColor(outline.color);
1159
- const paintRgb = parseColor(paint2);
1159
+ const paintRgb = parseColor(paint);
1160
1160
  const primaryLabel = parseColor(primary.color);
1161
1161
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1162
1162
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1165,8 +1165,8 @@ function normalizeOutlineChrome(outline, primary) {
1165
1165
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1166
1166
  return {
1167
1167
  ...outline,
1168
- color: paint2,
1169
- borderColor: hasBorder ? paint2 : outline.borderColor
1168
+ color: paint,
1169
+ borderColor: hasBorder ? paint : outline.borderColor
1170
1170
  };
1171
1171
  }
1172
1172
  function generateButtonVariants(samples) {
@@ -6762,21 +6762,6 @@ function pricingCardFeatureCount(tree, index) {
6762
6762
  const target = findPricingCollection(tree)?.children?.[index];
6763
6763
  return target ? pricingFeatureList(target).length : 0;
6764
6764
  }
6765
- function prevailingFeatureIcon(features) {
6766
- const counts = /* @__PURE__ */ new Map();
6767
- for (const row of features) {
6768
- const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6769
- const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6770
- entry.count += 1;
6771
- counts.set(key, entry);
6772
- }
6773
- let best = null;
6774
- for (const entry of counts.values()) {
6775
- if (!best || entry.count > best.count) best = entry;
6776
- }
6777
- if (!best) return {};
6778
- return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6779
- }
6780
6765
  function addPricingCardFeature(tree, index, text) {
6781
6766
  return withPricingCollection(tree, (collection) => {
6782
6767
  const children = collection.children;
@@ -6785,7 +6770,7 @@ function addPricingCardFeature(tree, index, text) {
6785
6770
  const features = pricingFeatureList(target);
6786
6771
  if (features.length >= PRICING_FEATURES_MAX) return false;
6787
6772
  target.slots = target.slots ?? {};
6788
- target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6773
+ target.slots.features = [...features, { text }];
6789
6774
  return true;
6790
6775
  });
6791
6776
  }
@@ -7429,120 +7414,6 @@ function findSelectableNavContainer(doc = document) {
7429
7414
  );
7430
7415
  }
7431
7416
 
7432
- // src/lib/youtube.ts
7433
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7434
- function extractYouTubeId(input) {
7435
- const trimmed = input.trim();
7436
- if (!trimmed) return null;
7437
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7438
- let url;
7439
- try {
7440
- url = new URL(trimmed);
7441
- } catch {
7442
- return null;
7443
- }
7444
- const host = url.hostname.replace(/^www\./, "");
7445
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7446
- return null;
7447
- }
7448
- let candidate = null;
7449
- if (host === "youtu.be") {
7450
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
7451
- } else if (url.pathname === "/watch") {
7452
- candidate = url.searchParams.get("v");
7453
- } else {
7454
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7455
- candidate = match ? match[1] : null;
7456
- }
7457
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7458
- }
7459
-
7460
- // src/lib/section-embed.ts
7461
- var SECTION_EMBED_SUFFIX = "__ohw_embed";
7462
- function readStoredEmbed(value) {
7463
- if (value.startsWith("start\n")) {
7464
- return { raw: value.slice("start\n".length), at: "start" };
7465
- }
7466
- return { raw: value, at: "end" };
7467
- }
7468
- function embedFrameSrc(value) {
7469
- const videoId = extractYouTubeId(value);
7470
- if (videoId) {
7471
- return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7472
- }
7473
- let url;
7474
- try {
7475
- url = new URL(value);
7476
- } catch {
7477
- return null;
7478
- }
7479
- const host = url.hostname.replace(/^www\./, "").toLowerCase();
7480
- if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7481
- const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7482
- const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7483
- return { src, title: "Map" };
7484
- }
7485
- if (host === "maps.app.goo.gl") {
7486
- return { src: value, title: "Map" };
7487
- }
7488
- if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7489
- return { src: value, title: "Calendar" };
7490
- }
7491
- if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7492
- return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7493
- }
7494
- if (host === "forms.gle") {
7495
- return { src: value, title: "Form" };
7496
- }
7497
- return null;
7498
- }
7499
- function place(section, box, at) {
7500
- if (at === "start") {
7501
- section.insertBefore(box, section.firstChild);
7502
- return;
7503
- }
7504
- section.appendChild(box);
7505
- }
7506
- function paint(section, key, src, title, at) {
7507
- const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7508
- const frame = existing?.querySelector("iframe");
7509
- if (existing && frame) {
7510
- if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7511
- frame.title = title;
7512
- place(section, existing, at);
7513
- return;
7514
- }
7515
- existing?.remove();
7516
- const box = document.createElement("div");
7517
- box.setAttribute("data-ohw-section-embed", key);
7518
- box.style.cssText = at === "start" ? "width:100%;max-width:960px;margin:0 auto 32px;padding:32px 24px 0;box-sizing:border-box;" : "width:100%;max-width:960px;margin:32px auto 0;padding:0 24px 32px;box-sizing:border-box;";
7519
- const frameWrap = document.createElement("div");
7520
- frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7521
- const iframe = document.createElement("iframe");
7522
- iframe.src = src;
7523
- iframe.title = title;
7524
- iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7525
- iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7526
- iframe.setAttribute("allowfullscreen", "");
7527
- frameWrap.appendChild(iframe);
7528
- box.appendChild(frameWrap);
7529
- place(section, box, at);
7530
- }
7531
- function applySectionEmbeds(content) {
7532
- for (const [key, val] of Object.entries(content)) {
7533
- if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7534
- const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7535
- const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7536
- const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7537
- const frame = stored ? embedFrameSrc(stored.raw) : null;
7538
- if (!section || !stored || !frame) {
7539
- section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7540
- continue;
7541
- }
7542
- paint(section, key, frame.src, frame.title, stored.at);
7543
- }
7544
- }
7545
-
7546
7417
  // src/ui/ai-tree/aiSectionsManager.tsx
7547
7418
  import { flushSync } from "react-dom";
7548
7419
  import { createRoot } from "react-dom/client";
@@ -8116,7 +7987,7 @@ var AI_MOBILE_CSS = [
8116
7987
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
8117
7988
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
8118
7989
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
8119
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
7990
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8120
7991
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
8121
7992
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
8122
7993
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8132,10 +8003,8 @@ var AI_MOBILE_CSS = [
8132
8003
  "[data-ai-section]{overflow-x:hidden}",
8133
8004
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8134
8005
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
8135
- // still got a 20px band of section background down both sides on a phone. The footer's own
8136
- // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8137
- "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8138
- "[data-ai-container]{padding:0 20px !important}",
8006
+ // still got a 20px band of section background down both sides on a phone.
8007
+ "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8139
8008
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8140
8009
  "[data-ai-cell]{width:100%;min-width:0}",
8141
8010
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8340,31 +8209,6 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8340
8209
  function textAttrs(ctx, path) {
8341
8210
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8342
8211
  }
8343
- var AI_RESPONSIVE_CSS = [
8344
- "@media (max-width: 960px) {",
8345
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8346
- ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8347
- "}",
8348
- "@media (max-width: 640px) {",
8349
- " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8350
- " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8351
- // Group containers flatten to a column on phones; span placements come along for free.
8352
- // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8353
- // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8354
- // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8355
- // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8356
- // layered text used to be.
8357
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8358
- ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8359
- // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8360
- // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8361
- // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8362
- // other rule had already been taught to stand down.
8363
- " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8364
- " [data-ai-responsive] { overflow-x: hidden; }",
8365
- " [data-ai-responsive] img { max-width: 100%; }",
8366
- "}"
8367
- ].join("\n");
8368
8212
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8369
8213
  function MediaBox({
8370
8214
  refValue,
@@ -8419,7 +8263,7 @@ function MediaBox({
8419
8263
  position: fill ? "absolute" : void 0,
8420
8264
  inset: fill ? 0 : void 0,
8421
8265
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8422
- height: fill ? "100%" : fixedSize ? height : void 0,
8266
+ height: fill ? "100%" : void 0,
8423
8267
  aspectRatio: fill ? void 0 : aspectRatio,
8424
8268
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8425
8269
  borderRadius: radius,
@@ -9915,7 +9759,7 @@ function CollectionBlock({ node, ctx, path }) {
9915
9759
  return /* @__PURE__ */ jsx(
9916
9760
  "div",
9917
9761
  {
9918
- "data-ai-grid": String(itemsPerRow),
9762
+ "data-ai-grid": "",
9919
9763
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9920
9764
  style: {
9921
9765
  display: "grid",
@@ -10217,7 +10061,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10217
10061
  },
10218
10062
  children: [
10219
10063
  i > 0 && ctx.heroOverlapFullBleed ? (
10220
- // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10064
+ // The section's `data-ai-container` gave up its max-width/gutter so the base
10221
10065
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10222
10066
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10223
10067
  // the full section width instead of reading at the usual content width.
@@ -10636,7 +10480,6 @@ function AiTreeRenderer({
10636
10480
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10637
10481
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10638
10482
  ...bgAttrs,
10639
- "data-ai-responsive": "",
10640
10483
  style: {
10641
10484
  position: "relative",
10642
10485
  padding: `${padCss} 0`,
@@ -10650,13 +10493,12 @@ function AiTreeRenderer({
10650
10493
  ...fillHeight ? { display: "grid" } : {}
10651
10494
  },
10652
10495
  children: [
10653
- /* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
10654
- /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10655
10496
  isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10497
+ /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10656
10498
  /* @__PURE__ */ jsx(
10657
10499
  "div",
10658
10500
  {
10659
- "data-ai-section-inner": "",
10501
+ "data-ai-container": "",
10660
10502
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10661
10503
  style: {
10662
10504
  position: "relative",
@@ -10673,7 +10515,7 @@ function AiTreeRenderer({
10673
10515
  children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
10674
10516
  "div",
10675
10517
  {
10676
- "data-ai-columns": "",
10518
+ "data-ai-row": "",
10677
10519
  style: {
10678
10520
  display: "grid",
10679
10521
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -11335,10 +11177,9 @@ function applyAiSectionsToDom(state, options) {
11335
11177
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11336
11178
  continue;
11337
11179
  }
11180
+ const isNewMount = !existing || !existing.container.isConnected;
11338
11181
  let container = existing?.container;
11339
- let isNewMount = false;
11340
11182
  if (!container || !container.isConnected) {
11341
- isNewMount = true;
11342
11183
  existing?.root.unmount();
11343
11184
  container?.remove();
11344
11185
  container = document.createElement("div");
@@ -11676,34 +11517,6 @@ function minSpanForFooterBlock(type) {
11676
11517
  return 3;
11677
11518
  }
11678
11519
  }
11679
- function readLiveSocialItems() {
11680
- const root = getFooterRoot();
11681
- const row = root?.querySelector("[data-ohw-socials-row]");
11682
- if (!row) return [];
11683
- const items = [];
11684
- for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11685
- const href = anchor.getAttribute("href")?.trim() ?? "";
11686
- const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11687
- const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11688
- if (!platform || !/^https?:\/\//i.test(href)) continue;
11689
- items.push({ platform, href });
11690
- }
11691
- return items;
11692
- }
11693
- function syncSocialRowsFromDom(tree) {
11694
- const root = getFooterRoot();
11695
- if (!root) return;
11696
- const row = root.querySelector("[data-ohw-socials-row]");
11697
- const live = readLiveSocialItems();
11698
- if (row && live.length === 0) return;
11699
- for (const col of tree.columns) {
11700
- col.blocks = col.blocks.flatMap((block) => {
11701
- if (block.type !== "social-row") return [block];
11702
- if (!row) return [];
11703
- return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
11704
- });
11705
- }
11706
- }
11707
11520
  function collectBrandBlocks(tree) {
11708
11521
  const brand = [];
11709
11522
  for (const col of tree.columns) {
@@ -11949,7 +11762,6 @@ function textOf2(el) {
11949
11762
  }
11950
11763
  function syncFooterTreeLinksFromDom(tree) {
11951
11764
  const next = cloneTree(tree);
11952
- syncSocialRowsFromDom(next);
11953
11765
  const domCols = listFooterColumns().map((col) => {
11954
11766
  const heading = getFooterColumnHeadingEl(col);
11955
11767
  const title = heading ? textOf2(heading) : void 0;
@@ -17762,7 +17574,7 @@ function apiBase() {
17762
17574
  function bridgeVersion() {
17763
17575
  try {
17764
17576
  if (true) {
17765
- return "0.1.169-next.450";
17577
+ return "0.1.170";
17766
17578
  }
17767
17579
  } catch {
17768
17580
  }
@@ -17776,7 +17588,7 @@ function stampBridgeVersionOnDocument() {
17776
17588
  return;
17777
17589
  }
17778
17590
  try {
17779
- const v = true ? "0.1.169-next.450" : "";
17591
+ const v = true ? "0.1.170" : "";
17780
17592
  if (v) {
17781
17593
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17782
17594
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18454,7 +18266,6 @@ function MediaOverlay({
18454
18266
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18455
18267
  );
18456
18268
  }, [isVideo]);
18457
- const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18458
18269
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18459
18270
  const box = {
18460
18271
  position: "fixed",
@@ -18553,10 +18364,11 @@ function MediaOverlay({
18553
18364
  className: "flex items-center justify-center cursor-pointer",
18554
18365
  style: {
18555
18366
  ...box,
18556
- // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18557
- // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18558
- // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18559
- pointerEvents: "none",
18367
+ // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18368
+ // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18369
+ // in-document, pointer-events does it natively. The button below opts back in, so
18370
+ // Replace still works.
18371
+ pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18560
18372
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18561
18373
  // than hovered. Hover keeps the existing tinted preview.
18562
18374
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18583,17 +18395,17 @@ function MediaOverlay({
18583
18395
  },
18584
18396
  children: [
18585
18397
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18586
- replaceLabel
18398
+ isVideo ? "Replace video" : "Replace image"
18587
18399
  ]
18588
18400
  }
18589
18401
  ),
18590
- showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
18402
+ replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ jsxs8(
18591
18403
  Button,
18592
18404
  {
18593
18405
  "data-ohw-media-overlay": "",
18594
18406
  variant: "outline",
18595
18407
  size: "sm",
18596
- "aria-label": replaceLabel,
18408
+ "aria-label": isVideo ? "Replace video" : "Replace image",
18597
18409
  className: "gap-1.5 cursor-pointer hover:bg-background",
18598
18410
  style: {
18599
18411
  ...OVERLAY_BUTTON_STYLE,
@@ -18616,7 +18428,7 @@ function MediaOverlay({
18616
18428
  },
18617
18429
  children: [
18618
18430
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18619
- replaceMode === "full" ? replaceLabel : null
18431
+ replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18620
18432
  ]
18621
18433
  }
18622
18434
  )
@@ -19247,24 +19059,8 @@ function AiSectionOverlay({
19247
19059
  }
19248
19060
 
19249
19061
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19250
- import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
19251
- import {
19252
- AlignCenter,
19253
- AlignLeft,
19254
- AlignRight,
19255
- ArrowLeft as ArrowLeft2,
19256
- ArrowRight as ArrowRight2,
19257
- Check as Check2,
19258
- ChevronDown as ChevronDown3,
19259
- Image as ImageIcon2,
19260
- ImageMinus,
19261
- ImagePlus,
19262
- Link as LinkIcon,
19263
- Minus,
19264
- Palette,
19265
- Plus as Plus2,
19266
- Star
19267
- } from "lucide-react";
19062
+ import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
19063
+ import { Star } from "lucide-react";
19268
19064
 
19269
19065
  // src/lib/ai-media-strip-tree.ts
19270
19066
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19378,6 +19174,14 @@ function setMediaStripItemAsset(tree, index, assetId) {
19378
19174
  return true;
19379
19175
  });
19380
19176
  }
19177
+ function setMediaStripItemAlt(tree, index, alt) {
19178
+ return withMediaStrip(tree, (block) => {
19179
+ const items = block.items;
19180
+ if (index < 0 || index >= items.length) return false;
19181
+ items[index] = { ...items[index], alt };
19182
+ return true;
19183
+ });
19184
+ }
19381
19185
  function setMediaStripItemLink(tree, index, link) {
19382
19186
  return withMediaStrip(tree, (block) => {
19383
19187
  const items = block.items;
@@ -19395,117 +19199,11 @@ function setMediaStripItemLink(tree, index, link) {
19395
19199
  });
19396
19200
  }
19397
19201
 
19398
- // src/ui/dialog.tsx
19399
- import * as React9 from "react";
19400
- import { Dialog as DialogPrimitive } from "radix-ui";
19401
- import { X as X2 } from "lucide-react";
19402
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19403
- function Dialog2({
19404
- ...props
19405
- }) {
19406
- return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
19407
- }
19408
- function DialogPortal({
19409
- ...props
19410
- }) {
19411
- return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
19412
- }
19413
- function DialogOverlay({
19414
- className,
19415
- ...props
19416
- }) {
19417
- return /* @__PURE__ */ jsx20(
19418
- DialogPrimitive.Overlay,
19419
- {
19420
- "data-slot": "dialog-overlay",
19421
- "data-ohw-link-modal-root": "",
19422
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19423
- ...props
19424
- }
19425
- );
19426
- }
19427
- var DialogContent = React9.forwardRef(
19428
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19429
- const positionMode = container ? "absolute" : "fixed";
19430
- return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
19431
- /* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19432
- /* @__PURE__ */ jsxs11(
19433
- DialogPrimitive.Content,
19434
- {
19435
- ref,
19436
- "data-slot": "dialog-content",
19437
- className: cn(
19438
- positionMode,
19439
- "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",
19440
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19441
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19442
- className
19443
- ),
19444
- onMouseDown: (e) => e.stopPropagation(),
19445
- ...props,
19446
- children: [
19447
- children,
19448
- showCloseButton ? /* @__PURE__ */ jsx20(
19449
- DialogPrimitive.Close,
19450
- {
19451
- type: "button",
19452
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19453
- "aria-label": "Close",
19454
- children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
19455
- }
19456
- ) : null
19457
- ]
19458
- }
19459
- )
19460
- ] });
19461
- }
19462
- );
19463
- DialogContent.displayName = DialogPrimitive.Content.displayName;
19464
- function DialogHeader({
19465
- className,
19466
- ...props
19467
- }) {
19468
- return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19469
- }
19470
- function DialogFooter({
19471
- className,
19472
- ...props
19473
- }) {
19474
- return /* @__PURE__ */ jsx20(
19475
- "div",
19476
- {
19477
- className: cn("flex items-center justify-end gap-2", className),
19478
- ...props
19479
- }
19480
- );
19481
- }
19482
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19483
- DialogPrimitive.Title,
19484
- {
19485
- ref,
19486
- className: cn(
19487
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19488
- className
19489
- ),
19490
- ...props
19491
- }
19492
- ));
19493
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
19494
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19495
- DialogPrimitive.Description,
19496
- {
19497
- ref,
19498
- className: cn("text-sm text-muted-foreground", className),
19499
- ...props
19500
- }
19501
- ));
19502
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
19503
- var DialogClose = DialogPrimitive.Close;
19504
-
19505
19202
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19506
- import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19507
- var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19508
- 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]";
19203
+ import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19204
+ var PRIMARY3 = "#0885FE";
19205
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19206
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19509
19207
  function findMediaStripItemElement(sectionId, index) {
19510
19208
  const sectionEl2 = findByInstanceId(sectionId);
19511
19209
  if (!sectionEl2) return null;
@@ -19515,35 +19213,14 @@ function findMediaStripItemElement(sectionId, index) {
19515
19213
  }
19516
19214
  return null;
19517
19215
  }
19518
- function itemRefFromTarget(target) {
19519
- if (!(target instanceof Element)) return null;
19520
- if (target.closest(CHROME_SELECTOR)) return null;
19521
- const itemEl = target.closest("[data-ohw-media-strip-item]");
19522
- if (!itemEl) return null;
19523
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19524
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19525
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19526
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19527
- if (!sectionId || Number.isNaN(index)) return null;
19528
- return { sectionId, index };
19529
- }
19530
- function sameRef(a, b) {
19531
- return a?.sectionId === b?.sectionId && a?.index === b?.index;
19532
- }
19533
- function rectOf(el) {
19216
+ function readRect2(ref) {
19217
+ const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19534
19218
  if (!el) return null;
19535
19219
  const r2 = el.getBoundingClientRect();
19536
19220
  if (r2.width <= 0 || r2.height <= 0) return null;
19537
19221
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19538
19222
  }
19539
- function readRect2(ref) {
19540
- return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19541
- }
19542
- function readStripRect(ref) {
19543
- const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19544
- return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19545
- }
19546
- function useLiveItemRect(ref, strip = false) {
19223
+ function useLiveItemRect(ref) {
19547
19224
  const [rect, setRect] = useState8(null);
19548
19225
  useEffect9(() => {
19549
19226
  if (!ref) {
@@ -19551,7 +19228,7 @@ function useLiveItemRect(ref, strip = false) {
19551
19228
  return;
19552
19229
  }
19553
19230
  const update = () => {
19554
- const next = strip ? readStripRect(ref) : readRect2(ref);
19231
+ const next = readRect2(ref);
19555
19232
  setRect(
19556
19233
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19557
19234
  );
@@ -19566,49 +19243,9 @@ function useLiveItemRect(ref, strip = false) {
19566
19243
  window.removeEventListener("resize", update);
19567
19244
  clearInterval(interval);
19568
19245
  };
19569
- }, [ref?.sectionId, ref?.index, strip]);
19246
+ }, [ref?.sectionId, ref?.index]);
19570
19247
  return rect;
19571
19248
  }
19572
- var TOOLBAR_STRIP_GAP = 52;
19573
- var TOOLBAR_STRIP_GAP_MOBILE = 42;
19574
- var TOOLBAR_EDGE_MARGIN2 = 4;
19575
- function StripToolbarSlot({ stripRect, children }) {
19576
- const slotRef = useRef5(null);
19577
- const [shift, setShift] = useState8(0);
19578
- const centerX = stripRect.left + stripRect.width / 2;
19579
- useLayoutEffect4(() => {
19580
- const slot = slotRef.current;
19581
- if (!slot) return;
19582
- const clamp = () => {
19583
- const w = slot.offsetWidth;
19584
- if (w <= 0) return;
19585
- const half = w / 2;
19586
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19587
- setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19588
- };
19589
- clamp();
19590
- const ro = new ResizeObserver(clamp);
19591
- ro.observe(slot);
19592
- return () => ro.disconnect();
19593
- }, [centerX, children]);
19594
- const mobile = window.innerWidth <= 480;
19595
- return /* @__PURE__ */ jsx21(
19596
- "div",
19597
- {
19598
- ref: slotRef,
19599
- "data-ohw-bridge": "",
19600
- "data-ohw-item-interaction": "",
19601
- className: "pointer-events-auto fixed",
19602
- style: {
19603
- top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19604
- left: centerX + shift,
19605
- transform: "translate(-50%, -100%)",
19606
- zIndex: 2147483645
19607
- },
19608
- children
19609
- }
19610
- );
19611
- }
19612
19249
  function requestValidateTree(postToParent2, tree) {
19613
19250
  return new Promise((resolve) => {
19614
19251
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19645,72 +19282,116 @@ function requestAssetPick(postToParent2) {
19645
19282
  postToParent2({ type: "ow:asset-pick", id });
19646
19283
  });
19647
19284
  }
19648
- function ToolbarAction({
19285
+ function Pill({
19649
19286
  label,
19650
19287
  onClick,
19651
- disabled = false,
19652
- active = false,
19653
- children
19288
+ disabled,
19289
+ active
19654
19290
  }) {
19655
- const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19656
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19657
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19658
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19659
- ] });
19660
- }
19661
- function ToolbarSeparator() {
19662
- return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19291
+ return /* @__PURE__ */ jsx20(
19292
+ "button",
19293
+ {
19294
+ type: "button",
19295
+ onClick,
19296
+ disabled,
19297
+ style: {
19298
+ height: 28,
19299
+ padding: "0 10px",
19300
+ display: "inline-flex",
19301
+ alignItems: "center",
19302
+ gap: 4,
19303
+ borderRadius: 999,
19304
+ border: "none",
19305
+ cursor: disabled ? "default" : "pointer",
19306
+ background: active ? OHW_BLUE_DARK : "#ffffff",
19307
+ color: active ? "#ffffff" : OHW_BLUE_DARK,
19308
+ opacity: disabled ? 0.4 : 1,
19309
+ fontSize: 12,
19310
+ lineHeight: "16px",
19311
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19312
+ whiteSpace: "nowrap",
19313
+ flex: "0 0 auto"
19314
+ },
19315
+ children: label
19316
+ }
19317
+ );
19663
19318
  }
19664
- function OptionMenu({
19665
- label,
19666
- value,
19667
- options,
19668
- onChange
19669
- }) {
19670
- const current = options.find((o) => o.value === value) ?? options[0];
19671
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
19672
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
19673
- /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
19674
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
19675
- "button",
19676
- {
19677
- type: "button",
19678
- "aria-label": label,
19679
- 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",
19680
- children: [
19681
- /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
19682
- /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
19683
- ]
19684
- }
19685
- ) }),
19686
- /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
19687
- const selected = option.value === value;
19688
- return /* @__PURE__ */ jsxs12(
19689
- DropdownMenuItem,
19319
+ function AltInput({ value, onCommit }) {
19320
+ const [draft, setDraft] = useState8(value);
19321
+ useEffect9(() => setDraft(value), [value]);
19322
+ return /* @__PURE__ */ jsxs11(
19323
+ "div",
19324
+ {
19325
+ style: {
19326
+ display: "flex",
19327
+ alignItems: "center",
19328
+ gap: 6,
19329
+ height: 28,
19330
+ padding: "0 12px",
19331
+ borderRadius: 999,
19332
+ background: "#ffffff",
19333
+ width: "100%",
19334
+ maxWidth: 260,
19335
+ boxSizing: "border-box"
19336
+ },
19337
+ children: [
19338
+ /* @__PURE__ */ jsx20(
19339
+ "span",
19690
19340
  {
19691
- role: "menuitemradio",
19692
- "aria-checked": selected,
19693
- onSelect: () => onChange(option.value),
19694
- className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
19695
- children: [
19696
- /* @__PURE__ */ jsx21("span", { children: option.label }),
19697
- selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
19698
- ]
19699
- },
19700
- option.value
19701
- );
19702
- }) })
19703
- ] })
19704
- ] });
19341
+ style: {
19342
+ flex: "0 0 auto",
19343
+ color: OHW_BLUE_DARK,
19344
+ fontSize: 10,
19345
+ fontWeight: 700,
19346
+ textTransform: "uppercase",
19347
+ letterSpacing: 0.4
19348
+ },
19349
+ children: "Alt"
19350
+ }
19351
+ ),
19352
+ /* @__PURE__ */ jsx20(
19353
+ "input",
19354
+ {
19355
+ type: "text",
19356
+ value: draft,
19357
+ onChange: (e) => setDraft(e.target.value),
19358
+ onBlur: () => {
19359
+ if (draft !== value) onCommit(draft);
19360
+ },
19361
+ onKeyDown: (e) => {
19362
+ if (e.key === "Enter") e.currentTarget.blur();
19363
+ if (e.key === "Escape") {
19364
+ setDraft(value);
19365
+ e.currentTarget.blur();
19366
+ }
19367
+ },
19368
+ placeholder: "Describe this image",
19369
+ "aria-label": "Image alt text",
19370
+ style: {
19371
+ flex: 1,
19372
+ minWidth: 0,
19373
+ border: "none",
19374
+ outline: "none",
19375
+ background: "transparent",
19376
+ fontSize: 12,
19377
+ lineHeight: "16px",
19378
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19379
+ color: "#1f2937"
19380
+ }
19381
+ }
19382
+ )
19383
+ ]
19384
+ }
19385
+ );
19705
19386
  }
19706
19387
  var VARIANTS = [
19707
19388
  { value: "logos", label: "Logos" },
19708
19389
  { value: "reel", label: "Reel" }
19709
19390
  ];
19710
19391
  var ALIGNS = [
19711
- { value: "left", label: "Align left", Icon: AlignLeft },
19712
- { value: "center", label: "Align center", Icon: AlignCenter },
19713
- { value: "right", label: "Align right", Icon: AlignRight }
19392
+ { value: "left", label: "Left" },
19393
+ { value: "center", label: "Center" },
19394
+ { value: "right", label: "Right" }
19714
19395
  ];
19715
19396
  var HOVERS = [
19716
19397
  { value: "none", label: "None" },
@@ -19718,104 +19399,104 @@ var HOVERS = [
19718
19399
  { value: "zoom", label: "Zoom" },
19719
19400
  { value: "fade", label: "Fade" }
19720
19401
  ];
19402
+ var TREATMENTS = [
19403
+ { value: "color", label: "Color" },
19404
+ { value: "grayscale", label: "Grayscale" }
19405
+ ];
19721
19406
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19722
- function LinkModal({
19723
- href,
19724
- linkTarget,
19725
- onClose,
19726
- onSave
19727
- }) {
19728
- const [draft, setDraft] = useState8(href);
19729
- const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
19407
+ function LinkInput({ value, onCommit }) {
19408
+ const [draft, setDraft] = useState8(value);
19730
19409
  const [invalid, setInvalid] = useState8(false);
19731
- const save = () => {
19410
+ useEffect9(() => {
19411
+ setDraft(value);
19412
+ setInvalid(false);
19413
+ }, [value]);
19414
+ const commit2 = () => {
19732
19415
  const next = draft.trim();
19733
- if (next && !HTTP_URL_RE.test(next)) {
19734
- setInvalid(true);
19735
- return;
19736
- }
19737
- onSave(next, newTab ? "new-tab" : "same-tab");
19738
- onClose();
19416
+ if (next === value) return setInvalid(false);
19417
+ if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19418
+ setInvalid(false);
19419
+ onCommit(next);
19739
19420
  };
19740
- return /* @__PURE__ */ jsx21(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs12(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
19741
- /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
19742
- /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
19743
- /* @__PURE__ */ jsx21(
19744
- "input",
19745
- {
19746
- autoFocus: true,
19747
- type: "text",
19748
- inputMode: "url",
19749
- value: draft,
19750
- onChange: (e) => {
19751
- setDraft(e.target.value);
19752
- setInvalid(false);
19753
- },
19754
- onKeyDown: (e) => {
19755
- if (e.key === "Enter") save();
19756
- },
19757
- placeholder: "https://example.com",
19758
- "aria-label": "Image link URL",
19759
- "aria-invalid": invalid,
19760
- className: cn(
19761
- "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",
19762
- invalid && "border-destructive focus:border-destructive"
19763
- )
19764
- }
19765
- ),
19766
- invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
19767
- /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
19768
- /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
19769
- "Open in new tab"
19770
- ] })
19771
- ] }),
19772
- /* @__PURE__ */ jsxs12(DialogFooter, { children: [
19773
- href && /* @__PURE__ */ jsx21(
19774
- "button",
19775
- {
19776
- type: "button",
19777
- onClick: () => {
19778
- onSave("", "new-tab");
19779
- onClose();
19780
- },
19781
- className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
19782
- children: "Remove link"
19783
- }
19784
- ),
19785
- /* @__PURE__ */ jsx21(
19786
- "button",
19787
- {
19788
- type: "button",
19789
- onClick: onClose,
19790
- className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
19791
- children: "Cancel"
19792
- }
19793
- ),
19794
- /* @__PURE__ */ jsx21(
19795
- "button",
19796
- {
19797
- type: "button",
19798
- onClick: save,
19799
- className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
19800
- children: "Save"
19801
- }
19802
- )
19803
- ] })
19804
- ] }) });
19421
+ return /* @__PURE__ */ jsxs11(
19422
+ "div",
19423
+ {
19424
+ style: {
19425
+ display: "flex",
19426
+ alignItems: "center",
19427
+ gap: 6,
19428
+ height: 28,
19429
+ padding: "0 12px",
19430
+ borderRadius: 999,
19431
+ background: "#ffffff",
19432
+ width: "100%",
19433
+ maxWidth: 260,
19434
+ boxSizing: "border-box",
19435
+ boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19436
+ },
19437
+ children: [
19438
+ /* @__PURE__ */ jsx20(
19439
+ "span",
19440
+ {
19441
+ style: {
19442
+ flex: "0 0 auto",
19443
+ color: OHW_BLUE_DARK,
19444
+ fontSize: 10,
19445
+ fontWeight: 700,
19446
+ textTransform: "uppercase",
19447
+ letterSpacing: 0.4
19448
+ },
19449
+ children: "Link"
19450
+ }
19451
+ ),
19452
+ /* @__PURE__ */ jsx20(
19453
+ "input",
19454
+ {
19455
+ type: "text",
19456
+ inputMode: "url",
19457
+ value: draft,
19458
+ onChange: (e) => setDraft(e.target.value),
19459
+ onBlur: commit2,
19460
+ onKeyDown: (e) => {
19461
+ if (e.key === "Enter") e.currentTarget.blur();
19462
+ if (e.key === "Escape") {
19463
+ setDraft(value);
19464
+ setInvalid(false);
19465
+ e.currentTarget.blur();
19466
+ }
19467
+ },
19468
+ placeholder: "https://example.com",
19469
+ "aria-label": "Image link URL",
19470
+ "aria-invalid": invalid,
19471
+ style: {
19472
+ flex: 1,
19473
+ minWidth: 0,
19474
+ border: "none",
19475
+ outline: "none",
19476
+ background: "transparent",
19477
+ fontSize: 12,
19478
+ lineHeight: "16px",
19479
+ fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19480
+ color: "#1f2937"
19481
+ }
19482
+ }
19483
+ )
19484
+ ]
19485
+ }
19486
+ );
19805
19487
  }
19806
19488
  function MediaStripToolbar({
19807
19489
  entry,
19808
19490
  index,
19809
19491
  pending,
19810
19492
  error,
19811
- itemEditOn,
19812
- onToggleItemEdit,
19813
19493
  onSetVariant,
19814
19494
  onSetAlign,
19815
19495
  onSetHover,
19816
19496
  onSetTreatment,
19817
19497
  onResize,
19818
- onOpenLink,
19498
+ onSetAlt,
19499
+ onSetLink,
19819
19500
  onAddItem,
19820
19501
  onRemoveItem,
19821
19502
  onChangeImage,
@@ -19824,102 +19505,81 @@ function MediaStripToolbar({
19824
19505
  }) {
19825
19506
  const items = mediaStripItems(entry.tree);
19826
19507
  const itemCount = items.length;
19508
+ const currentAlt = items[index]?.alt ?? "";
19509
+ const currentHref2 = items[index]?.href ?? "";
19510
+ const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19827
19511
  const slots = findMediaStripSlots(entry.tree);
19828
19512
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19829
19513
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19830
19514
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19831
19515
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19832
19516
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19833
- const mobile = window.innerWidth <= 480;
19834
- const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
19835
- return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
19517
+ const isMobile = window.innerWidth <= 480;
19518
+ const rowStyle = isMobile ? {
19519
+ display: "flex",
19520
+ gap: 6,
19521
+ flexWrap: "nowrap",
19522
+ justifyContent: "center",
19523
+ overflowX: "auto",
19524
+ WebkitOverflowScrolling: "touch",
19525
+ width: "100%",
19526
+ scrollbarWidth: "none"
19527
+ } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19528
+ return /* @__PURE__ */ jsxs11(
19836
19529
  "div",
19837
19530
  {
19838
19531
  "data-ohw-bridge": "",
19839
19532
  "data-ohw-toolbar": "",
19840
19533
  onMouseDown: (e) => e.stopPropagation(),
19841
- className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
19842
- style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19534
+ style: {
19535
+ display: "flex",
19536
+ flexDirection: "column",
19537
+ gap: 6,
19538
+ alignItems: "center",
19539
+ background: OHW_BLUE,
19540
+ padding: 8,
19541
+ borderRadius: 12,
19542
+ boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19543
+ pointerEvents: pending ? "none" : "auto",
19544
+ opacity: pending ? 0.6 : 1,
19545
+ maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19546
+ },
19843
19547
  children: [
19844
- /* @__PURE__ */ jsxs12(
19845
- "div",
19846
- {
19847
- className: cn(
19848
- "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
19849
- "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
19850
- mobile ? "flex-wrap justify-center" : "flex-nowrap"
19851
- ),
19852
- children: [
19853
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
19854
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
19855
- CustomToolbarButton,
19856
- {
19857
- type: "button",
19858
- "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
19859
- "aria-pressed": itemEditOn,
19860
- onClick: onToggleItemEdit,
19861
- className: "group size-8",
19862
- children: /* @__PURE__ */ jsx21(
19863
- Star,
19864
- {
19865
- size: 16,
19866
- fill: "currentColor",
19867
- strokeWidth: 0,
19868
- className: cn(
19869
- "transition-colors",
19870
- itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
19871
- ),
19872
- style: { pointerEvents: "none" }
19873
- }
19874
- )
19875
- }
19876
- ) }),
19877
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
19878
- ] }),
19879
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19880
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
19881
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
19882
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
19883
- /* @__PURE__ */ jsx21(
19884
- ToolbarAction,
19885
- {
19886
- label: gatedLabel("Move right"),
19887
- onClick: onMoveRight,
19888
- disabled: !itemEditOn || index >= itemCount - 1,
19889
- children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
19890
- }
19891
- ),
19892
- /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
19893
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19894
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
19895
- /* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
19896
- /* @__PURE__ */ jsx21(
19897
- ToolbarAction,
19898
- {
19899
- label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
19900
- active: treatment === "grayscale",
19901
- onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
19902
- children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
19903
- }
19904
- ),
19905
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19906
- ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ jsx21(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ jsx21(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
19907
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19908
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
19909
- /* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
19910
- sizeValue,
19911
- "px"
19912
- ] }),
19913
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
19914
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
19915
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
19916
- ]
19917
- }
19918
- ),
19919
- error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19548
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19549
+ VARIANTS.map((v) => /* @__PURE__ */ jsx20(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19550
+ ALIGNS.map((a) => /* @__PURE__ */ jsx20(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19551
+ ] }),
19552
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19553
+ HOVERS.map((h) => /* @__PURE__ */ jsx20(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19554
+ TREATMENTS.map((t) => /* @__PURE__ */ jsx20(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19555
+ ] }),
19556
+ /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19557
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19558
+ /* @__PURE__ */ jsxs11("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19559
+ sizeValue,
19560
+ "px"
19561
+ ] }),
19562
+ /* @__PURE__ */ jsx20(Pill, { label: "+", onClick: () => onResize(8) })
19563
+ ] }),
19564
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19565
+ /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19566
+ currentHref2 && /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19567
+ /* @__PURE__ */ jsx20(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19568
+ /* @__PURE__ */ jsx20(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19569
+ ] }),
19570
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19571
+ /* @__PURE__ */ jsx20(Pill, { label: "Change Image", onClick: onChangeImage }),
19572
+ /* @__PURE__ */ jsx20(Pill, { label: "+ Item", onClick: onAddItem }),
19573
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19574
+ ] }),
19575
+ /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19576
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19577
+ /* @__PURE__ */ jsx20(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19578
+ ] }),
19579
+ error && /* @__PURE__ */ jsx20("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
19920
19580
  ]
19921
19581
  }
19922
- ) });
19582
+ );
19923
19583
  }
19924
19584
  function findMediaStripSlots(tree) {
19925
19585
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19938,23 +19598,31 @@ function AiMediaStripOverlay({
19938
19598
  }) {
19939
19599
  const [hover, setHover] = useState8(null);
19940
19600
  const [active, setActive] = useState8(null);
19941
- const [itemEditOn, setItemEditOn] = useState8(false);
19942
- const [linkOpen, setLinkOpen] = useState8(false);
19943
19601
  const [pending, setPending] = useState8(false);
19944
19602
  const [error, setError] = useState8(null);
19945
19603
  const activeRef = useRef5(null);
19946
19604
  activeRef.current = active;
19947
- const linkOpenRef = useRef5(false);
19948
- linkOpenRef.current = linkOpen;
19949
19605
  useEffect9(() => {
19950
19606
  const onMove = (e) => {
19951
- const ref = itemRefFromTarget(e.target);
19952
19607
  const t = e.target;
19953
- const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
19954
- setHover((prev) => {
19955
- const next = ref && !overEditable ? ref : null;
19956
- return sameRef(prev, next) ? prev : next;
19957
- });
19608
+ if (!(t instanceof HTMLElement)) return;
19609
+ 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]")) {
19610
+ return;
19611
+ }
19612
+ const itemEl = t.closest("[data-ohw-media-strip-item]");
19613
+ if (!itemEl) {
19614
+ setHover(null);
19615
+ return;
19616
+ }
19617
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19618
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19619
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19620
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19621
+ if (!sectionId || Number.isNaN(index)) {
19622
+ setHover(null);
19623
+ return;
19624
+ }
19625
+ setHover({ sectionId, index });
19958
19626
  };
19959
19627
  const onLeave = () => setHover(null);
19960
19628
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19966,25 +19634,23 @@ function AiMediaStripOverlay({
19966
19634
  }, []);
19967
19635
  useEffect9(() => {
19968
19636
  const onClick = (e) => {
19637
+ const current = activeRef.current;
19638
+ if (!current) return;
19969
19639
  const t = e.target;
19970
- if (!(t instanceof Element)) return;
19971
- if (t.closest(CHROME_SELECTOR)) return;
19972
- const ref = itemRefFromTarget(t);
19973
- if (sameRef(activeRef.current, ref)) return;
19974
- if (ref) clearInteractionChromeRef.current();
19975
- setItemEditOn(false);
19640
+ if (!(t instanceof HTMLElement)) return;
19641
+ if (t.closest("[data-ohw-item-interaction]")) return;
19642
+ const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19643
+ if (itemEl && itemEl.contains(t)) return;
19644
+ setActive(null);
19976
19645
  setError(null);
19977
- setActive(ref);
19978
19646
  };
19979
19647
  document.addEventListener("click", onClick, true);
19980
19648
  return () => document.removeEventListener("click", onClick, true);
19981
- }, [clearInteractionChromeRef]);
19649
+ }, []);
19982
19650
  useEffect9(() => {
19983
19651
  const onBlur = () => {
19984
19652
  if (!activeRef.current) return;
19985
19653
  setActive(null);
19986
- setItemEditOn(false);
19987
- setLinkOpen(false);
19988
19654
  setError(null);
19989
19655
  };
19990
19656
  window.addEventListener("blur", onBlur);
@@ -19994,10 +19660,7 @@ function AiMediaStripOverlay({
19994
19660
  const onKeyDown = (e) => {
19995
19661
  if (e.key !== "Escape") return;
19996
19662
  if (!activeRef.current) return;
19997
- if (linkOpenRef.current) return;
19998
- if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19999
19663
  setActive(null);
20000
- setItemEditOn(false);
20001
19664
  setError(null);
20002
19665
  };
20003
19666
  document.addEventListener("keydown", onKeyDown);
@@ -20031,133 +19694,137 @@ function AiMediaStripOverlay({
20031
19694
  tree: nextTree,
20032
19695
  label: entry.label,
20033
19696
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
20034
- ...entry.brand ? { brand: entry.brand } : {},
20035
- // The user is already looking at the strip they just edited — recentering the viewport
20036
- // on every edit reads as the section jumping around.
20037
- skipScrollIntoView: true
19697
+ ...entry.brand ? { brand: entry.brand } : {}
20038
19698
  });
20039
19699
  return true;
20040
19700
  },
20041
19701
  [findEntry, postToParent2, applyTreeLocalRef]
20042
19702
  );
20043
19703
  const activeEntry = active ? findEntry(active.sectionId) : null;
19704
+ const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
20044
19705
  const activeItemRect = useLiveItemRect(active);
20045
- const activeStripRect = useLiveItemRect(active, true);
20046
- const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
20047
- const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
20048
- const activeItem = active ? activeItems[active.index] : void 0;
20049
- const activeHref = activeItem?.href ?? "";
20050
- const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
20051
- return /* @__PURE__ */ jsxs12(Fragment7, { children: [
20052
- hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20053
- activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
20054
- /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
20055
- /* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
20056
- MediaStripToolbar,
20057
- {
20058
- entry: activeEntry,
20059
- index: active.index,
20060
- pending,
20061
- error,
20062
- itemEditOn,
20063
- onToggleItemEdit: () => setItemEditOn((on) => !on),
20064
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
20065
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
20066
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
20067
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
20068
- onResize: (delta) => {
20069
- const slots = findMediaStripSlots(activeEntry.tree);
20070
- const variant = slots?.variant === "reel" ? "reel" : "logos";
20071
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
20072
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
20073
- },
20074
- onOpenLink: () => setLinkOpen(true),
20075
- onAddItem: () => {
20076
- void requestAssetPick(postToParent2).then((picked) => {
20077
- if (!picked) return;
20078
- const item = { assetId: picked.assetId, alt: "Logo" };
19706
+ const TOOLBAR_APPROX_H = 170;
19707
+ const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19708
+ return /* @__PURE__ */ jsxs11(Fragment7, { children: [
19709
+ hoverHandleRect && hover && /* @__PURE__ */ jsx20(
19710
+ "button",
19711
+ {
19712
+ type: "button",
19713
+ "data-ohw-toolbar": "",
19714
+ onClick: () => {
19715
+ clearInteractionChromeRef.current();
19716
+ setActive(hover);
19717
+ },
19718
+ "aria-label": "Configure media item",
19719
+ style: {
19720
+ position: "fixed",
19721
+ top: hoverHandleRect.top + 8,
19722
+ left: hoverHandleRect.left + hoverHandleRect.width - 36,
19723
+ width: 28,
19724
+ height: 28,
19725
+ borderRadius: 8,
19726
+ border: `1.5px dashed ${PRIMARY3}`,
19727
+ background: "#ffffff",
19728
+ color: PRIMARY3,
19729
+ display: "flex",
19730
+ alignItems: "center",
19731
+ justifyContent: "center",
19732
+ cursor: "pointer",
19733
+ zIndex: 2147483643,
19734
+ fontSize: 14,
19735
+ fontWeight: 700
19736
+ },
19737
+ children: /* @__PURE__ */ jsx20(Star, { size: 14, style: { pointerEvents: "none" } })
19738
+ }
19739
+ ),
19740
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
19741
+ ItemInteractionLayer,
19742
+ {
19743
+ rect: activeItemRect,
19744
+ state: toolbarState,
19745
+ toolbar: /* @__PURE__ */ jsx20(
19746
+ MediaStripToolbar,
19747
+ {
19748
+ entry: activeEntry,
19749
+ index: active.index,
19750
+ pending,
19751
+ error,
19752
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19753
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19754
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19755
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19756
+ onResize: (delta) => {
19757
+ const slots = findMediaStripSlots(activeEntry.tree);
19758
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
19759
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19760
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19761
+ },
19762
+ onSetAlt: (alt) => {
19763
+ void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19764
+ },
19765
+ onSetLink: (href, linkTarget) => {
20079
19766
  void runMutation(
20080
19767
  active.sectionId,
20081
- (tree) => addMediaStripItem(tree, item, active.index),
20082
- { [picked.assetId]: picked.url }
20083
- ).then((applied) => {
20084
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19768
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19769
+ );
19770
+ },
19771
+ onAddItem: () => {
19772
+ void requestAssetPick(postToParent2).then((picked) => {
19773
+ if (!picked) return;
19774
+ const item = { assetId: picked.assetId, alt: "Logo" };
19775
+ void runMutation(
19776
+ active.sectionId,
19777
+ (tree) => addMediaStripItem(tree, item, active.index),
19778
+ { [picked.assetId]: picked.url }
19779
+ ).then((applied) => {
19780
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19781
+ });
20085
19782
  });
20086
- });
20087
- },
20088
- onChangeImage: () => {
20089
- void requestAssetPick(postToParent2).then((picked) => {
20090
- if (!picked) return;
20091
- void runMutation(
20092
- active.sectionId,
20093
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
20094
- { [picked.assetId]: picked.url }
19783
+ },
19784
+ onChangeImage: () => {
19785
+ void requestAssetPick(postToParent2).then((picked) => {
19786
+ if (!picked) return;
19787
+ void runMutation(
19788
+ active.sectionId,
19789
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19790
+ { [picked.assetId]: picked.url }
19791
+ );
19792
+ });
19793
+ },
19794
+ onRemoveItem: () => {
19795
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19796
+ (applied) => {
19797
+ if (applied) setActive(null);
19798
+ }
20095
19799
  );
20096
- });
20097
- },
20098
- onRemoveItem: () => {
20099
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
20100
- (applied) => {
20101
- if (applied) setActive(null);
20102
- }
20103
- );
20104
- },
20105
- onMoveLeft: () => {
20106
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
20107
- (applied) => {
20108
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
20109
- }
20110
- );
20111
- },
20112
- onMoveRight: () => {
20113
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20114
- (applied) => {
20115
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20116
- }
20117
- );
20118
- }
20119
- }
20120
- ) }),
20121
- /* @__PURE__ */ jsx21(
20122
- "div",
20123
- {
20124
- "data-ohw-bridge": "",
20125
- "data-ohw-item-interaction": "",
20126
- "aria-hidden": true,
20127
- className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20128
- style: {
20129
- top: activeItemRect.top + activeItemRect.height + 10,
20130
- left: activeItemRect.left - 5,
20131
- background: PRIMARY3,
20132
- zIndex: 2147483644
20133
- },
20134
- children: "Media item"
20135
- }
20136
- ),
20137
- linkOpen && /* @__PURE__ */ jsx21(
20138
- LinkModal,
20139
- {
20140
- href: activeHref,
20141
- linkTarget: activeTarget,
20142
- onClose: () => setLinkOpen(false),
20143
- onSave: (href, linkTarget) => {
20144
- void runMutation(
20145
- active.sectionId,
20146
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20147
- );
19800
+ },
19801
+ onMoveLeft: () => {
19802
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19803
+ (applied) => {
19804
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19805
+ }
19806
+ );
19807
+ },
19808
+ onMoveRight: () => {
19809
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19810
+ (applied) => {
19811
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19812
+ }
19813
+ );
19814
+ }
20148
19815
  }
20149
- }
20150
- )
20151
- ] })
19816
+ )
19817
+ }
19818
+ )
20152
19819
  ] });
20153
19820
  }
20154
19821
 
20155
19822
  // src/ui/ai-section/AiPricingCardOverlay.tsx
20156
- import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
20157
- import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
20158
- import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
19823
+ import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
19824
+ import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
19825
+ import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
20159
19826
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
20160
- 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]";
19827
+ 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]";
20161
19828
  function findPricingCardElement(sectionId, index) {
20162
19829
  const sectionEl2 = findByInstanceId(sectionId);
20163
19830
  if (!sectionEl2) return null;
@@ -20169,7 +19836,7 @@ function findPricingCardElement(sectionId, index) {
20169
19836
  }
20170
19837
  function cardRefFromTarget(target) {
20171
19838
  if (!(target instanceof Element)) return null;
20172
- if (target.closest(CHROME_SELECTOR2)) return null;
19839
+ if (target.closest(CHROME_SELECTOR)) return null;
20173
19840
  const cardEl = target.closest("[data-ohw-pricing-card]");
20174
19841
  if (!cardEl) return null;
20175
19842
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -20179,21 +19846,21 @@ function cardRefFromTarget(target) {
20179
19846
  if (!sectionId || Number.isNaN(index)) return null;
20180
19847
  return { sectionId, index };
20181
19848
  }
20182
- function sameRef2(a, b) {
19849
+ function sameRef(a, b) {
20183
19850
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
20184
19851
  }
20185
- function rectOf2(el) {
19852
+ function rectOf(el) {
20186
19853
  if (!el) return null;
20187
19854
  const r2 = el.getBoundingClientRect();
20188
19855
  if (r2.width <= 0 || r2.height <= 0) return null;
20189
19856
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
20190
19857
  }
20191
19858
  function readRect3(ref) {
20192
- return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19859
+ return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20193
19860
  }
20194
19861
  function readGridRect(ref) {
20195
19862
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
20196
- return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19863
+ return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20197
19864
  }
20198
19865
  function useLiveCardRect(ref, grid = false) {
20199
19866
  const [rect, setRect] = useState9(null);
@@ -20223,19 +19890,19 @@ function useLiveCardRect(ref, grid = false) {
20223
19890
  }
20224
19891
  var TOOLBAR_GRID_GAP = 52;
20225
19892
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20226
- var TOOLBAR_EDGE_MARGIN3 = 4;
19893
+ var TOOLBAR_EDGE_MARGIN2 = 4;
20227
19894
  function GridToolbarSlot({ gridRect, children }) {
20228
19895
  const slotRef = useRef6(null);
20229
19896
  const [shift, setShift] = useState9(0);
20230
19897
  const centerX = gridRect.left + gridRect.width / 2;
20231
- useLayoutEffect5(() => {
19898
+ useLayoutEffect4(() => {
20232
19899
  const slot = slotRef.current;
20233
19900
  if (!slot) return;
20234
19901
  const clamp = () => {
20235
19902
  const w = slot.offsetWidth;
20236
19903
  if (w <= 0) return;
20237
19904
  const half = w / 2;
20238
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19905
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20239
19906
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
20240
19907
  };
20241
19908
  clamp();
@@ -20244,7 +19911,7 @@ function GridToolbarSlot({ gridRect, children }) {
20244
19911
  return () => ro.disconnect();
20245
19912
  }, [centerX, children]);
20246
19913
  const mobile = window.innerWidth <= 480;
20247
- return /* @__PURE__ */ jsx22(
19914
+ return /* @__PURE__ */ jsx21(
20248
19915
  "div",
20249
19916
  {
20250
19917
  ref: slotRef,
@@ -20279,7 +19946,7 @@ function requestValidateTree2(postToParent2, tree) {
20279
19946
  });
20280
19947
  }
20281
19948
  function StyleSwatch({ style }) {
20282
- return /* @__PURE__ */ jsx22(
19949
+ return /* @__PURE__ */ jsx21(
20283
19950
  "span",
20284
19951
  {
20285
19952
  "aria-hidden": true,
@@ -20293,35 +19960,35 @@ function StyleSwatch({ style }) {
20293
19960
  );
20294
19961
  }
20295
19962
  function ButtonGlyph() {
20296
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20297
- /* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20298
- /* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19963
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19964
+ /* @__PURE__ */ jsx21("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19965
+ /* @__PURE__ */ jsx21("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20299
19966
  ] });
20300
19967
  }
20301
19968
  function FeatureGlyph({ mode }) {
20302
- return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20303
- /* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20304
- /* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20305
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20306
- /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20307
- /* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20308
- mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19969
+ return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19970
+ /* @__PURE__ */ jsx21("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19971
+ /* @__PURE__ */ jsx21("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19972
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19973
+ /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19974
+ /* @__PURE__ */ jsx21("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19975
+ mode === "add" && /* @__PURE__ */ jsx21("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20309
19976
  ] });
20310
19977
  }
20311
- function ToolbarAction2({
19978
+ function ToolbarAction({
20312
19979
  label,
20313
19980
  onClick,
20314
19981
  disabled = false,
20315
19982
  children
20316
19983
  }) {
20317
- const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20318
- return /* @__PURE__ */ jsxs13(Tooltip, { children: [
20319
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
20320
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19984
+ const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19985
+ return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19986
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19987
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20321
19988
  ] });
20322
19989
  }
20323
- function ToolbarSeparator2() {
20324
- return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19990
+ function ToolbarSeparator() {
19991
+ return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20325
19992
  }
20326
19993
  function CardStyleMenu({
20327
19994
  value,
@@ -20329,7 +19996,7 @@ function CardStyleMenu({
20329
19996
  disabled = false
20330
19997
  }) {
20331
19998
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20332
- const trigger = /* @__PURE__ */ jsxs13(
19999
+ const trigger = /* @__PURE__ */ jsxs12(
20333
20000
  "button",
20334
20001
  {
20335
20002
  type: "button",
@@ -20340,28 +20007,28 @@ function CardStyleMenu({
20340
20007
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20341
20008
  ),
20342
20009
  children: [
20343
- /* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
20344
- /* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
20345
- /* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
20010
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: current.value }),
20011
+ /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
20012
+ /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20346
20013
  ]
20347
20014
  }
20348
20015
  );
20349
20016
  if (disabled) {
20350
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20351
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20352
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20353
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
20354
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20017
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20018
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20019
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
20020
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: trigger }) }),
20021
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20355
20022
  ] })
20356
20023
  ] });
20357
20024
  }
20358
- return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20359
- /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20360
- /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
20361
- /* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
20362
- /* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20025
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20026
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20027
+ /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
20028
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: trigger }),
20029
+ /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20363
20030
  const selected = style.value === value;
20364
- return /* @__PURE__ */ jsxs13(
20031
+ return /* @__PURE__ */ jsxs12(
20365
20032
  DropdownMenuItem,
20366
20033
  {
20367
20034
  role: "menuitemradio",
@@ -20369,9 +20036,9 @@ function CardStyleMenu({
20369
20036
  onSelect: () => onChange(style.value),
20370
20037
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20371
20038
  children: [
20372
- /* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
20373
- /* @__PURE__ */ jsx22("span", { children: style.label }),
20374
- selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
20039
+ /* @__PURE__ */ jsx21(StyleSwatch, { style: style.value }),
20040
+ /* @__PURE__ */ jsx21("span", { children: style.label }),
20041
+ selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20375
20042
  ]
20376
20043
  },
20377
20044
  style.value
@@ -20401,7 +20068,7 @@ function PricingCardToolbar({
20401
20068
  const style = pricingCardStyle(entry.tree, index);
20402
20069
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20403
20070
  const mobile = window.innerWidth <= 480;
20404
- return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
20071
+ return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
20405
20072
  "div",
20406
20073
  {
20407
20074
  "data-ohw-bridge": "",
@@ -20413,7 +20080,7 @@ function PricingCardToolbar({
20413
20080
  ),
20414
20081
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20415
20082
  children: [
20416
- /* @__PURE__ */ jsxs13(
20083
+ /* @__PURE__ */ jsxs12(
20417
20084
  "div",
20418
20085
  {
20419
20086
  className: cn(
@@ -20422,8 +20089,8 @@ function PricingCardToolbar({
20422
20089
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20423
20090
  ),
20424
20091
  children: [
20425
- /* @__PURE__ */ jsxs13(Tooltip, { children: [
20426
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
20092
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
20093
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20427
20094
  CustomToolbarButton,
20428
20095
  {
20429
20096
  type: "button",
@@ -20431,7 +20098,7 @@ function PricingCardToolbar({
20431
20098
  "aria-pressed": featuredTag,
20432
20099
  onClick: () => onSetFeaturedTag(!featuredTag),
20433
20100
  className: "group size-8",
20434
- children: /* @__PURE__ */ jsx22(
20101
+ children: /* @__PURE__ */ jsx21(
20435
20102
  Star2,
20436
20103
  {
20437
20104
  size: 16,
@@ -20446,25 +20113,25 @@ function PricingCardToolbar({
20446
20113
  )
20447
20114
  }
20448
20115
  ) }),
20449
- /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20116
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20450
20117
  ] }),
20451
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20452
- /* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20453
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20454
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
20455
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
20456
- /* @__PURE__ */ jsx22(ButtonGlyph, {}),
20457
- /* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20118
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20119
+ /* @__PURE__ */ jsx21(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20120
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20121
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx21(ButtonGlyph, {}) }),
20122
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
20123
+ /* @__PURE__ */ jsx21(ButtonGlyph, {}),
20124
+ /* @__PURE__ */ jsx21(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20458
20125
  ] }) }),
20459
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
20460
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
20461
- /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20462
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
20463
- /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
20126
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "add" }) }),
20127
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "remove" }) }),
20128
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20129
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
20130
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) })
20464
20131
  ]
20465
20132
  }
20466
20133
  ),
20467
- error && /* @__PURE__ */ jsx22("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20134
+ error && /* @__PURE__ */ jsx21("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20468
20135
  ]
20469
20136
  }
20470
20137
  ) });
@@ -20498,7 +20165,7 @@ function AiPricingCardOverlay({
20498
20165
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20499
20166
  setHover((prev) => {
20500
20167
  const next = ref && !overEditable ? ref : null;
20501
- return sameRef2(prev, next) ? prev : next;
20168
+ return sameRef(prev, next) ? prev : next;
20502
20169
  });
20503
20170
  };
20504
20171
  const onLeave = () => setHover(null);
@@ -20513,10 +20180,10 @@ function AiPricingCardOverlay({
20513
20180
  const onClick = (e) => {
20514
20181
  const t = e.target;
20515
20182
  if (!(t instanceof Element)) return;
20516
- if (t.closest(CHROME_SELECTOR2)) return;
20183
+ if (t.closest(CHROME_SELECTOR)) return;
20517
20184
  const ref = cardRefFromTarget(t);
20518
- setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20519
- if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20185
+ setActive((prev) => sameRef(prev, ref) ? prev : ref);
20186
+ if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20520
20187
  };
20521
20188
  document.addEventListener("click", onClick, true);
20522
20189
  return () => document.removeEventListener("click", onClick, true);
@@ -20581,12 +20248,12 @@ function AiPricingCardOverlay({
20581
20248
  const activeEntry = active ? findEntry(active.sectionId) : null;
20582
20249
  const activeCardRect = useLiveCardRect(active);
20583
20250
  const activeGridRect = useLiveCardRect(active, true);
20584
- const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20585
- return /* @__PURE__ */ jsxs13(Fragment8, { children: [
20586
- hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20587
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
20588
- /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20589
- /* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
20251
+ const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20252
+ return /* @__PURE__ */ jsxs12(Fragment8, { children: [
20253
+ hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20254
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
20255
+ /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20256
+ /* @__PURE__ */ jsx21(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx21(
20590
20257
  PricingCardToolbar,
20591
20258
  {
20592
20259
  entry: activeEntry,
@@ -20614,7 +20281,7 @@ function AiPricingCardOverlay({
20614
20281
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20615
20282
  }
20616
20283
  ) }),
20617
- /* @__PURE__ */ jsx22(
20284
+ /* @__PURE__ */ jsx21(
20618
20285
  "div",
20619
20286
  {
20620
20287
  "data-ohw-bridge": "",
@@ -20678,11 +20345,39 @@ function clearVideo(tree, path) {
20678
20345
  });
20679
20346
  }
20680
20347
 
20348
+ // src/lib/youtube.ts
20349
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20350
+ function extractYouTubeId(input) {
20351
+ const trimmed = input.trim();
20352
+ if (!trimmed) return null;
20353
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20354
+ let url;
20355
+ try {
20356
+ url = new URL(trimmed);
20357
+ } catch {
20358
+ return null;
20359
+ }
20360
+ const host = url.hostname.replace(/^www\./, "");
20361
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20362
+ return null;
20363
+ }
20364
+ let candidate = null;
20365
+ if (host === "youtu.be") {
20366
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
20367
+ } else if (url.pathname === "/watch") {
20368
+ candidate = url.searchParams.get("v");
20369
+ } else {
20370
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20371
+ candidate = match ? match[1] : null;
20372
+ }
20373
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20374
+ }
20375
+
20681
20376
  // src/ui/ai-section/AiVideoOverlay.tsx
20682
- import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20377
+ import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
20683
20378
  var PRIMARY5 = "#0885FE";
20684
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
20685
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20379
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20380
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20686
20381
  function findVideoBlockElement(sectionId, path) {
20687
20382
  const sectionEl2 = findByInstanceId(sectionId);
20688
20383
  if (!sectionEl2) return null;
@@ -20742,12 +20437,12 @@ function requestValidateTree3(postToParent2, tree) {
20742
20437
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20743
20438
  });
20744
20439
  }
20745
- function Pill({
20440
+ function Pill2({
20746
20441
  label,
20747
20442
  onClick,
20748
20443
  disabled
20749
20444
  }) {
20750
- return /* @__PURE__ */ jsx23(
20445
+ return /* @__PURE__ */ jsx22(
20751
20446
  "button",
20752
20447
  {
20753
20448
  type: "button",
@@ -20763,7 +20458,7 @@ function Pill({
20763
20458
  border: "none",
20764
20459
  cursor: disabled ? "default" : "pointer",
20765
20460
  background: "#ffffff",
20766
- color: OHW_BLUE_DARK,
20461
+ color: OHW_BLUE_DARK2,
20767
20462
  opacity: disabled ? 0.4 : 1,
20768
20463
  fontSize: 12,
20769
20464
  lineHeight: "16px",
@@ -20806,8 +20501,8 @@ function VideoUrlInput({ value, onCommit }) {
20806
20501
  onCommit(id);
20807
20502
  }
20808
20503
  };
20809
- return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20810
- /* @__PURE__ */ jsxs14(
20504
+ return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20505
+ /* @__PURE__ */ jsxs13(
20811
20506
  "div",
20812
20507
  {
20813
20508
  style: {
@@ -20823,12 +20518,12 @@ function VideoUrlInput({ value, onCommit }) {
20823
20518
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20824
20519
  },
20825
20520
  children: [
20826
- /* @__PURE__ */ jsx23(
20521
+ /* @__PURE__ */ jsx22(
20827
20522
  "span",
20828
20523
  {
20829
20524
  style: {
20830
20525
  flex: "0 0 auto",
20831
- color: OHW_BLUE_DARK,
20526
+ color: OHW_BLUE_DARK2,
20832
20527
  fontSize: 10,
20833
20528
  lineHeight: "16px",
20834
20529
  fontWeight: 700,
@@ -20838,7 +20533,7 @@ function VideoUrlInput({ value, onCommit }) {
20838
20533
  children: "Video"
20839
20534
  }
20840
20535
  ),
20841
- /* @__PURE__ */ jsx23(
20536
+ /* @__PURE__ */ jsx22(
20842
20537
  "input",
20843
20538
  {
20844
20539
  type: "text",
@@ -20875,7 +20570,7 @@ function VideoUrlInput({ value, onCommit }) {
20875
20570
  ]
20876
20571
  }
20877
20572
  ),
20878
- invalid && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20573
+ invalid && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20879
20574
  ] });
20880
20575
  }
20881
20576
  function VideoToolbar({
@@ -20885,7 +20580,7 @@ function VideoToolbar({
20885
20580
  onSetVideoId,
20886
20581
  onRemove
20887
20582
  }) {
20888
- return /* @__PURE__ */ jsxs14(
20583
+ return /* @__PURE__ */ jsxs13(
20889
20584
  "div",
20890
20585
  {
20891
20586
  "data-ohw-bridge": "",
@@ -20897,7 +20592,7 @@ function VideoToolbar({
20897
20592
  gap: 6,
20898
20593
  alignItems: "center",
20899
20594
  width: 280,
20900
- background: OHW_BLUE,
20595
+ background: OHW_BLUE2,
20901
20596
  padding: 8,
20902
20597
  borderRadius: 12,
20903
20598
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20905,9 +20600,9 @@ function VideoToolbar({
20905
20600
  opacity: pending ? 0.6 : 1
20906
20601
  },
20907
20602
  children: [
20908
- /* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20909
- /* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20910
- error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20603
+ /* @__PURE__ */ jsx22(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20604
+ /* @__PURE__ */ jsx22(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20605
+ error && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20911
20606
  ]
20912
20607
  }
20913
20608
  );
@@ -21027,8 +20722,8 @@ function AiVideoOverlay({
21027
20722
  const activeBlockRect = useLiveBlockRect(active);
21028
20723
  const TOOLBAR_APPROX_H = 90;
21029
20724
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21030
- return /* @__PURE__ */ jsxs14(Fragment9, { children: [
21031
- hoverHandleRect && hover && /* @__PURE__ */ jsx23(
20725
+ return /* @__PURE__ */ jsxs13(Fragment9, { children: [
20726
+ hoverHandleRect && hover && /* @__PURE__ */ jsx22(
21032
20727
  "button",
21033
20728
  {
21034
20729
  type: "button",
@@ -21056,15 +20751,15 @@ function AiVideoOverlay({
21056
20751
  fontSize: 14,
21057
20752
  fontWeight: 700
21058
20753
  },
21059
- children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
20754
+ children: /* @__PURE__ */ jsx22(Star3, { size: 14, style: { pointerEvents: "none" } })
21060
20755
  }
21061
20756
  ),
21062
- activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
20757
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx22(
21063
20758
  ItemInteractionLayer,
21064
20759
  {
21065
20760
  rect: activeBlockRect,
21066
20761
  state: toolbarState,
21067
- toolbar: /* @__PURE__ */ jsx23(
20762
+ toolbar: /* @__PURE__ */ jsx22(
21068
20763
  VideoToolbar,
21069
20764
  {
21070
20765
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -21139,10 +20834,10 @@ function setCarouselAutoplay(tree, on) {
21139
20834
  }
21140
20835
 
21141
20836
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
21142
- import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
20837
+ import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
21143
20838
  var PRIMARY6 = "#0885FE";
21144
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21145
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20839
+ var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20840
+ var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21146
20841
  function findCarouselItemElement(sectionId, index) {
21147
20842
  const sectionEl2 = findByInstanceId(sectionId);
21148
20843
  if (!sectionEl2) return null;
@@ -21221,8 +20916,8 @@ function requestAssetPick2(postToParent2) {
21221
20916
  postToParent2({ type: "ow:asset-pick", id });
21222
20917
  });
21223
20918
  }
21224
- function Pill2({ label, onClick, disabled }) {
21225
- return /* @__PURE__ */ jsx24(
20919
+ function Pill3({ label, onClick, disabled }) {
20920
+ return /* @__PURE__ */ jsx23(
21226
20921
  "button",
21227
20922
  {
21228
20923
  type: "button",
@@ -21238,7 +20933,7 @@ function Pill2({ label, onClick, disabled }) {
21238
20933
  border: "none",
21239
20934
  cursor: disabled ? "default" : "pointer",
21240
20935
  background: "#ffffff",
21241
- color: OHW_BLUE_DARK2,
20936
+ color: OHW_BLUE_DARK3,
21242
20937
  opacity: disabled ? 0.4 : 1,
21243
20938
  fontSize: 12,
21244
20939
  lineHeight: "16px",
@@ -21256,7 +20951,7 @@ function TogglePill({
21256
20951
  onToggle,
21257
20952
  disabled
21258
20953
  }) {
21259
- return /* @__PURE__ */ jsxs15(
20954
+ return /* @__PURE__ */ jsxs14(
21260
20955
  "button",
21261
20956
  {
21262
20957
  type: "button",
@@ -21275,7 +20970,7 @@ function TogglePill({
21275
20970
  border: "none",
21276
20971
  cursor: disabled ? "default" : "pointer",
21277
20972
  background: "#ffffff",
21278
- color: OHW_BLUE_DARK2,
20973
+ color: OHW_BLUE_DARK3,
21279
20974
  opacity: disabled ? 0.4 : 1,
21280
20975
  fontSize: 12,
21281
20976
  lineHeight: "16px",
@@ -21285,7 +20980,7 @@ function TogglePill({
21285
20980
  },
21286
20981
  children: [
21287
20982
  label,
21288
- /* @__PURE__ */ jsx24(
20983
+ /* @__PURE__ */ jsx23(
21289
20984
  "span",
21290
20985
  {
21291
20986
  "aria-hidden": true,
@@ -21298,10 +20993,10 @@ function TogglePill({
21298
20993
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21299
20994
  // carries the brand colour in the text, and a pale blue track next to it read as
21300
20995
  // "disabled control" rather than "switch that is off".
21301
- background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20996
+ background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21302
20997
  transition: "background 120ms ease"
21303
20998
  },
21304
- children: /* @__PURE__ */ jsx24(
20999
+ children: /* @__PURE__ */ jsx23(
21305
21000
  "span",
21306
21001
  {
21307
21002
  style: {
@@ -21330,7 +21025,7 @@ function CarouselSlideToolbar({
21330
21025
  onChangeImage,
21331
21026
  onToggleAutoplay
21332
21027
  }) {
21333
- return /* @__PURE__ */ jsxs15(
21028
+ return /* @__PURE__ */ jsxs14(
21334
21029
  "div",
21335
21030
  {
21336
21031
  "data-ohw-bridge": "",
@@ -21341,7 +21036,7 @@ function CarouselSlideToolbar({
21341
21036
  flexDirection: "column",
21342
21037
  gap: 6,
21343
21038
  alignItems: "center",
21344
- background: OHW_BLUE2,
21039
+ background: OHW_BLUE3,
21345
21040
  padding: 8,
21346
21041
  borderRadius: 12,
21347
21042
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21353,11 +21048,11 @@ function CarouselSlideToolbar({
21353
21048
  pointerEvents: pending ? "none" : "auto"
21354
21049
  },
21355
21050
  children: [
21356
- /* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21357
- /* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
21358
- /* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21051
+ /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21052
+ /* @__PURE__ */ jsx23(Pill3, { label: "Change Image", onClick: onChangeImage }),
21053
+ /* @__PURE__ */ jsx23(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21359
21054
  ] }),
21360
- error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21055
+ error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21361
21056
  ]
21362
21057
  }
21363
21058
  );
@@ -21497,8 +21192,8 @@ function AiFadeCarouselOverlay({
21497
21192
  const activeItemRect = useLiveItemRect2(active);
21498
21193
  const TOOLBAR_APPROX_H = 90;
21499
21194
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21500
- return /* @__PURE__ */ jsxs15(Fragment10, { children: [
21501
- hoverHandleRect && hover && /* @__PURE__ */ jsx24(
21195
+ return /* @__PURE__ */ jsxs14(Fragment10, { children: [
21196
+ hoverHandleRect && hover && /* @__PURE__ */ jsx23(
21502
21197
  "button",
21503
21198
  {
21504
21199
  type: "button",
@@ -21527,10 +21222,10 @@ function AiFadeCarouselOverlay({
21527
21222
  fontSize: 14,
21528
21223
  fontWeight: 700
21529
21224
  },
21530
- children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
21225
+ children: /* @__PURE__ */ jsx23(Star4, { size: 14, style: { pointerEvents: "none" } })
21531
21226
  }
21532
21227
  ),
21533
- swapping && /* @__PURE__ */ jsx24(
21228
+ swapping && /* @__PURE__ */ jsx23(
21534
21229
  "div",
21535
21230
  {
21536
21231
  ref: skeletonRef,
@@ -21548,15 +21243,15 @@ function AiFadeCarouselOverlay({
21548
21243
  zIndex: 2147483646,
21549
21244
  pointerEvents: "none"
21550
21245
  },
21551
- children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
21246
+ children: /* @__PURE__ */ jsx23("style", { children: MEDIA_SKELETON_CSS })
21552
21247
  }
21553
21248
  ),
21554
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
21249
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx23(
21555
21250
  ItemInteractionLayer,
21556
21251
  {
21557
21252
  rect: activeItemRect,
21558
21253
  state: toolbarState,
21559
- toolbar: /* @__PURE__ */ jsx24(
21254
+ toolbar: /* @__PURE__ */ jsx23(
21560
21255
  CarouselSlideToolbar,
21561
21256
  {
21562
21257
  pending,
@@ -21747,11 +21442,118 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21747
21442
  // src/ui/link-modal/LinkPopover.tsx
21748
21443
  import { useEffect as useEffect16 } from "react";
21749
21444
 
21445
+ // src/ui/dialog.tsx
21446
+ import * as React9 from "react";
21447
+ import { Dialog as DialogPrimitive } from "radix-ui";
21448
+ import { X as X2 } from "lucide-react";
21449
+ import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
21450
+ function Dialog2({
21451
+ ...props
21452
+ }) {
21453
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
21454
+ }
21455
+ function DialogPortal({
21456
+ ...props
21457
+ }) {
21458
+ return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
21459
+ }
21460
+ function DialogOverlay({
21461
+ className,
21462
+ ...props
21463
+ }) {
21464
+ return /* @__PURE__ */ jsx24(
21465
+ DialogPrimitive.Overlay,
21466
+ {
21467
+ "data-slot": "dialog-overlay",
21468
+ "data-ohw-link-modal-root": "",
21469
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21470
+ ...props
21471
+ }
21472
+ );
21473
+ }
21474
+ var DialogContent = React9.forwardRef(
21475
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21476
+ const positionMode = container ? "absolute" : "fixed";
21477
+ return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
21478
+ /* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21479
+ /* @__PURE__ */ jsxs15(
21480
+ DialogPrimitive.Content,
21481
+ {
21482
+ ref,
21483
+ "data-slot": "dialog-content",
21484
+ className: cn(
21485
+ positionMode,
21486
+ "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",
21487
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21488
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21489
+ className
21490
+ ),
21491
+ onMouseDown: (e) => e.stopPropagation(),
21492
+ ...props,
21493
+ children: [
21494
+ children,
21495
+ showCloseButton ? /* @__PURE__ */ jsx24(
21496
+ DialogPrimitive.Close,
21497
+ {
21498
+ type: "button",
21499
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21500
+ "aria-label": "Close",
21501
+ children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
21502
+ }
21503
+ ) : null
21504
+ ]
21505
+ }
21506
+ )
21507
+ ] });
21508
+ }
21509
+ );
21510
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
21511
+ function DialogHeader({
21512
+ className,
21513
+ ...props
21514
+ }) {
21515
+ return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21516
+ }
21517
+ function DialogFooter({
21518
+ className,
21519
+ ...props
21520
+ }) {
21521
+ return /* @__PURE__ */ jsx24(
21522
+ "div",
21523
+ {
21524
+ className: cn("flex items-center justify-end gap-2", className),
21525
+ ...props
21526
+ }
21527
+ );
21528
+ }
21529
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21530
+ DialogPrimitive.Title,
21531
+ {
21532
+ ref,
21533
+ className: cn(
21534
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21535
+ className
21536
+ ),
21537
+ ...props
21538
+ }
21539
+ ));
21540
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
21541
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21542
+ DialogPrimitive.Description,
21543
+ {
21544
+ ref,
21545
+ className: cn("text-sm text-muted-foreground", className),
21546
+ ...props
21547
+ }
21548
+ ));
21549
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
21550
+ var DialogClose = DialogPrimitive.Close;
21551
+
21750
21552
  // src/ui/link-modal/LinkEditorPanel.tsx
21751
21553
  import { Info, X as X4 } from "lucide-react";
21752
21554
 
21753
21555
  // src/ui/link-modal/DestinationBreadcrumb.tsx
21754
- import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
21556
+ import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
21755
21557
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
21756
21558
  function DestinationBreadcrumb({
21757
21559
  pageTitle,
@@ -21765,7 +21567,7 @@ function DestinationBreadcrumb({
21765
21567
  /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
21766
21568
  ] }),
21767
21569
  /* @__PURE__ */ jsx25(
21768
- ArrowRight3,
21570
+ ArrowRight2,
21769
21571
  {
21770
21572
  size: 16,
21771
21573
  className: "shrink-0 text-muted-foreground",
@@ -21877,7 +21679,7 @@ function Label({ className, ...props }) {
21877
21679
  }
21878
21680
 
21879
21681
  // src/ui/link-modal/UrlOrPageInput.tsx
21880
- import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
21682
+ import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
21881
21683
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
21882
21684
  function FieldChevron({
21883
21685
  onClick
@@ -21890,7 +21692,7 @@ function FieldChevron({
21890
21692
  onClick,
21891
21693
  "aria-label": "Open page list",
21892
21694
  tabIndex: -1,
21893
- children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
21695
+ children: /* @__PURE__ */ jsx29(ChevronDown4, { size: 16 })
21894
21696
  }
21895
21697
  );
21896
21698
  }
@@ -22120,7 +21922,7 @@ function LinkEditorPanel({ state, onClose }) {
22120
21922
  // src/ui/link-modal/SectionPickerOverlay.tsx
22121
21923
  import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
22122
21924
  import { createPortal as createPortal2 } from "react-dom";
22123
- import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
21925
+ import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
22124
21926
  import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
22125
21927
 
22126
21928
  // src/lib/parent-scroll.ts
@@ -22397,7 +22199,7 @@ function SectionPickerOverlay({
22397
22199
  className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
22398
22200
  onClick: onBack,
22399
22201
  children: [
22400
- /* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
22202
+ /* @__PURE__ */ jsx31(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
22401
22203
  "Back"
22402
22204
  ]
22403
22205
  }
@@ -22466,7 +22268,7 @@ function SectionPickerOverlay({
22466
22268
  className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
22467
22269
  style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
22468
22270
  "aria-hidden": true,
22469
- children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
22271
+ children: /* @__PURE__ */ jsx31(Check3, { className: "size-5" })
22470
22272
  }
22471
22273
  ) : null
22472
22274
  ]
@@ -22850,7 +22652,6 @@ function shouldUseDevFixtures() {
22850
22652
  function getLogoElement(el) {
22851
22653
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22852
22654
  if (marked) return marked;
22853
- if (el.closest('[data-ohw-editable="icon"]')) return null;
22854
22655
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22855
22656
  if (!root) return null;
22856
22657
  const anchor = el.closest("a");
@@ -22920,7 +22721,7 @@ function addFooterColumnWithPersist({
22920
22721
  import {
22921
22722
  useCallback as useCallback9,
22922
22723
  useEffect as useEffect17,
22923
- useLayoutEffect as useLayoutEffect6,
22724
+ useLayoutEffect as useLayoutEffect5,
22924
22725
  useRef as useRef11,
22925
22726
  useState as useState15
22926
22727
  } from "react";
@@ -23017,7 +22818,7 @@ function FloatingPanel({
23017
22818
  return () => window.removeEventListener("message", onParentScroll);
23018
22819
  }, [open]);
23019
22820
  const positionRef = useRef11(position);
23020
- useLayoutEffect6(() => {
22821
+ useLayoutEffect5(() => {
23021
22822
  if (!open) {
23022
22823
  positionRef.current = position;
23023
22824
  return;
@@ -23027,7 +22828,7 @@ function FloatingPanel({
23027
22828
  }
23028
22829
  positionRef.current = position;
23029
22830
  }, [open, position, liveScroll, parentScroll]);
23030
- useLayoutEffect6(() => {
22831
+ useLayoutEffect5(() => {
23031
22832
  if (!open || !panelRef.current) return;
23032
22833
  const el = panelRef.current;
23033
22834
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -23236,7 +23037,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
23236
23037
  }
23237
23038
 
23238
23039
  // src/ui/button-style-panel.tsx
23239
- import { Check as Check5 } from "lucide-react";
23040
+ import { Check as Check4 } from "lucide-react";
23240
23041
  import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
23241
23042
  var SIZE_LABEL = { s: "S", m: "M", l: "L" };
23242
23043
  function ButtonStylePanel({
@@ -23307,7 +23108,7 @@ function ButtonStylePanel({
23307
23108
  {
23308
23109
  className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
23309
23110
  "aria-hidden": true,
23310
- children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
23111
+ children: /* @__PURE__ */ jsx35(Check4, { className: "size-3", strokeWidth: 3 })
23311
23112
  }
23312
23113
  ) : null
23313
23114
  ]
@@ -24339,7 +24140,7 @@ function useSectionDrag({
24339
24140
  }
24340
24141
 
24341
24142
  // src/ui/footer-container-chrome.tsx
24342
- import { Plus as Plus4 } from "lucide-react";
24143
+ import { Plus as Plus3 } from "lucide-react";
24343
24144
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
24344
24145
  function FooterContainerChrome({
24345
24146
  rect,
@@ -24380,7 +24181,7 @@ function FooterContainerChrome({
24380
24181
  if (addDisabled) return;
24381
24182
  onAdd();
24382
24183
  },
24383
- children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24184
+ children: /* @__PURE__ */ jsx36(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24384
24185
  }
24385
24186
  ) }),
24386
24187
  /* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
@@ -24787,7 +24588,7 @@ function retargetPageLinks(change, deps) {
24787
24588
  }
24788
24589
 
24789
24590
  // src/ui/navbar-container-chrome.tsx
24790
- import { Plus as Plus5 } from "lucide-react";
24591
+ import { Plus as Plus4 } from "lucide-react";
24791
24592
  import { jsx as jsx37 } from "react/jsx-runtime";
24792
24593
  function NavbarContainerChrome({
24793
24594
  rect,
@@ -24823,7 +24624,7 @@ function NavbarContainerChrome({
24823
24624
  e.stopPropagation();
24824
24625
  onAdd();
24825
24626
  },
24826
- children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24627
+ children: /* @__PURE__ */ jsx37(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24827
24628
  }
24828
24629
  )
24829
24630
  }
@@ -24895,7 +24696,7 @@ function Badge({ className, variant, ...props }) {
24895
24696
  }
24896
24697
 
24897
24698
  // src/OhhwellsBridge.tsx
24898
- import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings } from "lucide-react";
24699
+ import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings } from "lucide-react";
24899
24700
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
24900
24701
  var PRIMARY7 = "#0885FE";
24901
24702
  var IMAGE_FADE_MS = 300;
@@ -25673,7 +25474,7 @@ function getNavigationSelectionParent(el) {
25673
25474
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25674
25475
  return resolveFooterLinksContainerFrom(el);
25675
25476
  }
25676
- 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)) {
25477
+ if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
25677
25478
  return getNavigationRoot(el);
25678
25479
  }
25679
25480
  return null;
@@ -25895,6 +25696,7 @@ var ICONS = {
25895
25696
  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"/>',
25896
25697
  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"/>'
25897
25698
  };
25699
+ var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25898
25700
  var SELECTION_CHROME_GAP2 = 4;
25899
25701
  var TOOLBAR_STROKE_GAP2 = 4;
25900
25702
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25992,7 +25794,7 @@ function applyVisibleViewport(el, parentScroll) {
25992
25794
  el.style.top = `${top}px`;
25993
25795
  el.style.height = `${height}px`;
25994
25796
  }
25995
- var TOOLBAR_EDGE_MARGIN4 = 4;
25797
+ var TOOLBAR_EDGE_MARGIN3 = 4;
25996
25798
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25997
25799
  const isAbove = transform.includes("translateY(-100%)");
25998
25800
  let visualTop = isAbove ? top - approxH : top;
@@ -26019,8 +25821,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
26019
25821
  function clampToolbarLeft(centerX, toolbarWidth) {
26020
25822
  const half = toolbarWidth / 2;
26021
25823
  return Math.max(
26022
- TOOLBAR_EDGE_MARGIN4 + half,
26023
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25824
+ TOOLBAR_EDGE_MARGIN3 + half,
25825
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
26024
25826
  );
26025
25827
  }
26026
25828
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26421,7 +26223,7 @@ function OhhwellsBridge() {
26421
26223
  }, []);
26422
26224
  const subdomainFromQuery = searchParams.get("subdomain");
26423
26225
  const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
26424
- useLayoutEffect7(() => {
26226
+ useLayoutEffect6(() => {
26425
26227
  const next = resolveSubdomain(subdomainFromQuery);
26426
26228
  if (next !== subdomain) setSubdomain(next);
26427
26229
  if (next) return;
@@ -26903,6 +26705,21 @@ function OhhwellsBridge() {
26903
26705
  const [isItemDragging, setIsItemDragging] = useState18(false);
26904
26706
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
26905
26707
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26708
+ const [floatingPanel, setFloatingPanel] = useState18(null);
26709
+ const floatingPanelOpenRef = useRef14(false);
26710
+ floatingPanelOpenRef.current = floatingPanel !== null;
26711
+ const floatingPanelRef = useRef14(null);
26712
+ floatingPanelRef.current = floatingPanel;
26713
+ const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26714
+ const buttonCollectionDragRef = useRef14(null);
26715
+ const buttonDropInsertIndexRef = useRef14(null);
26716
+ const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26717
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26718
+ const buttonPointerDragRef = useRef14(null);
26719
+ const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26720
+ const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26721
+ const [editorViewport, setEditorViewport] = useState18("desktop");
26722
+ const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26906
26723
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
26907
26724
  const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
26908
26725
  const footerDragRef = useRef14(null);
@@ -26929,21 +26746,6 @@ function OhhwellsBridge() {
26929
26746
  const stylesRef = useRef14("");
26930
26747
  const appliedDrawerRef = useRef14(null);
26931
26748
  const pendingDeleteUndoRef = useRef14(null);
26932
- const [floatingPanel, setFloatingPanel] = useState18(null);
26933
- const floatingPanelOpenRef = useRef14(false);
26934
- const floatingPanelRef = useRef14(null);
26935
- floatingPanelRef.current = floatingPanel;
26936
- const setFloatingPanelRef = useRef14(setFloatingPanel);
26937
- const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26938
- const buttonCollectionDragRef = useRef14(null);
26939
- const buttonDropInsertIndexRef = useRef14(null);
26940
- const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26941
- const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26942
- const buttonPointerDragRef = useRef14(null);
26943
- const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26944
- const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26945
- const [editorViewport, setEditorViewport] = useState18("desktop");
26946
- const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26947
26749
  const [sitePages, setSitePages] = useState18([]);
26948
26750
  const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
26949
26751
  const [sectionsByPath, setSectionsByPath] = useState18({});
@@ -26953,18 +26755,7 @@ function OhhwellsBridge() {
26953
26755
  const linkPopoverOpenRef = useRef14(false);
26954
26756
  const linkPopoverGraceUntilRef = useRef14(0);
26955
26757
  setLinkPopoverRef.current = setLinkPopover;
26956
- setFloatingPanelRef.current = setFloatingPanel;
26957
26758
  linkPopoverSessionRef.current = linkPopover;
26958
- floatingPanelOpenRef.current = Boolean(floatingPanel);
26959
- useEffect21(() => {
26960
- const syncViewport = () => {
26961
- const next = window.innerWidth <= 480 ? "mobile" : "desktop";
26962
- setEditorViewport((prev) => prev === next ? prev : next);
26963
- };
26964
- syncViewport();
26965
- window.addEventListener("resize", syncViewport);
26966
- return () => window.removeEventListener("resize", syncViewport);
26967
- }, []);
26968
26759
  useEffect21(() => {
26969
26760
  setSectionOrderPersistHandler((entries) => {
26970
26761
  const currentPath = window.location.pathname;
@@ -28671,7 +28462,7 @@ function OhhwellsBridge() {
28671
28462
  isFooterFrameSelection,
28672
28463
  postToParent2
28673
28464
  ]);
28674
- useLayoutEffect7(() => {
28465
+ useLayoutEffect6(() => {
28675
28466
  if (!subdomain || isEditMode) {
28676
28467
  setFetchState("done");
28677
28468
  return;
@@ -28698,7 +28489,6 @@ function OhhwellsBridge() {
28698
28489
  applyAiFooterFromContent(content);
28699
28490
  if (typeof content[STYLE_STORE_KEY] === "string") {
28700
28491
  stylesRef.current = content[STYLE_STORE_KEY];
28701
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28702
28492
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28703
28493
  }
28704
28494
  applyBrandChrome(content);
@@ -28709,16 +28499,15 @@ function OhhwellsBridge() {
28709
28499
  if (key === "__ohw_sections") continue;
28710
28500
  if (key === AI_SECTIONS_KEY) continue;
28711
28501
  if (key === AI_FOOTER_KEY) continue;
28712
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28713
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28714
28502
  if (key === BRAND_KIT_KEY) continue;
28715
28503
  if (key === STYLE_STORE_KEY) continue;
28716
28504
  if (BRAND_CHROME_KEYS.has(key)) continue;
28505
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28717
28506
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28507
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28718
28508
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28719
28509
  continue;
28720
28510
  }
28721
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28722
28511
  if (applyVideoSettingNode(key, val)) continue;
28723
28512
  if (applyCarouselNode(key, val)) continue;
28724
28513
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28758,7 +28547,6 @@ function OhhwellsBridge() {
28758
28547
  });
28759
28548
  applyLinkByKey(key, val);
28760
28549
  }
28761
- applySectionEmbeds(content);
28762
28550
  applyLogoFromContent(content);
28763
28551
  applyLogoSizes(content);
28764
28552
  reconcileNavbarItemsFromContent(content);
@@ -28947,22 +28735,20 @@ function OhhwellsBridge() {
28947
28735
  }
28948
28736
  applyAiFooterFromContent(content);
28949
28737
  if (typeof content[STYLE_STORE_KEY] === "string") {
28950
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28951
28738
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28952
28739
  }
28953
28740
  for (const [key, val] of Object.entries(content)) {
28954
28741
  if (key === "__ohw_sections") continue;
28955
28742
  if (key === AI_SECTIONS_KEY) continue;
28956
28743
  if (key === AI_FOOTER_KEY) continue;
28957
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28958
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28959
28744
  if (key === BRAND_KIT_KEY) continue;
28960
28745
  if (key === STYLE_STORE_KEY) continue;
28961
28746
  if (BRAND_CHROME_KEYS.has(key)) continue;
28747
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
28748
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28962
28749
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28963
28750
  continue;
28964
28751
  }
28965
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28966
28752
  if (applyVideoSettingNode(key, val)) continue;
28967
28753
  if (applyCarouselNode(key, val)) continue;
28968
28754
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28987,7 +28773,6 @@ function OhhwellsBridge() {
28987
28773
  });
28988
28774
  applyLinkByKey(key, val);
28989
28775
  }
28990
- applySectionEmbeds(content);
28991
28776
  applyLogoFromContent(content);
28992
28777
  reconcileNavbarItemsFromContent(content);
28993
28778
  reconcileFooterOrderFromContent(content);
@@ -29043,7 +28828,7 @@ function OhhwellsBridge() {
29043
28828
  if (debounceTimer) clearTimeout(debounceTimer);
29044
28829
  };
29045
28830
  }, [subdomain, isEditMode, pathname]);
29046
- useLayoutEffect7(() => {
28831
+ useLayoutEffect6(() => {
29047
28832
  const el = document.getElementById("ohw-loader");
29048
28833
  if (!el) return;
29049
28834
  const visible = Boolean(subdomain) && fetchState !== "done";
@@ -29227,11 +29012,26 @@ function OhhwellsBridge() {
29227
29012
  const t2 = setTimeout(measure, 500);
29228
29013
  const ro = new ResizeObserver(schedule);
29229
29014
  ro.observe(document.body);
29015
+ let lastWidth = window.innerWidth;
29016
+ let resizeTimers = [];
29017
+ const clearResizeTimers = () => {
29018
+ resizeTimers.forEach(clearTimeout);
29019
+ resizeTimers = [];
29020
+ };
29021
+ const handleResize = () => {
29022
+ if (window.innerWidth === lastWidth) return;
29023
+ lastWidth = window.innerWidth;
29024
+ clearResizeTimers();
29025
+ resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
29026
+ };
29027
+ window.addEventListener("resize", handleResize);
29230
29028
  return () => {
29231
29029
  clearTimeout(t1);
29232
29030
  clearTimeout(t2);
29233
29031
  if (raf != null) cancelAnimationFrame(raf);
29234
29032
  ro.disconnect();
29033
+ clearResizeTimers();
29034
+ window.removeEventListener("resize", handleResize);
29235
29035
  };
29236
29036
  }, [pathname, isEditMode, postToParent2]);
29237
29037
  useEffect21(() => {
@@ -29528,13 +29328,6 @@ function OhhwellsBridge() {
29528
29328
  if (target.closest("[data-ohw-state-toggle]")) return;
29529
29329
  if (target.closest("[data-ohw-max-badge]")) return;
29530
29330
  if (isInsideLinkEditor(target)) return;
29531
- if (isInsideFloatingPanel(target)) return;
29532
- if (target.closest("[data-ohw-form-toolbar]")) return;
29533
- if (target.closest(
29534
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29535
- )) {
29536
- return;
29537
- }
29538
29331
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29539
29332
  clearMediaSelectionRef.current();
29540
29333
  }
@@ -29558,6 +29351,8 @@ function OhhwellsBridge() {
29558
29351
  return;
29559
29352
  }
29560
29353
  }
29354
+ if (isInsideFloatingPanel(target)) return;
29355
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29561
29356
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29562
29357
  if (collectionItem) {
29563
29358
  e.preventDefault();
@@ -29569,6 +29364,11 @@ function OhhwellsBridge() {
29569
29364
  });
29570
29365
  return;
29571
29366
  }
29367
+ if (target.closest(
29368
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29369
+ )) {
29370
+ return;
29371
+ }
29572
29372
  {
29573
29373
  const formEl = getFormElement(target);
29574
29374
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29722,13 +29522,9 @@ function OhhwellsBridge() {
29722
29522
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29723
29523
  e.preventDefault();
29724
29524
  e.stopPropagation();
29525
+ selectIconElementRef.current(editable);
29725
29526
  const aiIcon = editable.hasAttribute("data-ai-icon");
29726
29527
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
29727
- if (aiIcon) {
29728
- aiSectionApiRef.current?.selectFromElement(editable);
29729
- } else {
29730
- selectIconElementRef.current(editable);
29731
- }
29732
29528
  postToParentRef.current({
29733
29529
  type: "ow:icon-pick",
29734
29530
  key: editable.dataset.ohwKey ?? "",
@@ -29956,9 +29752,6 @@ function OhhwellsBridge() {
29956
29752
  setHoveredItemRect(null);
29957
29753
  hoveredNavContainerRef.current = null;
29958
29754
  setHoveredNavContainerRect(null);
29959
- siblingHintElRef.current = null;
29960
- setSiblingHintRect(null);
29961
- setSiblingHintRects([]);
29962
29755
  return;
29963
29756
  }
29964
29757
  {
@@ -30079,6 +29872,7 @@ function OhhwellsBridge() {
30079
29872
  hoveredNavContainerRef.current = null;
30080
29873
  setHoveredNavContainerRect(null);
30081
29874
  hoveredItemElRef.current = editable;
29875
+ setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
30082
29876
  }
30083
29877
  }
30084
29878
  }
@@ -30788,11 +30582,7 @@ function OhhwellsBridge() {
30788
30582
  };
30789
30583
  const handleMouseMove = (e) => {
30790
30584
  const { clientX, clientY } = e;
30791
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30792
- dismissImageHover();
30793
- clearImageHover();
30794
- return;
30795
- }
30585
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30796
30586
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30797
30587
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30798
30588
  formHoverElRef.current = null;
@@ -30821,12 +30611,7 @@ function OhhwellsBridge() {
30821
30611
  setHoveredItemRect(null);
30822
30612
  hoveredNavContainerRef.current = null;
30823
30613
  setHoveredNavContainerRect(null);
30824
- siblingHintElRef.current = null;
30825
- setSiblingHintRect(null);
30826
- setSiblingHintRects([]);
30827
30614
  dismissImageHover();
30828
- clearImageHover();
30829
- setSectionGap(null);
30830
30615
  return;
30831
30616
  }
30832
30617
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30838,11 +30623,7 @@ function OhhwellsBridge() {
30838
30623
  if (e.data?.type !== "ow:pointer-sync") return;
30839
30624
  const { clientX, clientY } = e.data;
30840
30625
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30841
- if (pointOwnedByFloatingPanel(clientX, clientY)) {
30842
- dismissImageHover();
30843
- clearImageHover();
30844
- return;
30845
- }
30626
+ if (pointOwnedByFloatingPanel(clientX, clientY)) return;
30846
30627
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30847
30628
  if (probeSocialsRowAt(clientX, clientY)) return;
30848
30629
  probeSectionGapAt(clientX, clientY);
@@ -31222,7 +31003,6 @@ function OhhwellsBridge() {
31222
31003
  applyAiFooterFromContent(content);
31223
31004
  if (typeof content[STYLE_STORE_KEY] === "string") {
31224
31005
  stylesRef.current = content[STYLE_STORE_KEY];
31225
- document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31226
31006
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31227
31007
  }
31228
31008
  applyBrandChrome(content);
@@ -31237,16 +31017,15 @@ function OhhwellsBridge() {
31237
31017
  }
31238
31018
  if (key === AI_SECTIONS_KEY) continue;
31239
31019
  if (key === AI_FOOTER_KEY) continue;
31240
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31241
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31242
31020
  if (key === BRAND_KIT_KEY) continue;
31243
31021
  if (key === STYLE_STORE_KEY) continue;
31244
31022
  if (BRAND_CHROME_KEYS.has(key)) continue;
31023
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31245
31024
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
31025
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31246
31026
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31247
31027
  continue;
31248
31028
  }
31249
- if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31250
31029
  if (applyVideoSettingNode(key, val)) continue;
31251
31030
  if (applyCarouselNode(key, val)) continue;
31252
31031
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31272,7 +31051,6 @@ function OhhwellsBridge() {
31272
31051
  });
31273
31052
  applyLinkByKey(key, val);
31274
31053
  }
31275
- applySectionEmbeds(content);
31276
31054
  applyLogoFromContent(content);
31277
31055
  applyLogoSizes(content);
31278
31056
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31912,12 +31690,6 @@ function OhhwellsBridge() {
31912
31690
  closeLinkPopoverRef.current();
31913
31691
  return;
31914
31692
  }
31915
- if (floatingPanelOpenRef.current) {
31916
- setFloatingPanelRef.current(null);
31917
- deselectRef.current();
31918
- deactivateRef.current();
31919
- return;
31920
- }
31921
31693
  deselectRef.current();
31922
31694
  deactivateRef.current();
31923
31695
  clearMediaSelectionRef.current();
@@ -32748,10 +32520,10 @@ function OhhwellsBridge() {
32748
32520
  window.removeEventListener("message", handleDuplicateSection);
32749
32521
  window.removeEventListener("message", handleDeactivate);
32750
32522
  window.removeEventListener("message", handleSelectNav);
32523
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32751
32524
  window.removeEventListener("message", handleToastAction);
32752
32525
  window.removeEventListener("message", handleFormCount);
32753
32526
  window.removeEventListener("message", handleUiEscape);
32754
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32755
32527
  autoSaveTimers.current.forEach(clearTimeout);
32756
32528
  autoSaveTimers.current.clear();
32757
32529
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -33045,7 +32817,7 @@ function OhhwellsBridge() {
33045
32817
  postToParent2({
33046
32818
  type: "ow:ready",
33047
32819
  version: "1",
33048
- bridgeVersion: "0.1.169-next.450",
32820
+ bridgeVersion: "0.1.170",
33049
32821
  path: pathname,
33050
32822
  nodes: collectEditableNodes(editContentRef.current),
33051
32823
  sections
@@ -33781,7 +33553,7 @@ function OhhwellsBridge() {
33781
33553
  className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
33782
33554
  onClick: () => setFieldTypePickerOpen((open) => !open),
33783
33555
  "data-ohw-add-field": "",
33784
- children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
33556
+ children: /* @__PURE__ */ jsx40(Plus5, { size: 15, "aria-hidden": true })
33785
33557
  }
33786
33558
  ),
33787
33559
  /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),