@pagehub/sdk 0.1.4 → 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,474 @@
1
+ import { jsxs as d, Fragment as k, jsx as a } from "react/jsx-runtime";
2
+ import { useNode as D } from "@craftjs/core";
3
+ import { useState as L, useRef as T, useEffect as q, Suspense as w, lazy as F } from "react";
4
+ import { e4 as U, e5 as B, dr as N, e6 as K, e7 as V, ce as $, e8 as Y, aD as j, aI as G, C as f, aB as H, aO as m, u as z } from "./index-C66dAl3Q.js";
5
+ import { T as M } from "./ToolbarDashedButton-DbUxGmDg.js";
6
+ import { u as W } from "./usePopoverPosition-83Vti7Aw.js";
7
+ import { P as J, p as Q } from "./popoverOpenRequestAtom-hBS_siXv.js";
8
+ const P = ["exists", "not-exists"], O = {
9
+ "url-param": ["equals", "not-equals", "contains", "not-contains", "exists", "not-exists"],
10
+ "form-field": ["equals", "not-equals", "contains", "not-contains", "exists", "not-exists"],
11
+ connector: ["exists", "not-exists", "greater-than", "less-than", "equals"],
12
+ company: ["exists", "not-exists", "equals", "not-equals"],
13
+ device: ["equals"],
14
+ auth: ["equals", "not-equals", "exists", "not-exists", "greater-than", "less-than"],
15
+ item: ["exists", "not-exists", "equals", "not-equals", "contains", "greater-than", "less-than"],
16
+ localStorage: ["exists", "not-exists", "equals", "not-equals"],
17
+ state: ["equals", "not-equals", "exists", "not-exists", "contains"]
18
+ }, X = {
19
+ equals: "Equals",
20
+ "not-equals": "Not equals",
21
+ contains: "Contains",
22
+ "not-contains": "Doesn't contain",
23
+ exists: "Exists",
24
+ "not-exists": "Doesn't exist",
25
+ "greater-than": "Greater than",
26
+ "less-than": "Less than"
27
+ }, Z = F(() => import("./ConditionEditorPanel-DLbqYaSF.js")), ee = 340, te = {
28
+ "url-param": G,
29
+ "form-field": j,
30
+ connector: Y,
31
+ company: $,
32
+ device: V,
33
+ auth: K,
34
+ item: N,
35
+ localStorage: B,
36
+ state: U
37
+ }, ae = {
38
+ "url-param": "URL Parameter",
39
+ "form-field": "Form Field",
40
+ connector: "Connector",
41
+ company: "Company",
42
+ device: "Device",
43
+ auth: "Auth",
44
+ item: "Item",
45
+ localStorage: "Local Storage",
46
+ state: "State"
47
+ }, le = {
48
+ equals: "=",
49
+ "not-equals": "≠",
50
+ contains: "∋",
51
+ "not-contains": "∌",
52
+ exists: "exists",
53
+ "not-exists": "missing",
54
+ "greater-than": ">",
55
+ "less-than": "<"
56
+ };
57
+ function ne(t) {
58
+ return ae[t.type] ?? t.type;
59
+ }
60
+ function oe(t) {
61
+ if (t.type === "device") return t.value || "";
62
+ if (!t.key) return "";
63
+ const l = le[t.operator] ?? t.operator;
64
+ return P.includes(t.operator) ? `${t.key} ${l}` : t.value ? `${t.key} ${l} ${t.value}` : t.key;
65
+ }
66
+ function se({
67
+ cond: t,
68
+ onChange: l,
69
+ onRemove: o,
70
+ autoOpen: v,
71
+ onAutoOpenConsumed: s
72
+ }) {
73
+ const [n, e] = L(!1), { triggerRef: h, initialPos: x, setInitialPos: c, computePosition: i } = W(ee), p = te[t.type] || N, b = ne(t), C = oe(t) || "Add…", g = () => {
74
+ c(i()), e(!0);
75
+ }, r = T(!1);
76
+ return q(() => {
77
+ !v || r.current || (r.current = !0, requestAnimationFrame(() => {
78
+ c(i()), e(!0), s == null || s();
79
+ }));
80
+ }, [v]), /* @__PURE__ */ d(k, { children: [
81
+ /* @__PURE__ */ a(
82
+ f,
83
+ {
84
+ mode: "popover",
85
+ ref: h,
86
+ label: b,
87
+ open: n,
88
+ onTriggerClick: () => n ? e(!1) : g(),
89
+ onClear: () => {
90
+ n && e(!1), o();
91
+ },
92
+ triggerAriaLabel: "Edit condition",
93
+ clearAriaLabel: "Remove condition",
94
+ leading: /* @__PURE__ */ a(p, { className: "size-3.5", "aria-hidden": !0 }),
95
+ summary: C
96
+ }
97
+ ),
98
+ n && /* @__PURE__ */ a(w, { fallback: null, children: /* @__PURE__ */ a(
99
+ Z,
100
+ {
101
+ cond: t,
102
+ onChange: l,
103
+ initialPosition: x,
104
+ onClose: () => e(!1)
105
+ }
106
+ ) })
107
+ ] });
108
+ }
109
+ const _ = [
110
+ { value: "url-param", label: "URL Parameter" },
111
+ { value: "form-field", label: "Form Field" },
112
+ { value: "connector", label: "Connector" },
113
+ { value: "company", label: "Company Variable" },
114
+ { value: "device", label: "Device / Viewport" },
115
+ { value: "auth", label: "Auth Status" },
116
+ { value: "localStorage", label: "Local Storage" },
117
+ { value: "state", label: "State" }
118
+ ], E = _, re = [
119
+ { value: "status", label: "Login status" },
120
+ { value: "customer.hasSubscription", label: "Has subscription" },
121
+ { value: "customer.orderCount", label: "Order count" },
122
+ { value: "customer.totalSpent", label: "Total spent" }
123
+ ], ie = [
124
+ { value: "logged-in", label: "Logged in" },
125
+ { value: "logged-out", label: "Logged out" }
126
+ ], ue = [
127
+ { value: "true", label: "Yes" },
128
+ { value: "false", label: "No" }
129
+ ], ce = [
130
+ { value: "mobile", label: "Mobile" },
131
+ { value: "desktop", label: "Desktop" }
132
+ ], pe = [
133
+ { value: "name", label: "Company name" },
134
+ { value: "email", label: "Company email" },
135
+ { value: "phone", label: "Company phone" },
136
+ { value: "tagline", label: "Tagline" },
137
+ { value: "location", label: "Location" },
138
+ { value: "address", label: "Address" },
139
+ { value: "website", label: "Website" }
140
+ ];
141
+ function S(t) {
142
+ switch (t) {
143
+ case "device":
144
+ return { type: "device", key: "viewport", operator: "equals", value: "mobile" };
145
+ case "auth":
146
+ return { type: "auth", key: "status", operator: "equals", value: "logged-in" };
147
+ case "connector":
148
+ return { type: "connector", key: "", operator: "exists", value: "" };
149
+ case "company":
150
+ return { type: "company", key: "name", operator: "exists", value: "" };
151
+ case "localStorage":
152
+ return { type: "localStorage", key: "", operator: "not-exists", value: "" };
153
+ case "state":
154
+ return { type: "state", key: "", operator: "equals", value: "" };
155
+ default:
156
+ return { type: t, key: "", operator: "equals", value: "" };
157
+ }
158
+ }
159
+ function R({
160
+ cond: t,
161
+ onChange: l,
162
+ formElements: o,
163
+ connectorOptions: v
164
+ }) {
165
+ var n;
166
+ const s = O[t.type] || O["url-param"];
167
+ return /* @__PURE__ */ d(k, { children: [
168
+ /* @__PURE__ */ a(
169
+ m,
170
+ {
171
+ value: t.type,
172
+ onChange: (e) => {
173
+ const h = e;
174
+ l({ ...S(h), type: h });
175
+ },
176
+ propKey: "condType",
177
+ children: E.map((e) => /* @__PURE__ */ a("option", { value: e.value, children: e.label }, e.value))
178
+ }
179
+ ),
180
+ t.type === "device" && /* @__PURE__ */ a(
181
+ m,
182
+ {
183
+ value: t.value || "mobile",
184
+ onChange: (e) => l({ value: e }),
185
+ propKey: "condDevice",
186
+ children: ce.map((e) => /* @__PURE__ */ a("option", { value: e.value, children: e.label }, e.value))
187
+ }
188
+ ),
189
+ t.type === "auth" && /* @__PURE__ */ a(
190
+ m,
191
+ {
192
+ value: t.key || "status",
193
+ onChange: (e) => {
194
+ l({ key: e, ...{
195
+ status: { operator: "equals", value: "logged-in" },
196
+ "customer.hasSubscription": { operator: "equals", value: "true" },
197
+ "customer.orderCount": { operator: "greater-than", value: "0" },
198
+ "customer.totalSpent": { operator: "greater-than", value: "0" }
199
+ }[e] || { operator: "equals", value: "" } });
200
+ },
201
+ propKey: "condAuthField",
202
+ children: re.map((e) => /* @__PURE__ */ a("option", { value: e.value, children: e.label }, e.value))
203
+ }
204
+ ),
205
+ t.type === "company" && /* @__PURE__ */ a(
206
+ m,
207
+ {
208
+ value: t.key,
209
+ onChange: (e) => l({ key: e }),
210
+ propKey: "condCompanyField",
211
+ children: pe.map((e) => /* @__PURE__ */ a("option", { value: e.value, children: e.label }, e.value))
212
+ }
213
+ ),
214
+ t.type === "connector" && /* @__PURE__ */ d(k, { children: [
215
+ /* @__PURE__ */ d(
216
+ m,
217
+ {
218
+ value: t.key.split(".")[0] || "",
219
+ onChange: (e) => l({ key: e }),
220
+ propKey: "condConnProvider",
221
+ children: [
222
+ /* @__PURE__ */ a("option", { value: "", children: "Select provider..." }),
223
+ v.map((e) => /* @__PURE__ */ a("option", { value: e.provider, children: e.provider.charAt(0).toUpperCase() + e.provider.slice(1) }, e.provider))
224
+ ]
225
+ }
226
+ ),
227
+ t.key && /* @__PURE__ */ d(
228
+ m,
229
+ {
230
+ value: t.key,
231
+ onChange: (e) => l({ key: e }),
232
+ propKey: "condConnCollection",
233
+ children: [
234
+ /* @__PURE__ */ a("option", { value: t.key.split(".")[0], children: "Any data" }),
235
+ (n = v.find((e) => e.provider === t.key.split(".")[0])) == null ? void 0 : n.collections.map((e) => /* @__PURE__ */ a("option", { value: `${t.key.split(".")[0]}.${e}`, children: e.charAt(0).toUpperCase() + e.slice(1) }, e))
236
+ ]
237
+ }
238
+ )
239
+ ] }),
240
+ t.type === "form-field" && /* @__PURE__ */ d(k, { children: [
241
+ /* @__PURE__ */ d(
242
+ m,
243
+ {
244
+ value: t.target || "",
245
+ onChange: (e) => l({ target: e }),
246
+ propKey: "condFormTarget",
247
+ children: [
248
+ /* @__PURE__ */ a("option", { value: "", children: "Select field..." }),
249
+ o.map((e) => /* @__PURE__ */ a("option", { value: e.anchor, children: e.label }, e.nodeId))
250
+ ]
251
+ }
252
+ ),
253
+ /* @__PURE__ */ a(f, { children: /* @__PURE__ */ a(
254
+ "input",
255
+ {
256
+ type: "text",
257
+ value: t.key,
258
+ onChange: (e) => l({ key: e.target.value }),
259
+ placeholder: "field name",
260
+ className: "h-full w-full bg-transparent px-1 font-mono text-xs outline-none"
261
+ }
262
+ ) })
263
+ ] }),
264
+ t.type === "url-param" && /* @__PURE__ */ a(f, { children: /* @__PURE__ */ a(
265
+ "input",
266
+ {
267
+ type: "text",
268
+ value: t.key,
269
+ onChange: (e) => l({ key: e.target.value }),
270
+ placeholder: "param name (e.g. ref)",
271
+ className: "h-full w-full bg-transparent px-1 font-mono text-xs outline-none"
272
+ }
273
+ ) }),
274
+ t.type === "localStorage" && /* @__PURE__ */ a(f, { children: /* @__PURE__ */ a(
275
+ "input",
276
+ {
277
+ type: "text",
278
+ value: t.key,
279
+ onChange: (e) => l({ key: e.target.value }),
280
+ placeholder: "storage key (e.g. ph-cookie-consent)",
281
+ className: "h-full w-full bg-transparent px-1 font-mono text-xs outline-none"
282
+ }
283
+ ) }),
284
+ t.type === "state" && /* @__PURE__ */ a(f, { children: /* @__PURE__ */ a(
285
+ "input",
286
+ {
287
+ type: "text",
288
+ value: t.key,
289
+ onChange: (e) => l({ key: e.target.value }),
290
+ placeholder: "state key (element id or named state)",
291
+ className: "h-full w-full bg-transparent px-1 font-mono text-xs outline-none"
292
+ }
293
+ ) }),
294
+ t.type !== "device" && /* @__PURE__ */ a(
295
+ m,
296
+ {
297
+ value: t.operator,
298
+ onChange: (e) => l({ operator: e }),
299
+ propKey: "condOp",
300
+ children: s.map((e) => /* @__PURE__ */ a("option", { value: e, children: X[e] }, e))
301
+ }
302
+ ),
303
+ t.type !== "device" && !P.includes(t.operator) && (t.type === "auth" && t.key === "status" ? /* @__PURE__ */ a(
304
+ m,
305
+ {
306
+ value: t.value || "logged-in",
307
+ onChange: (e) => l({ value: e }),
308
+ propKey: "condAuthValue",
309
+ children: ie.map((e) => /* @__PURE__ */ a("option", { value: e.value, children: e.label }, e.value))
310
+ }
311
+ ) : t.type === "auth" && t.key === "customer.hasSubscription" ? /* @__PURE__ */ a(
312
+ m,
313
+ {
314
+ value: t.value || "true",
315
+ onChange: (e) => l({ value: e }),
316
+ propKey: "condAuthBoolValue",
317
+ children: ue.map((e) => /* @__PURE__ */ a("option", { value: e.value, children: e.label }, e.value))
318
+ }
319
+ ) : /* @__PURE__ */ a(f, { children: /* @__PURE__ */ a(
320
+ "input",
321
+ {
322
+ type: "text",
323
+ value: t.value,
324
+ onChange: (e) => l({ value: e.target.value }),
325
+ placeholder: "expected value",
326
+ className: "h-full w-full bg-transparent px-1 font-mono text-xs outline-none"
327
+ }
328
+ ) }))
329
+ ] });
330
+ }
331
+ function de({
332
+ cond: t,
333
+ onChange: l,
334
+ onRemove: o,
335
+ formElements: v,
336
+ connectorOptions: s
337
+ }) {
338
+ var n;
339
+ return /* @__PURE__ */ d("div", { className: "border-base-300 mb-2 flex flex-col gap-1.5 rounded-md border p-2", children: [
340
+ /* @__PURE__ */ d("div", { className: "flex items-center justify-between", children: [
341
+ /* @__PURE__ */ a("span", { className: "text-neutral-content text-[10px] font-medium", children: ((n = E.find((e) => e.value === t.type)) == null ? void 0 : n.label) || t.type }),
342
+ /* @__PURE__ */ a(
343
+ "button",
344
+ {
345
+ type: "button",
346
+ onClick: o,
347
+ className: "text-neutral-content hover:bg-error hover:text-error-content rounded p-0.5",
348
+ children: /* @__PURE__ */ a(H, { size: 12 })
349
+ }
350
+ )
351
+ ] }),
352
+ /* @__PURE__ */ a(
353
+ R,
354
+ {
355
+ cond: t,
356
+ onChange: l,
357
+ formElements: v,
358
+ connectorOptions: s
359
+ }
360
+ )
361
+ ] });
362
+ }
363
+ function ve({
364
+ group: t,
365
+ groupIndex: l,
366
+ onChange: o,
367
+ onRemove: v,
368
+ formElements: s,
369
+ connectorOptions: n
370
+ }) {
371
+ const e = (c, i) => {
372
+ const p = [...t.conditions];
373
+ p[c] = { ...p[c], ...i }, o({ ...t, conditions: p });
374
+ }, h = (c) => {
375
+ const i = t.conditions.filter((p, b) => b !== c);
376
+ i.length === 0 ? v() : o({ ...t, conditions: i });
377
+ }, x = () => {
378
+ o({
379
+ ...t,
380
+ conditions: [...t.conditions, S("url-param")]
381
+ });
382
+ };
383
+ return /* @__PURE__ */ d("div", { children: [
384
+ t.conditions.length > 1 && /* @__PURE__ */ d("div", { className: "bg-neutral mb-2 flex gap-1 rounded-md p-0.5", children: [
385
+ /* @__PURE__ */ a(
386
+ "button",
387
+ {
388
+ type: "button",
389
+ onClick: () => o({ ...t, logic: "all" }),
390
+ className: `flex-1 rounded px-2 py-1 text-[11px] font-medium transition-colors ${t.logic === "all" ? "bg-base-100 text-base-content shadow-sm" : "text-neutral-content hover:text-base-content"}`,
391
+ children: "All match (AND)"
392
+ }
393
+ ),
394
+ /* @__PURE__ */ a(
395
+ "button",
396
+ {
397
+ type: "button",
398
+ onClick: () => o({ ...t, logic: "any" }),
399
+ className: `flex-1 rounded px-2 py-1 text-[11px] font-medium transition-colors ${t.logic === "any" ? "bg-base-100 text-base-content shadow-sm" : "text-neutral-content hover:text-base-content"}`,
400
+ children: "Any match (OR)"
401
+ }
402
+ )
403
+ ] }),
404
+ t.conditions.map((c, i) => /* @__PURE__ */ a(
405
+ de,
406
+ {
407
+ cond: c,
408
+ onChange: (p) => e(i, p),
409
+ onRemove: () => h(i),
410
+ formElements: s,
411
+ connectorOptions: n
412
+ },
413
+ i
414
+ )),
415
+ /* @__PURE__ */ a(M, { onClick: x, children: "Add condition" })
416
+ ] });
417
+ }
418
+ const me = "conditions", he = () => {
419
+ var g;
420
+ const {
421
+ id: t,
422
+ actions: { setProp: l },
423
+ conditionGroups: o
424
+ } = D((r) => {
425
+ var u, y;
426
+ return {
427
+ id: r.id,
428
+ conditionGroups: (y = (u = r.data) == null ? void 0 : u.props) == null ? void 0 : y.conditionGroups
429
+ };
430
+ }), s = z(J).get(Q(t, me)) || 0, n = ((g = o == null ? void 0 : o[0]) == null ? void 0 : g.conditions) ?? [], e = (r) => {
431
+ l((u) => {
432
+ u.conditionGroups = r.length > 0 ? [{ conditions: r, logic: "all" }] : [];
433
+ });
434
+ }, h = (r, u) => {
435
+ const y = n.map((A, I) => I === r ? { ...A, ...u } : A);
436
+ e(y);
437
+ }, x = (r) => {
438
+ e(n.filter((u, y) => y !== r));
439
+ }, c = T(n.length), [i, p] = L(null);
440
+ q(() => {
441
+ n.length > c.current && p(n.length - 1), c.current = n.length;
442
+ }, [n.length]);
443
+ const b = T(0);
444
+ q(() => {
445
+ s === 0 || s === b.current || (b.current = s, n.length > 0 && p(n.length - 1));
446
+ }, [s, n.length]);
447
+ const C = () => p(null);
448
+ return n.length === 0 ? null : /* @__PURE__ */ a("div", { className: "flex flex-col gap-1", children: n.map((r, u) => /* @__PURE__ */ a(
449
+ se,
450
+ {
451
+ cond: r,
452
+ autoOpen: u === i,
453
+ onAutoOpenConsumed: C,
454
+ onChange: (y) => h(u, y),
455
+ onRemove: () => x(u)
456
+ },
457
+ u
458
+ )) });
459
+ }, Te = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
460
+ __proto__: null,
461
+ CONDITION_TYPE_OPTIONS: _,
462
+ ConditionFields: R,
463
+ ConditionGroupUI: ve,
464
+ ConditionsInput: he,
465
+ defaultCondition: S
466
+ }, Symbol.toStringTag, { value: "Module" }));
467
+ export {
468
+ se as C,
469
+ _ as a,
470
+ ve as b,
471
+ R as c,
472
+ S as d,
473
+ Te as e
474
+ };