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