@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,670 @@
1
+ import { jsxs as w, jsx as t, Fragment as Q } from "react/jsx-runtime";
2
+ import { F as Se } from "./FloatingPanel-DJP5Vhua.js";
3
+ import { M as Me } from "./MediaManagerModal-Dc5PK3dn.js";
4
+ import { memo as ye, useMemo as Z, useState as g, useRef as $e, useEffect as C, useCallback as $ } from "react";
5
+ import { a as re } from "./index.esm-mqFx3NOs.js";
6
+ import { _ as Fe, a_ as se, db as B, fi as he, ct as De, aR as Ae, aO as Ee, a4 as Re, w as E, a0 as _e, W as Le } from "./index-C66dAl3Q.js";
7
+ import { S as Oe } from "./SearchInput-DRUztbM0.js";
8
+ import { useEditor as Pe } from "@craftjs/core";
9
+ import { M as Be } from "./MiniPreviewTile-B4zxTj9Y.js";
10
+ function We({
11
+ iconRef: e,
12
+ isSelected: r,
13
+ isFocused: a,
14
+ isFavorite: c,
15
+ onClick: s,
16
+ onDoubleClick: l,
17
+ onContextMenu: i,
18
+ onHover: f
19
+ }) {
20
+ const d = e.indexOf("/"), I = d > 0 ? e.slice(d + 1) : e;
21
+ return /* @__PURE__ */ w(
22
+ "button",
23
+ {
24
+ type: "button",
25
+ onClick: () => s(e),
26
+ onDoubleClick: () => l(e),
27
+ onContextMenu: (p) => {
28
+ p.preventDefault(), i(e);
29
+ },
30
+ onMouseEnter: f ? () => f(e) : void 0,
31
+ onMouseLeave: f ? () => f(null) : void 0,
32
+ onFocus: f ? () => f(e) : void 0,
33
+ className: `relative flex size-full cursor-pointer items-center justify-center rounded-md transition-colors ${r ? "bg-primary/10 text-primary" : a ? "ring-primary/40 bg-primary/5 ring-1" : "text-base-content/80 hover:bg-neutral hover:text-base-content"}`,
34
+ "aria-label": `Icon: ${I}${c ? " (favorite)" : ""}`,
35
+ tabIndex: a ? 0 : -1,
36
+ role: "gridcell",
37
+ "aria-selected": r,
38
+ children: [
39
+ /* @__PURE__ */ t("svg", { className: "h-[18px] w-[18px]", "aria-hidden": "true", fill: "currentColor", children: /* @__PURE__ */ t("use", { href: `#${I}` }) }),
40
+ c && /* @__PURE__ */ t(
41
+ "span",
42
+ {
43
+ "aria-hidden": "true",
44
+ className: "bg-primary absolute top-1 right-1 size-1 rounded-full"
45
+ }
46
+ )
47
+ ]
48
+ }
49
+ );
50
+ }
51
+ const X = ye(We);
52
+ function W({
53
+ refs: e,
54
+ selectedIcon: r,
55
+ favorites: a,
56
+ onPick: c,
57
+ onDoublePick: s,
58
+ onToggleFavorite: l,
59
+ onHover: i
60
+ }) {
61
+ if (e.length === 0)
62
+ return /* @__PURE__ */ t("div", { className: "text-neutral-content px-3 py-4 text-center text-xs", children: "No icons." });
63
+ const f = new Set(a);
64
+ return /* @__PURE__ */ t("div", { role: "grid", "aria-label": "Icons", className: "grid grid-cols-5 gap-1", children: e.map((d) => /* @__PURE__ */ t("div", { className: "aspect-square", children: /* @__PURE__ */ t(
65
+ X,
66
+ {
67
+ iconRef: d,
68
+ isSelected: r === `ref-icon:${d}`,
69
+ isFavorite: f.has(d),
70
+ onClick: c,
71
+ onDoubleClick: s,
72
+ onContextMenu: l,
73
+ onHover: i
74
+ }
75
+ ) }, d)) });
76
+ }
77
+ const ze = [
78
+ "tb/TbBookmark",
79
+ "tb/TbCalendar",
80
+ "tb/TbLink",
81
+ "tb/TbKey",
82
+ "tb/TbBriefcase",
83
+ "tb/TbCamera",
84
+ "tb/TbCreditCard",
85
+ "tb/TbDatabase",
86
+ "tb/TbFolder",
87
+ "tb/TbGlobe",
88
+ "tb/TbHeart",
89
+ "tb/TbShare",
90
+ "tb/TbBell",
91
+ "tb/TbCloud",
92
+ "tb/TbFlag",
93
+ "tb/TbHome",
94
+ "tb/TbLock",
95
+ "tb/TbPhone",
96
+ "tb/TbStar",
97
+ "tb/TbTrash",
98
+ "tb/TbArrowLeft",
99
+ "tb/TbArrowRight",
100
+ "tb/TbCode",
101
+ "tb/TbDownload",
102
+ "tb/TbFilter",
103
+ "tb/TbGift",
104
+ "fa/FaInfo",
105
+ "tb/TbMap",
106
+ "tb/TbRss",
107
+ "tb/TbSearch"
108
+ ], He = 20, Ge = 200, ce = /* @__PURE__ */ new Map();
109
+ function je(e) {
110
+ if (!e) return null;
111
+ const r = e.match(/^[A-Z][a-z0-9]*/);
112
+ return r ? r[0] : null;
113
+ }
114
+ function Ue(e, r) {
115
+ if (!e || !r || r.length === 0) return [];
116
+ const a = ce.get(e);
117
+ if (a) return a;
118
+ const c = e[0].toUpperCase() + e.slice(1), s = /* @__PURE__ */ new Map();
119
+ for (const i of r) {
120
+ if (!i.startsWith(c)) continue;
121
+ const f = i.slice(c.length), d = je(f);
122
+ if (!d) continue;
123
+ const I = `${e}/${i}`, p = s.get(d);
124
+ p ? p.push(I) : s.set(d, [I]);
125
+ }
126
+ const l = [];
127
+ for (const [i, f] of s)
128
+ f.length < He || l.push({
129
+ key: i,
130
+ label: i,
131
+ refs: f.slice(0, Ge)
132
+ });
133
+ return l.sort((i, f) => f.refs.length - i.refs.length), ce.set(e, l), l;
134
+ }
135
+ const v = 7, ee = 44, R = 44, q = 7 * ee, J = 8, le = "icon-recents", ie = "icon-favorites", Ke = 30, Ye = 100, z = { data: null }, H = /* @__PURE__ */ new Map();
136
+ async function Ve() {
137
+ if (z.data) return z.data;
138
+ const e = await fetch("/api/icon-manifest");
139
+ if (!e.ok) throw new Error("Failed to load icon set index");
140
+ const r = await e.json();
141
+ return z.data = r, r;
142
+ }
143
+ async function fe(e) {
144
+ const r = H.get(e);
145
+ if (r) return r;
146
+ const a = await fetch(`/api/icon-manifest?set=${encodeURIComponent(e)}`);
147
+ if (!a.ok) throw new Error(`Failed to load manifest for set "${e}"`);
148
+ const c = await a.json();
149
+ return H.set(e, c), c;
150
+ }
151
+ function de(e) {
152
+ const r = e.indexOf("/");
153
+ return r > 0 ? e.slice(0, r) : null;
154
+ }
155
+ function Ze({
156
+ value: e,
157
+ prefix: r,
158
+ isOpen: a,
159
+ onChange: c,
160
+ onClose: s,
161
+ onUseMedia: l
162
+ }) {
163
+ const { query: i } = Pe(), f = Fe(i).pageMedia, d = Z(
164
+ () => ({ value: e, prefix: r, enabled: a, changed: c, onUseMedia: l }),
165
+ [e, r, a, c, l]
166
+ ), I = () => e != null && e.startsWith("ref-image:") ? "media" : "icons", [p, F] = g(I()), [h, M] = g(e), [m, N] = g(() => {
167
+ if (e != null && e.startsWith("ref-icon:")) {
168
+ const n = e.replace("ref-icon:", ""), o = n.indexOf("/");
169
+ if (o > 0) return n.slice(0, o);
170
+ }
171
+ return "tb";
172
+ }), [T, k] = g(""), [S, y] = g(!1), [G, be] = g(z.data), [D, j] = g(H.get(m) || null), [me, U] = g(!1), [K, te] = g([]), [Y, ne] = g([]), [x, A] = g(0), _ = $e(null), [ge, pe] = g(!1);
173
+ C(() => {
174
+ pe(!0);
175
+ }, []), C(() => {
176
+ G || Ve().then(be).catch((n) => se.error(n));
177
+ }, [a, G]), C(() => {
178
+ const n = H.get(m);
179
+ if (n) {
180
+ j(n);
181
+ return;
182
+ }
183
+ U(!0), fe(m).then((o) => {
184
+ j(o), U(!1);
185
+ }).catch((o) => {
186
+ se.error(o), j([]), U(!1);
187
+ });
188
+ }, [m, a]), C(() => {
189
+ const n = B.getJSON(le, []), o = B.getJSON(ie, []);
190
+ Array.isArray(n) && te(n), Array.isArray(o) && ne(o);
191
+ }, [a]), C(() => {
192
+ const n = /* @__PURE__ */ new Set(["tb"]);
193
+ for (const o of K) {
194
+ const u = de(o);
195
+ u && n.add(u);
196
+ }
197
+ for (const o of Y) {
198
+ const u = de(o);
199
+ u && n.add(u);
200
+ }
201
+ for (const o of n)
202
+ he(o), fe(o).catch(() => {
203
+ });
204
+ }, [a, K, Y]);
205
+ const L = Z(() => {
206
+ const n = D || [];
207
+ if (!T) return n;
208
+ const o = new RegExp(T.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "i");
209
+ return n.filter((u) => o.test(u));
210
+ }, [D, T]), xe = Z(
211
+ () => Ue(m, D || []),
212
+ [m, D]
213
+ ), Ie = Math.ceil(L.length / v);
214
+ C(() => {
215
+ F(I());
216
+ }, [e, a]), C(() => {
217
+ M(e);
218
+ }, [a, e]), C(() => {
219
+ A(0);
220
+ }, [p, m, T]);
221
+ const oe = s, ae = $((n) => {
222
+ te((o) => {
223
+ const u = [n, ...o.filter((b) => b !== n)].slice(0, Ke);
224
+ return B.set(le, u), u;
225
+ });
226
+ }, []), ve = $((n) => {
227
+ ne((o) => {
228
+ const b = o.includes(n) ? o.filter((P) => P !== n) : [n, ...o].slice(0, Ye);
229
+ return B.set(ie, b), b;
230
+ });
231
+ }, []), O = $(
232
+ (n) => {
233
+ const o = `ref-icon:${n}`;
234
+ ae(n), c(o), s();
235
+ },
236
+ [ae, c, s]
237
+ ), Te = $(
238
+ (n) => {
239
+ const o = `ref-icon:${n}`;
240
+ M(o), c(o);
241
+ },
242
+ [c]
243
+ ), Ce = $(
244
+ (n) => {
245
+ O(n);
246
+ },
247
+ [O]
248
+ ), ke = (n) => {
249
+ if (!n) return;
250
+ const o = `ref-image:${n}`;
251
+ c(o), s(), y(!1);
252
+ }, we = (n) => {
253
+ var o;
254
+ k(n), (o = _.current) == null || o.scrollTo({ scrollLeft: 0, scrollTop: 0 });
255
+ }, Ne = (n) => {
256
+ var o;
257
+ N(n), k(""), (o = _.current) == null || o.scrollTo({ scrollLeft: 0, scrollTop: 0 });
258
+ }, V = $(
259
+ (n) => {
260
+ if (p !== "icons") return;
261
+ const o = L;
262
+ if (o.length === 0) return;
263
+ const u = (b) => {
264
+ var P;
265
+ (P = _.current) == null || P.scrollToItem({
266
+ rowIndex: Math.floor(b / v),
267
+ columnIndex: b % v
268
+ });
269
+ };
270
+ switch (n.key) {
271
+ case "ArrowRight":
272
+ n.preventDefault(), x < o.length - 1 && (A(x + 1), u(x + 1));
273
+ break;
274
+ case "ArrowLeft":
275
+ n.preventDefault(), x > 0 && (A(x - 1), u(x - 1));
276
+ break;
277
+ case "ArrowDown":
278
+ n.preventDefault();
279
+ {
280
+ const b = x + v;
281
+ b < o.length && (A(b), u(b));
282
+ }
283
+ break;
284
+ case "ArrowUp":
285
+ n.preventDefault();
286
+ {
287
+ const b = x - v;
288
+ b >= 0 && (A(b), u(b));
289
+ }
290
+ break;
291
+ case "Enter":
292
+ n.preventDefault(), o[x] && O(`${m}/${o[x]}`);
293
+ break;
294
+ }
295
+ },
296
+ [a, p, L, x, m, O]
297
+ );
298
+ return C(() => (document.addEventListener("keydown", V), () => document.removeEventListener("keydown", V)), [a, V]), De({ id: "icon-dialog", isOpen: a, onDismiss: oe }), {
299
+ dialog: d,
300
+ closeDialog: oe,
301
+ isClient: ge,
302
+ activeTab: p,
303
+ setActiveTab: F,
304
+ set: m,
305
+ setIndex: G,
306
+ setNames: D,
307
+ handleSetChange: Ne,
308
+ search: T,
309
+ setSearch: k,
310
+ filteredIcons: L,
311
+ rowCount: Ie,
312
+ selectedIcon: h,
313
+ focusedIndex: x,
314
+ gridRef: _,
315
+ loadingNames: me,
316
+ handleSearch: we,
317
+ handleIconClick: Te,
318
+ handleIconDoubleClick: Ce,
319
+ recents: K,
320
+ favorites: Y,
321
+ toggleFavorite: ve,
322
+ categories: xe,
323
+ showMediaBrowser: S,
324
+ setShowMediaBrowser: y,
325
+ handleMediaSelect: ke,
326
+ pageMedia: f,
327
+ getMediaContent: Ae
328
+ };
329
+ }
330
+ function qe({ d: e }) {
331
+ var d, I, p, F;
332
+ C(() => {
333
+ he(e.set);
334
+ }, [e.set]);
335
+ const [r, a] = g(null), c = e.search.length > 0, s = (d = e.selectedIcon) != null && d.startsWith("ref-icon:") ? e.selectedIcon.slice(9) : null, l = r ?? s, i = l ? l.slice(l.indexOf("/") + 1) : null, f = l ? l.slice(0, l.indexOf("/")) : null;
336
+ return /* @__PURE__ */ w(
337
+ "div",
338
+ {
339
+ role: "tabpanel",
340
+ id: "icons-tabpanel",
341
+ "aria-labelledby": "icons-tab",
342
+ "aria-label": "Icon selection",
343
+ className: "flex min-h-0 flex-1 flex-col",
344
+ children: [
345
+ /* @__PURE__ */ w("div", { className: "flex shrink-0 items-center gap-2 px-3 py-2", children: [
346
+ /* @__PURE__ */ t(
347
+ Oe,
348
+ {
349
+ value: e.search,
350
+ onChange: e.handleSearch,
351
+ placeholder: "Search icons...",
352
+ size: "slim",
353
+ className: "flex-1"
354
+ }
355
+ ),
356
+ /* @__PURE__ */ t("div", { className: "w-32 shrink-0", children: /* @__PURE__ */ t(Ee, { value: e.set, onChange: e.handleSetChange, placeholder: "Icon set", children: (e.setIndex ?? [{ id: e.set, name: e.set, count: 0 }]).map((h) => /* @__PURE__ */ t("option", { value: h.id, children: h.name }, h.id)) }) })
357
+ ] }),
358
+ (c || e.loadingNames) && /* @__PURE__ */ t("div", { className: "text-neutral-content shrink-0 px-3 pb-1 text-[10px]", children: e.loadingNames ? "Loading…" : `${e.filteredIcons.length} result${e.filteredIcons.length !== 1 ? "s" : ""}` }),
359
+ c ? /* @__PURE__ */ t(
360
+ "div",
361
+ {
362
+ role: "grid",
363
+ "aria-label": "Icons grid",
364
+ "aria-rowcount": e.rowCount,
365
+ "aria-colcount": v,
366
+ className: "min-h-0 flex-1 overflow-hidden",
367
+ children: /* @__PURE__ */ t(
368
+ re,
369
+ {
370
+ ref: e.gridRef,
371
+ columnCount: v,
372
+ columnWidth: ee,
373
+ height: J * R,
374
+ rowCount: e.rowCount,
375
+ rowHeight: R,
376
+ width: q,
377
+ className: "scrollbar-light text-base-content",
378
+ children: ({ columnIndex: h, rowIndex: M, style: m }) => {
379
+ const N = M * v + h;
380
+ if (N >= e.filteredIcons.length) return null;
381
+ const T = e.filteredIcons[N], k = `${e.set}/${T}`, S = `ref-icon:${k}`, y = e.focusedIndex === N;
382
+ return /* @__PURE__ */ t("div", { style: m, className: "p-0.5", children: /* @__PURE__ */ t(
383
+ X,
384
+ {
385
+ iconRef: k,
386
+ isSelected: e.selectedIcon === S,
387
+ isFocused: y,
388
+ isFavorite: e.favorites.includes(k),
389
+ onClick: e.handleIconClick,
390
+ onDoubleClick: e.handleIconDoubleClick,
391
+ onContextMenu: e.toggleFavorite,
392
+ onHover: a
393
+ }
394
+ ) });
395
+ }
396
+ }
397
+ )
398
+ }
399
+ ) : /* @__PURE__ */ w(Re, { className: "min-h-0 flex-1", children: [
400
+ /* @__PURE__ */ t(E, { title: "Common", defaultOpen: !0, full: 1, children: /* @__PURE__ */ t(
401
+ W,
402
+ {
403
+ refs: ze,
404
+ selectedIcon: e.selectedIcon,
405
+ favorites: e.favorites,
406
+ onPick: e.handleIconClick,
407
+ onDoublePick: e.handleIconDoubleClick,
408
+ onToggleFavorite: e.toggleFavorite,
409
+ onHover: a
410
+ }
411
+ ) }),
412
+ e.recents.length > 0 && /* @__PURE__ */ t(E, { title: `Recents · ${e.recents.length}`, defaultOpen: !1, full: 1, children: /* @__PURE__ */ t(
413
+ W,
414
+ {
415
+ refs: e.recents,
416
+ selectedIcon: e.selectedIcon,
417
+ favorites: e.favorites,
418
+ onPick: e.handleIconClick,
419
+ onDoublePick: e.handleIconDoubleClick,
420
+ onToggleFavorite: e.toggleFavorite
421
+ }
422
+ ) }),
423
+ e.favorites.length > 0 && /* @__PURE__ */ t(
424
+ E,
425
+ {
426
+ title: `Favorites · ${e.favorites.length}`,
427
+ defaultOpen: !1,
428
+ full: 1,
429
+ children: /* @__PURE__ */ t(
430
+ W,
431
+ {
432
+ refs: e.favorites,
433
+ selectedIcon: e.selectedIcon,
434
+ favorites: e.favorites,
435
+ onPick: e.handleIconClick,
436
+ onDoublePick: e.handleIconDoubleClick,
437
+ onToggleFavorite: e.toggleFavorite
438
+ }
439
+ )
440
+ }
441
+ ),
442
+ e.categories.map((h) => /* @__PURE__ */ t(
443
+ E,
444
+ {
445
+ title: `${h.label} · ${h.refs.length}`,
446
+ defaultOpen: !1,
447
+ full: 1,
448
+ scrollable: h.refs.length > 50,
449
+ maxHeight: "280px",
450
+ children: /* @__PURE__ */ t(
451
+ W,
452
+ {
453
+ refs: h.refs,
454
+ selectedIcon: e.selectedIcon,
455
+ favorites: e.favorites,
456
+ onPick: e.handleIconClick,
457
+ onDoublePick: e.handleIconDoubleClick,
458
+ onToggleFavorite: e.toggleFavorite
459
+ }
460
+ )
461
+ },
462
+ `${e.set}:${h.key}`
463
+ )),
464
+ (((I = e.setNames) == null ? void 0 : I.length) ?? 0) > 0 && /* @__PURE__ */ t(
465
+ E,
466
+ {
467
+ title: `All · ${(((p = e.setNames) == null ? void 0 : p.length) ?? 0).toLocaleString()}`,
468
+ defaultOpen: e.categories.length === 0,
469
+ full: 1,
470
+ children: /* @__PURE__ */ t(
471
+ "div",
472
+ {
473
+ role: "grid",
474
+ "aria-label": `All ${e.set} icons`,
475
+ style: { width: q, height: J * R },
476
+ children: /* @__PURE__ */ t(
477
+ re,
478
+ {
479
+ columnCount: v,
480
+ columnWidth: ee,
481
+ height: J * R,
482
+ rowCount: Math.ceil((((F = e.setNames) == null ? void 0 : F.length) ?? 0) / v),
483
+ rowHeight: R,
484
+ width: q,
485
+ className: "scrollbar-light",
486
+ children: ({ columnIndex: h, rowIndex: M, style: m }) => {
487
+ const N = M * v + h, T = e.setNames || [];
488
+ if (N >= T.length) return null;
489
+ const k = T[N], S = `${e.set}/${k}`, y = `ref-icon:${S}`;
490
+ return /* @__PURE__ */ t("div", { style: m, className: "p-1", children: /* @__PURE__ */ t(
491
+ X,
492
+ {
493
+ iconRef: S,
494
+ isSelected: e.selectedIcon === y,
495
+ isFocused: !1,
496
+ isFavorite: e.favorites.includes(S),
497
+ onClick: e.handleIconClick,
498
+ onDoubleClick: e.handleIconDoubleClick,
499
+ onContextMenu: e.toggleFavorite,
500
+ onHover: a
501
+ }
502
+ ) });
503
+ }
504
+ }
505
+ )
506
+ }
507
+ )
508
+ },
509
+ `${e.set}:__all__`
510
+ )
511
+ ] }),
512
+ /* @__PURE__ */ t("div", { className: "border-base-300 bg-neutral text-neutral-content flex h-10 shrink-0 items-center gap-2 border-t px-3 text-xs", children: i ? /* @__PURE__ */ w(Q, { children: [
513
+ /* @__PURE__ */ t(
514
+ "svg",
515
+ {
516
+ className: "text-base-content size-5 shrink-0",
517
+ "aria-hidden": "true",
518
+ fill: "currentColor",
519
+ children: /* @__PURE__ */ t("use", { href: `#${i}` })
520
+ }
521
+ ),
522
+ /* @__PURE__ */ t("span", { className: "text-base-content truncate font-mono text-[11px]", children: i }),
523
+ /* @__PURE__ */ t("span", { className: "text-neutral-content/60 shrink-0 tracking-wide uppercase", children: f })
524
+ ] }) : /* @__PURE__ */ t("span", { className: "text-neutral-content/60", children: "Hover an icon to preview" }) })
525
+ ]
526
+ }
527
+ );
528
+ }
529
+ function Je({ d: e }) {
530
+ var a;
531
+ const r = (a = e.dialog.value) != null && a.startsWith("ref-image:") ? e.getMediaContent(e.pageMedia, e.dialog.value.replace("ref-image:", "")) : null;
532
+ return /* @__PURE__ */ t(
533
+ "div",
534
+ {
535
+ className: "flex flex-1 flex-col items-center justify-center gap-4 p-8",
536
+ role: "tabpanel",
537
+ id: "media-tabpanel",
538
+ "aria-labelledby": "media-tab",
539
+ "aria-label": "Media selection",
540
+ children: r ? /* @__PURE__ */ w(Q, { children: [
541
+ /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-4", children: /* @__PURE__ */ t(Be, { size: "video", bg: "neutral", relative: !0, children: /* @__PURE__ */ t("img", { src: r, alt: "Selected media", className: "size-full object-contain" }) }) }),
542
+ /* @__PURE__ */ t(
543
+ "button",
544
+ {
545
+ type: "button",
546
+ onClick: () => e.setShowMediaBrowser(!0),
547
+ className: "btn btn-primary",
548
+ "aria-label": "Change selected image",
549
+ children: "Change Image"
550
+ }
551
+ )
552
+ ] }) : /* @__PURE__ */ w(Q, { children: [
553
+ /* @__PURE__ */ t(_e, { size: 48, className: "text-neutral-content" }),
554
+ /* @__PURE__ */ t("p", { className: "text-neutral-content text-center text-sm", children: "Select an image from your media library" }),
555
+ /* @__PURE__ */ t(
556
+ "button",
557
+ {
558
+ type: "button",
559
+ onClick: () => e.setShowMediaBrowser(!0),
560
+ className: "btn btn-primary",
561
+ "aria-label": "Browse media library",
562
+ children: "Browse Media"
563
+ }
564
+ )
565
+ ] })
566
+ }
567
+ );
568
+ }
569
+ function lt({
570
+ value: e,
571
+ prefix: r,
572
+ onChange: a,
573
+ onClose: c,
574
+ initialPosition: s,
575
+ defaultWidth: l,
576
+ defaultHeight: i
577
+ }) {
578
+ return /* @__PURE__ */ t(
579
+ Se,
580
+ {
581
+ isOpen: !0,
582
+ onClose: c,
583
+ title: "Select Icon",
584
+ storageKey: "icon-picker",
585
+ autoSize: !1,
586
+ defaultWidth: l,
587
+ defaultHeight: i,
588
+ minWidth: 320,
589
+ maxWidth: 640,
590
+ minHeight: 360,
591
+ initialPosition: s,
592
+ zIndex: Le,
593
+ children: /* @__PURE__ */ t(Qe, { value: e, prefix: r, onChange: a, onClose: c })
594
+ }
595
+ );
596
+ }
597
+ function Qe({ value: e, prefix: r, onChange: a, onClose: c }) {
598
+ const s = Ze({
599
+ value: e,
600
+ prefix: r,
601
+ isOpen: !0,
602
+ // body only mounts when panel open
603
+ onChange: a,
604
+ onClose: c
605
+ });
606
+ return s.isClient ? /* @__PURE__ */ w("div", { className: "flex h-full min-h-0 flex-col", children: [
607
+ /* @__PURE__ */ w(
608
+ "div",
609
+ {
610
+ className: "border-base-300 flex shrink-0 gap-4 border-b px-3",
611
+ role: "tablist",
612
+ "aria-label": "Icon selection tabs",
613
+ children: [
614
+ /* @__PURE__ */ t(
615
+ ue,
616
+ {
617
+ active: s.activeTab === "icons",
618
+ onClick: () => s.setActiveTab("icons"),
619
+ label: "Icons",
620
+ id: "icons"
621
+ }
622
+ ),
623
+ /* @__PURE__ */ t(
624
+ ue,
625
+ {
626
+ active: s.activeTab === "media",
627
+ onClick: () => s.setActiveTab("media"),
628
+ label: "Media",
629
+ id: "media"
630
+ }
631
+ )
632
+ ]
633
+ }
634
+ ),
635
+ s.activeTab === "icons" && /* @__PURE__ */ t(qe, { d: s }),
636
+ s.activeTab === "media" && /* @__PURE__ */ t(Je, { d: s }),
637
+ s.showMediaBrowser && /* @__PURE__ */ t(
638
+ Me,
639
+ {
640
+ isOpen: s.showMediaBrowser,
641
+ onClose: () => s.setShowMediaBrowser(!1),
642
+ onSelect: s.handleMediaSelect,
643
+ selectionMode: !0
644
+ }
645
+ )
646
+ ] }) : null;
647
+ }
648
+ function ue({
649
+ active: e,
650
+ onClick: r,
651
+ label: a,
652
+ id: c
653
+ }) {
654
+ return /* @__PURE__ */ t(
655
+ "button",
656
+ {
657
+ onClick: r,
658
+ className: `relative cursor-pointer py-2 text-xs font-medium transition-colors ${e ? "text-base-content after:bg-base-content after:absolute after:inset-x-0 after:-bottom-px after:h-px after:content-['']" : "text-neutral-content hover:text-base-content"}`,
659
+ role: "tab",
660
+ "aria-selected": e,
661
+ "aria-controls": `${c}-tabpanel`,
662
+ id: `${c}-tab`,
663
+ tabIndex: e ? 0 : -1,
664
+ children: a
665
+ }
666
+ );
667
+ }
668
+ export {
669
+ lt as default
670
+ };