@ohhwells/bridge 0.1.171 → 0.1.172-next.457

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 useLayoutEffect6, useRef as useRef14, useState as useState18 } from "react";
4
+ import React12, { useCallback as useCallback12, useEffect as useEffect21, useLayoutEffect as useLayoutEffect7, 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 paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1131
- const luminance = relativeLuminance(paint);
1130
+ const paint3 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1131
+ const luminance = relativeLuminance(paint3);
1132
1132
  return {
1133
- background: toCss({ ...paint, a: 1 }),
1133
+ background: toCss({ ...paint3, 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 paint = accentColor(primary);
1140
+ const paint3 = accentColor(primary);
1141
1141
  return {
1142
1142
  background: TRANSPARENT,
1143
- color: paint,
1144
- borderColor: paint,
1143
+ color: paint3,
1144
+ borderColor: paint3,
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 paint = accentColor(primary);
1157
+ const paint3 = accentColor(primary);
1158
1158
  const text = parseColor(outline.color);
1159
- const paintRgb = parseColor(paint);
1159
+ const paintRgb = parseColor(paint3);
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: paint,
1169
- borderColor: hasBorder ? paint : outline.borderColor
1168
+ color: paint3,
1169
+ borderColor: hasBorder ? paint3 : outline.borderColor
1170
1170
  };
1171
1171
  }
1172
1172
  function generateButtonVariants(samples) {
@@ -5199,6 +5199,118 @@ function deleteNavbarItem(sourceAnchor) {
5199
5199
  };
5200
5200
  }
5201
5201
 
5202
+ // src/lib/hidden-editables.ts
5203
+ var HIDDEN_EDITABLES_KEY = "__ohw_hidden_editables";
5204
+ var HIDDEN_ATTR = "data-ohw-editable-hidden";
5205
+ var FORM_SELECTOR = '[data-ohw-editable="form"]';
5206
+ function parseJson3(raw) {
5207
+ if (!raw) return null;
5208
+ try {
5209
+ return JSON.parse(raw);
5210
+ } catch {
5211
+ return null;
5212
+ }
5213
+ }
5214
+ function readHiddenEditables(content) {
5215
+ const parsed = parseJson3(content?.[HIDDEN_EDITABLES_KEY]);
5216
+ if (!Array.isArray(parsed)) return [];
5217
+ return [...new Set(parsed.filter((key) => typeof key === "string" && key.length > 0))];
5218
+ }
5219
+ function isEditableKeyHidden(content, key) {
5220
+ if (!key) return false;
5221
+ return readHiddenEditables(content).includes(key);
5222
+ }
5223
+ function resolveSoftHideTarget(el) {
5224
+ const cta = el.closest(CTA_BUTTON_SELECTOR);
5225
+ if (cta) return cta;
5226
+ const form = el.closest(FORM_SELECTOR);
5227
+ if (form) return form;
5228
+ return el;
5229
+ }
5230
+ function canSoftHideEditable(el, opts) {
5231
+ if (!el) return false;
5232
+ const target = resolveSoftHideTarget(el);
5233
+ const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
5234
+ if (!key) return false;
5235
+ if (key.startsWith("ai.")) return false;
5236
+ if (key.startsWith("__ohw_")) return false;
5237
+ if (el.hasAttribute("data-ohw-section") || target.hasAttribute("data-ohw-section")) return false;
5238
+ if (el.closest("[data-ohw-social-item]")) return false;
5239
+ if (target.matches(FORM_SELECTOR) || el.dataset.ohwEditable === "form") return true;
5240
+ const cta = el.closest(CTA_BUTTON_SELECTOR);
5241
+ if (cta) return !isLastNavbarButton(cta);
5242
+ if (opts?.isNavFooterItem) return false;
5243
+ if (el.closest("[data-ohw-nav-container], [data-ohw-nav-drawer], [data-ohw-nav-root], nav")) {
5244
+ if (el.closest("[data-ohw-href-key], [data-ohw-nav-item], [data-ohw-nav-group]")) return false;
5245
+ }
5246
+ if (el.closest("footer, [data-ai-footer]")) {
5247
+ if (el.closest("[data-ohw-href-key], [data-ohw-footer-item], [data-ohw-social-item]")) return false;
5248
+ }
5249
+ const kind = el.dataset.ohwEditable;
5250
+ return kind === "text" || kind === "plain" || kind === "image" || kind === "bg-image" || kind === "video" || kind === "icon" || kind === "link" || kind === "map";
5251
+ }
5252
+ function withHiddenEditable(content, key) {
5253
+ const hidden = readHiddenEditables(content);
5254
+ if (hidden.includes(key)) {
5255
+ return {
5256
+ content,
5257
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text: content[HIDDEN_EDITABLES_KEY] ?? "[]" }],
5258
+ added: false
5259
+ };
5260
+ }
5261
+ const nextHidden = [...hidden, key];
5262
+ const text = JSON.stringify(nextHidden);
5263
+ return {
5264
+ content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
5265
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text }],
5266
+ added: true
5267
+ };
5268
+ }
5269
+ function withoutHiddenEditable(content, key) {
5270
+ const nextHidden = readHiddenEditables(content).filter((entry) => entry !== key);
5271
+ const text = JSON.stringify(nextHidden);
5272
+ return {
5273
+ content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
5274
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text }]
5275
+ };
5276
+ }
5277
+ function escapeAttrValue(value) {
5278
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
5279
+ }
5280
+ function markHidden(el) {
5281
+ softHide(el);
5282
+ el.setAttribute(HIDDEN_ATTR, "");
5283
+ }
5284
+ function markVisible(el) {
5285
+ softUnhide(el);
5286
+ el.removeAttribute(HIDDEN_ATTR);
5287
+ }
5288
+ function applyHiddenEditablesToDom(content, root = document) {
5289
+ const hidden = readHiddenEditables(content);
5290
+ root.querySelectorAll(`[${HIDDEN_ATTR}]`).forEach((el) => markVisible(el));
5291
+ for (const key of hidden) {
5292
+ root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
5293
+ markHidden(resolveSoftHideTarget(el));
5294
+ });
5295
+ }
5296
+ }
5297
+ function softHideEditableInDom(el, content) {
5298
+ if (!canSoftHideEditable(el)) return null;
5299
+ const target = resolveSoftHideTarget(el);
5300
+ const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
5301
+ if (!key) return null;
5302
+ const next = withHiddenEditable(content, key);
5303
+ markHidden(target);
5304
+ return { content: next.content, nodes: next.nodes, key, target };
5305
+ }
5306
+ function softUnhideEditableInDom(key, content, root = document) {
5307
+ const next = withoutHiddenEditable(content, key);
5308
+ root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
5309
+ markVisible(resolveSoftHideTarget(el));
5310
+ });
5311
+ return next;
5312
+ }
5313
+
5202
5314
  // src/lib/collect-editable-nodes.ts
5203
5315
  var VIDEO_AUTOPLAY_SUFFIX = "__ohw_autoplay";
5204
5316
  var VIDEO_MUTED_SUFFIX = "__ohw_muted";
@@ -5277,7 +5389,9 @@ function collectEditableNodes(extraContent, root = document) {
5277
5389
  BUTTON_ASSIGNMENTS_KEY,
5278
5390
  BUTTON_COLLECTIONS_KEY,
5279
5391
  BUTTON_SNAPSHOTS_KEY,
5280
- BUTTON_HIDDEN_KEY
5392
+ BUTTON_HIDDEN_KEY,
5393
+ // Soft-hidden template slots (non-AI Delete) — no DOM marker when hidden.
5394
+ HIDDEN_EDITABLES_KEY
5281
5395
  ]) {
5282
5396
  const text = extraContent[key];
5283
5397
  if (typeof text === "string" && text.length > 0) {
@@ -6762,6 +6876,21 @@ function pricingCardFeatureCount(tree, index) {
6762
6876
  const target = findPricingCollection(tree)?.children?.[index];
6763
6877
  return target ? pricingFeatureList(target).length : 0;
6764
6878
  }
6879
+ function prevailingFeatureIcon(features) {
6880
+ const counts = /* @__PURE__ */ new Map();
6881
+ for (const row of features) {
6882
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
6883
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
6884
+ entry.count += 1;
6885
+ counts.set(key, entry);
6886
+ }
6887
+ let best = null;
6888
+ for (const entry of counts.values()) {
6889
+ if (!best || entry.count > best.count) best = entry;
6890
+ }
6891
+ if (!best) return {};
6892
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
6893
+ }
6765
6894
  function addPricingCardFeature(tree, index, text) {
6766
6895
  return withPricingCollection(tree, (collection) => {
6767
6896
  const children = collection.children;
@@ -6770,7 +6899,7 @@ function addPricingCardFeature(tree, index, text) {
6770
6899
  const features = pricingFeatureList(target);
6771
6900
  if (features.length >= PRICING_FEATURES_MAX) return false;
6772
6901
  target.slots = target.slots ?? {};
6773
- target.slots.features = [...features, { text }];
6902
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6774
6903
  return true;
6775
6904
  });
6776
6905
  }
@@ -6837,6 +6966,127 @@ function rewriteIconSlot(tree, path, ref) {
6837
6966
  return next;
6838
6967
  }
6839
6968
 
6969
+ // src/lib/ai-remove-block.ts
6970
+ function blockPathFromEditKey(sectionId, key) {
6971
+ const prefix = aiSlotKeyPrefixFor(sectionId);
6972
+ if (!key.startsWith(prefix)) return void 0;
6973
+ const path = [];
6974
+ for (const part of key.slice(prefix.length).split(".")) {
6975
+ if (/^[rbc]\d+$/.test(part)) path.push(part);
6976
+ else break;
6977
+ }
6978
+ if (path.length < 2 || !/^r\d+$/.test(path[0]) || !/^b\d+$/.test(path[1])) return void 0;
6979
+ return path.join(".");
6980
+ }
6981
+ function parseBlockPath(path) {
6982
+ const segs = [];
6983
+ for (const part of path.split(".")) {
6984
+ const match = part.match(/^([rbc])(\d+)$/);
6985
+ if (!match) return void 0;
6986
+ segs.push({ kind: match[1], index: Number(match[2]) });
6987
+ }
6988
+ if (segs.length < 2 || segs[0].kind !== "r" || segs[1].kind !== "b") return void 0;
6989
+ return segs;
6990
+ }
6991
+ function cloneTree(tree) {
6992
+ return JSON.parse(JSON.stringify(tree));
6993
+ }
6994
+ function nodeAtPath2(tree, segs) {
6995
+ let node = tree.rows?.[segs[0].index]?.blocks?.[segs[1].index];
6996
+ for (let i = 2; i < segs.length; i += 1) {
6997
+ if (segs[i].kind !== "c") return null;
6998
+ node = node?.children?.[segs[i].index];
6999
+ }
7000
+ return node ?? null;
7001
+ }
7002
+ function unwrapPromoted(node) {
7003
+ if (node.promoted === true && node.slots?.layout === "stack" && (node.children?.length ?? 0) === 1) {
7004
+ const only = { ...node.children[0] };
7005
+ if (node.slot) only.slot = node.slot;
7006
+ only.span = node.span;
7007
+ return only;
7008
+ }
7009
+ return node;
7010
+ }
7011
+ function removeBlockAtPath(tree, path) {
7012
+ const segs = parseBlockPath(path);
7013
+ if (!segs) return { ok: false, reasons: [`invalid block path "${path}"`] };
7014
+ const next = cloneTree(tree);
7015
+ const rowIndex = segs[0].index;
7016
+ const row = next.rows[rowIndex];
7017
+ if (!row) return { ok: false, reasons: [`row ${rowIndex} not found`] };
7018
+ if (segs.length === 2) {
7019
+ const blockIndex = segs[1].index;
7020
+ if (!row.blocks[blockIndex]) return { ok: false, reasons: [`block ${path} not found`] };
7021
+ row.blocks.splice(blockIndex, 1);
7022
+ if (row.blocks.length === 0) {
7023
+ next.rows.splice(rowIndex, 1);
7024
+ } else if (row.blocks.length === 1) {
7025
+ row.blocks[0] = { ...row.blocks[0], span: 12 };
7026
+ delete row.blocks[0].slot;
7027
+ }
7028
+ } else {
7029
+ let parent = row.blocks[segs[1].index];
7030
+ for (let i = 2; i < segs.length - 1; i += 1) {
7031
+ if (!parent?.children || segs[i].kind !== "c") {
7032
+ return { ok: false, reasons: [`block ${path} not found`] };
7033
+ }
7034
+ parent = parent.children[segs[i].index];
7035
+ }
7036
+ const childIndex = segs[segs.length - 1].index;
7037
+ if (!parent?.children || segs[segs.length - 1].kind !== "c" || !parent.children[childIndex]) {
7038
+ return { ok: false, reasons: [`block ${path} not found`] };
7039
+ }
7040
+ parent.children.splice(childIndex, 1);
7041
+ if (segs.length === 3) {
7042
+ row.blocks[segs[1].index] = unwrapPromoted(parent);
7043
+ if (row.blocks[segs[1].index].type === "group" && (row.blocks[segs[1].index].children?.length ?? 0) === 0) {
7044
+ row.blocks.splice(segs[1].index, 1);
7045
+ if (row.blocks.length === 0) next.rows.splice(rowIndex, 1);
7046
+ }
7047
+ if (next.rows[rowIndex]?.blocks.length === 1) {
7048
+ next.rows[rowIndex].blocks[0] = { ...next.rows[rowIndex].blocks[0], span: 12 };
7049
+ delete next.rows[rowIndex].blocks[0].slot;
7050
+ }
7051
+ } else {
7052
+ const grand = row.blocks[segs[1].index];
7053
+ let cursor = grand;
7054
+ for (let i = 2; i < segs.length - 2; i += 1) {
7055
+ cursor = cursor?.children?.[segs[i].index];
7056
+ }
7057
+ const containerIndex = segs[segs.length - 2].index;
7058
+ if (cursor?.children?.[containerIndex]) {
7059
+ cursor.children[containerIndex] = unwrapPromoted(parent);
7060
+ }
7061
+ }
7062
+ }
7063
+ if (next.rows.length === 0) {
7064
+ return { ok: false, reasons: ["a section must keep at least one block"] };
7065
+ }
7066
+ return { ok: true, tree: next };
7067
+ }
7068
+ function planAiBlockRemoval(aiSectionsRaw, editKey) {
7069
+ if (!editKey || !editKey.startsWith("ai.")) return null;
7070
+ const state = parseAiSectionsState(aiSectionsRaw);
7071
+ const entry = state.sections.find((s) => editKey.startsWith(aiSlotKeyPrefixFor(s.id)));
7072
+ if (!entry) return null;
7073
+ const path = blockPathFromEditKey(entry.id, editKey);
7074
+ if (!path) return null;
7075
+ const segs = parseBlockPath(path);
7076
+ if (!segs) return null;
7077
+ const node = nodeAtPath2(entry.tree, segs);
7078
+ if (!node) return null;
7079
+ const removed = removeBlockAtPath(entry.tree, path);
7080
+ if (!removed.ok) return removed;
7081
+ return { ok: true, tree: removed.tree, path, entry };
7082
+ }
7083
+ var planAiTextBlockRemoval = planAiBlockRemoval;
7084
+ function canRemoveAiBlock(aiSectionsRaw, editKey) {
7085
+ const plan = planAiBlockRemoval(aiSectionsRaw, editKey);
7086
+ return plan?.ok === true;
7087
+ }
7088
+ var canRemoveAiTextBlock = canRemoveAiBlock;
7089
+
6840
7090
  // src/lib/ai-footer-tree.ts
6841
7091
  var FOOTER_COLUMN_SPANS = [12, 6, 4, 3];
6842
7092
  var FOOTER_COLUMN_BLOCKS = [
@@ -7414,6 +7664,174 @@ function findSelectableNavContainer(doc = document) {
7414
7664
  );
7415
7665
  }
7416
7666
 
7667
+ // src/lib/youtube.ts
7668
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7669
+ function extractYouTubeId(input) {
7670
+ const trimmed = input.trim();
7671
+ if (!trimmed) return null;
7672
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7673
+ let url;
7674
+ try {
7675
+ url = new URL(trimmed);
7676
+ } catch {
7677
+ return null;
7678
+ }
7679
+ const host = url.hostname.replace(/^www\./, "");
7680
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7681
+ return null;
7682
+ }
7683
+ let candidate = null;
7684
+ if (host === "youtu.be") {
7685
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7686
+ } else if (url.pathname === "/watch") {
7687
+ candidate = url.searchParams.get("v");
7688
+ } else {
7689
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7690
+ candidate = match ? match[1] : null;
7691
+ }
7692
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7693
+ }
7694
+
7695
+ // src/lib/section-embed.ts
7696
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7697
+ function readStoredEmbed(value) {
7698
+ if (value.startsWith("start\n")) {
7699
+ return { raw: value.slice("start\n".length), at: "start" };
7700
+ }
7701
+ return { raw: value, at: "end" };
7702
+ }
7703
+ function embedFrameSrc(value) {
7704
+ const videoId = extractYouTubeId(value);
7705
+ if (videoId) {
7706
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7707
+ }
7708
+ let url;
7709
+ try {
7710
+ url = new URL(value);
7711
+ } catch {
7712
+ return null;
7713
+ }
7714
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7715
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7716
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7717
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7718
+ return { src, title: "Map" };
7719
+ }
7720
+ if (host === "maps.app.goo.gl") {
7721
+ return { src: value, title: "Map" };
7722
+ }
7723
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7724
+ return { src: value, title: "Calendar" };
7725
+ }
7726
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7727
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7728
+ }
7729
+ if (host === "forms.gle") {
7730
+ return { src: value, title: "Form" };
7731
+ }
7732
+ return null;
7733
+ }
7734
+ function place(section, box, at) {
7735
+ if (at === "start") {
7736
+ section.insertBefore(box, section.firstChild);
7737
+ return;
7738
+ }
7739
+ section.appendChild(box);
7740
+ }
7741
+ function paint(section, key, src, title, at) {
7742
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7743
+ const frame = existing?.querySelector("iframe");
7744
+ if (existing && frame) {
7745
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7746
+ frame.title = title;
7747
+ place(section, existing, at);
7748
+ return;
7749
+ }
7750
+ existing?.remove();
7751
+ const box = document.createElement("div");
7752
+ box.setAttribute("data-ohw-section-embed", key);
7753
+ 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;";
7754
+ const frameWrap = document.createElement("div");
7755
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7756
+ const iframe = document.createElement("iframe");
7757
+ iframe.src = src;
7758
+ iframe.title = title;
7759
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7760
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7761
+ iframe.setAttribute("allowfullscreen", "");
7762
+ frameWrap.appendChild(iframe);
7763
+ box.appendChild(frameWrap);
7764
+ place(section, box, at);
7765
+ }
7766
+ function applySectionEmbeds(content) {
7767
+ for (const [key, val] of Object.entries(content)) {
7768
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7769
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7770
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7771
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7772
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7773
+ if (!section || !stored || !frame) {
7774
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7775
+ continue;
7776
+ }
7777
+ paint(section, key, frame.src, frame.title, stored.at);
7778
+ }
7779
+ }
7780
+
7781
+ // src/lib/section-extra.ts
7782
+ var SECTION_EXTRA_SUFFIX = "__ohw_extra";
7783
+ function placeUnderCards(section, box) {
7784
+ const cards = section.querySelector("[data-ohw-cards]");
7785
+ if (cards) {
7786
+ cards.after(box);
7787
+ return;
7788
+ }
7789
+ const viewAll = section.querySelector(".classes-viewall");
7790
+ if (viewAll && section.contains(viewAll)) {
7791
+ section.insertBefore(box, viewAll);
7792
+ return;
7793
+ }
7794
+ const copy = section.querySelector(".classes-copy");
7795
+ if (copy?.parentElement === section) {
7796
+ copy.after(box);
7797
+ return;
7798
+ }
7799
+ section.appendChild(box);
7800
+ }
7801
+ function paint2(section, key, text) {
7802
+ const existing = section.querySelector(`[data-ohw-section-extra="${CSS.escape(key)}"]`);
7803
+ if (existing) {
7804
+ const editable = existing.querySelector('[data-ohw-editable="text"]');
7805
+ if (editable && editable.innerHTML !== text) {
7806
+ editable.innerHTML = text;
7807
+ }
7808
+ placeUnderCards(section, existing);
7809
+ return;
7810
+ }
7811
+ const box = document.createElement("div");
7812
+ box.setAttribute("data-ohw-section-extra", key);
7813
+ box.style.cssText = "width:100%;max-width:720px;margin:48px auto 0;padding:0 48px;box-sizing:border-box;text-align:center;";
7814
+ const p = document.createElement("p");
7815
+ p.setAttribute("data-ohw-editable", "text");
7816
+ p.setAttribute("data-ohw-key", key);
7817
+ p.style.cssText = "font-family:var(--font-body, inherit);font-weight:400;font-size:clamp(15px,1.4vw,18px);line-height:1.55;margin:0;color:inherit;";
7818
+ p.innerHTML = text;
7819
+ box.appendChild(p);
7820
+ placeUnderCards(section, box);
7821
+ }
7822
+ function applySectionExtras(content) {
7823
+ for (const [key, val] of Object.entries(content)) {
7824
+ if (!key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
7825
+ const sectionId = key.slice(0, -SECTION_EXTRA_SUFFIX.length);
7826
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7827
+ if (!section || typeof val !== "string" || !val.trim()) {
7828
+ section?.querySelector(`[data-ohw-section-extra="${CSS.escape(key)}"]`)?.remove();
7829
+ continue;
7830
+ }
7831
+ paint2(section, key, val);
7832
+ }
7833
+ }
7834
+
7417
7835
  // src/ui/ai-tree/aiSectionsManager.tsx
7418
7836
  import { flushSync } from "react-dom";
7419
7837
  import { createRoot } from "react-dom/client";
@@ -7936,12 +8354,19 @@ function footerBodyStyle(fallbackFont, color, weight = 500) {
7936
8354
  }
7937
8355
  var str = (value) => typeof value === "string" ? value : "";
7938
8356
  var cardRadius = (slots) => slots.cornerStyle === "sharp" ? 0 : AI_TREE_TOKENS.radiusCard;
7939
- var blockAlignStyle = (blockAlign) => blockAlign ? {
7940
- display: "flex",
7941
- flexDirection: "column",
7942
- alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
7943
- textAlign: blockAlign
7944
- } : {};
8357
+ var HUG_ALIGN_TYPES = /* @__PURE__ */ new Set(["button", "button-row", "rating"]);
8358
+ var blockAlignStyle = (blockAlign, blockType) => {
8359
+ if (!blockAlign) return {};
8360
+ if (blockType && HUG_ALIGN_TYPES.has(blockType)) {
8361
+ return {
8362
+ display: "flex",
8363
+ flexDirection: "column",
8364
+ alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
8365
+ textAlign: blockAlign
8366
+ };
8367
+ }
8368
+ return { width: "100%", textAlign: blockAlign, boxSizing: "border-box" };
8369
+ };
7945
8370
  var fullBleedBlock = (block) => block.type === "carousel" || block.type === "group" && str(block.slots?.layout) === "overlap";
7946
8371
  var featureLines = (value) => value.split(/\n|<br\s*\/?>/i).map((line) => line.trim()).filter(Boolean);
7947
8372
  var AI_MOBILE_CSS = [
@@ -7987,7 +8412,7 @@ var AI_MOBILE_CSS = [
7987
8412
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
7988
8413
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
7989
8414
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
7990
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8415
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
7991
8416
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
7992
8417
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
7993
8418
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8003,8 +8428,10 @@ var AI_MOBILE_CSS = [
8003
8428
  "[data-ai-section]{overflow-x:hidden}",
8004
8429
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8005
8430
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
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}",
8431
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8432
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8433
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8434
+ "[data-ai-container]{padding:0 20px !important}",
8008
8435
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8009
8436
  "[data-ai-cell]{width:100%;min-width:0}",
8010
8437
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8209,6 +8636,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8209
8636
  function textAttrs(ctx, path) {
8210
8637
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8211
8638
  }
8639
+ var AI_RESPONSIVE_CSS = [
8640
+ "@media (max-width: 960px) {",
8641
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8642
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8643
+ "}",
8644
+ "@media (max-width: 640px) {",
8645
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8646
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8647
+ // Group containers flatten to a column on phones; span placements come along for free.
8648
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8649
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8650
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8651
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8652
+ // layered text used to be.
8653
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8654
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8655
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8656
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8657
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8658
+ // other rule had already been taught to stand down.
8659
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8660
+ " [data-ai-responsive] { overflow-x: hidden; }",
8661
+ " [data-ai-responsive] img { max-width: 100%; }",
8662
+ "}"
8663
+ ].join("\n");
8212
8664
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8213
8665
  function MediaBox({
8214
8666
  refValue,
@@ -8263,7 +8715,7 @@ function MediaBox({
8263
8715
  position: fill ? "absolute" : void 0,
8264
8716
  inset: fill ? 0 : void 0,
8265
8717
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8266
- height: fill ? "100%" : void 0,
8718
+ height: fill ? "100%" : fixedSize ? height : void 0,
8267
8719
  aspectRatio: fill ? void 0 : aspectRatio,
8268
8720
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8269
8721
  borderRadius: radius,
@@ -8464,7 +8916,13 @@ function TextBlock({
8464
8916
  "div",
8465
8917
  {
8466
8918
  ...textAttrs(ctx, `${path}.content`),
8467
- style: { ...typeStyle(spec, font), color: ctx.brand.palette.dark, textAlign: align },
8919
+ style: {
8920
+ ...typeStyle(spec, font),
8921
+ color: ctx.brand.palette.dark,
8922
+ textAlign: align,
8923
+ width: "100%",
8924
+ boxSizing: "border-box"
8925
+ },
8468
8926
  dangerouslySetInnerHTML: { __html: str(slots.content) }
8469
8927
  }
8470
8928
  );
@@ -8475,7 +8933,7 @@ function SectionHeaderBlock({ node, ctx, path }) {
8475
8933
  const children = node.children ?? [];
8476
8934
  const buttonRowIdx = children.findIndex((c) => c.type === "button-row");
8477
8935
  const buttonRow = buttonRowIdx >= 0 ? children[buttonRowIdx] : void 0;
8478
- return /* @__PURE__ */ jsxs("div", { style: { textAlign: align }, children: [
8936
+ return /* @__PURE__ */ jsxs("div", { style: { textAlign: align, width: "100%", boxSizing: "border-box" }, children: [
8479
8937
  str(slots.tagline) && /* @__PURE__ */ jsx(
8480
8938
  "div",
8481
8939
  {
@@ -9759,7 +10217,7 @@ function CollectionBlock({ node, ctx, path }) {
9759
10217
  return /* @__PURE__ */ jsx(
9760
10218
  "div",
9761
10219
  {
9762
- "data-ai-grid": "",
10220
+ "data-ai-grid": String(itemsPerRow),
9763
10221
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9764
10222
  style: {
9765
10223
  display: "grid",
@@ -10061,7 +10519,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10061
10519
  },
10062
10520
  children: [
10063
10521
  i > 0 && ctx.heroOverlapFullBleed ? (
10064
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10522
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10065
10523
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10066
10524
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10067
10525
  // the full section width instead of reading at the usual content width.
@@ -10094,10 +10552,10 @@ function renderNode(node, ctx, path, ambientAlign) {
10094
10552
  gridColumn: `span ${typeof child.span === "number" ? Math.min(12, Math.max(1, child.span)) : 12}`,
10095
10553
  minWidth: 0
10096
10554
  } : { minWidth: 0 },
10097
- // A child's own `align` (or the group's inherited `ambientAlign`, e.g. from an
10098
- // `overlap` overlay layer — see renderNode) positions it within this column; a stack
10099
- // child otherwise stretches full-width (unchanged pre-existing behaviour).
10100
- ...blockAlignStyle(child.align ?? ambientAlign)
10555
+ // Same ambient as renderNode below: child's own align, else the group's, else the
10556
+ // inherited ambient (overlap overlay / section). Copy fills the column; button-row
10557
+ // etc. still hug via flex alignItems.
10558
+ ...blockAlignStyle(child.align ?? node.align ?? ambientAlign, child.type)
10101
10559
  },
10102
10560
  children: renderNode(child, ctx, `${path}.c${i}`, node.align ?? ambientAlign)
10103
10561
  },
@@ -10466,12 +10924,7 @@ function AiTreeRenderer({
10466
10924
  if (fillHeight) return "stretch";
10467
10925
  return (distributed ?? settings.verticalPosition) === "top" ? "start" : "center";
10468
10926
  };
10469
- const cellAlignStyle = (blockAlign) => blockAlign ? {
10470
- display: "flex",
10471
- flexDirection: "column",
10472
- alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
10473
- textAlign: blockAlign
10474
- } : {};
10927
+ const cellAlignStyle = (blockAlign, blockType) => blockAlignStyle(blockAlign, blockType);
10475
10928
  const needsOverlayClearance = fillHeight && pad === 0;
10476
10929
  return /* @__PURE__ */ jsxs(
10477
10930
  "section",
@@ -10480,6 +10933,7 @@ function AiTreeRenderer({
10480
10933
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10481
10934
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10482
10935
  ...bgAttrs,
10936
+ "data-ai-responsive": "",
10483
10937
  style: {
10484
10938
  position: "relative",
10485
10939
  padding: `${padCss} 0`,
@@ -10493,12 +10947,13 @@ function AiTreeRenderer({
10493
10947
  ...fillHeight ? { display: "grid" } : {}
10494
10948
  },
10495
10949
  children: [
10496
- isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10950
+ /* @__PURE__ */ jsx("style", { children: AI_RESPONSIVE_CSS }),
10497
10951
  /* @__PURE__ */ jsx("style", { children: AI_MOBILE_CSS }),
10952
+ isOverlay && backgroundUrl && /* @__PURE__ */ jsx("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10498
10953
  /* @__PURE__ */ jsx(
10499
10954
  "div",
10500
10955
  {
10501
- "data-ai-container": "",
10956
+ "data-ai-section-inner": "",
10502
10957
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10503
10958
  style: {
10504
10959
  position: "relative",
@@ -10515,7 +10970,7 @@ function AiTreeRenderer({
10515
10970
  children: tree.rows.map((row, r2) => /* @__PURE__ */ jsx(
10516
10971
  "div",
10517
10972
  {
10518
- "data-ai-row": "",
10973
+ "data-ai-columns": "",
10519
10974
  style: {
10520
10975
  display: "grid",
10521
10976
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -10531,11 +10986,11 @@ function AiTreeRenderer({
10531
10986
  gridColumn: `span ${Math.min(12, Math.max(1, block.span))}`,
10532
10987
  minWidth: 0,
10533
10988
  // Cascades the section's min-height stretch (see `fillHeight` above) down to
10534
- // this cell; `cellAlignStyle` below overrides to `flex` when the block also has
10535
- // its own horizontal `align`, which takes priority for that block.
10989
+ // this cell; `cellAlignStyle` below overrides when the block also has its own
10990
+ // horizontal `align` (flex hug for buttons; width 100% for text).
10536
10991
  ...fillHeight ? { display: "grid" } : {},
10537
10992
  // Horizontal placement of the block's content within its column.
10538
- ...fullBleedBlock(block) ? {} : cellAlignStyle(block.align),
10993
+ ...fullBleedBlock(block) ? {} : cellAlignStyle(block.align, block.type),
10539
10994
  // space-between: each column becomes a flex column whose content spreads over
10540
10995
  // the full row height instead of clumping at the top.
10541
10996
  ...distributed === "space-between" ? { display: "flex", flexDirection: "column", justifyContent: "space-between" } : {}
@@ -11177,9 +11632,10 @@ function applyAiSectionsToDom(state, options) {
11177
11632
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11178
11633
  continue;
11179
11634
  }
11180
- const isNewMount = !existing || !existing.container.isConnected;
11181
11635
  let container = existing?.container;
11636
+ let isNewMount = false;
11182
11637
  if (!container || !container.isConnected) {
11638
+ isNewMount = true;
11183
11639
  existing?.root.unmount();
11184
11640
  container?.remove();
11185
11641
  container = document.createElement("div");
@@ -11259,7 +11715,7 @@ import { createRoot as createRoot2 } from "react-dom/client";
11259
11715
  import { flushSync as flushSync2 } from "react-dom";
11260
11716
  import { jsx as jsx3 } from "react/jsx-runtime";
11261
11717
  var CONTAINER_ATTR2 = "data-ohw-ai-footer";
11262
- var HIDDEN_ATTR = "data-ohw-ai-footer-replaced";
11718
+ var HIDDEN_ATTR2 = "data-ohw-ai-footer-replaced";
11263
11719
  var mounted2 = null;
11264
11720
  var mountOptions = {};
11265
11721
  var capturedSurface;
@@ -11289,12 +11745,12 @@ function findTemplateFooter() {
11289
11745
  function hideTemplateFooter(footer) {
11290
11746
  if (!footer) return;
11291
11747
  footer.style.display = "none";
11292
- footer.setAttribute(HIDDEN_ATTR, "");
11748
+ footer.setAttribute(HIDDEN_ATTR2, "");
11293
11749
  }
11294
11750
  function showTemplateFooter() {
11295
- for (const el of document.querySelectorAll(`[${HIDDEN_ATTR}]`)) {
11751
+ for (const el of document.querySelectorAll(`[${HIDDEN_ATTR2}]`)) {
11296
11752
  el.style.removeProperty("display");
11297
- el.removeAttribute(HIDDEN_ATTR);
11753
+ el.removeAttribute(HIDDEN_ATTR2);
11298
11754
  }
11299
11755
  }
11300
11756
  function unmountAiFooter() {
@@ -11489,7 +11945,7 @@ function pickFooterColumnIndex(columnBlockCounts) {
11489
11945
  }
11490
11946
 
11491
11947
  // src/lib/ai-footer-edits.ts
11492
- function cloneTree(tree) {
11948
+ function cloneTree2(tree) {
11493
11949
  return JSON.parse(JSON.stringify(tree));
11494
11950
  }
11495
11951
  function rebalanceFooterColumnSpans(columns) {
@@ -11517,6 +11973,34 @@ function minSpanForFooterBlock(type) {
11517
11973
  return 3;
11518
11974
  }
11519
11975
  }
11976
+ function readLiveSocialItems() {
11977
+ const root = getFooterRoot();
11978
+ const row = root?.querySelector("[data-ohw-socials-row]");
11979
+ if (!row) return [];
11980
+ const items = [];
11981
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
11982
+ const href = anchor.getAttribute("href")?.trim() ?? "";
11983
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
11984
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
11985
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
11986
+ items.push({ platform, href });
11987
+ }
11988
+ return items;
11989
+ }
11990
+ function syncSocialRowsFromDom(tree) {
11991
+ const root = getFooterRoot();
11992
+ if (!root) return;
11993
+ const row = root.querySelector("[data-ohw-socials-row]");
11994
+ const live = readLiveSocialItems();
11995
+ if (row && live.length === 0) return;
11996
+ for (const col of tree.columns) {
11997
+ col.blocks = col.blocks.flatMap((block) => {
11998
+ if (block.type !== "social-row") return [block];
11999
+ if (!row) return [];
12000
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
12001
+ });
12002
+ }
12003
+ }
11520
12004
  function collectBrandBlocks(tree) {
11521
12005
  const brand = [];
11522
12006
  for (const col of tree.columns) {
@@ -11539,7 +12023,7 @@ function countFooterLinkLists(tree) {
11539
12023
  return collectLinkListBlocks(tree).length;
11540
12024
  }
11541
12025
  function packFooterTreeBrand(tree) {
11542
- const next = cloneTree(tree);
12026
+ const next = cloneTree2(tree);
11543
12027
  const brand = collectBrandBlocks(next);
11544
12028
  const lists = collectLinkListBlocks(next);
11545
12029
  if (lists.length === 0) {
@@ -11624,7 +12108,7 @@ function ensureFooterTree(tree, opts) {
11624
12108
  return tree ?? buildDefaultFooterTree(opts);
11625
12109
  }
11626
12110
  function appendFooterSocial(tree, entry) {
11627
- const next = cloneTree(tree);
12111
+ const next = cloneTree2(tree);
11628
12112
  const platform = entry.platform.trim().toLowerCase();
11629
12113
  const href = entry.href.trim();
11630
12114
  for (const col2 of next.columns) {
@@ -11653,7 +12137,7 @@ function appendFooterSocial(tree, entry) {
11653
12137
  return next;
11654
12138
  }
11655
12139
  function insertFooterHours(tree, hours, title = "Hours") {
11656
- const next = cloneTree(tree);
12140
+ const next = cloneTree2(tree);
11657
12141
  const idx = pickFooterColumnIndex(next.columns.map((c) => c.blocks.length));
11658
12142
  const col = next.columns[idx] ?? next.columns[0];
11659
12143
  if (!col) return next;
@@ -11680,7 +12164,7 @@ function addFooterLinkColumn(tree, column) {
11680
12164
  return next;
11681
12165
  }
11682
12166
  function removeFooterBlock(tree, predicate) {
11683
- const next = cloneTree(tree);
12167
+ const next = cloneTree2(tree);
11684
12168
  for (let c = 0; c < next.columns.length; c++) {
11685
12169
  const col = next.columns[c];
11686
12170
  if (!col) continue;
@@ -11716,7 +12200,7 @@ function foldAiFooterSlotOverride(tree, key, value) {
11716
12200
  const path = key.slice(prefix.length);
11717
12201
  const brandMatch = path.match(/^brand\.b(\d+)\.(.+)$/);
11718
12202
  if (!brandMatch) return null;
11719
- const next = cloneTree(tree);
12203
+ const next = cloneTree2(tree);
11720
12204
  const brands = [];
11721
12205
  for (const col of next.columns) {
11722
12206
  for (const block2 of col.blocks) {
@@ -11761,7 +12245,8 @@ function textOf2(el) {
11761
12245
  return (el?.textContent ?? "").replace(/\s+/g, " ").trim();
11762
12246
  }
11763
12247
  function syncFooterTreeLinksFromDom(tree) {
11764
- const next = cloneTree(tree);
12248
+ const next = cloneTree2(tree);
12249
+ syncSocialRowsFromDom(next);
11765
12250
  const domCols = listFooterColumns().map((col) => {
11766
12251
  const heading = getFooterColumnHeadingEl(col);
11767
12252
  const title = heading ? textOf2(heading) : void 0;
@@ -12242,7 +12727,7 @@ var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
12242
12727
  var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
12243
12728
  var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
12244
12729
  var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
12245
- var HIDDEN_ATTR2 = "data-ohw-placeholder-hidden";
12730
+ var HIDDEN_ATTR3 = "data-ohw-placeholder-hidden";
12246
12731
  function hasPlaceholder(text) {
12247
12732
  return HAS_PLACEHOLDER_RE.test(text);
12248
12733
  }
@@ -12261,10 +12746,10 @@ function skipped(el) {
12261
12746
  }
12262
12747
  function hideIfEmptied(el) {
12263
12748
  const control = el?.closest("a, button");
12264
- if (!control || control.hasAttribute(HIDDEN_ATTR2)) return;
12749
+ if (!control || control.hasAttribute(HIDDEN_ATTR3)) return;
12265
12750
  if ((control.textContent ?? "").trim()) return;
12266
12751
  if (control.querySelector("img, svg, picture, video")) return;
12267
- control.setAttribute(HIDDEN_ATTR2, "");
12752
+ control.setAttribute(HIDDEN_ATTR3, "");
12268
12753
  control.style.display = "none";
12269
12754
  }
12270
12755
  function stripElementAttrs(el) {
@@ -17413,10 +17898,10 @@ function ItemInteractionLayer({
17413
17898
  }
17414
17899
 
17415
17900
  // src/lib/forms.ts
17416
- var FORM_SELECTOR = '[data-ohw-editable="form"]';
17901
+ var FORM_SELECTOR2 = '[data-ohw-editable="form"]';
17417
17902
  function getFormElement(el) {
17418
17903
  if (!el) return null;
17419
- return el.closest(FORM_SELECTOR);
17904
+ return el.closest(FORM_SELECTOR2);
17420
17905
  }
17421
17906
  function formKeyOf(form) {
17422
17907
  return form.getAttribute("data-ohw-key");
@@ -17477,7 +17962,7 @@ function clearSubmitError(form) {
17477
17962
  if (note) note.style.display = "none";
17478
17963
  }
17479
17964
  var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
17480
- var HIDDEN_ATTR3 = "data-ohw-form-hidden";
17965
+ var HIDDEN_ATTR4 = "data-ohw-form-hidden";
17481
17966
  var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
17482
17967
  function formSuccessKey(formKey) {
17483
17968
  return `${formKey}-success`;
@@ -17503,13 +17988,13 @@ function setFormViewState(form, formKey, state, initialText) {
17503
17988
  Array.from(form.children).forEach((child) => {
17504
17989
  if (!(child instanceof HTMLElement) || child === success) return;
17505
17990
  if (state === "success") {
17506
- if (!child.hasAttribute(HIDDEN_ATTR3)) {
17507
- child.setAttribute(HIDDEN_ATTR3, child.style.display);
17991
+ if (!child.hasAttribute(HIDDEN_ATTR4)) {
17992
+ child.setAttribute(HIDDEN_ATTR4, child.style.display);
17508
17993
  child.style.display = "none";
17509
17994
  }
17510
- } else if (child.hasAttribute(HIDDEN_ATTR3)) {
17511
- child.style.display = child.getAttribute(HIDDEN_ATTR3) ?? "";
17512
- child.removeAttribute(HIDDEN_ATTR3);
17995
+ } else if (child.hasAttribute(HIDDEN_ATTR4)) {
17996
+ child.style.display = child.getAttribute(HIDDEN_ATTR4) ?? "";
17997
+ child.removeAttribute(HIDDEN_ATTR4);
17513
17998
  }
17514
17999
  });
17515
18000
  success.style.display = state === "success" ? "" : "none";
@@ -17528,7 +18013,7 @@ function bindPublishedForms(apiUrl, subdomain, content = {}) {
17528
18013
  "submit",
17529
18014
  async (e) => {
17530
18015
  const target = e.target;
17531
- const form = target?.closest(FORM_SELECTOR);
18016
+ const form = target?.closest(FORM_SELECTOR2);
17532
18017
  if (!form || !(form instanceof HTMLFormElement)) return;
17533
18018
  const formKey = formKeyOf(form);
17534
18019
  if (!formKey) return;
@@ -17574,7 +18059,7 @@ function apiBase() {
17574
18059
  function bridgeVersion() {
17575
18060
  try {
17576
18061
  if (true) {
17577
- return "0.1.171";
18062
+ return "0.1.172-next.457";
17578
18063
  }
17579
18064
  } catch {
17580
18065
  }
@@ -17588,7 +18073,7 @@ function stampBridgeVersionOnDocument() {
17588
18073
  return;
17589
18074
  }
17590
18075
  try {
17591
- const v = true ? "0.1.171" : "";
18076
+ const v = true ? "0.1.172-next.457" : "";
17592
18077
  if (v) {
17593
18078
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17594
18079
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -18159,7 +18644,7 @@ function FieldTypePicker({ onPick }) {
18159
18644
 
18160
18645
  // src/ui/MediaOverlay.tsx
18161
18646
  import * as React8 from "react";
18162
- import { Film, ImageIcon, Pause, Play as Play2, Volume2, VolumeX } from "lucide-react";
18647
+ import { Film, ImageIcon, Pause, Play as Play2, Trash2 as Trash23, Volume2, VolumeX } from "lucide-react";
18163
18648
 
18164
18649
  // src/ui/button.tsx
18165
18650
  import * as React7 from "react";
@@ -18249,6 +18734,7 @@ function MediaOverlay({
18249
18734
  onFadeOutComplete,
18250
18735
  onReplace,
18251
18736
  onSelect,
18737
+ onDelete,
18252
18738
  onVideoSettingsChange
18253
18739
  }) {
18254
18740
  const { rect } = hover;
@@ -18268,6 +18754,7 @@ function MediaOverlay({
18268
18754
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18269
18755
  );
18270
18756
  }, [isVideo]);
18757
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18271
18758
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18272
18759
  const box = {
18273
18760
  position: "fixed",
@@ -18366,11 +18853,10 @@ function MediaOverlay({
18366
18853
  className: "flex items-center justify-center cursor-pointer",
18367
18854
  style: {
18368
18855
  ...box,
18369
- // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18370
- // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18371
- // in-document, pointer-events does it natively. The button below opts back in, so
18372
- // Replace still works.
18373
- pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18856
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18857
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18858
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18859
+ pointerEvents: "none",
18374
18860
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18375
18861
  // than hovered. Hover keeps the existing tinted preview.
18376
18862
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18397,40 +18883,74 @@ function MediaOverlay({
18397
18883
  },
18398
18884
  children: [
18399
18885
  isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18400
- isVideo ? "Replace video" : "Replace image"
18886
+ replaceLabel
18401
18887
  ]
18402
18888
  }
18403
18889
  ),
18404
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ jsxs8(
18405
- Button,
18890
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ jsxs8(
18891
+ "div",
18406
18892
  {
18407
- "data-ohw-media-overlay": "",
18408
- variant: "outline",
18409
- size: "sm",
18410
- "aria-label": isVideo ? "Replace video" : "Replace image",
18411
- className: "gap-1.5 cursor-pointer hover:bg-background",
18893
+ className: "flex items-center gap-1.5",
18412
18894
  style: {
18413
- ...OVERLAY_BUTTON_STYLE,
18414
- // Icon-only is a square of the same height, so the pair can never differ vertically.
18415
- // `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
18416
- // minimum beats a width — the square came out wider than the avatar it sat on.
18417
- ...replaceMode === "icon" && buttonSize ? {
18418
- width: buttonSize.height,
18419
- minWidth: buttonSize.height,
18420
- padding: 0,
18421
- justifyContent: "center"
18422
- } : null,
18423
- // Don't let Replace steal clicks when text (e.g. nav) sits on top of this media.
18895
+ // Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
18424
18896
  pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
18425
18897
  },
18426
- onMouseDown: (e) => e.preventDefault(),
18427
- onClick: (e) => {
18428
- e.stopPropagation();
18429
- onReplace(hover.key);
18430
- },
18898
+ onClick: (e) => e.stopPropagation(),
18431
18899
  children: [
18432
- isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18433
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18900
+ /* @__PURE__ */ jsxs8(
18901
+ Button,
18902
+ {
18903
+ "data-ohw-media-overlay": "",
18904
+ variant: "outline",
18905
+ size: "sm",
18906
+ "aria-label": replaceLabel,
18907
+ className: "gap-1.5 cursor-pointer hover:bg-background",
18908
+ style: {
18909
+ ...OVERLAY_BUTTON_STYLE,
18910
+ // Icon-only is a square of the same height, so the pair can never differ vertically.
18911
+ // `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
18912
+ // minimum beats a width — the square came out wider than the avatar it sat on.
18913
+ ...replaceMode === "icon" && buttonSize ? {
18914
+ width: buttonSize.height,
18915
+ minWidth: buttonSize.height,
18916
+ padding: 0,
18917
+ justifyContent: "center"
18918
+ } : null
18919
+ },
18920
+ onMouseDown: (e) => e.preventDefault(),
18921
+ onClick: (e) => {
18922
+ e.stopPropagation();
18923
+ onReplace(hover.key);
18924
+ },
18925
+ children: [
18926
+ isVideo ? /* @__PURE__ */ jsx17(Film, { size: 14 }) : /* @__PURE__ */ jsx17(ImageIcon, { size: 14 }),
18927
+ replaceMode === "full" ? replaceLabel : null
18928
+ ]
18929
+ }
18930
+ ),
18931
+ selected && onDelete ? /* @__PURE__ */ jsx17(
18932
+ Button,
18933
+ {
18934
+ "data-ohw-media-overlay": "",
18935
+ variant: "outline",
18936
+ size: "sm",
18937
+ "aria-label": "Delete",
18938
+ title: "Delete",
18939
+ className: "cursor-pointer hover:bg-background",
18940
+ style: {
18941
+ ...OVERLAY_BUTTON_STYLE,
18942
+ minWidth: 0,
18943
+ padding: buttonSize ? `0 ${(buttonSize.height - 14) / 2}px` : "0 8px",
18944
+ height: buttonSize?.height
18945
+ },
18946
+ onMouseDown: (e) => e.preventDefault(),
18947
+ onClick: (e) => {
18948
+ e.stopPropagation();
18949
+ onDelete(hover.key);
18950
+ },
18951
+ children: /* @__PURE__ */ jsx17(Trash23, { size: 14 })
18952
+ }
18953
+ ) : null
18434
18954
  ]
18435
18955
  }
18436
18956
  )
@@ -19061,8 +19581,24 @@ function AiSectionOverlay({
19061
19581
  }
19062
19582
 
19063
19583
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19064
- import { useCallback as useCallback3, useEffect as useEffect9, useRef as useRef5, useState as useState8 } from "react";
19065
- import { Star } from "lucide-react";
19584
+ import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect4, useRef as useRef5, useState as useState8 } from "react";
19585
+ import {
19586
+ AlignCenter,
19587
+ AlignLeft,
19588
+ AlignRight,
19589
+ ArrowLeft as ArrowLeft2,
19590
+ ArrowRight as ArrowRight2,
19591
+ Check as Check2,
19592
+ ChevronDown as ChevronDown3,
19593
+ Image as ImageIcon2,
19594
+ ImageMinus,
19595
+ ImagePlus,
19596
+ Link as LinkIcon,
19597
+ Minus,
19598
+ Palette,
19599
+ Plus as Plus2,
19600
+ Star
19601
+ } from "lucide-react";
19066
19602
 
19067
19603
  // src/lib/ai-media-strip-tree.ts
19068
19604
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19176,14 +19712,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
19176
19712
  return true;
19177
19713
  });
19178
19714
  }
19179
- function setMediaStripItemAlt(tree, index, alt) {
19180
- return withMediaStrip(tree, (block) => {
19181
- const items = block.items;
19182
- if (index < 0 || index >= items.length) return false;
19183
- items[index] = { ...items[index], alt };
19184
- return true;
19185
- });
19186
- }
19187
19715
  function setMediaStripItemLink(tree, index, link) {
19188
19716
  return withMediaStrip(tree, (block) => {
19189
19717
  const items = block.items;
@@ -19201,11 +19729,117 @@ function setMediaStripItemLink(tree, index, link) {
19201
19729
  });
19202
19730
  }
19203
19731
 
19732
+ // src/ui/dialog.tsx
19733
+ import * as React9 from "react";
19734
+ import { Dialog as DialogPrimitive } from "radix-ui";
19735
+ import { X as X2 } from "lucide-react";
19736
+ import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19737
+ function Dialog2({
19738
+ ...props
19739
+ }) {
19740
+ return /* @__PURE__ */ jsx20(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
19741
+ }
19742
+ function DialogPortal({
19743
+ ...props
19744
+ }) {
19745
+ return /* @__PURE__ */ jsx20(DialogPrimitive.Portal, { ...props });
19746
+ }
19747
+ function DialogOverlay({
19748
+ className,
19749
+ ...props
19750
+ }) {
19751
+ return /* @__PURE__ */ jsx20(
19752
+ DialogPrimitive.Overlay,
19753
+ {
19754
+ "data-slot": "dialog-overlay",
19755
+ "data-ohw-link-modal-root": "",
19756
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19757
+ ...props
19758
+ }
19759
+ );
19760
+ }
19761
+ var DialogContent = React9.forwardRef(
19762
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19763
+ const positionMode = container ? "absolute" : "fixed";
19764
+ return /* @__PURE__ */ jsxs11(DialogPortal, { container: container ?? void 0, children: [
19765
+ /* @__PURE__ */ jsx20(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19766
+ /* @__PURE__ */ jsxs11(
19767
+ DialogPrimitive.Content,
19768
+ {
19769
+ ref,
19770
+ "data-slot": "dialog-content",
19771
+ className: cn(
19772
+ positionMode,
19773
+ "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",
19774
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19775
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19776
+ className
19777
+ ),
19778
+ onMouseDown: (e) => e.stopPropagation(),
19779
+ ...props,
19780
+ children: [
19781
+ children,
19782
+ showCloseButton ? /* @__PURE__ */ jsx20(
19783
+ DialogPrimitive.Close,
19784
+ {
19785
+ type: "button",
19786
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19787
+ "aria-label": "Close",
19788
+ children: /* @__PURE__ */ jsx20(X2, { size: 16, "aria-hidden": true })
19789
+ }
19790
+ ) : null
19791
+ ]
19792
+ }
19793
+ )
19794
+ ] });
19795
+ }
19796
+ );
19797
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
19798
+ function DialogHeader({
19799
+ className,
19800
+ ...props
19801
+ }) {
19802
+ return /* @__PURE__ */ jsx20("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19803
+ }
19804
+ function DialogFooter({
19805
+ className,
19806
+ ...props
19807
+ }) {
19808
+ return /* @__PURE__ */ jsx20(
19809
+ "div",
19810
+ {
19811
+ className: cn("flex items-center justify-end gap-2", className),
19812
+ ...props
19813
+ }
19814
+ );
19815
+ }
19816
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19817
+ DialogPrimitive.Title,
19818
+ {
19819
+ ref,
19820
+ className: cn(
19821
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19822
+ className
19823
+ ),
19824
+ ...props
19825
+ }
19826
+ ));
19827
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
19828
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx20(
19829
+ DialogPrimitive.Description,
19830
+ {
19831
+ ref,
19832
+ className: cn("text-sm text-muted-foreground", className),
19833
+ ...props
19834
+ }
19835
+ ));
19836
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
19837
+ var DialogClose = DialogPrimitive.Close;
19838
+
19204
19839
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19205
- import { Fragment as Fragment7, jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
19206
- var PRIMARY3 = "#0885FE";
19207
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19208
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19840
+ import { Fragment as Fragment7, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
19841
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19842
+ 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]";
19209
19843
  function findMediaStripItemElement(sectionId, index) {
19210
19844
  const sectionEl2 = findByInstanceId(sectionId);
19211
19845
  if (!sectionEl2) return null;
@@ -19215,14 +19849,35 @@ function findMediaStripItemElement(sectionId, index) {
19215
19849
  }
19216
19850
  return null;
19217
19851
  }
19218
- function readRect2(ref) {
19219
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19852
+ function itemRefFromTarget(target) {
19853
+ if (!(target instanceof Element)) return null;
19854
+ if (target.closest(CHROME_SELECTOR)) return null;
19855
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19856
+ if (!itemEl) return null;
19857
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19858
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19859
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19860
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19861
+ if (!sectionId || Number.isNaN(index)) return null;
19862
+ return { sectionId, index };
19863
+ }
19864
+ function sameRef(a, b) {
19865
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19866
+ }
19867
+ function rectOf(el) {
19220
19868
  if (!el) return null;
19221
19869
  const r2 = el.getBoundingClientRect();
19222
19870
  if (r2.width <= 0 || r2.height <= 0) return null;
19223
19871
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19224
19872
  }
19225
- function useLiveItemRect(ref) {
19873
+ function readRect2(ref) {
19874
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19875
+ }
19876
+ function readStripRect(ref) {
19877
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19878
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19879
+ }
19880
+ function useLiveItemRect(ref, strip = false) {
19226
19881
  const [rect, setRect] = useState8(null);
19227
19882
  useEffect9(() => {
19228
19883
  if (!ref) {
@@ -19230,7 +19885,7 @@ function useLiveItemRect(ref) {
19230
19885
  return;
19231
19886
  }
19232
19887
  const update = () => {
19233
- const next = readRect2(ref);
19888
+ const next = strip ? readStripRect(ref) : readRect2(ref);
19234
19889
  setRect(
19235
19890
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19236
19891
  );
@@ -19245,9 +19900,49 @@ function useLiveItemRect(ref) {
19245
19900
  window.removeEventListener("resize", update);
19246
19901
  clearInterval(interval);
19247
19902
  };
19248
- }, [ref?.sectionId, ref?.index]);
19903
+ }, [ref?.sectionId, ref?.index, strip]);
19249
19904
  return rect;
19250
19905
  }
19906
+ var TOOLBAR_STRIP_GAP = 52;
19907
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19908
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19909
+ function StripToolbarSlot({ stripRect, children }) {
19910
+ const slotRef = useRef5(null);
19911
+ const [shift, setShift] = useState8(0);
19912
+ const centerX = stripRect.left + stripRect.width / 2;
19913
+ useLayoutEffect4(() => {
19914
+ const slot = slotRef.current;
19915
+ if (!slot) return;
19916
+ const clamp = () => {
19917
+ const w = slot.offsetWidth;
19918
+ if (w <= 0) return;
19919
+ const half = w / 2;
19920
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19921
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19922
+ };
19923
+ clamp();
19924
+ const ro = new ResizeObserver(clamp);
19925
+ ro.observe(slot);
19926
+ return () => ro.disconnect();
19927
+ }, [centerX, children]);
19928
+ const mobile = window.innerWidth <= 480;
19929
+ return /* @__PURE__ */ jsx21(
19930
+ "div",
19931
+ {
19932
+ ref: slotRef,
19933
+ "data-ohw-bridge": "",
19934
+ "data-ohw-item-interaction": "",
19935
+ className: "pointer-events-auto fixed",
19936
+ style: {
19937
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
19938
+ left: centerX + shift,
19939
+ transform: "translate(-50%, -100%)",
19940
+ zIndex: 2147483645
19941
+ },
19942
+ children
19943
+ }
19944
+ );
19945
+ }
19251
19946
  function requestValidateTree(postToParent2, tree) {
19252
19947
  return new Promise((resolve) => {
19253
19948
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19284,116 +19979,72 @@ function requestAssetPick(postToParent2) {
19284
19979
  postToParent2({ type: "ow:asset-pick", id });
19285
19980
  });
19286
19981
  }
19287
- function Pill({
19982
+ function ToolbarAction({
19288
19983
  label,
19289
19984
  onClick,
19290
- disabled,
19291
- active
19985
+ disabled = false,
19986
+ active = false,
19987
+ children
19292
19988
  }) {
19293
- return /* @__PURE__ */ jsx20(
19294
- "button",
19295
- {
19296
- type: "button",
19297
- onClick,
19298
- disabled,
19299
- style: {
19300
- height: 28,
19301
- padding: "0 10px",
19302
- display: "inline-flex",
19303
- alignItems: "center",
19304
- gap: 4,
19305
- borderRadius: 999,
19306
- border: "none",
19307
- cursor: disabled ? "default" : "pointer",
19308
- background: active ? OHW_BLUE_DARK : "#ffffff",
19309
- color: active ? "#ffffff" : OHW_BLUE_DARK,
19310
- opacity: disabled ? 0.4 : 1,
19311
- fontSize: 12,
19312
- lineHeight: "16px",
19313
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19314
- whiteSpace: "nowrap",
19315
- flex: "0 0 auto"
19316
- },
19317
- children: label
19318
- }
19319
- );
19989
+ const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
19990
+ return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19991
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19992
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19993
+ ] });
19320
19994
  }
19321
- function AltInput({ value, onCommit }) {
19322
- const [draft, setDraft] = useState8(value);
19323
- useEffect9(() => setDraft(value), [value]);
19324
- return /* @__PURE__ */ jsxs11(
19325
- "div",
19326
- {
19327
- style: {
19328
- display: "flex",
19329
- alignItems: "center",
19330
- gap: 6,
19331
- height: 28,
19332
- padding: "0 12px",
19333
- borderRadius: 999,
19334
- background: "#ffffff",
19335
- width: "100%",
19336
- maxWidth: 260,
19337
- boxSizing: "border-box"
19338
- },
19339
- children: [
19340
- /* @__PURE__ */ jsx20(
19341
- "span",
19342
- {
19343
- style: {
19344
- flex: "0 0 auto",
19345
- color: OHW_BLUE_DARK,
19346
- fontSize: 10,
19347
- fontWeight: 700,
19348
- textTransform: "uppercase",
19349
- letterSpacing: 0.4
19350
- },
19351
- children: "Alt"
19352
- }
19353
- ),
19354
- /* @__PURE__ */ jsx20(
19355
- "input",
19995
+ function ToolbarSeparator() {
19996
+ return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19997
+ }
19998
+ function OptionMenu({
19999
+ label,
20000
+ value,
20001
+ options,
20002
+ onChange
20003
+ }) {
20004
+ const current = options.find((o) => o.value === value) ?? options[0];
20005
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20006
+ /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: label }),
20007
+ /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
20008
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
20009
+ "button",
20010
+ {
20011
+ type: "button",
20012
+ "aria-label": label,
20013
+ 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",
20014
+ children: [
20015
+ /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
20016
+ /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20017
+ ]
20018
+ }
20019
+ ) }),
20020
+ /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
20021
+ const selected = option.value === value;
20022
+ return /* @__PURE__ */ jsxs12(
20023
+ DropdownMenuItem,
19356
20024
  {
19357
- type: "text",
19358
- value: draft,
19359
- onChange: (e) => setDraft(e.target.value),
19360
- onBlur: () => {
19361
- if (draft !== value) onCommit(draft);
19362
- },
19363
- onKeyDown: (e) => {
19364
- if (e.key === "Enter") e.currentTarget.blur();
19365
- if (e.key === "Escape") {
19366
- setDraft(value);
19367
- e.currentTarget.blur();
19368
- }
19369
- },
19370
- placeholder: "Describe this image",
19371
- "aria-label": "Image alt text",
19372
- style: {
19373
- flex: 1,
19374
- minWidth: 0,
19375
- border: "none",
19376
- outline: "none",
19377
- background: "transparent",
19378
- fontSize: 12,
19379
- lineHeight: "16px",
19380
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19381
- color: "#1f2937"
19382
- }
19383
- }
19384
- )
19385
- ]
19386
- }
19387
- );
20025
+ role: "menuitemradio",
20026
+ "aria-checked": selected,
20027
+ onSelect: () => onChange(option.value),
20028
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20029
+ children: [
20030
+ /* @__PURE__ */ jsx21("span", { children: option.label }),
20031
+ selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20032
+ ]
20033
+ },
20034
+ option.value
20035
+ );
20036
+ }) })
20037
+ ] })
20038
+ ] });
19388
20039
  }
19389
20040
  var VARIANTS = [
19390
20041
  { value: "logos", label: "Logos" },
19391
20042
  { value: "reel", label: "Reel" }
19392
20043
  ];
19393
20044
  var ALIGNS = [
19394
- { value: "left", label: "Left" },
19395
- { value: "center", label: "Center" },
19396
- { value: "right", label: "Right" }
20045
+ { value: "left", label: "Align left", Icon: AlignLeft },
20046
+ { value: "center", label: "Align center", Icon: AlignCenter },
20047
+ { value: "right", label: "Align right", Icon: AlignRight }
19397
20048
  ];
19398
20049
  var HOVERS = [
19399
20050
  { value: "none", label: "None" },
@@ -19401,104 +20052,104 @@ var HOVERS = [
19401
20052
  { value: "zoom", label: "Zoom" },
19402
20053
  { value: "fade", label: "Fade" }
19403
20054
  ];
19404
- var TREATMENTS = [
19405
- { value: "color", label: "Color" },
19406
- { value: "grayscale", label: "Grayscale" }
19407
- ];
19408
20055
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19409
- function LinkInput({ value, onCommit }) {
19410
- const [draft, setDraft] = useState8(value);
20056
+ function LinkModal({
20057
+ href,
20058
+ linkTarget,
20059
+ onClose,
20060
+ onSave
20061
+ }) {
20062
+ const [draft, setDraft] = useState8(href);
20063
+ const [newTab, setNewTab] = useState8(linkTarget !== "same-tab");
19411
20064
  const [invalid, setInvalid] = useState8(false);
19412
- useEffect9(() => {
19413
- setDraft(value);
19414
- setInvalid(false);
19415
- }, [value]);
19416
- const commit2 = () => {
20065
+ const save = () => {
19417
20066
  const next = draft.trim();
19418
- if (next === value) return setInvalid(false);
19419
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19420
- setInvalid(false);
19421
- onCommit(next);
19422
- };
19423
- return /* @__PURE__ */ jsxs11(
19424
- "div",
19425
- {
19426
- style: {
19427
- display: "flex",
19428
- alignItems: "center",
19429
- gap: 6,
19430
- height: 28,
19431
- padding: "0 12px",
19432
- borderRadius: 999,
19433
- background: "#ffffff",
19434
- width: "100%",
19435
- maxWidth: 260,
19436
- boxSizing: "border-box",
19437
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19438
- },
19439
- children: [
19440
- /* @__PURE__ */ jsx20(
19441
- "span",
19442
- {
19443
- style: {
19444
- flex: "0 0 auto",
19445
- color: OHW_BLUE_DARK,
19446
- fontSize: 10,
19447
- fontWeight: 700,
19448
- textTransform: "uppercase",
19449
- letterSpacing: 0.4
19450
- },
19451
- children: "Link"
19452
- }
19453
- ),
19454
- /* @__PURE__ */ jsx20(
19455
- "input",
19456
- {
19457
- type: "text",
19458
- inputMode: "url",
19459
- value: draft,
19460
- onChange: (e) => setDraft(e.target.value),
19461
- onBlur: commit2,
19462
- onKeyDown: (e) => {
19463
- if (e.key === "Enter") e.currentTarget.blur();
19464
- if (e.key === "Escape") {
19465
- setDraft(value);
19466
- setInvalid(false);
19467
- e.currentTarget.blur();
19468
- }
19469
- },
19470
- placeholder: "https://example.com",
19471
- "aria-label": "Image link URL",
19472
- "aria-invalid": invalid,
19473
- style: {
19474
- flex: 1,
19475
- minWidth: 0,
19476
- border: "none",
19477
- outline: "none",
19478
- background: "transparent",
19479
- fontSize: 12,
19480
- lineHeight: "16px",
19481
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19482
- color: "#1f2937"
19483
- }
19484
- }
19485
- )
19486
- ]
20067
+ if (next && !HTTP_URL_RE.test(next)) {
20068
+ setInvalid(true);
20069
+ return;
19487
20070
  }
19488
- );
20071
+ onSave(next, newTab ? "new-tab" : "same-tab");
20072
+ onClose();
20073
+ };
20074
+ 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: [
20075
+ /* @__PURE__ */ jsx21(DialogHeader, { children: /* @__PURE__ */ jsx21(DialogTitle, { className: "text-base", children: "Image link" }) }),
20076
+ /* @__PURE__ */ jsxs12("div", { className: "flex flex-col gap-3", children: [
20077
+ /* @__PURE__ */ jsx21(
20078
+ "input",
20079
+ {
20080
+ autoFocus: true,
20081
+ type: "text",
20082
+ inputMode: "url",
20083
+ value: draft,
20084
+ onChange: (e) => {
20085
+ setDraft(e.target.value);
20086
+ setInvalid(false);
20087
+ },
20088
+ onKeyDown: (e) => {
20089
+ if (e.key === "Enter") save();
20090
+ },
20091
+ placeholder: "https://example.com",
20092
+ "aria-label": "Image link URL",
20093
+ "aria-invalid": invalid,
20094
+ className: cn(
20095
+ "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",
20096
+ invalid && "border-destructive focus:border-destructive"
20097
+ )
20098
+ }
20099
+ ),
20100
+ invalid && /* @__PURE__ */ jsx21("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
20101
+ /* @__PURE__ */ jsxs12("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
20102
+ /* @__PURE__ */ jsx21("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
20103
+ "Open in new tab"
20104
+ ] })
20105
+ ] }),
20106
+ /* @__PURE__ */ jsxs12(DialogFooter, { children: [
20107
+ href && /* @__PURE__ */ jsx21(
20108
+ "button",
20109
+ {
20110
+ type: "button",
20111
+ onClick: () => {
20112
+ onSave("", "new-tab");
20113
+ onClose();
20114
+ },
20115
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
20116
+ children: "Remove link"
20117
+ }
20118
+ ),
20119
+ /* @__PURE__ */ jsx21(
20120
+ "button",
20121
+ {
20122
+ type: "button",
20123
+ onClick: onClose,
20124
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
20125
+ children: "Cancel"
20126
+ }
20127
+ ),
20128
+ /* @__PURE__ */ jsx21(
20129
+ "button",
20130
+ {
20131
+ type: "button",
20132
+ onClick: save,
20133
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
20134
+ children: "Save"
20135
+ }
20136
+ )
20137
+ ] })
20138
+ ] }) });
19489
20139
  }
19490
20140
  function MediaStripToolbar({
19491
20141
  entry,
19492
20142
  index,
19493
20143
  pending,
19494
20144
  error,
20145
+ itemEditOn,
20146
+ onToggleItemEdit,
19495
20147
  onSetVariant,
19496
20148
  onSetAlign,
19497
20149
  onSetHover,
19498
20150
  onSetTreatment,
19499
20151
  onResize,
19500
- onSetAlt,
19501
- onSetLink,
20152
+ onOpenLink,
19502
20153
  onAddItem,
19503
20154
  onRemoveItem,
19504
20155
  onChangeImage,
@@ -19507,81 +20158,102 @@ function MediaStripToolbar({
19507
20158
  }) {
19508
20159
  const items = mediaStripItems(entry.tree);
19509
20160
  const itemCount = items.length;
19510
- const currentAlt = items[index]?.alt ?? "";
19511
- const currentHref2 = items[index]?.href ?? "";
19512
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19513
20161
  const slots = findMediaStripSlots(entry.tree);
19514
20162
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19515
20163
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19516
20164
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19517
20165
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19518
20166
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19519
- const isMobile = window.innerWidth <= 480;
19520
- const rowStyle = isMobile ? {
19521
- display: "flex",
19522
- gap: 6,
19523
- flexWrap: "nowrap",
19524
- justifyContent: "center",
19525
- overflowX: "auto",
19526
- WebkitOverflowScrolling: "touch",
19527
- width: "100%",
19528
- scrollbarWidth: "none"
19529
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19530
- return /* @__PURE__ */ jsxs11(
20167
+ const mobile = window.innerWidth <= 480;
20168
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
20169
+ return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
19531
20170
  "div",
19532
20171
  {
19533
20172
  "data-ohw-bridge": "",
19534
20173
  "data-ohw-toolbar": "",
19535
20174
  onMouseDown: (e) => e.stopPropagation(),
19536
- style: {
19537
- display: "flex",
19538
- flexDirection: "column",
19539
- gap: 6,
19540
- alignItems: "center",
19541
- background: OHW_BLUE,
19542
- padding: 8,
19543
- borderRadius: 12,
19544
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19545
- pointerEvents: pending ? "none" : "auto",
19546
- opacity: pending ? 0.6 : 1,
19547
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19548
- },
20175
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
20176
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19549
20177
  children: [
19550
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19551
- VARIANTS.map((v) => /* @__PURE__ */ jsx20(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19552
- ALIGNS.map((a) => /* @__PURE__ */ jsx20(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19553
- ] }),
19554
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19555
- HOVERS.map((h) => /* @__PURE__ */ jsx20(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19556
- TREATMENTS.map((t) => /* @__PURE__ */ jsx20(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19557
- ] }),
19558
- /* @__PURE__ */ jsxs11("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19559
- /* @__PURE__ */ jsx20(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19560
- /* @__PURE__ */ jsxs11("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19561
- sizeValue,
19562
- "px"
19563
- ] }),
19564
- /* @__PURE__ */ jsx20(Pill, { label: "+", onClick: () => onResize(8) })
19565
- ] }),
19566
- /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19567
- /* @__PURE__ */ jsx20("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx20(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19568
- currentHref2 && /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19569
- /* @__PURE__ */ jsx20(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19570
- /* @__PURE__ */ jsx20(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19571
- ] }),
19572
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19573
- /* @__PURE__ */ jsx20(Pill, { label: "Change Image", onClick: onChangeImage }),
19574
- /* @__PURE__ */ jsx20(Pill, { label: "+ Item", onClick: onAddItem }),
19575
- /* @__PURE__ */ jsx20(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19576
- ] }),
19577
- /* @__PURE__ */ jsxs11("div", { style: rowStyle, children: [
19578
- /* @__PURE__ */ jsx20(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19579
- /* @__PURE__ */ jsx20(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19580
- ] }),
19581
- error && /* @__PURE__ */ jsx20("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20178
+ /* @__PURE__ */ jsxs12(
20179
+ "div",
20180
+ {
20181
+ className: cn(
20182
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
20183
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
20184
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
20185
+ ),
20186
+ children: [
20187
+ /* @__PURE__ */ jsxs12(Tooltip, { children: [
20188
+ /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20189
+ CustomToolbarButton,
20190
+ {
20191
+ type: "button",
20192
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
20193
+ "aria-pressed": itemEditOn,
20194
+ onClick: onToggleItemEdit,
20195
+ className: "group size-8",
20196
+ children: /* @__PURE__ */ jsx21(
20197
+ Star,
20198
+ {
20199
+ size: 16,
20200
+ fill: "currentColor",
20201
+ strokeWidth: 0,
20202
+ className: cn(
20203
+ "transition-colors",
20204
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
20205
+ ),
20206
+ style: { pointerEvents: "none" }
20207
+ }
20208
+ )
20209
+ }
20210
+ ) }),
20211
+ /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
20212
+ ] }),
20213
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20214
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(ImageIcon2, { size: 16, style: { pointerEvents: "none" } }) }),
20215
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ jsx21(LinkIcon, { size: 16, style: { pointerEvents: "none" } }) }),
20216
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ jsx21(ArrowLeft2, { size: 16, style: { pointerEvents: "none" } }) }),
20217
+ /* @__PURE__ */ jsx21(
20218
+ ToolbarAction,
20219
+ {
20220
+ label: gatedLabel("Move right"),
20221
+ onClick: onMoveRight,
20222
+ disabled: !itemEditOn || index >= itemCount - 1,
20223
+ children: /* @__PURE__ */ jsx21(ArrowRight2, { size: 16, style: { pointerEvents: "none" } })
20224
+ }
20225
+ ),
20226
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ jsx21(ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
20227
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20228
+ /* @__PURE__ */ jsx21(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
20229
+ /* @__PURE__ */ jsx21(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
20230
+ /* @__PURE__ */ jsx21(
20231
+ ToolbarAction,
20232
+ {
20233
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
20234
+ active: treatment === "grayscale",
20235
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
20236
+ children: /* @__PURE__ */ jsx21(Palette, { size: 16, style: { pointerEvents: "none" } })
20237
+ }
20238
+ ),
20239
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20240
+ 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)),
20241
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20242
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) }),
20243
+ /* @__PURE__ */ jsxs12("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
20244
+ sizeValue,
20245
+ "px"
20246
+ ] }),
20247
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
20248
+ /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20249
+ /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ jsx21(ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
20250
+ ]
20251
+ }
20252
+ ),
20253
+ 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 })
19582
20254
  ]
19583
20255
  }
19584
- );
20256
+ ) });
19585
20257
  }
19586
20258
  function findMediaStripSlots(tree) {
19587
20259
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19600,31 +20272,23 @@ function AiMediaStripOverlay({
19600
20272
  }) {
19601
20273
  const [hover, setHover] = useState8(null);
19602
20274
  const [active, setActive] = useState8(null);
20275
+ const [itemEditOn, setItemEditOn] = useState8(false);
20276
+ const [linkOpen, setLinkOpen] = useState8(false);
19603
20277
  const [pending, setPending] = useState8(false);
19604
20278
  const [error, setError] = useState8(null);
19605
20279
  const activeRef = useRef5(null);
19606
20280
  activeRef.current = active;
20281
+ const linkOpenRef = useRef5(false);
20282
+ linkOpenRef.current = linkOpen;
19607
20283
  useEffect9(() => {
19608
20284
  const onMove = (e) => {
20285
+ const ref = itemRefFromTarget(e.target);
19609
20286
  const t = e.target;
19610
- if (!(t instanceof HTMLElement)) return;
19611
- 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]")) {
19612
- return;
19613
- }
19614
- const itemEl = t.closest("[data-ohw-media-strip-item]");
19615
- if (!itemEl) {
19616
- setHover(null);
19617
- return;
19618
- }
19619
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19620
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19621
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19622
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19623
- if (!sectionId || Number.isNaN(index)) {
19624
- setHover(null);
19625
- return;
19626
- }
19627
- setHover({ sectionId, index });
20287
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
20288
+ setHover((prev) => {
20289
+ const next = ref && !overEditable ? ref : null;
20290
+ return sameRef(prev, next) ? prev : next;
20291
+ });
19628
20292
  };
19629
20293
  const onLeave = () => setHover(null);
19630
20294
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19636,23 +20300,25 @@ function AiMediaStripOverlay({
19636
20300
  }, []);
19637
20301
  useEffect9(() => {
19638
20302
  const onClick = (e) => {
19639
- const current = activeRef.current;
19640
- if (!current) return;
19641
20303
  const t = e.target;
19642
- if (!(t instanceof HTMLElement)) return;
19643
- if (t.closest("[data-ohw-item-interaction]")) return;
19644
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19645
- if (itemEl && itemEl.contains(t)) return;
19646
- setActive(null);
20304
+ if (!(t instanceof Element)) return;
20305
+ if (t.closest(CHROME_SELECTOR)) return;
20306
+ const ref = itemRefFromTarget(t);
20307
+ if (sameRef(activeRef.current, ref)) return;
20308
+ if (ref) clearInteractionChromeRef.current();
20309
+ setItemEditOn(false);
19647
20310
  setError(null);
20311
+ setActive(ref);
19648
20312
  };
19649
20313
  document.addEventListener("click", onClick, true);
19650
20314
  return () => document.removeEventListener("click", onClick, true);
19651
- }, []);
20315
+ }, [clearInteractionChromeRef]);
19652
20316
  useEffect9(() => {
19653
20317
  const onBlur = () => {
19654
20318
  if (!activeRef.current) return;
19655
20319
  setActive(null);
20320
+ setItemEditOn(false);
20321
+ setLinkOpen(false);
19656
20322
  setError(null);
19657
20323
  };
19658
20324
  window.addEventListener("blur", onBlur);
@@ -19662,7 +20328,10 @@ function AiMediaStripOverlay({
19662
20328
  const onKeyDown = (e) => {
19663
20329
  if (e.key !== "Escape") return;
19664
20330
  if (!activeRef.current) return;
20331
+ if (linkOpenRef.current) return;
20332
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19665
20333
  setActive(null);
20334
+ setItemEditOn(false);
19666
20335
  setError(null);
19667
20336
  };
19668
20337
  document.addEventListener("keydown", onKeyDown);
@@ -19696,137 +20365,133 @@ function AiMediaStripOverlay({
19696
20365
  tree: nextTree,
19697
20366
  label: entry.label,
19698
20367
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19699
- ...entry.brand ? { brand: entry.brand } : {}
20368
+ ...entry.brand ? { brand: entry.brand } : {},
20369
+ // The user is already looking at the strip they just edited — recentering the viewport
20370
+ // on every edit reads as the section jumping around.
20371
+ skipScrollIntoView: true
19700
20372
  });
19701
20373
  return true;
19702
20374
  },
19703
20375
  [findEntry, postToParent2, applyTreeLocalRef]
19704
20376
  );
19705
20377
  const activeEntry = active ? findEntry(active.sectionId) : null;
19706
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19707
20378
  const activeItemRect = useLiveItemRect(active);
19708
- const TOOLBAR_APPROX_H = 170;
19709
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19710
- return /* @__PURE__ */ jsxs11(Fragment7, { children: [
19711
- hoverHandleRect && hover && /* @__PURE__ */ jsx20(
19712
- "button",
19713
- {
19714
- type: "button",
19715
- "data-ohw-toolbar": "",
19716
- onClick: () => {
19717
- clearInteractionChromeRef.current();
19718
- setActive(hover);
19719
- },
19720
- "aria-label": "Configure media item",
19721
- style: {
19722
- position: "fixed",
19723
- top: hoverHandleRect.top + 8,
19724
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
19725
- width: 28,
19726
- height: 28,
19727
- borderRadius: 8,
19728
- border: `1.5px dashed ${PRIMARY3}`,
19729
- background: "#ffffff",
19730
- color: PRIMARY3,
19731
- display: "flex",
19732
- alignItems: "center",
19733
- justifyContent: "center",
19734
- cursor: "pointer",
19735
- zIndex: 2147483643,
19736
- fontSize: 14,
19737
- fontWeight: 700
19738
- },
19739
- children: /* @__PURE__ */ jsx20(Star, { size: 14, style: { pointerEvents: "none" } })
19740
- }
19741
- ),
19742
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx20(
19743
- ItemInteractionLayer,
19744
- {
19745
- rect: activeItemRect,
19746
- state: toolbarState,
19747
- toolbar: /* @__PURE__ */ jsx20(
19748
- MediaStripToolbar,
19749
- {
19750
- entry: activeEntry,
19751
- index: active.index,
19752
- pending,
19753
- error,
19754
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19755
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19756
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19757
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19758
- onResize: (delta) => {
19759
- const slots = findMediaStripSlots(activeEntry.tree);
19760
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19761
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19762
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19763
- },
19764
- onSetAlt: (alt) => {
19765
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19766
- },
19767
- onSetLink: (href, linkTarget) => {
20379
+ const activeStripRect = useLiveItemRect(active, true);
20380
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
20381
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
20382
+ const activeItem = active ? activeItems[active.index] : void 0;
20383
+ const activeHref = activeItem?.href ?? "";
20384
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
20385
+ return /* @__PURE__ */ jsxs12(Fragment7, { children: [
20386
+ hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20387
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment7, { children: [
20388
+ /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
20389
+ /* @__PURE__ */ jsx21(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ jsx21(
20390
+ MediaStripToolbar,
20391
+ {
20392
+ entry: activeEntry,
20393
+ index: active.index,
20394
+ pending,
20395
+ error,
20396
+ itemEditOn,
20397
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
20398
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
20399
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
20400
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
20401
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
20402
+ onResize: (delta) => {
20403
+ const slots = findMediaStripSlots(activeEntry.tree);
20404
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
20405
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
20406
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
20407
+ },
20408
+ onOpenLink: () => setLinkOpen(true),
20409
+ onAddItem: () => {
20410
+ void requestAssetPick(postToParent2).then((picked) => {
20411
+ if (!picked) return;
20412
+ const item = { assetId: picked.assetId, alt: "Logo" };
19768
20413
  void runMutation(
19769
20414
  active.sectionId,
19770
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19771
- );
19772
- },
19773
- onAddItem: () => {
19774
- void requestAssetPick(postToParent2).then((picked) => {
19775
- if (!picked) return;
19776
- const item = { assetId: picked.assetId, alt: "Logo" };
19777
- void runMutation(
19778
- active.sectionId,
19779
- (tree) => addMediaStripItem(tree, item, active.index),
19780
- { [picked.assetId]: picked.url }
19781
- ).then((applied) => {
19782
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19783
- });
20415
+ (tree) => addMediaStripItem(tree, item, active.index),
20416
+ { [picked.assetId]: picked.url }
20417
+ ).then((applied) => {
20418
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19784
20419
  });
19785
- },
19786
- onChangeImage: () => {
19787
- void requestAssetPick(postToParent2).then((picked) => {
19788
- if (!picked) return;
19789
- void runMutation(
19790
- active.sectionId,
19791
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19792
- { [picked.assetId]: picked.url }
19793
- );
19794
- });
19795
- },
19796
- onRemoveItem: () => {
19797
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19798
- (applied) => {
19799
- if (applied) setActive(null);
19800
- }
19801
- );
19802
- },
19803
- onMoveLeft: () => {
19804
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19805
- (applied) => {
19806
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19807
- }
19808
- );
19809
- },
19810
- onMoveRight: () => {
19811
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19812
- (applied) => {
19813
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19814
- }
20420
+ });
20421
+ },
20422
+ onChangeImage: () => {
20423
+ void requestAssetPick(postToParent2).then((picked) => {
20424
+ if (!picked) return;
20425
+ void runMutation(
20426
+ active.sectionId,
20427
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
20428
+ { [picked.assetId]: picked.url }
19815
20429
  );
19816
- }
20430
+ });
20431
+ },
20432
+ onRemoveItem: () => {
20433
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
20434
+ (applied) => {
20435
+ if (applied) setActive(null);
20436
+ }
20437
+ );
20438
+ },
20439
+ onMoveLeft: () => {
20440
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
20441
+ (applied) => {
20442
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
20443
+ }
20444
+ );
20445
+ },
20446
+ onMoveRight: () => {
20447
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20448
+ (applied) => {
20449
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20450
+ }
20451
+ );
19817
20452
  }
19818
- )
19819
- }
19820
- )
20453
+ }
20454
+ ) }),
20455
+ /* @__PURE__ */ jsx21(
20456
+ "div",
20457
+ {
20458
+ "data-ohw-bridge": "",
20459
+ "data-ohw-item-interaction": "",
20460
+ "aria-hidden": true,
20461
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20462
+ style: {
20463
+ top: activeItemRect.top + activeItemRect.height + 10,
20464
+ left: activeItemRect.left - 5,
20465
+ background: PRIMARY3,
20466
+ zIndex: 2147483644
20467
+ },
20468
+ children: "Media item"
20469
+ }
20470
+ ),
20471
+ linkOpen && /* @__PURE__ */ jsx21(
20472
+ LinkModal,
20473
+ {
20474
+ href: activeHref,
20475
+ linkTarget: activeTarget,
20476
+ onClose: () => setLinkOpen(false),
20477
+ onSave: (href, linkTarget) => {
20478
+ void runMutation(
20479
+ active.sectionId,
20480
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20481
+ );
20482
+ }
20483
+ }
20484
+ )
20485
+ ] })
19821
20486
  ] });
19822
20487
  }
19823
20488
 
19824
20489
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19825
- import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect4, useRef as useRef6, useState as useState9 } from "react";
19826
- import { Check as Check2, ChevronDown as ChevronDown3, Minus, Plus as Plus2, Star as Star2 } from "lucide-react";
19827
- import { Fragment as Fragment8, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
20490
+ import { useCallback as useCallback4, useEffect as useEffect10, useLayoutEffect as useLayoutEffect5, useRef as useRef6, useState as useState9 } from "react";
20491
+ import { Check as Check3, ChevronDown as ChevronDown4, Minus as Minus2, Plus as Plus3, Star as Star2 } from "lucide-react";
20492
+ import { Fragment as Fragment8, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
19828
20493
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19829
- 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]";
20494
+ 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]";
19830
20495
  function findPricingCardElement(sectionId, index) {
19831
20496
  const sectionEl2 = findByInstanceId(sectionId);
19832
20497
  if (!sectionEl2) return null;
@@ -19838,7 +20503,7 @@ function findPricingCardElement(sectionId, index) {
19838
20503
  }
19839
20504
  function cardRefFromTarget(target) {
19840
20505
  if (!(target instanceof Element)) return null;
19841
- if (target.closest(CHROME_SELECTOR)) return null;
20506
+ if (target.closest(CHROME_SELECTOR2)) return null;
19842
20507
  const cardEl = target.closest("[data-ohw-pricing-card]");
19843
20508
  if (!cardEl) return null;
19844
20509
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -19848,21 +20513,21 @@ function cardRefFromTarget(target) {
19848
20513
  if (!sectionId || Number.isNaN(index)) return null;
19849
20514
  return { sectionId, index };
19850
20515
  }
19851
- function sameRef(a, b) {
20516
+ function sameRef2(a, b) {
19852
20517
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19853
20518
  }
19854
- function rectOf(el) {
20519
+ function rectOf2(el) {
19855
20520
  if (!el) return null;
19856
20521
  const r2 = el.getBoundingClientRect();
19857
20522
  if (r2.width <= 0 || r2.height <= 0) return null;
19858
20523
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19859
20524
  }
19860
20525
  function readRect3(ref) {
19861
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20526
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19862
20527
  }
19863
20528
  function readGridRect(ref) {
19864
20529
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19865
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20530
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19866
20531
  }
19867
20532
  function useLiveCardRect(ref, grid = false) {
19868
20533
  const [rect, setRect] = useState9(null);
@@ -19892,19 +20557,19 @@ function useLiveCardRect(ref, grid = false) {
19892
20557
  }
19893
20558
  var TOOLBAR_GRID_GAP = 52;
19894
20559
  var TOOLBAR_GRID_GAP_MOBILE = 42;
19895
- var TOOLBAR_EDGE_MARGIN2 = 4;
20560
+ var TOOLBAR_EDGE_MARGIN3 = 4;
19896
20561
  function GridToolbarSlot({ gridRect, children }) {
19897
20562
  const slotRef = useRef6(null);
19898
20563
  const [shift, setShift] = useState9(0);
19899
20564
  const centerX = gridRect.left + gridRect.width / 2;
19900
- useLayoutEffect4(() => {
20565
+ useLayoutEffect5(() => {
19901
20566
  const slot = slotRef.current;
19902
20567
  if (!slot) return;
19903
20568
  const clamp = () => {
19904
20569
  const w = slot.offsetWidth;
19905
20570
  if (w <= 0) return;
19906
20571
  const half = w / 2;
19907
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20572
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
19908
20573
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19909
20574
  };
19910
20575
  clamp();
@@ -19913,7 +20578,7 @@ function GridToolbarSlot({ gridRect, children }) {
19913
20578
  return () => ro.disconnect();
19914
20579
  }, [centerX, children]);
19915
20580
  const mobile = window.innerWidth <= 480;
19916
- return /* @__PURE__ */ jsx21(
20581
+ return /* @__PURE__ */ jsx22(
19917
20582
  "div",
19918
20583
  {
19919
20584
  ref: slotRef,
@@ -19948,7 +20613,7 @@ function requestValidateTree2(postToParent2, tree) {
19948
20613
  });
19949
20614
  }
19950
20615
  function StyleSwatch({ style }) {
19951
- return /* @__PURE__ */ jsx21(
20616
+ return /* @__PURE__ */ jsx22(
19952
20617
  "span",
19953
20618
  {
19954
20619
  "aria-hidden": true,
@@ -19962,35 +20627,35 @@ function StyleSwatch({ style }) {
19962
20627
  );
19963
20628
  }
19964
20629
  function ButtonGlyph() {
19965
- return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19966
- /* @__PURE__ */ jsx21("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
19967
- /* @__PURE__ */ jsx21("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20630
+ return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20631
+ /* @__PURE__ */ jsx22("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20632
+ /* @__PURE__ */ jsx22("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
19968
20633
  ] });
19969
20634
  }
19970
20635
  function FeatureGlyph({ mode }) {
19971
- return /* @__PURE__ */ jsxs12("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
19972
- /* @__PURE__ */ jsx21("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
19973
- /* @__PURE__ */ jsx21("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
19974
- /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
19975
- /* @__PURE__ */ jsx21("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
19976
- /* @__PURE__ */ jsx21("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
19977
- mode === "add" && /* @__PURE__ */ jsx21("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20636
+ return /* @__PURE__ */ jsxs13("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20637
+ /* @__PURE__ */ jsx22("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20638
+ /* @__PURE__ */ jsx22("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20639
+ /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20640
+ /* @__PURE__ */ jsx22("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20641
+ /* @__PURE__ */ jsx22("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20642
+ mode === "add" && /* @__PURE__ */ jsx22("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
19978
20643
  ] });
19979
20644
  }
19980
- function ToolbarAction({
20645
+ function ToolbarAction2({
19981
20646
  label,
19982
20647
  onClick,
19983
20648
  disabled = false,
19984
20649
  children
19985
20650
  }) {
19986
- const button = /* @__PURE__ */ jsx21(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
19987
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
19988
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: button }) : button }),
19989
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20651
+ const button = /* @__PURE__ */ jsx22(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20652
+ return /* @__PURE__ */ jsxs13(Tooltip, { children: [
20653
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: button }) : button }),
20654
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
19990
20655
  ] });
19991
20656
  }
19992
- function ToolbarSeparator() {
19993
- return /* @__PURE__ */ jsx21("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20657
+ function ToolbarSeparator2() {
20658
+ return /* @__PURE__ */ jsx22("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
19994
20659
  }
19995
20660
  function CardStyleMenu({
19996
20661
  value,
@@ -19998,7 +20663,7 @@ function CardStyleMenu({
19998
20663
  disabled = false
19999
20664
  }) {
20000
20665
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20001
- const trigger = /* @__PURE__ */ jsxs12(
20666
+ const trigger = /* @__PURE__ */ jsxs13(
20002
20667
  "button",
20003
20668
  {
20004
20669
  type: "button",
@@ -20009,28 +20674,28 @@ function CardStyleMenu({
20009
20674
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20010
20675
  ),
20011
20676
  children: [
20012
- /* @__PURE__ */ jsx21(StyleSwatch, { style: current.value }),
20013
- /* @__PURE__ */ jsx21("span", { className: "flex-1 text-left", children: current.label }),
20014
- /* @__PURE__ */ jsx21(ChevronDown3, { size: 16, style: { pointerEvents: "none" } })
20677
+ /* @__PURE__ */ jsx22(StyleSwatch, { style: current.value }),
20678
+ /* @__PURE__ */ jsx22("span", { className: "flex-1 text-left", children: current.label }),
20679
+ /* @__PURE__ */ jsx22(ChevronDown4, { size: 16, style: { pointerEvents: "none" } })
20015
20680
  ]
20016
20681
  }
20017
20682
  );
20018
20683
  if (disabled) {
20019
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20020
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20021
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
20022
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21("span", { className: "inline-flex", children: trigger }) }),
20023
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20684
+ return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20685
+ /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20686
+ /* @__PURE__ */ jsxs13(Tooltip, { children: [
20687
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22("span", { className: "inline-flex", children: trigger }) }),
20688
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20024
20689
  ] })
20025
20690
  ] });
20026
20691
  }
20027
- return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20028
- /* @__PURE__ */ jsx21("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20029
- /* @__PURE__ */ jsxs12(DropdownMenu, { modal: false, children: [
20030
- /* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: trigger }),
20031
- /* @__PURE__ */ jsx21(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20692
+ return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20693
+ /* @__PURE__ */ jsx22("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20694
+ /* @__PURE__ */ jsxs13(DropdownMenu, { modal: false, children: [
20695
+ /* @__PURE__ */ jsx22(DropdownMenuTrigger, { asChild: true, children: trigger }),
20696
+ /* @__PURE__ */ jsx22(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20032
20697
  const selected = style.value === value;
20033
- return /* @__PURE__ */ jsxs12(
20698
+ return /* @__PURE__ */ jsxs13(
20034
20699
  DropdownMenuItem,
20035
20700
  {
20036
20701
  role: "menuitemradio",
@@ -20038,9 +20703,9 @@ function CardStyleMenu({
20038
20703
  onSelect: () => onChange(style.value),
20039
20704
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20040
20705
  children: [
20041
- /* @__PURE__ */ jsx21(StyleSwatch, { style: style.value }),
20042
- /* @__PURE__ */ jsx21("span", { children: style.label }),
20043
- selected && /* @__PURE__ */ jsx21(Check2, { size: 16, className: "text-bridge-primary" })
20706
+ /* @__PURE__ */ jsx22(StyleSwatch, { style: style.value }),
20707
+ /* @__PURE__ */ jsx22("span", { children: style.label }),
20708
+ selected && /* @__PURE__ */ jsx22(Check3, { size: 16, className: "text-bridge-primary" })
20044
20709
  ]
20045
20710
  },
20046
20711
  style.value
@@ -20070,7 +20735,7 @@ function PricingCardToolbar({
20070
20735
  const style = pricingCardStyle(entry.tree, index);
20071
20736
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20072
20737
  const mobile = window.innerWidth <= 480;
20073
- return /* @__PURE__ */ jsx21(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs12(
20738
+ return /* @__PURE__ */ jsx22(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsxs13(
20074
20739
  "div",
20075
20740
  {
20076
20741
  "data-ohw-bridge": "",
@@ -20082,7 +20747,7 @@ function PricingCardToolbar({
20082
20747
  ),
20083
20748
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20084
20749
  children: [
20085
- /* @__PURE__ */ jsxs12(
20750
+ /* @__PURE__ */ jsxs13(
20086
20751
  "div",
20087
20752
  {
20088
20753
  className: cn(
@@ -20091,8 +20756,8 @@ function PricingCardToolbar({
20091
20756
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20092
20757
  ),
20093
20758
  children: [
20094
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
20095
- /* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
20759
+ /* @__PURE__ */ jsxs13(Tooltip, { children: [
20760
+ /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
20096
20761
  CustomToolbarButton,
20097
20762
  {
20098
20763
  type: "button",
@@ -20100,7 +20765,7 @@ function PricingCardToolbar({
20100
20765
  "aria-pressed": featuredTag,
20101
20766
  onClick: () => onSetFeaturedTag(!featuredTag),
20102
20767
  className: "group size-8",
20103
- children: /* @__PURE__ */ jsx21(
20768
+ children: /* @__PURE__ */ jsx22(
20104
20769
  Star2,
20105
20770
  {
20106
20771
  size: 16,
@@ -20115,25 +20780,25 @@ function PricingCardToolbar({
20115
20780
  )
20116
20781
  }
20117
20782
  ) }),
20118
- /* @__PURE__ */ jsx21(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20783
+ /* @__PURE__ */ jsx22(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20119
20784
  ] }),
20120
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20121
- /* @__PURE__ */ jsx21(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20122
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20123
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx21(ButtonGlyph, {}) }),
20124
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
20125
- /* @__PURE__ */ jsx21(ButtonGlyph, {}),
20126
- /* @__PURE__ */ jsx21(Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20785
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20786
+ /* @__PURE__ */ jsx22(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20787
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20788
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ jsx22(ButtonGlyph, {}) }),
20789
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ jsxs13("span", { className: "relative inline-flex", children: [
20790
+ /* @__PURE__ */ jsx22(ButtonGlyph, {}),
20791
+ /* @__PURE__ */ jsx22(Minus2, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20127
20792
  ] }) }),
20128
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "add" }) }),
20129
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx21(FeatureGlyph, { mode: "remove" }) }),
20130
- /* @__PURE__ */ jsx21(ToolbarSeparator, {}),
20131
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx21(Plus2, { size: 16, style: { pointerEvents: "none" } }) }),
20132
- /* @__PURE__ */ jsx21(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx21(Minus, { size: 16, style: { pointerEvents: "none" } }) })
20793
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "add" }) }),
20794
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ jsx22(FeatureGlyph, { mode: "remove" }) }),
20795
+ /* @__PURE__ */ jsx22(ToolbarSeparator2, {}),
20796
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ jsx22(Plus3, { size: 16, style: { pointerEvents: "none" } }) }),
20797
+ /* @__PURE__ */ jsx22(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ jsx22(Minus2, { size: 16, style: { pointerEvents: "none" } }) })
20133
20798
  ]
20134
20799
  }
20135
20800
  ),
20136
- 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 })
20801
+ 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 })
20137
20802
  ]
20138
20803
  }
20139
20804
  ) });
@@ -20167,7 +20832,7 @@ function AiPricingCardOverlay({
20167
20832
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20168
20833
  setHover((prev) => {
20169
20834
  const next = ref && !overEditable ? ref : null;
20170
- return sameRef(prev, next) ? prev : next;
20835
+ return sameRef2(prev, next) ? prev : next;
20171
20836
  });
20172
20837
  };
20173
20838
  const onLeave = () => setHover(null);
@@ -20182,10 +20847,10 @@ function AiPricingCardOverlay({
20182
20847
  const onClick = (e) => {
20183
20848
  const t = e.target;
20184
20849
  if (!(t instanceof Element)) return;
20185
- if (t.closest(CHROME_SELECTOR)) return;
20850
+ if (t.closest(CHROME_SELECTOR2)) return;
20186
20851
  const ref = cardRefFromTarget(t);
20187
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
20188
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20852
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20853
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20189
20854
  };
20190
20855
  document.addEventListener("click", onClick, true);
20191
20856
  return () => document.removeEventListener("click", onClick, true);
@@ -20250,12 +20915,12 @@ function AiPricingCardOverlay({
20250
20915
  const activeEntry = active ? findEntry(active.sectionId) : null;
20251
20916
  const activeCardRect = useLiveCardRect(active);
20252
20917
  const activeGridRect = useLiveCardRect(active, true);
20253
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20254
- return /* @__PURE__ */ jsxs12(Fragment8, { children: [
20255
- hoverRect && /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20256
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs12(Fragment8, { children: [
20257
- /* @__PURE__ */ jsx21(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20258
- /* @__PURE__ */ jsx21(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx21(
20918
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20919
+ return /* @__PURE__ */ jsxs13(Fragment8, { children: [
20920
+ hoverRect && /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20921
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ jsxs13(Fragment8, { children: [
20922
+ /* @__PURE__ */ jsx22(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20923
+ /* @__PURE__ */ jsx22(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ jsx22(
20259
20924
  PricingCardToolbar,
20260
20925
  {
20261
20926
  entry: activeEntry,
@@ -20283,7 +20948,7 @@ function AiPricingCardOverlay({
20283
20948
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20284
20949
  }
20285
20950
  ) }),
20286
- /* @__PURE__ */ jsx21(
20951
+ /* @__PURE__ */ jsx22(
20287
20952
  "div",
20288
20953
  {
20289
20954
  "data-ohw-bridge": "",
@@ -20347,39 +21012,11 @@ function clearVideo(tree, path) {
20347
21012
  });
20348
21013
  }
20349
21014
 
20350
- // src/lib/youtube.ts
20351
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20352
- function extractYouTubeId(input) {
20353
- const trimmed = input.trim();
20354
- if (!trimmed) return null;
20355
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20356
- let url;
20357
- try {
20358
- url = new URL(trimmed);
20359
- } catch {
20360
- return null;
20361
- }
20362
- const host = url.hostname.replace(/^www\./, "");
20363
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20364
- return null;
20365
- }
20366
- let candidate = null;
20367
- if (host === "youtu.be") {
20368
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20369
- } else if (url.pathname === "/watch") {
20370
- candidate = url.searchParams.get("v");
20371
- } else {
20372
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20373
- candidate = match ? match[1] : null;
20374
- }
20375
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20376
- }
20377
-
20378
21015
  // src/ui/ai-section/AiVideoOverlay.tsx
20379
- import { Fragment as Fragment9, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
21016
+ import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
20380
21017
  var PRIMARY5 = "#0885FE";
20381
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20382
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
21018
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
21019
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20383
21020
  function findVideoBlockElement(sectionId, path) {
20384
21021
  const sectionEl2 = findByInstanceId(sectionId);
20385
21022
  if (!sectionEl2) return null;
@@ -20439,12 +21076,12 @@ function requestValidateTree3(postToParent2, tree) {
20439
21076
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20440
21077
  });
20441
21078
  }
20442
- function Pill2({
21079
+ function Pill({
20443
21080
  label,
20444
21081
  onClick,
20445
21082
  disabled
20446
21083
  }) {
20447
- return /* @__PURE__ */ jsx22(
21084
+ return /* @__PURE__ */ jsx23(
20448
21085
  "button",
20449
21086
  {
20450
21087
  type: "button",
@@ -20460,7 +21097,7 @@ function Pill2({
20460
21097
  border: "none",
20461
21098
  cursor: disabled ? "default" : "pointer",
20462
21099
  background: "#ffffff",
20463
- color: OHW_BLUE_DARK2,
21100
+ color: OHW_BLUE_DARK,
20464
21101
  opacity: disabled ? 0.4 : 1,
20465
21102
  fontSize: 12,
20466
21103
  lineHeight: "16px",
@@ -20503,8 +21140,8 @@ function VideoUrlInput({ value, onCommit }) {
20503
21140
  onCommit(id);
20504
21141
  }
20505
21142
  };
20506
- return /* @__PURE__ */ jsxs13("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20507
- /* @__PURE__ */ jsxs13(
21143
+ return /* @__PURE__ */ jsxs14("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
21144
+ /* @__PURE__ */ jsxs14(
20508
21145
  "div",
20509
21146
  {
20510
21147
  style: {
@@ -20520,12 +21157,12 @@ function VideoUrlInput({ value, onCommit }) {
20520
21157
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20521
21158
  },
20522
21159
  children: [
20523
- /* @__PURE__ */ jsx22(
21160
+ /* @__PURE__ */ jsx23(
20524
21161
  "span",
20525
21162
  {
20526
21163
  style: {
20527
21164
  flex: "0 0 auto",
20528
- color: OHW_BLUE_DARK2,
21165
+ color: OHW_BLUE_DARK,
20529
21166
  fontSize: 10,
20530
21167
  lineHeight: "16px",
20531
21168
  fontWeight: 700,
@@ -20535,7 +21172,7 @@ function VideoUrlInput({ value, onCommit }) {
20535
21172
  children: "Video"
20536
21173
  }
20537
21174
  ),
20538
- /* @__PURE__ */ jsx22(
21175
+ /* @__PURE__ */ jsx23(
20539
21176
  "input",
20540
21177
  {
20541
21178
  type: "text",
@@ -20572,7 +21209,7 @@ function VideoUrlInput({ value, onCommit }) {
20572
21209
  ]
20573
21210
  }
20574
21211
  ),
20575
- 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." })
21212
+ 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." })
20576
21213
  ] });
20577
21214
  }
20578
21215
  function VideoToolbar({
@@ -20582,7 +21219,7 @@ function VideoToolbar({
20582
21219
  onSetVideoId,
20583
21220
  onRemove
20584
21221
  }) {
20585
- return /* @__PURE__ */ jsxs13(
21222
+ return /* @__PURE__ */ jsxs14(
20586
21223
  "div",
20587
21224
  {
20588
21225
  "data-ohw-bridge": "",
@@ -20594,7 +21231,7 @@ function VideoToolbar({
20594
21231
  gap: 6,
20595
21232
  alignItems: "center",
20596
21233
  width: 280,
20597
- background: OHW_BLUE2,
21234
+ background: OHW_BLUE,
20598
21235
  padding: 8,
20599
21236
  borderRadius: 12,
20600
21237
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20602,9 +21239,9 @@ function VideoToolbar({
20602
21239
  opacity: pending ? 0.6 : 1
20603
21240
  },
20604
21241
  children: [
20605
- /* @__PURE__ */ jsx22(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20606
- /* @__PURE__ */ jsx22(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20607
- error && /* @__PURE__ */ jsx22("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21242
+ /* @__PURE__ */ jsx23(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
21243
+ /* @__PURE__ */ jsx23(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
21244
+ error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20608
21245
  ]
20609
21246
  }
20610
21247
  );
@@ -20724,8 +21361,8 @@ function AiVideoOverlay({
20724
21361
  const activeBlockRect = useLiveBlockRect(active);
20725
21362
  const TOOLBAR_APPROX_H = 90;
20726
21363
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20727
- return /* @__PURE__ */ jsxs13(Fragment9, { children: [
20728
- hoverHandleRect && hover && /* @__PURE__ */ jsx22(
21364
+ return /* @__PURE__ */ jsxs14(Fragment9, { children: [
21365
+ hoverHandleRect && hover && /* @__PURE__ */ jsx23(
20729
21366
  "button",
20730
21367
  {
20731
21368
  type: "button",
@@ -20753,15 +21390,15 @@ function AiVideoOverlay({
20753
21390
  fontSize: 14,
20754
21391
  fontWeight: 700
20755
21392
  },
20756
- children: /* @__PURE__ */ jsx22(Star3, { size: 14, style: { pointerEvents: "none" } })
21393
+ children: /* @__PURE__ */ jsx23(Star3, { size: 14, style: { pointerEvents: "none" } })
20757
21394
  }
20758
21395
  ),
20759
- activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx22(
21396
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ jsx23(
20760
21397
  ItemInteractionLayer,
20761
21398
  {
20762
21399
  rect: activeBlockRect,
20763
21400
  state: toolbarState,
20764
- toolbar: /* @__PURE__ */ jsx22(
21401
+ toolbar: /* @__PURE__ */ jsx23(
20765
21402
  VideoToolbar,
20766
21403
  {
20767
21404
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20836,10 +21473,10 @@ function setCarouselAutoplay(tree, on) {
20836
21473
  }
20837
21474
 
20838
21475
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20839
- import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs14 } from "react/jsx-runtime";
21476
+ import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
20840
21477
  var PRIMARY6 = "#0885FE";
20841
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20842
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21478
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21479
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20843
21480
  function findCarouselItemElement(sectionId, index) {
20844
21481
  const sectionEl2 = findByInstanceId(sectionId);
20845
21482
  if (!sectionEl2) return null;
@@ -20918,8 +21555,8 @@ function requestAssetPick2(postToParent2) {
20918
21555
  postToParent2({ type: "ow:asset-pick", id });
20919
21556
  });
20920
21557
  }
20921
- function Pill3({ label, onClick, disabled }) {
20922
- return /* @__PURE__ */ jsx23(
21558
+ function Pill2({ label, onClick, disabled }) {
21559
+ return /* @__PURE__ */ jsx24(
20923
21560
  "button",
20924
21561
  {
20925
21562
  type: "button",
@@ -20935,7 +21572,7 @@ function Pill3({ label, onClick, disabled }) {
20935
21572
  border: "none",
20936
21573
  cursor: disabled ? "default" : "pointer",
20937
21574
  background: "#ffffff",
20938
- color: OHW_BLUE_DARK3,
21575
+ color: OHW_BLUE_DARK2,
20939
21576
  opacity: disabled ? 0.4 : 1,
20940
21577
  fontSize: 12,
20941
21578
  lineHeight: "16px",
@@ -20953,7 +21590,7 @@ function TogglePill({
20953
21590
  onToggle,
20954
21591
  disabled
20955
21592
  }) {
20956
- return /* @__PURE__ */ jsxs14(
21593
+ return /* @__PURE__ */ jsxs15(
20957
21594
  "button",
20958
21595
  {
20959
21596
  type: "button",
@@ -20972,7 +21609,7 @@ function TogglePill({
20972
21609
  border: "none",
20973
21610
  cursor: disabled ? "default" : "pointer",
20974
21611
  background: "#ffffff",
20975
- color: OHW_BLUE_DARK3,
21612
+ color: OHW_BLUE_DARK2,
20976
21613
  opacity: disabled ? 0.4 : 1,
20977
21614
  fontSize: 12,
20978
21615
  lineHeight: "16px",
@@ -20982,7 +21619,7 @@ function TogglePill({
20982
21619
  },
20983
21620
  children: [
20984
21621
  label,
20985
- /* @__PURE__ */ jsx23(
21622
+ /* @__PURE__ */ jsx24(
20986
21623
  "span",
20987
21624
  {
20988
21625
  "aria-hidden": true,
@@ -20995,10 +21632,10 @@ function TogglePill({
20995
21632
  // Off is a grey track, not a washed-out blue: the pill's own white background already
20996
21633
  // carries the brand colour in the text, and a pale blue track next to it read as
20997
21634
  // "disabled control" rather than "switch that is off".
20998
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21635
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
20999
21636
  transition: "background 120ms ease"
21000
21637
  },
21001
- children: /* @__PURE__ */ jsx23(
21638
+ children: /* @__PURE__ */ jsx24(
21002
21639
  "span",
21003
21640
  {
21004
21641
  style: {
@@ -21027,7 +21664,7 @@ function CarouselSlideToolbar({
21027
21664
  onChangeImage,
21028
21665
  onToggleAutoplay
21029
21666
  }) {
21030
- return /* @__PURE__ */ jsxs14(
21667
+ return /* @__PURE__ */ jsxs15(
21031
21668
  "div",
21032
21669
  {
21033
21670
  "data-ohw-bridge": "",
@@ -21038,7 +21675,7 @@ function CarouselSlideToolbar({
21038
21675
  flexDirection: "column",
21039
21676
  gap: 6,
21040
21677
  alignItems: "center",
21041
- background: OHW_BLUE3,
21678
+ background: OHW_BLUE2,
21042
21679
  padding: 8,
21043
21680
  borderRadius: 12,
21044
21681
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21050,11 +21687,11 @@ function CarouselSlideToolbar({
21050
21687
  pointerEvents: pending ? "none" : "auto"
21051
21688
  },
21052
21689
  children: [
21053
- /* @__PURE__ */ jsxs14("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21054
- /* @__PURE__ */ jsx23(Pill3, { label: "Change Image", onClick: onChangeImage }),
21055
- /* @__PURE__ */ jsx23(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21690
+ /* @__PURE__ */ jsxs15("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21691
+ /* @__PURE__ */ jsx24(Pill2, { label: "Change Image", onClick: onChangeImage }),
21692
+ /* @__PURE__ */ jsx24(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21056
21693
  ] }),
21057
- error && /* @__PURE__ */ jsx23("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21694
+ error && /* @__PURE__ */ jsx24("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21058
21695
  ]
21059
21696
  }
21060
21697
  );
@@ -21194,8 +21831,8 @@ function AiFadeCarouselOverlay({
21194
21831
  const activeItemRect = useLiveItemRect2(active);
21195
21832
  const TOOLBAR_APPROX_H = 90;
21196
21833
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21197
- return /* @__PURE__ */ jsxs14(Fragment10, { children: [
21198
- hoverHandleRect && hover && /* @__PURE__ */ jsx23(
21834
+ return /* @__PURE__ */ jsxs15(Fragment10, { children: [
21835
+ hoverHandleRect && hover && /* @__PURE__ */ jsx24(
21199
21836
  "button",
21200
21837
  {
21201
21838
  type: "button",
@@ -21224,10 +21861,10 @@ function AiFadeCarouselOverlay({
21224
21861
  fontSize: 14,
21225
21862
  fontWeight: 700
21226
21863
  },
21227
- children: /* @__PURE__ */ jsx23(Star4, { size: 14, style: { pointerEvents: "none" } })
21864
+ children: /* @__PURE__ */ jsx24(Star4, { size: 14, style: { pointerEvents: "none" } })
21228
21865
  }
21229
21866
  ),
21230
- swapping && /* @__PURE__ */ jsx23(
21867
+ swapping && /* @__PURE__ */ jsx24(
21231
21868
  "div",
21232
21869
  {
21233
21870
  ref: skeletonRef,
@@ -21245,15 +21882,15 @@ function AiFadeCarouselOverlay({
21245
21882
  zIndex: 2147483646,
21246
21883
  pointerEvents: "none"
21247
21884
  },
21248
- children: /* @__PURE__ */ jsx23("style", { children: MEDIA_SKELETON_CSS })
21885
+ children: /* @__PURE__ */ jsx24("style", { children: MEDIA_SKELETON_CSS })
21249
21886
  }
21250
21887
  ),
21251
- activeItemRect && active && activeEntry && /* @__PURE__ */ jsx23(
21888
+ activeItemRect && active && activeEntry && /* @__PURE__ */ jsx24(
21252
21889
  ItemInteractionLayer,
21253
21890
  {
21254
21891
  rect: activeItemRect,
21255
21892
  state: toolbarState,
21256
- toolbar: /* @__PURE__ */ jsx23(
21893
+ toolbar: /* @__PURE__ */ jsx24(
21257
21894
  CarouselSlideToolbar,
21258
21895
  {
21259
21896
  pending,
@@ -21444,118 +22081,11 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21444
22081
  // src/ui/link-modal/LinkPopover.tsx
21445
22082
  import { useEffect as useEffect16 } from "react";
21446
22083
 
21447
- // src/ui/dialog.tsx
21448
- import * as React9 from "react";
21449
- import { Dialog as DialogPrimitive } from "radix-ui";
21450
- import { X as X2 } from "lucide-react";
21451
- import { jsx as jsx24, jsxs as jsxs15 } from "react/jsx-runtime";
21452
- function Dialog2({
21453
- ...props
21454
- }) {
21455
- return /* @__PURE__ */ jsx24(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
21456
- }
21457
- function DialogPortal({
21458
- ...props
21459
- }) {
21460
- return /* @__PURE__ */ jsx24(DialogPrimitive.Portal, { ...props });
21461
- }
21462
- function DialogOverlay({
21463
- className,
21464
- ...props
21465
- }) {
21466
- return /* @__PURE__ */ jsx24(
21467
- DialogPrimitive.Overlay,
21468
- {
21469
- "data-slot": "dialog-overlay",
21470
- "data-ohw-link-modal-root": "",
21471
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21472
- ...props
21473
- }
21474
- );
21475
- }
21476
- var DialogContent = React9.forwardRef(
21477
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21478
- const positionMode = container ? "absolute" : "fixed";
21479
- return /* @__PURE__ */ jsxs15(DialogPortal, { container: container ?? void 0, children: [
21480
- /* @__PURE__ */ jsx24(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21481
- /* @__PURE__ */ jsxs15(
21482
- DialogPrimitive.Content,
21483
- {
21484
- ref,
21485
- "data-slot": "dialog-content",
21486
- className: cn(
21487
- positionMode,
21488
- "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",
21489
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21490
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21491
- className
21492
- ),
21493
- onMouseDown: (e) => e.stopPropagation(),
21494
- ...props,
21495
- children: [
21496
- children,
21497
- showCloseButton ? /* @__PURE__ */ jsx24(
21498
- DialogPrimitive.Close,
21499
- {
21500
- type: "button",
21501
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21502
- "aria-label": "Close",
21503
- children: /* @__PURE__ */ jsx24(X2, { size: 16, "aria-hidden": true })
21504
- }
21505
- ) : null
21506
- ]
21507
- }
21508
- )
21509
- ] });
21510
- }
21511
- );
21512
- DialogContent.displayName = DialogPrimitive.Content.displayName;
21513
- function DialogHeader({
21514
- className,
21515
- ...props
21516
- }) {
21517
- return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21518
- }
21519
- function DialogFooter({
21520
- className,
21521
- ...props
21522
- }) {
21523
- return /* @__PURE__ */ jsx24(
21524
- "div",
21525
- {
21526
- className: cn("flex items-center justify-end gap-2", className),
21527
- ...props
21528
- }
21529
- );
21530
- }
21531
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21532
- DialogPrimitive.Title,
21533
- {
21534
- ref,
21535
- className: cn(
21536
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21537
- className
21538
- ),
21539
- ...props
21540
- }
21541
- ));
21542
- DialogTitle.displayName = DialogPrimitive.Title.displayName;
21543
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx24(
21544
- DialogPrimitive.Description,
21545
- {
21546
- ref,
21547
- className: cn("text-sm text-muted-foreground", className),
21548
- ...props
21549
- }
21550
- ));
21551
- DialogDescription.displayName = DialogPrimitive.Description.displayName;
21552
- var DialogClose = DialogPrimitive.Close;
21553
-
21554
22084
  // src/ui/link-modal/LinkEditorPanel.tsx
21555
22085
  import { Info, X as X4 } from "lucide-react";
21556
22086
 
21557
22087
  // src/ui/link-modal/DestinationBreadcrumb.tsx
21558
- import { ArrowRight as ArrowRight2, File, GalleryVertical } from "lucide-react";
22088
+ import { ArrowRight as ArrowRight3, File, GalleryVertical } from "lucide-react";
21559
22089
  import { jsx as jsx25, jsxs as jsxs16 } from "react/jsx-runtime";
21560
22090
  function DestinationBreadcrumb({
21561
22091
  pageTitle,
@@ -21569,7 +22099,7 @@ function DestinationBreadcrumb({
21569
22099
  /* @__PURE__ */ jsx25("span", { className: "text-sm font-medium leading-none text-foreground!", children: pageTitle })
21570
22100
  ] }),
21571
22101
  /* @__PURE__ */ jsx25(
21572
- ArrowRight2,
22102
+ ArrowRight3,
21573
22103
  {
21574
22104
  size: 16,
21575
22105
  className: "shrink-0 text-muted-foreground",
@@ -21681,7 +22211,7 @@ function Label({ className, ...props }) {
21681
22211
  }
21682
22212
 
21683
22213
  // src/ui/link-modal/UrlOrPageInput.tsx
21684
- import { ChevronDown as ChevronDown4, File as File2, X as X3 } from "lucide-react";
22214
+ import { ChevronDown as ChevronDown5, File as File2, X as X3 } from "lucide-react";
21685
22215
  import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
21686
22216
  function FieldChevron({
21687
22217
  onClick
@@ -21694,7 +22224,7 @@ function FieldChevron({
21694
22224
  onClick,
21695
22225
  "aria-label": "Open page list",
21696
22226
  tabIndex: -1,
21697
- children: /* @__PURE__ */ jsx29(ChevronDown4, { size: 16 })
22227
+ children: /* @__PURE__ */ jsx29(ChevronDown5, { size: 16 })
21698
22228
  }
21699
22229
  );
21700
22230
  }
@@ -21924,7 +22454,7 @@ function LinkEditorPanel({ state, onClose }) {
21924
22454
  // src/ui/link-modal/SectionPickerOverlay.tsx
21925
22455
  import { useCallback as useCallback7, useEffect as useEffect14, useMemo as useMemo2, useRef as useRef10, useState as useState13 } from "react";
21926
22456
  import { createPortal as createPortal2 } from "react-dom";
21927
- import { ArrowLeft as ArrowLeft2, Check as Check3 } from "lucide-react";
22457
+ import { ArrowLeft as ArrowLeft3, Check as Check4 } from "lucide-react";
21928
22458
  import { usePathname as usePathname2, useRouter as useRouter2 } from "next/navigation";
21929
22459
 
21930
22460
  // src/lib/parent-scroll.ts
@@ -22201,7 +22731,7 @@ function SectionPickerOverlay({
22201
22731
  className: "h-8 min-w-0 gap-1 border-border bg-background px-2 py-1.5 shadow-sm hover:bg-muted cursor-pointer",
22202
22732
  onClick: onBack,
22203
22733
  children: [
22204
- /* @__PURE__ */ jsx31(ArrowLeft2, { className: "size-4 shrink-0", "aria-hidden": true }),
22734
+ /* @__PURE__ */ jsx31(ArrowLeft3, { className: "size-4 shrink-0", "aria-hidden": true }),
22205
22735
  "Back"
22206
22736
  ]
22207
22737
  }
@@ -22270,7 +22800,7 @@ function SectionPickerOverlay({
22270
22800
  className: "absolute right-3 top-3 flex size-8 items-center justify-center rounded-full text-white",
22271
22801
  style: { backgroundColor: "var(--ohw-primary, #0885fe)" },
22272
22802
  "aria-hidden": true,
22273
- children: /* @__PURE__ */ jsx31(Check3, { className: "size-5" })
22803
+ children: /* @__PURE__ */ jsx31(Check4, { className: "size-5" })
22274
22804
  }
22275
22805
  ) : null
22276
22806
  ]
@@ -22654,6 +23184,7 @@ function shouldUseDevFixtures() {
22654
23184
  function getLogoElement(el) {
22655
23185
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22656
23186
  if (marked) return marked;
23187
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22657
23188
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22658
23189
  if (!root) return null;
22659
23190
  const anchor = el.closest("a");
@@ -22723,7 +23254,7 @@ function addFooterColumnWithPersist({
22723
23254
  import {
22724
23255
  useCallback as useCallback9,
22725
23256
  useEffect as useEffect17,
22726
- useLayoutEffect as useLayoutEffect5,
23257
+ useLayoutEffect as useLayoutEffect6,
22727
23258
  useRef as useRef11,
22728
23259
  useState as useState15
22729
23260
  } from "react";
@@ -22820,7 +23351,7 @@ function FloatingPanel({
22820
23351
  return () => window.removeEventListener("message", onParentScroll);
22821
23352
  }, [open]);
22822
23353
  const positionRef = useRef11(position);
22823
- useLayoutEffect5(() => {
23354
+ useLayoutEffect6(() => {
22824
23355
  if (!open) {
22825
23356
  positionRef.current = position;
22826
23357
  return;
@@ -22830,7 +23361,7 @@ function FloatingPanel({
22830
23361
  }
22831
23362
  positionRef.current = position;
22832
23363
  }, [open, position, liveScroll, parentScroll]);
22833
- useLayoutEffect5(() => {
23364
+ useLayoutEffect6(() => {
22834
23365
  if (!open || !panelRef.current) return;
22835
23366
  const el = panelRef.current;
22836
23367
  const header = el.querySelector("[data-ohw-floating-panel-header]");
@@ -23039,7 +23570,7 @@ function SocialsDisplayPanel({ display, onChange, className }) {
23039
23570
  }
23040
23571
 
23041
23572
  // src/ui/button-style-panel.tsx
23042
- import { Check as Check4 } from "lucide-react";
23573
+ import { Check as Check5 } from "lucide-react";
23043
23574
  import { jsx as jsx35, jsxs as jsxs24 } from "react/jsx-runtime";
23044
23575
  var SIZE_LABEL = { s: "S", m: "M", l: "L" };
23045
23576
  function ButtonStylePanel({
@@ -23110,7 +23641,7 @@ function ButtonStylePanel({
23110
23641
  {
23111
23642
  className: "absolute right-0.5 top-0.5 flex size-5 items-center justify-center rounded-full bg-primary text-primary-foreground",
23112
23643
  "aria-hidden": true,
23113
- children: /* @__PURE__ */ jsx35(Check4, { className: "size-3", strokeWidth: 3 })
23644
+ children: /* @__PURE__ */ jsx35(Check5, { className: "size-3", strokeWidth: 3 })
23114
23645
  }
23115
23646
  ) : null
23116
23647
  ]
@@ -24142,7 +24673,7 @@ function useSectionDrag({
24142
24673
  }
24143
24674
 
24144
24675
  // src/ui/footer-container-chrome.tsx
24145
- import { Plus as Plus3 } from "lucide-react";
24676
+ import { Plus as Plus4 } from "lucide-react";
24146
24677
  import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
24147
24678
  function FooterContainerChrome({
24148
24679
  rect,
@@ -24183,7 +24714,7 @@ function FooterContainerChrome({
24183
24714
  if (addDisabled) return;
24184
24715
  onAdd();
24185
24716
  },
24186
- children: /* @__PURE__ */ jsx36(Plus3, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24717
+ children: /* @__PURE__ */ jsx36(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24187
24718
  }
24188
24719
  ) }),
24189
24720
  /* @__PURE__ */ jsx36(TooltipContent, { side: "bottom", sideOffset: 9, children: addDisabled ? "Maximum columns reached" : "Add item" })
@@ -24590,7 +25121,7 @@ function retargetPageLinks(change, deps) {
24590
25121
  }
24591
25122
 
24592
25123
  // src/ui/navbar-container-chrome.tsx
24593
- import { Plus as Plus4 } from "lucide-react";
25124
+ import { Plus as Plus5 } from "lucide-react";
24594
25125
  import { jsx as jsx37 } from "react/jsx-runtime";
24595
25126
  function NavbarContainerChrome({
24596
25127
  rect,
@@ -24626,7 +25157,7 @@ function NavbarContainerChrome({
24626
25157
  e.stopPropagation();
24627
25158
  onAdd();
24628
25159
  },
24629
- children: /* @__PURE__ */ jsx37(Plus4, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
25160
+ children: /* @__PURE__ */ jsx37(Plus5, { className: "size-4 shrink-0 text-foreground", "aria-hidden": true })
24630
25161
  }
24631
25162
  )
24632
25163
  }
@@ -24698,7 +25229,7 @@ function Badge({ className, variant, ...props }) {
24698
25229
  }
24699
25230
 
24700
25231
  // src/OhhwellsBridge.tsx
24701
- import { Brush as Brush2, Link as Link2, Plus as Plus5, Settings } from "lucide-react";
25232
+ import { Brush as Brush2, Link as Link2, Plus as Plus6, Settings, Trash2 as Trash24 } from "lucide-react";
24702
25233
  import { Fragment as Fragment13, jsx as jsx40, jsxs as jsxs26 } from "react/jsx-runtime";
24703
25234
  var PRIMARY7 = "#0885FE";
24704
25235
  var IMAGE_FADE_MS = 300;
@@ -25476,7 +26007,7 @@ function getNavigationSelectionParent(el) {
25476
26007
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25477
26008
  return resolveFooterLinksContainerFrom(el);
25478
26009
  }
25479
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
26010
+ 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)) {
25480
26011
  return getNavigationRoot(el);
25481
26012
  }
25482
26013
  return null;
@@ -25698,7 +26229,6 @@ var ICONS = {
25698
26229
  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"/>',
25699
26230
  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"/>'
25700
26231
  };
25701
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25702
26232
  var SELECTION_CHROME_GAP2 = 4;
25703
26233
  var TOOLBAR_STROKE_GAP2 = 4;
25704
26234
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25796,7 +26326,7 @@ function applyVisibleViewport(el, parentScroll) {
25796
26326
  el.style.top = `${top}px`;
25797
26327
  el.style.height = `${height}px`;
25798
26328
  }
25799
- var TOOLBAR_EDGE_MARGIN3 = 4;
26329
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25800
26330
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25801
26331
  const isAbove = transform.includes("translateY(-100%)");
25802
26332
  let visualTop = isAbove ? top - approxH : top;
@@ -25823,8 +26353,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25823
26353
  function clampToolbarLeft(centerX, toolbarWidth) {
25824
26354
  const half = toolbarWidth / 2;
25825
26355
  return Math.max(
25826
- TOOLBAR_EDGE_MARGIN3 + half,
25827
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
26356
+ TOOLBAR_EDGE_MARGIN4 + half,
26357
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25828
26358
  );
25829
26359
  }
25830
26360
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -25946,7 +26476,10 @@ function FloatingToolbar({
25946
26476
  onCommand,
25947
26477
  activeCommands,
25948
26478
  showEditLink,
25949
- onEditLink
26479
+ onEditLink,
26480
+ showDelete,
26481
+ onDelete,
26482
+ deleteDisabled
25950
26483
  }) {
25951
26484
  const localRef = React12.useRef(null);
25952
26485
  const [measuredW, setMeasuredW] = React12.useState(330);
@@ -25973,7 +26506,7 @@ function FloatingToolbar({
25973
26506
  const ro = new ResizeObserver(update);
25974
26507
  ro.observe(node);
25975
26508
  return () => ro.disconnect();
25976
- }, [showEditLink, activeCommands]);
26509
+ }, [showEditLink, showDelete, activeCommands]);
25977
26510
  const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
25978
26511
  return /* @__PURE__ */ jsx40(
25979
26512
  "div",
@@ -26038,7 +26571,28 @@ function FloatingToolbar({
26038
26571
  },
26039
26572
  children: /* @__PURE__ */ jsx40(Link2, { className: "size-4 shrink-0", "aria-hidden": true })
26040
26573
  }
26041
- ) : null
26574
+ ) : null,
26575
+ showDelete ? /* @__PURE__ */ jsxs26(Fragment13, { children: [
26576
+ /* @__PURE__ */ jsx40(CustomToolbarDivider, {}),
26577
+ /* @__PURE__ */ jsx40(
26578
+ CustomToolbarButton,
26579
+ {
26580
+ type: "button",
26581
+ title: "Delete",
26582
+ disabled: deleteDisabled,
26583
+ onMouseDown: (e) => {
26584
+ e.preventDefault();
26585
+ e.stopPropagation();
26586
+ if (!deleteDisabled) onDelete?.();
26587
+ },
26588
+ onClick: (e) => {
26589
+ e.preventDefault();
26590
+ e.stopPropagation();
26591
+ },
26592
+ children: /* @__PURE__ */ jsx40(Trash24, { className: "size-4 shrink-0", "aria-hidden": true })
26593
+ }
26594
+ )
26595
+ ] }) : null
26042
26596
  ] })
26043
26597
  }
26044
26598
  );
@@ -26225,7 +26779,7 @@ function OhhwellsBridge() {
26225
26779
  }, []);
26226
26780
  const subdomainFromQuery = searchParams.get("subdomain");
26227
26781
  const [subdomain, setSubdomain] = useState18(() => resolveSubdomain(subdomainFromQuery));
26228
- useLayoutEffect6(() => {
26782
+ useLayoutEffect7(() => {
26229
26783
  const next = resolveSubdomain(subdomainFromQuery);
26230
26784
  if (next !== subdomain) setSubdomain(next);
26231
26785
  if (next) return;
@@ -26652,6 +27206,8 @@ function OhhwellsBridge() {
26652
27206
  const [activeCommands, setActiveCommands] = useState18(/* @__PURE__ */ new Set());
26653
27207
  const [sectionGap, setSectionGap] = useState18(null);
26654
27208
  const [toolbarShowEditLink, setToolbarShowEditLink] = useState18(false);
27209
+ const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = useState18(false);
27210
+ const deletingAiBlockRef = useRef14(false);
26655
27211
  const hoveredNavContainerRef = useRef14(null);
26656
27212
  const [hoveredNavContainerRect, setHoveredNavContainerRect] = useState18(null);
26657
27213
  const hoveredItemElRef = useRef14(null);
@@ -26707,21 +27263,6 @@ function OhhwellsBridge() {
26707
27263
  const [isItemDragging, setIsItemDragging] = useState18(false);
26708
27264
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState18(false);
26709
27265
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26710
- const [floatingPanel, setFloatingPanel] = useState18(null);
26711
- const floatingPanelOpenRef = useRef14(false);
26712
- floatingPanelOpenRef.current = floatingPanel !== null;
26713
- const floatingPanelRef = useRef14(null);
26714
- floatingPanelRef.current = floatingPanel;
26715
- const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
26716
- const buttonCollectionDragRef = useRef14(null);
26717
- const buttonDropInsertIndexRef = useRef14(null);
26718
- const [buttonDropSlots, setButtonDropSlots] = useState18([]);
26719
- const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
26720
- const buttonPointerDragRef = useRef14(null);
26721
- const [buttonStyleTick, setButtonStyleTick] = useState18(0);
26722
- const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
26723
- const [editorViewport, setEditorViewport] = useState18("desktop");
26724
- const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26725
27266
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState18(null);
26726
27267
  const [footerHeadingVisible, setFooterHeadingVisible] = useState18(null);
26727
27268
  const footerDragRef = useRef14(null);
@@ -26748,6 +27289,21 @@ function OhhwellsBridge() {
26748
27289
  const stylesRef = useRef14("");
26749
27290
  const appliedDrawerRef = useRef14(null);
26750
27291
  const pendingDeleteUndoRef = useRef14(null);
27292
+ const [floatingPanel, setFloatingPanel] = useState18(null);
27293
+ const floatingPanelOpenRef = useRef14(false);
27294
+ const floatingPanelRef = useRef14(null);
27295
+ floatingPanelRef.current = floatingPanel;
27296
+ const setFloatingPanelRef = useRef14(setFloatingPanel);
27297
+ const [floatingPanelPos, setFloatingPanelPos] = useState18(null);
27298
+ const buttonCollectionDragRef = useRef14(null);
27299
+ const buttonDropInsertIndexRef = useRef14(null);
27300
+ const [buttonDropSlots, setButtonDropSlots] = useState18([]);
27301
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = useState18(null);
27302
+ const buttonPointerDragRef = useRef14(null);
27303
+ const [buttonStyleTick, setButtonStyleTick] = useState18(0);
27304
+ const [logoSizeDraft, setLogoSizeDraft] = useState18(null);
27305
+ const [editorViewport, setEditorViewport] = useState18("desktop");
27306
+ const [parentScrollSnap, setParentScrollSnap] = useState18(null);
26751
27307
  const [sitePages, setSitePages] = useState18([]);
26752
27308
  const collectionItemsRef = useRef14(/* @__PURE__ */ new Map());
26753
27309
  const [sectionsByPath, setSectionsByPath] = useState18({});
@@ -26757,7 +27313,18 @@ function OhhwellsBridge() {
26757
27313
  const linkPopoverOpenRef = useRef14(false);
26758
27314
  const linkPopoverGraceUntilRef = useRef14(0);
26759
27315
  setLinkPopoverRef.current = setLinkPopover;
27316
+ setFloatingPanelRef.current = setFloatingPanel;
26760
27317
  linkPopoverSessionRef.current = linkPopover;
27318
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
27319
+ useEffect21(() => {
27320
+ const syncViewport = () => {
27321
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
27322
+ setEditorViewport((prev) => prev === next ? prev : next);
27323
+ };
27324
+ syncViewport();
27325
+ window.addEventListener("resize", syncViewport);
27326
+ return () => window.removeEventListener("resize", syncViewport);
27327
+ }, []);
26761
27328
  useEffect21(() => {
26762
27329
  setSectionOrderPersistHandler((entries) => {
26763
27330
  const currentPath = window.location.pathname;
@@ -27064,6 +27631,7 @@ function OhhwellsBridge() {
27064
27631
  setMaxBadge(null);
27065
27632
  setActiveCommands(/* @__PURE__ */ new Set());
27066
27633
  setToolbarShowEditLink(false);
27634
+ setToolbarShowAiBlockDelete(false);
27067
27635
  postToParent2({ type: "ow:exit-edit" });
27068
27636
  }, [postToParent2]);
27069
27637
  const clearSelectedAttr = useCallback12(() => {
@@ -27234,6 +27802,7 @@ function OhhwellsBridge() {
27234
27802
  setMaxBadge(null);
27235
27803
  setActiveCommands(/* @__PURE__ */ new Set());
27236
27804
  setToolbarShowEditLink(false);
27805
+ setToolbarShowAiBlockDelete(false);
27237
27806
  postToParent2({ type: "ow:exit-edit" });
27238
27807
  reselectNavigationItem(navAnchor);
27239
27808
  }, [postToParent2, reselectNavigationItem]);
@@ -28404,6 +28973,13 @@ function OhhwellsBridge() {
28404
28973
  }
28405
28974
  }
28406
28975
  setToolbarShowEditLink(Boolean(getHrefKeyFromElement(el)));
28976
+ setToolbarShowAiBlockDelete(
28977
+ canRemoveAiBlock(aiSectionsRef.current, el.dataset.ohwKey ?? null) || canSoftHideEditable(el, {
28978
+ isNavFooterItem: Boolean(
28979
+ getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
28980
+ )
28981
+ })
28982
+ );
28407
28983
  const navAnchor = getNavigationItemAnchor(el);
28408
28984
  if (navAnchor) {
28409
28985
  if (isNestedNavChild(navAnchor)) {
@@ -28464,7 +29040,7 @@ function OhhwellsBridge() {
28464
29040
  isFooterFrameSelection,
28465
29041
  postToParent2
28466
29042
  ]);
28467
- useLayoutEffect6(() => {
29043
+ useLayoutEffect7(() => {
28468
29044
  if (!subdomain || isEditMode) {
28469
29045
  setFetchState("done");
28470
29046
  return;
@@ -28491,6 +29067,7 @@ function OhhwellsBridge() {
28491
29067
  applyAiFooterFromContent(content);
28492
29068
  if (typeof content[STYLE_STORE_KEY] === "string") {
28493
29069
  stylesRef.current = content[STYLE_STORE_KEY];
29070
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28494
29071
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28495
29072
  }
28496
29073
  applyBrandChrome(content);
@@ -28501,15 +29078,16 @@ function OhhwellsBridge() {
28501
29078
  if (key === "__ohw_sections") continue;
28502
29079
  if (key === AI_SECTIONS_KEY) continue;
28503
29080
  if (key === AI_FOOTER_KEY) continue;
29081
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
29082
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28504
29083
  if (key === BRAND_KIT_KEY) continue;
28505
29084
  if (key === STYLE_STORE_KEY) continue;
28506
29085
  if (BRAND_CHROME_KEYS.has(key)) continue;
28507
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28508
29086
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28509
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28510
29087
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28511
29088
  continue;
28512
29089
  }
29090
+ if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
28513
29091
  if (applyVideoSettingNode(key, val)) continue;
28514
29092
  if (applyCarouselNode(key, val)) continue;
28515
29093
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28549,6 +29127,8 @@ function OhhwellsBridge() {
28549
29127
  });
28550
29128
  applyLinkByKey(key, val);
28551
29129
  }
29130
+ applySectionEmbeds(content);
29131
+ applySectionExtras(content);
28552
29132
  applyLogoFromContent(content);
28553
29133
  applyLogoSizes(content);
28554
29134
  reconcileNavbarItemsFromContent(content);
@@ -28557,6 +29137,7 @@ function OhhwellsBridge() {
28557
29137
  applySocialsDisplayFromContent(content);
28558
29138
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
28559
29139
  syncButtonsFromContent(document, content);
29140
+ applyHiddenEditablesToDom(content);
28560
29141
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
28561
29142
  if (typeof content[STYLE_STORE_KEY] === "string") {
28562
29143
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
@@ -28737,20 +29318,22 @@ function OhhwellsBridge() {
28737
29318
  }
28738
29319
  applyAiFooterFromContent(content);
28739
29320
  if (typeof content[STYLE_STORE_KEY] === "string") {
29321
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28740
29322
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28741
29323
  }
28742
29324
  for (const [key, val] of Object.entries(content)) {
28743
29325
  if (key === "__ohw_sections") continue;
28744
29326
  if (key === AI_SECTIONS_KEY) continue;
28745
29327
  if (key === AI_FOOTER_KEY) continue;
29328
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
29329
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28746
29330
  if (key === BRAND_KIT_KEY) continue;
28747
29331
  if (key === STYLE_STORE_KEY) continue;
28748
29332
  if (BRAND_CHROME_KEYS.has(key)) continue;
28749
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28750
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28751
29333
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28752
29334
  continue;
28753
29335
  }
29336
+ if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
28754
29337
  if (applyVideoSettingNode(key, val)) continue;
28755
29338
  if (applyCarouselNode(key, val)) continue;
28756
29339
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28775,6 +29358,8 @@ function OhhwellsBridge() {
28775
29358
  });
28776
29359
  applyLinkByKey(key, val);
28777
29360
  }
29361
+ applySectionEmbeds(content);
29362
+ applySectionExtras(content);
28778
29363
  applyLogoFromContent(content);
28779
29364
  reconcileNavbarItemsFromContent(content);
28780
29365
  reconcileFooterOrderFromContent(content);
@@ -28782,6 +29367,7 @@ function OhhwellsBridge() {
28782
29367
  applySocialsDisplayFromContent(content);
28783
29368
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
28784
29369
  syncButtonsFromContent(document, content);
29370
+ applyHiddenEditablesToDom(content);
28785
29371
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
28786
29372
  if (typeof content[STYLE_STORE_KEY] === "string") {
28787
29373
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
@@ -28830,7 +29416,7 @@ function OhhwellsBridge() {
28830
29416
  if (debounceTimer) clearTimeout(debounceTimer);
28831
29417
  };
28832
29418
  }, [subdomain, isEditMode, pathname]);
28833
- useLayoutEffect6(() => {
29419
+ useLayoutEffect7(() => {
28834
29420
  const el = document.getElementById("ohw-loader");
28835
29421
  if (!el) return;
28836
29422
  const visible = Boolean(subdomain) && fetchState !== "done";
@@ -28920,6 +29506,7 @@ function OhhwellsBridge() {
28920
29506
  applySocialsDisplayFromContent(content);
28921
29507
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
28922
29508
  syncButtonsFromContent(document, content);
29509
+ applyHiddenEditablesToDom(content);
28923
29510
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
28924
29511
  document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
28925
29512
  if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
@@ -29014,26 +29601,11 @@ function OhhwellsBridge() {
29014
29601
  const t2 = setTimeout(measure, 500);
29015
29602
  const ro = new ResizeObserver(schedule);
29016
29603
  ro.observe(document.body);
29017
- let lastWidth = window.innerWidth;
29018
- let resizeTimers = [];
29019
- const clearResizeTimers = () => {
29020
- resizeTimers.forEach(clearTimeout);
29021
- resizeTimers = [];
29022
- };
29023
- const handleResize = () => {
29024
- if (window.innerWidth === lastWidth) return;
29025
- lastWidth = window.innerWidth;
29026
- clearResizeTimers();
29027
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
29028
- };
29029
- window.addEventListener("resize", handleResize);
29030
29604
  return () => {
29031
29605
  clearTimeout(t1);
29032
29606
  clearTimeout(t2);
29033
29607
  if (raf != null) cancelAnimationFrame(raf);
29034
29608
  ro.disconnect();
29035
- clearResizeTimers();
29036
- window.removeEventListener("resize", handleResize);
29037
29609
  };
29038
29610
  }, [pathname, isEditMode, postToParent2]);
29039
29611
  useEffect21(() => {
@@ -29330,6 +29902,13 @@ function OhhwellsBridge() {
29330
29902
  if (target.closest("[data-ohw-state-toggle]")) return;
29331
29903
  if (target.closest("[data-ohw-max-badge]")) return;
29332
29904
  if (isInsideLinkEditor(target)) return;
29905
+ if (isInsideFloatingPanel(target)) return;
29906
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29907
+ if (target.closest(
29908
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29909
+ )) {
29910
+ return;
29911
+ }
29333
29912
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29334
29913
  clearMediaSelectionRef.current();
29335
29914
  }
@@ -29353,8 +29932,6 @@ function OhhwellsBridge() {
29353
29932
  return;
29354
29933
  }
29355
29934
  }
29356
- if (isInsideFloatingPanel(target)) return;
29357
- if (target.closest("[data-ohw-form-toolbar]")) return;
29358
29935
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29359
29936
  if (collectionItem) {
29360
29937
  e.preventDefault();
@@ -29366,11 +29943,6 @@ function OhhwellsBridge() {
29366
29943
  });
29367
29944
  return;
29368
29945
  }
29369
- if (target.closest(
29370
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29371
- )) {
29372
- return;
29373
- }
29374
29946
  {
29375
29947
  const formEl = getFormElement(target);
29376
29948
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29524,9 +30096,13 @@ function OhhwellsBridge() {
29524
30096
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29525
30097
  e.preventDefault();
29526
30098
  e.stopPropagation();
29527
- selectIconElementRef.current(editable);
29528
30099
  const aiIcon = editable.hasAttribute("data-ai-icon");
29529
30100
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
30101
+ if (aiIcon) {
30102
+ aiSectionApiRef.current?.selectFromElement(editable);
30103
+ } else {
30104
+ selectIconElementRef.current(editable);
30105
+ }
29530
30106
  postToParentRef.current({
29531
30107
  type: "ow:icon-pick",
29532
30108
  key: editable.dataset.ohwKey ?? "",
@@ -29754,6 +30330,9 @@ function OhhwellsBridge() {
29754
30330
  setHoveredItemRect(null);
29755
30331
  hoveredNavContainerRef.current = null;
29756
30332
  setHoveredNavContainerRect(null);
30333
+ siblingHintElRef.current = null;
30334
+ setSiblingHintRect(null);
30335
+ setSiblingHintRects([]);
29757
30336
  return;
29758
30337
  }
29759
30338
  {
@@ -29874,7 +30453,6 @@ function OhhwellsBridge() {
29874
30453
  hoveredNavContainerRef.current = null;
29875
30454
  setHoveredNavContainerRect(null);
29876
30455
  hoveredItemElRef.current = editable;
29877
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29878
30456
  }
29879
30457
  }
29880
30458
  }
@@ -30584,7 +31162,11 @@ function OhhwellsBridge() {
30584
31162
  };
30585
31163
  const handleMouseMove = (e) => {
30586
31164
  const { clientX, clientY } = e;
30587
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
31165
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
31166
+ dismissImageHover();
31167
+ clearImageHover();
31168
+ return;
31169
+ }
30588
31170
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30589
31171
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30590
31172
  formHoverElRef.current = null;
@@ -30613,7 +31195,12 @@ function OhhwellsBridge() {
30613
31195
  setHoveredItemRect(null);
30614
31196
  hoveredNavContainerRef.current = null;
30615
31197
  setHoveredNavContainerRect(null);
31198
+ siblingHintElRef.current = null;
31199
+ setSiblingHintRect(null);
31200
+ setSiblingHintRects([]);
30616
31201
  dismissImageHover();
31202
+ clearImageHover();
31203
+ setSectionGap(null);
30617
31204
  return;
30618
31205
  }
30619
31206
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30625,7 +31212,11 @@ function OhhwellsBridge() {
30625
31212
  if (e.data?.type !== "ow:pointer-sync") return;
30626
31213
  const { clientX, clientY } = e.data;
30627
31214
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30628
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
31215
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
31216
+ dismissImageHover();
31217
+ clearImageHover();
31218
+ return;
31219
+ }
30629
31220
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30630
31221
  if (probeSocialsRowAt(clientX, clientY)) return;
30631
31222
  probeSectionGapAt(clientX, clientY);
@@ -31005,6 +31596,7 @@ function OhhwellsBridge() {
31005
31596
  applyAiFooterFromContent(content);
31006
31597
  if (typeof content[STYLE_STORE_KEY] === "string") {
31007
31598
  stylesRef.current = content[STYLE_STORE_KEY];
31599
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31008
31600
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31009
31601
  }
31010
31602
  applyBrandChrome(content);
@@ -31019,15 +31611,16 @@ function OhhwellsBridge() {
31019
31611
  }
31020
31612
  if (key === AI_SECTIONS_KEY) continue;
31021
31613
  if (key === AI_FOOTER_KEY) continue;
31614
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31615
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31022
31616
  if (key === BRAND_KIT_KEY) continue;
31023
31617
  if (key === STYLE_STORE_KEY) continue;
31024
31618
  if (BRAND_CHROME_KEYS.has(key)) continue;
31025
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31026
31619
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
31027
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31028
31620
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31029
31621
  continue;
31030
31622
  }
31623
+ if (key.endsWith(SECTION_EMBED_SUFFIX) || key.endsWith(SECTION_EXTRA_SUFFIX)) continue;
31031
31624
  if (applyVideoSettingNode(key, val)) continue;
31032
31625
  if (applyCarouselNode(key, val)) continue;
31033
31626
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31053,6 +31646,8 @@ function OhhwellsBridge() {
31053
31646
  });
31054
31647
  applyLinkByKey(key, val);
31055
31648
  }
31649
+ applySectionEmbeds(content);
31650
+ applySectionExtras(content);
31056
31651
  applyLogoFromContent(content);
31057
31652
  applyLogoSizes(content);
31058
31653
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31067,6 +31662,7 @@ function OhhwellsBridge() {
31067
31662
  reconcileNavbarItemsFromContent(editContentRef.current);
31068
31663
  reconcileFooterOrderFromContent(editContentRef.current);
31069
31664
  syncButtonsFromContent(document, editContentRef.current);
31665
+ applyHiddenEditablesToDom(editContentRef.current);
31070
31666
  if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
31071
31667
  syncNavigationDragCursorAttrs();
31072
31668
  if (typeof content[STYLE_STORE_KEY] === "string") {
@@ -31692,6 +32288,12 @@ function OhhwellsBridge() {
31692
32288
  closeLinkPopoverRef.current();
31693
32289
  return;
31694
32290
  }
32291
+ if (floatingPanelOpenRef.current) {
32292
+ setFloatingPanelRef.current(null);
32293
+ deselectRef.current();
32294
+ deactivateRef.current();
32295
+ return;
32296
+ }
31695
32297
  deselectRef.current();
31696
32298
  deactivateRef.current();
31697
32299
  clearMediaSelectionRef.current();
@@ -31870,7 +32472,7 @@ function OhhwellsBridge() {
31870
32472
  return;
31871
32473
  }
31872
32474
  }
31873
- if ((e.key === "Delete" || e.key === "Backspace") && selectedElRef.current && !activeElRef.current && !linkPopoverOpenRef.current) {
32475
+ if ((e.key === "Delete" || e.key === "Backspace") && !activeElRef.current && !linkPopoverOpenRef.current && (selectedElRef.current || selectedMediaElRef.current || selectedIconElRef.current)) {
31874
32476
  if (handleDeleteSelectedRef.current()) {
31875
32477
  e.preventDefault();
31876
32478
  return;
@@ -32522,10 +33124,10 @@ function OhhwellsBridge() {
32522
33124
  window.removeEventListener("message", handleDuplicateSection);
32523
33125
  window.removeEventListener("message", handleDeactivate);
32524
33126
  window.removeEventListener("message", handleSelectNav);
32525
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32526
33127
  window.removeEventListener("message", handleToastAction);
32527
33128
  window.removeEventListener("message", handleFormCount);
32528
33129
  window.removeEventListener("message", handleUiEscape);
33130
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32529
33131
  autoSaveTimers.current.forEach(clearTimeout);
32530
33132
  autoSaveTimers.current.clear();
32531
33133
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32819,7 +33421,7 @@ function OhhwellsBridge() {
32819
33421
  postToParent2({
32820
33422
  type: "ow:ready",
32821
33423
  version: "1",
32822
- bridgeVersion: "0.1.171",
33424
+ bridgeVersion: "0.1.172-next.457",
32823
33425
  path: pathname,
32824
33426
  nodes: collectEditableNodes(editContentRef.current),
32825
33427
  sections
@@ -33176,7 +33778,154 @@ function OhhwellsBridge() {
33176
33778
  enforceLinkHrefs();
33177
33779
  return true;
33178
33780
  }, []);
33781
+ const deleteAiBlock = useCallback12(
33782
+ (editKey, opts) => {
33783
+ if (!opts?.fromToolbar && activeElRef.current) return false;
33784
+ if (deletingAiBlockRef.current) return false;
33785
+ const plan = planAiBlockRemoval(aiSectionsRef.current, editKey);
33786
+ if (!plan) return false;
33787
+ if (!plan.ok) {
33788
+ postToParent2({
33789
+ type: "ow:toast",
33790
+ title: plan.reasons[0] ?? "That block cannot be deleted",
33791
+ toastType: "error"
33792
+ });
33793
+ return true;
33794
+ }
33795
+ const { tree: nextTree, entry } = plan;
33796
+ const previous = aiSectionsRef.current;
33797
+ deletingAiBlockRef.current = true;
33798
+ void requestValidateTree5(postToParent2, nextTree).then(({ ok, reasons }) => {
33799
+ deletingAiBlockRef.current = false;
33800
+ if (!ok) {
33801
+ postToParent2({
33802
+ type: "ow:toast",
33803
+ title: reasons[0] ?? "That change is not allowed.",
33804
+ toastType: "error"
33805
+ });
33806
+ return;
33807
+ }
33808
+ clearMediaSelectionRef.current();
33809
+ clearIconSelectionRef.current();
33810
+ applyTreeLocalRef.current?.({
33811
+ id: entry.id,
33812
+ mode: "replace",
33813
+ targetSectionId: entry.id,
33814
+ tree: nextTree,
33815
+ label: entry.label,
33816
+ media: entry.media,
33817
+ ...entry.brand ? { brand: entry.brand } : {},
33818
+ skipScrollIntoView: true
33819
+ });
33820
+ const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `delete-block-${Date.now()}`;
33821
+ pendingDeleteUndoRef.current = {
33822
+ actionId,
33823
+ restore: () => {
33824
+ clearInteractionChromeRef.current();
33825
+ aiSectionsRef.current = previous;
33826
+ applyAiSectionsToDom(parseAiSectionsState(previous));
33827
+ const restoreHeight = document.body.scrollHeight;
33828
+ if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
33829
+ postToParent2({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: previous }] });
33830
+ postToParent2({
33831
+ type: "ow:ai-sections-changed",
33832
+ sections: collectSections(),
33833
+ nodes: collectEditableNodes(editContentRef.current)
33834
+ });
33835
+ }
33836
+ };
33837
+ postToParent2({
33838
+ type: "ow:toast",
33839
+ title: "Block deleted",
33840
+ toastType: "success",
33841
+ actionLabel: "Undo",
33842
+ actionId,
33843
+ duration: 6e3
33844
+ });
33845
+ });
33846
+ return true;
33847
+ },
33848
+ [postToParent2]
33849
+ );
33850
+ const softHideTemplateEditable = useCallback12(
33851
+ (el, opts) => {
33852
+ if (!opts?.fromToolbar && activeElRef.current) return false;
33853
+ if (!canSoftHideEditable(el, {
33854
+ isNavFooterItem: Boolean(
33855
+ getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
33856
+ )
33857
+ })) {
33858
+ return false;
33859
+ }
33860
+ const previousContent = editContentRef.current;
33861
+ const result = softHideEditableInDom(el, previousContent);
33862
+ if (!result) return false;
33863
+ editContentRef.current = result.content;
33864
+ postToParent2({ type: "ow:change", nodes: result.nodes });
33865
+ clearMediaSelectionRef.current();
33866
+ clearIconSelectionRef.current();
33867
+ clearInteractionChromeRef.current();
33868
+ clearFormPickRef.current?.();
33869
+ deselectRef.current();
33870
+ const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `hide-editable-${Date.now()}`;
33871
+ const hiddenKey = result.key;
33872
+ pendingDeleteUndoRef.current = {
33873
+ actionId,
33874
+ restore: () => {
33875
+ clearInteractionChromeRef.current();
33876
+ const restored = softUnhideEditableInDom(hiddenKey, editContentRef.current);
33877
+ editContentRef.current = restored.content;
33878
+ postToParent2({ type: "ow:change", nodes: restored.nodes });
33879
+ const restoreHeight = document.body.scrollHeight;
33880
+ if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
33881
+ }
33882
+ };
33883
+ postToParent2({
33884
+ type: "ow:toast",
33885
+ title: "Block deleted",
33886
+ toastType: "success",
33887
+ actionLabel: "Undo",
33888
+ actionId,
33889
+ duration: 6e3
33890
+ });
33891
+ return true;
33892
+ },
33893
+ [postToParent2]
33894
+ );
33895
+ const deleteFromToolbar = useCallback12(
33896
+ (editKey, el) => {
33897
+ if (!editKey && !el) return false;
33898
+ if (editKey && canRemoveAiBlock(aiSectionsRef.current, editKey)) {
33899
+ return deleteAiBlock(editKey, { fromToolbar: true });
33900
+ }
33901
+ const target = el ?? (editKey ? document.querySelector(`[data-ohw-key="${editKey.replace(/"/g, '\\"')}"]`) : null);
33902
+ if (target) return softHideTemplateEditable(target, { fromToolbar: true });
33903
+ return false;
33904
+ },
33905
+ [deleteAiBlock, softHideTemplateEditable]
33906
+ );
33907
+ const resolveSelectedAiBlockKey = useCallback12(() => {
33908
+ const candidates = [
33909
+ activeElRef.current?.dataset.ohwKey,
33910
+ selectedMediaElRef.current?.dataset.ohwKey,
33911
+ selectedMedia?.key,
33912
+ selectedIconElRef.current?.dataset.ohwKey,
33913
+ selectedElRef.current?.getAttribute("data-ohw-href-key"),
33914
+ selectedElRef.current?.dataset.ohwKey,
33915
+ selectedElRef.current?.querySelector("[data-ohw-key]")?.dataset.ohwKey
33916
+ ];
33917
+ for (const key of candidates) {
33918
+ if (key && canRemoveAiBlock(aiSectionsRef.current, key)) return key;
33919
+ }
33920
+ return null;
33921
+ }, [selectedMedia]);
33179
33922
  const handleDeleteSelected = useCallback12(() => {
33923
+ if (!activeElRef.current) {
33924
+ const aiKey = resolveSelectedAiBlockKey();
33925
+ if (aiKey && deleteAiBlock(aiKey)) return true;
33926
+ const mediaEl = selectedMediaElRef.current;
33927
+ if (mediaEl && softHideTemplateEditable(mediaEl, { fromToolbar: true })) return true;
33928
+ }
33180
33929
  const selected = selectedElRef.current;
33181
33930
  if (!selected) return false;
33182
33931
  if (isCtaButton(selected)) {
@@ -33235,7 +33984,7 @@ function OhhwellsBridge() {
33235
33984
  }
33236
33985
  }
33237
33986
  return deleted;
33238
- }, [postToParent2]);
33987
+ }, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
33239
33988
  handleDeleteSelectedRef.current = handleDeleteSelected;
33240
33989
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
33241
33990
  const handleLinkPopoverSubmit = useCallback12(
@@ -33453,6 +34202,13 @@ function OhhwellsBridge() {
33453
34202
  isUploading: false,
33454
34203
  onReplace: handleMediaReplace,
33455
34204
  onSelect: handleMediaSelect,
34205
+ onDelete: canRemoveAiBlock(aiSectionsRef.current, selectedMedia.key) || selectedMediaElRef.current != null && canSoftHideEditable(selectedMediaElRef.current, {
34206
+ isNavFooterItem: Boolean(
34207
+ getNavigationItemAnchor(selectedMediaElRef.current) && isNavFooterScopedNavigationItem(selectedMediaElRef.current) && !isCtaButton(selectedMediaElRef.current)
34208
+ )
34209
+ }) ? (key) => {
34210
+ deleteFromToolbar(key, selectedMediaElRef.current);
34211
+ } : void 0,
33456
34212
  onVideoSettingsChange: handleVideoSettingsChange
33457
34213
  }
33458
34214
  ),
@@ -33555,7 +34311,7 @@ function OhhwellsBridge() {
33555
34311
  className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
33556
34312
  onClick: () => setFieldTypePickerOpen((open) => !open),
33557
34313
  "data-ohw-add-field": "",
33558
- children: /* @__PURE__ */ jsx40(Plus5, { size: 15, "aria-hidden": true })
34314
+ children: /* @__PURE__ */ jsx40(Plus6, { size: 15, "aria-hidden": true })
33559
34315
  }
33560
34316
  ),
33561
34317
  /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
@@ -33617,7 +34373,24 @@ function OhhwellsBridge() {
33617
34373
  children: state
33618
34374
  },
33619
34375
  state
33620
- )) })
34376
+ )) }),
34377
+ /* @__PURE__ */ jsx40("div", { className: "mx-0.5 h-5 w-px bg-border" }),
34378
+ /* @__PURE__ */ jsx40(
34379
+ "button",
34380
+ {
34381
+ type: "button",
34382
+ "aria-label": "Delete form",
34383
+ title: "Delete",
34384
+ className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
34385
+ onClick: () => {
34386
+ setFieldTypePickerOpen(false);
34387
+ const form = formPickElRef.current;
34388
+ if (!form) return;
34389
+ softHideTemplateEditable(form, { fromToolbar: true });
34390
+ },
34391
+ children: /* @__PURE__ */ jsx40(Trash24, { size: 15, "aria-hidden": true })
34392
+ }
34393
+ )
33621
34394
  ]
33622
34395
  }
33623
34396
  )
@@ -33786,7 +34559,15 @@ function OhhwellsBridge() {
33786
34559
  onCommand: handleCommand,
33787
34560
  activeCommands,
33788
34561
  showEditLink,
33789
- onEditLink: openLinkPopoverForActive
34562
+ onEditLink: openLinkPopoverForActive,
34563
+ showDelete: toolbarShowAiBlockDelete,
34564
+ deleteDisabled: deletingAiBlockRef.current,
34565
+ onDelete: () => {
34566
+ const el = activeElRef.current;
34567
+ const key = el?.dataset.ohwKey;
34568
+ if (!key) return;
34569
+ deleteFromToolbar(key, el);
34570
+ }
33790
34571
  }
33791
34572
  )
33792
34573
  ] }),
@@ -34015,6 +34796,7 @@ export {
34015
34796
  FOOTER_COLUMN_BLOCKS,
34016
34797
  FOOTER_COLUMN_SPANS,
34017
34798
  FOOTER_SOCIAL_PLATFORMS,
34799
+ HIDDEN_EDITABLES_KEY,
34018
34800
  ItemActionToolbar,
34019
34801
  ItemInteractionLayer,
34020
34802
  LinkEditorPanel,
@@ -34037,9 +34819,14 @@ export {
34037
34819
  addFooterLinkColumn,
34038
34820
  appendFooterSocial,
34039
34821
  applyBrandChrome,
34822
+ applyHiddenEditablesToDom,
34040
34823
  applyStickySearchParams,
34824
+ blockPathFromEditKey,
34041
34825
  buildDefaultFooterTree,
34042
34826
  buildTarget,
34827
+ canRemoveAiBlock,
34828
+ canRemoveAiTextBlock,
34829
+ canSoftHideEditable,
34043
34830
  dropIndicatorVariants,
34044
34831
  ensureFooterTree,
34045
34832
  filterAvailablePages,
@@ -34050,6 +34837,7 @@ export {
34050
34837
  insertFooterHours,
34051
34838
  isDeadPageHref,
34052
34839
  isEditSessionActive,
34840
+ isEditableKeyHidden,
34053
34841
  isPlainLeftClick,
34054
34842
  isRenderableFooterTree,
34055
34843
  isRenderableTree,
@@ -34060,15 +34848,22 @@ export {
34060
34848
  parseAiFooterState,
34061
34849
  parseAiSectionsState,
34062
34850
  parseTarget,
34851
+ planAiBlockRemoval,
34852
+ planAiTextBlockRemoval,
34063
34853
  planBuildPageSync,
34854
+ readHiddenEditables,
34064
34855
  recordOverriddenPaths,
34065
34856
  releaseTemplateLogoIfReplaced,
34857
+ removeBlockAtPath,
34066
34858
  removeFooterBlock,
34067
34859
  resetOverriddenPathsCache,
34068
34860
  resolveFooterCopyright,
34861
+ resolveSoftHideTarget,
34069
34862
  resolveStickyNavigation,
34070
34863
  serializeAiFooterState,
34071
34864
  shouldFetchContentForPath,
34865
+ softHideEditableInDom,
34866
+ softUnhideEditableInDom,
34072
34867
  stepViableSlide,
34073
34868
  stripPlaceholderText,
34074
34869
  stripPlaceholders,
@@ -34076,6 +34871,8 @@ export {
34076
34871
  toggleVariants,
34077
34872
  useOhwCarousel,
34078
34873
  validateUrlInput,
34079
- viableSlides
34874
+ viableSlides,
34875
+ withHiddenEditable,
34876
+ withoutHiddenEditable
34080
34877
  };
34081
34878
  //# sourceMappingURL=index.js.map