@gx-design-vue/image 0.2.0-alpha.4 → 0.2.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,62 +1,63 @@
1
- import { Fragment as e, Teleport as t, Transition as n, computed as r, createVNode as i, customRef as a, defineComponent as o, getCurrentInstance as s, getCurrentScope as c, hasInjectionContext as l, inject as u, isRef as d, isVNode as f, mergeDefaults as p, mergeProps as m, nextTick as h, onMounted as g, onScopeDispose as _, onUnmounted as v, readonly as y, ref as b, shallowRef as x, toRef as S, toValue as C, unref as w, watch as T, watchEffect as E } from "vue";
2
- import { CloseOutlined as D, CopyOutlined as O, DownloadOutlined as k, EyeOutlined as A, LeftOutlined as ee, LoadingOutlined as te, RightOutlined as ne, RotateLeftOutlined as j, RotateRightOutlined as M, SwapOutlined as N, ZoomInOutlined as P, ZoomOutOutlined as re } from "@antdv-next/icons";
3
- import { proGenStyleHooks as ie, unit as F } from "@gx-design-vue/pro-provider";
4
- import { useBaseConfig as ae } from "antdv-next/config-provider/context";
5
- import oe from "antdv-next/config-provider/hooks/useCSSVarCls";
6
- import { message as I } from "antdv-next";
1
+ import { Fragment as e, Teleport as t, Transition as n, computed as r, createVNode as i, defineComponent as a, isVNode as o, mergeDefaults as s, mergeProps as c, nextTick as l, onMounted as u, onScopeDispose as d, onUnmounted as f, ref as p, toRef as m, unref as h, watch as g, watchEffect as _ } from "vue";
2
+ import { GIcon as v } from "@gx-design-vue/icon";
3
+ import { proGenStyleHooks as y, unit as b } from "@gx-design-vue/pro-provider";
4
+ import { isClient as x, useEventListener as S, useScrollLock as C, useThrottleFn as w, useWindowSize as T } from "@vueuse/core";
5
+ import { useBaseConfig as ee } from "antdv-next/config-provider/context";
6
+ import te from "antdv-next/config-provider/hooks/useCSSVarCls";
7
+ import { message as E } from "antdv-next";
7
8
  //#region ../pro-utils/dist/is/type.js
8
- function L(e, t) {
9
+ function D(e, t) {
9
10
  return Object.prototype.toString.call(e) === `[object ${t}]`;
10
11
  }
11
- function R(e) {
12
+ function O(e) {
12
13
  return typeof e == "boolean";
13
14
  }
14
- function se(e) {
15
+ function k(e) {
15
16
  return typeof e == "number";
16
17
  }
17
- function z(e) {
18
+ function A(e) {
18
19
  return Array.isArray === void 0 ? Object.prototype.toString.call(e) === "[object Array]" : Array.isArray(e);
19
20
  }
20
- function B(e) {
21
- return e !== null && L(e, "Object");
21
+ function j(e) {
22
+ return e !== null && D(e, "Object");
22
23
  }
23
- function ce(e) {
24
+ function M(e) {
24
25
  return typeof e == "string";
25
26
  }
26
27
  //#endregion
27
28
  //#region ../pro-utils/dist/is/server.js
28
- var V = typeof window > "u", le = (e) => setTimeout(e, 16), H = (e) => clearTimeout(e);
29
- typeof window < "u" && "requestAnimationFrame" in window && (le = (e) => window.requestAnimationFrame(e), H = (e) => window.cancelAnimationFrame(e));
30
- var ue = 0, U = /* @__PURE__ */ new Map();
31
- function W(e) {
32
- U.delete(e);
29
+ var N = typeof window > "u", P = (e) => setTimeout(e, 16), F = (e) => clearTimeout(e);
30
+ typeof window < "u" && "requestAnimationFrame" in window && (P = (e) => window.requestAnimationFrame(e), F = (e) => window.cancelAnimationFrame(e));
31
+ var I = 0, L = /* @__PURE__ */ new Map();
32
+ function R(e) {
33
+ L.delete(e);
33
34
  }
34
- function de(e, t = 1) {
35
- ue += 1;
36
- let n = ue;
35
+ function z(e, t = 1) {
36
+ I += 1;
37
+ let n = I;
37
38
  function r(t) {
38
- if (t === 0) W(n), e();
39
+ if (t === 0) R(n), e();
39
40
  else {
40
- let e = le(() => {
41
+ let e = P(() => {
41
42
  r(t - 1);
42
43
  });
43
- U.set(n, e);
44
+ L.set(n, e);
44
45
  }
45
46
  }
46
47
  return r(t), n;
47
48
  }
48
- de.cancel = (e) => {
49
- let t = U.get(e);
50
- return W(t), H(t);
49
+ z.cancel = (e) => {
50
+ let t = L.get(e);
51
+ return R(t), F(t);
51
52
  };
52
53
  //#endregion
53
54
  //#region ../pro-utils/dist/dom/scroll.js
54
- function fe(e) {
55
+ function ne(e) {
55
56
  return e.replace(/[-_](.)/g, (e, t) => t.toUpperCase());
56
57
  }
57
- function G(e, t) {
58
- if (V || !e || !t) return "";
59
- t = fe(t), t === "float" && (t = "cssFloat");
58
+ function B(e, t) {
59
+ if (N || !e || !t) return "";
60
+ t = ne(t), t === "float" && (t = "cssFloat");
60
61
  try {
61
62
  let n = e.style[t];
62
63
  if (n) return n;
@@ -66,11 +67,11 @@ function G(e, t) {
66
67
  return e.style[t];
67
68
  }
68
69
  }
69
- function pe(e, t) {
70
- if (!V) return (t == null ? G(e, "overflow") : t ? G(e, "overflow-y") : G(e, "overflow-x")).match(/(scroll|auto|overlay)/);
70
+ function V(e, t) {
71
+ if (!N) return (t == null ? B(e, "overflow") : t ? B(e, "overflow-y") : B(e, "overflow-x")).match(/(scroll|auto|overlay)/);
71
72
  }
72
- function me(e, t) {
73
- if (V) return;
73
+ function H(e, t) {
74
+ if (N) return;
74
75
  let n = e;
75
76
  for (; n;) {
76
77
  if ([
@@ -78,274 +79,85 @@ function me(e, t) {
78
79
  document,
79
80
  document.documentElement
80
81
  ].includes(n)) return window;
81
- if (pe(n, t)) return n;
82
+ if (V(n, t)) return n;
82
83
  n = n.parentNode;
83
84
  }
84
85
  return n;
85
86
  }
86
87
  //#endregion
87
88
  //#region ../pro-utils/dist/object/classNames.js
88
- function K(...e) {
89
+ function U(...e) {
89
90
  let t = [];
90
91
  for (let n = 0; n < e.length; n++) {
91
92
  let r = e[n];
92
93
  if (r) {
93
- if (ce(r)) t.push(r);
94
- else if (z(r)) for (let e = 0; e < r.length; e++) {
95
- let n = K(r[e]);
94
+ if (M(r)) t.push(r);
95
+ else if (A(r)) for (let e = 0; e < r.length; e++) {
96
+ let n = U(r[e]);
96
97
  n && t.push(n);
97
98
  }
98
- else if (B(r)) for (let e in r) r[e] && t.push(e);
99
+ else if (j(r)) for (let e in r) r[e] && t.push(e);
99
100
  }
100
101
  }
101
102
  return t.filter((e) => e).join(" ");
102
103
  }
103
104
  //#endregion
104
105
  //#region ../pro-utils/dist/slots/index.js
105
- function he({ vnode: e, defaultVNode: t }, ...n) {
106
+ function W({ vnode: e, defaultVNode: t }, ...n) {
106
107
  return e === !1 ? null : typeof e == "function" ? e?.(...n) : e || t;
107
108
  }
108
- function ge({ value: e, slotsValue: t, defaultVNode: n, render: r }) {
109
- return e === !1 ? !1 : e === !0 ? t ?? n : B(e) && r ? f(e) ? e : t : e || t;
109
+ function G({ value: e, slotsValue: t, defaultVNode: n, render: r }) {
110
+ return e === !1 ? !1 : e === !0 ? t ?? n : j(e) && r ? o(e) ? e : t : e || t;
110
111
  }
111
- function _e(e, ...t) {
112
- let { slots: n, key: r = "default", render: i, props: a, defaultChildren: o } = e, s = a[r], c = n?.[r], l = typeof o == "function" ? o?.() : o, u = ge({
112
+ function re(e, ...t) {
113
+ let { slots: n, key: r = "default", render: i, props: a, defaultChildren: o } = e, s = a[r], c = n?.[r], l = typeof o == "function" ? o?.() : o, u = G({
113
114
  value: s,
114
115
  slotsValue: c,
115
116
  defaultVNode: l,
116
117
  render: i
117
118
  });
118
- return u === !1 ? !1 : i ? he({
119
+ return u === !1 ? !1 : i ? W({
119
120
  vnode: u,
120
121
  defaultVNode: l
121
122
  }, ...t) : u;
122
123
  }
123
- function q(e, ...t) {
124
- let { slots: n, key: r = "default", props: i, defaultChildren: a } = e, o = i[r], s = n?.[r]?.(...t), c = typeof a == "function" ? a?.() : a, l = ge({
124
+ function K(e, ...t) {
125
+ let { slots: n, key: r = "default", props: i, defaultChildren: a } = e, o = i[r], s = n?.[r]?.(...t), c = typeof a == "function" ? a?.() : a, l = G({
125
126
  value: o,
126
127
  slotsValue: s,
127
128
  defaultVNode: c,
128
129
  render: !0
129
130
  });
130
- return l === !1 ? !1 : he({
131
+ return l === !1 ? !1 : W({
131
132
  vnode: l,
132
133
  defaultVNode: c
133
134
  }, ...t);
134
135
  }
135
- function ve(e, ...t) {
136
+ function ie(e, ...t) {
136
137
  let { slots: n, props: r, keys: i, render: a, defaultVNodes: o } = e, s = {};
137
138
  return i.forEach((e, i) => {
138
- let c = o ? o[i] : null, l = a ? q({
139
+ let c = o ? o[i] : null, l = a ? K({
139
140
  slots: n,
140
141
  props: r,
141
142
  key: e,
142
143
  defaultChildren: c
143
- }, ...t) : _e({
144
+ }, ...t) : re({
144
145
  slots: n,
145
146
  props: r,
146
147
  key: e,
147
148
  render: !1,
148
149
  defaultChildren: c
149
150
  }, ...t);
150
- (R(l) || l) && (s[e] = l);
151
+ (O(l) || l) && (s[e] = l);
151
152
  }), s;
152
153
  }
153
154
  //#endregion
154
- //#region ../../node_modules/.pnpm/@vueuse+shared@14.3.0_vue@3.5.27_typescript@6.0.3_/node_modules/@vueuse/shared/dist/index.js
155
- function ye(e, t) {
156
- return c() ? (_(e, t), !0) : !1;
157
- }
158
- var J = /* @__PURE__ */ new WeakMap(), be = (...e) => {
159
- let t = e[0], n = s()?.proxy ?? c();
160
- if (n == null && !l()) throw Error("injectLocal must be called in setup");
161
- return n && J.has(n) && t in J.get(n) ? J.get(n)[t] : u(...e);
162
- }, Y = typeof window < "u" && typeof document < "u";
163
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
164
- var xe = Object.prototype.toString, Se = (e) => xe.call(e) === "[object Object]", Ce = () => {}, we = /* @__PURE__ */ Te();
165
- function Te() {
166
- var e, t;
167
- return Y && !!(!((e = window) == null || (e = e.navigator) == null) && e.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((t = window) == null || (t = t.navigator) == null ? void 0 : t.maxTouchPoints) > 2 && /iPad|Macintosh/.test(window?.navigator.userAgent));
168
- }
169
- function Ee(...e) {
170
- if (e.length !== 1) return S(...e);
171
- let t = e[0];
172
- return typeof t == "function" ? y(a(() => ({
173
- get: t,
174
- set: Ce
175
- }))) : b(t);
176
- }
177
- function De(e, t) {
178
- function n(...n) {
179
- return new Promise((r, i) => {
180
- Promise.resolve(e(() => t.apply(this, n), {
181
- fn: t,
182
- thisArg: this,
183
- args: n
184
- })).then(r).catch(i);
185
- });
186
- }
187
- return n;
188
- }
189
- function Oe(...e) {
190
- let t = 0, n, r = !0, i = Ce, a, o, s, c, l;
191
- !d(e[0]) && typeof e[0] == "object" ? {delay: o, trailing: s = !0, leading: c = !0, rejectOnCancel: l = !1} = e[0] : [o, s = !0, c = !0, l = !1] = e;
192
- let u = () => {
193
- n && (clearTimeout(n), n = void 0, i(), i = Ce);
194
- };
195
- return (e) => {
196
- let d = C(o), f = Date.now() - t, p = () => a = e();
197
- return u(), d <= 0 ? (t = Date.now(), p()) : (f > d ? (t = Date.now(), (c || !r) && p()) : s && (a = new Promise((e, a) => {
198
- i = l ? a : e, n = setTimeout(() => {
199
- t = Date.now(), r = !0, e(p()), u();
200
- }, Math.max(0, d - f));
201
- })), !c && !n && (n = setTimeout(() => r = !0, d)), r = !1, a);
202
- };
203
- }
204
- function ke(e) {
205
- return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
206
- }
207
- function Ae(e) {
208
- return Array.isArray(e) ? e : [e];
209
- }
210
- function je(e) {
211
- return e || s();
212
- }
213
- function Me(e, t = 200, n = !1, r = !0, i = !1) {
214
- return De(Oe(t, n, r, i), e);
215
- }
216
- function Ne(e, t = !0, n) {
217
- je(n) ? g(e, n) : t ? e() : h(e);
218
- }
219
- function Pe(e, t, n) {
220
- return T(e, t, {
221
- ...n,
222
- immediate: !0
223
- });
224
- }
225
- //#endregion
226
- //#region ../../node_modules/.pnpm/@vueuse+core@14.3.0_vue@3.5.27_typescript@6.0.3_/node_modules/@vueuse/core/dist/index.js
227
- var Fe = Y ? window : void 0;
228
- Y && window.document, Y && window.navigator, Y && window.location;
229
- function Ie(e) {
230
- let t = C(e);
231
- return t?.$el ?? t;
232
- }
233
- function X(...e) {
234
- let t = (e, t, n, r) => (e.addEventListener(t, n, r), () => e.removeEventListener(t, n, r)), n = r(() => {
235
- let t = Ae(C(e[0])).filter((e) => e != null);
236
- return t.every((e) => typeof e != "string") ? t : void 0;
237
- });
238
- return Pe(() => [
239
- n.value?.map((e) => Ie(e)) ?? [Fe].filter((e) => e != null),
240
- Ae(C(n.value ? e[1] : e[0])),
241
- Ae(w(n.value ? e[2] : e[1])),
242
- C(n.value ? e[3] : e[2])
243
- ], ([e, n, r, i], a, o) => {
244
- if (!e?.length || !n?.length || !r?.length) return;
245
- let s = Se(i) ? { ...i } : i, c = e.flatMap((e) => n.flatMap((n) => r.map((r) => t(e, n, r, s))));
246
- o(() => {
247
- c.forEach((e) => e());
248
- });
249
- }, { flush: "post" });
250
- }
251
- function Le() {
252
- let e = x(!1), t = s();
253
- return t && g(() => {
254
- e.value = !0;
255
- }, t), e;
256
- }
257
- /* @__NO_SIDE_EFFECTS__ */
258
- function Re(e) {
259
- let t = Le();
260
- return r(() => (t.value, !!e()));
261
- }
262
- var ze = Symbol("vueuse-ssr-width");
263
- /* @__NO_SIDE_EFFECTS__ */
264
- function Be() {
265
- let e = l() ? be(ze, null) : null;
266
- return typeof e == "number" ? e : void 0;
267
- }
268
- function Ve(e, t = {}) {
269
- let { window: n = Fe, ssrWidth: i = /* @__PURE__ */ Be() } = t, a = /* @__PURE__ */ Re(() => n && "matchMedia" in n && typeof n.matchMedia == "function"), o = x(typeof i == "number"), s = x(), c = x(!1);
270
- return E(() => {
271
- if (o.value) {
272
- o.value = !a.value, c.value = C(e).split(",").some((e) => {
273
- let t = e.includes("not all"), n = e.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), r = e.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), a = !!(n || r);
274
- return n && a && (a = i >= ke(n[1])), r && a && (a = i <= ke(r[1])), t ? !a : a;
275
- });
276
- return;
277
- }
278
- a.value && (s.value = n.matchMedia(C(e)), c.value = s.value.matches);
279
- }), X(s, "change", (e) => {
280
- c.value = e.matches;
281
- }, { passive: !0 }), r(() => c.value);
282
- }
283
- function He(e) {
284
- return typeof Window < "u" && e instanceof Window ? e.document.documentElement : typeof Document < "u" && e instanceof Document ? e.documentElement : e;
285
- }
286
- function Ue(e) {
287
- let t = window.getComputedStyle(e);
288
- if (t.overflowX === "scroll" || t.overflowY === "scroll" || t.overflowX === "auto" && e.clientWidth < e.scrollWidth || t.overflowY === "auto" && e.clientHeight < e.scrollHeight) return !0;
289
- {
290
- let t = e.parentNode;
291
- return !t || t.tagName === "BODY" ? !1 : Ue(t);
292
- }
293
- }
294
- function We(e) {
295
- let t = e || window.event, n = t.target;
296
- return Ue(n) ? !1 : t.touches.length > 1 ? !0 : (t.preventDefault && t.preventDefault(), !1);
297
- }
298
- var Ge = /* @__PURE__ */ new WeakMap();
299
- function Ke(e, t = !1) {
300
- let n = x(t), i = null, a = "";
301
- T(Ee(e), (e) => {
302
- let t = He(C(e));
303
- if (t) {
304
- let e = t;
305
- if (Ge.get(e) || Ge.set(e, e.style.overflow), e.style.overflow !== "hidden" && (a = e.style.overflow), e.style.overflow === "hidden") return n.value = !0;
306
- if (n.value) return e.style.overflow = "hidden";
307
- }
308
- }, { immediate: !0 });
309
- let o = () => {
310
- let t = He(C(e));
311
- !t || n.value || (we && (i = X(t, "touchmove", (e) => {
312
- We(e);
313
- }, { passive: !1 })), t.style.overflow = "hidden", n.value = !0);
314
- }, s = () => {
315
- let t = He(C(e));
316
- !t || !n.value || (we && i?.(), t.style.overflow = a, Ge.delete(t), n.value = !1);
317
- };
318
- return ye(s), r({
319
- get() {
320
- return n.value;
321
- },
322
- set(e) {
323
- e ? o() : s();
324
- }
325
- });
326
- }
327
- function qe(e = {}) {
328
- let { window: t = Fe, initialWidth: n = Infinity, initialHeight: r = Infinity, listenOrientation: i = !0, includeScrollbar: a = !0, type: o = "inner" } = e, s = x(n), c = x(r), l = () => {
329
- if (t) if (o === "outer") s.value = t.outerWidth, c.value = t.outerHeight;
330
- else if (o === "visual" && t.visualViewport) {
331
- let { width: e, height: n, scale: r } = t.visualViewport;
332
- s.value = Math.round(e * r), c.value = Math.round(n * r);
333
- } else a ? (s.value = t.innerWidth, c.value = t.innerHeight) : (s.value = t.document.documentElement.clientWidth, c.value = t.document.documentElement.clientHeight);
334
- };
335
- l(), Ne(l);
336
- let u = { passive: !0 };
337
- return X("resize", l, u), t && o === "visual" && t.visualViewport && X(t.visualViewport, "resize", l, u), i && T(Ve("(orientation: portrait)"), () => l()), {
338
- width: s,
339
- height: c
340
- };
341
- }
342
- //#endregion
343
155
  //#region src/hooks/useImagePreview.ts
344
- function Je(e) {
345
- let { canPreview: t } = e, n = b(!1), r = b(null), i = Ke(document.body, !1), a;
346
- return _(() => {
156
+ function ae(e) {
157
+ let { canPreview: t } = e, n = p(!1), r = p(null), i = C(document.body, !1), a;
158
+ return d(() => {
347
159
  a !== void 0 && (window.cancelAnimationFrame(a), a = void 0), i.value = !1;
348
- }), X("wheel", (e) => {
160
+ }), S("wheel", (e) => {
349
161
  n.value && e.ctrlKey && e.preventDefault();
350
162
  }, { passive: !1 }), {
351
163
  showViewer: n,
@@ -365,12 +177,12 @@ function Je(e) {
365
177
  }
366
178
  //#endregion
367
179
  //#region ../pro-hooks/dist/core/useIsIos.js
368
- var Ye = (typeof window > "u" ? !1 : /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && !window.MSStream;
369
- typeof window > "u" || Ye || window.safari;
180
+ var q = (typeof window > "u" ? !1 : /iPad|iPhone|iPod/.test(navigator.platform) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1) && !window.MSStream;
181
+ typeof window > "u" || q || window.safari;
370
182
  //#endregion
371
183
  //#region ../pro-hooks/dist/core/useState.js
372
- function Xe(e) {
373
- let t = b(typeof e == "function" ? e() : e);
184
+ function J(e) {
185
+ let t = p(typeof e == "function" ? e() : e);
374
186
  function n(e) {
375
187
  t.value = e;
376
188
  }
@@ -378,36 +190,36 @@ function Xe(e) {
378
190
  }
379
191
  //#endregion
380
192
  //#region ../pro-hooks/dist/core/useMergedState.js
381
- function Ze(e, t) {
382
- let { defaultValue: n, value: r = b() } = t || {}, i = typeof e == "function" ? e() : e;
383
- r.value !== void 0 && (i = w(r)), n !== void 0 && (i = typeof n == "function" ? n() : n);
384
- let a = b(i), o = b(i), [s, c] = Xe([o.value]), l = E(() => {
193
+ function oe(e, t) {
194
+ let { defaultValue: n, value: r = p() } = t || {}, i = typeof e == "function" ? e() : e;
195
+ r.value !== void 0 && (i = h(r)), n !== void 0 && (i = typeof n == "function" ? n() : n);
196
+ let a = p(i), o = p(i), [s, c] = J([o.value]), l = _(() => {
385
197
  let e = r.value === void 0 ? a.value : r.value;
386
198
  t?.postState && (e = t.postState(e, a.value)), o.value = e;
387
- }), u = T(s, () => {
199
+ }), u = g(s, () => {
388
200
  let e = s.value[0];
389
201
  a.value !== e && t?.onChange?.(a.value, e);
390
202
  }, { deep: !0 });
391
- function d(e) {
203
+ function f(e) {
392
204
  a.value = e;
393
205
  }
394
- function f(e) {
395
- d(e), c([o.value]);
206
+ function m(e) {
207
+ f(e), c([o.value]);
396
208
  }
397
- let p = T(r, () => {
209
+ let v = g(r, () => {
398
210
  a.value = r.value;
399
211
  });
400
- return _(() => {
401
- l(), u(), p();
212
+ return d(() => {
213
+ l(), u(), v();
402
214
  }), [
403
215
  o,
404
- f,
216
+ m,
405
217
  a
406
218
  ];
407
219
  }
408
220
  //#endregion
409
221
  //#region src/hooks/useImageTransform.ts
410
- var Qe = {
222
+ var Y = {
411
223
  x: 0,
412
224
  y: 0,
413
225
  rotate: 0,
@@ -415,15 +227,15 @@ var Qe = {
415
227
  flipX: !1,
416
228
  flipY: !1
417
229
  };
418
- function $e(e) {
419
- let { imageRef: t, minScale: n, maxScale: r, windowWidth: i, windowHeight: a, onTransform: o } = e, s = b(null), c = b([]), [l, u] = Xe({ ...Qe }), d = (e) => {
230
+ function se(e) {
231
+ let { imageRef: t, minScale: n, maxScale: r, windowWidth: i, windowHeight: a, onTransform: o } = e, s = p(null), c = p([]), [l, u] = J({ ...Y }), d = (e) => {
420
232
  let t = { ...l.value };
421
- u({ ...Qe }), (t.x !== 0 || t.y !== 0 || t.scale !== 1 || t.rotate !== 0 || t.flipX || t.flipY) && o?.({
422
- transform: { ...Qe },
233
+ u({ ...Y }), (t.x !== 0 || t.y !== 0 || t.scale !== 1 || t.rotate !== 0 || t.flipX || t.flipY) && o?.({
234
+ transform: { ...Y },
423
235
  action: e
424
236
  });
425
237
  }, f = (e, t) => {
426
- s.value === null && (c.value = [], s.value = de(() => {
238
+ s.value === null && (c.value = [], s.value = z(() => {
427
239
  let e = { ...l.value };
428
240
  for (let t of c.value) e = {
429
241
  ...e,
@@ -447,14 +259,14 @@ function $e(e) {
447
259
  if (!d) return;
448
260
  let { width: p, height: m, offsetWidth: h, offsetHeight: g, offsetLeft: _, offsetTop: v } = d, y = e, b = l.value.scale * e;
449
261
  b > r.value ? (b = r.value, y = r.value / l.value.scale) : b < n.value && (b = u ? b : n.value, y = b / l.value.scale);
450
- let x = s ?? i.value / 2, S = c ?? a.value / 2, C = y - 1, w = C * p * .5, T = C * m * .5, E = C * (x - l.value.x - _), D = C * (S - l.value.y - v), O = l.value.x - (E - w), k = l.value.y - (D - T);
262
+ let x = s ?? i.value / 2, S = c ?? a.value / 2, C = y - 1, w = C * p * .5, T = C * m * .5, ee = C * (x - l.value.x - _), te = C * (S - l.value.y - v), E = l.value.x - (ee - w), D = l.value.y - (te - T);
451
263
  if (e < 1 && b === 1) {
452
264
  let e = h * b, t = g * b;
453
- e <= i.value && t <= a.value && (O = 0, k = 0);
265
+ e <= i.value && t <= a.value && (E = 0, D = 0);
454
266
  }
455
267
  f({
456
- x: O,
457
- y: k,
268
+ x: E,
269
+ y: D,
458
270
  scale: b
459
271
  }, o);
460
272
  }
@@ -462,7 +274,7 @@ function $e(e) {
462
274
  }
463
275
  //#endregion
464
276
  //#region src/hooks/useImageBoundary.ts
465
- function et(e, t, n, r) {
277
+ function ce(e, t, n, r) {
466
278
  let i = t + n, a = (n - r) / 2;
467
279
  if (n > r) {
468
280
  if (t > 0) return { [e]: a };
@@ -470,34 +282,34 @@ function et(e, t, n, r) {
470
282
  } else if (t < 0 || i > r) return { [e]: t < 0 ? a : -a };
471
283
  return {};
472
284
  }
473
- function tt(e) {
285
+ function le(e) {
474
286
  let { imageWidth: t, imageHeight: n, imageLeft: r, imageTop: i, windowWidth: a, windowHeight: o } = e;
475
287
  return t <= a && n <= o ? {
476
288
  x: 0,
477
289
  y: 0
478
290
  } : t > a || n > o ? {
479
- ...et("x", r, t, a),
480
- ...et("y", i, n, o)
291
+ ...ce("x", r, t, a),
292
+ ...ce("y", i, n, o)
481
293
  } : null;
482
294
  }
483
295
  //#endregion
484
296
  //#region src/hooks/useMouseEvent.ts
485
- var nt = 1, rt = 2;
486
- function it(e) {
487
- let { imageRef: t, movable: n, visible: r, scaleStep: i, transform: a, updateTransform: o, dispatchZoomChange: s, windowWidth: c, windowHeight: l } = e, u = b(!1), d = b({
297
+ var ue = 1, de = 2;
298
+ function fe(e) {
299
+ let { imageRef: t, movable: n, visible: r, scaleStep: i, transform: a, updateTransform: o, dispatchZoomChange: s, windowWidth: c, windowHeight: l } = e, u = p(!1), d = p({
488
300
  diffX: 0,
489
301
  diffY: 0,
490
302
  transformX: 0,
491
303
  transformY: 0
492
304
  });
493
- return X(window, "mouseup", () => {
305
+ return S(window, "mouseup", () => {
494
306
  if (!r.value || !u.value) return;
495
307
  u.value = !1;
496
308
  let { transformX: e, transformY: n } = d.value;
497
309
  if (!(a.value.x !== e && a.value.y !== n)) return;
498
310
  let i = t.value;
499
311
  if (!i) return;
500
- let s = i.offsetWidth * a.value.scale, f = i.offsetHeight * a.value.scale, { left: p, top: m } = i.getBoundingClientRect(), h = a.value.rotate % 180 != 0, g = tt({
312
+ let s = i.offsetWidth * a.value.scale, f = i.offsetHeight * a.value.scale, { left: p, top: m } = i.getBoundingClientRect(), h = a.value.rotate % 180 != 0, g = le({
501
313
  imageWidth: h ? f : s,
502
314
  imageHeight: h ? s : f,
503
315
  imageLeft: p,
@@ -506,7 +318,7 @@ function it(e) {
506
318
  windowHeight: l.value
507
319
  });
508
320
  g && o({ ...g }, "dragRebound");
509
- }), X(window, "mousemove", (e) => {
321
+ }), S(window, "mousemove", (e) => {
510
322
  !r.value || !u.value || o({
511
323
  x: e.pageX - d.value.diffX,
512
324
  y: e.pageY - d.value.diffY
@@ -523,24 +335,24 @@ function it(e) {
523
335
  },
524
336
  onWheel: (e) => {
525
337
  if (!r.value || e.deltaY === 0) return;
526
- let t = nt + Math.min(Math.abs(e.deltaY / 100), rt) * i.value;
527
- e.deltaY > 0 && (t = nt / t), s(t, "wheel", e.clientX, e.clientY);
338
+ let t = ue + Math.min(Math.abs(e.deltaY / 100), de) * i.value;
339
+ e.deltaY > 0 && (t = ue / t), s(t, "wheel", e.clientX, e.clientY);
528
340
  }
529
341
  };
530
342
  }
531
343
  //#endregion
532
344
  //#region src/hooks/useTouchEvent.ts
533
- function at(e, t) {
345
+ function X(e, t) {
534
346
  return Math.hypot(e.x - t.x, e.y - t.y);
535
347
  }
536
- function ot(e, t, n, r) {
537
- let i = at(e, n), a = at(t, r);
348
+ function pe(e, t, n, r) {
349
+ let i = X(e, n), a = X(t, r);
538
350
  if (i === 0 && a === 0) return [e.x, e.y];
539
351
  let o = i / (i + a);
540
352
  return [e.x + o * (t.x - e.x), e.y + o * (t.y - e.y)];
541
353
  }
542
- function st(e) {
543
- let { imageRef: t, movable: n, visible: r, minScale: i, transform: a, updateTransform: o, dispatchZoomChange: s, windowWidth: c, windowHeight: l } = e, u = b(!1), d = b({
354
+ function me(e) {
355
+ let { imageRef: t, movable: n, visible: r, minScale: i, transform: a, updateTransform: o, dispatchZoomChange: s, windowWidth: c, windowHeight: l } = e, u = p(!1), d = p({
544
356
  point1: {
545
357
  x: 0,
546
358
  y: 0
@@ -556,7 +368,7 @@ function st(e) {
556
368
  ...e
557
369
  };
558
370
  };
559
- return X(window, "touchmove", (e) => {
371
+ return S(window, "touchmove", (e) => {
560
372
  r.value && n.value && e.preventDefault();
561
373
  }, { passive: !1 }), {
562
374
  isTouching: u,
@@ -591,8 +403,8 @@ function st(e) {
591
403
  }, i = {
592
404
  x: t[1].clientX,
593
405
  y: t[1].clientY
594
- }, [a, o] = ot(n, r, e, i);
595
- s(at(e, i) / at(n, r), "touchZoom", a, o, !0), f({
406
+ }, [a, o] = pe(n, r, e, i);
407
+ s(X(e, i) / X(n, r), "touchZoom", a, o, !0), f({
596
408
  point1: e,
597
409
  point2: i,
598
410
  eventType: "touchZoom"
@@ -611,7 +423,7 @@ function st(e) {
611
423
  }, "touchZoom");
612
424
  let e = t.value;
613
425
  if (!e) return;
614
- let n = e.offsetWidth * a.value.scale, s = e.offsetHeight * a.value.scale, { left: d, top: p } = e.getBoundingClientRect(), m = a.value.rotate % 180 != 0, h = tt({
426
+ let n = e.offsetWidth * a.value.scale, s = e.offsetHeight * a.value.scale, { left: d, top: p } = e.getBoundingClientRect(), m = a.value.rotate % 180 != 0, h = le({
615
427
  imageWidth: m ? s : n,
616
428
  imageHeight: m ? n : s,
617
429
  imageLeft: d,
@@ -625,7 +437,7 @@ function st(e) {
625
437
  }
626
438
  //#endregion
627
439
  //#region src/style/preview.ts
628
- function ct(e) {
440
+ function he(e) {
629
441
  return {
630
442
  zIndexPopup: `calc(${e.zIndexPopupBase} + 80)`,
631
443
  previewOperationColor: e.colorTextDescription,
@@ -635,7 +447,7 @@ function ct(e) {
635
447
  previewOperationSize: e.fontSizeLG
636
448
  };
637
449
  }
638
- var lt = (e) => {
450
+ var ge = (e) => {
639
451
  let t = e.componentCls, { motionEaseOut: n, motionDurationSlow: r, previewOperationSize: i, zIndexPopup: a } = e, o = {
640
452
  position: "absolute",
641
453
  color: e.previewOperationColor,
@@ -734,7 +546,7 @@ var lt = (e) => {
734
546
  padding: e.paddingXXS,
735
547
  color: e.previewOperationColor,
736
548
  backgroundColor: e.colorBgContainer,
737
- border: `${F(e.lineWidth)} ${e.lineType} ${e.colorFillTertiary}`,
549
+ border: `${b(e.lineWidth)} ${e.lineType} ${e.colorFillTertiary}`,
738
550
  borderRadius: e.borderRadiusLG,
739
551
  fontSize: i,
740
552
  "&-action": {
@@ -769,7 +581,7 @@ var lt = (e) => {
769
581
  }
770
582
  }
771
583
  } };
772
- }, ut = (e) => {
584
+ }, _e = (e) => {
773
585
  let t = e.componentCls, { motionDurationSlow: n, motionEaseOut: r } = e;
774
586
  return { [`${t}`]: {
775
587
  "&-fade-enter-active, &-fade-leave-active": {
@@ -795,22 +607,25 @@ var lt = (e) => {
795
607
  [`${t}-close, ${t}-switch, ${t}-footer`]: { opacity: 1 }
796
608
  }
797
609
  } };
798
- }, dt = ie("GImagePreview", (e) => [lt(e), ut(e)], ct), ft = 1, Z = {
799
- rotateLeft: i(j, null, null),
800
- rotateRight: i(M, null, null),
801
- zoomIn: i(P, null, null),
802
- zoomOut: i(re, null, null),
803
- flipX: i(N, null, null),
804
- flipY: i(N, { rotate: 90 }, null),
805
- copy: i(O, null, null),
806
- download: i(k, null, null)
610
+ }, ve = y("GImagePreview", (e) => [ge(e), _e(e)], he), ye = 1, Z = {
611
+ rotateLeft: i(v, { type: "RotateLeftOutlined" }, null),
612
+ rotateRight: i(v, { type: "RotateRightOutlined" }, null),
613
+ zoomIn: i(v, { type: "ZoomInOutlined" }, null),
614
+ zoomOut: i(v, { type: "ZoomOutOutlined" }, null),
615
+ flipX: i(v, { type: "SwapOutlined" }, null),
616
+ flipY: i(v, {
617
+ type: "SwapOutlined",
618
+ rotate: 90
619
+ }, null),
620
+ copy: i(v, { type: "CopyOutlined" }, null),
621
+ download: i(v, { type: "DownloadOutlined" }, null)
807
622
  }, Q = {
808
623
  copySuccess: "复制成功",
809
624
  copyFailed: "复制失败",
810
625
  downloadSuccess: "下载成功",
811
626
  downloadFailed: "下载失败"
812
627
  };
813
- function pt(e) {
628
+ function be(e) {
814
629
  try {
815
630
  let t = new URL(e, window.location.href).pathname.match(/\/([^/]+)$/)?.[1];
816
631
  return t ? decodeURIComponent(t) : "image";
@@ -819,7 +634,7 @@ function pt(e) {
819
634
  return t ? decodeURIComponent(t) : "image";
820
635
  }
821
636
  }
822
- function mt(e) {
637
+ function xe(e) {
823
638
  let t = {
824
639
  "image/gif": "gif",
825
640
  "image/jpg": "jpg",
@@ -830,12 +645,12 @@ function mt(e) {
830
645
  }, n = e?.toLowerCase();
831
646
  return t[n] || n?.split("/")[1]?.split("+")[0] || "png";
832
647
  }
833
- async function ht(e) {
648
+ async function Se(e) {
834
649
  let t = await fetch(e, { mode: "cors" });
835
650
  if (!t.ok) throw Error(`Failed to fetch image: ${t.status}`);
836
651
  return t.blob();
837
652
  }
838
- async function gt(e) {
653
+ async function Ce(e) {
839
654
  return new Promise((t, n) => {
840
655
  let r = new Image(), i = URL.createObjectURL(e);
841
656
  r.onload = () => {
@@ -855,52 +670,52 @@ async function gt(e) {
855
670
  }, r.src = i;
856
671
  });
857
672
  }
858
- async function _t(e) {
673
+ async function we(e) {
859
674
  let t = (e.type || "").toLowerCase();
860
- return t === "image/png" || t === "image/svg+xml" ? { [t]: e } : { "image/png": await gt(e) };
675
+ return t === "image/png" || t === "image/svg+xml" ? { [t]: e } : { "image/png": await Ce(e) };
861
676
  }
862
- function vt(e, t) {
863
- let n = pt(e);
864
- return n.includes(".") ? n.endsWith(".svg+xml") ? n.replace(/\.svg\+xml$/i, ".svg") : n : `${n}.${mt(t)}`;
677
+ function Te(e, t) {
678
+ let n = be(e);
679
+ return n.includes(".") ? n.endsWith(".svg+xml") ? n.replace(/\.svg\+xml$/i, ".svg") : n : `${n}.${xe(t)}`;
865
680
  }
866
- function yt(e, t) {
681
+ function Ee(e, t) {
867
682
  let n = URL.createObjectURL(e), r = document.createElement("a");
868
683
  r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), r.remove(), URL.revokeObjectURL(n);
869
684
  }
870
- var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
871
- let { width: l, height: u } = qe(), { prefixCls: d } = ae("pro-image-preview", a), f = oe(d), [p, m] = dt(d, f), [_, y] = Ze(a.open, {
872
- value: S(a, "open"),
685
+ var De = /* @__PURE__ */ a((a, { emit: o, slots: s, expose: c }) => {
686
+ let { width: d, height: h } = T(), { prefixCls: _ } = ee("pro-image-preview", a), y = te(_), [b, x] = ve(_, y), [S, C] = oe(a.open, {
687
+ value: m(a, "open"),
873
688
  onChange: (e) => {
874
689
  a.onOpenChange?.(e), o("update:open", e);
875
690
  }
876
- }), x = b(!0), C = b(), w = b(), E = b(a.current ?? 0), O = b(!1), k = b(!1), { transform: A, resetTransform: j, updateTransform: M, dispatchZoomChange: N } = $e({
877
- imageRef: C,
878
- minScale: S(a, "minScale"),
879
- maxScale: S(a, "maxScale"),
880
- windowWidth: l,
881
- windowHeight: u,
691
+ }), w = p(!0), D = p(), O = p(), k = p(a.current ?? 0), A = p(!1), j = p(!1), { transform: M, resetTransform: N, updateTransform: P, dispatchZoomChange: F } = se({
692
+ imageRef: D,
693
+ minScale: m(a, "minScale"),
694
+ maxScale: m(a, "maxScale"),
695
+ windowWidth: d,
696
+ windowHeight: h,
882
697
  onTransform: a.onTransform
883
- }), { isMoving: P, onMouseDown: re, onWheel: ie } = it({
884
- imageRef: C,
885
- movable: S(a, "movable"),
886
- visible: _,
887
- scaleStep: S(a, "scaleStep"),
888
- transform: A,
889
- updateTransform: M,
890
- dispatchZoomChange: N,
891
- windowWidth: l,
892
- windowHeight: u
893
- }), { isTouching: F, onTouchStart: L, onTouchMove: R, onTouchEnd: se } = st({
894
- imageRef: C,
895
- movable: S(a, "movable"),
896
- visible: _,
897
- minScale: S(a, "minScale"),
898
- transform: A,
899
- updateTransform: M,
900
- dispatchZoomChange: N,
901
- windowWidth: l,
902
- windowHeight: u
903
- }), z = r(() => a.urls[E.value]), B = r(() => a.urls.length > 1), ce = r(() => a.urls.length >= 1), V = r(() => a.mask === !1 ? {
698
+ }), { isMoving: I, onMouseDown: L, onWheel: R } = fe({
699
+ imageRef: D,
700
+ movable: m(a, "movable"),
701
+ visible: S,
702
+ scaleStep: m(a, "scaleStep"),
703
+ transform: M,
704
+ updateTransform: P,
705
+ dispatchZoomChange: F,
706
+ windowWidth: d,
707
+ windowHeight: h
708
+ }), { isTouching: z, onTouchStart: ne, onTouchMove: B, onTouchEnd: V } = me({
709
+ imageRef: D,
710
+ movable: m(a, "movable"),
711
+ visible: S,
712
+ minScale: m(a, "minScale"),
713
+ transform: M,
714
+ updateTransform: P,
715
+ dispatchZoomChange: F,
716
+ windowWidth: d,
717
+ windowHeight: h
718
+ }), H = r(() => a.urls[k.value]), W = r(() => a.urls.length > 1), G = r(() => a.urls.length >= 1), re = r(() => a.mask === !1 ? {
904
719
  visible: !1,
905
720
  blur: !1
906
721
  } : a.mask && typeof a.mask == "object" && !("type" in a.mask) ? {
@@ -909,95 +724,95 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
909
724
  } : {
910
725
  visible: !0,
911
726
  blur: !0
912
- }), le = r(() => {
727
+ }), ae = r(() => {
913
728
  let e = {};
914
729
  return a.mousePosition && (e.transformOrigin = `${a.mousePosition.x}px ${a.mousePosition.y}px`), e;
915
730
  });
916
- T(() => a.current, (e) => {
917
- e !== void 0 && (E.value = e);
918
- }), T(() => a.current, (e) => {
919
- e !== void 0 && (E.value = e);
731
+ g(() => a.current, (e) => {
732
+ e !== void 0 && (k.value = e);
733
+ }), g(() => a.current, (e) => {
734
+ e !== void 0 && (k.value = e);
920
735
  });
921
- let H = () => {
922
- y(!1), a.onClose?.(), o("close");
923
- }, ue = () => {
924
- P.value || H();
925
- }, U = () => {
926
- if (E.value > 0 || a.infinite) {
927
- let e = E.value - 1 < 0 ? a.urls.length - 1 : E.value - 1;
928
- x.value = !1, E.value = e, j("prev"), h(() => {
929
- x.value = !0;
736
+ let q = () => {
737
+ C(!1), a.onClose?.(), o("close");
738
+ }, J = () => {
739
+ I.value || q();
740
+ }, Y = () => {
741
+ if (k.value > 0 || a.infinite) {
742
+ let e = k.value - 1 < 0 ? a.urls.length - 1 : k.value - 1;
743
+ w.value = !1, k.value = e, N("prev"), l(() => {
744
+ w.value = !0;
930
745
  });
931
746
  }
932
- }, W = () => {
933
- if (E.value < a.urls.length - 1 || a.infinite) {
934
- let e = E.value + 1 > a.urls.length - 1 ? 0 : E.value + 1;
935
- x.value = !1, E.value = e, j("next"), h(() => {
936
- x.value = !0;
747
+ }, ce = () => {
748
+ if (k.value < a.urls.length - 1 || a.infinite) {
749
+ let e = k.value + 1 > a.urls.length - 1 ? 0 : k.value + 1;
750
+ w.value = !1, k.value = e, N("next"), l(() => {
751
+ w.value = !0;
937
752
  });
938
753
  }
754
+ }, le = () => {
755
+ F(ye + (a.scaleStep ?? .5), "zoomIn");
756
+ }, ue = () => {
757
+ F(ye / (ye + (a.scaleStep ?? .5)), "zoomOut");
939
758
  }, de = () => {
940
- N(ft + (a.scaleStep ?? .5), "zoomIn");
941
- }, fe = () => {
942
- N(ft / (ft + (a.scaleStep ?? .5)), "zoomOut");
943
- }, G = () => {
944
- M({ rotate: A.value.rotate + 90 }, "rotateRight");
759
+ P({ rotate: M.value.rotate + 90 }, "rotateRight");
760
+ }, X = () => {
761
+ P({ rotate: M.value.rotate - 90 }, "rotateLeft");
945
762
  }, pe = () => {
946
- M({ rotate: A.value.rotate - 90 }, "rotateLeft");
947
- }, me = () => {
948
- M({ flipX: !A.value.flipX }, "flipX");
763
+ P({ flipX: !M.value.flipX }, "flipX");
949
764
  }, he = () => {
950
- M({ flipY: !A.value.flipY }, "flipY");
765
+ P({ flipY: !M.value.flipY }, "flipY");
951
766
  }, ge = async () => {
952
- if (!(!z.value || O.value)) {
767
+ if (!(!H.value || A.value)) {
953
768
  if (!navigator.clipboard || !window.ClipboardItem) {
954
- I.error(Q.copyFailed);
769
+ E.error(Q.copyFailed);
955
770
  return;
956
771
  }
957
- O.value = !0;
772
+ A.value = !0;
958
773
  try {
959
- let e = await _t(await ht(z.value));
960
- await navigator.clipboard.write([new ClipboardItem(e)]), I.success(Q.copySuccess);
774
+ let e = await we(await Se(H.value));
775
+ await navigator.clipboard.write([new ClipboardItem(e)]), E.success(Q.copySuccess);
961
776
  } catch {
962
- I.error(Q.copyFailed);
777
+ E.error(Q.copyFailed);
963
778
  } finally {
964
- O.value = !1;
779
+ A.value = !1;
965
780
  }
966
781
  }
967
782
  }, _e = async () => {
968
- if (!(!z.value || k.value)) {
969
- k.value = !0;
783
+ if (!(!H.value || j.value)) {
784
+ j.value = !0;
970
785
  try {
971
- let e = await ht(z.value);
972
- yt(e, vt(z.value, e.type)), I.success(Q.downloadSuccess);
786
+ let e = await Se(H.value);
787
+ Ee(e, Te(H.value, e.type)), E.success(Q.downloadSuccess);
973
788
  } catch {
974
- I.error(Q.downloadFailed);
789
+ E.error(Q.downloadFailed);
975
790
  } finally {
976
- k.value = !1;
791
+ j.value = !1;
977
792
  }
978
793
  }
979
- }, ye = (e) => {
980
- _.value && (A.value.scale === 1 ? N(ft + (a.scaleStep ?? .5), "doubleClick", e.clientX, e.clientY) : M({
794
+ }, be = (e) => {
795
+ S.value && (M.value.scale === 1 ? F(ye + (a.scaleStep ?? .5), "doubleClick", e.clientX, e.clientY) : P({
981
796
  x: 0,
982
797
  y: 0,
983
798
  scale: 1
984
799
  }, "doubleClick"));
985
- }, J = (e) => {
800
+ }, xe = (e) => {
986
801
  if (e.key === "Escape") {
987
- H();
802
+ q();
988
803
  return;
989
804
  }
990
- !_.value || !B.value || (e.key === "ArrowLeft" ? U() : e.key === "ArrowRight" && W());
991
- }, be;
992
- g(() => {
993
- let e = (e) => J(e);
994
- window.addEventListener("keydown", e), be = () => window.removeEventListener("keydown", e);
995
- }), v(() => {
996
- be?.();
805
+ !S.value || !W.value || (e.key === "ArrowLeft" ? Y() : e.key === "ArrowRight" && ce());
806
+ }, Ce;
807
+ u(() => {
808
+ let e = (e) => xe(e);
809
+ window.addEventListener("keydown", e), Ce = () => window.removeEventListener("keydown", e);
810
+ }), f(() => {
811
+ Ce?.();
997
812
  }), c({ setOpen: (e) => {
998
- y(e), E.value = a.current ?? 0;
813
+ C(e), k.value = a.current ?? 0;
999
814
  } });
1000
- let Y = () => ve({
815
+ let De = () => ie({
1001
816
  slots: s,
1002
817
  props: { ...a.icons },
1003
818
  keys: [
@@ -1021,8 +836,8 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
1021
836
  Z.copy,
1022
837
  Z.download
1023
838
  ]
1024
- }), xe = () => {
1025
- let e = Y();
839
+ }), Oe = () => {
840
+ let e = De();
1026
841
  return [
1027
842
  {
1028
843
  icon: e.flipY,
@@ -1031,71 +846,77 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
1031
846
  },
1032
847
  {
1033
848
  icon: e.flipX,
1034
- onClick: me,
849
+ onClick: pe,
1035
850
  type: "flipX"
1036
851
  },
1037
852
  {
1038
853
  icon: e.rotateLeft,
1039
- onClick: pe,
854
+ onClick: X,
1040
855
  type: "rotateLeft"
1041
856
  },
1042
857
  {
1043
858
  icon: e.rotateRight,
1044
- onClick: G,
859
+ onClick: de,
1045
860
  type: "rotateRight"
1046
861
  },
1047
862
  {
1048
863
  icon: e.zoomOut,
1049
- onClick: fe,
864
+ onClick: ue,
1050
865
  type: "zoomOut",
1051
- disabled: r(() => A.value.scale <= (a.minScale ?? 1))
866
+ disabled: r(() => M.value.scale <= (a.minScale ?? 1))
1052
867
  },
1053
868
  {
1054
869
  icon: e.zoomIn,
1055
- onClick: de,
870
+ onClick: le,
1056
871
  type: "zoomIn",
1057
- disabled: r(() => A.value.scale === (a.maxScale ?? 50))
872
+ disabled: r(() => M.value.scale === (a.maxScale ?? 50))
1058
873
  },
1059
874
  {
1060
- icon: O.value ? i(te, { spin: !0 }, null) : e.copy,
875
+ icon: A.value ? i(v, {
876
+ type: "Spinning",
877
+ spin: !0
878
+ }, null) : e.copy,
1061
879
  onClick: ge,
1062
880
  type: "copy",
1063
- disabled: r(() => O.value)
881
+ disabled: r(() => A.value)
1064
882
  },
1065
883
  {
1066
- icon: k.value ? i(te, { spin: !0 }, null) : e.download,
884
+ icon: j.value ? i(v, {
885
+ type: "Spinning",
886
+ spin: !0
887
+ }, null) : e.download,
1067
888
  onClick: _e,
1068
889
  type: "download",
1069
- disabled: r(() => k.value)
890
+ disabled: r(() => j.value)
1070
891
  }
1071
892
  ];
1072
893
  };
1073
894
  return () => {
1074
895
  let r = {
1075
- transform: `translate3d(${A.value.x}px, ${A.value.y}px, 0) scale3d(${A.value.flipX ? "-" : ""}${A.value.scale}, ${A.value.flipY ? "-" : ""}${A.value.scale}, 1) rotate(${A.value.rotate}deg)`,
1076
- transitionDuration: !x.value || F.value ? "0s" : void 0
1077
- }, o = q({
896
+ transform: `translate3d(${M.value.x}px, ${M.value.y}px, 0) scale3d(${M.value.flipX ? "-" : ""}${M.value.scale}, ${M.value.flipY ? "-" : ""}${M.value.scale}, 1) rotate(${M.value.rotate}deg)`,
897
+ transitionDuration: !w.value || z.value ? "0s" : void 0
898
+ }, o = K({
1078
899
  slots: s,
1079
900
  props: { close: a.icons?.close },
1080
901
  key: "close"
1081
- }), c = q({
902
+ }), c = K({
1082
903
  slots: s,
1083
904
  props: { left: a.icons?.left },
1084
905
  key: "left"
1085
- }), l = q({
906
+ }), l = K({
1086
907
  slots: s,
1087
908
  props: { right: a.icons?.right },
1088
909
  key: "right"
1089
- }), u = `${d.value}-actions-action`, h = xe();
910
+ }), u = `${_.value}-actions-action`, d = Oe();
1090
911
  return i(t, { to: a.getContainer || "body" }, { default: () => [i(n, {
1091
- name: `${d.value}-fade`,
912
+ name: `${_.value}-fade`,
1092
913
  appear: !0,
1093
- onAfterLeave: () => j("close")
1094
- }, { default: () => [_.value && i("div", {
1095
- ref: w,
1096
- class: K(d.value, p.value, m.value, f.value, {
1097
- [`${d.value}-movable`]: a.movable,
1098
- [`${d.value}-moving`]: P.value
914
+ onAfterLeave: () => N("close")
915
+ }, { default: () => [S.value && i("div", {
916
+ ref: O,
917
+ class: U(_.value, b.value, x.value, y.value, {
918
+ [`${_.value}-movable`]: a.movable,
919
+ [`${_.value}-moving`]: I.value
1099
920
  }),
1100
921
  style: { zIndex: a.zIndex },
1101
922
  role: "dialog",
@@ -1103,50 +924,50 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
1103
924
  "aria-label": "Image",
1104
925
  tabindex: -1
1105
926
  }, [
1106
- V.value.visible && i("div", {
1107
- class: K(`${d.value}-mask`, a.maskClass, { [`${d.value}-mask-blur`]: V.value.blur }),
1108
- onClick: a.onHideOnClickModal ? ue : void 0
927
+ re.value.visible && i("div", {
928
+ class: U(`${_.value}-mask`, a.maskClass, { [`${_.value}-mask-blur`]: re.value.blur }),
929
+ onClick: a.onHideOnClickModal ? J : void 0
1109
930
  }, null),
1110
931
  i("div", {
1111
- class: `${d.value}-body`,
1112
- style: le.value
932
+ class: `${_.value}-body`,
933
+ style: ae.value
1113
934
  }, [i("img", {
1114
- ref: C,
1115
- class: `${d.value}-img`,
1116
- src: z.value,
935
+ ref: D,
936
+ class: `${_.value}-img`,
937
+ src: H.value,
1117
938
  alt: "Image",
1118
939
  loading: "eager",
1119
940
  decoding: "sync",
1120
941
  style: r,
1121
- onWheel: ie,
1122
- onMousedown: re,
1123
- onDblclick: ye,
1124
- onTouchstart: L,
1125
- onTouchmove: R,
1126
- onTouchend: se,
1127
- onTouchcancel: se
942
+ onWheel: R,
943
+ onMousedown: L,
944
+ onDblclick: be,
945
+ onTouchstart: ne,
946
+ onTouchmove: B,
947
+ onTouchend: V,
948
+ onTouchcancel: V
1128
949
  }, null)]),
1129
950
  i("button", {
1130
951
  type: "button",
1131
- class: `${d.value}-close`,
1132
- onClick: H
1133
- }, [o || i(D, null, null)]),
1134
- B.value && i(e, null, [i("button", {
952
+ class: `${_.value}-close`,
953
+ onClick: q
954
+ }, [o || i(v, { type: "CloseOutlined" }, null)]),
955
+ W.value && i(e, null, [i("button", {
1135
956
  type: "button",
1136
- class: K(`${d.value}-switch`, `${d.value}-switch-prev`, { [`${d.value}-switch-disabled`]: !a.infinite && E.value === 0 }),
957
+ class: U(`${_.value}-switch`, `${_.value}-switch-prev`, { [`${_.value}-switch-disabled`]: !a.infinite && k.value === 0 }),
1137
958
  onClick: (e) => {
1138
- e.preventDefault(), e.stopPropagation(), U();
959
+ e.preventDefault(), e.stopPropagation(), Y();
1139
960
  }
1140
- }, [c || i(ee, null, null)]), i("button", {
961
+ }, [c || i(v, { type: "LeftOutlined" }, null)]), i("button", {
1141
962
  type: "button",
1142
- class: K(`${d.value}-switch`, `${d.value}-switch-next`, { [`${d.value}-switch-disabled`]: !a.infinite && E.value === a.urls.length - 1 }),
963
+ class: U(`${_.value}-switch`, `${_.value}-switch-next`, { [`${_.value}-switch-disabled`]: !a.infinite && k.value === a.urls.length - 1 }),
1143
964
  onClick: (e) => {
1144
- e.preventDefault(), e.stopPropagation(), W();
965
+ e.preventDefault(), e.stopPropagation(), ce();
1145
966
  }
1146
- }, [l || i(ne, null, null)])]),
1147
- i("div", { class: `${d.value}-footer` }, [ce.value && i("div", { class: `${d.value}-progress` }, [a.countRender ? a.countRender(E.value + 1, a.urls.length) : `${E.value + 1} / ${a.urls.length}`]), i("div", { class: `${d.value}-actions` }, [h.map(({ icon: e, onClick: t, type: n, disabled: r }) => i("button", {
967
+ }, [l || i(v, { type: "RightOutlined" }, null)])]),
968
+ i("div", { class: `${_.value}-footer` }, [G.value && i("div", { class: `${_.value}-progress` }, [a.countRender ? a.countRender(k.value + 1, a.urls.length) : `${k.value + 1} / ${a.urls.length}`]), i("div", { class: `${_.value}-actions` }, [d.map(({ icon: e, onClick: t, type: n, disabled: r }) => i("button", {
1148
969
  type: "button",
1149
- class: K(u, `${u}-${n}`, { [`${u}-disabled`]: r && r.value }),
970
+ class: U(u, `${u}-${n}`, { [`${u}-disabled`]: r && r.value }),
1150
971
  onClick: () => {
1151
972
  r?.value || t();
1152
973
  },
@@ -1157,7 +978,7 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
1157
978
  ])] })] });
1158
979
  };
1159
980
  }, {
1160
- props: /* @__PURE__ */ p({
981
+ props: /*@__PURE__*/ s({
1161
982
  class: {
1162
983
  type: String,
1163
984
  required: !1
@@ -1285,7 +1106,7 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
1285
1106
  ],
1286
1107
  name: "GImagePreview",
1287
1108
  inheritAttrs: !1
1288
- }), xt = (e) => {
1109
+ }), Oe = (e) => {
1289
1110
  let { motionDurationSlow: t, paddingXXS: n, marginXXS: r, colorTextLightSolid: i } = e;
1290
1111
  return {
1291
1112
  position: "absolute",
@@ -1302,14 +1123,14 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
1302
1123
  overflow: "hidden",
1303
1124
  whiteSpace: "nowrap",
1304
1125
  textOverflow: "ellipsis",
1305
- padding: `0 ${F(n)}`,
1126
+ padding: `0 ${b(n)}`,
1306
1127
  ".anticon": {
1307
1128
  marginInlineEnd: r,
1308
1129
  svg: { verticalAlign: "baseline" }
1309
1130
  }
1310
1131
  }
1311
1132
  };
1312
- }, St = (e) => {
1133
+ }, ke = (e) => {
1313
1134
  let t = {
1314
1135
  width: "100%",
1315
1136
  height: "100%"
@@ -1345,67 +1166,67 @@ var bt = /* @__PURE__ */ o((a, { emit: o, slots: s, expose: c }) => {
1345
1166
  position: "absolute",
1346
1167
  inset: 0
1347
1168
  },
1348
- [`${e.componentCls}-mask`]: { ...xt(e) },
1169
+ [`${e.componentCls}-mask`]: { ...Oe(e) },
1349
1170
  [`${e.componentCls}-mask:hover`]: { opacity: 1 }
1350
1171
  } };
1351
- }, Ct = ie("GImage", (e) => [St(e)]), wt = {
1172
+ }, Ae = y("GImage", (e) => [ke(e)]), je = {
1352
1173
  src: "",
1353
1174
  alt: "",
1354
1175
  fit: "contain",
1355
1176
  preview: !0,
1356
1177
  loading: "eager"
1357
1178
  };
1358
- function Tt(e) {
1179
+ function Me(e) {
1359
1180
  return e && e.nodeType === 1;
1360
1181
  }
1361
- var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
1362
- let c = Y && "loading" in HTMLImageElement.prototype, { prefixCls: l } = ae("pro-image", t), u = oe(l), [d, f] = Ct(l, u), p = b(), _ = b(!1), v = b(!0), y = b(), x = b(), S, C = r(() => t.loading === "eager" ? !1 : !c && t.loading === "lazy" || t.lazy), w = r(() => Y && t.fit ? {
1182
+ var $ = /* @__PURE__ */ a((t, { emit: n, slots: a, expose: o, attrs: s }) => {
1183
+ let d = x && "loading" in HTMLImageElement.prototype, { prefixCls: f } = ee("pro-image", t), m = te(f), [h, _] = Ae(f, m), y = p(), C = p(!1), T = p(!0), E = p(), D = p(), O, A = r(() => t.loading === "eager" ? !1 : !d && t.loading === "lazy" || t.lazy), j = r(() => x && t.fit ? {
1363
1184
  ...t.imageStyle,
1364
1185
  objectFit: t.fit
1365
- } : { ...t.imageStyle }), E = r(() => typeof t.preview == "object" ? t.preview : {}), D = r(() => !!t.preview), O = r(() => {
1366
- let { urls: e = [], current: n = 0 } = E.value;
1367
- if (se(n)) return e.length >= n ? n : 0;
1186
+ } : { ...t.imageStyle }), N = r(() => typeof t.preview == "object" ? t.preview : {}), P = r(() => !!t.preview), F = r(() => {
1187
+ let { urls: e = [], current: n = 0 } = N.value;
1188
+ if (k(n)) return e.length >= n ? n : 0;
1368
1189
  let r = e.indexOf(t.src ?? "");
1369
1190
  return r >= 0 ? r : 0;
1370
- }), k = r(() => F(t.width)), ee = r(() => F(t.height)), { showViewer: te, mousePosition: ne, openPreview: j, closePreview: M } = Je({ canPreview: D }), N = () => {
1371
- Y && (v.value = !0, _.value = !1, p.value = t.src);
1372
- }, P = (e) => {
1373
- _.value || (v.value = !1, _.value = !1, t.onLoad?.(e), n("load", e));
1374
- }, re = (e) => {
1375
- v.value = !1, _.value = !0, t.onError?.(e), n("error", e);
1376
- }, ie = () => {
1377
- if (!y.value || !x.value) return !1;
1378
- let e = y.value.getBoundingClientRect(), t = x.value.getBoundingClientRect ? x.value.getBoundingClientRect() : {
1191
+ }), I = r(() => b(t.width)), L = r(() => b(t.height)), { showViewer: R, mousePosition: z, openPreview: ne, closePreview: B } = ae({ canPreview: P }), V = () => {
1192
+ x && (T.value = !0, C.value = !1, y.value = t.src);
1193
+ }, W = (e) => {
1194
+ C.value || (T.value = !1, C.value = !1, t.onLoad?.(e), n("load", e));
1195
+ }, G = (e) => {
1196
+ T.value = !1, C.value = !0, t.onError?.(e), n("error", e);
1197
+ }, re = () => {
1198
+ if (!E.value || !D.value) return !1;
1199
+ let e = E.value.getBoundingClientRect(), t = D.value.getBoundingClientRect ? D.value.getBoundingClientRect() : {
1379
1200
  top: 0,
1380
- bottom: x.value.innerHeight ?? 0,
1201
+ bottom: D.value.innerHeight ?? 0,
1381
1202
  left: 0,
1382
- right: x.value.innerWidth ?? 0
1203
+ right: D.value.innerWidth ?? 0
1383
1204
  };
1384
1205
  return e.top < t.bottom && e.bottom > t.top && e.left < t.right && e.right > t.left;
1385
- }, I = Me(() => {
1386
- ie() && (N(), S?.(), S = void 0);
1387
- }, 200, !0), L = async () => {
1388
- if (!Y) return;
1389
- await h();
1206
+ }, K = w(() => {
1207
+ re() && (V(), O?.(), O = void 0);
1208
+ }, 200, !0), q = async () => {
1209
+ if (!x) return;
1210
+ await l();
1390
1211
  let { scrollContainer: e } = t;
1391
- Tt(e) ? x.value = e : ce(e) && e !== "" ? x.value = document.querySelector(e) ?? void 0 : y.value && (x.value = me(y.value)), x.value && (S = X(x.value, "scroll", I), setTimeout(I, 100));
1392
- }, R = (e) => {
1393
- let r = v.value ? "loaded" : _.value ? "error" : "success";
1394
- if (t.onClick?.(r), n("click", r), !(v.value || _.value) && D.value) {
1212
+ Me(e) ? D.value = e : M(e) && e !== "" ? D.value = document.querySelector(e) ?? void 0 : E.value && (D.value = H(E.value)), D.value && (O = S(D.value, "scroll", K), setTimeout(K, 100));
1213
+ }, J = (e) => {
1214
+ let r = T.value ? "loaded" : C.value ? "error" : "success";
1215
+ if (t.onClick?.(r), n("click", r), !(T.value || C.value) && P.value) {
1395
1216
  let t = e.currentTarget?.getBoundingClientRect();
1396
- j(t ? {
1217
+ ne(t ? {
1397
1218
  ...e,
1398
1219
  clientX: t.x + t.width / 2,
1399
1220
  clientY: t.y + t.height / 2
1400
1221
  } : e);
1401
1222
  }
1402
1223
  };
1403
- return T(() => t.src, () => {
1404
- C.value ? (v.value = !0, _.value = !1, S?.(), L()) : N();
1405
- }), g(() => {
1406
- C.value ? L() : N();
1224
+ return g(() => t.src, () => {
1225
+ A.value ? (T.value = !0, C.value = !1, O?.(), q()) : V();
1226
+ }), u(() => {
1227
+ A.value ? q() : V();
1407
1228
  }), o({ setOpen: (e) => {
1408
- e ? j() : M();
1229
+ e ? ne() : B();
1409
1230
  } }), () => {
1410
1231
  let n = {}, r = {};
1411
1232
  for (let [e, t] of Object.entries(s)) /^(?:data-|on[A-Z])/i.test(e) || [
@@ -1413,7 +1234,7 @@ var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
1413
1234
  "style",
1414
1235
  "class"
1415
1236
  ].includes(e) ? n[e] = t : r[e] = t;
1416
- let o = ve({
1237
+ let o = ie({
1417
1238
  slots: a,
1418
1239
  props: t,
1419
1240
  keys: [
@@ -1423,53 +1244,53 @@ var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
1423
1244
  ],
1424
1245
  render: !0
1425
1246
  });
1426
- return i("div", m({
1427
- class: K(l.value, d.value, f.value, u.value, t.class),
1428
- ref: y
1247
+ return i("div", c({
1248
+ class: U(f.value, h.value, _.value, m.value, t.class),
1249
+ ref: E
1429
1250
  }, n, {
1430
1251
  style: {
1431
- width: F(t.size) || k.value,
1432
- height: F(t.size) || ee.value,
1252
+ width: b(t.size) || I.value,
1253
+ height: b(t.size) || L.value,
1433
1254
  ...n.style || {}
1434
1255
  },
1435
1256
  onClick: (e) => {
1436
- _.value && R(e);
1257
+ C.value && J(e);
1437
1258
  }
1438
1259
  }), [
1439
- _.value ? i("div", { class: K(`${l.value}-error`) }, [o.fallback]) : i(e, null, [i("img", m(r, {
1440
- src: p.value,
1260
+ C.value ? i("div", { class: U(`${f.value}-error`) }, [o.fallback]) : i(e, null, [i("img", c(r, {
1261
+ src: y.value,
1441
1262
  loading: t.loading,
1442
- style: w.value,
1443
- class: K(t.imageClass, `${l.value}-img`, {
1444
- [`${l.value}-img-placeholder`]: t.placeholder === !0,
1445
- [`${l.value}-img-preview`]: D.value
1263
+ style: j.value,
1264
+ class: U(t.imageClass, `${f.value}-img`, {
1265
+ [`${f.value}-img-placeholder`]: t.placeholder === !0,
1266
+ [`${f.value}-img-preview`]: P.value
1446
1267
  }),
1447
1268
  crossorigin: t.crossOrigin,
1448
- width: k.value,
1449
- height: ee.value,
1450
- onClick: R,
1451
- onLoad: P,
1452
- onError: re
1453
- }), null), v.value && i("div", {
1454
- class: K(`${l.value}-placeholder`),
1455
- onClick: R
1269
+ width: I.value,
1270
+ height: L.value,
1271
+ onClick: J,
1272
+ onLoad: W,
1273
+ onError: G
1274
+ }), null), T.value && i("div", {
1275
+ class: U(`${f.value}-placeholder`),
1276
+ onClick: J
1456
1277
  }, [o.placeholder])]),
1457
- E.value.mask && D.value && i("div", {
1458
- class: K(`${l.value}-mask`, E.value.maskClass),
1278
+ N.value.mask && P.value && i("div", {
1279
+ class: U(`${f.value}-mask`, N.value.maskClass),
1459
1280
  style: { display: n.style?.display === "none" ? "none" : void 0 }
1460
- }, [o.mask || i("div", { class: K(`${l.value}-mask-info`) }, [i(A, null, null)])]),
1461
- D.value && i(bt, m(E.value, {
1462
- urls: E.value.urls || (t.src ? [t.src] : []),
1463
- current: O.value,
1464
- zIndex: t.zIndex ?? E.value.zIndex,
1465
- open: te.value,
1466
- mousePosition: ne.value,
1467
- onClose: () => M()
1281
+ }, [o.mask || i("div", { class: U(`${f.value}-mask-info`) }, [i(v, { type: "EyeOutlined" }, null)])]),
1282
+ P.value && i(De, c(N.value, {
1283
+ urls: N.value.urls || (t.src ? [t.src] : []),
1284
+ current: F.value,
1285
+ zIndex: t.zIndex ?? N.value.zIndex,
1286
+ open: R.value,
1287
+ mousePosition: z.value,
1288
+ onClose: () => B()
1468
1289
  }), a)
1469
1290
  ]);
1470
1291
  };
1471
1292
  }, {
1472
- props: /* @__PURE__ */ p({
1293
+ props: /*@__PURE__*/ s({
1473
1294
  rootClass: {
1474
1295
  type: String,
1475
1296
  required: !1
@@ -1573,7 +1394,7 @@ var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
1573
1394
  type: Function,
1574
1395
  required: !1
1575
1396
  }
1576
- }, wt),
1397
+ }, je),
1577
1398
  emits: [
1578
1399
  "click",
1579
1400
  "load",
@@ -1583,6 +1404,6 @@ var $ = /* @__PURE__ */ o((t, { emit: n, slots: a, expose: o, attrs: s }) => {
1583
1404
  inheritAttrs: !1
1584
1405
  });
1585
1406
  $.isGImage = !0, $.install = (e) => (e.component($.name, $), e);
1586
- var Et = $;
1407
+ var Ne = $;
1587
1408
  //#endregion
1588
- export { Et as GImage, bt as GImagePreview };
1409
+ export { Ne as GImage, De as GImagePreview };