useblocks 1.1.71 → 1.1.81
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/CHANGELOG.md +426 -0
- package/README.md +38 -0
- package/iframe/js/amp.Da_6yDxX.js +1 -0
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.js +1 -1
- package/iframe/js/rules.4N5s3OV-.js +1 -1
- package/package.json +30 -9
- package/static/core/1ab52017.js +2134 -0
- package/static/core/4296ff4b.js +3280 -0
- package/static/core/{63206e112.js → 496a28e52.js} +2682 -2421
- package/static/core/{9ab1c444.js → 5cc21a00.js} +2302 -2432
- package/static/core/{b9b92e01.js → 6a3ea43c.js} +15 -15
- package/static/core/{e02024fb2.js → 6fc5508e2.js} +69 -69
- package/static/core/{ea6c5c93.js → 7cff1d56.js} +3327 -2997
- package/static/core/87de8255.js +1098 -0
- package/static/core/{3f22a9d32.js → 909c874d2.js} +1196 -1123
- package/static/core/{c3b45fb6.js → ace7c2d1.js} +7 -7
- package/static/core/{5e082e16.js → c287f8b6.js} +38 -38
- package/static/core/{585259872.js → cc4c61c42.js} +108 -108
- package/static/core/{222d29d9.js → d2293148.js} +272 -248
- package/static/core/{e4d01015.js → d70b5c31.js} +22367 -19437
- package/static/core/{68ec11c8.js → dfbad00e.js} +4 -4
- package/static/core/{ce9be2ec2.js → f2b0c97b2.js} +2138 -2086
- package/static/core/{d3bbb05e.js → f7e3905a.js} +3 -3
- package/static/core/{513594a8.js → fc514220.js} +34 -34
- package/static/umd-runtime/ui-kit.js +1171 -1103
- package/ui-kit/index.js +1541 -1469
- package/{useblocks-core.77131b3d.js → useblocks-core.0a682f7d.js} +6 -6
- package/useblocks-esm.js +4 -4
- package/{useblocks-po.77131b3d.js → useblocks-po.0a682f7d.js} +1 -1
- package/useblocks.d.ts +66 -0
- package/useblocks.js +3 -3
- package/favicon-b.ico +0 -0
- package/favicon.ico +0 -0
- package/fonts/SegoeUI-Bold.woff2 +0 -0
- package/fonts/SegoeUI-Semibold.woff2 +0 -0
- package/fonts/SegoeUI.woff2 +0 -0
- package/iframe/js/amp.DllX-Im0.js +0 -1
- package/js/amplitude.min.js +0 -10859
- package/js/sourcebuster.min.js +0 -672
- package/manifest.json +0 -17
- package/npm-publish.manifest.json +0 -51
- package/static/core/23546a64.js +0 -925
- package/static/core/35ad3ae5.js +0 -3150
- package/static/core/36bf6931.js +0 -2119
- package/static/media/image-editor/images/samples/large_sample.jpg +0 -0
- package/static/media/image-editor/images/samples/sample1.jpg +0 -0
- package/static/media/image-editor/images/samples/sample1_thumbnail.jpg +0 -0
- package/static/media/image-editor/images/samples/sample2.jpg +0 -0
- package/static/media/image-editor/images/samples/sample2_thumbnail.jpg +0 -0
- package/static/media/image-editor/images/samples/sample3.jpg +0 -0
- package/static/media/image-editor/images/samples/sample3_thumbnail.jpg +0 -0
- package/static/media/image-editor/images/samples/sample4.json +0 -871
- package/static/media/image-editor/images/samples/sample4_preview.jpg +0 -0
- package/test-font.otf +0 -0
- package/test-font.ttf +0 -0
- package/test-font.woff2 +0 -0
- package/tsconfig.json +0 -14
- package/two_step_headless_plugin.html +0 -558
- /package/iframe/{iframe-eblock.77131b3d.html → iframe-eblock.0a682f7d.html} +0 -0
- /package/iframe/{iframe.77131b3d.html → iframe.0a682f7d.html} +0 -0
|
@@ -0,0 +1,1098 @@
|
|
|
1
|
+
__useblocks__.define("static/core/87de8255.js", [
|
|
2
|
+
"require",
|
|
3
|
+
"exports",
|
|
4
|
+
"module",
|
|
5
|
+
"static/core/df237243.js",
|
|
6
|
+
"static/core/7cff1d56.js"
|
|
7
|
+
], function(Ae, g, tr) {
|
|
8
|
+
const Ze = Ae("./df237243.js"), d = Ae("./7cff1d56.js");
|
|
9
|
+
function Oe(r) {
|
|
10
|
+
return function(e) {
|
|
11
|
+
return {
|
|
12
|
+
setOptions: () => {},
|
|
13
|
+
instance: {},
|
|
14
|
+
dispose: () => {},
|
|
15
|
+
...r(e) || {}
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function et(r) {
|
|
20
|
+
return (e) => {
|
|
21
|
+
const n = {}, a = [];
|
|
22
|
+
for (const m of r) a.push(m(e));
|
|
23
|
+
for (const m of a) Object.assign(n, m.instance);
|
|
24
|
+
return {
|
|
25
|
+
instance: n,
|
|
26
|
+
setOptions: async (m) => {
|
|
27
|
+
for (const S of a) await S.setOptions(m);
|
|
28
|
+
},
|
|
29
|
+
dispose: () => {
|
|
30
|
+
for (const m of a) m.dispose();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function tt(r) {
|
|
36
|
+
const e = r.replace(/-/g, "+").replace(/_/g, "/").padEnd(r.length + (4 - r.length % 4) % 4, "="), n = atob(e), a = new Uint8Array(n.length);
|
|
37
|
+
for (let s = 0; s < n.length; s++) a[s] = n.charCodeAt(s);
|
|
38
|
+
return new TextDecoder().decode(a);
|
|
39
|
+
}
|
|
40
|
+
function Ce(r) {
|
|
41
|
+
const [e, n, a] = r.split("."), s = JSON.parse(tt(n));
|
|
42
|
+
return {
|
|
43
|
+
exp: s.exp,
|
|
44
|
+
createdAt: s.iat,
|
|
45
|
+
data: s
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var le = d.createIdentifier$1(), Re = new WeakMap(), rt = 3e4;
|
|
49
|
+
function nt(r) {
|
|
50
|
+
let e;
|
|
51
|
+
try {
|
|
52
|
+
e = Ce(r).exp;
|
|
53
|
+
} catch {
|
|
54
|
+
return !0;
|
|
55
|
+
}
|
|
56
|
+
return typeof e != "number" || !Number.isFinite(e) ? !0 : e * 1e3 <= Date.now() + rt;
|
|
57
|
+
}
|
|
58
|
+
function Le(r, e, n, a) {
|
|
59
|
+
const s = Re.get(r);
|
|
60
|
+
s && (s.stale = !0);
|
|
61
|
+
const u = { stale: !1 };
|
|
62
|
+
Re.set(r, u), r.injectFactory(le, async (m, S) => {
|
|
63
|
+
if (u.stale) return "";
|
|
64
|
+
try {
|
|
65
|
+
let E = await S || void 0;
|
|
66
|
+
if (!E) {
|
|
67
|
+
const _ = r.getInstance(d.STANDALONE_BOOTSTRAP_TOKEN_ID);
|
|
68
|
+
_ && (E = await _);
|
|
69
|
+
}
|
|
70
|
+
return e ? !E || nt(E) ? await e(n, a, E) : E : "";
|
|
71
|
+
} catch {
|
|
72
|
+
return "";
|
|
73
|
+
}
|
|
74
|
+
}, !0);
|
|
75
|
+
}
|
|
76
|
+
var at = Oe((r) => {
|
|
77
|
+
let e, n, a;
|
|
78
|
+
return r.addService(d.REQUEST_HANDLER_ID, { execute: async (s) => {
|
|
79
|
+
if (e) {
|
|
80
|
+
const u = await r.getInstanceAsync(le);
|
|
81
|
+
u && s.headers.append("authorization", `Bearer ${u}`);
|
|
82
|
+
}
|
|
83
|
+
} }), { setOptions(s) {
|
|
84
|
+
const u = !d.deepEqual(n, s.user), m = a !== s.project;
|
|
85
|
+
(e !== s.getAuthToken || u || m) && (e = s.getAuthToken, n = s.user, a = s.project, Le(r, e, s.user, s.project));
|
|
86
|
+
} };
|
|
87
|
+
}), Me = Ze.__commonJSMin(((r, e) => {
|
|
88
|
+
(function(n) {
|
|
89
|
+
"use strict";
|
|
90
|
+
var a = n.setTimeout, s = n.clearTimeout, u = n.XMLHttpRequest, m = n.XDomainRequest, S = n.ActiveXObject, E = n.EventSource, _ = n.document, W = n.Promise, F = n.fetch, q = n.Response, G = n.TextDecoder, x = n.TextEncoder, X = n.AbortController;
|
|
91
|
+
if (typeof window < "u" && typeof _ < "u" && !("readyState" in _) && _.body == null && (_.readyState = "loading", window.addEventListener("load", function(t) {
|
|
92
|
+
_.readyState = "complete";
|
|
93
|
+
}, !1)), u == null && S != null && (u = function() {
|
|
94
|
+
return new S("Microsoft.XMLHTTP");
|
|
95
|
+
}), Object.create == null && (Object.create = function(t) {
|
|
96
|
+
function o() {}
|
|
97
|
+
return o.prototype = t, new o();
|
|
98
|
+
}), Date.now || (Date.now = function() {
|
|
99
|
+
return new Date().getTime();
|
|
100
|
+
}), X == null) {
|
|
101
|
+
var K = F;
|
|
102
|
+
F = function(t, o) {
|
|
103
|
+
var c = o.signal;
|
|
104
|
+
return K(t, {
|
|
105
|
+
headers: o.headers,
|
|
106
|
+
credentials: o.credentials,
|
|
107
|
+
cache: o.cache
|
|
108
|
+
}).then(function(i) {
|
|
109
|
+
var f = i.body.getReader();
|
|
110
|
+
return c._reader = f, c._aborted && c._reader.cancel(), {
|
|
111
|
+
status: i.status,
|
|
112
|
+
statusText: i.statusText,
|
|
113
|
+
headers: i.headers,
|
|
114
|
+
body: { getReader: function() {
|
|
115
|
+
return f;
|
|
116
|
+
} }
|
|
117
|
+
};
|
|
118
|
+
});
|
|
119
|
+
}, X = function() {
|
|
120
|
+
this.signal = {
|
|
121
|
+
_reader: null,
|
|
122
|
+
_aborted: !1
|
|
123
|
+
}, this.abort = function() {
|
|
124
|
+
this.signal._reader != null && this.signal._reader.cancel(), this.signal._aborted = !0;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function ye() {
|
|
129
|
+
this.bitsNeeded = 0, this.codePoint = 0;
|
|
130
|
+
}
|
|
131
|
+
ye.prototype.decode = function(t) {
|
|
132
|
+
function o(h, P, p) {
|
|
133
|
+
if (p === 1) return h >= 128 >> P && h << P <= 2047;
|
|
134
|
+
if (p === 2) return h >= 2048 >> P && h << P <= 55295 || h >= 57344 >> P && h << P <= 65535;
|
|
135
|
+
if (p === 3) return h >= 65536 >> P && h << P <= 1114111;
|
|
136
|
+
throw new Error();
|
|
137
|
+
}
|
|
138
|
+
function c(h, P) {
|
|
139
|
+
if (h === 6) return P >> 6 > 15 ? 3 : P > 31 ? 2 : 1;
|
|
140
|
+
if (h === 12) return P > 15 ? 3 : 2;
|
|
141
|
+
if (h === 18) return 3;
|
|
142
|
+
throw new Error();
|
|
143
|
+
}
|
|
144
|
+
for (var i = 65533, f = "", l = this.bitsNeeded, y = this.codePoint, T = 0; T < t.length; T += 1) {
|
|
145
|
+
var v = t[T];
|
|
146
|
+
l !== 0 && (v < 128 || v > 191 || !o(y << 6 | v & 63, l - 6, c(l, y))) && (l = 0, y = i, f += String.fromCharCode(y)), l === 0 ? (v >= 0 && v <= 127 ? (l = 0, y = v) : v >= 192 && v <= 223 ? (l = 6, y = v & 31) : v >= 224 && v <= 239 ? (l = 12, y = v & 15) : v >= 240 && v <= 247 ? (l = 18, y = v & 7) : (l = 0, y = i), l !== 0 && !o(y, l, c(l, y)) && (l = 0, y = i)) : (l -= 6, y = y << 6 | v & 63), l === 0 && (y <= 65535 ? f += String.fromCharCode(y) : (f += String.fromCharCode(55296 + (y - 65535 - 1 >> 10)), f += String.fromCharCode(56320 + (y - 65535 - 1 & 1023))));
|
|
147
|
+
}
|
|
148
|
+
return this.bitsNeeded = l, this.codePoint = y, f;
|
|
149
|
+
};
|
|
150
|
+
var Wt = function() {
|
|
151
|
+
try {
|
|
152
|
+
return new G().decode(new x().encode("test"), { stream: !0 }) === "test";
|
|
153
|
+
} catch {}
|
|
154
|
+
return !1;
|
|
155
|
+
};
|
|
156
|
+
(G == null || x == null || !Wt()) && (G = ye);
|
|
157
|
+
var N = function() {};
|
|
158
|
+
function J(t) {
|
|
159
|
+
this.withCredentials = !1, this.readyState = 0, this.status = 0, this.statusText = "", this.responseText = "", this.onprogress = N, this.onload = N, this.onerror = N, this.onreadystatechange = N, this._contentType = "", this._xhr = t, this._sendTimeout = 0, this._abort = N;
|
|
160
|
+
}
|
|
161
|
+
J.prototype.open = function(t, o) {
|
|
162
|
+
this._abort(!0);
|
|
163
|
+
var c = this, i = this._xhr, f = 1, l = 0;
|
|
164
|
+
this._abort = function(p) {
|
|
165
|
+
c._sendTimeout !== 0 && (s(c._sendTimeout), c._sendTimeout = 0), (f === 1 || f === 2 || f === 3) && (f = 4, i.onload = N, i.onerror = N, i.onabort = N, i.onprogress = N, i.onreadystatechange = N, i.abort(), l !== 0 && (s(l), l = 0), p || (c.readyState = 4, c.onabort(null), c.onreadystatechange())), f = 0;
|
|
166
|
+
};
|
|
167
|
+
var y = function() {
|
|
168
|
+
if (f === 1) {
|
|
169
|
+
var p = 0, b = "", k = void 0;
|
|
170
|
+
if ("contentType" in i) p = 200, b = "OK", k = i.contentType;
|
|
171
|
+
else try {
|
|
172
|
+
p = i.status, b = i.statusText, k = i.getResponseHeader("Content-Type");
|
|
173
|
+
} catch {
|
|
174
|
+
p = 0, b = "", k = void 0;
|
|
175
|
+
}
|
|
176
|
+
p !== 0 && (f = 2, c.readyState = 2, c.status = p, c.statusText = b, c._contentType = k, c.onreadystatechange());
|
|
177
|
+
}
|
|
178
|
+
}, T = function() {
|
|
179
|
+
if (y(), f === 2 || f === 3) {
|
|
180
|
+
f = 3;
|
|
181
|
+
var p = "";
|
|
182
|
+
try {
|
|
183
|
+
p = i.responseText;
|
|
184
|
+
} catch {}
|
|
185
|
+
c.readyState = 3, c.responseText = p, c.onprogress();
|
|
186
|
+
}
|
|
187
|
+
}, v = function(p, b) {
|
|
188
|
+
if ((b == null || b.preventDefault == null) && (b = { preventDefault: N }), T(), f === 1 || f === 2 || f === 3) {
|
|
189
|
+
if (f = 4, l !== 0 && (s(l), l = 0), c.readyState = 4, p === "load") c.onload(b);
|
|
190
|
+
else if (p === "error") c.onerror(b);
|
|
191
|
+
else if (p === "abort") c.onabort(b);
|
|
192
|
+
else throw new TypeError();
|
|
193
|
+
c.onreadystatechange();
|
|
194
|
+
}
|
|
195
|
+
}, h = function(p) {
|
|
196
|
+
i != null && (i.readyState === 4 ? (!("onload" in i) || !("onerror" in i) || !("onabort" in i)) && v(i.responseText === "" ? "error" : "load", p) : i.readyState === 3 ? "onprogress" in i || T() : i.readyState === 2 && y());
|
|
197
|
+
}, P = function() {
|
|
198
|
+
l = a(function() {
|
|
199
|
+
P();
|
|
200
|
+
}, 500), i.readyState === 3 && T();
|
|
201
|
+
};
|
|
202
|
+
"onload" in i && (i.onload = function(p) {
|
|
203
|
+
v("load", p);
|
|
204
|
+
}), "onerror" in i && (i.onerror = function(p) {
|
|
205
|
+
v("error", p);
|
|
206
|
+
}), "onabort" in i && (i.onabort = function(p) {
|
|
207
|
+
v("abort", p);
|
|
208
|
+
}), "onprogress" in i && (i.onprogress = T), "onreadystatechange" in i && (i.onreadystatechange = function(p) {
|
|
209
|
+
h(p);
|
|
210
|
+
}), ("contentType" in i || !("ontimeout" in u.prototype)) && (o += (o.indexOf("?") === -1 ? "?" : "&") + "padding=true"), i.open(t, o, !0), "readyState" in i && (l = a(function() {
|
|
211
|
+
P();
|
|
212
|
+
}, 0));
|
|
213
|
+
}, J.prototype.abort = function() {
|
|
214
|
+
this._abort(!1);
|
|
215
|
+
}, J.prototype.getResponseHeader = function(t) {
|
|
216
|
+
return this._contentType;
|
|
217
|
+
}, J.prototype.setRequestHeader = function(t, o) {
|
|
218
|
+
var c = this._xhr;
|
|
219
|
+
"setRequestHeader" in c && c.setRequestHeader(t, o);
|
|
220
|
+
}, J.prototype.getAllResponseHeaders = function() {
|
|
221
|
+
return this._xhr.getAllResponseHeaders != null && this._xhr.getAllResponseHeaders() || "";
|
|
222
|
+
}, J.prototype.send = function() {
|
|
223
|
+
if ((!("ontimeout" in u.prototype) || !("sendAsBinary" in u.prototype) && !("mozAnon" in u.prototype)) && _ != null && _.readyState != null && _.readyState !== "complete") {
|
|
224
|
+
var t = this;
|
|
225
|
+
t._sendTimeout = a(function() {
|
|
226
|
+
t._sendTimeout = 0, t.send();
|
|
227
|
+
}, 4);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
var o = this._xhr;
|
|
231
|
+
"withCredentials" in o && (o.withCredentials = this.withCredentials);
|
|
232
|
+
try {
|
|
233
|
+
o.send(void 0);
|
|
234
|
+
} catch (c) {
|
|
235
|
+
throw c;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
function Be(t) {
|
|
239
|
+
return t.replace(/[A-Z]/g, function(o) {
|
|
240
|
+
return String.fromCharCode(o.charCodeAt(0) + 32);
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function ze(t) {
|
|
244
|
+
for (var o = Object.create(null), c = t.split(`\r
|
|
245
|
+
`), i = 0; i < c.length; i += 1) {
|
|
246
|
+
var f = c[i].split(": "), l = f.shift(), y = f.join(": ");
|
|
247
|
+
o[Be(l)] = y;
|
|
248
|
+
}
|
|
249
|
+
this._map = o;
|
|
250
|
+
}
|
|
251
|
+
ze.prototype.get = function(t) {
|
|
252
|
+
return this._map[Be(t)];
|
|
253
|
+
}, u != null && u.HEADERS_RECEIVED == null && (u.HEADERS_RECEIVED = 2);
|
|
254
|
+
function He() {}
|
|
255
|
+
He.prototype.open = function(t, o, c, i, f, l, y) {
|
|
256
|
+
t.open("GET", f);
|
|
257
|
+
var T = 0;
|
|
258
|
+
t.onprogress = function() {
|
|
259
|
+
var h = t.responseText.slice(T);
|
|
260
|
+
T += h.length, c(h);
|
|
261
|
+
}, t.onerror = function(h) {
|
|
262
|
+
h.preventDefault(), i(new Error("NetworkError"));
|
|
263
|
+
}, t.onload = function() {
|
|
264
|
+
i(null);
|
|
265
|
+
}, t.onabort = function() {
|
|
266
|
+
i(null);
|
|
267
|
+
}, t.onreadystatechange = function() {
|
|
268
|
+
if (t.readyState === u.HEADERS_RECEIVED) {
|
|
269
|
+
var h = t.status, P = t.statusText;
|
|
270
|
+
o(h, P, t.getResponseHeader("Content-Type"), new ze(t.getAllResponseHeaders()));
|
|
271
|
+
}
|
|
272
|
+
}, t.withCredentials = l;
|
|
273
|
+
for (var v in y) Object.prototype.hasOwnProperty.call(y, v) && t.setRequestHeader(v, y[v]);
|
|
274
|
+
return t.send(), t;
|
|
275
|
+
};
|
|
276
|
+
function We(t) {
|
|
277
|
+
this._headers = t;
|
|
278
|
+
}
|
|
279
|
+
We.prototype.get = function(t) {
|
|
280
|
+
return this._headers.get(t);
|
|
281
|
+
};
|
|
282
|
+
function Ve() {}
|
|
283
|
+
Ve.prototype.open = function(t, o, c, i, f, l, y) {
|
|
284
|
+
var T = null, v = new X(), h = v.signal, P = new G();
|
|
285
|
+
return F(f, {
|
|
286
|
+
headers: y,
|
|
287
|
+
credentials: l ? "include" : "same-origin",
|
|
288
|
+
signal: h,
|
|
289
|
+
cache: "no-store"
|
|
290
|
+
}).then(function(p) {
|
|
291
|
+
return T = p.body.getReader(), o(p.status, p.statusText, p.headers.get("Content-Type"), new We(p.headers)), new W(function(b, k) {
|
|
292
|
+
var ce = function() {
|
|
293
|
+
T.read().then(function(C) {
|
|
294
|
+
C.done ? b(void 0) : (c(P.decode(C.value, { stream: !0 })), ce());
|
|
295
|
+
}).catch(function(C) {
|
|
296
|
+
k(C);
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
ce();
|
|
300
|
+
});
|
|
301
|
+
}).catch(function(p) {
|
|
302
|
+
if (p.name !== "AbortError") return p;
|
|
303
|
+
}).then(function(p) {
|
|
304
|
+
i(p);
|
|
305
|
+
}), { abort: function() {
|
|
306
|
+
T?.cancel(), v.abort();
|
|
307
|
+
} };
|
|
308
|
+
};
|
|
309
|
+
function oe() {
|
|
310
|
+
this._listeners = Object.create(null);
|
|
311
|
+
}
|
|
312
|
+
function $e(t) {
|
|
313
|
+
a(function() {
|
|
314
|
+
throw t;
|
|
315
|
+
}, 0);
|
|
316
|
+
}
|
|
317
|
+
oe.prototype.dispatchEvent = function(t) {
|
|
318
|
+
t.target = this;
|
|
319
|
+
var o = this._listeners[t.type];
|
|
320
|
+
if (o != null) for (var c = o.length, i = 0; i < c; i += 1) {
|
|
321
|
+
var f = o[i];
|
|
322
|
+
try {
|
|
323
|
+
typeof f.handleEvent == "function" ? f.handleEvent(t) : f.call(this, t);
|
|
324
|
+
} catch (l) {
|
|
325
|
+
$e(l);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}, oe.prototype.addEventListener = function(t, o) {
|
|
329
|
+
t = String(t);
|
|
330
|
+
var c = this._listeners, i = c[t];
|
|
331
|
+
i == null && (i = [], c[t] = i);
|
|
332
|
+
for (var f = !1, l = 0; l < i.length; l += 1) i[l] === o && (f = !0);
|
|
333
|
+
f || i.push(o);
|
|
334
|
+
}, oe.prototype.removeEventListener = function(t, o) {
|
|
335
|
+
t = String(t);
|
|
336
|
+
var c = this._listeners, i = c[t];
|
|
337
|
+
if (i != null) {
|
|
338
|
+
for (var f = [], l = 0; l < i.length; l += 1) i[l] !== o && f.push(i[l]);
|
|
339
|
+
f.length === 0 ? delete c[t] : c[t] = f;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
function Z(t) {
|
|
343
|
+
this.type = t, this.target = void 0;
|
|
344
|
+
}
|
|
345
|
+
function Xe(t, o) {
|
|
346
|
+
Z.call(this, t), this.data = o.data, this.lastEventId = o.lastEventId;
|
|
347
|
+
}
|
|
348
|
+
Xe.prototype = Object.create(Z.prototype);
|
|
349
|
+
function Pe(t, o) {
|
|
350
|
+
Z.call(this, t), this.status = o.status, this.statusText = o.statusText, this.headers = o.headers;
|
|
351
|
+
}
|
|
352
|
+
Pe.prototype = Object.create(Z.prototype);
|
|
353
|
+
function Je(t, o) {
|
|
354
|
+
Z.call(this, t), this.error = o.error;
|
|
355
|
+
}
|
|
356
|
+
Je.prototype = Object.create(Z.prototype);
|
|
357
|
+
var Te = -1, V = 0, ee = 1, se = 2, be = -1, $ = 0, we = 1, Ye = 2, Vt = 3, $t = /^text\/event\-stream(;.*)?$/i, Xt = 1e3, Jt = 18e6, Ee = function(t, o) {
|
|
358
|
+
var c = t == null ? o : parseInt(t, 10);
|
|
359
|
+
return c !== c && (c = o), je(c);
|
|
360
|
+
}, je = function(t) {
|
|
361
|
+
return Math.min(Math.max(t, Xt), Jt);
|
|
362
|
+
}, te = function(t, o, c) {
|
|
363
|
+
try {
|
|
364
|
+
typeof o == "function" && o.call(t, c);
|
|
365
|
+
} catch (i) {
|
|
366
|
+
$e(i);
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
function D(t, o) {
|
|
370
|
+
oe.call(this), o = o || {}, this.onopen = void 0, this.onmessage = void 0, this.onerror = void 0, this.url = void 0, this.readyState = void 0, this.withCredentials = void 0, this.headers = void 0, this._close = void 0, Kt(this, t, o);
|
|
371
|
+
}
|
|
372
|
+
function Yt() {
|
|
373
|
+
return u != null && "withCredentials" in u.prototype || m == null ? new u() : new m();
|
|
374
|
+
}
|
|
375
|
+
var xt = F != null && q != null && "body" in q.prototype;
|
|
376
|
+
function Kt(t, o, c) {
|
|
377
|
+
o = String(o);
|
|
378
|
+
var i = !!c.withCredentials, f = c.lastEventIdQueryParameterName || "lastEventId", l = je(1e3), y = Ee(c.heartbeatTimeout, 45e3), T = "", v = l, h = !1, P = 0, p = c.headers || {}, b = c.Transport, k = xt && b == null ? void 0 : new J(b != null ? new b() : Yt()), ce = b != null && typeof b != "string" ? new b() : k == null ? new Ve() : new He(), C = void 0, R = 0, Q = Te, re = "", ve = "", B = "", he = "", A = $, _e = 0, Y = 0, Zt = function(j, w, L, M) {
|
|
379
|
+
if (Q === V) if (j === 200 && L != null && $t.test(L)) {
|
|
380
|
+
Q = ee, h = Date.now(), v = l, t.readyState = ee;
|
|
381
|
+
var O = new Pe("open", {
|
|
382
|
+
status: j,
|
|
383
|
+
statusText: w,
|
|
384
|
+
headers: M
|
|
385
|
+
});
|
|
386
|
+
t.dispatchEvent(O), te(t, t.onopen, O);
|
|
387
|
+
} else {
|
|
388
|
+
j !== 200 ? (w && (w = w.replace(/\s+/g, " ")), "" + j + w) : "" + (L == null ? "-" : L.replace(/\s+/g, " ")), Ie();
|
|
389
|
+
var O = new Pe("error", {
|
|
390
|
+
status: j,
|
|
391
|
+
statusText: w,
|
|
392
|
+
headers: M
|
|
393
|
+
});
|
|
394
|
+
t.dispatchEvent(O), te(t, t.onerror, O);
|
|
395
|
+
}
|
|
396
|
+
}, er = function(j) {
|
|
397
|
+
if (Q === ee) {
|
|
398
|
+
for (var w = -1, L = 0; L < j.length; L += 1) {
|
|
399
|
+
var M = j.charCodeAt(L);
|
|
400
|
+
(M === 10 || M === 13) && (w = L);
|
|
401
|
+
}
|
|
402
|
+
var O = (w !== -1 ? he : "") + j.slice(0, w + 1);
|
|
403
|
+
he = (w === -1 ? he : "") + j.slice(w + 1), j !== "" && (h = Date.now(), P += j.length);
|
|
404
|
+
for (var I = 0; I < O.length; I += 1) {
|
|
405
|
+
var M = O.charCodeAt(I);
|
|
406
|
+
if (A === be && M === 10) A = $;
|
|
407
|
+
else if (A === be && (A = $), M === 13 || M === 10) {
|
|
408
|
+
if (A !== $) {
|
|
409
|
+
A === we && (Y = I + 1);
|
|
410
|
+
var z = O.slice(_e, Y - 1), H = O.slice(Y + (Y < I && O.charCodeAt(Y) === 32 ? 1 : 0), I);
|
|
411
|
+
z === "data" ? (re += `
|
|
412
|
+
`, re += H) : z === "id" ? ve = H : z === "event" ? B = H : z === "retry" ? (l = Ee(H, l), v = l) : z === "heartbeatTimeout" && (y = Ee(H, y), R !== 0 && (s(R), R = a(function() {
|
|
413
|
+
ue();
|
|
414
|
+
}, y)));
|
|
415
|
+
}
|
|
416
|
+
if (A === $) {
|
|
417
|
+
if (re !== "") {
|
|
418
|
+
T = ve, B === "" && (B = "message");
|
|
419
|
+
var ne = new Xe(B, {
|
|
420
|
+
data: re.slice(1),
|
|
421
|
+
lastEventId: ve
|
|
422
|
+
});
|
|
423
|
+
if (t.dispatchEvent(ne), B === "open" ? te(t, t.onopen, ne) : B === "message" ? te(t, t.onmessage, ne) : B === "error" && te(t, t.onerror, ne), Q === se) return;
|
|
424
|
+
}
|
|
425
|
+
re = "", B = "";
|
|
426
|
+
}
|
|
427
|
+
A = M === 13 ? be : $;
|
|
428
|
+
} else A === $ && (_e = I, A = we), A === we ? M === 58 && (Y = I + 1, A = Ye) : A === Ye && (A = Vt);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}, Ke = function(j) {
|
|
432
|
+
if (Q === ee || Q === V) {
|
|
433
|
+
Q = Te, R !== 0 && (s(R), R = 0), R = a(function() {
|
|
434
|
+
ue();
|
|
435
|
+
}, v), v = je(Math.min(l * 16, v * 2)), t.readyState = V;
|
|
436
|
+
var w = new Je("error", { error: j });
|
|
437
|
+
t.dispatchEvent(w), te(t, t.onerror, w);
|
|
438
|
+
}
|
|
439
|
+
}, Ie = function() {
|
|
440
|
+
Q = se, C != null && (C.abort(), C = void 0), R !== 0 && (s(R), R = 0), t.readyState = se;
|
|
441
|
+
}, ue = function() {
|
|
442
|
+
if (R = 0, Q !== Te) {
|
|
443
|
+
if (!h && C != null) Ke(new Error("No activity within " + y + " milliseconds. " + (Q === V ? "No response received." : P + " chars received.") + " Reconnecting.")), C != null && (C.abort(), C = void 0);
|
|
444
|
+
else {
|
|
445
|
+
var j = Math.max((h || Date.now()) + y - Date.now(), 1);
|
|
446
|
+
h = !1, R = a(function() {
|
|
447
|
+
ue();
|
|
448
|
+
}, j);
|
|
449
|
+
}
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
h = !1, P = 0, R = a(function() {
|
|
453
|
+
ue();
|
|
454
|
+
}, y), Q = V, re = "", B = "", ve = T, he = "", _e = 0, Y = 0, A = $;
|
|
455
|
+
var w = o;
|
|
456
|
+
if (o.slice(0, 5) !== "data:" && o.slice(0, 5) !== "blob:" && T !== "") {
|
|
457
|
+
var L = o.indexOf("?");
|
|
458
|
+
w = L === -1 ? o : o.slice(0, L + 1) + o.slice(L + 1).replace(/(?:^|&)([^=&]*)(?:=[^&]*)?/g, function(H, ne) {
|
|
459
|
+
return ne === f ? "" : H;
|
|
460
|
+
}), w += (o.indexOf("?") === -1 ? "?" : "&") + f + "=" + encodeURIComponent(T);
|
|
461
|
+
}
|
|
462
|
+
var M = t.withCredentials, O = {};
|
|
463
|
+
O.Accept = "text/event-stream";
|
|
464
|
+
var I = t.headers;
|
|
465
|
+
if (I != null) for (var z in I) Object.prototype.hasOwnProperty.call(I, z) && (O[z] = I[z]);
|
|
466
|
+
try {
|
|
467
|
+
C = ce.open(k, Zt, er, Ke, w, M, O);
|
|
468
|
+
} catch (H) {
|
|
469
|
+
throw Ie(), H;
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
t.url = o, t.readyState = V, t.withCredentials = i, t.headers = p, t._close = Ie, ue();
|
|
473
|
+
}
|
|
474
|
+
D.prototype = Object.create(oe.prototype), D.prototype.CONNECTING = V, D.prototype.OPEN = ee, D.prototype.CLOSED = se, D.prototype.close = function() {
|
|
475
|
+
this._close();
|
|
476
|
+
}, D.CONNECTING = V, D.OPEN = ee, D.CLOSED = se, D.prototype.withCredentials = void 0;
|
|
477
|
+
var xe = E;
|
|
478
|
+
u != null && (E == null || !("withCredentials" in E.prototype)) && (xe = D), (function(t) {
|
|
479
|
+
if (typeof e == "object" && typeof e.exports == "object") {
|
|
480
|
+
var o = t(r);
|
|
481
|
+
o !== void 0 && (e.exports = o);
|
|
482
|
+
} else typeof define == "function" && define.amd ? define(["exports"], t) : t(n);
|
|
483
|
+
})(function(t) {
|
|
484
|
+
t.EventSourcePolyfill = D, t.NativeEventSource = E, t.EventSource = xe;
|
|
485
|
+
});
|
|
486
|
+
})(typeof globalThis > "u" ? typeof window < "u" ? window : typeof self < "u" ? self : r : globalThis);
|
|
487
|
+
})), it = Me();
|
|
488
|
+
function ot({ candidates: r, headers: e, createEventSource: n, onMessage: a, onError: s }) {
|
|
489
|
+
const u = r.filter(Boolean);
|
|
490
|
+
let m = !1, S = null;
|
|
491
|
+
const E = () => {
|
|
492
|
+
S?.close(), S = null;
|
|
493
|
+
}, _ = (W) => {
|
|
494
|
+
if (m) return;
|
|
495
|
+
const F = u[W];
|
|
496
|
+
if (!F) {
|
|
497
|
+
s?.(new Error("Failed to connect to EventSource through proxy chain"));
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
E();
|
|
501
|
+
const q = n(F, { headers: e });
|
|
502
|
+
S = q, q.onmessage = (G) => {
|
|
503
|
+
m || S !== q || a(G);
|
|
504
|
+
}, q.onerror = (G) => {
|
|
505
|
+
if (!(m || S !== q)) {
|
|
506
|
+
if (E(), W + 1 < u.length) {
|
|
507
|
+
_(W + 1);
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
s?.(G);
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
};
|
|
514
|
+
return _(0), { close() {
|
|
515
|
+
m = !0, E();
|
|
516
|
+
} };
|
|
517
|
+
}
|
|
518
|
+
var st = "https://api.unsplash.com", ct = "https://api.giphy.com/v1/gifs";
|
|
519
|
+
function ae(r) {
|
|
520
|
+
return { error: r instanceof Error ? r : new Error(String(r)) };
|
|
521
|
+
}
|
|
522
|
+
async function de(r) {
|
|
523
|
+
if (!r.ok) throw new Error(`Request failed with status ${r.status}`);
|
|
524
|
+
const e = await r.text();
|
|
525
|
+
try {
|
|
526
|
+
return e ? JSON.parse(e) : null;
|
|
527
|
+
} catch (n) {
|
|
528
|
+
throw n;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
function ut(r) {
|
|
532
|
+
return r && Array.isArray(r.results) ? r : r?.data && Array.isArray(r.data.results) ? r.data : r?.response && Array.isArray(r.response.results) ? r.response : {
|
|
533
|
+
...r || {},
|
|
534
|
+
results: []
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
var qe = d.createApi({
|
|
538
|
+
reducerPath: "imageApi",
|
|
539
|
+
baseQuery: void 0,
|
|
540
|
+
endpoints: (r) => ({
|
|
541
|
+
getImageInfo: r.query({ queryFn: async function(e, n) {
|
|
542
|
+
try {
|
|
543
|
+
const a = n.getState().configSlice?.config?.imageInfoToolUrl || "https://scr.useblocks.io/imageinfo";
|
|
544
|
+
return { data: await de(await fetch(`${a}?url=${encodeURIComponent(e)}`)) };
|
|
545
|
+
} catch (a) {
|
|
546
|
+
return ae(a);
|
|
547
|
+
}
|
|
548
|
+
} }),
|
|
549
|
+
getSearchImage: r.query({ queryFn: async function({ query: e, page: n }, a) {
|
|
550
|
+
const s = e.keywords.replace(/[^\w\d\sа-яёА-ЯЁ]|_/g, "").replace(/[\s_-]+/g, " ");
|
|
551
|
+
try {
|
|
552
|
+
const u = a.getState().configSlice?.config, m = d.di.getInstance(a, d.SECURITY_MODULE_ID) !== void 0, S = new URL(`${st}/search/photos`);
|
|
553
|
+
return S.searchParams.set("client_id", "S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"), S.searchParams.set("lang", "ru"), S.searchParams.set("per_page", "18"), S.searchParams.set("query", s), S.searchParams.set("page", String(n)), e.color !== "" && S.searchParams.set("color", e.color), e.orientation !== "" && S.searchParams.set("orientation", e.orientation), { data: ut(await de(await d.fetchWithResourceProxy(S.toString(), {
|
|
554
|
+
config: u,
|
|
555
|
+
standalone: m,
|
|
556
|
+
resourceType: "stockImages",
|
|
557
|
+
intent: "metadata"
|
|
558
|
+
}))) };
|
|
559
|
+
} catch (u) {
|
|
560
|
+
return ae(u);
|
|
561
|
+
}
|
|
562
|
+
} }),
|
|
563
|
+
getUnsplashImage: r.query({ queryFn: async function(e, n) {
|
|
564
|
+
try {
|
|
565
|
+
const a = n.getState().configSlice?.config, s = d.di.getInstance(n, d.SECURITY_MODULE_ID) !== void 0, u = new URL(e);
|
|
566
|
+
return u.searchParams.set("client_id", "S5iNcLqYgRBIOLQdluHdTsCJnjCvahzhG7JfYQOrV7o"), { data: await de(await d.fetchWithResourceProxy(u.toString(), {
|
|
567
|
+
config: a,
|
|
568
|
+
standalone: s,
|
|
569
|
+
resourceType: "stockImages",
|
|
570
|
+
intent: "metadata"
|
|
571
|
+
})) };
|
|
572
|
+
} catch (a) {
|
|
573
|
+
return ae(a);
|
|
574
|
+
}
|
|
575
|
+
} }),
|
|
576
|
+
sendAiImageRequest: r.query({ queryFn: async function({ body: e }, n) {
|
|
577
|
+
try {
|
|
578
|
+
return await d.getClient(n).aiGenerator.ai_create(e);
|
|
579
|
+
} catch (a) {
|
|
580
|
+
throw new Error(a);
|
|
581
|
+
}
|
|
582
|
+
} }),
|
|
583
|
+
getAiImage: r.query({ queryFn: async function(e, n) {
|
|
584
|
+
try {
|
|
585
|
+
return await d.getClient(n).aiGenerator.ai_status_list(e);
|
|
586
|
+
} catch (a) {
|
|
587
|
+
return ae(a);
|
|
588
|
+
}
|
|
589
|
+
} }),
|
|
590
|
+
getAiImageSSE: r.query({
|
|
591
|
+
queryFn: (e) => ({ data: [] }),
|
|
592
|
+
async onCacheEntryAdded({ task_id: e, entity_id: n, setError: a }, s) {
|
|
593
|
+
const { updateCachedData: u, cacheEntryRemoved: m } = s, S = d.getClient(s).baseUrl || d.normalizeBaseUrl("https://app.useblocks.io/api"), E = s.getState().configSlice?.config, _ = d.di.getInstance(s, d.SECURITY_MODULE_ID) !== void 0, W = d.PLUGIN.isPlugin ? await d.di.getInstance(s, le) : d.api.get(d.APP_COOKIES.em_token), F = W ? { Authorization: `Bearer ${W}` } : {}, q = `${S}/ai-generator/v1/ai-status?entity_id=${n}&stream=1&task_id=${e}`, G = d.resolveBackendProxyRequestCandidates(q, {
|
|
594
|
+
config: E,
|
|
595
|
+
method: "GET",
|
|
596
|
+
requestType: "ai",
|
|
597
|
+
standalone: _
|
|
598
|
+
}), x = ot({
|
|
599
|
+
candidates: G.length > 0 ? G : [q],
|
|
600
|
+
headers: F,
|
|
601
|
+
createEventSource: (X, K) => new it.EventSourcePolyfill(X, K),
|
|
602
|
+
onMessage: (X) => {
|
|
603
|
+
const K = JSON.parse(X.data);
|
|
604
|
+
u((ye) => {
|
|
605
|
+
ye.push(K);
|
|
606
|
+
}), K.progress === 100 && x.close();
|
|
607
|
+
},
|
|
608
|
+
onError: () => {
|
|
609
|
+
x.close();
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
await m, x.close();
|
|
613
|
+
}
|
|
614
|
+
}),
|
|
615
|
+
getSearchGif: r.query({ queryFn: async function({ query: e, page: n }, a) {
|
|
616
|
+
const s = e.keywords.replace(/[^\w\d\sа-яёА-ЯЁ]|_/g, "").replace(/[\s_-]+/g, " ");
|
|
617
|
+
try {
|
|
618
|
+
const u = a.getState().configSlice?.config, m = d.di.getInstance(a, d.SECURITY_MODULE_ID) !== void 0;
|
|
619
|
+
return { data: await de(await d.fetchWithResourceProxy(`${ct}/search?api_key=Nh77eBlPeMn1ed9MBAvL542NUGeNO26F&q=${encodeURIComponent(s)}&limit=25&offset=${n}&lang=en`, {
|
|
620
|
+
config: u,
|
|
621
|
+
standalone: m,
|
|
622
|
+
resourceType: "generic",
|
|
623
|
+
intent: "metadata"
|
|
624
|
+
})) };
|
|
625
|
+
} catch (u) {
|
|
626
|
+
return ae(u);
|
|
627
|
+
}
|
|
628
|
+
} })
|
|
629
|
+
})
|
|
630
|
+
}), { useLazyGetImageInfoQuery: lt, useGetImageInfoQuery: rr, useGetSearchImageQuery: nr, useLazyGetSearchImageQuery: dt, useSendAiImageRequestQuery: ar, useLazySendAiImageRequestQuery: ft, useGetAiImageQuery: ir, useLazyGetAiImageQuery: or, useGetUnsplashImageQuery: sr, useLazyGetUnsplashImageQuery: pt, useGetSearchGifQuery: cr, useLazyGetSearchGifQuery: gt, useGetAiImageSSEQuery: ur, useLazyGetAiImageSSEQuery: yt } = qe, vt = "https://app.useblocks.io/api".replaceAll(/[\\/]$/g, ""), me = "wp-json/limits/v1", ht = "wp-json/subscription/v2", Ge = d.createApi({
|
|
631
|
+
reducerPath: "limitsApi",
|
|
632
|
+
baseQuery: d.fetchBaseQueryApp({ baseUrl: vt }),
|
|
633
|
+
tagTypes: [
|
|
634
|
+
"LimitsStats",
|
|
635
|
+
"LimitsWarnings",
|
|
636
|
+
"SubscriptionMe"
|
|
637
|
+
],
|
|
638
|
+
endpoints: (r) => ({
|
|
639
|
+
getLimitsStats: r.query({
|
|
640
|
+
query: () => ({
|
|
641
|
+
url: `${me}/stats`,
|
|
642
|
+
method: "GET"
|
|
643
|
+
}),
|
|
644
|
+
providesTags: ["LimitsStats"]
|
|
645
|
+
}),
|
|
646
|
+
getLimitsStatsByType: r.query({
|
|
647
|
+
query: (e) => ({
|
|
648
|
+
url: `${me}/stats/${e}`,
|
|
649
|
+
method: "GET"
|
|
650
|
+
}),
|
|
651
|
+
providesTags: (e, n, a) => [{
|
|
652
|
+
type: "LimitsStats",
|
|
653
|
+
id: a
|
|
654
|
+
}]
|
|
655
|
+
}),
|
|
656
|
+
getLimitsWarnings: r.query({
|
|
657
|
+
query: () => ({
|
|
658
|
+
url: `${me}/warnings`,
|
|
659
|
+
method: "GET"
|
|
660
|
+
}),
|
|
661
|
+
providesTags: ["LimitsWarnings"]
|
|
662
|
+
}),
|
|
663
|
+
getSubscriptionMeV2: r.query({
|
|
664
|
+
query: () => ({
|
|
665
|
+
url: `${ht}/me`,
|
|
666
|
+
method: "GET"
|
|
667
|
+
}),
|
|
668
|
+
providesTags: ["SubscriptionMe"]
|
|
669
|
+
}),
|
|
670
|
+
invalidatePlanCache: r.mutation({ queryFn: async (e, n) => d.v2ResultOf(await d.getClientV2(n).billing.planInvalidateCreate()) })
|
|
671
|
+
})
|
|
672
|
+
}), { useGetLimitsStatsQuery: mt, useLazyGetLimitsStatsQuery: lr, useGetLimitsStatsByTypeQuery: dr, useLazyGetLimitsStatsByTypeQuery: St, useGetLimitsWarningsQuery: Pt, useLazyGetLimitsWarningsQuery: fr, useGetSubscriptionMeV2Query: pr, useLazyGetSubscriptionMeV2Query: gr, useInvalidatePlanCacheMutation: Tt } = Ge, ie = "Integrations", fe = "Webhook", pe = "TestRecipients", Se = "Storage", Ne = "Plan", U = (r, e) => {
|
|
673
|
+
const n = d.v2ResultOf(r);
|
|
674
|
+
return "error" in n ? { error: n.error } : { data: e(n.data) };
|
|
675
|
+
}, De = d.createApi({
|
|
676
|
+
reducerPath: "projectSettingsV2Api",
|
|
677
|
+
tagTypes: [
|
|
678
|
+
ie,
|
|
679
|
+
fe,
|
|
680
|
+
pe,
|
|
681
|
+
Se,
|
|
682
|
+
Ne
|
|
683
|
+
],
|
|
684
|
+
baseQuery: d.fetchBaseQueryApp({ baseUrl: "https://app.useblocks.io/api/v2" }),
|
|
685
|
+
endpoints: (r) => ({
|
|
686
|
+
getProjectPlan: r.query({
|
|
687
|
+
query: (e) => `/projects/${e}/plan`,
|
|
688
|
+
providesTags: (e, n, a) => [{
|
|
689
|
+
type: Ne,
|
|
690
|
+
id: String(a)
|
|
691
|
+
}]
|
|
692
|
+
}),
|
|
693
|
+
getProjectIntegrations: r.query({
|
|
694
|
+
async queryFn(e, n) {
|
|
695
|
+
return U(await d.getClientV2(n).projects.integrationsList({ id: String(e) }), (a) => Object.fromEntries((a?.items || []).map((s) => [s.provider, s])));
|
|
696
|
+
},
|
|
697
|
+
providesTags: (e, n, a) => [{
|
|
698
|
+
type: ie,
|
|
699
|
+
id: String(a)
|
|
700
|
+
}]
|
|
701
|
+
}),
|
|
702
|
+
getIntegrationCredentials: r.query({
|
|
703
|
+
async queryFn({ projectId: e, provider: n }, a) {
|
|
704
|
+
return U(await d.getClientV2(a).projects.integrationsDetail({
|
|
705
|
+
id: String(e),
|
|
706
|
+
provider: n,
|
|
707
|
+
reveal: !0
|
|
708
|
+
}), (s) => s?.settings || {});
|
|
709
|
+
},
|
|
710
|
+
keepUnusedDataFor: 0
|
|
711
|
+
}),
|
|
712
|
+
putProjectIntegration: r.mutation({
|
|
713
|
+
async queryFn({ projectId: e, provider: n, settings: a }, s) {
|
|
714
|
+
return U(await d.getClientV2(s).projects.integrationsUpdate({
|
|
715
|
+
id: String(e),
|
|
716
|
+
provider: n
|
|
717
|
+
}, { settings: a }), (u) => u);
|
|
718
|
+
},
|
|
719
|
+
invalidatesTags: (e, n, { projectId: a }) => [{
|
|
720
|
+
type: ie,
|
|
721
|
+
id: String(a)
|
|
722
|
+
}]
|
|
723
|
+
}),
|
|
724
|
+
deleteProjectIntegration: r.mutation({
|
|
725
|
+
async queryFn({ projectId: e, provider: n }, a) {
|
|
726
|
+
return U(await d.getClientV2(a).projects.integrationsDelete({
|
|
727
|
+
id: String(e),
|
|
728
|
+
provider: n
|
|
729
|
+
}), () => {});
|
|
730
|
+
},
|
|
731
|
+
invalidatesTags: (e, n, { projectId: a }) => [{
|
|
732
|
+
type: ie,
|
|
733
|
+
id: String(a)
|
|
734
|
+
}]
|
|
735
|
+
}),
|
|
736
|
+
getProjectWebhook: r.query({
|
|
737
|
+
async queryFn(e, n) {
|
|
738
|
+
return U(await d.getClientV2(n).projects.webhookList({ id: String(e) }), (a) => a?.url || "");
|
|
739
|
+
},
|
|
740
|
+
providesTags: (e, n, a) => [{
|
|
741
|
+
type: fe,
|
|
742
|
+
id: String(a)
|
|
743
|
+
}]
|
|
744
|
+
}),
|
|
745
|
+
putProjectWebhook: r.mutation({
|
|
746
|
+
async queryFn({ projectId: e, url: n }, a) {
|
|
747
|
+
return U(await d.getClientV2(a).projects.webhookUpdate({ id: String(e) }, { url: n }), (s) => ({ url: s?.url || "" }));
|
|
748
|
+
},
|
|
749
|
+
invalidatesTags: (e, n, { projectId: a }) => [{
|
|
750
|
+
type: fe,
|
|
751
|
+
id: String(a)
|
|
752
|
+
}]
|
|
753
|
+
}),
|
|
754
|
+
getProjectStorage: r.query({
|
|
755
|
+
async queryFn(e, n) {
|
|
756
|
+
return U(await d.getClientV2(n).projects.storageList({ id: String(e) }), (a) => a);
|
|
757
|
+
},
|
|
758
|
+
providesTags: (e, n, a) => [{
|
|
759
|
+
type: Se,
|
|
760
|
+
id: String(a)
|
|
761
|
+
}]
|
|
762
|
+
}),
|
|
763
|
+
putProjectSettings: r.mutation({
|
|
764
|
+
async queryFn({ projectId: e, body: n }, a) {
|
|
765
|
+
return U(await d.getClientV2(a).projects.settingsUpdate({ id: String(e) }, n), (s) => s);
|
|
766
|
+
},
|
|
767
|
+
invalidatesTags: (e, n, { projectId: a }) => [
|
|
768
|
+
{
|
|
769
|
+
type: ie,
|
|
770
|
+
id: String(a)
|
|
771
|
+
},
|
|
772
|
+
{
|
|
773
|
+
type: fe,
|
|
774
|
+
id: String(a)
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
type: pe,
|
|
778
|
+
id: String(a)
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
type: Se,
|
|
782
|
+
id: String(a)
|
|
783
|
+
}
|
|
784
|
+
]
|
|
785
|
+
}),
|
|
786
|
+
getProjectTestRecipients: r.query({
|
|
787
|
+
async queryFn(e, n) {
|
|
788
|
+
return U(await d.getClientV2(n).projects.testRecipientsList({ id: String(e) }), (a) => a?.emails || []);
|
|
789
|
+
},
|
|
790
|
+
providesTags: (e, n, a) => [{
|
|
791
|
+
type: pe,
|
|
792
|
+
id: String(a)
|
|
793
|
+
}]
|
|
794
|
+
}),
|
|
795
|
+
putProjectTestRecipients: r.mutation({
|
|
796
|
+
async queryFn({ projectId: e, emails: n }, a) {
|
|
797
|
+
return U(await d.getClientV2(a).projects.testRecipientsUpdate({ id: String(e) }, { emails: n }), (s) => ({ emails: s?.emails || [] }));
|
|
798
|
+
},
|
|
799
|
+
invalidatesTags: (e, n, { projectId: a }) => [{
|
|
800
|
+
type: pe,
|
|
801
|
+
id: String(a)
|
|
802
|
+
}]
|
|
803
|
+
})
|
|
804
|
+
})
|
|
805
|
+
}), { useGetProjectPlanQuery: bt, useLazyGetProjectPlanQuery: wt, useGetProjectStorageQuery: yr, usePutProjectSettingsMutation: vr, useGetProjectIntegrationsQuery: Et, useLazyGetIntegrationCredentialsQuery: jt, usePutProjectIntegrationMutation: hr, useDeleteProjectIntegrationMutation: mr, useGetProjectWebhookQuery: _t, usePutProjectWebhookMutation: Sr, useGetProjectTestRecipientsQuery: It, usePutProjectTestRecipientsMutation: At } = De, Qe = new URLSearchParams(window.location.search), Ue = Qe.get("tag"), Ot = Qe.get("folder"), Ct = d.createState({
|
|
806
|
+
activeModal: "",
|
|
807
|
+
switchToPlanRequestTitle: "",
|
|
808
|
+
secondModal: "",
|
|
809
|
+
projectsTotal: "",
|
|
810
|
+
projectsTotalPages: "",
|
|
811
|
+
folders: [],
|
|
812
|
+
activeTagId: Ue || null,
|
|
813
|
+
activeFolderId: Ot || (Ue ? null : "all"),
|
|
814
|
+
activeIntegration: null,
|
|
815
|
+
addNewProjectInitialTitle: null
|
|
816
|
+
}), ge = "projectsPageSlice", Fe = d.createSlice({
|
|
817
|
+
name: ge,
|
|
818
|
+
initialState: Ct,
|
|
819
|
+
reducers: {
|
|
820
|
+
openModal(r, e) {
|
|
821
|
+
r.activeModal = e.payload;
|
|
822
|
+
},
|
|
823
|
+
openAddNewProjectModal(r, e) {
|
|
824
|
+
r.activeModal = d.MODALS.ADD_NEW_PROJECT_MODAL, r.addNewProjectInitialTitle = e.payload ?? null;
|
|
825
|
+
},
|
|
826
|
+
setSwitchToPlanRequestTitle(r, e) {
|
|
827
|
+
r.switchToPlanRequestTitle = typeof e.payload == "string" ? e.payload : "";
|
|
828
|
+
},
|
|
829
|
+
closeModal(r) {
|
|
830
|
+
r.activeModal = "", r.activeIntegration = null, r.addNewProjectInitialTitle = null, r.switchToPlanRequestTitle = "";
|
|
831
|
+
},
|
|
832
|
+
openSecondModal(r, e) {
|
|
833
|
+
r.secondModal = e.payload;
|
|
834
|
+
},
|
|
835
|
+
closeSecondModal(r) {
|
|
836
|
+
r.secondModal = "";
|
|
837
|
+
},
|
|
838
|
+
setFolders(r, { payload: e }) {
|
|
839
|
+
r.folders = e;
|
|
840
|
+
},
|
|
841
|
+
setActiveTagId(r, { payload: e }) {
|
|
842
|
+
r.activeTagId = e;
|
|
843
|
+
},
|
|
844
|
+
setActiveIntegration(r, e) {
|
|
845
|
+
r.activeIntegration = e.payload;
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
extraReducers: (r) => {
|
|
849
|
+
r.addMatcher(d.projectsApi.endpoints.getProjects.matchFulfilled, (e, n) => {
|
|
850
|
+
const a = n.meta, s = a.baseQueryMeta, u = a.projectsListPagination ?? s?.projectsListPagination;
|
|
851
|
+
if (u != null && typeof u.total == "number" && Number.isFinite(u.total) && u.total >= 0) {
|
|
852
|
+
e.projectsTotal = String(u.total), e.projectsTotalPages = String(typeof u.totalPages == "number" && Number.isFinite(u.totalPages) ? u.totalPages : "");
|
|
853
|
+
return;
|
|
854
|
+
}
|
|
855
|
+
const m = s?.response?.headers?.get?.("X-WP-Total"), S = s?.response?.headers?.get?.("X-WP-TotalPages");
|
|
856
|
+
e.projectsTotal = m ?? "", e.projectsTotalPages = S ?? "";
|
|
857
|
+
}), r.addMatcher(d.taxonomiesApi.endpoints.getTerms.matchFulfilled, (e, { meta: n, payload: a }) => {
|
|
858
|
+
const s = n.arg.originalArgs?.kind;
|
|
859
|
+
(s === "folder" || s === "blockfolder") && (e.folders = a);
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
}), { openModal: Rt, openAddNewProjectModal: Pr, setSwitchToPlanRequestTitle: Lt, closeModal: Mt, openSecondModal: qt, closeSecondModal: Gt, setFolders: Tr, setActiveTagId: br, setActiveIntegration: wr } = Fe.actions, Nt = (r) => r[ge].activeModal, Dt = (r) => r[ge].secondModal, Qt = (r) => r[ge].projectsTotal, Ut = 3, Ft = /^(.+\.[a-zA-Z0-9]{1,8})\?[^?#]*$/;
|
|
863
|
+
function kt(r) {
|
|
864
|
+
let e = r;
|
|
865
|
+
for (let n = 0; n < Ut; n++) try {
|
|
866
|
+
const a = decodeURIComponent(e);
|
|
867
|
+
if (a === e) break;
|
|
868
|
+
e = a;
|
|
869
|
+
} catch {
|
|
870
|
+
break;
|
|
871
|
+
}
|
|
872
|
+
return e.normalize("NFC");
|
|
873
|
+
}
|
|
874
|
+
function Bt(r) {
|
|
875
|
+
const e = r.match(Ft);
|
|
876
|
+
return e ? e[1] : r;
|
|
877
|
+
}
|
|
878
|
+
function zt(r) {
|
|
879
|
+
if (/^https?:\/\//i.test(r)) return new URL(r).pathname.split("/").filter(Boolean).pop();
|
|
880
|
+
if (r.startsWith("//")) return new URL(r, "https://placeholder.invalid").pathname.split("/").filter(Boolean).pop();
|
|
881
|
+
}
|
|
882
|
+
function ke(r) {
|
|
883
|
+
const e = r.replaceAll("\\", "/").trim();
|
|
884
|
+
if (!e) return e;
|
|
885
|
+
let n;
|
|
886
|
+
try {
|
|
887
|
+
n = zt(e);
|
|
888
|
+
} catch {}
|
|
889
|
+
if (!n) {
|
|
890
|
+
n = Bt(e.split("/").pop() ?? "");
|
|
891
|
+
const a = n.indexOf("#");
|
|
892
|
+
a >= 0 && (n = n.slice(0, a));
|
|
893
|
+
}
|
|
894
|
+
return kt(n);
|
|
895
|
+
}
|
|
896
|
+
function Ht(r) {
|
|
897
|
+
const e = r.trim();
|
|
898
|
+
if (e) {
|
|
899
|
+
if (!(/^https?:\/\//i.test(e) || e.startsWith("//"))) try {
|
|
900
|
+
new URL(e);
|
|
901
|
+
} catch {
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
return ke(e) || void 0;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
Object.defineProperty(g, "OAuthMixin", {
|
|
908
|
+
enumerable: !0,
|
|
909
|
+
get: function() {
|
|
910
|
+
return at;
|
|
911
|
+
}
|
|
912
|
+
}), Object.defineProperty(g, "TOKEN_ID", {
|
|
913
|
+
enumerable: !0,
|
|
914
|
+
get: function() {
|
|
915
|
+
return le;
|
|
916
|
+
}
|
|
917
|
+
}), Object.defineProperty(g, "closeModal", {
|
|
918
|
+
enumerable: !0,
|
|
919
|
+
get: function() {
|
|
920
|
+
return Mt;
|
|
921
|
+
}
|
|
922
|
+
}), Object.defineProperty(g, "closeSecondModal", {
|
|
923
|
+
enumerable: !0,
|
|
924
|
+
get: function() {
|
|
925
|
+
return Gt;
|
|
926
|
+
}
|
|
927
|
+
}), Object.defineProperty(g, "combineMixins", {
|
|
928
|
+
enumerable: !0,
|
|
929
|
+
get: function() {
|
|
930
|
+
return et;
|
|
931
|
+
}
|
|
932
|
+
}), Object.defineProperty(g, "decodeFileNameFromPath", {
|
|
933
|
+
enumerable: !0,
|
|
934
|
+
get: function() {
|
|
935
|
+
return ke;
|
|
936
|
+
}
|
|
937
|
+
}), Object.defineProperty(g, "decodeFileNameFromUrl", {
|
|
938
|
+
enumerable: !0,
|
|
939
|
+
get: function() {
|
|
940
|
+
return Ht;
|
|
941
|
+
}
|
|
942
|
+
}), Object.defineProperty(g, "decodeJwt", {
|
|
943
|
+
enumerable: !0,
|
|
944
|
+
get: function() {
|
|
945
|
+
return Ce;
|
|
946
|
+
}
|
|
947
|
+
}), Object.defineProperty(g, "defineMixin", {
|
|
948
|
+
enumerable: !0,
|
|
949
|
+
get: function() {
|
|
950
|
+
return Oe;
|
|
951
|
+
}
|
|
952
|
+
}), Object.defineProperty(g, "imageApi", {
|
|
953
|
+
enumerable: !0,
|
|
954
|
+
get: function() {
|
|
955
|
+
return qe;
|
|
956
|
+
}
|
|
957
|
+
}), Object.defineProperty(g, "limitsApi", {
|
|
958
|
+
enumerable: !0,
|
|
959
|
+
get: function() {
|
|
960
|
+
return Ge;
|
|
961
|
+
}
|
|
962
|
+
}), Object.defineProperty(g, "openModal", {
|
|
963
|
+
enumerable: !0,
|
|
964
|
+
get: function() {
|
|
965
|
+
return Rt;
|
|
966
|
+
}
|
|
967
|
+
}), Object.defineProperty(g, "openSecondModal", {
|
|
968
|
+
enumerable: !0,
|
|
969
|
+
get: function() {
|
|
970
|
+
return qt;
|
|
971
|
+
}
|
|
972
|
+
}), Object.defineProperty(g, "projectSettingsV2Api", {
|
|
973
|
+
enumerable: !0,
|
|
974
|
+
get: function() {
|
|
975
|
+
return De;
|
|
976
|
+
}
|
|
977
|
+
}), Object.defineProperty(g, "projectsPageSlice", {
|
|
978
|
+
enumerable: !0,
|
|
979
|
+
get: function() {
|
|
980
|
+
return Fe;
|
|
981
|
+
}
|
|
982
|
+
}), Object.defineProperty(g, "recreateTokenProvider", {
|
|
983
|
+
enumerable: !0,
|
|
984
|
+
get: function() {
|
|
985
|
+
return Le;
|
|
986
|
+
}
|
|
987
|
+
}), Object.defineProperty(g, "require_eventsource", {
|
|
988
|
+
enumerable: !0,
|
|
989
|
+
get: function() {
|
|
990
|
+
return Me;
|
|
991
|
+
}
|
|
992
|
+
}), Object.defineProperty(g, "selectActiveModal", {
|
|
993
|
+
enumerable: !0,
|
|
994
|
+
get: function() {
|
|
995
|
+
return Nt;
|
|
996
|
+
}
|
|
997
|
+
}), Object.defineProperty(g, "selectProjectsTotal", {
|
|
998
|
+
enumerable: !0,
|
|
999
|
+
get: function() {
|
|
1000
|
+
return Qt;
|
|
1001
|
+
}
|
|
1002
|
+
}), Object.defineProperty(g, "selectSecondModal", {
|
|
1003
|
+
enumerable: !0,
|
|
1004
|
+
get: function() {
|
|
1005
|
+
return Dt;
|
|
1006
|
+
}
|
|
1007
|
+
}), Object.defineProperty(g, "setSwitchToPlanRequestTitle", {
|
|
1008
|
+
enumerable: !0,
|
|
1009
|
+
get: function() {
|
|
1010
|
+
return Lt;
|
|
1011
|
+
}
|
|
1012
|
+
}), Object.defineProperty(g, "useGetLimitsStatsQuery", {
|
|
1013
|
+
enumerable: !0,
|
|
1014
|
+
get: function() {
|
|
1015
|
+
return mt;
|
|
1016
|
+
}
|
|
1017
|
+
}), Object.defineProperty(g, "useGetLimitsWarningsQuery", {
|
|
1018
|
+
enumerable: !0,
|
|
1019
|
+
get: function() {
|
|
1020
|
+
return Pt;
|
|
1021
|
+
}
|
|
1022
|
+
}), Object.defineProperty(g, "useGetProjectIntegrationsQuery", {
|
|
1023
|
+
enumerable: !0,
|
|
1024
|
+
get: function() {
|
|
1025
|
+
return Et;
|
|
1026
|
+
}
|
|
1027
|
+
}), Object.defineProperty(g, "useGetProjectPlanQuery", {
|
|
1028
|
+
enumerable: !0,
|
|
1029
|
+
get: function() {
|
|
1030
|
+
return bt;
|
|
1031
|
+
}
|
|
1032
|
+
}), Object.defineProperty(g, "useGetProjectTestRecipientsQuery", {
|
|
1033
|
+
enumerable: !0,
|
|
1034
|
+
get: function() {
|
|
1035
|
+
return It;
|
|
1036
|
+
}
|
|
1037
|
+
}), Object.defineProperty(g, "useGetProjectWebhookQuery", {
|
|
1038
|
+
enumerable: !0,
|
|
1039
|
+
get: function() {
|
|
1040
|
+
return _t;
|
|
1041
|
+
}
|
|
1042
|
+
}), Object.defineProperty(g, "useInvalidatePlanCacheMutation", {
|
|
1043
|
+
enumerable: !0,
|
|
1044
|
+
get: function() {
|
|
1045
|
+
return Tt;
|
|
1046
|
+
}
|
|
1047
|
+
}), Object.defineProperty(g, "useLazyGetAiImageSSEQuery", {
|
|
1048
|
+
enumerable: !0,
|
|
1049
|
+
get: function() {
|
|
1050
|
+
return yt;
|
|
1051
|
+
}
|
|
1052
|
+
}), Object.defineProperty(g, "useLazyGetImageInfoQuery", {
|
|
1053
|
+
enumerable: !0,
|
|
1054
|
+
get: function() {
|
|
1055
|
+
return lt;
|
|
1056
|
+
}
|
|
1057
|
+
}), Object.defineProperty(g, "useLazyGetIntegrationCredentialsQuery", {
|
|
1058
|
+
enumerable: !0,
|
|
1059
|
+
get: function() {
|
|
1060
|
+
return jt;
|
|
1061
|
+
}
|
|
1062
|
+
}), Object.defineProperty(g, "useLazyGetLimitsStatsByTypeQuery", {
|
|
1063
|
+
enumerable: !0,
|
|
1064
|
+
get: function() {
|
|
1065
|
+
return St;
|
|
1066
|
+
}
|
|
1067
|
+
}), Object.defineProperty(g, "useLazyGetProjectPlanQuery", {
|
|
1068
|
+
enumerable: !0,
|
|
1069
|
+
get: function() {
|
|
1070
|
+
return wt;
|
|
1071
|
+
}
|
|
1072
|
+
}), Object.defineProperty(g, "useLazyGetSearchGifQuery", {
|
|
1073
|
+
enumerable: !0,
|
|
1074
|
+
get: function() {
|
|
1075
|
+
return gt;
|
|
1076
|
+
}
|
|
1077
|
+
}), Object.defineProperty(g, "useLazyGetSearchImageQuery", {
|
|
1078
|
+
enumerable: !0,
|
|
1079
|
+
get: function() {
|
|
1080
|
+
return dt;
|
|
1081
|
+
}
|
|
1082
|
+
}), Object.defineProperty(g, "useLazyGetUnsplashImageQuery", {
|
|
1083
|
+
enumerable: !0,
|
|
1084
|
+
get: function() {
|
|
1085
|
+
return pt;
|
|
1086
|
+
}
|
|
1087
|
+
}), Object.defineProperty(g, "useLazySendAiImageRequestQuery", {
|
|
1088
|
+
enumerable: !0,
|
|
1089
|
+
get: function() {
|
|
1090
|
+
return ft;
|
|
1091
|
+
}
|
|
1092
|
+
}), Object.defineProperty(g, "usePutProjectTestRecipientsMutation", {
|
|
1093
|
+
enumerable: !0,
|
|
1094
|
+
get: function() {
|
|
1095
|
+
return At;
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
});
|