@oneclick.dev/cms-core-modules 0.0.122 → 0.0.124

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/dist/{ContentEditor-CoJjsV-m.js → ContentEditor-BcIUumah.js} +63 -59
  2. package/dist/{ContentEditor-DIwqplfB.mjs → ContentEditor-DX1bTQKs.mjs} +27894 -26319
  3. package/dist/{Detail-Dk8E6_uF.mjs → Detail-B7pe808q.mjs} +15 -14
  4. package/dist/Detail-BESGmY7z.js +1 -0
  5. package/dist/{Detail-Cn9Bk0u0.mjs → Detail-B_Q7Qkuz.mjs} +26 -25
  6. package/dist/Detail-CNiLIEh9.js +1 -0
  7. package/dist/{Detail-B_scnidb.mjs → Detail-DNxAzeCs.mjs} +35 -34
  8. package/dist/Detail-t3tOcy3X.js +1 -0
  9. package/dist/Editor-D4evcdhv.mjs +768 -0
  10. package/dist/Editor-gLLtuJbY.js +1 -0
  11. package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-BjKpsqT9.js +1 -0
  12. package/dist/FormStatusBadge.vue_vue_type_script_setup_true_lang-D5v5AhLe.mjs +76 -0
  13. package/dist/Knowledge-B66vxz--.js +1 -0
  14. package/dist/Knowledge-BnMTTuJ7.mjs +742 -0
  15. package/dist/{NewReservationDialog.vue_vue_type_script_setup_true_lang-bZidw6RT.mjs → NewReservationDialog.vue_vue_type_script_setup_true_lang-8I_Z9cD_.mjs} +530 -530
  16. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BVE_uURZ.js +1 -0
  17. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BdFa-xNf.mjs +3566 -0
  18. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DzPOadcU.js +925 -0
  19. package/dist/Overview-BE4uYPx0.mjs +745 -0
  20. package/dist/Overview-CQRpFhbJ.mjs +286 -0
  21. package/dist/Overview-CTs7sX4d.js +1 -0
  22. package/dist/Overview-Cj89XXKN.js +1 -0
  23. package/dist/Overview-D_c18mbR.mjs +248 -0
  24. package/dist/Overview-g4Rcj245.js +1 -0
  25. package/dist/TableCalculationWidget-CkQPrVUd.js +59 -0
  26. package/dist/TableCalculationWidget-CrqcLGfU.mjs +254 -0
  27. package/dist/TableDataWidget-7qvC3Egd.js +1 -0
  28. package/dist/TableDataWidget-DMTSoGRO.mjs +121 -0
  29. package/dist/TableOverviewCard-AFq-puJs.js +1 -0
  30. package/dist/TableOverviewCard-Ci0d4o4w.mjs +391 -0
  31. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-CBn-Oxl9.mjs +534 -0
  32. package/dist/TableResultView.vue_vue_type_script_setup_true_lang-C_Lv-SmJ.js +1 -0
  33. package/dist/TableRowActionCard-BhdnnPaq.mjs +266 -0
  34. package/dist/TableRowActionCard-IzB6tNN-.js +1 -0
  35. package/dist/TableView-6mdrL3zx.js +4 -0
  36. package/dist/TableView-Du5nOE6R.mjs +8228 -0
  37. package/dist/Test-CzmOmi53.mjs +447 -0
  38. package/dist/Test-USDtNFY1.js +1 -0
  39. package/dist/UserDetail-DpUL3mhk.mjs +1483 -0
  40. package/dist/UserDetail-KRIfxaYd.js +1 -0
  41. package/dist/{agenda-BCKDYOeF.mjs → agenda-DWdbWUbb.mjs} +10 -9
  42. package/dist/agenda-r9Gl85GL.js +1 -0
  43. package/dist/cms-core-modules.css +1 -1
  44. package/dist/dateRangePresets-B-l5b_wR.mjs +48 -0
  45. package/dist/dateRangePresets-CPWqst_x.js +1 -0
  46. package/dist/fuse-Deb-Iq39.mjs +1473 -0
  47. package/dist/fuse-_CGUd5Zq.js +1 -0
  48. package/dist/{index-DU3Ib10Z.mjs → index-B_qaX29C.mjs} +7 -6
  49. package/dist/index-CQuN5rKx.js +1 -0
  50. package/dist/index-CnDGeInm.js +1 -0
  51. package/dist/index-CqDTc5Ig.mjs +20 -0
  52. package/dist/index-CyvvAdt4.js +1 -0
  53. package/dist/index-DIRD7t5_.mjs +20 -0
  54. package/dist/index-OJuBYR60.mjs +57 -0
  55. package/dist/{index-Bk3yLv_G.js → index-yHLT6gaZ.js} +3 -3
  56. package/dist/index.cjs.js +1 -1
  57. package/dist/index.mjs +671 -118
  58. package/dist/{orders-CElKNc1v.mjs → orders-BfTLIm7U.mjs} +10 -9
  59. package/dist/orders-DUa2PVoa.js +1 -0
  60. package/dist/reports-ChCsd1Gk.mjs +1107 -0
  61. package/dist/reports-DmJPm8uP.js +158 -0
  62. package/dist/row-item-C1dUyimV.mjs +204 -0
  63. package/dist/row-item-Cyo3m3MZ.js +1 -0
  64. package/dist/server-handlers.cjs.js +1 -1
  65. package/dist/server-handlers.mjs +1764 -605
  66. package/dist/src/appointments/components/edit/EventDialog/BookingsList.vue.d.ts +9 -3
  67. package/dist/src/appointments/components/edit/EventDialog/OrderDetailDialog.vue.d.ts +2 -0
  68. package/dist/src/appointments/components/edit/EventDialog/ReservationDetailDialog.vue.d.ts +4 -2
  69. package/dist/src/appointments/components/edit/dashboard/BookingsList.vue.d.ts +9 -3
  70. package/dist/src/appointments/pages/edit/orders.vue.d.ts +9 -3
  71. package/dist/src/appointments/pages/edit/reports.vue.d.ts +229 -1
  72. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Container.d.ts +1 -1
  73. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Row.d.ts +7 -0
  74. package/dist/src/contentManager/components/content-editor/tiptap-extensions/Stack.d.ts +7 -0
  75. package/dist/src/contentManager/components/content-editor/tiptap-extensions/helpers/resizeHistory.d.ts +9 -0
  76. package/dist/src/contentManager/components/content-editor/tiptap-menus/ElementEditorMenu.vue.d.ts +3 -1
  77. package/dist/src/firebaseAuthManager/components/DeleteUserDialog.vue.d.ts +25 -0
  78. package/dist/src/firebaseAuthManager/components/ReasonActionDialog.vue.d.ts +23 -0
  79. package/dist/src/firebaseAuthManager/components/UserStatusBadge.vue.d.ts +5 -0
  80. package/dist/src/firebaseAuthManager/config.d.ts +151 -0
  81. package/dist/src/firebaseAuthManager/index.d.ts +163 -0
  82. package/dist/src/firebaseAuthManager/index.vue.d.ts +14 -0
  83. package/dist/src/firebaseAuthManager/metadata.d.ts +2 -0
  84. package/dist/src/firebaseAuthManager/pages/Overview.vue.d.ts +2 -0
  85. package/dist/src/firebaseAuthManager/pages/UserDetail.vue.d.ts +2 -0
  86. package/dist/src/firebaseAuthManager/permissions.d.ts +5 -0
  87. package/dist/src/firebaseAuthManager/routes.d.ts +5 -0
  88. package/dist/src/firebaseAuthManager/server.d.ts +162 -0
  89. package/dist/src/firebaseAuthManager/types.d.ts +84 -0
  90. package/dist/src/formBuilder/components/FormPreviewDialog.vue.d.ts +12 -0
  91. package/dist/src/formBuilder/components/FormStatusBadge.vue.d.ts +9 -0
  92. package/dist/src/formBuilder/config.d.ts +31 -0
  93. package/dist/src/formBuilder/index.d.ts +44 -0
  94. package/dist/src/formBuilder/index.vue.d.ts +14 -0
  95. package/dist/src/formBuilder/lib/forms.d.ts +11 -0
  96. package/dist/src/formBuilder/metadata.d.ts +2 -0
  97. package/dist/src/formBuilder/pages/Editor.vue.d.ts +2 -0
  98. package/dist/src/formBuilder/pages/Overview.vue.d.ts +2 -0
  99. package/dist/src/formBuilder/permissions.d.ts +5 -0
  100. package/dist/src/formBuilder/routes.d.ts +5 -0
  101. package/dist/src/formBuilder/server.d.ts +87 -0
  102. package/dist/src/formBuilder/tools.d.ts +1 -0
  103. package/dist/src/formBuilder/types.d.ts +46 -0
  104. package/dist/src/helpbot/composables/useHelpbotApi.d.ts +18 -0
  105. package/dist/src/helpbot/config.d.ts +17 -0
  106. package/dist/src/helpbot/index.d.ts +29 -0
  107. package/dist/src/helpbot/index.vue.d.ts +2 -0
  108. package/dist/src/helpbot/metadata.d.ts +2 -0
  109. package/dist/src/helpbot/pages/Knowledge.vue.d.ts +4 -0
  110. package/dist/src/helpbot/pages/Overview.vue.d.ts +2 -0
  111. package/dist/src/helpbot/pages/Test.vue.d.ts +4 -0
  112. package/dist/src/helpbot/permissions.d.ts +5 -0
  113. package/dist/src/helpbot/routes.d.ts +5 -0
  114. package/dist/src/helpbot/types.d.ts +42 -0
  115. package/dist/src/index.d.ts +3 -0
  116. package/dist/src/server-handlers.d.ts +2 -0
  117. package/dist/src/table/chat-components/TableCalculationWidget.vue.d.ts +15 -0
  118. package/dist/src/table/chat-components/TableDataWidget.vue.d.ts +15 -0
  119. package/dist/src/table/chat-components/TableOverviewCard.vue.d.ts +61 -0
  120. package/dist/src/table/chat-components/TableResultView.vue.d.ts +48 -0
  121. package/dist/src/table/chat-components/TableRowActionCard.vue.d.ts +15 -0
  122. package/dist/src/table/components/filters/DialogTableFilterOptionItem.vue.d.ts +16 -0
  123. package/dist/src/table/components/filters/NumberComparisonFilter.vue.d.ts +12 -0
  124. package/dist/src/table/components/filters/NumberComparisonFilterSettings.vue.d.ts +12 -0
  125. package/dist/src/table/components/filters/NumberRangeFilter.vue.d.ts +12 -0
  126. package/dist/src/table/components/filters/NumberRangeFilterSettings.vue.d.ts +12 -0
  127. package/dist/src/table/components/filters/filter-utils.d.ts +14 -0
  128. package/dist/src/table/composables/useTableAgentTools.d.ts +33 -0
  129. package/dist/src/table/index.d.ts +339 -0
  130. package/dist/src/table/tool-sandbox.d.ts +13 -0
  131. package/dist/src/table/tool-utils.d.ts +11 -0
  132. package/dist/src/table/tools.d.ts +333 -1
  133. package/dist/src/table/types.d.ts +79 -0
  134. package/dist/tool-sandbox-DdkMLkDK.mjs +182 -0
  135. package/dist/tool-sandbox-DoF1PsyS.js +115 -0
  136. package/dist/types-9N-DKxNj.mjs +250 -0
  137. package/dist/types-BMraG1kN.js +1 -0
  138. package/dist/types-Cem0vPo_.js +1 -0
  139. package/dist/types-ibC3-e1N.mjs +2630 -0
  140. package/dist/useHelpbotApi-BIIungOh.js +1 -0
  141. package/dist/useHelpbotApi-HC9JSiSn.mjs +229 -0
  142. package/dist/useTableAgentTools-D5mzGf3A.js +1 -0
  143. package/dist/useTableAgentTools-DcN3kYRL.mjs +131 -0
  144. package/dist/vee-validate-zod-BQElPD0m.js +1 -0
  145. package/dist/vee-validate-zod-CN16K2x9.mjs +1780 -0
  146. package/package.json +17 -17
  147. package/src/formBuilder/tools.ts +1 -0
  148. package/src/table/tools.ts +304 -1
  149. package/dist/Detail-BCUUNWvp.js +0 -1
  150. package/dist/Detail-DGg_xXZc.js +0 -1
  151. package/dist/Detail-Sc2qZdxj.js +0 -1
  152. package/dist/NewReservationDialog.vue_vue_type_script_setup_true_lang-BdZbcubW.js +0 -1
  153. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-BYSeUW_V.js +0 -925
  154. package/dist/OrderDetailDialog.vue_vue_type_script_setup_true_lang-DwAUYR8p.mjs +0 -5021
  155. package/dist/TableView-Ctnep-Qu.mjs +0 -6247
  156. package/dist/TableView-DJqyJL9L.js +0 -4
  157. package/dist/agenda-B54F8cEr.js +0 -1
  158. package/dist/orders-BMosTk6r.js +0 -1
  159. package/dist/reports-BQT_GZzU.js +0 -158
  160. package/dist/reports-DksZCTOw.mjs +0 -837
  161. package/dist/vee-validate-zod-SjDT8X35.mjs +0 -4404
  162. package/dist/vee-validate-zod-VCmLnrtQ.js +0 -1
@@ -1,4 +1,4 @@
1
- import { defineComponent as De, ref as U, reactive as Ue, computed as re, watch as Re, resolveComponent as h, openBlock as i, createElementBlock as p, createElementVNode as f, Fragment as te, renderList as pe, normalizeClass as he, createVNode as r, withCtx as c, createTextVNode as w, toDisplayString as k, createCommentVNode as W, createBlock as be, onMounted as Ee, onBeforeUnmount as ze, nextTick as Le, unref as g, isRef as we, markRaw as Be, inject as qe } from "vue";
1
+ import { defineComponent as De, ref as P, reactive as Ue, computed as ie, watch as Re, resolveComponent as h, openBlock as i, createElementBlock as p, createElementVNode as f, Fragment as ee, renderList as pe, normalizeClass as he, createVNode as r, withCtx as c, createTextVNode as N, toDisplayString as R, createCommentVNode as H, createBlock as be, onMounted as Fe, onBeforeUnmount as ze, nextTick as Le, unref as g, isRef as we, markRaw as Be, inject as qe } from "vue";
2
2
  import { CalendarIcon as je, ChevronLeft as He, Check as Qe, ChevronRight as Ye, X as We, Zap as Ge, Plus as Pe, Pencil as Xe, Users as Ze, Tag as Je, Trash2 as Me } from "lucide-vue-next";
3
3
  import { useModuleRoute as Ke, useModule as et, useLogs as tt, useFirebaseIntegration as nt } from "@oneclick.dev/cms-kit";
4
4
  import { c as Oe } from "./utils-CanmrIWO.mjs";
@@ -27,8 +27,8 @@ const ot = { class: "space-y-3" }, rt = { class: "grid gap-4 @md/modal:grid-cols
27
27
  props: {
28
28
  agendaData: {}
29
29
  },
30
- setup(z, { expose: X }) {
31
- const A = [
30
+ setup(U, { expose: G }) {
31
+ const E = [
32
32
  {
33
33
  id: "firstName",
34
34
  fieldName: "First Name",
@@ -64,109 +64,109 @@ const ot = { class: "space-y-3" }, rt = { class: "grid gap-4 @md/modal:grid-cols
64
64
  required: !0,
65
65
  visible: !0
66
66
  }
67
- ], Q = /* @__PURE__ */ new Set(["firstName", "email"]), ue = z, B = U([]), O = Ue({}), F = re(() => {
68
- const v = ue.agendaData?.customerInformationFields, x = (Array.isArray(v) && v.length > 0 ? v : A).filter((C) => C?.id && (C.visible !== !1 || Q.has(C.id))).map((C) => ({
69
- ...C,
70
- required: Q.has(C.id),
67
+ ], Q = /* @__PURE__ */ new Set(["firstName", "email"]), le = /* @__PURE__ */ new Set(["firstName"]), j = U, Z = P([]), T = Ue({}), F = ie(() => {
68
+ const _ = j.agendaData?.customerInformationFields, S = (Array.isArray(_) && _.length > 0 ? _ : E).filter((M) => M?.id && (M.visible !== !1 || Q.has(M.id))).map((M) => ({
69
+ ...M,
70
+ required: le.has(M.id),
71
71
  visible: !0
72
- })), D = A.filter((C) => Q.has(C.id) && !x.some((le) => le.id === C.id)).map((C) => ({
73
- ...C,
74
- required: !0,
72
+ })), k = E.filter((M) => Q.has(M.id) && !S.some((ue) => ue.id === M.id)).map((M) => ({
73
+ ...M,
74
+ required: le.has(M.id),
75
75
  visible: !0
76
76
  }));
77
- return [...x, ...D];
78
- }), E = (v) => v.fieldName || v.id, q = (v) => v.replace(/[^A-Za-z0-9_-]/g, "-"), $ = (v, N) => ["new-res-customer-info", v.id, N].filter(Boolean).map((D) => q(D)).join("-"), M = (v) => v.fieldType === "email" || v.fieldType === "tel" || v.fieldType === "date" ? v.fieldType : "text", Y = (v) => Array.isArray(v.options) ? v.options.filter(Boolean) : [], H = (v) => v.fieldType === "checkbox" ? !1 : "", L = (v = !1) => {
79
- const N = new Set(F.value.map((x) => x.id));
80
- Object.keys(O).forEach((x) => {
81
- N.has(x) || delete O[x];
82
- }), F.value.forEach((x) => {
83
- const D = H(x);
84
- (v || O[x.id] === void 0 || typeof O[x.id] != typeof D) && (O[x.id] = D);
77
+ return [...S, ...k];
78
+ }), V = (_) => _.fieldName || _.id, L = (_) => _.replace(/[^A-Za-z0-9_-]/g, "-"), I = (_, O) => ["new-res-customer-info", _.id, O].filter(Boolean).map((k) => L(k)).join("-"), Y = (_) => _.fieldType === "email" || _.fieldType === "tel" || _.fieldType === "date" ? _.fieldType : "text", z = (_) => Array.isArray(_.options) ? _.options.filter(Boolean) : [], B = (_) => _.fieldType === "checkbox" ? !1 : "", J = (_ = !1) => {
79
+ const O = new Set(F.value.map((S) => S.id));
80
+ Object.keys(T).forEach((S) => {
81
+ O.has(S) || delete T[S];
82
+ }), F.value.forEach((S) => {
83
+ const k = B(S);
84
+ (_ || T[S.id] === void 0 || typeof T[S.id] != typeof k) && (T[S.id] = k);
85
85
  });
86
- }, K = () => {
87
- const v = F.value.reduce((N, x) => {
88
- const D = O[x.id];
89
- return N[x.id] = typeof D == "string" ? D.trim() : !!D, N;
86
+ }, w = () => {
87
+ const _ = F.value.reduce((O, S) => {
88
+ const k = T[S.id];
89
+ return O[S.id] = typeof k == "string" ? k.trim() : !!k, O;
90
90
  }, {});
91
- return Object.entries(v).forEach(([N, x]) => {
92
- O[N] = x;
93
- }), v;
94
- }, T = (v, N) => v.fieldType === "checkbox" ? N === !0 : typeof N == "string" ? N.trim().length > 0 : N != null, ie = () => {
95
- B.value = [], L(!0);
96
- }, Z = () => {
97
- const v = [], N = K();
98
- return F.value.forEach((x) => {
99
- const D = N[x.id], C = E(x);
100
- x.required && !T(x, D) && v.push(`Please fill in ${C}.`), x.fieldType === "email" && T(x, D) && typeof D == "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(D) === !1 && v.push(`Please fill in a correct ${C}.`);
101
- }), B.value = v, v.length === 0;
91
+ return Object.entries(_).forEach(([O, S]) => {
92
+ T[O] = S;
93
+ }), _;
94
+ }, se = (_, O) => _.fieldType === "checkbox" ? O === !0 : typeof O == "string" ? O.trim().length > 0 : O != null, X = () => {
95
+ Z.value = [], J(!0);
96
+ }, ae = () => {
97
+ const _ = [], O = w();
98
+ return F.value.forEach((S) => {
99
+ const k = O[S.id], M = V(S);
100
+ S.required && !se(S, k) && _.push(`Please fill in ${M}.`), S.fieldType === "email" && se(S, k) && typeof k == "string" && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(k) === !1 && _.push(`Please fill in a correct ${M}.`);
101
+ }), Z.value = _, _.length === 0;
102
102
  };
103
103
  return Re(F, () => {
104
- L();
105
- }, { immediate: !0 }), X({
106
- getCustomerInfo: K,
107
- reset: ie,
108
- validateForm: Z
109
- }), (v, N) => {
110
- const x = h("Checkbox"), D = h("Label"), C = h("SelectValue"), le = h("SelectTrigger"), ve = h("SelectItem"), ye = h("SelectGroup"), me = h("SelectContent"), de = h("Select"), fe = h("RadioGroupItem"), ae = h("RadioGroup"), ge = h("Input");
104
+ J();
105
+ }, { immediate: !0 }), G({
106
+ getCustomerInfo: w,
107
+ reset: X,
108
+ validateForm: ae
109
+ }), (_, O) => {
110
+ const S = h("Checkbox"), k = h("Label"), M = h("SelectValue"), ue = h("SelectTrigger"), ye = h("SelectItem"), me = h("SelectGroup"), de = h("SelectContent"), fe = h("Select"), oe = h("RadioGroupItem"), ge = h("RadioGroup"), ve = h("Input");
111
111
  return i(), p("div", ot, [
112
- N[0] || (N[0] = f("h2", { class: "text-sm font-medium" }, "Customer Information", -1)),
112
+ O[0] || (O[0] = f("h2", { class: "text-sm font-medium" }, "Customer Information", -1)),
113
113
  f("div", rt, [
114
- (i(!0), p(te, null, pe(F.value, (_) => (i(), p("div", {
115
- key: _.id,
116
- class: he(["grid gap-2", _.fieldType === "checkbox" ? "@md/modal:col-span-2" : ""])
114
+ (i(!0), p(ee, null, pe(F.value, (v) => (i(), p("div", {
115
+ key: v.id,
116
+ class: he(["grid gap-2", v.fieldType === "checkbox" ? "@md/modal:col-span-2" : ""])
117
117
  }, [
118
- _.fieldType === "checkbox" ? (i(), p("div", it, [
119
- r(x, {
120
- id: $(_),
121
- modelValue: O[_.id],
122
- "onUpdate:modelValue": (P) => O[_.id] = P
118
+ v.fieldType === "checkbox" ? (i(), p("div", it, [
119
+ r(S, {
120
+ id: I(v),
121
+ modelValue: T[v.id],
122
+ "onUpdate:modelValue": ($) => T[v.id] = $
123
123
  }, null, 8, ["id", "modelValue", "onUpdate:modelValue"]),
124
- r(D, {
125
- for: $(_),
124
+ r(k, {
125
+ for: I(v),
126
126
  class: "font-normal cursor-pointer"
127
127
  }, {
128
128
  default: c(() => [
129
- w(k(E(_)) + " ", 1),
130
- _.required ? W("", !0) : (i(), p("span", lt, "optional"))
129
+ N(R(V(v)) + " ", 1),
130
+ v.required ? H("", !0) : (i(), p("span", lt, "optional"))
131
131
  ]),
132
132
  _: 2
133
133
  }, 1032, ["for"])
134
- ])) : _.fieldType === "select" ? (i(), p(te, { key: 1 }, [
135
- r(D, {
136
- for: $(_)
134
+ ])) : v.fieldType === "select" ? (i(), p(ee, { key: 1 }, [
135
+ r(k, {
136
+ for: I(v)
137
137
  }, {
138
138
  default: c(() => [
139
- w(k(E(_)) + " ", 1),
140
- _.required ? W("", !0) : (i(), p("span", ut, "optional"))
139
+ N(R(V(v)) + " ", 1),
140
+ v.required ? H("", !0) : (i(), p("span", ut, "optional"))
141
141
  ]),
142
142
  _: 2
143
143
  }, 1032, ["for"]),
144
- r(de, {
145
- modelValue: O[_.id],
146
- "onUpdate:modelValue": (P) => O[_.id] = P
144
+ r(fe, {
145
+ modelValue: T[v.id],
146
+ "onUpdate:modelValue": ($) => T[v.id] = $
147
147
  }, {
148
148
  default: c(() => [
149
- r(le, {
150
- id: $(_),
149
+ r(ue, {
150
+ id: I(v),
151
151
  class: "w-full"
152
152
  }, {
153
153
  default: c(() => [
154
- r(C, {
155
- placeholder: `Select ${E(_)}`
154
+ r(M, {
155
+ placeholder: `Select ${V(v)}`
156
156
  }, null, 8, ["placeholder"])
157
157
  ]),
158
158
  _: 2
159
159
  }, 1032, ["id"]),
160
- r(me, null, {
160
+ r(de, null, {
161
161
  default: c(() => [
162
- r(ye, null, {
162
+ r(me, null, {
163
163
  default: c(() => [
164
- (i(!0), p(te, null, pe(Y(_), (P) => (i(), be(ve, {
165
- key: P,
166
- value: P
164
+ (i(!0), p(ee, null, pe(z(v), ($) => (i(), be(ye, {
165
+ key: $,
166
+ value: $
167
167
  }, {
168
168
  default: c(() => [
169
- w(k(P), 1)
169
+ N(R($), 1)
170
170
  ]),
171
171
  _: 2
172
172
  }, 1032, ["value"]))), 128))
@@ -179,34 +179,34 @@ const ot = { class: "space-y-3" }, rt = { class: "grid gap-4 @md/modal:grid-cols
179
179
  ]),
180
180
  _: 2
181
181
  }, 1032, ["modelValue", "onUpdate:modelValue"])
182
- ], 64)) : _.fieldType === "radio" ? (i(), p(te, { key: 2 }, [
183
- r(D, null, {
182
+ ], 64)) : v.fieldType === "radio" ? (i(), p(ee, { key: 2 }, [
183
+ r(k, null, {
184
184
  default: c(() => [
185
- w(k(E(_)) + " ", 1),
186
- _.required ? W("", !0) : (i(), p("span", dt, "optional"))
185
+ N(R(V(v)) + " ", 1),
186
+ v.required ? H("", !0) : (i(), p("span", dt, "optional"))
187
187
  ]),
188
188
  _: 2
189
189
  }, 1024),
190
- r(ae, {
191
- modelValue: O[_.id],
192
- "onUpdate:modelValue": (P) => O[_.id] = P,
190
+ r(ge, {
191
+ modelValue: T[v.id],
192
+ "onUpdate:modelValue": ($) => T[v.id] = $,
193
193
  class: "grid gap-2"
194
194
  }, {
195
195
  default: c(() => [
196
- (i(!0), p(te, null, pe(Y(_), (P) => (i(), p("div", {
197
- key: P,
196
+ (i(!0), p(ee, null, pe(z(v), ($) => (i(), p("div", {
197
+ key: $,
198
198
  class: "flex items-center gap-2"
199
199
  }, [
200
- r(fe, {
201
- id: $(_, P),
202
- value: P
200
+ r(oe, {
201
+ id: I(v, $),
202
+ value: $
203
203
  }, null, 8, ["id", "value"]),
204
- r(D, {
205
- for: $(_, P),
204
+ r(k, {
205
+ for: I(v, $),
206
206
  class: "font-normal cursor-pointer"
207
207
  }, {
208
208
  default: c(() => [
209
- w(k(P), 1)
209
+ N(R($), 1)
210
210
  ]),
211
211
  _: 2
212
212
  }, 1032, ["for"])
@@ -214,129 +214,129 @@ const ot = { class: "space-y-3" }, rt = { class: "grid gap-4 @md/modal:grid-cols
214
214
  ]),
215
215
  _: 2
216
216
  }, 1032, ["modelValue", "onUpdate:modelValue"])
217
- ], 64)) : (i(), p(te, { key: 3 }, [
218
- r(D, {
219
- for: $(_)
217
+ ], 64)) : (i(), p(ee, { key: 3 }, [
218
+ r(k, {
219
+ for: I(v)
220
220
  }, {
221
221
  default: c(() => [
222
- w(k(E(_)) + " ", 1),
223
- _.required ? W("", !0) : (i(), p("span", ct, "optional"))
222
+ N(R(V(v)) + " ", 1),
223
+ v.required ? H("", !0) : (i(), p("span", ct, "optional"))
224
224
  ]),
225
225
  _: 2
226
226
  }, 1032, ["for"]),
227
- r(ge, {
228
- modelValue: O[_.id],
229
- "onUpdate:modelValue": (P) => O[_.id] = P,
230
- id: $(_),
231
- type: M(_),
227
+ r(ve, {
228
+ modelValue: T[v.id],
229
+ "onUpdate:modelValue": ($) => T[v.id] = $,
230
+ id: I(v),
231
+ type: Y(v),
232
232
  autocomplete: "off"
233
233
  }, null, 8, ["modelValue", "onUpdate:modelValue", "id", "type"])
234
234
  ], 64))
235
235
  ], 2))), 128))
236
236
  ]),
237
- B.value.length > 0 ? (i(), p("div", pt, [
237
+ Z.value.length > 0 ? (i(), p("div", pt, [
238
238
  f("ul", mt, [
239
- (i(!0), p(te, null, pe(B.value, (_) => (i(), p("li", { key: _ }, k(_), 1))), 128))
239
+ (i(!0), p(ee, null, pe(Z.value, (v) => (i(), p("li", { key: v }, R(v), 1))), 128))
240
240
  ])
241
- ])) : W("", !0)
241
+ ])) : H("", !0)
242
242
  ]);
243
243
  };
244
244
  }
245
245
  });
246
- function gt(z = {}) {
247
- const X = U(null), A = U(!1), Q = U(!1), ue = U(!1), B = U(!1), O = z.dragSpeed ?? 1.1, F = z.dragThreshold ?? 10, E = z.edgeThreshold ?? 10, q = z.ignoreDragSelector ?? 'input, select, textarea, [contenteditable="true"], [data-horizontal-scroll-ignore-drag]';
248
- let $ = null, M = 0, Y = 0, H = !1, L = null, K = null, T = null;
249
- const ie = () => {
250
- L === null || typeof window > "u" || (window.clearTimeout(L), L = null);
251
- }, Z = () => {
252
- const a = X.value;
246
+ function gt(U = {}) {
247
+ const G = P(null), E = P(!1), Q = P(!1), le = P(!1), j = P(!1), Z = U.dragSpeed ?? 1.1, T = U.dragThreshold ?? 10, F = U.edgeThreshold ?? 10, V = U.ignoreDragSelector ?? 'input, select, textarea, [contenteditable="true"], [data-horizontal-scroll-ignore-drag]';
248
+ let L = null, I = 0, Y = 0, z = !1, B = null, J = null, w = null;
249
+ const se = () => {
250
+ B === null || typeof window > "u" || (window.clearTimeout(B), B = null);
251
+ }, X = () => {
252
+ const a = G.value;
253
253
  if (!a) {
254
- Q.value = !1, ue.value = !1, B.value = !1;
254
+ Q.value = !1, le.value = !1, j.value = !1;
255
255
  return;
256
256
  }
257
257
  const l = Math.max(a.scrollWidth - a.clientWidth, 0);
258
- Q.value = l > E, ue.value = Q.value && a.scrollLeft > E, B.value = Q.value && a.scrollLeft < l - E;
259
- }, v = () => {
258
+ Q.value = l > F, le.value = Q.value && a.scrollLeft > F, j.value = Q.value && a.scrollLeft < l - F;
259
+ }, ae = () => {
260
260
  Le(() => {
261
261
  if (typeof window > "u") {
262
- Z();
262
+ X();
263
263
  return;
264
264
  }
265
- window.requestAnimationFrame(() => Z());
265
+ window.requestAnimationFrame(() => X());
266
266
  });
267
- }, N = () => {
268
- if (typeof z.scrollStep == "number") return z.scrollStep;
269
- const a = X.value;
267
+ }, _ = () => {
268
+ if (typeof U.scrollStep == "number") return U.scrollStep;
269
+ const a = G.value;
270
270
  return a ? Math.max(Math.floor(a.clientWidth * 0.72), 180) : 240;
271
- }, x = (a, l = "smooth") => {
272
- const I = X.value;
273
- if (I) {
274
- if (I.scrollBy({ left: a, behavior: l }), l === "auto") {
275
- Z();
271
+ }, O = (a, l = "smooth") => {
272
+ const D = G.value;
273
+ if (D) {
274
+ if (D.scrollBy({ left: a, behavior: l }), l === "auto") {
275
+ X();
276
276
  return;
277
277
  }
278
- v();
278
+ ae();
279
279
  }
280
- }, D = () => {
281
- x(-N());
282
- }, C = () => {
283
- x(N());
284
- }, le = () => {
285
- const a = X.value;
286
- $ !== null && a?.hasPointerCapture?.($) && a.releasePointerCapture($), A.value && (H = !0, ie(), typeof window < "u" && (L = window.setTimeout(() => {
287
- H = !1, L = null;
288
- }, 0))), $ = null, A.value = !1, a && (a.style.userSelect = "", a.style.cursor = ""), Z();
289
- }, ve = () => {
290
- Z();
280
+ }, S = () => {
281
+ O(-_());
282
+ }, k = () => {
283
+ O(_());
284
+ }, M = () => {
285
+ const a = G.value;
286
+ L !== null && a?.hasPointerCapture?.(L) && a.releasePointerCapture(L), E.value && (z = !0, se(), typeof window < "u" && (B = window.setTimeout(() => {
287
+ z = !1, B = null;
288
+ }, 0))), L = null, E.value = !1, a && (a.style.userSelect = "", a.style.cursor = ""), X();
289
+ }, ue = () => {
290
+ X();
291
291
  }, ye = (a) => {
292
- const l = X.value;
292
+ const l = G.value;
293
293
  if (!l || !Q.value || Math.abs(a.deltaY) <= Math.abs(a.deltaX)) return;
294
- const I = a.deltaY < 0, oe = a.deltaY > 0;
295
- I && !ue.value || oe && !B.value || (a.preventDefault(), l.scrollLeft += a.deltaY, Z());
296
- }, me = (a) => a instanceof Element ? !!a.closest(q) : !1, de = (a) => {
297
- const l = X.value;
298
- !l || !Q.value || a.pointerType !== "touch" && a.button === 0 && (me(a.target) || ($ = a.pointerId, M = a.clientX, Y = l.scrollLeft, H = !1));
294
+ const D = a.deltaY < 0, re = a.deltaY > 0;
295
+ D && !le.value || re && !j.value || (a.preventDefault(), l.scrollLeft += a.deltaY, X());
296
+ }, me = (a) => a instanceof Element ? !!a.closest(V) : !1, de = (a) => {
297
+ const l = G.value;
298
+ !l || !Q.value || a.pointerType !== "touch" && a.button === 0 && (me(a.target) || (L = a.pointerId, I = a.clientX, Y = l.scrollLeft, z = !1));
299
299
  }, fe = (a) => {
300
- const l = X.value;
301
- if (!l || $ !== a.pointerId) return;
302
- const I = a.clientX - M;
303
- !A.value && Math.abs(I) < F || (A.value || (A.value = !0, l.style.userSelect = "none", l.style.cursor = "grabbing", l.setPointerCapture?.(a.pointerId)), a.preventDefault(), l.scrollLeft = Y - I * O, Z());
304
- }, ae = (a) => {
305
- $ === a.pointerId && le();
300
+ const l = G.value;
301
+ if (!l || L !== a.pointerId) return;
302
+ const D = a.clientX - I;
303
+ !E.value && Math.abs(D) < T || (E.value || (E.value = !0, l.style.userSelect = "none", l.style.cursor = "grabbing", l.setPointerCapture?.(a.pointerId)), a.preventDefault(), l.scrollLeft = Y - D * Z, X());
304
+ }, oe = (a) => {
305
+ L === a.pointerId && M();
306
306
  }, ge = () => {
307
- $ !== null && le();
308
- }, _ = (a) => {
309
- H && (a.preventDefault(), a.stopPropagation(), H = !1);
310
- }, P = (a) => {
311
- typeof ResizeObserver < "u" && (K = new ResizeObserver(() => Z()), K.observe(a)), z.observeMutations !== !1 && typeof MutationObserver < "u" && (T = new MutationObserver(() => v()), T.observe(a, {
307
+ L !== null && M();
308
+ }, ve = (a) => {
309
+ z && (a.preventDefault(), a.stopPropagation(), z = !1);
310
+ }, v = (a) => {
311
+ typeof ResizeObserver < "u" && (J = new ResizeObserver(() => X()), J.observe(a)), U.observeMutations !== !1 && typeof MutationObserver < "u" && (w = new MutationObserver(() => ae()), w.observe(a, {
312
312
  childList: !0,
313
313
  subtree: !0,
314
314
  characterData: !0
315
315
  }));
316
- }, J = () => {
317
- K?.disconnect(), T?.disconnect(), K = null, T = null;
316
+ }, $ = () => {
317
+ J?.disconnect(), w?.disconnect(), J = null, w = null;
318
318
  }, ke = (a) => {
319
- a.addEventListener("scroll", ve), a.addEventListener("wheel", ye, { passive: !1 }), a.addEventListener("pointerdown", de), a.addEventListener("pointermove", fe), a.addEventListener("pointerup", ae), a.addEventListener("pointercancel", ge), a.addEventListener("lostpointercapture", ge), a.addEventListener("click", _, !0), P(a), v();
319
+ a.addEventListener("scroll", ue), a.addEventListener("wheel", ye, { passive: !1 }), a.addEventListener("pointerdown", de), a.addEventListener("pointermove", fe), a.addEventListener("pointerup", oe), a.addEventListener("pointercancel", ge), a.addEventListener("lostpointercapture", ge), a.addEventListener("click", ve, !0), v(a), ae();
320
320
  }, xe = (a) => {
321
- a.removeEventListener("scroll", ve), a.removeEventListener("wheel", ye), a.removeEventListener("pointerdown", de), a.removeEventListener("pointermove", fe), a.removeEventListener("pointerup", ae), a.removeEventListener("pointercancel", ge), a.removeEventListener("lostpointercapture", ge), a.removeEventListener("click", _, !0), J();
321
+ a.removeEventListener("scroll", ue), a.removeEventListener("wheel", ye), a.removeEventListener("pointerdown", de), a.removeEventListener("pointermove", fe), a.removeEventListener("pointerup", oe), a.removeEventListener("pointercancel", ge), a.removeEventListener("lostpointercapture", ge), a.removeEventListener("click", ve, !0), $();
322
322
  };
323
- return Re(X, (a, l) => {
324
- l && xe(l), a ? ke(a) : Z();
325
- }), Ee(() => {
326
- v();
323
+ return Re(G, (a, l) => {
324
+ l && xe(l), a ? ke(a) : X();
325
+ }), Fe(() => {
326
+ ae();
327
327
  }), ze(() => {
328
- ie(), X.value && xe(X.value), H = !1, le();
328
+ se(), G.value && xe(G.value), z = !1, M();
329
329
  }), {
330
- canScrollLeft: re(() => ue.value),
331
- canScrollRight: re(() => B.value),
332
- containerRef: X,
333
- isDragging: A,
330
+ canScrollLeft: ie(() => le.value),
331
+ canScrollRight: ie(() => j.value),
332
+ containerRef: G,
333
+ isDragging: E,
334
334
  isScrollable: Q,
335
- refresh: v,
336
- scrollNext: C,
337
- scrollPrev: D,
338
- showLeftShadow: ue,
339
- showRightShadow: B
335
+ refresh: ae,
336
+ scrollNext: k,
337
+ scrollPrev: S,
338
+ showLeftShadow: le,
339
+ showRightShadow: j
340
340
  };
341
341
  }
342
342
  const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "text-sm font-medium" }, ht = {
@@ -366,105 +366,105 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
366
366
  }, Nt = {
367
367
  key: 0,
368
368
  class: "absolute -top-1 -right-1 flex items-center justify-center bg-primary rounded-full text-background size-4"
369
- }, Ot = { class: "flex flex-wrap gap-2" }, Vt = ["onClick"], Mt = { key: 0 }, At = { key: 1 }, Ft = { key: 2 }, Et = /* @__PURE__ */ De({
369
+ }, Ot = { class: "flex flex-wrap gap-2" }, Vt = ["onClick"], Mt = { key: 0 }, At = { key: 1 }, Et = { key: 2 }, Ft = /* @__PURE__ */ De({
370
370
  __name: "QuickReservationAdder",
371
371
  props: {
372
372
  agendaData: {},
373
373
  surface: { default: "card" }
374
374
  },
375
375
  emits: ["add"],
376
- setup(z, { emit: X }) {
377
- const A = z, Q = X, ue = new st("en-US", {
376
+ setup(U, { emit: G }) {
377
+ const E = U, Q = G, le = new st("en-US", {
378
378
  dateStyle: "long"
379
- }), B = Ae(Ve()), O = re(() => A.surface === "popover"), F = U(""), E = U(void 0), q = U(""), $ = U(""), M = U([]), Y = U(1), H = U(0), L = re(() => A.agendaData?.resources?.find((a) => a.id === q.value)), K = (a) => {
380
- const [l, I] = a.split(":").map(Number);
381
- return l * 60 + I;
382
- }, T = (a) => {
383
- const l = Math.floor(a / 60), I = a % 60;
384
- return `${l.toString().padStart(2, "0")}:${I.toString().padStart(2, "0")}`;
385
- }, ie = () => {
386
- if (!L.value) return [];
387
- const a = L.value.interval || 60;
388
- let l = null, I = null;
389
- for (const s of Object.values(L.value.openingHours || {}))
379
+ }), j = Ae(Ve()), Z = ie(() => E.surface === "popover"), T = P(""), F = P(void 0), V = P(""), L = P(""), I = P([]), Y = P(1), z = P(0), B = ie(() => E.agendaData?.resources?.find((a) => a.id === V.value)), J = (a) => {
380
+ const [l, D] = a.split(":").map(Number);
381
+ return l * 60 + D;
382
+ }, w = (a) => {
383
+ const l = Math.floor(a / 60), D = a % 60;
384
+ return `${l.toString().padStart(2, "0")}:${D.toString().padStart(2, "0")}`;
385
+ }, se = () => {
386
+ if (!B.value) return [];
387
+ const a = B.value.interval || 60;
388
+ let l = null, D = null;
389
+ for (const s of Object.values(B.value.openingHours || {}))
390
390
  for (const n of s) {
391
- const m = K(n.start), S = K(n.end);
392
- (l === null || m < l) && (l = m), (I === null || S > I) && (I = S);
391
+ const m = J(n.start), x = J(n.end);
392
+ (l === null || m < l) && (l = m), (D === null || x > D) && (D = x);
393
393
  }
394
- if (l === null || I === null) return [];
395
- const oe = [];
396
- for (let s = l; s < I; s += a)
397
- oe.push(T(s));
398
- return oe;
399
- }, Z = re(() => {
400
- const a = Number(H.value);
401
- return E.value && q.value && $.value && M.value.length > 0 && Number.isFinite(a) && a >= 0;
402
- }), v = re(() => ie()), {
403
- canScrollLeft: N,
404
- canScrollRight: x,
405
- containerRef: D,
406
- isDragging: C,
407
- isScrollable: le,
408
- scrollNext: ve,
394
+ if (l === null || D === null) return [];
395
+ const re = [];
396
+ for (let s = l; s < D; s += a)
397
+ re.push(w(s));
398
+ return re;
399
+ }, X = ie(() => {
400
+ const a = Number(z.value);
401
+ return F.value && V.value && L.value && I.value.length > 0 && Number.isFinite(a) && a >= 0;
402
+ }), ae = ie(() => se()), {
403
+ canScrollLeft: _,
404
+ canScrollRight: O,
405
+ containerRef: S,
406
+ isDragging: k,
407
+ isScrollable: M,
408
+ scrollNext: ue,
409
409
  scrollPrev: ye,
410
410
  showLeftShadow: me,
411
411
  showRightShadow: de
412
- } = gt(), fe = (a) => M.value.includes(a), ae = (a) => {
412
+ } = gt(), fe = (a) => I.value.includes(a), oe = (a) => {
413
413
  if (fe(a)) {
414
- M.value = M.value.filter((l) => l !== a);
414
+ I.value = I.value.filter((l) => l !== a);
415
415
  return;
416
416
  }
417
- M.value = [...M.value, a].sort((l, I) => K(l) - K(I));
417
+ I.value = [...I.value, a].sort((l, D) => J(l) - J(D));
418
418
  }, ge = (a, l) => {
419
- E.value = a ? Be(a) : void 0, F.value = a ? `${a}` : "", l();
420
- }, _ = U(""), P = U(""), J = U([]), ke = () => {
419
+ F.value = a ? Be(a) : void 0, T.value = a ? `${a}` : "", l();
420
+ }, ve = P(""), v = P(""), $ = P([]), ke = () => {
421
421
  Q("add", {
422
- date: E.value,
423
- resourceId: q.value,
424
- pricingOptionId: $.value,
425
- startTimes: M.value,
422
+ date: F.value,
423
+ resourceId: V.value,
424
+ pricingOptionId: L.value,
425
+ startTimes: I.value,
426
426
  spots: Y.value,
427
- paid: Number(H.value) || 0
428
- }), M.value = [], J.value = [], P.value = "", _.value = "";
427
+ paid: Number(z.value) || 0
428
+ }), I.value = [], $.value = [], v.value = "", ve.value = "";
429
429
  }, xe = () => {
430
- F.value = B.toString(), E.value = B, q.value = A.agendaData?.resources?.[0]?.id || "", $.value = A.agendaData?.pricingOptions?.find((a) => a.isDefault)?.id || A.agendaData?.pricingOptions?.[0]?.id || "", M.value = [], Y.value = 1, H.value = 0, _.value = "";
430
+ T.value = j.toString(), F.value = j, V.value = E.agendaData?.resources?.[0]?.id || "", L.value = E.agendaData?.pricingOptions?.find((a) => a.isDefault)?.id || E.agendaData?.pricingOptions?.[0]?.id || "", I.value = [], Y.value = 1, z.value = 0, ve.value = "";
431
431
  };
432
- return Ee(() => {
432
+ return Fe(() => {
433
433
  xe();
434
434
  }), (a, l) => {
435
- const I = h("Label"), oe = h("Button"), s = h("PopoverTrigger"), n = h("Calendar"), m = h("PopoverContent"), S = h("Popover"), V = h("DynamicSelectOption"), ne = h("DynamicSelect"), ee = h("Input");
435
+ const D = h("Label"), re = h("Button"), s = h("PopoverTrigger"), n = h("Calendar"), m = h("PopoverContent"), x = h("Popover"), A = h("DynamicSelectOption"), te = h("DynamicSelect"), K = h("Input");
436
436
  return i(), p("div", {
437
437
  class: he(g(Oe)(
438
438
  "@container/quick-adder grid gap-4 overflow-hidden bg-background",
439
- g(O) ? "p-5 sm:p-6" : "rounded-md border p-4"
439
+ g(Z) ? "p-5 sm:p-6" : "rounded-md border p-4"
440
440
  ))
441
441
  }, [
442
442
  f("div", vt, [
443
443
  f("div", null, [
444
- f("h3", _t, k(g(O) ? "Quick add reservations" : "Add reservations"), 1),
445
- g(O) ? (i(), p("p", ht, " Choose one date and add multiple timeslots in one pass. ")) : W("", !0)
444
+ f("h3", _t, R(g(Z) ? "Quick add reservations" : "Add reservations"), 1),
445
+ g(Z) ? (i(), p("p", ht, " Choose one date and add multiple timeslots in one pass. ")) : H("", !0)
446
446
  ])
447
447
  ]),
448
448
  f("div", bt, [
449
449
  f("div", yt, [
450
- r(I, null, {
450
+ r(D, null, {
451
451
  default: c(() => [...l[4] || (l[4] = [
452
- w("Date", -1)
452
+ N("Date", -1)
453
453
  ])]),
454
454
  _: 1
455
455
  }),
456
- r(S, null, {
456
+ r(x, null, {
457
457
  default: c(({ close: b }) => [
458
458
  r(s, { "as-child": "" }, {
459
459
  default: c(() => [
460
- r(oe, {
460
+ r(re, {
461
461
  type: "button",
462
462
  variant: "outline",
463
- class: he(g(Oe)("w-full justify-start text-left font-normal", !g(E) && "text-muted-foreground"))
463
+ class: he(g(Oe)("w-full justify-start text-left font-normal", !g(F) && "text-muted-foreground"))
464
464
  }, {
465
465
  default: c(() => [
466
466
  r(g(je)),
467
- w(" " + k(g(E) ? g(ue).format(g(E).toDate(g(Ve)())) : "Pick a date"), 1)
467
+ N(" " + R(g(F) ? g(le).format(g(F).toDate(g(Ve)())) : "Pick a date"), 1)
468
468
  ]),
469
469
  _: 1
470
470
  }, 8, ["class"])
@@ -477,8 +477,8 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
477
477
  }, {
478
478
  default: c(() => [
479
479
  r(n, {
480
- "model-value": g(E),
481
- "default-placeholder": g(B),
480
+ "model-value": g(F),
481
+ "default-placeholder": g(j),
482
482
  layout: "month-and-year",
483
483
  "initial-focus": "",
484
484
  "onUpdate:modelValue": (_e) => ge(_e, b),
@@ -491,70 +491,70 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
491
491
  _: 1
492
492
  })
493
493
  ]),
494
- z.agendaData.resources?.length > 1 ? (i(), p("div", xt, [
495
- r(I, null, {
494
+ U.agendaData.resources?.length > 1 ? (i(), p("div", xt, [
495
+ r(D, null, {
496
496
  default: c(() => [...l[5] || (l[5] = [
497
- w("Resource", -1)
497
+ N("Resource", -1)
498
498
  ])]),
499
499
  _: 1
500
500
  }),
501
- r(ne, {
502
- modelValue: g(q),
503
- "onUpdate:modelValue": l[0] || (l[0] = (b) => we(q) ? q.value = b : null),
501
+ r(te, {
502
+ modelValue: g(V),
503
+ "onUpdate:modelValue": l[0] || (l[0] = (b) => we(V) ? V.value = b : null),
504
504
  "wrapper-class": "w-full",
505
505
  class: "w-full",
506
506
  placeholder: "Select resource"
507
507
  }, {
508
508
  default: c(() => [
509
- (i(!0), p(te, null, pe(z.agendaData.resources || [], (b) => (i(), be(V, {
509
+ (i(!0), p(ee, null, pe(U.agendaData.resources || [], (b) => (i(), be(A, {
510
510
  key: b.id,
511
511
  value: b.id
512
512
  }, {
513
513
  default: c(() => [
514
- w(k(b.name), 1)
514
+ N(R(b.name), 1)
515
515
  ]),
516
516
  _: 2
517
517
  }, 1032, ["value"]))), 128))
518
518
  ]),
519
519
  _: 1
520
520
  }, 8, ["modelValue"])
521
- ])) : W("", !0),
522
- z.agendaData.pricingOptions?.length > 1 ? (i(), p("div", St, [
523
- r(I, null, {
521
+ ])) : H("", !0),
522
+ U.agendaData.pricingOptions?.length > 1 ? (i(), p("div", St, [
523
+ r(D, null, {
524
524
  default: c(() => [...l[6] || (l[6] = [
525
- w("Type", -1)
525
+ N("Type", -1)
526
526
  ])]),
527
527
  _: 1
528
528
  }),
529
- r(ne, {
530
- modelValue: g($),
531
- "onUpdate:modelValue": l[1] || (l[1] = (b) => we($) ? $.value = b : null),
529
+ r(te, {
530
+ modelValue: g(L),
531
+ "onUpdate:modelValue": l[1] || (l[1] = (b) => we(L) ? L.value = b : null),
532
532
  "wrapper-class": "w-full",
533
533
  class: "w-full",
534
534
  placeholder: "Select type"
535
535
  }, {
536
536
  default: c(() => [
537
- (i(!0), p(te, null, pe(z.agendaData.pricingOptions || [], (b) => (i(), be(V, {
537
+ (i(!0), p(ee, null, pe(U.agendaData.pricingOptions || [], (b) => (i(), be(A, {
538
538
  key: b.id,
539
539
  value: b.id
540
540
  }, {
541
541
  default: c(() => [
542
- w(k(b.name) + " (" + k(b.duration) + "min) ", 1)
542
+ N(R(b.name) + " (" + R(b.duration) + "min) ", 1)
543
543
  ]),
544
544
  _: 2
545
545
  }, 1032, ["value"]))), 128))
546
546
  ]),
547
547
  _: 1
548
548
  }, 8, ["modelValue"])
549
- ])) : W("", !0),
550
- z.agendaData?.maxTicketsPerReservation > 1 ? (i(), p("div", kt, [
551
- r(I, null, {
549
+ ])) : H("", !0),
550
+ U.agendaData?.maxTicketsPerReservation > 1 ? (i(), p("div", kt, [
551
+ r(D, null, {
552
552
  default: c(() => [...l[7] || (l[7] = [
553
- w("Spots/tickets", -1)
553
+ N("Spots/tickets", -1)
554
554
  ])]),
555
555
  _: 1
556
556
  }),
557
- r(ee, {
557
+ r(K, {
558
558
  modelValue: g(Y),
559
559
  "onUpdate:modelValue": l[2] || (l[2] = (b) => we(Y) ? Y.value = b : null),
560
560
  modelModifiers: { number: !0 },
@@ -563,17 +563,17 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
563
563
  class: "no-spinner",
564
564
  autocomplete: "off"
565
565
  }, null, 8, ["modelValue"])
566
- ])) : W("", !0),
566
+ ])) : H("", !0),
567
567
  f("div", $t, [
568
- r(I, null, {
568
+ r(D, null, {
569
569
  default: c(() => [...l[8] || (l[8] = [
570
- w("Paid (per reservation)", -1)
570
+ N("Paid (per reservation)", -1)
571
571
  ])]),
572
572
  _: 1
573
573
  }),
574
- r(ee, {
575
- modelValue: g(H),
576
- "onUpdate:modelValue": l[3] || (l[3] = (b) => we(H) ? H.value = b : null),
574
+ r(K, {
575
+ modelValue: g(z),
576
+ "onUpdate:modelValue": l[3] || (l[3] = (b) => we(z) ? z.value = b : null),
577
577
  modelModifiers: { number: !0 },
578
578
  type: "number",
579
579
  min: "0",
@@ -585,14 +585,14 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
585
585
  ])
586
586
  ]),
587
587
  f("div", Tt, [
588
- r(I, null, {
588
+ r(D, null, {
589
589
  default: c(() => [...l[10] || (l[10] = [
590
- w("Available hours", -1)
590
+ N("Available hours", -1)
591
591
  ])]),
592
592
  _: 1
593
593
  }),
594
- g(v).length === 0 ? (i(), p("div", It, " No preset hours are available for this resource. You can still add a custom time below. ")) : (i(), p("div", Rt, [
595
- g(N) ? (i(), be(oe, {
594
+ g(ae).length === 0 ? (i(), p("div", It, " No preset hours are available for this resource. You can still add a custom time below. ")) : (i(), p("div", Rt, [
595
+ g(_) ? (i(), be(re, {
596
596
  key: 0,
597
597
  type: "button",
598
598
  size: "icon",
@@ -604,69 +604,69 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
604
604
  r(g(He), { class: "size-4" })
605
605
  ]),
606
606
  _: 1
607
- }, 8, ["onClick"])) : W("", !0),
607
+ }, 8, ["onClick"])) : H("", !0),
608
608
  f("div", wt, [
609
- g(me) ? (i(), p("div", Dt)) : W("", !0),
610
- g(de) ? (i(), p("div", Ct)) : W("", !0),
609
+ g(me) ? (i(), p("div", Dt)) : H("", !0),
610
+ g(de) ? (i(), p("div", Ct)) : H("", !0),
611
611
  f("div", {
612
612
  ref_key: "hourScrollContainer",
613
- ref: D,
613
+ ref: S,
614
614
  class: he(g(Oe)(
615
615
  "hour-scroll-track flex w-full min-w-0 gap-2 overflow-x-auto overscroll-contain py-2",
616
- g(le) && !g(C) && "cursor-grab",
617
- g(C) && "cursor-grabbing select-none"
616
+ g(M) && !g(k) && "cursor-grab",
617
+ g(k) && "cursor-grabbing select-none"
618
618
  ))
619
619
  }, [
620
- (i(!0), p(te, null, pe(g(v), (b) => (i(), be(oe, {
620
+ (i(!0), p(ee, null, pe(g(ae), (b) => (i(), be(re, {
621
621
  key: b,
622
622
  type: "button",
623
623
  variant: "outline",
624
624
  class: he(["relative h-12 shrink-0", fe(b) ? "border-primary!" : ""]),
625
- onClick: (_e) => ae(b)
625
+ onClick: (_e) => oe(b)
626
626
  }, {
627
627
  default: c(() => [
628
- w(k(b) + " ", 1),
628
+ N(R(b) + " ", 1),
629
629
  fe(b) ? (i(), p("div", Nt, [
630
630
  r(g(Qe), { class: "size-3" })
631
- ])) : W("", !0)
631
+ ])) : H("", !0)
632
632
  ]),
633
633
  _: 2
634
634
  }, 1032, ["class", "onClick"]))), 128))
635
635
  ], 2)
636
636
  ]),
637
- g(x) ? (i(), be(oe, {
637
+ g(O) ? (i(), be(re, {
638
638
  key: 1,
639
639
  type: "button",
640
640
  size: "icon",
641
641
  variant: "outline",
642
642
  class: "hidden absolute size-8 shrink-0 rounded-full shadow-sm md:inline-flex z-[11] right-0.5",
643
- onClick: g(ve)
643
+ onClick: g(ue)
644
644
  }, {
645
645
  default: c(() => [
646
646
  r(g(Ye), { class: "size-4" })
647
647
  ]),
648
648
  _: 1
649
- }, 8, ["onClick"])) : W("", !0)
649
+ }, 8, ["onClick"])) : H("", !0)
650
650
  ])),
651
651
  f("div", Ot, [
652
- (i(!0), p(te, null, pe(g(J), (b) => (i(), p("div", {
652
+ (i(!0), p(ee, null, pe(g($), (b) => (i(), p("div", {
653
653
  key: b,
654
654
  class: "relative"
655
655
  }, [
656
- r(oe, {
656
+ r(re, {
657
657
  type: "button",
658
658
  variant: "outline",
659
659
  class: "h-12 px-4 py-2"
660
660
  }, {
661
661
  default: c(() => [
662
- w(k(b), 1)
662
+ N(R(b), 1)
663
663
  ]),
664
664
  _: 2
665
665
  }, 1024),
666
666
  f("div", {
667
667
  class: "absolute -top-1 -right-1 flex items-center justify-center bg-red-500 rounded-full text-white size-4 cursor-pointer",
668
668
  onClick: (_e) => {
669
- J.value = g(J).filter((ce) => ce !== b), M.value = g(M).filter((ce) => ce !== b);
669
+ $.value = g($).filter((ce) => ce !== b), I.value = g(I).filter((ce) => ce !== b);
670
670
  }
671
671
  }, [
672
672
  r(g(We), { class: "size-3" })
@@ -675,12 +675,12 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
675
675
  ])
676
676
  ]),
677
677
  f("div", null, [
678
- r(oe, {
679
- disabled: !g(Z),
678
+ r(re, {
679
+ disabled: !g(X),
680
680
  onClick: ke
681
681
  }, {
682
682
  default: c(() => [
683
- g(M).length === 0 ? (i(), p("span", Mt, "Select at least one timeslot")) : g(M).length === 1 ? (i(), p("span", At, "Add 1 reservation")) : (i(), p("span", Ft, "Add " + k(g(M).length) + " reservations", 1))
683
+ g(I).length === 0 ? (i(), p("span", Mt, "Select at least one timeslot")) : g(I).length === 1 ? (i(), p("span", At, "Add 1 reservation")) : (i(), p("span", Et, "Add " + R(g(I).length) + " reservations", 1))
684
684
  ]),
685
685
  _: 1
686
686
  }, 8, ["disabled"])
@@ -688,7 +688,7 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
688
688
  ], 2);
689
689
  };
690
690
  }
691
- }), Lt = /* @__PURE__ */ at(Et, [["__scopeId", "data-v-30be47b0"]]), Pt = { class: "space-y-3" }, Ut = { class: "flex flex-wrap items-center justify-between gap-3" }, zt = { class: "text-xs text-muted-foreground" }, Bt = { class: "flex flex-wrap items-center gap-2" }, qt = {
691
+ }), Lt = /* @__PURE__ */ at(Ft, [["__scopeId", "data-v-30be47b0"]]), Pt = { class: "space-y-3" }, Ut = { class: "flex flex-wrap items-center justify-between gap-3" }, zt = { class: "text-xs text-muted-foreground" }, Bt = { class: "flex flex-wrap items-center gap-2" }, qt = {
692
692
  key: 0,
693
693
  class: "rounded-md border border-dashed bg-muted/20 px-4 py-6 text-sm text-muted-foreground"
694
694
  }, jt = {
@@ -714,12 +714,12 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
714
714
  availabilityByReservation: {}
715
715
  },
716
716
  emits: ["add", "quick-add", "update:modelValue"],
717
- setup(z, { emit: X }) {
718
- const A = z, Q = X, ue = /^([01]\d|2[0-3]):[0-5]\d$/, B = re(() => A.modelValue ?? []), O = re(() => Number(A.agendaData?.maxTicketsPerReservation) > 1), F = U(null), E = U(!1), q = re(() => String(A.agendaData?.currency || "EUR").toUpperCase()), $ = re(() => {
717
+ setup(U, { emit: G }) {
718
+ const E = U, Q = G, le = /^([01]\d|2[0-3]):[0-5]\d$/, j = ie(() => E.modelValue ?? []), Z = ie(() => Number(E.agendaData?.maxTicketsPerReservation) > 1), T = P(null), F = P(!1), V = ie(() => String(E.agendaData?.currency || "EUR").toUpperCase()), L = ie(() => {
719
719
  try {
720
720
  return new Intl.NumberFormat("en-US", {
721
721
  style: "currency",
722
- currency: q.value,
722
+ currency: V.value,
723
723
  minimumFractionDigits: 2,
724
724
  maximumFractionDigits: 2
725
725
  });
@@ -729,11 +729,11 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
729
729
  maximumFractionDigits: 2
730
730
  });
731
731
  }
732
- }), M = (s) => {
732
+ }), I = (s) => {
733
733
  Q("update:modelValue", s);
734
- }, Y = (s) => ["date", "resourceId", "pricingOption"].includes(s), H = (s) => {
734
+ }, Y = (s) => ["date", "resourceId", "pricingOption"].includes(s), z = (s) => {
735
735
  if (!s.date || !s.resourceId || !s.pricingOption) return s;
736
- const n = ae(s);
736
+ const n = oe(s);
737
737
  return n.length === 0 ? {
738
738
  ...s,
739
739
  startTime: ""
@@ -741,130 +741,130 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
741
741
  ...s,
742
742
  startTime: n[0]
743
743
  };
744
- }, L = (s, n, m) => {
745
- M(B.value.map((S) => {
746
- if (S.id !== s) return S;
744
+ }, B = (s, n, m) => {
745
+ I(j.value.map((x) => {
746
+ if (x.id !== s) return x;
747
747
  if (n === "date") {
748
- const ne = {
749
- ...S,
748
+ const te = {
749
+ ...x,
750
750
  date: String(m ?? ""),
751
751
  dateValue: m || void 0
752
752
  };
753
- return H(ne);
753
+ return z(te);
754
754
  }
755
- const V = {
756
- ...S,
755
+ const A = {
756
+ ...x,
757
757
  [n]: m
758
758
  };
759
- return Y(n) ? H(V) : V;
759
+ return Y(n) ? z(A) : A;
760
760
  }));
761
- }, K = (s, n) => {
761
+ }, J = (s, n) => {
762
762
  const m = Number(n);
763
- L(s, "paid", Number.isFinite(m) ? m : 0);
764
- }, T = (s, n) => {
763
+ B(s, "paid", Number.isFinite(m) ? m : 0);
764
+ }, w = (s, n) => {
765
765
  const m = Number(n);
766
- L(s, "spots", Number.isFinite(m) && m > 0 ? m : 1);
767
- }, ie = (s) => {
768
- M(B.value.filter((n) => n.id !== s));
769
- }, Z = (s) => {
770
- Q("quick-add", s), E.value = !1;
771
- }, v = (s) => A.agendaData?.pricingOptions?.find((n) => n.id === s.pricingOption), N = (s) => {
772
- const n = v(s);
766
+ B(s, "spots", Number.isFinite(m) && m > 0 ? m : 1);
767
+ }, se = (s) => {
768
+ I(j.value.filter((n) => n.id !== s));
769
+ }, X = (s) => {
770
+ Q("quick-add", s), F.value = !1;
771
+ }, ae = (s) => E.agendaData?.pricingOptions?.find((n) => n.id === s.pricingOption), _ = (s) => {
772
+ const n = ae(s);
773
773
  return n ? n.duration ? `${n.name} (${n.duration}min)` : n.name : "Reservation";
774
- }, x = (s) => A.agendaData?.resources?.find((n) => n.id === s.resourceId), D = (s) => x(s)?.name || "Unknown resource", C = (s) => {
775
- if (!s || !ue.test(s)) return null;
774
+ }, O = (s) => E.agendaData?.resources?.find((n) => n.id === s.resourceId), S = (s) => O(s)?.name || "Unknown resource", k = (s) => {
775
+ if (!s || !le.test(s)) return null;
776
776
  const [n, m] = s.split(":").map(Number);
777
777
  return n * 60 + m;
778
- }, le = (s) => {
779
- const n = (s % 1440 + 1440) % 1440, m = Math.floor(n / 60), S = n % 60;
780
- return `${m.toString().padStart(2, "0")}:${S.toString().padStart(2, "0")}`;
781
- }, ve = (s) => {
782
- const n = Number(v(s)?.duration);
778
+ }, M = (s) => {
779
+ const n = (s % 1440 + 1440) % 1440, m = Math.floor(n / 60), x = n % 60;
780
+ return `${m.toString().padStart(2, "0")}:${x.toString().padStart(2, "0")}`;
781
+ }, ue = (s) => {
782
+ const n = Number(ae(s)?.duration);
783
783
  return Number.isFinite(n) && n > 0 ? n : 0;
784
784
  }, ye = (s) => {
785
785
  if (!s.startTime) return "";
786
- const n = ve(s);
786
+ const n = ue(s);
787
787
  if (n <= 0) return "";
788
- const m = C(s.startTime);
789
- return m === null ? "" : le(m + n);
788
+ const m = k(s.startTime);
789
+ return m === null ? "" : M(m + n);
790
790
  }, me = (s) => {
791
791
  if (!/^\d{4}-\d{2}-\d{2}$/.test(s)) return null;
792
- const [n, m, S] = s.split("-").map(Number), V = new Date(n, m - 1, S);
793
- return Number.isNaN(V.getTime()) || V.getFullYear() !== n || V.getMonth() !== m - 1 || V.getDate() !== S ? null : V;
794
- }, de = (s, n) => (A.agendaData?.exceptions || []).find((S) => n >= S.startDate && n <= S.endDate ? !S.resourceIds || S.resourceIds.length === 0 ? !0 : S.resourceIds.includes(s) : !1) || null, fe = (s) => {
795
- const n = x(s), m = me(s.date);
792
+ const [n, m, x] = s.split("-").map(Number), A = new Date(n, m - 1, x);
793
+ return Number.isNaN(A.getTime()) || A.getFullYear() !== n || A.getMonth() !== m - 1 || A.getDate() !== x ? null : A;
794
+ }, de = (s, n) => (E.agendaData?.exceptions || []).find((x) => n >= x.startDate && n <= x.endDate ? !x.resourceIds || x.resourceIds.length === 0 ? !0 : x.resourceIds.includes(s) : !1) || null, fe = (s) => {
795
+ const n = O(s), m = me(s.date);
796
796
  if (!n || !m) return [];
797
- const S = de(n.id, s.date);
798
- if (S)
799
- return S.isClosed ? [] : (S.timeslots || []).map((ne) => ({
800
- start: ne.startTime,
801
- end: ne.endTime
797
+ const x = de(n.id, s.date);
798
+ if (x)
799
+ return x.isClosed ? [] : (x.timeslots || []).map((te) => ({
800
+ start: te.startTime,
801
+ end: te.endTime
802
802
  }));
803
- const V = m.getDay();
804
- return n.openingHours?.[V] || [];
805
- }, ae = (s) => {
806
- const n = x(s);
803
+ const A = m.getDay();
804
+ return n.openingHours?.[A] || [];
805
+ }, oe = (s) => {
806
+ const n = O(s);
807
807
  if (!n) return [];
808
- const m = Number(n.interval) > 0 ? Number(n.interval) : 60, S = ve(s), V = /* @__PURE__ */ new Set();
809
- for (const ne of fe(s)) {
810
- const ee = C(ne.start), b = C(ne.end);
811
- if (ee === null || b === null || b <= ee) continue;
812
- const _e = S > 0 ? b - S : b - m;
813
- for (let ce = ee; ce <= _e; ce += m)
814
- V.add(le(ce));
808
+ const m = Number(n.interval) > 0 ? Number(n.interval) : 60, x = ue(s), A = /* @__PURE__ */ new Set();
809
+ for (const te of fe(s)) {
810
+ const K = k(te.start), b = k(te.end);
811
+ if (K === null || b === null || b <= K) continue;
812
+ const _e = x > 0 ? b - x : b - m;
813
+ for (let ce = K; ce <= _e; ce += m)
814
+ A.add(M(ce));
815
815
  }
816
- return Array.from(V).sort((ne, ee) => (C(ne) ?? 0) - (C(ee) ?? 0));
816
+ return Array.from(A).sort((te, K) => (k(te) ?? 0) - (k(K) ?? 0));
817
817
  }, ge = (s) => {
818
818
  if (!s.startTime) return "Select time";
819
819
  const n = ye(s);
820
820
  return n ? `${s.startTime} - ${n}` : s.startTime;
821
- }, _ = (s) => {
821
+ }, ve = (s) => {
822
822
  const n = Number(s);
823
- if (!Number.isFinite(n)) return q.value === "EUR" ? "€0.00" : "0.00";
823
+ if (!Number.isFinite(n)) return V.value === "EUR" ? "€0.00" : "0.00";
824
824
  try {
825
- return $.value.format(n);
825
+ return L.value.format(n);
826
826
  } catch {
827
827
  return `${n.toFixed(2)}`;
828
828
  }
829
- }, P = (s) => {
829
+ }, v = (s) => {
830
830
  const n = Number(s.spots), m = Number.isFinite(n) && n > 0 ? n : 1;
831
831
  return m === 1 ? "1 spot" : `${m} spots`;
832
- }, J = (s) => A.availabilityByReservation?.[s.id] ?? null, ke = (s) => {
833
- const n = J(s);
832
+ }, $ = (s) => E.availabilityByReservation?.[s.id] ?? null, ke = (s) => {
833
+ const n = $(s);
834
834
  return !n || n.status === "checking" ? "text-muted-foreground" : n.status === "available" ? "text-green-600 dark:text-green-400" : "text-red-600 dark:text-red-400";
835
835
  }, xe = (s) => {
836
836
  if (!/^\d{4}-\d{2}-\d{2}$/.test(s)) return null;
837
- const [n, m, S] = s.split("-").map(Number), V = new Date(n, m - 1, S);
838
- return Number.isNaN(V.getTime()) || V.getFullYear() !== n || V.getMonth() !== m - 1 || V.getDate() !== S ? null : (V.setHours(0, 0, 0, 0), V);
837
+ const [n, m, x] = s.split("-").map(Number), A = new Date(n, m - 1, x);
838
+ return Number.isNaN(A.getTime()) || A.getFullYear() !== n || A.getMonth() !== m - 1 || A.getDate() !== x ? null : (A.setHours(0, 0, 0, 0), A);
839
839
  }, a = (s) => {
840
840
  const n = xe(String(s.date || "").trim());
841
841
  if (!n) return "";
842
842
  const m = /* @__PURE__ */ new Date();
843
843
  if (m.setHours(0, 0, 0, 0), n < m)
844
844
  return "This date is in the past. Double-check it before saving.";
845
- const S = new Date(m);
846
- return S.setFullYear(S.getFullYear() + 1), n > S ? "This date is more than a year ahead. Double-check it before saving." : "";
847
- }, l = (s) => !s.date || !s.startTime || !s.resourceId || !s.pricingOption, I = (s) => F.value === s, oe = (s) => {
848
- F.value = F.value === s ? null : s;
845
+ const x = new Date(m);
846
+ return x.setFullYear(x.getFullYear() + 1), n > x ? "This date is more than a year ahead. Double-check it before saving." : "";
847
+ }, l = (s) => !s.date || !s.startTime || !s.resourceId || !s.pricingOption, D = (s) => T.value === s, re = (s) => {
848
+ T.value = T.value === s ? null : s;
849
849
  };
850
- return Re(B, (s) => {
850
+ return Re(j, (s) => {
851
851
  const n = new Set(s.map((m) => m.id));
852
- if (F.value && !n.has(F.value) && (F.value = null), !F.value) {
852
+ if (T.value && !n.has(T.value) && (T.value = null), !T.value) {
853
853
  const m = s.find(l);
854
- m && (F.value = m.id);
854
+ m && (T.value = m.id);
855
855
  }
856
856
  }, { immediate: !0 }), (s, n) => {
857
- const m = h("Button"), S = h("PopoverTrigger"), V = h("PopoverContent"), ne = h("Popover"), ee = h("Label"), b = h("DynamicSelectOption"), _e = h("DynamicSelect"), ce = h("Input"), Ce = h("SelectValue"), Ne = h("SelectTrigger"), e = h("SelectItem"), o = h("SelectContent"), d = h("Select");
857
+ const m = h("Button"), x = h("PopoverTrigger"), A = h("PopoverContent"), te = h("Popover"), K = h("Label"), b = h("DynamicSelectOption"), _e = h("DynamicSelect"), ce = h("Input"), Ce = h("SelectValue"), Ne = h("SelectTrigger"), e = h("SelectItem"), o = h("SelectContent"), d = h("Select");
858
858
  return i(), p("div", Pt, [
859
859
  f("div", Ut, [
860
- f("p", zt, k(B.value.length === 1 ? "1 reservation line" : `${B.value.length} reservation lines`), 1),
860
+ f("p", zt, R(j.value.length === 1 ? "1 reservation line" : `${j.value.length} reservation lines`), 1),
861
861
  f("div", Bt, [
862
- r(ne, {
863
- open: E.value,
864
- "onUpdate:open": n[0] || (n[0] = (t) => E.value = t)
862
+ r(te, {
863
+ open: F.value,
864
+ "onUpdate:open": n[0] || (n[0] = (t) => F.value = t)
865
865
  }, {
866
866
  default: c(() => [
867
- r(S, { "as-child": "" }, {
867
+ r(x, { "as-child": "" }, {
868
868
  default: c(() => [
869
869
  r(m, {
870
870
  type: "button",
@@ -874,24 +874,24 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
874
874
  }, {
875
875
  default: c(() => [
876
876
  r(g(Ge), { class: "size-4 text-primary" }),
877
- n[2] || (n[2] = w(" Quick add ", -1))
877
+ n[2] || (n[2] = N(" Quick add ", -1))
878
878
  ]),
879
879
  _: 1
880
880
  })
881
881
  ]),
882
882
  _: 1
883
883
  }),
884
- r(V, {
884
+ r(A, {
885
885
  align: "end",
886
886
  class: "max-h-[80vh] w-[min(34rem,calc(100vw-2rem))] overflow-y-auto p-0"
887
887
  }, {
888
888
  default: c(() => [
889
- E.value ? (i(), be(Lt, {
889
+ F.value ? (i(), be(Lt, {
890
890
  key: 0,
891
891
  surface: "popover",
892
- agendaData: z.agendaData,
893
- onAdd: Z
894
- }, null, 8, ["agendaData"])) : W("", !0)
892
+ agendaData: U.agendaData,
893
+ onAdd: X
894
+ }, null, 8, ["agendaData"])) : H("", !0)
895
895
  ]),
896
896
  _: 1
897
897
  })
@@ -906,14 +906,14 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
906
906
  }, {
907
907
  default: c(() => [
908
908
  r(g(Pe), { class: "size-4" }),
909
- n[3] || (n[3] = w(" Add line ", -1))
909
+ n[3] || (n[3] = N(" Add line ", -1))
910
910
  ]),
911
911
  _: 1
912
912
  })
913
913
  ])
914
914
  ]),
915
- B.value.length === 0 ? (i(), p("div", qt, " Use Quick add to create filled reservation lines, or add an empty line manually. ")) : (i(), p("div", jt, [
916
- (i(!0), p(te, null, pe(B.value, (t, y) => (i(), p("div", {
915
+ j.value.length === 0 ? (i(), p("div", qt, " Use Quick add to create filled reservation lines, or add an empty line manually. ")) : (i(), p("div", jt, [
916
+ (i(!0), p(ee, null, pe(j.value, (t, y) => (i(), p("div", {
917
917
  key: t.id,
918
918
  class: "rounded-xl border bg-background"
919
919
  }, [
@@ -921,20 +921,20 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
921
921
  f("button", {
922
922
  type: "button",
923
923
  class: "flex min-w-0 flex-1 items-start gap-3 rounded-lg px-1 py-1 text-left outline-none transition-colors hover:bg-muted/40 focus-visible:ring-2 focus-visible:ring-ring/50",
924
- "aria-expanded": I(t.id),
925
- onClick: (u) => oe(t.id)
924
+ "aria-expanded": D(t.id),
925
+ onClick: (u) => re(t.id)
926
926
  }, [
927
- f("span", Yt, k(y + 1), 1),
927
+ f("span", Yt, R(y + 1), 1),
928
928
  f("span", Wt, [
929
929
  f("span", Gt, [
930
930
  f("span", Xt, [
931
- f("span", Zt, k(ge(t)), 1),
932
- f("span", Jt, k(t.date || "No date selected"), 1),
933
- f("span", Kt, k(D(t)) + " · " + k(N(t)), 1),
934
- J(t)?.message ? (i(), p("span", {
931
+ f("span", Zt, R(ge(t)), 1),
932
+ f("span", Jt, R(t.date || "No date selected"), 1),
933
+ f("span", Kt, R(S(t)) + " · " + R(_(t)), 1),
934
+ $(t)?.message ? (i(), p("span", {
935
935
  key: 0,
936
936
  class: he(["mt-1 block text-xs font-medium", ke(t)])
937
- }, k(J(t)?.message), 3)) : W("", !0)
937
+ }, R($(t)?.message), 3)) : H("", !0)
938
938
  ]),
939
939
  f("span", en, [
940
940
  r(g(Xe), { class: "size-4" })
@@ -943,11 +943,11 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
943
943
  f("span", tn, [
944
944
  f("span", nn, [
945
945
  r(g(Ze), { class: "size-4" }),
946
- w(" " + k(P(t)), 1)
946
+ N(" " + R(v(t)), 1)
947
947
  ]),
948
948
  f("span", sn, [
949
949
  r(g(Je), { class: "size-4" }),
950
- w(" " + k(_(t.paid)), 1)
950
+ N(" " + R(ve(t.paid)), 1)
951
951
  ])
952
952
  ])
953
953
  ])
@@ -957,7 +957,7 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
957
957
  variant: "ghost",
958
958
  size: "icon",
959
959
  class: "mt-1 shrink-0",
960
- onClick: (u) => ie(t.id)
960
+ onClick: (u) => se(t.id)
961
961
  }, {
962
962
  default: c(() => [
963
963
  r(g(Me), { class: "size-4" })
@@ -967,19 +967,19 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
967
967
  ]),
968
968
  f("div", an, [
969
969
  f("div", null, [
970
- f("p", on, "Reservation " + k(y + 1), 1),
971
- f("p", rn, k(D(t)) + " · " + k(N(t)), 1),
972
- J(t)?.message ? (i(), p("p", {
970
+ f("p", on, "Reservation " + R(y + 1), 1),
971
+ f("p", rn, R(S(t)) + " · " + R(_(t)), 1),
972
+ $(t)?.message ? (i(), p("p", {
973
973
  key: 0,
974
974
  class: he(["mt-1 text-xs font-medium", ke(t)])
975
- }, k(J(t)?.message), 3)) : W("", !0)
975
+ }, R($(t)?.message), 3)) : H("", !0)
976
976
  ]),
977
977
  r(m, {
978
978
  type: "button",
979
979
  variant: "ghost",
980
980
  size: "icon",
981
981
  class: "shrink-0",
982
- onClick: (u) => ie(t.id)
982
+ onClick: (u) => se(t.id)
983
983
  }, {
984
984
  default: c(() => [
985
985
  r(g(Me), { class: "size-4" })
@@ -988,13 +988,13 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
988
988
  }, 8, ["onClick"])
989
989
  ]),
990
990
  f("div", {
991
- class: he(["px-3 pb-3 md:px-4 md:pb-4 overflow-hidden", I(t.id) ? "block" : "hidden md:block"])
991
+ class: he(["px-3 pb-3 md:px-4 md:pb-4 overflow-hidden", D(t.id) ? "block" : "hidden md:block"])
992
992
  }, [
993
993
  f("div", ln, [
994
994
  f("div", un, [
995
- r(ee, null, {
995
+ r(K, null, {
996
996
  default: c(() => [...n[4] || (n[4] = [
997
- w("Resource", -1)
997
+ N("Resource", -1)
998
998
  ])]),
999
999
  _: 1
1000
1000
  }),
@@ -1003,15 +1003,15 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1003
1003
  "wrapper-class": "w-full",
1004
1004
  class: "w-full",
1005
1005
  placeholder: "Select resource",
1006
- "onUpdate:modelValue": (u) => L(t.id, "resourceId", String(u ?? ""))
1006
+ "onUpdate:modelValue": (u) => B(t.id, "resourceId", String(u ?? ""))
1007
1007
  }, {
1008
1008
  default: c(() => [
1009
- (i(!0), p(te, null, pe(z.agendaData?.resources || [], (u) => (i(), be(b, {
1009
+ (i(!0), p(ee, null, pe(U.agendaData?.resources || [], (u) => (i(), be(b, {
1010
1010
  key: u.id,
1011
1011
  value: u.id
1012
1012
  }, {
1013
1013
  default: c(() => [
1014
- w(k(u.name), 1)
1014
+ N(R(u.name), 1)
1015
1015
  ]),
1016
1016
  _: 2
1017
1017
  }, 1032, ["value"]))), 128))
@@ -1020,32 +1020,32 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1020
1020
  }, 8, ["model-value", "onUpdate:modelValue"])
1021
1021
  ]),
1022
1022
  f("div", dn, [
1023
- r(ee, null, {
1023
+ r(K, null, {
1024
1024
  default: c(() => [...n[5] || (n[5] = [
1025
- w("Date", -1)
1025
+ N("Date", -1)
1026
1026
  ])]),
1027
1027
  _: 1
1028
1028
  }),
1029
1029
  r(ce, {
1030
1030
  "model-value": t.date,
1031
1031
  type: "date",
1032
- "onUpdate:modelValue": (u) => L(t.id, "date", String(u ?? ""))
1032
+ "onUpdate:modelValue": (u) => B(t.id, "date", String(u ?? ""))
1033
1033
  }, null, 8, ["model-value", "onUpdate:modelValue"]),
1034
- a(t) ? (i(), p("p", cn, k(a(t)), 1)) : W("", !0)
1034
+ a(t) ? (i(), p("p", cn, R(a(t)), 1)) : H("", !0)
1035
1035
  ]),
1036
1036
  f("div", pn, [
1037
- r(ee, {
1037
+ r(K, {
1038
1038
  for: `new_reservation_res_line_${y}_time`
1039
1039
  }, {
1040
1040
  default: c(() => [...n[6] || (n[6] = [
1041
- w("Time", -1)
1041
+ N("Time", -1)
1042
1042
  ])]),
1043
1043
  _: 1
1044
1044
  }, 8, ["for"]),
1045
- t.resourceId && t.date ? (i(), p(te, { key: 0 }, [
1045
+ t.resourceId && t.date ? (i(), p(ee, { key: 0 }, [
1046
1046
  r(d, {
1047
1047
  "model-value": t.startTime,
1048
- "onUpdate:modelValue": (u) => L(t.id, "startTime", String(u ?? ""))
1048
+ "onUpdate:modelValue": (u) => B(t.id, "startTime", String(u ?? ""))
1049
1049
  }, {
1050
1050
  default: c(() => [
1051
1051
  r(Ne, {
@@ -1059,12 +1059,12 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1059
1059
  }, 8, ["id"]),
1060
1060
  r(o, null, {
1061
1061
  default: c(() => [
1062
- (i(!0), p(te, null, pe(ae(t), (u) => (i(), be(e, {
1062
+ (i(!0), p(ee, null, pe(oe(t), (u) => (i(), be(e, {
1063
1063
  key: u,
1064
1064
  value: u
1065
1065
  }, {
1066
1066
  default: c(() => [
1067
- w(k(u), 1)
1067
+ N(R(u), 1)
1068
1068
  ]),
1069
1069
  _: 2
1070
1070
  }, 1032, ["value"]))), 128))
@@ -1074,17 +1074,17 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1074
1074
  ]),
1075
1075
  _: 2
1076
1076
  }, 1032, ["model-value", "onUpdate:modelValue"]),
1077
- t.resourceId && t.date && ae(t).length === 0 ? (i(), p("p", mn, " No times are available for this resource on the selected date. ")) : W("", !0)
1077
+ t.resourceId && t.date && oe(t).length === 0 ? (i(), p("p", mn, " No times are available for this resource on the selected date. ")) : H("", !0)
1078
1078
  ], 64)) : (i(), p("p", fn, [
1079
- !t.resourceId && !t.date ? (i(), p("span", gn, "Please select a resource and date.")) : t.resourceId ? t.date ? W("", !0) : (i(), p("span", _n, "Please select a date.")) : (i(), p("span", vn, "Please select a resource."))
1079
+ !t.resourceId && !t.date ? (i(), p("span", gn, "Please select a resource and date.")) : t.resourceId ? t.date ? H("", !0) : (i(), p("span", _n, "Please select a date.")) : (i(), p("span", vn, "Please select a resource."))
1080
1080
  ]))
1081
1081
  ]),
1082
1082
  f("div", {
1083
- class: he(["grid gap-2", { hidden: z.agendaData?.pricingOptions?.length < 2 }])
1083
+ class: he(["grid gap-2", { hidden: U.agendaData?.pricingOptions?.length < 2 }])
1084
1084
  }, [
1085
- r(ee, null, {
1085
+ r(K, null, {
1086
1086
  default: c(() => [...n[7] || (n[7] = [
1087
- w("Type", -1)
1087
+ N("Type", -1)
1088
1088
  ])]),
1089
1089
  _: 1
1090
1090
  }),
@@ -1093,15 +1093,15 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1093
1093
  "wrapper-class": "w-full",
1094
1094
  class: "w-full",
1095
1095
  placeholder: "Select type",
1096
- "onUpdate:modelValue": (u) => L(t.id, "pricingOption", String(u ?? ""))
1096
+ "onUpdate:modelValue": (u) => B(t.id, "pricingOption", String(u ?? ""))
1097
1097
  }, {
1098
1098
  default: c(() => [
1099
- (i(!0), p(te, null, pe(z.agendaData?.pricingOptions || [], (u) => (i(), be(b, {
1099
+ (i(!0), p(ee, null, pe(U.agendaData?.pricingOptions || [], (u) => (i(), be(b, {
1100
1100
  key: u.id,
1101
1101
  value: u.id
1102
1102
  }, {
1103
1103
  default: c(() => [
1104
- w(k(u.name), 1)
1104
+ N(R(u.name), 1)
1105
1105
  ]),
1106
1106
  _: 2
1107
1107
  }, 1032, ["value"]))), 128))
@@ -1110,12 +1110,12 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1110
1110
  }, 8, ["model-value", "onUpdate:modelValue"])
1111
1111
  ], 2),
1112
1112
  f("div", {
1113
- class: he(["grid gap-4", O.value ? "md:grid-cols-2 xl:grid-cols-2 xl:col-span-1" : ""])
1113
+ class: he(["grid gap-4", Z.value ? "md:grid-cols-2 xl:grid-cols-2 xl:col-span-1" : ""])
1114
1114
  }, [
1115
- O.value ? (i(), p("div", hn, [
1116
- r(ee, null, {
1115
+ Z.value ? (i(), p("div", hn, [
1116
+ r(K, null, {
1117
1117
  default: c(() => [...n[8] || (n[8] = [
1118
- w("Spots", -1)
1118
+ N("Spots", -1)
1119
1119
  ])]),
1120
1120
  _: 1
1121
1121
  }),
@@ -1124,15 +1124,15 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1124
1124
  type: "number",
1125
1125
  min: "1",
1126
1126
  class: "no-spinner",
1127
- "onUpdate:modelValue": (u) => T(t.id, u)
1127
+ "onUpdate:modelValue": (u) => w(t.id, u)
1128
1128
  }, null, 8, ["model-value", "onUpdate:modelValue"])
1129
- ])) : W("", !0),
1129
+ ])) : H("", !0),
1130
1130
  f("div", {
1131
- class: he(["grid gap-2", O.value ? "" : "md:col-span-2 xl:col-span-1"])
1131
+ class: he(["grid gap-2", Z.value ? "" : "md:col-span-2 xl:col-span-1"])
1132
1132
  }, [
1133
- r(ee, null, {
1133
+ r(K, null, {
1134
1134
  default: c(() => [...n[9] || (n[9] = [
1135
- w("Paid", -1)
1135
+ N("Paid", -1)
1136
1136
  ])]),
1137
1137
  _: 1
1138
1138
  }),
@@ -1142,7 +1142,7 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1142
1142
  min: "0",
1143
1143
  step: "1",
1144
1144
  class: "no-spinner",
1145
- "onUpdate:modelValue": (u) => K(t.id, u)
1145
+ "onUpdate:modelValue": (u) => J(t.id, u)
1146
1146
  }, null, 8, ["model-value", "onUpdate:modelValue"])
1147
1147
  ], 2)
1148
1148
  ], 2)
@@ -1153,55 +1153,55 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1153
1153
  ]);
1154
1154
  };
1155
1155
  }
1156
- }), yn = { class: "space-y-5 md:mt-5" }, xn = { class: "space-y-3" }, Sn = { class: "mt-4 text-red-400" }, kn = { class: "list-disc pl-4" }, $n = { key: 0 }, Tn = { key: 1 }, In = { key: 2 }, Fe = "", Vn = /* @__PURE__ */ De({
1156
+ }), yn = { class: "space-y-5 md:mt-5" }, xn = { class: "space-y-3" }, Sn = { class: "mt-4 text-red-400" }, kn = { class: "list-disc pl-4" }, $n = { key: 0 }, Tn = { key: 1 }, In = { key: 2 }, Ee = "", Vn = /* @__PURE__ */ De({
1157
1157
  __name: "NewReservationDialog",
1158
1158
  props: {
1159
1159
  agendaData: {}
1160
1160
  },
1161
- setup(z) {
1162
- const X = z, { params: A } = Ke(), { config: Q } = et(), { log: ue, logError: B } = tt(), O = nt(Q.project), F = re(() => A.value?.id ?? A.id ?? ""), E = qe("agendaData", U({})), q = re(() => X.agendaData ?? E.value ?? {}), $ = U(!1), M = U(!1), Y = U({});
1163
- let H = 0;
1164
- const L = U([]), K = /^([01]\d|2[0-3]):[0-5]\d$/, T = U([]), ie = U(null), Z = re(() => Object.values(Y.value).some((e) => e.status === "checking")), v = re(() => Object.values(Y.value).some((e) => e.status === "unavailable")), N = () => q.value?.resources?.[0]?.id ?? "", x = () => q.value?.pricingOptions?.find((e) => e.isDefault === !0)?.id ?? q.value?.pricingOptions?.[0]?.id ?? "", D = () => {
1161
+ setup(U) {
1162
+ const G = U, { params: E } = Ke(), { config: Q } = et(), { log: le, logError: j } = tt(), Z = nt(Q.project), T = ie(() => E.value?.id ?? E.id ?? ""), F = qe("agendaData", P({})), V = ie(() => G.agendaData ?? F.value ?? {}), L = P(!1), I = P(!1), Y = P({});
1163
+ let z = 0;
1164
+ const B = P([]), J = /^([01]\d|2[0-3]):[0-5]\d$/, w = P([]), se = P(null), X = ie(() => Object.values(Y.value).some((e) => e.status === "checking")), ae = ie(() => Object.values(Y.value).some((e) => e.status === "unavailable")), _ = () => V.value?.resources?.[0]?.id ?? "", O = () => V.value?.pricingOptions?.find((e) => e.isDefault === !0)?.id ?? V.value?.pricingOptions?.[0]?.id ?? "", S = () => {
1165
1165
  const e = /* @__PURE__ */ new Date(), o = e.getFullYear(), d = `${e.getMonth() + 1}`.padStart(2, "0"), t = `${e.getDate()}`.padStart(2, "0");
1166
1166
  return `${o}-${d}-${t}`;
1167
- }, C = (e) => {
1168
- let o = e?.pricingOption ?? x(), d = q.value?.pricingOptions?.find((y) => y.id === o)?.price ?? 0;
1167
+ }, k = (e) => {
1168
+ let o = e?.pricingOption ?? O(), d = V.value?.pricingOptions?.find((y) => y.id === o)?.price ?? 0;
1169
1169
  typeof d == "string" && (d = Number(d));
1170
1170
  let t = e?.paid ?? d;
1171
1171
  return typeof t == "string" && (t = Number(t)), {
1172
1172
  id: `reservation_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`,
1173
1173
  spots: Number(e?.spots) || 1,
1174
1174
  paid: Number.isFinite(t) ? t : 0,
1175
- resourceId: e?.resourceId ?? N(),
1175
+ resourceId: e?.resourceId ?? _(),
1176
1176
  pricingOption: o,
1177
- date: e?.date ?? D(),
1177
+ date: e?.date ?? S(),
1178
1178
  dateValue: e?.dateValue,
1179
- startTime: e?.startTime ?? Fe
1179
+ startTime: e?.startTime ?? Ee
1180
1180
  };
1181
- }, le = () => {
1182
- T.value = [C()];
1183
- }, ve = (e) => (!e.date || e.date === D()) && e.startTime === Fe, ye = () => {
1184
- const e = T.value[T.value.length - 1];
1185
- T.value = [...T.value, C(e ? { ...e } : void 0)];
1186
- }, me = (e) => q.value?.pricingOptions?.find((o) => o.id === e.pricingOption), de = (e) => q.value?.resources?.find((o) => o.id === e.resourceId), fe = () => {
1187
- const e = Number(q.value?.maxTicketsPerReservation);
1181
+ }, M = () => {
1182
+ w.value = [k()];
1183
+ }, ue = (e) => (!e.date || e.date === S()) && e.startTime === Ee, ye = () => {
1184
+ const e = w.value[w.value.length - 1];
1185
+ w.value = [...w.value, k(e ? { ...e } : void 0)];
1186
+ }, me = (e) => V.value?.pricingOptions?.find((o) => o.id === e.pricingOption), de = (e) => V.value?.resources?.find((o) => o.id === e.resourceId), fe = () => {
1187
+ const e = Number(V.value?.maxTicketsPerReservation);
1188
1188
  return Number.isFinite(e) && e > 0 ? e : null;
1189
- }, ae = (e) => `Reservation ${e + 1}`, ge = (e) => {
1189
+ }, oe = (e) => `Reservation ${e + 1}`, ge = (e) => {
1190
1190
  const o = String(e.date || "").trim(), d = String(e.startTime || "").trim(), t = String(e.resourceId || "").trim();
1191
1191
  return !o || !d || !t ? "" : `${t}_${o}_${d}`;
1192
- }, _ = () => {
1192
+ }, ve = () => {
1193
1193
  const e = [], o = /* @__PURE__ */ new Map(), d = fe();
1194
- return T.value.forEach((t, y) => {
1195
- const u = ae(y), j = String(t.date || "").trim(), G = String(t.startTime || "").trim(), R = String(t.resourceId || "").trim(), se = String(t.pricingOption || "").trim(), Te = Number(t.spots), $e = Number(t.paid);
1196
- j || e.push(`${u}: please select a date.`), G ? K.test(G) || e.push(`${u}: please enter a valid time.`) : e.push(`${u}: please select a time.`), R ? de(t) || e.push(`${u}: the selected resource is no longer available.`) : e.push(`${u}: please select a resource.`), se ? me(t) || e.push(`${u}: the selected type is no longer available.`) : e.push(`${u}: please select a type.`), !Number.isFinite(Te) || Te <= 0 ? e.push(`${u}: spots must be at least 1.`) : d !== null && Te > d && e.push(`${u}: spots cannot be more than ${d}.`), (!Number.isFinite($e) || $e < 0) && e.push(`${u}: paid amount must be 0 or higher.`);
1194
+ return w.value.forEach((t, y) => {
1195
+ const u = oe(y), q = String(t.date || "").trim(), W = String(t.startTime || "").trim(), C = String(t.resourceId || "").trim(), ne = String(t.pricingOption || "").trim(), Te = Number(t.spots), $e = Number(t.paid);
1196
+ q || e.push(`${u}: please select a date.`), W ? J.test(W) || e.push(`${u}: please enter a valid time.`) : e.push(`${u}: please select a time.`), C ? de(t) || e.push(`${u}: the selected resource is no longer available.`) : e.push(`${u}: please select a resource.`), ne ? me(t) || e.push(`${u}: the selected type is no longer available.`) : e.push(`${u}: please select a type.`), !Number.isFinite(Te) || Te <= 0 ? e.push(`${u}: spots must be at least 1.`) : d !== null && Te > d && e.push(`${u}: spots cannot be more than ${d}.`), (!Number.isFinite($e) || $e < 0) && e.push(`${u}: paid amount must be 0 or higher.`);
1197
1197
  const Se = ge(t);
1198
1198
  if (Se) {
1199
1199
  const Ie = o.get(Se);
1200
- Ie !== void 0 ? e.push(`${u}: duplicate of ${ae(Ie).toLowerCase()}.`) : o.set(Se, y);
1200
+ Ie !== void 0 ? e.push(`${u}: duplicate of ${oe(Ie).toLowerCase()}.`) : o.set(Se, y);
1201
1201
  }
1202
1202
  }), e;
1203
- }, P = (e) => {
1204
- const o = e.startTimes.map((d) => C({
1203
+ }, v = (e) => {
1204
+ const o = e.startTimes.map((d) => k({
1205
1205
  date: e.date ? `${e.date}` : "",
1206
1206
  dateValue: e.date,
1207
1207
  pricingOption: e.pricingOptionId,
@@ -1211,14 +1211,14 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1211
1211
  startTime: d
1212
1212
  }));
1213
1213
  if (o.length !== 0) {
1214
- if (T.value.length === 1 && ve(T.value[0])) {
1215
- T.value = o;
1214
+ if (w.value.length === 1 && ue(w.value[0])) {
1215
+ w.value = o;
1216
1216
  return;
1217
1217
  }
1218
- T.value = [...T.value, ...o];
1218
+ w.value = [...w.value, ...o];
1219
1219
  }
1220
- }, J = (e) => {
1221
- if (!e || !K.test(e)) return null;
1220
+ }, $ = (e) => {
1221
+ if (!e || !J.test(e)) return null;
1222
1222
  const [o, d] = e.split(":").map(Number);
1223
1223
  return o * 60 + d;
1224
1224
  }, ke = (e) => {
@@ -1228,7 +1228,7 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1228
1228
  if (!e.startTime || !e.pricingOption) return "";
1229
1229
  const o = me(e), d = Number(o?.duration);
1230
1230
  if (!Number.isFinite(d) || d <= 0) return e.startTime;
1231
- const t = J(e.startTime);
1231
+ const t = $(e.startTime);
1232
1232
  return t === null ? "" : ke(t + d);
1233
1233
  }, a = (e) => {
1234
1234
  const o = Number(e.spots);
@@ -1236,8 +1236,8 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1236
1236
  }, l = (e) => {
1237
1237
  const o = Number(de(e)?.capacity);
1238
1238
  return Number.isFinite(o) && o > 0 ? o : 1;
1239
- }, I = (e) => {
1240
- const o = String(e.date || "").trim(), d = String(e.resourceId || "").trim(), t = J(e.startTime), y = J(xe(e));
1239
+ }, D = (e) => {
1240
+ const o = String(e.date || "").trim(), d = String(e.resourceId || "").trim(), t = $(e.startTime), y = $(xe(e));
1241
1241
  return !o || !d || !de(e) || !me(e) || t === null || y === null || y <= t ? null : {
1242
1242
  reservation: e,
1243
1243
  date: o,
@@ -1247,114 +1247,114 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1247
1247
  capacity: l(e),
1248
1248
  requestedSpots: a(e)
1249
1249
  };
1250
- }, oe = (e) => ["approved", "needs_approval"].includes(e?.status), s = (e, o, d, t) => e < t && o > d, n = (e) => `${e} ${e === 1 ? "spot" : "spots"}`, m = (e, o, d) => e < d ? {
1250
+ }, re = (e) => ["approved", "needs_approval"].includes(e?.status), s = (e, o, d, t) => e < t && o > d, n = (e) => `${e} ${e === 1 ? "spot" : "spots"}`, m = (e, o, d) => e < d ? {
1251
1251
  status: "unavailable",
1252
1252
  message: `Not enough spots: ${n(Math.max(e, 0))} open, needs ${n(d)}.`
1253
1253
  } : {
1254
1254
  status: "available",
1255
1255
  message: `Available: ${e} of ${o} ${o === 1 ? "spot" : "spots"} open, ${n(e - d)} will remain.`
1256
- }, S = (e) => e?.id || e?.orderId || "", V = (e, o) => {
1256
+ }, x = (e) => e?.id || e?.orderId || "", A = (e, o) => {
1257
1257
  const d = [];
1258
1258
  for (let t = 0; t < e.length; t += o)
1259
1259
  d.push(e.slice(t, t + o));
1260
1260
  return d;
1261
- }, ne = async (e) => {
1261
+ }, te = async (e) => {
1262
1262
  const o = /* @__PURE__ */ new Map(), d = [];
1263
- for (const t of V(e, 10)) {
1263
+ for (const t of A(e, 10)) {
1264
1264
  const y = [
1265
1265
  { field: "status", operator: "==", value: "confirmed" },
1266
1266
  { field: "flattenedReservationDates", operator: "array-contains-any", value: t }
1267
1267
  ];
1268
- F.value && y.unshift({ field: "agendaId", operator: "==", value: F.value });
1269
- const u = await O.find(Q.reservationsCollection, { filters: y });
1270
- for (const j of u || []) {
1271
- const G = S(j);
1272
- G ? o.set(G, j) : d.push(j);
1268
+ T.value && y.unshift({ field: "agendaId", operator: "==", value: T.value });
1269
+ const u = await Z.find(Q.reservationsCollection, { filters: y });
1270
+ for (const q of u || []) {
1271
+ const W = x(q);
1272
+ W ? o.set(W, q) : d.push(q);
1273
1273
  }
1274
1274
  }
1275
1275
  return [...o.values(), ...d];
1276
- }, ee = (e, o) => {
1276
+ }, K = (e, o) => {
1277
1277
  let d = 0;
1278
1278
  for (const t of e)
1279
1279
  for (const y of t?.reservations || []) {
1280
- if (!oe(y) || y?.date !== o.date || y?.resourceId !== o.resourceId) continue;
1281
- const u = J(y?.timeslot?.startTime), j = J(y?.timeslot?.endTime);
1282
- if (u === null || j === null || j <= u || !s(o.startMinutes, o.endMinutes, u, j)) continue;
1283
- const G = Number(y?.spots);
1284
- d += Number.isFinite(G) && G > 0 ? G : 1;
1280
+ if (!re(y) || y?.date !== o.date || y?.resourceId !== o.resourceId) continue;
1281
+ const u = $(y?.timeslot?.startTime), q = $(y?.timeslot?.endTime);
1282
+ if (u === null || q === null || q <= u || !s(o.startMinutes, o.endMinutes, u, q)) continue;
1283
+ const W = Number(y?.spots);
1284
+ d += Number.isFinite(W) && W > 0 ? W : 1;
1285
1285
  }
1286
1286
  return d;
1287
1287
  }, b = (e) => {
1288
1288
  let o = 0;
1289
- for (const d of T.value) {
1289
+ for (const d of w.value) {
1290
1290
  if (d.id === e.reservation.id) continue;
1291
- const t = I(d);
1291
+ const t = D(d);
1292
1292
  t && t.date === e.date && t.resourceId === e.resourceId && s(e.startMinutes, e.endMinutes, t.startMinutes, t.endMinutes) && (o += t.requestedSpots);
1293
1293
  }
1294
1294
  return o;
1295
1295
  }, _e = async () => {
1296
- const e = ++H, o = T.value.map(I).filter((t) => !!t), d = o.reduce((t, y) => (t[y.reservation.id] = {
1296
+ const e = ++z, o = w.value.map(D).filter((t) => !!t), d = o.reduce((t, y) => (t[y.reservation.id] = {
1297
1297
  status: "checking",
1298
1298
  message: "Checking availability..."
1299
1299
  }, t), {});
1300
- if (Y.value = d, !$.value || o.length === 0)
1300
+ if (Y.value = d, !L.value || o.length === 0)
1301
1301
  return d;
1302
1302
  try {
1303
- const t = Array.from(new Set(o.map((j) => `${j.resourceId}_${j.date}`))), y = await ne(t);
1304
- if (e !== H) return null;
1305
- const u = o.reduce((j, G) => {
1306
- const R = ee(y, G) + b(G), se = G.capacity - R;
1307
- return j[G.reservation.id] = m(
1308
- se,
1309
- G.capacity,
1310
- G.requestedSpots
1311
- ), j;
1303
+ const t = Array.from(new Set(o.map((q) => `${q.resourceId}_${q.date}`))), y = await te(t);
1304
+ if (e !== z) return null;
1305
+ const u = o.reduce((q, W) => {
1306
+ const C = K(y, W) + b(W), ne = W.capacity - C;
1307
+ return q[W.reservation.id] = m(
1308
+ ne,
1309
+ W.capacity,
1310
+ W.requestedSpots
1311
+ ), q;
1312
1312
  }, {});
1313
1313
  return Y.value = u, u;
1314
1314
  } catch (t) {
1315
- if (e !== H) return null;
1315
+ if (e !== z) return null;
1316
1316
  console.error("Error checking new reservation availability:", t);
1317
- const y = o.reduce((u, j) => (u[j.reservation.id] = {
1317
+ const y = o.reduce((u, q) => (u[q.reservation.id] = {
1318
1318
  status: "error",
1319
1319
  message: "Could not check availability for this reservation."
1320
1320
  }, u), {});
1321
1321
  return Y.value = y, y;
1322
1322
  }
1323
- }, ce = (e) => e ? T.value.flatMap((o, d) => {
1323
+ }, ce = (e) => e ? w.value.flatMap((o, d) => {
1324
1324
  const t = e[o.id];
1325
- return t ? t.status === "unavailable" ? [`${ae(d)}: ${t.message}`] : t.status === "error" ? [`${ae(d)}: availability could not be checked.`] : [] : [];
1325
+ return t ? t.status === "unavailable" ? [`${oe(d)}: ${t.message}`] : t.status === "error" ? [`${oe(d)}: availability could not be checked.`] : [] : [];
1326
1326
  }) : ["Could not check availability before creating the reservation."];
1327
- Re($, async (e) => {
1328
- e ? (L.value = [], le(), await Le(), ie.value?.reset()) : (H += 1, Y.value = {});
1329
- }), Re(T, () => {
1330
- $.value && _e();
1327
+ Re(L, async (e) => {
1328
+ e ? (B.value = [], M(), await Le(), se.value?.reset()) : (z += 1, Y.value = {});
1329
+ }), Re(w, () => {
1330
+ L.value && _e();
1331
1331
  }, { deep: !0 });
1332
1332
  const Ce = () => {
1333
1333
  const e = [];
1334
- L.value = [];
1335
- const o = ie.value, d = o ? o.validateForm() : !1;
1336
- return o || e.push("Customer information form is unavailable."), T.value.length === 0 && e.push("Please add at least one reservation."), e.push(..._()), L.value = e, e.length === 0 && d;
1334
+ B.value = [];
1335
+ const o = se.value, d = o ? o.validateForm() : !1;
1336
+ return o || e.push("Customer information form is unavailable."), w.value.length === 0 && e.push("Please add at least one reservation."), e.push(...ve()), B.value = e, e.length === 0 && d;
1337
1337
  }, Ne = async () => {
1338
- const e = ie.value;
1338
+ const e = se.value;
1339
1339
  if (!e || !Ce()) return;
1340
1340
  const o = await _e(), d = ce(o);
1341
1341
  if (d.length > 0) {
1342
- L.value = d;
1342
+ B.value = d;
1343
1343
  return;
1344
1344
  }
1345
1345
  let t = !1;
1346
1346
  try {
1347
- M.value = !0;
1348
- const y = e.getCustomerInfo(), u = T.value.map((R) => {
1349
- const se = Number(R.paid) || 0, Te = Number(R.spots) || 1, $e = me(R), Se = de(R), Ie = R.date;
1347
+ I.value = !0;
1348
+ const y = e.getCustomerInfo(), u = w.value.map((C) => {
1349
+ const ne = Number(C.paid) || 0, Te = Number(C.spots) || 1, $e = me(C), Se = de(C), Ie = C.date;
1350
1350
  return {
1351
- paidAmount: se,
1352
- flattenedReservationDate: `${R.resourceId}_${Ie}`,
1353
- flattenedReservation: `${R.resourceId}_${Ie}_${R.startTime.replace(":", "")}`,
1351
+ paidAmount: ne,
1352
+ flattenedReservationDate: `${C.resourceId}_${Ie}`,
1353
+ flattenedReservation: `${C.resourceId}_${Ie}_${C.startTime.replace(":", "")}`,
1354
1354
  reservation: {
1355
1355
  status: "approved",
1356
- totalPrice: Number(se.toFixed(2)),
1357
- basePrice: Number((se / Te).toFixed(2)),
1356
+ totalPrice: Number(ne.toFixed(2)),
1357
+ basePrice: Number((ne / Te).toFixed(2)),
1358
1358
  addOnsPrice: 0,
1359
1359
  addOns: [],
1360
1360
  date: Ie,
@@ -1365,7 +1365,7 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1365
1365
  name: $e?.name || "",
1366
1366
  price: $e?.price || ""
1367
1367
  },
1368
- pricingOptionId: R.pricingOption,
1368
+ pricingOptionId: C.pricingOption,
1369
1369
  resource: {
1370
1370
  avatarLabel: Se?.avatarLabel || "",
1371
1371
  color: Se?.color || "",
@@ -1373,52 +1373,52 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1373
1373
  id: Se?.id || "",
1374
1374
  name: Se?.name || ""
1375
1375
  },
1376
- resourceId: R.resourceId,
1376
+ resourceId: C.resourceId,
1377
1377
  spots: Te,
1378
1378
  timeslot: {
1379
- startTime: R.startTime,
1380
- endTime: xe(R)
1379
+ startTime: C.startTime,
1380
+ endTime: xe(C)
1381
1381
  }
1382
1382
  }
1383
1383
  };
1384
- }), j = Number(u.reduce((R, se) => R + se.paidAmount, 0).toFixed(2)), G = {
1385
- agendaId: F.value,
1384
+ }), q = Number(u.reduce((C, ne) => C + ne.paidAmount, 0).toFixed(2)), W = {
1385
+ agendaId: T.value,
1386
1386
  customerInfo: y,
1387
1387
  metadata: {},
1388
- amountPaid: j,
1388
+ amountPaid: q,
1389
1389
  amountDue: 0,
1390
- subtotal: j,
1391
- total: j,
1390
+ subtotal: q,
1391
+ total: q,
1392
1392
  createdAt: /* @__PURE__ */ new Date(),
1393
1393
  updatedAt: /* @__PURE__ */ new Date(),
1394
1394
  discount: 0,
1395
- flattenedReservationDates: Array.from(new Set(u.map((R) => R.flattenedReservationDate))),
1396
- flattenedReservations: u.map((R) => R.flattenedReservation),
1395
+ flattenedReservationDates: Array.from(new Set(u.map((C) => C.flattenedReservationDate))),
1396
+ flattenedReservations: u.map((C) => C.flattenedReservation),
1397
1397
  paymentStatus: "paid",
1398
1398
  paymentType: "full",
1399
- reservations: u.map((R) => R.reservation),
1399
+ reservations: u.map((C) => C.reservation),
1400
1400
  status: "confirmed"
1401
1401
  };
1402
- await O.add(Q.reservationsCollection, G), t = !0, ue(`${u.length} ${u.length > 1 ? "reservations" : "reservation"} created in Studio`, {
1403
- agendaId: F.value,
1404
- reservationIds: u.map((R) => R.reservation.id),
1405
- amountPaid: j,
1406
- reservations: u.map((R) => `${R.reservation.resource.name}: ${R.reservation.date} ${R.reservation.timeslot.startTime}`)
1402
+ await Z.add(Q.reservationsCollection, W), t = !0, le(`${u.length} ${u.length > 1 ? "reservations" : "reservation"} created in Studio`, {
1403
+ agendaId: T.value,
1404
+ reservationIds: u.map((C) => C.reservation.id),
1405
+ amountPaid: q,
1406
+ reservations: u.map((C) => `${C.reservation.resource.name}: ${C.reservation.date} ${C.reservation.timeslot.startTime}`)
1407
1407
  });
1408
1408
  } catch (y) {
1409
- B("Failed to create reservation in Studio", {
1409
+ j("Failed to create reservation in Studio", {
1410
1410
  error: y instanceof Error ? y.message : String(y),
1411
- agendaId: F.value
1411
+ agendaId: T.value
1412
1412
  }), console.error("Error creating reservation:", y);
1413
1413
  } finally {
1414
- M.value = !1, t && ($.value = !1);
1414
+ I.value = !1, t && (L.value = !1);
1415
1415
  }
1416
1416
  };
1417
1417
  return (e, o) => {
1418
- const d = h("Button"), t = h("ResponsiveModalTrigger"), y = h("ResponsiveModalTitle"), u = h("ResponsiveModalHeader"), j = h("ResponsiveModalFooter"), G = h("ResponsiveModalScrollContent"), R = h("ResponsiveModal");
1419
- return i(), be(R, {
1420
- open: $.value,
1421
- "onUpdate:open": o[1] || (o[1] = (se) => $.value = se)
1418
+ const d = h("Button"), t = h("ResponsiveModalTrigger"), y = h("ResponsiveModalTitle"), u = h("ResponsiveModalHeader"), q = h("ResponsiveModalFooter"), W = h("ResponsiveModalScrollContent"), C = h("ResponsiveModal");
1419
+ return i(), be(C, {
1420
+ open: L.value,
1421
+ "onUpdate:open": o[1] || (o[1] = (ne) => L.value = ne)
1422
1422
  }, {
1423
1423
  default: c(() => [
1424
1424
  r(t, { "as-child": "" }, {
@@ -1426,20 +1426,20 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1426
1426
  r(d, null, {
1427
1427
  default: c(() => [
1428
1428
  r(g(Pe), { class: "size-4" }),
1429
- o[2] || (o[2] = w(" Add Reservation ", -1))
1429
+ o[2] || (o[2] = N(" Add Reservation ", -1))
1430
1430
  ]),
1431
1431
  _: 1
1432
1432
  })
1433
1433
  ]),
1434
1434
  _: 1
1435
1435
  }),
1436
- r(G, { class: "@container/modal sm:max-w-7xl" }, {
1436
+ r(W, { class: "@container/modal sm:max-w-7xl" }, {
1437
1437
  default: c(() => [
1438
1438
  r(u, null, {
1439
1439
  default: c(() => [
1440
1440
  r(y, null, {
1441
1441
  default: c(() => [...o[3] || (o[3] = [
1442
- w("Create new reservation", -1)
1442
+ N("Create new reservation", -1)
1443
1443
  ])]),
1444
1444
  _: 1
1445
1445
  })
@@ -1449,8 +1449,8 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1449
1449
  f("div", yn, [
1450
1450
  r(ft, {
1451
1451
  ref_key: "customerInformationRef",
1452
- ref: ie,
1453
- agendaData: q.value
1452
+ ref: se,
1453
+ agendaData: V.value
1454
1454
  }, null, 8, ["agendaData"]),
1455
1455
  o[5] || (o[5] = f("div", { class: "w-full h-[1px] bg-border my-8" }, null, -1)),
1456
1456
  f("div", xn, [
@@ -1458,28 +1458,28 @@ const vt = { class: "flex items-start justify-between gap-3" }, _t = { class: "t
1458
1458
  f("h2", { class: "text-sm font-medium" }, "Reservations")
1459
1459
  ], -1)),
1460
1460
  r(bn, {
1461
- modelValue: T.value,
1462
- "onUpdate:modelValue": o[0] || (o[0] = (se) => T.value = se),
1463
- agendaData: q.value,
1461
+ modelValue: w.value,
1462
+ "onUpdate:modelValue": o[0] || (o[0] = (ne) => w.value = ne),
1463
+ agendaData: V.value,
1464
1464
  "availability-by-reservation": Y.value,
1465
1465
  onAdd: ye,
1466
- onQuickAdd: P
1466
+ onQuickAdd: v
1467
1467
  }, null, 8, ["modelValue", "agendaData", "availability-by-reservation"])
1468
1468
  ]),
1469
1469
  f("div", Sn, [
1470
1470
  f("ul", kn, [
1471
- (i(!0), p(te, null, pe(L.value, (se) => (i(), p("li", { key: se }, k(se), 1))), 128))
1471
+ (i(!0), p(ee, null, pe(B.value, (ne) => (i(), p("li", { key: ne }, R(ne), 1))), 128))
1472
1472
  ])
1473
1473
  ])
1474
1474
  ]),
1475
- r(j, { class: "gap-2" }, {
1475
+ r(q, { class: "gap-2" }, {
1476
1476
  default: c(() => [
1477
1477
  r(d, {
1478
1478
  onClick: Ne,
1479
- disabled: M.value || Z.value || v.value
1479
+ disabled: I.value || X.value || ae.value
1480
1480
  }, {
1481
1481
  default: c(() => [
1482
- M.value ? (i(), p("span", $n, "Creating...")) : Z.value ? (i(), p("span", Tn, "Checking availability...")) : (i(), p("span", In, k(T.value.length > 1 ? `Create ${T.value.length} reservations` : "Create reservation"), 1))
1482
+ I.value ? (i(), p("span", $n, "Creating...")) : X.value ? (i(), p("span", Tn, "Checking availability...")) : (i(), p("span", In, R(w.value.length > 1 ? `Create ${w.value.length} reservations` : "Create reservation"), 1))
1483
1483
  ]),
1484
1484
  _: 1
1485
1485
  }, 8, ["disabled"])