@oneclick.dev/cms-core-modules 0.0.126 → 0.0.127

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.
@@ -1,11 +1,11 @@
1
- import { defineComponent as ne, inject as pt, resolveComponent as m, openBlock as b, createBlock as R, withCtx as c, createVNode as r, createElementVNode as p, createTextVNode as P, isRef as Y, unref as g, createElementBlock as k, toDisplayString as z, createCommentVNode as F, computed as G, watch as te, useTemplateRef as Ie, ref as L, nextTick as Re, Fragment as J, renderList as ce, withModifiers as fe, onMounted as vt, normalizeClass as De, withKeys as hn, provide as Pt, withAsyncContext as yn } from "vue";
2
- import { u as Ee, a as B, t as xn, b as Dn } from "./vee-validate-zod-D0WaDgDZ.mjs";
1
+ import { defineComponent as ne, inject as pt, resolveComponent as m, openBlock as b, createBlock as R, withCtx as c, createVNode as r, createElementVNode as p, createTextVNode as P, isRef as Y, unref as g, createElementBlock as k, toDisplayString as z, createCommentVNode as F, computed as G, watch as te, useTemplateRef as Ne, ref as B, nextTick as Ue, Fragment as J, renderList as pe, withModifiers as ue, onMounted as vt, normalizeClass as ye, withKeys as hn, provide as Pt, withAsyncContext as yn } from "vue";
2
+ import { u as Ie, a as j, t as xn, b as Dn } from "./vee-validate-zod-D0WaDgDZ.mjs";
3
3
  import { Info as Sn, GripVertical as ut, CircleX as Cn, Trash2 as wn, PlusCircle as Nt, X as Rt, Loader2 as ft, Search as Tt, ListFilter as kn, ChevronDown as It, Ellipsis as Vn, ImagePlus as $t, Plus as Pn, CornerDownRight as Nn, Tag as Tn, ChevronRight as In, Archive as $n, Trash as En } from "lucide-vue-next";
4
4
  import { animations as Ut } from "@formkit/drag-and-drop";
5
5
  import { useConfirmation as Lt, useModuleRoute as Bt, useFirebaseIntegration as jt, useModulePermissions as Mn, useModuleBreadcrumbs as An } from "@oneclick.dev/cms-kit";
6
6
  import { g as zn } from "./google-CvtuJwgk.mjs";
7
7
  import { t as de } from "./index-RLz1QPrf.mjs";
8
- import { o as Ne, a as ye, s as X, p as Oe, c as xe, b as Fe, f as Et } from "./types-B5MifmeF.mjs";
8
+ import { p as we, c as ke, o as Ve, a as he, s as X, b as Re, f as Et } from "./types-B5MifmeF.mjs";
9
9
  const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn = {
10
10
  key: 0,
11
11
  class: "text-red-500 text-sm mt-1"
@@ -18,9 +18,9 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
18
18
  }, Yn = /* @__PURE__ */ ne({
19
19
  __name: "Main",
20
20
  setup(e) {
21
- const t = pt("sources"), n = pt("defaultSource"), { errors: o } = Ee(), { value: l } = B("title"), { value: s } = B("description"), { value: i } = B("media");
21
+ const t = pt("sources"), n = pt("defaultSource"), { errors: o } = Ie(), { value: l } = j("title"), { value: s } = j("description"), { value: i } = j("media");
22
22
  return (d, a) => {
23
- const x = m("Label"), v = m("Input"), f = m("Textarea"), D = m("MediaPicker"), C = m("CardContent"), N = m("Card");
23
+ const x = m("Label"), v = m("Input"), f = m("Textarea"), S = m("MediaPicker"), C = m("CardContent"), N = m("Card");
24
24
  return b(), R(N, null, {
25
25
  default: c(() => [
26
26
  r(C, { class: "flex flex-col gap-4" }, {
@@ -41,7 +41,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
41
41
  id: "title",
42
42
  placeholder: "T-shirt with red heart",
43
43
  modelValue: g(l),
44
- "onUpdate:modelValue": a[0] || (a[0] = (E) => Y(l) ? l.value = E : null)
44
+ "onUpdate:modelValue": a[0] || (a[0] = ($) => Y(l) ? l.value = $ : null)
45
45
  }, null, 8, ["modelValue"]),
46
46
  g(o).title ? (b(), k("p", Rn, z(g(o).title), 1)) : F("", !0)
47
47
  ])
@@ -61,7 +61,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
61
61
  id: "description",
62
62
  placeholder: "Lovely T-shirt featuring a red heart",
63
63
  modelValue: g(s),
64
- "onUpdate:modelValue": a[1] || (a[1] = (E) => Y(s) ? s.value = E : null)
64
+ "onUpdate:modelValue": a[1] || (a[1] = ($) => Y(s) ? s.value = $ : null)
65
65
  }, null, 8, ["modelValue"]),
66
66
  g(o).description ? (b(), k("p", Bn, z(g(o).description), 1)) : F("", !0)
67
67
  ])
@@ -77,10 +77,10 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
77
77
  ])]),
78
78
  _: 1
79
79
  }),
80
- r(D, {
80
+ r(S, {
81
81
  id: "media",
82
82
  modelValue: g(i),
83
- "onUpdate:modelValue": a[2] || (a[2] = (E) => Y(i) ? i.value = E : null),
83
+ "onUpdate:modelValue": a[2] || (a[2] = ($) => Y(i) ? i.value = $ : null),
84
84
  sources: g(t),
85
85
  defaultSource: g(n)
86
86
  }, null, 8, ["modelValue", "sources", "defaultSource"]),
@@ -107,10 +107,12 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
107
107
  }, oo = /* @__PURE__ */ ne({
108
108
  __name: "Price",
109
109
  setup(e) {
110
- const { errors: t } = Ee(), { value: n } = B("price"), { value: o } = B("compareAtPrice"), { value: l } = B("isTaxable"), { value: s } = B("costPerItem");
111
- return G(() => Number(n.value) > 0), (i, d) => {
112
- const a = m("Label"), x = m("Input"), v = m("TooltipTrigger"), f = m("TooltipContent"), D = m("Tooltip"), C = m("Checkbox"), N = m("CardContent"), E = m("Card");
113
- return b(), R(E, null, {
110
+ const { errors: t } = Ie(), { value: n } = j("price"), { value: o } = j("compareAtPrice"), { value: l } = j("isTaxable"), { value: s } = j("costPerItem");
111
+ return G(
112
+ () => n.value != null && String(n.value).trim() !== "" && Number.isFinite(Number(n.value)) && Number(n.value) >= 0
113
+ ), (i, d) => {
114
+ const a = m("Label"), x = m("Input"), v = m("TooltipTrigger"), f = m("TooltipContent"), S = m("Tooltip"), C = m("Checkbox"), N = m("CardContent"), $ = m("Card");
115
+ return b(), R($, null, {
114
116
  default: c(() => [
115
117
  r(N, null, {
116
118
  default: c(() => [
@@ -129,10 +131,11 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
129
131
  p("div", Gn, [
130
132
  r(x, {
131
133
  type: "number",
134
+ min: "0",
132
135
  id: "price",
133
136
  class: "pl-10 no-spinner",
134
137
  modelValue: g(n),
135
- "onUpdate:modelValue": d[0] || (d[0] = (M) => Y(n) ? n.value = M : null)
138
+ "onUpdate:modelValue": d[0] || (d[0] = (A) => Y(n) ? n.value = A : null)
136
139
  }, null, 8, ["modelValue"]),
137
140
  d[5] || (d[5] = p("span", { class: "absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }, "€", -1))
138
141
  ]),
@@ -154,10 +157,10 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
154
157
  id: "compare-at-price",
155
158
  class: "pl-10 no-spinner",
156
159
  modelValue: g(o),
157
- "onUpdate:modelValue": d[1] || (d[1] = (M) => Y(o) ? o.value = M : null)
160
+ "onUpdate:modelValue": d[1] || (d[1] = (A) => Y(o) ? o.value = A : null)
158
161
  }, null, 8, ["modelValue"]),
159
162
  d[8] || (d[8] = p("span", { class: "absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }, "€", -1)),
160
- r(D, null, {
163
+ r(S, null, {
161
164
  default: c(() => [
162
165
  r(v, { "as-child": "" }, {
163
166
  default: c(() => [
@@ -190,7 +193,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
190
193
  r(C, {
191
194
  id: "charge-tax",
192
195
  modelValue: g(l),
193
- "onUpdate:modelValue": d[2] || (d[2] = (M) => Y(l) ? l.value = M : null)
196
+ "onUpdate:modelValue": d[2] || (d[2] = (A) => Y(l) ? l.value = A : null)
194
197
  }, null, 8, ["modelValue"]),
195
198
  r(a, {
196
199
  for: "charge-tax",
@@ -219,7 +222,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
219
222
  id: "cost-per-item",
220
223
  class: "pl-10 no-spinner",
221
224
  modelValue: g(s),
222
- "onUpdate:modelValue": d[3] || (d[3] = (M) => Y(s) ? s.value = M : null)
225
+ "onUpdate:modelValue": d[3] || (d[3] = (A) => Y(s) ? s.value = A : null)
223
226
  }, null, 8, ["modelValue"]),
224
227
  d[11] || (d[11] = p("span", { class: "absolute left-4 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none" }, "€", -1))
225
228
  ]),
@@ -240,17 +243,17 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
240
243
  }, so = { class: "flex items-center gap-2" }, io = /* @__PURE__ */ ne({
241
244
  __name: "Inventory",
242
245
  setup(e) {
243
- const { errors: t } = Ee(), { value: n } = B("sku"), { value: o } = B("barcode"), { value: l } = B("trackInventory"), { value: s } = B("allowBackorder"), { value: i } = B("stock"), { value: d } = B("options"), { value: a } = B("variants"), x = G(() => a.value.reduce((v, f) => f.stock < 0 ? v : v + f.stock, 0));
246
+ const { errors: t } = Ie(), { value: n } = j("sku"), { value: o } = j("barcode"), { value: l } = j("trackInventory"), { value: s } = j("allowBackorder"), { value: i } = j("stock"), { value: d } = j("options"), { value: a } = j("variants"), x = G(() => a.value.reduce((v, f) => f.stock < 0 ? v : v + f.stock, 0));
244
247
  return (v, f) => {
245
- const D = m("Label"), C = m("Input"), N = m("Checkbox"), E = m("TooltipTrigger"), M = m("TooltipContent"), A = m("Tooltip"), S = m("CardContent"), w = m("Card");
246
- return b(), R(w, null, {
248
+ const S = m("Label"), C = m("Input"), N = m("Checkbox"), $ = m("TooltipTrigger"), A = m("TooltipContent"), E = m("Tooltip"), V = m("CardContent"), D = m("Card");
249
+ return b(), R(D, null, {
247
250
  default: c(() => [
248
- r(S, null, {
251
+ r(V, null, {
249
252
  default: c(() => [
250
253
  f[12] || (f[12] = p("h3", { class: "text-lg font-semibold mb-4" }, "Inventory", -1)),
251
254
  p("div", lo, [
252
255
  p("div", null, [
253
- r(D, {
256
+ r(S, {
254
257
  for: "sku",
255
258
  class: "text-sm mb-2"
256
259
  }, {
@@ -266,7 +269,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
266
269
  }, null, 8, ["modelValue"])
267
270
  ]),
268
271
  p("div", null, [
269
- r(D, {
272
+ r(S, {
270
273
  for: "barcode",
271
274
  class: "text-sm mb-2"
272
275
  }, {
@@ -288,7 +291,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
288
291
  modelValue: g(l),
289
292
  "onUpdate:modelValue": f[2] || (f[2] = (U) => Y(l) ? l.value = U : null)
290
293
  }, null, 8, ["modelValue"]),
291
- r(D, {
294
+ r(S, {
292
295
  for: "track-quantity",
293
296
  class: "text-sm"
294
297
  }, {
@@ -300,7 +303,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
300
303
  ]),
301
304
  g(l) ? (b(), k("div", ao, [
302
305
  p("div", null, [
303
- r(D, {
306
+ r(S, {
304
307
  for: "stock",
305
308
  class: "text-sm mb-2"
306
309
  }, {
@@ -316,9 +319,9 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
316
319
  modelValue: g(i),
317
320
  "onUpdate:modelValue": f[3] || (f[3] = (U) => Y(i) ? i.value = U : null),
318
321
  class: "no-spinner"
319
- }, null, 8, ["modelValue"])) : (b(), R(A, { key: 1 }, {
322
+ }, null, 8, ["modelValue"])) : (b(), R(E, { key: 1 }, {
320
323
  default: c(() => [
321
- r(E, { class: "cursor-not-allowed" }, {
324
+ r($, { class: "cursor-not-allowed" }, {
322
325
  default: c(() => [
323
326
  r(C, {
324
327
  modelValue: x.value,
@@ -329,7 +332,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
329
332
  ]),
330
333
  _: 1
331
334
  }),
332
- r(M, null, {
335
+ r(A, null, {
333
336
  default: c(() => [...f[10] || (f[10] = [
334
337
  p("p", null, "Total stock of all variants", -1)
335
338
  ])]),
@@ -346,7 +349,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
346
349
  modelValue: g(s),
347
350
  "onUpdate:modelValue": f[5] || (f[5] = (U) => Y(s) ? s.value = U : null)
348
351
  }, null, 8, ["modelValue"]),
349
- r(D, {
352
+ r(S, {
350
353
  for: "continue-selling",
351
354
  class: "text-sm"
352
355
  }, {
@@ -370,19 +373,19 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
370
373
  }, po = /* @__PURE__ */ ne({
371
374
  __name: "Shipping",
372
375
  setup(e) {
373
- const { errors: t } = Ee(), { value: n } = B("isPhysicalProduct"), { value: o } = B("weight"), { value: l } = B("weightUnit");
376
+ const { errors: t } = Ie(), { value: n } = j("isPhysicalProduct"), { value: o } = j("weight"), { value: l } = j("weightUnit");
374
377
  return (s, i) => {
375
- const d = m("Checkbox"), a = m("Label"), x = m("Input"), v = m("SelectValue"), f = m("SelectTrigger"), D = m("SelectItem"), C = m("SelectGroup"), N = m("SelectContent"), E = m("Select"), M = m("CardContent"), A = m("Card");
376
- return b(), R(A, null, {
378
+ const d = m("Checkbox"), a = m("Label"), x = m("Input"), v = m("SelectValue"), f = m("SelectTrigger"), S = m("SelectItem"), C = m("SelectGroup"), N = m("SelectContent"), $ = m("Select"), A = m("CardContent"), E = m("Card");
379
+ return b(), R(E, null, {
377
380
  default: c(() => [
378
- r(M, null, {
381
+ r(A, null, {
379
382
  default: c(() => [
380
383
  i[10] || (i[10] = p("h3", { class: "text-lg font-semibold mb-4" }, "Shipping", -1)),
381
384
  p("div", uo, [
382
385
  r(d, {
383
386
  id: "is-physical-product",
384
387
  modelValue: g(n),
385
- "onUpdate:modelValue": i[0] || (i[0] = (S) => Y(n) ? n.value = S : null)
388
+ "onUpdate:modelValue": i[0] || (i[0] = (V) => Y(n) ? n.value = V : null)
386
389
  }, null, 8, ["modelValue"]),
387
390
  r(a, {
388
391
  for: "is-physical-product",
@@ -409,7 +412,7 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
409
412
  id: "weight",
410
413
  type: "number",
411
414
  modelValue: g(o),
412
- "onUpdate:modelValue": i[1] || (i[1] = (S) => Y(o) ? o.value = S : null),
415
+ "onUpdate:modelValue": i[1] || (i[1] = (V) => Y(o) ? o.value = V : null),
413
416
  class: "no-spinner"
414
417
  }, null, 8, ["modelValue"])
415
418
  ]),
@@ -423,9 +426,9 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
423
426
  ])]),
424
427
  _: 1
425
428
  }),
426
- r(E, {
429
+ r($, {
427
430
  modelValue: g(l),
428
- "onUpdate:modelValue": i[2] || (i[2] = (S) => Y(l) ? l.value = S : null)
431
+ "onUpdate:modelValue": i[2] || (i[2] = (V) => Y(l) ? l.value = V : null)
429
432
  }, {
430
433
  default: c(() => [
431
434
  r(f, null, {
@@ -438,25 +441,25 @@ const On = { class: "flex flex-col gap-4" }, Fn = { class: "flex flex-col" }, Rn
438
441
  default: c(() => [
439
442
  r(C, null, {
440
443
  default: c(() => [
441
- r(D, { value: "lb" }, {
444
+ r(S, { value: "lb" }, {
442
445
  default: c(() => [...i[6] || (i[6] = [
443
446
  P(" lb ", -1)
444
447
  ])]),
445
448
  _: 1
446
449
  }),
447
- r(D, { value: "oz" }, {
450
+ r(S, { value: "oz" }, {
448
451
  default: c(() => [...i[7] || (i[7] = [
449
452
  P(" oz ", -1)
450
453
  ])]),
451
454
  _: 1
452
455
  }),
453
- r(D, { value: "kg" }, {
456
+ r(S, { value: "kg" }, {
454
457
  default: c(() => [...i[8] || (i[8] = [
455
458
  P(" kg ", -1)
456
459
  ])]),
457
460
  _: 1
458
461
  }),
459
- r(D, { value: "g" }, {
462
+ r(S, { value: "g" }, {
460
463
  default: c(() => [...i[9] || (i[9] = [
461
464
  P(" g ", -1)
462
465
  ])]),
@@ -503,7 +506,7 @@ var [Xt, Yt] = Ht();
503
506
  function fo(e, t) {
504
507
  return e.source === t.source && e.flags.split("").sort().join("") === t.flags.split("").sort().join("");
505
508
  }
506
- function Ue(e, t, n = !0, o = ["__key"]) {
509
+ function Le(e, t, n = !0, o = ["__key"]) {
507
510
  if (e === t) return !0;
508
511
  if (typeof t == "object" && typeof e == "object" && e !== null && t !== null) {
509
512
  if (e instanceof Map || e instanceof Set) return !1;
@@ -517,7 +520,7 @@ function Ue(e, t, n = !0, o = ["__key"]) {
517
520
  for (const i of o)
518
521
  if ((i in l || i in s) && l[i] !== s[i]) return !1;
519
522
  for (const i in l)
520
- if (!(i in s) || l[i] !== s[i] && !n || n && !Ue(l[i], s[i], n, o)) return !1;
523
+ if (!(i in s) || l[i] !== s[i] && !n || n && !Le(l[i], s[i], n, o)) return !1;
521
524
  return !0;
522
525
  }
523
526
  return !1;
@@ -525,11 +528,11 @@ function Ue(e, t, n = !0, o = ["__key"]) {
525
528
  function Kt(e) {
526
529
  return e.split(" ").filter((t) => t);
527
530
  }
528
- function Me(e) {
531
+ function $e(e) {
529
532
  return { x: e.clientX, y: e.clientY };
530
533
  }
531
534
  Array();
532
- var bt = typeof window < "u", Z = /* @__PURE__ */ new WeakMap(), ue = /* @__PURE__ */ new WeakMap();
535
+ var bt = typeof window < "u", Z = /* @__PURE__ */ new WeakMap(), ce = /* @__PURE__ */ new WeakMap();
533
536
  function Gt() {
534
537
  if (!bt) return !1;
535
538
  if ("userAgentData" in navigator)
@@ -617,7 +620,7 @@ function qt(e) {
617
620
  return Object.assign(_, e), e.initialParent.data.emit("dragStarted", _), me = !1, _.emit("dragStarted", _), _;
618
621
  }
619
622
  function vo() {
620
- _.activeState && Ce(_.activeState.parent, void 0, _), _.selectedState && Se(_.selectedState.nodes, _.selectedState.parent, _), _.selectedState = _.activeState = void 0;
623
+ _.activeState && De(_.activeState.parent, void 0, _), _.selectedState && xe(_.selectedState.nodes, _.selectedState.parent, _), _.selectedState = _.activeState = void 0;
621
624
  }
622
625
  function bo() {
623
626
  if (_.pointerDown && (_.pointerDown.node.el.draggable = !0), _.pointerDown = void 0, !re(_)) return;
@@ -625,7 +628,7 @@ function bo() {
625
628
  re(_) && e.handleEnd(_);
626
629
  }
627
630
  function _o(e) {
628
- e.key === "Escape" && (_.selectedState && Se(_.selectedState.nodes, _.selectedState.parent, _), _.activeState && Ce(_.activeState.parent, void 0, _), _.selectedState = _.activeState = void 0);
631
+ e.key === "Escape" && (_.selectedState && xe(_.selectedState.nodes, _.selectedState.parent, _), _.activeState && De(_.activeState.parent, void 0, _), _.selectedState = _.activeState = void 0);
629
632
  }
630
633
  function ho(e) {
631
634
  if (!ee(_)) return;
@@ -636,8 +639,8 @@ function ho(e) {
636
639
  function yo(e) {
637
640
  if (!ee(_)) return;
638
641
  Q(e);
639
- const { x: t, y: n } = Me(e);
640
- ee(_) && Je({ x: t, y: n }, e, _);
642
+ const { x: t, y: n } = $e(e);
643
+ ee(_) && Qe({ x: t, y: n }, e, _);
641
644
  }
642
645
  function xo(e) {
643
646
  if (!_.pointerDown || !_.pointerDown.validated) return;
@@ -670,7 +673,7 @@ function Do({
670
673
  config: o = {}
671
674
  }) {
672
675
  if (!bt) return;
673
- Mt || (Mt = Ke(document, {
676
+ Mt || (Mt = Je(document, {
674
677
  dragover: yo,
675
678
  pointerdown: vo,
676
679
  pointerup: bo,
@@ -741,10 +744,10 @@ function Do({
741
744
  a(e)?.tearDown?.();
742
745
  }), o.plugins?.forEach((a) => {
743
746
  a(e)?.setup?.();
744
- }), Po(e, i), Ge(e, !0);
747
+ }), Po(e, i), We(e, !0);
745
748
  }
746
749
  function Jt(e, t, n, o, l, s) {
747
- const { x: i, y: d } = Me(n), a = e.el.getBoundingClientRect();
750
+ const { x: i, y: d } = $e(n), a = e.el.getBoundingClientRect();
748
751
  return {
749
752
  affectedNodes: [],
750
753
  ascendingDirection: !1,
@@ -783,9 +786,9 @@ function So({
783
786
  draggedNodes: t,
784
787
  targetNodes: n
785
788
  }) {
786
- Ge(e.el);
787
- const o = t.map((a) => a.data.value), l = $e(e.el, e.data), s = t[0].data.index, i = [...e.data.enabledNodes], d = [
788
- ...l.filter((a) => !o.some((x) => Ue(a, x)))
789
+ We(e.el);
790
+ const o = t.map((a) => a.data.value), l = Te(e.el, e.data), s = t[0].data.index, i = [...e.data.enabledNodes], d = [
791
+ ...l.filter((a) => !o.some((x) => Le(a, x)))
789
792
  ];
790
793
  d.splice(n[0].data.index, 0, ...o), "draggedNode" in _ && (_.currentTargetValue = n[0].data.value), gt(e.el, e.data, [...d]), e.data.config.onSort && e.data.config.onSort({
791
794
  parent: {
@@ -803,7 +806,7 @@ function So({
803
806
  state: _
804
807
  });
805
808
  }
806
- function Ce(e, t, n) {
809
+ function De(e, t, n) {
807
810
  if (!t) {
808
811
  n.activeState = void 0;
809
812
  return;
@@ -813,7 +816,7 @@ function Ce(e, t, n) {
813
816
  parent: e
814
817
  };
815
818
  }
816
- function Se(e, t, n) {
819
+ function xe(e, t, n) {
817
820
  const o = t.data.config.selectedClass;
818
821
  if (!n.selectedState) return;
819
822
  const l = Array.from(e);
@@ -827,18 +830,18 @@ function Se(e, t, n) {
827
830
  i !== -1 && n.selectedState.nodes.splice(i, 1);
828
831
  }
829
832
  }
830
- function Xe(e, t, n, o, l = !1) {
833
+ function Ge(e, t, n, o, l = !1) {
831
834
  o.pointerSelection = l;
832
835
  for (const s of t)
833
- s.el.setAttribute("aria-selected", "true"), Te([s.el], e.data.config.selectedClass, !0);
836
+ s.el.setAttribute("aria-selected", "true"), Pe([s.el], e.data.config.selectedClass, !0);
834
837
  o.selectedState = {
835
838
  nodes: t,
836
839
  parent: e
837
- }, Ce(e, n, o);
840
+ }, De(e, n, o);
838
841
  }
839
842
  function Co(e, t) {
840
843
  const n = e.targetData.parent.data.enabledNodes[0];
841
- n && (t.selectedState && t.selectedState.parent.el !== e.targetData.parent.el ? Ce(e.targetData.parent, n, t) : t.selectedState || Ce(e.targetData.parent, n, t));
844
+ n && (t.selectedState && t.selectedState.parent.el !== e.targetData.parent.el ? De(e.targetData.parent, n, t) : t.selectedState || De(e.targetData.parent, n, t));
842
845
  }
843
846
  function wo({
844
847
  currentParent: e,
@@ -849,12 +852,12 @@ function wo({
849
852
  targetNodes: s,
850
853
  state: i
851
854
  }) {
852
- Ge(n.el);
853
- const d = o.map((D) => D.data.value), a = [
854
- ...$e(e.el, e.data).filter(
855
- (D) => !d.some((C) => Ue(D, C))
855
+ We(n.el);
856
+ const d = o.map((S) => S.data.value), a = [
857
+ ...Te(e.el, e.data).filter(
858
+ (S) => !d.some((C) => Le(S, C))
856
859
  )
857
- ], x = $e(t.el, t.data), v = n.el === t.el && t.data.config.sortable === !1;
860
+ ], x = Te(t.el, t.data), v = n.el === t.el && t.data.config.sortable === !1;
858
861
  let f;
859
862
  s.length ? (v ? f = l : t.data.config.sortable === !1 ? f = t.data.enabledNodes.length : f = s[0].data.index, x.splice(f, 0, ...d)) : (f = v ? l : t.data.enabledNodes.length, x.splice(f, 0, ...d)), gt(e.el, e.data, a), gt(t.el, t.data, x), t.data.config.onTransfer && t.data.config.onTransfer({
860
863
  sourceParent: e,
@@ -874,7 +877,7 @@ function wo({
874
877
  targetNodes: s || []
875
878
  });
876
879
  }
877
- function $e(e, t) {
880
+ function Te(e, t) {
878
881
  return [...t.getValues(e)];
879
882
  }
880
883
  function gt(e, t, n) {
@@ -896,30 +899,30 @@ function re(e) {
896
899
  return "synthDragging" in e && !!e.synthDragging;
897
900
  }
898
901
  function Po(e, t) {
899
- t.abortControllers.mainParent = Ke(e, {
900
- dragover: Ye(t.config.handleParentDragover),
902
+ t.abortControllers.mainParent = Je(e, {
903
+ dragover: qe(t.config.handleParentDragover),
901
904
  handleParentPointerover: t.config.handleParentPointerover,
902
- scroll: Ye(t.config.handleParentScroll),
903
- drop: Ye(t.config.handleParentDrop),
905
+ scroll: qe(t.config.handleParentScroll),
906
+ drop: qe(t.config.handleParentDrop),
904
907
  hasNestedParent: (n) => {
905
908
  const o = Z.get(n.target);
906
909
  o && (o.nestedParent = n.detail.parent);
907
910
  },
908
- focus: Ye(t.config.handleParentFocus)
909
- }), t.config.externalDragHandle && t.config.externalDragHandle.el && t.config.externalDragHandle.callback && (t.abortControllers.externalDragHandle = Ke(
911
+ focus: qe(t.config.handleParentFocus)
912
+ }), t.config.externalDragHandle && t.config.externalDragHandle.el && t.config.externalDragHandle.callback && (t.abortControllers.externalDragHandle = Je(
910
913
  t.config.externalDragHandle.el,
911
914
  {
912
915
  pointerdown: (n) => {
913
916
  if (!t.config.externalDragHandle || !t.config.externalDragHandle.callback)
914
917
  return;
915
918
  const o = t.config.externalDragHandle.callback();
916
- if (!We(o)) {
919
+ if (!et(o)) {
917
920
  console.warn(
918
921
  "No draggable item found from external drag handle callback"
919
922
  );
920
923
  return;
921
924
  }
922
- const l = ue.get(o);
925
+ const l = ce.get(o);
923
926
  if (!l) return;
924
927
  const s = o.parentNode;
925
928
  if (!(s instanceof HTMLElement)) return;
@@ -941,7 +944,7 @@ function Po(e, t) {
941
944
  }
942
945
  function No(e) {
943
946
  const t = e.parent.data.config;
944
- e.node.data.abortControllers.mainNode = Ke(e.node.el, {
947
+ e.node.data.abortControllers.mainNode = Je(e.node.el, {
945
948
  keydown: le(t.handleNodeKeydown),
946
949
  dragstart: le(t.handleDragstart),
947
950
  dragover: le(t.handleNodeDragover),
@@ -966,14 +969,14 @@ function No(e) {
966
969
  });
967
970
  }
968
971
  function Wt(e) {
969
- ue.set(e.node.el, e.node.data), e.parent.data.config.plugins?.forEach((t) => {
972
+ ce.set(e.node.el, e.node.data), e.parent.data.config.plugins?.forEach((t) => {
970
973
  t(e.parent.el)?.setupNodeRemap?.(e);
971
974
  });
972
975
  }
973
976
  function To(e, t) {
974
977
  if (!ee(_)) return;
975
978
  const n = re(_) ? t.config.synthDropZoneClass : t.config.dropZoneClass;
976
- _.draggedNode.el === e && Te([e], n, !0);
979
+ _.draggedNode.el === e && Pe([e], n, !0);
977
980
  }
978
981
  function Io(e) {
979
982
  e.parent.data.config.plugins?.forEach((t) => {
@@ -989,17 +992,17 @@ function Eo(e) {
989
992
  if (e.length === 1 && e[0].addedNodes.length === 1 && !(e[0].addedNodes[0] instanceof HTMLElement))
990
993
  return;
991
994
  const t = e[0].target;
992
- !(t instanceof HTMLElement) || !Z.get(t) || Ge(t);
995
+ !(t instanceof HTMLElement) || !Z.get(t) || We(t);
993
996
  }
994
- function Ge(e, t) {
997
+ function We(e, t) {
995
998
  const n = Z.get(e);
996
999
  if (!n) return;
997
1000
  n.privateClasses = Array.from(e.classList);
998
1001
  const o = [], l = n.config;
999
1002
  for (let d = 0; d < e.children.length; d++) {
1000
1003
  const a = e.children[d];
1001
- if (!We(a) || a.id === "dnd-dragged-node-clone") continue;
1002
- const x = ue.get(a);
1004
+ if (!et(a) || a.id === "dnd-dragged-node-clone") continue;
1005
+ const x = ce.get(a);
1003
1006
  (t || !x) && l.tearDownNode({
1004
1007
  parent: {
1005
1008
  el: e,
@@ -1019,7 +1022,7 @@ function Ge(e, t) {
1019
1022
  }
1020
1023
  const s = n.getValues(e), i = [];
1021
1024
  for (let d = 0; d < o.length; d++) {
1022
- const a = o[d], x = ue.get(a);
1025
+ const a = o[d], x = ce.get(a);
1023
1026
  if (l.draggableValue && !l.draggableValue(s[d])) continue;
1024
1027
  const v = Object.assign(
1025
1028
  x ?? {
@@ -1031,7 +1034,7 @@ function Ge(e, t) {
1031
1034
  index: d
1032
1035
  }
1033
1036
  );
1034
- if (!ee(_) && _.activeState && Ue(_.activeState.node.data.value, v.value) && Ce(
1037
+ if (!ee(_) && _.activeState && Le(_.activeState.node.data.value, v.value) && De(
1035
1038
  {
1036
1039
  data: n,
1037
1040
  el: e
@@ -1041,10 +1044,10 @@ function Ge(e, t) {
1041
1044
  data: v
1042
1045
  },
1043
1046
  _
1044
- ), ee(_) && Ue(_.draggedNode.data.value, v.value)) {
1047
+ ), ee(_) && Le(_.draggedNode.data.value, v.value)) {
1045
1048
  _.draggedNode.data = v, _.draggedNode.el = a;
1046
1049
  const f = _.draggedNodes.find(
1047
- (D) => D.data.value === v.value
1050
+ (S) => S.data.value === v.value
1048
1051
  );
1049
1052
  f && (f.el = a);
1050
1053
  }
@@ -1118,7 +1121,7 @@ function Fo(e, t) {
1118
1121
  if (n.onDragstart) {
1119
1122
  const s = {
1120
1123
  parent: e.targetData.parent,
1121
- values: $e(
1124
+ values: Te(
1122
1125
  e.targetData.parent.el,
1123
1126
  e.targetData.parent.data
1124
1127
  ),
@@ -1151,7 +1154,7 @@ function Ro(e, t) {
1151
1154
  (a) => a.el === i.el
1152
1155
  ) === -1 ? o = [...t.selectedState.nodes, i] : o = t.selectedState.nodes.filter(
1153
1156
  (a) => a.el !== i.el
1154
- ) : o = [i], Xe(
1157
+ ) : o = [i], Ge(
1155
1158
  e.targetData.parent,
1156
1159
  o,
1157
1160
  e.targetData.node,
@@ -1164,7 +1167,7 @@ function Ro(e, t) {
1164
1167
  const d = e.targetData.parent.data.enabledNodes;
1165
1168
  if (t.selectedState && t.activeState)
1166
1169
  if (t.selectedState.parent.el !== e.targetData.parent.el) {
1167
- Se(t.selectedState.nodes, t.selectedState.parent, t), t.selectedState = void 0;
1170
+ xe(t.selectedState.nodes, t.selectedState.parent, t), t.selectedState = void 0;
1168
1171
  for (let a = 0; a <= i.data.index; a++)
1169
1172
  o.push(d[a]);
1170
1173
  } else {
@@ -1180,7 +1183,7 @@ function Ro(e, t) {
1180
1183
  else
1181
1184
  for (let a = 0; a <= i.data.index; a++)
1182
1185
  o.push(d[a]);
1183
- Xe(
1186
+ Ge(
1184
1187
  e.targetData.parent,
1185
1188
  o,
1186
1189
  e.targetData.node,
@@ -1191,13 +1194,13 @@ function Ro(e, t) {
1191
1194
  }
1192
1195
  t.selectedState?.nodes?.length ? t.selectedState.nodes.findIndex(
1193
1196
  (a) => a.el === e.targetData.node.el
1194
- ) === -1 && (t.selectedState.parent.el !== e.targetData.parent.el ? Se(t.selectedState.nodes, e.targetData.parent, t) : n.config.multiDrag && Gt() ? o.push(...t.selectedState.nodes) : Se(t.selectedState.nodes, e.targetData.parent, t), Xe(
1197
+ ) === -1 && (t.selectedState.parent.el !== e.targetData.parent.el ? xe(t.selectedState.nodes, e.targetData.parent, t) : n.config.multiDrag && Gt() ? o.push(...t.selectedState.nodes) : xe(t.selectedState.nodes, e.targetData.parent, t), Ge(
1195
1198
  e.targetData.parent,
1196
1199
  o,
1197
1200
  e.targetData.node,
1198
1201
  t,
1199
1202
  !0
1200
- )) : Xe(
1203
+ )) : Ge(
1201
1204
  e.targetData.parent,
1202
1205
  [e.targetData.node],
1203
1206
  e.targetData.node,
@@ -1206,17 +1209,17 @@ function Ro(e, t) {
1206
1209
  );
1207
1210
  }
1208
1211
  function Uo(e, t, n, o = !1) {
1209
- Te(
1212
+ Pe(
1210
1213
  t.map((l) => l.el),
1211
1214
  o ? n.synthDraggingClass : n.draggingClass
1212
1215
  ), setTimeout(() => {
1213
1216
  ge(
1214
1217
  t.map((l) => l.el),
1215
1218
  o ? n.synthDraggingClass : n.draggingClass
1216
- ), Te(
1219
+ ), Pe(
1217
1220
  t.map((l) => l.el),
1218
1221
  o ? n.synthDragPlaceholderClass : n.dragPlaceholderClass
1219
- ), Te(
1222
+ ), Pe(
1220
1223
  t.map((l) => l.el),
1221
1224
  o ? n.synthDropZoneClass : n.dropZoneClass
1222
1225
  ), ge(
@@ -1299,7 +1302,7 @@ function Zt({
1299
1302
  function Bo(e) {
1300
1303
  }
1301
1304
  function jo(e) {
1302
- e.detail.targetData.parent.el === e.detail.state.currentParent.el ? en(e.detail, e.detail.state) : qe(e.detail, e.detail.state);
1305
+ e.detail.targetData.parent.el === e.detail.state.currentParent.el ? en(e.detail, e.detail.state) : Ze(e.detail, e.detail.state);
1303
1306
  }
1304
1307
  function Ho(e, t) {
1305
1308
  const n = e.targetData.parent.data.config;
@@ -1330,7 +1333,7 @@ function Go(e, t) {
1330
1333
  const n = Z.get(t.initialParent.el)?.config;
1331
1334
  n?.onDragend && n.onDragend({
1332
1335
  parent: t.currentParent,
1333
- values: $e(t.currentParent.el, t.currentParent.data),
1336
+ values: Te(t.currentParent.el, t.currentParent.data),
1334
1337
  draggedNode: t.draggedNode,
1335
1338
  draggedNodes: t.draggedNodes,
1336
1339
  state: t
@@ -1341,11 +1344,11 @@ function qo(e) {
1341
1344
  const t = e.draggedNodes.map((v) => v.el), n = e.initialParent.data, o = re(e), l = Z.get(e.initialParent.el)?.config, s = o ? l?.synthDropZoneClass : l?.dropZoneClass, i = n?.config?.longPressClass, d = o ? n?.config?.synthDragPlaceholderClass : n?.config?.dragPlaceholderClass, a = e.originalZIndex;
1342
1345
  re(e) && (e.clonedDraggedNode && e.clonedDraggedNode.remove(), e.longPressTimeout && clearTimeout(e.longPressTimeout)), mt(e), e.lastScrollDirectionX = void 0, e.lastScrollDirectionY = void 0, e.preventEnter = !1, e.scrollDebounceTimeout && (clearTimeout(e.scrollDebounceTimeout), e.scrollDebounceTimeout = void 0), a !== void 0 && e.draggedNode && (e.draggedNode.el.style.zIndex = a), requestAnimationFrame(() => {
1343
1346
  ge(t, s), ge(t, i), ge(t, d);
1344
- }), Se(e.draggedNodes, e.currentParent, e), Ce(e.currentParent, void 0, e);
1347
+ }), xe(e.draggedNodes, e.currentParent, e), De(e.currentParent, void 0, e);
1345
1348
  const x = { ...e };
1346
1349
  l?.onDragend?.({
1347
1350
  parent: x.currentParent,
1348
- values: $e(
1351
+ values: Te(
1349
1352
  x.currentParent.el,
1350
1353
  x.currentParent.data
1351
1354
  ),
@@ -1355,7 +1358,7 @@ function qo(e) {
1355
1358
  }), e.emit("dragEnded", x), mo();
1356
1359
  }
1357
1360
  function Jo(e, t) {
1358
- ve(e.e), !t.pointerSelection && t.selectedState && Se(t.selectedState.nodes, e.targetData.parent, t);
1361
+ ve(e.e), !t.pointerSelection && t.selectedState && xe(t.selectedState.nodes, e.targetData.parent, t);
1359
1362
  const n = e.targetData.parent.data.config;
1360
1363
  t.pointerSelection = !1, "longPressTimeout" in t && t.longPressTimeout && clearTimeout(t.longPressTimeout), t.longPress = !1, ge(
1361
1364
  e.targetData.parent.data.enabledNodes.map((o) => o.el),
@@ -1393,12 +1396,12 @@ function Wo(e, t, n, o, l, s) {
1393
1396
  "height",
1394
1397
  "boxSizing",
1395
1398
  "overflow"
1396
- ], v = (N, E) => {
1397
- const M = window.getComputedStyle(N);
1398
- x.forEach((A) => {
1399
- E.style[A] = M[A];
1399
+ ], v = (N, $) => {
1400
+ const A = window.getComputedStyle(N);
1401
+ x.forEach((E) => {
1402
+ $.style[E] = A[E];
1400
1403
  });
1401
- }, f = (N, E = {}) => {
1404
+ }, f = (N, $ = {}) => {
1402
1405
  Object.assign(N.style, {
1403
1406
  position: "absolute",
1404
1407
  zIndex: "9999",
@@ -1409,7 +1412,7 @@ function Wo(e, t, n, o, l, s) {
1409
1412
  overflow: "hidden",
1410
1413
  width: `${s.width}px`,
1411
1414
  height: `${s.height}px`,
1412
- ...E
1415
+ ...$
1413
1416
  });
1414
1417
  };
1415
1418
  if (i.synthDragImage)
@@ -1418,13 +1421,13 @@ function Wo(e, t, n, o, l, s) {
1418
1421
  d = e.el.cloneNode(!0), v(e.el, d), d.setAttribute("popover", "manual"), f(d);
1419
1422
  else {
1420
1423
  const N = document.createElement("div");
1421
- N.setAttribute("popover", "manual"), l.forEach((E) => {
1422
- const M = E.el.cloneNode(!0);
1423
- v(E.el, M), M.style.pointerEvents = "none", M.style.margin = "0", N.append(M);
1424
+ N.setAttribute("popover", "manual"), l.forEach(($) => {
1425
+ const A = $.el.cloneNode(!0);
1426
+ v($.el, A), A.style.pointerEvents = "none", A.style.margin = "0", N.append(A);
1424
1427
  }), N.style.display = "flex", N.style.flexDirection = "column", N.style.padding = "0", N.style.margin = "0", N.style.position = "absolute", N.style.zIndex = "9999", N.style.pointerEvents = "none", d = N;
1425
1428
  }
1426
1429
  d.id = "dnd-dragged-node-clone", t.el.appendChild(d), d.showPopover();
1427
- const D = {
1430
+ const S = {
1428
1431
  clonedDraggedEls: [],
1429
1432
  clonedDraggedNode: d,
1430
1433
  synthDragScrolling: !1,
@@ -1441,13 +1444,13 @@ function Wo(e, t, n, o, l, s) {
1441
1444
  a?.offsetX,
1442
1445
  a?.offsetY
1443
1446
  ),
1444
- ...D
1447
+ ...S
1445
1448
  });
1446
1449
  }
1447
1450
  function Zo(e, t, n) {
1448
1451
  const o = e.targetData.parent.data.config;
1449
1452
  t.longPressTimeout = setTimeout(() => {
1450
- t && (t.longPress = !0, o.longPressClass && e.e.cancelable && Te([n.el], o.longPressClass), Q(e.e));
1453
+ t && (t.longPress = !0, o.longPressClass && e.e.cancelable && Pe([n.el], o.longPressClass), Q(e.e));
1451
1454
  }, o.longPressDuration || 1e3);
1452
1455
  }
1453
1456
  function mt(e, t = !0, n = !0) {
@@ -1461,9 +1464,9 @@ function Qt(e, t = !1) {
1461
1464
  ));
1462
1465
  }
1463
1466
  function At(e, t, n = !1) {
1464
- const o = Me(e);
1467
+ const o = $e(e);
1465
1468
  t.coordinates.x = o.x, t.coordinates.y = o.y, Qt(t, n), t.scrollDebounceTimeout && (clearTimeout(t.scrollDebounceTimeout), t.scrollDebounceTimeout = void 0), t.scrollDebounceTimeout = setTimeout(() => {
1466
- re(t) && Je(t.coordinates, e, t);
1469
+ re(t) && Qe(t.coordinates, e, t);
1467
1470
  }, 16);
1468
1471
  const l = il(o);
1469
1472
  if (!l) {
@@ -1494,17 +1497,17 @@ function At(e, t, n = !1) {
1494
1497
  }
1495
1498
  function Qo(e, t) {
1496
1499
  if (!e.targetData.parent.data.config.nativeDrag) return;
1497
- const { x: o, y: l } = Me(e.e);
1498
- t.coordinates.y = l, t.coordinates.x = o, Q(e.e), ve(e.e), ee(t) && Je({ x: o, y: l }, e.e, t), e.targetData.parent.el === t.currentParent?.el ? en(e, t) : qe(e, t);
1500
+ const { x: o, y: l } = $e(e.e);
1501
+ t.coordinates.y = l, t.coordinates.x = o, Q(e.e), ve(e.e), ee(t) && Qe({ x: o, y: l }, e.e, t), e.targetData.parent.el === t.currentParent?.el ? en(e, t) : Ze(e, t);
1499
1502
  }
1500
1503
  function el(e, t) {
1501
1504
  if (!e.targetData.parent.data.config.nativeDrag) return;
1502
1505
  Q(e.e), ve(e.e);
1503
- const { x: o, y: l } = Me(e.e);
1504
- ee(t) && Je({ x: o, y: l }, e.e, t), qe(e, t);
1506
+ const { x: o, y: l } = $e(e.e);
1507
+ ee(t) && Qe({ x: o, y: l }, e.e, t), Ze(e, t);
1505
1508
  }
1506
1509
  function tl(e) {
1507
- e.detail.targetData.parent.el !== e.detail.state.currentParent.el && qe(e.detail, e.detail.state);
1510
+ e.detail.targetData.parent.el !== e.detail.state.currentParent.el && Ze(e.detail, e.detail.state);
1508
1511
  }
1509
1512
  function nl({
1510
1513
  currentParent: e,
@@ -1564,7 +1567,7 @@ function rl(e, t, n, o) {
1564
1567
  return !1;
1565
1568
  }
1566
1569
  function en(e, t) {
1567
- const { x: n, y: o } = Me(e.e);
1570
+ const { x: n, y: o } = $e(e.e);
1568
1571
  if (!rl(e, t, n, o))
1569
1572
  return;
1570
1573
  const l = t.draggedNode.data.index > e.targetData.node.data.index ? [e.targetData.node.data.index, t.draggedNode.data.index] : [t.draggedNode.data.index, e.targetData.node.data.index];
@@ -1578,7 +1581,7 @@ function en(e, t) {
1578
1581
  }
1579
1582
  function le(e) {
1580
1583
  function t(n) {
1581
- const o = ue.get(n);
1584
+ const o = ce.get(n);
1582
1585
  if (!o) return;
1583
1586
  const l = Z.get(n.parentNode);
1584
1587
  if (l)
@@ -1605,7 +1608,7 @@ function le(e) {
1605
1608
  );
1606
1609
  };
1607
1610
  }
1608
- function qe(e, t) {
1611
+ function Ze(e, t) {
1609
1612
  Q(e.e), nl({
1610
1613
  currentParent: t.currentParent,
1611
1614
  targetParent: e.targetData.parent,
@@ -1622,7 +1625,7 @@ function qe(e, t) {
1622
1625
  targetNodes: "node" in e.targetData ? [e.targetData.node] : []
1623
1626
  }), t.currentParent = e.targetData.parent, t.transferred = !0);
1624
1627
  }
1625
- function Ye(e) {
1628
+ function qe(e) {
1626
1629
  function t(n) {
1627
1630
  const o = Z.get(n);
1628
1631
  if (o)
@@ -1645,12 +1648,12 @@ function Ye(e) {
1645
1648
  );
1646
1649
  };
1647
1650
  }
1648
- function Te(e, t, n = !1) {
1651
+ function Pe(e, t, n = !1) {
1649
1652
  function o(l, s) {
1650
- ue.set(l, s);
1653
+ ce.set(l, s);
1651
1654
  }
1652
1655
  for (const l of e) {
1653
- const s = ue.get(l), i = al(l, t, s, n);
1656
+ const s = ce.get(l), i = al(l, t, s, n);
1654
1657
  i && o(l, i);
1655
1658
  }
1656
1659
  }
@@ -1676,36 +1679,36 @@ function ge(e, t) {
1676
1679
  const n = Kt(t);
1677
1680
  if (n.length)
1678
1681
  for (const o of e) {
1679
- if (!We(o)) {
1682
+ if (!et(o)) {
1680
1683
  o.classList.remove(...n);
1681
1684
  continue;
1682
1685
  }
1683
- const l = ue.get(o) || Z.get(o);
1686
+ const l = ce.get(o) || Z.get(o);
1684
1687
  if (l)
1685
1688
  for (const s of n)
1686
1689
  l.privateClasses.includes(s) || o.classList.remove(s);
1687
1690
  }
1688
1691
  }
1689
1692
  function zt(e, t, n, o, l) {
1690
- const i = l.axis === "x", d = e === document.scrollingElement, a = i ? "scrollLeft" : "scrollTop", x = i ? "clientWidth" : "clientHeight", v = i ? "offsetWidth" : "offsetHeight", f = i ? "scrollWidth" : "scrollHeight", D = i ? t.clientX : t.clientY, C = i ? o.left : o.top, N = i ? n.overflowX : n.overflowY;
1693
+ const i = l.axis === "x", d = e === document.scrollingElement, a = i ? "scrollLeft" : "scrollTop", x = i ? "clientWidth" : "clientHeight", v = i ? "offsetWidth" : "offsetHeight", f = i ? "scrollWidth" : "scrollHeight", S = i ? t.clientX : t.clientY, C = i ? o.left : o.top, N = i ? n.overflowX : n.overflowY;
1691
1694
  if (d) {
1692
- const E = e[a], M = e[x], A = E > 0, S = E + M < (i ? l.state.rootScrollWidth || 0 : e[f]);
1695
+ const $ = e[a], A = e[x], E = $ > 0, V = $ + A < (i ? l.state.rootScrollWidth || 0 : e[f]);
1693
1696
  return i ? {
1694
- left: A && D < M * 0.075,
1695
- right: S && D > M * (1 - 0.075)
1697
+ left: E && S < A * 0.075,
1698
+ right: V && S > A * (1 - 0.075)
1696
1699
  } : {
1697
- up: A && D < M * 0.075,
1698
- down: S && D > M * (1 - 0.075)
1700
+ up: E && S < A * 0.075,
1701
+ down: V && S > A * (1 - 0.075)
1699
1702
  };
1700
1703
  }
1701
1704
  if ((N === "auto" || N === "scroll") && e !== document.body && e !== document.documentElement) {
1702
- const E = e[f], M = e[v], A = e[a], S = A > 0, w = A < E - M;
1705
+ const $ = e[f], A = e[v], E = e[a], V = E > 0, D = E < $ - A;
1703
1706
  return i ? {
1704
- left: S && D < C + M * 0.075,
1705
- right: w && D > C + M * (1 - 0.075)
1707
+ left: V && S < C + A * 0.075,
1708
+ right: D && S > C + A * (1 - 0.075)
1706
1709
  } : {
1707
- up: S && D < C + M * 0.075,
1708
- down: w && D > C + M * (1 - 0.075)
1710
+ up: V && S < C + A * 0.075,
1711
+ down: D && S > C + A * (1 - 0.075)
1709
1712
  };
1710
1713
  }
1711
1714
  return i ? { left: !1, right: !1 } : { up: !1, down: !1 };
@@ -1721,8 +1724,8 @@ function sl(e, t, n, o) {
1721
1724
  n[a] !== void 0 && (cancelAnimationFrame(n[a]), n[a] = void 0);
1722
1725
  return;
1723
1726
  }
1724
- const v = l ? "scrollLeft" : "scrollTop", f = l ? "clientWidth" : "clientHeight", D = l ? "scrollWidth" : "scrollHeight", C = e[v], N = e[f], E = e[D];
1725
- if (!(s > 0 ? C + N < E : C > 0)) {
1727
+ const v = l ? "scrollLeft" : "scrollTop", f = l ? "clientWidth" : "clientHeight", S = l ? "scrollWidth" : "scrollHeight", C = e[v], N = e[f], $ = e[S];
1728
+ if (!(s > 0 ? C + N < $ : C > 0)) {
1726
1729
  n[a] = void 0, n[d] = void 0;
1727
1730
  return;
1728
1731
  }
@@ -1734,7 +1737,7 @@ function Ot(e, t, n) {
1734
1737
  const o = e.getBoundingClientRect();
1735
1738
  return t >= o.left && t <= o.right && n >= o.top && n <= o.bottom;
1736
1739
  }
1737
- function Je(e, t, n) {
1740
+ function Qe(e, t, n) {
1738
1741
  if (!ee(n) || !n.draggedNode)
1739
1742
  return;
1740
1743
  mt(n);
@@ -1746,8 +1749,8 @@ function Je(e, t, n) {
1746
1749
  const x = window.getComputedStyle(a), v = a.getBoundingClientRect(), f = zt(a, t, x, v, {
1747
1750
  axis: "x",
1748
1751
  state: n
1749
- }), D = zt(a, t, x, v, { axis: "y" });
1750
- (f.left || f.right) && (n.lastScrollContainerX = a, i("x", f.right ? "positive" : "negative", a)), (D.up || D.down) && (n.lastScrollContainerY = a, i("y", D.down ? "positive" : "negative", a));
1752
+ }), S = zt(a, t, x, v, { axis: "y" });
1753
+ (f.left || f.right) && (n.lastScrollContainerX = a, i("x", f.right ? "positive" : "negative", a)), (S.up || S.down) && (n.lastScrollContainerY = a, i("y", S.down ? "positive" : "negative", a));
1751
1754
  };
1752
1755
  if (n.lastScrollContainerX && Ot(n.lastScrollContainerX, o, l) && d(n.lastScrollContainerX), !s && n.lastScrollContainerY && Ot(n.lastScrollContainerY, o, l) && d(n.lastScrollContainerY), !s) {
1753
1756
  let a = document.elementFromPoint(o, l);
@@ -1762,10 +1765,10 @@ function Je(e, t, n) {
1762
1765
  }
1763
1766
  function il(e) {
1764
1767
  let t = document.elementFromPoint(e.x, e.y);
1765
- if (!We(t)) return;
1768
+ if (!et(t)) return;
1766
1769
  let n, o = !0;
1767
1770
  for (; t && o; ) {
1768
- if (ue.has(t) || Z.has(t)) {
1771
+ if (ce.has(t) || Z.has(t)) {
1769
1772
  o = !1, n = Z.has(t);
1770
1773
  break;
1771
1774
  }
@@ -1780,7 +1783,7 @@ function il(e) {
1780
1783
  }
1781
1784
  } : void 0;
1782
1785
  } else {
1783
- const l = ue.get(t);
1786
+ const l = ce.get(t);
1784
1787
  if (!l) return;
1785
1788
  const s = Z.get(t.parentNode);
1786
1789
  return s ? {
@@ -1795,10 +1798,10 @@ function il(e) {
1795
1798
  } : void 0;
1796
1799
  }
1797
1800
  }
1798
- function We(e) {
1801
+ function et(e) {
1799
1802
  return e instanceof HTMLElement && e.parentNode instanceof HTMLElement;
1800
1803
  }
1801
- function Ke(e, t) {
1804
+ function Je(e, t) {
1802
1805
  const n = new AbortController();
1803
1806
  for (const o in t) {
1804
1807
  const l = t[o];
@@ -1881,19 +1884,19 @@ const fl = {
1881
1884
  get() {
1882
1885
  return o.option;
1883
1886
  },
1884
- set(S) {
1885
- s("update:option", S);
1887
+ set(V) {
1888
+ s("update:option", V);
1886
1889
  }
1887
1890
  }), d = G({
1888
1891
  get() {
1889
1892
  return i.value.values;
1890
1893
  },
1891
- set(S) {
1892
- i.value.values = S;
1894
+ set(V) {
1895
+ i.value.values = V;
1893
1896
  }
1894
- }), a = Ie("valueListRef"), x = L(!1);
1895
- te(x, async (S) => {
1896
- S || (await Re(), tn({
1897
+ }), a = Ne("valueListRef"), x = B(!1);
1898
+ te(x, async (V) => {
1899
+ V || (await Ue(), tn({
1897
1900
  parent: a?.value,
1898
1901
  values: d,
1899
1902
  group: "valueList",
@@ -1903,39 +1906,39 @@ const fl = {
1903
1906
  }, { immediate: !0 });
1904
1907
  const v = () => Math.random().toString(36).substring(2, 15), f = () => {
1905
1908
  i.value.values.push({ id: v(), value: "" });
1906
- }, D = async () => {
1907
- (i.value.name.trim() || i.value.values.filter((S) => S.value.trim() !== "").length > 0) && !await l("Are you sure you want to remove this option?") || s("remove");
1908
- }, C = (S) => {
1909
- i.value.values.splice(S, 1);
1910
- }, N = (S) => {
1911
- S.name.trim() ? S.nameError = void 0 : S.nameError = "Option name is required.";
1912
- }, E = (S, w) => {
1913
- const U = S.target, W = i.value.values;
1914
- if (S.key === "Backspace" && U.value === "" && W?.length > 2) {
1915
- C(w);
1909
+ }, S = async () => {
1910
+ (i.value.name.trim() || i.value.values.filter((V) => V.value.trim() !== "").length > 0) && !await l("Are you sure you want to remove this option?") || s("remove");
1911
+ }, C = (V) => {
1912
+ i.value.values.splice(V, 1);
1913
+ }, N = (V) => {
1914
+ V.name.trim() ? V.nameError = void 0 : V.nameError = "Option name is required.";
1915
+ }, $ = (V, D) => {
1916
+ const U = V.target, W = i.value.values;
1917
+ if (V.key === "Backspace" && U.value === "" && W?.length > 2) {
1918
+ C(D);
1916
1919
  return;
1917
1920
  }
1918
- }, M = (S, w) => {
1919
- S.target;
1920
- const U = i.value.values, W = U?.[w];
1921
+ }, A = (V, D) => {
1922
+ V.target;
1923
+ const U = i.value.values, W = U?.[D];
1921
1924
  W.touched = !0, U?.every((oe) => oe.value.trim() !== "") && f();
1922
- }, A = (S) => {
1923
- const w = i.value, U = w?.values.every((W, j) => W.value.trim() !== "" || j === S);
1924
- w && w.values[S].value.trim() === "" && !U && C(S);
1925
+ }, E = (V) => {
1926
+ const D = i.value, U = D?.values.every((W, H) => W.value.trim() !== "" || H === V);
1927
+ D && D.values[V].value.trim() === "" && !U && C(V);
1925
1928
  };
1926
1929
  return t({
1927
1930
  minified: x
1928
- }), (S, w) => {
1931
+ }), (V, D) => {
1929
1932
  const U = m("Input"), W = m("Button");
1930
1933
  return x.value ? (b(), k("div", {
1931
1934
  key: 1,
1932
1935
  class: "flex gap-4 p-6 border-b last:border-b-0 hover:bg-accent dark:hover:bg-accent/50 cursor-pointer transition-colors duration-200",
1933
- onClick: w[5] || (w[5] = (j) => x.value = !1)
1936
+ onClick: D[5] || (D[5] = (H) => x.value = !1)
1934
1937
  }, [
1935
1938
  p("div", null, [
1936
1939
  p("div", {
1937
1940
  class: "option-drag-handle flex-none mt-5 cursor-grab",
1938
- onClick: w[4] || (w[4] = fe(() => {
1941
+ onClick: D[4] || (D[4] = ue(() => {
1939
1942
  }, ["stop"]))
1940
1943
  }, [
1941
1944
  r(g(ut), { class: "size-4 text-gray-400" })
@@ -1944,10 +1947,10 @@ const fl = {
1944
1947
  p("div", Cl, [
1945
1948
  p("p", wl, z(i.value.name), 1),
1946
1949
  p("div", kl, [
1947
- (b(!0), k(J, null, ce(d.value, (j) => (b(), k(J, {
1948
- key: j.id
1950
+ (b(!0), k(J, null, pe(d.value, (H) => (b(), k(J, {
1951
+ key: H.id
1949
1952
  }, [
1950
- j.value ? (b(), k("span", Vl, z(j.value), 1)) : F("", !0)
1953
+ H.value ? (b(), k("span", Vl, z(H.value), 1)) : F("", !0)
1951
1954
  ], 64))), 128))
1952
1955
  ])
1953
1956
  ])
@@ -1959,12 +1962,12 @@ const fl = {
1959
1962
  ]),
1960
1963
  p("div", ml, [
1961
1964
  p("div", vl, [
1962
- w[6] || (w[6] = p("label", { class: "block text-sm mb-2" }, "Option name", -1)),
1965
+ D[6] || (D[6] = p("label", { class: "block text-sm mb-2" }, "Option name", -1)),
1963
1966
  p("div", bl, [
1964
1967
  r(U, {
1965
1968
  modelValue: i.value.name,
1966
- "onUpdate:modelValue": w[0] || (w[0] = (j) => i.value.name = j),
1967
- onBlur: w[1] || (w[1] = (j) => N(i.value)),
1969
+ "onUpdate:modelValue": D[0] || (D[0] = (H) => i.value.name = H),
1970
+ onBlur: D[1] || (D[1] = (H) => N(i.value)),
1968
1971
  "aria-invalid": i.value.nameError ? "true" : "false",
1969
1972
  placeholder: "Color",
1970
1973
  spellcheck: "false"
@@ -1978,29 +1981,29 @@ const fl = {
1978
1981
  ])) : F("", !0)
1979
1982
  ]),
1980
1983
  p("div", yl, [
1981
- w[7] || (w[7] = p("label", { class: "block text-sm mb-2" }, "Option values", -1)),
1984
+ D[7] || (D[7] = p("label", { class: "block text-sm mb-2" }, "Option values", -1)),
1982
1985
  p("div", {
1983
1986
  ref_key: "valueListRef",
1984
1987
  ref: a
1985
1988
  }, [
1986
- d.value ? (b(!0), k(J, { key: 0 }, ce(d.value, (j, oe) => (b(), k("div", {
1987
- key: j.id,
1989
+ d.value ? (b(!0), k(J, { key: 0 }, pe(d.value, (H, oe) => (b(), k("div", {
1990
+ key: H.id,
1988
1991
  class: "relative flex items-center mb-2"
1989
1992
  }, [
1990
- j.touched ? (b(), k("div", xl, [
1993
+ H.touched ? (b(), k("div", xl, [
1991
1994
  r(g(ut), { class: "size-4 text-gray-400" })
1992
1995
  ])) : F("", !0),
1993
1996
  r(U, {
1994
- modelValue: j.value,
1995
- "onUpdate:modelValue": (ie) => j.value = ie,
1997
+ modelValue: H.value,
1998
+ "onUpdate:modelValue": (ie) => H.value = ie,
1996
1999
  placeholder: "Option value",
1997
2000
  class: "pr-12",
1998
- onKeydown: (ie) => E(ie, oe),
1999
- onKeyup: (ie) => M(ie, oe),
2000
- onBlur: (ie) => A(oe),
2001
+ onKeydown: (ie) => $(ie, oe),
2002
+ onKeyup: (ie) => A(ie, oe),
2003
+ onBlur: (ie) => E(oe),
2001
2004
  spellcheck: "false"
2002
2005
  }, null, 8, ["modelValue", "onUpdate:modelValue", "onKeydown", "onKeyup", "onBlur"]),
2003
- d.value.length > 2 && j.touched ? (b(), k("button", {
2006
+ d.value.length > 2 && H.touched ? (b(), k("button", {
2004
2007
  key: 1,
2005
2008
  onClick: (ie) => C(oe),
2006
2009
  class: "absolute right-2 top-1/2 -translate-y-1/2 ml-2 p-2 text-muted-foreground/50 hover:text-muted-foreground",
@@ -2015,20 +2018,20 @@ const fl = {
2015
2018
  r(W, {
2016
2019
  size: "sm",
2017
2020
  variant: "outline",
2018
- onClick: w[2] || (w[2] = (j) => D()),
2021
+ onClick: D[2] || (D[2] = (H) => S()),
2019
2022
  class: "text-red-500 hover:text-red-600"
2020
2023
  }, {
2021
- default: c(() => [...w[8] || (w[8] = [
2024
+ default: c(() => [...D[8] || (D[8] = [
2022
2025
  P("Delete", -1)
2023
2026
  ])]),
2024
2027
  _: 1
2025
2028
  }),
2026
2029
  r(W, {
2027
2030
  size: "sm",
2028
- onClick: w[3] || (w[3] = (j) => x.value = !0),
2031
+ onClick: D[3] || (D[3] = (H) => x.value = !0),
2029
2032
  disabled: i.value.name.trim() === ""
2030
2033
  }, {
2031
- default: c(() => [...w[9] || (w[9] = [
2034
+ default: c(() => [...D[9] || (D[9] = [
2032
2035
  P("Done", -1)
2033
2036
  ])]),
2034
2037
  _: 1
@@ -2048,92 +2051,92 @@ const fl = {
2048
2051
  },
2049
2052
  emits: ["update:modelValue"],
2050
2053
  setup(e, { expose: t, emit: n }) {
2051
- const o = e, l = n, s = L([]), i = Ie("optionsListRefElement"), d = Ie("optionRefs"), a = G({
2054
+ const o = e, l = n, s = B([]), i = Ne("optionsListRefElement"), d = Ne("optionRefs"), a = G({
2052
2055
  get() {
2053
2056
  return o.modelValue;
2054
2057
  },
2055
- set(A) {
2056
- l("update:modelValue", A);
2058
+ set(E) {
2059
+ l("update:modelValue", E);
2057
2060
  }
2058
- }), x = L(!1);
2059
- te(a, (A) => {
2060
- x.value || (!s.value || s.value.length === 0 && A.length > 0) && (x.value = !0, s.value = A ? JSON.parse(JSON.stringify(A)) : []);
2061
- }, { deep: !0 }), te(s, (A) => {
2062
- a.value = A?.map((S) => ({
2063
- ...S,
2064
- values: S.values.filter((w) => w.value.trim() !== "")
2065
- })), !E.value && A.length > 0 && M();
2061
+ }), x = B(!1);
2062
+ te(a, (E) => {
2063
+ x.value || (!s.value || s.value.length === 0 && E.length > 0) && (x.value = !0, s.value = E ? JSON.parse(JSON.stringify(E)) : []);
2064
+ }, { deep: !0 }), te(s, (E) => {
2065
+ a.value = E?.map((V) => ({
2066
+ ...V,
2067
+ values: V.values.filter((D) => D.value.trim() !== "")
2068
+ })), !$.value && E.length > 0 && A();
2066
2069
  }, { deep: !0 });
2067
2070
  const v = () => Math.random().toString(36).substring(2, 15), f = () => {
2068
- const S = {
2071
+ const V = {
2069
2072
  id: v(),
2070
2073
  name: "",
2071
2074
  values: [{ id: v(), value: "" }],
2072
2075
  nameError: void 0
2073
2076
  };
2074
- s.value.push(S);
2075
- }, D = () => {
2076
- d.value?.forEach((A) => {
2077
- A && (A.minified = !0);
2077
+ s.value.push(V);
2078
+ }, S = () => {
2079
+ d.value?.forEach((E) => {
2080
+ E && (E.minified = !0);
2078
2081
  });
2079
- }, C = (A) => {
2080
- const S = s.value.findIndex((w) => w.id === A.id);
2081
- S !== -1 && (s.value[S] = A);
2082
- }, N = (A) => {
2083
- const S = s.value.findIndex((w) => w.id === A.id);
2084
- S !== -1 && s.value.splice(S, 1);
2085
- }, E = L(!1), M = () => {
2082
+ }, C = (E) => {
2083
+ const V = s.value.findIndex((D) => D.id === E.id);
2084
+ V !== -1 && (s.value[V] = E);
2085
+ }, N = (E) => {
2086
+ const V = s.value.findIndex((D) => D.id === E.id);
2087
+ V !== -1 && s.value.splice(V, 1);
2088
+ }, $ = B(!1), A = () => {
2086
2089
  try {
2087
- E.value = !0, tn({
2090
+ $.value = !0, tn({
2088
2091
  parent: i?.value,
2089
2092
  values: s,
2090
2093
  group: "optionsList",
2091
2094
  dragHandle: ".option-drag-handle",
2092
2095
  plugins: [Ut()]
2093
2096
  });
2094
- } catch (A) {
2095
- console.error(A);
2097
+ } catch (E) {
2098
+ console.error(E);
2096
2099
  }
2097
2100
  };
2098
2101
  return vt(() => {
2099
- s.value = o.modelValue ? JSON.parse(JSON.stringify(o.modelValue)) : [], s.value.length > 0 && M();
2102
+ s.value = o.modelValue ? JSON.parse(JSON.stringify(o.modelValue)) : [], s.value.length > 0 && A();
2100
2103
  }), t({
2101
- minifyAll: D
2102
- }), (A, S) => {
2103
- const w = m("Button");
2104
+ minifyAll: S
2105
+ }), (E, V) => {
2106
+ const D = m("Button");
2104
2107
  return b(), k("div", null, [
2105
2108
  p("div", {
2106
- class: De(["rounded-lg", s.value.length > 0 ? "border mb-6" : ""])
2109
+ class: ye(["rounded-lg", s.value.length > 0 ? "border mb-6" : ""])
2107
2110
  }, [
2108
2111
  p("div", {
2109
2112
  ref_key: "optionsListRefElement",
2110
2113
  ref: i
2111
2114
  }, [
2112
- (b(!0), k(J, null, ce(s.value, (U) => (b(), R(Pl, {
2115
+ (b(!0), k(J, null, pe(s.value, (U) => (b(), R(Pl, {
2113
2116
  ref_for: !0,
2114
2117
  ref_key: "optionRefs",
2115
2118
  ref: d,
2116
2119
  key: U.id,
2117
2120
  option: U,
2118
- "onUpdate:option": S[0] || (S[0] = (W) => C(W)),
2121
+ "onUpdate:option": V[0] || (V[0] = (W) => C(W)),
2119
2122
  onRemove: (W) => N(U)
2120
2123
  }, null, 8, ["option", "onRemove"]))), 128))
2121
2124
  ], 512),
2122
2125
  s.value && s.value.length < 3 ? (b(), k("div", {
2123
2126
  key: 0,
2124
- class: De(s.value.length > 0 ? "border-t" : "")
2127
+ class: ye(s.value.length > 0 ? "border-t" : "")
2125
2128
  }, [
2126
- s.value.length === 0 ? (b(), R(w, {
2129
+ s.value.length === 0 ? (b(), R(D, {
2127
2130
  key: 0,
2128
2131
  onClick: f,
2129
2132
  variant: "outline"
2130
2133
  }, {
2131
2134
  default: c(() => [
2132
2135
  r(g(Nt), { class: "size-4" }),
2133
- S[1] || (S[1] = P(" Add options like size or color ", -1))
2136
+ V[1] || (V[1] = P(" Add options like size or color ", -1))
2134
2137
  ]),
2135
2138
  _: 1
2136
- })) : (b(), R(w, {
2139
+ })) : (b(), R(D, {
2137
2140
  key: 1,
2138
2141
  onClick: f,
2139
2142
  variant: "ghost",
@@ -2141,7 +2144,7 @@ const fl = {
2141
2144
  }, {
2142
2145
  default: c(() => [
2143
2146
  r(g(Nt), { class: "size-4" }),
2144
- S[2] || (S[2] = P(" Add another option ", -1))
2147
+ V[2] || (V[2] = P(" Add another option ", -1))
2145
2148
  ]),
2146
2149
  _: 1
2147
2150
  }))
@@ -2153,16 +2156,16 @@ const fl = {
2153
2156
  }), Tl = { class: "grid gap-4 py-2" }, Il = /* @__PURE__ */ ne({
2154
2157
  __name: "VariantDialog",
2155
2158
  setup(e, { expose: t }) {
2156
- const n = L(!1), o = L(!1), l = L(null);
2159
+ const n = B(!1), o = B(!1), l = B(null);
2157
2160
  return t({
2158
2161
  openVariantDialog: (i) => {
2159
2162
  n.value = !0, l.value = i;
2160
2163
  }
2161
2164
  }), (i, d) => {
2162
- const a = m("ResponsiveModalTitle"), x = m("ResponsiveModalHeader"), v = m("Button"), f = m("ResponsiveModalClose"), D = m("ResponsiveModalFooter"), C = m("ResponsiveModalScrollContent"), N = m("ResponsiveModal");
2165
+ const a = m("ResponsiveModalTitle"), x = m("ResponsiveModalHeader"), v = m("Button"), f = m("ResponsiveModalClose"), S = m("ResponsiveModalFooter"), C = m("ResponsiveModalScrollContent"), N = m("ResponsiveModal");
2163
2166
  return b(), R(N, {
2164
2167
  open: g(n),
2165
- "onUpdate:open": d[0] || (d[0] = (E) => Y(n) ? n.value = E : null)
2168
+ "onUpdate:open": d[0] || (d[0] = ($) => Y(n) ? n.value = $ : null)
2166
2169
  }, {
2167
2170
  default: c(() => [
2168
2171
  r(C, { class: "sm:max-w-xl" }, {
@@ -2179,7 +2182,7 @@ const fl = {
2179
2182
  _: 1
2180
2183
  }),
2181
2184
  p("div", Tl, " variant " + z(g(l)), 1),
2182
- r(D, null, {
2185
+ r(S, null, {
2183
2186
  default: c(() => [
2184
2187
  r(f, { "as-child": "" }, {
2185
2188
  default: c(() => [
@@ -2261,25 +2264,25 @@ const fl = {
2261
2264
  set(h) {
2262
2265
  l("update:modelValue", h);
2263
2266
  }
2264
- }), i = pt("sources"), d = L(""), a = L(""), x = L(!1), v = L([]), f = L({}), D = L([]), C = L({}), N = Ie("variantDialog"), E = () => {
2267
+ }), i = pt("sources"), d = B(""), a = B(""), x = B(!1), v = B([]), f = B({}), S = B([]), C = B({}), N = Ne("variantDialog"), $ = () => {
2265
2268
  const h = Object.keys(o.options);
2266
2269
  if (h.length === 0) {
2267
2270
  a.value = "";
2268
2271
  return;
2269
2272
  }
2270
2273
  (!a.value || !h.includes(a.value)) && (a.value = h[0]);
2271
- }, M = () => {
2274
+ }, A = () => {
2272
2275
  const h = Object.entries(f.value).reduce((u, [y, I]) => (o.options?.[y]?.values?.some((K) => K.id === I) && (u[y] = I), u), {});
2273
2276
  JSON.stringify(h) !== JSON.stringify(f.value) && (f.value = h);
2274
2277
  };
2275
2278
  te(() => o.options, () => {
2276
- E(), M();
2279
+ $(), A();
2277
2280
  }, { immediate: !0, deep: !0 }), te(C, (h) => {
2278
- A();
2281
+ E();
2279
2282
  }, { deep: !0 }), te(() => o.hide, (h) => {
2280
- h || (E(), A());
2283
+ h || ($(), E());
2281
2284
  });
2282
- function A() {
2285
+ function E() {
2283
2286
  if (!C.value) {
2284
2287
  s.value = [];
2285
2288
  return;
@@ -2297,30 +2300,30 @@ const fl = {
2297
2300
  });
2298
2301
  }), s.value = h.filter((u) => u.options?.length === Object.keys(o.options).length && u.options?.every((y) => Object.entries(o.options).find(([, I]) => I.id === y.optionId)));
2299
2302
  }
2300
- function S(h) {
2303
+ function V(h) {
2301
2304
  return h.reduce(
2302
- (u, y) => u.flatMap((I) => y.map((H) => [...I, H])),
2305
+ (u, y) => u.flatMap((I) => y.map((L) => [...I, L])),
2303
2306
  [[]]
2304
2307
  );
2305
2308
  }
2306
- function w(h) {
2309
+ function D(h) {
2307
2310
  return h.slice().sort((u, y) => u.optionId.localeCompare(y.optionId)).map(({ optionId: u, valueId: y }) => `${u}:${y}`).join("|");
2308
2311
  }
2309
2312
  const U = (h) => h.split("|").map((y) => {
2310
- const [I, H] = y.split(":");
2311
- return { optionId: I, valueId: H };
2313
+ const [I, L] = y.split(":");
2314
+ return { optionId: I, valueId: L };
2312
2315
  }).map((y) => o.options?.[y.optionId]?.values?.find((K) => K.id === y.valueId)?.value || "").join(" "), W = (h) => h.split("|").map((y) => {
2313
- const [I, H] = y.split(":");
2314
- return { optionId: I, valueId: H };
2316
+ const [I, L] = y.split(":");
2317
+ return { optionId: I, valueId: L };
2315
2318
  }).map((y) => {
2316
- const I = o.options?.[y.optionId], H = I?.values?.find((K) => K.id === y.valueId);
2319
+ const I = o.options?.[y.optionId], L = I?.values?.find((K) => K.id === y.valueId);
2317
2320
  return {
2318
2321
  optionId: I?.id || y.optionId,
2319
2322
  option: I?.name || "",
2320
- valueId: H?.id || y.valueId,
2321
- value: H?.value || ""
2323
+ valueId: L?.id || y.valueId,
2324
+ value: L?.value || ""
2322
2325
  };
2323
- }), j = G(() => {
2326
+ }), H = G(() => {
2324
2327
  const h = Object.values(o.options).map(
2325
2328
  (y) => y.values.map((I) => ({
2326
2329
  optionId: y.id,
@@ -2329,8 +2332,8 @@ const fl = {
2329
2332
  value: I.value
2330
2333
  }))
2331
2334
  );
2332
- return S(h).map((y) => {
2333
- const I = w(y);
2335
+ return V(h).map((y) => {
2336
+ const I = D(y);
2334
2337
  return C.value[I] || (C.value[I] = { price: 0, stock: 0 }), {
2335
2338
  key: I,
2336
2339
  options: y,
@@ -2338,64 +2341,64 @@ const fl = {
2338
2341
  };
2339
2342
  });
2340
2343
  }), oe = G(() => {
2341
- let h = [...j.value];
2344
+ let h = [...H.value];
2342
2345
  const u = d.value.trim().toLowerCase();
2343
2346
  return u && (h = h.filter((y) => y.options?.some((I) => I.value.toLowerCase().includes(u)))), Object.entries(f.value).forEach(([y, I]) => {
2344
- I && (h = h.filter((H) => H.options?.some((K) => K.optionId === y && K.valueId === I)));
2347
+ I && (h = h.filter((L) => L.options?.some((K) => K.optionId === y && K.valueId === I)));
2345
2348
  }), h;
2346
- }), ie = G(() => Object.keys(f.value).length > 0), Ze = (h, u) => {
2349
+ }), ie = G(() => Object.keys(f.value).length > 0), tt = (h, u) => {
2347
2350
  if (!u) {
2348
- we(h);
2351
+ Ee(h);
2349
2352
  return;
2350
2353
  }
2351
2354
  f.value = {
2352
2355
  ...f.value,
2353
2356
  [h]: u
2354
2357
  };
2355
- }, we = (h) => {
2358
+ }, Ee = (h) => {
2356
2359
  const u = { ...f.value };
2357
2360
  delete u[h], f.value = u;
2358
- }, Qe = (h) => h.values?.find((u) => u.id === f.value[h.id])?.value, q = (h) => oe.value.filter((u) => u.options?.find((y) => y.optionId === a.value)?.valueId === h), be = G(() => {
2361
+ }, Be = (h) => h.values?.find((u) => u.id === f.value[h.id])?.value, q = (h) => oe.value.filter((u) => u.options?.find((y) => y.optionId === a.value)?.valueId === h), be = G(() => {
2359
2362
  const h = o.options?.[a.value]?.values || [];
2360
2363
  return !d.value.trim() && !ie.value ? h : h.filter((u) => q(u.id).length > 0);
2361
- }), ke = G(() => oe.value.map((h) => h.key)), Ae = G(() => D.value.length), Ve = G(() => {
2362
- const h = new Set(D.value);
2363
- return ke.value.filter((u) => h.has(u)).length;
2364
- }), V = G(() => ke.value.length === 0 || Ve.value === 0 ? !1 : Ve.value === ke.value.length ? !0 : "indeterminate");
2364
+ }), Se = G(() => oe.value.map((h) => h.key)), Me = G(() => S.value.length), je = G(() => {
2365
+ const h = new Set(S.value);
2366
+ return Se.value.filter((u) => h.has(u)).length;
2367
+ }), Ae = G(() => Se.value.length === 0 || je.value === 0 ? !1 : je.value === Se.value.length ? !0 : "indeterminate");
2365
2368
  te(be, (h) => {
2366
2369
  const u = new Set(h.map((y) => y.id));
2367
2370
  v.value = v.value.filter((y) => u.has(y));
2368
- }), te(j, (h) => {
2369
- const u = new Set(h.map((I) => I.key)), y = D.value.filter((I) => u.has(I));
2370
- y.length !== D.value.length && (D.value = y);
2371
+ }), te(H, (h) => {
2372
+ const u = new Set(h.map((I) => I.key)), y = S.value.filter((I) => u.has(I));
2373
+ y.length !== S.value.length && (S.value = y);
2371
2374
  });
2372
- const $ = (h, u) => {
2375
+ const w = (h, u) => {
2373
2376
  const y = new Set(h);
2374
2377
  if (u) {
2375
- D.value = Array.from(/* @__PURE__ */ new Set([...D.value, ...h]));
2378
+ S.value = Array.from(/* @__PURE__ */ new Set([...S.value, ...h]));
2376
2379
  return;
2377
2380
  }
2378
- D.value = D.value.filter((I) => !y.has(I));
2381
+ S.value = S.value.filter((I) => !y.has(I));
2382
+ }, M = (h, u) => {
2383
+ w([h], u === !0);
2379
2384
  }, ae = (h, u) => {
2380
- $([h], u === !0);
2381
- }, _e = (h, u) => {
2382
- $(q(h).map((y) => y.key), u === !0);
2385
+ w(q(h).map((y) => y.key), u === !0);
2386
+ }, _e = (h) => {
2387
+ w(Se.value, h === !0);
2383
2388
  }, ze = (h) => {
2384
- $(ke.value, h === !0);
2385
- }, Le = (h) => {
2386
- const u = q(h).map((H) => H.key);
2389
+ const u = q(h).map((L) => L.key);
2387
2390
  if (u.length === 0) return !1;
2388
- const y = new Set(D.value), I = u.filter((H) => y.has(H)).length;
2391
+ const y = new Set(S.value), I = u.filter((L) => y.has(L)).length;
2389
2392
  return I === 0 ? !1 : I === u.length ? !0 : "indeterminate";
2390
- }, et = (h, u) => {
2393
+ }, He = (h, u) => {
2391
2394
  const y = q(u);
2392
2395
  y && y.forEach((I) => {
2393
- C.value[w(I.options)].image = h;
2396
+ C.value[D(I.options)].image = h;
2394
2397
  });
2395
- }, Be = (h) => q(h).every((y) => !y.image), tt = (h) => {
2398
+ }, Xe = (h) => q(h).every((y) => !y.image), Ye = (h) => {
2396
2399
  const u = q(h);
2397
- return u.filter((I, H) => I.image && u.findIndex((K) => K.image === I.image) === H).length === 1;
2398
- }, je = (h) => q(h).filter((y) => y.image)[0]?.image, ht = (h) => q(h).filter((y) => y.image)[1]?.image, nn = (h) => {
2400
+ return u.filter((I, L) => I.image && u.findIndex((K) => K.image === I.image) === L).length === 1;
2401
+ }, Oe = (h) => q(h).filter((y) => y.image)[0]?.image, ht = (h) => q(h).filter((y) => y.image)[1]?.image, nn = (h) => {
2399
2402
  const u = q(h);
2400
2403
  if (u.length === 0) return "0";
2401
2404
  const y = u.map((I) => I.price);
@@ -2410,21 +2413,19 @@ const fl = {
2410
2413
  return be.value?.forEach((u) => {
2411
2414
  h += on(u.id);
2412
2415
  }), h;
2413
- }, He = L(null), he = L(""), rn = async (h, u) => {
2416
+ }, Ke = B(null), Fe = B(""), rn = async (h, u) => {
2414
2417
  h.preventDefault();
2415
2418
  const y = oe?.value?.filter((K) => K.options?.find((nt) => nt.optionId === a.value)?.valueId === u.id).map((K) => K.price), I = y.length === 0 ? !0 : y.every((K) => K === y[0]);
2416
- He.value = u.id, he.value = I ? y[0].toString() : "", await Re();
2417
- const H = document.getElementById(`variant-price-${u.id}`);
2418
- H?.focus(), H?.select();
2419
+ Ke.value = u.id, Fe.value = I ? y[0].toString() : "", await Ue();
2420
+ const L = document.getElementById(`variant-price-${u.id}`);
2421
+ L?.focus(), L?.select();
2419
2422
  }, an = (h) => {
2420
- Dt(h), He.value = null, he.value = "";
2423
+ Dt(h), Ke.value = null, Fe.value = "";
2421
2424
  }, Dt = (h) => {
2422
- if (he.value.trim() && Number(he.value.trim().replace(",", ".")) > 0) {
2423
- const u = Number(he.value.trim().replace(",", "."));
2424
- oe?.value?.filter((y) => y.options?.find((I) => I.optionId === a.value)?.valueId === h).forEach((y) => {
2425
- C.value[w(y.options)].price = u;
2426
- });
2427
- }
2425
+ const u = Fe.value.trim(), y = Number(u.replace(",", "."));
2426
+ u && Number.isFinite(y) && y >= 0 && oe?.value?.filter((I) => I.options?.find((L) => L.optionId === a.value)?.valueId === h).forEach((I) => {
2427
+ C.value[D(I.options)].price = y;
2428
+ });
2428
2429
  }, sn = (h) => {
2429
2430
  C.value = h.reduce((u, y) => (u[y.combinedOptions] = {
2430
2431
  price: y.price,
@@ -2433,17 +2434,17 @@ const fl = {
2433
2434
  }, u), {});
2434
2435
  };
2435
2436
  return vt(() => {
2436
- E();
2437
+ $();
2437
2438
  }), t({
2438
2439
  setVariantMap: sn,
2439
- refreshVariants: A
2440
+ refreshVariants: E
2440
2441
  }), (h, u) => {
2441
- const y = m("SelectValue"), I = m("SelectTrigger"), H = m("SelectItem"), K = m("SelectContent"), nt = m("Select"), pe = m("Button"), St = m("Input"), dn = m("PopoverTrigger"), un = m("RadioGroupItem"), cn = m("Label"), pn = m("RadioGroup"), fn = m("PopoverContent"), gn = m("Popover"), ot = m("Checkbox"), lt = m("TooltipTrigger"), rt = m("TooltipContent"), at = m("Tooltip"), Ct = m("DropdownMenuTrigger"), Pe = m("DropdownMenuItem"), wt = m("DropdownMenuContent"), kt = m("DropdownMenu"), mn = m("DropdownMenuGroup"), vn = m("DropdownMenuSeparator"), Vt = m("MediaPickerDialog"), st = m("NumberFieldInput"), it = m("NumberFieldContent"), dt = m("NumberField"), bn = m("NumberFieldDecrement"), _n = m("NumberFieldIncrement");
2442
+ const y = m("SelectValue"), I = m("SelectTrigger"), L = m("SelectItem"), K = m("SelectContent"), nt = m("Select"), fe = m("Button"), St = m("Input"), dn = m("PopoverTrigger"), un = m("RadioGroupItem"), cn = m("Label"), pn = m("RadioGroup"), fn = m("PopoverContent"), gn = m("Popover"), ot = m("Checkbox"), lt = m("TooltipTrigger"), rt = m("TooltipContent"), at = m("Tooltip"), Ct = m("DropdownMenuTrigger"), Ce = m("DropdownMenuItem"), wt = m("DropdownMenuContent"), kt = m("DropdownMenu"), mn = m("DropdownMenuGroup"), vn = m("DropdownMenuSeparator"), Vt = m("MediaPickerDialog"), st = m("NumberFieldInput"), it = m("NumberFieldContent"), dt = m("NumberField"), bn = m("NumberFieldDecrement"), _n = m("NumberFieldIncrement");
2442
2443
  return b(), k(J, null, [
2443
2444
  e.hide ? F("", !0) : (b(), k("div", $l, [
2444
2445
  p("div", El, [
2445
2446
  Object.keys(e.options).length > 1 ? (b(), k("div", Ml, [
2446
- u[13] || (u[13] = p("p", null, "Group by", -1)),
2447
+ u[15] || (u[15] = p("p", null, "Group by", -1)),
2447
2448
  r(nt, {
2448
2449
  modelValue: a.value,
2449
2450
  "onUpdate:modelValue": u[0] || (u[0] = (T) => a.value = T)
@@ -2457,7 +2458,7 @@ const fl = {
2457
2458
  }),
2458
2459
  r(K, null, {
2459
2460
  default: c(() => [
2460
- (b(!0), k(J, null, ce(e.options, (T) => (b(), R(H, {
2461
+ (b(!0), k(J, null, pe(e.options, (T) => (b(), R(L, {
2461
2462
  key: T.id,
2462
2463
  value: T.id
2463
2464
  }, {
@@ -2473,18 +2474,18 @@ const fl = {
2473
2474
  _: 1
2474
2475
  }, 8, ["modelValue"])
2475
2476
  ])) : F("", !0),
2476
- x.value ? (b(), R(pe, {
2477
+ x.value ? (b(), R(fe, {
2477
2478
  key: 2,
2478
2479
  variant: "outline",
2479
2480
  onClick: u[2] || (u[2] = (T) => x.value = !1),
2480
2481
  size: "sm",
2481
2482
  class: "ml-auto"
2482
2483
  }, {
2483
- default: c(() => [...u[14] || (u[14] = [
2484
+ default: c(() => [...u[16] || (u[16] = [
2484
2485
  P(" Cancel ", -1)
2485
2486
  ])]),
2486
2487
  _: 1
2487
- })) : (b(), R(pe, {
2488
+ })) : (b(), R(fe, {
2488
2489
  key: 1,
2489
2490
  variant: "outline",
2490
2491
  onClick: u[1] || (u[1] = (T) => x.value = !0),
@@ -2500,7 +2501,7 @@ const fl = {
2500
2501
  ]),
2501
2502
  x.value ? (b(), k("div", Al, [
2502
2503
  p("div", {
2503
- class: De(["relative", { "mb-4": Object.keys(e.options).length > 0 }])
2504
+ class: ye(["relative", { "mb-4": Object.keys(e.options).length > 0 }])
2504
2505
  }, [
2505
2506
  r(St, {
2506
2507
  placeholder: "Search",
@@ -2511,23 +2512,23 @@ const fl = {
2511
2512
  r(g(Tt), { class: "size-4 absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none" })
2512
2513
  ], 2),
2513
2514
  p("div", zl, [
2514
- (b(!0), k(J, null, ce(e.options, (T) => (b(), R(gn, {
2515
+ (b(!0), k(J, null, pe(e.options, (T) => (b(), R(gn, {
2515
2516
  key: T.id
2516
2517
  }, {
2517
2518
  default: c(() => [
2518
2519
  r(dn, { asChild: "" }, {
2519
2520
  default: c(() => [
2520
- r(pe, {
2521
+ r(fe, {
2521
2522
  variant: "outline",
2522
2523
  size: "sm",
2523
2524
  class: "border-dashed"
2524
2525
  }, {
2525
2526
  default: c(() => [
2526
2527
  f.value[T.id] ? (b(), k(J, { key: 1 }, [
2527
- P(z(T.name) + " is " + z(Qe(T)) + " ", 1),
2528
+ P(z(T.name) + " is " + z(Be(T)) + " ", 1),
2528
2529
  p("div", {
2529
2530
  class: "p-2",
2530
- onClick: fe((O) => we(T.id), ["stop", "prevent"])
2531
+ onClick: ue((O) => Ee(T.id), ["stop", "prevent"])
2531
2532
  }, [
2532
2533
  r(g(Rt), { class: "size-3" })
2533
2534
  ], 8, Ol)
@@ -2546,10 +2547,10 @@ const fl = {
2546
2547
  r(pn, {
2547
2548
  "model-value": f.value[T.id] || "",
2548
2549
  class: "mb-4",
2549
- "onUpdate:modelValue": (O) => Ze(T.id, O)
2550
+ "onUpdate:modelValue": (O) => tt(T.id, O)
2550
2551
  }, {
2551
2552
  default: c(() => [
2552
- (b(!0), k(J, null, ce(T.values, (O) => (b(), k("div", {
2553
+ (b(!0), k(J, null, pe(T.values, (O) => (b(), k("div", {
2553
2554
  class: "flex items-center space-x-2",
2554
2555
  key: O.id
2555
2556
  }, [
@@ -2570,14 +2571,14 @@ const fl = {
2570
2571
  ]),
2571
2572
  _: 2
2572
2573
  }, 1032, ["model-value", "onUpdate:modelValue"]),
2573
- r(pe, {
2574
+ r(fe, {
2574
2575
  variant: "ghost",
2575
- onClick: (O) => we(T.id),
2576
+ onClick: (O) => Ee(T.id),
2576
2577
  size: "sm",
2577
2578
  class: "ml-auto",
2578
2579
  disabled: !f.value[T.id]
2579
2580
  }, {
2580
- default: c(() => [...u[15] || (u[15] = [
2581
+ default: c(() => [...u[17] || (u[17] = [
2581
2582
  P(" Clear ", -1)
2582
2583
  ])]),
2583
2584
  _: 1
@@ -2597,15 +2598,15 @@ const fl = {
2597
2598
  p("th", Ul, [
2598
2599
  r(ot, {
2599
2600
  class: "border-muted-foreground translate-y-0.5",
2600
- "model-value": V.value,
2601
- "onUpdate:modelValue": ze
2601
+ "model-value": Ae.value,
2602
+ "onUpdate:modelValue": _e
2602
2603
  }, null, 8, ["model-value"])
2603
2604
  ]),
2604
- Ae.value === 0 ? (b(), k(J, { key: 0 }, [
2605
+ Me.value === 0 ? (b(), k(J, { key: 0 }, [
2605
2606
  p("th", Ll, [
2606
2607
  p("div", Bl, [
2607
- u[16] || (u[16] = p("span", null, "Variant", -1)),
2608
- u[17] || (u[17] = p("span", null, "·", -1)),
2608
+ u[18] || (u[18] = p("span", null, "Variant", -1)),
2609
+ u[19] || (u[19] = p("span", null, "·", -1)),
2609
2610
  v.value.length > 0 ? (b(), k("button", {
2610
2611
  key: 0,
2611
2612
  class: "hover:underline cursor-pointer",
@@ -2617,18 +2618,18 @@ const fl = {
2617
2618
  }, "Expand all"))
2618
2619
  ])
2619
2620
  ]),
2620
- u[20] || (u[20] = p("th", { class: "z-[101] sticky -top-4 py-2 font-normal bg-accent dark:bg-border" }, "Price", -1)),
2621
+ u[22] || (u[22] = p("th", { class: "z-[101] sticky -top-4 py-2 font-normal bg-accent dark:bg-border" }, "Price", -1)),
2621
2622
  p("th", jl, [
2622
2623
  r(at, null, {
2623
2624
  default: c(() => [
2624
2625
  r(lt, { class: "underline decoration-dashed underline-offset-4" }, {
2625
- default: c(() => [...u[18] || (u[18] = [
2626
+ default: c(() => [...u[20] || (u[20] = [
2626
2627
  P("Available", -1)
2627
2628
  ])]),
2628
2629
  _: 1
2629
2630
  }),
2630
2631
  r(rt, null, {
2631
- default: c(() => [...u[19] || (u[19] = [
2632
+ default: c(() => [...u[21] || (u[21] = [
2632
2633
  p("p", null, "Inventory at your store that can be sold.", -1)
2633
2634
  ])]),
2634
2635
  _: 1
@@ -2642,13 +2643,13 @@ const fl = {
2642
2643
  default: c(() => [
2643
2644
  r(Ct, { "as-child": "" }, {
2644
2645
  default: c(() => [
2645
- r(pe, {
2646
+ r(fe, {
2646
2647
  variant: "outline",
2647
2648
  class: "mr-2",
2648
2649
  size: "sm"
2649
2650
  }, {
2650
2651
  default: c(() => [
2651
- P(z(Ae.value) + " selected ", 1)
2652
+ P(z(Me.value) + " selected ", 1)
2652
2653
  ]),
2653
2654
  _: 1
2654
2655
  })
@@ -2660,8 +2661,8 @@ const fl = {
2660
2661
  align: "start"
2661
2662
  }, {
2662
2663
  default: c(() => [
2663
- r(Pe, null, {
2664
- default: c(() => [...u[21] || (u[21] = [
2664
+ r(Ce, null, {
2665
+ default: c(() => [...u[23] || (u[23] = [
2665
2666
  P(" Deselect all ", -1)
2666
2667
  ])]),
2667
2668
  _: 1
@@ -2676,7 +2677,7 @@ const fl = {
2676
2677
  default: c(() => [
2677
2678
  r(Ct, { "as-child": "" }, {
2678
2679
  default: c(() => [
2679
- r(pe, { size: "sm" }, {
2680
+ r(fe, { size: "sm" }, {
2680
2681
  default: c(() => [
2681
2682
  r(g(Vn), { class: "size-3" })
2682
2683
  ]),
@@ -2692,26 +2693,26 @@ const fl = {
2692
2693
  default: c(() => [
2693
2694
  r(mn, null, {
2694
2695
  default: c(() => [
2695
- r(Pe, null, {
2696
- default: c(() => [...u[22] || (u[22] = [
2696
+ r(Ce, null, {
2697
+ default: c(() => [...u[24] || (u[24] = [
2697
2698
  P(" Edit price ", -1)
2698
2699
  ])]),
2699
2700
  _: 1
2700
2701
  }),
2701
- r(Pe, null, {
2702
- default: c(() => [...u[23] || (u[23] = [
2702
+ r(Ce, null, {
2703
+ default: c(() => [...u[25] || (u[25] = [
2703
2704
  P(" Edit SKU ", -1)
2704
2705
  ])]),
2705
2706
  _: 1
2706
2707
  }),
2707
- r(Pe, null, {
2708
- default: c(() => [...u[24] || (u[24] = [
2708
+ r(Ce, null, {
2709
+ default: c(() => [...u[26] || (u[26] = [
2709
2710
  P(" Edit barcode ", -1)
2710
2711
  ])]),
2711
2712
  _: 1
2712
2713
  }),
2713
- r(Pe, null, {
2714
- default: c(() => [...u[25] || (u[25] = [
2714
+ r(Ce, null, {
2715
+ default: c(() => [...u[27] || (u[27] = [
2715
2716
  P(" Change image ", -1)
2716
2717
  ])]),
2717
2718
  _: 1
@@ -2720,9 +2721,9 @@ const fl = {
2720
2721
  _: 1
2721
2722
  }),
2722
2723
  r(vn),
2723
- r(Pe, null, {
2724
+ r(Ce, null, {
2724
2725
  default: c(() => [
2725
- P(" Remove variant" + z(Ae.value > 1 ? "s" : ""), 1)
2726
+ P(" Remove variant" + z(Me.value > 1 ? "s" : ""), 1)
2726
2727
  ]),
2727
2728
  _: 1
2728
2729
  })
@@ -2736,7 +2737,7 @@ const fl = {
2736
2737
  ])
2737
2738
  ]),
2738
2739
  p("tbody", Xl, [
2739
- (b(!0), k(J, null, ce(be.value, (T) => (b(), k(J, {
2740
+ (b(!0), k(J, null, pe(be.value, (T) => (b(), k(J, {
2740
2741
  key: T.id
2741
2742
  }, [
2742
2743
  p("tr", {
@@ -2746,9 +2747,9 @@ const fl = {
2746
2747
  p("td", Kl, [
2747
2748
  r(ot, {
2748
2749
  class: "border-muted-foreground translate-y-0.5",
2749
- "model-value": Le(T.id),
2750
- "onUpdate:modelValue": (O) => _e(T.id, O),
2751
- onClick: u[6] || (u[6] = fe(() => {
2750
+ "model-value": ze(T.id),
2751
+ "onUpdate:modelValue": (O) => ae(T.id, O),
2752
+ onClick: u[6] || (u[6] = ue(() => {
2752
2753
  }, ["stop"]))
2753
2754
  }, null, 8, ["model-value", "onUpdate:modelValue"])
2754
2755
  ]),
@@ -2758,17 +2759,17 @@ const fl = {
2758
2759
  r(Vt, {
2759
2760
  sources: g(i),
2760
2761
  maxFiles: 1,
2761
- "initial-value": Be(T.id) ? [] : tt(T.id) ? [je(T.id)] : [je(T.id), ht(T.id)],
2762
- onSubmit: (O) => et(O, T.id)
2762
+ "initial-value": Xe(T.id) ? [] : Ye(T.id) ? [Oe(T.id)] : [Oe(T.id), ht(T.id)],
2763
+ onSubmit: (O) => He(O, T.id)
2763
2764
  }, {
2764
2765
  default: c(() => [
2765
2766
  p("button", {
2766
- onClick: u[7] || (u[7] = fe(() => {
2767
+ onClick: u[7] || (u[7] = ue(() => {
2767
2768
  }, ["stop"])),
2768
2769
  tabindex: "-1",
2769
2770
  class: "cursor-pointer"
2770
2771
  }, [
2771
- Be(T.id) ? (b(), R(pe, {
2772
+ Xe(T.id) ? (b(), R(fe, {
2772
2773
  key: 0,
2773
2774
  variant: "outline",
2774
2775
  class: "size-15 border-dashed cursor-pointer"
@@ -2777,9 +2778,9 @@ const fl = {
2777
2778
  r(g($t))
2778
2779
  ]),
2779
2780
  _: 1
2780
- })) : tt(T.id) ? (b(), k("img", {
2781
+ })) : Ye(T.id) ? (b(), k("img", {
2781
2782
  key: 1,
2782
- src: je(T.id),
2783
+ src: Oe(T.id),
2783
2784
  class: "size-15 rounded-md object-cover",
2784
2785
  draggable: "false"
2785
2786
  }, null, 8, Jl)) : (b(), k("div", Wl, [
@@ -2789,7 +2790,7 @@ const fl = {
2789
2790
  draggable: "false"
2790
2791
  }, null, 8, Zl),
2791
2792
  p("img", {
2792
- src: je(T.id),
2793
+ src: Oe(T.id),
2793
2794
  class: "relative size-15 rounded-md shadow object-cover",
2794
2795
  draggable: "false"
2795
2796
  }, null, 8, Ql)
@@ -2804,7 +2805,7 @@ const fl = {
2804
2805
  p("button", nr, [
2805
2806
  P(z(q(T.id).length) + " variants ", 1),
2806
2807
  r(g(It), {
2807
- class: De(["size-3 transition-transform duration-200", v.value.includes(T.id) ? "rotate-180" : ""])
2808
+ class: ye(["size-3 transition-transform duration-200", v.value.includes(T.id) ? "rotate-180" : ""])
2808
2809
  }, null, 8, ["class"])
2809
2810
  ])
2810
2811
  ])
@@ -2821,10 +2822,10 @@ const fl = {
2821
2822
  default: c(() => [
2822
2823
  r(St, {
2823
2824
  id: `variant-price-${T.id}`,
2824
- modelValue: he.value,
2825
- "onUpdate:modelValue": u[8] || (u[8] = (O) => he.value = O),
2826
- class: De(["dark:bg-transparent dark:border-ring/50 text-center", He.value === T.id ? "" : "text-transparent"]),
2827
- onClick: u[9] || (u[9] = fe(() => {
2825
+ modelValue: Fe.value,
2826
+ "onUpdate:modelValue": u[8] || (u[8] = (O) => Fe.value = O),
2827
+ class: ye(["dark:bg-transparent dark:border-ring/50 text-center", Ke.value === T.id ? "" : "text-transparent"]),
2828
+ onClick: u[9] || (u[9] = ue(() => {
2828
2829
  }, ["stop"])),
2829
2830
  onFocus: (O) => rn(O, T),
2830
2831
  onBlur: (O) => an(T.id),
@@ -2842,7 +2843,7 @@ const fl = {
2842
2843
  ]),
2843
2844
  _: 2
2844
2845
  }, 1024),
2845
- He.value !== T.id ? (b(), k("span", sr, z(nn(T.id)), 1)) : F("", !0)
2846
+ Ke.value !== T.id ? (b(), k("span", sr, z(nn(T.id)), 1)) : F("", !0)
2846
2847
  ])
2847
2848
  ]),
2848
2849
  p("td", ir, [
@@ -2850,7 +2851,7 @@ const fl = {
2850
2851
  default: c(() => [
2851
2852
  r(lt, {
2852
2853
  class: "w-full focus-visible:outline-none",
2853
- onClick: u[10] || (u[10] = fe(() => {
2854
+ onClick: u[10] || (u[10] = ue(() => {
2854
2855
  }, ["stop"]))
2855
2856
  }, {
2856
2857
  default: c(() => [
@@ -2873,7 +2874,7 @@ const fl = {
2873
2874
  _: 2
2874
2875
  }, 1024),
2875
2876
  r(rt, null, {
2876
- default: c(() => [...u[26] || (u[26] = [
2877
+ default: c(() => [...u[28] || (u[28] = [
2877
2878
  p("p", null, "Update for individual variants only", -1)
2878
2879
  ])]),
2879
2880
  _: 1
@@ -2883,7 +2884,7 @@ const fl = {
2883
2884
  }, 1024)
2884
2885
  ])
2885
2886
  ], 8, Yl),
2886
- v.value.includes(T.id) ? (b(!0), k(J, { key: 0 }, ce(q(T.id), (O) => (b(), k("tr", {
2887
+ v.value.includes(T.id) ? (b(!0), k(J, { key: 0 }, pe(q(T.id), (O) => (b(), k("tr", {
2887
2888
  key: O.key,
2888
2889
  class: "hover:bg-accent/50 cursor-pointer transition-colors duration-200 border-b border-input",
2889
2890
  onClick: (se) => g(N).openVariantDialog(O)
@@ -2892,9 +2893,9 @@ const fl = {
2892
2893
  p("div", cr, [
2893
2894
  r(ot, {
2894
2895
  class: "border-muted-foreground translate-y-0.5",
2895
- "model-value": D.value.includes(O.key),
2896
- "onUpdate:modelValue": (se) => ae(O.key, se),
2897
- onClick: u[11] || (u[11] = fe(() => {
2896
+ "model-value": S.value.includes(O.key),
2897
+ "onUpdate:modelValue": (se) => M(O.key, se),
2898
+ onClick: u[11] || (u[11] = ue(() => {
2898
2899
  }, ["stop"]))
2899
2900
  }, null, 8, ["model-value", "onUpdate:modelValue"])
2900
2901
  ])
@@ -2905,22 +2906,22 @@ const fl = {
2905
2906
  r(Vt, {
2906
2907
  sources: g(i),
2907
2908
  maxFiles: 1,
2908
- "initial-value": C.value[w(O.options)].image ? [C.value[w(O.options)].image] : [],
2909
- onSubmit: (se) => C.value[w(O.options)].image = se
2909
+ "initial-value": C.value[D(O.options)].image ? [C.value[D(O.options)].image] : [],
2910
+ onSubmit: (se) => C.value[D(O.options)].image = se
2910
2911
  }, {
2911
2912
  default: c(() => [
2912
2913
  p("button", {
2913
- onClick: u[12] || (u[12] = fe(() => {
2914
+ onClick: u[12] || (u[12] = ue(() => {
2914
2915
  }, ["stop"])),
2915
2916
  tabindex: "-1",
2916
2917
  class: "cursor-pointer"
2917
2918
  }, [
2918
- C.value[w(O.options)].image ? (b(), k("img", {
2919
+ C.value[D(O.options)].image ? (b(), k("img", {
2919
2920
  key: 0,
2920
- src: C.value[w(O.options)].image,
2921
+ src: C.value[D(O.options)].image,
2921
2922
  class: "size-10 object-cover rounded-md",
2922
2923
  draggable: "false"
2923
- }, null, 8, gr)) : (b(), R(pe, {
2924
+ }, null, 8, gr)) : (b(), R(fe, {
2924
2925
  key: 1,
2925
2926
  variant: "outline",
2926
2927
  class: "size-10 border-dashed cursor-pointer"
@@ -2948,9 +2949,11 @@ const fl = {
2948
2949
  currencyDisplay: "symbol",
2949
2950
  currencySign: "standard"
2950
2951
  },
2951
- modelValue: C.value[w(O.options)].price,
2952
- "onUpdate:modelValue": (se) => C.value[w(O.options)].price = se,
2953
- min: 0
2952
+ modelValue: C.value[D(O.options)].price,
2953
+ "onUpdate:modelValue": (se) => C.value[D(O.options)].price = se,
2954
+ min: 0,
2955
+ onClick: u[13] || (u[13] = ue(() => {
2956
+ }, ["stop"]))
2954
2957
  }, {
2955
2958
  default: c(() => [
2956
2959
  r(it, null, {
@@ -2965,8 +2968,10 @@ const fl = {
2965
2968
  ]),
2966
2969
  p("td", br, [
2967
2970
  r(dt, {
2968
- modelValue: C.value[w(O.options)].stock,
2969
- "onUpdate:modelValue": (se) => C.value[w(O.options)].stock = se
2971
+ modelValue: C.value[D(O.options)].stock,
2972
+ "onUpdate:modelValue": (se) => C.value[D(O.options)].stock = se,
2973
+ onClick: u[14] || (u[14] = ue(() => {
2974
+ }, ["stop"]))
2970
2975
  }, {
2971
2976
  default: c(() => [
2972
2977
  r(it, null, {
@@ -2988,7 +2993,7 @@ const fl = {
2988
2993
  p("div", _r, [
2989
2994
  P(" Total inventory at Webshop: " + z(ln()) + " ", 1),
2990
2995
  xt() < 0 ? (b(), k("span", hr, "(" + z(xt()) + ")", 1)) : F("", !0),
2991
- u[27] || (u[27] = P(" available ", -1))
2996
+ u[29] || (u[29] = P(" available ", -1))
2992
2997
  ])
2993
2998
  ], 64)) : F("", !0)
2994
2999
  ])),
@@ -3002,38 +3007,38 @@ const fl = {
3002
3007
  }), xr = /* @__PURE__ */ ne({
3003
3008
  __name: "Variants",
3004
3009
  setup(e) {
3005
- const { params: t } = Bt(), { value: n } = B("options"), { value: o } = B("variants"), l = L([]), s = L([]), i = Ie("optionsEl"), d = Ie("variantsEl");
3010
+ const { params: t } = Bt(), { value: n } = j("options"), { value: o } = j("variants"), l = B([]), s = B([]), i = Ne("optionsEl"), d = Ne("variantsEl");
3006
3011
  te(l, async (f) => {
3007
- n.value = f ? JSON.parse(JSON.stringify(f)) : [], await Re(), d.value?.refreshVariants();
3012
+ n.value = f ? JSON.parse(JSON.stringify(f)) : [], await Ue(), d.value?.refreshVariants();
3008
3013
  }, { deep: !0 }), te(s, (f) => {
3009
3014
  o.value = f ? JSON.parse(JSON.stringify(f)) : [];
3010
3015
  }, { deep: !0 });
3011
- const a = L(!1), x = L(!1);
3016
+ const a = B(!1), x = B(!1);
3012
3017
  te(n, async (f) => {
3013
- t.value.productId == "new" || !f || Array.isArray(f) && f.length === 0 || a.value || (a.value = !0, l.value = JSON.parse(JSON.stringify(f)), await Re(), f.length > 1 && i.value?.minifyAll());
3018
+ t.value.productId == "new" || !f || Array.isArray(f) && f.length === 0 || a.value || (a.value = !0, l.value = JSON.parse(JSON.stringify(f)), await Ue(), f.length > 1 && i.value?.minifyAll());
3014
3019
  }, { deep: !0, immediate: !0 }), te(o, async (f) => {
3015
- t.value.productId == "new" || !f || Array.isArray(f) && f.length === 0 || x.value || (x.value = !0, s.value = JSON.parse(JSON.stringify(f)), await Re(), d.value?.setVariantMap(f));
3020
+ t.value.productId == "new" || !f || Array.isArray(f) && f.length === 0 || x.value || (x.value = !0, s.value = JSON.parse(JSON.stringify(f)), await Ue(), d.value?.setVariantMap(f));
3016
3021
  }, { deep: !0, immediate: !0 });
3017
3022
  const v = G(() => {
3018
- let f = l.value || [], D = {};
3023
+ let f = l.value || [], S = {};
3019
3024
  return !f || !Array.isArray(f) || f.forEach((C) => {
3020
- !C.name.trim() || C.values?.filter((N) => N.value.trim() !== "")?.length === 0 || (D[C.id] = {
3025
+ !C.name.trim() || C.values?.filter((N) => N.value.trim() !== "")?.length === 0 || (S[C.id] = {
3021
3026
  id: C.id,
3022
3027
  name: C.name,
3023
3028
  values: C.values?.map((N) => ({ id: N.id, value: N.value }))?.filter((N) => N.value.trim() !== "") || []
3024
3029
  });
3025
- }), D;
3030
+ }), S;
3026
3031
  });
3027
- return (f, D) => {
3032
+ return (f, S) => {
3028
3033
  const C = m("CardContent"), N = m("Card");
3029
3034
  return b(), R(N, null, {
3030
3035
  default: c(() => [
3031
3036
  r(C, null, {
3032
3037
  default: c(() => [
3033
- D[2] || (D[2] = p("h3", { class: "text-lg font-semibold mb-4" }, "Variants", -1)),
3038
+ S[2] || (S[2] = p("h3", { class: "text-lg font-semibold mb-4" }, "Variants", -1)),
3034
3039
  r(Nl, {
3035
3040
  modelValue: l.value,
3036
- "onUpdate:modelValue": D[0] || (D[0] = (E) => l.value = E),
3041
+ "onUpdate:modelValue": S[0] || (S[0] = ($) => l.value = $),
3037
3042
  ref_key: "optionsEl",
3038
3043
  ref: i
3039
3044
  }, null, 8, ["modelValue"]),
@@ -3042,7 +3047,7 @@ const fl = {
3042
3047
  ref: d,
3043
3048
  options: v.value,
3044
3049
  modelValue: s.value,
3045
- "onUpdate:modelValue": D[1] || (D[1] = (E) => s.value = E),
3050
+ "onUpdate:modelValue": S[1] || (S[1] = ($) => s.value = $),
3046
3051
  hide: Object.keys(v.value).length === 0
3047
3052
  }, null, 8, ["options", "modelValue", "hide"])
3048
3053
  ]),
@@ -3071,17 +3076,17 @@ const fl = {
3071
3076
  }, Ur = /* @__PURE__ */ ne({
3072
3077
  __name: "SEO",
3073
3078
  setup(e) {
3074
- const { errors: t } = Ee(), { value: n } = B("title"), { value: o } = B("slug"), { value: l } = B("seo");
3079
+ const { errors: t } = Ie(), { value: n } = j("title"), { value: o } = j("slug"), { value: l } = j("seo");
3075
3080
  function s(i) {
3076
3081
  return i ? i.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^\w\s-]/g, "").trim().replace(/[-\s]+/g, "-") : "";
3077
3082
  }
3078
3083
  return te(n, (i, d) => {
3079
3084
  (!o.value || s(d) === o.value) && (o.value = s(i)), (!l.value.title || d === l.value.title) && (l.value.title = i);
3080
3085
  }), (i, d) => {
3081
- const a = m("Label"), x = m("Input"), v = m("Textarea"), f = m("ProgressCircle"), D = m("CardContent"), C = m("Card");
3086
+ const a = m("Label"), x = m("Input"), v = m("Textarea"), f = m("ProgressCircle"), S = m("CardContent"), C = m("Card");
3082
3087
  return b(), R(C, null, {
3083
3088
  default: c(() => [
3084
- r(D, null, {
3089
+ r(S, null, {
3085
3090
  default: c(() => [
3086
3091
  d[7] || (d[7] = p("h3", { class: "text-lg font-semibold mb-4" }, "Search engine listing", -1)),
3087
3092
  p("div", Dr, [
@@ -3213,10 +3218,10 @@ const fl = {
3213
3218
  }, Yr = /* @__PURE__ */ ne({
3214
3219
  __name: "Status",
3215
3220
  setup(e) {
3216
- const { errors: t } = Ee(), { value: n } = B("status");
3221
+ const { errors: t } = Ie(), { value: n } = j("status");
3217
3222
  return (o, l) => {
3218
- const s = m("SelectValue"), i = m("SelectTrigger"), d = m("SelectItem"), a = m("SelectGroup"), x = m("SelectContent"), v = m("Select"), f = m("CardContent"), D = m("Card");
3219
- return b(), R(D, null, {
3223
+ const s = m("SelectValue"), i = m("SelectTrigger"), d = m("SelectItem"), a = m("SelectGroup"), x = m("SelectContent"), v = m("Select"), f = m("CardContent"), S = m("Card");
3224
+ return b(), R(S, null, {
3220
3225
  default: c(() => [
3221
3226
  r(f, null, {
3222
3227
  default: c(() => [
@@ -3303,13 +3308,13 @@ const fl = {
3303
3308
  if (!t.config.collectionsCollection) return [];
3304
3309
  const v = t.config.collectionsCollection.split(":");
3305
3310
  return v.length !== 2 ? [] : (await n.get(v[0]))?.[v[1]] || [];
3306
- }, l = L([]);
3311
+ }, l = B([]);
3307
3312
  (async () => {
3308
3313
  const v = await o();
3309
3314
  l.value = v;
3310
3315
  })();
3311
- const { value: i } = B("collections"), d = G(() => l.value.flatMap((v) => {
3312
- const f = v.status || "draft", D = [
3316
+ const { value: i } = j("collections"), d = G(() => l.value.flatMap((v) => {
3317
+ const f = v.status || "draft", S = [
3313
3318
  {
3314
3319
  id: v.id,
3315
3320
  title: v.title,
@@ -3317,29 +3322,29 @@ const fl = {
3317
3322
  isSubcollection: !1
3318
3323
  }
3319
3324
  ];
3320
- return Array.isArray(v.subcollections) && D.push(...v.subcollections.map((C) => ({
3325
+ return Array.isArray(v.subcollections) && S.push(...v.subcollections.map((C) => ({
3321
3326
  id: C.id,
3322
3327
  title: C.title,
3323
3328
  status: f === "published" && C.status || f,
3324
3329
  isSubcollection: !0,
3325
3330
  parentTitle: v.title
3326
- }))), D;
3331
+ }))), S;
3327
3332
  })), a = G(() => Array.isArray(i.value) ? i.value.map((v) => d.value.find((f) => f.id === v)).filter(Boolean) : []), x = (v) => v.isSubcollection ? `${v.parentTitle} / ${v.title}` : v.title;
3328
3333
  return (v, f) => {
3329
- const D = m("SelectTrigger"), C = m("SelectItem"), N = m("SelectGroup"), E = m("SelectContent"), M = m("Select"), A = m("CardContent"), S = m("Card");
3330
- return b(), R(S, null, {
3334
+ const S = m("SelectTrigger"), C = m("SelectItem"), N = m("SelectGroup"), $ = m("SelectContent"), A = m("Select"), E = m("CardContent"), V = m("Card");
3335
+ return b(), R(V, null, {
3331
3336
  default: c(() => [
3332
- r(A, null, {
3337
+ r(E, null, {
3333
3338
  default: c(() => [
3334
3339
  f[1] || (f[1] = p("h3", { class: "text-lg font-semibold mb-4" }, "Collections", -1)),
3335
- r(M, {
3340
+ r(A, {
3336
3341
  modelValue: g(i),
3337
- "onUpdate:modelValue": f[0] || (f[0] = (w) => Y(i) ? i.value = w : null),
3342
+ "onUpdate:modelValue": f[0] || (f[0] = (D) => Y(i) ? i.value = D : null),
3338
3343
  class: "w-full",
3339
3344
  multiple: !0
3340
3345
  }, {
3341
3346
  default: c(() => [
3342
- r(D, { class: "w-full" }, {
3347
+ r(S, { class: "w-full" }, {
3343
3348
  default: c(() => [
3344
3349
  p("div", Kr, [
3345
3350
  a.value.length === 0 ? (b(), k("span", Gr, "Collections")) : a.value.length === 1 ? (b(), k("span", qr, z(x(a.value[0])), 1)) : a.value.length === 2 ? (b(), k("span", Jr, z(x(a.value[0])) + ", " + z(x(a.value[1])), 1)) : (b(), k("span", Wr, z(x(a.value[0])) + ", " + z(x(a.value[1])) + " + " + z(a.value.length - 2), 1))
@@ -3347,26 +3352,26 @@ const fl = {
3347
3352
  ]),
3348
3353
  _: 1
3349
3354
  }),
3350
- r(E, null, {
3355
+ r($, null, {
3351
3356
  default: c(() => [
3352
3357
  r(N, null, {
3353
3358
  default: c(() => [
3354
- (b(!0), k(J, null, ce(d.value, (w) => (b(), R(C, {
3355
- key: w.id,
3356
- value: w.id
3359
+ (b(!0), k(J, null, pe(d.value, (D) => (b(), R(C, {
3360
+ key: D.id,
3361
+ value: D.id
3357
3362
  }, {
3358
3363
  default: c(() => [
3359
3364
  p("div", {
3360
- class: De(["flex min-w-0 items-center gap-2", { "pl-4": w.isSubcollection }])
3365
+ class: ye(["flex min-w-0 items-center gap-2", { "pl-4": D.isSubcollection }])
3361
3366
  }, [
3362
- w.isSubcollection ? (b(), R(g(Nn), {
3367
+ D.isSubcollection ? (b(), R(g(Nn), {
3363
3368
  key: 0,
3364
3369
  class: "size-4 shrink-0 text-muted-foreground"
3365
3370
  })) : F("", !0),
3366
3371
  p("div", {
3367
- class: De(["size-2 rounded-full shrink-0", w.status === "published" ? "bg-green-500" : "bg-blue-500"])
3372
+ class: ye(["size-2 rounded-full shrink-0", D.status === "published" ? "bg-green-500" : "bg-blue-500"])
3368
3373
  }, null, 2),
3369
- p("span", Zr, z(w.title), 1)
3374
+ p("span", Zr, z(D.title), 1)
3370
3375
  ], 2)
3371
3376
  ]),
3372
3377
  _: 2
@@ -3412,72 +3417,75 @@ const fl = {
3412
3417
  let t, n;
3413
3418
  const o = e, { hasPermission: l, hasAnyPermission: s, isAdmin: i } = Mn(), { params: d, navigateTo: a } = Bt(), { confirm: x } = Lt(), v = jt(o.config.project);
3414
3419
  Pt("sources", o.config.allowedMediaSources), Pt("defaultSource", o.config.defaultUploadMediaSource);
3415
- const f = L(!1), D = G(() => !d.value.productId || d.value.productId === "new"), C = L(""), N = L([]);
3416
- N.value = ([t, n] = yn(() => Ae()), t = await t, n(), t);
3417
- const E = xn(Ne({
3420
+ const f = B(!1), S = G(() => !d.value.productId || d.value.productId === "new"), C = B(""), N = B([]);
3421
+ N.value = ([t, n] = yn(() => je()), t = await t, n(), t);
3422
+ const $ = we(
3423
+ (w) => w === null || typeof w == "string" && w.trim() === "" ? void 0 : w,
3424
+ ke.number().finite("Must be a valid price").nonnegative("Must be 0 or greater")
3425
+ ), A = xn(Ve({
3418
3426
  title: X().min(1, "Title is required"),
3419
3427
  description: X().optional(),
3420
- media: ye(X()).optional(),
3421
- price: xe.number().positive("Must be positive"),
3422
- compareAtPrice: Oe(
3423
- (V) => V === "" ? void 0 : V,
3424
- xe.number().positive("Must be positive").optional()
3428
+ media: he(X()).optional(),
3429
+ price: $,
3430
+ compareAtPrice: we(
3431
+ (w) => w === "" ? void 0 : w,
3432
+ ke.number().positive("Must be positive").optional()
3425
3433
  ),
3426
- isTaxable: Fe().optional(),
3427
- costPerItem: Oe(
3428
- (V) => V === "" ? void 0 : V,
3429
- xe.number().positive("Must be positive").optional()
3434
+ isTaxable: Re().optional(),
3435
+ costPerItem: we(
3436
+ (w) => w === "" ? void 0 : w,
3437
+ ke.number().positive("Must be positive").optional()
3430
3438
  ),
3431
3439
  currency: X(),
3432
- stock: Oe(
3433
- (V) => V === "" ? void 0 : V,
3434
- xe.number().optional()
3440
+ stock: we(
3441
+ (w) => w === "" ? void 0 : w,
3442
+ ke.number().optional()
3435
3443
  ),
3436
- trackInventory: Fe().optional(),
3437
- allowBackorder: Fe().optional(),
3438
- isPhysicalProduct: Fe().optional(),
3439
- weight: Oe(
3440
- (V) => V === "" ? void 0 : V,
3441
- xe.number().optional()
3444
+ trackInventory: Re().optional(),
3445
+ allowBackorder: Re().optional(),
3446
+ isPhysicalProduct: Re().optional(),
3447
+ weight: we(
3448
+ (w) => w === "" ? void 0 : w,
3449
+ ke.number().optional()
3442
3450
  ),
3443
3451
  weightUnit: X().optional(),
3444
3452
  slug: X(),
3445
- seo: Ne({
3453
+ seo: Ve({
3446
3454
  title: X().optional(),
3447
3455
  description: X().optional()
3448
3456
  }).optional(),
3449
3457
  createdAt: Et(),
3450
3458
  updatedAt: Et(),
3451
3459
  status: X(),
3452
- options: ye(Ne({
3460
+ options: he(Ve({
3453
3461
  id: X(),
3454
3462
  name: X().min(1),
3455
- values: ye(Ne({
3463
+ values: he(Ve({
3456
3464
  id: X(),
3457
3465
  value: X()
3458
3466
  }))
3459
3467
  })).optional(),
3460
- variants: ye(Ne({
3468
+ variants: he(Ve({
3461
3469
  combinedOptions: X().min(1),
3462
3470
  name: X().min(1),
3463
- disabled: Fe().optional(),
3464
- price: xe.number().positive("Must be positive"),
3465
- stock: Oe(
3466
- (V) => V === "" ? void 0 : V,
3467
- xe.number().optional()
3471
+ disabled: Re().optional(),
3472
+ price: $,
3473
+ stock: we(
3474
+ (w) => w === "" ? void 0 : w,
3475
+ ke.number().optional()
3468
3476
  ),
3469
3477
  image: X().optional(),
3470
- options: ye(Ne({
3478
+ options: he(Ve({
3471
3479
  optionId: X(),
3472
3480
  option: X(),
3473
3481
  valueId: X(),
3474
3482
  value: X()
3475
3483
  }))
3476
3484
  })).optional(),
3477
- tags: ye(X()).optional(),
3478
- collections: ye(X()).optional()
3479
- })), { handleSubmit: M, errors: A, values: S, setValues: w } = Dn({
3480
- validationSchema: E,
3485
+ tags: he(X()).optional(),
3486
+ collections: he(X()).optional()
3487
+ })), { handleSubmit: E, errors: V, values: D, setValues: U } = Dn({
3488
+ validationSchema: A,
3481
3489
  initialValues: {
3482
3490
  createdAt: /* @__PURE__ */ new Date(),
3483
3491
  updatedAt: /* @__PURE__ */ new Date(),
@@ -3503,69 +3511,69 @@ const fl = {
3503
3511
  }
3504
3512
  });
3505
3513
  An(() => [
3506
- { text: D.value ? "New Product" : S.title || "Product" }
3514
+ { text: S.value ? "New Product" : D.title || "Product" }
3507
3515
  ]);
3508
- const U = (V) => {
3509
- let $ = {
3510
- ...V,
3511
- maxPrice: W(),
3512
- minPrice: j(),
3513
- maxCompareAtPrice: ie(),
3514
- minCompareAtPrice: oe(),
3515
- isSingleVariant: !V.variants || V.variants.length === 0,
3516
- variantsTotal: V.variants?.length || 1,
3517
- stock: Ze(),
3518
- featuredMedia: V.media?.[0]
3516
+ const W = (w) => {
3517
+ let M = {
3518
+ ...w,
3519
+ maxPrice: H(),
3520
+ minPrice: oe(),
3521
+ maxCompareAtPrice: tt(),
3522
+ minCompareAtPrice: ie(),
3523
+ isSingleVariant: !w.variants || w.variants.length === 0,
3524
+ variantsTotal: w.variants?.length || 1,
3525
+ stock: Ee(),
3526
+ featuredMedia: w.media?.[0]
3519
3527
  };
3520
- return $.isPhysicalProduct ? $.type = "physical" : ($.weight = 0, $.weightUnit = "kg", $.type = "digital"), $;
3521
- }, W = () => !S.variants || S.variants.length === 0 ? S.price : Math.max(...S.variants.map((V) => V.price)), j = () => !S.variants || S.variants.length === 0 ? S.price : Math.min(...S.variants.map((V) => V.price)), oe = () => S.compareAtPrice, ie = () => S.compareAtPrice, Ze = () => !S.variants || S.variants.length === 0 ? S.stock : S.variants.reduce((V, $) => $.stock < 0 ? V : V + $.stock, 0), we = M(async (V) => {
3528
+ return M.isPhysicalProduct ? M.type = "physical" : (M.weight = 0, M.weightUnit = "kg", M.type = "digital"), M;
3529
+ }, H = () => !D.variants || D.variants.length === 0 ? D.price : Math.max(...D.variants.map((w) => w.price)), oe = () => !D.variants || D.variants.length === 0 ? D.price : Math.min(...D.variants.map((w) => w.price)), ie = () => D.compareAtPrice, tt = () => D.compareAtPrice, Ee = () => !D.variants || D.variants.length === 0 ? D.stock : D.variants.reduce((w, M) => M.stock < 0 ? w : w + M.stock, 0), Be = E(async (w) => {
3522
3530
  f.value = !0;
3523
- let $ = U(V);
3524
- if (D.value) {
3525
- if (await Ve($.slug)) {
3531
+ let M = W(w);
3532
+ if (S.value) {
3533
+ if (await Ae(M.slug)) {
3526
3534
  de.error("Product slug already exists");
3527
3535
  return;
3528
3536
  }
3529
- $.createdAt = /* @__PURE__ */ new Date(), $.updatedAt = /* @__PURE__ */ new Date();
3530
- const ae = await v.add(o.config.productCollection, $);
3537
+ M.createdAt = /* @__PURE__ */ new Date(), M.updatedAt = /* @__PURE__ */ new Date();
3538
+ const ae = await v.add(o.config.productCollection, M);
3531
3539
  a(ae.id), de.success("Product created");
3532
3540
  } else {
3533
- if (C.value !== $.slug && await Ve($.slug)) {
3541
+ if (C.value !== M.slug && await Ae(M.slug)) {
3534
3542
  de.error("Product slug already exists");
3535
3543
  return;
3536
3544
  }
3537
- $.updatedAt = /* @__PURE__ */ new Date(), await v.update(o.config.productCollection, d.value.productId, $), a(`${d.value.productId}`), de.success("Product updated");
3545
+ M.updatedAt = /* @__PURE__ */ new Date(), await v.update(o.config.productCollection, d.value.productId, M), a(`${d.value.productId}`), de.success("Product updated");
3538
3546
  }
3539
3547
  f.value = !1;
3540
- }), Qe = async () => {
3541
- const V = await v.get(o.config.productCollection, d.value.productId);
3542
- if (!V) {
3548
+ }), q = async () => {
3549
+ const w = await v.get(o.config.productCollection, d.value.productId);
3550
+ if (!w) {
3543
3551
  de.error("Product not found"), a("");
3544
3552
  return;
3545
3553
  }
3546
- V.createdAt = new Date(V.createdAt), V.updatedAt = new Date(V.updatedAt), V.options?.forEach(($) => {
3547
- $.values.forEach((ae) => {
3554
+ w.createdAt = new Date(w.createdAt), w.updatedAt = new Date(w.updatedAt), w.options?.forEach((M) => {
3555
+ M.values.forEach((ae) => {
3548
3556
  ae.touched = !0;
3549
- }), $.values.push({ id: Math.random().toString(36).substring(2, 15), value: "" });
3550
- }), w(V), C.value = V.slug;
3551
- }, q = async () => {
3557
+ }), M.values.push({ id: Math.random().toString(36).substring(2, 15), value: "" });
3558
+ }), U(w), C.value = w.slug;
3559
+ }, be = async () => {
3552
3560
  try {
3553
- let V = { ...S }, $ = V.slug + "-copy", ae = 2;
3554
- for (; await Ve($); )
3555
- $ = V.slug + "-copy-" + ae, ae++;
3556
- V.id = void 0, V.createdAt = /* @__PURE__ */ new Date(), V.updatedAt = /* @__PURE__ */ new Date(), V.slug = $, V.status = "draft", V.title = V.title + " (copy)";
3557
- const _e = await v.add(o.config.productCollection, V);
3561
+ let w = { ...D }, M = w.slug + "-copy", ae = 2;
3562
+ for (; await Ae(M); )
3563
+ M = w.slug + "-copy-" + ae, ae++;
3564
+ w.id = void 0, w.createdAt = /* @__PURE__ */ new Date(), w.updatedAt = /* @__PURE__ */ new Date(), w.slug = M, w.status = "draft", w.title = w.title + " (copy)";
3565
+ const _e = await v.add(o.config.productCollection, w);
3558
3566
  a(_e.id), de.success("Product duplicated");
3559
3567
  } catch {
3560
3568
  de.error("Failed to duplicate product");
3561
3569
  }
3562
- }, be = async () => {
3570
+ }, Se = async () => {
3563
3571
  try {
3564
- await v.update(o.config.productCollection, d.value.productId, { status: "archived" }), w({ status: "archived" }, { force: !1 }), de.success("Product archived");
3572
+ await v.update(o.config.productCollection, d.value.productId, { status: "archived" }), U({ status: "archived" }, { force: !1 }), de.success("Product archived");
3565
3573
  } catch {
3566
3574
  de.error("Failed to archive product");
3567
3575
  }
3568
- }, ke = async () => {
3576
+ }, Me = async () => {
3569
3577
  if (await x("Are you sure you want to delete this product?"))
3570
3578
  try {
3571
3579
  await v.remove(o.config.productCollection, d.value.productId), a(""), de.success("Product deleted");
@@ -3573,32 +3581,32 @@ const fl = {
3573
3581
  de.error("Failed to delete product");
3574
3582
  }
3575
3583
  };
3576
- async function Ae() {
3584
+ async function je() {
3577
3585
  if (!o.config.collectionsCollection) return [];
3578
- const V = o.config.collectionsCollection.split(":");
3579
- return V.length !== 2 ? [] : (await v.get(V[0]))?.[V[1]] || [];
3586
+ const w = o.config.collectionsCollection.split(":");
3587
+ return w.length !== 2 ? [] : (await v.get(w[0]))?.[w[1]] || [];
3580
3588
  }
3581
- async function Ve(V) {
3589
+ async function Ae(w) {
3582
3590
  return (await v.find(o.config.productCollection, {
3583
3591
  filters: [
3584
3592
  {
3585
3593
  field: "slug",
3586
3594
  operator: "==",
3587
- value: V
3595
+ value: w
3588
3596
  }
3589
3597
  ]
3590
3598
  })).length > 0;
3591
3599
  }
3592
3600
  return vt(() => {
3593
- D.value || Qe();
3594
- }), (V, $) => {
3595
- const ae = m("Button"), _e = m("MenubarTrigger"), ze = m("MenubarMenu"), Le = m("MenubarItem"), et = m("MenubarContent"), Be = m("Menubar");
3601
+ S.value || q();
3602
+ }), (w, M) => {
3603
+ const ae = m("Button"), _e = m("MenubarTrigger"), ze = m("MenubarMenu"), He = m("MenubarItem"), Xe = m("MenubarContent"), Ye = m("Menubar");
3596
3604
  return b(), k("div", ea, [
3597
3605
  p("div", ta, [
3598
3606
  p("div", na, [
3599
3607
  r(ae, {
3600
3608
  variant: "ghost",
3601
- onClick: $[0] || ($[0] = (tt) => g(a)(""))
3609
+ onClick: M[0] || (M[0] = (Oe) => g(a)(""))
3602
3610
  }, {
3603
3611
  default: c(() => [
3604
3612
  r(g(Tn), { class: "size-4" })
@@ -3606,18 +3614,18 @@ const fl = {
3606
3614
  _: 1
3607
3615
  }),
3608
3616
  r(g(In), { class: "size-3" }),
3609
- p("h1", oa, z(D.value ? "New Product" : g(S).title), 1),
3610
- g(S).status === "published" ? (b(), k("span", la, "Published")) : g(S).status === "draft" ? (b(), k("span", ra, "Draft")) : g(S).status === "archived" ? (b(), k("span", aa, "Archived")) : F("", !0)
3617
+ p("h1", oa, z(S.value ? "New Product" : g(D).title), 1),
3618
+ g(D).status === "published" ? (b(), k("span", la, "Published")) : g(D).status === "draft" ? (b(), k("span", ra, "Draft")) : g(D).status === "archived" ? (b(), k("span", aa, "Archived")) : F("", !0)
3611
3619
  ]),
3612
- D.value ? F("", !0) : (b(), R(Be, {
3620
+ S.value ? F("", !0) : (b(), R(Ye, {
3613
3621
  key: 0,
3614
3622
  class: "rounded-lg shadow-xs"
3615
3623
  }, {
3616
3624
  default: c(() => [
3617
3625
  g(l)("create-product") ? (b(), R(ze, { key: 0 }, {
3618
3626
  default: c(() => [
3619
- r(_e, { onClick: q }, {
3620
- default: c(() => [...$[1] || ($[1] = [
3627
+ r(_e, { onClick: be }, {
3628
+ default: c(() => [...M[1] || (M[1] = [
3621
3629
  P("Duplicate", -1)
3622
3630
  ])]),
3623
3631
  _: 1
@@ -3628,7 +3636,7 @@ const fl = {
3628
3636
  r(ze, null, {
3629
3637
  default: c(() => [
3630
3638
  r(_e, null, {
3631
- default: c(() => [...$[2] || ($[2] = [
3639
+ default: c(() => [...M[2] || (M[2] = [
3632
3640
  P("Preview", -1)
3633
3641
  ])]),
3634
3642
  _: 1
@@ -3639,31 +3647,31 @@ const fl = {
3639
3647
  g(s)("edit-product", "delete-product") ? (b(), R(ze, { key: 1 }, {
3640
3648
  default: c(() => [
3641
3649
  r(_e, null, {
3642
- default: c(() => [...$[3] || ($[3] = [
3650
+ default: c(() => [...M[3] || (M[3] = [
3643
3651
  P("More actions", -1)
3644
3652
  ])]),
3645
3653
  _: 1
3646
3654
  }),
3647
- r(et, null, {
3655
+ r(Xe, null, {
3648
3656
  default: c(() => [
3649
- g(l)("edit-product") ? (b(), R(Le, {
3657
+ g(l)("edit-product") ? (b(), R(He, {
3650
3658
  key: 0,
3651
- onClick: be
3659
+ onClick: Se
3652
3660
  }, {
3653
3661
  default: c(() => [
3654
3662
  r(g($n), { class: "size-4" }),
3655
- $[4] || ($[4] = P(" Archive product ", -1))
3663
+ M[4] || (M[4] = P(" Archive product ", -1))
3656
3664
  ]),
3657
3665
  _: 1
3658
3666
  })) : F("", !0),
3659
- g(l)("delete-product") ? (b(), R(Le, {
3667
+ g(l)("delete-product") ? (b(), R(He, {
3660
3668
  key: 1,
3661
3669
  variant: "destructive",
3662
- onClick: ke
3670
+ onClick: Me
3663
3671
  }, {
3664
3672
  default: c(() => [
3665
3673
  r(g(En), { class: "size-4" }),
3666
- $[5] || ($[5] = P(" Delete product ", -1))
3674
+ M[5] || (M[5] = P(" Delete product ", -1))
3667
3675
  ]),
3668
3676
  _: 1
3669
3677
  })) : F("", !0)
@@ -3694,9 +3702,9 @@ const fl = {
3694
3702
  ]),
3695
3703
  g(s)("create-product", "edit-product") ? (b(), k("div", ua, [
3696
3704
  p("div", ca, [
3697
- D.value && g(l)("create-product") ? (b(), R(ae, {
3705
+ S.value && g(l)("create-product") ? (b(), R(ae, {
3698
3706
  key: 0,
3699
- onClick: g(we),
3707
+ onClick: g(Be),
3700
3708
  disabled: f.value
3701
3709
  }, {
3702
3710
  default: c(() => [
@@ -3709,7 +3717,7 @@ const fl = {
3709
3717
  _: 1
3710
3718
  }, 8, ["onClick", "disabled"])) : g(l)("edit-product") ? (b(), R(ae, {
3711
3719
  key: 1,
3712
- onClick: g(we),
3720
+ onClick: g(Be),
3713
3721
  disabled: f.value
3714
3722
  }, {
3715
3723
  default: c(() => [