@tabl.io/auth 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +51 -0
- package/dist/index.js +2434 -1033
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,253 +1,253 @@
|
|
|
1
|
-
import { create as
|
|
2
|
-
import { persist as
|
|
3
|
-
import { useEffect as
|
|
4
|
-
import { Loader2 as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { createClient as
|
|
7
|
-
var
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
get: ((
|
|
12
|
-
enumerable: !(
|
|
1
|
+
import { create as R3 } from "zustand";
|
|
2
|
+
import { persist as V3 } from "zustand/middleware";
|
|
3
|
+
import { useEffect as Z, useRef as J, useState as e3 } from "react";
|
|
4
|
+
import { Loader2 as v3, QrCode as H3, WifiOff as $3 } from "lucide-react";
|
|
5
|
+
import { Fragment as u3, jsx as T, jsxs as U } from "react/jsx-runtime";
|
|
6
|
+
import { createClient as W3 } from "@supabase/supabase-js";
|
|
7
|
+
var J3 = Object.create, L3 = Object.defineProperty, Y3 = Object.getOwnPropertyDescriptor, Z3 = Object.getOwnPropertyNames, e2 = Object.getPrototypeOf, t2 = Object.prototype.hasOwnProperty, r2 = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports), o2 = (e, t, r, o) => {
|
|
8
|
+
if (t && typeof t == "object" || typeof t == "function")
|
|
9
|
+
for (var i = Z3(t), d = 0, a = i.length, s; d < a; d++)
|
|
10
|
+
s = i[d], !t2.call(e, s) && s !== r && L3(e, s, {
|
|
11
|
+
get: ((k) => t[k]).bind(null, s),
|
|
12
|
+
enumerable: !(o = Y3(t, s)) || o.enumerable
|
|
13
13
|
});
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
value:
|
|
14
|
+
return e;
|
|
15
|
+
}, s2 = (e, t, r) => (r = e != null ? J3(e2(e)) : {}, o2(t || !e || !e.__esModule ? L3(r, "default", {
|
|
16
|
+
value: e,
|
|
17
17
|
enumerable: !0
|
|
18
|
-
}) :
|
|
18
|
+
}) : r, e)), b3 = {
|
|
19
19
|
supervisor: 1,
|
|
20
20
|
cashier: 2,
|
|
21
21
|
manager: 3
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
return
|
|
23
|
+
function n2(e, t) {
|
|
24
|
+
return b3[e] >= b3[t];
|
|
25
25
|
}
|
|
26
|
-
function
|
|
27
|
-
const
|
|
28
|
-
return
|
|
26
|
+
function m3(e) {
|
|
27
|
+
const t = e?.role;
|
|
28
|
+
return t === "manager" || t === "cashier" || t === "supervisor" ? t : null;
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const D3 = R3()((e) => ({
|
|
31
31
|
user: null,
|
|
32
32
|
role: null,
|
|
33
33
|
isInitializing: !0,
|
|
34
34
|
isAuthenticated: !1,
|
|
35
35
|
error: null,
|
|
36
|
-
init: (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
user:
|
|
40
|
-
role:
|
|
36
|
+
init: (t) => {
|
|
37
|
+
t.auth.getSession().then(({ data: { session: o } }) => {
|
|
38
|
+
o?.user ? e({
|
|
39
|
+
user: o.user,
|
|
40
|
+
role: m3(o.user.app_metadata),
|
|
41
41
|
isAuthenticated: !0,
|
|
42
42
|
isInitializing: !1
|
|
43
|
-
}) :
|
|
43
|
+
}) : e({ isInitializing: !1 });
|
|
44
44
|
});
|
|
45
|
-
const { data: { subscription:
|
|
46
|
-
|
|
47
|
-
user:
|
|
48
|
-
role:
|
|
45
|
+
const { data: { subscription: r } } = t.auth.onAuthStateChange((o, i) => {
|
|
46
|
+
i?.user ? e({
|
|
47
|
+
user: i.user,
|
|
48
|
+
role: m3(i.user.app_metadata),
|
|
49
49
|
isAuthenticated: !0,
|
|
50
50
|
isInitializing: !1,
|
|
51
51
|
error: null
|
|
52
|
-
}) :
|
|
52
|
+
}) : e({
|
|
53
53
|
user: null,
|
|
54
54
|
role: null,
|
|
55
55
|
isAuthenticated: !1,
|
|
56
56
|
isInitializing: !1
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
|
-
return () =>
|
|
59
|
+
return () => r.unsubscribe();
|
|
60
60
|
},
|
|
61
|
-
signIn: async (
|
|
62
|
-
|
|
63
|
-
const { data:
|
|
64
|
-
email:
|
|
65
|
-
password:
|
|
61
|
+
signIn: async (t, r, o) => {
|
|
62
|
+
e({ error: null });
|
|
63
|
+
const { data: i, error: d } = await t.auth.signInWithPassword({
|
|
64
|
+
email: r,
|
|
65
|
+
password: o
|
|
66
66
|
});
|
|
67
|
-
if (
|
|
68
|
-
throw
|
|
69
|
-
if (!
|
|
70
|
-
await
|
|
71
|
-
const
|
|
72
|
-
throw
|
|
67
|
+
if (d)
|
|
68
|
+
throw e({ error: d.message }), d;
|
|
69
|
+
if (!m3(i.user?.app_metadata)) {
|
|
70
|
+
await t.auth.signOut();
|
|
71
|
+
const a = "Usuário sem permissão de acesso.";
|
|
72
|
+
throw e({ error: a }), new Error(a);
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
signOut: async (
|
|
76
|
-
await
|
|
75
|
+
signOut: async (t) => {
|
|
76
|
+
await t.auth.signOut();
|
|
77
77
|
}
|
|
78
|
-
})),
|
|
78
|
+
})), a2 = R3()(V3((e, t) => ({
|
|
79
79
|
deviceId: crypto.randomUUID(),
|
|
80
80
|
deviceSessionId: null,
|
|
81
81
|
session: null,
|
|
82
82
|
isConnected: !1,
|
|
83
83
|
isConnecting: !1,
|
|
84
84
|
error: null,
|
|
85
|
-
connect: async (
|
|
86
|
-
|
|
85
|
+
connect: async (r, o) => {
|
|
86
|
+
e({
|
|
87
87
|
isConnecting: !0,
|
|
88
88
|
error: null
|
|
89
89
|
});
|
|
90
90
|
try {
|
|
91
|
-
const { deviceId:
|
|
92
|
-
otp:
|
|
93
|
-
deviceId:
|
|
91
|
+
const { deviceId: i } = t(), { data: d, error: a } = await o.functions.invoke("session/connect", { body: {
|
|
92
|
+
otp: r.replace(/-/g, ""),
|
|
93
|
+
deviceId: i
|
|
94
94
|
} });
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
97
|
-
access_token:
|
|
98
|
-
refresh_token:
|
|
95
|
+
if (a) throw a;
|
|
96
|
+
const s = typeof d == "string" ? JSON.parse(d) : d, { error: k } = await o.auth.setSession({
|
|
97
|
+
access_token: s.accessToken,
|
|
98
|
+
refresh_token: s.refreshToken
|
|
99
99
|
});
|
|
100
|
-
if (
|
|
101
|
-
|
|
102
|
-
deviceSessionId:
|
|
103
|
-
session:
|
|
100
|
+
if (k) throw k;
|
|
101
|
+
o.realtime.setAuth(s.accessToken), e({
|
|
102
|
+
deviceSessionId: s.deviceSessionId,
|
|
103
|
+
session: s.session,
|
|
104
104
|
isConnected: !0,
|
|
105
105
|
isConnecting: !1,
|
|
106
106
|
error: null
|
|
107
107
|
});
|
|
108
|
-
} catch (
|
|
109
|
-
let
|
|
108
|
+
} catch (i) {
|
|
109
|
+
let d = i.message ?? "Erro ao conectar";
|
|
110
110
|
try {
|
|
111
|
-
const
|
|
112
|
-
|
|
111
|
+
const a = await i.context?.json?.();
|
|
112
|
+
a?.error && (d = a.error);
|
|
113
113
|
} catch {
|
|
114
114
|
}
|
|
115
|
-
throw
|
|
115
|
+
throw e({
|
|
116
116
|
isConnecting: !1,
|
|
117
|
-
error:
|
|
118
|
-
}), new Error(
|
|
117
|
+
error: d
|
|
118
|
+
}), new Error(d);
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
-
disconnect: (
|
|
122
|
-
|
|
121
|
+
disconnect: (r) => {
|
|
122
|
+
r.auth.signOut(), e({
|
|
123
123
|
deviceSessionId: null,
|
|
124
124
|
session: null,
|
|
125
125
|
isConnected: !1,
|
|
126
126
|
error: null
|
|
127
127
|
});
|
|
128
128
|
},
|
|
129
|
-
clearError: () =>
|
|
129
|
+
clearError: () => e({ error: null })
|
|
130
130
|
}), {
|
|
131
131
|
name: "tabl::device",
|
|
132
|
-
partialize: (
|
|
133
|
-
deviceId:
|
|
134
|
-
deviceSessionId:
|
|
135
|
-
session:
|
|
136
|
-
isConnected:
|
|
132
|
+
partialize: (e) => ({
|
|
133
|
+
deviceId: e.deviceId,
|
|
134
|
+
deviceSessionId: e.deviceSessionId,
|
|
135
|
+
session: e.session,
|
|
136
|
+
isConnected: e.isConnected
|
|
137
137
|
})
|
|
138
138
|
}));
|
|
139
|
-
function
|
|
140
|
-
const { user:
|
|
141
|
-
function
|
|
142
|
-
return
|
|
139
|
+
function _3() {
|
|
140
|
+
const { user: e, role: t, isInitializing: r, isAuthenticated: o, error: i } = D3();
|
|
141
|
+
function d(a) {
|
|
142
|
+
return t ? n2(t, a) : !1;
|
|
143
143
|
}
|
|
144
144
|
return {
|
|
145
|
-
user:
|
|
146
|
-
role:
|
|
147
|
-
isInitializing:
|
|
148
|
-
isAuthenticated:
|
|
149
|
-
error:
|
|
150
|
-
can:
|
|
145
|
+
user: e,
|
|
146
|
+
role: t,
|
|
147
|
+
isInitializing: r,
|
|
148
|
+
isAuthenticated: o,
|
|
149
|
+
error: i,
|
|
150
|
+
can: d
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
const { isInitializing:
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
function H2(e, t) {
|
|
154
|
+
const { isInitializing: r, isAuthenticated: o, can: i } = _3();
|
|
155
|
+
Z(() => {
|
|
156
|
+
r || (!o || !i(e)) && t();
|
|
157
157
|
}, [
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
r,
|
|
159
|
+
o,
|
|
160
|
+
e
|
|
161
161
|
]);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
164
|
-
const { signIn:
|
|
165
|
-
return /* @__PURE__ */
|
|
163
|
+
function $2({ supabase: e, moduleName: t, logo: r }) {
|
|
164
|
+
const { signIn: o, error: i } = D3(), [d, a] = e3(""), [s, k] = e3(""), [p, u] = e3(!1);
|
|
165
|
+
return /* @__PURE__ */ T("div", {
|
|
166
166
|
className: "flex min-h-screen flex-col items-center justify-center bg-background p-4",
|
|
167
|
-
children: /* @__PURE__ */
|
|
167
|
+
children: /* @__PURE__ */ U("div", {
|
|
168
168
|
className: "w-full max-w-sm space-y-8",
|
|
169
|
-
children: [/* @__PURE__ */
|
|
169
|
+
children: [/* @__PURE__ */ U("div", {
|
|
170
170
|
className: "flex flex-col items-center gap-3 text-center",
|
|
171
|
-
children: [
|
|
171
|
+
children: [r && /* @__PURE__ */ T("div", {
|
|
172
172
|
className: "mb-2",
|
|
173
|
-
children:
|
|
174
|
-
}), /* @__PURE__ */
|
|
173
|
+
children: r
|
|
174
|
+
}), /* @__PURE__ */ U("div", { children: [/* @__PURE__ */ T("p", {
|
|
175
175
|
className: "text-xs font-bold uppercase tracking-widest text-muted-foreground",
|
|
176
176
|
children: "tabl.io"
|
|
177
|
-
}), /* @__PURE__ */
|
|
177
|
+
}), /* @__PURE__ */ T("h1", {
|
|
178
178
|
className: "text-2xl font-bold",
|
|
179
|
-
children:
|
|
179
|
+
children: t
|
|
180
180
|
})] })]
|
|
181
|
-
}), /* @__PURE__ */
|
|
181
|
+
}), /* @__PURE__ */ U("div", {
|
|
182
182
|
className: "rounded-xl border bg-card p-6 shadow-sm space-y-4",
|
|
183
|
-
children: [/* @__PURE__ */
|
|
183
|
+
children: [/* @__PURE__ */ U("div", {
|
|
184
184
|
className: "space-y-1",
|
|
185
|
-
children: [/* @__PURE__ */
|
|
185
|
+
children: [/* @__PURE__ */ T("h2", {
|
|
186
186
|
className: "text-base font-semibold",
|
|
187
187
|
children: "Entrar"
|
|
188
|
-
}), /* @__PURE__ */
|
|
188
|
+
}), /* @__PURE__ */ T("p", {
|
|
189
189
|
className: "text-sm text-muted-foreground",
|
|
190
190
|
children: "Use suas credenciais de acesso"
|
|
191
191
|
})]
|
|
192
|
-
}), /* @__PURE__ */
|
|
193
|
-
onSubmit: async (
|
|
194
|
-
if (
|
|
195
|
-
|
|
192
|
+
}), /* @__PURE__ */ U("form", {
|
|
193
|
+
onSubmit: async (m) => {
|
|
194
|
+
if (m.preventDefault(), !(!d || !s)) {
|
|
195
|
+
u(!0);
|
|
196
196
|
try {
|
|
197
|
-
await
|
|
197
|
+
await o(e, d, s);
|
|
198
198
|
} finally {
|
|
199
|
-
|
|
199
|
+
u(!1);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
},
|
|
203
203
|
className: "space-y-3",
|
|
204
204
|
children: [
|
|
205
|
-
/* @__PURE__ */
|
|
205
|
+
/* @__PURE__ */ U("div", {
|
|
206
206
|
className: "space-y-1.5",
|
|
207
|
-
children: [/* @__PURE__ */
|
|
207
|
+
children: [/* @__PURE__ */ T("label", {
|
|
208
208
|
htmlFor: "email",
|
|
209
209
|
className: "text-sm font-medium",
|
|
210
210
|
children: "E-mail"
|
|
211
|
-
}), /* @__PURE__ */
|
|
211
|
+
}), /* @__PURE__ */ T("input", {
|
|
212
212
|
id: "email",
|
|
213
213
|
type: "email",
|
|
214
214
|
autoComplete: "email",
|
|
215
215
|
autoFocus: !0,
|
|
216
216
|
required: !0,
|
|
217
|
-
value:
|
|
218
|
-
onChange: (
|
|
219
|
-
disabled:
|
|
217
|
+
value: d,
|
|
218
|
+
onChange: (m) => a(m.target.value),
|
|
219
|
+
disabled: p,
|
|
220
220
|
placeholder: "voce@restaurante.com",
|
|
221
221
|
className: "w-full rounded-md border bg-background px-3 py-2 text-sm outline-none transition focus:ring-2 focus:ring-ring/50 disabled:opacity-50"
|
|
222
222
|
})]
|
|
223
223
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
224
|
+
/* @__PURE__ */ U("div", {
|
|
225
225
|
className: "space-y-1.5",
|
|
226
|
-
children: [/* @__PURE__ */
|
|
226
|
+
children: [/* @__PURE__ */ T("label", {
|
|
227
227
|
htmlFor: "password",
|
|
228
228
|
className: "text-sm font-medium",
|
|
229
229
|
children: "Senha"
|
|
230
|
-
}), /* @__PURE__ */
|
|
230
|
+
}), /* @__PURE__ */ T("input", {
|
|
231
231
|
id: "password",
|
|
232
232
|
type: "password",
|
|
233
233
|
autoComplete: "current-password",
|
|
234
234
|
required: !0,
|
|
235
|
-
value:
|
|
236
|
-
onChange: (
|
|
237
|
-
disabled:
|
|
235
|
+
value: s,
|
|
236
|
+
onChange: (m) => k(m.target.value),
|
|
237
|
+
disabled: p,
|
|
238
238
|
placeholder: "••••••••",
|
|
239
239
|
className: "w-full rounded-md border bg-background px-3 py-2 text-sm outline-none transition focus:ring-2 focus:ring-ring/50 disabled:opacity-50"
|
|
240
240
|
})]
|
|
241
241
|
}),
|
|
242
|
-
|
|
242
|
+
i && /* @__PURE__ */ T("p", {
|
|
243
243
|
className: "rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",
|
|
244
|
-
children:
|
|
244
|
+
children: i
|
|
245
245
|
}),
|
|
246
|
-
/* @__PURE__ */
|
|
246
|
+
/* @__PURE__ */ T("button", {
|
|
247
247
|
type: "submit",
|
|
248
|
-
disabled:
|
|
248
|
+
disabled: p || !d || !s,
|
|
249
249
|
className: "inline-flex w-full items-center justify-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-50",
|
|
250
|
-
children:
|
|
250
|
+
children: p ? /* @__PURE__ */ T(v3, { className: "size-4 animate-spin" }) : "Entrar"
|
|
251
251
|
})
|
|
252
252
|
]
|
|
253
253
|
})]
|
|
@@ -255,258 +255,258 @@ function U3({ supabase: M, moduleName: L, logo: O }) {
|
|
|
255
255
|
})
|
|
256
256
|
});
|
|
257
257
|
}
|
|
258
|
-
function
|
|
259
|
-
const { isInitializing:
|
|
260
|
-
return
|
|
258
|
+
function W2({ role: e, fallback: t = null, children: r }) {
|
|
259
|
+
const { isInitializing: o, can: i } = _3();
|
|
260
|
+
return o ? /* @__PURE__ */ T(u3, { children: t }) : i(e) ? /* @__PURE__ */ T(u3, { children: r }) : /* @__PURE__ */ T(u3, { children: t });
|
|
261
261
|
}
|
|
262
|
-
var
|
|
263
|
-
(function(
|
|
264
|
-
typeof
|
|
265
|
-
})(typeof self < "u" ? self :
|
|
266
|
-
return (function(
|
|
267
|
-
var
|
|
268
|
-
function
|
|
269
|
-
if (
|
|
270
|
-
var
|
|
271
|
-
i:
|
|
262
|
+
var i2 = /* @__PURE__ */ r2(((e, t) => {
|
|
263
|
+
(function(o, i) {
|
|
264
|
+
typeof e == "object" && typeof t == "object" ? t.exports = i() : typeof define == "function" && define.amd ? define([], i) : typeof e == "object" ? e.jsQR = i() : o.jsQR = i();
|
|
265
|
+
})(typeof self < "u" ? self : e, function() {
|
|
266
|
+
return (function(r) {
|
|
267
|
+
var o = {};
|
|
268
|
+
function i(d) {
|
|
269
|
+
if (o[d]) return o[d].exports;
|
|
270
|
+
var a = o[d] = {
|
|
271
|
+
i: d,
|
|
272
272
|
l: !1,
|
|
273
273
|
exports: {}
|
|
274
274
|
};
|
|
275
|
-
return
|
|
275
|
+
return r[d].call(a.exports, a, a.exports, i), a.l = !0, a.exports;
|
|
276
276
|
}
|
|
277
|
-
return
|
|
278
|
-
|
|
277
|
+
return i.m = r, i.c = o, i.d = function(d, a, s) {
|
|
278
|
+
i.o(d, a) || Object.defineProperty(d, a, {
|
|
279
279
|
configurable: !1,
|
|
280
280
|
enumerable: !0,
|
|
281
|
-
get:
|
|
281
|
+
get: s
|
|
282
282
|
});
|
|
283
|
-
},
|
|
284
|
-
var
|
|
285
|
-
return
|
|
283
|
+
}, i.n = function(d) {
|
|
284
|
+
var a = d && d.__esModule ? function() {
|
|
285
|
+
return d.default;
|
|
286
286
|
} : function() {
|
|
287
|
-
return
|
|
287
|
+
return d;
|
|
288
288
|
};
|
|
289
|
-
return
|
|
290
|
-
},
|
|
291
|
-
return Object.prototype.hasOwnProperty.call(
|
|
292
|
-
},
|
|
289
|
+
return i.d(a, "a", a), a;
|
|
290
|
+
}, i.o = function(d, a) {
|
|
291
|
+
return Object.prototype.hasOwnProperty.call(d, a);
|
|
292
|
+
}, i.p = "", i(i.s = 3);
|
|
293
293
|
})([
|
|
294
|
-
(function(
|
|
294
|
+
(function(r, o, i) {
|
|
295
295
|
"use strict";
|
|
296
|
-
Object.defineProperty(
|
|
297
|
-
function
|
|
298
|
-
this.width =
|
|
296
|
+
Object.defineProperty(o, "__esModule", { value: !0 }), o.BitMatrix = (function() {
|
|
297
|
+
function d(a, s) {
|
|
298
|
+
this.width = s, this.height = a.length / s, this.data = a;
|
|
299
299
|
}
|
|
300
|
-
return
|
|
301
|
-
return new
|
|
302
|
-
},
|
|
303
|
-
return
|
|
304
|
-
},
|
|
305
|
-
this.data[
|
|
306
|
-
},
|
|
307
|
-
for (var
|
|
308
|
-
},
|
|
300
|
+
return d.createEmpty = function(a, s) {
|
|
301
|
+
return new d(new Uint8ClampedArray(a * s), a);
|
|
302
|
+
}, d.prototype.get = function(a, s) {
|
|
303
|
+
return a < 0 || a >= this.width || s < 0 || s >= this.height ? !1 : !!this.data[s * this.width + a];
|
|
304
|
+
}, d.prototype.set = function(a, s, k) {
|
|
305
|
+
this.data[s * this.width + a] = k ? 1 : 0;
|
|
306
|
+
}, d.prototype.setRegion = function(a, s, k, p, u) {
|
|
307
|
+
for (var c = s; c < s + p; c++) for (var m = a; m < a + k; m++) this.set(m, c, !!u);
|
|
308
|
+
}, d;
|
|
309
309
|
})();
|
|
310
310
|
}),
|
|
311
|
-
(function(
|
|
311
|
+
(function(r, o, i) {
|
|
312
312
|
"use strict";
|
|
313
|
-
Object.defineProperty(
|
|
314
|
-
var
|
|
315
|
-
function
|
|
316
|
-
return
|
|
313
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
314
|
+
var d = i(2);
|
|
315
|
+
function a(s, k) {
|
|
316
|
+
return s ^ k;
|
|
317
317
|
}
|
|
318
|
-
|
|
319
|
-
function
|
|
320
|
-
this.primitive =
|
|
321
|
-
for (var
|
|
322
|
-
this.expTable[
|
|
323
|
-
for (var
|
|
324
|
-
this.zero = new
|
|
318
|
+
o.addOrSubtractGF = a, o.default = (function() {
|
|
319
|
+
function s(k, p, u) {
|
|
320
|
+
this.primitive = k, this.size = p, this.generatorBase = u, this.expTable = new Array(this.size), this.logTable = new Array(this.size);
|
|
321
|
+
for (var c = 1, m = 0; m < this.size; m++)
|
|
322
|
+
this.expTable[m] = c, c = c * 2, c >= this.size && (c = (c ^ this.primitive) & this.size - 1);
|
|
323
|
+
for (var m = 0; m < this.size - 1; m++) this.logTable[this.expTable[m]] = m;
|
|
324
|
+
this.zero = new d.default(this, Uint8ClampedArray.from([0])), this.one = new d.default(this, Uint8ClampedArray.from([1]));
|
|
325
325
|
}
|
|
326
|
-
return
|
|
327
|
-
return
|
|
328
|
-
},
|
|
329
|
-
if (
|
|
330
|
-
return this.expTable[this.size - this.logTable[
|
|
331
|
-
},
|
|
332
|
-
if (
|
|
333
|
-
if (
|
|
334
|
-
var
|
|
335
|
-
return
|
|
336
|
-
},
|
|
337
|
-
if (
|
|
338
|
-
return this.logTable[
|
|
339
|
-
},
|
|
340
|
-
return this.expTable[
|
|
341
|
-
},
|
|
326
|
+
return s.prototype.multiply = function(k, p) {
|
|
327
|
+
return k === 0 || p === 0 ? 0 : this.expTable[(this.logTable[k] + this.logTable[p]) % (this.size - 1)];
|
|
328
|
+
}, s.prototype.inverse = function(k) {
|
|
329
|
+
if (k === 0) throw new Error("Can't invert 0");
|
|
330
|
+
return this.expTable[this.size - this.logTable[k] - 1];
|
|
331
|
+
}, s.prototype.buildMonomial = function(k, p) {
|
|
332
|
+
if (k < 0) throw new Error("Invalid monomial degree less than 0");
|
|
333
|
+
if (p === 0) return this.zero;
|
|
334
|
+
var u = new Uint8ClampedArray(k + 1);
|
|
335
|
+
return u[0] = p, new d.default(this, u);
|
|
336
|
+
}, s.prototype.log = function(k) {
|
|
337
|
+
if (k === 0) throw new Error("Can't take log(0)");
|
|
338
|
+
return this.logTable[k];
|
|
339
|
+
}, s.prototype.exp = function(k) {
|
|
340
|
+
return this.expTable[k];
|
|
341
|
+
}, s;
|
|
342
342
|
})();
|
|
343
343
|
}),
|
|
344
|
-
(function(
|
|
344
|
+
(function(r, o, i) {
|
|
345
345
|
"use strict";
|
|
346
|
-
Object.defineProperty(
|
|
347
|
-
var
|
|
348
|
-
|
|
349
|
-
function
|
|
350
|
-
if (
|
|
351
|
-
this.field =
|
|
352
|
-
var
|
|
353
|
-
if (
|
|
354
|
-
for (var
|
|
355
|
-
if (
|
|
346
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
347
|
+
var d = i(1);
|
|
348
|
+
o.default = (function() {
|
|
349
|
+
function a(s, k) {
|
|
350
|
+
if (k.length === 0) throw new Error("No coefficients.");
|
|
351
|
+
this.field = s;
|
|
352
|
+
var p = k.length;
|
|
353
|
+
if (p > 1 && k[0] === 0) {
|
|
354
|
+
for (var u = 1; u < p && k[u] === 0; ) u++;
|
|
355
|
+
if (u === p) this.coefficients = s.zero.coefficients;
|
|
356
356
|
else {
|
|
357
|
-
this.coefficients = new Uint8ClampedArray(
|
|
358
|
-
for (var
|
|
357
|
+
this.coefficients = new Uint8ClampedArray(p - u);
|
|
358
|
+
for (var c = 0; c < this.coefficients.length; c++) this.coefficients[c] = k[u + c];
|
|
359
359
|
}
|
|
360
|
-
} else this.coefficients =
|
|
360
|
+
} else this.coefficients = k;
|
|
361
361
|
}
|
|
362
|
-
return
|
|
362
|
+
return a.prototype.degree = function() {
|
|
363
363
|
return this.coefficients.length - 1;
|
|
364
|
-
},
|
|
364
|
+
}, a.prototype.isZero = function() {
|
|
365
365
|
return this.coefficients[0] === 0;
|
|
366
|
-
},
|
|
367
|
-
return this.coefficients[this.coefficients.length - 1 -
|
|
368
|
-
},
|
|
369
|
-
var
|
|
370
|
-
if (this.isZero()) return
|
|
371
|
-
if (
|
|
372
|
-
var
|
|
373
|
-
|
|
374
|
-
for (var
|
|
375
|
-
for (var
|
|
376
|
-
return new
|
|
377
|
-
},
|
|
378
|
-
if (
|
|
379
|
-
if (
|
|
380
|
-
for (var
|
|
381
|
-
return new
|
|
382
|
-
},
|
|
383
|
-
if (this.isZero() ||
|
|
384
|
-
for (var
|
|
385
|
-
for (var
|
|
386
|
-
return new
|
|
387
|
-
},
|
|
388
|
-
if (
|
|
389
|
-
if (
|
|
390
|
-
for (var
|
|
391
|
-
return new
|
|
392
|
-
},
|
|
393
|
-
var
|
|
394
|
-
if (
|
|
395
|
-
var
|
|
396
|
-
if (
|
|
397
|
-
return this.coefficients.forEach(function(
|
|
398
|
-
|
|
399
|
-
}),
|
|
400
|
-
|
|
401
|
-
for (var
|
|
402
|
-
return
|
|
403
|
-
},
|
|
366
|
+
}, a.prototype.getCoefficient = function(s) {
|
|
367
|
+
return this.coefficients[this.coefficients.length - 1 - s];
|
|
368
|
+
}, a.prototype.addOrSubtract = function(s) {
|
|
369
|
+
var k;
|
|
370
|
+
if (this.isZero()) return s;
|
|
371
|
+
if (s.isZero()) return this;
|
|
372
|
+
var p = this.coefficients, u = s.coefficients;
|
|
373
|
+
p.length > u.length && (k = [u, p], p = k[0], u = k[1]);
|
|
374
|
+
for (var c = new Uint8ClampedArray(u.length), m = u.length - p.length, v = 0; v < m; v++) c[v] = u[v];
|
|
375
|
+
for (var v = m; v < u.length; v++) c[v] = d.addOrSubtractGF(p[v - m], u[v]);
|
|
376
|
+
return new a(this.field, c);
|
|
377
|
+
}, a.prototype.multiply = function(s) {
|
|
378
|
+
if (s === 0) return this.field.zero;
|
|
379
|
+
if (s === 1) return this;
|
|
380
|
+
for (var k = this.coefficients.length, p = new Uint8ClampedArray(k), u = 0; u < k; u++) p[u] = this.field.multiply(this.coefficients[u], s);
|
|
381
|
+
return new a(this.field, p);
|
|
382
|
+
}, a.prototype.multiplyPoly = function(s) {
|
|
383
|
+
if (this.isZero() || s.isZero()) return this.field.zero;
|
|
384
|
+
for (var k = this.coefficients, p = k.length, u = s.coefficients, c = u.length, m = new Uint8ClampedArray(p + c - 1), v = 0; v < p; v++)
|
|
385
|
+
for (var y = k[v], C = 0; C < c; C++) m[v + C] = d.addOrSubtractGF(m[v + C], this.field.multiply(y, u[C]));
|
|
386
|
+
return new a(this.field, m);
|
|
387
|
+
}, a.prototype.multiplyByMonomial = function(s, k) {
|
|
388
|
+
if (s < 0) throw new Error("Invalid degree less than 0");
|
|
389
|
+
if (k === 0) return this.field.zero;
|
|
390
|
+
for (var p = this.coefficients.length, u = new Uint8ClampedArray(p + s), c = 0; c < p; c++) u[c] = this.field.multiply(this.coefficients[c], k);
|
|
391
|
+
return new a(this.field, u);
|
|
392
|
+
}, a.prototype.evaluateAt = function(s) {
|
|
393
|
+
var k = 0;
|
|
394
|
+
if (s === 0) return this.getCoefficient(0);
|
|
395
|
+
var p = this.coefficients.length;
|
|
396
|
+
if (s === 1)
|
|
397
|
+
return this.coefficients.forEach(function(c) {
|
|
398
|
+
k = d.addOrSubtractGF(k, c);
|
|
399
|
+
}), k;
|
|
400
|
+
k = this.coefficients[0];
|
|
401
|
+
for (var u = 1; u < p; u++) k = d.addOrSubtractGF(this.field.multiply(s, k), this.coefficients[u]);
|
|
402
|
+
return k;
|
|
403
|
+
}, a;
|
|
404
404
|
})();
|
|
405
405
|
}),
|
|
406
|
-
(function(
|
|
406
|
+
(function(r, o, i) {
|
|
407
407
|
"use strict";
|
|
408
|
-
Object.defineProperty(
|
|
409
|
-
var
|
|
410
|
-
function
|
|
411
|
-
var
|
|
412
|
-
if (!
|
|
413
|
-
for (var
|
|
414
|
-
var
|
|
415
|
-
if (
|
|
416
|
-
binaryData:
|
|
417
|
-
data:
|
|
418
|
-
chunks:
|
|
419
|
-
version:
|
|
408
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
409
|
+
var d = i(4), a = i(5), s = i(11), k = i(12);
|
|
410
|
+
function p(m) {
|
|
411
|
+
var v = k.locate(m);
|
|
412
|
+
if (!v) return null;
|
|
413
|
+
for (var y = 0, C = v; y < C.length; y++) {
|
|
414
|
+
var w = C[y], b = s.extract(m, w), x = a.decode(b.matrix);
|
|
415
|
+
if (x) return {
|
|
416
|
+
binaryData: x.bytes,
|
|
417
|
+
data: x.text,
|
|
418
|
+
chunks: x.chunks,
|
|
419
|
+
version: x.version,
|
|
420
420
|
location: {
|
|
421
|
-
topRightCorner:
|
|
422
|
-
topLeftCorner:
|
|
423
|
-
bottomRightCorner:
|
|
424
|
-
bottomLeftCorner:
|
|
425
|
-
topRightFinderPattern:
|
|
426
|
-
topLeftFinderPattern:
|
|
427
|
-
bottomLeftFinderPattern:
|
|
428
|
-
bottomRightAlignmentPattern:
|
|
421
|
+
topRightCorner: b.mappingFunction(w.dimension, 0),
|
|
422
|
+
topLeftCorner: b.mappingFunction(0, 0),
|
|
423
|
+
bottomRightCorner: b.mappingFunction(w.dimension, w.dimension),
|
|
424
|
+
bottomLeftCorner: b.mappingFunction(0, w.dimension),
|
|
425
|
+
topRightFinderPattern: w.topRight,
|
|
426
|
+
topLeftFinderPattern: w.topLeft,
|
|
427
|
+
bottomLeftFinderPattern: w.bottomLeft,
|
|
428
|
+
bottomRightAlignmentPattern: w.alignmentPattern
|
|
429
429
|
}
|
|
430
430
|
};
|
|
431
431
|
}
|
|
432
432
|
return null;
|
|
433
433
|
}
|
|
434
|
-
var
|
|
435
|
-
function
|
|
434
|
+
var u = { inversionAttempts: "attemptBoth" };
|
|
435
|
+
function c(m, v, y, C) {
|
|
436
436
|
C === void 0 && (C = {});
|
|
437
|
-
var
|
|
438
|
-
Object.keys(
|
|
439
|
-
|
|
437
|
+
var w = u;
|
|
438
|
+
Object.keys(w || {}).forEach(function(f) {
|
|
439
|
+
w[f] = C[f] || w[f];
|
|
440
440
|
});
|
|
441
|
-
var
|
|
442
|
-
return !
|
|
441
|
+
var b = w.inversionAttempts === "attemptBoth" || w.inversionAttempts === "invertFirst", x = w.inversionAttempts === "onlyInvert" || w.inversionAttempts === "invertFirst", B = d.binarize(m, v, y, b), n = B.binarized, l = B.inverted, h = p(x ? l : n);
|
|
442
|
+
return !h && (w.inversionAttempts === "attemptBoth" || w.inversionAttempts === "invertFirst") && (h = p(x ? n : l)), h;
|
|
443
443
|
}
|
|
444
|
-
|
|
444
|
+
c.default = c, o.default = c;
|
|
445
445
|
}),
|
|
446
|
-
(function(
|
|
446
|
+
(function(r, o, i) {
|
|
447
447
|
"use strict";
|
|
448
|
-
Object.defineProperty(
|
|
449
|
-
var
|
|
450
|
-
function
|
|
451
|
-
return
|
|
448
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
449
|
+
var d = i(0), a = 8, s = 24;
|
|
450
|
+
function k(c, m, v) {
|
|
451
|
+
return c < m ? m : c > v ? v : c;
|
|
452
452
|
}
|
|
453
|
-
var
|
|
454
|
-
function
|
|
455
|
-
this.width =
|
|
453
|
+
var p = (function() {
|
|
454
|
+
function c(m, v) {
|
|
455
|
+
this.width = m, this.data = new Uint8ClampedArray(m * v);
|
|
456
456
|
}
|
|
457
|
-
return
|
|
458
|
-
return this.data[
|
|
459
|
-
},
|
|
460
|
-
this.data[
|
|
461
|
-
},
|
|
457
|
+
return c.prototype.get = function(m, v) {
|
|
458
|
+
return this.data[v * this.width + m];
|
|
459
|
+
}, c.prototype.set = function(m, v, y) {
|
|
460
|
+
this.data[v * this.width + m] = y;
|
|
461
|
+
}, c;
|
|
462
462
|
})();
|
|
463
|
-
function
|
|
464
|
-
if (
|
|
465
|
-
for (var C = new
|
|
466
|
-
var
|
|
467
|
-
C.set(
|
|
463
|
+
function u(c, m, v, y) {
|
|
464
|
+
if (c.length !== m * v * 4) throw new Error("Malformed data passed to binarizer.");
|
|
465
|
+
for (var C = new p(m, v), w = 0; w < m; w++) for (var b = 0; b < v; b++) {
|
|
466
|
+
var x = c[(b * m + w) * 4 + 0], B = c[(b * m + w) * 4 + 1], n = c[(b * m + w) * 4 + 2];
|
|
467
|
+
C.set(w, b, 0.2126 * x + 0.7152 * B + 0.0722 * n);
|
|
468
468
|
}
|
|
469
|
-
for (var
|
|
470
|
-
for (var
|
|
471
|
-
var N = C.get(
|
|
472
|
-
|
|
469
|
+
for (var l = Math.ceil(m / a), h = Math.ceil(v / a), f = new p(l, h), g = 0; g < h; g++) for (var P = 0; P < l; P++) {
|
|
470
|
+
for (var S = 0, M = 1 / 0, O = 0, b = 0; b < a; b++) for (var w = 0; w < a; w++) {
|
|
471
|
+
var N = C.get(P * a + w, g * a + b);
|
|
472
|
+
S += N, M = Math.min(M, N), O = Math.max(O, N);
|
|
473
473
|
}
|
|
474
|
-
var
|
|
475
|
-
if (
|
|
476
|
-
var
|
|
477
|
-
|
|
474
|
+
var F = S / Math.pow(a, 2);
|
|
475
|
+
if (O - M <= s && (F = M / 2, g > 0 && P > 0)) {
|
|
476
|
+
var A = (f.get(P, g - 1) + 2 * f.get(P - 1, g) + f.get(P - 1, g - 1)) / 4;
|
|
477
|
+
M < A && (F = A);
|
|
478
478
|
}
|
|
479
|
-
|
|
479
|
+
f.set(P, g, F);
|
|
480
480
|
}
|
|
481
|
-
var
|
|
482
|
-
|
|
483
|
-
for (var
|
|
484
|
-
for (var
|
|
485
|
-
for (var
|
|
486
|
-
var
|
|
487
|
-
|
|
481
|
+
var E = d.BitMatrix.createEmpty(m, v), L = null;
|
|
482
|
+
y && (L = d.BitMatrix.createEmpty(m, v));
|
|
483
|
+
for (var g = 0; g < h; g++) for (var P = 0; P < l; P++) {
|
|
484
|
+
for (var D = k(P, 2, l - 3), _ = k(g, 2, h - 3), S = 0, Q = -2; Q <= 2; Q++) for (var I = -2; I <= 2; I++) S += f.get(D + Q, _ + I);
|
|
485
|
+
for (var j = S / 25, Q = 0; Q < a; Q++) for (var I = 0; I < a; I++) {
|
|
486
|
+
var w = P * a + Q, b = g * a + I, z = C.get(w, b);
|
|
487
|
+
E.set(w, b, z <= j), y && L.set(w, b, !(z <= j));
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
|
-
return
|
|
491
|
-
binarized:
|
|
492
|
-
inverted:
|
|
493
|
-
} : { binarized:
|
|
490
|
+
return y ? {
|
|
491
|
+
binarized: E,
|
|
492
|
+
inverted: L
|
|
493
|
+
} : { binarized: E };
|
|
494
494
|
}
|
|
495
|
-
|
|
495
|
+
o.binarize = u;
|
|
496
496
|
}),
|
|
497
|
-
(function(
|
|
497
|
+
(function(r, o, i) {
|
|
498
498
|
"use strict";
|
|
499
|
-
Object.defineProperty(
|
|
500
|
-
var
|
|
501
|
-
function
|
|
502
|
-
for (var
|
|
503
|
-
|
|
504
|
-
return
|
|
499
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
500
|
+
var d = i(0), a = i(6), s = i(9), k = i(10);
|
|
501
|
+
function p(n, l) {
|
|
502
|
+
for (var h = n ^ l, f = 0; h; )
|
|
503
|
+
f++, h &= h - 1;
|
|
504
|
+
return f;
|
|
505
505
|
}
|
|
506
|
-
function
|
|
507
|
-
return
|
|
506
|
+
function u(n, l) {
|
|
507
|
+
return l << 1 | n;
|
|
508
508
|
}
|
|
509
|
-
var
|
|
509
|
+
var c = [
|
|
510
510
|
{
|
|
511
511
|
bits: 21522,
|
|
512
512
|
formatInfo: {
|
|
@@ -731,176 +731,176 @@ var N3 = /* @__PURE__ */ x3(((M, L) => {
|
|
|
731
731
|
dataMask: 7
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
|
-
],
|
|
735
|
-
function(
|
|
736
|
-
return (
|
|
734
|
+
], m = [
|
|
735
|
+
function(n) {
|
|
736
|
+
return (n.y + n.x) % 2 === 0;
|
|
737
737
|
},
|
|
738
|
-
function(
|
|
739
|
-
return
|
|
738
|
+
function(n) {
|
|
739
|
+
return n.y % 2 === 0;
|
|
740
740
|
},
|
|
741
|
-
function(
|
|
742
|
-
return
|
|
741
|
+
function(n) {
|
|
742
|
+
return n.x % 3 === 0;
|
|
743
743
|
},
|
|
744
|
-
function(
|
|
745
|
-
return (
|
|
744
|
+
function(n) {
|
|
745
|
+
return (n.y + n.x) % 3 === 0;
|
|
746
746
|
},
|
|
747
|
-
function(
|
|
748
|
-
return (Math.floor(
|
|
747
|
+
function(n) {
|
|
748
|
+
return (Math.floor(n.y / 2) + Math.floor(n.x / 3)) % 2 === 0;
|
|
749
749
|
},
|
|
750
|
-
function(
|
|
751
|
-
return
|
|
750
|
+
function(n) {
|
|
751
|
+
return n.x * n.y % 2 + n.x * n.y % 3 === 0;
|
|
752
752
|
},
|
|
753
|
-
function(
|
|
754
|
-
return (
|
|
753
|
+
function(n) {
|
|
754
|
+
return (n.y * n.x % 2 + n.y * n.x % 3) % 2 === 0;
|
|
755
755
|
},
|
|
756
|
-
function(
|
|
757
|
-
return ((
|
|
756
|
+
function(n) {
|
|
757
|
+
return ((n.y + n.x) % 2 + n.y * n.x % 3) % 2 === 0;
|
|
758
758
|
}
|
|
759
759
|
];
|
|
760
|
-
function
|
|
761
|
-
var
|
|
762
|
-
|
|
763
|
-
for (var
|
|
764
|
-
for (var
|
|
765
|
-
var
|
|
766
|
-
|
|
760
|
+
function v(n) {
|
|
761
|
+
var l = 17 + 4 * n.versionNumber, h = d.BitMatrix.createEmpty(l, l);
|
|
762
|
+
h.setRegion(0, 0, 9, 9, !0), h.setRegion(l - 8, 0, 8, 9, !0), h.setRegion(0, l - 8, 9, 8, !0);
|
|
763
|
+
for (var f = 0, g = n.alignmentPatternCenters; f < g.length; f++)
|
|
764
|
+
for (var P = g[f], S = 0, M = n.alignmentPatternCenters; S < M.length; S++) {
|
|
765
|
+
var O = M[S];
|
|
766
|
+
P === 6 && O === 6 || P === 6 && O === l - 7 || P === l - 7 && O === 6 || h.setRegion(P - 2, O - 2, 5, 5, !0);
|
|
767
767
|
}
|
|
768
|
-
return
|
|
768
|
+
return h.setRegion(6, 9, 1, l - 17, !0), h.setRegion(9, 6, l - 17, 1, !0), n.versionNumber > 6 && (h.setRegion(l - 11, 0, 3, 6, !0), h.setRegion(0, l - 11, 6, 3, !0)), h;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
771
|
-
for (var
|
|
772
|
-
|
|
773
|
-
for (var
|
|
774
|
-
for (var
|
|
775
|
-
var
|
|
776
|
-
if (!
|
|
777
|
-
|
|
778
|
-
var
|
|
779
|
-
|
|
780
|
-
y:
|
|
781
|
-
x:
|
|
782
|
-
}) && (
|
|
770
|
+
function y(n, l, h) {
|
|
771
|
+
for (var f = m[h.dataMask], g = n.height, P = v(l), S = [], M = 0, O = 0, N = !0, F = g - 1; F > 0; F -= 2) {
|
|
772
|
+
F === 6 && F--;
|
|
773
|
+
for (var A = 0; A < g; A++)
|
|
774
|
+
for (var E = N ? g - 1 - A : A, L = 0; L < 2; L++) {
|
|
775
|
+
var D = F - L;
|
|
776
|
+
if (!P.get(D, E)) {
|
|
777
|
+
O++;
|
|
778
|
+
var _ = n.get(D, E);
|
|
779
|
+
f({
|
|
780
|
+
y: E,
|
|
781
|
+
x: D
|
|
782
|
+
}) && (_ = !_), M = u(_, M), O === 8 && (S.push(M), O = 0, M = 0);
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
N = !N;
|
|
786
786
|
}
|
|
787
|
-
return
|
|
787
|
+
return S;
|
|
788
788
|
}
|
|
789
|
-
function C(
|
|
790
|
-
var
|
|
791
|
-
if (
|
|
792
|
-
for (var
|
|
793
|
-
for (var
|
|
794
|
-
for (var
|
|
795
|
-
var
|
|
796
|
-
if (
|
|
797
|
-
var
|
|
798
|
-
|
|
789
|
+
function C(n) {
|
|
790
|
+
var l = n.height, h = Math.floor((l - 17) / 4);
|
|
791
|
+
if (h <= 6) return k.VERSIONS[h - 1];
|
|
792
|
+
for (var f = 0, g = 5; g >= 0; g--) for (var P = l - 9; P >= l - 11; P--) f = u(n.get(P, g), f);
|
|
793
|
+
for (var S = 0, P = 5; P >= 0; P--) for (var g = l - 9; g >= l - 11; g--) S = u(n.get(P, g), S);
|
|
794
|
+
for (var M = 1 / 0, O, N = 0, F = k.VERSIONS; N < F.length; N++) {
|
|
795
|
+
var A = F[N];
|
|
796
|
+
if (A.infoBits === f || A.infoBits === S) return A;
|
|
797
|
+
var E = p(f, A.infoBits);
|
|
798
|
+
E < M && (O = A, M = E), E = p(S, A.infoBits), E < M && (O = A, M = E);
|
|
799
799
|
}
|
|
800
|
-
if (
|
|
800
|
+
if (M <= 3) return O;
|
|
801
801
|
}
|
|
802
|
-
function
|
|
803
|
-
for (var
|
|
804
|
-
for (var
|
|
805
|
-
for (var
|
|
806
|
-
for (var
|
|
807
|
-
for (var
|
|
808
|
-
var
|
|
809
|
-
if (
|
|
810
|
-
var
|
|
811
|
-
|
|
802
|
+
function w(n) {
|
|
803
|
+
for (var l = 0, h = 0; h <= 8; h++) h !== 6 && (l = u(n.get(h, 8), l));
|
|
804
|
+
for (var f = 7; f >= 0; f--) f !== 6 && (l = u(n.get(8, f), l));
|
|
805
|
+
for (var g = n.height, P = 0, f = g - 1; f >= g - 7; f--) P = u(n.get(8, f), P);
|
|
806
|
+
for (var h = g - 8; h < g; h++) P = u(n.get(h, 8), P);
|
|
807
|
+
for (var S = 1 / 0, M = null, O = 0, N = c; O < N.length; O++) {
|
|
808
|
+
var F = N[O], A = F.bits, E = F.formatInfo;
|
|
809
|
+
if (A === l || A === P) return E;
|
|
810
|
+
var L = p(l, A);
|
|
811
|
+
L < S && (M = E, S = L), l !== P && (L = p(P, A), L < S && (M = E, S = L));
|
|
812
812
|
}
|
|
813
|
-
return
|
|
813
|
+
return S <= 3 ? M : null;
|
|
814
814
|
}
|
|
815
|
-
function
|
|
816
|
-
var
|
|
817
|
-
if (
|
|
818
|
-
for (var
|
|
819
|
-
|
|
820
|
-
numDataCodewords:
|
|
815
|
+
function b(n, l, h) {
|
|
816
|
+
var f = l.errorCorrectionLevels[h], g = [], P = 0;
|
|
817
|
+
if (f.ecBlocks.forEach(function(_) {
|
|
818
|
+
for (var Q = 0; Q < _.numBlocks; Q++)
|
|
819
|
+
g.push({
|
|
820
|
+
numDataCodewords: _.dataCodewordsPerBlock,
|
|
821
821
|
codewords: []
|
|
822
|
-
}),
|
|
823
|
-
}),
|
|
824
|
-
|
|
825
|
-
for (var
|
|
826
|
-
var
|
|
827
|
-
|
|
822
|
+
}), P += _.dataCodewordsPerBlock + f.ecCodewordsPerBlock;
|
|
823
|
+
}), n.length < P) return null;
|
|
824
|
+
n = n.slice(0, P);
|
|
825
|
+
for (var S = f.ecBlocks[0].dataCodewordsPerBlock, M = 0; M < S; M++) for (var O = 0, N = g; O < N.length; O++) {
|
|
826
|
+
var F = N[O];
|
|
827
|
+
F.codewords.push(n.shift());
|
|
828
828
|
}
|
|
829
|
-
if (
|
|
830
|
-
for (var
|
|
831
|
-
for (;
|
|
832
|
-
var
|
|
833
|
-
|
|
829
|
+
if (f.ecBlocks.length > 1)
|
|
830
|
+
for (var A = f.ecBlocks[0].numBlocks, E = f.ecBlocks[1].numBlocks, M = 0; M < E; M++) g[A + M].codewords.push(n.shift());
|
|
831
|
+
for (; n.length > 0; ) for (var L = 0, D = g; L < D.length; L++) {
|
|
832
|
+
var F = D[L];
|
|
833
|
+
F.codewords.push(n.shift());
|
|
834
834
|
}
|
|
835
|
-
return
|
|
835
|
+
return g;
|
|
836
836
|
}
|
|
837
|
-
function
|
|
838
|
-
var
|
|
839
|
-
if (!
|
|
840
|
-
var
|
|
841
|
-
if (!
|
|
842
|
-
var
|
|
843
|
-
if (!
|
|
844
|
-
for (var
|
|
845
|
-
return
|
|
846
|
-
}, 0),
|
|
847
|
-
var N =
|
|
848
|
-
if (!
|
|
849
|
-
for (var
|
|
837
|
+
function x(n) {
|
|
838
|
+
var l = C(n);
|
|
839
|
+
if (!l) return null;
|
|
840
|
+
var h = w(n);
|
|
841
|
+
if (!h) return null;
|
|
842
|
+
var f = b(y(n, l, h), l, h.errorCorrectionLevel);
|
|
843
|
+
if (!f) return null;
|
|
844
|
+
for (var g = f.reduce(function(E, L) {
|
|
845
|
+
return E + L.numDataCodewords;
|
|
846
|
+
}, 0), P = new Uint8ClampedArray(g), S = 0, M = 0, O = f; M < O.length; M++) {
|
|
847
|
+
var N = O[M], F = s.decode(N.codewords, N.codewords.length - N.numDataCodewords);
|
|
848
|
+
if (!F) return null;
|
|
849
|
+
for (var A = 0; A < N.numDataCodewords; A++) P[S++] = F[A];
|
|
850
850
|
}
|
|
851
851
|
try {
|
|
852
|
-
return
|
|
852
|
+
return a.decode(P, l.versionNumber);
|
|
853
853
|
} catch {
|
|
854
854
|
return null;
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
if (
|
|
859
|
-
var
|
|
860
|
-
if (
|
|
861
|
-
for (var
|
|
862
|
-
return
|
|
857
|
+
function B(n) {
|
|
858
|
+
if (n == null) return null;
|
|
859
|
+
var l = x(n);
|
|
860
|
+
if (l) return l;
|
|
861
|
+
for (var h = 0; h < n.width; h++) for (var f = h + 1; f < n.height; f++) n.get(h, f) !== n.get(f, h) && (n.set(h, f, !n.get(h, f)), n.set(f, h, !n.get(f, h)));
|
|
862
|
+
return x(n);
|
|
863
863
|
}
|
|
864
|
-
|
|
864
|
+
o.decode = B;
|
|
865
865
|
}),
|
|
866
|
-
(function(
|
|
866
|
+
(function(r, o, i) {
|
|
867
867
|
"use strict";
|
|
868
|
-
Object.defineProperty(
|
|
869
|
-
var
|
|
868
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
869
|
+
var d = i(7), a = i(8), s;
|
|
870
870
|
(function(C) {
|
|
871
871
|
C.Numeric = "numeric", C.Alphanumeric = "alphanumeric", C.Byte = "byte", C.Kanji = "kanji", C.ECI = "eci";
|
|
872
|
-
})(
|
|
873
|
-
var
|
|
872
|
+
})(s = o.Mode || (o.Mode = {}));
|
|
873
|
+
var k;
|
|
874
874
|
(function(C) {
|
|
875
875
|
C[C.Terminator = 0] = "Terminator", C[C.Numeric = 1] = "Numeric", C[C.Alphanumeric = 2] = "Alphanumeric", C[C.Byte = 4] = "Byte", C[C.Kanji = 8] = "Kanji", C[C.ECI = 7] = "ECI";
|
|
876
|
-
})(
|
|
877
|
-
function
|
|
878
|
-
for (var
|
|
876
|
+
})(k || (k = {}));
|
|
877
|
+
function p(C, w) {
|
|
878
|
+
for (var b = [], x = "", B = [
|
|
879
879
|
10,
|
|
880
880
|
12,
|
|
881
881
|
14
|
|
882
|
-
][
|
|
883
|
-
var
|
|
884
|
-
if (
|
|
885
|
-
var
|
|
886
|
-
|
|
882
|
+
][w], n = C.readBits(B); n >= 3; ) {
|
|
883
|
+
var l = C.readBits(10);
|
|
884
|
+
if (l >= 1e3) throw new Error("Invalid numeric value above 999");
|
|
885
|
+
var h = Math.floor(l / 100), f = Math.floor(l / 10) % 10, g = l % 10;
|
|
886
|
+
b.push(48 + h, 48 + f, 48 + g), x += h.toString() + f.toString() + g.toString(), n -= 3;
|
|
887
887
|
}
|
|
888
|
-
if (
|
|
889
|
-
var
|
|
890
|
-
if (
|
|
891
|
-
var
|
|
892
|
-
|
|
893
|
-
} else if (
|
|
894
|
-
var
|
|
895
|
-
if (
|
|
896
|
-
|
|
888
|
+
if (n === 2) {
|
|
889
|
+
var l = C.readBits(7);
|
|
890
|
+
if (l >= 100) throw new Error("Invalid numeric value above 99");
|
|
891
|
+
var h = Math.floor(l / 10), f = l % 10;
|
|
892
|
+
b.push(48 + h, 48 + f), x += h.toString() + f.toString();
|
|
893
|
+
} else if (n === 1) {
|
|
894
|
+
var l = C.readBits(4);
|
|
895
|
+
if (l >= 10) throw new Error("Invalid numeric value above 9");
|
|
896
|
+
b.push(48 + l), x += l.toString();
|
|
897
897
|
}
|
|
898
898
|
return {
|
|
899
|
-
bytes:
|
|
900
|
-
text:
|
|
899
|
+
bytes: b,
|
|
900
|
+
text: x
|
|
901
901
|
};
|
|
902
902
|
}
|
|
903
|
-
var
|
|
903
|
+
var u = [
|
|
904
904
|
"0",
|
|
905
905
|
"1",
|
|
906
906
|
"2",
|
|
@@ -947,142 +947,142 @@ var N3 = /* @__PURE__ */ x3(((M, L) => {
|
|
|
947
947
|
"/",
|
|
948
948
|
":"
|
|
949
949
|
];
|
|
950
|
-
function
|
|
951
|
-
for (var
|
|
950
|
+
function c(C, w) {
|
|
951
|
+
for (var b = [], x = "", B = [
|
|
952
952
|
9,
|
|
953
953
|
11,
|
|
954
954
|
13
|
|
955
|
-
][
|
|
956
|
-
var
|
|
957
|
-
|
|
955
|
+
][w], n = C.readBits(B); n >= 2; ) {
|
|
956
|
+
var l = C.readBits(11), h = Math.floor(l / 45), f = l % 45;
|
|
957
|
+
b.push(u[h].charCodeAt(0), u[f].charCodeAt(0)), x += u[h] + u[f], n -= 2;
|
|
958
958
|
}
|
|
959
|
-
if (
|
|
960
|
-
var
|
|
961
|
-
|
|
959
|
+
if (n === 1) {
|
|
960
|
+
var h = C.readBits(6);
|
|
961
|
+
b.push(u[h].charCodeAt(0)), x += u[h];
|
|
962
962
|
}
|
|
963
963
|
return {
|
|
964
|
-
bytes:
|
|
965
|
-
text:
|
|
964
|
+
bytes: b,
|
|
965
|
+
text: x
|
|
966
966
|
};
|
|
967
967
|
}
|
|
968
|
-
function
|
|
969
|
-
for (var
|
|
968
|
+
function m(C, w) {
|
|
969
|
+
for (var b = [], x = "", B = [
|
|
970
970
|
8,
|
|
971
971
|
16,
|
|
972
972
|
16
|
|
973
|
-
][
|
|
974
|
-
var
|
|
975
|
-
|
|
973
|
+
][w], n = C.readBits(B), l = 0; l < n; l++) {
|
|
974
|
+
var h = C.readBits(8);
|
|
975
|
+
b.push(h);
|
|
976
976
|
}
|
|
977
977
|
try {
|
|
978
|
-
|
|
979
|
-
return "%" + ("0" +
|
|
978
|
+
x += decodeURIComponent(b.map(function(f) {
|
|
979
|
+
return "%" + ("0" + f.toString(16)).substr(-2);
|
|
980
980
|
}).join(""));
|
|
981
981
|
} catch {
|
|
982
982
|
}
|
|
983
983
|
return {
|
|
984
|
-
bytes:
|
|
985
|
-
text:
|
|
984
|
+
bytes: b,
|
|
985
|
+
text: x
|
|
986
986
|
};
|
|
987
987
|
}
|
|
988
|
-
function
|
|
989
|
-
for (var
|
|
988
|
+
function v(C, w) {
|
|
989
|
+
for (var b = [], x = "", B = [
|
|
990
990
|
8,
|
|
991
991
|
10,
|
|
992
992
|
12
|
|
993
|
-
][
|
|
994
|
-
var
|
|
995
|
-
|
|
993
|
+
][w], n = C.readBits(B), l = 0; l < n; l++) {
|
|
994
|
+
var h = C.readBits(13), f = Math.floor(h / 192) << 8 | h % 192;
|
|
995
|
+
f < 7936 ? f += 33088 : f += 49472, b.push(f >> 8, f & 255), x += String.fromCharCode(a.shiftJISTable[f]);
|
|
996
996
|
}
|
|
997
997
|
return {
|
|
998
|
-
bytes:
|
|
999
|
-
text:
|
|
998
|
+
bytes: b,
|
|
999
|
+
text: x
|
|
1000
1000
|
};
|
|
1001
1001
|
}
|
|
1002
|
-
function
|
|
1003
|
-
for (var
|
|
1002
|
+
function y(C, w) {
|
|
1003
|
+
for (var b, x, B, n, l = new d.BitStream(C), h = w <= 9 ? 0 : w <= 26 ? 1 : 2, f = {
|
|
1004
1004
|
text: "",
|
|
1005
1005
|
bytes: [],
|
|
1006
1006
|
chunks: [],
|
|
1007
|
-
version:
|
|
1008
|
-
};
|
|
1009
|
-
var
|
|
1010
|
-
if (
|
|
1011
|
-
if (
|
|
1012
|
-
type:
|
|
1013
|
-
assignmentNumber:
|
|
1014
|
-
}) :
|
|
1015
|
-
type:
|
|
1016
|
-
assignmentNumber:
|
|
1017
|
-
}) :
|
|
1018
|
-
type:
|
|
1019
|
-
assignmentNumber:
|
|
1020
|
-
}) :
|
|
1021
|
-
type:
|
|
1007
|
+
version: w
|
|
1008
|
+
}; l.available() >= 4; ) {
|
|
1009
|
+
var g = l.readBits(4);
|
|
1010
|
+
if (g === k.Terminator) return f;
|
|
1011
|
+
if (g === k.ECI) l.readBits(1) === 0 ? f.chunks.push({
|
|
1012
|
+
type: s.ECI,
|
|
1013
|
+
assignmentNumber: l.readBits(7)
|
|
1014
|
+
}) : l.readBits(1) === 0 ? f.chunks.push({
|
|
1015
|
+
type: s.ECI,
|
|
1016
|
+
assignmentNumber: l.readBits(14)
|
|
1017
|
+
}) : l.readBits(1) === 0 ? f.chunks.push({
|
|
1018
|
+
type: s.ECI,
|
|
1019
|
+
assignmentNumber: l.readBits(21)
|
|
1020
|
+
}) : f.chunks.push({
|
|
1021
|
+
type: s.ECI,
|
|
1022
1022
|
assignmentNumber: -1
|
|
1023
1023
|
});
|
|
1024
|
-
else if (
|
|
1025
|
-
var
|
|
1026
|
-
|
|
1027
|
-
type:
|
|
1028
|
-
text:
|
|
1024
|
+
else if (g === k.Numeric) {
|
|
1025
|
+
var P = p(l, h);
|
|
1026
|
+
f.text += P.text, (b = f.bytes).push.apply(b, P.bytes), f.chunks.push({
|
|
1027
|
+
type: s.Numeric,
|
|
1028
|
+
text: P.text
|
|
1029
1029
|
});
|
|
1030
|
-
} else if (
|
|
1031
|
-
var
|
|
1032
|
-
|
|
1033
|
-
type:
|
|
1034
|
-
text:
|
|
1030
|
+
} else if (g === k.Alphanumeric) {
|
|
1031
|
+
var S = c(l, h);
|
|
1032
|
+
f.text += S.text, (x = f.bytes).push.apply(x, S.bytes), f.chunks.push({
|
|
1033
|
+
type: s.Alphanumeric,
|
|
1034
|
+
text: S.text
|
|
1035
1035
|
});
|
|
1036
|
-
} else if (
|
|
1037
|
-
var
|
|
1038
|
-
|
|
1039
|
-
type:
|
|
1040
|
-
bytes:
|
|
1041
|
-
text:
|
|
1036
|
+
} else if (g === k.Byte) {
|
|
1037
|
+
var M = m(l, h);
|
|
1038
|
+
f.text += M.text, (B = f.bytes).push.apply(B, M.bytes), f.chunks.push({
|
|
1039
|
+
type: s.Byte,
|
|
1040
|
+
bytes: M.bytes,
|
|
1041
|
+
text: M.text
|
|
1042
1042
|
});
|
|
1043
|
-
} else if (
|
|
1044
|
-
var
|
|
1045
|
-
|
|
1046
|
-
type:
|
|
1047
|
-
bytes:
|
|
1048
|
-
text:
|
|
1043
|
+
} else if (g === k.Kanji) {
|
|
1044
|
+
var O = v(l, h);
|
|
1045
|
+
f.text += O.text, (n = f.bytes).push.apply(n, O.bytes), f.chunks.push({
|
|
1046
|
+
type: s.Kanji,
|
|
1047
|
+
bytes: O.bytes,
|
|
1048
|
+
text: O.text
|
|
1049
1049
|
});
|
|
1050
1050
|
}
|
|
1051
1051
|
}
|
|
1052
|
-
if (
|
|
1052
|
+
if (l.available() === 0 || l.readBits(l.available()) === 0) return f;
|
|
1053
1053
|
}
|
|
1054
|
-
|
|
1054
|
+
o.decode = y;
|
|
1055
1055
|
}),
|
|
1056
|
-
(function(
|
|
1056
|
+
(function(r, o, i) {
|
|
1057
1057
|
"use strict";
|
|
1058
|
-
Object.defineProperty(
|
|
1059
|
-
function
|
|
1060
|
-
this.byteOffset = 0, this.bitOffset = 0, this.bytes =
|
|
1058
|
+
Object.defineProperty(o, "__esModule", { value: !0 }), o.BitStream = (function() {
|
|
1059
|
+
function d(a) {
|
|
1060
|
+
this.byteOffset = 0, this.bitOffset = 0, this.bytes = a;
|
|
1061
1061
|
}
|
|
1062
|
-
return
|
|
1063
|
-
if (
|
|
1064
|
-
var
|
|
1062
|
+
return d.prototype.readBits = function(a) {
|
|
1063
|
+
if (a < 1 || a > 32 || a > this.available()) throw new Error("Cannot read " + a.toString() + " bits");
|
|
1064
|
+
var s = 0;
|
|
1065
1065
|
if (this.bitOffset > 0) {
|
|
1066
|
-
var
|
|
1067
|
-
|
|
1066
|
+
var k = 8 - this.bitOffset, p = a < k ? a : k, u = k - p, c = 255 >> 8 - p << u;
|
|
1067
|
+
s = (this.bytes[this.byteOffset] & c) >> u, a -= p, this.bitOffset += p, this.bitOffset === 8 && (this.bitOffset = 0, this.byteOffset++);
|
|
1068
1068
|
}
|
|
1069
|
-
if (
|
|
1070
|
-
for (;
|
|
1071
|
-
|
|
1072
|
-
if (
|
|
1073
|
-
var
|
|
1074
|
-
|
|
1069
|
+
if (a > 0) {
|
|
1070
|
+
for (; a >= 8; )
|
|
1071
|
+
s = s << 8 | this.bytes[this.byteOffset] & 255, this.byteOffset++, a -= 8;
|
|
1072
|
+
if (a > 0) {
|
|
1073
|
+
var u = 8 - a, c = 255 >> u << u;
|
|
1074
|
+
s = s << a | (this.bytes[this.byteOffset] & c) >> u, this.bitOffset += a;
|
|
1075
1075
|
}
|
|
1076
1076
|
}
|
|
1077
|
-
return
|
|
1078
|
-
},
|
|
1077
|
+
return s;
|
|
1078
|
+
}, d.prototype.available = function() {
|
|
1079
1079
|
return 8 * (this.bytes.length - this.byteOffset) - this.bitOffset;
|
|
1080
|
-
},
|
|
1080
|
+
}, d;
|
|
1081
1081
|
})();
|
|
1082
1082
|
}),
|
|
1083
|
-
(function(
|
|
1083
|
+
(function(r, o, i) {
|
|
1084
1084
|
"use strict";
|
|
1085
|
-
Object.defineProperty(
|
|
1085
|
+
Object.defineProperty(o, "__esModule", { value: !0 }), o.shiftJISTable = {
|
|
1086
1086
|
32: 32,
|
|
1087
1087
|
33: 33,
|
|
1088
1088
|
34: 34,
|
|
@@ -8122,65 +8122,65 @@ var N3 = /* @__PURE__ */ x3(((M, L) => {
|
|
|
8122
8122
|
60068: 29081
|
|
8123
8123
|
};
|
|
8124
8124
|
}),
|
|
8125
|
-
(function(
|
|
8125
|
+
(function(r, o, i) {
|
|
8126
8126
|
"use strict";
|
|
8127
|
-
Object.defineProperty(
|
|
8128
|
-
var
|
|
8129
|
-
function
|
|
8127
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
8128
|
+
var d = i(1), a = i(2);
|
|
8129
|
+
function s(c, m, v, y) {
|
|
8130
8130
|
var C;
|
|
8131
|
-
|
|
8132
|
-
for (var
|
|
8133
|
-
var
|
|
8134
|
-
if (
|
|
8135
|
-
|
|
8136
|
-
for (var
|
|
8137
|
-
var
|
|
8138
|
-
|
|
8131
|
+
m.degree() < v.degree() && (C = [v, m], m = C[0], v = C[1]);
|
|
8132
|
+
for (var w = m, b = v, x = c.zero, B = c.one; b.degree() >= y / 2; ) {
|
|
8133
|
+
var n = w, l = x;
|
|
8134
|
+
if (w = b, x = B, w.isZero()) return null;
|
|
8135
|
+
b = n;
|
|
8136
|
+
for (var h = c.zero, f = w.getCoefficient(w.degree()), g = c.inverse(f); b.degree() >= w.degree() && !b.isZero(); ) {
|
|
8137
|
+
var P = b.degree() - w.degree(), S = c.multiply(b.getCoefficient(b.degree()), g);
|
|
8138
|
+
h = h.addOrSubtract(c.buildMonomial(P, S)), b = b.addOrSubtract(w.multiplyByMonomial(P, S));
|
|
8139
8139
|
}
|
|
8140
|
-
if (
|
|
8140
|
+
if (B = h.multiplyPoly(x).addOrSubtract(l), b.degree() >= w.degree()) return null;
|
|
8141
8141
|
}
|
|
8142
|
-
var
|
|
8143
|
-
if (
|
|
8144
|
-
var
|
|
8145
|
-
return [
|
|
8142
|
+
var M = B.getCoefficient(0);
|
|
8143
|
+
if (M === 0) return null;
|
|
8144
|
+
var O = c.inverse(M);
|
|
8145
|
+
return [B.multiply(O), b.multiply(O)];
|
|
8146
8146
|
}
|
|
8147
|
-
function
|
|
8148
|
-
var
|
|
8149
|
-
if (
|
|
8150
|
-
for (var
|
|
8151
|
-
return C !==
|
|
8147
|
+
function k(c, m) {
|
|
8148
|
+
var v = m.degree();
|
|
8149
|
+
if (v === 1) return [m.getCoefficient(1)];
|
|
8150
|
+
for (var y = new Array(v), C = 0, w = 1; w < c.size && C < v; w++) m.evaluateAt(w) === 0 && (y[C] = c.inverse(w), C++);
|
|
8151
|
+
return C !== v ? null : y;
|
|
8152
8152
|
}
|
|
8153
|
-
function
|
|
8154
|
-
for (var
|
|
8155
|
-
for (var
|
|
8156
|
-
C[
|
|
8153
|
+
function p(c, m, v) {
|
|
8154
|
+
for (var y = v.length, C = new Array(y), w = 0; w < y; w++) {
|
|
8155
|
+
for (var b = c.inverse(v[w]), x = 1, B = 0; B < y; B++) w !== B && (x = c.multiply(x, d.addOrSubtractGF(1, c.multiply(v[B], b))));
|
|
8156
|
+
C[w] = c.multiply(m.evaluateAt(b), c.inverse(x)), c.generatorBase !== 0 && (C[w] = c.multiply(C[w], b));
|
|
8157
8157
|
}
|
|
8158
8158
|
return C;
|
|
8159
8159
|
}
|
|
8160
|
-
function
|
|
8161
|
-
var
|
|
8162
|
-
|
|
8163
|
-
for (var
|
|
8164
|
-
var
|
|
8165
|
-
|
|
8160
|
+
function u(c, m) {
|
|
8161
|
+
var v = new Uint8ClampedArray(c.length);
|
|
8162
|
+
v.set(c);
|
|
8163
|
+
for (var y = new d.default(285, 256, 0), C = new a.default(y, v), w = new Uint8ClampedArray(m), b = !1, x = 0; x < m; x++) {
|
|
8164
|
+
var B = C.evaluateAt(y.exp(x + y.generatorBase));
|
|
8165
|
+
w[w.length - 1 - x] = B, B !== 0 && (b = !0);
|
|
8166
8166
|
}
|
|
8167
|
-
if (!
|
|
8168
|
-
var
|
|
8169
|
-
if (
|
|
8170
|
-
var
|
|
8171
|
-
if (
|
|
8172
|
-
for (var
|
|
8173
|
-
var
|
|
8174
|
-
if (
|
|
8175
|
-
|
|
8167
|
+
if (!b) return v;
|
|
8168
|
+
var n = new a.default(y, w), l = s(y, y.buildMonomial(m, 1), n, m);
|
|
8169
|
+
if (l === null) return null;
|
|
8170
|
+
var h = k(y, l[0]);
|
|
8171
|
+
if (h == null) return null;
|
|
8172
|
+
for (var f = p(y, l[1], h), g = 0; g < h.length; g++) {
|
|
8173
|
+
var P = v.length - 1 - y.log(h[g]);
|
|
8174
|
+
if (P < 0) return null;
|
|
8175
|
+
v[P] = d.addOrSubtractGF(v[P], f[g]);
|
|
8176
8176
|
}
|
|
8177
|
-
return
|
|
8177
|
+
return v;
|
|
8178
8178
|
}
|
|
8179
|
-
|
|
8179
|
+
o.decode = u;
|
|
8180
8180
|
}),
|
|
8181
|
-
(function(
|
|
8181
|
+
(function(r, o, i) {
|
|
8182
8182
|
"use strict";
|
|
8183
|
-
Object.defineProperty(
|
|
8183
|
+
Object.defineProperty(o, "__esModule", { value: !0 }), o.VERSIONS = [
|
|
8184
8184
|
{
|
|
8185
8185
|
infoBits: null,
|
|
8186
8186
|
versionNumber: 1,
|
|
@@ -10169,474 +10169,474 @@ var N3 = /* @__PURE__ */ x3(((M, L) => {
|
|
|
10169
10169
|
}
|
|
10170
10170
|
];
|
|
10171
10171
|
}),
|
|
10172
|
-
(function(
|
|
10172
|
+
(function(r, o, i) {
|
|
10173
10173
|
"use strict";
|
|
10174
|
-
Object.defineProperty(
|
|
10175
|
-
var
|
|
10176
|
-
function
|
|
10177
|
-
var
|
|
10178
|
-
if (
|
|
10179
|
-
a11:
|
|
10180
|
-
a12:
|
|
10174
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
10175
|
+
var d = i(0);
|
|
10176
|
+
function a(u, c, m, v) {
|
|
10177
|
+
var y = u.x - c.x + m.x - v.x, C = u.y - c.y + m.y - v.y;
|
|
10178
|
+
if (y === 0 && C === 0) return {
|
|
10179
|
+
a11: c.x - u.x,
|
|
10180
|
+
a12: c.y - u.y,
|
|
10181
10181
|
a13: 0,
|
|
10182
|
-
a21:
|
|
10183
|
-
a22:
|
|
10182
|
+
a21: m.x - c.x,
|
|
10183
|
+
a22: m.y - c.y,
|
|
10184
10184
|
a23: 0,
|
|
10185
|
-
a31:
|
|
10186
|
-
a32:
|
|
10185
|
+
a31: u.x,
|
|
10186
|
+
a32: u.y,
|
|
10187
10187
|
a33: 1
|
|
10188
10188
|
};
|
|
10189
|
-
var
|
|
10189
|
+
var w = c.x - m.x, b = v.x - m.x, x = c.y - m.y, B = v.y - m.y, n = w * B - b * x, l = (y * B - b * C) / n, h = (w * C - y * x) / n;
|
|
10190
10190
|
return {
|
|
10191
|
-
a11:
|
|
10192
|
-
a12:
|
|
10193
|
-
a13:
|
|
10194
|
-
a21:
|
|
10195
|
-
a22:
|
|
10196
|
-
a23:
|
|
10197
|
-
a31:
|
|
10198
|
-
a32:
|
|
10191
|
+
a11: c.x - u.x + l * c.x,
|
|
10192
|
+
a12: c.y - u.y + l * c.y,
|
|
10193
|
+
a13: l,
|
|
10194
|
+
a21: v.x - u.x + h * v.x,
|
|
10195
|
+
a22: v.y - u.y + h * v.y,
|
|
10196
|
+
a23: h,
|
|
10197
|
+
a31: u.x,
|
|
10198
|
+
a32: u.y,
|
|
10199
10199
|
a33: 1
|
|
10200
10200
|
};
|
|
10201
10201
|
}
|
|
10202
|
-
function
|
|
10203
|
-
var
|
|
10202
|
+
function s(u, c, m, v) {
|
|
10203
|
+
var y = a(u, c, m, v);
|
|
10204
10204
|
return {
|
|
10205
|
-
a11:
|
|
10206
|
-
a12:
|
|
10207
|
-
a13:
|
|
10208
|
-
a21:
|
|
10209
|
-
a22:
|
|
10210
|
-
a23:
|
|
10211
|
-
a31:
|
|
10212
|
-
a32:
|
|
10213
|
-
a33:
|
|
10205
|
+
a11: y.a22 * y.a33 - y.a23 * y.a32,
|
|
10206
|
+
a12: y.a13 * y.a32 - y.a12 * y.a33,
|
|
10207
|
+
a13: y.a12 * y.a23 - y.a13 * y.a22,
|
|
10208
|
+
a21: y.a23 * y.a31 - y.a21 * y.a33,
|
|
10209
|
+
a22: y.a11 * y.a33 - y.a13 * y.a31,
|
|
10210
|
+
a23: y.a13 * y.a21 - y.a11 * y.a23,
|
|
10211
|
+
a31: y.a21 * y.a32 - y.a22 * y.a31,
|
|
10212
|
+
a32: y.a12 * y.a31 - y.a11 * y.a32,
|
|
10213
|
+
a33: y.a11 * y.a22 - y.a12 * y.a21
|
|
10214
10214
|
};
|
|
10215
10215
|
}
|
|
10216
|
-
function u
|
|
10216
|
+
function k(u, c) {
|
|
10217
10217
|
return {
|
|
10218
|
-
a11:
|
|
10219
|
-
a12:
|
|
10220
|
-
a13:
|
|
10221
|
-
a21:
|
|
10222
|
-
a22:
|
|
10223
|
-
a23:
|
|
10224
|
-
a31:
|
|
10225
|
-
a32:
|
|
10226
|
-
a33:
|
|
10218
|
+
a11: u.a11 * c.a11 + u.a21 * c.a12 + u.a31 * c.a13,
|
|
10219
|
+
a12: u.a12 * c.a11 + u.a22 * c.a12 + u.a32 * c.a13,
|
|
10220
|
+
a13: u.a13 * c.a11 + u.a23 * c.a12 + u.a33 * c.a13,
|
|
10221
|
+
a21: u.a11 * c.a21 + u.a21 * c.a22 + u.a31 * c.a23,
|
|
10222
|
+
a22: u.a12 * c.a21 + u.a22 * c.a22 + u.a32 * c.a23,
|
|
10223
|
+
a23: u.a13 * c.a21 + u.a23 * c.a22 + u.a33 * c.a23,
|
|
10224
|
+
a31: u.a11 * c.a31 + u.a21 * c.a32 + u.a31 * c.a33,
|
|
10225
|
+
a32: u.a12 * c.a31 + u.a22 * c.a32 + u.a32 * c.a33,
|
|
10226
|
+
a33: u.a13 * c.a31 + u.a23 * c.a32 + u.a33 * c.a33
|
|
10227
10227
|
};
|
|
10228
10228
|
}
|
|
10229
|
-
function
|
|
10230
|
-
for (var
|
|
10229
|
+
function p(u, c) {
|
|
10230
|
+
for (var m = s({
|
|
10231
10231
|
x: 3.5,
|
|
10232
10232
|
y: 3.5
|
|
10233
10233
|
}, {
|
|
10234
|
-
x:
|
|
10234
|
+
x: c.dimension - 3.5,
|
|
10235
10235
|
y: 3.5
|
|
10236
10236
|
}, {
|
|
10237
|
-
x:
|
|
10238
|
-
y:
|
|
10237
|
+
x: c.dimension - 6.5,
|
|
10238
|
+
y: c.dimension - 6.5
|
|
10239
10239
|
}, {
|
|
10240
10240
|
x: 3.5,
|
|
10241
|
-
y:
|
|
10242
|
-
}),
|
|
10243
|
-
var
|
|
10241
|
+
y: c.dimension - 3.5
|
|
10242
|
+
}), v = k(a(c.topLeft, c.topRight, c.alignmentPattern, c.bottomLeft), m), y = d.BitMatrix.createEmpty(c.dimension, c.dimension), C = function(B, n) {
|
|
10243
|
+
var l = v.a13 * B + v.a23 * n + v.a33;
|
|
10244
10244
|
return {
|
|
10245
|
-
x: (
|
|
10246
|
-
y: (
|
|
10245
|
+
x: (v.a11 * B + v.a21 * n + v.a31) / l,
|
|
10246
|
+
y: (v.a12 * B + v.a22 * n + v.a32) / l
|
|
10247
10247
|
};
|
|
10248
|
-
},
|
|
10249
|
-
var
|
|
10250
|
-
|
|
10248
|
+
}, w = 0; w < c.dimension; w++) for (var b = 0; b < c.dimension; b++) {
|
|
10249
|
+
var x = C(b + 0.5, w + 0.5);
|
|
10250
|
+
y.set(b, w, u.get(Math.floor(x.x), Math.floor(x.y)));
|
|
10251
10251
|
}
|
|
10252
10252
|
return {
|
|
10253
|
-
matrix:
|
|
10253
|
+
matrix: y,
|
|
10254
10254
|
mappingFunction: C
|
|
10255
10255
|
};
|
|
10256
10256
|
}
|
|
10257
|
-
|
|
10257
|
+
o.extract = p;
|
|
10258
10258
|
}),
|
|
10259
|
-
(function(
|
|
10259
|
+
(function(r, o, i) {
|
|
10260
10260
|
"use strict";
|
|
10261
|
-
Object.defineProperty(
|
|
10262
|
-
var
|
|
10263
|
-
return Math.sqrt(Math.pow(
|
|
10261
|
+
Object.defineProperty(o, "__esModule", { value: !0 });
|
|
10262
|
+
var d = 4, a = 0.5, s = 1.5, k = function(B, n) {
|
|
10263
|
+
return Math.sqrt(Math.pow(n.x - B.x, 2) + Math.pow(n.y - B.y, 2));
|
|
10264
10264
|
};
|
|
10265
|
-
function
|
|
10266
|
-
return
|
|
10267
|
-
return
|
|
10265
|
+
function p(B) {
|
|
10266
|
+
return B.reduce(function(n, l) {
|
|
10267
|
+
return n + l;
|
|
10268
10268
|
});
|
|
10269
10269
|
}
|
|
10270
|
-
function
|
|
10271
|
-
var
|
|
10272
|
-
return
|
|
10273
|
-
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
], N =
|
|
10277
|
-
|
|
10278
|
-
|
|
10279
|
-
|
|
10280
|
-
], N =
|
|
10281
|
-
|
|
10282
|
-
|
|
10283
|
-
|
|
10284
|
-
], N =
|
|
10270
|
+
function u(B, n, l) {
|
|
10271
|
+
var h, f, g, P, S = k(B, n), M = k(n, l), O = k(B, l), N, F, A;
|
|
10272
|
+
return M >= S && M >= O ? (h = [
|
|
10273
|
+
n,
|
|
10274
|
+
B,
|
|
10275
|
+
l
|
|
10276
|
+
], N = h[0], F = h[1], A = h[2]) : O >= M && O >= S ? (f = [
|
|
10277
|
+
B,
|
|
10278
|
+
n,
|
|
10279
|
+
l
|
|
10280
|
+
], N = f[0], F = f[1], A = f[2]) : (g = [
|
|
10281
|
+
B,
|
|
10282
|
+
l,
|
|
10283
|
+
n
|
|
10284
|
+
], N = g[0], F = g[1], A = g[2]), (A.x - F.x) * (N.y - F.y) - (A.y - F.y) * (N.x - F.x) < 0 && (P = [A, N], N = P[0], A = P[1]), {
|
|
10285
10285
|
bottomLeft: N,
|
|
10286
|
-
topLeft:
|
|
10287
|
-
topRight:
|
|
10286
|
+
topLeft: F,
|
|
10287
|
+
topRight: A
|
|
10288
10288
|
};
|
|
10289
10289
|
}
|
|
10290
|
-
function
|
|
10291
|
-
var
|
|
10292
|
-
if (
|
|
10293
|
-
var
|
|
10294
|
-
switch (
|
|
10290
|
+
function c(B, n, l, h) {
|
|
10291
|
+
var f = (p(v(B, l, h, 5)) / 7 + p(v(B, n, h, 5)) / 7 + p(v(l, B, h, 5)) / 7 + p(v(n, B, h, 5)) / 7) / 4;
|
|
10292
|
+
if (f < 1) throw new Error("Invalid module size");
|
|
10293
|
+
var g = Math.round(k(B, n) / f), P = Math.round(k(B, l) / f), S = Math.floor((g + P) / 2) + 7;
|
|
10294
|
+
switch (S % 4) {
|
|
10295
10295
|
case 0:
|
|
10296
|
-
|
|
10296
|
+
S++;
|
|
10297
10297
|
break;
|
|
10298
10298
|
case 2:
|
|
10299
|
-
|
|
10299
|
+
S--;
|
|
10300
10300
|
break;
|
|
10301
10301
|
}
|
|
10302
10302
|
return {
|
|
10303
|
-
dimension:
|
|
10304
|
-
moduleSize:
|
|
10303
|
+
dimension: S,
|
|
10304
|
+
moduleSize: f
|
|
10305
10305
|
};
|
|
10306
10306
|
}
|
|
10307
|
-
function
|
|
10308
|
-
var
|
|
10309
|
-
x: Math.floor(
|
|
10310
|
-
y: Math.floor(
|
|
10311
|
-
}],
|
|
10312
|
-
|
|
10313
|
-
for (var N = Math.abs(
|
|
10314
|
-
var
|
|
10315
|
-
if (
|
|
10316
|
-
x:
|
|
10317
|
-
y:
|
|
10318
|
-
}),
|
|
10307
|
+
function m(B, n, l, h) {
|
|
10308
|
+
var f = [{
|
|
10309
|
+
x: Math.floor(B.x),
|
|
10310
|
+
y: Math.floor(B.y)
|
|
10311
|
+
}], g = Math.abs(n.y - B.y) > Math.abs(n.x - B.x), P, S, M, O;
|
|
10312
|
+
g ? (P = Math.floor(B.y), S = Math.floor(B.x), M = Math.floor(n.y), O = Math.floor(n.x)) : (P = Math.floor(B.x), S = Math.floor(B.y), M = Math.floor(n.x), O = Math.floor(n.y));
|
|
10313
|
+
for (var N = Math.abs(M - P), F = Math.abs(O - S), A = Math.floor(-N / 2), E = P < M ? 1 : -1, L = S < O ? 1 : -1, D = !0, _ = P, Q = S; _ !== M + E; _ += E) {
|
|
10314
|
+
var I = g ? Q : _, j = g ? _ : Q;
|
|
10315
|
+
if (l.get(I, j) !== D && (D = !D, f.push({
|
|
10316
|
+
x: I,
|
|
10317
|
+
y: j
|
|
10318
|
+
}), f.length === h + 1))
|
|
10319
10319
|
break;
|
|
10320
|
-
if (
|
|
10321
|
-
if (
|
|
10322
|
-
|
|
10320
|
+
if (A += F, A > 0) {
|
|
10321
|
+
if (Q === O) break;
|
|
10322
|
+
Q += L, A -= N;
|
|
10323
10323
|
}
|
|
10324
10324
|
}
|
|
10325
|
-
for (var
|
|
10326
|
-
return
|
|
10325
|
+
for (var z = [], R = 0; R < h; R++) f[R] && f[R + 1] ? z.push(k(f[R], f[R + 1])) : z.push(0);
|
|
10326
|
+
return z;
|
|
10327
10327
|
}
|
|
10328
|
-
function
|
|
10329
|
-
var
|
|
10330
|
-
x:
|
|
10331
|
-
y:
|
|
10332
|
-
},
|
|
10333
|
-
return (
|
|
10328
|
+
function v(B, n, l, h) {
|
|
10329
|
+
var f, g = n.y - B.y, P = n.x - B.x, S = m(B, n, l, Math.ceil(h / 2)), M = m(B, {
|
|
10330
|
+
x: B.x - P,
|
|
10331
|
+
y: B.y - g
|
|
10332
|
+
}, l, Math.ceil(h / 2)), O = S.shift() + M.shift() - 1;
|
|
10333
|
+
return (f = M.concat(O)).concat.apply(f, S);
|
|
10334
10334
|
}
|
|
10335
|
-
function
|
|
10336
|
-
var
|
|
10337
|
-
return
|
|
10338
|
-
|
|
10335
|
+
function y(B, n) {
|
|
10336
|
+
var l = p(B) / p(n), h = 0;
|
|
10337
|
+
return n.forEach(function(f, g) {
|
|
10338
|
+
h += Math.pow(B[g] - f * l, 2);
|
|
10339
10339
|
}), {
|
|
10340
|
-
averageSize:
|
|
10341
|
-
error:
|
|
10340
|
+
averageSize: l,
|
|
10341
|
+
error: h
|
|
10342
10342
|
};
|
|
10343
10343
|
}
|
|
10344
|
-
function C(
|
|
10344
|
+
function C(B, n, l) {
|
|
10345
10345
|
try {
|
|
10346
|
-
var
|
|
10346
|
+
var h = v(B, {
|
|
10347
10347
|
x: -1,
|
|
10348
|
-
y:
|
|
10349
|
-
},
|
|
10350
|
-
x:
|
|
10348
|
+
y: B.y
|
|
10349
|
+
}, l, n.length), f = v(B, {
|
|
10350
|
+
x: B.x,
|
|
10351
10351
|
y: -1
|
|
10352
|
-
},
|
|
10353
|
-
x: Math.max(0,
|
|
10354
|
-
y: Math.max(0,
|
|
10355
|
-
},
|
|
10356
|
-
x: Math.min(
|
|
10357
|
-
y: Math.min(
|
|
10358
|
-
},
|
|
10359
|
-
return
|
|
10352
|
+
}, l, n.length), g = v(B, {
|
|
10353
|
+
x: Math.max(0, B.x - B.y) - 1,
|
|
10354
|
+
y: Math.max(0, B.y - B.x) - 1
|
|
10355
|
+
}, l, n.length), P = v(B, {
|
|
10356
|
+
x: Math.min(l.width, B.x + B.y) + 1,
|
|
10357
|
+
y: Math.min(l.height, B.y + B.x) + 1
|
|
10358
|
+
}, l, n.length), S = y(h, n), M = y(f, n), O = y(g, n), N = y(P, n), F = Math.sqrt(S.error * S.error + M.error * M.error + O.error * O.error + N.error * N.error), A = (S.averageSize + M.averageSize + O.averageSize + N.averageSize) / 4;
|
|
10359
|
+
return F + (Math.pow(S.averageSize - A, 2) + Math.pow(M.averageSize - A, 2) + Math.pow(O.averageSize - A, 2) + Math.pow(N.averageSize - A, 2)) / A;
|
|
10360
10360
|
} catch {
|
|
10361
10361
|
return 1 / 0;
|
|
10362
10362
|
}
|
|
10363
10363
|
}
|
|
10364
|
-
function
|
|
10365
|
-
for (var
|
|
10366
|
-
for (var
|
|
10367
|
-
for (var
|
|
10368
|
-
for (var
|
|
10364
|
+
function w(B, n) {
|
|
10365
|
+
for (var l = Math.round(n.x); B.get(l, Math.round(n.y)); ) l--;
|
|
10366
|
+
for (var h = Math.round(n.x); B.get(h, Math.round(n.y)); ) h++;
|
|
10367
|
+
for (var f = (l + h) / 2, g = Math.round(n.y); B.get(Math.round(f), g); ) g--;
|
|
10368
|
+
for (var P = Math.round(n.y); B.get(Math.round(f), P); ) P++;
|
|
10369
10369
|
return {
|
|
10370
|
-
x:
|
|
10371
|
-
y: (
|
|
10370
|
+
x: f,
|
|
10371
|
+
y: (g + P) / 2
|
|
10372
10372
|
};
|
|
10373
10373
|
}
|
|
10374
|
-
function
|
|
10375
|
-
for (var
|
|
10376
|
-
for (var
|
|
10374
|
+
function b(B) {
|
|
10375
|
+
for (var n = [], l = [], h = [], f = [], g = function(I) {
|
|
10376
|
+
for (var j = 0, z = !1, R = [
|
|
10377
10377
|
0,
|
|
10378
10378
|
0,
|
|
10379
10379
|
0,
|
|
10380
10380
|
0,
|
|
10381
10381
|
0
|
|
10382
|
-
],
|
|
10383
|
-
var
|
|
10384
|
-
if (
|
|
10382
|
+
], t3 = function(G) {
|
|
10383
|
+
var i3 = B.get(G, I);
|
|
10384
|
+
if (i3 === z) j++;
|
|
10385
10385
|
else {
|
|
10386
10386
|
R = [
|
|
10387
10387
|
R[1],
|
|
10388
10388
|
R[2],
|
|
10389
10389
|
R[3],
|
|
10390
10390
|
R[4],
|
|
10391
|
-
|
|
10392
|
-
],
|
|
10393
|
-
var
|
|
10394
|
-
if (
|
|
10395
|
-
var
|
|
10396
|
-
startX:
|
|
10397
|
-
endX:
|
|
10398
|
-
y:
|
|
10399
|
-
}, o3 =
|
|
10400
|
-
return
|
|
10391
|
+
j
|
|
10392
|
+
], j = 1, z = i3;
|
|
10393
|
+
var V = p(R) / 7, q3 = Math.abs(R[0] - V) < V && Math.abs(R[1] - V) < V && Math.abs(R[2] - 3 * V) < 3 * V && Math.abs(R[3] - V) < V && Math.abs(R[4] - V) < V && !i3, Y = p(R.slice(-3)) / 3, X3 = Math.abs(R[2] - Y) < Y && Math.abs(R[3] - Y) < Y && Math.abs(R[4] - Y) < Y && i3;
|
|
10394
|
+
if (q3) {
|
|
10395
|
+
var c3 = G - R[3] - R[4], r3 = c3 - R[2], W = {
|
|
10396
|
+
startX: r3,
|
|
10397
|
+
endX: c3,
|
|
10398
|
+
y: I
|
|
10399
|
+
}, o3 = l.filter(function(H) {
|
|
10400
|
+
return r3 >= H.bottom.startX && r3 <= H.bottom.endX || c3 >= H.bottom.startX && r3 <= H.bottom.endX || r3 <= H.bottom.startX && c3 >= H.bottom.endX && R[2] / (H.bottom.endX - H.bottom.startX) < s && R[2] / (H.bottom.endX - H.bottom.startX) > a;
|
|
10401
10401
|
});
|
|
10402
|
-
o3.length > 0 ? o3[0].bottom =
|
|
10403
|
-
top:
|
|
10404
|
-
bottom:
|
|
10402
|
+
o3.length > 0 ? o3[0].bottom = W : l.push({
|
|
10403
|
+
top: W,
|
|
10404
|
+
bottom: W
|
|
10405
10405
|
});
|
|
10406
10406
|
}
|
|
10407
|
-
if (
|
|
10408
|
-
var
|
|
10409
|
-
startX:
|
|
10410
|
-
y:
|
|
10411
|
-
endX:
|
|
10412
|
-
}, o3 =
|
|
10413
|
-
return
|
|
10407
|
+
if (X3) {
|
|
10408
|
+
var l3 = G - R[4], s3 = l3 - R[3], W = {
|
|
10409
|
+
startX: s3,
|
|
10410
|
+
y: I,
|
|
10411
|
+
endX: l3
|
|
10412
|
+
}, o3 = f.filter(function($) {
|
|
10413
|
+
return s3 >= $.bottom.startX && s3 <= $.bottom.endX || l3 >= $.bottom.startX && s3 <= $.bottom.endX || s3 <= $.bottom.startX && l3 >= $.bottom.endX && R[2] / ($.bottom.endX - $.bottom.startX) < s && R[2] / ($.bottom.endX - $.bottom.startX) > a;
|
|
10414
10414
|
});
|
|
10415
|
-
o3.length > 0 ? o3[0].bottom =
|
|
10416
|
-
top:
|
|
10417
|
-
bottom:
|
|
10415
|
+
o3.length > 0 ? o3[0].bottom = W : f.push({
|
|
10416
|
+
top: W,
|
|
10417
|
+
bottom: W
|
|
10418
10418
|
});
|
|
10419
10419
|
}
|
|
10420
10420
|
}
|
|
10421
|
-
},
|
|
10422
|
-
|
|
10423
|
-
return
|
|
10424
|
-
})),
|
|
10425
|
-
return
|
|
10426
|
-
}),
|
|
10427
|
-
return
|
|
10428
|
-
})),
|
|
10429
|
-
return
|
|
10421
|
+
}, q = -1; q <= B.width; q++) t3(q);
|
|
10422
|
+
n.push.apply(n, l.filter(function(G) {
|
|
10423
|
+
return G.bottom.y !== I && G.bottom.y - G.top.y >= 2;
|
|
10424
|
+
})), l = l.filter(function(G) {
|
|
10425
|
+
return G.bottom.y === I;
|
|
10426
|
+
}), h.push.apply(h, f.filter(function(G) {
|
|
10427
|
+
return G.bottom.y !== I;
|
|
10428
|
+
})), f = f.filter(function(G) {
|
|
10429
|
+
return G.bottom.y === I;
|
|
10430
10430
|
});
|
|
10431
|
-
},
|
|
10432
|
-
|
|
10433
|
-
return
|
|
10434
|
-
})),
|
|
10435
|
-
var
|
|
10436
|
-
return
|
|
10437
|
-
}).map(function(
|
|
10438
|
-
var
|
|
10439
|
-
if (
|
|
10431
|
+
}, P = 0; P <= B.height; P++) g(P);
|
|
10432
|
+
n.push.apply(n, l.filter(function(I) {
|
|
10433
|
+
return I.bottom.y - I.top.y >= 2;
|
|
10434
|
+
})), h.push.apply(h, f);
|
|
10435
|
+
var S = n.filter(function(I) {
|
|
10436
|
+
return I.bottom.y - I.top.y >= 2;
|
|
10437
|
+
}).map(function(I) {
|
|
10438
|
+
var j = (I.top.startX + I.top.endX + I.bottom.startX + I.bottom.endX) / 4, z = (I.top.y + I.bottom.y + 1) / 2;
|
|
10439
|
+
if (B.get(Math.round(j), Math.round(z))) {
|
|
10440
10440
|
var R = [
|
|
10441
|
-
|
|
10442
|
-
|
|
10443
|
-
|
|
10444
|
-
],
|
|
10441
|
+
I.top.endX - I.top.startX,
|
|
10442
|
+
I.bottom.endX - I.bottom.startX,
|
|
10443
|
+
I.bottom.y - I.top.y + 1
|
|
10444
|
+
], t3 = p(R) / R.length;
|
|
10445
10445
|
return {
|
|
10446
10446
|
score: C({
|
|
10447
|
-
x: Math.round(
|
|
10448
|
-
y: Math.round(
|
|
10447
|
+
x: Math.round(j),
|
|
10448
|
+
y: Math.round(z)
|
|
10449
10449
|
}, [
|
|
10450
10450
|
1,
|
|
10451
10451
|
1,
|
|
10452
10452
|
3,
|
|
10453
10453
|
1,
|
|
10454
10454
|
1
|
|
10455
|
-
],
|
|
10456
|
-
x:
|
|
10457
|
-
y:
|
|
10458
|
-
size:
|
|
10455
|
+
], B),
|
|
10456
|
+
x: j,
|
|
10457
|
+
y: z,
|
|
10458
|
+
size: t3
|
|
10459
10459
|
};
|
|
10460
10460
|
}
|
|
10461
|
-
}).filter(function(
|
|
10462
|
-
return !!
|
|
10463
|
-
}).sort(function(
|
|
10464
|
-
return
|
|
10465
|
-
}).map(function(
|
|
10466
|
-
if (
|
|
10467
|
-
var R =
|
|
10468
|
-
return
|
|
10469
|
-
}).map(function(
|
|
10461
|
+
}).filter(function(I) {
|
|
10462
|
+
return !!I;
|
|
10463
|
+
}).sort(function(I, j) {
|
|
10464
|
+
return I.score - j.score;
|
|
10465
|
+
}).map(function(I, j, z) {
|
|
10466
|
+
if (j > d) return null;
|
|
10467
|
+
var R = z.filter(function(q, G) {
|
|
10468
|
+
return j !== G;
|
|
10469
|
+
}).map(function(q) {
|
|
10470
10470
|
return {
|
|
10471
|
-
x:
|
|
10472
|
-
y:
|
|
10473
|
-
score:
|
|
10474
|
-
size:
|
|
10471
|
+
x: q.x,
|
|
10472
|
+
y: q.y,
|
|
10473
|
+
score: q.score + Math.pow(q.size - I.size, 2) / I.size,
|
|
10474
|
+
size: q.size
|
|
10475
10475
|
};
|
|
10476
|
-
}).sort(function(
|
|
10477
|
-
return
|
|
10476
|
+
}).sort(function(q, G) {
|
|
10477
|
+
return q.score - G.score;
|
|
10478
10478
|
});
|
|
10479
10479
|
if (R.length < 2) return null;
|
|
10480
|
-
var
|
|
10480
|
+
var t3 = I.score + R[0].score + R[1].score;
|
|
10481
10481
|
return {
|
|
10482
|
-
points: [
|
|
10483
|
-
score:
|
|
10482
|
+
points: [I].concat(R.slice(0, 2)),
|
|
10483
|
+
score: t3
|
|
10484
10484
|
};
|
|
10485
|
-
}).filter(function(
|
|
10486
|
-
return !!
|
|
10487
|
-
}).sort(function(
|
|
10488
|
-
return
|
|
10485
|
+
}).filter(function(I) {
|
|
10486
|
+
return !!I;
|
|
10487
|
+
}).sort(function(I, j) {
|
|
10488
|
+
return I.score - j.score;
|
|
10489
10489
|
});
|
|
10490
|
-
if (
|
|
10491
|
-
var
|
|
10492
|
-
|
|
10490
|
+
if (S.length === 0) return null;
|
|
10491
|
+
var M = u(S[0].points[0], S[0].points[1], S[0].points[2]), O = M.topRight, N = M.topLeft, F = M.bottomLeft, A = x(B, h, O, N, F), E = [];
|
|
10492
|
+
A && E.push({
|
|
10493
10493
|
alignmentPattern: {
|
|
10494
|
-
x:
|
|
10495
|
-
y:
|
|
10494
|
+
x: A.alignmentPattern.x,
|
|
10495
|
+
y: A.alignmentPattern.y
|
|
10496
10496
|
},
|
|
10497
10497
|
bottomLeft: {
|
|
10498
|
-
x:
|
|
10499
|
-
y:
|
|
10498
|
+
x: F.x,
|
|
10499
|
+
y: F.y
|
|
10500
10500
|
},
|
|
10501
|
-
dimension:
|
|
10501
|
+
dimension: A.dimension,
|
|
10502
10502
|
topLeft: {
|
|
10503
10503
|
x: N.x,
|
|
10504
10504
|
y: N.y
|
|
10505
10505
|
},
|
|
10506
10506
|
topRight: {
|
|
10507
|
-
x:
|
|
10508
|
-
y:
|
|
10507
|
+
x: O.x,
|
|
10508
|
+
y: O.y
|
|
10509
10509
|
}
|
|
10510
10510
|
});
|
|
10511
|
-
var
|
|
10512
|
-
return
|
|
10511
|
+
var L = w(B, O), D = w(B, N), _ = w(B, F), Q = x(B, h, L, D, _);
|
|
10512
|
+
return Q && E.push({
|
|
10513
10513
|
alignmentPattern: {
|
|
10514
|
-
x:
|
|
10515
|
-
y:
|
|
10514
|
+
x: Q.alignmentPattern.x,
|
|
10515
|
+
y: Q.alignmentPattern.y
|
|
10516
10516
|
},
|
|
10517
10517
|
bottomLeft: {
|
|
10518
|
-
x:
|
|
10519
|
-
y:
|
|
10518
|
+
x: _.x,
|
|
10519
|
+
y: _.y
|
|
10520
10520
|
},
|
|
10521
10521
|
topLeft: {
|
|
10522
|
-
x:
|
|
10523
|
-
y:
|
|
10522
|
+
x: D.x,
|
|
10523
|
+
y: D.y
|
|
10524
10524
|
},
|
|
10525
10525
|
topRight: {
|
|
10526
|
-
x:
|
|
10527
|
-
y:
|
|
10526
|
+
x: L.x,
|
|
10527
|
+
y: L.y
|
|
10528
10528
|
},
|
|
10529
|
-
dimension:
|
|
10530
|
-
}),
|
|
10529
|
+
dimension: Q.dimension
|
|
10530
|
+
}), E.length === 0 ? null : E;
|
|
10531
10531
|
}
|
|
10532
|
-
|
|
10533
|
-
function
|
|
10534
|
-
var
|
|
10532
|
+
o.locate = b;
|
|
10533
|
+
function x(B, n, l, h, f) {
|
|
10534
|
+
var g, P, S;
|
|
10535
10535
|
try {
|
|
10536
|
-
|
|
10536
|
+
g = c(h, l, f, B), P = g.dimension, S = g.moduleSize;
|
|
10537
10537
|
} catch {
|
|
10538
10538
|
return null;
|
|
10539
10539
|
}
|
|
10540
|
-
var
|
|
10541
|
-
x:
|
|
10542
|
-
y:
|
|
10543
|
-
},
|
|
10544
|
-
x:
|
|
10545
|
-
y:
|
|
10546
|
-
},
|
|
10547
|
-
var
|
|
10548
|
-
if (
|
|
10549
|
-
var
|
|
10550
|
-
|
|
10551
|
-
|
|
10552
|
-
|
|
10540
|
+
var M = {
|
|
10541
|
+
x: l.x - h.x + f.x,
|
|
10542
|
+
y: l.y - h.y + f.y
|
|
10543
|
+
}, O = (k(h, f) + k(h, l)) / 2 / S, N = 1 - 3 / O, F = {
|
|
10544
|
+
x: h.x + N * (M.x - h.x),
|
|
10545
|
+
y: h.y + N * (M.y - h.y)
|
|
10546
|
+
}, A = n.map(function(E) {
|
|
10547
|
+
var L = (E.top.startX + E.top.endX + E.bottom.startX + E.bottom.endX) / 4, D = (E.top.y + E.bottom.y + 1) / 2;
|
|
10548
|
+
if (B.get(Math.floor(L), Math.floor(D))) {
|
|
10549
|
+
var _ = [
|
|
10550
|
+
E.top.endX - E.top.startX,
|
|
10551
|
+
E.bottom.endX - E.bottom.startX,
|
|
10552
|
+
E.bottom.y - E.top.y + 1
|
|
10553
10553
|
];
|
|
10554
|
-
return
|
|
10555
|
-
x:
|
|
10556
|
-
y:
|
|
10554
|
+
return p(_) / _.length, {
|
|
10555
|
+
x: L,
|
|
10556
|
+
y: D,
|
|
10557
10557
|
score: C({
|
|
10558
|
-
x: Math.floor(
|
|
10559
|
-
y: Math.floor(
|
|
10558
|
+
x: Math.floor(L),
|
|
10559
|
+
y: Math.floor(D)
|
|
10560
10560
|
}, [
|
|
10561
10561
|
1,
|
|
10562
10562
|
1,
|
|
10563
10563
|
1
|
|
10564
|
-
],
|
|
10565
|
-
x:
|
|
10566
|
-
y:
|
|
10567
|
-
},
|
|
10564
|
+
], B) + k({
|
|
10565
|
+
x: L,
|
|
10566
|
+
y: D
|
|
10567
|
+
}, F)
|
|
10568
10568
|
};
|
|
10569
10569
|
}
|
|
10570
|
-
}).filter(function(
|
|
10571
|
-
return !!
|
|
10572
|
-
}).sort(function(
|
|
10573
|
-
return
|
|
10570
|
+
}).filter(function(E) {
|
|
10571
|
+
return !!E;
|
|
10572
|
+
}).sort(function(E, L) {
|
|
10573
|
+
return E.score - L.score;
|
|
10574
10574
|
});
|
|
10575
10575
|
return {
|
|
10576
|
-
alignmentPattern:
|
|
10577
|
-
dimension:
|
|
10576
|
+
alignmentPattern: O >= 15 && A.length ? A[0] : F,
|
|
10577
|
+
dimension: P
|
|
10578
10578
|
};
|
|
10579
10579
|
}
|
|
10580
10580
|
})
|
|
10581
10581
|
]).default;
|
|
10582
10582
|
});
|
|
10583
|
-
})),
|
|
10584
|
-
function
|
|
10585
|
-
const { isConnected:
|
|
10586
|
-
return
|
|
10587
|
-
if (!
|
|
10583
|
+
})), c2 = /* @__PURE__ */ s2(i2(), 1), l2 = 3e4, d2 = 200;
|
|
10584
|
+
function J2({ supabase: e, app: t, children: r }) {
|
|
10585
|
+
const { isConnected: o, isConnecting: i, session: d, deviceSessionId: a, connect: s, disconnect: k, error: p, clearError: u } = a2(), [c, m] = e3(!1), v = o && d && d.app !== t, y = !o || !!v;
|
|
10586
|
+
return Z(() => {
|
|
10587
|
+
if (!o) return;
|
|
10588
10588
|
(async () => {
|
|
10589
|
-
const { data: { session:
|
|
10590
|
-
if (!
|
|
10591
|
-
|
|
10589
|
+
const { data: { session: w } } = await e.auth.getSession();
|
|
10590
|
+
if (!w) {
|
|
10591
|
+
k(e);
|
|
10592
10592
|
return;
|
|
10593
10593
|
}
|
|
10594
|
-
if (
|
|
10595
|
-
const { data:
|
|
10596
|
-
(!
|
|
10594
|
+
if (e.realtime.setAuth(w.access_token), a) {
|
|
10595
|
+
const { data: b } = await e.from("device_sessions").select("status").eq("id", a).maybeSingle();
|
|
10596
|
+
(!b || b.status !== "active") && (m(!0), k(e));
|
|
10597
10597
|
}
|
|
10598
10598
|
})();
|
|
10599
|
-
}, []),
|
|
10600
|
-
if (!
|
|
10601
|
-
const C =
|
|
10599
|
+
}, []), Z(() => {
|
|
10600
|
+
if (!o || !a) return;
|
|
10601
|
+
const C = e.channel(`ds-watch-${a}-${Math.random()}`).on("postgres_changes", {
|
|
10602
10602
|
event: "UPDATE",
|
|
10603
10603
|
schema: "public",
|
|
10604
10604
|
table: "device_sessions",
|
|
10605
|
-
filter: `id=eq.${
|
|
10606
|
-
}, (
|
|
10607
|
-
|
|
10605
|
+
filter: `id=eq.${a}`
|
|
10606
|
+
}, (w) => {
|
|
10607
|
+
w.new?.status === "ended" && (m(!0), k(e));
|
|
10608
10608
|
}).subscribe();
|
|
10609
10609
|
return () => {
|
|
10610
|
-
|
|
10610
|
+
e.removeChannel(C);
|
|
10611
10611
|
};
|
|
10612
|
-
}, [
|
|
10613
|
-
if (!
|
|
10612
|
+
}, [o, a]), Z(() => {
|
|
10613
|
+
if (!o || !a) return;
|
|
10614
10614
|
const C = setInterval(() => {
|
|
10615
|
-
|
|
10616
|
-
},
|
|
10615
|
+
e.functions.invoke("session/keepalive", { body: { deviceSessionId: a } });
|
|
10616
|
+
}, l2);
|
|
10617
10617
|
return () => clearInterval(C);
|
|
10618
|
-
}, [
|
|
10619
|
-
app:
|
|
10620
|
-
sessionEnded:
|
|
10621
|
-
isConnecting:
|
|
10622
|
-
error:
|
|
10623
|
-
onConnect: (C) =>
|
|
10624
|
-
onClearError:
|
|
10625
|
-
onDismissEnded: () =>
|
|
10626
|
-
}) : /* @__PURE__ */
|
|
10618
|
+
}, [o, a]), y ? /* @__PURE__ */ T(u2, {
|
|
10619
|
+
app: t,
|
|
10620
|
+
sessionEnded: c,
|
|
10621
|
+
isConnecting: i,
|
|
10622
|
+
error: p,
|
|
10623
|
+
onConnect: (C) => s(C, e),
|
|
10624
|
+
onClearError: u,
|
|
10625
|
+
onDismissEnded: () => m(!1)
|
|
10626
|
+
}) : /* @__PURE__ */ T(u3, { children: r });
|
|
10627
10627
|
}
|
|
10628
|
-
var
|
|
10628
|
+
var M3 = {
|
|
10629
10629
|
pdv: "PDV",
|
|
10630
10630
|
kds: "KDS"
|
|
10631
10631
|
};
|
|
10632
|
-
function
|
|
10633
|
-
const
|
|
10634
|
-
function
|
|
10635
|
-
|
|
10636
|
-
}
|
|
10637
|
-
async function
|
|
10638
|
-
const
|
|
10639
|
-
|
|
10632
|
+
function u2({ app: e, sessionEnded: t, isConnecting: r, error: o, onConnect: i, onClearError: d, onDismissEnded: a }) {
|
|
10633
|
+
const s = J(null), k = J(null), p = J(null), u = J(0), c = J(0), m = J(!1), v = J(0), [y, C] = e3(!1), [w, b] = e3(null);
|
|
10634
|
+
function x() {
|
|
10635
|
+
v.current += 1, cancelAnimationFrame(u.current), p.current?.getTracks().forEach((O) => O.stop()), p.current = null, C(!1);
|
|
10636
|
+
}
|
|
10637
|
+
async function B() {
|
|
10638
|
+
const O = v.current;
|
|
10639
|
+
b(null);
|
|
10640
10640
|
let N;
|
|
10641
10641
|
try {
|
|
10642
10642
|
N = await navigator.mediaDevices.getUserMedia({ video: {
|
|
@@ -10645,72 +10645,72 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10645
10645
|
height: { ideal: 720 }
|
|
10646
10646
|
} });
|
|
10647
10647
|
} catch {
|
|
10648
|
-
if (
|
|
10649
|
-
|
|
10648
|
+
if (O !== v.current) return;
|
|
10649
|
+
b("Não foi possível acessar a câmera. Verifique as permissões.");
|
|
10650
10650
|
return;
|
|
10651
10651
|
}
|
|
10652
|
-
if (
|
|
10653
|
-
N.getTracks().forEach((
|
|
10652
|
+
if (O !== v.current) {
|
|
10653
|
+
N.getTracks().forEach((A) => A.stop());
|
|
10654
10654
|
return;
|
|
10655
10655
|
}
|
|
10656
|
-
if (
|
|
10657
|
-
|
|
10656
|
+
if (p.current = N, s.current) {
|
|
10657
|
+
s.current.srcObject = N;
|
|
10658
10658
|
try {
|
|
10659
|
-
await
|
|
10659
|
+
await s.current.play();
|
|
10660
10660
|
} catch {
|
|
10661
10661
|
}
|
|
10662
10662
|
}
|
|
10663
|
-
if (
|
|
10663
|
+
if (O !== v.current) return;
|
|
10664
10664
|
C(!0);
|
|
10665
|
-
const
|
|
10666
|
-
if (
|
|
10667
|
-
const
|
|
10668
|
-
if (!
|
|
10669
|
-
|
|
10665
|
+
const F = () => {
|
|
10666
|
+
if (O !== v.current) return;
|
|
10667
|
+
const A = s.current, E = k.current;
|
|
10668
|
+
if (!A || !E || A.readyState !== A.HAVE_ENOUGH_DATA) {
|
|
10669
|
+
u.current = requestAnimationFrame(F);
|
|
10670
10670
|
return;
|
|
10671
10671
|
}
|
|
10672
|
-
const
|
|
10673
|
-
if (
|
|
10674
|
-
|
|
10672
|
+
const L = performance.now();
|
|
10673
|
+
if (L - c.current < d2) {
|
|
10674
|
+
u.current = requestAnimationFrame(F);
|
|
10675
10675
|
return;
|
|
10676
10676
|
}
|
|
10677
|
-
|
|
10678
|
-
const
|
|
10679
|
-
if (!
|
|
10680
|
-
|
|
10677
|
+
c.current = L;
|
|
10678
|
+
const D = E.getContext("2d", { willReadFrequently: !0 });
|
|
10679
|
+
if (!D) {
|
|
10680
|
+
u.current = requestAnimationFrame(F);
|
|
10681
10681
|
return;
|
|
10682
10682
|
}
|
|
10683
|
-
|
|
10684
|
-
const
|
|
10685
|
-
if (
|
|
10686
|
-
|
|
10687
|
-
let
|
|
10683
|
+
E.width = A.videoWidth, E.height = A.videoHeight, D.drawImage(A, 0, 0, E.width, E.height);
|
|
10684
|
+
const _ = D.getImageData(0, 0, E.width, E.height), Q = (0, c2.default)(_.data, _.width, _.height, { inversionAttempts: "dontInvert" });
|
|
10685
|
+
if (Q?.data && !m.current) {
|
|
10686
|
+
m.current = !0, x();
|
|
10687
|
+
let I = Q.data.trim(), j = null;
|
|
10688
10688
|
try {
|
|
10689
|
-
const
|
|
10690
|
-
|
|
10689
|
+
const z = JSON.parse(Q.data);
|
|
10690
|
+
z?.otp && (I = z.otp, j = z.app ?? null);
|
|
10691
10691
|
} catch {
|
|
10692
10692
|
}
|
|
10693
|
-
if (
|
|
10694
|
-
|
|
10693
|
+
if (j !== null && j !== e) {
|
|
10694
|
+
m.current = !1, b(`Este QR code é para o app ${j.toUpperCase()}, mas este dispositivo é ${M3[e]}. Gere um novo código no Manager.`);
|
|
10695
10695
|
return;
|
|
10696
10696
|
}
|
|
10697
|
-
|
|
10698
|
-
|
|
10697
|
+
i(I).catch(() => {
|
|
10698
|
+
m.current = !1, B();
|
|
10699
10699
|
});
|
|
10700
10700
|
return;
|
|
10701
10701
|
}
|
|
10702
|
-
|
|
10702
|
+
u.current = requestAnimationFrame(F);
|
|
10703
10703
|
};
|
|
10704
|
-
|
|
10704
|
+
u.current = requestAnimationFrame(F);
|
|
10705
10705
|
}
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
}, [
|
|
10709
|
-
function
|
|
10710
|
-
|
|
10706
|
+
Z(() => (m.current = !1, B(), x), []), Z(() => {
|
|
10707
|
+
o && (m.current = !1, x(), B());
|
|
10708
|
+
}, [o]);
|
|
10709
|
+
function n() {
|
|
10710
|
+
d(), b(null), m.current = !1, x(), B();
|
|
10711
10711
|
}
|
|
10712
|
-
const
|
|
10713
|
-
return /* @__PURE__ */
|
|
10712
|
+
const l = r || m.current, h = 288, f = Math.round(h * 0.65), g = Math.round((h - f) / 2), P = "var(--primary, #f97316)", S = "rgba(0,0,0,0.60)", M = 20;
|
|
10713
|
+
return /* @__PURE__ */ U("div", {
|
|
10714
10714
|
style: {
|
|
10715
10715
|
display: "flex",
|
|
10716
10716
|
minHeight: "100vh",
|
|
@@ -10723,7 +10723,7 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10723
10723
|
boxSizing: "border-box"
|
|
10724
10724
|
},
|
|
10725
10725
|
children: [
|
|
10726
|
-
/* @__PURE__ */
|
|
10726
|
+
/* @__PURE__ */ U("div", {
|
|
10727
10727
|
style: {
|
|
10728
10728
|
display: "flex",
|
|
10729
10729
|
flexDirection: "column",
|
|
@@ -10732,42 +10732,42 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10732
10732
|
textAlign: "center"
|
|
10733
10733
|
},
|
|
10734
10734
|
children: [
|
|
10735
|
-
/* @__PURE__ */
|
|
10735
|
+
/* @__PURE__ */ T("div", {
|
|
10736
10736
|
style: {
|
|
10737
10737
|
borderRadius: "9999px",
|
|
10738
|
-
background: `color-mix(in oklch, ${
|
|
10738
|
+
background: `color-mix(in oklch, ${P} 15%, transparent)`,
|
|
10739
10739
|
padding: "1rem"
|
|
10740
10740
|
},
|
|
10741
|
-
children: /* @__PURE__ */
|
|
10741
|
+
children: /* @__PURE__ */ T(H3, { style: {
|
|
10742
10742
|
width: "2.5rem",
|
|
10743
10743
|
height: "2.5rem",
|
|
10744
|
-
color:
|
|
10744
|
+
color: P
|
|
10745
10745
|
} })
|
|
10746
10746
|
}),
|
|
10747
|
-
/* @__PURE__ */
|
|
10747
|
+
/* @__PURE__ */ U("h1", {
|
|
10748
10748
|
style: {
|
|
10749
10749
|
fontSize: "1.25rem",
|
|
10750
10750
|
fontWeight: 700,
|
|
10751
10751
|
margin: 0,
|
|
10752
10752
|
color: "var(--foreground, #f1f5f9)"
|
|
10753
10753
|
},
|
|
10754
|
-
children: ["tabl ", /* @__PURE__ */
|
|
10755
|
-
style: { color:
|
|
10756
|
-
children:
|
|
10754
|
+
children: ["tabl ", /* @__PURE__ */ T("span", {
|
|
10755
|
+
style: { color: P },
|
|
10756
|
+
children: M3[e]
|
|
10757
10757
|
})]
|
|
10758
10758
|
}),
|
|
10759
|
-
/* @__PURE__ */
|
|
10759
|
+
/* @__PURE__ */ T("p", {
|
|
10760
10760
|
style: {
|
|
10761
10761
|
fontSize: "0.875rem",
|
|
10762
10762
|
color: "var(--muted-foreground, #94a3b8)",
|
|
10763
10763
|
maxWidth: "20rem",
|
|
10764
10764
|
margin: 0
|
|
10765
10765
|
},
|
|
10766
|
-
children:
|
|
10766
|
+
children: t ? "Sessão encerrada pelo gerente. Escaneie um novo QR code para continuar." : "Escaneie o QR code gerado pelo Manager para autorizar este dispositivo."
|
|
10767
10767
|
})
|
|
10768
10768
|
]
|
|
10769
10769
|
}),
|
|
10770
|
-
|
|
10770
|
+
t && /* @__PURE__ */ U("div", {
|
|
10771
10771
|
style: {
|
|
10772
10772
|
display: "flex",
|
|
10773
10773
|
alignItems: "center",
|
|
@@ -10780,14 +10780,14 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10780
10780
|
color: "#d97706"
|
|
10781
10781
|
},
|
|
10782
10782
|
children: [
|
|
10783
|
-
/* @__PURE__ */
|
|
10783
|
+
/* @__PURE__ */ T($3, { style: {
|
|
10784
10784
|
width: "1rem",
|
|
10785
10785
|
height: "1rem",
|
|
10786
10786
|
flexShrink: 0
|
|
10787
10787
|
} }),
|
|
10788
10788
|
"Sessão encerrada",
|
|
10789
|
-
/* @__PURE__ */
|
|
10790
|
-
onClick:
|
|
10789
|
+
/* @__PURE__ */ T("button", {
|
|
10790
|
+
onClick: a,
|
|
10791
10791
|
style: {
|
|
10792
10792
|
marginLeft: "0.5rem",
|
|
10793
10793
|
fontSize: "0.75rem",
|
|
@@ -10802,11 +10802,11 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10802
10802
|
})
|
|
10803
10803
|
]
|
|
10804
10804
|
}),
|
|
10805
|
-
/* @__PURE__ */
|
|
10805
|
+
/* @__PURE__ */ U("div", {
|
|
10806
10806
|
style: {
|
|
10807
10807
|
position: "relative",
|
|
10808
|
-
width:
|
|
10809
|
-
height:
|
|
10808
|
+
width: h,
|
|
10809
|
+
height: h,
|
|
10810
10810
|
flexShrink: 0,
|
|
10811
10811
|
overflow: "hidden",
|
|
10812
10812
|
borderRadius: "1rem",
|
|
@@ -10814,8 +10814,8 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10814
10814
|
boxShadow: "0 20px 40px rgba(0,0,0,0.5)"
|
|
10815
10815
|
},
|
|
10816
10816
|
children: [
|
|
10817
|
-
/* @__PURE__ */
|
|
10818
|
-
ref:
|
|
10817
|
+
/* @__PURE__ */ T("video", {
|
|
10818
|
+
ref: s,
|
|
10819
10819
|
style: {
|
|
10820
10820
|
position: "absolute",
|
|
10821
10821
|
inset: 0,
|
|
@@ -10826,113 +10826,113 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10826
10826
|
muted: !0,
|
|
10827
10827
|
playsInline: !0
|
|
10828
10828
|
}),
|
|
10829
|
-
/* @__PURE__ */
|
|
10830
|
-
ref:
|
|
10829
|
+
/* @__PURE__ */ T("canvas", {
|
|
10830
|
+
ref: k,
|
|
10831
10831
|
style: { display: "none" }
|
|
10832
10832
|
}),
|
|
10833
|
-
|
|
10833
|
+
y && !l && /* @__PURE__ */ U("div", {
|
|
10834
10834
|
style: {
|
|
10835
10835
|
position: "absolute",
|
|
10836
10836
|
inset: 0,
|
|
10837
10837
|
pointerEvents: "none"
|
|
10838
10838
|
},
|
|
10839
10839
|
children: [
|
|
10840
|
-
/* @__PURE__ */
|
|
10840
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10841
10841
|
position: "absolute",
|
|
10842
10842
|
top: 0,
|
|
10843
10843
|
left: 0,
|
|
10844
10844
|
right: 0,
|
|
10845
|
-
height:
|
|
10846
|
-
background:
|
|
10845
|
+
height: g,
|
|
10846
|
+
background: S
|
|
10847
10847
|
} }),
|
|
10848
|
-
/* @__PURE__ */
|
|
10848
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10849
10849
|
position: "absolute",
|
|
10850
10850
|
bottom: 0,
|
|
10851
10851
|
left: 0,
|
|
10852
10852
|
right: 0,
|
|
10853
|
-
height:
|
|
10854
|
-
background:
|
|
10853
|
+
height: g,
|
|
10854
|
+
background: S
|
|
10855
10855
|
} }),
|
|
10856
|
-
/* @__PURE__ */
|
|
10856
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10857
10857
|
position: "absolute",
|
|
10858
|
-
top:
|
|
10858
|
+
top: g,
|
|
10859
10859
|
left: 0,
|
|
10860
|
-
width:
|
|
10861
|
-
height:
|
|
10862
|
-
background:
|
|
10860
|
+
width: g,
|
|
10861
|
+
height: f,
|
|
10862
|
+
background: S
|
|
10863
10863
|
} }),
|
|
10864
|
-
/* @__PURE__ */
|
|
10864
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10865
10865
|
position: "absolute",
|
|
10866
|
-
top:
|
|
10866
|
+
top: g,
|
|
10867
10867
|
right: 0,
|
|
10868
|
-
width:
|
|
10869
|
-
height:
|
|
10870
|
-
background:
|
|
10868
|
+
width: g,
|
|
10869
|
+
height: f,
|
|
10870
|
+
background: S
|
|
10871
10871
|
} }),
|
|
10872
|
-
/* @__PURE__ */
|
|
10872
|
+
/* @__PURE__ */ U("div", {
|
|
10873
10873
|
style: {
|
|
10874
10874
|
position: "absolute",
|
|
10875
|
-
top:
|
|
10876
|
-
left:
|
|
10877
|
-
width:
|
|
10878
|
-
height:
|
|
10875
|
+
top: g,
|
|
10876
|
+
left: g,
|
|
10877
|
+
width: f,
|
|
10878
|
+
height: f,
|
|
10879
10879
|
overflow: "hidden"
|
|
10880
10880
|
},
|
|
10881
10881
|
children: [
|
|
10882
|
-
/* @__PURE__ */
|
|
10882
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10883
10883
|
position: "absolute",
|
|
10884
10884
|
top: 0,
|
|
10885
10885
|
left: 0,
|
|
10886
|
-
width:
|
|
10887
|
-
height:
|
|
10888
|
-
borderTop: `2px solid ${
|
|
10889
|
-
borderLeft: `2px solid ${
|
|
10886
|
+
width: M,
|
|
10887
|
+
height: M,
|
|
10888
|
+
borderTop: `2px solid ${P}`,
|
|
10889
|
+
borderLeft: `2px solid ${P}`,
|
|
10890
10890
|
borderRadius: "3px 0 0 0"
|
|
10891
10891
|
} }),
|
|
10892
|
-
/* @__PURE__ */
|
|
10892
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10893
10893
|
position: "absolute",
|
|
10894
10894
|
top: 0,
|
|
10895
10895
|
right: 0,
|
|
10896
|
-
width:
|
|
10897
|
-
height:
|
|
10898
|
-
borderTop: `2px solid ${
|
|
10899
|
-
borderRight: `2px solid ${
|
|
10896
|
+
width: M,
|
|
10897
|
+
height: M,
|
|
10898
|
+
borderTop: `2px solid ${P}`,
|
|
10899
|
+
borderRight: `2px solid ${P}`,
|
|
10900
10900
|
borderRadius: "0 3px 0 0"
|
|
10901
10901
|
} }),
|
|
10902
|
-
/* @__PURE__ */
|
|
10902
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10903
10903
|
position: "absolute",
|
|
10904
10904
|
bottom: 0,
|
|
10905
10905
|
left: 0,
|
|
10906
|
-
width:
|
|
10907
|
-
height:
|
|
10908
|
-
borderBottom: `2px solid ${
|
|
10909
|
-
borderLeft: `2px solid ${
|
|
10906
|
+
width: M,
|
|
10907
|
+
height: M,
|
|
10908
|
+
borderBottom: `2px solid ${P}`,
|
|
10909
|
+
borderLeft: `2px solid ${P}`,
|
|
10910
10910
|
borderRadius: "0 0 0 3px"
|
|
10911
10911
|
} }),
|
|
10912
|
-
/* @__PURE__ */
|
|
10912
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10913
10913
|
position: "absolute",
|
|
10914
10914
|
bottom: 0,
|
|
10915
10915
|
right: 0,
|
|
10916
|
-
width:
|
|
10917
|
-
height:
|
|
10918
|
-
borderBottom: `2px solid ${
|
|
10919
|
-
borderRight: `2px solid ${
|
|
10916
|
+
width: M,
|
|
10917
|
+
height: M,
|
|
10918
|
+
borderBottom: `2px solid ${P}`,
|
|
10919
|
+
borderRight: `2px solid ${P}`,
|
|
10920
10920
|
borderRadius: "0 0 3px 0"
|
|
10921
10921
|
} }),
|
|
10922
|
-
/* @__PURE__ */
|
|
10922
|
+
/* @__PURE__ */ T("div", { style: {
|
|
10923
10923
|
position: "absolute",
|
|
10924
10924
|
left: 0,
|
|
10925
10925
|
right: 0,
|
|
10926
10926
|
height: 2,
|
|
10927
|
-
background: `linear-gradient(90deg, transparent, ${
|
|
10928
|
-
boxShadow: `0 0 6px ${
|
|
10927
|
+
background: `linear-gradient(90deg, transparent, ${P}, transparent)`,
|
|
10928
|
+
boxShadow: `0 0 6px ${P}`,
|
|
10929
10929
|
animation: "tabl-scan 2s ease-in-out infinite"
|
|
10930
10930
|
} })
|
|
10931
10931
|
]
|
|
10932
10932
|
})
|
|
10933
10933
|
]
|
|
10934
10934
|
}),
|
|
10935
|
-
!
|
|
10935
|
+
!y && !w && /* @__PURE__ */ U("div", {
|
|
10936
10936
|
style: {
|
|
10937
10937
|
position: "absolute",
|
|
10938
10938
|
inset: 0,
|
|
@@ -10943,12 +10943,12 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10943
10943
|
gap: "0.75rem",
|
|
10944
10944
|
background: "rgba(0,0,0,0.85)"
|
|
10945
10945
|
},
|
|
10946
|
-
children: [/* @__PURE__ */
|
|
10946
|
+
children: [/* @__PURE__ */ T(v3, { style: {
|
|
10947
10947
|
width: "2rem",
|
|
10948
10948
|
height: "2rem",
|
|
10949
|
-
color:
|
|
10949
|
+
color: P,
|
|
10950
10950
|
animation: "tabl-spin 1s linear infinite"
|
|
10951
|
-
} }), /* @__PURE__ */
|
|
10951
|
+
} }), /* @__PURE__ */ T("span", {
|
|
10952
10952
|
style: {
|
|
10953
10953
|
fontSize: "0.75rem",
|
|
10954
10954
|
color: "rgba(255,255,255,0.6)"
|
|
@@ -10956,7 +10956,7 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10956
10956
|
children: "Acessando câmera..."
|
|
10957
10957
|
})]
|
|
10958
10958
|
}),
|
|
10959
|
-
|
|
10959
|
+
l && /* @__PURE__ */ U("div", {
|
|
10960
10960
|
style: {
|
|
10961
10961
|
position: "absolute",
|
|
10962
10962
|
inset: 0,
|
|
@@ -10967,12 +10967,12 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10967
10967
|
gap: "0.75rem",
|
|
10968
10968
|
background: "rgba(0,0,0,0.75)"
|
|
10969
10969
|
},
|
|
10970
|
-
children: [/* @__PURE__ */
|
|
10970
|
+
children: [/* @__PURE__ */ T(v3, { style: {
|
|
10971
10971
|
width: "2.5rem",
|
|
10972
10972
|
height: "2.5rem",
|
|
10973
|
-
color:
|
|
10973
|
+
color: P,
|
|
10974
10974
|
animation: "tabl-spin 1s linear infinite"
|
|
10975
|
-
} }), /* @__PURE__ */
|
|
10975
|
+
} }), /* @__PURE__ */ T("span", {
|
|
10976
10976
|
style: {
|
|
10977
10977
|
fontSize: "0.875rem",
|
|
10978
10978
|
fontWeight: 500,
|
|
@@ -10983,7 +10983,7 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10983
10983
|
})
|
|
10984
10984
|
]
|
|
10985
10985
|
}),
|
|
10986
|
-
(
|
|
10986
|
+
(w || o) && /* @__PURE__ */ U("div", {
|
|
10987
10987
|
style: {
|
|
10988
10988
|
display: "flex",
|
|
10989
10989
|
flexDirection: "column",
|
|
@@ -10996,15 +10996,15 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
10996
10996
|
maxWidth: "20rem",
|
|
10997
10997
|
boxSizing: "border-box"
|
|
10998
10998
|
},
|
|
10999
|
-
children: [/* @__PURE__ */
|
|
10999
|
+
children: [/* @__PURE__ */ T("p", {
|
|
11000
11000
|
style: {
|
|
11001
11001
|
fontSize: "0.875rem",
|
|
11002
11002
|
color: "#ef4444",
|
|
11003
11003
|
margin: 0
|
|
11004
11004
|
},
|
|
11005
|
-
children:
|
|
11006
|
-
}), /* @__PURE__ */
|
|
11007
|
-
onClick:
|
|
11005
|
+
children: w ?? o
|
|
11006
|
+
}), /* @__PURE__ */ T("button", {
|
|
11007
|
+
onClick: n,
|
|
11008
11008
|
style: {
|
|
11009
11009
|
alignSelf: "flex-end",
|
|
11010
11010
|
fontSize: "0.75rem",
|
|
@@ -11018,7 +11018,7 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
11018
11018
|
children: "Tentar novamente"
|
|
11019
11019
|
})]
|
|
11020
11020
|
}),
|
|
11021
|
-
/* @__PURE__ */
|
|
11021
|
+
/* @__PURE__ */ T("style", { children: `
|
|
11022
11022
|
@keyframes tabl-scan {
|
|
11023
11023
|
0% { top: 0px; }
|
|
11024
11024
|
50% { top: calc(100% - 2px); }
|
|
@@ -11032,26 +11032,1427 @@ function R3({ app: M, sessionEnded: L, isConnecting: O, error: v, onConnect: b,
|
|
|
11032
11032
|
]
|
|
11033
11033
|
});
|
|
11034
11034
|
}
|
|
11035
|
-
function
|
|
11036
|
-
const { url:
|
|
11037
|
-
if (!
|
|
11038
|
-
return
|
|
11035
|
+
function Y2(e) {
|
|
11036
|
+
const { url: t, anonKey: r, realtimeEventsPerSecond: o = 10 } = e;
|
|
11037
|
+
if (!t || !r) throw new Error("[tabl.io/auth] VITE_TABL_SERVER_URL e VITE_TABL_SERVER_ANON_KEY são obrigatórios.");
|
|
11038
|
+
return W3(t, r, {
|
|
11039
11039
|
auth: {
|
|
11040
11040
|
persistSession: !0,
|
|
11041
11041
|
autoRefreshToken: !0
|
|
11042
11042
|
},
|
|
11043
|
-
realtime: { params: { eventsPerSecond:
|
|
11043
|
+
realtime: { params: { eventsPerSecond: o } }
|
|
11044
|
+
});
|
|
11045
|
+
}
|
|
11046
|
+
var k3 = class {
|
|
11047
|
+
constructor() {
|
|
11048
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
11049
|
+
}
|
|
11050
|
+
subscribe(e) {
|
|
11051
|
+
return this.listeners.add(e), this.onSubscribe(), () => {
|
|
11052
|
+
this.listeners.delete(e), this.onUnsubscribe();
|
|
11053
|
+
};
|
|
11054
|
+
}
|
|
11055
|
+
hasListeners() {
|
|
11056
|
+
return this.listeners.size > 0;
|
|
11057
|
+
}
|
|
11058
|
+
onSubscribe() {
|
|
11059
|
+
}
|
|
11060
|
+
onUnsubscribe() {
|
|
11061
|
+
}
|
|
11062
|
+
}, f2 = {
|
|
11063
|
+
setTimeout: (e, t) => setTimeout(e, t),
|
|
11064
|
+
clearTimeout: (e) => clearTimeout(e),
|
|
11065
|
+
setInterval: (e, t) => setInterval(e, t),
|
|
11066
|
+
clearInterval: (e) => clearInterval(e)
|
|
11067
|
+
}, h2 = class {
|
|
11068
|
+
#e = f2;
|
|
11069
|
+
#t = !1;
|
|
11070
|
+
setTimeoutProvider(e) {
|
|
11071
|
+
process.env.NODE_ENV !== "production" && this.#t && e !== this.#e && console.error("[timeoutManager]: Switching provider after calls to previous provider might result in unexpected behavior.", {
|
|
11072
|
+
previous: this.#e,
|
|
11073
|
+
provider: e
|
|
11074
|
+
}), this.#e = e, process.env.NODE_ENV !== "production" && (this.#t = !1);
|
|
11075
|
+
}
|
|
11076
|
+
setTimeout(e, t) {
|
|
11077
|
+
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setTimeout(e, t);
|
|
11078
|
+
}
|
|
11079
|
+
clearTimeout(e) {
|
|
11080
|
+
this.#e.clearTimeout(e);
|
|
11081
|
+
}
|
|
11082
|
+
setInterval(e, t) {
|
|
11083
|
+
return process.env.NODE_ENV !== "production" && (this.#t = !0), this.#e.setInterval(e, t);
|
|
11084
|
+
}
|
|
11085
|
+
clearInterval(e) {
|
|
11086
|
+
this.#e.clearInterval(e);
|
|
11087
|
+
}
|
|
11088
|
+
}, C3 = new h2();
|
|
11089
|
+
function k2(e) {
|
|
11090
|
+
setTimeout(e, 0);
|
|
11091
|
+
}
|
|
11092
|
+
var B3 = typeof window > "u" || "Deno" in globalThis;
|
|
11093
|
+
function X() {
|
|
11094
|
+
}
|
|
11095
|
+
function B2(e, t) {
|
|
11096
|
+
return typeof e == "function" ? e(t) : e;
|
|
11097
|
+
}
|
|
11098
|
+
function m2(e) {
|
|
11099
|
+
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
11100
|
+
}
|
|
11101
|
+
function v2(e, t) {
|
|
11102
|
+
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
11103
|
+
}
|
|
11104
|
+
function w3(e, t) {
|
|
11105
|
+
return typeof e == "function" ? e(t) : e;
|
|
11106
|
+
}
|
|
11107
|
+
function C2(e, t) {
|
|
11108
|
+
return typeof e == "function" ? e(t) : e;
|
|
11109
|
+
}
|
|
11110
|
+
function S3(e, t) {
|
|
11111
|
+
const { type: r = "all", exact: o, fetchStatus: i, predicate: d, queryKey: a, stale: s } = e;
|
|
11112
|
+
if (a) {
|
|
11113
|
+
if (o) {
|
|
11114
|
+
if (t.queryHash !== g3(a, t.options)) return !1;
|
|
11115
|
+
} else if (!a3(t.queryKey, a)) return !1;
|
|
11116
|
+
}
|
|
11117
|
+
if (r !== "all") {
|
|
11118
|
+
const k = t.isActive();
|
|
11119
|
+
if (r === "active" && !k || r === "inactive" && k) return !1;
|
|
11120
|
+
}
|
|
11121
|
+
return !(typeof s == "boolean" && t.isStale() !== s || i && i !== t.state.fetchStatus || d && !d(t));
|
|
11122
|
+
}
|
|
11123
|
+
function O3(e, t) {
|
|
11124
|
+
const { exact: r, status: o, predicate: i, mutationKey: d } = e;
|
|
11125
|
+
if (d) {
|
|
11126
|
+
if (!t.options.mutationKey) return !1;
|
|
11127
|
+
if (r) {
|
|
11128
|
+
if (n3(t.options.mutationKey) !== n3(d)) return !1;
|
|
11129
|
+
} else if (!a3(t.options.mutationKey, d)) return !1;
|
|
11130
|
+
}
|
|
11131
|
+
return !(o && t.state.status !== o || i && !i(t));
|
|
11132
|
+
}
|
|
11133
|
+
function g3(e, t) {
|
|
11134
|
+
return (t?.queryKeyHashFn || n3)(e);
|
|
11135
|
+
}
|
|
11136
|
+
function n3(e) {
|
|
11137
|
+
return JSON.stringify(e, (t, r) => P3(r) ? Object.keys(r).sort().reduce((o, i) => (o[i] = r[i], o), {}) : r);
|
|
11138
|
+
}
|
|
11139
|
+
function a3(e, t) {
|
|
11140
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? Object.keys(t).every((r) => a3(e[r], t[r])) : !1;
|
|
11141
|
+
}
|
|
11142
|
+
var w2 = Object.prototype.hasOwnProperty;
|
|
11143
|
+
function y3(e, t, r = 0) {
|
|
11144
|
+
if (e === t) return e;
|
|
11145
|
+
if (r > 500) return t;
|
|
11146
|
+
const o = x3(e) && x3(t);
|
|
11147
|
+
if (!o && !(P3(e) && P3(t))) return t;
|
|
11148
|
+
const i = (o ? e : Object.keys(e)).length, d = o ? t : Object.keys(t), a = d.length, s = o ? new Array(a) : {};
|
|
11149
|
+
let k = 0;
|
|
11150
|
+
for (let p = 0; p < a; p++) {
|
|
11151
|
+
const u = o ? p : d[p], c = e[u], m = t[u];
|
|
11152
|
+
if (c === m) {
|
|
11153
|
+
s[u] = c, (o ? p < i : w2.call(e, u)) && k++;
|
|
11154
|
+
continue;
|
|
11155
|
+
}
|
|
11156
|
+
if (c === null || m === null || typeof c != "object" || typeof m != "object") {
|
|
11157
|
+
s[u] = m;
|
|
11158
|
+
continue;
|
|
11159
|
+
}
|
|
11160
|
+
const v = y3(c, m, r + 1);
|
|
11161
|
+
s[u] = v, v === c && k++;
|
|
11162
|
+
}
|
|
11163
|
+
return i === a && k === i ? e : s;
|
|
11164
|
+
}
|
|
11165
|
+
function x3(e) {
|
|
11166
|
+
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
11167
|
+
}
|
|
11168
|
+
function P3(e) {
|
|
11169
|
+
if (!A3(e)) return !1;
|
|
11170
|
+
const t = e.constructor;
|
|
11171
|
+
if (t === void 0) return !0;
|
|
11172
|
+
const r = t.prototype;
|
|
11173
|
+
return !(!A3(r) || !r.hasOwnProperty("isPrototypeOf") || Object.getPrototypeOf(e) !== Object.prototype);
|
|
11174
|
+
}
|
|
11175
|
+
function A3(e) {
|
|
11176
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
11177
|
+
}
|
|
11178
|
+
function y2(e) {
|
|
11179
|
+
return new Promise((t) => {
|
|
11180
|
+
C3.setTimeout(t, e);
|
|
11181
|
+
});
|
|
11182
|
+
}
|
|
11183
|
+
function P2(e, t, r) {
|
|
11184
|
+
if (typeof r.structuralSharing == "function") return r.structuralSharing(e, t);
|
|
11185
|
+
if (r.structuralSharing !== !1) {
|
|
11186
|
+
if (process.env.NODE_ENV !== "production") try {
|
|
11187
|
+
return y3(e, t);
|
|
11188
|
+
} catch (o) {
|
|
11189
|
+
throw console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${r.queryHash}]: ${o}`), o;
|
|
11190
|
+
}
|
|
11191
|
+
return y3(e, t);
|
|
11192
|
+
}
|
|
11193
|
+
return t;
|
|
11194
|
+
}
|
|
11195
|
+
function p2(e, t, r = 0) {
|
|
11196
|
+
const o = [...e, t];
|
|
11197
|
+
return r && o.length > r ? o.slice(1) : o;
|
|
11198
|
+
}
|
|
11199
|
+
function g2(e, t, r = 0) {
|
|
11200
|
+
const o = [t, ...e];
|
|
11201
|
+
return r && o.length > r ? o.slice(0, -1) : o;
|
|
11202
|
+
}
|
|
11203
|
+
var f3 = /* @__PURE__ */ Symbol();
|
|
11204
|
+
function j3(e, t) {
|
|
11205
|
+
return process.env.NODE_ENV !== "production" && e.queryFn === f3 && console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`), !e.queryFn && t?.initialPromise ? () => t.initialPromise : !e.queryFn || e.queryFn === f3 ? () => Promise.reject(/* @__PURE__ */ new Error(`Missing queryFn: '${e.queryHash}'`)) : e.queryFn;
|
|
11206
|
+
}
|
|
11207
|
+
function b2(e, t, r) {
|
|
11208
|
+
let o = !1, i;
|
|
11209
|
+
return Object.defineProperty(e, "signal", {
|
|
11210
|
+
enumerable: !0,
|
|
11211
|
+
get: () => (i ??= t(), o || (o = !0, i.aborted ? r() : i.addEventListener("abort", r, { once: !0 })), i)
|
|
11212
|
+
}), e;
|
|
11213
|
+
}
|
|
11214
|
+
var M2 = class extends k3 {
|
|
11215
|
+
#e;
|
|
11216
|
+
#t;
|
|
11217
|
+
#r;
|
|
11218
|
+
constructor() {
|
|
11219
|
+
super(), this.#r = (e) => {
|
|
11220
|
+
if (!B3 && window.addEventListener) {
|
|
11221
|
+
const t = () => e();
|
|
11222
|
+
return window.addEventListener("visibilitychange", t, !1), () => {
|
|
11223
|
+
window.removeEventListener("visibilitychange", t);
|
|
11224
|
+
};
|
|
11225
|
+
}
|
|
11226
|
+
};
|
|
11227
|
+
}
|
|
11228
|
+
onSubscribe() {
|
|
11229
|
+
this.#t || this.setEventListener(this.#r);
|
|
11230
|
+
}
|
|
11231
|
+
onUnsubscribe() {
|
|
11232
|
+
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
11233
|
+
}
|
|
11234
|
+
setEventListener(e) {
|
|
11235
|
+
this.#r = e, this.#t?.(), this.#t = e((t) => {
|
|
11236
|
+
typeof t == "boolean" ? this.setFocused(t) : this.onFocus();
|
|
11237
|
+
});
|
|
11238
|
+
}
|
|
11239
|
+
setFocused(e) {
|
|
11240
|
+
this.#e !== e && (this.#e = e, this.onFocus());
|
|
11241
|
+
}
|
|
11242
|
+
onFocus() {
|
|
11243
|
+
const e = this.isFocused();
|
|
11244
|
+
this.listeners.forEach((t) => {
|
|
11245
|
+
t(e);
|
|
11246
|
+
});
|
|
11247
|
+
}
|
|
11248
|
+
isFocused() {
|
|
11249
|
+
return typeof this.#e == "boolean" ? this.#e : globalThis.document?.visibilityState !== "hidden";
|
|
11250
|
+
}
|
|
11251
|
+
}, Q3 = new M2();
|
|
11252
|
+
function S2() {
|
|
11253
|
+
let e, t;
|
|
11254
|
+
const r = new Promise((i, d) => {
|
|
11255
|
+
e = i, t = d;
|
|
11256
|
+
});
|
|
11257
|
+
r.status = "pending", r.catch(() => {
|
|
11044
11258
|
});
|
|
11259
|
+
function o(i) {
|
|
11260
|
+
Object.assign(r, i), delete r.resolve, delete r.reject;
|
|
11261
|
+
}
|
|
11262
|
+
return r.resolve = (i) => {
|
|
11263
|
+
o({
|
|
11264
|
+
status: "fulfilled",
|
|
11265
|
+
value: i
|
|
11266
|
+
}), e(i);
|
|
11267
|
+
}, r.reject = (i) => {
|
|
11268
|
+
o({
|
|
11269
|
+
status: "rejected",
|
|
11270
|
+
reason: i
|
|
11271
|
+
}), t(i);
|
|
11272
|
+
}, r;
|
|
11273
|
+
}
|
|
11274
|
+
var O2 = k2;
|
|
11275
|
+
function x2() {
|
|
11276
|
+
let e = [], t = 0, r = (s) => {
|
|
11277
|
+
s();
|
|
11278
|
+
}, o = (s) => {
|
|
11279
|
+
s();
|
|
11280
|
+
}, i = O2;
|
|
11281
|
+
const d = (s) => {
|
|
11282
|
+
t ? e.push(s) : i(() => {
|
|
11283
|
+
r(s);
|
|
11284
|
+
});
|
|
11285
|
+
}, a = () => {
|
|
11286
|
+
const s = e;
|
|
11287
|
+
e = [], s.length && i(() => {
|
|
11288
|
+
o(() => {
|
|
11289
|
+
s.forEach((k) => {
|
|
11290
|
+
r(k);
|
|
11291
|
+
});
|
|
11292
|
+
});
|
|
11293
|
+
});
|
|
11294
|
+
};
|
|
11295
|
+
return {
|
|
11296
|
+
batch: (s) => {
|
|
11297
|
+
let k;
|
|
11298
|
+
t++;
|
|
11299
|
+
try {
|
|
11300
|
+
k = s();
|
|
11301
|
+
} finally {
|
|
11302
|
+
t--, t || a();
|
|
11303
|
+
}
|
|
11304
|
+
return k;
|
|
11305
|
+
},
|
|
11306
|
+
batchCalls: (s) => (...k) => {
|
|
11307
|
+
d(() => {
|
|
11308
|
+
s(...k);
|
|
11309
|
+
});
|
|
11310
|
+
},
|
|
11311
|
+
schedule: d,
|
|
11312
|
+
setNotifyFunction: (s) => {
|
|
11313
|
+
r = s;
|
|
11314
|
+
},
|
|
11315
|
+
setBatchNotifyFunction: (s) => {
|
|
11316
|
+
o = s;
|
|
11317
|
+
},
|
|
11318
|
+
setScheduler: (s) => {
|
|
11319
|
+
i = s;
|
|
11320
|
+
}
|
|
11321
|
+
};
|
|
11045
11322
|
}
|
|
11323
|
+
var K = x2(), A2 = class extends k3 {
|
|
11324
|
+
#e = !0;
|
|
11325
|
+
#t;
|
|
11326
|
+
#r;
|
|
11327
|
+
constructor() {
|
|
11328
|
+
super(), this.#r = (e) => {
|
|
11329
|
+
if (!B3 && window.addEventListener) {
|
|
11330
|
+
const t = () => e(!0), r = () => e(!1);
|
|
11331
|
+
return window.addEventListener("online", t, !1), window.addEventListener("offline", r, !1), () => {
|
|
11332
|
+
window.removeEventListener("online", t), window.removeEventListener("offline", r);
|
|
11333
|
+
};
|
|
11334
|
+
}
|
|
11335
|
+
};
|
|
11336
|
+
}
|
|
11337
|
+
onSubscribe() {
|
|
11338
|
+
this.#t || this.setEventListener(this.#r);
|
|
11339
|
+
}
|
|
11340
|
+
onUnsubscribe() {
|
|
11341
|
+
this.hasListeners() || (this.#t?.(), this.#t = void 0);
|
|
11342
|
+
}
|
|
11343
|
+
setEventListener(e) {
|
|
11344
|
+
this.#r = e, this.#t?.(), this.#t = e(this.setOnline.bind(this));
|
|
11345
|
+
}
|
|
11346
|
+
setOnline(e) {
|
|
11347
|
+
this.#e !== e && (this.#e = e, this.listeners.forEach((t) => {
|
|
11348
|
+
t(e);
|
|
11349
|
+
}));
|
|
11350
|
+
}
|
|
11351
|
+
isOnline() {
|
|
11352
|
+
return this.#e;
|
|
11353
|
+
}
|
|
11354
|
+
}, h3 = new A2();
|
|
11355
|
+
function E2(e) {
|
|
11356
|
+
return Math.min(1e3 * 2 ** e, 3e4);
|
|
11357
|
+
}
|
|
11358
|
+
function z3(e) {
|
|
11359
|
+
return (e ?? "online") === "online" ? h3.isOnline() : !0;
|
|
11360
|
+
}
|
|
11361
|
+
var p3 = class extends Error {
|
|
11362
|
+
constructor(e) {
|
|
11363
|
+
super("CancelledError"), this.revert = e?.revert, this.silent = e?.silent;
|
|
11364
|
+
}
|
|
11365
|
+
};
|
|
11366
|
+
function U3(e) {
|
|
11367
|
+
let t = !1, r = 0, o;
|
|
11368
|
+
const i = S2(), d = () => i.status !== "pending", a = (C) => {
|
|
11369
|
+
if (!d()) {
|
|
11370
|
+
const w = new p3(C);
|
|
11371
|
+
m(w), e.onCancel?.(w);
|
|
11372
|
+
}
|
|
11373
|
+
}, s = () => {
|
|
11374
|
+
t = !0;
|
|
11375
|
+
}, k = () => {
|
|
11376
|
+
t = !1;
|
|
11377
|
+
}, p = () => Q3.isFocused() && (e.networkMode === "always" || h3.isOnline()) && e.canRun(), u = () => z3(e.networkMode) && e.canRun(), c = (C) => {
|
|
11378
|
+
d() || (o?.(), i.resolve(C));
|
|
11379
|
+
}, m = (C) => {
|
|
11380
|
+
d() || (o?.(), i.reject(C));
|
|
11381
|
+
}, v = () => new Promise((C) => {
|
|
11382
|
+
o = (w) => {
|
|
11383
|
+
(d() || p()) && C(w);
|
|
11384
|
+
}, e.onPause?.();
|
|
11385
|
+
}).then(() => {
|
|
11386
|
+
o = void 0, d() || e.onContinue?.();
|
|
11387
|
+
}), y = () => {
|
|
11388
|
+
if (d()) return;
|
|
11389
|
+
let C;
|
|
11390
|
+
const w = r === 0 ? e.initialPromise : void 0;
|
|
11391
|
+
try {
|
|
11392
|
+
C = w ?? e.fn();
|
|
11393
|
+
} catch (b) {
|
|
11394
|
+
C = Promise.reject(b);
|
|
11395
|
+
}
|
|
11396
|
+
Promise.resolve(C).then(c).catch((b) => {
|
|
11397
|
+
if (d()) return;
|
|
11398
|
+
const x = e.retry ?? (B3 ? 0 : 3), B = e.retryDelay ?? E2, n = typeof B == "function" ? B(r, b) : B, l = x === !0 || typeof x == "number" && r < x || typeof x == "function" && x(r, b);
|
|
11399
|
+
if (t || !l) {
|
|
11400
|
+
m(b);
|
|
11401
|
+
return;
|
|
11402
|
+
}
|
|
11403
|
+
r++, e.onFail?.(r, b), y2(n).then(() => p() ? void 0 : v()).then(() => {
|
|
11404
|
+
t ? m(b) : y();
|
|
11405
|
+
});
|
|
11406
|
+
});
|
|
11407
|
+
};
|
|
11408
|
+
return {
|
|
11409
|
+
promise: i,
|
|
11410
|
+
status: () => i.status,
|
|
11411
|
+
cancel: a,
|
|
11412
|
+
continue: () => (o?.(), i),
|
|
11413
|
+
cancelRetry: s,
|
|
11414
|
+
continueRetry: k,
|
|
11415
|
+
canStart: u,
|
|
11416
|
+
start: () => (u() ? y() : v().then(y), i)
|
|
11417
|
+
};
|
|
11418
|
+
}
|
|
11419
|
+
var G3 = class {
|
|
11420
|
+
#e;
|
|
11421
|
+
destroy() {
|
|
11422
|
+
this.clearGcTimeout();
|
|
11423
|
+
}
|
|
11424
|
+
scheduleGc() {
|
|
11425
|
+
this.clearGcTimeout(), m2(this.gcTime) && (this.#e = C3.setTimeout(() => {
|
|
11426
|
+
this.optionalRemove();
|
|
11427
|
+
}, this.gcTime));
|
|
11428
|
+
}
|
|
11429
|
+
updateGcTime(e) {
|
|
11430
|
+
this.gcTime = Math.max(this.gcTime || 0, e ?? (B3 ? 1 / 0 : 300 * 1e3));
|
|
11431
|
+
}
|
|
11432
|
+
clearGcTimeout() {
|
|
11433
|
+
this.#e && (C3.clearTimeout(this.#e), this.#e = void 0);
|
|
11434
|
+
}
|
|
11435
|
+
}, I2 = class extends G3 {
|
|
11436
|
+
#e;
|
|
11437
|
+
#t;
|
|
11438
|
+
#r;
|
|
11439
|
+
#s;
|
|
11440
|
+
#o;
|
|
11441
|
+
#a;
|
|
11442
|
+
#i;
|
|
11443
|
+
constructor(e) {
|
|
11444
|
+
super(), this.#i = !1, this.#a = e.defaultOptions, this.setOptions(e.options), this.observers = [], this.#s = e.client, this.#r = this.#s.getQueryCache(), this.queryKey = e.queryKey, this.queryHash = e.queryHash, this.#e = I3(this.options), this.state = e.state ?? this.#e, this.scheduleGc();
|
|
11445
|
+
}
|
|
11446
|
+
get meta() {
|
|
11447
|
+
return this.options.meta;
|
|
11448
|
+
}
|
|
11449
|
+
get promise() {
|
|
11450
|
+
return this.#o?.promise;
|
|
11451
|
+
}
|
|
11452
|
+
setOptions(e) {
|
|
11453
|
+
if (this.options = {
|
|
11454
|
+
...this.#a,
|
|
11455
|
+
...e
|
|
11456
|
+
}, this.updateGcTime(this.options.gcTime), this.state && this.state.data === void 0) {
|
|
11457
|
+
const t = I3(this.options);
|
|
11458
|
+
t.data !== void 0 && (this.setState(E3(t.data, t.dataUpdatedAt)), this.#e = t);
|
|
11459
|
+
}
|
|
11460
|
+
}
|
|
11461
|
+
optionalRemove() {
|
|
11462
|
+
!this.observers.length && this.state.fetchStatus === "idle" && this.#r.remove(this);
|
|
11463
|
+
}
|
|
11464
|
+
setData(e, t) {
|
|
11465
|
+
const r = P2(this.state.data, e, this.options);
|
|
11466
|
+
return this.#n({
|
|
11467
|
+
data: r,
|
|
11468
|
+
type: "success",
|
|
11469
|
+
dataUpdatedAt: t?.updatedAt,
|
|
11470
|
+
manual: t?.manual
|
|
11471
|
+
}), r;
|
|
11472
|
+
}
|
|
11473
|
+
setState(e, t) {
|
|
11474
|
+
this.#n({
|
|
11475
|
+
type: "setState",
|
|
11476
|
+
state: e,
|
|
11477
|
+
setStateOptions: t
|
|
11478
|
+
});
|
|
11479
|
+
}
|
|
11480
|
+
cancel(e) {
|
|
11481
|
+
const t = this.#o?.promise;
|
|
11482
|
+
return this.#o?.cancel(e), t ? t.then(X).catch(X) : Promise.resolve();
|
|
11483
|
+
}
|
|
11484
|
+
destroy() {
|
|
11485
|
+
super.destroy(), this.cancel({ silent: !0 });
|
|
11486
|
+
}
|
|
11487
|
+
reset() {
|
|
11488
|
+
this.destroy(), this.setState(this.#e);
|
|
11489
|
+
}
|
|
11490
|
+
isActive() {
|
|
11491
|
+
return this.observers.some((e) => C2(e.options.enabled, this) !== !1);
|
|
11492
|
+
}
|
|
11493
|
+
isDisabled() {
|
|
11494
|
+
return this.getObserversCount() > 0 ? !this.isActive() : this.options.queryFn === f3 || this.state.dataUpdateCount + this.state.errorUpdateCount === 0;
|
|
11495
|
+
}
|
|
11496
|
+
isStatic() {
|
|
11497
|
+
return this.getObserversCount() > 0 ? this.observers.some((e) => w3(e.options.staleTime, this) === "static") : !1;
|
|
11498
|
+
}
|
|
11499
|
+
isStale() {
|
|
11500
|
+
return this.getObserversCount() > 0 ? this.observers.some((e) => e.getCurrentResult().isStale) : this.state.data === void 0 || this.state.isInvalidated;
|
|
11501
|
+
}
|
|
11502
|
+
isStaleByTime(e = 0) {
|
|
11503
|
+
return this.state.data === void 0 ? !0 : e === "static" ? !1 : this.state.isInvalidated ? !0 : !v2(this.state.dataUpdatedAt, e);
|
|
11504
|
+
}
|
|
11505
|
+
onFocus() {
|
|
11506
|
+
this.observers.find((e) => e.shouldFetchOnWindowFocus())?.refetch({ cancelRefetch: !1 }), this.#o?.continue();
|
|
11507
|
+
}
|
|
11508
|
+
onOnline() {
|
|
11509
|
+
this.observers.find((e) => e.shouldFetchOnReconnect())?.refetch({ cancelRefetch: !1 }), this.#o?.continue();
|
|
11510
|
+
}
|
|
11511
|
+
addObserver(e) {
|
|
11512
|
+
this.observers.includes(e) || (this.observers.push(e), this.clearGcTimeout(), this.#r.notify({
|
|
11513
|
+
type: "observerAdded",
|
|
11514
|
+
query: this,
|
|
11515
|
+
observer: e
|
|
11516
|
+
}));
|
|
11517
|
+
}
|
|
11518
|
+
removeObserver(e) {
|
|
11519
|
+
this.observers.includes(e) && (this.observers = this.observers.filter((t) => t !== e), this.observers.length || (this.#o && (this.#i ? this.#o.cancel({ revert: !0 }) : this.#o.cancelRetry()), this.scheduleGc()), this.#r.notify({
|
|
11520
|
+
type: "observerRemoved",
|
|
11521
|
+
query: this,
|
|
11522
|
+
observer: e
|
|
11523
|
+
}));
|
|
11524
|
+
}
|
|
11525
|
+
getObserversCount() {
|
|
11526
|
+
return this.observers.length;
|
|
11527
|
+
}
|
|
11528
|
+
invalidate() {
|
|
11529
|
+
this.state.isInvalidated || this.#n({ type: "invalidate" });
|
|
11530
|
+
}
|
|
11531
|
+
async fetch(e, t) {
|
|
11532
|
+
if (this.state.fetchStatus !== "idle" && this.#o?.status() !== "rejected") {
|
|
11533
|
+
if (this.state.data !== void 0 && t?.cancelRefetch) this.cancel({ silent: !0 });
|
|
11534
|
+
else if (this.#o)
|
|
11535
|
+
return this.#o.continueRetry(), this.#o.promise;
|
|
11536
|
+
}
|
|
11537
|
+
if (e && this.setOptions(e), !this.options.queryFn) {
|
|
11538
|
+
const s = this.observers.find((k) => k.options.queryFn);
|
|
11539
|
+
s && this.setOptions(s.options);
|
|
11540
|
+
}
|
|
11541
|
+
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));
|
|
11542
|
+
const r = new AbortController(), o = (s) => {
|
|
11543
|
+
Object.defineProperty(s, "signal", {
|
|
11544
|
+
enumerable: !0,
|
|
11545
|
+
get: () => (this.#i = !0, r.signal)
|
|
11546
|
+
});
|
|
11547
|
+
}, i = () => {
|
|
11548
|
+
const s = j3(this.options, t), p = (() => {
|
|
11549
|
+
const u = {
|
|
11550
|
+
client: this.#s,
|
|
11551
|
+
queryKey: this.queryKey,
|
|
11552
|
+
meta: this.meta
|
|
11553
|
+
};
|
|
11554
|
+
return o(u), u;
|
|
11555
|
+
})();
|
|
11556
|
+
return this.#i = !1, this.options.persister ? this.options.persister(s, p, this) : s(p);
|
|
11557
|
+
}, a = (() => {
|
|
11558
|
+
const s = {
|
|
11559
|
+
fetchOptions: t,
|
|
11560
|
+
options: this.options,
|
|
11561
|
+
queryKey: this.queryKey,
|
|
11562
|
+
client: this.#s,
|
|
11563
|
+
state: this.state,
|
|
11564
|
+
fetchFn: i
|
|
11565
|
+
};
|
|
11566
|
+
return o(s), s;
|
|
11567
|
+
})();
|
|
11568
|
+
this.options.behavior?.onFetch(a, this), this.#t = this.state, (this.state.fetchStatus === "idle" || this.state.fetchMeta !== a.fetchOptions?.meta) && this.#n({
|
|
11569
|
+
type: "fetch",
|
|
11570
|
+
meta: a.fetchOptions?.meta
|
|
11571
|
+
}), this.#o = U3({
|
|
11572
|
+
initialPromise: t?.initialPromise,
|
|
11573
|
+
fn: a.fetchFn,
|
|
11574
|
+
onCancel: (s) => {
|
|
11575
|
+
s instanceof p3 && s.revert && this.setState({
|
|
11576
|
+
...this.#t,
|
|
11577
|
+
fetchStatus: "idle"
|
|
11578
|
+
}), r.abort();
|
|
11579
|
+
},
|
|
11580
|
+
onFail: (s, k) => {
|
|
11581
|
+
this.#n({
|
|
11582
|
+
type: "failed",
|
|
11583
|
+
failureCount: s,
|
|
11584
|
+
error: k
|
|
11585
|
+
});
|
|
11586
|
+
},
|
|
11587
|
+
onPause: () => {
|
|
11588
|
+
this.#n({ type: "pause" });
|
|
11589
|
+
},
|
|
11590
|
+
onContinue: () => {
|
|
11591
|
+
this.#n({ type: "continue" });
|
|
11592
|
+
},
|
|
11593
|
+
retry: a.options.retry,
|
|
11594
|
+
retryDelay: a.options.retryDelay,
|
|
11595
|
+
networkMode: a.options.networkMode,
|
|
11596
|
+
canRun: () => !0
|
|
11597
|
+
});
|
|
11598
|
+
try {
|
|
11599
|
+
const s = await this.#o.start();
|
|
11600
|
+
if (s === void 0)
|
|
11601
|
+
throw process.env.NODE_ENV !== "production" && console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`), new Error(`${this.queryHash} data is undefined`);
|
|
11602
|
+
return this.setData(s), this.#r.config.onSuccess?.(s, this), this.#r.config.onSettled?.(s, this.state.error, this), s;
|
|
11603
|
+
} catch (s) {
|
|
11604
|
+
if (s instanceof p3) {
|
|
11605
|
+
if (s.silent) return this.#o.promise;
|
|
11606
|
+
if (s.revert) {
|
|
11607
|
+
if (this.state.data === void 0) throw s;
|
|
11608
|
+
return this.state.data;
|
|
11609
|
+
}
|
|
11610
|
+
}
|
|
11611
|
+
throw this.#n({
|
|
11612
|
+
type: "error",
|
|
11613
|
+
error: s
|
|
11614
|
+
}), this.#r.config.onError?.(s, this), this.#r.config.onSettled?.(this.state.data, s, this), s;
|
|
11615
|
+
} finally {
|
|
11616
|
+
this.scheduleGc();
|
|
11617
|
+
}
|
|
11618
|
+
}
|
|
11619
|
+
#n(e) {
|
|
11620
|
+
const t = (r) => {
|
|
11621
|
+
switch (e.type) {
|
|
11622
|
+
case "failed":
|
|
11623
|
+
return {
|
|
11624
|
+
...r,
|
|
11625
|
+
fetchFailureCount: e.failureCount,
|
|
11626
|
+
fetchFailureReason: e.error
|
|
11627
|
+
};
|
|
11628
|
+
case "pause":
|
|
11629
|
+
return {
|
|
11630
|
+
...r,
|
|
11631
|
+
fetchStatus: "paused"
|
|
11632
|
+
};
|
|
11633
|
+
case "continue":
|
|
11634
|
+
return {
|
|
11635
|
+
...r,
|
|
11636
|
+
fetchStatus: "fetching"
|
|
11637
|
+
};
|
|
11638
|
+
case "fetch":
|
|
11639
|
+
return {
|
|
11640
|
+
...r,
|
|
11641
|
+
...N2(r.data, this.options),
|
|
11642
|
+
fetchMeta: e.meta ?? null
|
|
11643
|
+
};
|
|
11644
|
+
case "success":
|
|
11645
|
+
const o = {
|
|
11646
|
+
...r,
|
|
11647
|
+
...E3(e.data, e.dataUpdatedAt),
|
|
11648
|
+
dataUpdateCount: r.dataUpdateCount + 1,
|
|
11649
|
+
...!e.manual && {
|
|
11650
|
+
fetchStatus: "idle",
|
|
11651
|
+
fetchFailureCount: 0,
|
|
11652
|
+
fetchFailureReason: null
|
|
11653
|
+
}
|
|
11654
|
+
};
|
|
11655
|
+
return this.#t = e.manual ? o : void 0, o;
|
|
11656
|
+
case "error":
|
|
11657
|
+
const i = e.error;
|
|
11658
|
+
return {
|
|
11659
|
+
...r,
|
|
11660
|
+
error: i,
|
|
11661
|
+
errorUpdateCount: r.errorUpdateCount + 1,
|
|
11662
|
+
errorUpdatedAt: Date.now(),
|
|
11663
|
+
fetchFailureCount: r.fetchFailureCount + 1,
|
|
11664
|
+
fetchFailureReason: i,
|
|
11665
|
+
fetchStatus: "idle",
|
|
11666
|
+
status: "error",
|
|
11667
|
+
isInvalidated: !0
|
|
11668
|
+
};
|
|
11669
|
+
case "invalidate":
|
|
11670
|
+
return {
|
|
11671
|
+
...r,
|
|
11672
|
+
isInvalidated: !0
|
|
11673
|
+
};
|
|
11674
|
+
case "setState":
|
|
11675
|
+
return {
|
|
11676
|
+
...r,
|
|
11677
|
+
...e.state
|
|
11678
|
+
};
|
|
11679
|
+
}
|
|
11680
|
+
};
|
|
11681
|
+
this.state = t(this.state), K.batch(() => {
|
|
11682
|
+
this.observers.forEach((r) => {
|
|
11683
|
+
r.onQueryUpdate();
|
|
11684
|
+
}), this.#r.notify({
|
|
11685
|
+
query: this,
|
|
11686
|
+
type: "updated",
|
|
11687
|
+
action: e
|
|
11688
|
+
});
|
|
11689
|
+
});
|
|
11690
|
+
}
|
|
11691
|
+
};
|
|
11692
|
+
function N2(e, t) {
|
|
11693
|
+
return {
|
|
11694
|
+
fetchFailureCount: 0,
|
|
11695
|
+
fetchFailureReason: null,
|
|
11696
|
+
fetchStatus: z3(t.networkMode) ? "fetching" : "paused",
|
|
11697
|
+
...e === void 0 && {
|
|
11698
|
+
error: null,
|
|
11699
|
+
status: "pending"
|
|
11700
|
+
}
|
|
11701
|
+
};
|
|
11702
|
+
}
|
|
11703
|
+
function E3(e, t) {
|
|
11704
|
+
return {
|
|
11705
|
+
data: e,
|
|
11706
|
+
dataUpdatedAt: t ?? Date.now(),
|
|
11707
|
+
error: null,
|
|
11708
|
+
isInvalidated: !1,
|
|
11709
|
+
status: "success"
|
|
11710
|
+
};
|
|
11711
|
+
}
|
|
11712
|
+
function I3(e) {
|
|
11713
|
+
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, r = t !== void 0, o = r ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
11714
|
+
return {
|
|
11715
|
+
data: t,
|
|
11716
|
+
dataUpdateCount: 0,
|
|
11717
|
+
dataUpdatedAt: r ? o ?? Date.now() : 0,
|
|
11718
|
+
error: null,
|
|
11719
|
+
errorUpdateCount: 0,
|
|
11720
|
+
errorUpdatedAt: 0,
|
|
11721
|
+
fetchFailureCount: 0,
|
|
11722
|
+
fetchFailureReason: null,
|
|
11723
|
+
fetchMeta: null,
|
|
11724
|
+
isInvalidated: !1,
|
|
11725
|
+
status: r ? "success" : "pending",
|
|
11726
|
+
fetchStatus: "idle"
|
|
11727
|
+
};
|
|
11728
|
+
}
|
|
11729
|
+
function N3(e) {
|
|
11730
|
+
return { onFetch: (t, r) => {
|
|
11731
|
+
const o = t.options, i = t.fetchOptions?.meta?.fetchMore?.direction, d = t.state.data?.pages || [], a = t.state.data?.pageParams || [];
|
|
11732
|
+
let s = {
|
|
11733
|
+
pages: [],
|
|
11734
|
+
pageParams: []
|
|
11735
|
+
}, k = 0;
|
|
11736
|
+
const p = async () => {
|
|
11737
|
+
let u = !1;
|
|
11738
|
+
const c = (y) => {
|
|
11739
|
+
b2(y, () => t.signal, () => u = !0);
|
|
11740
|
+
}, m = j3(t.options, t.fetchOptions), v = async (y, C, w) => {
|
|
11741
|
+
if (u) return Promise.reject();
|
|
11742
|
+
if (C == null && y.pages.length) return Promise.resolve(y);
|
|
11743
|
+
const x = await m((() => {
|
|
11744
|
+
const l = {
|
|
11745
|
+
client: t.client,
|
|
11746
|
+
queryKey: t.queryKey,
|
|
11747
|
+
pageParam: C,
|
|
11748
|
+
direction: w ? "backward" : "forward",
|
|
11749
|
+
meta: t.options.meta
|
|
11750
|
+
};
|
|
11751
|
+
return c(l), l;
|
|
11752
|
+
})()), { maxPages: B } = t.options, n = w ? g2 : p2;
|
|
11753
|
+
return {
|
|
11754
|
+
pages: n(y.pages, x, B),
|
|
11755
|
+
pageParams: n(y.pageParams, C, B)
|
|
11756
|
+
};
|
|
11757
|
+
};
|
|
11758
|
+
if (i && d.length) {
|
|
11759
|
+
const y = i === "backward", C = y ? F2 : F3, w = {
|
|
11760
|
+
pages: d,
|
|
11761
|
+
pageParams: a
|
|
11762
|
+
};
|
|
11763
|
+
s = await v(w, C(o, w), y);
|
|
11764
|
+
} else {
|
|
11765
|
+
const y = e ?? d.length;
|
|
11766
|
+
do {
|
|
11767
|
+
const C = k === 0 ? a[0] ?? o.initialPageParam : F3(o, s);
|
|
11768
|
+
if (k > 0 && C == null) break;
|
|
11769
|
+
s = await v(s, C), k++;
|
|
11770
|
+
} while (k < y);
|
|
11771
|
+
}
|
|
11772
|
+
return s;
|
|
11773
|
+
};
|
|
11774
|
+
t.options.persister ? t.fetchFn = () => t.options.persister?.(p, {
|
|
11775
|
+
client: t.client,
|
|
11776
|
+
queryKey: t.queryKey,
|
|
11777
|
+
meta: t.options.meta,
|
|
11778
|
+
signal: t.signal
|
|
11779
|
+
}, r) : t.fetchFn = p;
|
|
11780
|
+
} };
|
|
11781
|
+
}
|
|
11782
|
+
function F3(e, { pages: t, pageParams: r }) {
|
|
11783
|
+
const o = t.length - 1;
|
|
11784
|
+
return t.length > 0 ? e.getNextPageParam(t[o], t, r[o], r) : void 0;
|
|
11785
|
+
}
|
|
11786
|
+
function F2(e, { pages: t, pageParams: r }) {
|
|
11787
|
+
return t.length > 0 ? e.getPreviousPageParam?.(t[0], t, r[0], r) : void 0;
|
|
11788
|
+
}
|
|
11789
|
+
var T2 = class extends G3 {
|
|
11790
|
+
#e;
|
|
11791
|
+
#t;
|
|
11792
|
+
#r;
|
|
11793
|
+
#s;
|
|
11794
|
+
constructor(e) {
|
|
11795
|
+
super(), this.#e = e.client, this.mutationId = e.mutationId, this.#r = e.mutationCache, this.#t = [], this.state = e.state || R2(), this.setOptions(e.options), this.scheduleGc();
|
|
11796
|
+
}
|
|
11797
|
+
setOptions(e) {
|
|
11798
|
+
this.options = e, this.updateGcTime(this.options.gcTime);
|
|
11799
|
+
}
|
|
11800
|
+
get meta() {
|
|
11801
|
+
return this.options.meta;
|
|
11802
|
+
}
|
|
11803
|
+
addObserver(e) {
|
|
11804
|
+
this.#t.includes(e) || (this.#t.push(e), this.clearGcTimeout(), this.#r.notify({
|
|
11805
|
+
type: "observerAdded",
|
|
11806
|
+
mutation: this,
|
|
11807
|
+
observer: e
|
|
11808
|
+
}));
|
|
11809
|
+
}
|
|
11810
|
+
removeObserver(e) {
|
|
11811
|
+
this.#t = this.#t.filter((t) => t !== e), this.scheduleGc(), this.#r.notify({
|
|
11812
|
+
type: "observerRemoved",
|
|
11813
|
+
mutation: this,
|
|
11814
|
+
observer: e
|
|
11815
|
+
});
|
|
11816
|
+
}
|
|
11817
|
+
optionalRemove() {
|
|
11818
|
+
this.#t.length || (this.state.status === "pending" ? this.scheduleGc() : this.#r.remove(this));
|
|
11819
|
+
}
|
|
11820
|
+
continue() {
|
|
11821
|
+
return this.#s?.continue() ?? this.execute(this.state.variables);
|
|
11822
|
+
}
|
|
11823
|
+
async execute(e) {
|
|
11824
|
+
const t = () => {
|
|
11825
|
+
this.#o({ type: "continue" });
|
|
11826
|
+
}, r = {
|
|
11827
|
+
client: this.#e,
|
|
11828
|
+
meta: this.options.meta,
|
|
11829
|
+
mutationKey: this.options.mutationKey
|
|
11830
|
+
};
|
|
11831
|
+
this.#s = U3({
|
|
11832
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(e, r) : Promise.reject(/* @__PURE__ */ new Error("No mutationFn found")),
|
|
11833
|
+
onFail: (d, a) => {
|
|
11834
|
+
this.#o({
|
|
11835
|
+
type: "failed",
|
|
11836
|
+
failureCount: d,
|
|
11837
|
+
error: a
|
|
11838
|
+
});
|
|
11839
|
+
},
|
|
11840
|
+
onPause: () => {
|
|
11841
|
+
this.#o({ type: "pause" });
|
|
11842
|
+
},
|
|
11843
|
+
onContinue: t,
|
|
11844
|
+
retry: this.options.retry ?? 0,
|
|
11845
|
+
retryDelay: this.options.retryDelay,
|
|
11846
|
+
networkMode: this.options.networkMode,
|
|
11847
|
+
canRun: () => this.#r.canRun(this)
|
|
11848
|
+
});
|
|
11849
|
+
const o = this.state.status === "pending", i = !this.#s.canStart();
|
|
11850
|
+
try {
|
|
11851
|
+
if (o) t();
|
|
11852
|
+
else {
|
|
11853
|
+
this.#o({
|
|
11854
|
+
type: "pending",
|
|
11855
|
+
variables: e,
|
|
11856
|
+
isPaused: i
|
|
11857
|
+
}), this.#r.config.onMutate && await this.#r.config.onMutate(e, this, r);
|
|
11858
|
+
const a = await this.options.onMutate?.(e, r);
|
|
11859
|
+
a !== this.state.context && this.#o({
|
|
11860
|
+
type: "pending",
|
|
11861
|
+
context: a,
|
|
11862
|
+
variables: e,
|
|
11863
|
+
isPaused: i
|
|
11864
|
+
});
|
|
11865
|
+
}
|
|
11866
|
+
const d = await this.#s.start();
|
|
11867
|
+
return await this.#r.config.onSuccess?.(d, e, this.state.context, this, r), await this.options.onSuccess?.(d, e, this.state.context, r), await this.#r.config.onSettled?.(d, null, this.state.variables, this.state.context, this, r), await this.options.onSettled?.(d, null, e, this.state.context, r), this.#o({
|
|
11868
|
+
type: "success",
|
|
11869
|
+
data: d
|
|
11870
|
+
}), d;
|
|
11871
|
+
} catch (d) {
|
|
11872
|
+
try {
|
|
11873
|
+
await this.#r.config.onError?.(d, e, this.state.context, this, r);
|
|
11874
|
+
} catch (a) {
|
|
11875
|
+
Promise.reject(a);
|
|
11876
|
+
}
|
|
11877
|
+
try {
|
|
11878
|
+
await this.options.onError?.(d, e, this.state.context, r);
|
|
11879
|
+
} catch (a) {
|
|
11880
|
+
Promise.reject(a);
|
|
11881
|
+
}
|
|
11882
|
+
try {
|
|
11883
|
+
await this.#r.config.onSettled?.(void 0, d, this.state.variables, this.state.context, this, r);
|
|
11884
|
+
} catch (a) {
|
|
11885
|
+
Promise.reject(a);
|
|
11886
|
+
}
|
|
11887
|
+
try {
|
|
11888
|
+
await this.options.onSettled?.(void 0, d, e, this.state.context, r);
|
|
11889
|
+
} catch (a) {
|
|
11890
|
+
Promise.reject(a);
|
|
11891
|
+
}
|
|
11892
|
+
throw this.#o({
|
|
11893
|
+
type: "error",
|
|
11894
|
+
error: d
|
|
11895
|
+
}), d;
|
|
11896
|
+
} finally {
|
|
11897
|
+
this.#r.runNext(this);
|
|
11898
|
+
}
|
|
11899
|
+
}
|
|
11900
|
+
#o(e) {
|
|
11901
|
+
const t = (r) => {
|
|
11902
|
+
switch (e.type) {
|
|
11903
|
+
case "failed":
|
|
11904
|
+
return {
|
|
11905
|
+
...r,
|
|
11906
|
+
failureCount: e.failureCount,
|
|
11907
|
+
failureReason: e.error
|
|
11908
|
+
};
|
|
11909
|
+
case "pause":
|
|
11910
|
+
return {
|
|
11911
|
+
...r,
|
|
11912
|
+
isPaused: !0
|
|
11913
|
+
};
|
|
11914
|
+
case "continue":
|
|
11915
|
+
return {
|
|
11916
|
+
...r,
|
|
11917
|
+
isPaused: !1
|
|
11918
|
+
};
|
|
11919
|
+
case "pending":
|
|
11920
|
+
return {
|
|
11921
|
+
...r,
|
|
11922
|
+
context: e.context,
|
|
11923
|
+
data: void 0,
|
|
11924
|
+
failureCount: 0,
|
|
11925
|
+
failureReason: null,
|
|
11926
|
+
error: null,
|
|
11927
|
+
isPaused: e.isPaused,
|
|
11928
|
+
status: "pending",
|
|
11929
|
+
variables: e.variables,
|
|
11930
|
+
submittedAt: Date.now()
|
|
11931
|
+
};
|
|
11932
|
+
case "success":
|
|
11933
|
+
return {
|
|
11934
|
+
...r,
|
|
11935
|
+
data: e.data,
|
|
11936
|
+
failureCount: 0,
|
|
11937
|
+
failureReason: null,
|
|
11938
|
+
error: null,
|
|
11939
|
+
status: "success",
|
|
11940
|
+
isPaused: !1
|
|
11941
|
+
};
|
|
11942
|
+
case "error":
|
|
11943
|
+
return {
|
|
11944
|
+
...r,
|
|
11945
|
+
data: void 0,
|
|
11946
|
+
error: e.error,
|
|
11947
|
+
failureCount: r.failureCount + 1,
|
|
11948
|
+
failureReason: e.error,
|
|
11949
|
+
isPaused: !1,
|
|
11950
|
+
status: "error"
|
|
11951
|
+
};
|
|
11952
|
+
}
|
|
11953
|
+
};
|
|
11954
|
+
this.state = t(this.state), K.batch(() => {
|
|
11955
|
+
this.#t.forEach((r) => {
|
|
11956
|
+
r.onMutationUpdate(e);
|
|
11957
|
+
}), this.#r.notify({
|
|
11958
|
+
mutation: this,
|
|
11959
|
+
type: "updated",
|
|
11960
|
+
action: e
|
|
11961
|
+
});
|
|
11962
|
+
});
|
|
11963
|
+
}
|
|
11964
|
+
};
|
|
11965
|
+
function R2() {
|
|
11966
|
+
return {
|
|
11967
|
+
context: void 0,
|
|
11968
|
+
data: void 0,
|
|
11969
|
+
error: null,
|
|
11970
|
+
failureCount: 0,
|
|
11971
|
+
failureReason: null,
|
|
11972
|
+
isPaused: !1,
|
|
11973
|
+
status: "idle",
|
|
11974
|
+
variables: void 0,
|
|
11975
|
+
submittedAt: 0
|
|
11976
|
+
};
|
|
11977
|
+
}
|
|
11978
|
+
var L2 = class extends k3 {
|
|
11979
|
+
constructor(e = {}) {
|
|
11980
|
+
super(), this.config = e, this.#e = /* @__PURE__ */ new Set(), this.#t = /* @__PURE__ */ new Map(), this.#r = 0;
|
|
11981
|
+
}
|
|
11982
|
+
#e;
|
|
11983
|
+
#t;
|
|
11984
|
+
#r;
|
|
11985
|
+
build(e, t, r) {
|
|
11986
|
+
const o = new T2({
|
|
11987
|
+
client: e,
|
|
11988
|
+
mutationCache: this,
|
|
11989
|
+
mutationId: ++this.#r,
|
|
11990
|
+
options: e.defaultMutationOptions(t),
|
|
11991
|
+
state: r
|
|
11992
|
+
});
|
|
11993
|
+
return this.add(o), o;
|
|
11994
|
+
}
|
|
11995
|
+
add(e) {
|
|
11996
|
+
this.#e.add(e);
|
|
11997
|
+
const t = d3(e);
|
|
11998
|
+
if (typeof t == "string") {
|
|
11999
|
+
const r = this.#t.get(t);
|
|
12000
|
+
r ? r.push(e) : this.#t.set(t, [e]);
|
|
12001
|
+
}
|
|
12002
|
+
this.notify({
|
|
12003
|
+
type: "added",
|
|
12004
|
+
mutation: e
|
|
12005
|
+
});
|
|
12006
|
+
}
|
|
12007
|
+
remove(e) {
|
|
12008
|
+
if (this.#e.delete(e)) {
|
|
12009
|
+
const t = d3(e);
|
|
12010
|
+
if (typeof t == "string") {
|
|
12011
|
+
const r = this.#t.get(t);
|
|
12012
|
+
if (r)
|
|
12013
|
+
if (r.length > 1) {
|
|
12014
|
+
const o = r.indexOf(e);
|
|
12015
|
+
o !== -1 && r.splice(o, 1);
|
|
12016
|
+
} else r[0] === e && this.#t.delete(t);
|
|
12017
|
+
}
|
|
12018
|
+
}
|
|
12019
|
+
this.notify({
|
|
12020
|
+
type: "removed",
|
|
12021
|
+
mutation: e
|
|
12022
|
+
});
|
|
12023
|
+
}
|
|
12024
|
+
canRun(e) {
|
|
12025
|
+
const t = d3(e);
|
|
12026
|
+
if (typeof t == "string") {
|
|
12027
|
+
const r = this.#t.get(t)?.find((o) => o.state.status === "pending");
|
|
12028
|
+
return !r || r === e;
|
|
12029
|
+
} else return !0;
|
|
12030
|
+
}
|
|
12031
|
+
runNext(e) {
|
|
12032
|
+
const t = d3(e);
|
|
12033
|
+
return typeof t == "string" ? this.#t.get(t)?.find((r) => r !== e && r.state.isPaused)?.continue() ?? Promise.resolve() : Promise.resolve();
|
|
12034
|
+
}
|
|
12035
|
+
clear() {
|
|
12036
|
+
K.batch(() => {
|
|
12037
|
+
this.#e.forEach((e) => {
|
|
12038
|
+
this.notify({
|
|
12039
|
+
type: "removed",
|
|
12040
|
+
mutation: e
|
|
12041
|
+
});
|
|
12042
|
+
}), this.#e.clear(), this.#t.clear();
|
|
12043
|
+
});
|
|
12044
|
+
}
|
|
12045
|
+
getAll() {
|
|
12046
|
+
return Array.from(this.#e);
|
|
12047
|
+
}
|
|
12048
|
+
find(e) {
|
|
12049
|
+
const t = {
|
|
12050
|
+
exact: !0,
|
|
12051
|
+
...e
|
|
12052
|
+
};
|
|
12053
|
+
return this.getAll().find((r) => O3(t, r));
|
|
12054
|
+
}
|
|
12055
|
+
findAll(e = {}) {
|
|
12056
|
+
return this.getAll().filter((t) => O3(e, t));
|
|
12057
|
+
}
|
|
12058
|
+
notify(e) {
|
|
12059
|
+
K.batch(() => {
|
|
12060
|
+
this.listeners.forEach((t) => {
|
|
12061
|
+
t(e);
|
|
12062
|
+
});
|
|
12063
|
+
});
|
|
12064
|
+
}
|
|
12065
|
+
resumePausedMutations() {
|
|
12066
|
+
const e = this.getAll().filter((t) => t.state.isPaused);
|
|
12067
|
+
return K.batch(() => Promise.all(e.map((t) => t.continue().catch(X))));
|
|
12068
|
+
}
|
|
12069
|
+
};
|
|
12070
|
+
function d3(e) {
|
|
12071
|
+
return e.options.scope?.id;
|
|
12072
|
+
}
|
|
12073
|
+
var K3 = class extends k3 {
|
|
12074
|
+
constructor(e = {}) {
|
|
12075
|
+
super(), this.config = e, this.#e = /* @__PURE__ */ new Map();
|
|
12076
|
+
}
|
|
12077
|
+
#e;
|
|
12078
|
+
build(e, t, r) {
|
|
12079
|
+
const o = t.queryKey, i = t.queryHash ?? g3(o, t);
|
|
12080
|
+
let d = this.get(i);
|
|
12081
|
+
return d || (d = new I2({
|
|
12082
|
+
client: e,
|
|
12083
|
+
queryKey: o,
|
|
12084
|
+
queryHash: i,
|
|
12085
|
+
options: e.defaultQueryOptions(t),
|
|
12086
|
+
state: r,
|
|
12087
|
+
defaultOptions: e.getQueryDefaults(o)
|
|
12088
|
+
}), this.add(d)), d;
|
|
12089
|
+
}
|
|
12090
|
+
add(e) {
|
|
12091
|
+
this.#e.has(e.queryHash) || (this.#e.set(e.queryHash, e), this.notify({
|
|
12092
|
+
type: "added",
|
|
12093
|
+
query: e
|
|
12094
|
+
}));
|
|
12095
|
+
}
|
|
12096
|
+
remove(e) {
|
|
12097
|
+
const t = this.#e.get(e.queryHash);
|
|
12098
|
+
t && (e.destroy(), t === e && this.#e.delete(e.queryHash), this.notify({
|
|
12099
|
+
type: "removed",
|
|
12100
|
+
query: e
|
|
12101
|
+
}));
|
|
12102
|
+
}
|
|
12103
|
+
clear() {
|
|
12104
|
+
K.batch(() => {
|
|
12105
|
+
this.getAll().forEach((e) => {
|
|
12106
|
+
this.remove(e);
|
|
12107
|
+
});
|
|
12108
|
+
});
|
|
12109
|
+
}
|
|
12110
|
+
get(e) {
|
|
12111
|
+
return this.#e.get(e);
|
|
12112
|
+
}
|
|
12113
|
+
getAll() {
|
|
12114
|
+
return [...this.#e.values()];
|
|
12115
|
+
}
|
|
12116
|
+
find(e) {
|
|
12117
|
+
const t = {
|
|
12118
|
+
exact: !0,
|
|
12119
|
+
...e
|
|
12120
|
+
};
|
|
12121
|
+
return this.getAll().find((r) => S3(t, r));
|
|
12122
|
+
}
|
|
12123
|
+
findAll(e = {}) {
|
|
12124
|
+
const t = this.getAll();
|
|
12125
|
+
return Object.keys(e).length > 0 ? t.filter((r) => S3(e, r)) : t;
|
|
12126
|
+
}
|
|
12127
|
+
notify(e) {
|
|
12128
|
+
K.batch(() => {
|
|
12129
|
+
this.listeners.forEach((t) => {
|
|
12130
|
+
t(e);
|
|
12131
|
+
});
|
|
12132
|
+
});
|
|
12133
|
+
}
|
|
12134
|
+
onFocus() {
|
|
12135
|
+
K.batch(() => {
|
|
12136
|
+
this.getAll().forEach((e) => {
|
|
12137
|
+
e.onFocus();
|
|
12138
|
+
});
|
|
12139
|
+
});
|
|
12140
|
+
}
|
|
12141
|
+
onOnline() {
|
|
12142
|
+
K.batch(() => {
|
|
12143
|
+
this.getAll().forEach((e) => {
|
|
12144
|
+
e.onOnline();
|
|
12145
|
+
});
|
|
12146
|
+
});
|
|
12147
|
+
}
|
|
12148
|
+
}, D2 = class {
|
|
12149
|
+
#e;
|
|
12150
|
+
#t;
|
|
12151
|
+
#r;
|
|
12152
|
+
#s;
|
|
12153
|
+
#o;
|
|
12154
|
+
#a;
|
|
12155
|
+
#i;
|
|
12156
|
+
#n;
|
|
12157
|
+
constructor(e = {}) {
|
|
12158
|
+
this.#e = e.queryCache || new K3(), this.#t = e.mutationCache || new L2(), this.#r = e.defaultOptions || {}, this.#s = /* @__PURE__ */ new Map(), this.#o = /* @__PURE__ */ new Map(), this.#a = 0;
|
|
12159
|
+
}
|
|
12160
|
+
mount() {
|
|
12161
|
+
this.#a++, this.#a === 1 && (this.#i = Q3.subscribe(async (e) => {
|
|
12162
|
+
e && (await this.resumePausedMutations(), this.#e.onFocus());
|
|
12163
|
+
}), this.#n = h3.subscribe(async (e) => {
|
|
12164
|
+
e && (await this.resumePausedMutations(), this.#e.onOnline());
|
|
12165
|
+
}));
|
|
12166
|
+
}
|
|
12167
|
+
unmount() {
|
|
12168
|
+
this.#a--, this.#a === 0 && (this.#i?.(), this.#i = void 0, this.#n?.(), this.#n = void 0);
|
|
12169
|
+
}
|
|
12170
|
+
isFetching(e) {
|
|
12171
|
+
return this.#e.findAll({
|
|
12172
|
+
...e,
|
|
12173
|
+
fetchStatus: "fetching"
|
|
12174
|
+
}).length;
|
|
12175
|
+
}
|
|
12176
|
+
isMutating(e) {
|
|
12177
|
+
return this.#t.findAll({
|
|
12178
|
+
...e,
|
|
12179
|
+
status: "pending"
|
|
12180
|
+
}).length;
|
|
12181
|
+
}
|
|
12182
|
+
/**
|
|
12183
|
+
* Imperative (non-reactive) way to retrieve data for a QueryKey.
|
|
12184
|
+
* Should only be used in callbacks or functions where reading the latest data is necessary, e.g. for optimistic updates.
|
|
12185
|
+
*
|
|
12186
|
+
* Hint: Do not use this function inside a component, because it won't receive updates.
|
|
12187
|
+
* Use `useQuery` to create a `QueryObserver` that subscribes to changes.
|
|
12188
|
+
*/
|
|
12189
|
+
getQueryData(e) {
|
|
12190
|
+
const t = this.defaultQueryOptions({ queryKey: e });
|
|
12191
|
+
return this.#e.get(t.queryHash)?.state.data;
|
|
12192
|
+
}
|
|
12193
|
+
ensureQueryData(e) {
|
|
12194
|
+
const t = this.defaultQueryOptions(e), r = this.#e.build(this, t), o = r.state.data;
|
|
12195
|
+
return o === void 0 ? this.fetchQuery(e) : (e.revalidateIfStale && r.isStaleByTime(w3(t.staleTime, r)) && this.prefetchQuery(t), Promise.resolve(o));
|
|
12196
|
+
}
|
|
12197
|
+
getQueriesData(e) {
|
|
12198
|
+
return this.#e.findAll(e).map(({ queryKey: t, state: r }) => [t, r.data]);
|
|
12199
|
+
}
|
|
12200
|
+
setQueryData(e, t, r) {
|
|
12201
|
+
const o = this.defaultQueryOptions({ queryKey: e }), i = this.#e.get(o.queryHash)?.state.data, d = B2(t, i);
|
|
12202
|
+
if (d !== void 0)
|
|
12203
|
+
return this.#e.build(this, o).setData(d, {
|
|
12204
|
+
...r,
|
|
12205
|
+
manual: !0
|
|
12206
|
+
});
|
|
12207
|
+
}
|
|
12208
|
+
setQueriesData(e, t, r) {
|
|
12209
|
+
return K.batch(() => this.#e.findAll(e).map(({ queryKey: o }) => [o, this.setQueryData(o, t, r)]));
|
|
12210
|
+
}
|
|
12211
|
+
getQueryState(e) {
|
|
12212
|
+
const t = this.defaultQueryOptions({ queryKey: e });
|
|
12213
|
+
return this.#e.get(t.queryHash)?.state;
|
|
12214
|
+
}
|
|
12215
|
+
removeQueries(e) {
|
|
12216
|
+
const t = this.#e;
|
|
12217
|
+
K.batch(() => {
|
|
12218
|
+
t.findAll(e).forEach((r) => {
|
|
12219
|
+
t.remove(r);
|
|
12220
|
+
});
|
|
12221
|
+
});
|
|
12222
|
+
}
|
|
12223
|
+
resetQueries(e, t) {
|
|
12224
|
+
const r = this.#e;
|
|
12225
|
+
return K.batch(() => (r.findAll(e).forEach((o) => {
|
|
12226
|
+
o.reset();
|
|
12227
|
+
}), this.refetchQueries({
|
|
12228
|
+
type: "active",
|
|
12229
|
+
...e
|
|
12230
|
+
}, t)));
|
|
12231
|
+
}
|
|
12232
|
+
cancelQueries(e, t = {}) {
|
|
12233
|
+
const r = {
|
|
12234
|
+
revert: !0,
|
|
12235
|
+
...t
|
|
12236
|
+
}, o = K.batch(() => this.#e.findAll(e).map((i) => i.cancel(r)));
|
|
12237
|
+
return Promise.all(o).then(X).catch(X);
|
|
12238
|
+
}
|
|
12239
|
+
invalidateQueries(e, t = {}) {
|
|
12240
|
+
return K.batch(() => (this.#e.findAll(e).forEach((r) => {
|
|
12241
|
+
r.invalidate();
|
|
12242
|
+
}), e?.refetchType === "none" ? Promise.resolve() : this.refetchQueries({
|
|
12243
|
+
...e,
|
|
12244
|
+
type: e?.refetchType ?? e?.type ?? "active"
|
|
12245
|
+
}, t)));
|
|
12246
|
+
}
|
|
12247
|
+
refetchQueries(e, t = {}) {
|
|
12248
|
+
const r = {
|
|
12249
|
+
...t,
|
|
12250
|
+
cancelRefetch: t.cancelRefetch ?? !0
|
|
12251
|
+
}, o = K.batch(() => this.#e.findAll(e).filter((i) => !i.isDisabled() && !i.isStatic()).map((i) => {
|
|
12252
|
+
let d = i.fetch(void 0, r);
|
|
12253
|
+
return r.throwOnError || (d = d.catch(X)), i.state.fetchStatus === "paused" ? Promise.resolve() : d;
|
|
12254
|
+
}));
|
|
12255
|
+
return Promise.all(o).then(X);
|
|
12256
|
+
}
|
|
12257
|
+
fetchQuery(e) {
|
|
12258
|
+
const t = this.defaultQueryOptions(e);
|
|
12259
|
+
t.retry === void 0 && (t.retry = !1);
|
|
12260
|
+
const r = this.#e.build(this, t);
|
|
12261
|
+
return r.isStaleByTime(w3(t.staleTime, r)) ? r.fetch(t) : Promise.resolve(r.state.data);
|
|
12262
|
+
}
|
|
12263
|
+
prefetchQuery(e) {
|
|
12264
|
+
return this.fetchQuery(e).then(X).catch(X);
|
|
12265
|
+
}
|
|
12266
|
+
fetchInfiniteQuery(e) {
|
|
12267
|
+
return e.behavior = N3(e.pages), this.fetchQuery(e);
|
|
12268
|
+
}
|
|
12269
|
+
prefetchInfiniteQuery(e) {
|
|
12270
|
+
return this.fetchInfiniteQuery(e).then(X).catch(X);
|
|
12271
|
+
}
|
|
12272
|
+
ensureInfiniteQueryData(e) {
|
|
12273
|
+
return e.behavior = N3(e.pages), this.ensureQueryData(e);
|
|
12274
|
+
}
|
|
12275
|
+
resumePausedMutations() {
|
|
12276
|
+
return h3.isOnline() ? this.#t.resumePausedMutations() : Promise.resolve();
|
|
12277
|
+
}
|
|
12278
|
+
getQueryCache() {
|
|
12279
|
+
return this.#e;
|
|
12280
|
+
}
|
|
12281
|
+
getMutationCache() {
|
|
12282
|
+
return this.#t;
|
|
12283
|
+
}
|
|
12284
|
+
getDefaultOptions() {
|
|
12285
|
+
return this.#r;
|
|
12286
|
+
}
|
|
12287
|
+
setDefaultOptions(e) {
|
|
12288
|
+
this.#r = e;
|
|
12289
|
+
}
|
|
12290
|
+
setQueryDefaults(e, t) {
|
|
12291
|
+
this.#s.set(n3(e), {
|
|
12292
|
+
queryKey: e,
|
|
12293
|
+
defaultOptions: t
|
|
12294
|
+
});
|
|
12295
|
+
}
|
|
12296
|
+
getQueryDefaults(e) {
|
|
12297
|
+
const t = [...this.#s.values()], r = {};
|
|
12298
|
+
return t.forEach((o) => {
|
|
12299
|
+
a3(e, o.queryKey) && Object.assign(r, o.defaultOptions);
|
|
12300
|
+
}), r;
|
|
12301
|
+
}
|
|
12302
|
+
setMutationDefaults(e, t) {
|
|
12303
|
+
this.#o.set(n3(e), {
|
|
12304
|
+
mutationKey: e,
|
|
12305
|
+
defaultOptions: t
|
|
12306
|
+
});
|
|
12307
|
+
}
|
|
12308
|
+
getMutationDefaults(e) {
|
|
12309
|
+
const t = [...this.#o.values()], r = {};
|
|
12310
|
+
return t.forEach((o) => {
|
|
12311
|
+
a3(e, o.mutationKey) && Object.assign(r, o.defaultOptions);
|
|
12312
|
+
}), r;
|
|
12313
|
+
}
|
|
12314
|
+
defaultQueryOptions(e) {
|
|
12315
|
+
if (e._defaulted) return e;
|
|
12316
|
+
const t = {
|
|
12317
|
+
...this.#r.queries,
|
|
12318
|
+
...this.getQueryDefaults(e.queryKey),
|
|
12319
|
+
...e,
|
|
12320
|
+
_defaulted: !0
|
|
12321
|
+
};
|
|
12322
|
+
return t.queryHash || (t.queryHash = g3(t.queryKey, t)), t.refetchOnReconnect === void 0 && (t.refetchOnReconnect = t.networkMode !== "always"), t.throwOnError === void 0 && (t.throwOnError = !!t.suspense), !t.networkMode && t.persister && (t.networkMode = "offlineFirst"), t.queryFn === f3 && (t.enabled = !1), t;
|
|
12323
|
+
}
|
|
12324
|
+
defaultMutationOptions(e) {
|
|
12325
|
+
return e?._defaulted ? e : {
|
|
12326
|
+
...this.#r.mutations,
|
|
12327
|
+
...e?.mutationKey && this.getMutationDefaults(e.mutationKey),
|
|
12328
|
+
...e,
|
|
12329
|
+
_defaulted: !0
|
|
12330
|
+
};
|
|
12331
|
+
}
|
|
12332
|
+
clear() {
|
|
12333
|
+
this.#e.clear(), this.#t.clear();
|
|
12334
|
+
}
|
|
12335
|
+
};
|
|
12336
|
+
function T3(e) {
|
|
12337
|
+
if (!e || typeof e != "object") return !1;
|
|
12338
|
+
const t = e;
|
|
12339
|
+
return !!(t.code === "PGRST301" || typeof t.message == "string" && /jwt|token/i.test(t.message));
|
|
12340
|
+
}
|
|
12341
|
+
function Z2(e, t = {}) {
|
|
12342
|
+
let r = null;
|
|
12343
|
+
const o = () => r || (r = e.auth.refreshSession().then(({ error: k }) => !k).catch(() => !1).finally(() => {
|
|
12344
|
+
r = null;
|
|
12345
|
+
}), r), i = new K3({ onError: async (k, p) => {
|
|
12346
|
+
T3(k) && (await o() ? s.invalidateQueries({ queryKey: p.queryKey }) : await e.auth.signOut());
|
|
12347
|
+
} }), { defaultOptions: d = {}, ...a } = t, s = new D2({
|
|
12348
|
+
queryCache: i,
|
|
12349
|
+
defaultOptions: {
|
|
12350
|
+
...d,
|
|
12351
|
+
queries: {
|
|
12352
|
+
retry: (k, p) => {
|
|
12353
|
+
if (T3(p)) return !1;
|
|
12354
|
+
const u = d.queries?.retry;
|
|
12355
|
+
return typeof u == "function" ? u(k, p) : k < (typeof u == "number" ? u : 1);
|
|
12356
|
+
},
|
|
12357
|
+
...d.queries
|
|
12358
|
+
}
|
|
12359
|
+
},
|
|
12360
|
+
...a
|
|
12361
|
+
});
|
|
12362
|
+
return s;
|
|
12363
|
+
}
|
|
12364
|
+
var _2 = 300, j2 = 1e3, Q2 = 3e4, z2 = class {
|
|
12365
|
+
tables = /* @__PURE__ */ new Map();
|
|
12366
|
+
supabase = null;
|
|
12367
|
+
authWatchActive = !1;
|
|
12368
|
+
/**
|
|
12369
|
+
* Registra um listener para eventos de uma tabela.
|
|
12370
|
+
* Canal criado no primeiro registro, destruído no último unsubscribe.
|
|
12371
|
+
*
|
|
12372
|
+
* IMPORTANTE: a tabela precisa estar na publication do Supabase Realtime
|
|
12373
|
+
* (`ALTER PUBLICATION supabase_realtime ADD TABLE <tabela>`).
|
|
12374
|
+
* Subscrever uma tabela fora da publication gera CHANNEL_ERROR em loop.
|
|
12375
|
+
*/
|
|
12376
|
+
subscribe(e, t, r, o) {
|
|
12377
|
+
this.supabase || (this.supabase = e, this.watchAuth(e));
|
|
12378
|
+
let i = this.tables.get(t);
|
|
12379
|
+
i ? i.closeTimer !== null && (clearTimeout(i.closeTimer), i.closeTimer = null) : (i = {
|
|
12380
|
+
channel: this.createChannel(t),
|
|
12381
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
12382
|
+
refCount: 0,
|
|
12383
|
+
closeTimer: null
|
|
12384
|
+
}, this.tables.set(t, i));
|
|
12385
|
+
const d = {
|
|
12386
|
+
event: r,
|
|
12387
|
+
listener: o
|
|
12388
|
+
};
|
|
12389
|
+
return i.listeners.add(d), i.refCount++, () => {
|
|
12390
|
+
const a = this.tables.get(t);
|
|
12391
|
+
a && (a.listeners.delete(d), a.refCount = Math.max(0, a.refCount - 1), a.refCount === 0 && (a.closeTimer = setTimeout(() => {
|
|
12392
|
+
const s = this.tables.get(t);
|
|
12393
|
+
s && s.refCount === 0 && (this.supabase?.removeChannel(s.channel), this.tables.delete(t));
|
|
12394
|
+
}, _2)));
|
|
12395
|
+
};
|
|
12396
|
+
}
|
|
12397
|
+
watchAuth(e) {
|
|
12398
|
+
this.authWatchActive || (this.authWatchActive = !0, e.auth.onAuthStateChange((t, r) => {
|
|
12399
|
+
if (r) {
|
|
12400
|
+
if (t === "INITIAL_SESSION") {
|
|
12401
|
+
queueMicrotask(() => {
|
|
12402
|
+
this.tables.size > 0 && this.reconnectAll();
|
|
12403
|
+
});
|
|
12404
|
+
return;
|
|
12405
|
+
}
|
|
12406
|
+
(t === "SIGNED_IN" || t === "TOKEN_REFRESHED") && this.reconnectAll();
|
|
12407
|
+
}
|
|
12408
|
+
}));
|
|
12409
|
+
}
|
|
12410
|
+
reconnectAll() {
|
|
12411
|
+
for (const [e, t] of this.tables.entries())
|
|
12412
|
+
t.refCount !== 0 && (console.info(`[Realtime] 🔄 ${e}`), this.supabase?.removeChannel(t.channel), t.channel = this.createChannel(e));
|
|
12413
|
+
}
|
|
12414
|
+
createChannel(e, t = 0) {
|
|
12415
|
+
const r = `tabl:rt:${e}:${Date.now()}`;
|
|
12416
|
+
return this.supabase.channel(r).on("postgres_changes", {
|
|
12417
|
+
event: "*",
|
|
12418
|
+
schema: "public",
|
|
12419
|
+
table: e
|
|
12420
|
+
}, (o) => this.dispatch(e, o)).subscribe((o, i) => {
|
|
12421
|
+
o === "SUBSCRIBED" ? console.info(`[Realtime] ✅ ${e}`) : (o === "CHANNEL_ERROR" || o === "TIMED_OUT") && (console.error(`[Realtime] ❌ ${e} (${o})`, i ?? ""), this.scheduleReconnect(e, t));
|
|
12422
|
+
});
|
|
12423
|
+
}
|
|
12424
|
+
dispatch(e, t) {
|
|
12425
|
+
const r = this.tables.get(e);
|
|
12426
|
+
if (!r) return;
|
|
12427
|
+
const o = t.eventType;
|
|
12428
|
+
for (const { event: i, listener: d } of r.listeners) if (i === "*" || i === o) try {
|
|
12429
|
+
d(t);
|
|
12430
|
+
} catch (a) {
|
|
12431
|
+
console.error(`[Realtime] Erro em listener de ${e}:`, a);
|
|
12432
|
+
}
|
|
12433
|
+
}
|
|
12434
|
+
scheduleReconnect(e, t) {
|
|
12435
|
+
const r = this.tables.get(e);
|
|
12436
|
+
if (!r || r.refCount === 0) return;
|
|
12437
|
+
const o = Math.min(j2 * Math.pow(2, t), Q2);
|
|
12438
|
+
console.info(`[Realtime] Reconectando ${e} em ${o}ms (tentativa ${t + 1})`), setTimeout(() => {
|
|
12439
|
+
const i = this.tables.get(e);
|
|
12440
|
+
!i || i.refCount === 0 || (this.supabase?.removeChannel(i.channel), i.channel = this.createChannel(e, t + 1));
|
|
12441
|
+
}, o);
|
|
12442
|
+
}
|
|
12443
|
+
};
|
|
12444
|
+
const e5 = new z2();
|
|
11046
12445
|
export {
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
12446
|
+
J2 as DeviceSessionGuard,
|
|
12447
|
+
$2 as LoginPage,
|
|
12448
|
+
W2 as RoleGuard,
|
|
12449
|
+
Z2 as createAuthAwareQueryClient,
|
|
12450
|
+
Y2 as createTablaClient,
|
|
12451
|
+
m3 as getRoleFromMetadata,
|
|
12452
|
+
n2 as hasRole,
|
|
12453
|
+
e5 as realtimeRegistry,
|
|
12454
|
+
_3 as useAuth,
|
|
12455
|
+
D3 as useAuthStore,
|
|
12456
|
+
a2 as useDeviceSessionStore,
|
|
12457
|
+
H2 as useRequireRole
|
|
11057
12458
|
};
|