urfu-ui-kit-react 2.1.0 → 2.1.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/README.md +7 -2
- package/dist/components/Calendar/Calendar.d.ts +1 -1
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.types.d.ts +3 -0
- package/dist/components/Calendar/Calendar.types.d.ts.map +1 -1
- package/dist/components/ColumnSettings/ColumnSettings.d.ts.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/useModalFocus.d.ts +3 -1
- package/dist/components/Modal/useModalFocus.d.ts.map +1 -1
- package/dist/components/Modal/useModalTitleClearance.d.ts.map +1 -1
- package/dist/components/Notification/Notification.d.ts.map +1 -1
- package/dist/components/StickyActionBar/StickyActionBar.d.ts.map +1 -1
- package/dist/components/Table/Filter/FilterDateBox.d.ts +7 -3
- package/dist/components/Table/Filter/FilterDateBox.d.ts.map +1 -1
- package/dist/components/Table/Table.filterTypes.d.ts +4 -1
- package/dist/components/Table/Table.filterTypes.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/dev/index.js +473 -437
- package/dist/dev/types/vanilla/src/dev/intercept.d.ts +5 -2
- package/dist/dev/types/vanilla/src/dev/store.d.ts +3 -1
- package/dist/fonts/montserrat/Montserrat-Bold.woff2 +0 -0
- package/dist/fonts/montserrat/Montserrat-Medium.woff2 +0 -0
- package/dist/fonts/montserrat/Montserrat-Regular.woff2 +0 -0
- package/dist/fonts/montserrat/Montserrat-SemiBold.woff2 +0 -0
- package/dist/hooks/useAutoId.d.ts +3 -0
- package/dist/hooks/useAutoId.d.ts.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/responsive/uiKitResponsive.d.ts +2 -1
- package/dist/responsive/uiKitResponsive.d.ts.map +1 -1
- package/dist/shared/devLauncherOffset.d.ts +8 -0
- package/dist/shared/devLauncherOffset.d.ts.map +1 -0
- package/dist/shared/kitCopy.d.ts +21 -0
- package/dist/shared/kitCopy.d.ts.map +1 -0
- package/dist/shared/kitRegistry.d.ts +89 -0
- package/dist/shared/kitRegistry.d.ts.map +1 -0
- package/dist/style-no-fonts.css +1 -1
- package/dist/style.css +9 -9
- package/dist/style.layer.css +19 -10
- package/dist/style.shell.css +34 -158
- package/dist/urfu-ui-kit-react.js +5774 -5515
- package/dist/utils/inputMode.d.ts +2 -1
- package/dist/utils/inputMode.d.ts.map +1 -1
- package/package.json +5 -8
package/dist/dev/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { useSyncExternalStore as
|
|
2
|
-
let O = [],
|
|
3
|
-
const
|
|
1
|
+
import { useSyncExternalStore as Ft } from "react";
|
|
2
|
+
let O = [], Ht = 1;
|
|
3
|
+
const B = /* @__PURE__ */ new Set();
|
|
4
4
|
let R = !1;
|
|
5
|
-
function
|
|
5
|
+
function K() {
|
|
6
6
|
R || (R = !0, setTimeout(() => {
|
|
7
|
-
R = !1,
|
|
7
|
+
R = !1, B.forEach((t) => t());
|
|
8
8
|
}, 16));
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const
|
|
12
|
-
O = [...O.slice(-49),
|
|
13
|
-
let
|
|
14
|
-
return (
|
|
15
|
-
|
|
10
|
+
function jt(t, e, n) {
|
|
11
|
+
const o = Date.now(), r = { id: Ht++, service: t, method: e.toUpperCase(), path: n, status: "pending", duration: null, endedAt: null, faked: !1 };
|
|
12
|
+
O = [...O.slice(-49), r], K();
|
|
13
|
+
let a = !1;
|
|
14
|
+
return (s, i) => {
|
|
15
|
+
a || (a = !0, r.status = s, r.faked = i, r.endedAt = Date.now(), r.duration = r.endedAt - o, K());
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function et() {
|
|
19
19
|
return [...O].reverse();
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
O = [], R = !1,
|
|
21
|
+
function dt() {
|
|
22
|
+
O = [], R = !1, K();
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
26
|
-
|
|
24
|
+
function Ut(t) {
|
|
25
|
+
return B.add(t), () => {
|
|
26
|
+
B.delete(t);
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
const
|
|
30
|
-
let
|
|
31
|
-
const
|
|
29
|
+
const ft = "urfu-ui-kit:dev:", w = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Set();
|
|
30
|
+
let pt;
|
|
31
|
+
const ht = (t) => `${ft}${t}`, Nt = ["offline", "network", "slow"];
|
|
32
32
|
let E = null;
|
|
33
|
-
const
|
|
34
|
-
function
|
|
33
|
+
const I = /* @__PURE__ */ new Set();
|
|
34
|
+
function _t() {
|
|
35
35
|
let t;
|
|
36
36
|
try {
|
|
37
37
|
t = new URLSearchParams(window.location.search).get("dev");
|
|
@@ -42,11 +42,11 @@ function Ut() {
|
|
|
42
42
|
if (t === "off") {
|
|
43
43
|
E = null;
|
|
44
44
|
try {
|
|
45
|
-
Object.keys(localStorage).filter((e) => e.startsWith(
|
|
45
|
+
Object.keys(localStorage).filter((e) => e.startsWith(ft)).forEach((e) => localStorage.removeItem(e));
|
|
46
46
|
} catch {
|
|
47
47
|
}
|
|
48
48
|
} else
|
|
49
|
-
E = t.split(",").map((e) => e.trim()).filter(Boolean),
|
|
49
|
+
E = t.split(",").map((e) => e.trim()).filter(Boolean), I.clear();
|
|
50
50
|
try {
|
|
51
51
|
const e = new URL(window.location.href);
|
|
52
52
|
e.searchParams.delete("dev"), window.history.replaceState(window.history.state, "", e.href);
|
|
@@ -54,17 +54,17 @@ function Ut() {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
58
|
-
return [...
|
|
57
|
+
function Wt(t) {
|
|
58
|
+
return [...Nt, ...t.builtins ?? [], ...(t.groups ?? []).flatMap((e) => e.items.map((n) => n.id))];
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
if (!E ||
|
|
62
|
-
const e = new Set(
|
|
63
|
-
n.length && (
|
|
60
|
+
function Bt(t) {
|
|
61
|
+
if (!E || I.has(t.config.service)) return;
|
|
62
|
+
const e = new Set(Wt(t.config)), n = E.filter((o) => e.has(o));
|
|
63
|
+
n.length && (I.add(t.config.service), t.state = { ...t.state, faults: n }, N(t.config.service, t.state));
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function Kt(t) {
|
|
66
66
|
try {
|
|
67
|
-
const e = JSON.parse(localStorage.getItem(
|
|
67
|
+
const e = JSON.parse(localStorage.getItem(ht(t)) ?? "null");
|
|
68
68
|
return {
|
|
69
69
|
faults: Array.isArray(e == null ? void 0 : e.faults) ? e.faults.filter((n) => typeof n == "string") : [],
|
|
70
70
|
rules: Array.isArray(e == null ? void 0 : e.rules) ? e.rules : [],
|
|
@@ -74,145 +74,145 @@ function Ht(t) {
|
|
|
74
74
|
return { faults: [], rules: [] };
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function N(t, e) {
|
|
78
78
|
try {
|
|
79
|
-
localStorage.setItem(
|
|
79
|
+
localStorage.setItem(ht(t), JSON.stringify(e));
|
|
80
80
|
} catch {
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
t && (
|
|
83
|
+
function Jt(t) {
|
|
84
|
+
t && (pt = t);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
return
|
|
86
|
+
function Xt() {
|
|
87
|
+
return pt;
|
|
88
88
|
}
|
|
89
|
-
function
|
|
90
|
-
const
|
|
91
|
-
return
|
|
89
|
+
function Zt(t, e) {
|
|
90
|
+
const n = { config: t, state: Kt(t.service), kit: e };
|
|
91
|
+
return Bt(n), w.set(t.service, n), M(), n;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
93
|
+
function Vt(t) {
|
|
94
|
+
w.delete(t), w.size || (E = null, I.clear()), M();
|
|
95
95
|
}
|
|
96
|
-
function
|
|
97
|
-
return [...
|
|
96
|
+
function v() {
|
|
97
|
+
return [...w.values()];
|
|
98
98
|
}
|
|
99
|
-
function
|
|
100
|
-
return t ?
|
|
99
|
+
function Gt(t) {
|
|
100
|
+
return t ? w.get(t) : w.values().next().value;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
return
|
|
104
|
-
|
|
102
|
+
function bt(t) {
|
|
103
|
+
return J.add(t), () => {
|
|
104
|
+
J.delete(t);
|
|
105
105
|
};
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
|
|
107
|
+
function M() {
|
|
108
|
+
J.forEach((t) => t());
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
t.state = e,
|
|
110
|
+
function _(t, e) {
|
|
111
|
+
t.state = e, N(t.config.service, e), M();
|
|
112
112
|
}
|
|
113
|
-
function
|
|
114
|
-
const
|
|
115
|
-
|
|
113
|
+
function Yt(t, e, n) {
|
|
114
|
+
const o = t.state.faults.filter((r) => r !== e);
|
|
115
|
+
_(t, { ...t.state, faults: n ? [...o, e] : o });
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function Qt(t, e) {
|
|
118
118
|
const n = `rule-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
|
|
119
|
-
|
|
119
|
+
_(t, { ...t.state, rules: [...t.state.rules, { ...e, id: n, enabled: !0 }] });
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
|
|
121
|
+
function te(t, e, n) {
|
|
122
|
+
_(t, { ...t.state, rules: t.state.rules.map((o) => o.id === e ? { ...o, enabled: n } : o) });
|
|
123
123
|
}
|
|
124
|
-
function
|
|
125
|
-
|
|
124
|
+
function ee(t, e) {
|
|
125
|
+
_(t, { ...t.state, rules: t.state.rules.filter((n) => n.id !== e) });
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
|
|
129
|
-
t.state = { faults: [], rules: [], ...t.state.launcher ? { launcher: t.state.launcher } : {} },
|
|
130
|
-
}),
|
|
127
|
+
function ne() {
|
|
128
|
+
w.forEach((t) => {
|
|
129
|
+
t.state = { faults: [], rules: [], ...t.state.launcher ? { launcher: t.state.launcher } : {} }, N(t.config.service, t.state);
|
|
130
|
+
}), M();
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function q(t) {
|
|
133
133
|
return t.state.faults.length + t.state.rules.filter((e) => e.enabled).length;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function oe(t) {
|
|
136
136
|
return t.state.launcher ?? t.config.launcher ?? "visible";
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
e.state = { ...e.state, launcher: t },
|
|
141
|
-
}),
|
|
138
|
+
function ot(t) {
|
|
139
|
+
w.forEach((e) => {
|
|
140
|
+
e.state = { ...e.state, launcher: t }, N(e.config.service, e.state);
|
|
141
|
+
}), M();
|
|
142
142
|
}
|
|
143
|
-
const
|
|
144
|
-
let
|
|
145
|
-
const
|
|
146
|
-
let
|
|
147
|
-
const
|
|
143
|
+
const ae = 1e4, at = 200, L = ".u-error-screen, .u-notification-fail, .u-notification-warning, .u-offline-banner-offline";
|
|
144
|
+
let z = [], re = 1;
|
|
145
|
+
const X = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new Set();
|
|
146
|
+
let x = null;
|
|
147
|
+
const y = (t) => {
|
|
148
148
|
const e = (t ?? "").replace(/\s+/g, " ").trim();
|
|
149
|
-
return e.length >
|
|
150
|
-
},
|
|
151
|
-
function
|
|
152
|
-
var
|
|
153
|
-
const n =
|
|
154
|
-
if (!
|
|
155
|
-
const
|
|
156
|
-
return n.length > 1 ? `${
|
|
149
|
+
return e.length > at ? `${e.slice(0, at - 1)}…` : e;
|
|
150
|
+
}, se = (t) => t.status === "network" || typeof t.status == "number" && t.status >= 400;
|
|
151
|
+
function ie(t, e) {
|
|
152
|
+
var i;
|
|
153
|
+
const n = v().map((f) => f.config.service), o = (i = e.closest("[data-name]")) == null ? void 0 : i.getAttribute("data-name"), r = o && n.includes(o) ? o : null, a = et().find((f) => se(f) && f.endedAt !== null && t - f.endedAt <= ae && (!r || f.service === r));
|
|
154
|
+
if (!a) return;
|
|
155
|
+
const s = `${a.method} ${a.path} → ${a.status === "network" ? "сеть" : a.status}`;
|
|
156
|
+
return n.length > 1 ? `${a.service}: ${s}` : s;
|
|
157
157
|
}
|
|
158
|
-
function
|
|
159
|
-
var
|
|
158
|
+
function le(t) {
|
|
159
|
+
var o, r, a;
|
|
160
160
|
if (t.classList.contains("u-error-screen"))
|
|
161
161
|
return {
|
|
162
162
|
kind: "screen",
|
|
163
163
|
// Код — в data-error-code на корне заглушки: крупный код рисуется не у всех вариантов (forbidden, serverError).
|
|
164
164
|
// .u-error-screen-code — для разметки кита до появления атрибута.
|
|
165
|
-
code:
|
|
166
|
-
title:
|
|
167
|
-
text:
|
|
165
|
+
code: y(t.dataset.errorCode || ((o = t.querySelector(".u-error-screen-code")) == null ? void 0 : o.textContent)) || void 0,
|
|
166
|
+
title: y((r = t.querySelector(".u-error-screen-title")) == null ? void 0 : r.textContent) || y(t.getAttribute("aria-label")) || "Заглушка",
|
|
167
|
+
text: y((a = t.querySelector(".u-error-screen-description")) == null ? void 0 : a.textContent) || void 0
|
|
168
168
|
};
|
|
169
169
|
if (t.classList.contains("u-offline-banner-offline"))
|
|
170
|
-
return { kind: "offline", title:
|
|
170
|
+
return { kind: "offline", title: y(t.textContent) || "Нет связи" };
|
|
171
171
|
const e = t.classList.contains("u-notification-fail") ? "fail" : "warning", n = t.querySelector(".u-notification-content") ?? t;
|
|
172
|
-
return { kind: "notification", variant: e, title:
|
|
172
|
+
return { kind: "notification", variant: e, title: y(n.textContent) || "Уведомление" };
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
if (!t.isConnected || !t.matches(
|
|
176
|
-
const e =
|
|
174
|
+
function rt(t) {
|
|
175
|
+
if (!t.isConnected || !t.matches(L)) return;
|
|
176
|
+
const e = le(t);
|
|
177
177
|
if (!e) return;
|
|
178
178
|
const n = JSON.stringify(e);
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
const
|
|
182
|
-
|
|
179
|
+
if (X.get(t) === n) return;
|
|
180
|
+
X.set(t, n);
|
|
181
|
+
const o = Date.now();
|
|
182
|
+
z = [...z.slice(-29), { id: re++, at: o, ...e, cause: ie(o, t) }], F.forEach((r) => r());
|
|
183
183
|
}
|
|
184
|
-
function
|
|
185
|
-
t instanceof Element && (t.matches(
|
|
184
|
+
function ce(t, e) {
|
|
185
|
+
t instanceof Element && (t.matches(L) && e.push(t), t.querySelectorAll(L).forEach((n) => e.push(n)));
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
187
|
+
function ue() {
|
|
188
|
+
x || typeof MutationObserver > "u" || (x = new MutationObserver((t) => {
|
|
189
189
|
const e = [];
|
|
190
190
|
t.forEach((n) => {
|
|
191
191
|
if (n.type === "childList") {
|
|
192
|
-
n.addedNodes.forEach((
|
|
192
|
+
n.addedNodes.forEach((r) => ce(r, e));
|
|
193
193
|
return;
|
|
194
194
|
}
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
}), e.length && setTimeout(() => e.forEach(
|
|
198
|
-
}),
|
|
195
|
+
const o = n.target;
|
|
196
|
+
o.matches(L) ? e.push(o) : X.delete(o);
|
|
197
|
+
}), e.length && setTimeout(() => e.forEach(rt), 0);
|
|
198
|
+
}), x.observe(document.documentElement, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["data-error-code", "class"] }), document.querySelectorAll(L).forEach(rt));
|
|
199
199
|
}
|
|
200
|
-
function
|
|
201
|
-
|
|
200
|
+
function de() {
|
|
201
|
+
x == null || x.disconnect(), x = null;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
return [...
|
|
203
|
+
function Z() {
|
|
204
|
+
return [...z].reverse();
|
|
205
205
|
}
|
|
206
|
-
function
|
|
207
|
-
|
|
206
|
+
function gt() {
|
|
207
|
+
z = [], F.forEach((t) => t());
|
|
208
208
|
}
|
|
209
|
-
function
|
|
210
|
-
return
|
|
211
|
-
|
|
209
|
+
function fe(t) {
|
|
210
|
+
return F.add(t), () => {
|
|
211
|
+
F.delete(t);
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
const
|
|
215
|
-
function
|
|
214
|
+
const vt = 4e3, pe = /* @__PURE__ */ new Set(["GET", "HEAD"]);
|
|
215
|
+
function he(t, e) {
|
|
216
216
|
let n;
|
|
217
217
|
try {
|
|
218
218
|
n = new URL(t, window.location.href).pathname;
|
|
@@ -220,21 +220,21 @@ function ue(t, e) {
|
|
|
220
220
|
return null;
|
|
221
221
|
}
|
|
222
222
|
if (!e) return n;
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
const
|
|
226
|
-
return
|
|
223
|
+
const o = e.replace(/\/+$/, ""), r = n.indexOf(o);
|
|
224
|
+
if (r < 0) return null;
|
|
225
|
+
const a = n.slice(r + o.length);
|
|
226
|
+
return a.startsWith("/") || a === "" ? a || "/" : null;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
const n = (
|
|
230
|
-
return
|
|
228
|
+
function be(t, e) {
|
|
229
|
+
const n = (s) => s.split("/").filter(Boolean), o = n(t.trim()), r = n(e), a = (s, i) => s === o.length ? i === r.length : o[s] === "**" ? a(s + 1, i) || i < r.length && a(s, i + 1) : i === r.length ? !1 : (o[s] === "*" || o[s] === r[i]) && a(s + 1, i + 1);
|
|
230
|
+
return a(0, 0);
|
|
231
231
|
}
|
|
232
|
-
function
|
|
233
|
-
var
|
|
234
|
-
const n = (
|
|
235
|
-
return !n || n === "*" ? !0 : n === "WRITE" ? !
|
|
232
|
+
function ge(t, e) {
|
|
233
|
+
var o;
|
|
234
|
+
const n = (o = t.method) == null ? void 0 : o.trim().toUpperCase();
|
|
235
|
+
return !n || n === "*" ? !0 : n === "WRITE" ? !pe.has(e) : n === e;
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function ve(t, e) {
|
|
238
238
|
return t.html ? {
|
|
239
239
|
kind: "response",
|
|
240
240
|
delay: e,
|
|
@@ -249,180 +249,194 @@ function pe(t, e) {
|
|
|
249
249
|
body: JSON.stringify({ statusCode: t.status, message: t.message ?? `Сбой из dev-панели: ${t.status}` })
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
function
|
|
252
|
+
function me(t) {
|
|
253
253
|
const e = new Set(t.state.faults);
|
|
254
|
-
return [...(t.config.groups ?? []).flatMap((
|
|
254
|
+
return [...(t.config.groups ?? []).flatMap((o) => o.items).filter((o) => e.has(o.id)).flatMap((o) => [].concat(o.request ?? [])), ...t.state.rules.filter((o) => o.enabled)];
|
|
255
255
|
}
|
|
256
|
-
function
|
|
257
|
-
for (const e of
|
|
258
|
-
const n =
|
|
256
|
+
function mt(t) {
|
|
257
|
+
for (const e of v()) {
|
|
258
|
+
const n = he(t, e.config.apiBase);
|
|
259
259
|
if (n !== null) return { entry: e, path: n };
|
|
260
260
|
}
|
|
261
261
|
return null;
|
|
262
262
|
}
|
|
263
|
-
function
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
266
|
-
const
|
|
267
|
-
return
|
|
263
|
+
function wt({ entry: t, path: e }, n) {
|
|
264
|
+
const o = n.toUpperCase(), r = new Set(t.state.faults), a = r.has("slow") ? vt : 0;
|
|
265
|
+
if (r.has("offline") || r.has("network")) return { kind: "network", delay: a };
|
|
266
|
+
const s = me(t).find((i) => ge(i, o) && be(i.path, e));
|
|
267
|
+
return s ? ve(s, a) : a ? { kind: "pass", delay: a } : null;
|
|
268
268
|
}
|
|
269
|
-
const
|
|
270
|
-
function
|
|
271
|
-
return new Promise((n,
|
|
269
|
+
const xt = (t, e) => jt(t.entry.config.service, e, t.path), V = (t) => t.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
270
|
+
function we(t, e) {
|
|
271
|
+
return new Promise((n, o) => {
|
|
272
272
|
if (e != null && e.aborted) {
|
|
273
|
-
|
|
273
|
+
o(V(e));
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
|
-
const
|
|
276
|
+
const r = setTimeout(n, t);
|
|
277
277
|
e == null || e.addEventListener("abort", () => {
|
|
278
|
-
clearTimeout(
|
|
278
|
+
clearTimeout(r), o(V(e));
|
|
279
279
|
}, { once: !0 });
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
282
|
+
const yt = /* @__PURE__ */ new Set([204, 205, 304]), P = /* @__PURE__ */ new WeakSet();
|
|
283
|
+
function xe(t) {
|
|
284
|
+
if (typeof window > "u") return;
|
|
285
|
+
const e = t ?? window;
|
|
286
|
+
P.has(e) || (P.add(e), ye(e)), typeof XMLHttpRequest < "u" && !P.has(XMLHttpRequest.prototype) && (P.add(XMLHttpRequest.prototype), ke());
|
|
286
287
|
}
|
|
287
|
-
function
|
|
288
|
-
var
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
const
|
|
292
|
-
if (!
|
|
293
|
-
const i = (
|
|
288
|
+
function ye(t) {
|
|
289
|
+
var n;
|
|
290
|
+
const e = (n = t.fetch) == null ? void 0 : n.bind(t);
|
|
291
|
+
e && (t.fetch = async (o, r) => {
|
|
292
|
+
const a = typeof o == "object" && "url" in o ? o : null, s = mt(a ? a.url : String(o));
|
|
293
|
+
if (!s) return e(o, r);
|
|
294
|
+
const i = (r == null ? void 0 : r.method) ?? (a == null ? void 0 : a.method) ?? "GET", f = xt(s, i), u = wt(s, i), p = (r == null ? void 0 : r.signal) ?? (a == null ? void 0 : a.signal);
|
|
294
295
|
try {
|
|
295
|
-
if (
|
|
296
|
-
if ((
|
|
297
|
-
throw
|
|
298
|
-
if ((
|
|
299
|
-
return
|
|
300
|
-
status:
|
|
301
|
-
headers: { "Content-Type":
|
|
296
|
+
if (u != null && u.delay && await we(u.delay, p), p != null && p.aborted) throw V(p);
|
|
297
|
+
if ((u == null ? void 0 : u.kind) === "network")
|
|
298
|
+
throw f("network", !0), new TypeError("Failed to fetch");
|
|
299
|
+
if ((u == null ? void 0 : u.kind) === "response")
|
|
300
|
+
return f(u.status, !0), new Response(yt.has(u.status) ? null : u.body, {
|
|
301
|
+
status: u.status,
|
|
302
|
+
headers: { "Content-Type": u.contentType }
|
|
302
303
|
});
|
|
303
|
-
const
|
|
304
|
-
return
|
|
305
|
-
} catch (
|
|
306
|
-
throw
|
|
304
|
+
const m = await e(o, r);
|
|
305
|
+
return f(m.status, !1), m;
|
|
306
|
+
} catch (m) {
|
|
307
|
+
throw f(p != null && p.aborted ? "abort" : "network", !1), m;
|
|
307
308
|
}
|
|
308
309
|
});
|
|
309
310
|
}
|
|
310
|
-
const
|
|
311
|
-
function
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
n.call(this, o);
|
|
311
|
+
const st = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), $e = ["readyState", "responseURL", "status", "statusText", "responseText", "response", "getAllResponseHeaders", "getResponseHeader"];
|
|
312
|
+
function ke() {
|
|
313
|
+
const t = XMLHttpRequest.prototype, e = t.open, n = t.send, o = t.abort;
|
|
314
|
+
t.open = function(a, s, ...i) {
|
|
315
|
+
lt(this), $e.forEach((f) => {
|
|
316
|
+
Reflect.deleteProperty(this, f);
|
|
317
|
+
}), st.set(this, { method: a, url: String(s) }), e.call(this, a, s, ...i);
|
|
318
|
+
}, t.send = function(a) {
|
|
319
|
+
const s = st.get(this), i = s ? mt(s.url) : null;
|
|
320
|
+
if (!s || !i) {
|
|
321
|
+
n.call(this, a);
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
this.addEventListener("abort", () =>
|
|
324
|
+
const f = xt(i, s.method);
|
|
325
|
+
it.set(this, f);
|
|
326
|
+
const u = wt(i, s.method), p = () => {
|
|
327
|
+
this.addEventListener("abort", () => f("abort", !1), { once: !0 }), this.addEventListener("loadend", () => f(this.status || "network", !1), { once: !0 }), n.call(this, a);
|
|
328
328
|
};
|
|
329
|
-
if (!
|
|
329
|
+
if (!u) {
|
|
330
330
|
p();
|
|
331
331
|
return;
|
|
332
332
|
}
|
|
333
|
-
|
|
334
|
-
if (
|
|
333
|
+
H.set(this, setTimeout(() => {
|
|
334
|
+
if (H.delete(this), u.kind === "pass") {
|
|
335
335
|
p();
|
|
336
336
|
return;
|
|
337
337
|
}
|
|
338
|
-
|
|
339
|
-
},
|
|
338
|
+
f(u.kind === "network" ? "network" : u.status, !0), Se(this, u, s.url);
|
|
339
|
+
}, u.delay));
|
|
340
340
|
}, t.abort = function() {
|
|
341
|
-
var
|
|
342
|
-
if (!
|
|
343
|
-
|
|
341
|
+
var s;
|
|
342
|
+
if (!lt(this)) {
|
|
343
|
+
o.call(this);
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
(
|
|
347
|
-
const
|
|
348
|
-
|
|
346
|
+
(s = it.get(this)) == null || s("abort", !1);
|
|
347
|
+
const a = $t(this);
|
|
348
|
+
a("readyState", 4), a("status", 0), G(this, ["readystatechange", "abort", "loadend"]), a("readyState", 0);
|
|
349
349
|
};
|
|
350
350
|
}
|
|
351
|
-
function
|
|
352
|
-
const e =
|
|
353
|
-
return e === void 0 ? !1 : (clearTimeout(e),
|
|
351
|
+
function lt(t) {
|
|
352
|
+
const e = H.get(t);
|
|
353
|
+
return e === void 0 ? !1 : (clearTimeout(e), H.delete(t), !0);
|
|
354
354
|
}
|
|
355
|
-
const
|
|
355
|
+
const $t = (t) => (e, n) => {
|
|
356
356
|
Object.defineProperty(t, e, { configurable: !0, get: () => n });
|
|
357
|
-
},
|
|
357
|
+
}, G = (t, e) => {
|
|
358
358
|
e.forEach((n) => t.dispatchEvent(new ProgressEvent(n)));
|
|
359
359
|
};
|
|
360
|
-
function
|
|
361
|
-
const
|
|
362
|
-
if (
|
|
363
|
-
|
|
360
|
+
function Se(t, e, n) {
|
|
361
|
+
const o = $t(t);
|
|
362
|
+
if (o("readyState", 4), o("responseURL", n), e.kind === "network") {
|
|
363
|
+
o("status", 0), o("statusText", ""), G(t, ["readystatechange", "error", "loadend"]);
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
|
-
const
|
|
367
|
-
let
|
|
366
|
+
const r = yt.has(e.status) ? "" : e.body;
|
|
367
|
+
let a = r;
|
|
368
368
|
if (t.responseType === "json")
|
|
369
369
|
try {
|
|
370
|
-
|
|
370
|
+
a = e.contentType === "application/json" && r ? JSON.parse(r) : null;
|
|
371
371
|
} catch {
|
|
372
|
-
|
|
372
|
+
a = null;
|
|
373
373
|
}
|
|
374
|
-
|
|
375
|
-
const
|
|
374
|
+
o("status", e.status), o("statusText", String(e.status)), o("responseText", r), o("response", a);
|
|
375
|
+
const s = `content-type: ${e.contentType}\r
|
|
376
376
|
`;
|
|
377
|
-
Object.defineProperty(t, "getAllResponseHeaders", { configurable: !0, value: () =>
|
|
377
|
+
Object.defineProperty(t, "getAllResponseHeaders", { configurable: !0, value: () => s }), Object.defineProperty(t, "getResponseHeader", {
|
|
378
378
|
configurable: !0,
|
|
379
|
-
value: (
|
|
380
|
-
}),
|
|
379
|
+
value: (i) => i.toLowerCase() === "content-type" ? e.contentType : null
|
|
380
|
+
}), G(t, ["readystatechange", "load", "loadend"]);
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function nt(t) {
|
|
383
383
|
try {
|
|
384
384
|
t ? Reflect.deleteProperty(navigator, "onLine") : Object.defineProperty(navigator, "onLine", { configurable: !0, get: () => !1 }), window.dispatchEvent(new Event(t ? "online" : "offline"));
|
|
385
385
|
} catch {
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
|
-
function
|
|
389
|
-
const t =
|
|
390
|
-
|
|
388
|
+
function kt() {
|
|
389
|
+
const t = v().some((e) => e.state.faults.includes("offline"));
|
|
390
|
+
ne(), dt(), gt(), t && nt(!0);
|
|
391
391
|
}
|
|
392
|
-
const
|
|
392
|
+
const Ee = {
|
|
393
393
|
title: "Сеть",
|
|
394
394
|
items: [
|
|
395
395
|
{ id: "offline", label: "Офлайн браузера", hint: "Полоса «Нет связи», запросы к API падают" },
|
|
396
396
|
{ id: "network", label: "Обрыв соединения", hint: "Сеть есть, а сервер не отвечает" },
|
|
397
|
-
{ id: "slow", label: "Медленные ответы", hint: `Задержка ${
|
|
397
|
+
{ id: "slow", label: "Медленные ответы", hint: `Задержка ${vt / 1e3} с на запросы к API` }
|
|
398
398
|
]
|
|
399
|
-
},
|
|
399
|
+
}, Le = {
|
|
400
400
|
authFail: { label: "Сбой входа", hint: "После перезагрузки сервис рисует заглушку входа" },
|
|
401
401
|
crashApp: { label: "Падение приложения", hint: "Ошибка рендера над каркасом сервиса" },
|
|
402
402
|
crashPage: { label: "Падение страницы", hint: "Каждая открытая страница падает, пока флаг включён" }
|
|
403
|
-
},
|
|
403
|
+
}, Y = [["", "Любой"], ["GET", "GET"], ["write", "Запись"], ["POST", "POST"], ["PUT", "PUT"], ["PATCH", "PATCH"], ["DELETE", "DELETE"]], Te = [400, 401, 403, 404, 409, 422, 429, 500, 502, 503, 504], d = (t) => String(t ?? "").replace(/[&<>"']/g, (e) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[e]), Ae = '<svg viewBox="0 0 36 36" fill="none" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M28 0L20 16H36L28 0ZM28 5.11101L23.6984 13.7143H32.3016L28 5.11101Z" fill="#3BA68C"/><path fill-rule="evenodd" clip-rule="evenodd" d="M9 33.7143C12.1559 33.7143 14.7143 31.1559 14.7143 28C14.7143 24.8441 12.1559 22.2857 9 22.2857C5.84409 22.2857 3.28571 24.8441 3.28571 28C3.28571 31.1559 5.84409 33.7143 9 33.7143ZM9 36C13.4183 36 17 32.4183 17 28C17 23.5817 13.4183 20 9 20C4.58172 20 1 23.5817 1 28C1 32.4183 4.58172 36 9 36Z" fill="#E54B6A"/><path fill-rule="evenodd" clip-rule="evenodd" d="M33.7143 22.2857H22.2857V33.7143H33.7143V22.2857ZM20 20V36H36V20H20Z" fill="#1E4391"/><path fill-rule="evenodd" clip-rule="evenodd" d="M12.0593 4.9091L9 0L5.94073 4.9091L0 6.11146L4.05 10.3478L3.43769 16L9 13.7091L14.5623 16L13.95 10.3478L18 6.11146L12.0593 4.9091ZM14.0262 7.31822L10.7085 6.64674L9 3.90515L7.29149 6.64674L3.97378 7.31822L6.23558 9.68408L5.89362 12.8407L9 11.5613L12.1064 12.8407L11.7644 9.68408L14.0262 7.31822Z" fill="#E98446"/></svg>', Ce = `
|
|
404
404
|
:host { all: initial; }
|
|
405
405
|
* { box-sizing: border-box; }
|
|
406
406
|
.root { --p: #1e4391; --p-soft: #e8eef9; --fg: #222; --muted: #6b7280; --line: #d9dee8; --bg: #fff; --soft: #f5f7fb;
|
|
407
407
|
--danger: #d6342c; --danger-soft: #fdeceb;
|
|
408
|
+
/* Отступ кнопки снизу: StickyActionBar кита, пока стоит у нижнего края, задаёт на <html>
|
|
409
|
+
--u-dev-launcher-bottom (его высота + 12px) — кнопка и панель поднимаются над ним. */
|
|
410
|
+
--launcher-bottom: var(--u-dev-launcher-bottom, calc(12px + env(safe-area-inset-bottom, 0px)));
|
|
408
411
|
font-family: Montserrat, "Segoe UI", Arial, sans-serif; font-size: 13px; line-height: 1.4; color: var(--fg); }
|
|
409
412
|
button, input, select { font: inherit; color: inherit; }
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
.pill
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
413
|
+
/* Кнопка панели — в цветах кита: токены --u-color-* с :root сервиса проходят в shadow DOM
|
|
414
|
+
(all: initial их не сбрасывает), запасные значения — как в ките. В покое — круг с логотипом,
|
|
415
|
+
чтобы меньше закрывать нижние липкие панели сервиса; при наведении и фокусе раскрывается
|
|
416
|
+
в «логотип + Dev»; при включённых сбоях раскрыта всегда, цвет ошибки и число сбоев. */
|
|
417
|
+
.pill { --kit-p: var(--u-color-primary, #1e4391); --kit-error: var(--u-color-error, #ef302b);
|
|
418
|
+
--kit-surface: var(--u-color-surface, #fff); --kit-line: var(--u-color-border, #748ab9);
|
|
419
|
+
position: fixed; left: 12px; bottom: var(--launcher-bottom); z-index: 2147483000;
|
|
420
|
+
display: inline-flex; align-items: center; height: 36px; padding: 0; border: 1px solid var(--kit-line); border-radius: 18px;
|
|
421
|
+
background: var(--kit-surface); color: var(--kit-p); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer;
|
|
422
|
+
box-shadow: 0 2px 8px rgba(0,0,0,.15); }
|
|
423
|
+
.pill .logo { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--kit-surface); }
|
|
424
|
+
.pill .logo svg { display: block; width: 20px; height: 20px; }
|
|
425
|
+
.pill .label { max-width: 0; overflow: hidden; opacity: 0; padding: 0;
|
|
426
|
+
transition: max-width .2s ease, opacity .2s ease, padding .2s ease; }
|
|
427
|
+
.pill:hover .label, .pill:focus-visible .label, .pill.on .label { max-width: 260px; opacity: 1; padding: 0 14px 0 2px; }
|
|
428
|
+
.pill.on { background: var(--kit-error); border-color: var(--kit-error); color: #fff; }
|
|
429
|
+
.pill.on .logo { width: 30px; height: 30px; margin: 0 1px 0 2px; }
|
|
430
|
+
.pill:focus-visible { outline: 2px solid var(--kit-p); outline-offset: 2px; }
|
|
431
|
+
.panel { position: fixed; left: 12px; bottom: calc(var(--launcher-bottom) + 44px); z-index: 2147483001;
|
|
418
432
|
width: 360px; max-width: calc(100vw - 24px); max-height: min(70vh, 640px); display: flex; flex-direction: column;
|
|
419
433
|
background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(16,24,40,.25); }
|
|
420
|
-
.panel.alone { bottom:
|
|
421
|
-
.hint { position: fixed; left: 12px; bottom:
|
|
434
|
+
.panel.alone { bottom: var(--launcher-bottom); }
|
|
435
|
+
.hint { position: fixed; left: 12px; bottom: var(--launcher-bottom); z-index: 2147483000;
|
|
422
436
|
max-width: calc(100vw - 24px); padding: 8px 12px; border-radius: 10px; background: #222; color: #fff; font-size: 12px;
|
|
423
437
|
box-shadow: 0 4px 14px rgba(0,0,0,.2); }
|
|
424
438
|
.note { margin: 0 12px 8px; padding: 6px 10px; border-radius: 8px; background: var(--p-soft); color: var(--fg); font-size: 12px; overflow-wrap: anywhere; }
|
|
425
|
-
.pill ~ .hint { bottom: calc(
|
|
439
|
+
.pill ~ .hint { bottom: calc(var(--launcher-bottom) + 44px); }
|
|
426
440
|
.head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; }
|
|
427
441
|
.title { flex: 1; min-width: 0; font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
428
442
|
.title select { font-weight: 700; border: 1px solid var(--line); border-radius: 6px; padding: 2px 4px; background: var(--bg); max-width: 100%; }
|
|
@@ -476,290 +490,290 @@ dd { margin: 0; font-family: Consolas, monospace; font-size: 12px; overflow-wrap
|
|
|
476
490
|
padding-bottom: env(safe-area-inset-bottom, 0px); }
|
|
477
491
|
.panel ~ .pill { display: none; }
|
|
478
492
|
}
|
|
479
|
-
@media (prefers-reduced-motion: reduce) { .switch::after { transition: none; } }
|
|
480
|
-
`,
|
|
481
|
-
let
|
|
482
|
-
const
|
|
493
|
+
@media (prefers-reduced-motion: reduce) { .switch::after, .pill .label { transition: none; } }
|
|
494
|
+
`, Me = 6e3;
|
|
495
|
+
let Q, h = null, c = null, k = null, $ = null, T = !1, S = !1;
|
|
496
|
+
const St = { open: !1, tab: "faults", search: "", service: void 0, hint: "" }, l = { ...St };
|
|
483
497
|
function D() {
|
|
484
|
-
const t =
|
|
485
|
-
return t.find((e) => e.config.service ===
|
|
498
|
+
const t = v();
|
|
499
|
+
return t.find((e) => e.config.service === l.service) ?? t[0];
|
|
486
500
|
}
|
|
487
|
-
function
|
|
488
|
-
const e = (t.config.builtins ?? []).map((n) => ({ id: n,
|
|
501
|
+
function Et(t) {
|
|
502
|
+
const e = (t.config.builtins ?? []).map((n) => ({ id: n, ...Le[n] }));
|
|
489
503
|
return [
|
|
490
504
|
...e.length ? [{ title: "Весь сервис", items: e }] : [],
|
|
491
|
-
|
|
505
|
+
Ee,
|
|
492
506
|
...t.config.groups ?? []
|
|
493
507
|
];
|
|
494
508
|
}
|
|
495
|
-
function
|
|
509
|
+
function De(t, e) {
|
|
496
510
|
var n;
|
|
497
|
-
return ((n =
|
|
511
|
+
return ((n = Et(t).flatMap((o) => o.items).find((o) => o.id === e)) == null ? void 0 : n.label) ?? e;
|
|
498
512
|
}
|
|
499
|
-
function
|
|
513
|
+
function Lt(t) {
|
|
500
514
|
return [
|
|
501
|
-
...t.state.faults.map((e) =>
|
|
515
|
+
...t.state.faults.map((e) => De(t, e)),
|
|
502
516
|
...t.state.rules.filter((e) => e.enabled).map((e) => `${e.path} → ${e.status}`)
|
|
503
517
|
];
|
|
504
518
|
}
|
|
505
|
-
function
|
|
506
|
-
const
|
|
507
|
-
return
|
|
508
|
-
}
|
|
509
|
-
const
|
|
510
|
-
function
|
|
511
|
-
const e = new Set(t.state.faults), n =
|
|
512
|
-
const
|
|
513
|
-
return
|
|
514
|
-
<label class="row"><span class="text">${d(
|
|
515
|
-
<input class="switch" type="checkbox" role="switch" data-fault="${d(
|
|
516
|
-
aria-label="${d(
|
|
517
|
-
}).join(""),
|
|
518
|
-
var
|
|
519
|
-
return ((
|
|
519
|
+
function Pe(t, e, n, o) {
|
|
520
|
+
const r = t % 100, a = t % 10;
|
|
521
|
+
return r >= 11 && r <= 14 ? o : a === 1 ? e : a >= 2 && a <= 4 ? n : o;
|
|
522
|
+
}
|
|
523
|
+
const ct = (t) => !l.search || t.toLowerCase().includes(l.search.toLowerCase());
|
|
524
|
+
function Re(t) {
|
|
525
|
+
const e = new Set(t.state.faults), n = Et(t).map((a) => {
|
|
526
|
+
const s = a.items.filter((i) => ct(`${i.label} ${i.hint ?? ""} ${i.id}`));
|
|
527
|
+
return s.length ? `<div><div class="group-title">${d(a.title)}</div>${s.map((i) => `
|
|
528
|
+
<label class="row"><span class="text">${d(i.label)}${i.hint ? `<small>${d(i.hint)}</small>` : ""}</span>
|
|
529
|
+
<input class="switch" type="checkbox" role="switch" data-fault="${d(i.id)}" ${e.has(i.id) ? "checked" : ""}
|
|
530
|
+
aria-label="${d(i.label)}"></label>`).join("")}</div>` : "";
|
|
531
|
+
}).join(""), o = t.state.rules.filter((a) => ct(`${a.method ?? ""} ${a.path} ${a.status}`)), r = (a) => {
|
|
532
|
+
var s;
|
|
533
|
+
return ((s = Y.find(([i]) => i === (a ?? ""))) == null ? void 0 : s[1]) ?? a;
|
|
520
534
|
};
|
|
521
535
|
return `
|
|
522
|
-
<input class="search" type="search" data-search placeholder="Поиск: 503, офлайн, роли…" aria-label="Поиск по сценариям" value="${d(
|
|
523
|
-
${n || (
|
|
536
|
+
<input class="search" type="search" data-search placeholder="Поиск: 503, офлайн, роли…" aria-label="Поиск по сценариям" value="${d(l.search)}">
|
|
537
|
+
${n || (o.length ? "" : '<div class="empty">Ничего не найдено.</div>')}
|
|
524
538
|
<div><div class="group-title">Ответы сервера</div>
|
|
525
|
-
${
|
|
526
|
-
<input class="switch" type="checkbox" role="switch" data-rule="${d(
|
|
527
|
-
aria-label="${d(`${
|
|
528
|
-
<button class="remove" type="button" data-remove="${d(
|
|
539
|
+
${o.map((a) => `<div class="rule"><span class="text">${d(r(a.method))} ${d(a.path)} → ${a.status}</span>
|
|
540
|
+
<input class="switch" type="checkbox" role="switch" data-rule="${d(a.id)}" ${a.enabled ? "checked" : ""}
|
|
541
|
+
aria-label="${d(`${a.path} → ${a.status}`)}">
|
|
542
|
+
<button class="remove" type="button" data-remove="${d(a.id)}" aria-label="Удалить правило">×</button></div>`).join("")}
|
|
529
543
|
<form class="add" data-add>
|
|
530
|
-
<select name="method" aria-label="Метод">${
|
|
544
|
+
<select name="method" aria-label="Метод">${Y.map(([a, s]) => `<option value="${a}">${s}</option>`).join("")}</select>
|
|
531
545
|
<input name="path" required placeholder="/assets/*" aria-label="Путь после ${d(t.config.apiBase ?? "адреса сайта")}">
|
|
532
|
-
<select name="status" aria-label="Код ответа">${
|
|
546
|
+
<select name="status" aria-label="Код ответа">${Te.map((a) => `<option${a === 503 ? " selected" : ""}>${a}</option>`).join("")}</select>
|
|
533
547
|
<button class="btn primary" type="submit">Добавить</button>
|
|
534
548
|
</form>
|
|
535
549
|
</div>`;
|
|
536
550
|
}
|
|
537
|
-
function
|
|
551
|
+
function Oe() {
|
|
538
552
|
const t = document.documentElement.getAttribute("data-u-viewport");
|
|
539
553
|
return t || (window.matchMedia("(max-width: 576px)").matches ? "mobile" : window.matchMedia("(max-width: 900px)").matches ? "tablet" : "desktop");
|
|
540
554
|
}
|
|
541
|
-
function
|
|
542
|
-
var
|
|
543
|
-
const e = document.documentElement, n = getComputedStyle(e).getPropertyValue("--u-unit").trim(),
|
|
544
|
-
let
|
|
555
|
+
function Ie(t) {
|
|
556
|
+
var i, f, u;
|
|
557
|
+
const e = document.documentElement, n = getComputedStyle(e).getPropertyValue("--u-unit").trim(), o = t.kit ?? Xt();
|
|
558
|
+
let r = "—";
|
|
545
559
|
try {
|
|
546
|
-
const p = (
|
|
547
|
-
p && (
|
|
560
|
+
const p = (f = (i = t.config).user) == null ? void 0 : f.call(i);
|
|
561
|
+
p && (r = [p.name, (u = p.roles) != null && u.length ? p.roles.join(", ") : "без ролей"].filter(Boolean).join(" · "));
|
|
548
562
|
} catch {
|
|
549
|
-
|
|
563
|
+
r = "не удалось прочитать";
|
|
550
564
|
}
|
|
551
|
-
const
|
|
565
|
+
const a = Lt(t);
|
|
552
566
|
return `<dl>${[
|
|
553
|
-
["Ширина", `${window.innerWidth} px · ${
|
|
567
|
+
["Ширина", `${window.innerWidth} px · ${Oe()}`],
|
|
554
568
|
["Шкала", `${e.getAttribute("data-u-responsive") ?? "legacy"}${n ? ` · --u-unit ${n}` : ""}`],
|
|
555
|
-
["Кит",
|
|
569
|
+
["Кит", o ? `${o.name} ${o.version}` : "—"],
|
|
556
570
|
["Сервис", [t.config.service, t.config.version].filter(Boolean).join(" ")],
|
|
557
571
|
["API", t.config.apiBase ?? "все запросы"],
|
|
558
572
|
["Оболочка ЛК", window.__POWERED_BY_QIANKUN__ ? "да (Qiankun)" : "нет"],
|
|
559
573
|
["Ввод", e.getAttribute("data-input-mode") ?? "—"],
|
|
560
574
|
["Сеть", navigator.onLine ? "онлайн" : "офлайн"],
|
|
561
|
-
["Пользователь",
|
|
562
|
-
["Включено",
|
|
563
|
-
].map(([p,
|
|
575
|
+
["Пользователь", r],
|
|
576
|
+
["Включено", a.length ? a.join("; ") : "ничего"]
|
|
577
|
+
].map(([p, m]) => `<dt>${d(p)}</dt><dd>${d(m)}</dd>`).join("")}</dl>`;
|
|
564
578
|
}
|
|
565
579
|
function g() {
|
|
566
|
-
if (!
|
|
580
|
+
if (!c) return;
|
|
567
581
|
const t = D();
|
|
568
582
|
if (!t) {
|
|
569
|
-
|
|
583
|
+
c.innerHTML = "";
|
|
570
584
|
return;
|
|
571
585
|
}
|
|
572
|
-
const e =
|
|
573
|
-
<section class="panel${
|
|
574
|
-
<div class="head"><span class="title">${
|
|
586
|
+
const e = v().flatMap(Lt), n = e.length, o = n ? `Dev · ${n === 1 ? e[0] : `${n} ${Pe(n, "сбой", "сбоя", "сбоев")}`}` : "Dev", r = v(), a = r.every((b) => oe(b) === "hidden"), s = !a || n > 0, i = r.length > 1 ? `<select data-service aria-label="Сервис">${r.map((b) => `<option value="${d(b.config.service)}"${b === t ? " selected" : ""}>Dev · ${d(b.config.service)}</option>`).join("")}</select>` : `Dev · ${d(t.config.service)}`, f = l.open ? `
|
|
587
|
+
<section class="panel${s ? "" : " alone"}" role="region" aria-label="Панель разработки">
|
|
588
|
+
<div class="head"><span class="title">${i}</span>
|
|
575
589
|
<button class="reset" type="button" data-reset>Сбросить всё</button>
|
|
576
590
|
<button class="close" type="button" data-close aria-label="Свернуть панель">×</button></div>
|
|
577
591
|
<div class="escape">Без панели: адрес с ?dev=off · открыть и закрыть: Ctrl+Alt+D</div>
|
|
578
592
|
<div class="tabs" role="tablist">
|
|
579
|
-
<button class="tab" type="button" role="tab" data-tab="faults" aria-selected="${
|
|
580
|
-
<button class="tab" type="button" role="tab" data-tab="requests" aria-selected="${
|
|
581
|
-
<button class="tab" type="button" role="tab" data-tab="errors" aria-selected="${
|
|
582
|
-
<button class="tab" type="button" role="tab" data-tab="view" aria-selected="${
|
|
593
|
+
<button class="tab" type="button" role="tab" data-tab="faults" aria-selected="${l.tab === "faults"}">Сбои${q(t) ? ` · ${q(t)}` : ""}</button>
|
|
594
|
+
<button class="tab" type="button" role="tab" data-tab="requests" aria-selected="${l.tab === "requests"}">Запросы</button>
|
|
595
|
+
<button class="tab" type="button" role="tab" data-tab="errors" aria-selected="${l.tab === "errors"}">Ошибки${Z().length ? ` · ${Z().length}` : ""}</button>
|
|
596
|
+
<button class="tab" type="button" role="tab" data-tab="view" aria-selected="${l.tab === "view"}">Смотреть</button>
|
|
583
597
|
</div>
|
|
584
|
-
<div class="body">${
|
|
585
|
-
${
|
|
598
|
+
<div class="body">${l.tab === "faults" ? Re(t) : l.tab === "requests" ? Ct(t) : l.tab === "errors" ? je() : Ie(t)}</div>
|
|
599
|
+
${l.hint ? `<div class="note" role="status">${d(l.hint)}</div>` : ""}
|
|
586
600
|
<div class="foot">
|
|
587
601
|
${t.config.onRefetch ? '<button class="btn" type="button" data-refetch>Перезапросить данные</button>' : ""}
|
|
588
602
|
<button class="btn" type="button" data-reload>Перезагрузить</button>
|
|
589
|
-
${
|
|
590
|
-
<button class="btn" type="button" data-launcher="${
|
|
603
|
+
${r.some((b) => b.state.faults.length) ? '<button class="btn" type="button" data-share>Ссылка на сбои</button>' : ""}
|
|
604
|
+
<button class="btn" type="button" data-launcher="${a ? "visible" : "hidden"}">${a ? "Показывать кнопку" : "Скрыть кнопку"}</button>
|
|
591
605
|
</div>
|
|
592
|
-
</section>` : "",
|
|
593
|
-
|
|
594
|
-
const
|
|
606
|
+
</section>` : "", u = c.activeElement, p = Tt(u), m = (u == null ? void 0 : u.dataset.search) !== void 0 ? u.selectionStart : null, Ot = tt ?? _e();
|
|
607
|
+
tt = null;
|
|
608
|
+
const It = [
|
|
595
609
|
e.length ? `Включено: ${e.join(", ")}` : "Панель разработки (Ctrl+Alt+D)",
|
|
596
|
-
|
|
597
|
-
].filter(Boolean).join(". "),
|
|
598
|
-
<button class="pill${n ? " on" : ""}" type="button" data-toggle aria-expanded="${
|
|
599
|
-
title="${d(
|
|
600
|
-
if (
|
|
601
|
-
const b =
|
|
602
|
-
b == null || b.focus(), b instanceof HTMLInputElement &&
|
|
610
|
+
a ? "Кнопка скрыта и видна, пока включены сбои" : ""
|
|
611
|
+
].filter(Boolean).join(". "), qt = s ? `
|
|
612
|
+
<button class="pill${n ? " on" : ""}" type="button" data-toggle aria-expanded="${l.open}"
|
|
613
|
+
title="${d(It)}"><span class="logo">${Ae}</span><span class="label">${d(o)}</span></button>` : "", zt = l.hint && !l.open ? `<div class="hint" role="status">${d(l.hint)}</div>` : "";
|
|
614
|
+
if (c.innerHTML = `<style>${Ce}</style><div class="root">${f}${qt}${zt}</div>`, We(Ot), p) {
|
|
615
|
+
const b = c.querySelector(p);
|
|
616
|
+
b == null || b.focus(), b instanceof HTMLInputElement && m !== null && b.setSelectionRange(m, m);
|
|
603
617
|
}
|
|
604
618
|
}
|
|
605
|
-
const
|
|
606
|
-
function
|
|
619
|
+
const qe = ["search", "fault", "rule", "tab", "service", "reset", "close", "toggle", "ruleFrom", "clearJournal"];
|
|
620
|
+
function Tt(t) {
|
|
607
621
|
if (!t) return null;
|
|
608
622
|
const e = t.getAttribute("name");
|
|
609
623
|
if (e && t.closest("[data-add]")) return `[data-add] [name="${e}"]`;
|
|
610
|
-
const n =
|
|
624
|
+
const n = qe.find((a) => t.dataset[a] !== void 0);
|
|
611
625
|
if (!n) return null;
|
|
612
|
-
const
|
|
613
|
-
return
|
|
614
|
-
}
|
|
615
|
-
const
|
|
616
|
-
let
|
|
617
|
-
const
|
|
618
|
-
function
|
|
619
|
-
const e =
|
|
626
|
+
const o = t.dataset[n], r = `data-${n.replace(/[A-Z]/g, (a) => `-${a.toLowerCase()}`)}`;
|
|
627
|
+
return o ? `[${r}="${o.replace(/["\\]/g, "\\$&")}"]` : `[${r}]`;
|
|
628
|
+
}
|
|
629
|
+
const At = ["method", "path", "status"];
|
|
630
|
+
let tt = null;
|
|
631
|
+
const ze = { network: "сеть", abort: "отмена", pending: "…" };
|
|
632
|
+
function Ct(t) {
|
|
633
|
+
const e = et().filter((n) => n.service === t.config.service);
|
|
620
634
|
return e.length ? `<div class="requests-head"><span>Последние ${e.length}, новые сверху</span>
|
|
621
635
|
<button class="btn" type="button" data-clear-journal>Очистить</button></div>
|
|
622
636
|
<div class="requests">${e.map((n) => {
|
|
623
|
-
const
|
|
637
|
+
const o = typeof n.status == "number" ? String(n.status) : ze[n.status], r = n.status === "network" || typeof n.status == "number" && n.status >= 400, a = [n.duration === null ? "" : `${n.duration} мс`, n.faked ? "подменён панелью" : ""].filter(Boolean).join(" · ");
|
|
624
638
|
return `<div class="req"><span>${d(n.method)}</span>
|
|
625
|
-
<span class="path">${d(n.path)}${
|
|
626
|
-
<span class="status${
|
|
639
|
+
<span class="path">${d(n.path)}${a ? `<small>${d(a)}</small>` : ""}</span>
|
|
640
|
+
<span class="status${r ? " bad" : ""}">${d(o)}</span>
|
|
627
641
|
<button class="btn" type="button" data-rule-from="${n.id}" title="Ответ на этот адрес — в «Ответах сервера»">Правило</button></div>`;
|
|
628
642
|
}).join("")}</div>` : '<div class="empty">Запросов к API пока не было. Журнал помнит последние 50 и очищается при перезагрузке.</div>';
|
|
629
643
|
}
|
|
630
|
-
const
|
|
644
|
+
const Fe = {
|
|
631
645
|
screen: "Заглушка",
|
|
632
646
|
fail: "Уведомление об ошибке",
|
|
633
647
|
warning: "Предупреждение",
|
|
634
648
|
offline: "Нет связи"
|
|
635
|
-
},
|
|
636
|
-
function
|
|
637
|
-
const t =
|
|
649
|
+
}, He = (t) => Fe[t.kind === "notification" ? t.variant ?? "fail" : t.kind];
|
|
650
|
+
function je() {
|
|
651
|
+
const t = Z();
|
|
638
652
|
return t.length ? `<div class="requests-head"><span>Последние ${t.length}, новые сверху</span>
|
|
639
653
|
<button class="btn" type="button" data-clear-shown>Очистить</button></div>
|
|
640
654
|
<div>${t.map((e) => `<div class="shown">
|
|
641
|
-
<div class="shown-head"><span class="kind${e.variant === "warning" ? " warning" : ""}">${d(
|
|
655
|
+
<div class="shown-head"><span class="kind${e.variant === "warning" ? " warning" : ""}">${d(He(e))}${e.code ? ` · ${d(e.code)}` : ""}</span>
|
|
642
656
|
<time>${d(new Date(e.at).toLocaleTimeString("ru-RU"))}</time></div>
|
|
643
657
|
<div class="shown-title">${d(e.title)}</div>
|
|
644
658
|
${e.text ? `<small>${d(e.text)}</small>` : ""}
|
|
645
659
|
<div class="cause">${e.cause ? `← ${d(e.cause)}` : "<small>Неудачных запросов к API перед показом не было</small>"}</div>
|
|
646
660
|
</div>`).join("")}</div>` : '<div class="empty">Ошибок пользователю пока не показывали. Здесь появятся заглушки, уведомления об ошибке и полоса «Нет связи» — с причиной из запросов к API.</div>';
|
|
647
661
|
}
|
|
648
|
-
function
|
|
649
|
-
var
|
|
650
|
-
const e =
|
|
662
|
+
function Ue(t) {
|
|
663
|
+
var o;
|
|
664
|
+
const e = et().find((r) => String(r.id) === String(t));
|
|
651
665
|
if (!e) return;
|
|
652
|
-
|
|
666
|
+
tt = { method: Y.some(([r]) => r === e.method) ? e.method : "", path: e.path, status: "503" }, l.tab = "faults", l.search = "", g(), (o = c == null ? void 0 : c.querySelector('[data-add] [name="status"]')) == null || o.focus();
|
|
653
667
|
}
|
|
654
|
-
function
|
|
655
|
-
const t = [...new Set(
|
|
668
|
+
function Ne() {
|
|
669
|
+
const t = [...new Set(v().flatMap((i) => i.state.faults))], e = new URL(window.location.href);
|
|
656
670
|
e.searchParams.set("dev", t.join(","));
|
|
657
|
-
const n = e.href.replace(/%2C/gi, ","),
|
|
658
|
-
A(`Ссылка скопирована.${
|
|
659
|
-
},
|
|
660
|
-
A(`Ссылка: ${n}${
|
|
671
|
+
const n = e.href.replace(/%2C/gi, ","), r = v().some((i) => i.state.rules.some((f) => f.enabled)) ? " Свои правила «адрес → код» в неё не входят." : "", a = () => {
|
|
672
|
+
A(`Ссылка скопирована.${r}`), g();
|
|
673
|
+
}, s = () => {
|
|
674
|
+
A(`Ссылка: ${n}${r}`), g();
|
|
661
675
|
};
|
|
662
676
|
try {
|
|
663
|
-
navigator.clipboard.writeText(n).then(
|
|
677
|
+
navigator.clipboard.writeText(n).then(a, s);
|
|
664
678
|
} catch {
|
|
665
|
-
|
|
679
|
+
s();
|
|
666
680
|
}
|
|
667
681
|
}
|
|
668
|
-
function
|
|
669
|
-
const t =
|
|
670
|
-
return t ? Object.fromEntries(
|
|
682
|
+
function _e() {
|
|
683
|
+
const t = c == null ? void 0 : c.querySelector("[data-add]");
|
|
684
|
+
return t ? Object.fromEntries(At.map((e) => {
|
|
671
685
|
var n;
|
|
672
686
|
return [e, ((n = t.elements.namedItem(e)) == null ? void 0 : n.value) ?? ""];
|
|
673
687
|
})) : null;
|
|
674
688
|
}
|
|
675
|
-
function
|
|
676
|
-
const e =
|
|
677
|
-
!e || !t ||
|
|
678
|
-
const
|
|
679
|
-
|
|
689
|
+
function We(t) {
|
|
690
|
+
const e = c == null ? void 0 : c.querySelector("[data-add]");
|
|
691
|
+
!e || !t || At.forEach((n) => {
|
|
692
|
+
const o = e.elements.namedItem(n);
|
|
693
|
+
o && (o.value = t[n]);
|
|
680
694
|
});
|
|
681
695
|
}
|
|
682
|
-
function
|
|
696
|
+
function Be(t) {
|
|
683
697
|
if (!t) {
|
|
684
|
-
A(""),
|
|
698
|
+
A(""), ot("visible");
|
|
685
699
|
return;
|
|
686
700
|
}
|
|
687
|
-
|
|
688
|
-
const e =
|
|
689
|
-
A(`Кнопка Dev скрыта${e ? " и видна, пока включены сбои" : ""}. Панель: Ctrl+Alt+D`),
|
|
701
|
+
l.open = !1;
|
|
702
|
+
const e = v().some((n) => q(n) > 0);
|
|
703
|
+
A(`Кнопка Dev скрыта${e ? " и видна, пока включены сбои" : ""}. Панель: Ctrl+Alt+D`), ot("hidden");
|
|
690
704
|
}
|
|
691
705
|
function A(t) {
|
|
692
|
-
clearTimeout(
|
|
693
|
-
|
|
694
|
-
},
|
|
706
|
+
clearTimeout(Q), l.hint = t, t && (Q = setTimeout(() => {
|
|
707
|
+
l.hint = "", g();
|
|
708
|
+
}, Me));
|
|
695
709
|
}
|
|
696
|
-
function j(t = !
|
|
710
|
+
function j(t = !l.open) {
|
|
697
711
|
var e, n;
|
|
698
|
-
t && A(""),
|
|
712
|
+
t && A(""), l.open = t, g(), t ? (e = c == null ? void 0 : c.querySelector("[data-search], [data-tab]")) == null || e.focus() : (n = c == null ? void 0 : c.querySelector("[data-toggle]")) == null || n.focus();
|
|
699
713
|
}
|
|
700
|
-
function
|
|
701
|
-
var
|
|
714
|
+
function Ke(t) {
|
|
715
|
+
var o, r, a, s;
|
|
702
716
|
const e = t.target, n = D();
|
|
703
717
|
if (n)
|
|
704
718
|
if (e.closest("[data-toggle]")) j();
|
|
705
719
|
else if (e.closest("[data-close]")) j(!1);
|
|
706
720
|
else if (e.closest("[data-reset]"))
|
|
707
|
-
|
|
721
|
+
kt(), (r = (o = n.config).onRefetch) == null || r.call(o);
|
|
708
722
|
else if (e.closest("[data-reload]")) window.location.reload();
|
|
709
|
-
else if (e.closest("[data-rule-from]"))
|
|
723
|
+
else if (e.closest("[data-rule-from]")) Ue(Number(e.closest("[data-rule-from]").dataset.ruleFrom));
|
|
710
724
|
else if (e.closest("[data-clear-journal]"))
|
|
711
|
-
|
|
712
|
-
else if (e.closest("[data-clear-shown]"))
|
|
713
|
-
else if (e.closest("[data-share]"))
|
|
714
|
-
else if (e.closest("[data-launcher]"))
|
|
715
|
-
else if (e.closest("[data-refetch]")) (
|
|
725
|
+
dt(), g();
|
|
726
|
+
else if (e.closest("[data-clear-shown]")) gt();
|
|
727
|
+
else if (e.closest("[data-share]")) Ne();
|
|
728
|
+
else if (e.closest("[data-launcher]")) Be(e.closest("[data-launcher]").dataset.launcher === "hidden");
|
|
729
|
+
else if (e.closest("[data-refetch]")) (s = (a = n.config).onRefetch) == null || s.call(a);
|
|
716
730
|
else if (e.closest("[data-tab]")) {
|
|
717
|
-
const
|
|
718
|
-
|
|
719
|
-
} else e.closest("[data-remove]") &&
|
|
731
|
+
const i = e.closest("[data-tab]").dataset.tab;
|
|
732
|
+
l.tab = i === "view" || i === "requests" || i === "errors" ? i : "faults", g();
|
|
733
|
+
} else e.closest("[data-remove]") && ee(n, e.closest("[data-remove]").dataset.remove);
|
|
720
734
|
}
|
|
721
|
-
function
|
|
735
|
+
function Je(t) {
|
|
722
736
|
const e = t.target, n = D();
|
|
723
737
|
if (n)
|
|
724
738
|
if (e.dataset.fault) {
|
|
725
|
-
const
|
|
726
|
-
|
|
727
|
-
} else e.dataset.rule ?
|
|
739
|
+
const o = e.checked;
|
|
740
|
+
Yt(n, e.dataset.fault, o), e.dataset.fault === "offline" && nt(!o);
|
|
741
|
+
} else e.dataset.rule ? te(n, e.dataset.rule, e.checked) : e.dataset.service !== void 0 && (l.service = e.value, g());
|
|
728
742
|
}
|
|
729
|
-
function
|
|
743
|
+
function Xe(t) {
|
|
730
744
|
const e = t.target;
|
|
731
|
-
e.dataset.search !== void 0 && (
|
|
745
|
+
e.dataset.search !== void 0 && (l.search = e.value, g());
|
|
732
746
|
}
|
|
733
|
-
function
|
|
747
|
+
function Ze(t) {
|
|
734
748
|
const e = t.target;
|
|
735
749
|
if (e.dataset.add === void 0) return;
|
|
736
750
|
t.preventDefault();
|
|
737
|
-
const n = D(),
|
|
738
|
-
!n || !
|
|
739
|
-
method: String(
|
|
740
|
-
path:
|
|
741
|
-
status: Number(
|
|
742
|
-
html: Number(
|
|
751
|
+
const n = D(), o = new FormData(e), r = String(o.get("path") ?? "").trim();
|
|
752
|
+
!n || !r || (e.reset(), Qt(n, {
|
|
753
|
+
method: String(o.get("method") ?? "") || void 0,
|
|
754
|
+
path: r.startsWith("/") ? r : `/${r}`,
|
|
755
|
+
status: Number(o.get("status")) || 500,
|
|
756
|
+
html: Number(o.get("status")) === 502 || void 0
|
|
743
757
|
}));
|
|
744
758
|
}
|
|
745
|
-
function
|
|
746
|
-
t.ctrlKey && t.altKey && t.code === "KeyD" ? (t.preventDefault(), j()) : t.key === "Escape" &&
|
|
759
|
+
function Mt(t) {
|
|
760
|
+
t.ctrlKey && t.altKey && t.code === "KeyD" ? (t.preventDefault(), j()) : t.key === "Escape" && l.open && h && t.composedPath().includes(h) && (t.preventDefault(), t.stopPropagation(), j(!1));
|
|
747
761
|
}
|
|
748
|
-
function
|
|
762
|
+
function Ve() {
|
|
749
763
|
if (h || typeof document > "u") return;
|
|
750
|
-
h = document.createElement("div"), h.id = "urfu-ui-kit-dev", h.setAttribute("data-urfu-ui-kit-dev", ""),
|
|
751
|
-
(!(h != null && h.isConnected) ||
|
|
752
|
-
}),
|
|
753
|
-
const t =
|
|
754
|
-
|
|
755
|
-
const n =
|
|
756
|
-
|
|
764
|
+
h = document.createElement("div"), h.id = "urfu-ui-kit-dev", h.setAttribute("data-urfu-ui-kit-dev", ""), c = h.attachShadow({ mode: "open" }), c.addEventListener("click", Ke), c.addEventListener("change", Je), c.addEventListener("input", Xe), c.addEventListener("submit", Ze), window.addEventListener("keydown", Mt, !0), ut(), $ = new MutationObserver((o) => {
|
|
765
|
+
(!(h != null && h.isConnected) || o.some((r) => r.type === "attributes")) && ut();
|
|
766
|
+
}), $.observe(document.documentElement, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["open"] }), l.open = v().some((o) => q(o) > 0);
|
|
767
|
+
const t = bt(g), e = Ut(Dt);
|
|
768
|
+
c.addEventListener("pointerdown", Ye), window.addEventListener("pointerup", U, !0), window.addEventListener("pointercancel", U, !0);
|
|
769
|
+
const n = fe(() => {
|
|
770
|
+
l.open && g();
|
|
757
771
|
});
|
|
758
|
-
|
|
759
|
-
t(), e(), n(),
|
|
772
|
+
ue(), k = () => {
|
|
773
|
+
t(), e(), n(), de();
|
|
760
774
|
}, g();
|
|
761
775
|
}
|
|
762
|
-
function
|
|
776
|
+
function Ge() {
|
|
763
777
|
try {
|
|
764
778
|
const t = document.querySelectorAll("dialog:modal");
|
|
765
779
|
return t[t.length - 1] ?? null;
|
|
@@ -767,72 +781,94 @@ function Ke() {
|
|
|
767
781
|
return null;
|
|
768
782
|
}
|
|
769
783
|
}
|
|
770
|
-
function
|
|
784
|
+
function ut() {
|
|
771
785
|
if (!h) return;
|
|
772
|
-
const t =
|
|
786
|
+
const t = Ge() ?? document.documentElement;
|
|
773
787
|
h.parentNode !== t && t.appendChild(h);
|
|
774
788
|
}
|
|
775
|
-
function
|
|
776
|
-
var
|
|
777
|
-
if (!
|
|
778
|
-
|
|
789
|
+
function Dt() {
|
|
790
|
+
var r;
|
|
791
|
+
if (!l.open || l.tab !== "requests") {
|
|
792
|
+
S = !1;
|
|
779
793
|
return;
|
|
780
794
|
}
|
|
781
|
-
if (
|
|
782
|
-
|
|
795
|
+
if (T) {
|
|
796
|
+
S = !0;
|
|
783
797
|
return;
|
|
784
798
|
}
|
|
785
|
-
|
|
786
|
-
const t =
|
|
787
|
-
if (!
|
|
799
|
+
S = !1;
|
|
800
|
+
const t = c == null ? void 0 : c.querySelector(".body"), e = D();
|
|
801
|
+
if (!c || !t || !e) {
|
|
788
802
|
g();
|
|
789
803
|
return;
|
|
790
804
|
}
|
|
791
|
-
const n =
|
|
792
|
-
t.innerHTML =
|
|
805
|
+
const n = c.activeElement, o = n && t.contains(n) ? Tt(n) : null;
|
|
806
|
+
t.innerHTML = Ct(e), o && ((r = t.querySelector(o)) == null || r.focus());
|
|
793
807
|
}
|
|
794
|
-
function
|
|
795
|
-
|
|
808
|
+
function Ye() {
|
|
809
|
+
T = !0;
|
|
796
810
|
}
|
|
797
811
|
function U() {
|
|
798
|
-
|
|
812
|
+
T && (T = !1, S && setTimeout(Dt, 0));
|
|
799
813
|
}
|
|
800
|
-
function
|
|
801
|
-
|
|
814
|
+
function Qe() {
|
|
815
|
+
k == null || k(), k = null, $ == null || $.disconnect(), $ = null, window.removeEventListener("keydown", Mt, !0), window.removeEventListener("pointerup", U, !0), window.removeEventListener("pointercancel", U, !0), T = !1, S = !1, clearTimeout(Q), h == null || h.remove(), h = null, c = null, Object.assign(l, St);
|
|
802
816
|
}
|
|
803
|
-
|
|
817
|
+
const Pt = Symbol.for("urfu-ui-kit.dev-panel"), C = {
|
|
818
|
+
version: 1,
|
|
819
|
+
mount(t, e, n) {
|
|
820
|
+
return _t(), Jt(e), Zt(t, e).state.faults.includes("offline") && nt(!1), xe(n), Ve(), () => {
|
|
821
|
+
Vt(t.service), v().length || Qe();
|
|
822
|
+
};
|
|
823
|
+
},
|
|
824
|
+
isFault: (t, e) => {
|
|
825
|
+
var n;
|
|
826
|
+
return ((n = Gt(e)) == null ? void 0 : n.state.faults.includes(t)) ?? !1;
|
|
827
|
+
},
|
|
828
|
+
subscribe: bt,
|
|
829
|
+
reset: kt
|
|
830
|
+
}, Rt = () => typeof document > "u" ? null : document.defaultView;
|
|
831
|
+
function W() {
|
|
832
|
+
var e;
|
|
833
|
+
const t = (e = Rt()) == null ? void 0 : e[Pt];
|
|
834
|
+
return t && typeof t.version == "number" && t.version >= 1 ? t : null;
|
|
835
|
+
}
|
|
836
|
+
function tn() {
|
|
837
|
+
const t = W();
|
|
838
|
+
if (t) return t;
|
|
839
|
+
const e = Rt();
|
|
840
|
+
return e && (e[Pt] = C), C;
|
|
841
|
+
}
|
|
842
|
+
function en(t, e) {
|
|
804
843
|
return typeof window > "u" ? () => {
|
|
805
|
-
} : (
|
|
806
|
-
Kt(t.service), m().length || Xe();
|
|
807
|
-
});
|
|
844
|
+
} : tn().mount(t, e, window);
|
|
808
845
|
}
|
|
809
|
-
function
|
|
810
|
-
|
|
811
|
-
return ((n = Jt(e)) == null ? void 0 : n.state.faults.includes(t)) ?? !1;
|
|
846
|
+
function nn(t, e) {
|
|
847
|
+
return (W() ?? C).isFault(t, e);
|
|
812
848
|
}
|
|
813
|
-
function
|
|
814
|
-
return
|
|
849
|
+
function on(t) {
|
|
850
|
+
return (W() ?? C).subscribe(t);
|
|
815
851
|
}
|
|
816
|
-
function
|
|
817
|
-
|
|
852
|
+
function ln() {
|
|
853
|
+
(W() ?? C).reset();
|
|
818
854
|
}
|
|
819
|
-
const
|
|
820
|
-
function
|
|
821
|
-
return
|
|
855
|
+
const an = () => "2.1.2";
|
|
856
|
+
function cn(t) {
|
|
857
|
+
return en(t, { name: "urfu-ui-kit-react", version: an() });
|
|
822
858
|
}
|
|
823
|
-
function
|
|
824
|
-
return
|
|
859
|
+
function rn(t, e) {
|
|
860
|
+
return Ft(on, () => nn(t, e), () => !1);
|
|
825
861
|
}
|
|
826
|
-
function
|
|
827
|
-
if (
|
|
862
|
+
function un({ scope: t, service: e }) {
|
|
863
|
+
if (rn(t === "app" ? "crashApp" : "crashPage", e)) throw new Error(`Сбой из dev-панели: падение ${t === "app" ? "приложения" : "страницы"}`);
|
|
828
864
|
return null;
|
|
829
865
|
}
|
|
830
866
|
export {
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
867
|
+
un as DevCrashProbe,
|
|
868
|
+
nn as isDevFault,
|
|
869
|
+
be as matchPath,
|
|
870
|
+
cn as mountDevPanel,
|
|
871
|
+
ln as resetDevFaults,
|
|
872
|
+
on as subscribeDevFaults,
|
|
873
|
+
rn as useDevFault
|
|
838
874
|
};
|