useblocks 1.1.56 → 1.1.60
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/iframe/js/amp.BP7EklKo.js +1 -1
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.js +1 -1
- package/iframe/js/rules.4N5s3OV-.js +1 -1
- package/npm-publish.manifest.json +7 -7
- package/package.json +1 -1
- package/singlepage_headless_plugin.html +1 -1
- package/static/core/{4d493eba.js → 161d1254.js} +268 -257
- package/static/core/{4dadf572.js → 40f73dfb.js} +3 -3
- package/static/core/{289ba982.js → 43c3f160.js} +3270 -3187
- package/static/core/{58c4b8d7.js → 4c39852e.js} +5 -5
- package/static/core/{a4c19e27.js → 4e75b331.js} +4 -4
- package/static/core/{87969347.js → 53463a60.js} +675 -677
- package/static/core/{eb23332a.js → 7a15fa8b.js} +3 -3
- package/static/core/{12a9aa4e.js → 8815eb5b.js} +11514 -11159
- package/static/core/{4a5f1756.js → ba6c356e.js} +104 -104
- package/static/core/{b9bb2c5f.js → c9e59b34.js} +4634 -4271
- package/static/core/{fa354fb5.js → d9baa55e.js} +7 -7
- package/static/core/{bf446743.js → dbf19c2e.js} +248 -198
- package/static/core/{988589a5.js → f953827c.js} +7 -7
- package/static/esm/2474de05.js +131 -0
- package/static/esm/{3cde7cb6.js → 53b688bd.js} +48 -48
- package/two_step_headless_plugin.html +1 -1
- package/useblocks-core.f6bb8947.js +673 -0
- package/useblocks-esm.js +892 -529
- package/useblocks.d.ts +8 -0
- package/useblocks.js +698 -330
- package/static/esm/550bf3cb.js +0 -127
- package/useblocks-core.1279854f.js +0 -643
- /package/iframe/{iframe-eblock.1279854f.html → iframe-eblock.f6bb8947.html} +0 -0
- /package/iframe/{iframe.1279854f.html → iframe.f6bb8947.html} +0 -0
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
(function(){try{if(typeof document<"u"){var o=document.createElement("style");o.setAttribute("data-useblocks","true"),o.appendChild(document.createTextNode(".blocks-app .image-preview{text-align:center;min-height:100px;position:relative}.blocks-app .image-preview .image-editor-modal{border:1px solid red}.blocks-app .image-preview__edit-button{position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-preview img{border:1px solid var(--colorBorder);border-radius:6px;max-width:100%;max-height:500px}.blocks-app .image-editor-modal .ant-modal-container{flex-direction:column;min-height:100vh;display:flex;border-radius:0!important}.blocks-app .image-editor-modal .ant-modal-body{flex-grow:1;display:flex}.blocks-app .image-editor-modal .ant-modal-body #pixie-editor{flex-grow:1;height:calc(100vh - 70px);min-height:calc(100vh - 70px);overflow:hidden}.blocks-app .image-editor-modal .pi .text-on-primary{background:var(--colorPrimary);border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary:hover{background:var(--colorPrimaryHover);border-color:var(--colorPrimaryHover)}.blocks-app .image-editor-modal .pi .text-on-primary.rounded-full{border-radius:calc(var(--borderRadius) * 1px)}.blocks-app .image-editor-modal .pi .shadow-xl{box-shadow:none}.blocks-app .image-editor-modal .w-\\[4ch\\].text-sm.text-center{width:5ch}.blocks-app .image-editor-modal .pi .border-white{border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .bg-white\\/50{background-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary{color:var(--colorWhite)}.blocks-app .serach-results .ant-row{align-items:center}.blocks-app .serach-results .blocks-search__divider-wrapper{margin-top:12px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{border-top:1px solid var(--colorBorderSecondary);background:0 0;width:100%;height:1px;min-height:0;margin:0;position:static}.blocks-app .slideshow-container{width:524px;height:350px;margin:auto;position:relative;overflow:hidden}.blocks-app .slideshow-image{opacity:0;width:100%;height:100%;position:absolute;top:0;left:0}.blocks-app .image-ai .slideshow-image{width:auto;height:auto}.blocks-app .image-ai__image-item{text-align:center;border-radius:6px;justify-content:center;align-items:center;min-height:100px;display:flex;position:relative}.blocks-app .image-ai__image-item .buttons{justify-content:space-between;display:flex;position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-ai .text-area-input-hybrid{border:none;outline:none;min-height:0;padding:0 0 0 1px}.blocks-app .image-ai .text-area-input-hybrid textarea{height:32px;min-height:32px;padding:3px 11px;line-height:26px}.blocks-app .image-ai__loading{justify-content:center;align-items:center;min-height:150px;display:flex}.blocks-app .image-ai__loading .spin{flex-direction:column;justify-content:center;align-items:center;height:150px;display:flex}.blocks-app .image-ai__loading .status{margin:3px 0 0}.blocks-app .image-ai__preview{border-radius:6px;margin-top:24px;overflow:hidden}.blocks-app .image-ai__preview .image-ai__image-item img{border-radius:calc(var(--borderRadius) * 1px);object-fit:contain;max-height:100%;transition:height 1s;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}.blocks-app .image-ai .small{width:302px;height:202px}.blocks-app .image-ai .large{width:524px;height:350px}.blocks-app .image-ai .image-ai__row{padding:0 2px}.blocks-app .image-ai .image-ai__input-affix-wrapper{border-style:solid;border-width:calc(var(--borderWidth) * 1px);border-color:var(--colorFillSecondaryDarken);border-radius:calc(var(--borderRadius) * 1px);width:100%;padding-left:0;display:inline-flex}.blocks-app .image-ai .image-ai__input-affix-wrapper:hover{border-color:var(--borderColorHover)}.blocks-app .image-ai .image-ai__input-affix-wrapper.ant-input-affix-wrapper-focused{border-color:var(--colorPrimaryBorder)}.blocks-app .image-ai .image-ai__textarea{font-size:16px}.blocks-app .image-ai .image-ai__input-icon{font-size:16px;top:0;right:0}.dark .blocks-app .image-ai .image-ai__preview .image-ai__image-item img{background:#2b2b2b;border:1px solid #434343}.dark .blocks-app .image-ai .ant-btn{background:#1f1f1f}.dark .blocks-app .image-ai .ant-btn:hover{color:var(--colorPrimary)}.blocks-app .stock-tab img{border-radius:0;max-width:none;max-height:none}.blocks-app .stock-tab .stock-search-input{padding:0 2px}.blocks-app .stock-tab .my-masonry-grid{text-align:center;width:auto;display:flex}.blocks-app .stock-tab .my-masonry-grid_column{background-clip:padding-box}.blocks-app .stock-tab .list-item{cursor:pointer;background:#f0f2f5;border:1px solid #f0f2f5;border-radius:6px;min-height:100px;max-height:100px;margin-bottom:20px;transition:all .3s;display:inline-block;position:relative;overflow:hidden}.blocks-app .stock-tab .list-item .overlay-image{opacity:0;background-size:cover;width:110px;height:40px;transition:opacity .5s;position:absolute;bottom:10px;right:10px}.blocks-app .stock-tab .list-item .ant-spin{color:#f0f2f5;font-size:20px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.blocks-app .stock-tab .list-item img{object-fit:cover;opacity:0;border-radius:6px;height:auto;transition:opacity .5s ease-in-out;display:block}.blocks-app .stock-tab .list-item.loaded{border:1px solid #d9d9d9;max-height:1000px}.blocks-app .stock-tab .list-item.loaded img{opacity:1;height:100%}.blocks-app .stock-tab .list-item.loaded .loaded-image{opacity:.5}.blocks-app .stock-tab .list-item:hover{box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017}.blocks-app .stock-tab .list-item:hover p.creator-info,.blocks-app .stock-tab .list-item:hover .overlay-image{opacity:1}.blocks-app .stock-tab .list-item p.creator-info{color:#fff;opacity:0;background-color:#00000080;border-radius:0 0 6px;margin:0;padding:5px;font-size:10px;line-height:1.2;position:absolute;bottom:0;right:0}.blocks-app .stock-tab .list-item p.creator-info:hover a{color:#fff;text-decoration:underline}.blocks-app .stock-tab .list-item p.creator-info a{color:#fff;text-decoration:none}.blocks-app .stock-color-filter{display:flex}.blocks-app .stock-color-filter label{border-width:1px;width:24px;height:24px;margin:4px;padding:0;font-size:0;border-radius:6px!important}.blocks-app .stock-color-filter label.all-colors{background-image:linear-gradient(135deg,red,#ff7f00,#ff0,#0f0,#00f,#8b00ff)}.blocks-app .stock-color-filter label.black-color{background:#222}.blocks-app .stock-color-filter label.bw-color{background-image:linear-gradient(135deg,#222 50%,#fff 50%)}.blocks-app .stock-color-filter label.white-color{background:#fff}.blocks-app .stock-color-filter label.orange-color{background:#fa8c16}.blocks-app .stock-color-filter label.red-color{background:#f5222d}.blocks-app .stock-color-filter label.purple-color{background:#722ed1}.blocks-app .stock-color-filter label.magenta-color{background:#eb2f96}.blocks-app .stock-color-filter label.green-color{background:#52c41a}.blocks-app .stock-color-filter label.teal-color{background:#43c3c3}.blocks-app .stock-color-filter label.blue-color{background:#1677ff}.blocks-app .stock-color-filter .ant-radio-button-wrapper:not(:first-child):before{display:none}.blocks-app .serach-results{padding-top:6px}.blocks-app .serach-results .stock-search-input{width:322px;padding:0 2px}.blocks-app .serach-results .blocks-search__divider-wrapper{width:calc(100% + 48px);margin-top:12px;margin-left:-24px;margin-right:-24px;position:relative}.blocks-app .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{pointer-events:none;border-top:1px solid var(--colorBorderSecondary);background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);border-bottom:none;width:100%;height:20px;min-height:20px;margin:0;position:relative;bottom:auto;left:auto;right:auto}.dark .blocks-app .image-center .stock-tab .serach-results .blocks-search__divider-wrapper .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.dark .blocks-app .stock-tab .list-item{background:#2b2b2b;border:1px solid #2b2b2b}.dark .blocks-app .stock-tab .list-item.loaded{border:1px solid #434343}.blocks-app .image-center .image-center-image-preview{justify-content:center;align-items:center;display:flex}.blocks-app .image-center .ant-divider-horizontal{pointer-events:none;z-index:1;background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);width:calc(100% + 48px);height:20px;margin:24px -24px 0;position:absolute;bottom:-19px}.dark .blocks-app .image-center .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.blocks-app .image-center .ant-divider-horizontal.ant-divider-with-text{background:0 0;width:calc(100% + 38px);margin:0 -24px 20px;position:relative;top:0}.blocks-app .image-center img{border-radius:4px;max-width:524px;max-height:352px}.blocks-app .image-center .image-size{justify-content:center;margin-top:6px;font-size:14px;line-height:22px;display:flex}.blocks-app .image-center .ant-upload.ant-upload-drag{border-radius:6px}.blocks-app .image-center .ant-modal-body .stock-search-input{margin-bottom:0}.blocks-app .image-center .ant-modal-body .serach-results .stock-search-input{margin-bottom:10px}.blocks-app .image-center .ant-modal-body .ant-form:not(.serach-results) .ant-form-item:last-child{margin-bottom:0}.blocks-app .image-center .ant-modal-body .ant-tabs{transition:all .7s cubic-bezier(.075,.82,.165,1)}.blocks-app .image-center .ant-modal-body .ant-tabs .ant-tabs-content-holder{overflow-y:clip}.blocks-app .ant-modal{transition:width .7s ease-in-out}")),document.head.appendChild(o)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
|
|
2
|
-
__useblocks__.define("static/core/
|
|
2
|
+
__useblocks__.define("static/core/53463a60.js", [
|
|
3
3
|
"require",
|
|
4
4
|
"exports",
|
|
5
5
|
"module",
|
|
6
6
|
"static/core/bd36b180.js",
|
|
7
|
-
"static/core/
|
|
8
|
-
"static/core/
|
|
9
|
-
"static/core/
|
|
10
|
-
"static/core/
|
|
7
|
+
"static/core/c9e59b34.js",
|
|
8
|
+
"static/core/161d1254.js",
|
|
9
|
+
"static/core/4c39852e.js",
|
|
10
|
+
"static/core/40f73dfb.js",
|
|
11
11
|
"static/core/951903fb.js",
|
|
12
|
-
"static/core/
|
|
12
|
+
"static/core/dbf19c2e.js",
|
|
13
13
|
"react",
|
|
14
14
|
"react/jsx-runtime"
|
|
15
|
-
], function(
|
|
16
|
-
const Ze =
|
|
17
|
-
let n =
|
|
15
|
+
], function(de, gt, ln) {
|
|
16
|
+
const Ze = de("./bd36b180.js"), u = de("./c9e59b34.js"), Z = de("./161d1254.js"), ne = de("./4c39852e.js"), m = de("./40f73dfb.js"), ht = de("./951903fb.js"), N = de("./dbf19c2e.js");
|
|
17
|
+
let n = de("react");
|
|
18
18
|
n = Ze.__toESM(n);
|
|
19
|
-
let r =
|
|
20
|
-
var
|
|
21
|
-
function
|
|
19
|
+
let r = de("react/jsx-runtime");
|
|
20
|
+
var yt = Ze.__toESM(ne.require_prop_types());
|
|
21
|
+
function vt(t, e) {
|
|
22
22
|
return { [t]: {
|
|
23
23
|
Filter: e("Filter"),
|
|
24
24
|
filter: e("filter"),
|
|
@@ -111,11 +111,11 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
111
111
|
const d = o.slice(5, i).split(";")[0]?.trim();
|
|
112
112
|
d && (a = d), o = o.slice(i + 1);
|
|
113
113
|
}
|
|
114
|
-
const l = o.replace(/\s/g, ""), b = atob(l),
|
|
115
|
-
for (let d = 0; d < b.length; d++)
|
|
116
|
-
return new Blob([
|
|
114
|
+
const l = o.replace(/\s/g, ""), b = atob(l), p = new Uint8Array(b.length);
|
|
115
|
+
for (let d = 0; d < b.length; d++) p[d] = b.charCodeAt(d);
|
|
116
|
+
return new Blob([p], { type: a });
|
|
117
117
|
}
|
|
118
|
-
var
|
|
118
|
+
var Ct = "static/media/image-editor", bt = { text: {
|
|
119
119
|
replaceDefaultItems: !0,
|
|
120
120
|
defaultText: "Handwriting",
|
|
121
121
|
items: [
|
|
@@ -233,84 +233,84 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
233
233
|
}
|
|
234
234
|
]
|
|
235
235
|
} };
|
|
236
|
-
function
|
|
236
|
+
function wt(t, e) {
|
|
237
237
|
if (t === "json") return new Blob([e], { type: "application/json" });
|
|
238
238
|
if (t === "svg") return new Blob([e], { type: "image/svg+xml" });
|
|
239
239
|
const o = `image/${t}`;
|
|
240
240
|
return Xe(e.replace(/data:image\/([a-z]*)?;base64,/, ""), o);
|
|
241
241
|
}
|
|
242
|
-
var
|
|
243
|
-
const l =
|
|
244
|
-
let
|
|
245
|
-
const
|
|
246
|
-
if (!
|
|
247
|
-
const
|
|
248
|
-
for (const [P,
|
|
249
|
-
return Object.keys(
|
|
250
|
-
}, [
|
|
242
|
+
var At = ({ currentImageLink: t, prefetchedBlob: e, resolveImageBlob: o, onSave: a, uploadImageResultIsLoading: i }) => {
|
|
243
|
+
const l = N.useCookieManager(), [b, p] = (0, n.useState)(), [d, v] = (0, n.useState)(), { __: I } = m.useI18n();
|
|
244
|
+
let w = u.useDispatch();
|
|
245
|
+
const C = u.useStore(), R = u.useAppConfig(), y = u.useSelector(u.selectedCurrentUser), L = u.useSelector(Z.selectSecondModal), A = u.useSelector(u.selectProject), G = (0, n.useMemo)(() => {
|
|
246
|
+
if (!R?.icons) return;
|
|
247
|
+
const E = {};
|
|
248
|
+
for (const [P, j] of Object.entries(R.icons)) typeof j == "string" && (E[P] = N.sanitizeHtml(j));
|
|
249
|
+
return Object.keys(E).length > 0 ? E : void 0;
|
|
250
|
+
}, [R?.icons]), O = (0, n.useRef)(!1), [D, H] = (0, n.useState)(), B = u.useEventEmitter(u.events.FILE_PROXY_EVENT_ID);
|
|
251
251
|
(0, n.useEffect)(() => {
|
|
252
|
-
let
|
|
252
|
+
let E = !1;
|
|
253
253
|
return (async () => {
|
|
254
|
-
const
|
|
255
|
-
if (!
|
|
256
|
-
let
|
|
257
|
-
if (!
|
|
258
|
-
typeof o == "function" ?
|
|
254
|
+
const j = t;
|
|
255
|
+
if (!j && !e) return;
|
|
256
|
+
let x = e;
|
|
257
|
+
if (!x && j) try {
|
|
258
|
+
typeof o == "function" ? x = await o(j) : x = await (await fetch(j)).blob();
|
|
259
259
|
} catch {
|
|
260
|
-
if (
|
|
261
|
-
if (
|
|
262
|
-
url:
|
|
263
|
-
project:
|
|
264
|
-
}).filter((
|
|
265
|
-
const
|
|
266
|
-
|
|
260
|
+
if (E) return;
|
|
261
|
+
if (x = await B.fire({
|
|
262
|
+
url: j,
|
|
263
|
+
project: A
|
|
264
|
+
}).filter((U) => U instanceof Blob)[0], !x) {
|
|
265
|
+
const U = l.get(u.APP_COOKIES.em_token) || await u.di.getInstance(C, Z.TOKEN_ID);
|
|
266
|
+
x = await (await fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(j)}`, { headers: { authorization: `Bearer ${U}` } })).blob();
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
if (
|
|
270
|
-
const
|
|
271
|
-
|
|
272
|
-
if (
|
|
273
|
-
const
|
|
274
|
-
typeof
|
|
275
|
-
},
|
|
276
|
-
})().catch((
|
|
277
|
-
|
|
269
|
+
if (E || !x) return;
|
|
270
|
+
const S = new FileReader();
|
|
271
|
+
S.onload = () => {
|
|
272
|
+
if (E) return;
|
|
273
|
+
const U = S.result;
|
|
274
|
+
typeof U == "string" && (p(U), v(x.type), D?.tools.import.openBackgroundImage(U));
|
|
275
|
+
}, S.onerror = () => {}, S.readAsDataURL(x);
|
|
276
|
+
})().catch((j) => {}), () => {
|
|
277
|
+
E = !0;
|
|
278
278
|
};
|
|
279
279
|
}, [
|
|
280
280
|
t,
|
|
281
281
|
e,
|
|
282
282
|
o,
|
|
283
283
|
l,
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
284
|
+
D,
|
|
285
|
+
B,
|
|
286
|
+
A,
|
|
287
|
+
C
|
|
288
288
|
]);
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
}, [
|
|
292
|
-
|
|
289
|
+
const z = (0, n.useCallback)(() => {
|
|
290
|
+
p(null), v(null), w(Z.closeSecondModal()), w(Z.closeModal(u.MODALS.UPLOAD_IMAGE_MODAL));
|
|
291
|
+
}, [w]), V = (0, n.useRef)();
|
|
292
|
+
V.current = async function(E, P, j) {
|
|
293
293
|
try {
|
|
294
|
-
const
|
|
295
|
-
a && await a(new File([
|
|
294
|
+
const x = wt(j, E);
|
|
295
|
+
a && await a(new File([x], P, {
|
|
296
296
|
lastModified: Date.now(),
|
|
297
|
-
type:
|
|
297
|
+
type: x.type
|
|
298
298
|
}));
|
|
299
|
-
} catch (
|
|
300
|
-
throw
|
|
299
|
+
} catch (x) {
|
|
300
|
+
throw x;
|
|
301
301
|
}
|
|
302
302
|
};
|
|
303
|
-
const ee = (0, n.useCallback)((
|
|
304
|
-
if (
|
|
303
|
+
const ee = (0, n.useCallback)((E) => {
|
|
304
|
+
if (E && !(O.current && D)) {
|
|
305
305
|
O.current = !0;
|
|
306
|
-
const P =
|
|
307
|
-
|
|
306
|
+
const P = y.locale ? y.locale.replace("_", "-") : "en-US", j = y.theme === "system" ? matchMedia("(prefers-color-scheme: dark)").matches ? u.DARK : u.LIGHT : y.theme;
|
|
307
|
+
ht.Tf.init({
|
|
308
308
|
selector: "#pixie-editor",
|
|
309
|
-
baseUrl: m.getBundledHostAssetUrl(
|
|
309
|
+
baseUrl: m.getBundledHostAssetUrl(Ct),
|
|
310
310
|
image: b,
|
|
311
311
|
activeLanguage: P,
|
|
312
|
-
languages:
|
|
313
|
-
tools:
|
|
312
|
+
languages: vt(P, I),
|
|
313
|
+
tools: bt,
|
|
314
314
|
ui: {
|
|
315
315
|
menubar: {
|
|
316
316
|
replaceDefaultItems: !0,
|
|
@@ -328,55 +328,55 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
328
328
|
type: "button",
|
|
329
329
|
icon: (0, r.jsx)(m.EmIcons, {
|
|
330
330
|
icon: "HistoryOutlined",
|
|
331
|
-
configIcons:
|
|
331
|
+
configIcons: G,
|
|
332
332
|
style: { fontSize: 20 }
|
|
333
333
|
}),
|
|
334
334
|
align: "right",
|
|
335
335
|
desktopOnly: !0,
|
|
336
|
-
action: (
|
|
337
|
-
|
|
336
|
+
action: (x) => {
|
|
337
|
+
x.togglePanel("history");
|
|
338
338
|
}
|
|
339
339
|
},
|
|
340
340
|
{
|
|
341
341
|
type: "button",
|
|
342
342
|
icon: (0, r.jsx)(m.EmIcons, {
|
|
343
343
|
icon: "CloseOutlined",
|
|
344
|
-
configIcons:
|
|
344
|
+
configIcons: G,
|
|
345
345
|
style: { fontSize: 20 }
|
|
346
346
|
}),
|
|
347
347
|
align: "right",
|
|
348
348
|
desktopOnly: !0,
|
|
349
|
-
action: () =>
|
|
349
|
+
action: () => z()
|
|
350
350
|
}
|
|
351
351
|
]
|
|
352
352
|
},
|
|
353
353
|
nav: { position: "top" },
|
|
354
|
-
activeTheme:
|
|
354
|
+
activeTheme: j,
|
|
355
355
|
mode: "inline",
|
|
356
356
|
forceOverlayModeOnMobile: !1
|
|
357
357
|
},
|
|
358
|
-
onSave: async function(
|
|
358
|
+
onSave: async function(x, S, U) {
|
|
359
359
|
try {
|
|
360
|
-
await
|
|
360
|
+
await V.current(x, S, U);
|
|
361
361
|
} catch {}
|
|
362
362
|
}
|
|
363
|
-
}).then((
|
|
364
|
-
|
|
365
|
-
}).catch((
|
|
363
|
+
}).then((x) => {
|
|
364
|
+
H(x);
|
|
365
|
+
}).catch((x) => {});
|
|
366
366
|
}
|
|
367
367
|
}, [
|
|
368
|
-
|
|
368
|
+
y.theme,
|
|
369
369
|
b,
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
]),
|
|
377
|
-
|
|
370
|
+
D,
|
|
371
|
+
H,
|
|
372
|
+
y.locale,
|
|
373
|
+
I,
|
|
374
|
+
z,
|
|
375
|
+
G
|
|
376
|
+
]), q = (0, n.useCallback)(() => {
|
|
377
|
+
D?.tools.export.save(t?.split("/").pop().split(".")[0], d?.split("/")[1]);
|
|
378
378
|
}, [
|
|
379
|
-
|
|
379
|
+
D,
|
|
380
380
|
t,
|
|
381
381
|
d
|
|
382
382
|
]);
|
|
@@ -392,17 +392,17 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
392
392
|
closable: !1,
|
|
393
393
|
zIndex: 1100,
|
|
394
394
|
mask: !1,
|
|
395
|
-
open:
|
|
395
|
+
open: L,
|
|
396
396
|
footer: [(0, r.jsx)(m.Button, {
|
|
397
397
|
className: "em-analytics__profile-cancel",
|
|
398
|
-
onClick:
|
|
399
|
-
children:
|
|
398
|
+
onClick: z,
|
|
399
|
+
children: I("Cancel")
|
|
400
400
|
}, "Cancel"), (0, r.jsx)(m.Button, {
|
|
401
401
|
className: "em-analytics__profile-updapixiete",
|
|
402
402
|
id: "save",
|
|
403
403
|
type: "primary",
|
|
404
|
-
onClick:
|
|
405
|
-
children:
|
|
404
|
+
onClick: q,
|
|
405
|
+
children: I("Update")
|
|
406
406
|
}, "Ok")],
|
|
407
407
|
children: [i && (0, r.jsx)("div", {
|
|
408
408
|
style: {
|
|
@@ -419,11 +419,11 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
419
419
|
children: (0, r.jsx)(m.Spin, { size: "large" })
|
|
420
420
|
}), (0, r.jsx)("div", { id: "pixie-editor" })]
|
|
421
421
|
});
|
|
422
|
-
},
|
|
422
|
+
}, It = ({ currentImageLink: t, newLink: e, previewDisplayUrl: o, resolvedPreviewObjectUrl: a, resolvedPreviewBlob: i, resolveImageBlob: l, onSave: b, uploadImageResultIsLoading: p }) => {
|
|
423
423
|
const d = o || a;
|
|
424
424
|
return (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)("div", { children: (0, r.jsxs)("div", {
|
|
425
425
|
className: "image-preview",
|
|
426
|
-
children: [
|
|
426
|
+
children: [p && (0, r.jsx)("div", {
|
|
427
427
|
style: {
|
|
428
428
|
position: "absolute",
|
|
429
429
|
height: "100%",
|
|
@@ -440,13 +440,13 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
440
440
|
alt: "uploadedImage",
|
|
441
441
|
src: d
|
|
442
442
|
})]
|
|
443
|
-
}) }), (0, r.jsx)(
|
|
443
|
+
}) }), (0, r.jsx)(At, {
|
|
444
444
|
currentImageLink: t,
|
|
445
445
|
prefetchedBlob: i,
|
|
446
446
|
resolveImageBlob: l,
|
|
447
447
|
newLink: e,
|
|
448
448
|
onSave: b,
|
|
449
|
-
uploadImageResultIsLoading:
|
|
449
|
+
uploadImageResultIsLoading: p
|
|
450
450
|
})] });
|
|
451
451
|
}, Re = {
|
|
452
452
|
Pixel: "Pixel",
|
|
@@ -455,7 +455,7 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
455
455
|
unit: Re.Percent,
|
|
456
456
|
value: 80
|
|
457
457
|
};
|
|
458
|
-
function
|
|
458
|
+
function xt(t) {
|
|
459
459
|
return typeof t == "number" ? {
|
|
460
460
|
unit: Re.Percent,
|
|
461
461
|
value: t * 100
|
|
@@ -467,136 +467,136 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
467
467
|
value: parseFloat(t)
|
|
468
468
|
} : Je : Je;
|
|
469
469
|
}
|
|
470
|
-
function
|
|
471
|
-
const o =
|
|
470
|
+
function St(t, e) {
|
|
471
|
+
const o = xt(t);
|
|
472
472
|
let a;
|
|
473
473
|
return o.unit === Re.Pixel ? a = `${o.value}px` : a = `${100 - o.value}%`, e ? `${a} 0px 0px 0px` : `0px 0px ${a} 0px`;
|
|
474
474
|
}
|
|
475
|
-
function $e({ next: t, hasMore: e, children: o, loader: a, scrollThreshold: i = .8, endMessage: l, style: b, height:
|
|
476
|
-
const [ee,
|
|
477
|
-
|
|
478
|
-
const s = (0, n.useRef)(
|
|
479
|
-
s.current =
|
|
480
|
-
const h = (0, n.useRef)(
|
|
481
|
-
h.current =
|
|
482
|
-
const W = (0, n.useRef)(!1),
|
|
475
|
+
function $e({ next: t, hasMore: e, children: o, loader: a, scrollThreshold: i = .8, endMessage: l, style: b, height: p, scrollableTarget: d, hasChildren: v, inverse: I = !1, pullDownToRefresh: w = !1, pullDownToRefreshContent: C, releaseToRefreshContent: R, pullDownToRefreshThreshold: y = 100, refreshFunction: L, onScroll: A, dataLength: G, initialScrollY: O, className: D = "", role: H, tabIndex: B, id: z, ...V }) {
|
|
476
|
+
const [ee, q] = (0, n.useState)(!1), [E, P] = (0, n.useState)(!1), [j, x] = (0, n.useState)(0), S = (0, n.useRef)(null), U = (0, n.useRef)(null), _ = (0, n.useRef)(null), K = (0, n.useRef)(t);
|
|
477
|
+
K.current = t;
|
|
478
|
+
const s = (0, n.useRef)(L);
|
|
479
|
+
s.current = L;
|
|
480
|
+
const h = (0, n.useRef)(y);
|
|
481
|
+
h.current = y;
|
|
482
|
+
const W = (0, n.useRef)(!1), me = (0, n.useRef)(!1), T = (0, n.useRef)(0), J = (0, n.useRef)(0), $ = (0, n.useRef)(0), F = (0, n.useCallback)(() => d instanceof HTMLElement ? d : typeof d == "string" ? document.getElementById(d) : null, [d]);
|
|
483
483
|
(0, n.useEffect)(() => {
|
|
484
|
-
if (typeof
|
|
485
|
-
if (
|
|
484
|
+
if (typeof G > "u") throw new Error("mandatory prop \"dataLength\" is missing. The prop is needed when loading more content. Check README.md for usage");
|
|
485
|
+
if (w && typeof L != "function") throw new Error(`Mandatory prop "refreshFunction" missing.
|
|
486
486
|
Pull Down To Refresh functionality will not work
|
|
487
487
|
as expected. Check README.md for usage'`);
|
|
488
488
|
if (typeof O == "number") {
|
|
489
|
-
const
|
|
490
|
-
|
|
489
|
+
const Y = p ? S.current : F();
|
|
490
|
+
Y && Y.scrollHeight > O && Y.scrollTo(0, O);
|
|
491
491
|
}
|
|
492
492
|
}, []), (0, n.useEffect)(() => {
|
|
493
|
-
W.current = !1,
|
|
494
|
-
}, [
|
|
493
|
+
W.current = !1, q(!1);
|
|
494
|
+
}, [G]), (0, n.useEffect)(() => {
|
|
495
495
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
496
|
-
const
|
|
497
|
-
if (!
|
|
498
|
-
const
|
|
499
|
-
!ae.isIntersecting || W.current || (W.current = !0,
|
|
496
|
+
const Y = U.current;
|
|
497
|
+
if (!Y) return;
|
|
498
|
+
const re = p ? S.current : F(), M = new IntersectionObserver(([ae]) => {
|
|
499
|
+
!ae.isIntersecting || W.current || (W.current = !0, q(!0), K.current());
|
|
500
500
|
}, {
|
|
501
|
-
root:
|
|
502
|
-
rootMargin:
|
|
501
|
+
root: re,
|
|
502
|
+
rootMargin: St(i, I),
|
|
503
503
|
threshold: 0
|
|
504
504
|
});
|
|
505
|
-
return
|
|
505
|
+
return M.observe(Y), () => M.disconnect();
|
|
506
506
|
}, [
|
|
507
507
|
e,
|
|
508
508
|
i,
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
509
|
+
I,
|
|
510
|
+
p,
|
|
511
|
+
F
|
|
512
512
|
]), (0, n.useEffect)(() => {
|
|
513
|
-
var
|
|
514
|
-
if (!
|
|
515
|
-
const
|
|
516
|
-
if (!
|
|
517
|
-
const
|
|
518
|
-
setTimeout(() =>
|
|
513
|
+
var Y;
|
|
514
|
+
if (!A) return;
|
|
515
|
+
const re = (Y = p ? S.current : F()) !== null && Y !== void 0 ? Y : typeof window < "u" ? window : null;
|
|
516
|
+
if (!re) return;
|
|
517
|
+
const M = (ae) => {
|
|
518
|
+
setTimeout(() => A(ae), 0);
|
|
519
519
|
};
|
|
520
|
-
return
|
|
520
|
+
return re.addEventListener("scroll", M), () => re.removeEventListener("scroll", M);
|
|
521
521
|
}, [
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
522
|
+
A,
|
|
523
|
+
p,
|
|
524
|
+
F
|
|
525
525
|
]), (0, n.useEffect)(() => {
|
|
526
|
-
var
|
|
527
|
-
if (!
|
|
528
|
-
const
|
|
529
|
-
if (!
|
|
530
|
-
if (!((
|
|
531
|
-
const
|
|
532
|
-
|
|
526
|
+
var Y, re;
|
|
527
|
+
if (!w) return;
|
|
528
|
+
const M = (Y = p ? S.current : F()) !== null && Y !== void 0 ? Y : typeof window < "u" ? window : null;
|
|
529
|
+
if (!M) return;
|
|
530
|
+
if (!((re = _.current) === null || re === void 0) && re.firstChild) {
|
|
531
|
+
const X = _.current.firstChild.getBoundingClientRect().height;
|
|
532
|
+
$.current = X, x(X);
|
|
533
533
|
}
|
|
534
|
-
const ae = (
|
|
535
|
-
(
|
|
536
|
-
},
|
|
537
|
-
if (!
|
|
538
|
-
const
|
|
539
|
-
|
|
534
|
+
const ae = (X) => {
|
|
535
|
+
(M instanceof HTMLElement ? M.scrollTop : document.documentElement.scrollTop) > 0 || (me.current = !0, X instanceof MouseEvent ? T.current = X.pageY : X instanceof TouchEvent && (T.current = X.touches[0].pageY), J.current = T.current, S.current && (S.current.style.willChange = "transform", S.current.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)"));
|
|
536
|
+
}, g = (X) => {
|
|
537
|
+
if (!me.current || (X instanceof MouseEvent ? J.current = X.pageY : X instanceof TouchEvent && (J.current = X.touches[0].pageY), J.current < T.current)) return;
|
|
538
|
+
const ce = J.current - T.current;
|
|
539
|
+
ce >= h.current && P(!0), !(ce > $.current * 1.5) && S.current && (S.current.style.overflow = "visible", S.current.style.transform = `translate3d(0px, ${ce}px, 0px)`);
|
|
540
540
|
}, te = () => {
|
|
541
|
-
|
|
542
|
-
var
|
|
543
|
-
return
|
|
541
|
+
T.current = 0, J.current = 0, me.current = !1, P((X) => {
|
|
542
|
+
var ce;
|
|
543
|
+
return X && ((ce = s.current) === null || ce === void 0 || ce.call(s)), !1;
|
|
544
544
|
}), requestAnimationFrame(() => {
|
|
545
|
-
|
|
545
|
+
S.current && (S.current.style.overflow = "auto", S.current.style.transform = "none", S.current.style.willChange = "unset");
|
|
546
546
|
});
|
|
547
547
|
};
|
|
548
|
-
return
|
|
549
|
-
|
|
548
|
+
return M.addEventListener("touchstart", ae), M.addEventListener("touchmove", g), M.addEventListener("touchend", te), M.addEventListener("mousedown", ae), M.addEventListener("mousemove", g), M.addEventListener("mouseup", te), () => {
|
|
549
|
+
M.removeEventListener("touchstart", ae), M.removeEventListener("touchmove", g), M.removeEventListener("touchend", te), M.removeEventListener("mousedown", ae), M.removeEventListener("mousemove", g), M.removeEventListener("mouseup", te);
|
|
550
550
|
};
|
|
551
551
|
}, [
|
|
552
|
+
w,
|
|
552
553
|
p,
|
|
553
|
-
|
|
554
|
-
H
|
|
554
|
+
F
|
|
555
555
|
]);
|
|
556
|
-
const
|
|
557
|
-
height:
|
|
556
|
+
const he = {
|
|
557
|
+
height: p ?? "auto",
|
|
558
558
|
overflow: "auto",
|
|
559
559
|
WebkitOverflowScrolling: "touch",
|
|
560
560
|
...b
|
|
561
|
-
},
|
|
562
|
-
ref:
|
|
561
|
+
}, ie = v || !!(o && o instanceof Array && o.length), pe = w && p ? { overflow: "auto" } : {}, Ae = e ? (0, r.jsx)("div", {
|
|
562
|
+
ref: U,
|
|
563
563
|
style: { height: 1 }
|
|
564
564
|
}) : null;
|
|
565
565
|
return (0, r.jsx)("div", {
|
|
566
|
-
style:
|
|
566
|
+
style: pe,
|
|
567
567
|
className: "infinite-scroll-component__outerdiv",
|
|
568
568
|
children: (0, r.jsxs)("div", {
|
|
569
|
-
...
|
|
570
|
-
role:
|
|
571
|
-
tabIndex:
|
|
572
|
-
id:
|
|
573
|
-
className: ["infinite-scroll-component",
|
|
574
|
-
ref:
|
|
575
|
-
style:
|
|
569
|
+
...V,
|
|
570
|
+
role: H,
|
|
571
|
+
tabIndex: B,
|
|
572
|
+
id: z,
|
|
573
|
+
className: ["infinite-scroll-component", D].filter(Boolean).join(" "),
|
|
574
|
+
ref: S,
|
|
575
|
+
style: he,
|
|
576
576
|
children: [
|
|
577
|
-
|
|
577
|
+
w && (0, r.jsx)("div", {
|
|
578
578
|
style: { position: "relative" },
|
|
579
|
-
ref:
|
|
579
|
+
ref: _,
|
|
580
580
|
children: (0, r.jsx)("div", {
|
|
581
581
|
style: {
|
|
582
582
|
position: "absolute",
|
|
583
583
|
left: 0,
|
|
584
584
|
right: 0,
|
|
585
|
-
top: -1 *
|
|
585
|
+
top: -1 * j
|
|
586
586
|
},
|
|
587
|
-
children:
|
|
587
|
+
children: E ? R : C
|
|
588
588
|
})
|
|
589
589
|
}),
|
|
590
590
|
o,
|
|
591
|
-
!ee && !
|
|
591
|
+
!ee && !ie && e && a,
|
|
592
592
|
ee && e && a,
|
|
593
|
-
|
|
593
|
+
Ae,
|
|
594
594
|
!e && l
|
|
595
595
|
]
|
|
596
596
|
})
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Rt(t, e) {
|
|
600
600
|
if (t == null) return {};
|
|
601
601
|
var o = kt(t, e), a, i;
|
|
602
602
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -630,18 +630,18 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
630
630
|
}
|
|
631
631
|
return o;
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function ke(t) {
|
|
634
634
|
for (var e = 1; e < arguments.length; e++) {
|
|
635
635
|
var o = arguments[e] != null ? arguments[e] : {};
|
|
636
636
|
e % 2 ? et(Object(o), !0).forEach(function(a) {
|
|
637
|
-
|
|
637
|
+
jt(t, a, o[a]);
|
|
638
638
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : et(Object(o)).forEach(function(a) {
|
|
639
639
|
Object.defineProperty(t, a, Object.getOwnPropertyDescriptor(o, a));
|
|
640
640
|
});
|
|
641
641
|
}
|
|
642
642
|
return t;
|
|
643
643
|
}
|
|
644
|
-
function
|
|
644
|
+
function jt(t, e, o) {
|
|
645
645
|
return e in t ? Object.defineProperty(t, e, {
|
|
646
646
|
value: o,
|
|
647
647
|
enumerable: !0,
|
|
@@ -649,7 +649,7 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
649
649
|
writable: !0
|
|
650
650
|
}) : t[e] = o, t;
|
|
651
651
|
}
|
|
652
|
-
var
|
|
652
|
+
var Et = {
|
|
653
653
|
breakpointCols: void 0,
|
|
654
654
|
className: void 0,
|
|
655
655
|
columnClassName: void 0,
|
|
@@ -703,15 +703,15 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
703
703
|
const { column: t, columnAttrs: e = {}, columnClassName: o } = this.props, a = this.itemsInColumns(), i = `${100 / a.length}%`;
|
|
704
704
|
let l = o;
|
|
705
705
|
l && typeof l != "string" && (this.logDeprecated("The property \"columnClassName\" requires a string"), typeof l > "u" && (l = "my-masonry-grid_column"));
|
|
706
|
-
const b =
|
|
707
|
-
style:
|
|
706
|
+
const b = ke(ke(ke({}, t), e), {}, {
|
|
707
|
+
style: ke(ke({}, e.style), {}, { width: i }),
|
|
708
708
|
className: l
|
|
709
709
|
});
|
|
710
|
-
return a.map((
|
|
710
|
+
return a.map((p, d) => n.default.createElement("div", De({}, b, { key: d }), p));
|
|
711
711
|
}
|
|
712
712
|
logDeprecated(t) {}
|
|
713
713
|
render() {
|
|
714
|
-
const t = this.props, { children: e, breakpointCols: o, columnClassName: a, columnAttrs: i, column: l, className: b } = t,
|
|
714
|
+
const t = this.props, { children: e, breakpointCols: o, columnClassName: a, columnAttrs: i, column: l, className: b } = t, p = Rt(t, [
|
|
715
715
|
"children",
|
|
716
716
|
"breakpointCols",
|
|
717
717
|
"columnClassName",
|
|
@@ -720,11 +720,11 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
720
720
|
"className"
|
|
721
721
|
]);
|
|
722
722
|
let d = b;
|
|
723
|
-
return typeof b != "string" && (this.logDeprecated("The property \"className\" requires a string"), typeof b > "u" && (d = "my-masonry-grid")), n.default.createElement("div", De({},
|
|
723
|
+
return typeof b != "string" && (this.logDeprecated("The property \"className\" requires a string"), typeof b > "u" && (d = "my-masonry-grid")), n.default.createElement("div", De({}, p, { className: d }), this.renderColumns());
|
|
724
724
|
}
|
|
725
725
|
};
|
|
726
|
-
Ne.defaultProps =
|
|
727
|
-
function
|
|
726
|
+
Ne.defaultProps = Et;
|
|
727
|
+
function Ge(t, e) {
|
|
728
728
|
return t ? t.exhausted ? {
|
|
729
729
|
...t,
|
|
730
730
|
src: null
|
|
@@ -734,20 +734,20 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
734
734
|
} : null;
|
|
735
735
|
}
|
|
736
736
|
function tt({ items: t, getItemId: e, getRequestUrl: o, createController: a }) {
|
|
737
|
-
const [i, l] = (0, n.useState)({}), b = (0, n.useRef)(new Map()),
|
|
738
|
-
const
|
|
739
|
-
if (b.current.has(
|
|
740
|
-
itemId:
|
|
741
|
-
requestUrl:
|
|
742
|
-
cacheKey:
|
|
743
|
-
controller: b.current.get(
|
|
737
|
+
const [i, l] = (0, n.useState)({}), b = (0, n.useRef)(new Map()), p = (0, n.useCallback)((d) => {
|
|
738
|
+
const v = e(d), I = o(d), w = `${v}:${I}`;
|
|
739
|
+
if (b.current.has(w)) return {
|
|
740
|
+
itemId: v,
|
|
741
|
+
requestUrl: I,
|
|
742
|
+
cacheKey: w,
|
|
743
|
+
controller: b.current.get(w)
|
|
744
744
|
};
|
|
745
|
-
const
|
|
746
|
-
return b.current.set(
|
|
747
|
-
itemId:
|
|
748
|
-
requestUrl:
|
|
749
|
-
cacheKey:
|
|
750
|
-
controller:
|
|
745
|
+
const C = a(I);
|
|
746
|
+
return b.current.set(w, C), {
|
|
747
|
+
itemId: v,
|
|
748
|
+
requestUrl: I,
|
|
749
|
+
cacheKey: w,
|
|
750
|
+
controller: C
|
|
751
751
|
};
|
|
752
752
|
}, [
|
|
753
753
|
a,
|
|
@@ -755,103 +755,103 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
755
755
|
o
|
|
756
756
|
]);
|
|
757
757
|
return (0, n.useEffect)(() => {
|
|
758
|
-
const d = new Set(),
|
|
759
|
-
const { itemId:
|
|
760
|
-
d.add(
|
|
761
|
-
const
|
|
762
|
-
return
|
|
763
|
-
const
|
|
764
|
-
!
|
|
758
|
+
const d = new Set(), v = {}, I = t.map((w) => {
|
|
759
|
+
const { itemId: C, cacheKey: R, controller: y } = p(w);
|
|
760
|
+
d.add(R), v[C] = y.src;
|
|
761
|
+
const L = Ge(y.handleChangeSrc?.(), y.src);
|
|
762
|
+
return L?.changed && L.src && (v[C] = L.src), y.subscribeToSrcChange?.((A) => {
|
|
763
|
+
const G = Ge(A, y.src);
|
|
764
|
+
!G?.changed || !G.src || l((O) => O[C] === G.src ? O : {
|
|
765
765
|
...O,
|
|
766
|
-
[
|
|
766
|
+
[C]: G.src
|
|
767
767
|
});
|
|
768
768
|
});
|
|
769
769
|
}).filter(Boolean);
|
|
770
|
-
return b.current.forEach((
|
|
771
|
-
d.has(
|
|
772
|
-
}), l(
|
|
773
|
-
|
|
770
|
+
return b.current.forEach((w, C) => {
|
|
771
|
+
d.has(C) || b.current.delete(C);
|
|
772
|
+
}), l(v), () => {
|
|
773
|
+
I.forEach((w) => w?.());
|
|
774
774
|
};
|
|
775
|
-
}, [
|
|
775
|
+
}, [p, t]), {
|
|
776
776
|
getDisplaySrc: (0, n.useCallback)((d) => {
|
|
777
|
-
const { itemId:
|
|
778
|
-
return i[
|
|
779
|
-
}, [i,
|
|
777
|
+
const { itemId: v, requestUrl: I, controller: w } = p(d);
|
|
778
|
+
return i[v] || w.src || I;
|
|
779
|
+
}, [i, p]),
|
|
780
780
|
handleLoad: (0, n.useCallback)((d) => {
|
|
781
|
-
|
|
782
|
-
}, [
|
|
781
|
+
p(d).controller.handleSuccess();
|
|
782
|
+
}, [p]),
|
|
783
783
|
handleError: (0, n.useCallback)((d) => {
|
|
784
|
-
const { itemId:
|
|
785
|
-
|
|
786
|
-
...
|
|
787
|
-
[
|
|
784
|
+
const { itemId: v, controller: I } = p(d), w = Ge(I.handleError(), I.src);
|
|
785
|
+
w?.changed && w.src && l((C) => ({
|
|
786
|
+
...C,
|
|
787
|
+
[v]: w.src
|
|
788
788
|
}));
|
|
789
|
-
}, [
|
|
789
|
+
}, [p])
|
|
790
790
|
};
|
|
791
791
|
}
|
|
792
|
-
var nt = "blocks",
|
|
793
|
-
const
|
|
794
|
-
|
|
792
|
+
var nt = "blocks", Ot = ({ setCurrentImageLink: t, setModalHeight: e, setModalWidth: o, setImageStockList: a, imageStockList: i, currentReq: l, setCurrentReq: b, inputRef: p, setStockLink: d, customRequest: v }) => {
|
|
793
|
+
const I = u.useAppConfig(), w = u.useIsStandalone(), [C, R] = (0, n.useState)(!1), [y, L] = (0, n.useState)(2), { __: A } = m.useI18n(), G = m.useNotification(), [O] = Z.useLazyGetUnsplashImageQuery(), [D] = Z.useLazyGetSearchImageQuery(), H = (0, n.useCallback)((s) => s instanceof Error || typeof s?.message == "string" && s.message ? s.message : typeof s?.error?.message == "string" && s.error.message ? s.error.message : A("Failed to load stock images through the configured proxy chain."), [A]), B = (0, n.useCallback)((s) => {
|
|
794
|
+
G.error({
|
|
795
795
|
id: "STOCK_IMAGES_SEARCH_FAILED",
|
|
796
|
-
title:
|
|
797
|
-
description:
|
|
796
|
+
title: A("Failed to load stock images"),
|
|
797
|
+
description: H(s)
|
|
798
798
|
});
|
|
799
799
|
}, [
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
]),
|
|
804
|
-
|
|
800
|
+
A,
|
|
801
|
+
H,
|
|
802
|
+
G
|
|
803
|
+
]), z = async () => {
|
|
804
|
+
C || (R(!0), D({
|
|
805
805
|
query: l,
|
|
806
|
-
page:
|
|
806
|
+
page: y
|
|
807
807
|
}).then((s) => {
|
|
808
808
|
if (s?.error) {
|
|
809
|
-
|
|
809
|
+
B(s.error), R(!1);
|
|
810
810
|
return;
|
|
811
811
|
}
|
|
812
812
|
const h = s?.data?.results || [];
|
|
813
|
-
a((W) => [...W, ...h]),
|
|
813
|
+
a((W) => [...W, ...h]), R(!1), L((W) => W + 1);
|
|
814
814
|
}).catch(() => {
|
|
815
|
-
|
|
815
|
+
R(!1);
|
|
816
816
|
}));
|
|
817
817
|
};
|
|
818
818
|
(0, n.useEffect)(() => {
|
|
819
|
-
l.keywords !== "" &&
|
|
819
|
+
l.keywords !== "" && V();
|
|
820
820
|
}, [l.color, l.orientation]);
|
|
821
|
-
const
|
|
822
|
-
const s = await
|
|
821
|
+
const V = async () => {
|
|
822
|
+
const s = await D({
|
|
823
823
|
query: l,
|
|
824
824
|
page: 1
|
|
825
825
|
});
|
|
826
826
|
if (s?.error) {
|
|
827
|
-
|
|
827
|
+
B(s.error), a([]);
|
|
828
828
|
return;
|
|
829
829
|
}
|
|
830
830
|
const h = s?.data?.results || [];
|
|
831
831
|
h.length > 0 ? (a(h), setTimeout(() => {
|
|
832
832
|
o(1060), e("84vh");
|
|
833
833
|
}, 0)) : a([]);
|
|
834
|
-
}, [ee,
|
|
835
|
-
config:
|
|
836
|
-
standalone:
|
|
834
|
+
}, [ee, q] = (0, n.useState)(null), E = (0, n.useCallback)((s, h, W) => `${s}${s.includes("?") ? "&" : "?"}w=${h}&q=${W}`, []), P = (0, n.useCallback)((s) => u.getProxiedUrl(s, {
|
|
835
|
+
config: I,
|
|
836
|
+
standalone: w,
|
|
837
837
|
resourceType: "stockImages",
|
|
838
838
|
intent: "display"
|
|
839
|
-
}), [
|
|
839
|
+
}), [I, w]), { getDisplaySrc: j, handleLoad: x, handleError: S } = tt({
|
|
840
840
|
items: i,
|
|
841
841
|
getItemId: (0, n.useCallback)((s) => s.id, []),
|
|
842
|
-
getRequestUrl: (0, n.useCallback)((s) =>
|
|
842
|
+
getRequestUrl: (0, n.useCallback)((s) => E(s.urls.raw, 644, 96), [E]),
|
|
843
843
|
createController: P
|
|
844
|
-
}),
|
|
845
|
-
|
|
846
|
-
},
|
|
847
|
-
|
|
848
|
-
},
|
|
849
|
-
O(h.download_location),
|
|
844
|
+
}), U = (s) => (h) => {
|
|
845
|
+
x(s), h.target.parentNode.classList.add("loaded");
|
|
846
|
+
}, _ = (s) => () => {
|
|
847
|
+
S(s);
|
|
848
|
+
}, K = (s, h, W) => {
|
|
849
|
+
O(h.download_location), q(W), setTimeout(() => q(null), 2e3), d(`${s.raw}&w=1200&q=96`), t(`${s.raw}&w=1200&q=96`), v(`${s.raw}&w=1200&q=96`);
|
|
850
850
|
};
|
|
851
851
|
return (0, r.jsxs)("div", {
|
|
852
852
|
className: "stock-tab",
|
|
853
853
|
children: [(0, r.jsxs)(m.Form, {
|
|
854
|
-
onValuesChange:
|
|
854
|
+
onValuesChange: V,
|
|
855
855
|
className: i.length > 0 ? "serach-results" : "",
|
|
856
856
|
children: [(0, r.jsxs)(m.Row, {
|
|
857
857
|
gutter: 24,
|
|
@@ -860,16 +860,16 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
860
860
|
children: (0, r.jsx)(m.Form.Item, {
|
|
861
861
|
className: "stock-search-input",
|
|
862
862
|
children: (0, r.jsx)(m.SearchInput, {
|
|
863
|
-
onSearch:
|
|
863
|
+
onSearch: V,
|
|
864
864
|
allowClear: !0,
|
|
865
865
|
size: i.length > 0 ? "medium" : "large",
|
|
866
|
-
placeholder:
|
|
866
|
+
placeholder: A("Search image"),
|
|
867
867
|
value: l.keywords,
|
|
868
868
|
onChange: (s) => b((h) => ({
|
|
869
869
|
...h,
|
|
870
870
|
keywords: s.target.value
|
|
871
871
|
})),
|
|
872
|
-
ref:
|
|
872
|
+
ref: p,
|
|
873
873
|
spellCheck: "false",
|
|
874
874
|
enterButton: !1
|
|
875
875
|
})
|
|
@@ -882,35 +882,35 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
882
882
|
})),
|
|
883
883
|
children: [
|
|
884
884
|
(0, r.jsx)(m.Tooltip, {
|
|
885
|
-
title:
|
|
885
|
+
title: A("All"),
|
|
886
886
|
placement: "top",
|
|
887
887
|
children: (0, r.jsx)(m.Radio.Button, {
|
|
888
888
|
value: "",
|
|
889
|
-
children: (0, r.jsx)(
|
|
889
|
+
children: (0, r.jsx)(N.EmIcons, { icon: "MixedView" })
|
|
890
890
|
})
|
|
891
891
|
}),
|
|
892
892
|
(0, r.jsx)(m.Tooltip, {
|
|
893
|
-
title:
|
|
893
|
+
title: A("Landscape"),
|
|
894
894
|
placement: "top",
|
|
895
895
|
children: (0, r.jsx)(m.Radio.Button, {
|
|
896
896
|
value: "landscape",
|
|
897
|
-
children: (0, r.jsx)(
|
|
897
|
+
children: (0, r.jsx)(N.EmIcons, { icon: "LandscapeView" })
|
|
898
898
|
})
|
|
899
899
|
}),
|
|
900
900
|
(0, r.jsx)(m.Tooltip, {
|
|
901
|
-
title:
|
|
901
|
+
title: A("Portrait"),
|
|
902
902
|
placement: "top",
|
|
903
903
|
children: (0, r.jsx)(m.Radio.Button, {
|
|
904
904
|
value: "portrait",
|
|
905
|
-
children: (0, r.jsx)(
|
|
905
|
+
children: (0, r.jsx)(N.EmIcons, { icon: "PortraitView" })
|
|
906
906
|
})
|
|
907
907
|
}),
|
|
908
908
|
(0, r.jsx)(m.Tooltip, {
|
|
909
|
-
title:
|
|
909
|
+
title: A("Squarish"),
|
|
910
910
|
placement: "top",
|
|
911
911
|
children: (0, r.jsx)(m.Radio.Button, {
|
|
912
912
|
value: "squarish",
|
|
913
|
-
children: (0, r.jsx)(
|
|
913
|
+
children: (0, r.jsx)(N.EmIcons, { icon: "SquareView" })
|
|
914
914
|
})
|
|
915
915
|
})
|
|
916
916
|
]
|
|
@@ -924,57 +924,57 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
924
924
|
{
|
|
925
925
|
value: "",
|
|
926
926
|
colorClass: "all-colors",
|
|
927
|
-
label:
|
|
927
|
+
label: A("All")
|
|
928
928
|
},
|
|
929
929
|
{
|
|
930
930
|
value: "black",
|
|
931
931
|
colorClass: "black-color",
|
|
932
|
-
label:
|
|
932
|
+
label: A("Black")
|
|
933
933
|
},
|
|
934
934
|
{
|
|
935
935
|
value: "black_and_white",
|
|
936
936
|
colorClass: "bw-color",
|
|
937
|
-
label:
|
|
937
|
+
label: A("Black and White")
|
|
938
938
|
},
|
|
939
939
|
{
|
|
940
940
|
value: "white",
|
|
941
941
|
colorClass: "white-color",
|
|
942
|
-
label:
|
|
942
|
+
label: A("White")
|
|
943
943
|
},
|
|
944
944
|
{
|
|
945
945
|
value: "orange",
|
|
946
946
|
colorClass: "orange-color",
|
|
947
|
-
label:
|
|
947
|
+
label: A("Orange")
|
|
948
948
|
},
|
|
949
949
|
{
|
|
950
950
|
value: "red",
|
|
951
951
|
colorClass: "red-color",
|
|
952
|
-
label:
|
|
952
|
+
label: A("Red")
|
|
953
953
|
},
|
|
954
954
|
{
|
|
955
955
|
value: "purple",
|
|
956
956
|
colorClass: "purple-color",
|
|
957
|
-
label:
|
|
957
|
+
label: A("Purple")
|
|
958
958
|
},
|
|
959
959
|
{
|
|
960
960
|
value: "magenta",
|
|
961
961
|
colorClass: "magenta-color",
|
|
962
|
-
label:
|
|
962
|
+
label: A("Magenta")
|
|
963
963
|
},
|
|
964
964
|
{
|
|
965
965
|
value: "green",
|
|
966
966
|
colorClass: "green-color",
|
|
967
|
-
label:
|
|
967
|
+
label: A("Green")
|
|
968
968
|
},
|
|
969
969
|
{
|
|
970
970
|
value: "teal",
|
|
971
971
|
colorClass: "teal-color",
|
|
972
|
-
label:
|
|
972
|
+
label: A("Teal")
|
|
973
973
|
},
|
|
974
974
|
{
|
|
975
975
|
value: "blue",
|
|
976
976
|
colorClass: "blue-color",
|
|
977
|
-
label:
|
|
977
|
+
label: A("Blue")
|
|
978
978
|
}
|
|
979
979
|
],
|
|
980
980
|
tooltipPlacement: "top"
|
|
@@ -1004,11 +1004,11 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
1004
1004
|
},
|
|
1005
1005
|
children: (0, r.jsx)($e, {
|
|
1006
1006
|
dataLength: i && i.length,
|
|
1007
|
-
next:
|
|
1007
|
+
next: z,
|
|
1008
1008
|
hasMore: i,
|
|
1009
1009
|
endMessage: (0, r.jsxs)(m.Divider, {
|
|
1010
1010
|
plain: !0,
|
|
1011
|
-
children: [
|
|
1011
|
+
children: [A("That`s all we could find."), " 🤐"]
|
|
1012
1012
|
}),
|
|
1013
1013
|
scrollableTarget: "scrollableDiv",
|
|
1014
1014
|
style: { overflow: "visible" },
|
|
@@ -1019,15 +1019,15 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
1019
1019
|
columnClassName: "my-masonry-grid_column",
|
|
1020
1020
|
children: i.map((s) => (0, r.jsxs)("div", {
|
|
1021
1021
|
className: "list-item",
|
|
1022
|
-
onClick: () =>
|
|
1022
|
+
onClick: () => K(s.urls, s.links, s.id),
|
|
1023
1023
|
children: [
|
|
1024
1024
|
(0, r.jsx)("img", {
|
|
1025
1025
|
className: ee === s.id ? "loaded-image" : "",
|
|
1026
1026
|
width: "322px",
|
|
1027
|
-
src:
|
|
1027
|
+
src: j(s),
|
|
1028
1028
|
alt: s.description,
|
|
1029
|
-
onLoad:
|
|
1030
|
-
onError:
|
|
1029
|
+
onLoad: U(s),
|
|
1030
|
+
onError: _(s)
|
|
1031
1031
|
}),
|
|
1032
1032
|
(0, r.jsxs)("p", {
|
|
1033
1033
|
className: "creator-info",
|
|
@@ -1067,11 +1067,11 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
1067
1067
|
function rt(t) {
|
|
1068
1068
|
return /^(https?:)?\/\//i.test(t.trim());
|
|
1069
1069
|
}
|
|
1070
|
-
function
|
|
1070
|
+
function Lt(t) {
|
|
1071
1071
|
const e = t.trim();
|
|
1072
1072
|
return rt(e) || /^data:/i.test(e) ? e : `data:image/jpeg;base64, ${t}`;
|
|
1073
1073
|
}
|
|
1074
|
-
var
|
|
1074
|
+
var Dt = ({ images: t, transitionDuration: e = 1e3 }) => {
|
|
1075
1075
|
const [o, a] = (0, n.useState)([]);
|
|
1076
1076
|
return (0, n.useEffect)(() => {
|
|
1077
1077
|
if (t.length > 0) {
|
|
@@ -1080,7 +1080,7 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
1080
1080
|
src: i,
|
|
1081
1081
|
opacity: 0
|
|
1082
1082
|
}]), setTimeout(() => {
|
|
1083
|
-
a((l) => l.map((b,
|
|
1083
|
+
a((l) => l.map((b, p) => p === l.length - 1 ? {
|
|
1084
1084
|
...b,
|
|
1085
1085
|
opacity: 1
|
|
1086
1086
|
} : b));
|
|
@@ -1089,7 +1089,7 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
1089
1089
|
}, [t]), (0, r.jsx)("div", {
|
|
1090
1090
|
className: "slideshow-container",
|
|
1091
1091
|
children: o.map((i, l) => (0, r.jsx)("img", {
|
|
1092
|
-
src:
|
|
1092
|
+
src: Lt(i.src),
|
|
1093
1093
|
alt: `Slide ${l + 1}`,
|
|
1094
1094
|
className: "slideshow-image",
|
|
1095
1095
|
style: {
|
|
@@ -1099,115 +1099,115 @@ __useblocks__.define("static/core/87969347.js", [
|
|
|
1099
1099
|
}, l))
|
|
1100
1100
|
});
|
|
1101
1101
|
};
|
|
1102
|
-
function
|
|
1103
|
-
const { __:
|
|
1104
|
-
limitsInPlugin:
|
|
1105
|
-
hostedAiActive:
|
|
1106
|
-
}),
|
|
1107
|
-
|
|
1102
|
+
function Bt({ setModalHeight: t, customRequest: e, aiTabRef: o, isImageUploaded: a, setIsImageUploaded: i, aiImageRequest: l, imageAiList: b, setImageAiList: p, isLoadingAi: d, setIsLoadingAi: v, onPluginAiImageLimitExceeded: I, onImageGenerateLimitExceeded: w }) {
|
|
1103
|
+
const { __: C } = m.useI18n(), R = u.useAppConfig(), y = m.useNotification(), L = u.usePushToDataLayer(), { emailId: A, blockId: G, projectId: O } = u.useParams(), [D] = Z.useLazySendAiImageRequestQuery(), [H, { data: B = [] }] = Z.useLazyGetAiImageSSEQuery(), [z] = Z.useLazyGetLimitsStatsByTypeQuery(), V = R?.sendAIImageRequest || D, ee = R?.trigger || H, q = R?.handleLimitUsageEmitter || u.useEventEmitter(u.events.ON_LIMIT_ID), [E, P] = (0, n.useState)(0), [j, x] = (0, n.useState)(null), [S, U] = (0, n.useState)(!1), [_, K] = (0, n.useState)(C("Evaluating the task")), [s, h] = (0, n.useState)(!1), W = A || G, { limits: me } = R?.limits ? R : { limits: { ai_img_limit: 0 } }, { ai_img_limit: T } = me, J = !!(R.limits && R.counters) && u.PLUGIN.isPlugin, $ = u.useEventEmitter(u.events.AI_IMAGE_REQUEST_ID).hasListeners(), F = ne.shouldCountAiUsage({
|
|
1104
|
+
limitsInPlugin: J,
|
|
1105
|
+
hostedAiActive: $
|
|
1106
|
+
}), he = !$ && T > 0 && E >= T, ie = (0, n.useCallback)(() => {
|
|
1107
|
+
q.fire({
|
|
1108
1108
|
name: "AiImgCount",
|
|
1109
|
-
count:
|
|
1109
|
+
count: E + 1
|
|
1110
1110
|
});
|
|
1111
|
-
}, [
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
]),
|
|
1117
|
-
|
|
1111
|
+
}, [q, E]), pe = (0, n.useMemo)(() => !he && (!F || T === 0 || E < T), [
|
|
1112
|
+
he,
|
|
1113
|
+
F,
|
|
1114
|
+
E,
|
|
1115
|
+
T
|
|
1116
|
+
]), Ae = (0, n.useCallback)(async () => {
|
|
1117
|
+
K(C("Evaluating the task")), l !== "" && !d && (v(!0), h(!0), p([]), L({
|
|
1118
1118
|
event: "submit_form",
|
|
1119
1119
|
action: "ai_image_generation",
|
|
1120
|
-
entity_id:
|
|
1120
|
+
entity_id: A,
|
|
1121
1121
|
project_id: O
|
|
1122
|
-
}),
|
|
1122
|
+
}), V({ body: {
|
|
1123
1123
|
project_id: O,
|
|
1124
1124
|
request: "create-image",
|
|
1125
1125
|
connection: "midjourney",
|
|
1126
1126
|
message: l
|
|
1127
|
-
} }).then(({ data:
|
|
1127
|
+
} }).then(({ data: g, error: te }) => {
|
|
1128
1128
|
if (te) throw te;
|
|
1129
|
-
if (
|
|
1130
|
-
if (
|
|
1131
|
-
g
|
|
1129
|
+
if (g.data.status === 401) throw new Error(u.ERROR);
|
|
1130
|
+
if (g?.data?._eventResult) {
|
|
1131
|
+
p(g.data.task.images), v(!1), h(!1), K(C("Evaluating the task"));
|
|
1132
1132
|
return;
|
|
1133
1133
|
}
|
|
1134
|
-
|
|
1134
|
+
g?.data.status === 200 ? (g?.data.task.id && (K(g.data.task.message), x(g.data.task.id)), g.message && y.success({
|
|
1135
1135
|
id: "AI_IMAGE_SEND_SUCCESS",
|
|
1136
|
-
title:
|
|
1136
|
+
title: g.message,
|
|
1137
1137
|
placement: "bottomRight",
|
|
1138
1138
|
data: l
|
|
1139
1139
|
}), ee({
|
|
1140
|
-
task_id:
|
|
1140
|
+
task_id: g?.data.task.id,
|
|
1141
1141
|
entity_id: W
|
|
1142
|
-
})) : (
|
|
1142
|
+
})) : (v(!1), h(!1), y.error({
|
|
1143
1143
|
id: "AI_IMAGE_SEND_ERROR",
|
|
1144
|
-
title:
|
|
1144
|
+
title: g?.message || C("Something went wrong, please try again"),
|
|
1145
1145
|
placement: "bottomRight",
|
|
1146
1146
|
data: l,
|
|
1147
|
-
innerException:
|
|
1147
|
+
innerException: g
|
|
1148
1148
|
}));
|
|
1149
|
-
}).catch((
|
|
1150
|
-
|
|
1149
|
+
}).catch((g) => {
|
|
1150
|
+
v(!1), h(!1), (g?.error || g?.data) && y.fromError("AI_IMAGE_SEND_ERROR", l, g.error || g);
|
|
1151
1151
|
}));
|
|
1152
1152
|
}, [
|
|
1153
1153
|
l,
|
|
1154
1154
|
d,
|
|
1155
|
-
|
|
1155
|
+
v,
|
|
1156
1156
|
h,
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1157
|
+
p,
|
|
1158
|
+
L,
|
|
1159
|
+
A,
|
|
1160
1160
|
O,
|
|
1161
|
-
|
|
1162
|
-
|
|
1161
|
+
V,
|
|
1162
|
+
y,
|
|
1163
1163
|
ee,
|
|
1164
1164
|
W,
|
|
1165
|
-
|
|
1166
|
-
]),
|
|
1167
|
-
if (
|
|
1168
|
-
if (!u.PLUGIN.isPlugin &&
|
|
1169
|
-
const
|
|
1170
|
-
if (
|
|
1171
|
-
|
|
1165
|
+
C
|
|
1166
|
+
]), Y = (0, n.useCallback)(async () => {
|
|
1167
|
+
if (pe) {
|
|
1168
|
+
if (!u.PLUGIN.isPlugin && !$) {
|
|
1169
|
+
const g = N.resolveLimitActionPreflightExceededForType("image_generate", (await z("image_generate")).data?.stats);
|
|
1170
|
+
if (g) {
|
|
1171
|
+
w?.(g);
|
|
1172
1172
|
return;
|
|
1173
1173
|
}
|
|
1174
1174
|
}
|
|
1175
|
-
|
|
1176
|
-
} else
|
|
1177
|
-
title:
|
|
1178
|
-
description:
|
|
1175
|
+
F && (P((g) => g + 1), ie()), Ae();
|
|
1176
|
+
} else J && (I ? I() : y.error({
|
|
1177
|
+
title: C("The usage limit has been exceeded"),
|
|
1178
|
+
description: C(`The maximum number of requests for the current subscription period has been reached.
|
|
1179
1179
|
Select the appropriate plan to fulfil more requests`),
|
|
1180
1180
|
placement: "bottomRight"
|
|
1181
1181
|
}));
|
|
1182
1182
|
}, [
|
|
1183
|
-
|
|
1183
|
+
pe,
|
|
1184
|
+
J,
|
|
1184
1185
|
$,
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
p,
|
|
1186
|
+
F,
|
|
1187
|
+
z,
|
|
1188
|
+
w,
|
|
1189
1189
|
P,
|
|
1190
|
-
|
|
1191
|
-
|
|
1190
|
+
ie,
|
|
1191
|
+
Ae,
|
|
1192
|
+
y,
|
|
1192
1193
|
C,
|
|
1193
|
-
|
|
1194
|
-
x
|
|
1194
|
+
I
|
|
1195
1195
|
]);
|
|
1196
1196
|
(0, n.useEffect)(() => {
|
|
1197
|
-
|
|
1198
|
-
}, [
|
|
1199
|
-
const
|
|
1197
|
+
J && P(R?.counters?.ai_img_counter || 0);
|
|
1198
|
+
}, [R, J]);
|
|
1199
|
+
const re = u.useEventEmitter(u.events.AI_IMAGE_PROGRESS_ID);
|
|
1200
1200
|
(0, n.useEffect)(() => {
|
|
1201
|
-
const
|
|
1202
|
-
|
|
1201
|
+
const g = re.event(({ progress: te, status: X }) => {
|
|
1202
|
+
K(X || `${Math.round(te)}%`);
|
|
1203
1203
|
});
|
|
1204
|
-
return () =>
|
|
1205
|
-
}, [
|
|
1206
|
-
const
|
|
1204
|
+
return () => g.dispose();
|
|
1205
|
+
}, [re]);
|
|
1206
|
+
const M = (0, n.useCallback)(async (g) => {
|
|
1207
1207
|
if (!a) {
|
|
1208
1208
|
i(!0);
|
|
1209
1209
|
try {
|
|
1210
|
-
const te = rt(
|
|
1210
|
+
const te = rt(g) ? await (await fetch(g)).blob() : Xe(g);
|
|
1211
1211
|
e({ file: new File([te], "image.jpeg", { type: te.type || "image/jpeg" }) });
|
|
1212
1212
|
} catch {
|
|
1213
1213
|
i(!1);
|
|
@@ -1217,63 +1217,63 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1217
1217
|
a,
|
|
1218
1218
|
i,
|
|
1219
1219
|
e
|
|
1220
|
-
]), ae = (0, n.useCallback)((
|
|
1221
|
-
|
|
1220
|
+
]), ae = (0, n.useCallback)((g) => {
|
|
1221
|
+
g.status !== "error" && g.status !== "Canceled" ? g.images ? (K(g.status), g.progress === 100 && (p(g.images), K(C("Evaluating the task")), x(null), h(!1))) : (p([g.data]), v(!1)) : (v(!1), h(!1), y.error({
|
|
1222
1222
|
id: "AI_IMAGE_GET_ERROR",
|
|
1223
|
-
title:
|
|
1223
|
+
title: C("Something went wrong, please try again"),
|
|
1224
1224
|
placement: "bottomRight",
|
|
1225
|
-
data:
|
|
1225
|
+
data: j
|
|
1226
1226
|
}));
|
|
1227
1227
|
}, [
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
w,
|
|
1231
|
-
R,
|
|
1232
|
-
t,
|
|
1233
|
-
E,
|
|
1228
|
+
p,
|
|
1229
|
+
K,
|
|
1234
1230
|
C,
|
|
1231
|
+
v,
|
|
1232
|
+
t,
|
|
1233
|
+
j,
|
|
1234
|
+
y,
|
|
1235
1235
|
h
|
|
1236
1236
|
]);
|
|
1237
1237
|
return (0, n.useEffect)(() => {
|
|
1238
|
-
|
|
1239
|
-
}, [
|
|
1238
|
+
B.length > 1 && ae(B[B.length - 1]);
|
|
1239
|
+
}, [B, ae]), (0, n.useEffect)(() => {
|
|
1240
1240
|
(d || b.length > 0) && setTimeout(() => {
|
|
1241
|
-
let
|
|
1242
|
-
o.current && (
|
|
1241
|
+
let g = 550;
|
|
1242
|
+
o.current && (g = o.current.offsetHeight + 68), t(g);
|
|
1243
1243
|
}, 0);
|
|
1244
1244
|
}, [
|
|
1245
1245
|
o,
|
|
1246
|
-
|
|
1246
|
+
B,
|
|
1247
1247
|
b.length,
|
|
1248
1248
|
d,
|
|
1249
1249
|
t
|
|
1250
1250
|
]), {
|
|
1251
|
-
aiImageCounter:
|
|
1251
|
+
aiImageCounter: E,
|
|
1252
1252
|
setAiImageCounter: P,
|
|
1253
|
-
currentAiImgLimits:
|
|
1254
|
-
isFieldsDisabled:
|
|
1255
|
-
canGenerateImage:
|
|
1253
|
+
currentAiImgLimits: T,
|
|
1254
|
+
isFieldsDisabled: he,
|
|
1255
|
+
canGenerateImage: pe,
|
|
1256
1256
|
aiImageRequest: l,
|
|
1257
1257
|
imageAiList: b,
|
|
1258
|
-
setImageAiList:
|
|
1258
|
+
setImageAiList: p,
|
|
1259
1259
|
isLoadingAi: d,
|
|
1260
|
-
setIsLoadingAi:
|
|
1260
|
+
setIsLoadingAi: v,
|
|
1261
1261
|
loadingDuringGeneration: s,
|
|
1262
1262
|
setLoadingDuringGeneration: h,
|
|
1263
|
-
requestStatus:
|
|
1264
|
-
setRequestStatus:
|
|
1265
|
-
handleGenerate:
|
|
1266
|
-
handleLimitAiImgCount:
|
|
1267
|
-
convertBase64ToFile:
|
|
1268
|
-
isShiftPressed:
|
|
1269
|
-
setIsShiftPressed:
|
|
1270
|
-
currentReqId:
|
|
1271
|
-
setCurrentReqId:
|
|
1272
|
-
limitsInPlugin:
|
|
1263
|
+
requestStatus: _,
|
|
1264
|
+
setRequestStatus: K,
|
|
1265
|
+
handleGenerate: Y,
|
|
1266
|
+
handleLimitAiImgCount: ie,
|
|
1267
|
+
convertBase64ToFile: M,
|
|
1268
|
+
isShiftPressed: S,
|
|
1269
|
+
setIsShiftPressed: U,
|
|
1270
|
+
currentReqId: j,
|
|
1271
|
+
setCurrentReqId: x,
|
|
1272
|
+
limitsInPlugin: J
|
|
1273
1273
|
};
|
|
1274
1274
|
}
|
|
1275
|
-
var
|
|
1276
|
-
const
|
|
1275
|
+
var Ut = ({ setModalHeight: t, customRequest: e, aiTabRef: o, inputAiRef: a, isImageUploaded: i, setIsImageUploaded: l, aiImageRequest: b, setAiImageRequest: p, imageAiList: d, setImageAiList: v, isLoadingAi: I, setIsLoadingAi: w }) => {
|
|
1276
|
+
const C = u.useNavigate(), R = u.useDispatch(), { __: y, _n: L } = m.useI18n(), A = u.useAppConfig(), [G, O] = (0, n.useState)(!1), [D, H] = (0, n.useState)(null), { aiImageCounter: B, currentAiImgLimits: z, loadingDuringGeneration: V, requestStatus: ee, handleGenerate: q, convertBase64ToFile: E, isShiftPressed: P, setIsShiftPressed: j, limitsInPlugin: x } = Bt({
|
|
1277
1277
|
setModalHeight: t,
|
|
1278
1278
|
customRequest: e,
|
|
1279
1279
|
aiTabRef: o,
|
|
@@ -1281,58 +1281,58 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1281
1281
|
setIsImageUploaded: l,
|
|
1282
1282
|
aiImageRequest: b,
|
|
1283
1283
|
imageAiList: d,
|
|
1284
|
-
setImageAiList:
|
|
1285
|
-
isLoadingAi:
|
|
1286
|
-
setIsLoadingAi:
|
|
1284
|
+
setImageAiList: v,
|
|
1285
|
+
isLoadingAi: I,
|
|
1286
|
+
setIsLoadingAi: w,
|
|
1287
1287
|
onPluginAiImageLimitExceeded: () => O(!0),
|
|
1288
|
-
onImageGenerateLimitExceeded:
|
|
1289
|
-
}),
|
|
1290
|
-
|
|
1288
|
+
onImageGenerateLimitExceeded: H
|
|
1289
|
+
}), S = G && z > 0 ? ne.getAiTariffUpgradeStep(z) : null, U = S ? N.getLimitUpgradePresetDefinition(S.presetId) : null, _ = D ? N.getLimitUpgradePresetDefinition(D.presetId) : null, [K, s] = (0, n.useState)(!1), h = (0, n.useCallback)(() => s(!0), []), W = (0, n.useCallback)(() => s(!1), []), me = (0, n.useCallback)((F) => p(F.target.value), [p]), T = (0, n.useCallback)((F) => {
|
|
1290
|
+
F.key === "Shift" ? j(!0) : F.key === "Enter" && !P && (F.preventDefault(), q());
|
|
1291
1291
|
}, [
|
|
1292
1292
|
P,
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
]),
|
|
1296
|
-
|
|
1297
|
-
}, [
|
|
1293
|
+
q,
|
|
1294
|
+
j
|
|
1295
|
+
]), J = (0, n.useCallback)((F) => {
|
|
1296
|
+
F.key === "Shift" && j(!1);
|
|
1297
|
+
}, [j]), $ = d[d.length - 1];
|
|
1298
1298
|
return (0, r.jsxs)("div", {
|
|
1299
1299
|
className: "image-ai",
|
|
1300
1300
|
children: [
|
|
1301
|
-
|
|
1301
|
+
U && S ? (0, r.jsx)(N.LimitUpgradeModal, {
|
|
1302
1302
|
open: !0,
|
|
1303
1303
|
onClose: () => O(!1),
|
|
1304
|
-
title:
|
|
1305
|
-
subtitle:
|
|
1306
|
-
usageResource:
|
|
1307
|
-
previousDisplay:
|
|
1308
|
-
nextDisplay:
|
|
1304
|
+
title: y(U.titleKey),
|
|
1305
|
+
subtitle: y(U.subtitleKey),
|
|
1306
|
+
usageResource: U.usageResource,
|
|
1307
|
+
previousDisplay: N.presetLimitDisplay(S.previousLimit),
|
|
1308
|
+
nextDisplay: N.presetLimitDisplay(S.nextLimit),
|
|
1309
1309
|
onChangePlan: () => {
|
|
1310
|
-
O(!1), document.body.classList.remove("editor"),
|
|
1310
|
+
O(!1), document.body.classList.remove("editor"), C("/billing"), R(Z.openModal(u.MODALS.SWITCH_TO_PLAN_MODAL));
|
|
1311
1311
|
}
|
|
1312
1312
|
}) : null,
|
|
1313
|
-
|
|
1313
|
+
_ && D ? (0, r.jsx)(N.LimitUpgradeModal, {
|
|
1314
1314
|
open: !0,
|
|
1315
|
-
onClose: () =>
|
|
1316
|
-
title:
|
|
1317
|
-
subtitle:
|
|
1318
|
-
usageResource:
|
|
1319
|
-
previousDisplay:
|
|
1320
|
-
nextDisplay:
|
|
1315
|
+
onClose: () => H(null),
|
|
1316
|
+
title: y(_.titleKey),
|
|
1317
|
+
subtitle: y(_.subtitleKey),
|
|
1318
|
+
usageResource: _.usageResource,
|
|
1319
|
+
previousDisplay: N.presetLimitDisplay(D.previousLimit),
|
|
1320
|
+
nextDisplay: N.presetLimitDisplay(D.nextLimit),
|
|
1321
1321
|
onChangePlan: () => {
|
|
1322
|
-
|
|
1322
|
+
H(null), document.body.classList.remove("editor"), C("/billing"), R(Z.openModal(u.MODALS.SWITCH_TO_PLAN_MODAL));
|
|
1323
1323
|
}
|
|
1324
1324
|
}) : null,
|
|
1325
|
-
|
|
1326
|
-
text: `${
|
|
1327
|
-
exceeded:
|
|
1325
|
+
x && (0, r.jsx)(m.LimitsCounter, {
|
|
1326
|
+
text: `${B} ${y("of")} ${z > 0 ? z : "∞"} images ${L("was used", "were used", B)}`,
|
|
1327
|
+
exceeded: z > 0 && B >= z,
|
|
1328
1328
|
style: { marginTop: -25 },
|
|
1329
1329
|
extra: (0, r.jsx)("span", {
|
|
1330
1330
|
style: {
|
|
1331
1331
|
textDecoration: "underline",
|
|
1332
1332
|
cursor: "pointer"
|
|
1333
1333
|
},
|
|
1334
|
-
onClick: () =>
|
|
1335
|
-
children:
|
|
1334
|
+
onClick: () => C(A.billingPageUrl || u.APP_ROUTES.billing),
|
|
1335
|
+
children: y("Need more?")
|
|
1336
1336
|
})
|
|
1337
1337
|
}),
|
|
1338
1338
|
(0, r.jsx)(m.Row, {
|
|
@@ -1343,43 +1343,43 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1343
1343
|
children: (0, r.jsx)(m.Form.Item, {
|
|
1344
1344
|
style: { margin: 0 },
|
|
1345
1345
|
children: (0, r.jsxs)("span", {
|
|
1346
|
-
className: `ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${
|
|
1346
|
+
className: `ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${K ? " ant-input-affix-wrapper-focused" : ""}`,
|
|
1347
1347
|
children: [(0, r.jsx)(m.TextArea, {
|
|
1348
1348
|
ref: a,
|
|
1349
|
-
onKeyDown:
|
|
1350
|
-
onKeyUp:
|
|
1349
|
+
onKeyDown: T,
|
|
1350
|
+
onKeyUp: J,
|
|
1351
1351
|
onFocus: h,
|
|
1352
1352
|
onBlur: W,
|
|
1353
1353
|
autoSize: !0,
|
|
1354
1354
|
allowClear: !0,
|
|
1355
1355
|
className: "text-area-input-hybrid image-ai__textarea",
|
|
1356
|
-
placeholder:
|
|
1356
|
+
placeholder: y("Generate image"),
|
|
1357
1357
|
value: b,
|
|
1358
|
-
onChange:
|
|
1358
|
+
onChange: me,
|
|
1359
1359
|
spellCheck: "false"
|
|
1360
1360
|
}), (0, r.jsx)("span", {
|
|
1361
1361
|
className: "ant-input-suffix image-ai__input-suffix",
|
|
1362
|
-
children:
|
|
1362
|
+
children: I || V ? (0, r.jsx)(N.EmIcons, {
|
|
1363
1363
|
icon: "LoadingOutlined",
|
|
1364
1364
|
className: "input-icon image-ai__input-icon",
|
|
1365
1365
|
spin: !0
|
|
1366
|
-
}) : (0, r.jsx)(
|
|
1366
|
+
}) : (0, r.jsx)(N.EmIcons, {
|
|
1367
1367
|
icon: "AI",
|
|
1368
1368
|
className: "input-icon image-ai__input-icon",
|
|
1369
|
-
onClick:
|
|
1369
|
+
onClick: q
|
|
1370
1370
|
})
|
|
1371
1371
|
})]
|
|
1372
1372
|
})
|
|
1373
1373
|
})
|
|
1374
1374
|
})
|
|
1375
1375
|
}),
|
|
1376
|
-
(
|
|
1376
|
+
(I || d.length > 0) && (0, r.jsxs)("div", {
|
|
1377
1377
|
className: "image-ai__preview",
|
|
1378
|
-
children: [
|
|
1378
|
+
children: [I && d.length === 0 && (0, r.jsx)("div", {
|
|
1379
1379
|
className: "image-ai__loading",
|
|
1380
1380
|
children: (0, r.jsxs)("div", {
|
|
1381
1381
|
className: "spin",
|
|
1382
|
-
children: [(0, r.jsx)(
|
|
1382
|
+
children: [(0, r.jsx)(N.EmIcons, {
|
|
1383
1383
|
icon: "LoadingOutlined",
|
|
1384
1384
|
style: { fontSize: 48 },
|
|
1385
1385
|
spin: !0
|
|
@@ -1390,77 +1390,77 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1390
1390
|
})
|
|
1391
1391
|
}), d.length > 0 && (0, r.jsxs)("div", {
|
|
1392
1392
|
className: "image-ai__image-item",
|
|
1393
|
-
children: [(0, r.jsx)(
|
|
1393
|
+
children: [(0, r.jsx)(Dt, { images: d }), (0, r.jsx)("div", {
|
|
1394
1394
|
className: "buttons",
|
|
1395
1395
|
children: (0, r.jsx)(m.Button, {
|
|
1396
|
-
onClick: () =>
|
|
1397
|
-
icon: (0, r.jsx)(
|
|
1398
|
-
children:
|
|
1396
|
+
onClick: () => E($),
|
|
1397
|
+
icon: (0, r.jsx)(N.EmIcons, { icon: "CheckOutlined" }),
|
|
1398
|
+
children: y("Use this one")
|
|
1399
1399
|
})
|
|
1400
1400
|
})]
|
|
1401
1401
|
})]
|
|
1402
1402
|
})
|
|
1403
1403
|
]
|
|
1404
1404
|
});
|
|
1405
|
-
},
|
|
1406
|
-
const { __:
|
|
1407
|
-
|
|
1405
|
+
}, Mt = ({ setNewLink: t, setCurrentImageLink: e, setModalHeight: o, setModalWidth: a, setImageGifList: i, imageGifList: l, currentReqGif: b, setCurrentReqGif: p, inputRef: d, setStockLink: v, customRequest: I }) => {
|
|
1406
|
+
const { __: w } = m.useI18n(), C = u.useAppConfig(), R = u.useIsStandalone(), y = m.useNotification(), [L, A] = (0, n.useState)(null), [G, O] = (0, n.useState)(!1), [D, H] = (0, n.useState)(25), [B] = Z.useLazyGetSearchGifQuery(), z = (0, n.useCallback)((s) => s instanceof Error || typeof s?.message == "string" && s.message ? s.message : typeof s?.error?.message == "string" && s.error.message ? s.error.message : w("Failed to load GIFs through the configured proxy chain."), [w]), V = (0, n.useCallback)((s) => {
|
|
1407
|
+
y.error({
|
|
1408
1408
|
id: "STOCK_GIFS_SEARCH_FAILED",
|
|
1409
|
-
title:
|
|
1410
|
-
description:
|
|
1409
|
+
title: w("Failed to load GIFs"),
|
|
1410
|
+
description: z(s)
|
|
1411
1411
|
});
|
|
1412
1412
|
}, [
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1413
|
+
w,
|
|
1414
|
+
z,
|
|
1415
|
+
y
|
|
1416
1416
|
]), ee = async () => {
|
|
1417
|
-
|
|
1417
|
+
G || (O(!0), B({
|
|
1418
1418
|
query: b,
|
|
1419
|
-
page:
|
|
1419
|
+
page: D
|
|
1420
1420
|
}).then((s) => {
|
|
1421
1421
|
if (s?.error) {
|
|
1422
|
-
|
|
1422
|
+
V(s.error), O(!1);
|
|
1423
1423
|
return;
|
|
1424
1424
|
}
|
|
1425
|
-
i((h) => [...h, ...s.data.data]), O(!1),
|
|
1425
|
+
i((h) => [...h, ...s.data.data]), O(!1), H((h) => h + 25);
|
|
1426
1426
|
}).catch(() => {
|
|
1427
1427
|
O(!1);
|
|
1428
1428
|
}));
|
|
1429
|
-
},
|
|
1430
|
-
const s = await
|
|
1429
|
+
}, q = async () => {
|
|
1430
|
+
const s = await B({
|
|
1431
1431
|
query: b,
|
|
1432
1432
|
page: 0
|
|
1433
1433
|
});
|
|
1434
1434
|
if (s?.error) {
|
|
1435
|
-
|
|
1435
|
+
V(s.error), i([]);
|
|
1436
1436
|
return;
|
|
1437
1437
|
}
|
|
1438
1438
|
s?.data?.data?.length > 0 && (i(s.data.data), setTimeout(() => {
|
|
1439
1439
|
o("84vh"), a(1060);
|
|
1440
1440
|
}, 0));
|
|
1441
|
-
},
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
}, 2e3),
|
|
1445
|
-
}, P = { default: 3 },
|
|
1446
|
-
config:
|
|
1447
|
-
standalone:
|
|
1441
|
+
}, E = (s, h) => {
|
|
1442
|
+
A(h), setTimeout(() => {
|
|
1443
|
+
A(null);
|
|
1444
|
+
}, 2e3), v(`${s}`), e(`${s}`), I(`${s}`);
|
|
1445
|
+
}, P = { default: 3 }, j = (0, n.useCallback)((s) => u.getProxiedUrl(s, {
|
|
1446
|
+
config: C,
|
|
1447
|
+
standalone: R,
|
|
1448
1448
|
resourceType: "generic",
|
|
1449
1449
|
intent: "display"
|
|
1450
|
-
}), [
|
|
1450
|
+
}), [C, R]), { getDisplaySrc: x, handleLoad: S, handleError: U } = tt({
|
|
1451
1451
|
items: l,
|
|
1452
1452
|
getItemId: (0, n.useCallback)((s) => s.id, []),
|
|
1453
1453
|
getRequestUrl: (0, n.useCallback)((s) => s.images.downsized.url, []),
|
|
1454
|
-
createController:
|
|
1455
|
-
}),
|
|
1456
|
-
|
|
1457
|
-
},
|
|
1458
|
-
|
|
1454
|
+
createController: j
|
|
1455
|
+
}), _ = (s) => (h) => {
|
|
1456
|
+
S(s), h.target.parentNode.classList.add("loaded");
|
|
1457
|
+
}, K = (s) => () => {
|
|
1458
|
+
U(s);
|
|
1459
1459
|
};
|
|
1460
1460
|
return (0, r.jsxs)("div", {
|
|
1461
1461
|
className: "stock-tab",
|
|
1462
1462
|
children: [(0, r.jsxs)(m.Form, {
|
|
1463
|
-
onValuesChange:
|
|
1463
|
+
onValuesChange: q,
|
|
1464
1464
|
className: l.length > 0 ? "serach-results" : "",
|
|
1465
1465
|
children: [(0, r.jsx)(m.Row, {
|
|
1466
1466
|
gutter: 24,
|
|
@@ -1469,12 +1469,12 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1469
1469
|
children: (0, r.jsx)(m.Form.Item, {
|
|
1470
1470
|
className: "stock-search-input",
|
|
1471
1471
|
children: (0, r.jsx)(m.SearchInput, {
|
|
1472
|
-
onSearch:
|
|
1472
|
+
onSearch: q,
|
|
1473
1473
|
allowClear: !0,
|
|
1474
1474
|
size: l.length > 0 ? "medium" : "large",
|
|
1475
|
-
placeholder:
|
|
1475
|
+
placeholder: w("Search GIFs"),
|
|
1476
1476
|
value: b.keywords,
|
|
1477
|
-
onChange: (s) =>
|
|
1477
|
+
onChange: (s) => p((h) => ({
|
|
1478
1478
|
...h,
|
|
1479
1479
|
keywords: s.target.value
|
|
1480
1480
|
})),
|
|
@@ -1513,7 +1513,7 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1513
1513
|
hasMore: l,
|
|
1514
1514
|
endMessage: (0, r.jsxs)(m.Divider, {
|
|
1515
1515
|
plain: !0,
|
|
1516
|
-
children: [
|
|
1516
|
+
children: [w("That`s all we could find."), " 🤐"]
|
|
1517
1517
|
}),
|
|
1518
1518
|
scrollableTarget: "scrollableDiv",
|
|
1519
1519
|
style: { overflow: "visible" },
|
|
@@ -1524,15 +1524,15 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1524
1524
|
columnClassName: "my-masonry-grid_column",
|
|
1525
1525
|
children: l.map((s, h) => (0, r.jsxs)("div", {
|
|
1526
1526
|
className: "list-item",
|
|
1527
|
-
onClick: () =>
|
|
1527
|
+
onClick: () => E(s.images.downsized.url, s.id),
|
|
1528
1528
|
children: [
|
|
1529
1529
|
(0, r.jsx)("img", {
|
|
1530
|
-
className:
|
|
1530
|
+
className: L === s.id ? "loaded-image" : "",
|
|
1531
1531
|
width: "322px",
|
|
1532
|
-
src:
|
|
1532
|
+
src: x(s),
|
|
1533
1533
|
alt: s.title,
|
|
1534
|
-
onLoad:
|
|
1535
|
-
onError:
|
|
1534
|
+
onLoad: _(s),
|
|
1535
|
+
onError: K(s)
|
|
1536
1536
|
}),
|
|
1537
1537
|
(0, r.jsx)("a", {
|
|
1538
1538
|
rel: "noreferrer",
|
|
@@ -1544,7 +1544,7 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1544
1544
|
style: { backgroundImage: "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAkCAYAAAB/up84AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABSBJREFUeNrsWjFv2zoQVoMW8BZ18xaN3qLRW9QtW9OtW92to98vaPoP3K1b1S1b3c2jvWlUNm3lw1s8Mpu3PAo4Iocr70jKlp0COuCQlpKPx/t43x1pv3h8fEwGeT5yNoTgeclLZvza6NgxXoNaGRktjE6MpjC2NVqh92bwt4HxBI1ro0s0dgN2tvD5a8a/9vkq0M+xYKdG81A7Gp6pyBjZddrnO6N36Hkbqyn8u4L3vYC0hjLHeAbPVhC4TwAK/ewNvLsEhyxgFXLK2l/D4tvnOVrUiPEh1k/JjvLYyWENdeTcKazBBr6AdY4AqBTmbkIzhO4gvMumYLxAYKzgPTvhBBajYNwCksHYhOyYiow1KONaKYlfO8bPEWyGEfi5Iu+Vjizg7EzB3xvwWTMxWkHG4mDnMF6BnSnYncLzHWGG4BqiwZkKQMC7I0cOVTCJhvRUKNgNCmCOxhNmrBEWzwGi0Y6rIihbsnOH/JgE2hshKrLZv4Px9yhj1twafRlid/UIGWvlFdlVLirIkIM12nETGLeO2tTPECBUZuT/a7JBMpSxUybYLjulUCN2iEpHQoyuGWZJUCa8R/VGSZvGB0iOdjAO9n8EtC2zUxICSIoW0ICTmA53DCDKQzWZg89XAXZ2B2iMavBnjDKpBX6B1tnAM5aqQgGhnU2D6GmHuqw7AkaOPmP/bsHpFC1kTLqVhglS6fFNgX1MCXUHO1zR1h5AFOoSc1jjmKx/An/1PoBQasBSoZZ3hpyaOrg0IW2sRkG8JsU8CaCaLckAhfi6AG0cmeuzkyMQMtL+SiySkY3oA/EgGeICK0UOZYQKVsQpDAjm2BpsaAGQLMKnMdok3yLtpKS70yT7OUBcm7UTHb5grk5y1Csrj40MqUbUpgW7NXo+RunckODkQvdXM37iwm7b1VA7lAaVB4jUUZOUIzNxfOougAwy3GUN0qWG2IJJ09V2NcvIFE8c54nQelEHFM6C6chUhI+WZjjffDQkrenPhqmlrAC9Naof/aLhXZeNNfMZOk+MtPOVRjNmTpfcCut0+biGZ3PBj1ywWTOfqV3v+yjLFuDPRs8Ddu05vLtmsuHQ0s73wehvR0t7aGkPevfCM5fcGr0MbOW9NSSFwF52cP5KcLIv+X4EUGbCemcOqpoz73/haE4CZNkRjAR20vwENXHRc2bWEMyQuUuGVe4hc6K6rBmg7pKN0XdGX7dts9E3Rr8afUATFl1PqgLAG6T3AoX1nSVtMP9l5r5FVyiu+D14/YssRHOheGVQYNMeinrhsMcV2WVPRR1rIRT4QmiA5r4G6oxp0y6ZzFh4LvhmB84MHz1xta9vWQMrcFR/3iF+7DmEu2YoyTshRbuMvGE9hnwGPQR1tdR04aCueKrqAIgiu/AqcCf1JXPhfuoYosGHn4Hgqa6AnCK4IfSkCa1eCJRxLGnn+mX0rfDOJok4AsQAUpwQlND2++HIgNiOVO1LVRIgtXDPs0bpunEU08vktHLMpoJS1/d9qEo6h6gAzq7RRaPV+QmBeICzUUh2fIHzk0s3HedXwkEy2ReQmjn4XDzDjqkN4D/J04/y/np5KbSrrtbwAyx+kTxdf9tfpvSZIW9O3FScHJAF8PEFc5F2lQzSi5wJheoG3U/t0xYOcgBAcOHuAkr7mY9ditoAiCz2q8uvEcD8gJpSDuGNl5hfnaTJ0/fpheMUr4CitHCO6fqdesj359xh1tWiqggfdUCmcz9ZivZ7+BnQM5P/BRgABx8sJWqTxoYAAAAASUVORK5CYII=)" }
|
|
1545
1545
|
})
|
|
1546
1546
|
}),
|
|
1547
|
-
|
|
1547
|
+
L === s.id && (0, r.jsx)(m.Spin, {
|
|
1548
1548
|
className: "ant-spin",
|
|
1549
1549
|
size: "small"
|
|
1550
1550
|
})
|
|
@@ -1556,10 +1556,10 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1556
1556
|
})]
|
|
1557
1557
|
});
|
|
1558
1558
|
};
|
|
1559
|
-
function
|
|
1559
|
+
function Pt(t) {
|
|
1560
1560
|
if (!(t == null || t === "")) return t;
|
|
1561
1561
|
}
|
|
1562
|
-
async function
|
|
1562
|
+
async function Tt(t, e) {
|
|
1563
1563
|
if (t) {
|
|
1564
1564
|
if (t.url) return t.url;
|
|
1565
1565
|
if (typeof e.getFileById == "function" && t.id) {
|
|
@@ -1579,7 +1579,7 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1579
1579
|
return t.thumbnail || t.thumbnailUrl;
|
|
1580
1580
|
}
|
|
1581
1581
|
}
|
|
1582
|
-
function
|
|
1582
|
+
function Nt(t) {
|
|
1583
1583
|
if (!(!t?.success || !Array.isArray(t.detailed))) return t.detailed.find((e) => e?.success && e.data)?.data;
|
|
1584
1584
|
}
|
|
1585
1585
|
function Gt(t, e, o) {
|
|
@@ -1602,11 +1602,11 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1602
1602
|
childrenCount: t.childrenCount
|
|
1603
1603
|
};
|
|
1604
1604
|
}
|
|
1605
|
-
async function
|
|
1605
|
+
async function Ft(t, e, o) {
|
|
1606
1606
|
if (!e) return;
|
|
1607
|
-
const a =
|
|
1607
|
+
const a = Pt(o ?? e.rootId);
|
|
1608
1608
|
let i;
|
|
1609
|
-
typeof e.uploadFiles == "function" ? i =
|
|
1609
|
+
typeof e.uploadFiles == "function" ? i = Nt(await e.uploadFiles({
|
|
1610
1610
|
folderId: a,
|
|
1611
1611
|
items: [{
|
|
1612
1612
|
name: t.name,
|
|
@@ -1622,133 +1622,131 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1622
1622
|
folderId: a,
|
|
1623
1623
|
data: t
|
|
1624
1624
|
}), t, a));
|
|
1625
|
-
const l = await
|
|
1625
|
+
const l = await Tt(i, e);
|
|
1626
1626
|
return l ? {
|
|
1627
1627
|
item: i,
|
|
1628
1628
|
url: l
|
|
1629
1629
|
} : void 0;
|
|
1630
1630
|
}
|
|
1631
|
-
var st = "IMG", at = "BACKGROUND",
|
|
1632
|
-
const o =
|
|
1631
|
+
var st = "IMG", at = "BACKGROUND", zt = "GALLERY", we = "EDITOR", fe = "UPLOAD", Fe = "STOCK", ze = "GIF", Ke = "AI", Kt = { mode: "select" }, Wt = { mode: "save" }, { Dragger: Ht } = m.Upload, Vt = (t, e = "image") => Z.decodeFileNameFromUrl(t) ?? e, je = ne.normalizeImageFormatForDisplay, qt = (t, e) => {
|
|
1632
|
+
const o = je(e);
|
|
1633
1633
|
return !o || t.includes(".") ? t : `${t}.${o}`;
|
|
1634
|
-
},
|
|
1635
|
-
const e = u.useAppConfig(), o = u.useIsStandalone(), { __: a } = m.useI18n(), i = u.useDispatch(), { projectId: l } = u.useParams(), [b] =
|
|
1634
|
+
}, Qt = (t, e) => new File([t], qt(Vt(e), t.type), { type: t.type || "application/octet-stream" }), ot = ({ dataProvider: t }) => {
|
|
1635
|
+
const e = u.useAppConfig(), o = u.useIsStandalone(), { __: a } = m.useI18n(), i = u.useDispatch(), { projectId: l } = u.useParams(), [b] = Z.useLazyGetImageInfoQuery(), { modal: p } = m.App.useApp(), d = m.useNotification(), v = u.useSelector(Z.selectActiveModal), { request: I, resolveImagePicker: w } = N.useImagePicker(), [C, R] = (0, n.useState)(""), [y, L] = (0, n.useState)(""), [A, G] = (0, n.useState)(""), [O, D] = (0, n.useState)(""), [H, B] = (0, n.useState)(fe), [z, V] = (0, n.useState)({
|
|
1636
1636
|
width: "",
|
|
1637
1637
|
height: "",
|
|
1638
1638
|
size: "",
|
|
1639
1639
|
format: ""
|
|
1640
|
-
}), [
|
|
1640
|
+
}), [ee, q] = (0, n.useState)("success"), [E, P] = (0, n.useState)(!1), j = n.default.useRef(null), x = n.default.useRef(null), S = n.default.useRef(null), U = n.default.useRef(null), _ = n.default.useRef(null), K = n.default.useRef(null), s = n.default.useRef(null), h = n.default.useRef(null), W = n.default.useRef(null), [me, T] = (0, n.useState)("auto"), [J, $] = (0, n.useState)(572), [F, he] = (0, n.useState)(!1), [ie, pe] = (0, n.useState)({
|
|
1641
1641
|
keywords: "",
|
|
1642
1642
|
color: "",
|
|
1643
1643
|
orientation: ""
|
|
1644
|
-
}), [
|
|
1644
|
+
}), [Ae, Y] = (0, n.useState)({ keywords: "" }), [re, M] = (0, n.useState)([]), [ae, g] = (0, n.useState)([]), [te, X] = (0, n.useState)([]), [ce, it] = (0, n.useState)(!1), [lt, We] = (0, n.useState)(""), [_t, Ee] = (0, n.useState)(!1), [Yt, Be] = (0, n.useState)(0), He = u.useSelector(u.selectProject), ct = He?.id !== void 0 ? String(He.id) : l || "", ut = u.useEventEmitter(u.events.UPLOAD_EVENT_ID), Ie = n.default.useRef(ne.createImageUrlBlobResolver()), Ve = n.default.useRef(""), Ce = n.default.useRef(0), xe = n.default.useRef(""), [Zt, dt] = (0, n.useState)(""), [Xt, ft] = (0, n.useState)(null), [Jt, qe] = (0, n.useState)(""), Ue = (0, n.useCallback)((c) => {
|
|
1645
1645
|
if (!(c instanceof Blob)) return;
|
|
1646
1646
|
xe.current && URL.revokeObjectURL(xe.current);
|
|
1647
1647
|
const f = URL.createObjectURL(c);
|
|
1648
|
-
xe.current = f,
|
|
1648
|
+
xe.current = f, dt(f), ft(c);
|
|
1649
1649
|
}, []), ge = (0, n.useCallback)(() => {
|
|
1650
|
-
xe.current && (URL.revokeObjectURL(xe.current), xe.current = ""),
|
|
1651
|
-
}, []),
|
|
1650
|
+
xe.current && (URL.revokeObjectURL(xe.current), xe.current = ""), dt(""), ft(null);
|
|
1651
|
+
}, []), le = (0, n.useCallback)(() => {
|
|
1652
1652
|
qe("");
|
|
1653
|
-
}, [])
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
}, Me = (0, n.useCallback)((c, f, S = a("The image could not be uploaded.")) => {
|
|
1658
|
-
const V = f instanceof Error ? f.message : S;
|
|
1653
|
+
}, []), ye = N.isEditorLockedByPlan(He, { isPlugin: u.PLUGIN.isPlugin }), $t = (c) => {
|
|
1654
|
+
L(c.target.value);
|
|
1655
|
+
}, Me = (0, n.useCallback)((c, f, k = a("The image could not be uploaded.")) => {
|
|
1656
|
+
const Q = f instanceof Error ? f.message : k;
|
|
1659
1657
|
d.error({
|
|
1660
1658
|
id: "IMAGE_UPLOAD_ERROR",
|
|
1661
1659
|
data: c,
|
|
1662
1660
|
title: a("Upload failed"),
|
|
1663
|
-
description:
|
|
1661
|
+
description: Q
|
|
1664
1662
|
});
|
|
1665
|
-
}, [a, d]),
|
|
1663
|
+
}, [a, d]), en = (0, n.useCallback)(async (c) => N.pickUploadImageUrlFromFireResults(await ut.fire({
|
|
1666
1664
|
file: c,
|
|
1667
|
-
project:
|
|
1668
|
-
})), [
|
|
1665
|
+
project: ct
|
|
1666
|
+
})), [ct, ut]), be = ne.useImageBlobFetch(), tn = (0, n.useCallback)((c) => Ie.current.resolve(ne.canonicalImageUrlKey(c), void 0, be), [be]), Pe = async (c) => {
|
|
1669
1667
|
if (c) try {
|
|
1670
|
-
const f = await
|
|
1668
|
+
const f = await nn(c);
|
|
1671
1669
|
f && _e(f) ? await Oe({ file: f }) : f || Me({ url: c }, null, a("Failed to download image from URL."));
|
|
1672
1670
|
} catch (f) {
|
|
1673
1671
|
Me({ url: c }, f, a("Failed to process image URL."));
|
|
1674
1672
|
}
|
|
1675
|
-
},
|
|
1676
|
-
|
|
1677
|
-
if (
|
|
1673
|
+
}, mt = n.default.useRef(Pe);
|
|
1674
|
+
mt.current = Pe, n.default.useEffect(() => {
|
|
1675
|
+
if (H !== fe || !O) return;
|
|
1678
1676
|
const c = y.trim();
|
|
1679
1677
|
if (!c || !c.toLowerCase().startsWith("http")) return;
|
|
1680
1678
|
const f = setTimeout(() => {
|
|
1681
|
-
|
|
1679
|
+
mt.current(c);
|
|
1682
1680
|
}, 1e3);
|
|
1683
1681
|
return () => {
|
|
1684
1682
|
clearTimeout(f);
|
|
1685
1683
|
};
|
|
1686
1684
|
}, [
|
|
1687
1685
|
y,
|
|
1688
|
-
|
|
1689
|
-
|
|
1686
|
+
H,
|
|
1687
|
+
O
|
|
1690
1688
|
]);
|
|
1691
|
-
const
|
|
1689
|
+
const nn = async (c) => {
|
|
1692
1690
|
try {
|
|
1693
1691
|
const f = ne.canonicalImageUrlKey(c);
|
|
1694
|
-
return
|
|
1692
|
+
return Qt(await Ie.current.resolve(f, void 0, be), f);
|
|
1695
1693
|
} catch {}
|
|
1696
1694
|
};
|
|
1697
1695
|
document.onpaste = function(c) {
|
|
1698
1696
|
const f = c.clipboardData?.items?.[0];
|
|
1699
|
-
if (
|
|
1697
|
+
if (H === fe && O) {
|
|
1700
1698
|
if (f?.type?.indexOf("image") === 0 && e.imageCenterLocalUploadEnabled !== !1) {
|
|
1701
|
-
const
|
|
1702
|
-
_e(
|
|
1703
|
-
const oe = { file:
|
|
1704
|
-
|
|
1699
|
+
const Q = f.getAsFile();
|
|
1700
|
+
_e(Q);
|
|
1701
|
+
const oe = { file: Q };
|
|
1702
|
+
L(""), Oe(oe);
|
|
1705
1703
|
return;
|
|
1706
1704
|
}
|
|
1707
|
-
const
|
|
1708
|
-
if (
|
|
1709
|
-
c.preventDefault(), c.stopPropagation(),
|
|
1705
|
+
const k = c.clipboardData?.getData("text/plain");
|
|
1706
|
+
if (k && k.trim().toLowerCase().startsWith("http")) {
|
|
1707
|
+
c.preventDefault(), c.stopPropagation(), L(k.trim());
|
|
1710
1708
|
return;
|
|
1711
1709
|
}
|
|
1712
|
-
f?.type?.indexOf("text") === 0 && f.getAsString((
|
|
1713
|
-
if (
|
|
1714
|
-
else if (
|
|
1715
|
-
const oe =
|
|
1716
|
-
oe &&
|
|
1710
|
+
f?.type?.indexOf("text") === 0 && f.getAsString((Q) => {
|
|
1711
|
+
if (Q.trim().toLowerCase().startsWith("http")) L(Q.trim());
|
|
1712
|
+
else if (Q.toString().slice(1, 5) === "meta") {
|
|
1713
|
+
const oe = Q.toString().split("\"")[1];
|
|
1714
|
+
oe && L(oe);
|
|
1717
1715
|
}
|
|
1718
1716
|
});
|
|
1719
1717
|
}
|
|
1720
1718
|
}, (0, n.useEffect)(() => {
|
|
1721
1719
|
const c = (f) => {
|
|
1722
|
-
let
|
|
1723
|
-
|
|
1720
|
+
let k = null;
|
|
1721
|
+
I?.kind === "background" ? (k = at, D(at)) : I?.kind === "img" && (D(st), k = st), I?.currentUrl && k && (R(I.currentUrl), B(f));
|
|
1724
1722
|
};
|
|
1725
|
-
|
|
1723
|
+
v === u.MODALS.UPLOAD_IMAGE_MODAL || v === u.MODALS.UPLOAD_BACKGROUND_MODAL ? c(we) : v === u.MODALS.UPLOAD_IMAGE_MODAL_AI || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_AI ? (ye ? (Ee(!0), Be(2)) : c(Ke), setTimeout(() => W.current?.focus({ cursor: "start" }), 100)) : v === u.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD ? (c(fe), setTimeout(() => K.current?.focus({ cursor: "start" }), 100)) : v === u.MODALS.UPLOAD_IMAGE_MODAL_STOCK || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK ? (ye ? (Ee(!0), Be(3)) : c(Fe), setTimeout(() => h.current?.focus({ cursor: "start" }), 100)) : v === u.MODALS.UPLOAD_IMAGE_MODAL_GIF || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_GIF ? (ye ? (Ee(!0), Be(3)) : c(ze), setTimeout(() => s.current?.focus({ cursor: "start" }), 100)) : v === u.MODALS.UPLOAD_IMAGE_MODAL_EDIT || v === u.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT ? (ye ? (Ee(!0), Be(5)) : c(we), i(Z.openSecondModal(u.MODALS.IMAGE_EDITOR_MODAL))) : D("");
|
|
1726
1724
|
}, [
|
|
1727
|
-
|
|
1725
|
+
v,
|
|
1728
1726
|
i,
|
|
1729
|
-
|
|
1730
|
-
|
|
1727
|
+
ye,
|
|
1728
|
+
I
|
|
1731
1729
|
]);
|
|
1732
|
-
const Qe = (0, n.useCallback)(({ url: c = C || "", meta: f =
|
|
1733
|
-
|
|
1730
|
+
const Qe = (0, n.useCallback)(({ url: c = C || "", meta: f = Kt }) => {
|
|
1731
|
+
R(c), w({
|
|
1734
1732
|
url: c,
|
|
1735
1733
|
meta: f
|
|
1736
1734
|
}), setTimeout(() => {
|
|
1737
|
-
|
|
1735
|
+
le(), ge(), pe({
|
|
1738
1736
|
keywords: "",
|
|
1739
1737
|
color: "",
|
|
1740
1738
|
orientation: ""
|
|
1741
|
-
}),
|
|
1742
|
-
}, 200), i(
|
|
1739
|
+
}), Y({ keywords: "" }), g([]), M([]), D(""), We(""), it(!1), G(""), L(""), B(fe);
|
|
1740
|
+
}, 200), i(Z.closeModal()), i(Z.closeSecondModal());
|
|
1743
1741
|
}, [
|
|
1744
1742
|
C,
|
|
1745
|
-
|
|
1743
|
+
le,
|
|
1746
1744
|
i,
|
|
1747
|
-
|
|
1745
|
+
w,
|
|
1748
1746
|
ge
|
|
1749
|
-
]),
|
|
1747
|
+
]), pt = (0, n.useCallback)((c, f) => (T("auto"), P(!1), Qe({
|
|
1750
1748
|
url: c,
|
|
1751
|
-
meta:
|
|
1749
|
+
meta: Wt
|
|
1752
1750
|
}), d.success({
|
|
1753
1751
|
id: "IMAGE_UPLOAD_SUCCESS",
|
|
1754
1752
|
data: f,
|
|
@@ -1759,161 +1757,161 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1759
1757
|
d
|
|
1760
1758
|
]);
|
|
1761
1759
|
(0, n.useEffect)(() => {
|
|
1762
|
-
const c = y ||
|
|
1760
|
+
const c = y || A, f = ne.canonicalImageUrlKey(c);
|
|
1763
1761
|
if (!c || !f) {
|
|
1764
|
-
|
|
1762
|
+
q(""), Ve.current = "", le(), ge(), Ie.current.invalidateAll();
|
|
1765
1763
|
return;
|
|
1766
1764
|
}
|
|
1767
|
-
const
|
|
1768
|
-
|
|
1769
|
-
const
|
|
1765
|
+
const k = Ve.current;
|
|
1766
|
+
k && k !== f && (Ie.current.abandonKey(k), le(), ge()), Ve.current = f;
|
|
1767
|
+
const Q = new AbortController(), oe = y ? 800 : 0, se = ++Ce.current, Ye = setTimeout(async () => {
|
|
1770
1768
|
try {
|
|
1771
1769
|
const Se = async () => {
|
|
1772
|
-
const
|
|
1773
|
-
if (
|
|
1774
|
-
const { width:
|
|
1775
|
-
|
|
1776
|
-
width:
|
|
1777
|
-
height:
|
|
1778
|
-
size: (
|
|
1779
|
-
format:
|
|
1780
|
-
}),
|
|
1770
|
+
const ue = await Ie.current.resolve(f, Q.signal, be);
|
|
1771
|
+
if (se !== Ce.current) return;
|
|
1772
|
+
const { width: ve, height: on } = await ne.getImageDimensionsFromBlob(ue);
|
|
1773
|
+
se === Ce.current && (V({
|
|
1774
|
+
width: ve,
|
|
1775
|
+
height: on,
|
|
1776
|
+
size: (ue.size / 1024).toFixed(2),
|
|
1777
|
+
format: je(ue.type)
|
|
1778
|
+
}), le(), Ue(ue));
|
|
1781
1779
|
};
|
|
1782
1780
|
if (o) await Se();
|
|
1783
1781
|
else {
|
|
1784
|
-
const
|
|
1785
|
-
if (
|
|
1786
|
-
qe(
|
|
1782
|
+
const ue = await ne.resolveDataProviderPreview(t, f);
|
|
1783
|
+
if (ue?.previewUrl && se === Ce.current) {
|
|
1784
|
+
qe(ue.previewUrl), ge();
|
|
1787
1785
|
try {
|
|
1788
|
-
const { data:
|
|
1789
|
-
if (
|
|
1790
|
-
|
|
1791
|
-
width:
|
|
1792
|
-
height:
|
|
1793
|
-
size:
|
|
1794
|
-
format:
|
|
1786
|
+
const { data: ve } = await b(f);
|
|
1787
|
+
if (se !== Ce.current) return;
|
|
1788
|
+
ve ? V({
|
|
1789
|
+
width: ve?.width,
|
|
1790
|
+
height: ve?.height,
|
|
1791
|
+
size: ve?.fileSize != null ? (ve.fileSize / 1024).toFixed(2) : "",
|
|
1792
|
+
format: je(ve?.format)
|
|
1795
1793
|
}) : await Se();
|
|
1796
1794
|
} catch {
|
|
1797
1795
|
await Se();
|
|
1798
1796
|
}
|
|
1799
1797
|
} else await Se();
|
|
1800
1798
|
}
|
|
1801
|
-
if (
|
|
1802
|
-
|
|
1803
|
-
let
|
|
1804
|
-
|
|
1799
|
+
if (se !== Ce.current) return;
|
|
1800
|
+
q("success"), R(c), $(572), setTimeout(() => {
|
|
1801
|
+
let ue = 0;
|
|
1802
|
+
x.current && (ue = x.current.offsetHeight + 62), T(ue);
|
|
1805
1803
|
}, 0);
|
|
1806
1804
|
} catch (Se) {
|
|
1807
|
-
if (Se?.name === "AbortError" ||
|
|
1808
|
-
|
|
1805
|
+
if (Se?.name === "AbortError" || Q.signal.aborted || se !== Ce.current) return;
|
|
1806
|
+
le(), ge(), q("error");
|
|
1809
1807
|
}
|
|
1810
1808
|
}, oe);
|
|
1811
1809
|
return () => {
|
|
1812
|
-
clearTimeout(Ye),
|
|
1810
|
+
clearTimeout(Ye), Q.abort();
|
|
1813
1811
|
};
|
|
1814
1812
|
}, [
|
|
1815
1813
|
y,
|
|
1816
|
-
|
|
1814
|
+
A,
|
|
1817
1815
|
o,
|
|
1818
|
-
|
|
1819
|
-
|
|
1816
|
+
le,
|
|
1817
|
+
be,
|
|
1820
1818
|
b,
|
|
1821
1819
|
ge,
|
|
1822
1820
|
t,
|
|
1823
1821
|
Ue
|
|
1824
1822
|
]), (0, n.useEffect)(() => {
|
|
1825
|
-
if (!C || y ||
|
|
1823
|
+
if (!C || y || A) return;
|
|
1826
1824
|
const c = ne.canonicalImageUrlKey(C), f = new AbortController();
|
|
1827
|
-
let
|
|
1828
|
-
const
|
|
1829
|
-
const oe = await Ie.current.resolve(c, f.signal,
|
|
1830
|
-
if (
|
|
1831
|
-
const { width:
|
|
1832
|
-
|
|
1833
|
-
width:
|
|
1825
|
+
let k = !1;
|
|
1826
|
+
const Q = async () => {
|
|
1827
|
+
const oe = await Ie.current.resolve(c, f.signal, be);
|
|
1828
|
+
if (k) return;
|
|
1829
|
+
const { width: se, height: Ye } = await ne.getImageDimensionsFromBlob(oe);
|
|
1830
|
+
k || (le(), Ue(oe), V({
|
|
1831
|
+
width: se,
|
|
1834
1832
|
height: Ye,
|
|
1835
1833
|
size: (oe.size / 1024).toFixed(2),
|
|
1836
|
-
format:
|
|
1834
|
+
format: je(oe.type)
|
|
1837
1835
|
}));
|
|
1838
1836
|
};
|
|
1839
1837
|
return (async () => {
|
|
1840
1838
|
try {
|
|
1841
1839
|
if (!o) {
|
|
1842
1840
|
const oe = await ne.resolveDataProviderPreview(t, c);
|
|
1843
|
-
if (oe?.previewUrl && !
|
|
1841
|
+
if (oe?.previewUrl && !k) {
|
|
1844
1842
|
qe(oe.previewUrl), ge();
|
|
1845
1843
|
try {
|
|
1846
|
-
const { data:
|
|
1847
|
-
if (
|
|
1848
|
-
|
|
1849
|
-
width:
|
|
1850
|
-
height:
|
|
1851
|
-
size:
|
|
1852
|
-
format:
|
|
1853
|
-
}) : await
|
|
1844
|
+
const { data: se } = await b(c);
|
|
1845
|
+
if (k) return;
|
|
1846
|
+
se ? V({
|
|
1847
|
+
width: se?.width,
|
|
1848
|
+
height: se?.height,
|
|
1849
|
+
size: se?.fileSize != null ? (se.fileSize / 1024).toFixed(2) : "",
|
|
1850
|
+
format: je(se?.format)
|
|
1851
|
+
}) : await Q();
|
|
1854
1852
|
return;
|
|
1855
1853
|
} catch {
|
|
1856
|
-
await
|
|
1854
|
+
await Q();
|
|
1857
1855
|
}
|
|
1858
1856
|
}
|
|
1859
1857
|
}
|
|
1860
|
-
await
|
|
1858
|
+
await Q();
|
|
1861
1859
|
} catch {
|
|
1862
|
-
|
|
1860
|
+
k || le();
|
|
1863
1861
|
}
|
|
1864
1862
|
})(), () => {
|
|
1865
|
-
|
|
1863
|
+
k = !0, f.abort();
|
|
1866
1864
|
};
|
|
1867
1865
|
}, [
|
|
1868
1866
|
o,
|
|
1869
|
-
|
|
1867
|
+
le,
|
|
1870
1868
|
C,
|
|
1871
|
-
|
|
1869
|
+
be,
|
|
1872
1870
|
b,
|
|
1873
1871
|
t,
|
|
1874
1872
|
y,
|
|
1875
|
-
|
|
1873
|
+
A,
|
|
1876
1874
|
Ue
|
|
1877
1875
|
]);
|
|
1878
|
-
const
|
|
1879
|
-
i(
|
|
1880
|
-
|
|
1876
|
+
const rn = () => {
|
|
1877
|
+
i(Z.closeModal()), setTimeout(() => {
|
|
1878
|
+
le(), ge(), R(""), L(""), g([]), g([]), pe({
|
|
1881
1879
|
keywords: "",
|
|
1882
1880
|
color: "",
|
|
1883
1881
|
orientation: ""
|
|
1884
|
-
}),
|
|
1882
|
+
}), Y({ keywords: "" }), T("auto"), !ce && We(""), $(572), B(fe);
|
|
1885
1883
|
}, 200);
|
|
1886
|
-
},
|
|
1887
|
-
c ===
|
|
1884
|
+
}, sn = (c) => {
|
|
1885
|
+
c === zt ? p.success({
|
|
1888
1886
|
mask: { closable: !0 },
|
|
1889
1887
|
centered: !0,
|
|
1890
1888
|
title: a("Coming soon"),
|
|
1891
1889
|
content: a("The feature is under development."),
|
|
1892
1890
|
okText: a("Ok. I'll be waiting"),
|
|
1893
1891
|
onOk: () => {}
|
|
1894
|
-
}) : c ===
|
|
1892
|
+
}) : c === we && C === "" ? p.warning({
|
|
1895
1893
|
mask: { closable: !0 },
|
|
1896
1894
|
centered: !0,
|
|
1897
1895
|
title: a(""),
|
|
1898
1896
|
content: a("To preview and edit the uploaded image"),
|
|
1899
1897
|
okText: a("Upload Image"),
|
|
1900
1898
|
onOk: () => {
|
|
1901
|
-
|
|
1899
|
+
B(fe);
|
|
1902
1900
|
}
|
|
1903
1901
|
}) : (setTimeout(() => {
|
|
1904
|
-
let f = 0,
|
|
1905
|
-
c ===
|
|
1906
|
-
}, 0),
|
|
1902
|
+
let f = 0, k = 0;
|
|
1903
|
+
c === fe && j.current ? (ie.keywords === "" && K.current?.focus({ cursor: "start" }), f = 300, k = 572) : c === we && x.current ? (f = x.current.offsetHeight + 62, k = 572) : c === Fe && S.current ? (ie.keywords === "" && h.current?.focus({ cursor: "start" }), f = 130, k = 572, ae.length > 0 && (k = 1060, f = "84vh")) : c === ze && U.current ? (ie.keywords === "" && s.current?.focus({ cursor: "start" }), f = 130, k = 572, re.length > 0 && (k = 1060, f = "84vh")) : c === Ke && _.current && (lt === "" && te.length === 0 ? (W.current?.focus({ cursor: "start" }), f = 130) : f = _.current.offsetHeight + 82, k = 572), T(f), $(k);
|
|
1904
|
+
}, 0), B(c));
|
|
1907
1905
|
};
|
|
1908
1906
|
(0, n.useEffect)(() => {
|
|
1909
|
-
|
|
1910
|
-
|
|
1907
|
+
ie.keywords === "" && (K?.current?.focus({ cursor: "start" }), g([]), setTimeout(() => {
|
|
1908
|
+
T("auto"), $(572);
|
|
1911
1909
|
}, 0));
|
|
1912
1910
|
}, [
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1911
|
+
ie,
|
|
1912
|
+
g,
|
|
1913
|
+
T,
|
|
1914
|
+
$
|
|
1917
1915
|
]);
|
|
1918
1916
|
const _e = (c) => {
|
|
1919
1917
|
const f = c.type === "image/jpeg" || c.type === "image/png" || c.type === "image/jpg" || c.type === "image/webp" || c.type === "image/gif" || c.type === "image/svg+xml";
|
|
@@ -1925,27 +1923,27 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1925
1923
|
}), f;
|
|
1926
1924
|
}, Oe = async ({ file: c }) => {
|
|
1927
1925
|
try {
|
|
1928
|
-
|
|
1929
|
-
const f = await ne.prepareImageForEditorUpload(c, e),
|
|
1930
|
-
if (
|
|
1931
|
-
const
|
|
1932
|
-
if (
|
|
1926
|
+
he(!0);
|
|
1927
|
+
const f = await ne.prepareImageForEditorUpload(c, e), k = await en(f);
|
|
1928
|
+
if (k) return pt(k, f), k;
|
|
1929
|
+
const Q = await Ft(f, t);
|
|
1930
|
+
if (Q?.url) return pt(Q.url, f), Q.url;
|
|
1933
1931
|
Me(f, null);
|
|
1934
1932
|
return;
|
|
1935
1933
|
} catch (f) {
|
|
1936
1934
|
Me(c, f);
|
|
1937
1935
|
return;
|
|
1938
1936
|
} finally {
|
|
1939
|
-
|
|
1937
|
+
he(!1);
|
|
1940
1938
|
}
|
|
1941
|
-
},
|
|
1939
|
+
}, an = (c) => Oe({ file: c });
|
|
1942
1940
|
let Le = [{
|
|
1943
1941
|
label: a("Upload"),
|
|
1944
|
-
key:
|
|
1942
|
+
key: fe,
|
|
1945
1943
|
children: (0, r.jsxs)("div", {
|
|
1946
|
-
ref:
|
|
1944
|
+
ref: j,
|
|
1947
1945
|
style: { paddingBottom: 24 },
|
|
1948
|
-
children: [e.imageCenterLocalUploadEnabled !== !1 && (0, r.jsxs)(
|
|
1946
|
+
children: [e.imageCenterLocalUploadEnabled !== !1 && (0, r.jsxs)(Ht, {
|
|
1949
1947
|
showUploadList: !1,
|
|
1950
1948
|
name: "Image",
|
|
1951
1949
|
beforeUpload: _e,
|
|
@@ -1956,7 +1954,7 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1956
1954
|
children: [
|
|
1957
1955
|
(0, r.jsx)("p", {
|
|
1958
1956
|
className: "ant-upload-drag-icon",
|
|
1959
|
-
children: (0, r.jsx)(
|
|
1957
|
+
children: (0, r.jsx)(N.EmIcons, { icon: "InboxOutlined" })
|
|
1960
1958
|
}),
|
|
1961
1959
|
(0, r.jsx)("p", {
|
|
1962
1960
|
className: "ant-upload-text",
|
|
@@ -1970,123 +1968,123 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1970
1968
|
}), (0, r.jsx)(m.Form, {
|
|
1971
1969
|
style: { padding: "0 2px 0 2px" },
|
|
1972
1970
|
children: (0, r.jsx)(m.Form.Item, {
|
|
1973
|
-
validateStatus:
|
|
1971
|
+
validateStatus: ee,
|
|
1974
1972
|
children: (0, r.jsx)(m.Input, {
|
|
1975
|
-
ref:
|
|
1973
|
+
ref: K,
|
|
1976
1974
|
allowClear: !0,
|
|
1977
1975
|
size: "large",
|
|
1978
1976
|
placeholder: a("Paste image URL here"),
|
|
1979
1977
|
value: y,
|
|
1980
|
-
onChange:
|
|
1978
|
+
onChange: $t,
|
|
1981
1979
|
spellCheck: "false"
|
|
1982
1980
|
})
|
|
1983
1981
|
})
|
|
1984
1982
|
})]
|
|
1985
1983
|
})
|
|
1986
1984
|
}];
|
|
1987
|
-
return e.imageCenterStockEnabled && !
|
|
1985
|
+
return e.imageCenterStockEnabled && !ye && Le.push({
|
|
1988
1986
|
label: a("Stock"),
|
|
1989
|
-
key:
|
|
1987
|
+
key: Fe,
|
|
1990
1988
|
children: (0, r.jsx)("div", {
|
|
1991
|
-
ref:
|
|
1989
|
+
ref: S,
|
|
1992
1990
|
style: { paddingBottom: 24 },
|
|
1993
|
-
children: (0, r.jsx)(
|
|
1994
|
-
currentReq:
|
|
1995
|
-
setCurrentReq:
|
|
1996
|
-
imageStockList:
|
|
1997
|
-
setImageStockList:
|
|
1998
|
-
setModalWidth:
|
|
1999
|
-
setModalHeight:
|
|
2000
|
-
setStockLink:
|
|
2001
|
-
setCurrentImageLink:
|
|
2002
|
-
inputRef:
|
|
1991
|
+
children: (0, r.jsx)(Ot, {
|
|
1992
|
+
currentReq: ie,
|
|
1993
|
+
setCurrentReq: pe,
|
|
1994
|
+
imageStockList: ae,
|
|
1995
|
+
setImageStockList: g,
|
|
1996
|
+
setModalWidth: $,
|
|
1997
|
+
setModalHeight: T,
|
|
1998
|
+
setStockLink: G,
|
|
1999
|
+
setCurrentImageLink: R,
|
|
2000
|
+
inputRef: h,
|
|
2003
2001
|
customRequest: Pe
|
|
2004
2002
|
})
|
|
2005
2003
|
})
|
|
2006
|
-
}), e.imageCenterGifEnabled && !
|
|
2004
|
+
}), e.imageCenterGifEnabled && !ye && Le.push({
|
|
2007
2005
|
label: a("GIF"),
|
|
2008
2006
|
key: ze,
|
|
2009
2007
|
children: (0, r.jsx)("div", {
|
|
2010
|
-
ref:
|
|
2008
|
+
ref: U,
|
|
2011
2009
|
style: { paddingBottom: 24 },
|
|
2012
|
-
children: (0, r.jsx)(
|
|
2013
|
-
currentReqGif:
|
|
2014
|
-
setCurrentReqGif:
|
|
2015
|
-
imageGifList:
|
|
2016
|
-
setImageGifList:
|
|
2017
|
-
setModalWidth:
|
|
2018
|
-
setModalHeight:
|
|
2019
|
-
setStockLink:
|
|
2020
|
-
setCurrentImageLink:
|
|
2021
|
-
inputRef:
|
|
2010
|
+
children: (0, r.jsx)(Mt, {
|
|
2011
|
+
currentReqGif: Ae,
|
|
2012
|
+
setCurrentReqGif: Y,
|
|
2013
|
+
imageGifList: re,
|
|
2014
|
+
setImageGifList: M,
|
|
2015
|
+
setModalWidth: $,
|
|
2016
|
+
setModalHeight: T,
|
|
2017
|
+
setStockLink: G,
|
|
2018
|
+
setCurrentImageLink: R,
|
|
2019
|
+
inputRef: s,
|
|
2022
2020
|
customRequest: Pe
|
|
2023
2021
|
})
|
|
2024
2022
|
})
|
|
2025
|
-
}), e.elementAIimageEnabled && !
|
|
2023
|
+
}), e.elementAIimageEnabled && !ye && Le.push({
|
|
2026
2024
|
label: a("AI"),
|
|
2027
2025
|
key: Ke,
|
|
2028
2026
|
children: (0, r.jsx)("div", {
|
|
2029
|
-
ref:
|
|
2027
|
+
ref: _,
|
|
2030
2028
|
style: { paddingBottom: 24 },
|
|
2031
|
-
children: (0, r.jsx)(
|
|
2032
|
-
setModalHeight:
|
|
2029
|
+
children: (0, r.jsx)(Ut, {
|
|
2030
|
+
setModalHeight: T,
|
|
2033
2031
|
customRequest: Oe,
|
|
2034
|
-
aiImageRequest:
|
|
2032
|
+
aiImageRequest: lt,
|
|
2035
2033
|
setAiImageRequest: We,
|
|
2036
|
-
imageAiList:
|
|
2037
|
-
setImageAiList:
|
|
2038
|
-
isLoadingAi:
|
|
2039
|
-
setIsLoadingAi:
|
|
2040
|
-
aiTabRef:
|
|
2041
|
-
inputAiRef:
|
|
2034
|
+
imageAiList: te,
|
|
2035
|
+
setImageAiList: X,
|
|
2036
|
+
isLoadingAi: ce,
|
|
2037
|
+
setIsLoadingAi: it,
|
|
2038
|
+
aiTabRef: _,
|
|
2039
|
+
inputAiRef: W,
|
|
2042
2040
|
isImageUploaded: E,
|
|
2043
|
-
setIsImageUploaded:
|
|
2041
|
+
setIsImageUploaded: P
|
|
2044
2042
|
})
|
|
2045
2043
|
})
|
|
2046
2044
|
}), e.imageCenterEditorEnabled && Le.push({
|
|
2047
2045
|
label: "",
|
|
2048
|
-
key:
|
|
2046
|
+
key: we,
|
|
2049
2047
|
children: (0, r.jsx)("div", {
|
|
2050
|
-
ref:
|
|
2051
|
-
children: (0, r.jsx)(
|
|
2048
|
+
ref: x,
|
|
2049
|
+
children: (0, r.jsx)(It, {
|
|
2052
2050
|
currentImageLink: C,
|
|
2053
2051
|
newLink: y,
|
|
2054
|
-
previewDisplayUrl:
|
|
2055
|
-
resolvedPreviewObjectUrl:
|
|
2056
|
-
resolvedPreviewBlob:
|
|
2057
|
-
resolveImageBlob:
|
|
2058
|
-
imageSize:
|
|
2059
|
-
onSave:
|
|
2060
|
-
uploadImageResultIsLoading:
|
|
2052
|
+
previewDisplayUrl: Jt,
|
|
2053
|
+
resolvedPreviewObjectUrl: Zt,
|
|
2054
|
+
resolvedPreviewBlob: Xt,
|
|
2055
|
+
resolveImageBlob: tn,
|
|
2056
|
+
imageSize: z,
|
|
2057
|
+
onSave: an,
|
|
2058
|
+
uploadImageResultIsLoading: F || !1
|
|
2061
2059
|
})
|
|
2062
2060
|
})
|
|
2063
2061
|
}), (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(m.Modal, {
|
|
2064
|
-
width:
|
|
2062
|
+
width: J,
|
|
2065
2063
|
className: "image-center",
|
|
2066
2064
|
title: a("Image Center"),
|
|
2067
2065
|
style: { minHeight: 390 },
|
|
2068
|
-
open: !!
|
|
2066
|
+
open: !!O,
|
|
2069
2067
|
onOk: Qe,
|
|
2070
|
-
onCancel:
|
|
2071
|
-
footer:
|
|
2068
|
+
onCancel: rn,
|
|
2069
|
+
footer: H === we ? (0, r.jsx)(r.Fragment, {}) : null,
|
|
2072
2070
|
children: (0, r.jsx)(m.Spin, {
|
|
2073
|
-
spinning:
|
|
2071
|
+
spinning: F,
|
|
2074
2072
|
children: (0, r.jsx)(m.Tabs, {
|
|
2075
|
-
activeKey:
|
|
2076
|
-
onChange:
|
|
2073
|
+
activeKey: H,
|
|
2074
|
+
onChange: sn,
|
|
2077
2075
|
items: Le,
|
|
2078
2076
|
className: "modal-tabs",
|
|
2079
2077
|
style: {
|
|
2080
|
-
height:
|
|
2078
|
+
height: me,
|
|
2081
2079
|
minHeight: 130
|
|
2082
2080
|
}
|
|
2083
2081
|
})
|
|
2084
2082
|
})
|
|
2085
|
-
}), (0, r.jsx)(
|
|
2086
|
-
open:
|
|
2083
|
+
}), (0, r.jsx)(N.PlanUpgradePrompt, {
|
|
2084
|
+
open: _t,
|
|
2087
2085
|
onCancel: () => Ee(!1),
|
|
2088
|
-
initialSlide:
|
|
2086
|
+
initialSlide: Yt
|
|
2089
2087
|
})] });
|
|
2090
2088
|
};
|
|
2091
|
-
ot.propTypes = { dataProvider:
|
|
2089
|
+
ot.propTypes = { dataProvider: yt.default.object }, gt.default = ot;
|
|
2092
2090
|
});
|