@weavix/sdk-react 0.0.1
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 +45 -0
- package/dist/index.d.ts +265 -0
- package/dist/index.mjs +1198 -0
- package/dist/index.mjs.map +1 -0
- package/dist/sdk-react.css +1 -0
- package/package.json +40 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1198 @@
|
|
|
1
|
+
import He, { Component as Pt, useCallback as Ye, useState as D, useEffect as N, createContext as Ot, useRef as xt, useMemo as kt, useContext as jt } from "react";
|
|
2
|
+
import { on as At, setHandler as Lt, hostApi as P, dispatchHostEvent as B } from "@weavix/sdk-core";
|
|
3
|
+
import { METHOD_NOT_SUPPORTED as yr, MISSING_REQUIRED_SCOPE as Er, PLUGIN_ID_IS_NOT_CORRECT as br, PLUGIN_ID_OR_SLOT_NOT_PROVIDED as Rr, PluginActionError as _r, UNKNOWN_ERROR as wr, VALIDATION_ERROR as Ir, getField as Sr, getLocalizedString as Tr, hostApi as Cr, trackerApi as Pr, uiApi as Or } from "@weavix/sdk-core";
|
|
4
|
+
class Dt extends Pt {
|
|
5
|
+
static getDerivedStateFromError(r) {
|
|
6
|
+
return { hasError: !0, error: r };
|
|
7
|
+
}
|
|
8
|
+
constructor(r) {
|
|
9
|
+
super(r), this.state = { hasError: !1, error: null };
|
|
10
|
+
}
|
|
11
|
+
componentDidCatch(r, a) {
|
|
12
|
+
console.error("ErrorBoundary caught an error:", r, a);
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
return this.state.hasError && this.state.error ? this.props.fallback(this.state.error) : this.props.children;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
var Q = { exports: {} }, W = {};
|
|
19
|
+
var Ue;
|
|
20
|
+
function Mt() {
|
|
21
|
+
if (Ue) return W;
|
|
22
|
+
Ue = 1;
|
|
23
|
+
var s = He, r = /* @__PURE__ */ Symbol.for("react.element"), a = /* @__PURE__ */ Symbol.for("react.fragment"), i = Object.prototype.hasOwnProperty, u = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, d = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
24
|
+
function m(p, f, y) {
|
|
25
|
+
var v, w = {}, O = null, x = null;
|
|
26
|
+
y !== void 0 && (O = "" + y), f.key !== void 0 && (O = "" + f.key), f.ref !== void 0 && (x = f.ref);
|
|
27
|
+
for (v in f) i.call(f, v) && !d.hasOwnProperty(v) && (w[v] = f[v]);
|
|
28
|
+
if (p && p.defaultProps) for (v in f = p.defaultProps, f) w[v] === void 0 && (w[v] = f[v]);
|
|
29
|
+
return { $$typeof: r, type: p, key: O, ref: x, props: w, _owner: u.current };
|
|
30
|
+
}
|
|
31
|
+
return W.Fragment = a, W.jsx = m, W.jsxs = m, W;
|
|
32
|
+
}
|
|
33
|
+
var V = {};
|
|
34
|
+
var Ne;
|
|
35
|
+
function Ut() {
|
|
36
|
+
return Ne || (Ne = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
37
|
+
var s = He, r = /* @__PURE__ */ Symbol.for("react.element"), a = /* @__PURE__ */ Symbol.for("react.portal"), i = /* @__PURE__ */ Symbol.for("react.fragment"), u = /* @__PURE__ */ Symbol.for("react.strict_mode"), d = /* @__PURE__ */ Symbol.for("react.profiler"), m = /* @__PURE__ */ Symbol.for("react.provider"), p = /* @__PURE__ */ Symbol.for("react.context"), f = /* @__PURE__ */ Symbol.for("react.forward_ref"), y = /* @__PURE__ */ Symbol.for("react.suspense"), v = /* @__PURE__ */ Symbol.for("react.suspense_list"), w = /* @__PURE__ */ Symbol.for("react.memo"), O = /* @__PURE__ */ Symbol.for("react.lazy"), x = /* @__PURE__ */ Symbol.for("react.offscreen"), C = Symbol.iterator, F = "@@iterator";
|
|
38
|
+
function A(e) {
|
|
39
|
+
if (e === null || typeof e != "object")
|
|
40
|
+
return null;
|
|
41
|
+
var t = C && e[C] || e[F];
|
|
42
|
+
return typeof t == "function" ? t : null;
|
|
43
|
+
}
|
|
44
|
+
var I = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
45
|
+
function R(e) {
|
|
46
|
+
{
|
|
47
|
+
for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), o = 1; o < t; o++)
|
|
48
|
+
n[o - 1] = arguments[o];
|
|
49
|
+
ee("error", e, n);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function ee(e, t, n) {
|
|
53
|
+
{
|
|
54
|
+
var o = I.ReactDebugCurrentFrame, g = o.getStackAddendum();
|
|
55
|
+
g !== "" && (t += "%s", n = n.concat([g]));
|
|
56
|
+
var h = n.map(function(c) {
|
|
57
|
+
return String(c);
|
|
58
|
+
});
|
|
59
|
+
h.unshift("Warning: " + t), Function.prototype.apply.call(console[e], console, h);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
var te = !1, Ke = !1, Ge = !1, Xe = !1, Qe = !1, fe;
|
|
63
|
+
fe = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
64
|
+
function Ze(e) {
|
|
65
|
+
return !!(typeof e == "string" || typeof e == "function" || e === i || e === d || Qe || e === u || e === y || e === v || Xe || e === x || te || Ke || Ge || typeof e == "object" && e !== null && (e.$$typeof === O || e.$$typeof === w || e.$$typeof === m || e.$$typeof === p || e.$$typeof === f || // This needs to include all possible module reference object
|
|
66
|
+
// types supported by any Flight configuration anywhere since
|
|
67
|
+
// we don't know which Flight build this will end up being used
|
|
68
|
+
// with.
|
|
69
|
+
e.$$typeof === fe || e.getModuleId !== void 0));
|
|
70
|
+
}
|
|
71
|
+
function et(e, t, n) {
|
|
72
|
+
var o = e.displayName;
|
|
73
|
+
if (o)
|
|
74
|
+
return o;
|
|
75
|
+
var g = t.displayName || t.name || "";
|
|
76
|
+
return g !== "" ? n + "(" + g + ")" : n;
|
|
77
|
+
}
|
|
78
|
+
function ge(e) {
|
|
79
|
+
return e.displayName || "Context";
|
|
80
|
+
}
|
|
81
|
+
function L(e) {
|
|
82
|
+
if (e == null)
|
|
83
|
+
return null;
|
|
84
|
+
if (typeof e.tag == "number" && R("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
85
|
+
return e.displayName || e.name || null;
|
|
86
|
+
if (typeof e == "string")
|
|
87
|
+
return e;
|
|
88
|
+
switch (e) {
|
|
89
|
+
case i:
|
|
90
|
+
return "Fragment";
|
|
91
|
+
case a:
|
|
92
|
+
return "Portal";
|
|
93
|
+
case d:
|
|
94
|
+
return "Profiler";
|
|
95
|
+
case u:
|
|
96
|
+
return "StrictMode";
|
|
97
|
+
case y:
|
|
98
|
+
return "Suspense";
|
|
99
|
+
case v:
|
|
100
|
+
return "SuspenseList";
|
|
101
|
+
}
|
|
102
|
+
if (typeof e == "object")
|
|
103
|
+
switch (e.$$typeof) {
|
|
104
|
+
case p:
|
|
105
|
+
var t = e;
|
|
106
|
+
return ge(t) + ".Consumer";
|
|
107
|
+
case m:
|
|
108
|
+
var n = e;
|
|
109
|
+
return ge(n._context) + ".Provider";
|
|
110
|
+
case f:
|
|
111
|
+
return et(e, e.render, "ForwardRef");
|
|
112
|
+
case w:
|
|
113
|
+
var o = e.displayName || null;
|
|
114
|
+
return o !== null ? o : L(e.type) || "Memo";
|
|
115
|
+
case O: {
|
|
116
|
+
var g = e, h = g._payload, c = g._init;
|
|
117
|
+
try {
|
|
118
|
+
return L(c(h));
|
|
119
|
+
} catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
var M = Object.assign, H = 0, he, ve, me, pe, ye, Ee, be;
|
|
127
|
+
function Re() {
|
|
128
|
+
}
|
|
129
|
+
Re.__reactDisabledLog = !0;
|
|
130
|
+
function tt() {
|
|
131
|
+
{
|
|
132
|
+
if (H === 0) {
|
|
133
|
+
he = console.log, ve = console.info, me = console.warn, pe = console.error, ye = console.group, Ee = console.groupCollapsed, be = console.groupEnd;
|
|
134
|
+
var e = {
|
|
135
|
+
configurable: !0,
|
|
136
|
+
enumerable: !0,
|
|
137
|
+
value: Re,
|
|
138
|
+
writable: !0
|
|
139
|
+
};
|
|
140
|
+
Object.defineProperties(console, {
|
|
141
|
+
info: e,
|
|
142
|
+
log: e,
|
|
143
|
+
warn: e,
|
|
144
|
+
error: e,
|
|
145
|
+
group: e,
|
|
146
|
+
groupCollapsed: e,
|
|
147
|
+
groupEnd: e
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
H++;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
function rt() {
|
|
154
|
+
{
|
|
155
|
+
if (H--, H === 0) {
|
|
156
|
+
var e = {
|
|
157
|
+
configurable: !0,
|
|
158
|
+
enumerable: !0,
|
|
159
|
+
writable: !0
|
|
160
|
+
};
|
|
161
|
+
Object.defineProperties(console, {
|
|
162
|
+
log: M({}, e, {
|
|
163
|
+
value: he
|
|
164
|
+
}),
|
|
165
|
+
info: M({}, e, {
|
|
166
|
+
value: ve
|
|
167
|
+
}),
|
|
168
|
+
warn: M({}, e, {
|
|
169
|
+
value: me
|
|
170
|
+
}),
|
|
171
|
+
error: M({}, e, {
|
|
172
|
+
value: pe
|
|
173
|
+
}),
|
|
174
|
+
group: M({}, e, {
|
|
175
|
+
value: ye
|
|
176
|
+
}),
|
|
177
|
+
groupCollapsed: M({}, e, {
|
|
178
|
+
value: Ee
|
|
179
|
+
}),
|
|
180
|
+
groupEnd: M({}, e, {
|
|
181
|
+
value: be
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
H < 0 && R("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
var re = I.ReactCurrentDispatcher, ne;
|
|
189
|
+
function J(e, t, n) {
|
|
190
|
+
{
|
|
191
|
+
if (ne === void 0)
|
|
192
|
+
try {
|
|
193
|
+
throw Error();
|
|
194
|
+
} catch (g) {
|
|
195
|
+
var o = g.stack.trim().match(/\n( *(at )?)/);
|
|
196
|
+
ne = o && o[1] || "";
|
|
197
|
+
}
|
|
198
|
+
return `
|
|
199
|
+
` + ne + e;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
var ie = !1, K;
|
|
203
|
+
{
|
|
204
|
+
var nt = typeof WeakMap == "function" ? WeakMap : Map;
|
|
205
|
+
K = new nt();
|
|
206
|
+
}
|
|
207
|
+
function _e(e, t) {
|
|
208
|
+
if (!e || ie)
|
|
209
|
+
return "";
|
|
210
|
+
{
|
|
211
|
+
var n = K.get(e);
|
|
212
|
+
if (n !== void 0)
|
|
213
|
+
return n;
|
|
214
|
+
}
|
|
215
|
+
var o;
|
|
216
|
+
ie = !0;
|
|
217
|
+
var g = Error.prepareStackTrace;
|
|
218
|
+
Error.prepareStackTrace = void 0;
|
|
219
|
+
var h;
|
|
220
|
+
h = re.current, re.current = null, tt();
|
|
221
|
+
try {
|
|
222
|
+
if (t) {
|
|
223
|
+
var c = function() {
|
|
224
|
+
throw Error();
|
|
225
|
+
};
|
|
226
|
+
if (Object.defineProperty(c.prototype, "props", {
|
|
227
|
+
set: function() {
|
|
228
|
+
throw Error();
|
|
229
|
+
}
|
|
230
|
+
}), typeof Reflect == "object" && Reflect.construct) {
|
|
231
|
+
try {
|
|
232
|
+
Reflect.construct(c, []);
|
|
233
|
+
} catch (T) {
|
|
234
|
+
o = T;
|
|
235
|
+
}
|
|
236
|
+
Reflect.construct(e, [], c);
|
|
237
|
+
} else {
|
|
238
|
+
try {
|
|
239
|
+
c.call();
|
|
240
|
+
} catch (T) {
|
|
241
|
+
o = T;
|
|
242
|
+
}
|
|
243
|
+
e.call(c.prototype);
|
|
244
|
+
}
|
|
245
|
+
} else {
|
|
246
|
+
try {
|
|
247
|
+
throw Error();
|
|
248
|
+
} catch (T) {
|
|
249
|
+
o = T;
|
|
250
|
+
}
|
|
251
|
+
e();
|
|
252
|
+
}
|
|
253
|
+
} catch (T) {
|
|
254
|
+
if (T && o && typeof T.stack == "string") {
|
|
255
|
+
for (var l = T.stack.split(`
|
|
256
|
+
`), S = o.stack.split(`
|
|
257
|
+
`), b = l.length - 1, _ = S.length - 1; b >= 1 && _ >= 0 && l[b] !== S[_]; )
|
|
258
|
+
_--;
|
|
259
|
+
for (; b >= 1 && _ >= 0; b--, _--)
|
|
260
|
+
if (l[b] !== S[_]) {
|
|
261
|
+
if (b !== 1 || _ !== 1)
|
|
262
|
+
do
|
|
263
|
+
if (b--, _--, _ < 0 || l[b] !== S[_]) {
|
|
264
|
+
var k = `
|
|
265
|
+
` + l[b].replace(" at new ", " at ");
|
|
266
|
+
return e.displayName && k.includes("<anonymous>") && (k = k.replace("<anonymous>", e.displayName)), typeof e == "function" && K.set(e, k), k;
|
|
267
|
+
}
|
|
268
|
+
while (b >= 1 && _ >= 0);
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
} finally {
|
|
273
|
+
ie = !1, re.current = h, rt(), Error.prepareStackTrace = g;
|
|
274
|
+
}
|
|
275
|
+
var q = e ? e.displayName || e.name : "", U = q ? J(q) : "";
|
|
276
|
+
return typeof e == "function" && K.set(e, U), U;
|
|
277
|
+
}
|
|
278
|
+
function it(e, t, n) {
|
|
279
|
+
return _e(e, !1);
|
|
280
|
+
}
|
|
281
|
+
function st(e) {
|
|
282
|
+
var t = e.prototype;
|
|
283
|
+
return !!(t && t.isReactComponent);
|
|
284
|
+
}
|
|
285
|
+
function G(e, t, n) {
|
|
286
|
+
if (e == null)
|
|
287
|
+
return "";
|
|
288
|
+
if (typeof e == "function")
|
|
289
|
+
return _e(e, st(e));
|
|
290
|
+
if (typeof e == "string")
|
|
291
|
+
return J(e);
|
|
292
|
+
switch (e) {
|
|
293
|
+
case y:
|
|
294
|
+
return J("Suspense");
|
|
295
|
+
case v:
|
|
296
|
+
return J("SuspenseList");
|
|
297
|
+
}
|
|
298
|
+
if (typeof e == "object")
|
|
299
|
+
switch (e.$$typeof) {
|
|
300
|
+
case f:
|
|
301
|
+
return it(e.render);
|
|
302
|
+
case w:
|
|
303
|
+
return G(e.type, t, n);
|
|
304
|
+
case O: {
|
|
305
|
+
var o = e, g = o._payload, h = o._init;
|
|
306
|
+
try {
|
|
307
|
+
return G(h(g), t, n);
|
|
308
|
+
} catch {
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
return "";
|
|
313
|
+
}
|
|
314
|
+
var Y = Object.prototype.hasOwnProperty, we = {}, Ie = I.ReactDebugCurrentFrame;
|
|
315
|
+
function X(e) {
|
|
316
|
+
if (e) {
|
|
317
|
+
var t = e._owner, n = G(e.type, e._source, t ? t.type : null);
|
|
318
|
+
Ie.setExtraStackFrame(n);
|
|
319
|
+
} else
|
|
320
|
+
Ie.setExtraStackFrame(null);
|
|
321
|
+
}
|
|
322
|
+
function at(e, t, n, o, g) {
|
|
323
|
+
{
|
|
324
|
+
var h = Function.call.bind(Y);
|
|
325
|
+
for (var c in e)
|
|
326
|
+
if (h(e, c)) {
|
|
327
|
+
var l = void 0;
|
|
328
|
+
try {
|
|
329
|
+
if (typeof e[c] != "function") {
|
|
330
|
+
var S = Error((o || "React class") + ": " + n + " type `" + c + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[c] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
331
|
+
throw S.name = "Invariant Violation", S;
|
|
332
|
+
}
|
|
333
|
+
l = e[c](t, c, o, n, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
334
|
+
} catch (b) {
|
|
335
|
+
l = b;
|
|
336
|
+
}
|
|
337
|
+
l && !(l instanceof Error) && (X(g), R("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", o || "React class", n, c, typeof l), X(null)), l instanceof Error && !(l.message in we) && (we[l.message] = !0, X(g), R("Failed %s type: %s", n, l.message), X(null));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
var ot = Array.isArray;
|
|
342
|
+
function se(e) {
|
|
343
|
+
return ot(e);
|
|
344
|
+
}
|
|
345
|
+
function ut(e) {
|
|
346
|
+
{
|
|
347
|
+
var t = typeof Symbol == "function" && Symbol.toStringTag, n = t && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
348
|
+
return n;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
function lt(e) {
|
|
352
|
+
try {
|
|
353
|
+
return Se(e), !1;
|
|
354
|
+
} catch {
|
|
355
|
+
return !0;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
function Se(e) {
|
|
359
|
+
return "" + e;
|
|
360
|
+
}
|
|
361
|
+
function Te(e) {
|
|
362
|
+
if (lt(e))
|
|
363
|
+
return R("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ut(e)), Se(e);
|
|
364
|
+
}
|
|
365
|
+
var Ce = I.ReactCurrentOwner, ct = {
|
|
366
|
+
key: !0,
|
|
367
|
+
ref: !0,
|
|
368
|
+
__self: !0,
|
|
369
|
+
__source: !0
|
|
370
|
+
}, Pe, Oe;
|
|
371
|
+
function dt(e) {
|
|
372
|
+
if (Y.call(e, "ref")) {
|
|
373
|
+
var t = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
374
|
+
if (t && t.isReactWarning)
|
|
375
|
+
return !1;
|
|
376
|
+
}
|
|
377
|
+
return e.ref !== void 0;
|
|
378
|
+
}
|
|
379
|
+
function ft(e) {
|
|
380
|
+
if (Y.call(e, "key")) {
|
|
381
|
+
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
382
|
+
if (t && t.isReactWarning)
|
|
383
|
+
return !1;
|
|
384
|
+
}
|
|
385
|
+
return e.key !== void 0;
|
|
386
|
+
}
|
|
387
|
+
function gt(e, t) {
|
|
388
|
+
typeof e.ref == "string" && Ce.current;
|
|
389
|
+
}
|
|
390
|
+
function ht(e, t) {
|
|
391
|
+
{
|
|
392
|
+
var n = function() {
|
|
393
|
+
Pe || (Pe = !0, R("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
|
394
|
+
};
|
|
395
|
+
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
396
|
+
get: n,
|
|
397
|
+
configurable: !0
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
function vt(e, t) {
|
|
402
|
+
{
|
|
403
|
+
var n = function() {
|
|
404
|
+
Oe || (Oe = !0, R("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", t));
|
|
405
|
+
};
|
|
406
|
+
n.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
407
|
+
get: n,
|
|
408
|
+
configurable: !0
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
var mt = function(e, t, n, o, g, h, c) {
|
|
413
|
+
var l = {
|
|
414
|
+
// This tag allows us to uniquely identify this as a React Element
|
|
415
|
+
$$typeof: r,
|
|
416
|
+
// Built-in properties that belong on the element
|
|
417
|
+
type: e,
|
|
418
|
+
key: t,
|
|
419
|
+
ref: n,
|
|
420
|
+
props: c,
|
|
421
|
+
// Record the component responsible for creating this element.
|
|
422
|
+
_owner: h
|
|
423
|
+
};
|
|
424
|
+
return l._store = {}, Object.defineProperty(l._store, "validated", {
|
|
425
|
+
configurable: !1,
|
|
426
|
+
enumerable: !1,
|
|
427
|
+
writable: !0,
|
|
428
|
+
value: !1
|
|
429
|
+
}), Object.defineProperty(l, "_self", {
|
|
430
|
+
configurable: !1,
|
|
431
|
+
enumerable: !1,
|
|
432
|
+
writable: !1,
|
|
433
|
+
value: o
|
|
434
|
+
}), Object.defineProperty(l, "_source", {
|
|
435
|
+
configurable: !1,
|
|
436
|
+
enumerable: !1,
|
|
437
|
+
writable: !1,
|
|
438
|
+
value: g
|
|
439
|
+
}), Object.freeze && (Object.freeze(l.props), Object.freeze(l)), l;
|
|
440
|
+
};
|
|
441
|
+
function pt(e, t, n, o, g) {
|
|
442
|
+
{
|
|
443
|
+
var h, c = {}, l = null, S = null;
|
|
444
|
+
n !== void 0 && (Te(n), l = "" + n), ft(t) && (Te(t.key), l = "" + t.key), dt(t) && (S = t.ref, gt(t, g));
|
|
445
|
+
for (h in t)
|
|
446
|
+
Y.call(t, h) && !ct.hasOwnProperty(h) && (c[h] = t[h]);
|
|
447
|
+
if (e && e.defaultProps) {
|
|
448
|
+
var b = e.defaultProps;
|
|
449
|
+
for (h in b)
|
|
450
|
+
c[h] === void 0 && (c[h] = b[h]);
|
|
451
|
+
}
|
|
452
|
+
if (l || S) {
|
|
453
|
+
var _ = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
454
|
+
l && ht(c, _), S && vt(c, _);
|
|
455
|
+
}
|
|
456
|
+
return mt(e, l, S, g, o, Ce.current, c);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
var ae = I.ReactCurrentOwner, xe = I.ReactDebugCurrentFrame;
|
|
460
|
+
function z(e) {
|
|
461
|
+
if (e) {
|
|
462
|
+
var t = e._owner, n = G(e.type, e._source, t ? t.type : null);
|
|
463
|
+
xe.setExtraStackFrame(n);
|
|
464
|
+
} else
|
|
465
|
+
xe.setExtraStackFrame(null);
|
|
466
|
+
}
|
|
467
|
+
var oe;
|
|
468
|
+
oe = !1;
|
|
469
|
+
function ue(e) {
|
|
470
|
+
return typeof e == "object" && e !== null && e.$$typeof === r;
|
|
471
|
+
}
|
|
472
|
+
function ke() {
|
|
473
|
+
{
|
|
474
|
+
if (ae.current) {
|
|
475
|
+
var e = L(ae.current.type);
|
|
476
|
+
if (e)
|
|
477
|
+
return `
|
|
478
|
+
|
|
479
|
+
Check the render method of \`` + e + "`.";
|
|
480
|
+
}
|
|
481
|
+
return "";
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
function yt(e) {
|
|
485
|
+
return "";
|
|
486
|
+
}
|
|
487
|
+
var je = {};
|
|
488
|
+
function Et(e) {
|
|
489
|
+
{
|
|
490
|
+
var t = ke();
|
|
491
|
+
if (!t) {
|
|
492
|
+
var n = typeof e == "string" ? e : e.displayName || e.name;
|
|
493
|
+
n && (t = `
|
|
494
|
+
|
|
495
|
+
Check the top-level render call using <` + n + ">.");
|
|
496
|
+
}
|
|
497
|
+
return t;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
function Ae(e, t) {
|
|
501
|
+
{
|
|
502
|
+
if (!e._store || e._store.validated || e.key != null)
|
|
503
|
+
return;
|
|
504
|
+
e._store.validated = !0;
|
|
505
|
+
var n = Et(t);
|
|
506
|
+
if (je[n])
|
|
507
|
+
return;
|
|
508
|
+
je[n] = !0;
|
|
509
|
+
var o = "";
|
|
510
|
+
e && e._owner && e._owner !== ae.current && (o = " It was passed a child from " + L(e._owner.type) + "."), z(e), R('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', n, o), z(null);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
function Le(e, t) {
|
|
514
|
+
{
|
|
515
|
+
if (typeof e != "object")
|
|
516
|
+
return;
|
|
517
|
+
if (se(e))
|
|
518
|
+
for (var n = 0; n < e.length; n++) {
|
|
519
|
+
var o = e[n];
|
|
520
|
+
ue(o) && Ae(o, t);
|
|
521
|
+
}
|
|
522
|
+
else if (ue(e))
|
|
523
|
+
e._store && (e._store.validated = !0);
|
|
524
|
+
else if (e) {
|
|
525
|
+
var g = A(e);
|
|
526
|
+
if (typeof g == "function" && g !== e.entries)
|
|
527
|
+
for (var h = g.call(e), c; !(c = h.next()).done; )
|
|
528
|
+
ue(c.value) && Ae(c.value, t);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
function bt(e) {
|
|
533
|
+
{
|
|
534
|
+
var t = e.type;
|
|
535
|
+
if (t == null || typeof t == "string")
|
|
536
|
+
return;
|
|
537
|
+
var n;
|
|
538
|
+
if (typeof t == "function")
|
|
539
|
+
n = t.propTypes;
|
|
540
|
+
else if (typeof t == "object" && (t.$$typeof === f || // Note: Memo only checks outer props here.
|
|
541
|
+
// Inner props are checked in the reconciler.
|
|
542
|
+
t.$$typeof === w))
|
|
543
|
+
n = t.propTypes;
|
|
544
|
+
else
|
|
545
|
+
return;
|
|
546
|
+
if (n) {
|
|
547
|
+
var o = L(t);
|
|
548
|
+
at(n, e.props, "prop", o, e);
|
|
549
|
+
} else if (t.PropTypes !== void 0 && !oe) {
|
|
550
|
+
oe = !0;
|
|
551
|
+
var g = L(t);
|
|
552
|
+
R("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", g || "Unknown");
|
|
553
|
+
}
|
|
554
|
+
typeof t.getDefaultProps == "function" && !t.getDefaultProps.isReactClassApproved && R("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
function Rt(e) {
|
|
558
|
+
{
|
|
559
|
+
for (var t = Object.keys(e.props), n = 0; n < t.length; n++) {
|
|
560
|
+
var o = t[n];
|
|
561
|
+
if (o !== "children" && o !== "key") {
|
|
562
|
+
z(e), R("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", o), z(null);
|
|
563
|
+
break;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
e.ref !== null && (z(e), R("Invalid attribute `ref` supplied to `React.Fragment`."), z(null));
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
var De = {};
|
|
570
|
+
function Me(e, t, n, o, g, h) {
|
|
571
|
+
{
|
|
572
|
+
var c = Ze(e);
|
|
573
|
+
if (!c) {
|
|
574
|
+
var l = "";
|
|
575
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (l += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
576
|
+
var S = yt();
|
|
577
|
+
S ? l += S : l += ke();
|
|
578
|
+
var b;
|
|
579
|
+
e === null ? b = "null" : se(e) ? b = "array" : e !== void 0 && e.$$typeof === r ? (b = "<" + (L(e.type) || "Unknown") + " />", l = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, R("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", b, l);
|
|
580
|
+
}
|
|
581
|
+
var _ = pt(e, t, n, g, h);
|
|
582
|
+
if (_ == null)
|
|
583
|
+
return _;
|
|
584
|
+
if (c) {
|
|
585
|
+
var k = t.children;
|
|
586
|
+
if (k !== void 0)
|
|
587
|
+
if (o)
|
|
588
|
+
if (se(k)) {
|
|
589
|
+
for (var q = 0; q < k.length; q++)
|
|
590
|
+
Le(k[q], e);
|
|
591
|
+
Object.freeze && Object.freeze(k);
|
|
592
|
+
} else
|
|
593
|
+
R("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
594
|
+
else
|
|
595
|
+
Le(k, e);
|
|
596
|
+
}
|
|
597
|
+
if (Y.call(t, "key")) {
|
|
598
|
+
var U = L(e), T = Object.keys(t).filter(function(Ct) {
|
|
599
|
+
return Ct !== "key";
|
|
600
|
+
}), le = T.length > 0 ? "{key: someKey, " + T.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
601
|
+
if (!De[U + le]) {
|
|
602
|
+
var Tt = T.length > 0 ? "{" + T.join(": ..., ") + ": ...}" : "{}";
|
|
603
|
+
R(`A props object containing a "key" prop is being spread into JSX:
|
|
604
|
+
let props = %s;
|
|
605
|
+
<%s {...props} />
|
|
606
|
+
React keys must be passed directly to JSX without using spread:
|
|
607
|
+
let props = %s;
|
|
608
|
+
<%s key={someKey} {...props} />`, le, U, Tt, U), De[U + le] = !0;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
return e === i ? Rt(_) : bt(_), _;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
function _t(e, t, n) {
|
|
615
|
+
return Me(e, t, n, !0);
|
|
616
|
+
}
|
|
617
|
+
function wt(e, t, n) {
|
|
618
|
+
return Me(e, t, n, !1);
|
|
619
|
+
}
|
|
620
|
+
var It = wt, St = _t;
|
|
621
|
+
V.Fragment = i, V.jsx = It, V.jsxs = St;
|
|
622
|
+
})()), V;
|
|
623
|
+
}
|
|
624
|
+
var Fe;
|
|
625
|
+
function Nt() {
|
|
626
|
+
return Fe || (Fe = 1, process.env.NODE_ENV === "production" ? Q.exports = Mt() : Q.exports = Ut()), Q.exports;
|
|
627
|
+
}
|
|
628
|
+
var E = Nt();
|
|
629
|
+
const Ft = ({ error: s }) => /* @__PURE__ */ E.jsx("div", { className: "plugin-error", children: /* @__PURE__ */ E.jsxs("div", { className: "plugin-error__container", children: [
|
|
630
|
+
/* @__PURE__ */ E.jsxs("div", { className: "plugin-error__header", children: [
|
|
631
|
+
/* @__PURE__ */ E.jsxs(
|
|
632
|
+
"svg",
|
|
633
|
+
{
|
|
634
|
+
className: "plugin-error__icon",
|
|
635
|
+
width: "24",
|
|
636
|
+
height: "24",
|
|
637
|
+
viewBox: "0 0 24 24",
|
|
638
|
+
fill: "none",
|
|
639
|
+
children: [
|
|
640
|
+
/* @__PURE__ */ E.jsx("circle", { cx: "12", cy: "12", r: "10", fill: "#f44336" }),
|
|
641
|
+
/* @__PURE__ */ E.jsx(
|
|
642
|
+
"path",
|
|
643
|
+
{
|
|
644
|
+
d: "M12 7v6m0 4h.01",
|
|
645
|
+
stroke: "white",
|
|
646
|
+
strokeWidth: "2",
|
|
647
|
+
strokeLinecap: "round"
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
]
|
|
651
|
+
}
|
|
652
|
+
),
|
|
653
|
+
/* @__PURE__ */ E.jsx("h3", { className: "plugin-error__title", children: "Ошибка инициализации плагина" })
|
|
654
|
+
] }),
|
|
655
|
+
/* @__PURE__ */ E.jsx("div", { className: "plugin-error__message", children: "Не удалось инициализировать плагин. Проверьте параметры запуска и попробуйте перезагрузить страницу." }),
|
|
656
|
+
/* @__PURE__ */ E.jsxs("details", { className: "plugin-error__details", children: [
|
|
657
|
+
/* @__PURE__ */ E.jsx("summary", { className: "plugin-error__summary", children: "Детали ошибки" }),
|
|
658
|
+
/* @__PURE__ */ E.jsxs("pre", { className: "plugin-error__stack", children: [
|
|
659
|
+
s.message,
|
|
660
|
+
s.stack && `
|
|
661
|
+
|
|
662
|
+
${s.stack}`
|
|
663
|
+
] })
|
|
664
|
+
] })
|
|
665
|
+
] }) }), ze = Ft, zt = () => /* @__PURE__ */ E.jsx("div", { className: "plugin-loader", children: /* @__PURE__ */ E.jsxs("div", { className: "plugin-loader__content", children: [
|
|
666
|
+
/* @__PURE__ */ E.jsx("div", { className: "plugin-loader__spinner" }),
|
|
667
|
+
/* @__PURE__ */ E.jsx("div", { className: "plugin-loader__text", children: "Загрузка плагина..." })
|
|
668
|
+
] }) }), cr = zt, Z = /* @__PURE__ */ new Map(), ce = /* @__PURE__ */ new Map();
|
|
669
|
+
function de(s, r) {
|
|
670
|
+
let a = Z.get(s);
|
|
671
|
+
a || (a = /* @__PURE__ */ new Set(), Z.set(s, a));
|
|
672
|
+
const i = r;
|
|
673
|
+
if (a.add(i), ce.has(s))
|
|
674
|
+
try {
|
|
675
|
+
i(ce.get(s));
|
|
676
|
+
} catch (u) {
|
|
677
|
+
console.error(`[EventBus] Error replaying cached value for "${s}":`, u);
|
|
678
|
+
}
|
|
679
|
+
return () => {
|
|
680
|
+
a.delete(i), a.size === 0 && Z.delete(s);
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
function qt(s) {
|
|
684
|
+
const r = s.method;
|
|
685
|
+
ce.set(r, s.result);
|
|
686
|
+
const a = Z.get(r);
|
|
687
|
+
if (a)
|
|
688
|
+
for (const i of a)
|
|
689
|
+
try {
|
|
690
|
+
i(s.result);
|
|
691
|
+
} catch (u) {
|
|
692
|
+
console.error(`[EventBus] Error in subscriber for "${s.method}":`, u);
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
const $t = {};
|
|
696
|
+
function Ht(s) {
|
|
697
|
+
return $t[s];
|
|
698
|
+
}
|
|
699
|
+
const qe = 6666;
|
|
700
|
+
class $e extends Error {
|
|
701
|
+
constructor(r, a, i) {
|
|
702
|
+
super(a), this.name = "PluginActionError", this.code = r, this.errorData = i;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
class Yt {
|
|
706
|
+
constructor(r, a, i, u, d, m) {
|
|
707
|
+
this.pendingRequests = /* @__PURE__ */ new Map(), this.messageListener = null, this.requestTimeout = 1e4, this.pluginId = r, this.elementId = a, this.targetOrigin = d, this.entityId = u, this.entityMeta = m, this.slot = i, this.initListener();
|
|
708
|
+
}
|
|
709
|
+
request(r, a, i) {
|
|
710
|
+
return new Promise((u, d) => {
|
|
711
|
+
const m = this.generateMessageId(), p = i?.timeout ?? this.requestTimeout, f = {
|
|
712
|
+
messageId: m,
|
|
713
|
+
method: r,
|
|
714
|
+
payload: a
|
|
715
|
+
}, y = setTimeout(() => {
|
|
716
|
+
this.pendingRequests.get(m) && (this.pendingRequests.delete(m), d(new Error(`Request timeout: ${r} exceeded ${p}ms`)));
|
|
717
|
+
}, p);
|
|
718
|
+
this.pendingRequests.set(m, { resolve: u, reject: d, timeoutId: y });
|
|
719
|
+
try {
|
|
720
|
+
this.send(f);
|
|
721
|
+
} catch (v) {
|
|
722
|
+
clearTimeout(y), this.pendingRequests.delete(m), d(v);
|
|
723
|
+
}
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
send(r) {
|
|
727
|
+
window.parent.postMessage(
|
|
728
|
+
{
|
|
729
|
+
pluginId: this.pluginId,
|
|
730
|
+
elementId: this.elementId,
|
|
731
|
+
slot: this.slot,
|
|
732
|
+
entityId: this.entityId,
|
|
733
|
+
entityMeta: this.entityMeta,
|
|
734
|
+
...r
|
|
735
|
+
},
|
|
736
|
+
this.targetOrigin
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
destroy() {
|
|
740
|
+
this.messageListener && (window.removeEventListener("message", this.messageListener), this.messageListener = null), this.pendingRequests.forEach((r) => {
|
|
741
|
+
clearTimeout(r.timeoutId);
|
|
742
|
+
}), this.pendingRequests.clear();
|
|
743
|
+
}
|
|
744
|
+
initListener() {
|
|
745
|
+
this.messageListener = async (r) => {
|
|
746
|
+
if (r.origin !== this.targetOrigin) {
|
|
747
|
+
console.info(
|
|
748
|
+
"[Bridge] Ignored message from origin:",
|
|
749
|
+
r.origin,
|
|
750
|
+
"(expected:",
|
|
751
|
+
this.targetOrigin,
|
|
752
|
+
")"
|
|
753
|
+
);
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
const a = r.data;
|
|
757
|
+
if (console.info("[Bridge] Received message:", a), a.type === "event") {
|
|
758
|
+
console.info("[Bridge] Dispatching host event:", a.method, a.result), qt(a);
|
|
759
|
+
return;
|
|
760
|
+
}
|
|
761
|
+
if (console.info("[Bridge] Received message:", r.data), !a.messageId) {
|
|
762
|
+
console.info("[Bridge] Ignored message without messageId:", a);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
const i = a, u = this.pendingRequests.get(i.messageId);
|
|
766
|
+
if (!u) {
|
|
767
|
+
if (i.type === "request") {
|
|
768
|
+
const p = i.result.method, f = Ht(p);
|
|
769
|
+
if (!f) {
|
|
770
|
+
this.send({
|
|
771
|
+
messageId: i.messageId,
|
|
772
|
+
type: "response",
|
|
773
|
+
result: null,
|
|
774
|
+
errorCode: qe,
|
|
775
|
+
error: `No handler for method ${p}`
|
|
776
|
+
});
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
try {
|
|
780
|
+
const y = f();
|
|
781
|
+
this.send({
|
|
782
|
+
messageId: i.messageId,
|
|
783
|
+
payload: y,
|
|
784
|
+
method: "responseData",
|
|
785
|
+
type: "response"
|
|
786
|
+
});
|
|
787
|
+
} catch (y) {
|
|
788
|
+
const v = y instanceof Error ? y : new Error(String(y)), w = v instanceof $e ? v.code : qe;
|
|
789
|
+
this.send({
|
|
790
|
+
messageId: i.messageId,
|
|
791
|
+
type: "response",
|
|
792
|
+
result: null,
|
|
793
|
+
errorCode: w,
|
|
794
|
+
error: v.message
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
clearTimeout(u.timeoutId), this.pendingRequests.delete(i.messageId);
|
|
801
|
+
const d = i;
|
|
802
|
+
d.type === "response" && d.errorCode ? u.reject(
|
|
803
|
+
new $e(
|
|
804
|
+
d.errorCode,
|
|
805
|
+
d.error ?? "Unknown error",
|
|
806
|
+
d.errorData
|
|
807
|
+
)
|
|
808
|
+
) : u.resolve(d.result);
|
|
809
|
+
}, window.addEventListener("message", this.messageListener);
|
|
810
|
+
}
|
|
811
|
+
generateMessageId() {
|
|
812
|
+
return crypto.randomUUID();
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
let $ = null;
|
|
816
|
+
function Bt(s, r, a, i, u, d) {
|
|
817
|
+
return $ && $.destroy(), $ = new Yt(
|
|
818
|
+
s,
|
|
819
|
+
r,
|
|
820
|
+
a,
|
|
821
|
+
i,
|
|
822
|
+
u,
|
|
823
|
+
d
|
|
824
|
+
), $;
|
|
825
|
+
}
|
|
826
|
+
function Wt() {
|
|
827
|
+
if (!$)
|
|
828
|
+
throw new Error("Bridge not initialized. Call initBridge first.");
|
|
829
|
+
return $;
|
|
830
|
+
}
|
|
831
|
+
function j(s, r, a) {
|
|
832
|
+
return Wt().request(s, r, a);
|
|
833
|
+
}
|
|
834
|
+
const Vt = 3e5;
|
|
835
|
+
class Jt {
|
|
836
|
+
show(r) {
|
|
837
|
+
return j("confirm.show", r, {
|
|
838
|
+
timeout: Vt
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
class Kt {
|
|
843
|
+
constructor() {
|
|
844
|
+
this.callbackMap = /* @__PURE__ */ new Map(), this.toastActionIds = /* @__PURE__ */ new Map(), this.eventSubscribed = !1;
|
|
845
|
+
}
|
|
846
|
+
async add(r) {
|
|
847
|
+
this.ensureEventSubscription();
|
|
848
|
+
const a = [], i = r.actions?.map((m) => {
|
|
849
|
+
const p = crypto.randomUUID();
|
|
850
|
+
return this.callbackMap.set(p, m.onClick), a.push(p), { id: p, label: m.label };
|
|
851
|
+
}), u = await j("toast.add", {
|
|
852
|
+
name: r.name,
|
|
853
|
+
title: r.title,
|
|
854
|
+
content: r.content,
|
|
855
|
+
theme: r.theme,
|
|
856
|
+
autoHiding: r.autoHiding,
|
|
857
|
+
isClosable: r.isClosable,
|
|
858
|
+
actions: i
|
|
859
|
+
});
|
|
860
|
+
a.length > 0 && this.toastActionIds.set(u.name, a);
|
|
861
|
+
const d = r.autoHiding ?? 5e3;
|
|
862
|
+
return setTimeout(() => this.cleanupCallbacksForToast(u.name), d + 1e3), u;
|
|
863
|
+
}
|
|
864
|
+
ensureEventSubscription() {
|
|
865
|
+
this.eventSubscribed || (this.eventSubscribed = !0, de("toast.action.clicked", ({ name: r, actionId: a }) => {
|
|
866
|
+
this.callbackMap.get(a)?.(), this.cleanupCallbacksForToast(r);
|
|
867
|
+
}));
|
|
868
|
+
}
|
|
869
|
+
cleanupCallbacksForToast(r) {
|
|
870
|
+
const a = this.toastActionIds.get(r);
|
|
871
|
+
if (a) {
|
|
872
|
+
for (const i of a)
|
|
873
|
+
this.callbackMap.delete(i);
|
|
874
|
+
this.toastActionIds.delete(r);
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
class Gt {
|
|
879
|
+
constructor() {
|
|
880
|
+
this.toaster = new Kt(), this.confirm = new Jt();
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
const Be = new Gt();
|
|
884
|
+
function Xt(s, r, a = "ru") {
|
|
885
|
+
if (typeof s == "string")
|
|
886
|
+
return s;
|
|
887
|
+
const i = (r ?? a).toLowerCase(), u = a.toLowerCase();
|
|
888
|
+
return s[i] || s[u] || s.ru || s.en || "";
|
|
889
|
+
}
|
|
890
|
+
class Qt {
|
|
891
|
+
constructor(r) {
|
|
892
|
+
this.lastHeight = 0, this.isUpdating = !1, this.consecutiveSmallIncreases = 0, this.MAX_CONSECUTIVE_SMALL_INCREASES = 5, this.SMALL_INCREASE_THRESHOLD_PX = 10, this.resizeCallback = r;
|
|
893
|
+
}
|
|
894
|
+
enable() {
|
|
895
|
+
if (!document.body) {
|
|
896
|
+
console.error("[AutoResize] document.body does not exist yet");
|
|
897
|
+
return;
|
|
898
|
+
}
|
|
899
|
+
const r = async () => {
|
|
900
|
+
if (this.isUpdating)
|
|
901
|
+
return;
|
|
902
|
+
const i = document.getElementById("root"), u = window.getComputedStyle(document.body), d = parseInt(u.marginTop, 10) || 0, m = parseInt(u.marginBottom, 10) || 0, f = Math.max(
|
|
903
|
+
document.body.scrollHeight,
|
|
904
|
+
document.body.offsetHeight,
|
|
905
|
+
i ? i.scrollHeight + d + m : 0
|
|
906
|
+
) + 4;
|
|
907
|
+
if (f !== this.lastHeight) {
|
|
908
|
+
if (f > this.lastHeight)
|
|
909
|
+
if (f - this.lastHeight <= this.SMALL_INCREASE_THRESHOLD_PX) {
|
|
910
|
+
if (this.consecutiveSmallIncreases++, this.consecutiveSmallIncreases > this.MAX_CONSECUTIVE_SMALL_INCREASES) {
|
|
911
|
+
console.warn(
|
|
912
|
+
"[AutoResize] Infinite loop detected. Stopping auto-resize. This may be caused by elements with viewport-relative units (vh, %)."
|
|
913
|
+
), this.disable();
|
|
914
|
+
return;
|
|
915
|
+
}
|
|
916
|
+
} else
|
|
917
|
+
this.consecutiveSmallIncreases = 0;
|
|
918
|
+
else
|
|
919
|
+
this.consecutiveSmallIncreases = 0;
|
|
920
|
+
this.isUpdating = !0, this.lastHeight = f;
|
|
921
|
+
try {
|
|
922
|
+
await this.resizeCallback(f);
|
|
923
|
+
} catch (y) {
|
|
924
|
+
console.error("[AutoResize] Failed to update content size:", y);
|
|
925
|
+
} finally {
|
|
926
|
+
this.isUpdating = !1;
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
}, a = () => {
|
|
930
|
+
clearTimeout(this.resizeTimeout), this.resizeTimeout = setTimeout(r, 100);
|
|
931
|
+
};
|
|
932
|
+
this.resizeObserver = new ResizeObserver(a), this.resizeObserver.observe(document.body), r();
|
|
933
|
+
}
|
|
934
|
+
disable() {
|
|
935
|
+
this.resizeObserver?.disconnect(), clearTimeout(this.resizeTimeout), this.isUpdating = !1, this.consecutiveSmallIncreases = 0;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
class Zt {
|
|
939
|
+
constructor() {
|
|
940
|
+
this.slot = null, this.service = null, this.origin = null, this.innerUrl = null, this.queryParams = null;
|
|
941
|
+
}
|
|
942
|
+
getTheme() {
|
|
943
|
+
return j("theme.get");
|
|
944
|
+
}
|
|
945
|
+
getLanguage() {
|
|
946
|
+
return j("language.get");
|
|
947
|
+
}
|
|
948
|
+
getUserId() {
|
|
949
|
+
return j("userId.get");
|
|
950
|
+
}
|
|
951
|
+
getIsYateam() {
|
|
952
|
+
return j("isYateam.get");
|
|
953
|
+
}
|
|
954
|
+
getContext() {
|
|
955
|
+
return j("context.get");
|
|
956
|
+
}
|
|
957
|
+
updateContentSize(r) {
|
|
958
|
+
return j("contentSize.update", r);
|
|
959
|
+
}
|
|
960
|
+
notifyReady() {
|
|
961
|
+
return j("plugin.ready");
|
|
962
|
+
}
|
|
963
|
+
close(r) {
|
|
964
|
+
return j("plugin.close", r);
|
|
965
|
+
}
|
|
966
|
+
navigate(r) {
|
|
967
|
+
return j("navigate", r);
|
|
968
|
+
}
|
|
969
|
+
init(r) {
|
|
970
|
+
const { autoResize: a = !0 } = r, i = new URLSearchParams(location.search);
|
|
971
|
+
if (this.service = i.get("service"), this.service === null)
|
|
972
|
+
throw new Error("Service is not defined");
|
|
973
|
+
const u = i.get("slot");
|
|
974
|
+
if (!u)
|
|
975
|
+
throw new Error("Slot is not defined");
|
|
976
|
+
const d = i.get("parentOrigin");
|
|
977
|
+
if (!d)
|
|
978
|
+
throw new Error("Target origin is not defined");
|
|
979
|
+
const m = i.get("id");
|
|
980
|
+
if (!m)
|
|
981
|
+
throw new Error("Plugin id is not defined");
|
|
982
|
+
const p = i.get("elementId");
|
|
983
|
+
if (!p)
|
|
984
|
+
throw new Error("Element id is not defined");
|
|
985
|
+
const f = i.get("entityId"), y = i.get("entityMeta"), v = y ? JSON.parse(y) : void 0;
|
|
986
|
+
Bt(m, p, u, f, d, v), this.slot = u, this.origin = d, this.innerUrl = i.get("innerUrl") ?? "";
|
|
987
|
+
const w = i.get("queryParams");
|
|
988
|
+
this.queryParams = w ? JSON.parse(decodeURIComponent(w)) : {}, a && (this.autoResizeManager = new Qt(
|
|
989
|
+
(O) => this.updateContentSize({ height: O })
|
|
990
|
+
), this.autoResizeManager.enable());
|
|
991
|
+
}
|
|
992
|
+
getSlot() {
|
|
993
|
+
if (this.slot === null)
|
|
994
|
+
throw new Error("Plugin not initialized. Call init() first.");
|
|
995
|
+
return this.slot;
|
|
996
|
+
}
|
|
997
|
+
getService() {
|
|
998
|
+
if (this.service === null)
|
|
999
|
+
throw new Error("Service not initialized. Call init() first.");
|
|
1000
|
+
return this.service;
|
|
1001
|
+
}
|
|
1002
|
+
getOrigin() {
|
|
1003
|
+
if (this.origin === null)
|
|
1004
|
+
throw new Error("Origin not initialized. Call init() first.");
|
|
1005
|
+
return this.origin;
|
|
1006
|
+
}
|
|
1007
|
+
getInnerUrl() {
|
|
1008
|
+
if (this.innerUrl === null)
|
|
1009
|
+
throw new Error("Plugin not initialized. Call init() first.");
|
|
1010
|
+
return this.innerUrl;
|
|
1011
|
+
}
|
|
1012
|
+
getQueryParams() {
|
|
1013
|
+
if (this.queryParams === null)
|
|
1014
|
+
throw new Error("Plugin not initialized. Call init() first.");
|
|
1015
|
+
return this.queryParams;
|
|
1016
|
+
}
|
|
1017
|
+
disableAutoResize() {
|
|
1018
|
+
this.autoResizeManager?.disable();
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
const We = new Zt(), er = () => ({ show: Ye((r) => Be.confirm.show(r), []) }), dr = er;
|
|
1022
|
+
function tr() {
|
|
1023
|
+
const [s, r] = D(void 0);
|
|
1024
|
+
return N(() => {
|
|
1025
|
+
(async () => {
|
|
1026
|
+
const i = await We.getIsYateam();
|
|
1027
|
+
r(i);
|
|
1028
|
+
})();
|
|
1029
|
+
}, []), s;
|
|
1030
|
+
}
|
|
1031
|
+
function Ve() {
|
|
1032
|
+
const [s, r] = D(void 0);
|
|
1033
|
+
return N(() => de("language.changed", (i) => {
|
|
1034
|
+
r(i);
|
|
1035
|
+
}), []), s;
|
|
1036
|
+
}
|
|
1037
|
+
const rr = (s = "ru") => {
|
|
1038
|
+
const r = Ve();
|
|
1039
|
+
return (a) => Xt(a, r, s);
|
|
1040
|
+
}, fr = rr;
|
|
1041
|
+
function nr() {
|
|
1042
|
+
const [s, r] = D(void 0);
|
|
1043
|
+
return N(() => de("theme.changed", (i) => {
|
|
1044
|
+
r(i);
|
|
1045
|
+
}), []), s;
|
|
1046
|
+
}
|
|
1047
|
+
const ir = () => ({ add: Ye((r) => Be.toaster.add(r), []) }), gr = ir;
|
|
1048
|
+
function sr() {
|
|
1049
|
+
const [s, r] = D(void 0);
|
|
1050
|
+
return N(() => {
|
|
1051
|
+
(async () => {
|
|
1052
|
+
const i = await We.getUserId();
|
|
1053
|
+
r(i);
|
|
1054
|
+
})();
|
|
1055
|
+
}, []), s;
|
|
1056
|
+
}
|
|
1057
|
+
function ar() {
|
|
1058
|
+
const [s, r] = D(void 0);
|
|
1059
|
+
return N(() => At("context.changed", (i) => {
|
|
1060
|
+
r(i);
|
|
1061
|
+
}), []), s;
|
|
1062
|
+
}
|
|
1063
|
+
const Je = Ot(null);
|
|
1064
|
+
function hr() {
|
|
1065
|
+
const s = jt(Je);
|
|
1066
|
+
if (!s)
|
|
1067
|
+
throw new Error("useTrackerPluginContext must be used within TrackerPluginProvider");
|
|
1068
|
+
const r = nr(), a = Ve(), i = tr(), u = sr(), d = ar();
|
|
1069
|
+
return {
|
|
1070
|
+
service: P.getService(),
|
|
1071
|
+
origin: P.getOrigin(),
|
|
1072
|
+
slot: s.slot,
|
|
1073
|
+
innerUrl: s.innerUrl,
|
|
1074
|
+
queryParams: s.queryParams,
|
|
1075
|
+
registerHandler: s.registerHandler,
|
|
1076
|
+
theme: r,
|
|
1077
|
+
language: a,
|
|
1078
|
+
slotContext: d,
|
|
1079
|
+
isYateam: i,
|
|
1080
|
+
userId: u
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
const or = (s) => {
|
|
1084
|
+
try {
|
|
1085
|
+
return new URL(s, window.location.href).origin === window.location.origin;
|
|
1086
|
+
} catch {
|
|
1087
|
+
return !0;
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
function vr({
|
|
1091
|
+
children: s,
|
|
1092
|
+
autoResize: r = !0,
|
|
1093
|
+
fallback: a,
|
|
1094
|
+
errorFallback: i,
|
|
1095
|
+
autoNotifyReady: u = !0
|
|
1096
|
+
}) {
|
|
1097
|
+
const d = xt(!1), [m, p] = D(!1), [f, y] = D(null), [v, w] = D(null), O = kt(() => (x, C) => Lt(x, C), []);
|
|
1098
|
+
return N(() => {
|
|
1099
|
+
const x = (C) => {
|
|
1100
|
+
const A = C.target.closest("[href], [data-href]");
|
|
1101
|
+
if (!A) return;
|
|
1102
|
+
const I = A.getAttribute("href") || A.getAttribute("data-href");
|
|
1103
|
+
if (!I || or(I))
|
|
1104
|
+
return;
|
|
1105
|
+
C.preventDefault();
|
|
1106
|
+
const ee = A.getAttribute("target") === "_blank";
|
|
1107
|
+
P.navigate({
|
|
1108
|
+
path: I,
|
|
1109
|
+
options: {
|
|
1110
|
+
newTab: ee
|
|
1111
|
+
}
|
|
1112
|
+
}).then(() => {
|
|
1113
|
+
console.info(`Navigation: ${I}`);
|
|
1114
|
+
}).catch((te) => {
|
|
1115
|
+
console.error("Navigation error:", te);
|
|
1116
|
+
});
|
|
1117
|
+
};
|
|
1118
|
+
return document.addEventListener("click", x), () => {
|
|
1119
|
+
document.removeEventListener("click", x);
|
|
1120
|
+
};
|
|
1121
|
+
}, []), N(() => {
|
|
1122
|
+
if (d.current)
|
|
1123
|
+
return;
|
|
1124
|
+
(async () => {
|
|
1125
|
+
try {
|
|
1126
|
+
P.init({ autoResize: r }), d.current = !0, w({
|
|
1127
|
+
slot: P.getSlot(),
|
|
1128
|
+
innerUrl: P.getInnerUrl(),
|
|
1129
|
+
queryParams: P.getQueryParams(),
|
|
1130
|
+
registerHandler: O
|
|
1131
|
+
}), u && await P.notifyReady();
|
|
1132
|
+
const [C, F, A, I, R] = await Promise.allSettled([
|
|
1133
|
+
P.getTheme(),
|
|
1134
|
+
P.getLanguage(),
|
|
1135
|
+
P.getContext(),
|
|
1136
|
+
P.getIsYateam(),
|
|
1137
|
+
P.getUserId()
|
|
1138
|
+
]);
|
|
1139
|
+
C.status === "fulfilled" && C.value && B({
|
|
1140
|
+
messageId: "",
|
|
1141
|
+
type: "event",
|
|
1142
|
+
method: "theme.changed",
|
|
1143
|
+
result: C.value
|
|
1144
|
+
}), F.status === "fulfilled" && F.value && B({
|
|
1145
|
+
messageId: "",
|
|
1146
|
+
type: "event",
|
|
1147
|
+
method: "language.changed",
|
|
1148
|
+
result: F.value
|
|
1149
|
+
}), I.status === "fulfilled" && I.value && B({
|
|
1150
|
+
messageId: "",
|
|
1151
|
+
type: "event",
|
|
1152
|
+
method: "isYateam.changed",
|
|
1153
|
+
result: I.value
|
|
1154
|
+
}), R.status === "fulfilled" && R.value && B({
|
|
1155
|
+
messageId: "",
|
|
1156
|
+
type: "event",
|
|
1157
|
+
method: "userId.changed",
|
|
1158
|
+
result: R.value
|
|
1159
|
+
}), A.status === "fulfilled" && A.value && B({
|
|
1160
|
+
messageId: "",
|
|
1161
|
+
type: "event",
|
|
1162
|
+
method: "context.changed",
|
|
1163
|
+
result: A.value
|
|
1164
|
+
}), p(!0);
|
|
1165
|
+
} catch (C) {
|
|
1166
|
+
y(C);
|
|
1167
|
+
}
|
|
1168
|
+
})();
|
|
1169
|
+
}, [r, O, u]), f ? i ? /* @__PURE__ */ E.jsx(E.Fragment, { children: i(f) }) : /* @__PURE__ */ E.jsx(ze, { error: f }) : !m || !v ? /* @__PURE__ */ E.jsx(E.Fragment, { children: a }) : /* @__PURE__ */ E.jsx(
|
|
1170
|
+
Dt,
|
|
1171
|
+
{
|
|
1172
|
+
fallback: i || ((x) => /* @__PURE__ */ E.jsx(ze, { error: x })),
|
|
1173
|
+
children: /* @__PURE__ */ E.jsx(Je.Provider, { value: v, children: s })
|
|
1174
|
+
}
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
export {
|
|
1178
|
+
yr as METHOD_NOT_SUPPORTED,
|
|
1179
|
+
Er as MISSING_REQUIRED_SCOPE,
|
|
1180
|
+
br as PLUGIN_ID_IS_NOT_CORRECT,
|
|
1181
|
+
Rr as PLUGIN_ID_OR_SLOT_NOT_PROVIDED,
|
|
1182
|
+
_r as PluginActionError,
|
|
1183
|
+
ze as PluginError,
|
|
1184
|
+
cr as PluginLoader,
|
|
1185
|
+
vr as TrackerPluginProvider,
|
|
1186
|
+
wr as UNKNOWN_ERROR,
|
|
1187
|
+
Ir as VALIDATION_ERROR,
|
|
1188
|
+
Sr as getField,
|
|
1189
|
+
Tr as getLocalizedString,
|
|
1190
|
+
Cr as hostApi,
|
|
1191
|
+
Pr as trackerApi,
|
|
1192
|
+
Or as uiApi,
|
|
1193
|
+
dr as useConfirm,
|
|
1194
|
+
fr as useLocalizedString,
|
|
1195
|
+
gr as useToaster,
|
|
1196
|
+
hr as useTrackerPluginContext
|
|
1197
|
+
};
|
|
1198
|
+
//# sourceMappingURL=index.mjs.map
|