@ohhwells/bridge 0.1.170 → 0.1.172-next.456

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -53,6 +53,7 @@ __export(index_exports, {
53
53
  FOOTER_COLUMN_BLOCKS: () => FOOTER_COLUMN_BLOCKS,
54
54
  FOOTER_COLUMN_SPANS: () => FOOTER_COLUMN_SPANS,
55
55
  FOOTER_SOCIAL_PLATFORMS: () => FOOTER_SOCIAL_PLATFORMS,
56
+ HIDDEN_EDITABLES_KEY: () => HIDDEN_EDITABLES_KEY,
56
57
  ItemActionToolbar: () => ItemActionToolbar,
57
58
  ItemInteractionLayer: () => ItemInteractionLayer,
58
59
  LinkEditorPanel: () => LinkEditorPanel,
@@ -75,9 +76,14 @@ __export(index_exports, {
75
76
  addFooterLinkColumn: () => addFooterLinkColumn,
76
77
  appendFooterSocial: () => appendFooterSocial,
77
78
  applyBrandChrome: () => applyBrandChrome,
79
+ applyHiddenEditablesToDom: () => applyHiddenEditablesToDom,
78
80
  applyStickySearchParams: () => applyStickySearchParams,
81
+ blockPathFromEditKey: () => blockPathFromEditKey,
79
82
  buildDefaultFooterTree: () => buildDefaultFooterTree,
80
83
  buildTarget: () => buildTarget,
84
+ canRemoveAiBlock: () => canRemoveAiBlock,
85
+ canRemoveAiTextBlock: () => canRemoveAiTextBlock,
86
+ canSoftHideEditable: () => canSoftHideEditable,
81
87
  dropIndicatorVariants: () => dropIndicatorVariants,
82
88
  ensureFooterTree: () => ensureFooterTree,
83
89
  filterAvailablePages: () => filterAvailablePages,
@@ -88,6 +94,7 @@ __export(index_exports, {
88
94
  insertFooterHours: () => insertFooterHours,
89
95
  isDeadPageHref: () => isDeadPageHref,
90
96
  isEditSessionActive: () => isEditSessionActive,
97
+ isEditableKeyHidden: () => isEditableKeyHidden,
91
98
  isPlainLeftClick: () => isPlainLeftClick,
92
99
  isRenderableFooterTree: () => isRenderableFooterTree,
93
100
  isRenderableTree: () => isRenderableTree,
@@ -98,15 +105,22 @@ __export(index_exports, {
98
105
  parseAiFooterState: () => parseAiFooterState,
99
106
  parseAiSectionsState: () => parseAiSectionsState,
100
107
  parseTarget: () => parseTarget,
108
+ planAiBlockRemoval: () => planAiBlockRemoval,
109
+ planAiTextBlockRemoval: () => planAiTextBlockRemoval,
101
110
  planBuildPageSync: () => planBuildPageSync,
111
+ readHiddenEditables: () => readHiddenEditables,
102
112
  recordOverriddenPaths: () => recordOverriddenPaths,
103
113
  releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
114
+ removeBlockAtPath: () => removeBlockAtPath,
104
115
  removeFooterBlock: () => removeFooterBlock,
105
116
  resetOverriddenPathsCache: () => resetOverriddenPathsCache,
106
117
  resolveFooterCopyright: () => resolveFooterCopyright,
118
+ resolveSoftHideTarget: () => resolveSoftHideTarget,
107
119
  resolveStickyNavigation: () => resolveStickyNavigation,
108
120
  serializeAiFooterState: () => serializeAiFooterState,
109
121
  shouldFetchContentForPath: () => shouldFetchContentForPath,
122
+ softHideEditableInDom: () => softHideEditableInDom,
123
+ softUnhideEditableInDom: () => softUnhideEditableInDom,
110
124
  stepViableSlide: () => stepViableSlide,
111
125
  stripPlaceholderText: () => stripPlaceholderText,
112
126
  stripPlaceholders: () => stripPlaceholders,
@@ -114,7 +128,9 @@ __export(index_exports, {
114
128
  toggleVariants: () => toggleVariants,
115
129
  useOhwCarousel: () => useOhwCarousel,
116
130
  validateUrlInput: () => validateUrlInput,
117
- viableSlides: () => viableSlides
131
+ viableSlides: () => viableSlides,
132
+ withHiddenEditable: () => withHiddenEditable,
133
+ withoutHiddenEditable: () => withoutHiddenEditable
118
134
  });
119
135
  module.exports = __toCommonJS(index_exports);
120
136
 
@@ -1245,21 +1261,21 @@ function chromeFrom(sample) {
1245
1261
  };
1246
1262
  }
1247
1263
  function filledPrimary(seed) {
1248
- const paint = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1249
- const luminance = relativeLuminance(paint);
1264
+ const paint2 = parseColor(paintColor(seed)) ?? { r: 15, g: 15, b: 15, a: 1 };
1265
+ const luminance = relativeLuminance(paint2);
1250
1266
  return {
1251
- background: toCss({ ...paint, a: 1 }),
1267
+ background: toCss({ ...paint2, a: 1 }),
1252
1268
  color: luminance > 0.55 ? "rgb(15, 15, 15)" : "rgb(255, 255, 255)",
1253
1269
  borderColor: TRANSPARENT,
1254
1270
  borderWidth: "0px"
1255
1271
  };
1256
1272
  }
1257
1273
  function generatedSecondary(primary) {
1258
- const paint = accentColor(primary);
1274
+ const paint2 = accentColor(primary);
1259
1275
  return {
1260
1276
  background: TRANSPARENT,
1261
- color: paint,
1262
- borderColor: paint,
1277
+ color: paint2,
1278
+ borderColor: paint2,
1263
1279
  borderWidth: "1px"
1264
1280
  };
1265
1281
  }
@@ -1272,9 +1288,9 @@ function generatedGhost(primary) {
1272
1288
  };
1273
1289
  }
1274
1290
  function normalizeOutlineChrome(outline, primary) {
1275
- const paint = accentColor(primary);
1291
+ const paint2 = accentColor(primary);
1276
1292
  const text = parseColor(outline.color);
1277
- const paintRgb = parseColor(paint);
1293
+ const paintRgb = parseColor(paint2);
1278
1294
  const primaryLabel = parseColor(primary.color);
1279
1295
  const matchesOnPrimary = Boolean(text && primaryLabel) && colorKey(outline.color) === colorKey(primary.color);
1280
1296
  const textTooLight = text ? relativeLuminance(text) > 0.7 : false;
@@ -1283,8 +1299,8 @@ function normalizeOutlineChrome(outline, primary) {
1283
1299
  const hasBorder = parseFloat(outline.borderWidth) > 0;
1284
1300
  return {
1285
1301
  ...outline,
1286
- color: paint,
1287
- borderColor: hasBorder ? paint : outline.borderColor
1302
+ color: paint2,
1303
+ borderColor: hasBorder ? paint2 : outline.borderColor
1288
1304
  };
1289
1305
  }
1290
1306
  function generateButtonVariants(samples) {
@@ -5317,6 +5333,118 @@ function deleteNavbarItem(sourceAnchor) {
5317
5333
  };
5318
5334
  }
5319
5335
 
5336
+ // src/lib/hidden-editables.ts
5337
+ var HIDDEN_EDITABLES_KEY = "__ohw_hidden_editables";
5338
+ var HIDDEN_ATTR = "data-ohw-editable-hidden";
5339
+ var FORM_SELECTOR = '[data-ohw-editable="form"]';
5340
+ function parseJson3(raw) {
5341
+ if (!raw) return null;
5342
+ try {
5343
+ return JSON.parse(raw);
5344
+ } catch {
5345
+ return null;
5346
+ }
5347
+ }
5348
+ function readHiddenEditables(content) {
5349
+ const parsed = parseJson3(content?.[HIDDEN_EDITABLES_KEY]);
5350
+ if (!Array.isArray(parsed)) return [];
5351
+ return [...new Set(parsed.filter((key) => typeof key === "string" && key.length > 0))];
5352
+ }
5353
+ function isEditableKeyHidden(content, key) {
5354
+ if (!key) return false;
5355
+ return readHiddenEditables(content).includes(key);
5356
+ }
5357
+ function resolveSoftHideTarget(el) {
5358
+ const cta = el.closest(CTA_BUTTON_SELECTOR);
5359
+ if (cta) return cta;
5360
+ const form = el.closest(FORM_SELECTOR);
5361
+ if (form) return form;
5362
+ return el;
5363
+ }
5364
+ function canSoftHideEditable(el, opts) {
5365
+ if (!el) return false;
5366
+ const target = resolveSoftHideTarget(el);
5367
+ const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
5368
+ if (!key) return false;
5369
+ if (key.startsWith("ai.")) return false;
5370
+ if (key.startsWith("__ohw_")) return false;
5371
+ if (el.hasAttribute("data-ohw-section") || target.hasAttribute("data-ohw-section")) return false;
5372
+ if (el.closest("[data-ohw-social-item]")) return false;
5373
+ if (target.matches(FORM_SELECTOR) || el.dataset.ohwEditable === "form") return true;
5374
+ const cta = el.closest(CTA_BUTTON_SELECTOR);
5375
+ if (cta) return !isLastNavbarButton(cta);
5376
+ if (opts?.isNavFooterItem) return false;
5377
+ if (el.closest("[data-ohw-nav-container], [data-ohw-nav-drawer], [data-ohw-nav-root], nav")) {
5378
+ if (el.closest("[data-ohw-href-key], [data-ohw-nav-item], [data-ohw-nav-group]")) return false;
5379
+ }
5380
+ if (el.closest("footer, [data-ai-footer]")) {
5381
+ if (el.closest("[data-ohw-href-key], [data-ohw-footer-item], [data-ohw-social-item]")) return false;
5382
+ }
5383
+ const kind = el.dataset.ohwEditable;
5384
+ return kind === "text" || kind === "plain" || kind === "image" || kind === "bg-image" || kind === "video" || kind === "icon" || kind === "link" || kind === "map";
5385
+ }
5386
+ function withHiddenEditable(content, key) {
5387
+ const hidden = readHiddenEditables(content);
5388
+ if (hidden.includes(key)) {
5389
+ return {
5390
+ content,
5391
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text: content[HIDDEN_EDITABLES_KEY] ?? "[]" }],
5392
+ added: false
5393
+ };
5394
+ }
5395
+ const nextHidden = [...hidden, key];
5396
+ const text = JSON.stringify(nextHidden);
5397
+ return {
5398
+ content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
5399
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text }],
5400
+ added: true
5401
+ };
5402
+ }
5403
+ function withoutHiddenEditable(content, key) {
5404
+ const nextHidden = readHiddenEditables(content).filter((entry) => entry !== key);
5405
+ const text = JSON.stringify(nextHidden);
5406
+ return {
5407
+ content: { ...content, [HIDDEN_EDITABLES_KEY]: text },
5408
+ nodes: [{ key: HIDDEN_EDITABLES_KEY, text }]
5409
+ };
5410
+ }
5411
+ function escapeAttrValue(value) {
5412
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
5413
+ }
5414
+ function markHidden(el) {
5415
+ softHide(el);
5416
+ el.setAttribute(HIDDEN_ATTR, "");
5417
+ }
5418
+ function markVisible(el) {
5419
+ softUnhide(el);
5420
+ el.removeAttribute(HIDDEN_ATTR);
5421
+ }
5422
+ function applyHiddenEditablesToDom(content, root = document) {
5423
+ const hidden = readHiddenEditables(content);
5424
+ root.querySelectorAll(`[${HIDDEN_ATTR}]`).forEach((el) => markVisible(el));
5425
+ for (const key of hidden) {
5426
+ root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
5427
+ markHidden(resolveSoftHideTarget(el));
5428
+ });
5429
+ }
5430
+ }
5431
+ function softHideEditableInDom(el, content) {
5432
+ if (!canSoftHideEditable(el)) return null;
5433
+ const target = resolveSoftHideTarget(el);
5434
+ const key = target.dataset.ohwKey ?? el.dataset.ohwKey;
5435
+ if (!key) return null;
5436
+ const next = withHiddenEditable(content, key);
5437
+ markHidden(target);
5438
+ return { content: next.content, nodes: next.nodes, key, target };
5439
+ }
5440
+ function softUnhideEditableInDom(key, content, root = document) {
5441
+ const next = withoutHiddenEditable(content, key);
5442
+ root.querySelectorAll(`[data-ohw-key="${escapeAttrValue(key)}"]`).forEach((el) => {
5443
+ markVisible(resolveSoftHideTarget(el));
5444
+ });
5445
+ return next;
5446
+ }
5447
+
5320
5448
  // src/lib/collect-editable-nodes.ts
5321
5449
  var VIDEO_AUTOPLAY_SUFFIX = "__ohw_autoplay";
5322
5450
  var VIDEO_MUTED_SUFFIX = "__ohw_muted";
@@ -5395,7 +5523,9 @@ function collectEditableNodes(extraContent, root = document) {
5395
5523
  BUTTON_ASSIGNMENTS_KEY,
5396
5524
  BUTTON_COLLECTIONS_KEY,
5397
5525
  BUTTON_SNAPSHOTS_KEY,
5398
- BUTTON_HIDDEN_KEY
5526
+ BUTTON_HIDDEN_KEY,
5527
+ // Soft-hidden template slots (non-AI Delete) — no DOM marker when hidden.
5528
+ HIDDEN_EDITABLES_KEY
5399
5529
  ]) {
5400
5530
  const text = extraContent[key];
5401
5531
  if (typeof text === "string" && text.length > 0) {
@@ -6880,6 +7010,21 @@ function pricingCardFeatureCount(tree, index) {
6880
7010
  const target = findPricingCollection(tree)?.children?.[index];
6881
7011
  return target ? pricingFeatureList(target).length : 0;
6882
7012
  }
7013
+ function prevailingFeatureIcon(features) {
7014
+ const counts = /* @__PURE__ */ new Map();
7015
+ for (const row of features) {
7016
+ const key = `${row.icon ?? ""}|${row.iconColor ?? ""}`;
7017
+ const entry = counts.get(key) ?? { count: 0, ...row.icon ? { icon: row.icon } : {}, ...row.iconColor ? { iconColor: row.iconColor } : {} };
7018
+ entry.count += 1;
7019
+ counts.set(key, entry);
7020
+ }
7021
+ let best = null;
7022
+ for (const entry of counts.values()) {
7023
+ if (!best || entry.count > best.count) best = entry;
7024
+ }
7025
+ if (!best) return {};
7026
+ return { ...best.icon ? { icon: best.icon } : {}, ...best.iconColor ? { iconColor: best.iconColor } : {} };
7027
+ }
6883
7028
  function addPricingCardFeature(tree, index, text) {
6884
7029
  return withPricingCollection(tree, (collection) => {
6885
7030
  const children = collection.children;
@@ -6888,7 +7033,7 @@ function addPricingCardFeature(tree, index, text) {
6888
7033
  const features = pricingFeatureList(target);
6889
7034
  if (features.length >= PRICING_FEATURES_MAX) return false;
6890
7035
  target.slots = target.slots ?? {};
6891
- target.slots.features = [...features, { text }];
7036
+ target.slots.features = [...features, { text, ...prevailingFeatureIcon(features) }];
6892
7037
  return true;
6893
7038
  });
6894
7039
  }
@@ -6955,6 +7100,127 @@ function rewriteIconSlot(tree, path, ref) {
6955
7100
  return next;
6956
7101
  }
6957
7102
 
7103
+ // src/lib/ai-remove-block.ts
7104
+ function blockPathFromEditKey(sectionId, key) {
7105
+ const prefix = aiSlotKeyPrefixFor(sectionId);
7106
+ if (!key.startsWith(prefix)) return void 0;
7107
+ const path = [];
7108
+ for (const part of key.slice(prefix.length).split(".")) {
7109
+ if (/^[rbc]\d+$/.test(part)) path.push(part);
7110
+ else break;
7111
+ }
7112
+ if (path.length < 2 || !/^r\d+$/.test(path[0]) || !/^b\d+$/.test(path[1])) return void 0;
7113
+ return path.join(".");
7114
+ }
7115
+ function parseBlockPath(path) {
7116
+ const segs = [];
7117
+ for (const part of path.split(".")) {
7118
+ const match = part.match(/^([rbc])(\d+)$/);
7119
+ if (!match) return void 0;
7120
+ segs.push({ kind: match[1], index: Number(match[2]) });
7121
+ }
7122
+ if (segs.length < 2 || segs[0].kind !== "r" || segs[1].kind !== "b") return void 0;
7123
+ return segs;
7124
+ }
7125
+ function cloneTree(tree) {
7126
+ return JSON.parse(JSON.stringify(tree));
7127
+ }
7128
+ function nodeAtPath2(tree, segs) {
7129
+ let node = tree.rows?.[segs[0].index]?.blocks?.[segs[1].index];
7130
+ for (let i = 2; i < segs.length; i += 1) {
7131
+ if (segs[i].kind !== "c") return null;
7132
+ node = node?.children?.[segs[i].index];
7133
+ }
7134
+ return node ?? null;
7135
+ }
7136
+ function unwrapPromoted(node) {
7137
+ if (node.promoted === true && node.slots?.layout === "stack" && (node.children?.length ?? 0) === 1) {
7138
+ const only = { ...node.children[0] };
7139
+ if (node.slot) only.slot = node.slot;
7140
+ only.span = node.span;
7141
+ return only;
7142
+ }
7143
+ return node;
7144
+ }
7145
+ function removeBlockAtPath(tree, path) {
7146
+ const segs = parseBlockPath(path);
7147
+ if (!segs) return { ok: false, reasons: [`invalid block path "${path}"`] };
7148
+ const next = cloneTree(tree);
7149
+ const rowIndex = segs[0].index;
7150
+ const row = next.rows[rowIndex];
7151
+ if (!row) return { ok: false, reasons: [`row ${rowIndex} not found`] };
7152
+ if (segs.length === 2) {
7153
+ const blockIndex = segs[1].index;
7154
+ if (!row.blocks[blockIndex]) return { ok: false, reasons: [`block ${path} not found`] };
7155
+ row.blocks.splice(blockIndex, 1);
7156
+ if (row.blocks.length === 0) {
7157
+ next.rows.splice(rowIndex, 1);
7158
+ } else if (row.blocks.length === 1) {
7159
+ row.blocks[0] = { ...row.blocks[0], span: 12 };
7160
+ delete row.blocks[0].slot;
7161
+ }
7162
+ } else {
7163
+ let parent = row.blocks[segs[1].index];
7164
+ for (let i = 2; i < segs.length - 1; i += 1) {
7165
+ if (!parent?.children || segs[i].kind !== "c") {
7166
+ return { ok: false, reasons: [`block ${path} not found`] };
7167
+ }
7168
+ parent = parent.children[segs[i].index];
7169
+ }
7170
+ const childIndex = segs[segs.length - 1].index;
7171
+ if (!parent?.children || segs[segs.length - 1].kind !== "c" || !parent.children[childIndex]) {
7172
+ return { ok: false, reasons: [`block ${path} not found`] };
7173
+ }
7174
+ parent.children.splice(childIndex, 1);
7175
+ if (segs.length === 3) {
7176
+ row.blocks[segs[1].index] = unwrapPromoted(parent);
7177
+ if (row.blocks[segs[1].index].type === "group" && (row.blocks[segs[1].index].children?.length ?? 0) === 0) {
7178
+ row.blocks.splice(segs[1].index, 1);
7179
+ if (row.blocks.length === 0) next.rows.splice(rowIndex, 1);
7180
+ }
7181
+ if (next.rows[rowIndex]?.blocks.length === 1) {
7182
+ next.rows[rowIndex].blocks[0] = { ...next.rows[rowIndex].blocks[0], span: 12 };
7183
+ delete next.rows[rowIndex].blocks[0].slot;
7184
+ }
7185
+ } else {
7186
+ const grand = row.blocks[segs[1].index];
7187
+ let cursor = grand;
7188
+ for (let i = 2; i < segs.length - 2; i += 1) {
7189
+ cursor = cursor?.children?.[segs[i].index];
7190
+ }
7191
+ const containerIndex = segs[segs.length - 2].index;
7192
+ if (cursor?.children?.[containerIndex]) {
7193
+ cursor.children[containerIndex] = unwrapPromoted(parent);
7194
+ }
7195
+ }
7196
+ }
7197
+ if (next.rows.length === 0) {
7198
+ return { ok: false, reasons: ["a section must keep at least one block"] };
7199
+ }
7200
+ return { ok: true, tree: next };
7201
+ }
7202
+ function planAiBlockRemoval(aiSectionsRaw, editKey) {
7203
+ if (!editKey || !editKey.startsWith("ai.")) return null;
7204
+ const state = parseAiSectionsState(aiSectionsRaw);
7205
+ const entry = state.sections.find((s) => editKey.startsWith(aiSlotKeyPrefixFor(s.id)));
7206
+ if (!entry) return null;
7207
+ const path = blockPathFromEditKey(entry.id, editKey);
7208
+ if (!path) return null;
7209
+ const segs = parseBlockPath(path);
7210
+ if (!segs) return null;
7211
+ const node = nodeAtPath2(entry.tree, segs);
7212
+ if (!node) return null;
7213
+ const removed = removeBlockAtPath(entry.tree, path);
7214
+ if (!removed.ok) return removed;
7215
+ return { ok: true, tree: removed.tree, path, entry };
7216
+ }
7217
+ var planAiTextBlockRemoval = planAiBlockRemoval;
7218
+ function canRemoveAiBlock(aiSectionsRaw, editKey) {
7219
+ const plan = planAiBlockRemoval(aiSectionsRaw, editKey);
7220
+ return plan?.ok === true;
7221
+ }
7222
+ var canRemoveAiTextBlock = canRemoveAiBlock;
7223
+
6958
7224
  // src/lib/ai-footer-tree.ts
6959
7225
  var FOOTER_COLUMN_SPANS = [12, 6, 4, 3];
6960
7226
  var FOOTER_COLUMN_BLOCKS = [
@@ -7532,6 +7798,120 @@ function findSelectableNavContainer(doc = document) {
7532
7798
  );
7533
7799
  }
7534
7800
 
7801
+ // src/lib/youtube.ts
7802
+ var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
7803
+ function extractYouTubeId(input) {
7804
+ const trimmed = input.trim();
7805
+ if (!trimmed) return null;
7806
+ if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
7807
+ let url;
7808
+ try {
7809
+ url = new URL(trimmed);
7810
+ } catch {
7811
+ return null;
7812
+ }
7813
+ const host = url.hostname.replace(/^www\./, "");
7814
+ if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
7815
+ return null;
7816
+ }
7817
+ let candidate = null;
7818
+ if (host === "youtu.be") {
7819
+ candidate = url.pathname.slice(1).split("/")[0] ?? null;
7820
+ } else if (url.pathname === "/watch") {
7821
+ candidate = url.searchParams.get("v");
7822
+ } else {
7823
+ const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
7824
+ candidate = match ? match[1] : null;
7825
+ }
7826
+ return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
7827
+ }
7828
+
7829
+ // src/lib/section-embed.ts
7830
+ var SECTION_EMBED_SUFFIX = "__ohw_embed";
7831
+ function readStoredEmbed(value) {
7832
+ if (value.startsWith("start\n")) {
7833
+ return { raw: value.slice("start\n".length), at: "start" };
7834
+ }
7835
+ return { raw: value, at: "end" };
7836
+ }
7837
+ function embedFrameSrc(value) {
7838
+ const videoId = extractYouTubeId(value);
7839
+ if (videoId) {
7840
+ return { src: `https://www.youtube-nocookie.com/embed/${videoId}?rel=0`, title: "YouTube video" };
7841
+ }
7842
+ let url;
7843
+ try {
7844
+ url = new URL(value);
7845
+ } catch {
7846
+ return null;
7847
+ }
7848
+ const host = url.hostname.replace(/^www\./, "").toLowerCase();
7849
+ if (host === "google.com" && url.pathname.startsWith("/maps") || host === "maps.google.com") {
7850
+ const query = url.searchParams.get("q") || url.searchParams.get("query") || "";
7851
+ const src = query ? `https://maps.google.com/maps?q=${encodeURIComponent(query)}&output=embed` : `https://maps.google.com/maps?output=embed`;
7852
+ return { src, title: "Map" };
7853
+ }
7854
+ if (host === "maps.app.goo.gl") {
7855
+ return { src: value, title: "Map" };
7856
+ }
7857
+ if (host === "calendly.com" || host.endsWith(".calendly.com") || host === "calendar.google.com") {
7858
+ return { src: value, title: "Calendar" };
7859
+ }
7860
+ if (host === "docs.google.com" && url.pathname.includes("/forms/")) {
7861
+ return { src: value.replace(/\/edit(?:\?.*)?$/i, "/viewform"), title: "Form" };
7862
+ }
7863
+ if (host === "forms.gle") {
7864
+ return { src: value, title: "Form" };
7865
+ }
7866
+ return null;
7867
+ }
7868
+ function place(section, box, at) {
7869
+ if (at === "start") {
7870
+ section.insertBefore(box, section.firstChild);
7871
+ return;
7872
+ }
7873
+ section.appendChild(box);
7874
+ }
7875
+ function paint(section, key, src, title, at) {
7876
+ const existing = section.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`);
7877
+ const frame = existing?.querySelector("iframe");
7878
+ if (existing && frame) {
7879
+ if (frame.getAttribute("src") !== src) frame.setAttribute("src", src);
7880
+ frame.title = title;
7881
+ place(section, existing, at);
7882
+ return;
7883
+ }
7884
+ existing?.remove();
7885
+ const box = document.createElement("div");
7886
+ box.setAttribute("data-ohw-section-embed", key);
7887
+ 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;";
7888
+ const frameWrap = document.createElement("div");
7889
+ frameWrap.style.cssText = "position:relative;width:100%;aspect-ratio:16/9;min-height:250px;border-radius:12px;overflow:hidden;background:#0f172a;";
7890
+ const iframe = document.createElement("iframe");
7891
+ iframe.src = src;
7892
+ iframe.title = title;
7893
+ iframe.style.cssText = "position:absolute;inset:0;width:100%;height:100%;border:0;";
7894
+ iframe.allow = "accelerometer; autoplay; clipboard-write; encrypted-media; fullscreen; gyroscope; picture-in-picture";
7895
+ iframe.setAttribute("allowfullscreen", "");
7896
+ frameWrap.appendChild(iframe);
7897
+ box.appendChild(frameWrap);
7898
+ place(section, box, at);
7899
+ }
7900
+ function applySectionEmbeds(content) {
7901
+ for (const [key, val] of Object.entries(content)) {
7902
+ if (!key.endsWith(SECTION_EMBED_SUFFIX)) continue;
7903
+ const sectionId = key.slice(0, -SECTION_EMBED_SUFFIX.length);
7904
+ const section = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
7905
+ const stored = typeof val === "string" ? readStoredEmbed(val) : null;
7906
+ const frame = stored ? embedFrameSrc(stored.raw) : null;
7907
+ if (!section || !stored || !frame) {
7908
+ section?.querySelector(`[data-ohw-section-embed="${CSS.escape(key)}"]`)?.remove();
7909
+ continue;
7910
+ }
7911
+ paint(section, key, frame.src, frame.title, stored.at);
7912
+ }
7913
+ }
7914
+
7535
7915
  // src/ui/ai-tree/aiSectionsManager.tsx
7536
7916
  var import_react_dom = require("react-dom");
7537
7917
  var import_client = require("react-dom/client");
@@ -8054,12 +8434,19 @@ function footerBodyStyle(fallbackFont, color, weight = 500) {
8054
8434
  }
8055
8435
  var str = (value) => typeof value === "string" ? value : "";
8056
8436
  var cardRadius = (slots) => slots.cornerStyle === "sharp" ? 0 : AI_TREE_TOKENS.radiusCard;
8057
- var blockAlignStyle = (blockAlign) => blockAlign ? {
8058
- display: "flex",
8059
- flexDirection: "column",
8060
- alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
8061
- textAlign: blockAlign
8062
- } : {};
8437
+ var HUG_ALIGN_TYPES = /* @__PURE__ */ new Set(["button", "button-row", "rating"]);
8438
+ var blockAlignStyle = (blockAlign, blockType) => {
8439
+ if (!blockAlign) return {};
8440
+ if (blockType && HUG_ALIGN_TYPES.has(blockType)) {
8441
+ return {
8442
+ display: "flex",
8443
+ flexDirection: "column",
8444
+ alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
8445
+ textAlign: blockAlign
8446
+ };
8447
+ }
8448
+ return { width: "100%", textAlign: blockAlign, boxSizing: "border-box" };
8449
+ };
8063
8450
  var fullBleedBlock = (block) => block.type === "carousel" || block.type === "group" && str(block.slots?.layout) === "overlap";
8064
8451
  var featureLines = (value) => value.split(/\n|<br\s*\/?>/i).map((line) => line.trim()).filter(Boolean);
8065
8452
  var AI_MOBILE_CSS = [
@@ -8105,7 +8492,7 @@ var AI_MOBILE_CSS = [
8105
8492
  // page's first section. Top only (bottom needs no nav clearance); ~96px approximates the
8106
8493
  // template nav's own height (measured ~94px) — there's no shared `--ohw-header-h` var to read
8107
8494
  // an exact figure from (no live measurement exists), so this is a safe approximation, not a
8108
- // pixel-exact fit. Horizontal spacing already comes from `data-ai-container`.
8495
+ // pixel-exact fit. Horizontal spacing already comes from `data-ai-section-inner`.
8109
8496
  '[data-ai-overlay-clearance] [data-ai-overlap-layer="overlay"]{padding-top:96px}',
8110
8497
  // A full-bleed carousel's height is pure arithmetic: it spans the whole window, so 16/9 turns
8111
8498
  // window width straight into height. Measured at 16/9 it came out ~90% of the viewport at EVERY
@@ -8121,8 +8508,10 @@ var AI_MOBILE_CSS = [
8121
8508
  "[data-ai-section]{overflow-x:hidden}",
8122
8509
  // `:not([data-ai-full-bleed])`: this `!important` gutter beat the inline `padding: 0` that a
8123
8510
  // full-bleed section's container sets, so a carousel/media hero that is edge-to-edge on desktop
8124
- // still got a 20px band of section background down both sides on a phone.
8125
- "[data-ai-container]:not([data-ai-full-bleed]){padding:0 20px !important}",
8511
+ // still got a 20px band of section background down both sides on a phone. The footer's own
8512
+ // container keeps the unguarded rule below — `data-ai-full-bleed` can never appear on it.
8513
+ "[data-ai-section-inner]:not([data-ai-full-bleed]){padding:0 20px !important}",
8514
+ "[data-ai-container]{padding:0 20px !important}",
8126
8515
  "[data-ai-row]{display:flex !important;flex-direction:column !important;align-items:stretch !important}",
8127
8516
  "[data-ai-cell]{width:100%;min-width:0}",
8128
8517
  // The rule above turns every row into a COLUMN flex container on phones, which silently breaks
@@ -8327,6 +8716,31 @@ function pricingCardEmphasis(featured, ctx, hasBg) {
8327
8716
  function textAttrs(ctx, path) {
8328
8717
  return ctx.keyFor ? { "data-ohw-key": ctx.keyFor(path), "data-ohw-editable": "text" } : {};
8329
8718
  }
8719
+ var AI_RESPONSIVE_CSS = [
8720
+ "@media (max-width: 960px) {",
8721
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: repeat(2, 1fr) !important; }",
8722
+ ' [data-ai-responsive] [data-ai-grid="1"] { grid-template-columns: 1fr !important; }',
8723
+ "}",
8724
+ "@media (max-width: 640px) {",
8725
+ " [data-ai-responsive] [data-ai-grid] { grid-template-columns: 1fr !important; }",
8726
+ " [data-ai-responsive] [data-ai-columns] > * { grid-column: 1 / -1 !important; }",
8727
+ // Group containers flatten to a column on phones; span placements come along for free.
8728
+ // `:not([data-ai-group="overlap"])` for the same reason as the twin pair in AI_MOBILE_CSS — see
8729
+ // the comment there. This sheet's copy is the narrower selector, so without the exemption it
8730
+ // flattens an `overlap` hero below 640px even though the other rule stands down: measured a 390px
8731
+ // viewport with the heading/CTA in flow *under* the image, 219px of section background where the
8732
+ // layered text used to be.
8733
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) { display: flex !important; flex-direction: column !important; }',
8734
+ ' [data-ai-responsive] [data-ai-group]:not([data-ai-group="overlap"]) > * { grid-column: auto !important; }',
8735
+ // `:not([data-ai-full-bleed])` for the same reason as the twin rule in AI_MOBILE_CSS: this one
8736
+ // is narrower (0,2,0 vs 0,1,0) and also `!important`, so without the guard it wins outright and
8737
+ // a full-bleed hero gets its 20px side band back below 640px only — the one width where the
8738
+ // other rule had already been taught to stand down.
8739
+ " [data-ai-responsive] [data-ai-section-inner]:not([data-ai-full-bleed]) { padding-left: 20px !important; padding-right: 20px !important; }",
8740
+ " [data-ai-responsive] { overflow-x: hidden; }",
8741
+ " [data-ai-responsive] img { max-width: 100%; }",
8742
+ "}"
8743
+ ].join("\n");
8330
8744
  var TRANSPARENT_PX = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
8331
8745
  function MediaBox({
8332
8746
  refValue,
@@ -8381,7 +8795,7 @@ function MediaBox({
8381
8795
  position: fill ? "absolute" : void 0,
8382
8796
  inset: fill ? 0 : void 0,
8383
8797
  width: fill ? "100%" : fixedSize ? "auto" : "100%",
8384
- height: fill ? "100%" : void 0,
8798
+ height: fill ? "100%" : fixedSize ? height : void 0,
8385
8799
  aspectRatio: fill ? void 0 : aspectRatio,
8386
8800
  minHeight: fill || fixedSize ? void 0 : height ?? (aspectRatio ? void 0 : 180),
8387
8801
  borderRadius: radius,
@@ -8582,7 +8996,13 @@ function TextBlock({
8582
8996
  "div",
8583
8997
  {
8584
8998
  ...textAttrs(ctx, `${path}.content`),
8585
- style: { ...typeStyle(spec, font), color: ctx.brand.palette.dark, textAlign: align },
8999
+ style: {
9000
+ ...typeStyle(spec, font),
9001
+ color: ctx.brand.palette.dark,
9002
+ textAlign: align,
9003
+ width: "100%",
9004
+ boxSizing: "border-box"
9005
+ },
8586
9006
  dangerouslySetInnerHTML: { __html: str(slots.content) }
8587
9007
  }
8588
9008
  );
@@ -8593,7 +9013,7 @@ function SectionHeaderBlock({ node, ctx, path }) {
8593
9013
  const children = node.children ?? [];
8594
9014
  const buttonRowIdx = children.findIndex((c) => c.type === "button-row");
8595
9015
  const buttonRow = buttonRowIdx >= 0 ? children[buttonRowIdx] : void 0;
8596
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: align }, children: [
9016
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { textAlign: align, width: "100%", boxSizing: "border-box" }, children: [
8597
9017
  str(slots.tagline) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
8598
9018
  "div",
8599
9019
  {
@@ -9877,7 +10297,7 @@ function CollectionBlock({ node, ctx, path }) {
9877
10297
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
9878
10298
  "div",
9879
10299
  {
9880
- "data-ai-grid": "",
10300
+ "data-ai-grid": String(itemsPerRow),
9881
10301
  "data-ohw-pricing-collection": isPricing ? "" : void 0,
9882
10302
  style: {
9883
10303
  display: "grid",
@@ -10179,7 +10599,7 @@ function renderNode(node, ctx, path, ambientAlign) {
10179
10599
  },
10180
10600
  children: [
10181
10601
  i > 0 && ctx.heroOverlapFullBleed ? (
10182
- // The section's `data-ai-container` gave up its max-width/gutter so the base
10602
+ // The section's `data-ai-section-inner` gave up its max-width/gutter so the base
10183
10603
  // layer (this group's i===0 sibling) can span edge-to-edge — reintroduced here,
10184
10604
  // scoped to just the overlay text, so a heading/copy/CTA stack doesn't stretch
10185
10605
  // the full section width instead of reading at the usual content width.
@@ -10212,10 +10632,10 @@ function renderNode(node, ctx, path, ambientAlign) {
10212
10632
  gridColumn: `span ${typeof child.span === "number" ? Math.min(12, Math.max(1, child.span)) : 12}`,
10213
10633
  minWidth: 0
10214
10634
  } : { minWidth: 0 },
10215
- // A child's own `align` (or the group's inherited `ambientAlign`, e.g. from an
10216
- // `overlap` overlay layer — see renderNode) positions it within this column; a stack
10217
- // child otherwise stretches full-width (unchanged pre-existing behaviour).
10218
- ...blockAlignStyle(child.align ?? ambientAlign)
10635
+ // Same ambient as renderNode below: child's own align, else the group's, else the
10636
+ // inherited ambient (overlap overlay / section). Copy fills the column; button-row
10637
+ // etc. still hug via flex alignItems.
10638
+ ...blockAlignStyle(child.align ?? node.align ?? ambientAlign, child.type)
10219
10639
  },
10220
10640
  children: renderNode(child, ctx, `${path}.c${i}`, node.align ?? ambientAlign)
10221
10641
  },
@@ -10584,12 +11004,7 @@ function AiTreeRenderer({
10584
11004
  if (fillHeight) return "stretch";
10585
11005
  return (distributed ?? settings.verticalPosition) === "top" ? "start" : "center";
10586
11006
  };
10587
- const cellAlignStyle = (blockAlign) => blockAlign ? {
10588
- display: "flex",
10589
- flexDirection: "column",
10590
- alignItems: blockAlign === "left" ? "flex-start" : blockAlign === "right" ? "flex-end" : "center",
10591
- textAlign: blockAlign
10592
- } : {};
11007
+ const cellAlignStyle = (blockAlign, blockType) => blockAlignStyle(blockAlign, blockType);
10593
11008
  const needsOverlayClearance = fillHeight && pad === 0;
10594
11009
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
10595
11010
  "section",
@@ -10598,6 +11013,7 @@ function AiTreeRenderer({
10598
11013
  ...fillHeight ? { "data-ai-fill-height": "" } : {},
10599
11014
  ...needsOverlayClearance ? { "data-ai-overlay-clearance": "" } : {},
10600
11015
  ...bgAttrs,
11016
+ "data-ai-responsive": "",
10601
11017
  style: {
10602
11018
  position: "relative",
10603
11019
  padding: `${padCss} 0`,
@@ -10611,12 +11027,13 @@ function AiTreeRenderer({
10611
11027
  ...fillHeight ? { display: "grid" } : {}
10612
11028
  },
10613
11029
  children: [
10614
- isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
11030
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_RESPONSIVE_CSS }),
10615
11031
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { children: AI_MOBILE_CSS }),
11032
+ isOverlay && backgroundUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { position: "absolute", inset: 0, background: `rgba(255,255,255,${overlayAlpha})` } }),
10616
11033
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10617
11034
  "div",
10618
11035
  {
10619
- "data-ai-container": "",
11036
+ "data-ai-section-inner": "",
10620
11037
  ...fullBleedMedia ? { "data-ai-full-bleed": "" } : {},
10621
11038
  style: {
10622
11039
  position: "relative",
@@ -10633,7 +11050,7 @@ function AiTreeRenderer({
10633
11050
  children: tree.rows.map((row, r2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
10634
11051
  "div",
10635
11052
  {
10636
- "data-ai-row": "",
11053
+ "data-ai-columns": "",
10637
11054
  style: {
10638
11055
  display: "grid",
10639
11056
  gridTemplateColumns: "repeat(12, 1fr)",
@@ -10649,11 +11066,11 @@ function AiTreeRenderer({
10649
11066
  gridColumn: `span ${Math.min(12, Math.max(1, block.span))}`,
10650
11067
  minWidth: 0,
10651
11068
  // Cascades the section's min-height stretch (see `fillHeight` above) down to
10652
- // this cell; `cellAlignStyle` below overrides to `flex` when the block also has
10653
- // its own horizontal `align`, which takes priority for that block.
11069
+ // this cell; `cellAlignStyle` below overrides when the block also has its own
11070
+ // horizontal `align` (flex hug for buttons; width 100% for text).
10654
11071
  ...fillHeight ? { display: "grid" } : {},
10655
11072
  // Horizontal placement of the block's content within its column.
10656
- ...fullBleedBlock(block) ? {} : cellAlignStyle(block.align),
11073
+ ...fullBleedBlock(block) ? {} : cellAlignStyle(block.align, block.type),
10657
11074
  // space-between: each column becomes a flex column whose content spreads over
10658
11075
  // the full row height instead of clumping at the top.
10659
11076
  ...distributed === "space-between" ? { display: "flex", flexDirection: "column", justifyContent: "space-between" } : {}
@@ -11295,9 +11712,10 @@ function applyAiSectionsToDom(state, options) {
11295
11712
  if (existing && existing.serialized === serialized && existing.container.isConnected) {
11296
11713
  continue;
11297
11714
  }
11298
- const isNewMount = !existing || !existing.container.isConnected;
11299
11715
  let container = existing?.container;
11716
+ let isNewMount = false;
11300
11717
  if (!container || !container.isConnected) {
11718
+ isNewMount = true;
11301
11719
  existing?.root.unmount();
11302
11720
  container?.remove();
11303
11721
  container = document.createElement("div");
@@ -11377,7 +11795,7 @@ var import_client2 = require("react-dom/client");
11377
11795
  var import_react_dom2 = require("react-dom");
11378
11796
  var import_jsx_runtime3 = require("react/jsx-runtime");
11379
11797
  var CONTAINER_ATTR2 = "data-ohw-ai-footer";
11380
- var HIDDEN_ATTR = "data-ohw-ai-footer-replaced";
11798
+ var HIDDEN_ATTR2 = "data-ohw-ai-footer-replaced";
11381
11799
  var mounted2 = null;
11382
11800
  var mountOptions = {};
11383
11801
  var capturedSurface;
@@ -11407,12 +11825,12 @@ function findTemplateFooter() {
11407
11825
  function hideTemplateFooter(footer) {
11408
11826
  if (!footer) return;
11409
11827
  footer.style.display = "none";
11410
- footer.setAttribute(HIDDEN_ATTR, "");
11828
+ footer.setAttribute(HIDDEN_ATTR2, "");
11411
11829
  }
11412
11830
  function showTemplateFooter() {
11413
- for (const el of document.querySelectorAll(`[${HIDDEN_ATTR}]`)) {
11831
+ for (const el of document.querySelectorAll(`[${HIDDEN_ATTR2}]`)) {
11414
11832
  el.style.removeProperty("display");
11415
- el.removeAttribute(HIDDEN_ATTR);
11833
+ el.removeAttribute(HIDDEN_ATTR2);
11416
11834
  }
11417
11835
  }
11418
11836
  function unmountAiFooter() {
@@ -11607,7 +12025,7 @@ function pickFooterColumnIndex(columnBlockCounts) {
11607
12025
  }
11608
12026
 
11609
12027
  // src/lib/ai-footer-edits.ts
11610
- function cloneTree(tree) {
12028
+ function cloneTree2(tree) {
11611
12029
  return JSON.parse(JSON.stringify(tree));
11612
12030
  }
11613
12031
  function rebalanceFooterColumnSpans(columns) {
@@ -11635,6 +12053,34 @@ function minSpanForFooterBlock(type) {
11635
12053
  return 3;
11636
12054
  }
11637
12055
  }
12056
+ function readLiveSocialItems() {
12057
+ const root = getFooterRoot();
12058
+ const row = root?.querySelector("[data-ohw-socials-row]");
12059
+ if (!row) return [];
12060
+ const items = [];
12061
+ for (const anchor of Array.from(row.querySelectorAll("a[href]"))) {
12062
+ const href = anchor.getAttribute("href")?.trim() ?? "";
12063
+ const aria = anchor.getAttribute("aria-label")?.trim().toLowerCase() ?? "";
12064
+ const platform = FOOTER_SOCIAL_PLATFORMS.find((name) => aria === name) ?? FOOTER_SOCIAL_PLATFORMS.find((name) => href.toLowerCase().includes(name));
12065
+ if (!platform || !/^https?:\/\//i.test(href)) continue;
12066
+ items.push({ platform, href });
12067
+ }
12068
+ return items;
12069
+ }
12070
+ function syncSocialRowsFromDom(tree) {
12071
+ const root = getFooterRoot();
12072
+ if (!root) return;
12073
+ const row = root.querySelector("[data-ohw-socials-row]");
12074
+ const live = readLiveSocialItems();
12075
+ if (row && live.length === 0) return;
12076
+ for (const col of tree.columns) {
12077
+ col.blocks = col.blocks.flatMap((block) => {
12078
+ if (block.type !== "social-row") return [block];
12079
+ if (!row) return [];
12080
+ return [{ ...block, items: live.map((item) => ({ platform: item.platform, href: item.href })) }];
12081
+ });
12082
+ }
12083
+ }
11638
12084
  function collectBrandBlocks(tree) {
11639
12085
  const brand = [];
11640
12086
  for (const col of tree.columns) {
@@ -11657,7 +12103,7 @@ function countFooterLinkLists(tree) {
11657
12103
  return collectLinkListBlocks(tree).length;
11658
12104
  }
11659
12105
  function packFooterTreeBrand(tree) {
11660
- const next = cloneTree(tree);
12106
+ const next = cloneTree2(tree);
11661
12107
  const brand = collectBrandBlocks(next);
11662
12108
  const lists = collectLinkListBlocks(next);
11663
12109
  if (lists.length === 0) {
@@ -11742,7 +12188,7 @@ function ensureFooterTree(tree, opts) {
11742
12188
  return tree ?? buildDefaultFooterTree(opts);
11743
12189
  }
11744
12190
  function appendFooterSocial(tree, entry) {
11745
- const next = cloneTree(tree);
12191
+ const next = cloneTree2(tree);
11746
12192
  const platform = entry.platform.trim().toLowerCase();
11747
12193
  const href = entry.href.trim();
11748
12194
  for (const col2 of next.columns) {
@@ -11771,7 +12217,7 @@ function appendFooterSocial(tree, entry) {
11771
12217
  return next;
11772
12218
  }
11773
12219
  function insertFooterHours(tree, hours, title = "Hours") {
11774
- const next = cloneTree(tree);
12220
+ const next = cloneTree2(tree);
11775
12221
  const idx = pickFooterColumnIndex(next.columns.map((c) => c.blocks.length));
11776
12222
  const col = next.columns[idx] ?? next.columns[0];
11777
12223
  if (!col) return next;
@@ -11798,7 +12244,7 @@ function addFooterLinkColumn(tree, column) {
11798
12244
  return next;
11799
12245
  }
11800
12246
  function removeFooterBlock(tree, predicate) {
11801
- const next = cloneTree(tree);
12247
+ const next = cloneTree2(tree);
11802
12248
  for (let c = 0; c < next.columns.length; c++) {
11803
12249
  const col = next.columns[c];
11804
12250
  if (!col) continue;
@@ -11834,7 +12280,7 @@ function foldAiFooterSlotOverride(tree, key, value) {
11834
12280
  const path = key.slice(prefix.length);
11835
12281
  const brandMatch = path.match(/^brand\.b(\d+)\.(.+)$/);
11836
12282
  if (!brandMatch) return null;
11837
- const next = cloneTree(tree);
12283
+ const next = cloneTree2(tree);
11838
12284
  const brands = [];
11839
12285
  for (const col of next.columns) {
11840
12286
  for (const block2 of col.blocks) {
@@ -11879,7 +12325,8 @@ function textOf2(el) {
11879
12325
  return (el?.textContent ?? "").replace(/\s+/g, " ").trim();
11880
12326
  }
11881
12327
  function syncFooterTreeLinksFromDom(tree) {
11882
- const next = cloneTree(tree);
12328
+ const next = cloneTree2(tree);
12329
+ syncSocialRowsFromDom(next);
11883
12330
  const domCols = listFooterColumns().map((col) => {
11884
12331
  const heading = getFooterColumnHeadingEl(col);
11885
12332
  const title = heading ? textOf2(heading) : void 0;
@@ -12360,7 +12807,7 @@ var PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]-?/g;
12360
12807
  var HAS_PLACEHOLDER_RE = /\[[A-Za-z][A-Za-z0-9 _/&#'.-]{0,30}\]/;
12361
12808
  var SKIPPED_TAGS = /* @__PURE__ */ new Set(["SCRIPT", "STYLE", "NOSCRIPT", "TEXTAREA", "CODE", "PRE"]);
12362
12809
  var TEXT_ATTRS = ["alt", "title", "aria-label", "placeholder"];
12363
- var HIDDEN_ATTR2 = "data-ohw-placeholder-hidden";
12810
+ var HIDDEN_ATTR3 = "data-ohw-placeholder-hidden";
12364
12811
  function hasPlaceholder(text) {
12365
12812
  return HAS_PLACEHOLDER_RE.test(text);
12366
12813
  }
@@ -12379,10 +12826,10 @@ function skipped(el) {
12379
12826
  }
12380
12827
  function hideIfEmptied(el) {
12381
12828
  const control = el?.closest("a, button");
12382
- if (!control || control.hasAttribute(HIDDEN_ATTR2)) return;
12829
+ if (!control || control.hasAttribute(HIDDEN_ATTR3)) return;
12383
12830
  if ((control.textContent ?? "").trim()) return;
12384
12831
  if (control.querySelector("img, svg, picture, video")) return;
12385
- control.setAttribute(HIDDEN_ATTR2, "");
12832
+ control.setAttribute(HIDDEN_ATTR3, "");
12386
12833
  control.style.display = "none";
12387
12834
  }
12388
12835
  function stripElementAttrs(el) {
@@ -17531,10 +17978,10 @@ function ItemInteractionLayer({
17531
17978
  }
17532
17979
 
17533
17980
  // src/lib/forms.ts
17534
- var FORM_SELECTOR = '[data-ohw-editable="form"]';
17981
+ var FORM_SELECTOR2 = '[data-ohw-editable="form"]';
17535
17982
  function getFormElement(el) {
17536
17983
  if (!el) return null;
17537
- return el.closest(FORM_SELECTOR);
17984
+ return el.closest(FORM_SELECTOR2);
17538
17985
  }
17539
17986
  function formKeyOf(form) {
17540
17987
  return form.getAttribute("data-ohw-key");
@@ -17595,7 +18042,7 @@ function clearSubmitError(form) {
17595
18042
  if (note) note.style.display = "none";
17596
18043
  }
17597
18044
  var SUCCESS_TEXT_ATTR = "data-ohw-form-success-text";
17598
- var HIDDEN_ATTR3 = "data-ohw-form-hidden";
18045
+ var HIDDEN_ATTR4 = "data-ohw-form-hidden";
17599
18046
  var DEFAULT_SUCCESS_TEXT = "Thanks! We'll be in touch.";
17600
18047
  function formSuccessKey(formKey) {
17601
18048
  return `${formKey}-success`;
@@ -17621,13 +18068,13 @@ function setFormViewState(form, formKey, state, initialText) {
17621
18068
  Array.from(form.children).forEach((child) => {
17622
18069
  if (!(child instanceof HTMLElement) || child === success) return;
17623
18070
  if (state === "success") {
17624
- if (!child.hasAttribute(HIDDEN_ATTR3)) {
17625
- child.setAttribute(HIDDEN_ATTR3, child.style.display);
18071
+ if (!child.hasAttribute(HIDDEN_ATTR4)) {
18072
+ child.setAttribute(HIDDEN_ATTR4, child.style.display);
17626
18073
  child.style.display = "none";
17627
18074
  }
17628
- } else if (child.hasAttribute(HIDDEN_ATTR3)) {
17629
- child.style.display = child.getAttribute(HIDDEN_ATTR3) ?? "";
17630
- child.removeAttribute(HIDDEN_ATTR3);
18075
+ } else if (child.hasAttribute(HIDDEN_ATTR4)) {
18076
+ child.style.display = child.getAttribute(HIDDEN_ATTR4) ?? "";
18077
+ child.removeAttribute(HIDDEN_ATTR4);
17631
18078
  }
17632
18079
  });
17633
18080
  success.style.display = state === "success" ? "" : "none";
@@ -17646,7 +18093,7 @@ function bindPublishedForms(apiUrl, subdomain, content = {}) {
17646
18093
  "submit",
17647
18094
  async (e) => {
17648
18095
  const target = e.target;
17649
- const form = target?.closest(FORM_SELECTOR);
18096
+ const form = target?.closest(FORM_SELECTOR2);
17650
18097
  if (!form || !(form instanceof HTMLFormElement)) return;
17651
18098
  const formKey = formKeyOf(form);
17652
18099
  if (!formKey) return;
@@ -17692,7 +18139,7 @@ function apiBase() {
17692
18139
  function bridgeVersion() {
17693
18140
  try {
17694
18141
  if (true) {
17695
- return "0.1.170";
18142
+ return "0.1.172-next.456";
17696
18143
  }
17697
18144
  } catch {
17698
18145
  }
@@ -17706,7 +18153,7 @@ function stampBridgeVersionOnDocument() {
17706
18153
  return;
17707
18154
  }
17708
18155
  try {
17709
- const v = true ? "0.1.170" : "";
18156
+ const v = true ? "0.1.172-next.456" : "";
17710
18157
  if (v) {
17711
18158
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17712
18159
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -17867,7 +18314,9 @@ function isFieldRequired(wrapper) {
17867
18314
  function markFormFields(form) {
17868
18315
  form.querySelectorAll("input, textarea").forEach((input) => {
17869
18316
  const type = input.type;
17870
- if (type === "submit" || type === "button" || type === "reset" || type === "hidden") return;
18317
+ if (type === "submit" || type === "button" || type === "reset" || type === "hidden" || type === "checkbox" || type === "radio") {
18318
+ return;
18319
+ }
17871
18320
  if (getFieldWrapper(input)) return;
17872
18321
  let wrapper = input;
17873
18322
  while (wrapper.parentElement && wrapper.parentElement !== form && wrapper.parentElement.querySelectorAll("input, textarea").length === 1) {
@@ -18365,6 +18814,7 @@ function MediaOverlay({
18365
18814
  onFadeOutComplete,
18366
18815
  onReplace,
18367
18816
  onSelect,
18817
+ onDelete,
18368
18818
  onVideoSettingsChange
18369
18819
  }) {
18370
18820
  const { rect } = hover;
@@ -18384,6 +18834,7 @@ function MediaOverlay({
18384
18834
  (prev) => prev && prev.fullWidth === width && prev.height === height ? prev : { fullWidth: width, height }
18385
18835
  );
18386
18836
  }, [isVideo]);
18837
+ const replaceLabel = isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image";
18387
18838
  const replaceMode = buttonSize ? replaceButtonMode({ width: rect.width, height: rect.height }, buttonSize) : "none";
18388
18839
  const box = {
18389
18840
  position: "fixed",
@@ -18482,11 +18933,10 @@ function MediaOverlay({
18482
18933
  className: "flex items-center justify-center cursor-pointer",
18483
18934
  style: {
18484
18935
  ...box,
18485
- // When text overlays this media, let clicks fall THROUGH to the text underneath. In the
18486
- // parent this needed a whole `ow:click-at` round-trip to re-hit-test inside the iframe;
18487
- // in-document, pointer-events does it natively. The button below opts back in, so
18488
- // Replace still works.
18489
- pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto",
18936
+ // Visual only. `pointer-events: auto` on this full-bleed rect covered the navbar
18937
+ // (hero bg includes the absolute TopNav) and swallowed CTA press-drag. Text overlay
18938
+ // and cueOnly also need clicks to fall through — Replace / video controls opt back in.
18939
+ pointerEvents: "none",
18490
18940
  // Selected: a firm component ring with no wash, so the image reads as chosen rather
18491
18941
  // than hovered. Hover keeps the existing tinted preview.
18492
18942
  boxShadow: selected ? "inset 0 0 0 2px var(--color-bridge-primary)" : "inset 0 0 0 1.5px var(--color-bridge-primary)",
@@ -18513,40 +18963,74 @@ function MediaOverlay({
18513
18963
  },
18514
18964
  children: [
18515
18965
  isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18516
- isVideo ? "Replace video" : "Replace image"
18966
+ replaceLabel
18517
18967
  ]
18518
18968
  }
18519
18969
  ),
18520
- replaceMode === "none" || cueOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18521
- Button,
18970
+ showChrome && replaceMode !== "none" && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18971
+ "div",
18522
18972
  {
18523
- "data-ohw-media-overlay": "",
18524
- variant: "outline",
18525
- size: "sm",
18526
- "aria-label": isVideo ? "Replace video" : "Replace image",
18527
- className: "gap-1.5 cursor-pointer hover:bg-background",
18973
+ className: "flex items-center gap-1.5",
18528
18974
  style: {
18529
- ...OVERLAY_BUTTON_STYLE,
18530
- // Icon-only is a square of the same height, so the pair can never differ vertically.
18531
- // `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
18532
- // minimum beats a width — the square came out wider than the avatar it sat on.
18533
- ...replaceMode === "icon" && buttonSize ? {
18534
- width: buttonSize.height,
18535
- minWidth: buttonSize.height,
18536
- padding: 0,
18537
- justifyContent: "center"
18538
- } : null,
18539
- // Don't let Replace steal clicks when text (e.g. nav) sits on top of this media.
18975
+ // Parent overlay is pointer-events:none; controls opt back in (unless text sits on top).
18540
18976
  pointerEvents: hover.hasTextOverlap || cueOnly ? "none" : "auto"
18541
18977
  },
18542
- onMouseDown: (e) => e.preventDefault(),
18543
- onClick: (e) => {
18544
- e.stopPropagation();
18545
- onReplace(hover.key);
18546
- },
18978
+ onClick: (e) => e.stopPropagation(),
18547
18979
  children: [
18548
- isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
18549
- replaceMode === "full" ? isVideo ? "Replace video" : hover.elementType === "bg-image" ? "Replace background" : "Replace image" : null
18980
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
18981
+ Button,
18982
+ {
18983
+ "data-ohw-media-overlay": "",
18984
+ variant: "outline",
18985
+ size: "sm",
18986
+ "aria-label": replaceLabel,
18987
+ className: "gap-1.5 cursor-pointer hover:bg-background",
18988
+ style: {
18989
+ ...OVERLAY_BUTTON_STYLE,
18990
+ // Icon-only is a square of the same height, so the pair can never differ vertically.
18991
+ // `minWidth` has to go too: the button's own size carries `min-w-[64px]`, and a
18992
+ // minimum beats a width — the square came out wider than the avatar it sat on.
18993
+ ...replaceMode === "icon" && buttonSize ? {
18994
+ width: buttonSize.height,
18995
+ minWidth: buttonSize.height,
18996
+ padding: 0,
18997
+ justifyContent: "center"
18998
+ } : null
18999
+ },
19000
+ onMouseDown: (e) => e.preventDefault(),
19001
+ onClick: (e) => {
19002
+ e.stopPropagation();
19003
+ onReplace(hover.key);
19004
+ },
19005
+ children: [
19006
+ isVideo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Film, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.ImageIcon, { size: 14 }),
19007
+ replaceMode === "full" ? replaceLabel : null
19008
+ ]
19009
+ }
19010
+ ),
19011
+ selected && onDelete ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
19012
+ Button,
19013
+ {
19014
+ "data-ohw-media-overlay": "",
19015
+ variant: "outline",
19016
+ size: "sm",
19017
+ "aria-label": "Delete",
19018
+ title: "Delete",
19019
+ className: "cursor-pointer hover:bg-background",
19020
+ style: {
19021
+ ...OVERLAY_BUTTON_STYLE,
19022
+ minWidth: 0,
19023
+ padding: buttonSize ? `0 ${(buttonSize.height - 14) / 2}px` : "0 8px",
19024
+ height: buttonSize?.height
19025
+ },
19026
+ onMouseDown: (e) => e.preventDefault(),
19027
+ onClick: (e) => {
19028
+ e.stopPropagation();
19029
+ onDelete(hover.key);
19030
+ },
19031
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react5.Trash2, { size: 14 })
19032
+ }
19033
+ ) : null
18550
19034
  ]
18551
19035
  }
18552
19036
  )
@@ -19178,7 +19662,7 @@ function AiSectionOverlay({
19178
19662
 
19179
19663
  // src/ui/ai-section/AiMediaStripOverlay.tsx
19180
19664
  var import_react13 = require("react");
19181
- var import_lucide_react8 = require("lucide-react");
19665
+ var import_lucide_react9 = require("lucide-react");
19182
19666
 
19183
19667
  // src/lib/ai-media-strip-tree.ts
19184
19668
  var MEDIA_STRIP_ITEM_MIN = 1;
@@ -19292,14 +19776,6 @@ function setMediaStripItemAsset(tree, index, assetId) {
19292
19776
  return true;
19293
19777
  });
19294
19778
  }
19295
- function setMediaStripItemAlt(tree, index, alt) {
19296
- return withMediaStrip(tree, (block) => {
19297
- const items = block.items;
19298
- if (index < 0 || index >= items.length) return false;
19299
- items[index] = { ...items[index], alt };
19300
- return true;
19301
- });
19302
- }
19303
19779
  function setMediaStripItemLink(tree, index, link) {
19304
19780
  return withMediaStrip(tree, (block) => {
19305
19781
  const items = block.items;
@@ -19317,11 +19793,117 @@ function setMediaStripItemLink(tree, index, link) {
19317
19793
  });
19318
19794
  }
19319
19795
 
19320
- // src/ui/ai-section/AiMediaStripOverlay.tsx
19796
+ // src/ui/dialog.tsx
19797
+ var React9 = __toESM(require("react"), 1);
19798
+ var import_radix_ui6 = require("radix-ui");
19799
+ var import_lucide_react8 = require("lucide-react");
19321
19800
  var import_jsx_runtime20 = require("react/jsx-runtime");
19322
- var PRIMARY3 = "#0885FE";
19323
- var OHW_BLUE = `var(--ohw-primary, ${PRIMARY3})`;
19324
- var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY3}) 60%, #000000)`;
19801
+ function Dialog2({
19802
+ ...props
19803
+ }) {
19804
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
19805
+ }
19806
+ function DialogPortal({
19807
+ ...props
19808
+ }) {
19809
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
19810
+ }
19811
+ function DialogOverlay({
19812
+ className,
19813
+ ...props
19814
+ }) {
19815
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19816
+ import_radix_ui6.Dialog.Overlay,
19817
+ {
19818
+ "data-slot": "dialog-overlay",
19819
+ "data-ohw-link-modal-root": "",
19820
+ className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
19821
+ ...props
19822
+ }
19823
+ );
19824
+ }
19825
+ var DialogContent = React9.forwardRef(
19826
+ ({ className, children, showCloseButton = true, container, ...props }, ref) => {
19827
+ const positionMode = container ? "absolute" : "fixed";
19828
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DialogPortal, { container: container ?? void 0, children: [
19829
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
19830
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19831
+ import_radix_ui6.Dialog.Content,
19832
+ {
19833
+ ref,
19834
+ "data-slot": "dialog-content",
19835
+ className: cn(
19836
+ positionMode,
19837
+ "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",
19838
+ "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
19839
+ container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
19840
+ className
19841
+ ),
19842
+ onMouseDown: (e) => e.stopPropagation(),
19843
+ ...props,
19844
+ children: [
19845
+ children,
19846
+ showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19847
+ import_radix_ui6.Dialog.Close,
19848
+ {
19849
+ type: "button",
19850
+ className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
19851
+ "aria-label": "Close",
19852
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.X, { size: 16, "aria-hidden": true })
19853
+ }
19854
+ ) : null
19855
+ ]
19856
+ }
19857
+ )
19858
+ ] });
19859
+ }
19860
+ );
19861
+ DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
19862
+ function DialogHeader({
19863
+ className,
19864
+ ...props
19865
+ }) {
19866
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
19867
+ }
19868
+ function DialogFooter({
19869
+ className,
19870
+ ...props
19871
+ }) {
19872
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19873
+ "div",
19874
+ {
19875
+ className: cn("flex items-center justify-end gap-2", className),
19876
+ ...props
19877
+ }
19878
+ );
19879
+ }
19880
+ var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19881
+ import_radix_ui6.Dialog.Title,
19882
+ {
19883
+ ref,
19884
+ className: cn(
19885
+ "text-lg font-semibold leading-none tracking-tight text-card-foreground",
19886
+ className
19887
+ ),
19888
+ ...props
19889
+ }
19890
+ ));
19891
+ DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
19892
+ var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19893
+ import_radix_ui6.Dialog.Description,
19894
+ {
19895
+ ref,
19896
+ className: cn("text-sm text-muted-foreground", className),
19897
+ ...props
19898
+ }
19899
+ ));
19900
+ DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
19901
+ var DialogClose = import_radix_ui6.Dialog.Close;
19902
+
19903
+ // src/ui/ai-section/AiMediaStripOverlay.tsx
19904
+ var import_jsx_runtime21 = require("react/jsx-runtime");
19905
+ var PRIMARY3 = "var(--ohw-primary, #0885FE)";
19906
+ 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]";
19325
19907
  function findMediaStripItemElement(sectionId, index) {
19326
19908
  const sectionEl2 = findByInstanceId(sectionId);
19327
19909
  if (!sectionEl2) return null;
@@ -19331,14 +19913,35 @@ function findMediaStripItemElement(sectionId, index) {
19331
19913
  }
19332
19914
  return null;
19333
19915
  }
19334
- function readRect2(ref) {
19335
- const el = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19916
+ function itemRefFromTarget(target) {
19917
+ if (!(target instanceof Element)) return null;
19918
+ if (target.closest(CHROME_SELECTOR)) return null;
19919
+ const itemEl = target.closest("[data-ohw-media-strip-item]");
19920
+ if (!itemEl) return null;
19921
+ const sectionEl2 = itemEl.closest("[data-ohw-section]");
19922
+ const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19923
+ const sectionId = unit ? instanceIdOf(unit) || null : null;
19924
+ const index = Number(itemEl.dataset.ohwMediaStripIndex);
19925
+ if (!sectionId || Number.isNaN(index)) return null;
19926
+ return { sectionId, index };
19927
+ }
19928
+ function sameRef(a, b) {
19929
+ return a?.sectionId === b?.sectionId && a?.index === b?.index;
19930
+ }
19931
+ function rectOf(el) {
19336
19932
  if (!el) return null;
19337
19933
  const r2 = el.getBoundingClientRect();
19338
19934
  if (r2.width <= 0 || r2.height <= 0) return null;
19339
19935
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19340
19936
  }
19341
- function useLiveItemRect(ref) {
19937
+ function readRect2(ref) {
19938
+ return rectOf(ref && findMediaStripItemElement(ref.sectionId, ref.index));
19939
+ }
19940
+ function readStripRect(ref) {
19941
+ const item = ref && findMediaStripItemElement(ref.sectionId, ref.index);
19942
+ return rectOf(item?.closest("[data-ohw-media-strip]") ?? item);
19943
+ }
19944
+ function useLiveItemRect(ref, strip = false) {
19342
19945
  const [rect, setRect] = (0, import_react13.useState)(null);
19343
19946
  (0, import_react13.useEffect)(() => {
19344
19947
  if (!ref) {
@@ -19346,7 +19949,7 @@ function useLiveItemRect(ref) {
19346
19949
  return;
19347
19950
  }
19348
19951
  const update = () => {
19349
- const next = readRect2(ref);
19952
+ const next = strip ? readStripRect(ref) : readRect2(ref);
19350
19953
  setRect(
19351
19954
  (prev) => prev && next && prev.top === next.top && prev.left === next.left && prev.width === next.width && prev.height === next.height ? prev : next
19352
19955
  );
@@ -19361,9 +19964,49 @@ function useLiveItemRect(ref) {
19361
19964
  window.removeEventListener("resize", update);
19362
19965
  clearInterval(interval);
19363
19966
  };
19364
- }, [ref?.sectionId, ref?.index]);
19967
+ }, [ref?.sectionId, ref?.index, strip]);
19365
19968
  return rect;
19366
19969
  }
19970
+ var TOOLBAR_STRIP_GAP = 52;
19971
+ var TOOLBAR_STRIP_GAP_MOBILE = 42;
19972
+ var TOOLBAR_EDGE_MARGIN2 = 4;
19973
+ function StripToolbarSlot({ stripRect, children }) {
19974
+ const slotRef = (0, import_react13.useRef)(null);
19975
+ const [shift, setShift] = (0, import_react13.useState)(0);
19976
+ const centerX = stripRect.left + stripRect.width / 2;
19977
+ (0, import_react13.useLayoutEffect)(() => {
19978
+ const slot = slotRef.current;
19979
+ if (!slot) return;
19980
+ const clamp = () => {
19981
+ const w = slot.offsetWidth;
19982
+ if (w <= 0) return;
19983
+ const half = w / 2;
19984
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
19985
+ setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
19986
+ };
19987
+ clamp();
19988
+ const ro = new ResizeObserver(clamp);
19989
+ ro.observe(slot);
19990
+ return () => ro.disconnect();
19991
+ }, [centerX, children]);
19992
+ const mobile = window.innerWidth <= 480;
19993
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
19994
+ "div",
19995
+ {
19996
+ ref: slotRef,
19997
+ "data-ohw-bridge": "",
19998
+ "data-ohw-item-interaction": "",
19999
+ className: "pointer-events-auto fixed",
20000
+ style: {
20001
+ top: stripRect.top - (mobile ? TOOLBAR_STRIP_GAP_MOBILE : TOOLBAR_STRIP_GAP),
20002
+ left: centerX + shift,
20003
+ transform: "translate(-50%, -100%)",
20004
+ zIndex: 2147483645
20005
+ },
20006
+ children
20007
+ }
20008
+ );
20009
+ }
19367
20010
  function requestValidateTree(postToParent2, tree) {
19368
20011
  return new Promise((resolve) => {
19369
20012
  const id = `ai-validate-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
@@ -19400,116 +20043,72 @@ function requestAssetPick(postToParent2) {
19400
20043
  postToParent2({ type: "ow:asset-pick", id });
19401
20044
  });
19402
20045
  }
19403
- function Pill({
20046
+ function ToolbarAction({
19404
20047
  label,
19405
20048
  onClick,
19406
- disabled,
19407
- active
20049
+ disabled = false,
20050
+ active = false,
20051
+ children
19408
20052
  }) {
19409
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19410
- "button",
19411
- {
19412
- type: "button",
19413
- onClick,
19414
- disabled,
19415
- style: {
19416
- height: 28,
19417
- padding: "0 10px",
19418
- display: "inline-flex",
19419
- alignItems: "center",
19420
- gap: 4,
19421
- borderRadius: 999,
19422
- border: "none",
19423
- cursor: disabled ? "default" : "pointer",
19424
- background: active ? OHW_BLUE_DARK : "#ffffff",
19425
- color: active ? "#ffffff" : OHW_BLUE_DARK,
19426
- opacity: disabled ? 0.4 : 1,
19427
- fontSize: 12,
19428
- lineHeight: "16px",
19429
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19430
- whiteSpace: "nowrap",
19431
- flex: "0 0 auto"
19432
- },
19433
- children: label
19434
- }
19435
- );
20053
+ const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, active, onClick, className: "size-8", children });
20054
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20055
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
20056
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20057
+ ] });
19436
20058
  }
19437
- function AltInput({ value, onCommit }) {
19438
- const [draft, setDraft] = (0, import_react13.useState)(value);
19439
- (0, import_react13.useEffect)(() => setDraft(value), [value]);
19440
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19441
- "div",
19442
- {
19443
- style: {
19444
- display: "flex",
19445
- alignItems: "center",
19446
- gap: 6,
19447
- height: 28,
19448
- padding: "0 12px",
19449
- borderRadius: 999,
19450
- background: "#ffffff",
19451
- width: "100%",
19452
- maxWidth: 260,
19453
- boxSizing: "border-box"
19454
- },
19455
- children: [
19456
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19457
- "span",
19458
- {
19459
- style: {
19460
- flex: "0 0 auto",
19461
- color: OHW_BLUE_DARK,
19462
- fontSize: 10,
19463
- fontWeight: 700,
19464
- textTransform: "uppercase",
19465
- letterSpacing: 0.4
19466
- },
19467
- children: "Alt"
19468
- }
19469
- ),
19470
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19471
- "input",
20059
+ function ToolbarSeparator() {
20060
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20061
+ }
20062
+ function OptionMenu({
20063
+ label,
20064
+ value,
20065
+ options,
20066
+ onChange
20067
+ }) {
20068
+ const current = options.find((o) => o.value === value) ?? options[0];
20069
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20070
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: label }),
20071
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
20072
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20073
+ "button",
20074
+ {
20075
+ type: "button",
20076
+ "aria-label": label,
20077
+ 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",
20078
+ children: [
20079
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20080
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20081
+ ]
20082
+ }
20083
+ ) }),
20084
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[132px] min-w-[132px] p-1", children: options.map((option) => {
20085
+ const selected = option.value === value;
20086
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20087
+ DropdownMenuItem,
19472
20088
  {
19473
- type: "text",
19474
- value: draft,
19475
- onChange: (e) => setDraft(e.target.value),
19476
- onBlur: () => {
19477
- if (draft !== value) onCommit(draft);
19478
- },
19479
- onKeyDown: (e) => {
19480
- if (e.key === "Enter") e.currentTarget.blur();
19481
- if (e.key === "Escape") {
19482
- setDraft(value);
19483
- e.currentTarget.blur();
19484
- }
19485
- },
19486
- placeholder: "Describe this image",
19487
- "aria-label": "Image alt text",
19488
- style: {
19489
- flex: 1,
19490
- minWidth: 0,
19491
- border: "none",
19492
- outline: "none",
19493
- background: "transparent",
19494
- fontSize: 12,
19495
- lineHeight: "16px",
19496
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19497
- color: "#1f2937"
19498
- }
19499
- }
19500
- )
19501
- ]
19502
- }
19503
- );
20089
+ role: "menuitemradio",
20090
+ "aria-checked": selected,
20091
+ onSelect: () => onChange(option.value),
20092
+ className: cn("grid grid-cols-[1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20093
+ children: [
20094
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: option.label }),
20095
+ selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
20096
+ ]
20097
+ },
20098
+ option.value
20099
+ );
20100
+ }) })
20101
+ ] })
20102
+ ] });
19504
20103
  }
19505
20104
  var VARIANTS = [
19506
20105
  { value: "logos", label: "Logos" },
19507
20106
  { value: "reel", label: "Reel" }
19508
20107
  ];
19509
20108
  var ALIGNS = [
19510
- { value: "left", label: "Left" },
19511
- { value: "center", label: "Center" },
19512
- { value: "right", label: "Right" }
20109
+ { value: "left", label: "Align left", Icon: import_lucide_react9.AlignLeft },
20110
+ { value: "center", label: "Align center", Icon: import_lucide_react9.AlignCenter },
20111
+ { value: "right", label: "Align right", Icon: import_lucide_react9.AlignRight }
19513
20112
  ];
19514
20113
  var HOVERS = [
19515
20114
  { value: "none", label: "None" },
@@ -19517,104 +20116,104 @@ var HOVERS = [
19517
20116
  { value: "zoom", label: "Zoom" },
19518
20117
  { value: "fade", label: "Fade" }
19519
20118
  ];
19520
- var TREATMENTS = [
19521
- { value: "color", label: "Color" },
19522
- { value: "grayscale", label: "Grayscale" }
19523
- ];
19524
20119
  var HTTP_URL_RE = /^https?:\/\/\S+$/i;
19525
- function LinkInput({ value, onCommit }) {
19526
- const [draft, setDraft] = (0, import_react13.useState)(value);
20120
+ function LinkModal({
20121
+ href,
20122
+ linkTarget,
20123
+ onClose,
20124
+ onSave
20125
+ }) {
20126
+ const [draft, setDraft] = (0, import_react13.useState)(href);
20127
+ const [newTab, setNewTab] = (0, import_react13.useState)(linkTarget !== "same-tab");
19527
20128
  const [invalid, setInvalid] = (0, import_react13.useState)(false);
19528
- (0, import_react13.useEffect)(() => {
19529
- setDraft(value);
19530
- setInvalid(false);
19531
- }, [value]);
19532
- const commit2 = () => {
20129
+ const save = () => {
19533
20130
  const next = draft.trim();
19534
- if (next === value) return setInvalid(false);
19535
- if (next && !HTTP_URL_RE.test(next)) return setInvalid(true);
19536
- setInvalid(false);
19537
- onCommit(next);
19538
- };
19539
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
19540
- "div",
19541
- {
19542
- style: {
19543
- display: "flex",
19544
- alignItems: "center",
19545
- gap: 6,
19546
- height: 28,
19547
- padding: "0 12px",
19548
- borderRadius: 999,
19549
- background: "#ffffff",
19550
- width: "100%",
19551
- maxWidth: 260,
19552
- boxSizing: "border-box",
19553
- boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
19554
- },
19555
- children: [
19556
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19557
- "span",
19558
- {
19559
- style: {
19560
- flex: "0 0 auto",
19561
- color: OHW_BLUE_DARK,
19562
- fontSize: 10,
19563
- fontWeight: 700,
19564
- textTransform: "uppercase",
19565
- letterSpacing: 0.4
19566
- },
19567
- children: "Link"
19568
- }
19569
- ),
19570
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19571
- "input",
19572
- {
19573
- type: "text",
19574
- inputMode: "url",
19575
- value: draft,
19576
- onChange: (e) => setDraft(e.target.value),
19577
- onBlur: commit2,
19578
- onKeyDown: (e) => {
19579
- if (e.key === "Enter") e.currentTarget.blur();
19580
- if (e.key === "Escape") {
19581
- setDraft(value);
19582
- setInvalid(false);
19583
- e.currentTarget.blur();
19584
- }
19585
- },
19586
- placeholder: "https://example.com",
19587
- "aria-label": "Image link URL",
19588
- "aria-invalid": invalid,
19589
- style: {
19590
- flex: 1,
19591
- minWidth: 0,
19592
- border: "none",
19593
- outline: "none",
19594
- background: "transparent",
19595
- fontSize: 12,
19596
- lineHeight: "16px",
19597
- fontFamily: "Figtree, ui-sans-serif, system-ui, sans-serif",
19598
- color: "#1f2937"
19599
- }
19600
- }
19601
- )
19602
- ]
20131
+ if (next && !HTTP_URL_RE.test(next)) {
20132
+ setInvalid(true);
20133
+ return;
19603
20134
  }
19604
- );
20135
+ onSave(next, newTab ? "new-tab" : "same-tab");
20136
+ onClose();
20137
+ };
20138
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Dialog2, { open: true, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogContent, { "data-ohw-link-modal-root": "", className: "max-w-[400px] gap-4 p-5", children: [
20139
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DialogTitle, { className: "text-base", children: "Image link" }) }),
20140
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-col gap-3", children: [
20141
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20142
+ "input",
20143
+ {
20144
+ autoFocus: true,
20145
+ type: "text",
20146
+ inputMode: "url",
20147
+ value: draft,
20148
+ onChange: (e) => {
20149
+ setDraft(e.target.value);
20150
+ setInvalid(false);
20151
+ },
20152
+ onKeyDown: (e) => {
20153
+ if (e.key === "Enter") save();
20154
+ },
20155
+ placeholder: "https://example.com",
20156
+ "aria-label": "Image link URL",
20157
+ "aria-invalid": invalid,
20158
+ className: cn(
20159
+ "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",
20160
+ invalid && "border-destructive focus:border-destructive"
20161
+ )
20162
+ }
20163
+ ),
20164
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-xs text-destructive", children: "Enter a full URL starting with http:// or https://" }),
20165
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("label", { className: "flex items-center gap-2 text-[13px] text-foreground", children: [
20166
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("input", { type: "checkbox", checked: newTab, onChange: (e) => setNewTab(e.target.checked) }),
20167
+ "Open in new tab"
20168
+ ] })
20169
+ ] }),
20170
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DialogFooter, { children: [
20171
+ href && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20172
+ "button",
20173
+ {
20174
+ type: "button",
20175
+ onClick: () => {
20176
+ onSave("", "new-tab");
20177
+ onClose();
20178
+ },
20179
+ className: "mr-auto rounded-[6px] px-3 py-2 text-[13px] font-medium text-destructive transition-colors hover:bg-muted",
20180
+ children: "Remove link"
20181
+ }
20182
+ ),
20183
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20184
+ "button",
20185
+ {
20186
+ type: "button",
20187
+ onClick: onClose,
20188
+ className: "rounded-[6px] px-3 py-2 text-[13px] font-medium text-foreground transition-colors hover:bg-muted",
20189
+ children: "Cancel"
20190
+ }
20191
+ ),
20192
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20193
+ "button",
20194
+ {
20195
+ type: "button",
20196
+ onClick: save,
20197
+ className: "rounded-[6px] bg-bridge-primary px-3 py-2 text-[13px] font-medium text-primary-foreground transition-opacity hover:opacity-90",
20198
+ children: "Save"
20199
+ }
20200
+ )
20201
+ ] })
20202
+ ] }) });
19605
20203
  }
19606
20204
  function MediaStripToolbar({
19607
20205
  entry,
19608
20206
  index,
19609
20207
  pending,
19610
20208
  error,
20209
+ itemEditOn,
20210
+ onToggleItemEdit,
19611
20211
  onSetVariant,
19612
20212
  onSetAlign,
19613
20213
  onSetHover,
19614
20214
  onSetTreatment,
19615
20215
  onResize,
19616
- onSetAlt,
19617
- onSetLink,
20216
+ onOpenLink,
19618
20217
  onAddItem,
19619
20218
  onRemoveItem,
19620
20219
  onChangeImage,
@@ -19623,81 +20222,102 @@ function MediaStripToolbar({
19623
20222
  }) {
19624
20223
  const items = mediaStripItems(entry.tree);
19625
20224
  const itemCount = items.length;
19626
- const currentAlt = items[index]?.alt ?? "";
19627
- const currentHref2 = items[index]?.href ?? "";
19628
- const currentTarget = items[index]?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
19629
20225
  const slots = findMediaStripSlots(entry.tree);
19630
20226
  const variant = slots?.variant === "reel" ? "reel" : "logos";
19631
20227
  const align = slots?.align === "left" || slots?.align === "right" ? slots.align : "center";
19632
20228
  const hover = slots?.hover === "none" || slots?.hover === "lift" || slots?.hover === "zoom" || slots?.hover === "fade" ? slots.hover : "lift";
19633
20229
  const treatment = slots?.treatment === "color" || slots?.treatment === "grayscale" ? slots.treatment : variant === "logos" ? "grayscale" : "color";
19634
20230
  const sizeValue = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19635
- const isMobile = window.innerWidth <= 480;
19636
- const rowStyle = isMobile ? {
19637
- display: "flex",
19638
- gap: 6,
19639
- flexWrap: "nowrap",
19640
- justifyContent: "center",
19641
- overflowX: "auto",
19642
- WebkitOverflowScrolling: "touch",
19643
- width: "100%",
19644
- scrollbarWidth: "none"
19645
- } : { display: "flex", gap: 6, flexWrap: "nowrap", justifyContent: "center" };
19646
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
20231
+ const mobile = window.innerWidth <= 480;
20232
+ const gatedLabel = (label) => itemEditOn ? label : "Turn on the star to edit this image";
20233
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
19647
20234
  "div",
19648
20235
  {
19649
20236
  "data-ohw-bridge": "",
19650
20237
  "data-ohw-toolbar": "",
19651
20238
  onMouseDown: (e) => e.stopPropagation(),
19652
- style: {
19653
- display: "flex",
19654
- flexDirection: "column",
19655
- gap: 6,
19656
- alignItems: "center",
19657
- background: OHW_BLUE,
19658
- padding: 8,
19659
- borderRadius: 12,
19660
- boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
19661
- pointerEvents: pending ? "none" : "auto",
19662
- opacity: pending ? 0.6 : 1,
19663
- maxWidth: isMobile ? "calc(100vw - 24px)" : "none"
19664
- },
20239
+ className: cn("flex flex-col items-center gap-1.5 font-sans", pending && "pointer-events-none opacity-60"),
20240
+ style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
19665
20241
  children: [
19666
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19667
- VARIANTS.map((v) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: v.label, active: variant === v.value, onClick: () => onSetVariant(v.value) }, v.value)),
19668
- ALIGNS.map((a) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: a.label, active: align === a.value, onClick: () => onSetAlign(a.value) }, a.value))
19669
- ] }),
19670
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19671
- HOVERS.map((h) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: h.label, active: hover === h.value, onClick: () => onSetHover(h.value) }, h.value)),
19672
- TREATMENTS.map((t) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: t.label, active: treatment === t.value, onClick: () => onSetTreatment(t.value) }, t.value))
19673
- ] }),
19674
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
19675
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212", onClick: () => onResize(-8) }),
19676
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: { color: "#ffffff", fontSize: 12, minWidth: 34, textAlign: "center" }, children: [
19677
- sizeValue,
19678
- "px"
19679
- ] }),
19680
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+", onClick: () => onResize(8) })
19681
- ] }),
19682
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AltInput, { value: currentAlt, onCommit: onSetAlt }) }),
19683
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(LinkInput, { value: currentHref2, onCommit: (href) => onSetLink(href, currentTarget) }) }),
19684
- currentHref2 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19685
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "New tab", active: currentTarget === "new-tab", onClick: () => onSetLink(currentHref2, "new-tab") }),
19686
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Same tab", active: currentTarget === "same-tab", onClick: () => onSetLink(currentHref2, "same-tab") })
19687
- ] }),
19688
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19689
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "Change Image", onClick: onChangeImage }),
19690
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "+ Item", onClick: onAddItem }),
19691
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2212 Item", onClick: onRemoveItem, disabled: itemCount <= 1 })
19692
- ] }),
19693
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: rowStyle, children: [
19694
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2190 Move", onClick: onMoveLeft, disabled: index <= 0 }),
19695
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Pill, { label: "\u2192 Move", onClick: onMoveRight, disabled: index >= itemCount - 1 })
19696
- ] }),
19697
- error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20242
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20243
+ "div",
20244
+ {
20245
+ className: cn(
20246
+ "flex items-center gap-1 rounded-[10px] border border-border bg-background p-1 whitespace-nowrap",
20247
+ "shadow-[0px_10px_15px_-3px_rgba(0,0,0,0.1),0px_4px_6px_-4px_rgba(0,0,0,0.1)]",
20248
+ mobile ? "flex-wrap justify-center" : "flex-nowrap"
20249
+ ),
20250
+ children: [
20251
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20252
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20253
+ CustomToolbarButton,
20254
+ {
20255
+ type: "button",
20256
+ "aria-label": itemEditOn ? "Done editing this image" : "Edit this image",
20257
+ "aria-pressed": itemEditOn,
20258
+ onClick: onToggleItemEdit,
20259
+ className: "group size-8",
20260
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20261
+ import_lucide_react9.Star,
20262
+ {
20263
+ size: 16,
20264
+ fill: "currentColor",
20265
+ strokeWidth: 0,
20266
+ className: cn(
20267
+ "transition-colors",
20268
+ itemEditOn ? "text-[#f59e0b] group-hover:text-[#d97706]" : "text-[#d6d3d1] group-hover:text-[#fbbf24]"
20269
+ ),
20270
+ style: { pointerEvents: "none" }
20271
+ }
20272
+ )
20273
+ }
20274
+ ) }),
20275
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: itemEditOn ? "Done editing this image" : "Edit this image" })
20276
+ ] }),
20277
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20278
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Change image"), onClick: onChangeImage, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Image, { size: 16, style: { pointerEvents: "none" } }) }),
20279
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Link"), onClick: onOpenLink, disabled: !itemEditOn, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Link, { size: 16, style: { pointerEvents: "none" } }) }),
20280
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Move left"), onClick: onMoveLeft, disabled: !itemEditOn || index <= 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowLeft, { size: 16, style: { pointerEvents: "none" } }) }),
20281
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20282
+ ToolbarAction,
20283
+ {
20284
+ label: gatedLabel("Move right"),
20285
+ onClick: onMoveRight,
20286
+ disabled: !itemEditOn || index >= itemCount - 1,
20287
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ArrowRight, { size: 16, style: { pointerEvents: "none" } })
20288
+ }
20289
+ ),
20290
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: gatedLabel("Remove image"), onClick: onRemoveItem, disabled: !itemEditOn || itemCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImageMinus, { size: 16, style: { pointerEvents: "none" } }) }),
20291
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20292
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Layout", value: variant, options: VARIANTS, onChange: onSetVariant }),
20293
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(OptionMenu, { label: "Hover", value: hover, options: HOVERS, onChange: onSetHover }),
20294
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20295
+ ToolbarAction,
20296
+ {
20297
+ label: treatment === "grayscale" ? "Show in color" : "Show grayscale",
20298
+ active: treatment === "grayscale",
20299
+ onClick: () => onSetTreatment(treatment === "grayscale" ? "color" : "grayscale"),
20300
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Palette, { size: 16, style: { pointerEvents: "none" } })
20301
+ }
20302
+ ),
20303
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20304
+ ALIGNS.map(({ value, label, Icon }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label, active: align === value, onClick: () => onSetAlign(value), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 16, style: { pointerEvents: "none" } }) }, value)),
20305
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20306
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Smaller", onClick: () => onResize(-8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) }),
20307
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "min-w-[40px] text-center text-xs tabular-nums text-muted-foreground", children: [
20308
+ sizeValue,
20309
+ "px"
20310
+ ] }),
20311
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Larger", onClick: () => onResize(8), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20312
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20313
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add image", onClick: onAddItem, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ImagePlus, { size: 16, style: { pointerEvents: "none" } }) })
20314
+ ]
20315
+ }
20316
+ ),
20317
+ error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
19698
20318
  ]
19699
20319
  }
19700
- );
20320
+ ) });
19701
20321
  }
19702
20322
  function findMediaStripSlots(tree) {
19703
20323
  const stack = tree.rows.flatMap((row) => row.blocks);
@@ -19716,31 +20336,23 @@ function AiMediaStripOverlay({
19716
20336
  }) {
19717
20337
  const [hover, setHover] = (0, import_react13.useState)(null);
19718
20338
  const [active, setActive] = (0, import_react13.useState)(null);
20339
+ const [itemEditOn, setItemEditOn] = (0, import_react13.useState)(false);
20340
+ const [linkOpen, setLinkOpen] = (0, import_react13.useState)(false);
19719
20341
  const [pending, setPending] = (0, import_react13.useState)(false);
19720
20342
  const [error, setError] = (0, import_react13.useState)(null);
19721
20343
  const activeRef = (0, import_react13.useRef)(null);
19722
20344
  activeRef.current = active;
20345
+ const linkOpenRef = (0, import_react13.useRef)(false);
20346
+ linkOpenRef.current = linkOpen;
19723
20347
  (0, import_react13.useEffect)(() => {
19724
20348
  const onMove = (e) => {
20349
+ const ref = itemRefFromTarget(e.target);
19725
20350
  const t = e.target;
19726
- if (!(t instanceof HTMLElement)) return;
19727
- 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]")) {
19728
- return;
19729
- }
19730
- const itemEl = t.closest("[data-ohw-media-strip-item]");
19731
- if (!itemEl) {
19732
- setHover(null);
19733
- return;
19734
- }
19735
- const sectionEl2 = itemEl.closest("[data-ohw-section]");
19736
- const unit = sectionEl2 ? movableUnit(sectionEl2) : null;
19737
- const sectionId = unit ? instanceIdOf(unit) || null : null;
19738
- const index = Number(itemEl.dataset.ohwMediaStripIndex);
19739
- if (!sectionId || Number.isNaN(index)) {
19740
- setHover(null);
19741
- return;
19742
- }
19743
- setHover({ sectionId, index });
20351
+ const overEditable = Boolean(t?.closest?.("[data-ohw-editable]"));
20352
+ setHover((prev) => {
20353
+ const next = ref && !overEditable ? ref : null;
20354
+ return sameRef(prev, next) ? prev : next;
20355
+ });
19744
20356
  };
19745
20357
  const onLeave = () => setHover(null);
19746
20358
  document.addEventListener("mousemove", onMove, { passive: true });
@@ -19752,23 +20364,25 @@ function AiMediaStripOverlay({
19752
20364
  }, []);
19753
20365
  (0, import_react13.useEffect)(() => {
19754
20366
  const onClick = (e) => {
19755
- const current = activeRef.current;
19756
- if (!current) return;
19757
20367
  const t = e.target;
19758
- if (!(t instanceof HTMLElement)) return;
19759
- if (t.closest("[data-ohw-item-interaction]")) return;
19760
- const itemEl = findMediaStripItemElement(current.sectionId, current.index);
19761
- if (itemEl && itemEl.contains(t)) return;
19762
- setActive(null);
20368
+ if (!(t instanceof Element)) return;
20369
+ if (t.closest(CHROME_SELECTOR)) return;
20370
+ const ref = itemRefFromTarget(t);
20371
+ if (sameRef(activeRef.current, ref)) return;
20372
+ if (ref) clearInteractionChromeRef.current();
20373
+ setItemEditOn(false);
19763
20374
  setError(null);
20375
+ setActive(ref);
19764
20376
  };
19765
20377
  document.addEventListener("click", onClick, true);
19766
20378
  return () => document.removeEventListener("click", onClick, true);
19767
- }, []);
20379
+ }, [clearInteractionChromeRef]);
19768
20380
  (0, import_react13.useEffect)(() => {
19769
20381
  const onBlur = () => {
19770
20382
  if (!activeRef.current) return;
19771
20383
  setActive(null);
20384
+ setItemEditOn(false);
20385
+ setLinkOpen(false);
19772
20386
  setError(null);
19773
20387
  };
19774
20388
  window.addEventListener("blur", onBlur);
@@ -19778,7 +20392,10 @@ function AiMediaStripOverlay({
19778
20392
  const onKeyDown = (e) => {
19779
20393
  if (e.key !== "Escape") return;
19780
20394
  if (!activeRef.current) return;
20395
+ if (linkOpenRef.current) return;
20396
+ if (document.querySelector('[data-ohw-more-menu][data-state="open"]')) return;
19781
20397
  setActive(null);
20398
+ setItemEditOn(false);
19782
20399
  setError(null);
19783
20400
  };
19784
20401
  document.addEventListener("keydown", onKeyDown);
@@ -19812,137 +20429,133 @@ function AiMediaStripOverlay({
19812
20429
  tree: nextTree,
19813
20430
  label: entry.label,
19814
20431
  media: extraMedia ? { ...entry.media, ...extraMedia } : entry.media,
19815
- ...entry.brand ? { brand: entry.brand } : {}
20432
+ ...entry.brand ? { brand: entry.brand } : {},
20433
+ // The user is already looking at the strip they just edited — recentering the viewport
20434
+ // on every edit reads as the section jumping around.
20435
+ skipScrollIntoView: true
19816
20436
  });
19817
20437
  return true;
19818
20438
  },
19819
20439
  [findEntry, postToParent2, applyTreeLocalRef]
19820
20440
  );
19821
20441
  const activeEntry = active ? findEntry(active.sectionId) : null;
19822
- const hoverHandleRect = useLiveItemRect(!active && hover ? hover : null);
19823
20442
  const activeItemRect = useLiveItemRect(active);
19824
- const TOOLBAR_APPROX_H = 170;
19825
- const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
19826
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
19827
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19828
- "button",
19829
- {
19830
- type: "button",
19831
- "data-ohw-toolbar": "",
19832
- onClick: () => {
19833
- clearInteractionChromeRef.current();
19834
- setActive(hover);
19835
- },
19836
- "aria-label": "Configure media item",
19837
- style: {
19838
- position: "fixed",
19839
- top: hoverHandleRect.top + 8,
19840
- left: hoverHandleRect.left + hoverHandleRect.width - 36,
19841
- width: 28,
19842
- height: 28,
19843
- borderRadius: 8,
19844
- border: `1.5px dashed ${PRIMARY3}`,
19845
- background: "#ffffff",
19846
- color: PRIMARY3,
19847
- display: "flex",
19848
- alignItems: "center",
19849
- justifyContent: "center",
19850
- cursor: "pointer",
19851
- zIndex: 2147483643,
19852
- fontSize: 14,
19853
- fontWeight: 700
19854
- },
19855
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react8.Star, { size: 14, style: { pointerEvents: "none" } })
19856
- }
19857
- ),
19858
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19859
- ItemInteractionLayer,
19860
- {
19861
- rect: activeItemRect,
19862
- state: toolbarState,
19863
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
19864
- MediaStripToolbar,
19865
- {
19866
- entry: activeEntry,
19867
- index: active.index,
19868
- pending,
19869
- error,
19870
- onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
19871
- onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
19872
- onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
19873
- onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
19874
- onResize: (delta) => {
19875
- const slots = findMediaStripSlots(activeEntry.tree);
19876
- const variant = slots?.variant === "reel" ? "reel" : "logos";
19877
- const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
19878
- void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
19879
- },
19880
- onSetAlt: (alt) => {
19881
- void runMutation(active.sectionId, (tree) => setMediaStripItemAlt(tree, active.index, alt));
19882
- },
19883
- onSetLink: (href, linkTarget) => {
20443
+ const activeStripRect = useLiveItemRect(active, true);
20444
+ const hoverRect = useLiveItemRect(hover && !sameRef(hover, active) ? hover : null);
20445
+ const activeItems = activeEntry ? mediaStripItems(activeEntry.tree) : [];
20446
+ const activeItem = active ? activeItems[active.index] : void 0;
20447
+ const activeHref = activeItem?.href ?? "";
20448
+ const activeTarget = activeItem?.linkTarget === "same-tab" ? "same-tab" : "new-tab";
20449
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20450
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20451
+ activeItemRect && activeStripRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20452
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeItemRect, state: "active-top" }),
20453
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StripToolbarSlot, { stripRect: activeStripRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20454
+ MediaStripToolbar,
20455
+ {
20456
+ entry: activeEntry,
20457
+ index: active.index,
20458
+ pending,
20459
+ error,
20460
+ itemEditOn,
20461
+ onToggleItemEdit: () => setItemEditOn((on) => !on),
20462
+ onSetVariant: (variant) => runMutation(active.sectionId, (tree) => setMediaStripVariant(tree, variant)),
20463
+ onSetAlign: (align) => runMutation(active.sectionId, (tree) => setMediaStripAlign(tree, align)),
20464
+ onSetHover: (hoverPreset) => runMutation(active.sectionId, (tree) => setMediaStripHover(tree, hoverPreset)),
20465
+ onSetTreatment: (treatment) => runMutation(active.sectionId, (tree) => setMediaStripTreatment(tree, treatment)),
20466
+ onResize: (delta) => {
20467
+ const slots = findMediaStripSlots(activeEntry.tree);
20468
+ const variant = slots?.variant === "reel" ? "reel" : "logos";
20469
+ const current = variant === "logos" ? typeof slots?.logoMaxHeight === "number" ? slots.logoMaxHeight : 48 : typeof slots?.cardWidth === "number" ? slots.cardWidth : 240;
20470
+ void runMutation(active.sectionId, (tree) => setMediaStripSizing(tree, current + delta));
20471
+ },
20472
+ onOpenLink: () => setLinkOpen(true),
20473
+ onAddItem: () => {
20474
+ void requestAssetPick(postToParent2).then((picked) => {
20475
+ if (!picked) return;
20476
+ const item = { assetId: picked.assetId, alt: "Logo" };
19884
20477
  void runMutation(
19885
20478
  active.sectionId,
19886
- (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
19887
- );
19888
- },
19889
- onAddItem: () => {
19890
- void requestAssetPick(postToParent2).then((picked) => {
19891
- if (!picked) return;
19892
- const item = { assetId: picked.assetId, alt: "Logo" };
19893
- void runMutation(
19894
- active.sectionId,
19895
- (tree) => addMediaStripItem(tree, item, active.index),
19896
- { [picked.assetId]: picked.url }
19897
- ).then((applied) => {
19898
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19899
- });
20479
+ (tree) => addMediaStripItem(tree, item, active.index),
20480
+ { [picked.assetId]: picked.url }
20481
+ ).then((applied) => {
20482
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19900
20483
  });
19901
- },
19902
- onChangeImage: () => {
19903
- void requestAssetPick(postToParent2).then((picked) => {
19904
- if (!picked) return;
19905
- void runMutation(
19906
- active.sectionId,
19907
- (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
19908
- { [picked.assetId]: picked.url }
19909
- );
19910
- });
19911
- },
19912
- onRemoveItem: () => {
19913
- void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
19914
- (applied) => {
19915
- if (applied) setActive(null);
19916
- }
19917
- );
19918
- },
19919
- onMoveLeft: () => {
19920
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
19921
- (applied) => {
19922
- if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
19923
- }
19924
- );
19925
- },
19926
- onMoveRight: () => {
19927
- void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
19928
- (applied) => {
19929
- if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
19930
- }
20484
+ });
20485
+ },
20486
+ onChangeImage: () => {
20487
+ void requestAssetPick(postToParent2).then((picked) => {
20488
+ if (!picked) return;
20489
+ void runMutation(
20490
+ active.sectionId,
20491
+ (tree) => setMediaStripItemAsset(tree, active.index, picked.assetId),
20492
+ { [picked.assetId]: picked.url }
19931
20493
  );
19932
- }
20494
+ });
20495
+ },
20496
+ onRemoveItem: () => {
20497
+ void runMutation(active.sectionId, (tree) => removeMediaStripItem(tree, active.index)).then(
20498
+ (applied) => {
20499
+ if (applied) setActive(null);
20500
+ }
20501
+ );
20502
+ },
20503
+ onMoveLeft: () => {
20504
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, -1)).then(
20505
+ (applied) => {
20506
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index - 1 });
20507
+ }
20508
+ );
20509
+ },
20510
+ onMoveRight: () => {
20511
+ void runMutation(active.sectionId, (tree) => reorderMediaStripItem(tree, active.index, 1)).then(
20512
+ (applied) => {
20513
+ if (applied) setActive({ sectionId: active.sectionId, index: active.index + 1 });
20514
+ }
20515
+ );
19933
20516
  }
19934
- )
19935
- }
19936
- )
20517
+ }
20518
+ ) }),
20519
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20520
+ "div",
20521
+ {
20522
+ "data-ohw-bridge": "",
20523
+ "data-ohw-item-interaction": "",
20524
+ "aria-hidden": true,
20525
+ className: "pointer-events-none fixed rounded-[4px] px-[7px] py-[3px] font-sans text-[11px] font-medium leading-none text-primary-foreground whitespace-nowrap",
20526
+ style: {
20527
+ top: activeItemRect.top + activeItemRect.height + 10,
20528
+ left: activeItemRect.left - 5,
20529
+ background: PRIMARY3,
20530
+ zIndex: 2147483644
20531
+ },
20532
+ children: "Media item"
20533
+ }
20534
+ ),
20535
+ linkOpen && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20536
+ LinkModal,
20537
+ {
20538
+ href: activeHref,
20539
+ linkTarget: activeTarget,
20540
+ onClose: () => setLinkOpen(false),
20541
+ onSave: (href, linkTarget) => {
20542
+ void runMutation(
20543
+ active.sectionId,
20544
+ (tree) => setMediaStripItemLink(tree, active.index, href ? { href, linkTarget } : {})
20545
+ );
20546
+ }
20547
+ }
20548
+ )
20549
+ ] })
19937
20550
  ] });
19938
20551
  }
19939
20552
 
19940
20553
  // src/ui/ai-section/AiPricingCardOverlay.tsx
19941
20554
  var import_react14 = require("react");
19942
- var import_lucide_react9 = require("lucide-react");
19943
- var import_jsx_runtime21 = require("react/jsx-runtime");
20555
+ var import_lucide_react10 = require("lucide-react");
20556
+ var import_jsx_runtime22 = require("react/jsx-runtime");
19944
20557
  var PRIMARY4 = "var(--ohw-primary, #0885FE)";
19945
- 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]";
20558
+ 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]";
19946
20559
  function findPricingCardElement(sectionId, index) {
19947
20560
  const sectionEl2 = findByInstanceId(sectionId);
19948
20561
  if (!sectionEl2) return null;
@@ -19954,7 +20567,7 @@ function findPricingCardElement(sectionId, index) {
19954
20567
  }
19955
20568
  function cardRefFromTarget(target) {
19956
20569
  if (!(target instanceof Element)) return null;
19957
- if (target.closest(CHROME_SELECTOR)) return null;
20570
+ if (target.closest(CHROME_SELECTOR2)) return null;
19958
20571
  const cardEl = target.closest("[data-ohw-pricing-card]");
19959
20572
  if (!cardEl) return null;
19960
20573
  const sectionEl2 = cardEl.closest("[data-ohw-section]");
@@ -19964,21 +20577,21 @@ function cardRefFromTarget(target) {
19964
20577
  if (!sectionId || Number.isNaN(index)) return null;
19965
20578
  return { sectionId, index };
19966
20579
  }
19967
- function sameRef(a, b) {
20580
+ function sameRef2(a, b) {
19968
20581
  return a?.sectionId === b?.sectionId && a?.index === b?.index;
19969
20582
  }
19970
- function rectOf(el) {
20583
+ function rectOf2(el) {
19971
20584
  if (!el) return null;
19972
20585
  const r2 = el.getBoundingClientRect();
19973
20586
  if (r2.width <= 0 || r2.height <= 0) return null;
19974
20587
  return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
19975
20588
  }
19976
20589
  function readRect3(ref) {
19977
- return rectOf(ref && findPricingCardElement(ref.sectionId, ref.index));
20590
+ return rectOf2(ref && findPricingCardElement(ref.sectionId, ref.index));
19978
20591
  }
19979
20592
  function readGridRect(ref) {
19980
20593
  const card = ref && findPricingCardElement(ref.sectionId, ref.index);
19981
- return rectOf(card?.closest("[data-ohw-pricing-collection]") ?? card);
20594
+ return rectOf2(card?.closest("[data-ohw-pricing-collection]") ?? card);
19982
20595
  }
19983
20596
  function useLiveCardRect(ref, grid = false) {
19984
20597
  const [rect, setRect] = (0, import_react14.useState)(null);
@@ -20008,7 +20621,7 @@ function useLiveCardRect(ref, grid = false) {
20008
20621
  }
20009
20622
  var TOOLBAR_GRID_GAP = 52;
20010
20623
  var TOOLBAR_GRID_GAP_MOBILE = 42;
20011
- var TOOLBAR_EDGE_MARGIN2 = 4;
20624
+ var TOOLBAR_EDGE_MARGIN3 = 4;
20012
20625
  function GridToolbarSlot({ gridRect, children }) {
20013
20626
  const slotRef = (0, import_react14.useRef)(null);
20014
20627
  const [shift, setShift] = (0, import_react14.useState)(0);
@@ -20020,7 +20633,7 @@ function GridToolbarSlot({ gridRect, children }) {
20020
20633
  const w = slot.offsetWidth;
20021
20634
  if (w <= 0) return;
20022
20635
  const half = w / 2;
20023
- const clamped = Math.max(TOOLBAR_EDGE_MARGIN2 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN2 - half));
20636
+ const clamped = Math.max(TOOLBAR_EDGE_MARGIN3 + half, Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half));
20024
20637
  setShift((prev) => Math.abs(prev - (clamped - centerX)) < 0.5 ? prev : clamped - centerX);
20025
20638
  };
20026
20639
  clamp();
@@ -20029,7 +20642,7 @@ function GridToolbarSlot({ gridRect, children }) {
20029
20642
  return () => ro.disconnect();
20030
20643
  }, [centerX, children]);
20031
20644
  const mobile = window.innerWidth <= 480;
20032
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20645
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20033
20646
  "div",
20034
20647
  {
20035
20648
  ref: slotRef,
@@ -20064,7 +20677,7 @@ function requestValidateTree2(postToParent2, tree) {
20064
20677
  });
20065
20678
  }
20066
20679
  function StyleSwatch({ style }) {
20067
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20680
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20068
20681
  "span",
20069
20682
  {
20070
20683
  "aria-hidden": true,
@@ -20078,35 +20691,35 @@ function StyleSwatch({ style }) {
20078
20691
  );
20079
20692
  }
20080
20693
  function ButtonGlyph() {
20081
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20082
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20083
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20694
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "12", viewBox: "0 0 18 12", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20695
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("rect", { x: "0.75", y: "0.75", width: "16.5", height: "10.5", rx: "3", stroke: "currentColor", strokeWidth: "1.5" }),
20696
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5.5 6H12.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
20084
20697
  ] });
20085
20698
  }
20086
20699
  function FeatureGlyph({ mode }) {
20087
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20088
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20089
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20090
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20091
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20092
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20093
- mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20700
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", "aria-hidden": true, style: { pointerEvents: "none" }, children: [
20701
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "8", cy: "8", r: "7.25", stroke: "currentColor", strokeWidth: "1.5" }),
20702
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M5 8.2L7.2 10.3L11 6", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }),
20703
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "4.25", fill: "var(--ohw-background, #ffffff)", stroke: "var(--ohw-background, #ffffff)", strokeWidth: "1" }),
20704
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("circle", { cx: "13.5", cy: "13.5", r: "3.75", fill: "var(--ohw-background, #ffffff)", stroke: PRIMARY4, strokeWidth: "1" }),
20705
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M11.5 13.5H15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" }),
20706
+ mode === "add" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M13.5 11.5V15.5", stroke: PRIMARY4, strokeWidth: "1.5", strokeLinecap: "round" })
20094
20707
  ] });
20095
20708
  }
20096
- function ToolbarAction({
20709
+ function ToolbarAction2({
20097
20710
  label,
20098
20711
  onClick,
20099
20712
  disabled = false,
20100
20713
  children
20101
20714
  }) {
20102
- const button = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20103
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20104
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: button }) : button }),
20105
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20715
+ const button = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CustomToolbarButton, { type: "button", "aria-label": label, disabled, onClick, className: "size-8", children });
20716
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20717
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: button }) : button }),
20718
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: label })
20106
20719
  ] });
20107
20720
  }
20108
- function ToolbarSeparator() {
20109
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20721
+ function ToolbarSeparator2() {
20722
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "mx-0.5 block h-6 w-px shrink-0 bg-border" });
20110
20723
  }
20111
20724
  function CardStyleMenu({
20112
20725
  value,
@@ -20114,7 +20727,7 @@ function CardStyleMenu({
20114
20727
  disabled = false
20115
20728
  }) {
20116
20729
  const current = PRICING_CARD_STYLES.find((s) => s.value === value) ?? PRICING_CARD_STYLES[0];
20117
- const trigger = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20730
+ const trigger = /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20118
20731
  "button",
20119
20732
  {
20120
20733
  type: "button",
@@ -20125,28 +20738,28 @@ function CardStyleMenu({
20125
20738
  disabled && "cursor-not-allowed opacity-40 hover:bg-transparent"
20126
20739
  ),
20127
20740
  children: [
20128
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: current.value }),
20129
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20130
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20741
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: current.value }),
20742
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex-1 text-left", children: current.label }),
20743
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.ChevronDown, { size: 16, style: { pointerEvents: "none" } })
20131
20744
  ]
20132
20745
  }
20133
20746
  );
20134
20747
  if (disabled) {
20135
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20136
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20137
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20138
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "inline-flex", children: trigger }) }),
20139
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20748
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20749
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground opacity-50", children: "Card style" }),
20750
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20751
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "inline-flex", children: trigger }) }),
20752
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: "Mark as featured to edit card style" })
20140
20753
  ] })
20141
20754
  ] });
20142
20755
  }
20143
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20144
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20145
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(DropdownMenu, { modal: false, children: [
20146
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20147
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20756
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-1.5 pl-1.5", children: [
20757
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-xs text-muted-foreground", children: "Card style" }),
20758
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(DropdownMenu, { modal: false, children: [
20759
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuTrigger, { asChild: true, children: trigger }),
20760
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "w-[152px] min-w-[152px] p-1", children: PRICING_CARD_STYLES.map((style) => {
20148
20761
  const selected = style.value === value;
20149
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20762
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20150
20763
  DropdownMenuItem,
20151
20764
  {
20152
20765
  role: "menuitemradio",
@@ -20154,9 +20767,9 @@ function CardStyleMenu({
20154
20767
  onSelect: () => onChange(style.value),
20155
20768
  className: cn("grid grid-cols-[18px_1fr_16px] gap-2 py-2 pl-2 pr-2 text-[13px]", selected && "bg-muted"),
20156
20769
  children: [
20157
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StyleSwatch, { style: style.value }),
20158
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: style.label }),
20159
- selected && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Check, { size: 16, className: "text-bridge-primary" })
20770
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StyleSwatch, { style: style.value }),
20771
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: style.label }),
20772
+ selected && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Check, { size: 16, className: "text-bridge-primary" })
20160
20773
  ]
20161
20774
  },
20162
20775
  style.value
@@ -20186,7 +20799,7 @@ function PricingCardToolbar({
20186
20799
  const style = pricingCardStyle(entry.tree, index);
20187
20800
  const featuredTag = pricingCardFeaturedTag(entry.tree, index);
20188
20801
  const mobile = window.innerWidth <= 480;
20189
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20802
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20190
20803
  "div",
20191
20804
  {
20192
20805
  "data-ohw-bridge": "",
@@ -20198,7 +20811,7 @@ function PricingCardToolbar({
20198
20811
  ),
20199
20812
  style: { maxWidth: mobile ? "calc(100vw - 24px)" : void 0 },
20200
20813
  children: [
20201
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
20814
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
20202
20815
  "div",
20203
20816
  {
20204
20817
  className: cn(
@@ -20207,8 +20820,8 @@ function PricingCardToolbar({
20207
20820
  mobile ? "flex-wrap justify-center" : "flex-nowrap"
20208
20821
  ),
20209
20822
  children: [
20210
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Tooltip, { children: [
20211
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20823
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
20824
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20212
20825
  CustomToolbarButton,
20213
20826
  {
20214
20827
  type: "button",
@@ -20216,8 +20829,8 @@ function PricingCardToolbar({
20216
20829
  "aria-pressed": featuredTag,
20217
20830
  onClick: () => onSetFeaturedTag(!featuredTag),
20218
20831
  className: "group size-8",
20219
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20220
- import_lucide_react9.Star,
20832
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20833
+ import_lucide_react10.Star,
20221
20834
  {
20222
20835
  size: 16,
20223
20836
  fill: "currentColor",
@@ -20231,25 +20844,25 @@ function PricingCardToolbar({
20231
20844
  )
20232
20845
  }
20233
20846
  ) }),
20234
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20847
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { side: "bottom", sideOffset: 8, children: featuredTag ? "Unmark featured" : "Mark as featured" })
20235
20848
  ] }),
20236
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20237
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20238
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20239
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}) }),
20240
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "relative inline-flex", children: [
20241
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ButtonGlyph, {}),
20242
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20849
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20850
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardStyleMenu, { value: style, onChange: onSetStyle, disabled: !featuredTag }),
20851
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20852
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add button", onClick: onAddButton, disabled: buttonCount >= 2, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}) }),
20853
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove button", onClick: onRemoveButton, disabled: buttonCount === 0, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("span", { className: "relative inline-flex", children: [
20854
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ButtonGlyph, {}),
20855
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 10, strokeWidth: 2.5, className: "absolute -right-1.5 -top-1.5 rounded-full bg-background text-bridge-primary" })
20243
20856
  ] }) }),
20244
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "add" }) }),
20245
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(FeatureGlyph, { mode: "remove" }) }),
20246
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarSeparator, {}),
20247
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20248
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ToolbarAction, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Minus, { size: 16, style: { pointerEvents: "none" } }) })
20857
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add feature", onClick: onAddFeature, disabled: featureCount >= 10, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "add" }) }),
20858
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove feature", onClick: onRemoveFeature, disabled: featureCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FeatureGlyph, { mode: "remove" }) }),
20859
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarSeparator2, {}),
20860
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Add tier", onClick: onAddTier, disabled: collectionCount >= 4, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Plus, { size: 16, style: { pointerEvents: "none" } }) }),
20861
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ToolbarAction2, { label: "Remove tier", onClick: onRemoveTier, disabled: collectionCount <= 1, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Minus, { size: 16, style: { pointerEvents: "none" } }) })
20249
20862
  ]
20250
20863
  }
20251
20864
  ),
20252
- error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20865
+ error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "max-w-[260px] rounded-md bg-background px-2 py-1 text-center text-[11px] text-destructive shadow-sm", children: error })
20253
20866
  ]
20254
20867
  }
20255
20868
  ) });
@@ -20283,7 +20896,7 @@ function AiPricingCardOverlay({
20283
20896
  const overEditable = Boolean(t?.closest?.("[data-ohw-editable], [data-ohw-role], a, button"));
20284
20897
  setHover((prev) => {
20285
20898
  const next = ref && !overEditable ? ref : null;
20286
- return sameRef(prev, next) ? prev : next;
20899
+ return sameRef2(prev, next) ? prev : next;
20287
20900
  });
20288
20901
  };
20289
20902
  const onLeave = () => setHover(null);
@@ -20298,10 +20911,10 @@ function AiPricingCardOverlay({
20298
20911
  const onClick = (e) => {
20299
20912
  const t = e.target;
20300
20913
  if (!(t instanceof Element)) return;
20301
- if (t.closest(CHROME_SELECTOR)) return;
20914
+ if (t.closest(CHROME_SELECTOR2)) return;
20302
20915
  const ref = cardRefFromTarget(t);
20303
- setActive((prev) => sameRef(prev, ref) ? prev : ref);
20304
- if (!ref || !sameRef(activeRef.current, ref)) setError(null);
20916
+ setActive((prev) => sameRef2(prev, ref) ? prev : ref);
20917
+ if (!ref || !sameRef2(activeRef.current, ref)) setError(null);
20305
20918
  };
20306
20919
  document.addEventListener("click", onClick, true);
20307
20920
  return () => document.removeEventListener("click", onClick, true);
@@ -20366,12 +20979,12 @@ function AiPricingCardOverlay({
20366
20979
  const activeEntry = active ? findEntry(active.sectionId) : null;
20367
20980
  const activeCardRect = useLiveCardRect(active);
20368
20981
  const activeGridRect = useLiveCardRect(active, true);
20369
- const hoverRect = useLiveCardRect(hover && !sameRef(hover, active) ? hover : null);
20370
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20371
- hoverRect && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20372
- activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
20373
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20374
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
20982
+ const hoverRect = useLiveCardRect(hover && !sameRef2(hover, active) ? hover : null);
20983
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20984
+ hoverRect && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: hoverRect, state: "hover" }),
20985
+ activeCardRect && activeGridRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20986
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ItemInteractionLayer, { rect: activeCardRect, state: "active-top" }),
20987
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(GridToolbarSlot, { gridRect: activeGridRect, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20375
20988
  PricingCardToolbar,
20376
20989
  {
20377
20990
  entry: activeEntry,
@@ -20399,7 +21012,7 @@ function AiPricingCardOverlay({
20399
21012
  onRemoveFeature: () => runMutation(active.sectionId, (tree) => removePricingCardFeature(tree, active.index))
20400
21013
  }
20401
21014
  ) }),
20402
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
21015
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
20403
21016
  "div",
20404
21017
  {
20405
21018
  "data-ohw-bridge": "",
@@ -20421,7 +21034,7 @@ function AiPricingCardOverlay({
20421
21034
 
20422
21035
  // src/ui/ai-section/AiVideoOverlay.tsx
20423
21036
  var import_react15 = require("react");
20424
- var import_lucide_react10 = require("lucide-react");
21037
+ var import_lucide_react11 = require("lucide-react");
20425
21038
 
20426
21039
  // src/lib/ai-video-tree.ts
20427
21040
  function resolveVideoBlock(tree, path) {
@@ -20463,39 +21076,11 @@ function clearVideo(tree, path) {
20463
21076
  });
20464
21077
  }
20465
21078
 
20466
- // src/lib/youtube.ts
20467
- var YOUTUBE_ID_PATTERN = /^[A-Za-z0-9_-]{11}$/;
20468
- function extractYouTubeId(input) {
20469
- const trimmed = input.trim();
20470
- if (!trimmed) return null;
20471
- if (YOUTUBE_ID_PATTERN.test(trimmed)) return trimmed;
20472
- let url;
20473
- try {
20474
- url = new URL(trimmed);
20475
- } catch {
20476
- return null;
20477
- }
20478
- const host = url.hostname.replace(/^www\./, "");
20479
- if (host !== "youtube.com" && host !== "m.youtube.com" && host !== "youtu.be" && host !== "youtube-nocookie.com") {
20480
- return null;
20481
- }
20482
- let candidate = null;
20483
- if (host === "youtu.be") {
20484
- candidate = url.pathname.slice(1).split("/")[0] ?? null;
20485
- } else if (url.pathname === "/watch") {
20486
- candidate = url.searchParams.get("v");
20487
- } else {
20488
- const match = url.pathname.match(/^\/(?:embed|shorts)\/([^/]+)/);
20489
- candidate = match ? match[1] : null;
20490
- }
20491
- return candidate && YOUTUBE_ID_PATTERN.test(candidate) ? candidate : null;
20492
- }
20493
-
20494
21079
  // src/ui/ai-section/AiVideoOverlay.tsx
20495
- var import_jsx_runtime22 = require("react/jsx-runtime");
21080
+ var import_jsx_runtime23 = require("react/jsx-runtime");
20496
21081
  var PRIMARY5 = "#0885FE";
20497
- var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY5})`;
20498
- var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
21082
+ var OHW_BLUE = `var(--ohw-primary, ${PRIMARY5})`;
21083
+ var OHW_BLUE_DARK = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY5}) 60%, #000000)`;
20499
21084
  function findVideoBlockElement(sectionId, path) {
20500
21085
  const sectionEl2 = findByInstanceId(sectionId);
20501
21086
  if (!sectionEl2) return null;
@@ -20555,12 +21140,12 @@ function requestValidateTree3(postToParent2, tree) {
20555
21140
  postToParent2({ type: "ow:ai-validate-tree-request", id, tree });
20556
21141
  });
20557
21142
  }
20558
- function Pill2({
21143
+ function Pill({
20559
21144
  label,
20560
21145
  onClick,
20561
21146
  disabled
20562
21147
  }) {
20563
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21148
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20564
21149
  "button",
20565
21150
  {
20566
21151
  type: "button",
@@ -20576,7 +21161,7 @@ function Pill2({
20576
21161
  border: "none",
20577
21162
  cursor: disabled ? "default" : "pointer",
20578
21163
  background: "#ffffff",
20579
- color: OHW_BLUE_DARK2,
21164
+ color: OHW_BLUE_DARK,
20580
21165
  opacity: disabled ? 0.4 : 1,
20581
21166
  fontSize: 12,
20582
21167
  lineHeight: "16px",
@@ -20619,8 +21204,8 @@ function VideoUrlInput({ value, onCommit }) {
20619
21204
  onCommit(id);
20620
21205
  }
20621
21206
  };
20622
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
20623
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21207
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", flexDirection: "column", gap: 4, width: "100%", maxWidth: 280 }, children: [
21208
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20624
21209
  "div",
20625
21210
  {
20626
21211
  style: {
@@ -20636,12 +21221,12 @@ function VideoUrlInput({ value, onCommit }) {
20636
21221
  boxShadow: invalid ? "inset 0 0 0 1.5px #EF4444" : "none"
20637
21222
  },
20638
21223
  children: [
20639
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21224
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20640
21225
  "span",
20641
21226
  {
20642
21227
  style: {
20643
21228
  flex: "0 0 auto",
20644
- color: OHW_BLUE_DARK2,
21229
+ color: OHW_BLUE_DARK,
20645
21230
  fontSize: 10,
20646
21231
  lineHeight: "16px",
20647
21232
  fontWeight: 700,
@@ -20651,7 +21236,7 @@ function VideoUrlInput({ value, onCommit }) {
20651
21236
  children: "Video"
20652
21237
  }
20653
21238
  ),
20654
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21239
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20655
21240
  "input",
20656
21241
  {
20657
21242
  type: "text",
@@ -20688,7 +21273,7 @@ function VideoUrlInput({ value, onCommit }) {
20688
21273
  ]
20689
21274
  }
20690
21275
  ),
20691
- invalid && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
21276
+ invalid && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, textAlign: "center" }, children: "That doesn't look like a YouTube link \u2014 try pasting the video URL again." })
20692
21277
  ] });
20693
21278
  }
20694
21279
  function VideoToolbar({
@@ -20698,7 +21283,7 @@ function VideoToolbar({
20698
21283
  onSetVideoId,
20699
21284
  onRemove
20700
21285
  }) {
20701
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
21286
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
20702
21287
  "div",
20703
21288
  {
20704
21289
  "data-ohw-bridge": "",
@@ -20710,7 +21295,7 @@ function VideoToolbar({
20710
21295
  gap: 6,
20711
21296
  alignItems: "center",
20712
21297
  width: 280,
20713
- background: OHW_BLUE2,
21298
+ background: OHW_BLUE,
20714
21299
  padding: 8,
20715
21300
  borderRadius: 12,
20716
21301
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -20718,9 +21303,9 @@ function VideoToolbar({
20718
21303
  opacity: pending ? 0.6 : 1
20719
21304
  },
20720
21305
  children: [
20721
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
20722
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Pill2, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
20723
- error && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21306
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VideoUrlInput, { value: videoId, onCommit: onSetVideoId }),
21307
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill, { label: "Remove video", onClick: onRemove, disabled: !videoId }),
21308
+ error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
20724
21309
  ]
20725
21310
  }
20726
21311
  );
@@ -20840,8 +21425,8 @@ function AiVideoOverlay({
20840
21425
  const activeBlockRect = useLiveBlockRect(active);
20841
21426
  const TOOLBAR_APPROX_H = 90;
20842
21427
  const toolbarState = activeBlockRect && activeBlockRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
20843
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
20844
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21428
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21429
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20845
21430
  "button",
20846
21431
  {
20847
21432
  type: "button",
@@ -20869,15 +21454,15 @@ function AiVideoOverlay({
20869
21454
  fontSize: 14,
20870
21455
  fontWeight: 700
20871
21456
  },
20872
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Star, { size: 14, style: { pointerEvents: "none" } })
21457
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
20873
21458
  }
20874
21459
  ),
20875
- activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21460
+ activeBlockRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20876
21461
  ItemInteractionLayer,
20877
21462
  {
20878
21463
  rect: activeBlockRect,
20879
21464
  state: toolbarState,
20880
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
21465
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
20881
21466
  VideoToolbar,
20882
21467
  {
20883
21468
  videoId: videoIdAt(activeEntry.tree, active.path),
@@ -20901,7 +21486,7 @@ function AiVideoOverlay({
20901
21486
 
20902
21487
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20903
21488
  var import_react16 = require("react");
20904
- var import_lucide_react11 = require("lucide-react");
21489
+ var import_lucide_react12 = require("lucide-react");
20905
21490
 
20906
21491
  // src/lib/ai-carousel-tree.ts
20907
21492
  function isCarouselBlock(node) {
@@ -20952,10 +21537,10 @@ function setCarouselAutoplay(tree, on) {
20952
21537
  }
20953
21538
 
20954
21539
  // src/ui/ai-section/AiFadeCarouselOverlay.tsx
20955
- var import_jsx_runtime23 = require("react/jsx-runtime");
21540
+ var import_jsx_runtime24 = require("react/jsx-runtime");
20956
21541
  var PRIMARY6 = "#0885FE";
20957
- var OHW_BLUE3 = `var(--ohw-primary, ${PRIMARY6})`;
20958
- var OHW_BLUE_DARK3 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
21542
+ var OHW_BLUE2 = `var(--ohw-primary, ${PRIMARY6})`;
21543
+ var OHW_BLUE_DARK2 = `color-mix(in srgb, var(--ohw-primary, ${PRIMARY6}) 60%, #000000)`;
20959
21544
  function findCarouselItemElement(sectionId, index) {
20960
21545
  const sectionEl2 = findByInstanceId(sectionId);
20961
21546
  if (!sectionEl2) return null;
@@ -21034,8 +21619,8 @@ function requestAssetPick2(postToParent2) {
21034
21619
  postToParent2({ type: "ow:asset-pick", id });
21035
21620
  });
21036
21621
  }
21037
- function Pill3({ label, onClick, disabled }) {
21038
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21622
+ function Pill2({ label, onClick, disabled }) {
21623
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21039
21624
  "button",
21040
21625
  {
21041
21626
  type: "button",
@@ -21051,7 +21636,7 @@ function Pill3({ label, onClick, disabled }) {
21051
21636
  border: "none",
21052
21637
  cursor: disabled ? "default" : "pointer",
21053
21638
  background: "#ffffff",
21054
- color: OHW_BLUE_DARK3,
21639
+ color: OHW_BLUE_DARK2,
21055
21640
  opacity: disabled ? 0.4 : 1,
21056
21641
  fontSize: 12,
21057
21642
  lineHeight: "16px",
@@ -21069,7 +21654,7 @@ function TogglePill({
21069
21654
  onToggle,
21070
21655
  disabled
21071
21656
  }) {
21072
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21657
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21073
21658
  "button",
21074
21659
  {
21075
21660
  type: "button",
@@ -21088,7 +21673,7 @@ function TogglePill({
21088
21673
  border: "none",
21089
21674
  cursor: disabled ? "default" : "pointer",
21090
21675
  background: "#ffffff",
21091
- color: OHW_BLUE_DARK3,
21676
+ color: OHW_BLUE_DARK2,
21092
21677
  opacity: disabled ? 0.4 : 1,
21093
21678
  fontSize: 12,
21094
21679
  lineHeight: "16px",
@@ -21098,7 +21683,7 @@ function TogglePill({
21098
21683
  },
21099
21684
  children: [
21100
21685
  label,
21101
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21686
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21102
21687
  "span",
21103
21688
  {
21104
21689
  "aria-hidden": true,
@@ -21111,10 +21696,10 @@ function TogglePill({
21111
21696
  // Off is a grey track, not a washed-out blue: the pill's own white background already
21112
21697
  // carries the brand colour in the text, and a pale blue track next to it read as
21113
21698
  // "disabled control" rather than "switch that is off".
21114
- background: on ? OHW_BLUE_DARK3 : "#CBD5E1",
21699
+ background: on ? OHW_BLUE_DARK2 : "#CBD5E1",
21115
21700
  transition: "background 120ms ease"
21116
21701
  },
21117
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21702
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21118
21703
  "span",
21119
21704
  {
21120
21705
  style: {
@@ -21143,7 +21728,7 @@ function CarouselSlideToolbar({
21143
21728
  onChangeImage,
21144
21729
  onToggleAutoplay
21145
21730
  }) {
21146
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
21731
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21147
21732
  "div",
21148
21733
  {
21149
21734
  "data-ohw-bridge": "",
@@ -21154,7 +21739,7 @@ function CarouselSlideToolbar({
21154
21739
  flexDirection: "column",
21155
21740
  gap: 6,
21156
21741
  alignItems: "center",
21157
- background: OHW_BLUE3,
21742
+ background: OHW_BLUE2,
21158
21743
  padding: 8,
21159
21744
  borderRadius: 12,
21160
21745
  boxShadow: "0 8px 24px rgba(0,0,0,0.25)",
@@ -21166,11 +21751,11 @@ function CarouselSlideToolbar({
21166
21751
  pointerEvents: pending ? "none" : "auto"
21167
21752
  },
21168
21753
  children: [
21169
- /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21170
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Pill3, { label: "Change Image", onClick: onChangeImage }),
21171
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21754
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { style: { display: "flex", gap: 6, alignItems: "center" }, children: [
21755
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Pill2, { label: "Change Image", onClick: onChangeImage }),
21756
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TogglePill, { label: "Autoplay", on: autoplay, onToggle: onToggleAutoplay })
21172
21757
  ] }),
21173
- error && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21758
+ error && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { style: { color: "#FCA5A5", fontSize: 11, maxWidth: 220, textAlign: "center" }, children: error })
21174
21759
  ]
21175
21760
  }
21176
21761
  );
@@ -21310,8 +21895,8 @@ function AiFadeCarouselOverlay({
21310
21895
  const activeItemRect = useLiveItemRect2(active);
21311
21896
  const TOOLBAR_APPROX_H = 90;
21312
21897
  const toolbarState = activeItemRect && activeItemRect.top < TOOLBAR_APPROX_H ? "active-bottom" : "active-top";
21313
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
21314
- hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21898
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
21899
+ hoverHandleRect && hover && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21315
21900
  "button",
21316
21901
  {
21317
21902
  type: "button",
@@ -21340,10 +21925,10 @@ function AiFadeCarouselOverlay({
21340
21925
  fontSize: 14,
21341
21926
  fontWeight: 700
21342
21927
  },
21343
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Star, { size: 14, style: { pointerEvents: "none" } })
21928
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Star, { size: 14, style: { pointerEvents: "none" } })
21344
21929
  }
21345
21930
  ),
21346
- swapping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21931
+ swapping && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21347
21932
  "div",
21348
21933
  {
21349
21934
  ref: skeletonRef,
@@ -21361,15 +21946,15 @@ function AiFadeCarouselOverlay({
21361
21946
  zIndex: 2147483646,
21362
21947
  pointerEvents: "none"
21363
21948
  },
21364
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("style", { children: MEDIA_SKELETON_CSS })
21949
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("style", { children: MEDIA_SKELETON_CSS })
21365
21950
  }
21366
21951
  ),
21367
- activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21952
+ activeItemRect && active && activeEntry && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21368
21953
  ItemInteractionLayer,
21369
21954
  {
21370
21955
  rect: activeItemRect,
21371
21956
  state: toolbarState,
21372
- toolbar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
21957
+ toolbar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21373
21958
  CarouselSlideToolbar,
21374
21959
  {
21375
21960
  pending,
@@ -21560,113 +22145,6 @@ function mergePrefetchedSections(prev, fetched, livePath, liveSections) {
21560
22145
  // src/ui/link-modal/LinkPopover.tsx
21561
22146
  var import_react20 = require("react");
21562
22147
 
21563
- // src/ui/dialog.tsx
21564
- var React9 = __toESM(require("react"), 1);
21565
- var import_radix_ui6 = require("radix-ui");
21566
- var import_lucide_react12 = require("lucide-react");
21567
- var import_jsx_runtime24 = require("react/jsx-runtime");
21568
- function Dialog2({
21569
- ...props
21570
- }) {
21571
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Root, { "data-slot": "dialog", ...props });
21572
- }
21573
- function DialogPortal({
21574
- ...props
21575
- }) {
21576
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_radix_ui6.Dialog.Portal, { ...props });
21577
- }
21578
- function DialogOverlay({
21579
- className,
21580
- ...props
21581
- }) {
21582
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21583
- import_radix_ui6.Dialog.Overlay,
21584
- {
21585
- "data-slot": "dialog-overlay",
21586
- "data-ohw-link-modal-root": "",
21587
- className: cn("fixed inset-0 z-[2147483646] bg-black/50", className),
21588
- ...props
21589
- }
21590
- );
21591
- }
21592
- var DialogContent = React9.forwardRef(
21593
- ({ className, children, showCloseButton = true, container, ...props }, ref) => {
21594
- const positionMode = container ? "absolute" : "fixed";
21595
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(DialogPortal, { container: container ?? void 0, children: [
21596
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DialogOverlay, { className: cn(positionMode, "inset-0") }),
21597
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
21598
- import_radix_ui6.Dialog.Content,
21599
- {
21600
- ref,
21601
- "data-slot": "dialog-content",
21602
- className: cn(
21603
- positionMode,
21604
- "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",
21605
- "rounded-xl border border-border bg-background font-sans shadow-lg outline-none",
21606
- container ? "max-h-[calc(100%-32px)]" : "max-h-[calc(100vh-32px)]",
21607
- className
21608
- ),
21609
- onMouseDown: (e) => e.stopPropagation(),
21610
- ...props,
21611
- children: [
21612
- children,
21613
- showCloseButton ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21614
- import_radix_ui6.Dialog.Close,
21615
- {
21616
- type: "button",
21617
- className: "absolute right-[9px] top-[9px] rounded-sm p-1.5 text-foreground hover:bg-muted/50",
21618
- "aria-label": "Close",
21619
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { size: 16, "aria-hidden": true })
21620
- }
21621
- ) : null
21622
- ]
21623
- }
21624
- )
21625
- ] });
21626
- }
21627
- );
21628
- DialogContent.displayName = import_radix_ui6.Dialog.Content.displayName;
21629
- function DialogHeader({
21630
- className,
21631
- ...props
21632
- }) {
21633
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: cn("flex flex-col gap-1.5", className), ...props });
21634
- }
21635
- function DialogFooter({
21636
- className,
21637
- ...props
21638
- }) {
21639
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21640
- "div",
21641
- {
21642
- className: cn("flex items-center justify-end gap-2", className),
21643
- ...props
21644
- }
21645
- );
21646
- }
21647
- var DialogTitle = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21648
- import_radix_ui6.Dialog.Title,
21649
- {
21650
- ref,
21651
- className: cn(
21652
- "text-lg font-semibold leading-none tracking-tight text-card-foreground",
21653
- className
21654
- ),
21655
- ...props
21656
- }
21657
- ));
21658
- DialogTitle.displayName = import_radix_ui6.Dialog.Title.displayName;
21659
- var DialogDescription = React9.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
21660
- import_radix_ui6.Dialog.Description,
21661
- {
21662
- ref,
21663
- className: cn("text-sm text-muted-foreground", className),
21664
- ...props
21665
- }
21666
- ));
21667
- DialogDescription.displayName = import_radix_ui6.Dialog.Description.displayName;
21668
- var DialogClose = import_radix_ui6.Dialog.Close;
21669
-
21670
22148
  // src/ui/link-modal/LinkEditorPanel.tsx
21671
22149
  var import_lucide_react16 = require("lucide-react");
21672
22150
 
@@ -22770,6 +23248,7 @@ function shouldUseDevFixtures() {
22770
23248
  function getLogoElement(el) {
22771
23249
  const marked = el.closest('[data-ohw-role="logo"], [data-ohw-logo]');
22772
23250
  if (marked) return marked;
23251
+ if (el.closest('[data-ohw-editable="icon"]')) return null;
22773
23252
  const root = el.closest("nav, [data-ohw-nav-root], footer");
22774
23253
  if (!root) return null;
22775
23254
  const anchor = el.closest("a");
@@ -25586,7 +26065,7 @@ function getNavigationSelectionParent(el) {
25586
26065
  if (!isFooterLinksContainer(el) && (el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup2(el))) {
25587
26066
  return resolveFooterLinksContainerFrom(el);
25588
26067
  }
25589
- if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-nav-drawer") || isFooterLinksContainer(el)) {
26068
+ 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)) {
25590
26069
  return getNavigationRoot(el);
25591
26070
  }
25592
26071
  return null;
@@ -25808,7 +26287,6 @@ var ICONS = {
25808
26287
  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"/>',
25809
26288
  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"/>'
25810
26289
  };
25811
- var HEIGHT_SETTLE_DELAYS = [150, 400, 800];
25812
26290
  var SELECTION_CHROME_GAP2 = 4;
25813
26291
  var TOOLBAR_STROKE_GAP2 = 4;
25814
26292
  var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
@@ -25906,7 +26384,7 @@ function applyVisibleViewport(el, parentScroll) {
25906
26384
  el.style.top = `${top}px`;
25907
26385
  el.style.height = `${height}px`;
25908
26386
  }
25909
- var TOOLBAR_EDGE_MARGIN3 = 4;
26387
+ var TOOLBAR_EDGE_MARGIN4 = 4;
25910
26388
  function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25911
26389
  const isAbove = transform.includes("translateY(-100%)");
25912
26390
  let visualTop = isAbove ? top - approxH : top;
@@ -25933,8 +26411,8 @@ function clampToolbarToClip(top, transform, rect, clip, approxH, gap) {
25933
26411
  function clampToolbarLeft(centerX, toolbarWidth) {
25934
26412
  const half = toolbarWidth / 2;
25935
26413
  return Math.max(
25936
- TOOLBAR_EDGE_MARGIN3 + half,
25937
- Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN3 - half)
26414
+ TOOLBAR_EDGE_MARGIN4 + half,
26415
+ Math.min(centerX, window.innerWidth - TOOLBAR_EDGE_MARGIN4 - half)
25938
26416
  );
25939
26417
  }
25940
26418
  function calcToolbarPos(rect, parentScroll, toolbarW = 306) {
@@ -26056,7 +26534,10 @@ function FloatingToolbar({
26056
26534
  onCommand,
26057
26535
  activeCommands,
26058
26536
  showEditLink,
26059
- onEditLink
26537
+ onEditLink,
26538
+ showDelete,
26539
+ onDelete,
26540
+ deleteDisabled
26060
26541
  }) {
26061
26542
  const localRef = import_react25.default.useRef(null);
26062
26543
  const [measuredW, setMeasuredW] = import_react25.default.useState(330);
@@ -26083,7 +26564,7 @@ function FloatingToolbar({
26083
26564
  const ro = new ResizeObserver(update);
26084
26565
  ro.observe(node);
26085
26566
  return () => ro.disconnect();
26086
- }, [showEditLink, activeCommands]);
26567
+ }, [showEditLink, showDelete, activeCommands]);
26087
26568
  const { top, left, transform } = calcToolbarPos(rect, parentScroll, measuredW);
26088
26569
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
26089
26570
  "div",
@@ -26148,7 +26629,28 @@ function FloatingToolbar({
26148
26629
  },
26149
26630
  children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Link, { className: "size-4 shrink-0", "aria-hidden": true })
26150
26631
  }
26151
- ) : null
26632
+ ) : null,
26633
+ showDelete ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
26634
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
26635
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
26636
+ CustomToolbarButton,
26637
+ {
26638
+ type: "button",
26639
+ title: "Delete",
26640
+ disabled: deleteDisabled,
26641
+ onMouseDown: (e) => {
26642
+ e.preventDefault();
26643
+ e.stopPropagation();
26644
+ if (!deleteDisabled) onDelete?.();
26645
+ },
26646
+ onClick: (e) => {
26647
+ e.preventDefault();
26648
+ e.stopPropagation();
26649
+ },
26650
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Trash2, { className: "size-4 shrink-0", "aria-hidden": true })
26651
+ }
26652
+ )
26653
+ ] }) : null
26152
26654
  ] })
26153
26655
  }
26154
26656
  );
@@ -26762,6 +27264,8 @@ function OhhwellsBridge() {
26762
27264
  const [activeCommands, setActiveCommands] = (0, import_react25.useState)(/* @__PURE__ */ new Set());
26763
27265
  const [sectionGap, setSectionGap] = (0, import_react25.useState)(null);
26764
27266
  const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react25.useState)(false);
27267
+ const [toolbarShowAiBlockDelete, setToolbarShowAiBlockDelete] = (0, import_react25.useState)(false);
27268
+ const deletingAiBlockRef = (0, import_react25.useRef)(false);
26765
27269
  const hoveredNavContainerRef = (0, import_react25.useRef)(null);
26766
27270
  const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react25.useState)(null);
26767
27271
  const hoveredItemElRef = (0, import_react25.useRef)(null);
@@ -26817,21 +27321,6 @@ function OhhwellsBridge() {
26817
27321
  const [isItemDragging, setIsItemDragging] = (0, import_react25.useState)(false);
26818
27322
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react25.useState)(false);
26819
27323
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
26820
- const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
26821
- const floatingPanelOpenRef = (0, import_react25.useRef)(false);
26822
- floatingPanelOpenRef.current = floatingPanel !== null;
26823
- const floatingPanelRef = (0, import_react25.useRef)(null);
26824
- floatingPanelRef.current = floatingPanel;
26825
- const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
26826
- const buttonCollectionDragRef = (0, import_react25.useRef)(null);
26827
- const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
26828
- const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
26829
- const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
26830
- const buttonPointerDragRef = (0, import_react25.useRef)(null);
26831
- const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
26832
- const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
26833
- const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
26834
- const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
26835
27324
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react25.useState)(null);
26836
27325
  const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react25.useState)(null);
26837
27326
  const footerDragRef = (0, import_react25.useRef)(null);
@@ -26858,6 +27347,21 @@ function OhhwellsBridge() {
26858
27347
  const stylesRef = (0, import_react25.useRef)("");
26859
27348
  const appliedDrawerRef = (0, import_react25.useRef)(null);
26860
27349
  const pendingDeleteUndoRef = (0, import_react25.useRef)(null);
27350
+ const [floatingPanel, setFloatingPanel] = (0, import_react25.useState)(null);
27351
+ const floatingPanelOpenRef = (0, import_react25.useRef)(false);
27352
+ const floatingPanelRef = (0, import_react25.useRef)(null);
27353
+ floatingPanelRef.current = floatingPanel;
27354
+ const setFloatingPanelRef = (0, import_react25.useRef)(setFloatingPanel);
27355
+ const [floatingPanelPos, setFloatingPanelPos] = (0, import_react25.useState)(null);
27356
+ const buttonCollectionDragRef = (0, import_react25.useRef)(null);
27357
+ const buttonDropInsertIndexRef = (0, import_react25.useRef)(null);
27358
+ const [buttonDropSlots, setButtonDropSlots] = (0, import_react25.useState)([]);
27359
+ const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react25.useState)(null);
27360
+ const buttonPointerDragRef = (0, import_react25.useRef)(null);
27361
+ const [buttonStyleTick, setButtonStyleTick] = (0, import_react25.useState)(0);
27362
+ const [logoSizeDraft, setLogoSizeDraft] = (0, import_react25.useState)(null);
27363
+ const [editorViewport, setEditorViewport] = (0, import_react25.useState)("desktop");
27364
+ const [parentScrollSnap, setParentScrollSnap] = (0, import_react25.useState)(null);
26861
27365
  const [sitePages, setSitePages] = (0, import_react25.useState)([]);
26862
27366
  const collectionItemsRef = (0, import_react25.useRef)(/* @__PURE__ */ new Map());
26863
27367
  const [sectionsByPath, setSectionsByPath] = (0, import_react25.useState)({});
@@ -26867,7 +27371,18 @@ function OhhwellsBridge() {
26867
27371
  const linkPopoverOpenRef = (0, import_react25.useRef)(false);
26868
27372
  const linkPopoverGraceUntilRef = (0, import_react25.useRef)(0);
26869
27373
  setLinkPopoverRef.current = setLinkPopover;
27374
+ setFloatingPanelRef.current = setFloatingPanel;
26870
27375
  linkPopoverSessionRef.current = linkPopover;
27376
+ floatingPanelOpenRef.current = Boolean(floatingPanel);
27377
+ (0, import_react25.useEffect)(() => {
27378
+ const syncViewport = () => {
27379
+ const next = window.innerWidth <= 480 ? "mobile" : "desktop";
27380
+ setEditorViewport((prev) => prev === next ? prev : next);
27381
+ };
27382
+ syncViewport();
27383
+ window.addEventListener("resize", syncViewport);
27384
+ return () => window.removeEventListener("resize", syncViewport);
27385
+ }, []);
26871
27386
  (0, import_react25.useEffect)(() => {
26872
27387
  setSectionOrderPersistHandler((entries) => {
26873
27388
  const currentPath = window.location.pathname;
@@ -27174,6 +27689,7 @@ function OhhwellsBridge() {
27174
27689
  setMaxBadge(null);
27175
27690
  setActiveCommands(/* @__PURE__ */ new Set());
27176
27691
  setToolbarShowEditLink(false);
27692
+ setToolbarShowAiBlockDelete(false);
27177
27693
  postToParent2({ type: "ow:exit-edit" });
27178
27694
  }, [postToParent2]);
27179
27695
  const clearSelectedAttr = (0, import_react25.useCallback)(() => {
@@ -27344,6 +27860,7 @@ function OhhwellsBridge() {
27344
27860
  setMaxBadge(null);
27345
27861
  setActiveCommands(/* @__PURE__ */ new Set());
27346
27862
  setToolbarShowEditLink(false);
27863
+ setToolbarShowAiBlockDelete(false);
27347
27864
  postToParent2({ type: "ow:exit-edit" });
27348
27865
  reselectNavigationItem(navAnchor);
27349
27866
  }, [postToParent2, reselectNavigationItem]);
@@ -28514,6 +29031,13 @@ function OhhwellsBridge() {
28514
29031
  }
28515
29032
  }
28516
29033
  setToolbarShowEditLink(Boolean(getHrefKeyFromElement(el)));
29034
+ setToolbarShowAiBlockDelete(
29035
+ canRemoveAiBlock(aiSectionsRef.current, el.dataset.ohwKey ?? null) || canSoftHideEditable(el, {
29036
+ isNavFooterItem: Boolean(
29037
+ getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
29038
+ )
29039
+ })
29040
+ );
28517
29041
  const navAnchor = getNavigationItemAnchor(el);
28518
29042
  if (navAnchor) {
28519
29043
  if (isNestedNavChild(navAnchor)) {
@@ -28601,6 +29125,7 @@ function OhhwellsBridge() {
28601
29125
  applyAiFooterFromContent(content);
28602
29126
  if (typeof content[STYLE_STORE_KEY] === "string") {
28603
29127
  stylesRef.current = content[STYLE_STORE_KEY];
29128
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28604
29129
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28605
29130
  }
28606
29131
  applyBrandChrome(content);
@@ -28611,15 +29136,16 @@ function OhhwellsBridge() {
28611
29136
  if (key === "__ohw_sections") continue;
28612
29137
  if (key === AI_SECTIONS_KEY) continue;
28613
29138
  if (key === AI_FOOTER_KEY) continue;
29139
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
29140
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28614
29141
  if (key === BRAND_KIT_KEY) continue;
28615
29142
  if (key === STYLE_STORE_KEY) continue;
28616
29143
  if (BRAND_CHROME_KEYS.has(key)) continue;
28617
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28618
29144
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
28619
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28620
29145
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28621
29146
  continue;
28622
29147
  }
29148
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28623
29149
  if (applyVideoSettingNode(key, val)) continue;
28624
29150
  if (applyCarouselNode(key, val)) continue;
28625
29151
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28659,6 +29185,7 @@ function OhhwellsBridge() {
28659
29185
  });
28660
29186
  applyLinkByKey(key, val);
28661
29187
  }
29188
+ applySectionEmbeds(content);
28662
29189
  applyLogoFromContent(content);
28663
29190
  applyLogoSizes(content);
28664
29191
  reconcileNavbarItemsFromContent(content);
@@ -28667,6 +29194,7 @@ function OhhwellsBridge() {
28667
29194
  applySocialsDisplayFromContent(content);
28668
29195
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
28669
29196
  syncButtonsFromContent(document, content);
29197
+ applyHiddenEditablesToDom(content);
28670
29198
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
28671
29199
  if (typeof content[STYLE_STORE_KEY] === "string") {
28672
29200
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
@@ -28847,20 +29375,22 @@ function OhhwellsBridge() {
28847
29375
  }
28848
29376
  applyAiFooterFromContent(content);
28849
29377
  if (typeof content[STYLE_STORE_KEY] === "string") {
29378
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
28850
29379
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
28851
29380
  }
28852
29381
  for (const [key, val] of Object.entries(content)) {
28853
29382
  if (key === "__ohw_sections") continue;
28854
29383
  if (key === AI_SECTIONS_KEY) continue;
28855
29384
  if (key === AI_FOOTER_KEY) continue;
29385
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
29386
+ if (LOGO_IMAGE_KEYS.includes(key)) continue;
28856
29387
  if (key === BRAND_KIT_KEY) continue;
28857
29388
  if (key === STYLE_STORE_KEY) continue;
28858
29389
  if (BRAND_CHROME_KEYS.has(key)) continue;
28859
- if (key === LOGO_PLACEHOLDER_KEY) continue;
28860
- if (LOGO_IMAGE_KEYS.includes(key)) continue;
28861
29390
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
28862
29391
  continue;
28863
29392
  }
29393
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
28864
29394
  if (applyVideoSettingNode(key, val)) continue;
28865
29395
  if (applyCarouselNode(key, val)) continue;
28866
29396
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -28885,6 +29415,7 @@ function OhhwellsBridge() {
28885
29415
  });
28886
29416
  applyLinkByKey(key, val);
28887
29417
  }
29418
+ applySectionEmbeds(content);
28888
29419
  applyLogoFromContent(content);
28889
29420
  reconcileNavbarItemsFromContent(content);
28890
29421
  reconcileFooterOrderFromContent(content);
@@ -28892,6 +29423,7 @@ function OhhwellsBridge() {
28892
29423
  applySocialsDisplayFromContent(content);
28893
29424
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
28894
29425
  syncButtonsFromContent(document, content);
29426
+ applyHiddenEditablesToDom(content);
28895
29427
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
28896
29428
  if (typeof content[STYLE_STORE_KEY] === "string") {
28897
29429
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
@@ -29030,6 +29562,7 @@ function OhhwellsBridge() {
29030
29562
  applySocialsDisplayFromContent(content);
29031
29563
  applySocialsLabelsFromContent(content, document, { fillEmptyOnly: isEditModeRef.current });
29032
29564
  syncButtonsFromContent(document, content);
29565
+ applyHiddenEditablesToDom(content);
29033
29566
  if (isEditModeRef.current) requestMissingSocialIconsRef.current();
29034
29567
  document.querySelectorAll("footer [data-ohw-href-key]").forEach((el) => {
29035
29568
  if (isFooterHrefKey(el.getAttribute("data-ohw-href-key")) || getSocialItem(el)) {
@@ -29124,26 +29657,11 @@ function OhhwellsBridge() {
29124
29657
  const t2 = setTimeout(measure, 500);
29125
29658
  const ro = new ResizeObserver(schedule);
29126
29659
  ro.observe(document.body);
29127
- let lastWidth = window.innerWidth;
29128
- let resizeTimers = [];
29129
- const clearResizeTimers = () => {
29130
- resizeTimers.forEach(clearTimeout);
29131
- resizeTimers = [];
29132
- };
29133
- const handleResize = () => {
29134
- if (window.innerWidth === lastWidth) return;
29135
- lastWidth = window.innerWidth;
29136
- clearResizeTimers();
29137
- resizeTimers = HEIGHT_SETTLE_DELAYS.map((delay) => setTimeout(measure, delay));
29138
- };
29139
- window.addEventListener("resize", handleResize);
29140
29660
  return () => {
29141
29661
  clearTimeout(t1);
29142
29662
  clearTimeout(t2);
29143
29663
  if (raf != null) cancelAnimationFrame(raf);
29144
29664
  ro.disconnect();
29145
- clearResizeTimers();
29146
- window.removeEventListener("resize", handleResize);
29147
29665
  };
29148
29666
  }, [pathname, isEditMode, postToParent2]);
29149
29667
  (0, import_react25.useEffect)(() => {
@@ -29440,6 +29958,13 @@ function OhhwellsBridge() {
29440
29958
  if (target.closest("[data-ohw-state-toggle]")) return;
29441
29959
  if (target.closest("[data-ohw-max-badge]")) return;
29442
29960
  if (isInsideLinkEditor(target)) return;
29961
+ if (isInsideFloatingPanel(target)) return;
29962
+ if (target.closest("[data-ohw-form-toolbar]")) return;
29963
+ if (target.closest(
29964
+ '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29965
+ )) {
29966
+ return;
29967
+ }
29443
29968
  if (selectedMediaElRef.current && !selectedMediaElRef.current.contains(target) && !target.closest("[data-ohw-media-overlay], [data-ohw-edit-chrome], [data-ohw-item-interaction]")) {
29444
29969
  clearMediaSelectionRef.current();
29445
29970
  }
@@ -29463,8 +29988,6 @@ function OhhwellsBridge() {
29463
29988
  return;
29464
29989
  }
29465
29990
  }
29466
- if (isInsideFloatingPanel(target)) return;
29467
- if (target.closest("[data-ohw-form-toolbar]")) return;
29468
29991
  const collectionItem = matchCollectionItemClick(target, collectionItemsRef.current);
29469
29992
  if (collectionItem) {
29470
29993
  e.preventDefault();
@@ -29476,11 +29999,6 @@ function OhhwellsBridge() {
29476
29999
  });
29477
30000
  return;
29478
30001
  }
29479
- if (target.closest(
29480
- '[data-ohw-field-toolbar], [data-ohw-field-type-picker], [data-radix-popper-content-wrapper], [role="menu"], [data-slot="dropdown-menu-content"]'
29481
- )) {
29482
- return;
29483
- }
29484
30002
  {
29485
30003
  const formEl = getFormElement(target);
29486
30004
  const onSuccessText = target.closest(`[${SUCCESS_TEXT_ATTR}]`);
@@ -29634,9 +30152,13 @@ function OhhwellsBridge() {
29634
30152
  if (isIconEditable(editable) && !getSocialItem(editable)) {
29635
30153
  e.preventDefault();
29636
30154
  e.stopPropagation();
29637
- selectIconElementRef.current(editable);
29638
30155
  const aiIcon = editable.hasAttribute("data-ai-icon");
29639
30156
  const featureIcon = aiIcon && /\.features\.\d+\.icon$/.test(editable.dataset.ohwKey ?? "");
30157
+ if (aiIcon) {
30158
+ aiSectionApiRef.current?.selectFromElement(editable);
30159
+ } else {
30160
+ selectIconElementRef.current(editable);
30161
+ }
29640
30162
  postToParentRef.current({
29641
30163
  type: "ow:icon-pick",
29642
30164
  key: editable.dataset.ohwKey ?? "",
@@ -29864,6 +30386,9 @@ function OhhwellsBridge() {
29864
30386
  setHoveredItemRect(null);
29865
30387
  hoveredNavContainerRef.current = null;
29866
30388
  setHoveredNavContainerRect(null);
30389
+ siblingHintElRef.current = null;
30390
+ setSiblingHintRect(null);
30391
+ setSiblingHintRects([]);
29867
30392
  return;
29868
30393
  }
29869
30394
  {
@@ -29984,7 +30509,6 @@ function OhhwellsBridge() {
29984
30509
  hoveredNavContainerRef.current = null;
29985
30510
  setHoveredNavContainerRect(null);
29986
30511
  hoveredItemElRef.current = editable;
29987
- setHoveredItemRect(isSelectedForHoverRef.current(editable) ? null : editable.getBoundingClientRect());
29988
30512
  }
29989
30513
  }
29990
30514
  }
@@ -30694,7 +31218,11 @@ function OhhwellsBridge() {
30694
31218
  };
30695
31219
  const handleMouseMove = (e) => {
30696
31220
  const { clientX, clientY } = e;
30697
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
31221
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
31222
+ dismissImageHover();
31223
+ clearImageHover();
31224
+ return;
31225
+ }
30698
31226
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) {
30699
31227
  document.querySelectorAll("[data-ohw-hovered]").forEach((el) => el.removeAttribute("data-ohw-hovered"));
30700
31228
  formHoverElRef.current = null;
@@ -30723,7 +31251,12 @@ function OhhwellsBridge() {
30723
31251
  setHoveredItemRect(null);
30724
31252
  hoveredNavContainerRef.current = null;
30725
31253
  setHoveredNavContainerRect(null);
31254
+ siblingHintElRef.current = null;
31255
+ setSiblingHintRect(null);
31256
+ setSiblingHintRects([]);
30726
31257
  dismissImageHover();
31258
+ clearImageHover();
31259
+ setSectionGap(null);
30727
31260
  return;
30728
31261
  }
30729
31262
  if (probeSocialsRowAt(clientX, clientY)) return;
@@ -30735,7 +31268,11 @@ function OhhwellsBridge() {
30735
31268
  if (e.data?.type !== "ow:pointer-sync") return;
30736
31269
  const { clientX, clientY } = e.data;
30737
31270
  if (typeof clientX !== "number" || typeof clientY !== "number") return;
30738
- if (pointOwnedByFloatingPanel(clientX, clientY)) return;
31271
+ if (pointOwnedByFloatingPanel(clientX, clientY)) {
31272
+ dismissImageHover();
31273
+ clearImageHover();
31274
+ return;
31275
+ }
30739
31276
  if (isNavDrawerOpen() && isPointOutsideOpenDrawer(clientX, clientY)) return;
30740
31277
  if (probeSocialsRowAt(clientX, clientY)) return;
30741
31278
  probeSectionGapAt(clientX, clientY);
@@ -31115,6 +31652,7 @@ function OhhwellsBridge() {
31115
31652
  applyAiFooterFromContent(content);
31116
31653
  if (typeof content[STYLE_STORE_KEY] === "string") {
31117
31654
  stylesRef.current = content[STYLE_STORE_KEY];
31655
+ document.querySelectorAll('[data-ohw-editable="form"]').forEach((f) => markFormFields(f));
31118
31656
  applyStylesToDom(parseStyleStore(content[STYLE_STORE_KEY]));
31119
31657
  }
31120
31658
  applyBrandChrome(content);
@@ -31129,15 +31667,16 @@ function OhhwellsBridge() {
31129
31667
  }
31130
31668
  if (key === AI_SECTIONS_KEY) continue;
31131
31669
  if (key === AI_FOOTER_KEY) continue;
31670
+ if (key === LOGO_PLACEHOLDER_KEY) continue;
31671
+ if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31132
31672
  if (key === BRAND_KIT_KEY) continue;
31133
31673
  if (key === STYLE_STORE_KEY) continue;
31134
31674
  if (BRAND_CHROME_KEYS.has(key)) continue;
31135
- if (key === LOGO_PLACEHOLDER_KEY) continue;
31136
31675
  if (key === CUSTOM_CODE_AFTER_HEAD_KEY || key === CUSTOM_CODE_BEFORE_HEAD_KEY) continue;
31137
- if (LOGO_IMAGE_KEYS.includes(key) && !String(val ?? "").trim()) continue;
31138
31676
  if (typeof content[AI_FOOTER_KEY] === "string" && content[AI_FOOTER_KEY] && isAiFooterOwnedContentKey(key)) {
31139
31677
  continue;
31140
31678
  }
31679
+ if (key.endsWith(SECTION_EMBED_SUFFIX)) continue;
31141
31680
  if (applyVideoSettingNode(key, val)) continue;
31142
31681
  if (applyCarouselNode(key, val)) continue;
31143
31682
  document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
@@ -31163,6 +31702,7 @@ function OhhwellsBridge() {
31163
31702
  });
31164
31703
  applyLinkByKey(key, val);
31165
31704
  }
31705
+ applySectionEmbeds(content);
31166
31706
  applyLogoFromContent(content);
31167
31707
  applyLogoSizes(content);
31168
31708
  document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
@@ -31177,6 +31717,7 @@ function OhhwellsBridge() {
31177
31717
  reconcileNavbarItemsFromContent(editContentRef.current);
31178
31718
  reconcileFooterOrderFromContent(editContentRef.current);
31179
31719
  syncButtonsFromContent(document, editContentRef.current);
31720
+ applyHiddenEditablesToDom(editContentRef.current);
31180
31721
  if (selectedElRef.current && !selectedElRef.current.isConnected) deselectRef.current();
31181
31722
  syncNavigationDragCursorAttrs();
31182
31723
  if (typeof content[STYLE_STORE_KEY] === "string") {
@@ -31802,6 +32343,12 @@ function OhhwellsBridge() {
31802
32343
  closeLinkPopoverRef.current();
31803
32344
  return;
31804
32345
  }
32346
+ if (floatingPanelOpenRef.current) {
32347
+ setFloatingPanelRef.current(null);
32348
+ deselectRef.current();
32349
+ deactivateRef.current();
32350
+ return;
32351
+ }
31805
32352
  deselectRef.current();
31806
32353
  deactivateRef.current();
31807
32354
  clearMediaSelectionRef.current();
@@ -31980,7 +32527,7 @@ function OhhwellsBridge() {
31980
32527
  return;
31981
32528
  }
31982
32529
  }
31983
- if ((e.key === "Delete" || e.key === "Backspace") && selectedElRef.current && !activeElRef.current && !linkPopoverOpenRef.current) {
32530
+ if ((e.key === "Delete" || e.key === "Backspace") && !activeElRef.current && !linkPopoverOpenRef.current && (selectedElRef.current || selectedMediaElRef.current || selectedIconElRef.current)) {
31984
32531
  if (handleDeleteSelectedRef.current()) {
31985
32532
  e.preventDefault();
31986
32533
  return;
@@ -32632,10 +33179,10 @@ function OhhwellsBridge() {
32632
33179
  window.removeEventListener("message", handleDuplicateSection);
32633
33180
  window.removeEventListener("message", handleDeactivate);
32634
33181
  window.removeEventListener("message", handleSelectNav);
32635
- document.documentElement.removeAttribute("data-ohw-panel-dragging");
32636
33182
  window.removeEventListener("message", handleToastAction);
32637
33183
  window.removeEventListener("message", handleFormCount);
32638
33184
  window.removeEventListener("message", handleUiEscape);
33185
+ document.documentElement.removeAttribute("data-ohw-panel-dragging");
32639
33186
  autoSaveTimers.current.forEach(clearTimeout);
32640
33187
  autoSaveTimers.current.clear();
32641
33188
  if (imageUnhoverTimerRef.current) clearTimeout(imageUnhoverTimerRef.current);
@@ -32929,7 +33476,7 @@ function OhhwellsBridge() {
32929
33476
  postToParent2({
32930
33477
  type: "ow:ready",
32931
33478
  version: "1",
32932
- bridgeVersion: "0.1.170",
33479
+ bridgeVersion: "0.1.172-next.456",
32933
33480
  path: pathname,
32934
33481
  nodes: collectEditableNodes(editContentRef.current),
32935
33482
  sections
@@ -33286,7 +33833,154 @@ function OhhwellsBridge() {
33286
33833
  enforceLinkHrefs();
33287
33834
  return true;
33288
33835
  }, []);
33836
+ const deleteAiBlock = (0, import_react25.useCallback)(
33837
+ (editKey, opts) => {
33838
+ if (!opts?.fromToolbar && activeElRef.current) return false;
33839
+ if (deletingAiBlockRef.current) return false;
33840
+ const plan = planAiBlockRemoval(aiSectionsRef.current, editKey);
33841
+ if (!plan) return false;
33842
+ if (!plan.ok) {
33843
+ postToParent2({
33844
+ type: "ow:toast",
33845
+ title: plan.reasons[0] ?? "That block cannot be deleted",
33846
+ toastType: "error"
33847
+ });
33848
+ return true;
33849
+ }
33850
+ const { tree: nextTree, entry } = plan;
33851
+ const previous = aiSectionsRef.current;
33852
+ deletingAiBlockRef.current = true;
33853
+ void requestValidateTree5(postToParent2, nextTree).then(({ ok, reasons }) => {
33854
+ deletingAiBlockRef.current = false;
33855
+ if (!ok) {
33856
+ postToParent2({
33857
+ type: "ow:toast",
33858
+ title: reasons[0] ?? "That change is not allowed.",
33859
+ toastType: "error"
33860
+ });
33861
+ return;
33862
+ }
33863
+ clearMediaSelectionRef.current();
33864
+ clearIconSelectionRef.current();
33865
+ applyTreeLocalRef.current?.({
33866
+ id: entry.id,
33867
+ mode: "replace",
33868
+ targetSectionId: entry.id,
33869
+ tree: nextTree,
33870
+ label: entry.label,
33871
+ media: entry.media,
33872
+ ...entry.brand ? { brand: entry.brand } : {},
33873
+ skipScrollIntoView: true
33874
+ });
33875
+ const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `delete-block-${Date.now()}`;
33876
+ pendingDeleteUndoRef.current = {
33877
+ actionId,
33878
+ restore: () => {
33879
+ clearInteractionChromeRef.current();
33880
+ aiSectionsRef.current = previous;
33881
+ applyAiSectionsToDom(parseAiSectionsState(previous));
33882
+ const restoreHeight = document.body.scrollHeight;
33883
+ if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
33884
+ postToParent2({ type: "ow:change", nodes: [{ key: AI_SECTIONS_KEY, text: previous }] });
33885
+ postToParent2({
33886
+ type: "ow:ai-sections-changed",
33887
+ sections: collectSections(),
33888
+ nodes: collectEditableNodes(editContentRef.current)
33889
+ });
33890
+ }
33891
+ };
33892
+ postToParent2({
33893
+ type: "ow:toast",
33894
+ title: "Block deleted",
33895
+ toastType: "success",
33896
+ actionLabel: "Undo",
33897
+ actionId,
33898
+ duration: 6e3
33899
+ });
33900
+ });
33901
+ return true;
33902
+ },
33903
+ [postToParent2]
33904
+ );
33905
+ const softHideTemplateEditable = (0, import_react25.useCallback)(
33906
+ (el, opts) => {
33907
+ if (!opts?.fromToolbar && activeElRef.current) return false;
33908
+ if (!canSoftHideEditable(el, {
33909
+ isNavFooterItem: Boolean(
33910
+ getNavigationItemAnchor(el) && isNavFooterScopedNavigationItem(el) && !isCtaButton(el)
33911
+ )
33912
+ })) {
33913
+ return false;
33914
+ }
33915
+ const previousContent = editContentRef.current;
33916
+ const result = softHideEditableInDom(el, previousContent);
33917
+ if (!result) return false;
33918
+ editContentRef.current = result.content;
33919
+ postToParent2({ type: "ow:change", nodes: result.nodes });
33920
+ clearMediaSelectionRef.current();
33921
+ clearIconSelectionRef.current();
33922
+ clearInteractionChromeRef.current();
33923
+ clearFormPickRef.current?.();
33924
+ deselectRef.current();
33925
+ const actionId = typeof crypto !== "undefined" && "randomUUID" in crypto ? crypto.randomUUID() : `hide-editable-${Date.now()}`;
33926
+ const hiddenKey = result.key;
33927
+ pendingDeleteUndoRef.current = {
33928
+ actionId,
33929
+ restore: () => {
33930
+ clearInteractionChromeRef.current();
33931
+ const restored = softUnhideEditableInDom(hiddenKey, editContentRef.current);
33932
+ editContentRef.current = restored.content;
33933
+ postToParent2({ type: "ow:change", nodes: restored.nodes });
33934
+ const restoreHeight = document.body.scrollHeight;
33935
+ if (restoreHeight > 50) postToParent2({ type: "ow:height", height: restoreHeight });
33936
+ }
33937
+ };
33938
+ postToParent2({
33939
+ type: "ow:toast",
33940
+ title: "Block deleted",
33941
+ toastType: "success",
33942
+ actionLabel: "Undo",
33943
+ actionId,
33944
+ duration: 6e3
33945
+ });
33946
+ return true;
33947
+ },
33948
+ [postToParent2]
33949
+ );
33950
+ const deleteFromToolbar = (0, import_react25.useCallback)(
33951
+ (editKey, el) => {
33952
+ if (!editKey && !el) return false;
33953
+ if (editKey && canRemoveAiBlock(aiSectionsRef.current, editKey)) {
33954
+ return deleteAiBlock(editKey, { fromToolbar: true });
33955
+ }
33956
+ const target = el ?? (editKey ? document.querySelector(`[data-ohw-key="${editKey.replace(/"/g, '\\"')}"]`) : null);
33957
+ if (target) return softHideTemplateEditable(target, { fromToolbar: true });
33958
+ return false;
33959
+ },
33960
+ [deleteAiBlock, softHideTemplateEditable]
33961
+ );
33962
+ const resolveSelectedAiBlockKey = (0, import_react25.useCallback)(() => {
33963
+ const candidates = [
33964
+ activeElRef.current?.dataset.ohwKey,
33965
+ selectedMediaElRef.current?.dataset.ohwKey,
33966
+ selectedMedia?.key,
33967
+ selectedIconElRef.current?.dataset.ohwKey,
33968
+ selectedElRef.current?.getAttribute("data-ohw-href-key"),
33969
+ selectedElRef.current?.dataset.ohwKey,
33970
+ selectedElRef.current?.querySelector("[data-ohw-key]")?.dataset.ohwKey
33971
+ ];
33972
+ for (const key of candidates) {
33973
+ if (key && canRemoveAiBlock(aiSectionsRef.current, key)) return key;
33974
+ }
33975
+ return null;
33976
+ }, [selectedMedia]);
33289
33977
  const handleDeleteSelected = (0, import_react25.useCallback)(() => {
33978
+ if (!activeElRef.current) {
33979
+ const aiKey = resolveSelectedAiBlockKey();
33980
+ if (aiKey && deleteAiBlock(aiKey)) return true;
33981
+ const mediaEl = selectedMediaElRef.current;
33982
+ if (mediaEl && softHideTemplateEditable(mediaEl, { fromToolbar: true })) return true;
33983
+ }
33290
33984
  const selected = selectedElRef.current;
33291
33985
  if (!selected) return false;
33292
33986
  if (isCtaButton(selected)) {
@@ -33345,7 +34039,7 @@ function OhhwellsBridge() {
33345
34039
  }
33346
34040
  }
33347
34041
  return deleted;
33348
- }, [postToParent2]);
34042
+ }, [postToParent2, deleteAiBlock, softHideTemplateEditable, resolveSelectedAiBlockKey]);
33349
34043
  handleDeleteSelectedRef.current = handleDeleteSelected;
33350
34044
  runPendingDeleteUndoRef.current = runPendingDeleteUndo;
33351
34045
  const handleLinkPopoverSubmit = (0, import_react25.useCallback)(
@@ -33563,6 +34257,13 @@ function OhhwellsBridge() {
33563
34257
  isUploading: false,
33564
34258
  onReplace: handleMediaReplace,
33565
34259
  onSelect: handleMediaSelect,
34260
+ onDelete: canRemoveAiBlock(aiSectionsRef.current, selectedMedia.key) || selectedMediaElRef.current != null && canSoftHideEditable(selectedMediaElRef.current, {
34261
+ isNavFooterItem: Boolean(
34262
+ getNavigationItemAnchor(selectedMediaElRef.current) && isNavFooterScopedNavigationItem(selectedMediaElRef.current) && !isCtaButton(selectedMediaElRef.current)
34263
+ )
34264
+ }) ? (key) => {
34265
+ deleteFromToolbar(key, selectedMediaElRef.current);
34266
+ } : void 0,
33566
34267
  onVideoSettingsChange: handleVideoSettingsChange
33567
34268
  }
33568
34269
  ),
@@ -33727,7 +34428,24 @@ function OhhwellsBridge() {
33727
34428
  children: state
33728
34429
  },
33729
34430
  state
33730
- )) })
34431
+ )) }),
34432
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "mx-0.5 h-5 w-px bg-border" }),
34433
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
34434
+ "button",
34435
+ {
34436
+ type: "button",
34437
+ "aria-label": "Delete form",
34438
+ title: "Delete",
34439
+ className: "flex h-7 w-7 items-center justify-center rounded-md text-foreground transition-colors hover:bg-muted/80",
34440
+ onClick: () => {
34441
+ setFieldTypePickerOpen(false);
34442
+ const form = formPickElRef.current;
34443
+ if (!form) return;
34444
+ softHideTemplateEditable(form, { fromToolbar: true });
34445
+ },
34446
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react22.Trash2, { size: 15, "aria-hidden": true })
34447
+ }
34448
+ )
33731
34449
  ]
33732
34450
  }
33733
34451
  )
@@ -33896,7 +34614,15 @@ function OhhwellsBridge() {
33896
34614
  onCommand: handleCommand,
33897
34615
  activeCommands,
33898
34616
  showEditLink,
33899
- onEditLink: openLinkPopoverForActive
34617
+ onEditLink: openLinkPopoverForActive,
34618
+ showDelete: toolbarShowAiBlockDelete,
34619
+ deleteDisabled: deletingAiBlockRef.current,
34620
+ onDelete: () => {
34621
+ const el = activeElRef.current;
34622
+ const key = el?.dataset.ohwKey;
34623
+ if (!key) return;
34624
+ deleteFromToolbar(key, el);
34625
+ }
33900
34626
  }
33901
34627
  )
33902
34628
  ] }),
@@ -34126,6 +34852,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34126
34852
  FOOTER_COLUMN_BLOCKS,
34127
34853
  FOOTER_COLUMN_SPANS,
34128
34854
  FOOTER_SOCIAL_PLATFORMS,
34855
+ HIDDEN_EDITABLES_KEY,
34129
34856
  ItemActionToolbar,
34130
34857
  ItemInteractionLayer,
34131
34858
  LinkEditorPanel,
@@ -34148,9 +34875,14 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34148
34875
  addFooterLinkColumn,
34149
34876
  appendFooterSocial,
34150
34877
  applyBrandChrome,
34878
+ applyHiddenEditablesToDom,
34151
34879
  applyStickySearchParams,
34880
+ blockPathFromEditKey,
34152
34881
  buildDefaultFooterTree,
34153
34882
  buildTarget,
34883
+ canRemoveAiBlock,
34884
+ canRemoveAiTextBlock,
34885
+ canSoftHideEditable,
34154
34886
  dropIndicatorVariants,
34155
34887
  ensureFooterTree,
34156
34888
  filterAvailablePages,
@@ -34161,6 +34893,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34161
34893
  insertFooterHours,
34162
34894
  isDeadPageHref,
34163
34895
  isEditSessionActive,
34896
+ isEditableKeyHidden,
34164
34897
  isPlainLeftClick,
34165
34898
  isRenderableFooterTree,
34166
34899
  isRenderableTree,
@@ -34171,15 +34904,22 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34171
34904
  parseAiFooterState,
34172
34905
  parseAiSectionsState,
34173
34906
  parseTarget,
34907
+ planAiBlockRemoval,
34908
+ planAiTextBlockRemoval,
34174
34909
  planBuildPageSync,
34910
+ readHiddenEditables,
34175
34911
  recordOverriddenPaths,
34176
34912
  releaseTemplateLogoIfReplaced,
34913
+ removeBlockAtPath,
34177
34914
  removeFooterBlock,
34178
34915
  resetOverriddenPathsCache,
34179
34916
  resolveFooterCopyright,
34917
+ resolveSoftHideTarget,
34180
34918
  resolveStickyNavigation,
34181
34919
  serializeAiFooterState,
34182
34920
  shouldFetchContentForPath,
34921
+ softHideEditableInDom,
34922
+ softUnhideEditableInDom,
34183
34923
  stepViableSlide,
34184
34924
  stripPlaceholderText,
34185
34925
  stripPlaceholders,
@@ -34187,6 +34927,8 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
34187
34927
  toggleVariants,
34188
34928
  useOhwCarousel,
34189
34929
  validateUrlInput,
34190
- viableSlides
34930
+ viableSlides,
34931
+ withHiddenEditable,
34932
+ withoutHiddenEditable
34191
34933
  });
34192
34934
  //# sourceMappingURL=index.cjs.map