ablok-components 0.3.113 → 0.3.115

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 (20) hide show
  1. package/dist/ablok-components.umd.js +2 -2
  2. package/dist/components/molecules/base-camera/base-camera.vue_vue_type_script_async_true_setup_true_lang.js +196 -197
  3. package/dist/components/molecules/dom-renderer/dom-renderer.vue_vue_type_script_setup_true_lang.js +25 -26
  4. package/dist/components/molecules/image-resize/image-resize.vue_vue_type_script_setup_true_lang.js +38 -39
  5. package/package.json +1 -1
  6. package/dist/_virtual/_rolldown/runtime.js +0 -13
  7. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_Symbol.js +0 -9
  8. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseGetTag.js +0 -15
  9. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseTrim.js +0 -13
  10. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_freeGlobal.js +0 -8
  11. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_getRawTag.js +0 -19
  12. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_objectToString.js +0 -12
  13. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_root.js +0 -10
  14. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_trimmedEndIndex.js +0 -13
  15. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/debounce.js +0 -55
  16. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isObject.js +0 -12
  17. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isObjectLike.js +0 -11
  18. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isSymbol.js +0 -14
  19. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/now.js +0 -12
  20. package/dist/node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/toNumber.js +0 -24
@@ -1,15 +1,14 @@
1
- import { __toESM as e } from "../../../_virtual/_rolldown/runtime.js";
2
- import t from "../../atoms/svg-icon/svg-icon.js";
3
- import n from "../../atoms/loading-spinner/loading-spinner.js";
4
- import { dataURItoBlob as r } from "../../../utilities/helpers.js";
5
- import i from "../input-dropdown/input-dropdown.js";
6
- import { require_debounce as a } from "../../../node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/debounce.js";
7
- import { useCameraFilter as o } from "../../../composables/useCameraFilter.js";
8
- import s from "../../atoms/zoom-slider/zoom-slider.js";
9
- import c from "../../../assets/img/guide.js";
10
- import { computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createVNode as m, defineComponent as h, nextTick as ee, normalizeClass as g, normalizeStyle as _, onBeforeUnmount as te, onMounted as ne, openBlock as v, ref as y, toDisplayString as b, vShow as re, watch as ie, withCtx as ae, withDirectives as oe, withModifiers as se } from "vue";
1
+ import e from "../../atoms/svg-icon/svg-icon.js";
2
+ import t from "../../atoms/loading-spinner/loading-spinner.js";
3
+ import { dataURItoBlob as n } from "../../../utilities/helpers.js";
4
+ import r from "../input-dropdown/input-dropdown.js";
5
+ import { useCameraFilter as i } from "../../../composables/useCameraFilter.js";
6
+ import a from "../../atoms/zoom-slider/zoom-slider.js";
7
+ import o from "../../../assets/img/guide.js";
8
+ import { computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createVNode as f, defineComponent as p, nextTick as ee, normalizeClass as m, normalizeStyle as h, onBeforeUnmount as te, onMounted as ne, openBlock as g, ref as _, toDisplayString as v, vShow as re, watch as ie, withCtx as ae, withDirectives as oe, withModifiers as se } from "vue";
9
+ import { debounce as ce } from "lodash";
11
10
  //#region src/components/molecules/base-camera/base-camera.vue?vue&type=script&async=true&setup=true&lang.ts
12
- var ce = /* @__PURE__ */ e(a(), 1), le = { class: "camera__preview" }, ue = {
11
+ var le = { class: "camera__preview" }, ue = {
13
12
  key: 0,
14
13
  class: "camera__bg-notification"
15
14
  }, de = ["innerHTML"], fe = ["width", "height"], pe = {
@@ -61,7 +60,7 @@ var ce = /* @__PURE__ */ e(a(), 1), le = { class: "camera__preview" }, ue = {
61
60
  width: 720,
62
61
  height: 1280
63
62
  }
64
- }, x = /*@__PURE__*/ h({
63
+ }, y = /*@__PURE__*/ p({
65
64
  ...De,
66
65
  props: {
67
66
  modelValue: { type: null },
@@ -83,7 +82,7 @@ var ce = /* @__PURE__ */ e(a(), 1), le = { class: "camera__preview" }, ue = {
83
82
  },
84
83
  guideSrc: {
85
84
  type: String,
86
- default: () => c
85
+ default: () => o
87
86
  },
88
87
  countdown: {
89
88
  type: Number,
@@ -140,116 +139,116 @@ var ce = /* @__PURE__ */ e(a(), 1), le = { class: "camera__preview" }, ue = {
140
139
  }
141
140
  },
142
141
  emits: ["update:modelValue"],
143
- setup(e, { expose: a, emit: c }) {
144
- let h = e, De = c, x = y(), S = y(), ke = y(!1), C = y([]), w = y(), T = y(), E = y(), D = y(!1), O = y(!1), k = y(0), A = y(0), j = y(), M = y(h.zoom || 1), Ae = y(!1), N = y(!1), P = y(null), F = y(!1), I, L, je = typeof window < "u" && "DeviceMotionEvent" in window && (window.matchMedia?.("(pointer: coarse)")?.matches || "ontouchstart" in window), Me = l(() => h.correctOrientation && je), R = l(() => ke.value && (!Me.value || F.value));
145
- function z() {
146
- L &&= (window.removeEventListener("pointerdown", L, !0), window.removeEventListener("touchend", L, !0), void 0);
142
+ setup(o, { expose: p, emit: De }) {
143
+ let y = o, ke = De, b = _(), x = _(), Ae = _(!1), S = _([]), C = _(), w = _(), T = _(), E = _(!1), D = _(!1), O = _(0), k = _(0), A = _(), j = _(y.zoom || 1), je = _(!1), M = _(!1), N = _(null), P = _(!1), F, I, Me = typeof window < "u" && "DeviceMotionEvent" in window && (window.matchMedia?.("(pointer: coarse)")?.matches || "ontouchstart" in window), Ne = s(() => y.correctOrientation && Me), L = s(() => Ae.value && (!Ne.value || P.value));
144
+ function R() {
145
+ I &&= (window.removeEventListener("pointerdown", I, !0), window.removeEventListener("touchend", I, !0), void 0);
147
146
  }
148
- function B() {
149
- F.value = !0, I &&= (clearTimeout(I), void 0), z();
147
+ function z() {
148
+ P.value = !0, F &&= (clearTimeout(F), void 0), R();
150
149
  }
151
- function Ne() {
152
- L || (L = () => {
153
- V();
154
- }, window.addEventListener("pointerdown", L, !0), window.addEventListener("touchend", L, !0));
150
+ function Pe() {
151
+ I || (I = () => {
152
+ B();
153
+ }, window.addEventListener("pointerdown", I, !0), window.addEventListener("touchend", I, !0));
155
154
  }
156
- function Pe(e) {
155
+ function Fe(e) {
157
156
  let t = e.accelerationIncludingGravity;
158
157
  if (!t || t.x == null || t.y == null) return;
159
158
  let n = Math.round(Math.atan2(t.x, t.y) * 180 / Math.PI);
160
- if (P.value = n, !(typeof screen < "u" && screen.orientation && screen.orientation.type || "portrait-primary").startsWith("portrait")) N.value = !1;
159
+ if (N.value = n, !(typeof screen < "u" && screen.orientation && screen.orientation.type || "portrait-primary").startsWith("portrait")) M.value = !1;
161
160
  else {
162
161
  let e = Math.abs(Math.abs(n) - 90);
163
- !N.value && e < 40 ? N.value = !0 : N.value && e > 50 && (N.value = !1);
162
+ !M.value && e < 40 ? M.value = !0 : M.value && e > 50 && (M.value = !1);
164
163
  }
165
- F.value || B();
164
+ P.value || z();
166
165
  }
167
- async function V() {
168
- if (!(!h.correctOrientation || Ae.value)) try {
166
+ async function B() {
167
+ if (!(!y.correctOrientation || je.value)) try {
169
168
  let e = window.DeviceOrientationEvent, t = window.DeviceMotionEvent;
170
169
  if (e && typeof e.requestPermission == "function" && await e.requestPermission() !== "granted") {
171
- B();
170
+ z();
172
171
  return;
173
172
  }
174
- t && typeof t.requestPermission == "function" && await t.requestPermission().catch(() => {}), window.addEventListener("devicemotion", Pe, !0), Ae.value = !0, z();
173
+ t && typeof t.requestPermission == "function" && await t.requestPermission().catch(() => {}), window.addEventListener("devicemotion", Fe, !0), je.value = !0, R();
175
174
  } catch (e) {
176
- console.error(e, "enableMotion: failed"), B();
175
+ console.error(e, "enableMotion: failed"), z();
177
176
  }
178
177
  }
179
- let H = l(() => ({
178
+ let V = s(() => ({
180
179
  ...Oe,
181
- ...h.resolutions
182
- })), Fe = l(() => Object.values(H.value)[0]);
183
- function Ie(e) {
180
+ ...y.resolutions
181
+ })), Ie = s(() => Object.values(V.value)[0]);
182
+ function Le(e) {
184
183
  return String(e || "").trim().toLowerCase().replace(/\s+/g, "").replace(/[:/]/g, "x");
185
184
  }
186
- let U = l(() => {
187
- if (H.value[h.ratio]) return h.ratio;
188
- let e = Ie(h.ratio);
189
- if (H.value[e]) return e;
190
- }), W = l(() => U.value ? H.value[U.value] : Fe.value), Le = l(() => {
191
- let e = U.value ? H.value[U.value] : void 0;
185
+ let H = s(() => {
186
+ if (V.value[y.ratio]) return y.ratio;
187
+ let e = Le(y.ratio);
188
+ if (V.value[e]) return e;
189
+ }), U = s(() => H.value ? V.value[H.value] : Ie.value), Re = s(() => {
190
+ let e = H.value ? V.value[H.value] : void 0;
192
191
  return e ? `${e.width} / ${e.height}` : void 0;
193
- }), G = l(() => C.value.filter((e) => e.kind === "videoinput")), Re = l(() => C.value.filter((e) => e.kind === "audioinput")), K = y([]), ze = l(() => G.value.filter((e) => !K.value.includes(e.deviceId)));
192
+ }), W = s(() => S.value.filter((e) => e.kind === "videoinput")), ze = s(() => S.value.filter((e) => e.kind === "audioinput")), G = _([]), K = s(() => W.value.filter((e) => !G.value.includes(e.deviceId)));
194
193
  function Be(e) {
195
- e && !K.value.includes(e) && (K.value = [...K.value, e]);
194
+ e && !G.value.includes(e) && (G.value = [...G.value, e]);
196
195
  }
197
196
  function Ve(e) {
198
- let t = G.value;
197
+ let t = W.value;
199
198
  if (!t.length) return;
200
199
  let n = t.findIndex((t) => t.deviceId === e);
201
200
  for (let e = 1; e <= t.length; e++) {
202
201
  let r = t[(Math.max(n, 0) + e) % t.length];
203
- if (r && !K.value.includes(r.deviceId)) return r;
202
+ if (r && !G.value.includes(r.deviceId)) return r;
204
203
  }
205
204
  }
206
- let He = l(() => ze.value.map((e, t) => ({
205
+ let He = s(() => K.value.map((e, t) => ({
207
206
  text: e.label.slice(0, e.label.indexOf("(")) || `Camera ${t + 1}`,
208
207
  value: e.deviceId
209
- }))), Ue = l({
208
+ }))), Ue = s({
210
209
  get() {
211
- return w.value && w.value.deviceId;
210
+ return C.value && C.value.deviceId;
212
211
  },
213
212
  set(e) {
214
- w.value = G.value.find((t) => t.deviceId === e), E.value = void 0;
213
+ C.value = W.value.find((t) => t.deviceId === e), T.value = void 0;
215
214
  }
216
215
  });
217
- l({
216
+ s({
218
217
  get() {
219
- return T.value && T.value.deviceId;
218
+ return w.value && w.value.deviceId;
220
219
  },
221
220
  set(e) {
222
- T.value = Re.value.find((t) => t.deviceId === e);
221
+ w.value = ze.value.find((t) => t.deviceId === e);
223
222
  }
224
223
  });
225
- let q = l(() => {
226
- let e = w.value && G.value.findIndex((e) => e.deviceId === w.value?.deviceId);
227
- return h.enableMirrorCamera && e === 0 ? "mirror-cam" : "";
228
- }), We = l(() => {
229
- let e = w.value && C.value.findIndex((e) => e.deviceId === w.value?.deviceId);
224
+ let q = s(() => {
225
+ let e = C.value && W.value.findIndex((e) => e.deviceId === C.value?.deviceId);
226
+ return y.enableMirrorCamera && e === 0 ? "mirror-cam" : "";
227
+ }), We = s(() => {
228
+ let e = C.value && S.value.findIndex((e) => e.deviceId === C.value?.deviceId);
230
229
  return q.value ? `${q.value} mirror-device-${e}` : "";
231
- }), { tintRgb: Ge, applyFilterToCanvas: Ke } = o(h);
230
+ }), { tintRgb: Ge, applyFilterToCanvas: Ke } = i(y);
232
231
  function qe() {
233
- if (U.value && W.value) {
234
- k.value = W.value.width, A.value = W.value.height;
232
+ if (H.value && U.value) {
233
+ O.value = U.value.width, k.value = U.value.height;
235
234
  return;
236
235
  }
237
- k.value = x.value.parentElement && x.value.parentElement.clientWidth, A.value = x.value.parentElement && x.value.parentElement.clientHeight;
236
+ O.value = b.value.parentElement && b.value.parentElement.clientWidth, k.value = b.value.parentElement && b.value.parentElement.clientHeight;
238
237
  }
239
- let Je = (0, ce.default)(() => {
238
+ let Je = ce(() => {
240
239
  qe();
241
240
  }, 300, {
242
241
  trailing: !0,
243
242
  leading: !1
244
243
  });
245
- function Ye(e) {
244
+ function J(e) {
246
245
  return new Promise((t) => setTimeout(t, e));
247
246
  }
248
- async function Xe() {
249
- let e = W.value ? {
250
- width: W.value.width,
251
- height: W.value.height
252
- } : void 0, t = e ? Math.max(e.width, e.height) : void 0, n = e ? Math.min(e.width, e.height) : void 0, r = h.enableAudio && { ...T.value ? { deviceId: T.value.deviceId } : {} }, i = w.value && w.value.deviceId, a = E.value, o = [];
247
+ async function Ye() {
248
+ let e = U.value ? {
249
+ width: U.value.width,
250
+ height: U.value.height
251
+ } : void 0, t = e ? Math.max(e.width, e.height) : void 0, n = e ? Math.min(e.width, e.height) : void 0, r = y.enableAudio && { ...w.value ? { deviceId: w.value.deviceId } : {} }, i = C.value && C.value.deviceId, a = T.value, o = [];
253
252
  i ? (t && n && o.push({
254
253
  deviceId: { exact: i },
255
254
  width: { ideal: t },
@@ -273,134 +272,134 @@ var ce = /* @__PURE__ */ e(a(), 1), le = { class: "camera__preview" }, ue = {
273
272
  } catch (e) {
274
273
  let t = e && e.name;
275
274
  if (t === "NotReadableError" || t === "AbortError") {
276
- await Ye(500);
275
+ await J(500);
277
276
  continue;
278
277
  }
279
278
  break;
280
279
  }
281
280
  }
282
- function J() {
283
- x.value && x.value.srcObject && (x.value.srcObject.getTracks().forEach((e) => {
281
+ function Y() {
282
+ b.value && b.value.srcObject && (b.value.srcObject.getTracks().forEach((e) => {
284
283
  e.stop();
285
- }), x.value.srcObject = null);
284
+ }), b.value.srcObject = null);
286
285
  }
287
- let Y = 0, X, Ze;
288
- function Z() {
289
- X &&= (clearTimeout(X), void 0), Ze &&= (Ze(), void 0);
286
+ let X = 0, Z, Xe;
287
+ function Q() {
288
+ Z &&= (clearTimeout(Z), void 0), Xe &&= (Xe(), void 0);
290
289
  }
291
- function Qe(e) {
290
+ function Ze(e) {
292
291
  Be(e);
293
292
  let t = Ve(e);
294
- t && t.deviceId !== e && (w.value = t);
293
+ t && t.deviceId !== e && (C.value = t);
295
294
  }
296
- function $e(e) {
297
- Z();
298
- let t = w.value && w.value.deviceId, n = x.value;
295
+ function Qe(e) {
296
+ Q();
297
+ let t = C.value && C.value.deviceId, n = b.value;
299
298
  if (!t || !n) return;
300
299
  let r = n.srcObject && n.srcObject.getVideoTracks?.()[0];
301
300
  if (!r || typeof r.addEventListener != "function" || n.videoWidth > 0) return;
302
301
  let i = () => {
303
- if (Z(), e !== Y || !x.value) return;
302
+ if (Q(), e !== X || !b.value) return;
304
303
  let n = Ve(t);
305
- n && n.deviceId !== t && (J(), Qe(t));
304
+ n && n.deviceId !== t && (Y(), Ze(t));
306
305
  }, a = () => {
307
- e === Y && x.value && x.value.videoWidth > 0 && Z();
306
+ e === X && b.value && b.value.videoWidth > 0 && Q();
308
307
  }, o = () => {
309
308
  i();
310
309
  };
311
- r.addEventListener("unmute", a), r.addEventListener("ended", o), Ze = () => {
310
+ r.addEventListener("unmute", a), r.addEventListener("ended", o), Xe = () => {
312
311
  r.removeEventListener("unmute", a), r.removeEventListener("ended", o);
313
- }, X = setTimeout(() => {
314
- X = void 0, !(e !== Y || !x.value) && (x.value.videoWidth === 0 ? i() : Z());
312
+ }, Z = setTimeout(() => {
313
+ Z = void 0, !(e !== X || !b.value) && (b.value.videoWidth === 0 ? i() : Q());
315
314
  }, 8e3);
316
315
  }
317
- let et = 0;
318
- async function Q() {
319
- let e = ++Y;
320
- Z();
321
- let t = !!(x.value && x.value.srcObject);
322
- if (J(), t && (await Ye(350), e !== Y)) return;
323
- let n = await Xe();
324
- if (e !== Y) {
316
+ let $e = 0;
317
+ async function $() {
318
+ let e = ++X;
319
+ Q();
320
+ let t = !!(b.value && b.value.srcObject);
321
+ if (Y(), t && (await J(350), e !== X)) return;
322
+ let n = await Ye();
323
+ if (e !== X) {
325
324
  n?.getTracks?.().forEach((e) => e.stop());
326
325
  return;
327
326
  }
328
- if (n && x.value) {
329
- et = 0, x.value.srcObject = n, x.value.muted = !0;
327
+ if (n && b.value) {
328
+ $e = 0, b.value.srcObject = n, b.value.muted = !0;
330
329
  try {
331
- await x.value.play?.();
330
+ await b.value.play?.();
332
331
  } catch {}
333
- $e(e);
334
- } else if (!n && w.value) {
335
- et < 2 && (et++, await Ye(600), e === Y && await Q());
332
+ Qe(e);
333
+ } else if (!n && C.value) {
334
+ $e < 2 && ($e++, await J(600), e === X && await $());
336
335
  return;
337
336
  }
338
- return C.value = await navigator.mediaDevices.enumerateDevices(), {
339
- stream: x.value && x.value.srcObject,
340
- devices: C.value
337
+ return S.value = await navigator.mediaDevices.enumerateDevices(), {
338
+ stream: b.value && b.value.srcObject,
339
+ devices: S.value
341
340
  };
342
341
  }
343
- function tt() {
344
- D.value ? (D.value = !1, O.value = !1, J()) : (D.value = !0, Q());
342
+ function et() {
343
+ E.value ? (E.value = !1, D.value = !1, Y()) : (E.value = !0, $());
345
344
  }
346
- function nt() {
347
- w.value = void 0, E.value = E.value === "user" ? "environment" : "user", Q();
345
+ function tt() {
346
+ C.value = void 0, T.value = T.value === "user" ? "environment" : "user", $();
348
347
  }
349
- async function rt(e, t) {
350
- e && (!t || e.deviceId !== t.deviceId) && await Q();
348
+ async function nt(e, t) {
349
+ e && (!t || e.deviceId !== t.deviceId) && await $();
351
350
  }
352
- ie(() => w.value, rt), ie(() => T.value, rt);
353
- function $() {
354
- h.countdown ? (j.value = j.value ? j.value - 1 : h.countdown, j.value ? setTimeout($, 1e3) : ot()) : ot();
351
+ ie(() => C.value, nt), ie(() => w.value, nt);
352
+ function rt() {
353
+ y.countdown ? (A.value = A.value ? A.value - 1 : y.countdown, A.value ? setTimeout(rt, 1e3) : ot()) : ot();
355
354
  }
356
- a({
357
- onCapture: $,
358
- enableMotion: V,
359
- camera: x.value,
360
- zoom: M
355
+ p({
356
+ onCapture: rt,
357
+ enableMotion: B,
358
+ camera: b.value,
359
+ zoom: j
361
360
  });
362
361
  function it() {
363
- if (!h.correctOrientation || P.value == null) return 0;
364
- let e = ((P.value - 180) % 360 + 360) % 360;
362
+ if (!y.correctOrientation || N.value == null) return 0;
363
+ let e = ((N.value - 180) % 360 + 360) % 360;
365
364
  return (-1 * (Math.round(e / 90) * 90 % 360) % 360 + 360) % 360;
366
365
  }
367
366
  function at(e, t, n, r, i) {
368
- let a = S.value.width, o = S.value.height;
367
+ let a = x.value.width, o = x.value.height;
369
368
  e.translate(a / 2, o / 2), q.value && e.scale(-1, 1), e.rotate(n * Math.PI / 180);
370
- let s = o, c = a, l = Math.max(s / r, c / i) * (M.value && M.value > 0 ? M.value : 1), u = r * l, d = i * l;
369
+ let s = o, c = a, l = Math.max(s / r, c / i) * (j.value && j.value > 0 ? j.value : 1), u = r * l, d = i * l;
371
370
  e.drawImage(t, -u / 2, -d / 2, u, d);
372
371
  }
373
372
  function ot() {
374
- O.value = !0;
375
- let e = S.value.getContext("2d"), t = x.value, n = t && t.srcObject && t.srcObject.getTracks(), { aspectRatio: r, width: i, height: a } = n.length && n[0].getSettings(), o = t?.videoWidth || i || k.value, s = t?.videoHeight || a || A.value, c = o && s ? o / s : r, l = W.value || {
373
+ D.value = !0;
374
+ let e = x.value.getContext("2d"), t = b.value, n = t && t.srcObject && t.srcObject.getTracks(), { aspectRatio: r, width: i, height: a } = n.length && n[0].getSettings(), o = t?.videoWidth || i || O.value, s = t?.videoHeight || a || k.value, c = o && s ? o / s : r, l = U.value || {
376
375
  width: o,
377
376
  height: s
378
- }, u = l?.width || o, d = U.value ? l?.height || s : Math.round(u / c), f = u / d;
379
- if (S.value.width = u, S.value.height = d, !o || !s || !c) return;
377
+ }, u = l?.width || o, d = H.value ? l?.height || s : Math.round(u / c), f = u / d;
378
+ if (x.value.width = u, x.value.height = d, !o || !s || !c) return;
380
379
  let p = it();
381
380
  if (e.save(), p === 90 || p === 270) {
382
- at(e, t, p, o, s), e.restore(), Ke(e, S.value.width, S.value.height), st(S.value.toDataURL("image/png"));
381
+ at(e, t, p, o, s), e.restore(), Ke(e, x.value.width, x.value.height), st(x.value.toDataURL("image/png"));
383
382
  return;
384
383
  }
385
- if (p === 180 && (e.translate(S.value.width, S.value.height), e.scale(-1, -1)), q.value && (e.translate(S.value.width, 0), e.scale(-1, 1)), h.enableCropImage) {
384
+ if (p === 180 && (e.translate(x.value.width, x.value.height), e.scale(-1, -1)), q.value && (e.translate(x.value.width, 0), e.scale(-1, 1)), y.enableCropImage) {
386
385
  let n = 0, r = 0, i = o, a = s;
387
- if (c > f ? (i = s * f, n = (o - i) / 2) : c < f && (a = o / f, r = (s - a) / 2), M.value && M.value !== 1) {
388
- let e = i / M.value, t = a / M.value;
386
+ if (c > f ? (i = s * f, n = (o - i) / 2) : c < f && (a = o / f, r = (s - a) / 2), j.value && j.value !== 1) {
387
+ let e = i / j.value, t = a / j.value;
389
388
  n += (i - e) / 2, r += (a - t) / 2, i = e, a = t;
390
389
  }
391
- e.drawImage(t, n, r, i, a, 0, 0, S.value.width, S.value.height);
390
+ e.drawImage(t, n, r, i, a, 0, 0, x.value.width, x.value.height);
392
391
  } else {
393
- let n = S.value.width, r = S.value.height, i = 0, a = 0;
394
- if (c > f ? (r = S.value.width / c, a = (S.value.height - r) / 2) : c < f && (n = S.value.height * c, i = (S.value.width - n) / 2), M.value && M.value !== 1) {
395
- let c = o / M.value, l = s / M.value, u = (o - c) / 2, d = (s - l) / 2;
396
- q.value && (i = S.value.width - i - n), e.drawImage(t, u, d, c, l, i, a, n, r);
397
- } else q.value && (i = S.value.width - i - n), e.drawImage(t, 0, 0, o, s, i, a, n, r);
392
+ let n = x.value.width, r = x.value.height, i = 0, a = 0;
393
+ if (c > f ? (r = x.value.width / c, a = (x.value.height - r) / 2) : c < f && (n = x.value.height * c, i = (x.value.width - n) / 2), j.value && j.value !== 1) {
394
+ let c = o / j.value, l = s / j.value, u = (o - c) / 2, d = (s - l) / 2;
395
+ q.value && (i = x.value.width - i - n), e.drawImage(t, u, d, c, l, i, a, n, r);
396
+ } else q.value && (i = x.value.width - i - n), e.drawImage(t, 0, 0, o, s, i, a, n, r);
398
397
  }
399
- e.restore(), Ke(e, S.value.width, S.value.height), st(S.value.toDataURL("image/png"));
398
+ e.restore(), Ke(e, x.value.width, x.value.height), st(x.value.toDataURL("image/png"));
400
399
  }
401
400
  function st(e) {
402
- let t = r(e);
403
- De("update:modelValue", {
401
+ let t = n(e);
402
+ ke("update:modelValue", {
404
403
  name: `cam-pic-${(/* @__PURE__ */ new Date()).toISOString()}`,
405
404
  id: `cam-pic-${(/* @__PURE__ */ new Date()).toISOString()}`,
406
405
  blob: t,
@@ -408,98 +407,98 @@ var ce = /* @__PURE__ */ e(a(), 1), le = { class: "camera__preview" }, ue = {
408
407
  });
409
408
  }
410
409
  return ne(async () => {
411
- await Q(), D.value = !0, E.value = h.defaultRearCamera ? "environment" : "user";
412
- let e = h.defaultRearCamera && G.value.length > 1 ? G.value[G.value.length - 1] : G.value[0];
413
- if (w.value = e, h.enableAudio && (T.value = Re.value[0]), navigator.mediaDevices.addEventListener("devicechange", async (e) => {
414
- await Q();
415
- }), window.addEventListener("resize", Je), qe(), Me.value) {
416
- I = setTimeout(B, 3e3);
410
+ await $(), E.value = !0, T.value = y.defaultRearCamera ? "environment" : "user";
411
+ let e = y.defaultRearCamera && W.value.length > 1 ? W.value[W.value.length - 1] : W.value[0];
412
+ if (C.value = e, y.enableAudio && (w.value = ze.value[0]), navigator.mediaDevices.addEventListener("devicechange", async (e) => {
413
+ await $();
414
+ }), window.addEventListener("resize", Je), qe(), Ne.value) {
415
+ F = setTimeout(z, 3e3);
417
416
  let e = window.DeviceOrientationEvent;
418
- e && typeof e.requestPermission == "function" ? Ne() : V();
417
+ e && typeof e.requestPermission == "function" ? Pe() : B();
419
418
  }
420
- await ee(), ke.value = !0;
419
+ await ee(), Ae.value = !0;
421
420
  }), te(() => {
422
- D.value = !1, O.value = !1, Z(), J(), window.removeEventListener("resize", Je), window.removeEventListener("devicemotion", Pe, !0), I && clearTimeout(I), z();
423
- }), (r, a) => (v(), f("div", { class: g(["camera", We.value]) }, [
424
- p("div", le, [
425
- R.value ? d("", !0) : (v(), f("div", ue, [m(n, { color: "#000" }, {
426
- default: ae(() => [p("span", {
427
- class: g("d-block text-center"),
428
- innerHTML: r.$t("camera.waitForCameraNotification")
421
+ E.value = !1, D.value = !1, Q(), Y(), window.removeEventListener("resize", Je), window.removeEventListener("devicemotion", Fe, !0), F && clearTimeout(F), R();
422
+ }), (n, i) => (g(), u("div", { class: m(["camera", We.value]) }, [
423
+ d("div", le, [
424
+ L.value ? l("", !0) : (g(), u("div", ue, [f(t, { color: "#000" }, {
425
+ default: ae(() => [d("span", {
426
+ class: m("d-block text-center"),
427
+ innerHTML: n.$t("camera.waitForCameraNotification")
429
428
  }, null, 8, de)]),
430
429
  _: 1
431
430
  })])),
432
- oe(p("div", {
433
- class: g(["camera__video-wrapper", U.value ? `aspect-ratio--${U.value}` : ""]),
434
- style: _({
435
- aspectRatio: Le.value || void 0,
436
- transform: M.value === 1 ? void 0 : `scale(${M.value})`
431
+ oe(d("div", {
432
+ class: m(["camera__video-wrapper", H.value ? `aspect-ratio--${H.value}` : ""]),
433
+ style: h({
434
+ aspectRatio: Re.value || void 0,
435
+ transform: j.value === 1 ? void 0 : `scale(${j.value})`
437
436
  })
438
- }, [p("video", {
437
+ }, [d("video", {
439
438
  ref_key: "camera",
440
- ref: x,
439
+ ref: b,
441
440
  class: "camera__video",
442
- style: _({
443
- filter: h.filter === "grayscale" ? "grayscale(100%)" : h.filter === "sepia" ? "sepia(100%)" : "none",
444
- transform: e.correctOrientation && N.value ? "rotate(180deg)" : void 0
441
+ style: h({
442
+ filter: y.filter === "grayscale" ? "grayscale(100%)" : y.filter === "sepia" ? "sepia(100%)" : "none",
443
+ transform: o.correctOrientation && M.value ? "rotate(180deg)" : void 0
445
444
  }),
446
445
  autoplay: "",
447
446
  muted: "",
448
447
  playsinline: ""
449
- }, null, 4), e.tintColor ? (v(), f("div", {
448
+ }, null, 4), o.tintColor ? (g(), u("div", {
450
449
  key: 0,
451
450
  class: "camera__tint-overlay",
452
- style: _({
453
- backgroundColor: e.tintColor,
454
- opacity: e.tintIntensity,
451
+ style: h({
452
+ backgroundColor: o.tintColor,
453
+ opacity: o.tintIntensity,
455
454
  mixBlendMode: "multiply"
456
455
  })
457
- }, null, 4)) : d("", !0)], 6), [[re, R.value]]),
458
- oe(p("canvas", {
456
+ }, null, 4)) : l("", !0)], 6), [[re, L.value]]),
457
+ oe(d("canvas", {
459
458
  ref_key: "canvas",
460
- ref: S,
459
+ ref: x,
461
460
  class: "camera__canvas",
462
- width: k.value,
463
- height: A.value
464
- }, null, 8, fe), [[re, O.value]]),
465
- j.value ? (v(), f("div", pe, [(v(), f("p", {
461
+ width: O.value,
462
+ height: k.value
463
+ }, null, 8, fe), [[re, D.value]]),
464
+ A.value ? (g(), u("div", pe, [(g(), u("p", {
466
465
  class: "countdown",
467
- key: j.value,
468
- innerHTML: j.value,
469
- "data-countdown": j.value
470
- }, null, 8, me))])) : d("", !0),
471
- e.enableGuide && D.value && R.value ? (v(), f("img", {
466
+ key: A.value,
467
+ innerHTML: A.value,
468
+ "data-countdown": A.value
469
+ }, null, 8, me))])) : l("", !0),
470
+ o.enableGuide && E.value && L.value ? (g(), u("img", {
472
471
  key: 2,
473
472
  class: "camera__guide",
474
- src: e.guideSrc
475
- }, null, 8, he)) : d("", !0),
476
- e.enableZoomSlider ? (v(), f("div", ge, [m(s, {
477
- modelValue: M.value,
478
- "onUpdate:modelValue": a[0] ||= (e) => M.value = e
479
- }, null, 8, ["modelValue"])])) : d("", !0)
473
+ src: o.guideSrc
474
+ }, null, 8, he)) : l("", !0),
475
+ o.enableZoomSlider ? (g(), u("div", ge, [f(a, {
476
+ modelValue: j.value,
477
+ "onUpdate:modelValue": i[0] ||= (e) => j.value = e
478
+ }, null, 8, ["modelValue"])])) : l("", !0)
480
479
  ]),
481
- p("div", _e, [p("div", ve, [p("div", ye, [p("div", be, [p("div", xe, [p("button", {
480
+ d("div", _e, [d("div", ve, [d("div", ye, [d("div", be, [d("div", xe, [d("button", {
482
481
  type: "button",
483
482
  class: "camera__toggle btn btn-primary",
484
- onClick: tt
485
- }, [D.value ? (v(), f("span", Ce, b(r.$t("common.pause")), 1)) : (v(), f("span", Se, b(r.$t("common.play")), 1))]), p("button", {
483
+ onClick: et
484
+ }, [E.value ? (g(), u("span", Ce, v(n.$t("common.pause")), 1)) : (g(), u("span", Se, v(n.$t("common.play")), 1))]), d("button", {
486
485
  type: "button",
487
486
  class: "camera__capture btn btn-primary",
488
- onClick: $
489
- }, b(r.$t("camera.capture")), 1)])])])])]),
490
- (e.enableSwitchCamera || e.enableSelectDevice) && ze.value && ze.value.length > 1 ? (v(), f("div", we, [p("div", Te, [e.enableSelectDevice ? (v(), u(i, {
487
+ onClick: rt
488
+ }, v(n.$t("camera.capture")), 1)])])])])]),
489
+ (o.enableSwitchCamera || o.enableSelectDevice) && K.value && K.value.length > 1 ? (g(), u("div", we, [d("div", Te, [o.enableSelectDevice ? (g(), c(r, {
491
490
  key: 0,
492
491
  modelValue: Ue.value,
493
- "onUpdate:modelValue": a[1] ||= (e) => Ue.value = e,
492
+ "onUpdate:modelValue": i[1] ||= (e) => Ue.value = e,
494
493
  options: He.value,
495
494
  class: "w-100"
496
- }, null, 8, ["modelValue", "options"])) : d("", !0)]), p("div", Ee, [e.enableSwitchCamera ? (v(), f("button", {
495
+ }, null, 8, ["modelValue", "options"])) : l("", !0)]), d("div", Ee, [o.enableSwitchCamera ? (g(), u("button", {
497
496
  key: 0,
498
497
  class: "btn",
499
- onClick: se(nt, ["prevent"])
500
- }, [m(t, { symbol: "switch-camera" })])) : d("", !0)])])) : d("", !0)
498
+ onClick: se(tt, ["prevent"])
499
+ }, [f(e, { symbol: "switch-camera" })])) : l("", !0)])])) : l("", !0)
501
500
  ], 2));
502
501
  }
503
502
  });
504
503
  //#endregion
505
- export { x as default };
504
+ export { y as default };