@camstack/addon-tailscale-client 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/assets/icon.svg +1 -0
  2. package/dist/tailscale.addon.js +14388 -84
  3. package/dist/tailscale.addon.js.map +1 -1
  4. package/dist/tailscale.addon.mjs +14384 -81
  5. package/dist/tailscale.addon.mjs.map +1 -1
  6. package/package.json +7 -32
  7. package/dist/@mf-types/compiled-types/page/TailscaleClientOverviewPage.d.ts +0 -20
  8. package/dist/@mf-types/compiled-types/page/TailscaleClientOverviewPage.d.ts.map +0 -1
  9. package/dist/@mf-types/compiled-types/page/page.d.ts +0 -8
  10. package/dist/@mf-types/compiled-types/page/page.d.ts.map +0 -1
  11. package/dist/@mf-types/page.d.ts +0 -2
  12. package/dist/@mf-types.d.ts +0 -3
  13. package/dist/@mf-types.zip +0 -0
  14. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-bYM9BuS1.mjs +0 -12
  15. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-CtHD1dC0.mjs +0 -12
  16. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-fz-lQtUx.mjs +0 -12
  17. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-B-3nffMn.mjs +0 -73
  18. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-6CvhJC3f.mjs +0 -42
  19. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-Sv3rXvki.mjs +0 -46
  20. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare__react__loadShare__.mjs-BBqTAV2L.mjs +0 -56
  21. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-BK8BTUon.mjs +0 -18
  22. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare__react_mf_2_dom__loadShare__.mjs-B6pR25zU.mjs +0 -28
  23. package/dist/__mfe_internal__addon_tailscale_client_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-kyoamNQ7.mjs +0 -18
  24. package/dist/_stub.js +0 -652
  25. package/dist/_virtual_mf-localSharedImportMap___mfe_internal__addon_tailscale_client_page-PXP_-hRW.mjs +0 -156
  26. package/dist/addon-tailscale-client.css +0 -3
  27. package/dist/client-1J4MstR_.mjs +0 -7592
  28. package/dist/dist-C168hexw.mjs +0 -17192
  29. package/dist/dist-CPnIfsyh.mjs +0 -2229
  30. package/dist/dist-CmoRvaEc.mjs +0 -2483
  31. package/dist/dist-CwyDJZhZ.mjs +0 -16329
  32. package/dist/dist-DNrrMIdr.mjs +0 -662
  33. package/dist/dist-i1I4ldIE.mjs +0 -1260
  34. package/dist/getErrorShape-BPSzUA7W-C2H3tqHP.mjs +0 -189
  35. package/dist/hostInit-KpnzzkeJ.mjs +0 -144
  36. package/dist/jsx-runtime-BmcMHbj3.mjs +0 -22
  37. package/dist/modern-CWdms43F.mjs +0 -2184
  38. package/dist/react-BXkW-3WQ.mjs +0 -293
  39. package/dist/react-dom-BcGsvCWU.mjs +0 -131
  40. package/dist/remoteEntry.js +0 -83
  41. package/dist/rolldown-runtime-DC4cgjXG.mjs +0 -20
  42. package/dist/virtualExposes-wANYNTM2.mjs +0 -27
@@ -1,1260 +0,0 @@
1
- import { T as e, b as t, o as n, x as r } from "./__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-6CvhJC3f.mjs";
2
- import { i, o as a } from "./__mfe_internal__addon_tailscale_client_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-CtHD1dC0.mjs";
3
- //#region ../sdk/dist/index.js
4
- var o = class {
5
- constructor() {
6
- this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
7
- }
8
- set(e, t) {
9
- this.keyToValue.set(e, t), this.valueToKey.set(t, e);
10
- }
11
- getByKey(e) {
12
- return this.keyToValue.get(e);
13
- }
14
- getByValue(e) {
15
- return this.valueToKey.get(e);
16
- }
17
- clear() {
18
- this.keyToValue.clear(), this.valueToKey.clear();
19
- }
20
- }, s = class {
21
- constructor(e) {
22
- this.generateIdentifier = e, this.kv = new o();
23
- }
24
- register(e, t) {
25
- this.kv.getByValue(e) || (t ||= this.generateIdentifier(e), this.kv.set(t, e));
26
- }
27
- clear() {
28
- this.kv.clear();
29
- }
30
- getIdentifier(e) {
31
- return this.kv.getByValue(e);
32
- }
33
- getValue(e) {
34
- return this.kv.getByKey(e);
35
- }
36
- }, c = class extends s {
37
- constructor() {
38
- super((e) => e.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
39
- }
40
- register(e, t) {
41
- typeof t == "object" ? (t.allowProps && this.classToAllowedProps.set(e, t.allowProps), super.register(e, t.identifier)) : super.register(e, t);
42
- }
43
- getAllowedProps(e) {
44
- return this.classToAllowedProps.get(e);
45
- }
46
- };
47
- function l(e) {
48
- if ("values" in Object) return Object.values(e);
49
- let t = [];
50
- for (let n in e) e.hasOwnProperty(n) && t.push(e[n]);
51
- return t;
52
- }
53
- function u(e, t) {
54
- let n = l(e);
55
- if ("find" in n) return n.find(t);
56
- let r = n;
57
- for (let e = 0; e < r.length; e++) {
58
- let n = r[e];
59
- if (t(n)) return n;
60
- }
61
- }
62
- function d(e, t) {
63
- Object.entries(e).forEach(([e, n]) => t(n, e));
64
- }
65
- function f(e, t) {
66
- return e.indexOf(t) !== -1;
67
- }
68
- function p(e, t) {
69
- for (let n = 0; n < e.length; n++) {
70
- let r = e[n];
71
- if (t(r)) return r;
72
- }
73
- }
74
- var m = class {
75
- constructor() {
76
- this.transfomers = {};
77
- }
78
- register(e) {
79
- this.transfomers[e.name] = e;
80
- }
81
- findApplicable(e) {
82
- return u(this.transfomers, (t) => t.isApplicable(e));
83
- }
84
- findByName(e) {
85
- return this.transfomers[e];
86
- }
87
- }, ee = (e) => Object.prototype.toString.call(e).slice(8, -1), te = (e) => e === void 0, ne = (e) => e === null, h = (e) => typeof e != "object" || !e || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, g = (e) => h(e) && Object.keys(e).length === 0, _ = (e) => Array.isArray(e), re = (e) => typeof e == "string", ie = (e) => typeof e == "number" && !isNaN(e), ae = (e) => typeof e == "boolean", oe = (e) => e instanceof RegExp, v = (e) => e instanceof Map, y = (e) => e instanceof Set, se = (e) => ee(e) === "Symbol", ce = (e) => e instanceof Date && !isNaN(e.valueOf()), b = (e) => e instanceof Error, le = (e) => typeof e == "number" && isNaN(e), ue = (e) => ae(e) || ne(e) || te(e) || ie(e) || re(e) || se(e), de = (e) => typeof e == "bigint", fe = (e) => e === Infinity || e === -Infinity, pe = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), me = (e) => e instanceof URL, x = (e) => e.replace(/\\/g, "\\\\").replace(/\./g, "\\."), S = (e) => e.map(String).map(x).join("."), C = (e, t) => {
88
- let n = [], r = "";
89
- for (let i = 0; i < e.length; i++) {
90
- let a = e.charAt(i);
91
- if (!t && a === "\\") {
92
- let t = e.charAt(i + 1);
93
- if (t === "\\") {
94
- r += "\\", i++;
95
- continue;
96
- } else if (t !== ".") throw Error("invalid path");
97
- }
98
- if (a === "\\" && e.charAt(i + 1) === ".") {
99
- r += ".", i++;
100
- continue;
101
- }
102
- if (a === ".") {
103
- n.push(r), r = "";
104
- continue;
105
- }
106
- r += a;
107
- }
108
- let i = r;
109
- return n.push(i), n;
110
- };
111
- function w(e, t, n, r) {
112
- return {
113
- isApplicable: e,
114
- annotation: t,
115
- transform: n,
116
- untransform: r
117
- };
118
- }
119
- var he = [
120
- w(te, "undefined", () => null, () => void 0),
121
- w(de, "bigint", (e) => e.toString(), (e) => typeof BigInt < "u" ? BigInt(e) : (console.error("Please add a BigInt polyfill."), e)),
122
- w(ce, "Date", (e) => e.toISOString(), (e) => new Date(e)),
123
- w(b, "Error", (e, t) => {
124
- let n = {
125
- name: e.name,
126
- message: e.message
127
- };
128
- return "cause" in e && (n.cause = e.cause), t.allowedErrorProps.forEach((t) => {
129
- n[t] = e[t];
130
- }), n;
131
- }, (e, t) => {
132
- let n = Error(e.message, { cause: e.cause });
133
- return n.name = e.name, n.stack = e.stack, t.allowedErrorProps.forEach((t) => {
134
- n[t] = e[t];
135
- }), n;
136
- }),
137
- w(oe, "regexp", (e) => "" + e, (e) => {
138
- let t = e.slice(1, e.lastIndexOf("/")), n = e.slice(e.lastIndexOf("/") + 1);
139
- return new RegExp(t, n);
140
- }),
141
- w(y, "set", (e) => [...e.values()], (e) => new Set(e)),
142
- w(v, "map", (e) => [...e.entries()], (e) => new Map(e)),
143
- w((e) => le(e) || fe(e), "number", (e) => le(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
144
- w((e) => e === 0 && 1 / e == -Infinity, "number", () => "-0", Number),
145
- w(me, "URL", (e) => e.toString(), (e) => new URL(e))
146
- ];
147
- function T(e, t, n, r) {
148
- return {
149
- isApplicable: e,
150
- annotation: t,
151
- transform: n,
152
- untransform: r
153
- };
154
- }
155
- var ge = T((e, t) => se(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, n) => {
156
- let r = n.symbolRegistry.getValue(t[1]);
157
- if (!r) throw Error("Trying to deserialize unknown symbol");
158
- return r;
159
- }), _e = [
160
- Int8Array,
161
- Uint8Array,
162
- Int16Array,
163
- Uint16Array,
164
- Int32Array,
165
- Uint32Array,
166
- Float32Array,
167
- Float64Array,
168
- Uint8ClampedArray
169
- ].reduce((e, t) => (e[t.name] = t, e), {}), E = T(pe, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
170
- let n = _e[t[1]];
171
- if (!n) throw Error("Trying to deserialize unknown typed array");
172
- return new n(e);
173
- });
174
- function D(e, t) {
175
- return e?.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
176
- }
177
- var O = T(D, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
178
- let n = t.classRegistry.getAllowedProps(e.constructor);
179
- if (!n) return { ...e };
180
- let r = {};
181
- return n.forEach((t) => {
182
- r[t] = e[t];
183
- }), r;
184
- }, (e, t, n) => {
185
- let r = n.classRegistry.getValue(t[1]);
186
- if (!r) throw Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
187
- return Object.assign(Object.create(r.prototype), e);
188
- }), ve = T((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, n) => {
189
- let r = n.customTransformerRegistry.findByName(t[1]);
190
- if (!r) throw Error("Trying to deserialize unknown custom value");
191
- return r.deserialize(e);
192
- }), ye = [
193
- O,
194
- ge,
195
- ve,
196
- E
197
- ], be = (e, t) => {
198
- let n = p(ye, (n) => n.isApplicable(e, t));
199
- if (n) return {
200
- value: n.transform(e, t),
201
- type: n.annotation(e, t)
202
- };
203
- let r = p(he, (n) => n.isApplicable(e, t));
204
- if (r) return {
205
- value: r.transform(e, t),
206
- type: r.annotation
207
- };
208
- }, xe = {};
209
- he.forEach((e) => {
210
- xe[e.annotation] = e;
211
- });
212
- var Se = (e, t, n) => {
213
- if (_(t)) switch (t[0]) {
214
- case "symbol": return ge.untransform(e, t, n);
215
- case "class": return O.untransform(e, t, n);
216
- case "custom": return ve.untransform(e, t, n);
217
- case "typed-array": return E.untransform(e, t, n);
218
- default: throw Error("Unknown transformation: " + t);
219
- }
220
- else {
221
- let r = xe[t];
222
- if (!r) throw Error("Unknown transformation: " + t);
223
- return r.untransform(e, n);
224
- }
225
- }, k = (e, t) => {
226
- if (t > e.size) throw Error("index out of bounds");
227
- let n = e.keys();
228
- for (; t > 0;) n.next(), t--;
229
- return n.next().value;
230
- };
231
- function Ce(e) {
232
- if (f(e, "__proto__")) throw Error("__proto__ is not allowed as a property");
233
- if (f(e, "prototype")) throw Error("prototype is not allowed as a property");
234
- if (f(e, "constructor")) throw Error("constructor is not allowed as a property");
235
- }
236
- var we = (e, t) => {
237
- Ce(t);
238
- for (let n = 0; n < t.length; n++) {
239
- let r = t[n];
240
- if (y(e)) e = k(e, +r);
241
- else if (v(e)) {
242
- let i = +r, a = +t[++n] == 0 ? "key" : "value", o = k(e, i);
243
- switch (a) {
244
- case "key":
245
- e = o;
246
- break;
247
- case "value":
248
- e = e.get(o);
249
- break;
250
- }
251
- } else e = e[r];
252
- }
253
- return e;
254
- }, A = (e, t, n) => {
255
- if (Ce(t), t.length === 0) return n(e);
256
- let r = e;
257
- for (let e = 0; e < t.length - 1; e++) {
258
- let n = t[e];
259
- if (_(r)) {
260
- let e = +n;
261
- r = r[e];
262
- } else if (h(r)) r = r[n];
263
- else if (y(r)) {
264
- let e = +n;
265
- r = k(r, e);
266
- } else if (v(r)) {
267
- if (e === t.length - 2) break;
268
- let i = +n, a = +t[++e] == 0 ? "key" : "value", o = k(r, i);
269
- switch (a) {
270
- case "key":
271
- r = o;
272
- break;
273
- case "value":
274
- r = r.get(o);
275
- break;
276
- }
277
- }
278
- }
279
- let i = t[t.length - 1];
280
- if (_(r) ? r[+i] = n(r[+i]) : h(r) && (r[i] = n(r[i])), y(r)) {
281
- let e = k(r, +i), t = n(e);
282
- e !== t && (r.delete(e), r.add(t));
283
- }
284
- if (v(r)) {
285
- let e = +t[t.length - 2], a = k(r, e);
286
- switch (+i == 0 ? "key" : "value") {
287
- case "key": {
288
- let e = n(a);
289
- r.set(e, r.get(a)), e !== a && r.delete(a);
290
- break;
291
- }
292
- case "value":
293
- r.set(a, n(r.get(a)));
294
- break;
295
- }
296
- }
297
- return e;
298
- }, Te = (e) => e < 1;
299
- function j(e, t, n, r = []) {
300
- if (!e) return;
301
- let i = Te(n);
302
- if (!_(e)) {
303
- d(e, (e, a) => j(e, t, n, [...r, ...C(a, i)]));
304
- return;
305
- }
306
- let [a, o] = e;
307
- o && d(o, (e, a) => {
308
- j(e, t, n, [...r, ...C(a, i)]);
309
- }), t(a, r);
310
- }
311
- function Ee(e, t, n, r) {
312
- return j(t, (t, n) => {
313
- e = A(e, n, (e) => Se(e, t, r));
314
- }, n), e;
315
- }
316
- function De(e, t, n) {
317
- let r = Te(n);
318
- function i(t, n) {
319
- let i = we(e, C(n, r));
320
- t.map((e) => C(e, r)).forEach((t) => {
321
- e = A(e, t, () => i);
322
- });
323
- }
324
- if (_(t)) {
325
- let [n, a] = t;
326
- n.forEach((t) => {
327
- e = A(e, C(t, r), () => e);
328
- }), a && d(a, i);
329
- } else d(t, i);
330
- return e;
331
- }
332
- var Oe = (e, t) => h(e) || _(e) || v(e) || y(e) || b(e) || D(e, t);
333
- function ke(e, t, n) {
334
- let r = n.get(e);
335
- r ? r.push(t) : n.set(e, [t]);
336
- }
337
- function Ae(e, t) {
338
- let n = {}, r;
339
- return e.forEach((e) => {
340
- if (e.length <= 1) return;
341
- t || (e = e.map((e) => e.map(String)).sort((e, t) => e.length - t.length));
342
- let [i, ...a] = e;
343
- i.length === 0 ? r = a.map(S) : n[S(i)] = a.map(S);
344
- }), r ? g(n) ? [r] : [r, n] : g(n) ? void 0 : n;
345
- }
346
- var je = (e, t, n, r, i = [], a = [], o = /* @__PURE__ */ new Map()) => {
347
- let s = ue(e);
348
- if (!s) {
349
- ke(e, i, t);
350
- let n = o.get(e);
351
- if (n) return r ? { transformedValue: null } : n;
352
- }
353
- if (!Oe(e, n)) {
354
- let t = be(e, n), r = t ? {
355
- transformedValue: t.value,
356
- annotations: [t.type]
357
- } : { transformedValue: e };
358
- return s || o.set(e, r), r;
359
- }
360
- if (f(a, e)) return { transformedValue: null };
361
- let c = be(e, n), l = c?.value ?? e, u = _(l) ? [] : {}, p = {};
362
- d(l, (s, c) => {
363
- if (c === "__proto__" || c === "constructor" || c === "prototype") throw Error(`Detected property ${c}. This is a prototype pollution risk, please remove it from your object.`);
364
- let l = je(s, t, n, r, [...i, c], [...a, e], o);
365
- u[c] = l.transformedValue, _(l.annotations) ? p[x(c)] = l.annotations : h(l.annotations) && d(l.annotations, (e, t) => {
366
- p[x(c) + "." + t] = e;
367
- });
368
- });
369
- let m = g(p) ? {
370
- transformedValue: u,
371
- annotations: c ? [c.type] : void 0
372
- } : {
373
- transformedValue: u,
374
- annotations: c ? [c.type, p] : p
375
- };
376
- return s || o.set(e, m), m;
377
- };
378
- function M(e) {
379
- return Object.prototype.toString.call(e).slice(8, -1);
380
- }
381
- function Me(e) {
382
- return M(e) === "Array";
383
- }
384
- function Ne(e) {
385
- if (M(e) !== "Object") return !1;
386
- let t = Object.getPrototypeOf(e);
387
- return !!t && t.constructor === Object && t === Object.prototype;
388
- }
389
- function Pe(e, t, n, r, i) {
390
- let a = {}.propertyIsEnumerable.call(r, t) ? "enumerable" : "nonenumerable";
391
- a === "enumerable" && (e[t] = n), i && a === "nonenumerable" && Object.defineProperty(e, t, {
392
- value: n,
393
- enumerable: !1,
394
- writable: !0,
395
- configurable: !0
396
- });
397
- }
398
- function N(e, t = {}) {
399
- if (Me(e)) return e.map((e) => N(e, t));
400
- if (!Ne(e)) return e;
401
- let n = Object.getOwnPropertyNames(e), r = Object.getOwnPropertySymbols(e);
402
- return [...n, ...r].reduce((n, r) => {
403
- if (r === "__proto__" || Me(t.props) && !t.props.includes(r)) return n;
404
- let i = e[r];
405
- return Pe(n, r, N(i, t), e, t.nonenumerable), n;
406
- }, {});
407
- }
408
- var P = class {
409
- constructor({ dedupe: e = !1 } = {}) {
410
- this.classRegistry = new c(), this.symbolRegistry = new s((e) => e.description ?? ""), this.customTransformerRegistry = new m(), this.allowedErrorProps = [], this.dedupe = e;
411
- }
412
- serialize(e) {
413
- let t = /* @__PURE__ */ new Map(), n = je(e, t, this, this.dedupe), r = { json: n.transformedValue };
414
- n.annotations && (r.meta = {
415
- ...r.meta,
416
- values: n.annotations
417
- });
418
- let i = Ae(t, this.dedupe);
419
- return i && (r.meta = {
420
- ...r.meta,
421
- referentialEqualities: i
422
- }), r.meta && (r.meta.v = 1), r;
423
- }
424
- deserialize(e, t) {
425
- let { json: n, meta: r } = e, i = t?.inPlace ? n : N(n);
426
- return r?.values && (i = Ee(i, r.values, r.v ?? 0, this)), r?.referentialEqualities && (i = De(i, r.referentialEqualities, r.v ?? 0)), i;
427
- }
428
- stringify(e) {
429
- return JSON.stringify(this.serialize(e));
430
- }
431
- parse(e) {
432
- return this.deserialize(JSON.parse(e), { inPlace: !0 });
433
- }
434
- registerClass(e, t) {
435
- this.classRegistry.register(e, t);
436
- }
437
- registerSymbol(e, t) {
438
- this.symbolRegistry.register(e, t);
439
- }
440
- registerCustom(e, t) {
441
- this.customTransformerRegistry.register({
442
- name: t,
443
- ...e
444
- });
445
- }
446
- allowErrorProps(...e) {
447
- this.allowedErrorProps.push(...e);
448
- }
449
- };
450
- P.defaultInstance = new P(), P.serialize = P.defaultInstance.serialize.bind(P.defaultInstance), P.deserialize = P.defaultInstance.deserialize.bind(P.defaultInstance), P.stringify = P.defaultInstance.stringify.bind(P.defaultInstance), P.parse = P.defaultInstance.parse.bind(P.defaultInstance), P.registerClass = P.defaultInstance.registerClass.bind(P.defaultInstance), P.registerSymbol = P.defaultInstance.registerSymbol.bind(P.defaultInstance), P.registerCustom = P.defaultInstance.registerCustom.bind(P.defaultInstance), P.allowErrorProps = P.defaultInstance.allowErrorProps.bind(P.defaultInstance), P.serialize, P.deserialize, P.stringify, P.parse, P.registerClass, P.registerCustom, P.registerSymbol, P.allowErrorProps;
451
- var Fe = 1e4, Ie = 3e3, Le = 2e3, Re = 3e4, F = class {
452
- _serverUrl;
453
- useWs;
454
- baseRetryMs;
455
- maxRetryMs;
456
- onConnectionChange;
457
- token;
458
- _trpcClient;
459
- _wsClient = null;
460
- mirror = null;
461
- mirrorInit = null;
462
- connected = !1;
463
- connectedPromise = null;
464
- _systemProxy;
465
- _connectionVersion = 0;
466
- connectionListeners = /* @__PURE__ */ new Set();
467
- constructor(e) {
468
- this._serverUrl = e.serverUrl.replace(/\/+$/, ""), this.token = e.token;
469
- let t = typeof window < "u";
470
- this.useWs = e.useWebSocket ?? t, this.onConnectionChange = e.onConnectionChange, this.baseRetryMs = e.retryDelayMs ?? Le, this.maxRetryMs = e.maxRetryDelayMs ?? Re, this._trpcClient = this.buildTrpcClient(), this._systemProxy = a(this._trpcClient);
471
- }
472
- get serverUrl() {
473
- return this._serverUrl;
474
- }
475
- get connectionVersion() {
476
- return this._connectionVersion;
477
- }
478
- subscribeConnectionEvents(e) {
479
- return this.connectionListeners.add(e), () => {
480
- this.connectionListeners.delete(e);
481
- };
482
- }
483
- emitConnectionEvent(e) {
484
- try {
485
- this.onConnectionChange?.(e);
486
- } catch {}
487
- for (let t of this.connectionListeners) try {
488
- t(e, this._connectionVersion);
489
- } catch {}
490
- }
491
- async awaitConnected(e) {
492
- if (this.connected) return;
493
- if (this.connectedPromise) return this.connectedPromise;
494
- let t = e ?? 15e3;
495
- this.connectedPromise = (async () => {
496
- let e = this._trpcClient.auth.me.query();
497
- Number.isFinite(t) ? await new Promise((n, r) => {
498
- let i = setTimeout(() => r(/* @__PURE__ */ Error(`System.awaitConnected: probe timed out after ${t}ms`)), t);
499
- e.then(() => {
500
- clearTimeout(i), n();
501
- }, (e) => {
502
- clearTimeout(i), r(e instanceof Error ? e : Error(String(e)));
503
- });
504
- }) : await e, this.connected = !0;
505
- })();
506
- try {
507
- await this.connectedPromise;
508
- } finally {
509
- this.connectedPromise = null;
510
- }
511
- }
512
- async init(e) {
513
- if (this.mirror?.isReady()) return;
514
- if (this.mirrorInit) return this.mirrorInit;
515
- let t = new i(this._trpcClient);
516
- return this.mirror = t, this.mirrorInit = (async () => {
517
- await this.awaitConnected(e), await t.init(e);
518
- })().finally(() => {
519
- this.mirrorInit = null;
520
- }), this.mirrorInit;
521
- }
522
- async awaitReady() {
523
- if (!this.mirror?.isReady()) return this.mirrorInit ? this.mirrorInit : this.init();
524
- }
525
- isReady() {
526
- return this.mirror?.isReady() ?? !1;
527
- }
528
- isConnected() {
529
- return this.connected;
530
- }
531
- reconnect() {
532
- this.useWs && (this.emitConnectionEvent("connecting"), this._wsClient?.close(), this.disposeMirror(), this.connected = !1, this.connectedPromise = null, this._trpcClient = this.buildTrpcClient(), this._systemProxy = a(this._trpcClient));
533
- }
534
- switchServerUrl(e) {
535
- let t = e.replace(/\/+$/, "");
536
- t !== this._serverUrl && (this._serverUrl = t, this.reconnect());
537
- }
538
- async raceConnectionEndpoints(e) {
539
- let t = e?.perCandidateTimeoutMs ?? 1500, n = (() => {
540
- try {
541
- return new URL(this._serverUrl);
542
- } catch {
543
- return null;
544
- }
545
- })(), r = n?.port ? Number(n.port) : n?.protocol === "https:" ? 443 : 80, i = n?.protocol === "https:" ? "https" : "http", a = this._trpcClient.localNetwork?.getConnectionEndpoints;
546
- if (!a) return {
547
- winner: this._serverUrl,
548
- switched: !1
549
- };
550
- let o;
551
- try {
552
- o = (await a.query({
553
- port: r,
554
- ipv4Only: e?.ipv4Only,
555
- scheme: i
556
- })).endpoints;
557
- } catch {
558
- return {
559
- winner: this._serverUrl,
560
- switched: !1
561
- };
562
- }
563
- if (o.length === 0) return {
564
- winner: this._serverUrl,
565
- switched: !1
566
- };
567
- let s = await I(o.map((e) => e.baseUrl), t);
568
- return !s || s === this._serverUrl ? {
569
- winner: s ?? this._serverUrl,
570
- switched: !1
571
- } : (this.switchServerUrl(s), {
572
- winner: s,
573
- switched: !0
574
- });
575
- }
576
- close() {
577
- this.disposeMirror(), this.connected = !1, this.connectedPromise = null, this._wsClient?.close();
578
- }
579
- disposeMirror() {
580
- this.mirror?.dispose(), this.mirror = null, this.mirrorInit = null;
581
- }
582
- async login(e, t) {
583
- let n = await this._trpcClient.auth.login.mutate({
584
- username: e,
585
- password: t
586
- });
587
- if (typeof n == "object" && n && "token" in n) {
588
- let e = n, t = e.token;
589
- typeof t == "string" && e.requiresTotp !== !0 && this.setToken(t);
590
- }
591
- return n;
592
- }
593
- async loginVerifyTotp(e, t) {
594
- let n = await this._trpcClient.auth.loginVerifyTotp.mutate({
595
- challengeToken: e,
596
- code: t
597
- });
598
- if (typeof n == "object" && n && "token" in n) {
599
- let e = n.token;
600
- typeof e == "string" && this.setToken(e);
601
- }
602
- return n;
603
- }
604
- async logout() {
605
- await this._trpcClient.auth.logout.mutate();
606
- }
607
- async getMe() {
608
- return await this._trpcClient.auth.me.query();
609
- }
610
- setToken(e) {
611
- this.token = e;
612
- }
613
- listDevices(e) {
614
- return this.mirror ? (e ? this.mirror.query(e) : this.mirror.getAllDevices()).map((e) => this.attachBinding(e)) : [];
615
- }
616
- getDevice(e) {
617
- let t = this.mirror?.getDeviceById(e) ?? null;
618
- return t ? this.attachBinding(t) : null;
619
- }
620
- getDeviceByName(e) {
621
- let t = this.mirror?.getDeviceByName(e) ?? null;
622
- return t ? this.attachBinding(t) : null;
623
- }
624
- getDeviceByStableId(e) {
625
- let t = this.mirror?.getDeviceByStableId(e) ?? null;
626
- return t ? this.attachBinding(t) : null;
627
- }
628
- async waitForDevice(e, t) {
629
- this.mirror || await this.init();
630
- let n = await this.mirror.waitForDevice(e, t ?? 3e4);
631
- return this.attachBinding(n);
632
- }
633
- onDeviceAdded(e) {
634
- if (!this.mirror) throw Error("System.onDeviceAdded: call init() before subscribing");
635
- return this.mirror.onDeviceAdded(e);
636
- }
637
- onDeviceRemoved(e) {
638
- if (!this.mirror) throw Error("System.onDeviceRemoved: call init() before subscribing");
639
- return this.mirror.onDeviceRemoved(e);
640
- }
641
- attachBinding(e) {
642
- let t = this.lookupBinding(e.deviceId);
643
- if (t === e.binding) return e;
644
- let n = e;
645
- return n.binding = t, e;
646
- }
647
- lookupBinding(e) {
648
- return this.mirror ? this.mirror.getDeviceById(e)?.binding ?? null : null;
649
- }
650
- get addonPages() {
651
- return this._systemProxy.addonPages;
652
- }
653
- get addonSettings() {
654
- return this._systemProxy.addonSettings;
655
- }
656
- get alerts() {
657
- return this._systemProxy.alerts;
658
- }
659
- get audioAnalyzer() {
660
- return this._systemProxy.audioAnalyzer;
661
- }
662
- get audioCodec() {
663
- return this._systemProxy.audioCodec;
664
- }
665
- get backup() {
666
- return this._systemProxy.backup;
667
- }
668
- get decoder() {
669
- return this._systemProxy.decoder;
670
- }
671
- get deviceManager() {
672
- return this._systemProxy.deviceManager;
673
- }
674
- get deviceProvider() {
675
- return this._systemProxy.deviceProvider;
676
- }
677
- get deviceState() {
678
- return this._systemProxy.deviceState;
679
- }
680
- get metricsProvider() {
681
- return this._systemProxy.metricsProvider;
682
- }
683
- get notificationOutput() {
684
- return this._systemProxy.notificationOutput;
685
- }
686
- get pipelineExecutor() {
687
- return this._systemProxy.pipelineExecutor;
688
- }
689
- get pipelineOrchestrator() {
690
- return this._systemProxy.pipelineOrchestrator;
691
- }
692
- get pipelineRunner() {
693
- return this._systemProxy.pipelineRunner;
694
- }
695
- get platformProbe() {
696
- return this._systemProxy.platformProbe;
697
- }
698
- get recordingEngine() {
699
- return this._systemProxy.recordingEngine;
700
- }
701
- get settingsStore() {
702
- return this._systemProxy.settingsStore;
703
- }
704
- get storage() {
705
- return this._systemProxy.storage;
706
- }
707
- get streamBroker() {
708
- return this._systemProxy.streamBroker;
709
- }
710
- get turnProvider() {
711
- return this._systemProxy.turnProvider;
712
- }
713
- get userManagement() {
714
- return this._systemProxy.userManagement;
715
- }
716
- subscribeEvent(e, t) {
717
- let n = this._trpcClient.live.onEvent.subscribe({ category: e }, { onData: (e) => {
718
- try {
719
- t(e);
720
- } catch {}
721
- } });
722
- return () => {
723
- try {
724
- n.unsubscribe();
725
- } catch {}
726
- };
727
- }
728
- get trpcClient() {
729
- return this._trpcClient;
730
- }
731
- get wsClient() {
732
- return this._wsClient;
733
- }
734
- buildTrpcClient() {
735
- let i = () => {
736
- let e = {};
737
- return this.token && (e.Authorization = `Bearer ${this.token}`), e;
738
- };
739
- if (this.useWs) {
740
- let n = this._serverUrl.replace(/^http/, "ws") + "/trpc", i = this.baseRetryMs, a = this.maxRetryMs;
741
- return this._wsClient = e({
742
- url: n,
743
- connectionParams: () => ({ token: this.token }),
744
- retryDelayMs: (e) => Math.min(i * 2 ** e, a),
745
- keepAlive: {
746
- enabled: !0,
747
- intervalMs: Fe,
748
- pongTimeoutMs: Ie
749
- },
750
- onOpen: () => {
751
- this._connectionVersion += 1, this.emitConnectionEvent("connected");
752
- },
753
- onClose: () => {
754
- this.emitConnectionEvent("disconnected");
755
- }
756
- }), r({ links: [t({
757
- client: this._wsClient,
758
- transformer: P
759
- })] });
760
- }
761
- return this._wsClient = null, r({ links: [n({
762
- url: `${this._serverUrl}/trpc`,
763
- headers: i,
764
- transformer: P
765
- })] });
766
- }
767
- };
768
- function ze(e) {
769
- return new F(e);
770
- }
771
- async function I(e, t) {
772
- if (e.length === 0) return null;
773
- if (typeof fetch != "function") return e[0] ?? null;
774
- let n = typeof window < "u" && window.location !== void 0 && window.location.protocol === "https:" ? e.filter((e) => e.toLowerCase().startsWith("https://")) : e;
775
- if (n.length === 0) return null;
776
- let r = n.map(() => new AbortController()), i = n.map(async (e, n) => {
777
- let i = r[n], a = setTimeout(() => i.abort(), t);
778
- try {
779
- let t = await fetch(`${e.replace(/\/+$/, "")}/trpc/health`, {
780
- method: "GET",
781
- signal: i.signal,
782
- credentials: "omit"
783
- });
784
- if (!t.ok) throw Error(`${t.status}`);
785
- return e;
786
- } finally {
787
- clearTimeout(a);
788
- }
789
- });
790
- try {
791
- let e = await Promise.any(i);
792
- for (let e of r) try {
793
- e.abort();
794
- } catch {}
795
- return e;
796
- } catch {
797
- return null;
798
- }
799
- }
800
- var L = /* @__PURE__ */ ((e) => (e.Motion = "motion", e.Person = "person", e.Vehicle = "vehicle", e.Animal = "animal", e.Audio = "audio", e.Face = "face", e.Plate = "plate", e.Package = "package", e.Doorbell = "doorbell", e.Sensor = "sensor", e))(L || {}), R = /* @__PURE__ */ "animal.dog_cat.dog.cat.horse.sheep.cow.elephant.bear.zebra.giraffe.mouse.rabbit.deer.lion.tiger.bird.eagle.owl.pigeon.fish.whale.dolphin.snake.turtle.lizard".split("."), z = [
801
- "person",
802
- "people",
803
- "pedestrian",
804
- "rider",
805
- "driver",
806
- "cyclist",
807
- "skier",
808
- "skateboarder",
809
- "face",
810
- "hand",
811
- "head",
812
- "body"
813
- ], B = [
814
- "vehicle",
815
- "car",
816
- "truck",
817
- "bus",
818
- "motorcycle",
819
- "bicycle",
820
- "van",
821
- "ambulance",
822
- "police_car",
823
- "fire_truck",
824
- "train",
825
- "subway",
826
- "tram",
827
- "airplane",
828
- "boat",
829
- "ship",
830
- "helicopter"
831
- ], V = /* @__PURE__ */ "face.eyes.nose.mouth.ears.eyebrows.left_eye.right_eye.pupil.iris.eyelid.eye_corner.upper_lip.lower_lip.teeth.chin.cheek.forehead.jaw.glasses.sunglasses.facial_hair.beard.mustache.facial_landmark.facial_keypoint".split("."), H = [
832
- "plate",
833
- "license_plate",
834
- "front_plate",
835
- "rear_plate",
836
- "motorcycle_plate",
837
- "temporary_plate",
838
- "dealer_plate",
839
- "licensePlate",
840
- "plate_number",
841
- "plate_character",
842
- "plate_digit",
843
- "plate_letter",
844
- "plate_symbol",
845
- "plate_region",
846
- "plate_country_identifier",
847
- "plate_frame",
848
- "plate_bolt",
849
- "plate_sticker",
850
- "plate_validation_tag",
851
- "damaged_plate",
852
- "obscured_plate",
853
- "dirty_plate"
854
- ], U = [
855
- "motion",
856
- "movement",
857
- "other"
858
- ], W = ["package", "packet"], G = ["audio"], K = /* @__PURE__ */ "speech.scream.babbling.yell.bellow.whoop.whispering.laughter.snicker.crying.cry.sigh.singing.choir.chant.mantra.child_singing.rapping.humming.groan.grunt.whistling.breathing.wheeze.snoring.gasp.pant.snort.cough.throat_clearing.sneeze.sniff.cheering.applause.chatter.crowd.children_playing.bark.yip.howl.bow-wow.growling.whimper_dog.purr.meow.hiss.caterwaul.pets.livestock.doorbell.ding-dong.door.slam.knock.alarm.telephone.music.dog.dogs".split("."), q = ["doorbell", "ring"], J = [
859
- "lock",
860
- "binary",
861
- "flood",
862
- "entry",
863
- "door",
864
- "leak",
865
- "door_open",
866
- "flooded",
867
- "entry_open"
868
- ], Y = {
869
- ...R.reduce((e, t) => ({
870
- ...e,
871
- [t]: "animal"
872
- }), {}),
873
- ...z.reduce((e, t) => ({
874
- ...e,
875
- [t]: "person"
876
- }), {}),
877
- ...B.reduce((e, t) => ({
878
- ...e,
879
- [t]: "vehicle"
880
- }), {}),
881
- ...U.reduce((e, t) => ({
882
- ...e,
883
- [t]: "motion"
884
- }), {}),
885
- ...W.reduce((e, t) => ({
886
- ...e,
887
- [t]: "package"
888
- }), {}),
889
- ...V.reduce((e, t) => ({
890
- ...e,
891
- [t]: "face"
892
- }), {}),
893
- ...H.reduce((e, t) => ({
894
- ...e,
895
- [t]: "plate"
896
- }), {}),
897
- ...G.reduce((e, t) => ({
898
- ...e,
899
- [t]: "audio"
900
- }), {}),
901
- ...K.reduce((e, t) => ({
902
- ...e,
903
- [t]: "audio"
904
- }), {}),
905
- ...q.reduce((e, t) => ({
906
- ...e,
907
- [t]: "doorbell"
908
- }), {}),
909
- ...J.reduce((e, t) => ({
910
- ...e,
911
- [t]: "sensor"
912
- }), {})
913
- }, Be = (e) => V.includes(e), Ve = (e) => H.includes(e), He = (e) => R.includes(e), Ue = (e) => z.includes(e), We = (e) => B.includes(e), Ge = (e) => U.includes(e), Ke = (e) => q.includes(e), qe = (e) => W.includes(e), Je = (e) => G.includes(e) || K.includes(e), Ye = (e) => J.includes(e), Xe = (e) => Be(e) || Ve(e), Ze = (e) => Y[e], Qe = (e) => {
914
- let { className: t } = e, n = {
915
- face: "person",
916
- plate: "vehicle"
917
- }, r = Y[t];
918
- return r && r !== t ? r : n[t];
919
- }, $e = Object.values(L), X = $e.filter((e) => e !== "motion"), Z = [
920
- "person",
921
- "doorbell",
922
- "package"
923
- ], et = [
924
- ...Z,
925
- "vehicle",
926
- "animal",
927
- "audio",
928
- "face",
929
- "plate"
930
- ], tt = [...X];
931
- function nt(e, t) {
932
- switch (e) {
933
- case "critical": return Z;
934
- case "important": return et;
935
- case "all": return tt;
936
- case "custom": return t?.length ? t : X;
937
- default: return X;
938
- }
939
- }
940
- var Q = {
941
- Light: "light",
942
- Switch: "switch",
943
- WindowCovering: "cover",
944
- Lock: "lock",
945
- SecuritySystem: "alarm",
946
- Buttons: "button",
947
- Select: "select",
948
- Siren: "siren",
949
- Sensor: "sensor",
950
- Entry: "entry",
951
- Program: "script",
952
- MediaPlayer: "media_player",
953
- Outlet: "switch",
954
- light: "light",
955
- switch: "switch",
956
- input_boolean: "switch",
957
- cover: "cover",
958
- lock: "lock",
959
- alarm_control_panel: "alarm",
960
- input_button: "button",
961
- button: "button",
962
- input_select: "select",
963
- select: "select",
964
- siren: "siren",
965
- sensor: "sensor",
966
- media_player: "media_player",
967
- script: "script"
968
- }, rt = {
969
- light: "light",
970
- switch: "switch",
971
- input_boolean: "switch",
972
- cover: "cover",
973
- lock: "lock",
974
- alarm_control_panel: "alarm",
975
- input_button: "button",
976
- button: "button",
977
- input_select: "select",
978
- select: "select",
979
- siren: "siren",
980
- sensor: "sensor",
981
- binary_sensor: "sensor",
982
- media_player: "media_player",
983
- script: "script",
984
- climate: "climate",
985
- camera: "camera",
986
- fan: "fan",
987
- vacuum: "vacuum",
988
- automation: "automation",
989
- scene: "scene",
990
- input_number: "sensor",
991
- person: "person",
992
- device_tracker: "tracker",
993
- weather: "weather",
994
- water_heater: "climate"
995
- }, it = {
996
- Light: "light",
997
- Switch: "switch",
998
- WindowCovering: "cover",
999
- Lock: "lock",
1000
- SecuritySystem: "alarm",
1001
- Buttons: "button",
1002
- Select: "select",
1003
- Siren: "siren",
1004
- Sensor: "sensor",
1005
- Entry: "entry",
1006
- Program: "script",
1007
- MediaPlayer: "media_player",
1008
- Camera: "camera",
1009
- Doorbell: "doorbell",
1010
- Fan: "fan",
1011
- Outlet: "switch"
1012
- };
1013
- function at(e) {
1014
- return Q[e] || (Q[e.toLowerCase()] ?? null);
1015
- }
1016
- var ot = [
1017
- "Entry",
1018
- "Light",
1019
- "Switch",
1020
- "Lock",
1021
- "SecuritySystem",
1022
- "Buttons",
1023
- "WindowCovering",
1024
- "Siren",
1025
- "Sensor",
1026
- "Select",
1027
- "Program"
1028
- ], st = new Set(ot), ct = [
1029
- "light",
1030
- "switch",
1031
- "input_boolean",
1032
- "cover",
1033
- "lock",
1034
- "alarm_control_panel",
1035
- "input_button",
1036
- "button",
1037
- "input_select",
1038
- "select",
1039
- "siren",
1040
- "media_player",
1041
- "script"
1042
- ], lt = new Set(ct), $ = [
1043
- {
1044
- id: "liveStream",
1045
- label: "Live Stream",
1046
- sources: {
1047
- frigate: !0,
1048
- scrypted: !0,
1049
- rtsp: !0
1050
- },
1051
- adapterMethod: "getLiveStream"
1052
- },
1053
- {
1054
- id: "multiResolution",
1055
- label: "Multi-Resolution",
1056
- sources: {
1057
- frigate: !0,
1058
- scrypted: !0,
1059
- rtsp: !1
1060
- },
1061
- adapterMethod: "getResolutions"
1062
- },
1063
- {
1064
- id: "motion",
1065
- label: "Motion Detection",
1066
- sources: {
1067
- frigate: !1,
1068
- scrypted: !0,
1069
- rtsp: !1
1070
- },
1071
- adapterMethod: "getMotion"
1072
- },
1073
- {
1074
- id: "objectDetection",
1075
- label: "Object Detection",
1076
- sources: {
1077
- frigate: !1,
1078
- scrypted: !0,
1079
- rtsp: !1
1080
- },
1081
- adapterMethod: "getObjectDetections"
1082
- },
1083
- {
1084
- id: "audioVolume",
1085
- label: "Audio Level",
1086
- sources: {
1087
- frigate: !1,
1088
- scrypted: !0,
1089
- rtsp: !1
1090
- },
1091
- adapterMethod: "getAudioVolume"
1092
- },
1093
- {
1094
- id: "audioVolumes",
1095
- label: "Audio Volumes (dBFS)",
1096
- sources: {
1097
- frigate: !1,
1098
- scrypted: !0,
1099
- rtsp: !1
1100
- },
1101
- adapterMethod: "getAudioVolumes"
1102
- },
1103
- {
1104
- id: "ptz",
1105
- label: "PTZ Control",
1106
- sources: {
1107
- frigate: !1,
1108
- scrypted: !0,
1109
- rtsp: !1
1110
- },
1111
- adapterMethod: "getPTZ"
1112
- },
1113
- {
1114
- id: "intercom",
1115
- label: "Intercom (Mic)",
1116
- sources: {
1117
- frigate: !1,
1118
- scrypted: !0,
1119
- rtsp: !1
1120
- },
1121
- adapterMethod: "getIntercomSupport"
1122
- },
1123
- {
1124
- id: "deviceStatus",
1125
- label: "Device Status",
1126
- sources: {
1127
- frigate: !1,
1128
- scrypted: !0,
1129
- rtsp: !1
1130
- },
1131
- adapterMethod: "getStatus"
1132
- },
1133
- {
1134
- id: "timeline",
1135
- label: "Detection Timeline",
1136
- sources: {
1137
- frigate: !0,
1138
- scrypted: !0,
1139
- rtsp: !1
1140
- },
1141
- adapterMethod: "getCameraDayData"
1142
- },
1143
- {
1144
- id: "clusteredTimeline",
1145
- label: "Clustered Timeline",
1146
- sources: {
1147
- frigate: !0,
1148
- scrypted: !0,
1149
- rtsp: !1
1150
- },
1151
- requiresBackend: !0,
1152
- adapterMethod: "getClusteredDayData"
1153
- },
1154
- {
1155
- id: "detectionClasses",
1156
- label: "Detection Classes",
1157
- sources: {
1158
- frigate: !0,
1159
- scrypted: !0,
1160
- rtsp: !1
1161
- },
1162
- adapterMethod: "getDetectionClasses"
1163
- },
1164
- {
1165
- id: "videoClips",
1166
- label: "Video Clips",
1167
- sources: {
1168
- frigate: !0,
1169
- scrypted: !0,
1170
- rtsp: !1
1171
- },
1172
- adapterMethod: "getVideoClips"
1173
- },
1174
- {
1175
- id: "nvrPlayback",
1176
- label: "NVR Playback",
1177
- sources: {
1178
- frigate: !0,
1179
- scrypted: !0,
1180
- rtsp: !1
1181
- },
1182
- adapterMethod: "getNvrPlaybackSupported"
1183
- },
1184
- {
1185
- id: "nvrScrub",
1186
- label: "NVR Scrub/Seek",
1187
- sources: {
1188
- frigate: !1,
1189
- scrypted: !0,
1190
- rtsp: !1
1191
- },
1192
- adapterMethod: "seekRecordingStream"
1193
- },
1194
- {
1195
- id: "recordingThumbnail",
1196
- label: "Recording Thumbnails",
1197
- sources: {
1198
- frigate: !0,
1199
- scrypted: !0,
1200
- rtsp: !1
1201
- },
1202
- adapterMethod: "getRecordingStreamThumbnail"
1203
- },
1204
- {
1205
- id: "nvrSeekToLive",
1206
- label: "Seek to Live",
1207
- sources: {
1208
- frigate: !1,
1209
- scrypted: !0,
1210
- rtsp: !1
1211
- },
1212
- adapterMethod: "seekNvrToLive"
1213
- }
1214
- ];
1215
- function ut(e, t, n) {
1216
- let r = $.find((t) => t.id === e);
1217
- return !(!r || !r.sources[t] || r.platforms && r.platforms[n] === !1);
1218
- }
1219
- function dt(e) {
1220
- return $.filter((t) => t.sources[e]);
1221
- }
1222
- function ft() {
1223
- return $.filter((e) => e.requiresBackend);
1224
- }
1225
- function pt(e, t, n) {
1226
- if (e.length === 0) return null;
1227
- let r = t.viewportWidth * t.viewportHeight * (t.pixelRatio ?? 1), i = t.bandwidthMbps ?? 100, a = t.packetLoss ?? 0, o = t.rttMs ?? 50, s = "high";
1228
- t.maxResolution === "low" || t.isCellular || i < 1 || a > .05 ? s = "low" : t.maxResolution === "medium" || i < 5 || r < 5e5 || o > 200 ? s = "medium" : (t.maxResolution === "high" || r > 2e6) && (s = "high");
1229
- let c = {
1230
- main: "high",
1231
- sub: "medium",
1232
- ext: "low"
1233
- }, l = n ?? "native", u = e.map((e) => {
1234
- let t = 0, n = c[e.profile] ?? "medium";
1235
- if (n === s ? t += 100 : (s === "high" && n === "medium" || s === "medium" && n === "high" || s === "medium" && n === "low" || s === "low" && n === "medium") && (t += 50), e.transport === l ? t += 30 : e.transport === "native" ? t += 20 : e.transport === "rtsp" ? t += 15 : e.transport === "rtmp" && (t += 10), e.metadata?.width && e.metadata?.height) {
1236
- let n = e.metadata.width * e.metadata.height / Math.max(r, 1);
1237
- n >= .8 && n <= 2 ? t += 25 : n >= .5 && n <= 3 && (t += 15), n > 4 && i < 10 && (t -= 20);
1238
- }
1239
- return e.metadata?.codec && (i < 5 && e.metadata.codec.includes("265") && (t += 10), i >= 10 && e.metadata.codec.includes("264") && (t += 5)), {
1240
- ...e,
1241
- score: t,
1242
- targetTier: s
1243
- };
1244
- });
1245
- u.sort((e, t) => t.score - e.score);
1246
- let d = u[0];
1247
- return {
1248
- streamName: d.streamName,
1249
- profile: d.profile,
1250
- transport: d.transport,
1251
- label: d.label,
1252
- metadata: d.metadata,
1253
- reason: `${d.targetTier} quality → ${d.profile}/${d.transport} (score: ${d.score})`
1254
- };
1255
- }
1256
- function mt(e, t) {
1257
- return t ? 10 : e.isCellular || (e.packetLoss ?? 0) > .02 ? 15 : 30;
1258
- }
1259
- //#endregion
1260
- export { X as DEFAULT_ENABLED_CLASSES, L as DetectionClass, ct as ELIGIBLE_HA_DOMAINS, lt as ELIGIBLE_HA_DOMAINS_SET, ot as ELIGIBLE_SCRYPTED_DEVICE_TYPES, st as ELIGIBLE_SCRYPTED_DEVICE_TYPES_SET, $ as FEATURE_MATRIX, rt as HA_DOMAIN_TYPE_MAP, Q as RAW_TO_CANONICAL, it as SCRYPTED_TYPE_TO_CANONICAL, F as System, tt as TIMELINE_PRESET_ALL, Z as TIMELINE_PRESET_CRITICAL, et as TIMELINE_PRESET_IMPORTANT, R as animalClasses, G as audioClasses, K as audioLabelClasses, ze as createSystem, $e as defaultDetectionClasses, Y as detectionClassesDefaultMap, q as doorbellClasses, V as faceClasses, ft as getBackendRequiredFeatures, at as getCanonicalDeviceType, nt as getClassesForTimelinePreset, mt as getNextEvalInterval, Ze as getParentClass, Qe as getParentDetectionClass, dt as getSourceFeatures, He as isAnimalClassname, Je as isAudioClassname, Ke as isDoorbellClassname, Be as isFaceClassname, ut as isFeatureAvailable, Xe as isLabelDetection, Ge as isMotionClassname, qe as isPackageClassname, Ue as isPersonClassname, Ve as isPlateClassname, Ye as isSensorLabelClassname, We as isVehicleClassname, H as licensePlateClasses, U as motionClasses, W as packageClasses, z as personClasses, I as raceFastestEndpoint, pt as selectOptimalStream, J as sensorLabelClasses, B as vehicleClasses };