@dxtmisha/functional 1.3.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ScrollbarWidth-D6yhyHBp.js +2184 -0
- package/dist/classes/ref/DatetimeRef.d.ts +1 -3
- package/dist/classes/ref/EventRef.d.ts +1 -2
- package/dist/classes/ref/GeoFlagRef.d.ts +1 -2
- package/dist/classes/ref/GeoIntlRef.d.ts +1 -2
- package/dist/classes/ref/GeoRef.d.ts +1 -1
- package/dist/composables/ref/useApiRef.d.ts +1 -1
- package/dist/composables/ref/useCookieRef.d.ts +1 -1
- package/dist/composables/ref/useMeta.d.ts +1 -2
- package/dist/composables/ref/useTranslateRef.d.ts +1 -1
- package/dist/flags.js +1 -1
- package/dist/functions/basic.d.ts +1 -0
- package/dist/functions/computedByLanguage.d.ts +15 -0
- package/dist/functions/ref/getBindRef.d.ts +1 -1
- package/dist/functions/ref/render.d.ts +1 -1
- package/dist/functions/render/getBind.d.ts +2 -2
- package/dist/functions/render/getClassName.d.ts +1 -1
- package/dist/functions/render/getIndexForRender.d.ts +1 -1
- package/dist/functions/toBind.d.ts +1 -1
- package/dist/functions/toBinds.d.ts +1 -1
- package/dist/library.d.ts +2 -103
- package/dist/library.js +1338 -1846
- package/dist/types/constructorTypes.d.ts +1 -1
- package/dist/types/listTypes.d.ts +1 -1
- package/package.json +6 -5
- package/dist/Icons-BNmTjp32.js +0 -1301
- package/dist/classes/Api.d.ts +0 -305
- package/dist/classes/BroadcastMessage.d.ts +0 -36
- package/dist/classes/Cache.d.ts +0 -34
- package/dist/classes/CacheItem.d.ts +0 -55
- package/dist/classes/CacheStatic.d.ts +0 -17
- package/dist/classes/Cookie.d.ts +0 -58
- package/dist/classes/CookieBlock.d.ts +0 -22
- package/dist/classes/DataStorage.d.ts +0 -82
- package/dist/classes/Datetime.d.ts +0 -482
- package/dist/classes/EventItem.d.ts +0 -160
- package/dist/classes/Geo.d.ts +0 -168
- package/dist/classes/GeoFlag.d.ts +0 -79
- package/dist/classes/GeoIntl.d.ts +0 -262
- package/dist/classes/GeoPhone.d.ts +0 -107
- package/dist/classes/Global.d.ts +0 -21
- package/dist/classes/Hash.d.ts +0 -59
- package/dist/classes/Icons.d.ts +0 -90
- package/dist/classes/Loading.d.ts +0 -49
- package/dist/classes/Meta.d.ts +0 -168
- package/dist/classes/MetaManager.d.ts +0 -103
- package/dist/classes/MetaOg.d.ts +0 -101
- package/dist/classes/MetaTwitter.d.ts +0 -101
- package/dist/classes/ScrollbarWidth.d.ts +0 -33
- package/dist/classes/Translate.d.ts +0 -116
- package/dist/classes/__tests__/Meta.test.d.ts +0 -4
- package/dist/classes/__tests__/MetaManager.test.d.ts +0 -4
- package/dist/classes/__tests__/MetaOg.test.d.ts +0 -4
- package/dist/classes/__tests__/MetaTwitter.test.d.ts +0 -4
- package/dist/functions/anyToString.d.ts +0 -7
- package/dist/functions/applyTemplate.d.ts +0 -10
- package/dist/functions/arrFill.d.ts +0 -8
- package/dist/functions/copyObject.d.ts +0 -8
- package/dist/functions/createElement.d.ts +0 -13
- package/dist/functions/domQuerySelector.d.ts +0 -7
- package/dist/functions/domQuerySelectorAll.d.ts +0 -7
- package/dist/functions/encodeAttribute.d.ts +0 -7
- package/dist/functions/eventStopPropagation.d.ts +0 -7
- package/dist/functions/executeFunction.d.ts +0 -8
- package/dist/functions/executePromise.d.ts +0 -7
- package/dist/functions/forEach.d.ts +0 -11
- package/dist/functions/frame.d.ts +0 -16
- package/dist/functions/getAttributes.d.ts +0 -8
- package/dist/functions/getClipboardData.d.ts +0 -11
- package/dist/functions/getColumn.d.ts +0 -10
- package/dist/functions/getElement.d.ts +0 -8
- package/dist/functions/getElementId.d.ts +0 -9
- package/dist/functions/getElementItem.d.ts +0 -11
- package/dist/functions/getElementOrWindow.d.ts +0 -8
- package/dist/functions/getExp.d.ts +0 -13
- package/dist/functions/getItemByPath.d.ts +0 -8
- package/dist/functions/getKey.d.ts +0 -7
- package/dist/functions/getLengthOfAllArray.d.ts +0 -8
- package/dist/functions/getMaxLengthAllArray.d.ts +0 -8
- package/dist/functions/getMinLengthAllArray.d.ts +0 -8
- package/dist/functions/getMouseClient.d.ts +0 -8
- package/dist/functions/getMouseClientX.d.ts +0 -7
- package/dist/functions/getMouseClientY.d.ts +0 -7
- package/dist/functions/getObjectByKeys.d.ts +0 -8
- package/dist/functions/getObjectNoUndefined.d.ts +0 -8
- package/dist/functions/getObjectOrNone.d.ts +0 -7
- package/dist/functions/getRandomText.d.ts +0 -11
- package/dist/functions/getRequestString.d.ts +0 -9
- package/dist/functions/getStepPercent.d.ts +0 -8
- package/dist/functions/getStepValue.d.ts +0 -8
- package/dist/functions/goScroll.d.ts +0 -10
- package/dist/functions/inArray.d.ts +0 -8
- package/dist/functions/initScrollbarOffset.d.ts +0 -6
- package/dist/functions/intersectKey.d.ts +0 -8
- package/dist/functions/isArray.d.ts +0 -7
- package/dist/functions/isDifferent.d.ts +0 -9
- package/dist/functions/isDomRuntime.d.ts +0 -10
- package/dist/functions/isFilled.d.ts +0 -9
- package/dist/functions/isFloat.d.ts +0 -7
- package/dist/functions/isFunction.d.ts +0 -8
- package/dist/functions/isInDom.d.ts +0 -8
- package/dist/functions/isIntegerBetween.d.ts +0 -8
- package/dist/functions/isNull.d.ts +0 -8
- package/dist/functions/isNumber.d.ts +0 -7
- package/dist/functions/isObject.d.ts +0 -7
- package/dist/functions/isObjectNotArray.d.ts +0 -7
- package/dist/functions/isSelected.d.ts +0 -8
- package/dist/functions/isSelectedByList.d.ts +0 -8
- package/dist/functions/isString.d.ts +0 -7
- package/dist/functions/isWindow.d.ts +0 -7
- package/dist/functions/random.d.ts +0 -8
- package/dist/functions/replaceRecursive.d.ts +0 -10
- package/dist/functions/replaceTemplate.d.ts +0 -9
- package/dist/functions/secondToTime.d.ts +0 -7
- package/dist/functions/setElementItem.d.ts +0 -10
- package/dist/functions/setValues.d.ts +0 -17
- package/dist/functions/splice.d.ts +0 -12
- package/dist/functions/strFill.d.ts +0 -8
- package/dist/functions/toArray.d.ts +0 -17
- package/dist/functions/toCamelCase.d.ts +0 -7
- package/dist/functions/toCamelCaseFirst.d.ts +0 -7
- package/dist/functions/toDate.d.ts +0 -7
- package/dist/functions/toKebabCase.d.ts +0 -15
- package/dist/functions/toNumber.d.ts +0 -8
- package/dist/functions/toNumberByMax.d.ts +0 -9
- package/dist/functions/toPercent.d.ts +0 -8
- package/dist/functions/toPercentBy100.d.ts +0 -8
- package/dist/functions/transformation.d.ts +0 -21
- package/dist/functions/uniqueArray.d.ts +0 -7
- package/dist/functions/writeClipboardData.d.ts +0 -7
- package/dist/types/basicTypes.d.ts +0 -126
- package/dist/types/geoTypes.d.ts +0 -86
- package/dist/types/metaTypes.d.ts +0 -584
package/dist/Icons-BNmTjp32.js
DELETED
|
@@ -1,1301 +0,0 @@
|
|
|
1
|
-
var W = Object.defineProperty;
|
|
2
|
-
var Q = (s, t, e) => t in s ? W(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
-
var l = (s, t, e) => Q(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import { isRef as V } from "vue";
|
|
5
|
-
import { geo as K } from "@dxtmisha/media";
|
|
6
|
-
function H(s) {
|
|
7
|
-
return s instanceof Function || typeof s == "function";
|
|
8
|
-
}
|
|
9
|
-
function I(s) {
|
|
10
|
-
return H(s) ? s() : s;
|
|
11
|
-
}
|
|
12
|
-
async function Y(s) {
|
|
13
|
-
const t = I(s);
|
|
14
|
-
return t instanceof Promise ? await t : t;
|
|
15
|
-
}
|
|
16
|
-
function $(s) {
|
|
17
|
-
return !!(s && typeof s == "object");
|
|
18
|
-
}
|
|
19
|
-
function T(s, t) {
|
|
20
|
-
if ($(s)) {
|
|
21
|
-
const e = [];
|
|
22
|
-
return s instanceof Map ? s.forEach((i, n) => e.push(t(i, n, s))) : Array.isArray(s) ? s.forEach((i, n) => e.push(t(i, n, s))) : Object.entries(s).forEach(
|
|
23
|
-
([i, n]) => e.push(t(n, i, s))
|
|
24
|
-
), e.filter((i) => i !== void 0);
|
|
25
|
-
}
|
|
26
|
-
return [];
|
|
27
|
-
}
|
|
28
|
-
function D(s) {
|
|
29
|
-
return V(s) ? s.value : s;
|
|
30
|
-
}
|
|
31
|
-
function X(s, t = "=", e = "&") {
|
|
32
|
-
return T(
|
|
33
|
-
s,
|
|
34
|
-
(i, n) => `${n}${t}${encodeURIComponent(String(i).trim())}`
|
|
35
|
-
).sort().join(e);
|
|
36
|
-
}
|
|
37
|
-
function g() {
|
|
38
|
-
return typeof window < "u" && !!window.document;
|
|
39
|
-
}
|
|
40
|
-
function C(s) {
|
|
41
|
-
return s == null;
|
|
42
|
-
}
|
|
43
|
-
function E(s, t) {
|
|
44
|
-
if (s) {
|
|
45
|
-
if (t && s === "0")
|
|
46
|
-
return !0;
|
|
47
|
-
switch (typeof s) {
|
|
48
|
-
case "bigint":
|
|
49
|
-
case "number":
|
|
50
|
-
return s !== 0;
|
|
51
|
-
case "boolean":
|
|
52
|
-
return s;
|
|
53
|
-
case "function":
|
|
54
|
-
case "symbol":
|
|
55
|
-
return !0;
|
|
56
|
-
case "object":
|
|
57
|
-
return Array.isArray(s) ? s.length > 0 : Object.values(s).some((e) => !C(e));
|
|
58
|
-
case "string":
|
|
59
|
-
return !["", "undefined", "null", "0", "false", "[]"].includes(s);
|
|
60
|
-
case "undefined":
|
|
61
|
-
return !1;
|
|
62
|
-
default:
|
|
63
|
-
return !!s;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return !1;
|
|
67
|
-
}
|
|
68
|
-
function p(s) {
|
|
69
|
-
return $(s) && !Array.isArray(s);
|
|
70
|
-
}
|
|
71
|
-
function S(s) {
|
|
72
|
-
return typeof s == "string";
|
|
73
|
-
}
|
|
74
|
-
function _(s, t) {
|
|
75
|
-
return Math.floor(Math.random() * (t - s + 1) + s);
|
|
76
|
-
}
|
|
77
|
-
function O(s) {
|
|
78
|
-
return Array.isArray(s) ? s : [s];
|
|
79
|
-
}
|
|
80
|
-
function J(s) {
|
|
81
|
-
return g() && s === window;
|
|
82
|
-
}
|
|
83
|
-
function y(s) {
|
|
84
|
-
if (g())
|
|
85
|
-
return J(s) ? document.body : S(s) ? document.querySelector(s) ?? void 0 : s;
|
|
86
|
-
}
|
|
87
|
-
function z(s) {
|
|
88
|
-
return J(s) ? s : y(s);
|
|
89
|
-
}
|
|
90
|
-
function tt(s) {
|
|
91
|
-
return !!y(s)?.closest("html");
|
|
92
|
-
}
|
|
93
|
-
class B {
|
|
94
|
-
/**
|
|
95
|
-
* Classes Constructor
|
|
96
|
-
* @param elementSelector element/ элемент
|
|
97
|
-
* @param type type/ тип
|
|
98
|
-
* @param listener the object that receives a notification (an object that implements the
|
|
99
|
-
* Event interface) when an event of the specified type occurs/ объект, который принимает
|
|
100
|
-
* уведомление, когда событие указанного типа произошло
|
|
101
|
-
* @param options object that specifies characteristics/ объект options
|
|
102
|
-
* @param detail an event-dependent value associated with the event/ зависимое от события
|
|
103
|
-
* значение, связанное с событием
|
|
104
|
-
*/
|
|
105
|
-
constructor(t, e = ["click"], i, n, r) {
|
|
106
|
-
this.listener = i, this.options = n, this.detail = r, this.element = z(t), this.elementControl = y(t), this.type = O(e);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Element.
|
|
110
|
-
*
|
|
111
|
-
* Элемент.
|
|
112
|
-
*/
|
|
113
|
-
element;
|
|
114
|
-
/**
|
|
115
|
-
* Element for checking. If the element is missing in the DOM, the event is turned off.
|
|
116
|
-
*
|
|
117
|
-
* Элемент для проверки. Если элемент отсутствует в DOM, событие выключается.
|
|
118
|
-
*/
|
|
119
|
-
elementControl;
|
|
120
|
-
elementControlEdit;
|
|
121
|
-
/**
|
|
122
|
-
* A case-sensitive string representing the event type to listen for.
|
|
123
|
-
*
|
|
124
|
-
* Чувствительная к регистру строка, представляющая тип обрабатываемого события.
|
|
125
|
-
*/
|
|
126
|
-
type;
|
|
127
|
-
/**
|
|
128
|
-
* The object that receives a notification (an object that implements the Event interface)
|
|
129
|
-
* when an event of the specified type occurs. This must be null, an object with a
|
|
130
|
-
* handleEvent() method, or a JavaScript function.
|
|
131
|
-
*
|
|
132
|
-
* Объект, который принимает уведомление, когда событие указанного типа произошло.
|
|
133
|
-
* Это должен быть объект, реализующий интерфейс EventListener или просто функция JavaScript.
|
|
134
|
-
*/
|
|
135
|
-
listenerRecent = (t) => {
|
|
136
|
-
tt(this.elementControl) ? (this.listener?.call(this.element, t, this.detail), $(this.options) && this.options?.once && this.stop()) : this.stop();
|
|
137
|
-
};
|
|
138
|
-
/**
|
|
139
|
-
* Event states.
|
|
140
|
-
*
|
|
141
|
-
* Состояния события.
|
|
142
|
-
*/
|
|
143
|
-
activity = !1;
|
|
144
|
-
activityItems = [];
|
|
145
|
-
/**
|
|
146
|
-
* Checks whether event listening is currently enabled.
|
|
147
|
-
*
|
|
148
|
-
* Проверяет, включено ли сейчас прослушивание события.
|
|
149
|
-
*/
|
|
150
|
-
isActive() {
|
|
151
|
-
return this.activity;
|
|
152
|
-
}
|
|
153
|
-
getElement() {
|
|
154
|
-
return this.element;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Change of an element for tracking.
|
|
158
|
-
*
|
|
159
|
-
* Изменение элемента для прослеживания.
|
|
160
|
-
* @param elementSelector element/ элемент
|
|
161
|
-
*/
|
|
162
|
-
setElement(t) {
|
|
163
|
-
const e = z(t);
|
|
164
|
-
return this.elementControlEdit || (this.elementControl = y(t)), this.element = e, this.reset(), this;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Modifies the object that receives the notification.
|
|
168
|
-
*
|
|
169
|
-
* Модифицирует объект, который получает уведомление.
|
|
170
|
-
* @param elementSelector element/ элемент
|
|
171
|
-
*/
|
|
172
|
-
setElementControl(t) {
|
|
173
|
-
return this.elementControl = y(t), this.elementControlEdit = !C(this.elementControl), this.elementControlEdit || (this.elementControl = y(this.element)), this;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Changes the type of the handled event.
|
|
177
|
-
*
|
|
178
|
-
* Изменяет тип обрабатываемого события.
|
|
179
|
-
* @param type type/ тип
|
|
180
|
-
*/
|
|
181
|
-
setType(t) {
|
|
182
|
-
return this.type = O(t), this.reset(), this;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Modifies the object that receives the notification.
|
|
186
|
-
*
|
|
187
|
-
* Модифицирует объект, который получает уведомление.
|
|
188
|
-
* @param listener
|
|
189
|
-
*/
|
|
190
|
-
setListener(t) {
|
|
191
|
-
return this.listener = t, this;
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Modifying the options object that defines the characteristics of an object.
|
|
195
|
-
*
|
|
196
|
-
* Изменение объекта options, который определяет характеристики объекта.
|
|
197
|
-
* @param options
|
|
198
|
-
*/
|
|
199
|
-
setOptions(t) {
|
|
200
|
-
return this.options = t, this.reset(), this;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Modifying a dependent value for the dispatch method.
|
|
204
|
-
*
|
|
205
|
-
* Изменение зависимого значения для метода dispatch.
|
|
206
|
-
* @param detail
|
|
207
|
-
*/
|
|
208
|
-
setDetail(t) {
|
|
209
|
-
return this.detail = t, this;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* The method of the EventTarget sends an Event to the object, (synchronously) invoking
|
|
213
|
-
* the affected EventListeners in the appropriate order.
|
|
214
|
-
*
|
|
215
|
-
* Отправляет событие в общую систему событий. Это событие подчиняется тем же правилам
|
|
216
|
-
* поведения "Захвата" и "Всплывания" как и непосредственно инициированные события.
|
|
217
|
-
* @param detail an event-dependent value associated with the event/ зависимое от события
|
|
218
|
-
* значение, связанное с событием
|
|
219
|
-
*/
|
|
220
|
-
dispatch(t = this.detail) {
|
|
221
|
-
return this.type.forEach(
|
|
222
|
-
(e) => this.element?.dispatchEvent(new CustomEvent(e, { detail: t }))
|
|
223
|
-
), this;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Starting event listening.
|
|
227
|
-
*
|
|
228
|
-
* Запуск прослушивания события.
|
|
229
|
-
*/
|
|
230
|
-
start() {
|
|
231
|
-
return this.activity || (this.activity = !0, this.activityItems = [], this.type.forEach((t) => {
|
|
232
|
-
this.element && !(t === "resize" && this.makeResize()) && !(t === "scroll-sync" && this.makeScroll()) && (this.element.addEventListener(t, this.listenerRecent, this.options), this.activityItems.push({
|
|
233
|
-
element: this.element,
|
|
234
|
-
type: t
|
|
235
|
-
}));
|
|
236
|
-
})), this;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Stopping event listening.
|
|
240
|
-
*
|
|
241
|
-
* Остановка прослушивания события.
|
|
242
|
-
*/
|
|
243
|
-
stop() {
|
|
244
|
-
return this.activity && (this.activity = !1, this.activityItems.forEach(({
|
|
245
|
-
element: t,
|
|
246
|
-
type: e,
|
|
247
|
-
listener: i,
|
|
248
|
-
observer: n
|
|
249
|
-
}) => {
|
|
250
|
-
n ? n.disconnect() : i ? t?.removeEventListener(e, i) : t?.removeEventListener(e, this.listenerRecent);
|
|
251
|
-
})), this;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Toggling event handler state.
|
|
255
|
-
*
|
|
256
|
-
* Переключение состояния работы события.
|
|
257
|
-
* @param activity event activation/ активация события
|
|
258
|
-
*/
|
|
259
|
-
toggle(t) {
|
|
260
|
-
return t ? this.start() : this.stop();
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Overloads the listening events.
|
|
264
|
-
*
|
|
265
|
-
* Перегружает события прослушивания.
|
|
266
|
-
*/
|
|
267
|
-
reset() {
|
|
268
|
-
return this.activity && (this.stop(), this.start()), this;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Checks if the ResizeObserver object exists.
|
|
272
|
-
*
|
|
273
|
-
* Проверяет, существует ли объект ResizeObserver.
|
|
274
|
-
*/
|
|
275
|
-
isObserver() {
|
|
276
|
-
return "ResizeObserver" in window;
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* The implementation of the resize event for an element.
|
|
280
|
-
*
|
|
281
|
-
* Реализация события изменения размера для элемента.
|
|
282
|
-
*/
|
|
283
|
-
makeResize() {
|
|
284
|
-
if (this.element && this.element instanceof HTMLElement && this.element !== document.body && this.isObserver()) {
|
|
285
|
-
const t = new ResizeObserver(
|
|
286
|
-
(e) => this.listenerRecent(e?.[0])
|
|
287
|
-
);
|
|
288
|
-
return t.observe(this.element), this.activityItems.push({
|
|
289
|
-
element: this.element,
|
|
290
|
-
type: "resize",
|
|
291
|
-
observer: t
|
|
292
|
-
}), !0;
|
|
293
|
-
}
|
|
294
|
-
return !1;
|
|
295
|
-
}
|
|
296
|
-
/**
|
|
297
|
-
* Implementation of the scroll event for an element.
|
|
298
|
-
*
|
|
299
|
-
* Реализация события изменения положения скролла для элемента.
|
|
300
|
-
*/
|
|
301
|
-
makeScroll() {
|
|
302
|
-
if (this.element) {
|
|
303
|
-
let t = !1;
|
|
304
|
-
const e = (i) => {
|
|
305
|
-
t || (t = !0, requestAnimationFrame(() => {
|
|
306
|
-
this.listenerRecent(i), t = !1;
|
|
307
|
-
}));
|
|
308
|
-
};
|
|
309
|
-
return this.element.addEventListener("scroll", e, this.options), this.element.addEventListener("resize", e, this.options), this.activityItems.push(
|
|
310
|
-
{
|
|
311
|
-
element: this.element,
|
|
312
|
-
type: "scroll",
|
|
313
|
-
listener: e
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
element: this.element,
|
|
317
|
-
type: "resize",
|
|
318
|
-
listener: e
|
|
319
|
-
}
|
|
320
|
-
), !0;
|
|
321
|
-
}
|
|
322
|
-
return !1;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
const F = "ui-loading", v = class v {
|
|
326
|
-
/**
|
|
327
|
-
* Check if the loader is active now.
|
|
328
|
-
*
|
|
329
|
-
* Проверить, активен ли сейчас загрузчик.
|
|
330
|
-
*/
|
|
331
|
-
static is() {
|
|
332
|
-
return this.value > 0;
|
|
333
|
-
}
|
|
334
|
-
/**
|
|
335
|
-
* Shows the loader.
|
|
336
|
-
*
|
|
337
|
-
* Показывает загрузчик.
|
|
338
|
-
*/
|
|
339
|
-
static show() {
|
|
340
|
-
this.value++, this.dispatch();
|
|
341
|
-
}
|
|
342
|
-
/**
|
|
343
|
-
* Hides the loader.
|
|
344
|
-
*
|
|
345
|
-
* Скрывает загрузчик.
|
|
346
|
-
*/
|
|
347
|
-
static hide() {
|
|
348
|
-
this.is() && (this.value--, this.dispatch());
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Event registration to listen for data changes.
|
|
352
|
-
*
|
|
353
|
-
* Регистрация события для прослушивания изменений данных.
|
|
354
|
-
* @param listener the object that receives a notification (an object that implements the
|
|
355
|
-
* Event interface) when an event of the specified type occurs/ объект, который принимает
|
|
356
|
-
* уведомление, когда событие указанного типа произошло
|
|
357
|
-
* @param element element/ элемент
|
|
358
|
-
*/
|
|
359
|
-
static registrationEvent(t, e) {
|
|
360
|
-
g() && new B(window, F, t).setElementControl(e).start();
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Calls the event listener.
|
|
364
|
-
*
|
|
365
|
-
* Вызывает слушателя событий.
|
|
366
|
-
*/
|
|
367
|
-
static dispatch() {
|
|
368
|
-
this.event?.dispatch({ loading: this.is() });
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
l(v, "value", 0), l(v, "event"), g() && (v.event = new B(window, F));
|
|
372
|
-
let d = v;
|
|
373
|
-
function et(s) {
|
|
374
|
-
return JSON.parse(JSON.stringify(s));
|
|
375
|
-
}
|
|
376
|
-
function P(s) {
|
|
377
|
-
switch (typeof s) {
|
|
378
|
-
case "number":
|
|
379
|
-
return !0;
|
|
380
|
-
case "string":
|
|
381
|
-
return !!s.match(/^[0-9]+$/);
|
|
382
|
-
default:
|
|
383
|
-
return !1;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
function j(s) {
|
|
387
|
-
if (typeof s == "number")
|
|
388
|
-
return s;
|
|
389
|
-
if (!s)
|
|
390
|
-
return 0;
|
|
391
|
-
let t = s.replace(/[^\d., ]+/ig, "");
|
|
392
|
-
return t.match(/( [0-9]{3}[ ,.]|[0-9] [0-9])/ig) ? t = t.replace(/ /ig, "").replace(/,/ig, ".") : t.match(/,[0-9]{3}[,.]/ig) ? t = t.replace(/,/ig, "") : t.match(/[.][0-9]{3}[,.]/ig) ? t = t.replace(/[.]/ig, "").replace(/,/ig, ".") : t = t.replace(/,/ig, "."), parseFloat(t);
|
|
393
|
-
}
|
|
394
|
-
function st(s, t) {
|
|
395
|
-
return C(s) ? !1 : Array.isArray(t) ? t.includes(s) : P(s) && P(t) ? j(s) === j(t) : s === t;
|
|
396
|
-
}
|
|
397
|
-
const R = {};
|
|
398
|
-
let k = "ui-storage";
|
|
399
|
-
class it {
|
|
400
|
-
/**
|
|
401
|
-
* Constructor
|
|
402
|
-
* @param name value name/ название значения
|
|
403
|
-
* @param isSession should we use a session/ использовать ли сессию
|
|
404
|
-
*/
|
|
405
|
-
constructor(t, e = !1) {
|
|
406
|
-
this.name = t, this.isSession = e;
|
|
407
|
-
const i = `${e ? "session" : "storage"}#${t}`;
|
|
408
|
-
if (i in R)
|
|
409
|
-
return R[i];
|
|
410
|
-
this.make(), R[i] = this;
|
|
411
|
-
}
|
|
412
|
-
/**
|
|
413
|
-
* Changing the prefix in key names. Should be called at the beginning of the code.
|
|
414
|
-
*
|
|
415
|
-
* Изменение префикса в названиях ключей. Вызывать нужно в начале кода.
|
|
416
|
-
* @param newPrefix new prefix/ новый префикс
|
|
417
|
-
*/
|
|
418
|
-
static setPrefix(t) {
|
|
419
|
-
k = t;
|
|
420
|
-
}
|
|
421
|
-
value;
|
|
422
|
-
age;
|
|
423
|
-
/**
|
|
424
|
-
* Getting data from local storage.
|
|
425
|
-
*
|
|
426
|
-
* Получение данных из локального хранилища.
|
|
427
|
-
* @param defaultValue default value/ значение по умолчанию
|
|
428
|
-
* @param cache cache time/ время кэширования
|
|
429
|
-
*/
|
|
430
|
-
get(t, e) {
|
|
431
|
-
if (this.value !== null && this.value !== void 0 && this.isCache(e))
|
|
432
|
-
return this.value;
|
|
433
|
-
if (t !== void 0)
|
|
434
|
-
return this.set(t);
|
|
435
|
-
}
|
|
436
|
-
/**
|
|
437
|
-
* Changing data in storage.
|
|
438
|
-
*
|
|
439
|
-
* Изменение данных в хранилище.
|
|
440
|
-
* @param value new values/ новые значения
|
|
441
|
-
*/
|
|
442
|
-
set(t) {
|
|
443
|
-
return this.value = I(t), this.age = (/* @__PURE__ */ new Date()).getTime(), this.value === void 0 ? this.remove() : this.getMethod()?.setItem(this.getIndex(), JSON.stringify({
|
|
444
|
-
value: this.value,
|
|
445
|
-
age: this.age
|
|
446
|
-
})), this.value;
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Removing data from storage.
|
|
450
|
-
*
|
|
451
|
-
* Удаление данных из хранилища.
|
|
452
|
-
*/
|
|
453
|
-
remove() {
|
|
454
|
-
return this.getMethod()?.removeItem(this.getIndex()), this;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Clearing all data from storage.
|
|
458
|
-
*
|
|
459
|
-
* Очистка всех данных из хранилища.
|
|
460
|
-
*/
|
|
461
|
-
update() {
|
|
462
|
-
return this.make(), this;
|
|
463
|
-
}
|
|
464
|
-
/**
|
|
465
|
-
* Checks for storage time limit.
|
|
466
|
-
*
|
|
467
|
-
* Проверяет на лимит времени хранения.
|
|
468
|
-
* @param cache cache time/ время кэширования
|
|
469
|
-
*/
|
|
470
|
-
isCache(t) {
|
|
471
|
-
return C(t) || this.age && this.age + t * 1e3 >= (/* @__PURE__ */ new Date()).getTime();
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Returns an object for working with storage.
|
|
475
|
-
*
|
|
476
|
-
* Возвращает объект для работы с хранилищем.
|
|
477
|
-
*/
|
|
478
|
-
getMethod() {
|
|
479
|
-
if (g())
|
|
480
|
-
return this.isSession ? window?.sessionStorage : window?.localStorage;
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Getting the storage key name.
|
|
484
|
-
*
|
|
485
|
-
* Получение имени ключа в хранилище.
|
|
486
|
-
*/
|
|
487
|
-
getIndex() {
|
|
488
|
-
return `${k}__${this.name}`;
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Getting data from storage.
|
|
492
|
-
*
|
|
493
|
-
* Получение данных из хранилища.
|
|
494
|
-
*/
|
|
495
|
-
getValue() {
|
|
496
|
-
const t = this.getMethod()?.getItem(this.getIndex());
|
|
497
|
-
if (t)
|
|
498
|
-
try {
|
|
499
|
-
return JSON.parse(t);
|
|
500
|
-
} catch (e) {
|
|
501
|
-
console.error("DataStorage", e);
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
/**
|
|
505
|
-
* Filling in the data from storage.
|
|
506
|
-
*
|
|
507
|
-
* Заполнение данными из хранилища.
|
|
508
|
-
*/
|
|
509
|
-
make() {
|
|
510
|
-
const t = this.getValue();
|
|
511
|
-
return t ? (this.value = t.value, this.age = t.age) : (this.value = void 0, this.age = void 0), this;
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
const nt = "geo-code", o = class o {
|
|
515
|
-
/**
|
|
516
|
-
* Information about the current country.
|
|
517
|
-
*
|
|
518
|
-
* Информация об текущей стране.
|
|
519
|
-
*/
|
|
520
|
-
static get() {
|
|
521
|
-
return this.item;
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Current country.
|
|
525
|
-
*
|
|
526
|
-
* Текущая страна.
|
|
527
|
-
*/
|
|
528
|
-
static getCountry() {
|
|
529
|
-
return this.item.country;
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Current language.
|
|
533
|
-
*
|
|
534
|
-
* Текущий язык.
|
|
535
|
-
*/
|
|
536
|
-
static getLanguage() {
|
|
537
|
-
return this.language;
|
|
538
|
-
}
|
|
539
|
-
/**
|
|
540
|
-
* Full format according to the standard.
|
|
541
|
-
*
|
|
542
|
-
* Полный формат согласно стандарту.
|
|
543
|
-
*/
|
|
544
|
-
static getStandard() {
|
|
545
|
-
return this.item.standard;
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Returns the first day of the week.
|
|
549
|
-
*
|
|
550
|
-
* Возвращает первый день недели.
|
|
551
|
-
*/
|
|
552
|
-
static getFirstDay() {
|
|
553
|
-
return this.item.firstDay;
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Full format.
|
|
557
|
-
*
|
|
558
|
-
* Полный формат.
|
|
559
|
-
*/
|
|
560
|
-
static getLocation() {
|
|
561
|
-
return this.location;
|
|
562
|
-
}
|
|
563
|
-
/**
|
|
564
|
-
* Obtaining processed data.
|
|
565
|
-
*
|
|
566
|
-
* Получение обработанных данных.
|
|
567
|
-
*/
|
|
568
|
-
static getItem() {
|
|
569
|
-
return {
|
|
570
|
-
...this.item,
|
|
571
|
-
language: this.language
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* Returns the full list of countries.
|
|
576
|
-
*
|
|
577
|
-
* Возвращает полный список стран.
|
|
578
|
-
*/
|
|
579
|
-
static getList() {
|
|
580
|
-
return K;
|
|
581
|
-
}
|
|
582
|
-
/**
|
|
583
|
-
* Returns the data about the country by its full code.
|
|
584
|
-
*
|
|
585
|
-
* Возвращает данные о стране по ее полному коду.
|
|
586
|
-
* @param code country code, full form language-country or one of them/
|
|
587
|
-
* код страны, полный вид язык-страна или один из них
|
|
588
|
-
*/
|
|
589
|
-
static getByCode(t) {
|
|
590
|
-
let e;
|
|
591
|
-
return t && (t.match(/([A-Z]{2}-[a-z]{2})|([a-z]{2}-[A-Z]{2})/) && (e = this.getByCodeFull(t)), !e && t.match(/[A-Z]{2}/) && (e = this.getByCountry(this.toCountry(t))), !e && t.match(/[a-z]{2}/) && (e = this.getByLanguage(this.toLanguage(t)))), this.toFull(et(e ?? this.getList()[0]));
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* Returns the full data by language and country.
|
|
595
|
-
*
|
|
596
|
-
* Возвращает полные данные по языку и стране.
|
|
597
|
-
* @param code string in the form of language-country/ строка в виде язык-страна
|
|
598
|
-
*/
|
|
599
|
-
static getByCodeFull(t) {
|
|
600
|
-
return this.getList().find(
|
|
601
|
-
(e) => st(t, [
|
|
602
|
-
`${e.language}-${e.country}`,
|
|
603
|
-
`${e.country}-${e.language}`
|
|
604
|
-
])
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
/**
|
|
608
|
-
* Returns the full data by country.
|
|
609
|
-
*
|
|
610
|
-
* Возвращает полные данные по стране.
|
|
611
|
-
* @param country country/ страна
|
|
612
|
-
*/
|
|
613
|
-
static getByCountry(t) {
|
|
614
|
-
return this.getList().find((e) => e.country === t || e?.countryAlternative?.find((i) => i === t));
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Returns the full data by language.
|
|
618
|
-
*
|
|
619
|
-
* Возвращает полные данные по языку.
|
|
620
|
-
* @param language language/ язык
|
|
621
|
-
*/
|
|
622
|
-
static getByLanguage(t) {
|
|
623
|
-
return this.getList().find((e) => e.language === t || e?.languageAlternative?.find((i) => i === t));
|
|
624
|
-
}
|
|
625
|
-
/**
|
|
626
|
-
* Retrieving the default timezone.
|
|
627
|
-
*
|
|
628
|
-
* Получение временной зоны по умолчанию
|
|
629
|
-
*/
|
|
630
|
-
static getTimezone() {
|
|
631
|
-
return this.timezone;
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* Retrieving the default timezone (formatted view).
|
|
635
|
-
*
|
|
636
|
-
* Получение временной зоны по умолчанию (отформатированный вид).
|
|
637
|
-
*/
|
|
638
|
-
static getTimezoneFormat() {
|
|
639
|
-
const t = Math.abs(Math.trunc(this.timezone / 60)).toString().padStart(2, "0"), e = Math.abs(this.timezone % 60).toString().padStart(2, "0");
|
|
640
|
-
return this.timezone >= 0 ? `-${t}:${e}` : `+${t}:${e}`;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Determines the current country by its full name.
|
|
644
|
-
*
|
|
645
|
-
* Определяет текущую страну по ее полному названию.
|
|
646
|
-
* @param code country code, full form language-country or one of them/
|
|
647
|
-
* код страны, полный вид язык-страна или один из них
|
|
648
|
-
*/
|
|
649
|
-
static find(t) {
|
|
650
|
-
return this.getByCode(t);
|
|
651
|
-
}
|
|
652
|
-
/**
|
|
653
|
-
* Returns a complete string with the country code and language.
|
|
654
|
-
*
|
|
655
|
-
* Возвращает полную строку с кодом страны и языка.
|
|
656
|
-
* @param item object with data about the current country/
|
|
657
|
-
* объект с данными об текущей стране
|
|
658
|
-
*/
|
|
659
|
-
static toStandard(t) {
|
|
660
|
-
return `${t.language}-${t.country}`;
|
|
661
|
-
}
|
|
662
|
-
/**
|
|
663
|
-
* Changes the data by the full code.
|
|
664
|
-
*
|
|
665
|
-
* Изменяет данные по полному коду.
|
|
666
|
-
* @param code country code, full form language-country or one of them/
|
|
667
|
-
* код страны, полный вид язык-страна или один из них
|
|
668
|
-
* @param save save the result/ сохранить результат
|
|
669
|
-
*/
|
|
670
|
-
static set(t, e) {
|
|
671
|
-
this.location = t, this.item = this.getByCode(this.location), this.language = this.findLanguage(this.location), e && this.storage.set(this.location);
|
|
672
|
-
}
|
|
673
|
-
/**
|
|
674
|
-
* Changing the default timezone for transmitted dates.
|
|
675
|
-
*
|
|
676
|
-
* Изменение временной зоны по умолчанию для отправляемых дат
|
|
677
|
-
* @param timezone new time zone/ новая временная зона
|
|
678
|
-
*/
|
|
679
|
-
static setTimezone(t) {
|
|
680
|
-
this.timezone = t;
|
|
681
|
-
}
|
|
682
|
-
/**
|
|
683
|
-
* Determines the current location.
|
|
684
|
-
*
|
|
685
|
-
* Определяет текущую локацию.
|
|
686
|
-
*/
|
|
687
|
-
static findLocation() {
|
|
688
|
-
return g() && (this.storage.get() || document.querySelector("html")?.lang || navigator.language || navigator.languages[0] || "en-GB") || "en-GB";
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Determines the current language.
|
|
692
|
-
*
|
|
693
|
-
* Определяет текущий язык.
|
|
694
|
-
* @param code country code, full form language-country or one of them/
|
|
695
|
-
* код страны, полный вид язык-страна или один из них
|
|
696
|
-
*/
|
|
697
|
-
static findLanguage(t) {
|
|
698
|
-
return t && t.match(/[a-z]{2}/) ? this.toLanguage(t) : this.item.language;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Returns the country code by its full language-country.
|
|
702
|
-
*
|
|
703
|
-
* Возвращает код страны по ее полному язык-страна.
|
|
704
|
-
* @param code country code/ код страна
|
|
705
|
-
*/
|
|
706
|
-
static toCountry(t) {
|
|
707
|
-
return t.replace(/[^A-Z]+/g, "");
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Returns the language code by its full language-country.<br>
|
|
711
|
-
* Возвращает код языка по его полному язык-страна.
|
|
712
|
-
* @param code country code/ код страна
|
|
713
|
-
*/
|
|
714
|
-
static toLanguage(t) {
|
|
715
|
-
return t.replace(/[^a-z]+/g, "");
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Adding missing data.<br>
|
|
719
|
-
* Добавление недостающих данных.
|
|
720
|
-
* @param item object with data about the current country/
|
|
721
|
-
* объект с данными об текущей стране
|
|
722
|
-
*/
|
|
723
|
-
static toFull(t) {
|
|
724
|
-
return {
|
|
725
|
-
...t,
|
|
726
|
-
standard: this.toStandard(t),
|
|
727
|
-
firstDay: t?.firstDay || "Mo"
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
};
|
|
731
|
-
l(o, "storage", new it(nt)), l(o, "location"), l(o, "item"), l(o, "language"), l(o, "timezone", (/* @__PURE__ */ new Date()).getTimezoneOffset()), o.location = o.findLocation(), o.language = o.findLanguage(o.location), o.item = o.getByCode(o.location);
|
|
732
|
-
let w = o;
|
|
733
|
-
var rt = /* @__PURE__ */ ((s) => (s.get = "GET", s.post = "POST", s.put = "PUT", s.delete = "DELETE", s))(rt || {});
|
|
734
|
-
const M = "d-response-loading", x = [];
|
|
735
|
-
class m {
|
|
736
|
-
static url = "/api/";
|
|
737
|
-
static response = [];
|
|
738
|
-
static responseLoading;
|
|
739
|
-
static headers = {};
|
|
740
|
-
static requestDefault;
|
|
741
|
-
static preparation = !1;
|
|
742
|
-
static preparationItem;
|
|
743
|
-
static preparationEndItem;
|
|
744
|
-
static status;
|
|
745
|
-
static statusText;
|
|
746
|
-
static error;
|
|
747
|
-
static lastResponse;
|
|
748
|
-
static lastMessage;
|
|
749
|
-
/**
|
|
750
|
-
* Is the server local.
|
|
751
|
-
*
|
|
752
|
-
* Является ли сервер локальный.
|
|
753
|
-
*/
|
|
754
|
-
static isLocalhost() {
|
|
755
|
-
return typeof location > "u" || location.hostname === "localhost";
|
|
756
|
-
}
|
|
757
|
-
/**
|
|
758
|
-
* Returns the data of the last request.
|
|
759
|
-
*
|
|
760
|
-
* Возвращает данные последнего запроса.
|
|
761
|
-
*/
|
|
762
|
-
static getLastResponse() {
|
|
763
|
-
return this.lastResponse;
|
|
764
|
-
}
|
|
765
|
-
/**
|
|
766
|
-
* Returns messages from the last request.
|
|
767
|
-
*
|
|
768
|
-
* Возвращает сообщения от последнего запроса.
|
|
769
|
-
*/
|
|
770
|
-
static getLastMessage() {
|
|
771
|
-
return this.lastMessage || "";
|
|
772
|
-
}
|
|
773
|
-
/**
|
|
774
|
-
* Getting the header for the request.
|
|
775
|
-
*
|
|
776
|
-
* Получение заголовка для запроса.
|
|
777
|
-
* @param value list of headers/ список заголовков
|
|
778
|
-
* @param type type of request/ тип запроса
|
|
779
|
-
*/
|
|
780
|
-
static getHeaders(t, e = "application/json;charset=UTF-8") {
|
|
781
|
-
if (t !== null) {
|
|
782
|
-
const i = {
|
|
783
|
-
...this.headers,
|
|
784
|
-
...t || {}
|
|
785
|
-
};
|
|
786
|
-
return E(e) && (i["Content-Type"] = e), i;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* Getting the full path to the request script.
|
|
791
|
-
*
|
|
792
|
-
* Получение полного пути к скрипту запроса.
|
|
793
|
-
* @param path path to the script/ путь к скрипту
|
|
794
|
-
* @param api adding a path to the site’s API/ добавление пути к API сайта
|
|
795
|
-
*/
|
|
796
|
-
static getUrl(t, e = !0) {
|
|
797
|
-
return `${e ? this.url : ""}${t}`.replace("{locale}", w.getLocation()).replace("{country}", w.getCountry()).replace("{language}", w.getLanguage());
|
|
798
|
-
}
|
|
799
|
-
/**
|
|
800
|
-
* Getting data for the body.
|
|
801
|
-
*
|
|
802
|
-
* Получение данных для тела.
|
|
803
|
-
* @param request this request/ данный запрос
|
|
804
|
-
* @param method method for request/ метод запрос
|
|
805
|
-
*/
|
|
806
|
-
static getBody(t = {}, e = "GET") {
|
|
807
|
-
if (t instanceof FormData)
|
|
808
|
-
return t;
|
|
809
|
-
if (e !== "GET" && E(t))
|
|
810
|
-
return S(t) ? t : JSON.stringify(t);
|
|
811
|
-
}
|
|
812
|
-
/**
|
|
813
|
-
* Getting data for the body of the get method.
|
|
814
|
-
*
|
|
815
|
-
* Получение данных для тела метода get.
|
|
816
|
-
* @param request this request/ данный запрос
|
|
817
|
-
* @param path path to request/ путь к запрос
|
|
818
|
-
* @param method method for request/ метод запрос
|
|
819
|
-
*/
|
|
820
|
-
static getBodyForGet(t, e = "", i = "GET") {
|
|
821
|
-
if (i === "GET") {
|
|
822
|
-
const n = e.match(/\?/) ? "&" : "?", r = typeof t == "object" ? X(t) : t;
|
|
823
|
-
if (E(r))
|
|
824
|
-
return `${n}${r}`;
|
|
825
|
-
}
|
|
826
|
-
return "";
|
|
827
|
-
}
|
|
828
|
-
/**
|
|
829
|
-
* Returns a list of data about the emulator.
|
|
830
|
-
*
|
|
831
|
-
* Возвращает список данных об эмуляторе.
|
|
832
|
-
*/
|
|
833
|
-
static getResponseList() {
|
|
834
|
-
return this.response.filter((t) => t.isForGlobal !== !0);
|
|
835
|
-
}
|
|
836
|
-
/**
|
|
837
|
-
* Returns the execution status code.
|
|
838
|
-
*
|
|
839
|
-
* Возвращает код статуса выполнения.
|
|
840
|
-
*/
|
|
841
|
-
static getStatus() {
|
|
842
|
-
return this.status;
|
|
843
|
-
}
|
|
844
|
-
/**
|
|
845
|
-
* Returns the execution status text.
|
|
846
|
-
*
|
|
847
|
-
* Возвращает текст статуса выполнения.
|
|
848
|
-
*/
|
|
849
|
-
static getStatusText() {
|
|
850
|
-
return this.statusText;
|
|
851
|
-
}
|
|
852
|
-
/**
|
|
853
|
-
* Returns the script execution error.
|
|
854
|
-
*
|
|
855
|
-
* Возвращает ошибку выполнения скрипта.
|
|
856
|
-
*/
|
|
857
|
-
static getError() {
|
|
858
|
-
return this.error;
|
|
859
|
-
}
|
|
860
|
-
/**
|
|
861
|
-
* Adds default data to the request.
|
|
862
|
-
*
|
|
863
|
-
* Добавляет данные по умолчанию к запросу.
|
|
864
|
-
*/
|
|
865
|
-
static addRequestDefault(t) {
|
|
866
|
-
if (this.requestDefault) {
|
|
867
|
-
const e = D(this.requestDefault);
|
|
868
|
-
if (t instanceof FormData)
|
|
869
|
-
T(e, (i, n) => {
|
|
870
|
-
t.has(n) || t.set(n, i);
|
|
871
|
-
});
|
|
872
|
-
else if (p(t))
|
|
873
|
-
return {
|
|
874
|
-
...e,
|
|
875
|
-
...t
|
|
876
|
-
};
|
|
877
|
-
}
|
|
878
|
-
return t;
|
|
879
|
-
}
|
|
880
|
-
/**
|
|
881
|
-
* Modifies the default header data.
|
|
882
|
-
*
|
|
883
|
-
* Изменяет данные заголовка по умолчанию.
|
|
884
|
-
*/
|
|
885
|
-
static setHeaders(t) {
|
|
886
|
-
return p(t) && (this.headers = t), m;
|
|
887
|
-
}
|
|
888
|
-
/**
|
|
889
|
-
* Modifies the default request data.
|
|
890
|
-
*
|
|
891
|
-
* Изменяет данные запроса по умолчанию.
|
|
892
|
-
*/
|
|
893
|
-
static setRequestDefault(t) {
|
|
894
|
-
this.requestDefault = t;
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* Change the base path to the script.
|
|
898
|
-
*
|
|
899
|
-
* Изменить базовый путь к скрипту.
|
|
900
|
-
* @param url path to the script/ путь к скрипту
|
|
901
|
-
*/
|
|
902
|
-
static setUrl(t) {
|
|
903
|
-
return this.url = t, m;
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* The function is modified for a call before the request.
|
|
907
|
-
*
|
|
908
|
-
* Изменить функцию перед запросом.
|
|
909
|
-
* @param callback function for call/ функция для вызова
|
|
910
|
-
*/
|
|
911
|
-
static setPreparation(t) {
|
|
912
|
-
return this.preparationItem = t, m;
|
|
913
|
-
}
|
|
914
|
-
/**
|
|
915
|
-
* Modify the function after the request.
|
|
916
|
-
*
|
|
917
|
-
* Изменить функцию после запроса.
|
|
918
|
-
* @param callback function for call/ функция для вызова
|
|
919
|
-
*/
|
|
920
|
-
static setEnd(t) {
|
|
921
|
-
return this.preparationEndItem = t, m;
|
|
922
|
-
}
|
|
923
|
-
/**
|
|
924
|
-
* To execute a request.
|
|
925
|
-
*
|
|
926
|
-
* Выполнить запрос.
|
|
927
|
-
* @param pathRequest query string or list of parameters/ строка запроса или список параметров
|
|
928
|
-
*/
|
|
929
|
-
static async request(t) {
|
|
930
|
-
return S(t) ? await this.fetch({
|
|
931
|
-
path: t
|
|
932
|
-
}) : await this.fetch(t);
|
|
933
|
-
}
|
|
934
|
-
/**
|
|
935
|
-
* Sends a get method request.
|
|
936
|
-
*
|
|
937
|
-
* Отправляет запрос метода get.
|
|
938
|
-
* @param request list of parameters/ список параметров
|
|
939
|
-
*/
|
|
940
|
-
static get(t) {
|
|
941
|
-
return this.request({
|
|
942
|
-
...t,
|
|
943
|
-
method: "GET"
|
|
944
|
-
/* get */
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
/**
|
|
948
|
-
* Sends a post method request.
|
|
949
|
-
*
|
|
950
|
-
* Отправляет запрос метода post.
|
|
951
|
-
* @param request list of parameters/ список параметров
|
|
952
|
-
*/
|
|
953
|
-
static post(t) {
|
|
954
|
-
return this.request({
|
|
955
|
-
...t,
|
|
956
|
-
method: "POST"
|
|
957
|
-
/* post */
|
|
958
|
-
});
|
|
959
|
-
}
|
|
960
|
-
/**
|
|
961
|
-
* Sends a put method request.
|
|
962
|
-
*
|
|
963
|
-
* Отправляет запрос метода put.
|
|
964
|
-
* @param request list of parameters/ список параметров
|
|
965
|
-
*/
|
|
966
|
-
static put(t) {
|
|
967
|
-
return this.request({
|
|
968
|
-
...t,
|
|
969
|
-
method: "PUT"
|
|
970
|
-
/* put */
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
/**
|
|
974
|
-
* Sends a delete method request.
|
|
975
|
-
*
|
|
976
|
-
* Отправляет запрос метода delete.
|
|
977
|
-
* @param request list of parameters/ список параметров
|
|
978
|
-
*/
|
|
979
|
-
static delete(t) {
|
|
980
|
-
return this.request({
|
|
981
|
-
...t,
|
|
982
|
-
method: "DELETE"
|
|
983
|
-
/* delete */
|
|
984
|
-
});
|
|
985
|
-
}
|
|
986
|
-
/**
|
|
987
|
-
* Adding cached requests.
|
|
988
|
-
*
|
|
989
|
-
* Добавление кешированных запросов.
|
|
990
|
-
* @param response data for caching/ данные для кеширования
|
|
991
|
-
*/
|
|
992
|
-
static addResponse(t) {
|
|
993
|
-
return this.response.push(...O(t)), m;
|
|
994
|
-
}
|
|
995
|
-
/**
|
|
996
|
-
* Checks if there is a global cached request, if there is, returns it.
|
|
997
|
-
*
|
|
998
|
-
* Проверяет, есть ли глобальный кешированный запрос, если есть, возвращает его.
|
|
999
|
-
* @param path link to the request/ ссылка на запрос
|
|
1000
|
-
* @param method request method/ метод запроса
|
|
1001
|
-
* @param request data for the request/ данные для запроса
|
|
1002
|
-
* @param devMode is it developer mode/ является ли режим разработчика
|
|
1003
|
-
*/
|
|
1004
|
-
static getResponse(t = "", e, i, n) {
|
|
1005
|
-
return this.response.find((r) => {
|
|
1006
|
-
if (I(D(r?.disable)) !== !0 && (r.path instanceof RegExp && t.match(r.path) || t === r.path) && e === r.method && (x.indexOf(r) === -1 || n)) {
|
|
1007
|
-
const a = this.addRequestDefault(r?.request);
|
|
1008
|
-
let c = !1;
|
|
1009
|
-
if (i === a || a === "*any" ? c = !0 : E(i) && E(a) && p(i) && p(a) && !(i instanceof FormData) && !(a instanceof FormData) && Object.values(i).length === Object.values(a).length && (c = Object.entries(a).reduce(
|
|
1010
|
-
(u, [h, f]) => u && (f === i?.[h] || f === "*any"),
|
|
1011
|
-
!0
|
|
1012
|
-
)), c)
|
|
1013
|
-
return n && console.warn(`Response type: ${r.path}`), x.push(r), !0;
|
|
1014
|
-
}
|
|
1015
|
-
return !1;
|
|
1016
|
-
});
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* To execute a request.
|
|
1020
|
-
*
|
|
1021
|
-
* Выполнить запрос.
|
|
1022
|
-
* @param apiFetch property of the request/ свойство запроса
|
|
1023
|
-
*/
|
|
1024
|
-
static async fetch(t) {
|
|
1025
|
-
const {
|
|
1026
|
-
toData: e = !0,
|
|
1027
|
-
hideError: i = !1,
|
|
1028
|
-
queryReturn: n = void 0,
|
|
1029
|
-
globalPreparation: r = !0,
|
|
1030
|
-
globalEnd: a = !0
|
|
1031
|
-
} = t, c = await this.makeEmulator(t);
|
|
1032
|
-
if (c)
|
|
1033
|
-
return c;
|
|
1034
|
-
let u = {};
|
|
1035
|
-
d.show();
|
|
1036
|
-
try {
|
|
1037
|
-
this.preparationItem && r && await this.makePreparation();
|
|
1038
|
-
const h = await this.makeQuery(t), f = a && this.preparationEndItem ? await this.makePreparationEnd(h) : {};
|
|
1039
|
-
if (this.status = h.status, this.statusText = h.statusText, f?.reset)
|
|
1040
|
-
return d.hide(), await this.fetch(t);
|
|
1041
|
-
n ? u = await n(h) : "data" in f ? u = f.data : (h.headers.get("Content-Type") ?? "").match("application/json") ? u = await h.json() : u = { data: await h.text() };
|
|
1042
|
-
} catch (h) {
|
|
1043
|
-
i && console.error("Api: ", h), this.error = h;
|
|
1044
|
-
}
|
|
1045
|
-
return d.hide(), this.makeData(u, e);
|
|
1046
|
-
}
|
|
1047
|
-
/**
|
|
1048
|
-
* Emulates an execution request.
|
|
1049
|
-
*
|
|
1050
|
-
* Эмулирует запрос выполнения.
|
|
1051
|
-
* @param response Data for pre-request/ Данные для пред-запроса
|
|
1052
|
-
* @param request data for the request/ данные для запроса
|
|
1053
|
-
*/
|
|
1054
|
-
static fetchResponse(t, e) {
|
|
1055
|
-
return this.startResponseLoading(), new Promise((i) => {
|
|
1056
|
-
Y(
|
|
1057
|
-
H(t.response) ? t.response(e) : t.response
|
|
1058
|
-
).then((n) => {
|
|
1059
|
-
D(t?.lag) ? (d.show(), setTimeout(() => {
|
|
1060
|
-
this.stopResponseLoading(), i(n), d.hide();
|
|
1061
|
-
}, _(0, 2e3))) : (this.stopResponseLoading(), i(n));
|
|
1062
|
-
});
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* Выполнение эмулятора, если доступно
|
|
1067
|
-
* @param apiFetch property of the request/ свойство запроса
|
|
1068
|
-
*/
|
|
1069
|
-
static async makeEmulator(t) {
|
|
1070
|
-
const {
|
|
1071
|
-
path: e = "",
|
|
1072
|
-
method: i = "GET",
|
|
1073
|
-
global: n = i === "GET",
|
|
1074
|
-
devMode: r = !1
|
|
1075
|
-
} = t;
|
|
1076
|
-
if (n || r) {
|
|
1077
|
-
const a = this.addRequestDefault(t.request), c = this.getResponse(e, i, a, r);
|
|
1078
|
-
if (c) {
|
|
1079
|
-
const u = await this.fetchResponse(c, a);
|
|
1080
|
-
return r && console.warn("Response data:", e, a, u), u;
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* Executing the request.
|
|
1086
|
-
*
|
|
1087
|
-
* Выполнение запроса.
|
|
1088
|
-
* @param apiFetch property of the request/ свойство запроса
|
|
1089
|
-
*/
|
|
1090
|
-
static async makeQuery(t) {
|
|
1091
|
-
const e = this.addRequestDefault(t.request), {
|
|
1092
|
-
api: i = !0,
|
|
1093
|
-
path: n = "",
|
|
1094
|
-
pathFull: r = void 0,
|
|
1095
|
-
method: a = "GET",
|
|
1096
|
-
headers: c = {},
|
|
1097
|
-
type: u = "application/json;charset=UTF-8",
|
|
1098
|
-
init: h = {}
|
|
1099
|
-
} = t, f = r ?? this.getUrl(n, i), Z = `${f}${this.getBodyForGet(e, f, a)}`, N = this.getHeaders(c, u), A = {
|
|
1100
|
-
...h,
|
|
1101
|
-
method: a,
|
|
1102
|
-
body: this.getBody(e, a)
|
|
1103
|
-
};
|
|
1104
|
-
return N && (A.headers = N), await fetch(Z, A);
|
|
1105
|
-
}
|
|
1106
|
-
/**
|
|
1107
|
-
* Preparation before executing the request.
|
|
1108
|
-
*
|
|
1109
|
-
* Подготовка перед выполнением запроса.
|
|
1110
|
-
*/
|
|
1111
|
-
static async makePreparation() {
|
|
1112
|
-
return new Promise((t) => {
|
|
1113
|
-
this.preparation ? setTimeout(() => this.makePreparation().then(t), 160) : this.preparationItem ? (this.preparation = !0, this.preparationItem().then(() => {
|
|
1114
|
-
this.preparation = !1, t();
|
|
1115
|
-
})) : t();
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
/**
|
|
1119
|
-
* Analysis of the request after execution.
|
|
1120
|
-
*
|
|
1121
|
-
* Анализ запроса после выполнения.
|
|
1122
|
-
* @param query data received in the request/ данные, полученные в запросе
|
|
1123
|
-
*/
|
|
1124
|
-
static async makePreparationEnd(t) {
|
|
1125
|
-
let e = {};
|
|
1126
|
-
return this.preparationEndItem && (e = await this.preparationEndItem(t)), e;
|
|
1127
|
-
}
|
|
1128
|
-
/**
|
|
1129
|
-
* Transforms data if needed.
|
|
1130
|
-
*
|
|
1131
|
-
* Преобразует данные, если нужно.
|
|
1132
|
-
* @param data data for transformation/ данные для преобразования
|
|
1133
|
-
* @param toData is it necessary to process the data/ нужно ли обрабатывать данные
|
|
1134
|
-
*/
|
|
1135
|
-
static makeData(t, e) {
|
|
1136
|
-
if (this.lastResponse = t, t && p(t) && ("message" in t && (this.lastMessage = String(t.message)), e && "data" in t)) {
|
|
1137
|
-
if (p(t.data)) {
|
|
1138
|
-
const i = { ...t.data };
|
|
1139
|
-
return "success" in t && (i.success = t.success), i;
|
|
1140
|
-
}
|
|
1141
|
-
return t.data;
|
|
1142
|
-
}
|
|
1143
|
-
return t;
|
|
1144
|
-
}
|
|
1145
|
-
/**
|
|
1146
|
-
* Enable loading for request emulation.
|
|
1147
|
-
*
|
|
1148
|
-
* Включить загрузку для эмуляции запроса.
|
|
1149
|
-
*/
|
|
1150
|
-
static startResponseLoading() {
|
|
1151
|
-
this.responseLoading && clearTimeout(this.responseLoading), g() && document.body.classList.add(M);
|
|
1152
|
-
}
|
|
1153
|
-
/**
|
|
1154
|
-
* Disable loading for request emulation.
|
|
1155
|
-
*
|
|
1156
|
-
* Отключить загрузку для эмуляции запроса.
|
|
1157
|
-
*/
|
|
1158
|
-
static stopResponseLoading() {
|
|
1159
|
-
this.responseLoading = setTimeout(() => {
|
|
1160
|
-
this.responseLoading = void 0, g() && document.body.classList.remove(M);
|
|
1161
|
-
}, 1200);
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
const b = "__UI_ICON", U = 320, q = "--LOAD--", L = class L {
|
|
1165
|
-
/**
|
|
1166
|
-
* Checks if the given icon is in the list of connected icons.
|
|
1167
|
-
*
|
|
1168
|
-
* Проверяет, есть ли данная иконка в списке подключенных иконок.
|
|
1169
|
-
* @param index icon name/ название иконки
|
|
1170
|
-
*/
|
|
1171
|
-
static is(t) {
|
|
1172
|
-
return t in this.icons || this.getName(t) in this.icons;
|
|
1173
|
-
}
|
|
1174
|
-
/**
|
|
1175
|
-
* Returns the icon by the name.
|
|
1176
|
-
*
|
|
1177
|
-
* Возвращает иконку по названию.
|
|
1178
|
-
* @param index icon name/ название иконки
|
|
1179
|
-
* @param url path to the storage location of the icon, if the icon does not exist/
|
|
1180
|
-
* путь к месту хранения иконки, если иконка не существует
|
|
1181
|
-
* @param wait waiting time for picture loading/
|
|
1182
|
-
* время ожидания загрузки картинки
|
|
1183
|
-
*/
|
|
1184
|
-
static async get(t, e = "", i = 1e3 * 60 * 3) {
|
|
1185
|
-
const n = this.icons?.[this.getName(t)] ?? this.icons?.[t] ?? `${t.replace(/^@/, e ?? this.url)}.svg`;
|
|
1186
|
-
return typeof n == "string" ? n === q && i > 0 ? (await this.wait(), this.get(t, e, i - U)) : n : await n;
|
|
1187
|
-
}
|
|
1188
|
-
/**
|
|
1189
|
-
* Returns a list of names of all registered icons.
|
|
1190
|
-
*
|
|
1191
|
-
* Возвращает список названий всех зарегистрированных иконок.
|
|
1192
|
-
*/
|
|
1193
|
-
static getNameList() {
|
|
1194
|
-
return T(this.icons, (t, e) => e.replace(/^@/, ""));
|
|
1195
|
-
}
|
|
1196
|
-
/**
|
|
1197
|
-
* Returns a global link.
|
|
1198
|
-
*
|
|
1199
|
-
* Возвращает глобальную ссылку.
|
|
1200
|
-
*/
|
|
1201
|
-
static getUrlGlobal() {
|
|
1202
|
-
return `${m.isLocalhost(), ""}${this.url}`;
|
|
1203
|
-
}
|
|
1204
|
-
/**
|
|
1205
|
-
* Adding custom icons.
|
|
1206
|
-
*
|
|
1207
|
-
* Добавление пользовательских иконок.
|
|
1208
|
-
* @param index icon name/ название иконки
|
|
1209
|
-
* @param file path to the file/ путь к файлу
|
|
1210
|
-
*/
|
|
1211
|
-
static add(t, e) {
|
|
1212
|
-
this.icons[this.getName(t)] = e;
|
|
1213
|
-
}
|
|
1214
|
-
/**
|
|
1215
|
-
* Adding custom icons in loading mode.
|
|
1216
|
-
*
|
|
1217
|
-
* Добавление пользовательских иконок в режиме загрузки.
|
|
1218
|
-
* @param index icon name/ название иконки
|
|
1219
|
-
*/
|
|
1220
|
-
static addLoad(t) {
|
|
1221
|
-
this.icons[this.getName(t)] = q;
|
|
1222
|
-
}
|
|
1223
|
-
/**
|
|
1224
|
-
* Adding custom global icons.
|
|
1225
|
-
*
|
|
1226
|
-
* Добавление пользовательских глобальных иконок.
|
|
1227
|
-
* @param index icon name/ название иконки
|
|
1228
|
-
* @param file path to the file/ путь к файлу
|
|
1229
|
-
*/
|
|
1230
|
-
static addGlobal(t, e) {
|
|
1231
|
-
this.icons[this.getName(t)] = `${this.getUrlGlobal()}${e}`;
|
|
1232
|
-
}
|
|
1233
|
-
/**
|
|
1234
|
-
* Adding an icon by the list.
|
|
1235
|
-
*
|
|
1236
|
-
* Добавление иконки по списку.
|
|
1237
|
-
* @param list list of icons/ список иконки
|
|
1238
|
-
*/
|
|
1239
|
-
static addByList(t) {
|
|
1240
|
-
T(t, (e, i) => this.add(i, e));
|
|
1241
|
-
}
|
|
1242
|
-
/**
|
|
1243
|
-
* Changes the file path.
|
|
1244
|
-
*
|
|
1245
|
-
* Изменяет путь к файлу.
|
|
1246
|
-
* @param url new file path/ новый путь к файлу
|
|
1247
|
-
*/
|
|
1248
|
-
static setUrl(t) {
|
|
1249
|
-
this.url = t;
|
|
1250
|
-
}
|
|
1251
|
-
/**
|
|
1252
|
-
* Returns the icon name.
|
|
1253
|
-
*
|
|
1254
|
-
* Возвращает название иконки.
|
|
1255
|
-
* @param index icon name/ название иконки
|
|
1256
|
-
*/
|
|
1257
|
-
static getName(t) {
|
|
1258
|
-
return `@${t}`;
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* Script execution delay.
|
|
1262
|
-
*
|
|
1263
|
-
* Задержка выполнения скрипта.
|
|
1264
|
-
*/
|
|
1265
|
-
static wait() {
|
|
1266
|
-
return new Promise((t) => setTimeout(() => t(), U));
|
|
1267
|
-
}
|
|
1268
|
-
};
|
|
1269
|
-
l(L, "icons", {}), l(L, "url", "/icons/"), g() && (b in window || (window[b] = {}), L.icons = window[b]);
|
|
1270
|
-
let G = L;
|
|
1271
|
-
export {
|
|
1272
|
-
m as A,
|
|
1273
|
-
it as D,
|
|
1274
|
-
B as E,
|
|
1275
|
-
w as G,
|
|
1276
|
-
G as I,
|
|
1277
|
-
d as L,
|
|
1278
|
-
E as a,
|
|
1279
|
-
C as b,
|
|
1280
|
-
S as c,
|
|
1281
|
-
O as d,
|
|
1282
|
-
I as e,
|
|
1283
|
-
T as f,
|
|
1284
|
-
X as g,
|
|
1285
|
-
y as h,
|
|
1286
|
-
g as i,
|
|
1287
|
-
$ as j,
|
|
1288
|
-
p as k,
|
|
1289
|
-
D as l,
|
|
1290
|
-
st as m,
|
|
1291
|
-
et as n,
|
|
1292
|
-
rt as o,
|
|
1293
|
-
Y as p,
|
|
1294
|
-
z as q,
|
|
1295
|
-
_ as r,
|
|
1296
|
-
H as s,
|
|
1297
|
-
j as t,
|
|
1298
|
-
tt as u,
|
|
1299
|
-
P as v,
|
|
1300
|
-
J as w
|
|
1301
|
-
};
|