@getmicdrop/venue-calendar 4.3.0 → 4.3.2

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 (66) hide show
  1. package/dist/{Badge-XNQHeoZJ.js → Badge-Gg5PWs7f.js} +39 -60
  2. package/dist/Calendar-bhl8Q8us.js +1332 -0
  3. package/dist/{CalendarFoundryView-9LW4nveh.js → CalendarFoundryView-C2O_AmBk.js} +5881 -5311
  4. package/dist/CartView-D57bwixz.js +2245 -0
  5. package/dist/{Checkbox-BexPyTGk.js → Checkbox-24CWEsty.js} +1 -1
  6. package/dist/{Checkout-D_oRIhxJ.js → Checkout-BqaJK6UP.js} +136 -135
  7. package/dist/{Checkout-C6xmGlWs.js → Checkout-DQWeMchu.js} +100 -100
  8. package/dist/{CollectionView-BdVW1cJz.js → CollectionView-B-PR54hU.js} +3 -3
  9. package/dist/CropImage-CxLcNArr.js +445 -0
  10. package/dist/{Event-I5Wu3_AC.js → Event-DxNC58Zb.js} +327 -325
  11. package/dist/{EventPage-BjrFGlDJ.js → EventPage-Y3NWzmN0.js} +38 -38
  12. package/dist/{Heading-KNE3t6AC.js → Heading-cKAx0Ogl.js} +3 -1
  13. package/dist/Input-D1FpSX5Q.js +292 -0
  14. package/dist/{Modal-c4rwVXSs.js → Modal-LkN8lh_m.js} +5 -2
  15. package/dist/ModalFooter-B_8f1Z5p.js +301 -0
  16. package/dist/{PasswordInput-Dm4Z88em.js → PasswordInput-Bt6tvpzi.js} +19 -15
  17. package/dist/{ScarcityBadge-DMI7KfDF.js → ScarcityBadge-g0dRh6K7.js} +1 -1
  18. package/dist/{SeriesPage-BQGc51bF.js → SeriesPage-D2305oP-.js} +2 -2
  19. package/dist/{Spinner-C8M6STFM.js → Spinner-LroI7eOC.js} +1 -1
  20. package/dist/{Success-CxJiJEdx.js → Success-ClXshzvl.js} +1 -1
  21. package/dist/{ViewTicketsEmbed-D-w4zHtm.js → ViewTicketsEmbed-CvuMdTA7.js} +4 -4
  22. package/dist/{browser-By3zPFZd.js → browser-viCaCwoW.js} +1 -1
  23. package/dist/imageOptimizer-BwLwBMI6.js +112 -0
  24. package/dist/keyboard-fiZFqeNA.js +29 -0
  25. package/dist/{modalManager.svelte-CQrpnx4J.js → modalManager.svelte-B9mhX1cG.js} +1 -1
  26. package/dist/{phoneUtils-by0RmQv1.js → phoneUtils-C2GGZYvA.js} +319 -319
  27. package/dist/portal-DqxEuE-7.js +166 -0
  28. package/dist/{to-event-card-props-BdO47New.js → to-event-card-props-dIhKdERf.js} +103 -97
  29. package/dist/types/index.d.ts +11 -0
  30. package/dist/venue-calendar.css +1 -1
  31. package/dist/venue-calendar.es.js +1053 -969
  32. package/dist/venue-calendar.iife.js +60 -60
  33. package/dist/venue-calendar.umd.js +57 -57
  34. package/dist/z-index-BgKs9X9U.js +225 -0
  35. package/package.json +220 -220
  36. package/dist/Calendar-C5tzjUQM.js +0 -1333
  37. package/dist/CartView-C4Fpn8mC.js +0 -2245
  38. package/dist/CropImage-D70HuWqC.js +0 -404
  39. package/dist/Input-Docb71Sc.js +0 -489
  40. package/dist/ModalFooter-CFgAtDI3.js +0 -464
  41. package/dist/imageOptimizer-CB3wKJU8.js +0 -47
  42. package/dist/z-index-B0Vk_Mp1.js +0 -27
  43. /package/dist/locales/{4.3.0 → 4.3.2}/flow/de.js +0 -0
  44. /package/dist/locales/{4.3.0 → 4.3.2}/flow/es.js +0 -0
  45. /package/dist/locales/{4.3.0 → 4.3.2}/flow/fr.js +0 -0
  46. /package/dist/locales/{4.3.0 → 4.3.2}/flow/id.js +0 -0
  47. /package/dist/locales/{4.3.0 → 4.3.2}/flow/it.js +0 -0
  48. /package/dist/locales/{4.3.0 → 4.3.2}/flow/ja.js +0 -0
  49. /package/dist/locales/{4.3.0 → 4.3.2}/flow/ko.js +0 -0
  50. /package/dist/locales/{4.3.0 → 4.3.2}/flow/nl.js +0 -0
  51. /package/dist/locales/{4.3.0 → 4.3.2}/flow/pl.js +0 -0
  52. /package/dist/locales/{4.3.0 → 4.3.2}/flow/pt-br.js +0 -0
  53. /package/dist/locales/{4.3.0 → 4.3.2}/flow/tr.js +0 -0
  54. /package/dist/locales/{4.3.0 → 4.3.2}/flow/zh.js +0 -0
  55. /package/dist/locales/{4.3.0 → 4.3.2}/main/de.js +0 -0
  56. /package/dist/locales/{4.3.0 → 4.3.2}/main/es.js +0 -0
  57. /package/dist/locales/{4.3.0 → 4.3.2}/main/fr.js +0 -0
  58. /package/dist/locales/{4.3.0 → 4.3.2}/main/id.js +0 -0
  59. /package/dist/locales/{4.3.0 → 4.3.2}/main/it.js +0 -0
  60. /package/dist/locales/{4.3.0 → 4.3.2}/main/ja.js +0 -0
  61. /package/dist/locales/{4.3.0 → 4.3.2}/main/ko.js +0 -0
  62. /package/dist/locales/{4.3.0 → 4.3.2}/main/nl.js +0 -0
  63. /package/dist/locales/{4.3.0 → 4.3.2}/main/pl.js +0 -0
  64. /package/dist/locales/{4.3.0 → 4.3.2}/main/pt-br.js +0 -0
  65. /package/dist/locales/{4.3.0 → 4.3.2}/main/tr.js +0 -0
  66. /package/dist/locales/{4.3.0 → 4.3.2}/main/zh.js +0 -0
@@ -0,0 +1,445 @@
1
+ import { C as e, b as t, t as n, v as r } from "./Button-Cm6xkipe.js";
2
+ import { t as i } from "./CloseOutline-qpVa62mu.js";
3
+ import { a, i as o, r as s, t as c } from "./imageOptimizer-BwLwBMI6.js";
4
+ import { t as l } from "./z-index-BgKs9X9U.js";
5
+ import { n as u } from "./keyboard-fiZFqeNA.js";
6
+ import "svelte/internal/disclose-version";
7
+ import * as d from "svelte/internal/client";
8
+ import { MediaQuery as f } from "svelte/reactivity";
9
+ import { onDestroy as p, onMount as m } from "svelte";
10
+ //#region node_modules/@getmicdrop/svelte-components/dist/primitives/Icons/MinusOutline.svelte
11
+ var h = d.from_svg("<svg aria-hidden=\"true\" fill=\"none\" stroke-width=\"2\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M19.5 12h-15\"></path></svg>");
12
+ function g(e, t) {
13
+ let n = d.prop(t, "size", 3, "24"), r = d.prop(t, "color", 3, "currentColor"), i = d.prop(t, "class", 3, "");
14
+ var a = h();
15
+ d.template_effect(() => {
16
+ d.set_class(a, 0, d.clsx(i())), d.set_attribute(a, "width", n()), d.set_attribute(a, "height", n()), d.set_attribute(a, "stroke", r());
17
+ }), d.append(e, a);
18
+ }
19
+ //#endregion
20
+ //#region node_modules/svelte-easy-crop/dist/helpers.js
21
+ function _(e, t, n) {
22
+ return e >= t * n ? {
23
+ width: t * n,
24
+ height: t
25
+ } : {
26
+ width: e,
27
+ height: e / n
28
+ };
29
+ }
30
+ function v(e, t, n, r) {
31
+ return {
32
+ x: y(e.x, t.width, n.width, r),
33
+ y: y(e.y, t.height, n.height, r)
34
+ };
35
+ }
36
+ function y(e, t, n, r) {
37
+ let i = Math.abs(t * r / 2 - n / 2);
38
+ return Math.min(i, Math.max(e, -i));
39
+ }
40
+ function b(e, t) {
41
+ return Math.sqrt((e.y - t.y) ** 2 + (e.x - t.x) ** 2);
42
+ }
43
+ function x(e, t, n, r, i, a = !0) {
44
+ let o = a ? S : C, s = {
45
+ x: o(100, ((t.width - n.width / i) / 2 - e.x / i) / t.width * 100),
46
+ y: o(100, ((t.height - n.height / i) / 2 - e.y / i) / t.height * 100),
47
+ width: o(100, n.width / t.width * 100 / i),
48
+ height: o(100, n.height / t.height * 100 / i)
49
+ }, c = o(t.naturalWidth, s.width * t.naturalWidth / 100, !0), l = o(t.naturalHeight, s.height * t.naturalHeight / 100, !0), u = t.naturalWidth >= t.naturalHeight * r ? {
50
+ width: Math.round(l * r),
51
+ height: l
52
+ } : {
53
+ width: c,
54
+ height: Math.round(c / r)
55
+ };
56
+ return {
57
+ croppedAreaPercentages: s,
58
+ croppedAreaPixels: {
59
+ ...u,
60
+ x: o(t.naturalWidth - u.width, s.x * t.naturalWidth / 100, !0),
61
+ y: o(t.naturalHeight - u.height, s.y * t.naturalHeight / 100, !0)
62
+ }
63
+ };
64
+ }
65
+ function S(e, t, n = !1) {
66
+ return Math.min(e, Math.max(0, n ? Math.round(t) : t));
67
+ }
68
+ function C(e, t) {
69
+ return t;
70
+ }
71
+ function w(e, t) {
72
+ return {
73
+ x: (t.x + e.x) / 2,
74
+ y: (t.y + e.y) / 2
75
+ };
76
+ }
77
+ //#endregion
78
+ //#region node_modules/svelte-easy-crop/dist/Cropper.svelte
79
+ var T = d.from_html("<div data-testid=\"cropper\"></div>"), E = d.from_html("<div class=\"svelte-easy-crop-container svelte-1yetlj5\" role=\"button\" data-testid=\"container\"><img class=\"svelte-easy-crop-image svelte-1yetlj5\" alt=\"\"/> <!></div>");
80
+ function D(e, t) {
81
+ d.push(t, !0);
82
+ let n = d.prop(t, "crop", 31, () => d.proxy({
83
+ x: 0,
84
+ y: 0
85
+ })), r = d.prop(t, "zoom", 15, 1), i = d.prop(t, "minZoom", 11, 1), a = d.prop(t, "maxZoom", 11, 3), o = d.prop(t, "aspect", 3, 4 / 3), s = d.prop(t, "cropSize", 3, null), c = d.prop(t, "cropShape", 3, "rect"), l = d.prop(t, "showGrid", 3, !0), u = d.prop(t, "zoomSpeed", 3, 1), f = d.prop(t, "crossOrigin", 3, null), h = d.prop(t, "restrictPosition", 3, !0), g = d.prop(t, "tabindex", 3, void 0), y = d.state(null), S = d.state(d.proxy({
86
+ width: 0,
87
+ height: 0,
88
+ naturalWidth: 0,
89
+ naturalHeight: 0
90
+ })), C = d.state(null), D = d.state(null), O = d.state(null), k = d.state(d.proxy({
91
+ x: 0,
92
+ y: 0
93
+ })), A = d.state(d.proxy({
94
+ x: 0,
95
+ y: 0
96
+ })), j = d.state(0), M = d.state(null), N = d.state(null);
97
+ m(() => {
98
+ d.get(O) && d.get(O).complete && I(), d.get(C) && (d.get(C).addEventListener("gesturestart", P), d.get(C).addEventListener("gesturechange", P));
99
+ }), p(() => {
100
+ d.get(C) && (d.get(C).removeEventListener("gesturestart", P), d.get(C).removeEventListener("gesturechange", P)), F();
101
+ });
102
+ let P = (e) => e.preventDefault(), F = () => {
103
+ typeof document < "u" && (document.removeEventListener("mousemove", H), document.removeEventListener("mouseup", q), document.removeEventListener("touchmove", W), document.removeEventListener("touchend", q));
104
+ }, I = () => {
105
+ R(), Z();
106
+ }, L = () => s() ? s().width / s().height : o(), R = () => {
107
+ d.get(O) && (d.set(S, {
108
+ width: d.get(O).width,
109
+ height: d.get(O).height,
110
+ naturalWidth: d.get(O).naturalWidth,
111
+ naturalHeight: d.get(O).naturalHeight
112
+ }, !0), d.set(y, s() ? s() : _(d.get(O).width, d.get(O).height, o()), !0)), d.get(C) && d.set(D, d.get(C).getBoundingClientRect(), !0);
113
+ }, z = (e) => ({
114
+ x: Number(e.clientX),
115
+ y: Number(e.clientY)
116
+ }), B = (e) => ({
117
+ x: Number(e.clientX),
118
+ y: Number(e.clientY)
119
+ }), V = (e) => {
120
+ e.preventDefault(), document.addEventListener("mousemove", H), document.addEventListener("mouseup", q), G(z(e));
121
+ }, H = (e) => K(z(e)), U = (e) => {
122
+ e.preventDefault(), document.addEventListener("touchmove", W, { passive: !1 }), document.addEventListener("touchend", q), e.touches.length === 2 ? J(e) : e.touches.length === 1 && G(B(e.touches[0]));
123
+ }, W = (e) => {
124
+ e.preventDefault(), e.touches.length === 2 ? ee(e) : e.touches.length === 1 && K(B(e.touches[0]));
125
+ }, G = ({ x: e, y: t }) => {
126
+ d.set(k, {
127
+ x: e,
128
+ y: t
129
+ }, !0), d.set(A, {
130
+ x: n().x,
131
+ y: n().y
132
+ }, !0);
133
+ }, K = ({ x: e, y: t }) => {
134
+ d.get(M) && window.cancelAnimationFrame(d.get(M)), d.set(M, window.requestAnimationFrame(() => {
135
+ if (e === void 0 || t === void 0 || !d.get(y)) return;
136
+ let i = e - d.get(k).x, a = t - d.get(k).y, o = {
137
+ x: d.get(A).x + i,
138
+ y: d.get(A).y + a
139
+ };
140
+ n(h() ? v(o, d.get(S), d.get(y), r()) : o);
141
+ }), !0);
142
+ }, q = () => {
143
+ F(), Z();
144
+ }, J = (e) => {
145
+ let t = B(e.touches[0]), n = B(e.touches[1]);
146
+ d.set(j, b(t, n), !0), G(w(t, n));
147
+ }, ee = (e) => {
148
+ let t = B(e.touches[0]), n = B(e.touches[1]), i = w(t, n);
149
+ K(i), d.get(N) && window.cancelAnimationFrame(d.get(N)), d.set(N, window.requestAnimationFrame(() => {
150
+ let e = b(t, n), a = r() * (e / d.get(j));
151
+ X(a, i), d.set(j, e, !0);
152
+ }), !0);
153
+ }, Y = (e) => {
154
+ e.preventDefault();
155
+ let t = z(e), n = r() - e.deltaY * u() / 200;
156
+ X(n, t);
157
+ }, te = ({ x: e, y: t }) => {
158
+ if (!d.get(D)) throw Error("The Cropper is not mounted");
159
+ return {
160
+ x: d.get(D).width / 2 - (e - d.get(D).left),
161
+ y: d.get(D).height / 2 - (t - d.get(D).top)
162
+ };
163
+ }, ne = ({ x: e, y: t }) => ({
164
+ x: (e + n().x) / r(),
165
+ y: (t + n().y) / r()
166
+ }), X = (e, t) => {
167
+ if (!d.get(y)) return;
168
+ let o = te(t), s = ne(o);
169
+ r(Math.min(a(), Math.max(e, i())));
170
+ let c = {
171
+ x: s.x * r() - o.x,
172
+ y: s.y * r() - o.y
173
+ };
174
+ n(h() ? v(c, d.get(S), d.get(y), r()) : c);
175
+ }, Z = () => {
176
+ if (!d.get(y) || d.get(y).width === 0) return;
177
+ let { croppedAreaPercentages: e, croppedAreaPixels: i } = x(h() ? v(n(), d.get(S), d.get(y), r()) : n(), d.get(S), d.get(y), L(), r(), h());
178
+ t.oncropcomplete?.({
179
+ percent: e,
180
+ pixels: i
181
+ });
182
+ };
183
+ d.user_effect(() => {
184
+ d.get(O) && d.set(y, s() ? s() : _(d.get(O).width, d.get(O).height, o()), !0);
185
+ }), d.user_effect(() => {
186
+ r() && Z();
187
+ });
188
+ let re = (e) => {
189
+ d.user_effect(() => (e.addEventListener("touchstart", U), e.addEventListener("mousedown", V), e.addEventListener("wheel", Y, { passive: !1 }), () => {
190
+ e.removeEventListener("touchstart", U), e.removeEventListener("mousedown", V), e.removeEventListener("wheel", Y);
191
+ }));
192
+ };
193
+ var Q = E();
194
+ d.event("resize", d.window, R);
195
+ var $ = d.child(Q);
196
+ d.bind_this($, (e) => d.set(O, e), () => d.get(O));
197
+ var ie = d.sibling($, 2), ae = (e) => {
198
+ var t = T();
199
+ let n;
200
+ d.template_effect(() => {
201
+ n = d.set_class(t, 1, "svelte-easy-crop-area svelte-1yetlj5", null, n, {
202
+ "svelte-easy-crop-round": c() === "round",
203
+ "svelte-easy-crop-grid": l()
204
+ }), d.set_style(t, `width: ${d.get(y).width ?? ""}px; height: ${d.get(y).height ?? ""}px;`);
205
+ }), d.append(e, t);
206
+ };
207
+ d.if(ie, (e) => {
208
+ d.get(y) && e(ae);
209
+ }), d.reset(Q), d.bind_this(Q, (e) => d.set(C, e), () => d.get(C)), d.action(Q, (e) => re?.(e)), d.template_effect(() => {
210
+ d.set_attribute(Q, "tabindex", g()), d.set_attribute($, "src", t.image), d.set_style($, `transform: translate(${n().x ?? ""}px, ${n().y ?? ""}px) scale(${r() ?? ""});`), d.set_attribute($, "crossorigin", f());
211
+ }), d.event("load", $, I), d.replay_events($), d.append(e, Q), d.pop();
212
+ }
213
+ //#endregion
214
+ //#region node_modules/svelte-easy-crop/dist/index.js
215
+ var O = D, k = d.from_html("<div class=\"absolute inset-0 flex items-center justify-center bg-bg-tertiary z-sticky\"><span> </span></div>"), A = d.from_html("<div><!> <!></div> <div class=\"flex-1 space-y-4\"><p> </p> <div class=\"flex items-center justify-center gap-3 max-w-xs mx-auto\"><!> <input type=\"range\" min=\"1\" max=\"3\" step=\"0.1\" class=\"flex-1 w-full h-2 bg-bg-tertiary rounded-lg appearance-none cursor-pointer accent-primary\" data-purpose=\"ui-only\"/> <!></div></div>", 1), j = d.from_html("<!> <!>", 1), M = d.from_html("<div class=\"flex gap-3\"><!></div>"), N = d.from_html("<div class=\"flex flex-col gap-4 landscape:flex-row landscape:items-center landscape:gap-6\"><!></div>"), P = d.from_html("<div class=\"fixed inset-0 flex items-center justify-center overflow-y-auto overflow-x-hidden bg-bg-primary/50 p-4\" role=\"presentation\"><div class=\"relative w-full max-w-lg max-h-full\" data-escape-layer=\"\"><div class=\"relative bg-card rounded-lg shadow-xl\"><div class=\"flex items-center justify-between p-4 border-b border-border rounded-t-lg\"><h3> </h3> <!></div> <div class=\"p-4 md:p-6 space-y-4\"><!></div> <div class=\"flex items-center justify-end gap-3 p-4 border-t border-border rounded-b-lg\"><!></div></div></div></div>");
216
+ function F(p, m) {
217
+ d.push(m, !0);
218
+ let h = (e, t = d.noop) => {
219
+ var i = A(), o = d.first_child(i), s = d.child(o), c = (e) => {
220
+ var t = k(), n = d.child(t), i = d.child(n, !0);
221
+ d.reset(n), d.reset(t), d.template_effect(() => {
222
+ d.set_class(n, 1, d.clsx(r.smMuted)), d.set_text(i, d.get(D).loading);
223
+ }), d.append(e, t);
224
+ };
225
+ d.if(s, (e) => {
226
+ d.get(R) && e(c);
227
+ }), O(d.sibling(s, 2), {
228
+ get image() {
229
+ return S();
230
+ },
231
+ aspect: 1,
232
+ minZoom: 1,
233
+ maxZoom: 3,
234
+ showGrid: !0,
235
+ oncropcomplete: B,
236
+ get crop() {
237
+ return d.get(F);
238
+ },
239
+ set crop(e) {
240
+ d.set(F, e, !0);
241
+ },
242
+ get zoom() {
243
+ return d.get(I);
244
+ },
245
+ set zoom(e) {
246
+ d.set(I, e, !0);
247
+ }
248
+ }), d.reset(o);
249
+ var l = d.sibling(o, 2), u = d.child(l), f = d.child(u, !0);
250
+ d.reset(u);
251
+ var p = d.sibling(u, 2), m = d.child(p);
252
+ n(m, {
253
+ variant: "outline",
254
+ size: "sm",
255
+ class: "rounded-full! w-9! h-9! p-0! shrink-0",
256
+ onclick: () => d.set(I, Math.max(1, d.get(I) - .2), !0),
257
+ get "aria-label"() {
258
+ return d.get(D).zoomOut;
259
+ },
260
+ children: (e, t) => {
261
+ g(e, { class: "w-4 h-4" });
262
+ },
263
+ $$slots: { default: !0 }
264
+ });
265
+ var h = d.sibling(m, 2);
266
+ d.remove_input_defaults(h);
267
+ var _ = d.sibling(h, 2);
268
+ n(_, {
269
+ variant: "outline",
270
+ size: "sm",
271
+ class: "rounded-full! w-9! h-9! p-0! shrink-0",
272
+ onclick: () => d.set(I, Math.min(3, d.get(I) + .2), !0),
273
+ get "aria-label"() {
274
+ return d.get(D).zoomIn;
275
+ },
276
+ children: (e, t) => {
277
+ a(e, { class: "w-4 h-4" });
278
+ },
279
+ $$slots: { default: !0 }
280
+ }), d.reset(p), d.reset(l), d.template_effect(() => {
281
+ d.set_class(o, 1, d.clsx(t())), d.set_class(u, 1, `${r.smMuted} text-center`), d.set_text(f, d.get(D).dragToPosition), d.set_attribute(h, "aria-label", d.get(D).zoomLevel);
282
+ }), d.bind_value(h, () => d.get(I), (e) => d.set(I, e)), d.append(e, i);
283
+ }, _ = (e, t = d.noop) => {
284
+ var r = j(), i = d.first_child(r);
285
+ {
286
+ let e = d.derived(() => d.get(z) || C());
287
+ n(i, {
288
+ type: "button",
289
+ variant: "alternative",
290
+ size: "md",
291
+ get class() {
292
+ return t();
293
+ },
294
+ onclick: H,
295
+ get disabled() {
296
+ return d.get(e);
297
+ },
298
+ children: (e, t) => {
299
+ d.next();
300
+ var n = d.text();
301
+ d.template_effect(() => d.set_text(n, d.get(D).cancel)), d.append(e, n);
302
+ },
303
+ $$slots: { default: !0 }
304
+ });
305
+ }
306
+ var a = d.sibling(i, 2);
307
+ {
308
+ let e = d.derived(() => d.get(R) || d.get(z) || C());
309
+ n(a, {
310
+ type: "button",
311
+ size: "md",
312
+ get class() {
313
+ return t();
314
+ },
315
+ onclick: V,
316
+ get disabled() {
317
+ return d.get(e);
318
+ },
319
+ children: (e, t) => {
320
+ var n = d.comment(), r = d.first_child(n), i = (e) => {
321
+ var t = d.text();
322
+ d.template_effect(() => d.set_text(t, d.get(D).uploading)), d.append(e, t);
323
+ }, a = (e) => {
324
+ var t = d.text();
325
+ d.template_effect(() => d.set_text(t, d.get(D).save)), d.append(e, t);
326
+ };
327
+ d.if(r, (e) => {
328
+ d.get(z) || C() ? e(i) : e(a, -1);
329
+ }), d.append(e, n);
330
+ },
331
+ $$slots: { default: !0 }
332
+ });
333
+ }
334
+ d.append(e, r);
335
+ }, v = d.state(void 0), y = new f("(max-width: 767px), (max-height: 500px)", !1), b = {
336
+ cropImageTitle: "Crop image",
337
+ loading: "Loading...",
338
+ dragToPosition: "Drag to position. Pinch or use slider to zoom.",
339
+ cancel: "Cancel",
340
+ uploading: "Uploading...",
341
+ save: "Save",
342
+ closeModal: "Close modal",
343
+ zoomOut: "Zoom out",
344
+ zoomIn: "Zoom in",
345
+ zoomLevel: "Zoom level"
346
+ }, x = d.prop(m, "showModal", 15, !1), S = d.prop(m, "imageSrc", 15, ""), C = d.prop(m, "isUploadingImage", 3, !1), w = d.prop(m, "labels", 19, () => ({}));
347
+ m.onSave && !m.onsave && t("CropImage: prop \"onSave\" is deprecated. Use \"onsave\" instead."), m.onCancel && !m.oncancel && t("CropImage: prop \"onCancel\" is deprecated. Use \"oncancel\" instead.");
348
+ let T = d.derived(() => m.onsave ?? m.onSave ?? (() => {})), E = d.derived(() => m.oncancel ?? m.onCancel ?? (() => {})), D = d.derived(() => e(b, w())), F = d.state(d.proxy({
349
+ x: 0,
350
+ y: 0
351
+ })), I = d.state(1), L = d.state(null), R = d.state(!0), z = d.state(!1);
352
+ d.user_effect(() => {
353
+ x() && S() && (d.set(F, {
354
+ x: 0,
355
+ y: 0
356
+ }, !0), d.set(I, 1), d.set(L, null), d.set(R, !0), d.set(z, !1));
357
+ });
358
+ function B(e) {
359
+ d.set(L, e.pixels, !0), d.set(R, !1);
360
+ }
361
+ async function V() {
362
+ if (!d.get(L) || d.get(z)) return;
363
+ d.set(z, !0);
364
+ let e = await U(S(), d.get(L));
365
+ d.get(T)(e);
366
+ }
367
+ function H() {
368
+ x(!1), S(""), d.set(F, {
369
+ x: 0,
370
+ y: 0
371
+ }, !0), d.set(I, 1), d.set(L, null), d.set(z, !1), d.get(E)();
372
+ }
373
+ async function U(e, t) {
374
+ let n = await c(e), r = document.createElement("canvas"), i = r.getContext("2d"), a = 1e3;
375
+ r.width = a, r.height = a, i.imageSmoothingEnabled = !0, i.imageSmoothingQuality = "high", i.drawImage(n, t.x, t.y, t.width, t.height, 0, 0, a, a);
376
+ let o = s(), l = o ? "image/webp" : "image/jpeg", u = o ? .8 : .85, d = o ? "webp" : "jpg";
377
+ return new Promise((e) => {
378
+ r.toBlob((t) => {
379
+ e(new File([t], `cropped-image.${d}`, { type: l }));
380
+ }, l, u);
381
+ });
382
+ }
383
+ var W = d.comment();
384
+ d.event("keydown", d.window, (e) => {
385
+ x() && !y.current && u(e, d.get(v)) && (e.preventDefault(), H());
386
+ });
387
+ var G = d.first_child(W), K = (e) => {
388
+ o(e, {
389
+ get open() {
390
+ return x();
391
+ },
392
+ get title() {
393
+ return d.get(D).cropImageTitle;
394
+ },
395
+ alwaysSheet: !0,
396
+ onclose: () => {
397
+ !d.get(z) && !C() && H();
398
+ },
399
+ actions: (e) => {
400
+ var t = M(), n = d.child(t);
401
+ _(n, () => "flex-1"), d.reset(t), d.append(e, t);
402
+ },
403
+ children: (e, t) => {
404
+ var n = N(), r = d.child(n);
405
+ h(r, () => "relative w-full max-w-[50dvh] landscape:max-w-[35dvh] shrink-0 mx-auto aspect-square bg-bg-secondary rounded-lg overflow-hidden"), d.reset(n), d.append(e, n);
406
+ },
407
+ $$slots: {
408
+ actions: !0,
409
+ default: !0
410
+ }
411
+ });
412
+ }, q = (e) => {
413
+ var t = P();
414
+ let a;
415
+ var o = d.child(t), s = d.child(o), c = d.child(s), u = d.child(c), f = d.child(u, !0);
416
+ d.reset(u);
417
+ var p = d.sibling(u, 2);
418
+ n(p, {
419
+ variant: "icon",
420
+ size: "sm",
421
+ onclick: H,
422
+ get "aria-label"() {
423
+ return d.get(D).closeModal;
424
+ },
425
+ children: (e, t) => {
426
+ i(e, { class: "w-3 h-3" });
427
+ },
428
+ $$slots: { default: !0 }
429
+ }), d.reset(c);
430
+ var m = d.sibling(c, 2), g = d.child(m);
431
+ h(g, () => "relative w-full aspect-square sm:aspect-[4/3] max-h-80 sm:max-h-96 bg-bg-secondary rounded-lg overflow-hidden"), d.reset(m);
432
+ var y = d.sibling(m, 2), b = d.child(y);
433
+ _(b, () => ""), d.reset(y), d.reset(s), d.reset(o), d.bind_this(o, (e) => d.set(v, e), () => d.get(v)), d.reset(t), d.template_effect(() => {
434
+ a = d.set_style(t, "", a, { "z-index": l.modal }), d.set_class(u, 1, d.clsx(r.h2)), d.set_text(f, d.get(D).cropImageTitle);
435
+ }), d.delegated("click", t, (e) => {
436
+ e.target === e.currentTarget && H();
437
+ }), d.append(e, t);
438
+ };
439
+ d.if(G, (e) => {
440
+ y.current ? e(K) : x() && e(q, 1);
441
+ }), d.append(p, W), d.pop();
442
+ }
443
+ d.delegate(["click"]);
444
+ //#endregion
445
+ export { F as default };