@pagehub/sdk 0.1.5 → 0.1.6

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.
Files changed (141) hide show
  1. package/README.md +1 -1
  2. package/dist/chrome/viewport/Viewport/hooks/usePageLoadIndicator.d.ts +2 -2
  3. package/dist/chrome/viewport/design-system/hooks/useDesignSystem.d.ts +2 -2
  4. package/dist/chrome/viewport/design-system/hooks/usePaletteState.d.ts +2 -2
  5. package/dist/chunks/ActionEditorPanel-9v50QUwu.js +89 -0
  6. package/dist/chunks/ActionInput-CTt7sOs6.js +929 -0
  7. package/dist/chunks/ActionsAddPicker-BeTPUUor.js +51 -0
  8. package/dist/chunks/ActionsInput-D0h-zLYj.js +174 -0
  9. package/dist/chunks/AnchoredPopover-CckPTxXu.js +2676 -0
  10. package/dist/chunks/AnimationEditorPanel-CXNmsTqV.js +26 -0
  11. package/dist/chunks/AnimationsInput-Djyz0uXG.js +292 -0
  12. package/dist/chunks/AnimationsInputPopover-B2-oNebx.js +71 -0
  13. package/dist/chunks/AnimationsPanel-DungA9qb.js +25 -0
  14. package/dist/chunks/Audio.render-CsR69fZ9.js +22 -0
  15. package/dist/chunks/AudioMainTab-BljM2NMQ.js +70 -0
  16. package/dist/chunks/BackdropEditorPanel-CA2k-6SR.js +26 -0
  17. package/dist/chunks/BackgroundImageInputPopover-vB_217Ig.js +94 -0
  18. package/dist/chunks/BackgroundImagePanel-BvMhF9eU.js +100 -0
  19. package/dist/chunks/BackgroundMainTab-CI4c5DEF.js +10 -0
  20. package/dist/chunks/BundleRowPanel-BcYfyfGQ.js +33 -0
  21. package/dist/chunks/ButtonMainTab-Civy_DoA.js +43 -0
  22. package/dist/chunks/CSSEditorInput-C1ITwAh3.js +73 -0
  23. package/dist/chunks/ClassNameInput-Ce0fGQES.js +720 -0
  24. package/dist/chunks/CodeEditor-axBXmPH8.js +33370 -0
  25. package/dist/chunks/ColorInput-BSfMNt86.js +187 -0
  26. package/dist/chunks/ColorPanel-DOLrT-gS.js +562 -0
  27. package/dist/chunks/ComponentImportExportPanel-DVcnGhGx.js +161 -0
  28. package/dist/chunks/ComponentImportExportPopover-BY1_oxU8.js +26 -0
  29. package/dist/chunks/ConditionEditorPanel-DLbqYaSF.js +43 -0
  30. package/dist/chunks/ConditionsAddPicker-SsHJlc1E.js +54 -0
  31. package/dist/chunks/ConditionsInput-B_5Nge8o.js +474 -0
  32. package/dist/chunks/ContainerMainTab-kkktm1Ns.js +1107 -0
  33. package/dist/chunks/ContainerOverflowSectionPanel-ibKXf-1N.js +120 -0
  34. package/dist/chunks/ContainerOverflowSectionPopover-CRQ9EPsn.js +24 -0
  35. package/dist/chunks/ContainerPaddingOverlay-Cd3xOv-S.js +340 -0
  36. package/dist/chunks/ContainerScrollEffectSection-Dbztqdnr.js +123 -0
  37. package/dist/chunks/ContainerStateSection-DY_gjBJL.js +478 -0
  38. package/dist/chunks/ConversionFields-Bpfl-SGP.js +135 -0
  39. package/dist/chunks/CraftListEditor-_TIy1ogW.js +73 -0
  40. package/dist/chunks/CreateTokenDialog-DNWtWqJd.js +147 -0
  41. package/dist/chunks/Data.render-DTmaqSyz.js +10 -0
  42. package/dist/chunks/DataAttributesPanel-mYhisO_O.js +125 -0
  43. package/dist/chunks/DataMainTab-Batm515E.js +23 -0
  44. package/dist/chunks/DataSourceSectionSlot-BKoO6Vxn.js +10 -0
  45. package/dist/chunks/EditorEmptyLeafHintView-D3E3UN_0.js +78 -0
  46. package/dist/chunks/EffectRowInputPopover-CYhfjFwJ.js +323 -0
  47. package/dist/chunks/EffectsClassInput-Yujuchwy.js +315 -0
  48. package/dist/chunks/Embed.render-BgKpUV8n.js +17 -0
  49. package/dist/chunks/EmbedMainTab-d_-Bnkug.js +225 -0
  50. package/dist/chunks/FilterEditorPanel-CRa0IpLr.js +26 -0
  51. package/dist/chunks/FlexDirectionInput-C5gYjk5W.js +78 -0
  52. package/dist/chunks/FloatingPanel-DJP5Vhua.js +553 -0
  53. package/dist/chunks/FontFamilyInput-CVNnVylt.js +111 -0
  54. package/dist/chunks/Form.render-6GjcmL2u.js +54 -0
  55. package/dist/chunks/FormElement.render-DWrG-2ID.js +36 -0
  56. package/dist/chunks/FormElementMainTab-DSbF3F6e.js +470 -0
  57. package/dist/chunks/FormMainTab-SHny1HxF.js +240 -0
  58. package/dist/chunks/GradientInputPopover-1K6O9jBq.js +103 -0
  59. package/dist/chunks/GradientPanel-DSRQKkaB.js +194 -0
  60. package/dist/chunks/HTMLCodeInput-CCe4Bj5z.js +69 -0
  61. package/dist/chunks/HandlerEditorPanel-DiOXobsl.js +93 -0
  62. package/dist/chunks/HandlersAddPicker-DWTgjKgo.js +101 -0
  63. package/dist/chunks/HandlersInput-p49STTn8.js +132 -0
  64. package/dist/chunks/IconDialogInput-C-81_L2n.js +105 -0
  65. package/dist/chunks/IconInput-D2Gy7Hvf.js +182 -0
  66. package/dist/chunks/IconMainTab-CNrVjDWP.js +26 -0
  67. package/dist/chunks/IconPickerPanel-BjNOlCh6.js +670 -0
  68. package/dist/chunks/ImageMainTab-C4O7RjX0.js +66 -0
  69. package/dist/chunks/ImageSettingsPanel-dvOmGg3C.js +485 -0
  70. package/dist/chunks/LayoutPresetPanel-CNAVAcvw.js +81 -0
  71. package/dist/chunks/LayoutPresetSlot-BqMTdE33.js +16 -0
  72. package/dist/chunks/LinkMainTab-BfFZx0AU.js +13 -0
  73. package/dist/chunks/ListEditor-mD-CmRNE.js +178 -0
  74. package/dist/chunks/Map.render-DFkmncHz.js +82 -0
  75. package/dist/chunks/MapLeaflet-DOfmZ3Pk.js +6588 -0
  76. package/dist/chunks/MapMainTab-CxI7IS1_.js +165 -0
  77. package/dist/chunks/MapPoint.render-0OAfCZTp.js +16 -0
  78. package/dist/chunks/MapPointMainTab-CmLcaSR5.js +60 -0
  79. package/dist/chunks/MediaInput-DHs3D8TJ.js +672 -0
  80. package/dist/chunks/MediaManagerModal-Dc5PK3dn.js +240 -0
  81. package/dist/chunks/MiniPreviewTile-B4zxTj9Y.js +32 -0
  82. package/dist/chunks/ModifierChipList-CwsWklih.js +33 -0
  83. package/dist/chunks/ModifiersAddPicker-D-vSYw7O.js +74 -0
  84. package/dist/chunks/ModifiersPickerPanel-CTefidBx.js +243 -0
  85. package/dist/chunks/NodeAiContextInputPopover-D5bn5o_T.js +66 -0
  86. package/dist/chunks/NodeAiContextPanel-Bx4rcjiM.js +81 -0
  87. package/dist/chunks/NumberSettingsPanel-DASi_l6V.js +56 -0
  88. package/dist/chunks/PageSettingsModal-D6o450IR.js +2678 -0
  89. package/dist/chunks/PatternInputPopover-qMWBv_nl.js +100 -0
  90. package/dist/chunks/PatternPanel-D2fgWDd-.js +352 -0
  91. package/dist/chunks/PeekTargetButton-ClrJX7zh.js +26 -0
  92. package/dist/chunks/PermissionsSection-DwobrV40.js +82 -0
  93. package/dist/chunks/PresetAddChildList-D6a0xdt8.js +35 -0
  94. package/dist/chunks/PropertiesInput-9O39ngbb.js +125 -0
  95. package/dist/chunks/PropertiesPanel-DO0RlalO.js +76 -0
  96. package/dist/chunks/SaveModifierPanel-B6mjKyrT.js +130 -0
  97. package/dist/chunks/ScrollEffectEditorPanel-CllGUhui.js +26 -0
  98. package/dist/chunks/SearchInput-DRUztbM0.js +76 -0
  99. package/dist/chunks/SearchableMenuPopover-DZKVXiEl.js +1251 -0
  100. package/dist/chunks/SlotRenderer-CaLf_2_C.js +38 -0
  101. package/dist/chunks/StateBindingEditorPanel-DKdcG5py.js +101 -0
  102. package/dist/chunks/StateBindingsAddPicker-DxMNAWAD.js +91 -0
  103. package/dist/chunks/StateBindingsInput-iWiqvAVB.js +103 -0
  104. package/dist/chunks/TailwindInput-660FZtyK.js +24 -0
  105. package/dist/chunks/TextEditor-B2O7DlN8.js +22032 -0
  106. package/dist/chunks/TextMainTab-B5udsXsk.js +260 -0
  107. package/dist/chunks/TextStyleEditorPanel-GRNPGzUL.js +381 -0
  108. package/dist/chunks/TextStylePickerPanel-l108SmGQ.js +140 -0
  109. package/dist/chunks/TextareaSettingsPanel-C1rQuF1O.js +50 -0
  110. package/dist/chunks/TokenPicker-Q0LToF_p.js +291 -0
  111. package/dist/chunks/ToolbarDashedButton-DbUxGmDg.js +23 -0
  112. package/dist/chunks/TransformEditorPanel-BGwyznZ6.js +26 -0
  113. package/dist/chunks/TransitionEditorPanel-BSvk58Ow.js +26 -0
  114. package/dist/chunks/TypographyPresetInput-DqnGSgR2.js +296 -0
  115. package/dist/chunks/ValidationPanel-CmA9SfoF.js +56 -0
  116. package/dist/chunks/Video.render-Dg6xvis4.js +21 -0
  117. package/dist/chunks/VideoMainTab-v5UFhUm-.js +174 -0
  118. package/dist/chunks/YouTube.esm-EbHnLU1Z.js +744 -0
  119. package/dist/chunks/dialogAtoms-CeQ2G05l.js +59 -0
  120. package/dist/chunks/extends-hS2Bh-Yp.js +12 -0
  121. package/dist/chunks/formatStorage-C3o2s3dk.js +22 -0
  122. package/dist/chunks/googleFonts-Dj4AntNi.js +323 -0
  123. package/dist/chunks/helpers-Cll72tMn.js +18 -0
  124. package/dist/chunks/index-B-GJd039.js +2875 -0
  125. package/dist/chunks/index-C66dAl3Q.js +32177 -0
  126. package/dist/chunks/index.esm-mqFx3NOs.js +644 -0
  127. package/dist/chunks/popoverOpenRequestAtom-hBS_siXv.js +22 -0
  128. package/dist/chunks/propertyRegistry-CMhVNOgl.js +38 -0
  129. package/dist/chunks/resolveAnchorsViaCraft-Cixm6ZyJ.js +31 -0
  130. package/dist/chunks/toolboxUtils-DjTMslSn.js +370 -0
  131. package/dist/chunks/uiPrimitives-BtohldWg.js +15 -0
  132. package/dist/chunks/use-event-listener-DO3Sk7g0.js +15 -0
  133. package/dist/chunks/useElementPicker-DoNuXNMQ.js +41 -0
  134. package/dist/chunks/useLayoutPreset-wOMV5YnO.js +528 -0
  135. package/dist/chunks/useMediaManager-CmKDbFfw.js +4629 -0
  136. package/dist/chunks/usePopoverAutoOpen-CxIjt0ez.js +25 -0
  137. package/dist/chunks/usePopoverPosition-83Vti7Aw.js +15 -0
  138. package/dist/render/static/index.js +9 -0
  139. package/package.json +22 -13
  140. package/dist/pagehub-viewer.umd.cjs +0 -574
  141. package/dist/pagehub.umd.cjs +0 -1130
@@ -0,0 +1,672 @@
1
+ import { jsxs as t, jsx as l, Fragment as te } from "react/jsx-runtime";
2
+ import { useEditor as he, useNode as ne } from "@craftjs/core";
3
+ import { useRef as le, useState as b, useMemo as V, Suspense as fe } from "react";
4
+ import { u as be, aK as ge, R as ve, aL as xe, aM as ye, aN as Ne, C as z, at as Ce, Q as we, W as ie, aO as Y, aP as oe, aQ as ke, aR as Pe, _ as Me, aw as Se, a0 as ce, w as de, aS as Ie } from "./index-C66dAl3Q.js";
5
+ import { T as $e } from "./ToolbarDashedButton-DbUxGmDg.js";
6
+ import { TailwindInput as ue } from "./TailwindInput-660FZtyK.js";
7
+ import { S as Le } from "./SearchInput-DRUztbM0.js";
8
+ import { F as re } from "./FloatingPanel-DJP5Vhua.js";
9
+ import { u as Ee, g as Fe, M as Te, a as je } from "./useMediaManager-CmKDbFfw.js";
10
+ import { M as Re } from "./MiniPreviewTile-B4zxTj9Y.js";
11
+ import { M as Oe } from "./MediaManagerModal-Dc5PK3dn.js";
12
+ function Be(s, r, d, u) {
13
+ const m = s.selectionStart ?? r.length, h = s.selectionEnd ?? r.length, f = `${r.slice(0, m)}${d}${r.slice(h)}`;
14
+ u(f), requestAnimationFrame(() => {
15
+ const x = m + d.length;
16
+ s.focus(), s.setSelectionRange(x, x);
17
+ });
18
+ }
19
+ function Ve({
20
+ id: s,
21
+ label: r,
22
+ value: d,
23
+ onChange: u,
24
+ placeholder: m,
25
+ helpText: h,
26
+ snippets: f = [],
27
+ showExpressionHelp: x = !0,
28
+ intent: w = "generic"
29
+ }) {
30
+ const { query: y } = he(), { nodeId: E } = ne((e) => ({ nodeId: e.id })), Z = le(null), [K, N] = b(null), [F, J] = b(), [k, P] = b(""), [T, H] = b(!1), U = le(null), X = le(null), D = be(ge), [p, ae] = b("variable"), [j, I] = b("item.image"), [R, A] = b("/placeholder.jpg"), [M, $] = b("logged-in"), [O, q] = b("item.image"), [o, _] = b("/placeholder.jpg"), C = V(() => ve(y, E), [y, E]), c = V(() => {
31
+ const e = xe(E, y);
32
+ return e ? `${ye(e.provider)} ${Ne(e.provider, e.collection)}` : null;
33
+ }, [E, y]), ee = V(() => {
34
+ const e = k.trim().toLowerCase(), i = (v) => {
35
+ var se;
36
+ return v.id.toLowerCase().includes(e) || v.label.toLowerCase().includes(e) || ((se = v.group) == null ? void 0 : se.toLowerCase().includes(e));
37
+ }, a = /(image|img|photo|thumbnail|thumb|src|url|avatar|logo|banner|cover|hero|media)/i, n = (v) => a.test(v.id) || a.test(v.label), g = e ? C.filter(i) : C;
38
+ return w !== "image-src" || T ? g : g.filter(n);
39
+ }, [C, k, w, T]), Q = V(() => {
40
+ if (w !== "image-src") return ee;
41
+ const e = /(image|img|photo|thumbnail|thumb|src|url|avatar|logo|banner|cover|hero|media)/i, i = (a) => {
42
+ const n = a.id.toLowerCase(), g = a.label.toLowerCase();
43
+ let v = 0;
44
+ return n.startsWith("item.") && (v += 8), (n.includes(".image") || g.includes("image")) && (v += 6), (e.test(n) || e.test(g)) && (v += 4), v;
45
+ };
46
+ return [...ee].sort((a, n) => i(n) - i(a));
47
+ }, [ee, w]), L = V(() => {
48
+ const e = /* @__PURE__ */ new Map();
49
+ for (const i of Q) {
50
+ const a = i.group || "Other";
51
+ e.has(a) || e.set(a, []), e.get(a).push(i);
52
+ }
53
+ return Array.from(e.entries());
54
+ }, [Q]), B = V(() => L.flatMap(([, e]) => e), [L]), G = V(() => {
55
+ const e = j || "item.image", i = R || "/placeholder.jpg", a = O || e, n = o || i;
56
+ return p === "variable" ? `{{${e}}}` : p === "fallback" ? `{{${e} || "${i}"}}` : p === "ifelse" ? `{{${e} ? ${a} : "${n}"}}` : p === "equals" ? `{{${e} == ${M} ? ${a} : "${n}"}}` : `{{${e} != ${M} ? ${a} : "${n}"}}`;
57
+ }, [p, j, R, O, o, M]), W = (e, i, a = !1) => {
58
+ i && e(a ? `{{${i}}}` : i);
59
+ };
60
+ return /* @__PURE__ */ t("div", { className: "space-y-2", children: [
61
+ r ? /* @__PURE__ */ l("label", { htmlFor: s, className: "toolbar-label block font-medium", children: r }) : null,
62
+ /* @__PURE__ */ t("div", { className: "relative", children: [
63
+ /* @__PURE__ */ l(
64
+ z,
65
+ {
66
+ open: K !== null,
67
+ trailing: /* @__PURE__ */ t("div", { className: "flex items-center gap-0.5", children: [
68
+ /* @__PURE__ */ l(
69
+ "button",
70
+ {
71
+ ref: U,
72
+ type: "button",
73
+ className: "btn btn-ghost btn-xs",
74
+ onClick: () => {
75
+ var i;
76
+ const e = (i = U.current) == null ? void 0 : i.getBoundingClientRect();
77
+ if (e) {
78
+ const a = D ? e.right + 8 : e.left - 420;
79
+ J({ x: Math.max(8, a), y: Math.max(8, e.top) });
80
+ }
81
+ N((a) => a === "variables" ? null : "variables");
82
+ },
83
+ "aria-label": "Insert variable",
84
+ children: /* @__PURE__ */ l(Ce, { className: "size-3.5" })
85
+ }
86
+ ),
87
+ /* @__PURE__ */ l(
88
+ "button",
89
+ {
90
+ ref: X,
91
+ type: "button",
92
+ className: "btn btn-ghost btn-xs",
93
+ onClick: () => {
94
+ var i;
95
+ const e = (i = X.current) == null ? void 0 : i.getBoundingClientRect();
96
+ if (e) {
97
+ const a = D ? e.right + 8 : e.left - 420;
98
+ J({ x: Math.max(8, a), y: Math.max(8, e.top) });
99
+ }
100
+ N((a) => a === "expressions" ? null : "expressions");
101
+ },
102
+ "aria-label": "Insert expression",
103
+ children: /* @__PURE__ */ l(we, { className: "size-3.5" })
104
+ }
105
+ )
106
+ ] }),
107
+ children: /* @__PURE__ */ l(
108
+ "input",
109
+ {
110
+ ref: Z,
111
+ id: s,
112
+ type: "text",
113
+ value: d,
114
+ onChange: (e) => u(e.target.value),
115
+ placeholder: m,
116
+ className: "input-plain h-full min-w-0 flex-1 px-2!"
117
+ }
118
+ )
119
+ }
120
+ ),
121
+ K === "variables" ? /* @__PURE__ */ l(
122
+ re,
123
+ {
124
+ isOpen: !0,
125
+ onClose: () => N(null),
126
+ title: "Variables",
127
+ storageKey: "variable-text-input-vars",
128
+ minWidth: 360,
129
+ maxWidth: 520,
130
+ minHeight: 280,
131
+ initialPosition: F,
132
+ zIndex: ie,
133
+ children: /* @__PURE__ */ t("div", { className: "flex flex-col gap-2 p-3", children: [
134
+ /* @__PURE__ */ l(
135
+ Le,
136
+ {
137
+ value: k,
138
+ onChange: P,
139
+ placeholder: "Search variables...",
140
+ size: "slim",
141
+ clearTooltip: "Clear variable search"
142
+ }
143
+ ),
144
+ w === "image-src" ? /* @__PURE__ */ t("div", { className: "flex items-center justify-between px-1", children: [
145
+ /* @__PURE__ */ l("span", { className: "text-neutral-content text-[10px] uppercase", children: "Image-relevant fields" }),
146
+ /* @__PURE__ */ l(
147
+ "button",
148
+ {
149
+ type: "button",
150
+ className: "btn btn-ghost btn-xs",
151
+ onClick: () => H((e) => !e),
152
+ children: T ? "Show image fields" : "Show all variables"
153
+ }
154
+ )
155
+ ] }) : null,
156
+ /* @__PURE__ */ l("div", { className: "max-h-52 space-y-2 overflow-y-auto", children: L.map(([e, i]) => /* @__PURE__ */ t("div", { children: [
157
+ /* @__PURE__ */ l("div", { className: "text-neutral-content px-2 pb-1 text-[10px] font-semibold uppercase", children: e }),
158
+ /* @__PURE__ */ l("div", { className: "space-y-1", children: i.map((a) => /* @__PURE__ */ t(
159
+ "button",
160
+ {
161
+ type: "button",
162
+ className: "hover:bg-base-200 flex w-full items-center justify-between rounded px-2 py-1 text-left",
163
+ onClick: () => {
164
+ const n = Z.current;
165
+ n && (Be(n, d || "", `{{${a.id}}}`, u), N(null));
166
+ },
167
+ children: [
168
+ /* @__PURE__ */ l("span", { className: "truncate text-xs", children: a.label }),
169
+ /* @__PURE__ */ l("span", { className: "text-neutral-content ml-2 shrink-0 text-[10px]", children: `{{${a.id}}}` })
170
+ ]
171
+ },
172
+ `${e}-${a.id}`
173
+ )) })
174
+ ] }, e)) })
175
+ ] })
176
+ }
177
+ ) : null,
178
+ K === "expressions" ? /* @__PURE__ */ l(
179
+ re,
180
+ {
181
+ isOpen: !0,
182
+ onClose: () => N(null),
183
+ title: "Expression Builder",
184
+ storageKey: "variable-text-input-expr",
185
+ minWidth: 360,
186
+ maxWidth: 560,
187
+ minHeight: 320,
188
+ initialPosition: F,
189
+ zIndex: ie,
190
+ children: /* @__PURE__ */ t("div", { className: "flex flex-col gap-2 p-3", children: [
191
+ /* @__PURE__ */ t("div", { children: [
192
+ /* @__PURE__ */ l("label", { className: "toolbar-label mb-1 block", children: "Mode" }),
193
+ /* @__PURE__ */ t(
194
+ Y,
195
+ {
196
+ value: p,
197
+ onChange: (e) => ae(e),
198
+ placeholder: "Select mode",
199
+ chevron: !0,
200
+ children: [
201
+ /* @__PURE__ */ l("option", { value: "variable", children: "Variable" }),
202
+ /* @__PURE__ */ l("option", { value: "fallback", children: "Variable + Fallback" }),
203
+ /* @__PURE__ */ l("option", { value: "ifelse", children: "If / else" }),
204
+ /* @__PURE__ */ l("option", { value: "equals", children: "Equals check" }),
205
+ /* @__PURE__ */ l("option", { value: "not-equals", children: "Not equals check" })
206
+ ]
207
+ }
208
+ )
209
+ ] }),
210
+ /* @__PURE__ */ t("div", { children: [
211
+ /* @__PURE__ */ l("label", { className: "toolbar-label mb-1 block", children: "Variable" }),
212
+ /* @__PURE__ */ l(
213
+ Y,
214
+ {
215
+ value: j,
216
+ onChange: (e) => I(e),
217
+ placeholder: "Select variable",
218
+ chevron: !0,
219
+ children: B.map((e) => /* @__PURE__ */ t("option", { value: e.id, children: [
220
+ e.group ? `${e.group}: ` : "",
221
+ e.label
222
+ ] }, e.id))
223
+ }
224
+ )
225
+ ] }),
226
+ p === "fallback" ? /* @__PURE__ */ t("div", { children: [
227
+ /* @__PURE__ */ l("label", { className: "toolbar-label mb-1 block", children: "Fallback URL/value" }),
228
+ /* @__PURE__ */ l(z, { children: /* @__PURE__ */ l(
229
+ "input",
230
+ {
231
+ value: R,
232
+ onChange: (e) => A(e.target.value),
233
+ className: "input-plain h-full min-w-0 flex-1 px-2!"
234
+ }
235
+ ) })
236
+ ] }) : null,
237
+ p === "ifelse" || p === "equals" || p === "not-equals" ? /* @__PURE__ */ t(te, { children: [
238
+ p === "equals" || p === "not-equals" ? /* @__PURE__ */ t("div", { children: [
239
+ /* @__PURE__ */ l("label", { className: "toolbar-label mb-1 block", children: "Compare to" }),
240
+ /* @__PURE__ */ t("div", { className: "flex gap-1", children: [
241
+ /* @__PURE__ */ l(z, { children: /* @__PURE__ */ l(
242
+ "input",
243
+ {
244
+ value: M,
245
+ onChange: (e) => $(e.target.value),
246
+ className: "input-plain h-full min-w-0 flex-1 px-2!",
247
+ placeholder: "logged-in"
248
+ }
249
+ ) }),
250
+ /* @__PURE__ */ l("div", { className: "w-34", children: /* @__PURE__ */ t(
251
+ Y,
252
+ {
253
+ value: "",
254
+ onChange: (e) => W($, e, !0),
255
+ placeholder: "Pick var...",
256
+ chevron: !0,
257
+ children: [
258
+ /* @__PURE__ */ l("option", { value: "", children: "Pick var…" }),
259
+ B.map((e) => /* @__PURE__ */ l("option", { value: e.id, children: e.label }, `cmp-${e.id}`))
260
+ ]
261
+ }
262
+ ) })
263
+ ] })
264
+ ] }) : null,
265
+ /* @__PURE__ */ t("div", { children: [
266
+ /* @__PURE__ */ l("label", { className: "toolbar-label mb-1 block", children: "True value" }),
267
+ /* @__PURE__ */ t("div", { className: "flex gap-1", children: [
268
+ /* @__PURE__ */ l(z, { children: /* @__PURE__ */ l(
269
+ "input",
270
+ {
271
+ value: O,
272
+ onChange: (e) => q(e.target.value),
273
+ className: "input-plain h-full min-w-0 flex-1 px-2!"
274
+ }
275
+ ) }),
276
+ /* @__PURE__ */ l("div", { className: "w-34", children: /* @__PURE__ */ t(
277
+ Y,
278
+ {
279
+ value: "",
280
+ onChange: (e) => W(q, e),
281
+ placeholder: "Pick var...",
282
+ chevron: !0,
283
+ children: [
284
+ /* @__PURE__ */ l("option", { value: "", children: "Pick var…" }),
285
+ B.map((e) => /* @__PURE__ */ l("option", { value: e.id, children: e.label }, `tv-${e.id}`))
286
+ ]
287
+ }
288
+ ) })
289
+ ] })
290
+ ] }),
291
+ /* @__PURE__ */ t("div", { children: [
292
+ /* @__PURE__ */ l("label", { className: "toolbar-label mb-1 block", children: "False value" }),
293
+ /* @__PURE__ */ t("div", { className: "flex gap-1", children: [
294
+ /* @__PURE__ */ l(z, { children: /* @__PURE__ */ l(
295
+ "input",
296
+ {
297
+ value: o,
298
+ onChange: (e) => _(e.target.value),
299
+ className: "input-plain h-full min-w-0 flex-1 px-2!"
300
+ }
301
+ ) }),
302
+ /* @__PURE__ */ l("div", { className: "w-34", children: /* @__PURE__ */ t(
303
+ Y,
304
+ {
305
+ value: "",
306
+ onChange: (e) => W(_, e),
307
+ placeholder: "Pick var...",
308
+ chevron: !0,
309
+ children: [
310
+ /* @__PURE__ */ l("option", { value: "", children: "Pick var…" }),
311
+ B.map((e) => /* @__PURE__ */ l("option", { value: e.id, children: e.label }, `fv-${e.id}`))
312
+ ]
313
+ }
314
+ ) })
315
+ ] })
316
+ ] })
317
+ ] }) : null,
318
+ /* @__PURE__ */ t("div", { children: [
319
+ /* @__PURE__ */ l("label", { className: "toolbar-label mb-1 block", children: "Preview" }),
320
+ /* @__PURE__ */ l(z, { grow: !0, children: /* @__PURE__ */ l("code", { className: "block w-full py-1 text-[11px] break-all whitespace-pre-wrap", children: G }) })
321
+ ] }),
322
+ /* @__PURE__ */ l("div", { className: "flex justify-end", children: /* @__PURE__ */ l(
323
+ "button",
324
+ {
325
+ type: "button",
326
+ className: "btn btn-primary btn-sm",
327
+ onClick: () => {
328
+ u(G), N(null);
329
+ },
330
+ children: "Insert Expression"
331
+ }
332
+ ) })
333
+ ] })
334
+ }
335
+ ) : null
336
+ ] }),
337
+ c ? /* @__PURE__ */ t("div", { className: "text-neutral-content text-xs", children: [
338
+ "Data scope: ",
339
+ /* @__PURE__ */ l("span", { className: "text-base-content font-medium", children: c })
340
+ ] }) : null,
341
+ f.length > 0 ? /* @__PURE__ */ l("div", { className: "flex flex-wrap gap-1", children: f.map((e) => /* @__PURE__ */ l(
342
+ "button",
343
+ {
344
+ type: "button",
345
+ className: "btn btn-ghost btn-xs",
346
+ onClick: () => u(e.value),
347
+ children: e.label
348
+ },
349
+ e.label
350
+ )) }) : null,
351
+ h ? /* @__PURE__ */ l("p", { className: "text-neutral-content text-xs", children: h }) : null,
352
+ x ? /* @__PURE__ */ t("details", { className: "text-neutral-content text-xs", children: [
353
+ /* @__PURE__ */ l("summary", { className: "cursor-pointer font-medium select-none", children: "What works here" }),
354
+ /* @__PURE__ */ t("div", { className: "mt-2 space-y-1", children: [
355
+ /* @__PURE__ */ t("div", { children: [
356
+ "Variables:",
357
+ /* @__PURE__ */ l("code", { className: "ml-1", children: "{{item.image}}" })
358
+ ] }),
359
+ /* @__PURE__ */ t("div", { children: [
360
+ "Fallback:",
361
+ /* @__PURE__ */ l("code", { className: "ml-1", children: '{{item.image || "/placeholder.jpg"}}' })
362
+ ] }),
363
+ /* @__PURE__ */ t("div", { children: [
364
+ "If / else:",
365
+ /* @__PURE__ */ l("code", { className: "ml-1", children: '{{item.image ? item.image : "/placeholder.jpg"}}' })
366
+ ] }),
367
+ /* @__PURE__ */ t("div", { children: [
368
+ "Equality check:",
369
+ /* @__PURE__ */ l("code", { className: "ml-1", children: '{{auth.status == logged-in ? item.image : "/placeholder.jpg"}}' })
370
+ ] })
371
+ ] })
372
+ ] }) : null
373
+ ] });
374
+ }
375
+ const me = 480, ze = 600;
376
+ function pe(s, r) {
377
+ return r.includes(".") ? r.split(".").reduce((d, u) => d == null ? d : d[u], s) : s == null ? void 0 : s[r];
378
+ }
379
+ function S(s, r, d) {
380
+ if (!r.includes(".")) {
381
+ s[r] = d;
382
+ return;
383
+ }
384
+ const u = r.split(".");
385
+ let m = s;
386
+ for (let h = 0; h < u.length - 1; h++) {
387
+ const f = u[h];
388
+ (m[f] == null || typeof m[f] != "object") && (m[f] = {}), m = m[f];
389
+ }
390
+ m[u[u.length - 1]] = d;
391
+ }
392
+ const Ze = (s) => {
393
+ var i;
394
+ const r = { ...s }, { props: d, id: u } = ne((a) => {
395
+ var n;
396
+ return {
397
+ props: (n = a.data) == null ? void 0 : n.props,
398
+ id: a.id
399
+ };
400
+ }), {
401
+ actions: { setProp: m }
402
+ } = ne(), { query: h, actions: f } = he(), {
403
+ propKey: x,
404
+ typeKey: w,
405
+ contentKey: y = "src",
406
+ title: E = "Media",
407
+ showObjectProperties: Z = !0,
408
+ kindFilter: K,
409
+ defaultTypeValue: N = "cdn",
410
+ variant: F = "full",
411
+ label: J
412
+ } = r, [k, P] = b(!1), [T, H] = b("library"), U = le(null), [X, D] = b(), p = be(ge), ae = () => {
413
+ var n;
414
+ const a = (n = U.current) == null ? void 0 : n.getBoundingClientRect();
415
+ if (a) {
416
+ const g = p ? a.right + 8 : a.left - me - 8;
417
+ D({ x: Math.max(8, g), y: Math.max(8, a.top) });
418
+ } else
419
+ D(void 0);
420
+ H(q ? "dynamic" : "library"), P(!0);
421
+ }, j = (a) => {
422
+ if (!a) return;
423
+ const n = oe(h, a);
424
+ m((g) => {
425
+ S(g, x, a), S(g, w, (n == null ? void 0 : n.type) || N), y !== x && S(g, y, null);
426
+ }), Ie(
427
+ h,
428
+ f,
429
+ a,
430
+ (n == null ? void 0 : n.type) || "cdn",
431
+ u
432
+ ), P(!1);
433
+ }, I = Ee({
434
+ isOpen: F === "chip" && k,
435
+ onClose: () => P(!1),
436
+ onSelect: j,
437
+ selectionMode: !0
438
+ }), R = pe(d, x), A = pe(d, y), M = !!R, $ = typeof A == "string" ? A.trim() : "", O = !!$ && $.startsWith("http"), q = !!$, o = M ? oe(h, R) : null, _ = (o == null ? void 0 : o.type) === "svg", C = _ ? (i = o == null ? void 0 : o.metadata) == null ? void 0 : i.svg : null;
439
+ let c = null;
440
+ if (M && !_)
441
+ if ((o == null ? void 0 : o.type) === "cdn") {
442
+ const a = o.cdnId || o.id;
443
+ c = ke(a, { width: 600, format: "auto" });
444
+ } else
445
+ c = Pe(Me(h).pageMedia, R);
446
+ else O && (c = A);
447
+ const Q = (o ? Fe(o) : null) === "video" && !!c, L = !!(C || c), B = () => {
448
+ m((a) => {
449
+ S(a, x, null), S(a, w, N), S(a, y, null);
450
+ });
451
+ }, G = (a) => {
452
+ m((n) => {
453
+ S(n, y, a || null), a && (S(n, x, null), S(n, w, N));
454
+ });
455
+ }, W = () => F === "chip" && k ? /* @__PURE__ */ t(fe, { fallback: null, children: [
456
+ /* @__PURE__ */ l(
457
+ re,
458
+ {
459
+ isOpen: !0,
460
+ onClose: () => P(!1),
461
+ title: "Select Media",
462
+ storageKey: "media-input-chip-picker",
463
+ autoSize: !1,
464
+ defaultWidth: me,
465
+ defaultHeight: ze,
466
+ minWidth: 360,
467
+ maxWidth: 720,
468
+ minHeight: 420,
469
+ initialPosition: X,
470
+ persistSize: !1,
471
+ zIndex: ie,
472
+ children: /* @__PURE__ */ t("div", { className: "flex h-full flex-col", children: [
473
+ /* @__PURE__ */ t("div", { className: "border-base-300 flex items-center gap-1 border-b p-2", children: [
474
+ /* @__PURE__ */ l(
475
+ "button",
476
+ {
477
+ type: "button",
478
+ className: `btn btn-xs ${T === "library" ? "btn-primary" : "btn-ghost"}`,
479
+ onClick: () => H("library"),
480
+ children: "Library"
481
+ }
482
+ ),
483
+ /* @__PURE__ */ l(
484
+ "button",
485
+ {
486
+ type: "button",
487
+ className: `btn btn-xs ${T === "dynamic" ? "btn-primary" : "btn-ghost"}`,
488
+ onClick: () => H("dynamic"),
489
+ children: "Dynamic"
490
+ }
491
+ )
492
+ ] }),
493
+ T === "library" ? /* @__PURE__ */ l(
494
+ Te,
495
+ {
496
+ manager: I,
497
+ selectionMode: !0,
498
+ onSelect: j,
499
+ onClose: () => P(!1),
500
+ popover: !0
501
+ }
502
+ ) : /* @__PURE__ */ l("div", { className: "space-y-2 p-3", children: /* @__PURE__ */ l(
503
+ Ve,
504
+ {
505
+ id: "media-chip-dynamic-src",
506
+ value: $,
507
+ onChange: G,
508
+ label: "Image Source",
509
+ placeholder: "https://... or {{item.image}}",
510
+ helpText: "Use a URL or token like {{item.image}}.",
511
+ intent: "image-src",
512
+ showExpressionHelp: !1,
513
+ snippets: [
514
+ { label: "Item image", value: "{{item.image}}" },
515
+ { label: "Image fallback", value: '{{item.image || "/placeholder.jpg"}}' },
516
+ {
517
+ label: "Connector image",
518
+ value: "{{connector.provider.bindings.products.0.image}}"
519
+ }
520
+ ]
521
+ }
522
+ ) })
523
+ ] })
524
+ }
525
+ ),
526
+ F === "chip" && k ? /* @__PURE__ */ l(
527
+ je,
528
+ {
529
+ previewMedia: I.previewMedia,
530
+ filteredMedia: I.filteredMedia,
531
+ onClose: () => I.setPreviewMedia(null),
532
+ onPrevious: I.handlePreviewPrevious,
533
+ onNext: I.handlePreviewNext
534
+ }
535
+ ) : null
536
+ ] }) : k ? /* @__PURE__ */ l(
537
+ Oe,
538
+ {
539
+ isOpen: !0,
540
+ onClose: () => P(!1),
541
+ onSelect: j,
542
+ selectionMode: !0,
543
+ kindFilter: K
544
+ }
545
+ ) : null;
546
+ if (F === "chip") {
547
+ const a = L ? C ? /* @__PURE__ */ l(
548
+ "span",
549
+ {
550
+ className: "text-base-content absolute inset-0 flex items-center justify-center [&>svg]:size-full [&>svg]:max-h-full [&>svg]:max-w-full",
551
+ dangerouslySetInnerHTML: { __html: C },
552
+ "aria-hidden": !0
553
+ }
554
+ ) : Q ? /* @__PURE__ */ l(
555
+ "video",
556
+ {
557
+ src: c ?? void 0,
558
+ className: "absolute inset-0 size-full object-cover",
559
+ preload: "metadata",
560
+ muted: !0,
561
+ playsInline: !0
562
+ }
563
+ ) : /* @__PURE__ */ l(
564
+ "span",
565
+ {
566
+ className: "absolute inset-0 bg-cover bg-center",
567
+ style: c ? { backgroundImage: `url(${c})` } : void 0,
568
+ "aria-hidden": !0
569
+ }
570
+ ) : /* @__PURE__ */ l(ce, { className: "size-3.5", "aria-hidden": !0 });
571
+ return /* @__PURE__ */ t(te, { children: [
572
+ /* @__PURE__ */ l(
573
+ z,
574
+ {
575
+ mode: "popover",
576
+ ref: U,
577
+ label: J,
578
+ open: k,
579
+ onTriggerClick: ae,
580
+ onClear: B,
581
+ triggerAriaLabel: L || q ? "Change media" : "Add media",
582
+ clearAriaLabel: "Clear media",
583
+ variant: L ? "preview" : "default",
584
+ leading: a,
585
+ summary: L ? null : q ? $ : "Add..."
586
+ }
587
+ ),
588
+ W()
589
+ ] });
590
+ }
591
+ const e = /* @__PURE__ */ t(te, { children: [
592
+ /* @__PURE__ */ t("div", { className: "space-y-2", children: [
593
+ M && (C || c) || O && c ? /* @__PURE__ */ t("div", { className: "relative", children: [
594
+ /* @__PURE__ */ l(Re, { size: "video", bg: "base-100", bordered: !1, padded: !0, children: C ? /* @__PURE__ */ l(
595
+ "div",
596
+ {
597
+ className: "text-base-content flex size-full items-center justify-center [&>svg]:size-full [&>svg]:max-h-full [&>svg]:max-w-full",
598
+ dangerouslySetInnerHTML: { __html: C }
599
+ }
600
+ ) : Q ? /* @__PURE__ */ l(
601
+ "video",
602
+ {
603
+ src: c ?? void 0,
604
+ className: "size-full rounded-lg object-cover",
605
+ preload: "metadata",
606
+ muted: !0,
607
+ playsInline: !0
608
+ }
609
+ ) : c ? /* @__PURE__ */ l(
610
+ "img",
611
+ {
612
+ src: c,
613
+ alt: "Preview",
614
+ className: "size-full rounded-lg object-cover",
615
+ loading: "lazy"
616
+ }
617
+ ) : null }),
618
+ /* @__PURE__ */ l(Se, { onClick: B, tooltip: "Clear media", floating: !0 })
619
+ ] }) : null,
620
+ O && /* @__PURE__ */ t("div", { className: "space-y-2", children: [
621
+ /* @__PURE__ */ l("label", { htmlFor: "media-input-url", className: "toolbar-label block font-medium", children: "Image URL" }),
622
+ /* @__PURE__ */ l(
623
+ "input",
624
+ {
625
+ id: "media-input-url",
626
+ type: "url",
627
+ value: A || "",
628
+ onChange: (a) => G(a.target.value),
629
+ placeholder: "https://example.com/image.jpg",
630
+ className: "input placeholder:text-neutral-content px-3! py-2!"
631
+ }
632
+ ),
633
+ /* @__PURE__ */ l("p", { className: "text-neutral-content text-xs", children: "Enter a direct image URL or use the media library below" })
634
+ ] }),
635
+ /* @__PURE__ */ l(
636
+ $e,
637
+ {
638
+ onClick: () => P(!0),
639
+ icon: /* @__PURE__ */ l(ce, { size: 12, "aria-hidden": !0 }),
640
+ children: M ? "Change Media" : "Browse Media Library"
641
+ }
642
+ )
643
+ ] }),
644
+ Z && /* @__PURE__ */ t(
645
+ de,
646
+ {
647
+ title: "Object Properties",
648
+ nested: !0,
649
+ collapsible: !0,
650
+ defaultOpen: !1,
651
+ accordionPassive: !0,
652
+ children: [
653
+ /* @__PURE__ */ l(ue, { propKey: "objectFit", label: "Object Fit", prop: "objectFit", type: "select" }),
654
+ /* @__PURE__ */ l(
655
+ ue,
656
+ {
657
+ propKey: "objectPosition",
658
+ label: "Object Position",
659
+ prop: "objectPosition",
660
+ type: "select"
661
+ }
662
+ )
663
+ ]
664
+ }
665
+ ),
666
+ W()
667
+ ] });
668
+ return E ? /* @__PURE__ */ l(de, { title: E, full: 1, collapsible: r.collapsible, children: e }) : e;
669
+ };
670
+ export {
671
+ Ze as M
672
+ };