ablok-components 0.3.74 → 0.3.75
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,32 +1,32 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { debounce as
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as Pe, ref as r, computed as v, watch as ye, onMounted as We, nextTick as je, onBeforeUnmount as Ae, openBlock as g, createElementBlock as w, normalizeClass as ae, createElementVNode as h, createVNode as ie, withCtx as Fe, createCommentVNode as O, withDirectives as be, normalizeStyle as oe, vShow as _e, toDisplayString as ne, createBlock as Ne, withModifiers as qe } from "vue";
|
|
2
|
+
import { debounce as Ze } from "lodash";
|
|
3
|
+
import Ke from "../../atoms/loading-spinner/loading-spinner.vue.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import
|
|
5
|
+
import Je from "../../atoms/svg-icon/svg-icon.vue.js";
|
|
6
6
|
/* empty css */
|
|
7
|
-
import
|
|
7
|
+
import Qe from "../input-dropdown/input-dropdown.vue.js";
|
|
8
8
|
/* empty css */
|
|
9
|
-
import { dataURItoBlob as
|
|
10
|
-
import { useCameraFilter as
|
|
11
|
-
import
|
|
9
|
+
import { dataURItoBlob as Xe } from "../../../utilities/helpers.js";
|
|
10
|
+
import { useCameraFilter as Ye } from "../../../composables/useCameraFilter.js";
|
|
11
|
+
import et from "../../atoms/zoom-slider/zoom-slider.vue.js";
|
|
12
12
|
/* empty css */
|
|
13
|
-
import
|
|
14
|
-
const
|
|
13
|
+
import tt from "../../../assets/img/guide.png.js";
|
|
14
|
+
const at = { class: "camera__preview" }, it = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "camera__bg-notification"
|
|
17
|
-
},
|
|
17
|
+
}, ot = ["innerHTML"], nt = ["width", "height"], lt = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "camera__countdown-overlay"
|
|
20
|
-
},
|
|
20
|
+
}, rt = ["innerHTML", "data-countdown"], st = ["src"], ct = {
|
|
21
21
|
key: 3,
|
|
22
22
|
class: "camera__zoom-slider"
|
|
23
|
-
}, ut = { class: "camera__controls" },
|
|
23
|
+
}, ut = { class: "camera__controls" }, dt = { class: "container" }, vt = { class: "row" }, ht = { class: "col" }, mt = { class: "btn-group" }, ft = { key: 0 }, gt = { key: 1 }, wt = {
|
|
24
24
|
key: 0,
|
|
25
25
|
class: "camera__select-device"
|
|
26
|
-
},
|
|
26
|
+
}, pt = { class: "col" }, yt = { class: "" }, bt = {
|
|
27
27
|
name: "BaseCamera",
|
|
28
28
|
inheritAttrs: !1
|
|
29
|
-
},
|
|
29
|
+
}, Ce = {
|
|
30
30
|
"1x1": { width: 720, height: 720 },
|
|
31
31
|
"2x3": { width: 720, height: 1080 },
|
|
32
32
|
"3x2": { width: 1080, height: 720 },
|
|
@@ -36,8 +36,8 @@ const tt = { class: "camera__preview" }, at = {
|
|
|
36
36
|
"5x4": { width: 1200, height: 960 },
|
|
37
37
|
"16x9": { width: 1280, height: 720 },
|
|
38
38
|
"9x16": { width: 720, height: 1280 }
|
|
39
|
-
},
|
|
40
|
-
...
|
|
39
|
+
}, $t = /* @__PURE__ */ Pe({
|
|
40
|
+
...bt,
|
|
41
41
|
props: {
|
|
42
42
|
modelValue: {
|
|
43
43
|
type: null
|
|
@@ -60,7 +60,7 @@ const tt = { class: "camera__preview" }, at = {
|
|
|
60
60
|
},
|
|
61
61
|
guideSrc: {
|
|
62
62
|
type: String,
|
|
63
|
-
default: () =>
|
|
63
|
+
default: () => tt
|
|
64
64
|
},
|
|
65
65
|
countdown: {
|
|
66
66
|
type: Number,
|
|
@@ -73,7 +73,7 @@ const tt = { class: "camera__preview" }, at = {
|
|
|
73
73
|
filter: {
|
|
74
74
|
type: String,
|
|
75
75
|
default: "none",
|
|
76
|
-
validator: (
|
|
76
|
+
validator: (c) => ["none", "grayscale", "sepia"].includes(c)
|
|
77
77
|
},
|
|
78
78
|
tintColor: {
|
|
79
79
|
type: String,
|
|
@@ -97,7 +97,7 @@ const tt = { class: "camera__preview" }, at = {
|
|
|
97
97
|
},
|
|
98
98
|
resolutions: {
|
|
99
99
|
type: Object,
|
|
100
|
-
default: () =>
|
|
100
|
+
default: () => Ce
|
|
101
101
|
},
|
|
102
102
|
zoom: {
|
|
103
103
|
type: Number,
|
|
@@ -113,211 +113,225 @@ const tt = { class: "camera__preview" }, at = {
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
emits: ["update:modelValue"],
|
|
116
|
-
setup(
|
|
117
|
-
const i =
|
|
118
|
-
let
|
|
119
|
-
const
|
|
120
|
-
function
|
|
121
|
-
|
|
116
|
+
setup(c, { expose: ke, emit: Se }) {
|
|
117
|
+
const i = c, De = Se, s = r(), a = r(), le = r(!1), V = r([]), m = r(), x = r(), R = r(!1), W = r(!1), j = r(0), A = r(0), C = r(), l = r(i.zoom || 1), re = r(!1), z = r(!1), Z = r(null), K = r(!1);
|
|
118
|
+
let L, k;
|
|
119
|
+
const Ie = typeof window < "u" && "DeviceMotionEvent" in window && (window.matchMedia?.("(pointer: coarse)")?.matches || "ontouchstart" in window), se = v(() => i.correctOrientation && Ie), J = v(() => le.value && (!se.value || K.value));
|
|
120
|
+
function Q() {
|
|
121
|
+
k && (window.removeEventListener("pointerdown", k, !0), window.removeEventListener("touchend", k, !0), k = void 0);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
123
|
+
function F() {
|
|
124
|
+
K.value = !0, L && (clearTimeout(L), L = void 0), Q();
|
|
125
125
|
}
|
|
126
126
|
function Ee() {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}, window.addEventListener("pointerdown",
|
|
127
|
+
k || (k = () => {
|
|
128
|
+
X();
|
|
129
|
+
}, window.addEventListener("pointerdown", k, !0), window.addEventListener("touchend", k, !0));
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function ce(e) {
|
|
132
132
|
const t = e.accelerationIncludingGravity;
|
|
133
133
|
if (!t || t.x == null || t.y == null) return;
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
136
|
-
|
|
134
|
+
const o = Math.round(Math.atan2(t.x, t.y) * 180 / Math.PI);
|
|
135
|
+
if (Z.value = o, !(typeof screen < "u" && screen.orientation && screen.orientation.type || "portrait-primary").startsWith("portrait"))
|
|
136
|
+
z.value = !1;
|
|
137
137
|
else {
|
|
138
|
-
const
|
|
139
|
-
!
|
|
138
|
+
const E = Math.abs(Math.abs(o) - 90);
|
|
139
|
+
!z.value && E < 40 ? z.value = !0 : z.value && E > 50 && (z.value = !1);
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
K.value || F();
|
|
142
142
|
}
|
|
143
|
-
async function
|
|
143
|
+
async function X() {
|
|
144
144
|
if (!(!i.correctOrientation || re.value))
|
|
145
145
|
try {
|
|
146
146
|
const e = window.DeviceOrientationEvent, t = window.DeviceMotionEvent;
|
|
147
147
|
if (e && typeof e.requestPermission == "function" && await e.requestPermission() !== "granted") {
|
|
148
|
-
|
|
148
|
+
F();
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
151
|
t && typeof t.requestPermission == "function" && await t.requestPermission().catch(() => {
|
|
152
|
-
}), window.addEventListener("devicemotion",
|
|
152
|
+
}), window.addEventListener("devicemotion", ce, !0), re.value = !0, Q();
|
|
153
153
|
} catch (e) {
|
|
154
|
-
console.error(e, "enableMotion: failed"),
|
|
154
|
+
console.error(e, "enableMotion: failed"), F();
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
const
|
|
158
|
-
function
|
|
157
|
+
const H = v(() => ({ ...Ce, ...i.resolutions })), Me = v(() => Object.values(H.value)[0]);
|
|
158
|
+
function Oe(e) {
|
|
159
159
|
return String(e || "").trim().toLowerCase().replace(/\s+/g, "").replace(/[:/]/g, "x");
|
|
160
160
|
}
|
|
161
|
-
const
|
|
162
|
-
if (
|
|
161
|
+
const S = v(() => {
|
|
162
|
+
if (H.value[i.ratio])
|
|
163
163
|
return i.ratio;
|
|
164
|
-
const e =
|
|
165
|
-
if (
|
|
164
|
+
const e = Oe(i.ratio);
|
|
165
|
+
if (H.value[e])
|
|
166
166
|
return e;
|
|
167
|
-
}),
|
|
168
|
-
const e =
|
|
167
|
+
}), T = v(() => S.value ? H.value[S.value] : Me.value), xe = v(() => {
|
|
168
|
+
const e = S.value ? H.value[S.value] : void 0;
|
|
169
169
|
return e ? `${e.width} / ${e.height}` : void 0;
|
|
170
|
-
}),
|
|
170
|
+
}), f = v(() => V.value.filter((e) => e.kind === "videoinput")), ue = v(() => V.value.filter((e) => e.kind === "audioinput")), Re = v(() => f.value.map((e, t) => ({
|
|
171
171
|
text: e.label.slice(0, e.label.indexOf("(")) || `Camera ${t + 1}`,
|
|
172
172
|
value: e.deviceId
|
|
173
|
-
}))), de =
|
|
173
|
+
}))), de = v({
|
|
174
174
|
get() {
|
|
175
|
-
return
|
|
175
|
+
return m.value && m.value.deviceId;
|
|
176
176
|
},
|
|
177
177
|
set(e) {
|
|
178
|
-
|
|
178
|
+
m.value = f.value.find((t) => t.deviceId === e);
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
|
-
|
|
181
|
+
v({
|
|
182
182
|
get() {
|
|
183
|
-
return
|
|
183
|
+
return x.value && x.value.deviceId;
|
|
184
184
|
},
|
|
185
185
|
set(e) {
|
|
186
|
-
|
|
186
|
+
x.value = ue.value.find((t) => t.deviceId === e);
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
|
-
const
|
|
190
|
-
const e =
|
|
189
|
+
const $ = v(() => {
|
|
190
|
+
const e = m.value && f.value.findIndex((t) => t.deviceId === m.value.deviceId);
|
|
191
191
|
return i.enableMirrorCamera && e === 0 ? "mirror-cam" : "";
|
|
192
|
-
}),
|
|
193
|
-
const e =
|
|
194
|
-
return
|
|
195
|
-
}), { tintRgb:
|
|
192
|
+
}), Te = v(() => {
|
|
193
|
+
const e = m.value && V.value.findIndex((t) => t.deviceId === m.value.deviceId);
|
|
194
|
+
return $.value ? `${$.value} mirror-device-${e}` : "";
|
|
195
|
+
}), { tintRgb: _t, applyFilterToCanvas: ve } = Ye(i);
|
|
196
196
|
function he() {
|
|
197
|
-
if (
|
|
198
|
-
|
|
197
|
+
if (S.value && T.value) {
|
|
198
|
+
j.value = T.value.width, A.value = T.value.height;
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
|
|
201
|
+
j.value = s.value.parentElement && s.value.parentElement.clientWidth, A.value = s.value.parentElement && s.value.parentElement.clientHeight;
|
|
202
202
|
}
|
|
203
|
-
const me =
|
|
203
|
+
const me = Ze(() => {
|
|
204
204
|
he();
|
|
205
205
|
}, 300, { trailing: !0, leading: !1 });
|
|
206
|
-
async function
|
|
207
|
-
const e =
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
// audio: false,
|
|
213
|
-
video: {
|
|
214
|
-
...h.value ? { deviceId: h.value.deviceId } : {},
|
|
215
|
-
...t ? { width: { ideal: t } } : {},
|
|
216
|
-
...l ? { height: { ideal: l } } : {}
|
|
217
|
-
}
|
|
206
|
+
async function ze() {
|
|
207
|
+
const e = T.value ? { width: T.value.width, height: T.value.height } : void 0, t = e ? Math.max(e.width, e.height) : void 0, o = e ? Math.min(e.width, e.height) : void 0, D = i.enableAudio && {
|
|
208
|
+
...x.value ? { deviceId: x.value.deviceId } : {}
|
|
209
|
+
// deviceId: activeAudioDevice.value ? { exact: activeAudioDevice.value } : undefined
|
|
210
|
+
}, I = {
|
|
211
|
+
...m.value ? { deviceId: { exact: m.value.deviceId } } : {}
|
|
218
212
|
};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
213
|
+
try {
|
|
214
|
+
return await navigator.mediaDevices.getUserMedia({
|
|
215
|
+
audio: D,
|
|
216
|
+
video: {
|
|
217
|
+
...I,
|
|
218
|
+
...t ? { width: { ideal: t } } : {},
|
|
219
|
+
...o ? { height: { ideal: o } } : {}
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
} catch {
|
|
223
|
+
try {
|
|
224
|
+
return await navigator.mediaDevices.getUserMedia({ audio: D, video: I });
|
|
225
|
+
} catch (n) {
|
|
226
|
+
console.error(n, "navigator.mediaDevices.getUserMedia: failed");
|
|
227
|
+
}
|
|
228
|
+
}
|
|
222
229
|
}
|
|
223
|
-
function
|
|
224
|
-
|
|
230
|
+
function Y() {
|
|
231
|
+
s.value && s.value.srcObject && (s.value.srcObject.getTracks().forEach((t) => {
|
|
225
232
|
t.stop();
|
|
226
|
-
});
|
|
233
|
+
}), s.value.srcObject = null);
|
|
227
234
|
}
|
|
228
|
-
|
|
229
|
-
|
|
235
|
+
let fe = 0;
|
|
236
|
+
async function N() {
|
|
237
|
+
const e = ++fe;
|
|
238
|
+
Y();
|
|
239
|
+
const t = await ze();
|
|
240
|
+
if (e !== fe) {
|
|
241
|
+
t?.getTracks?.().forEach((o) => o.stop());
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
return t && s.value && (s.value.srcObject = t), V.value = await navigator.mediaDevices.enumerateDevices(), { stream: s.value && s.value.srcObject, devices: V.value };
|
|
230
245
|
}
|
|
231
|
-
function
|
|
232
|
-
|
|
246
|
+
function Le() {
|
|
247
|
+
R.value ? (R.value = !1, W.value = !1, Y()) : (R.value = !0, N());
|
|
233
248
|
}
|
|
234
|
-
function
|
|
235
|
-
if (
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
h.value = b.value[e === b.value.length - 1 ? 0 : e + 1], G();
|
|
249
|
+
function $e() {
|
|
250
|
+
if (f.value.length > 1) {
|
|
251
|
+
const e = f.value.findIndex((t) => t.deviceId === m.value?.deviceId);
|
|
252
|
+
m.value = f.value[e === f.value.length - 1 ? 0 : e + 1];
|
|
239
253
|
}
|
|
240
254
|
}
|
|
241
|
-
async function
|
|
242
|
-
|
|
255
|
+
async function ge(e, t) {
|
|
256
|
+
e && (!t || e.deviceId !== t.deviceId) && await N();
|
|
243
257
|
}
|
|
244
|
-
|
|
258
|
+
ye(() => m.value, ge), ye(() => x.value, ge);
|
|
245
259
|
function ee() {
|
|
246
|
-
i.countdown ? (C.value = C.value ? C.value - 1 : i.countdown, C.value ? setTimeout(ee, 1e3) :
|
|
260
|
+
i.countdown ? (C.value = C.value ? C.value - 1 : i.countdown, C.value ? setTimeout(ee, 1e3) : we()) : we();
|
|
247
261
|
}
|
|
248
|
-
|
|
249
|
-
function
|
|
250
|
-
if (!i.correctOrientation ||
|
|
251
|
-
const e = ((
|
|
262
|
+
ke({ onCapture: ee, enableMotion: X, camera: s.value, zoom: l });
|
|
263
|
+
function Be() {
|
|
264
|
+
if (!i.correctOrientation || Z.value == null) return 0;
|
|
265
|
+
const e = ((Z.value - 180) % 360 + 360) % 360;
|
|
252
266
|
return (-1 * (Math.round(e / 90) * 90 % 360) % 360 + 360) % 360;
|
|
253
267
|
}
|
|
254
|
-
function
|
|
255
|
-
const
|
|
256
|
-
e.translate(
|
|
257
|
-
const u =
|
|
258
|
-
e.drawImage(t, -
|
|
268
|
+
function Ve(e, t, o, D, I) {
|
|
269
|
+
const E = a.value.width, n = a.value.height;
|
|
270
|
+
e.translate(E / 2, n / 2), $.value && e.scale(-1, 1), e.rotate(o * Math.PI / 180);
|
|
271
|
+
const u = n, p = E, B = Math.max(u / D, p / I) * (l.value && l.value > 0 ? l.value : 1), U = D * B, _ = I * B;
|
|
272
|
+
e.drawImage(t, -U / 2, -_ / 2, U, _);
|
|
259
273
|
}
|
|
260
|
-
function
|
|
261
|
-
|
|
262
|
-
const e = a.value.getContext("2d"), t =
|
|
263
|
-
if (a.value.width =
|
|
274
|
+
function we() {
|
|
275
|
+
W.value = !0;
|
|
276
|
+
const e = a.value.getContext("2d"), t = s.value, o = t && t.srcObject && t.srcObject.getTracks(), { aspectRatio: D, width: I, height: E } = o.length && o[0].getSettings(), n = t?.videoWidth || I || j.value, u = t?.videoHeight || E || A.value, p = n && u ? n / u : D, te = T.value || { width: n, height: u }, B = te?.width || n, U = S.value ? te?.height || u : Math.round(B / p), _ = B / U;
|
|
277
|
+
if (a.value.width = B, a.value.height = U, !n || !u || !p)
|
|
264
278
|
return;
|
|
265
|
-
const
|
|
266
|
-
if (e.save(),
|
|
267
|
-
|
|
279
|
+
const q = Be();
|
|
280
|
+
if (e.save(), q === 90 || q === 270) {
|
|
281
|
+
Ve(e, t, q, n, u), e.restore(), ve(e, a.value.width, a.value.height), pe(a.value.toDataURL("image/png"));
|
|
268
282
|
return;
|
|
269
283
|
}
|
|
270
|
-
if (
|
|
271
|
-
let
|
|
272
|
-
if (
|
|
273
|
-
const
|
|
274
|
-
|
|
284
|
+
if (q === 180 && (e.translate(a.value.width, a.value.height), e.scale(-1, -1)), $.value && (e.translate(a.value.width, 0), e.scale(-1, 1)), i.enableCropImage) {
|
|
285
|
+
let y = 0, M = 0, d = n, b = u;
|
|
286
|
+
if (p > _ ? (d = u * _, y = (n - d) / 2) : p < _ && (b = n / _, M = (u - b) / 2), l.value && l.value !== 1) {
|
|
287
|
+
const G = d / l.value, P = b / l.value;
|
|
288
|
+
y += (d - G) / 2, M += (b - P) / 2, d = G, b = P;
|
|
275
289
|
}
|
|
276
290
|
e.drawImage(
|
|
277
291
|
t,
|
|
278
|
-
p,
|
|
279
|
-
k,
|
|
280
|
-
c,
|
|
281
292
|
y,
|
|
293
|
+
M,
|
|
294
|
+
d,
|
|
295
|
+
b,
|
|
282
296
|
0,
|
|
283
297
|
0,
|
|
284
298
|
a.value.width,
|
|
285
299
|
a.value.height
|
|
286
300
|
);
|
|
287
301
|
} else {
|
|
288
|
-
let
|
|
289
|
-
if (
|
|
290
|
-
const
|
|
291
|
-
|
|
302
|
+
let y = a.value.width, M = a.value.height, d = 0, b = 0;
|
|
303
|
+
if (p > _ ? (M = a.value.width / p, b = (a.value.height - M) / 2) : p < _ && (y = a.value.height * p, d = (a.value.width - y) / 2), l.value && l.value !== 1) {
|
|
304
|
+
const G = n / l.value, P = u / l.value, Ue = (n - G) / 2, Ge = (u - P) / 2;
|
|
305
|
+
$.value && (d = a.value.width - d - y), e.drawImage(
|
|
292
306
|
t,
|
|
293
|
-
Ve,
|
|
294
307
|
Ue,
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
308
|
+
Ge,
|
|
309
|
+
G,
|
|
310
|
+
P,
|
|
311
|
+
d,
|
|
312
|
+
b,
|
|
298
313
|
y,
|
|
299
|
-
|
|
300
|
-
k
|
|
314
|
+
M
|
|
301
315
|
);
|
|
302
316
|
} else
|
|
303
|
-
|
|
317
|
+
$.value && (d = a.value.width - d - y), e.drawImage(
|
|
304
318
|
t,
|
|
305
319
|
0,
|
|
306
320
|
0,
|
|
307
|
-
|
|
321
|
+
n,
|
|
308
322
|
u,
|
|
309
|
-
|
|
323
|
+
d,
|
|
324
|
+
b,
|
|
310
325
|
y,
|
|
311
|
-
|
|
312
|
-
k
|
|
326
|
+
M
|
|
313
327
|
);
|
|
314
328
|
}
|
|
315
329
|
e.restore(), ve(e, a.value.width, a.value.height);
|
|
316
330
|
const He = a.value.toDataURL("image/png");
|
|
317
|
-
|
|
331
|
+
pe(He);
|
|
318
332
|
}
|
|
319
|
-
function
|
|
320
|
-
const t =
|
|
333
|
+
function pe(e) {
|
|
334
|
+
const t = Xe(e);
|
|
321
335
|
De("update:modelValue", {
|
|
322
336
|
name: `cam-pic-${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
323
337
|
id: `cam-pic-${(/* @__PURE__ */ new Date()).toISOString()}`,
|
|
@@ -325,101 +339,103 @@ const tt = { class: "camera__preview" }, at = {
|
|
|
325
339
|
size: t.size
|
|
326
340
|
});
|
|
327
341
|
}
|
|
328
|
-
return
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
342
|
+
return We(async () => {
|
|
343
|
+
await N(), R.value = !0;
|
|
344
|
+
const e = i.defaultRearCamera && f.value.length > 1 ? f.value[f.value.length - 1] : f.value[0];
|
|
345
|
+
if (m.value = e, i.enableAudio && (x.value = ue.value[0]), navigator.mediaDevices.addEventListener("devicechange", async (t) => {
|
|
346
|
+
await N();
|
|
347
|
+
}), window.addEventListener("resize", me), he(), se.value) {
|
|
348
|
+
L = setTimeout(F, 3e3);
|
|
349
|
+
const t = window.DeviceOrientationEvent;
|
|
350
|
+
t && typeof t.requestPermission == "function" ? Ee() : X();
|
|
335
351
|
}
|
|
336
|
-
await
|
|
352
|
+
await je(), le.value = !0;
|
|
337
353
|
}), Ae(() => {
|
|
338
|
-
|
|
339
|
-
}), (e, t) => (
|
|
340
|
-
class: ae(["camera",
|
|
354
|
+
R.value = !1, W.value = !1, Y(), window.removeEventListener("resize", me), window.removeEventListener("devicemotion", ce, !0), L && clearTimeout(L), Q();
|
|
355
|
+
}), (e, t) => (g(), w("div", {
|
|
356
|
+
class: ae(["camera", Te.value])
|
|
341
357
|
}, [
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
ie(
|
|
358
|
+
h("div", at, [
|
|
359
|
+
J.value ? O("", !0) : (g(), w("div", it, [
|
|
360
|
+
ie(Ke, { color: "#000" }, {
|
|
345
361
|
default: Fe(() => [
|
|
346
|
-
|
|
362
|
+
h("span", {
|
|
347
363
|
class: ae("d-block text-center"),
|
|
348
364
|
innerHTML: e.$t("camera.waitForCameraNotification")
|
|
349
|
-
}, null, 8,
|
|
365
|
+
}, null, 8, ot)
|
|
350
366
|
]),
|
|
351
367
|
_: 1
|
|
352
368
|
})
|
|
353
369
|
])),
|
|
354
|
-
|
|
355
|
-
class: ae(["camera__video-wrapper",
|
|
356
|
-
style: oe({ aspectRatio:
|
|
370
|
+
be(h("div", {
|
|
371
|
+
class: ae(["camera__video-wrapper", S.value ? `aspect-ratio--${S.value}` : ""]),
|
|
372
|
+
style: oe({ aspectRatio: xe.value || void 0, transform: l.value !== 1 ? `scale(${l.value})` : void 0 })
|
|
357
373
|
}, [
|
|
358
|
-
|
|
374
|
+
h("video", {
|
|
359
375
|
ref_key: "camera",
|
|
360
|
-
ref:
|
|
376
|
+
ref: s,
|
|
361
377
|
class: "camera__video",
|
|
362
378
|
style: oe({
|
|
363
379
|
filter: i.filter === "grayscale" ? "grayscale(100%)" : i.filter === "sepia" ? "sepia(100%)" : "none",
|
|
364
|
-
transform:
|
|
380
|
+
transform: c.correctOrientation && z.value ? "rotate(180deg)" : void 0
|
|
365
381
|
}),
|
|
366
382
|
autoplay: "",
|
|
367
383
|
playsinline: ""
|
|
368
384
|
}, null, 4),
|
|
369
|
-
|
|
385
|
+
c.tintColor ? (g(), w("div", {
|
|
370
386
|
key: 0,
|
|
371
387
|
class: "camera__tint-overlay",
|
|
372
388
|
style: oe({
|
|
373
|
-
backgroundColor:
|
|
374
|
-
opacity:
|
|
389
|
+
backgroundColor: c.tintColor,
|
|
390
|
+
opacity: c.tintIntensity,
|
|
375
391
|
mixBlendMode: "multiply"
|
|
376
392
|
})
|
|
377
|
-
}, null, 4)) :
|
|
393
|
+
}, null, 4)) : O("", !0)
|
|
378
394
|
], 6), [
|
|
379
|
-
[
|
|
395
|
+
[_e, J.value]
|
|
380
396
|
]),
|
|
381
|
-
|
|
397
|
+
be(h("canvas", {
|
|
382
398
|
ref_key: "canvas",
|
|
383
399
|
ref: a,
|
|
384
400
|
class: "camera__canvas",
|
|
385
|
-
width:
|
|
386
|
-
height:
|
|
387
|
-
}, null, 8,
|
|
388
|
-
[
|
|
401
|
+
width: j.value,
|
|
402
|
+
height: A.value
|
|
403
|
+
}, null, 8, nt), [
|
|
404
|
+
[_e, W.value]
|
|
389
405
|
]),
|
|
390
|
-
C.value ? (
|
|
391
|
-
(
|
|
406
|
+
C.value ? (g(), w("div", lt, [
|
|
407
|
+
(g(), w("p", {
|
|
392
408
|
class: "countdown",
|
|
393
409
|
key: C.value,
|
|
394
410
|
innerHTML: C.value,
|
|
395
411
|
"data-countdown": C.value
|
|
396
|
-
}, null, 8,
|
|
397
|
-
])) :
|
|
398
|
-
|
|
412
|
+
}, null, 8, rt))
|
|
413
|
+
])) : O("", !0),
|
|
414
|
+
c.enableGuide && R.value && J.value ? (g(), w("img", {
|
|
399
415
|
key: 2,
|
|
400
416
|
class: "camera__guide",
|
|
401
|
-
src:
|
|
402
|
-
}, null, 8,
|
|
403
|
-
|
|
404
|
-
ie(
|
|
405
|
-
modelValue:
|
|
406
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
417
|
+
src: c.guideSrc
|
|
418
|
+
}, null, 8, st)) : O("", !0),
|
|
419
|
+
c.enableZoomSlider ? (g(), w("div", ct, [
|
|
420
|
+
ie(et, {
|
|
421
|
+
modelValue: l.value,
|
|
422
|
+
"onUpdate:modelValue": t[0] || (t[0] = (o) => l.value = o)
|
|
407
423
|
}, null, 8, ["modelValue"])
|
|
408
|
-
])) :
|
|
424
|
+
])) : O("", !0)
|
|
409
425
|
]),
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
426
|
+
h("div", ut, [
|
|
427
|
+
h("div", dt, [
|
|
428
|
+
h("div", vt, [
|
|
429
|
+
h("div", ht, [
|
|
430
|
+
h("div", mt, [
|
|
431
|
+
h("button", {
|
|
416
432
|
type: "button",
|
|
417
433
|
class: "camera__toggle btn btn-primary",
|
|
418
|
-
onClick:
|
|
434
|
+
onClick: Le
|
|
419
435
|
}, [
|
|
420
|
-
|
|
436
|
+
R.value ? (g(), w("span", gt, ne(e.$t("common.pause")), 1)) : (g(), w("span", ft, ne(e.$t("common.play")), 1))
|
|
421
437
|
]),
|
|
422
|
-
|
|
438
|
+
h("button", {
|
|
423
439
|
type: "button",
|
|
424
440
|
class: "camera__capture btn btn-primary",
|
|
425
441
|
onClick: ee
|
|
@@ -429,29 +445,29 @@ const tt = { class: "camera__preview" }, at = {
|
|
|
429
445
|
])
|
|
430
446
|
])
|
|
431
447
|
]),
|
|
432
|
-
(
|
|
433
|
-
|
|
434
|
-
|
|
448
|
+
(c.enableSwitchCamera || c.enableSelectDevice) && f.value && f.value.length > 1 ? (g(), w("div", wt, [
|
|
449
|
+
h("div", pt, [
|
|
450
|
+
c.enableSelectDevice ? (g(), Ne(Qe, {
|
|
435
451
|
key: 0,
|
|
436
452
|
modelValue: de.value,
|
|
437
|
-
"onUpdate:modelValue": t[1] || (t[1] = (
|
|
438
|
-
options:
|
|
453
|
+
"onUpdate:modelValue": t[1] || (t[1] = (o) => de.value = o),
|
|
454
|
+
options: Re.value,
|
|
439
455
|
class: "w-100"
|
|
440
|
-
}, null, 8, ["modelValue", "options"])) :
|
|
456
|
+
}, null, 8, ["modelValue", "options"])) : O("", !0)
|
|
441
457
|
]),
|
|
442
|
-
|
|
443
|
-
|
|
458
|
+
h("div", yt, [
|
|
459
|
+
c.enableSwitchCamera ? (g(), w("button", {
|
|
444
460
|
key: 0,
|
|
445
461
|
class: "btn",
|
|
446
|
-
onClick:
|
|
462
|
+
onClick: qe($e, ["prevent"])
|
|
447
463
|
}, [
|
|
448
|
-
ie(
|
|
449
|
-
])) :
|
|
464
|
+
ie(Je, { symbol: "switch-camera" })
|
|
465
|
+
])) : O("", !0)
|
|
450
466
|
])
|
|
451
|
-
])) :
|
|
467
|
+
])) : O("", !0)
|
|
452
468
|
], 2));
|
|
453
469
|
}
|
|
454
470
|
});
|
|
455
471
|
export {
|
|
456
|
-
|
|
472
|
+
$t as default
|
|
457
473
|
};
|