useblocks 1.1.49 → 1.1.53
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/runtime/THIRD_PARTY_LICENSES.txt +1 -1
- package/singlepage_headless_plugin.html +1 -1
- package/static/core/{8c81db36.js → 139e4380.js} +3 -3
- package/static/core/{1ca5f3772.js → 1995fb0a2.js} +10 -10
- package/static/core/{3b4845f7.js → 1f5e1fc9.js} +321 -321
- package/static/core/{59023866.js → 31e98e6e.js} +616 -611
- package/static/core/{13f581cc.js → 5318562c.js} +3 -3
- package/static/core/{386cf7b3.js → 75737a9d.js} +5156 -5116
- package/static/core/{11296a18.js → 9929a348.js} +107 -107
- package/static/core/{e7c24fe9.js → b408f33a.js} +179 -173
- package/static/core/{3dea3b87.js → bc7e3d2b.js} +7 -7
- package/static/core/{de79e0c5.js → c3058168.js} +524 -510
- package/static/core/ce0410b1.js +467 -0
- package/static/core/{339377b8.js → d1eb3c68.js} +13244 -13200
- package/static/core/{8e110c69.js → dc1f9e4f.js} +31 -31
- package/static/core/{7a229b90.js → e1d239ab.js} +41 -41
- package/static/core/{aacf134d.js → e5e07f1d.js} +514 -494
- package/static/core/{acb049cb.js → ebd852b6.js} +1267 -1265
- package/static/core/{c59f9731.js → ee0ddb51.js} +4036 -3900
- package/static/core/{13d197af.js → f3cff4c9.js} +169 -169
- package/two_step_headless_plugin.html +1 -1
- package/ui-kit/index.js +49 -47
- package/{useblocks-core.15a9129c.js → useblocks-core.2a5dade1.js} +6 -6
- package/useblocks-esm.js +3 -3
- package/useblocks.js +3 -3
- package/static/core/a11c28c2.js +0 -467
- /package/iframe/{iframe-eblock.15a9129c.html → iframe-eblock.2a5dade1.html} +0 -0
- /package/iframe/{iframe.15a9129c.html → iframe.2a5dade1.html} +0 -0
|
@@ -1,25 +1,26 @@
|
|
|
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/31e98e6e.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/
|
|
11
|
-
"static/core/
|
|
12
|
-
"static/core/
|
|
7
|
+
"static/core/ee0ddb51.js",
|
|
8
|
+
"static/core/5318562c.js",
|
|
9
|
+
"static/core/ebd852b6.js",
|
|
10
|
+
"static/core/75737a9d.js",
|
|
11
|
+
"static/core/1995fb0a2.js",
|
|
12
|
+
"static/core/1f5e1fc9.js",
|
|
13
13
|
"react",
|
|
14
|
+
"prop-types",
|
|
14
15
|
"react-router-dom",
|
|
15
|
-
"react/jsx-runtime"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const Je = le("./bd36b180.js"), u = le("./c59f9731.js"), Y = le("./13f581cc.js"), f = le("./acb049cb.js"), Ct = le("./386cf7b3.js"), T = le("./1ca5f3772.js"), re = le("./3b4845f7.js");
|
|
16
|
+
"react/jsx-runtime"
|
|
17
|
+
], function(le, vt, dn) {
|
|
18
|
+
const Je = le("./bd36b180.js"), u = le("./ee0ddb51.js"), _ = le("./5318562c.js"), m = le("./ebd852b6.js"), Ct = le("./75737a9d.js"), F = le("./1995fb0a2.js"), ne = le("./1f5e1fc9.js");
|
|
19
19
|
let n = le("react");
|
|
20
20
|
n = Je.__toESM(n);
|
|
21
|
-
let Te = le("
|
|
22
|
-
|
|
21
|
+
let Te = le("prop-types");
|
|
22
|
+
Te = Je.__toESM(Te);
|
|
23
|
+
let Ne = le("react-router-dom"), r = le("react/jsx-runtime");
|
|
23
24
|
function bt(t, e) {
|
|
24
25
|
return { [t]: {
|
|
25
26
|
Filter: e("Filter"),
|
|
@@ -110,11 +111,11 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
110
111
|
let o = t.trim(), a = e?.trim() || "application/octet-stream";
|
|
111
112
|
const i = o.indexOf(",");
|
|
112
113
|
if (o.startsWith("data:") && i >= 0) {
|
|
113
|
-
const
|
|
114
|
-
|
|
114
|
+
const d = o.slice(5, i).split(";")[0]?.trim();
|
|
115
|
+
d && (a = d), o = o.slice(i + 1);
|
|
115
116
|
}
|
|
116
|
-
const l = o.replace(/\s/g, ""),
|
|
117
|
-
for (let
|
|
117
|
+
const l = o.replace(/\s/g, ""), b = atob(l), g = new Uint8Array(b.length);
|
|
118
|
+
for (let d = 0; d < b.length; d++) g[d] = b.charCodeAt(d);
|
|
118
119
|
return new Blob([g], { type: a });
|
|
119
120
|
}
|
|
120
121
|
var wt = "static/media/image-editor", At = { text: {
|
|
@@ -241,58 +242,60 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
241
242
|
const o = `image/${t}`;
|
|
242
243
|
return $e(e.replace(/data:image\/([a-z]*)?;base64,/, ""), o);
|
|
243
244
|
}
|
|
244
|
-
var xt = ({ currentImageLink: t, prefetchedBlob: e,
|
|
245
|
-
const
|
|
246
|
-
let
|
|
247
|
-
const
|
|
248
|
-
if (!
|
|
249
|
-
const
|
|
250
|
-
for (const [P,
|
|
251
|
-
return Object.keys(
|
|
252
|
-
}, [
|
|
245
|
+
var xt = ({ currentImageLink: t, prefetchedBlob: e, resolveImageBlob: o, onSave: a, uploadImageResultIsLoading: i }) => {
|
|
246
|
+
const l = ne.useCookieManager(), [b, g] = (0, n.useState)(), [d, R] = (0, n.useState)(), { __: x } = m.useI18n();
|
|
247
|
+
let p = u.useDispatch();
|
|
248
|
+
const w = u.useStore(), j = u.useAppConfig(), C = u.useSelector(u.selectedCurrentUser), U = u.useSelector(_.selectSecondModal), y = u.useSelector(u.selectProject), D = (0, n.useMemo)(() => {
|
|
249
|
+
if (!j?.icons) return;
|
|
250
|
+
const k = {};
|
|
251
|
+
for (const [P, E] of Object.entries(j.icons)) typeof E == "string" && (k[P] = F.sanitizeHtml(E));
|
|
252
|
+
return Object.keys(k).length > 0 ? k : void 0;
|
|
253
|
+
}, [j?.icons]), O = (0, n.useRef)(!1), [T, Q] = (0, n.useState)(), N = u.useEventEmitter(u.events.FILE_PROXY_EVENT_ID);
|
|
253
254
|
(0, n.useEffect)(() => {
|
|
254
|
-
let
|
|
255
|
+
let k = !1;
|
|
255
256
|
return (async () => {
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
257
|
+
const E = t;
|
|
258
|
+
if (!E && !e) return;
|
|
258
259
|
let I = e;
|
|
259
|
-
if (!I &&
|
|
260
|
-
I = await (await fetch(
|
|
260
|
+
if (!I && E) try {
|
|
261
|
+
typeof o == "function" ? I = await o(E) : I = await (await fetch(E)).blob();
|
|
261
262
|
} catch {
|
|
262
|
-
if (
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
263
|
+
if (k) return;
|
|
264
|
+
if (I = await N.fire({
|
|
265
|
+
url: E,
|
|
266
|
+
project: y
|
|
267
|
+
}).filter((L) => L instanceof Blob)[0], !I) {
|
|
268
|
+
const L = l.get(u.APP_COOKIES.em_token) || await u.di.getInstance(w, _.TOKEN_ID);
|
|
269
|
+
I = await (await fetch(`https://app.useblocks.io/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(E)}`, { headers: { authorization: `Bearer ${L}` } })).blob();
|
|
268
270
|
}
|
|
269
271
|
}
|
|
270
|
-
if (
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
if (
|
|
274
|
-
const
|
|
275
|
-
typeof
|
|
276
|
-
},
|
|
277
|
-
})().catch((
|
|
278
|
-
|
|
272
|
+
if (k || !I) return;
|
|
273
|
+
const A = new FileReader();
|
|
274
|
+
A.onload = () => {
|
|
275
|
+
if (k) return;
|
|
276
|
+
const L = A.result;
|
|
277
|
+
typeof L == "string" && (g(L), R(I.type), T?.tools.import.openBackgroundImage(L));
|
|
278
|
+
}, A.onerror = () => {}, A.readAsDataURL(I);
|
|
279
|
+
})().catch((E) => {}), () => {
|
|
280
|
+
k = !0;
|
|
279
281
|
};
|
|
280
282
|
}, [
|
|
281
283
|
t,
|
|
282
284
|
e,
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
o,
|
|
286
|
+
l,
|
|
287
|
+
T,
|
|
288
|
+
N,
|
|
289
|
+
y,
|
|
290
|
+
w
|
|
288
291
|
]);
|
|
289
|
-
const
|
|
290
|
-
|
|
291
|
-
}, [
|
|
292
|
-
|
|
292
|
+
const M = (0, n.useCallback)(() => {
|
|
293
|
+
g(null), R(null), p(_.closeSecondModal()), p(_.closeModal(u.MODALS.UPLOAD_IMAGE_MODAL));
|
|
294
|
+
}, [p]), z = (0, n.useRef)();
|
|
295
|
+
z.current = async function(k, P, E) {
|
|
293
296
|
try {
|
|
294
|
-
const I = It(
|
|
295
|
-
|
|
297
|
+
const I = It(E, k);
|
|
298
|
+
a && await a(new File([I], P, {
|
|
296
299
|
lastModified: Date.now(),
|
|
297
300
|
type: I.type
|
|
298
301
|
}));
|
|
@@ -300,14 +303,14 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
300
303
|
throw I;
|
|
301
304
|
}
|
|
302
305
|
};
|
|
303
|
-
const
|
|
304
|
-
if (
|
|
305
|
-
|
|
306
|
-
const P =
|
|
306
|
+
const ee = (0, n.useCallback)((k) => {
|
|
307
|
+
if (k && !(O.current && T)) {
|
|
308
|
+
O.current = !0;
|
|
309
|
+
const P = C.locale ? C.locale.replace("_", "-") : "en-US", E = C.theme === "system" ? matchMedia("(prefers-color-scheme: dark)").matches ? u.DARK : u.LIGHT : C.theme;
|
|
307
310
|
Ct.Tf.init({
|
|
308
311
|
selector: "#pixie-editor",
|
|
309
|
-
baseUrl:
|
|
310
|
-
image:
|
|
312
|
+
baseUrl: m.getBundledHostAssetUrl(wt),
|
|
313
|
+
image: b,
|
|
311
314
|
activeLanguage: P,
|
|
312
315
|
languages: bt(P, x),
|
|
313
316
|
tools: At,
|
|
@@ -326,9 +329,9 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
326
329
|
},
|
|
327
330
|
{
|
|
328
331
|
type: "button",
|
|
329
|
-
icon: (0, r.jsx)(
|
|
332
|
+
icon: (0, r.jsx)(m.EmIcons, {
|
|
330
333
|
icon: "HistoryOutlined",
|
|
331
|
-
configIcons:
|
|
334
|
+
configIcons: D,
|
|
332
335
|
style: { fontSize: 20 }
|
|
333
336
|
}),
|
|
334
337
|
align: "right",
|
|
@@ -339,49 +342,49 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
339
342
|
},
|
|
340
343
|
{
|
|
341
344
|
type: "button",
|
|
342
|
-
icon: (0, r.jsx)(
|
|
345
|
+
icon: (0, r.jsx)(m.EmIcons, {
|
|
343
346
|
icon: "CloseOutlined",
|
|
344
|
-
configIcons:
|
|
347
|
+
configIcons: D,
|
|
345
348
|
style: { fontSize: 20 }
|
|
346
349
|
}),
|
|
347
350
|
align: "right",
|
|
348
351
|
desktopOnly: !0,
|
|
349
|
-
action: () =>
|
|
352
|
+
action: () => M()
|
|
350
353
|
}
|
|
351
354
|
]
|
|
352
355
|
},
|
|
353
356
|
nav: { position: "top" },
|
|
354
|
-
activeTheme:
|
|
357
|
+
activeTheme: E,
|
|
355
358
|
mode: "inline",
|
|
356
359
|
forceOverlayModeOnMobile: !1
|
|
357
360
|
},
|
|
358
|
-
onSave: async function(I,
|
|
361
|
+
onSave: async function(I, A, L) {
|
|
359
362
|
try {
|
|
360
|
-
await
|
|
363
|
+
await z.current(I, A, L);
|
|
361
364
|
} catch {}
|
|
362
365
|
}
|
|
363
366
|
}).then((I) => {
|
|
364
|
-
|
|
367
|
+
Q(I);
|
|
365
368
|
}).catch((I) => {});
|
|
366
369
|
}
|
|
367
370
|
}, [
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
371
|
+
C.theme,
|
|
372
|
+
b,
|
|
373
|
+
T,
|
|
374
|
+
Q,
|
|
375
|
+
C.locale,
|
|
373
376
|
x,
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
]),
|
|
377
|
-
|
|
377
|
+
M,
|
|
378
|
+
D
|
|
379
|
+
]), K = (0, n.useCallback)(() => {
|
|
380
|
+
T?.tools.export.save(t?.split("/").pop().split(".")[0], d?.split("/")[1]);
|
|
378
381
|
}, [
|
|
379
|
-
|
|
382
|
+
T,
|
|
380
383
|
t,
|
|
381
|
-
|
|
384
|
+
d
|
|
382
385
|
]);
|
|
383
|
-
return (0, r.jsxs)(
|
|
384
|
-
afterOpenChange:
|
|
386
|
+
return (0, r.jsxs)(m.Modal, {
|
|
387
|
+
afterOpenChange: ee,
|
|
385
388
|
width: "100%",
|
|
386
389
|
style: {
|
|
387
390
|
maxWidth: "100%",
|
|
@@ -392,19 +395,19 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
392
395
|
closable: !1,
|
|
393
396
|
zIndex: 1100,
|
|
394
397
|
mask: !1,
|
|
395
|
-
open:
|
|
396
|
-
footer: [(0, r.jsx)(
|
|
398
|
+
open: U,
|
|
399
|
+
footer: [(0, r.jsx)(m.Button, {
|
|
397
400
|
className: "em-analytics__profile-cancel",
|
|
398
|
-
onClick:
|
|
401
|
+
onClick: M,
|
|
399
402
|
children: x("Cancel")
|
|
400
|
-
}, "Cancel"), (0, r.jsx)(
|
|
403
|
+
}, "Cancel"), (0, r.jsx)(m.Button, {
|
|
401
404
|
className: "em-analytics__profile-updapixiete",
|
|
402
405
|
id: "save",
|
|
403
406
|
type: "primary",
|
|
404
|
-
onClick:
|
|
407
|
+
onClick: K,
|
|
405
408
|
children: x("Update")
|
|
406
409
|
}, "Ok")],
|
|
407
|
-
children: [
|
|
410
|
+
children: [i && (0, r.jsx)("div", {
|
|
408
411
|
style: {
|
|
409
412
|
position: "absolute",
|
|
410
413
|
height: "100%",
|
|
@@ -416,14 +419,14 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
416
419
|
zIndex: 10,
|
|
417
420
|
opacity: .7
|
|
418
421
|
},
|
|
419
|
-
children: (0, r.jsx)(
|
|
422
|
+
children: (0, r.jsx)(m.Spin, { size: "large" })
|
|
420
423
|
}), (0, r.jsx)("div", { id: "pixie-editor" })]
|
|
421
424
|
});
|
|
422
|
-
}, St = ({ currentImageLink: t, newLink: e, previewDisplayUrl: o, resolvedPreviewObjectUrl: a, resolvedPreviewBlob: i,
|
|
423
|
-
const
|
|
425
|
+
}, St = ({ currentImageLink: t, newLink: e, previewDisplayUrl: o, resolvedPreviewObjectUrl: a, resolvedPreviewBlob: i, resolveImageBlob: l, onSave: b, uploadImageResultIsLoading: g }) => {
|
|
426
|
+
const d = o || a;
|
|
424
427
|
return (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)("div", { children: (0, r.jsxs)("div", {
|
|
425
428
|
className: "image-preview",
|
|
426
|
-
children: [
|
|
429
|
+
children: [g && (0, r.jsx)("div", {
|
|
427
430
|
style: {
|
|
428
431
|
position: "absolute",
|
|
429
432
|
height: "100%",
|
|
@@ -435,111 +438,112 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
435
438
|
zIndex: 10,
|
|
436
439
|
opacity: .7
|
|
437
440
|
},
|
|
438
|
-
children: (0, r.jsx)(
|
|
439
|
-
}),
|
|
441
|
+
children: (0, r.jsx)(m.Spin, { size: "large" })
|
|
442
|
+
}), d && (0, r.jsx)("img", {
|
|
440
443
|
alt: "uploadedImage",
|
|
441
|
-
src:
|
|
444
|
+
src: d
|
|
442
445
|
})]
|
|
443
446
|
}) }), (0, r.jsx)(xt, {
|
|
444
447
|
currentImageLink: t,
|
|
445
448
|
prefetchedBlob: i,
|
|
449
|
+
resolveImageBlob: l,
|
|
446
450
|
newLink: e,
|
|
447
|
-
onSave:
|
|
448
|
-
uploadImageResultIsLoading:
|
|
451
|
+
onSave: b,
|
|
452
|
+
uploadImageResultIsLoading: g
|
|
449
453
|
})] });
|
|
450
|
-
},
|
|
454
|
+
}, Re = {
|
|
451
455
|
Pixel: "Pixel",
|
|
452
456
|
Percent: "Percent"
|
|
453
457
|
}, et = {
|
|
454
|
-
unit:
|
|
458
|
+
unit: Re.Percent,
|
|
455
459
|
value: 80
|
|
456
460
|
};
|
|
457
461
|
function Rt(t) {
|
|
458
462
|
return typeof t == "number" ? {
|
|
459
|
-
unit:
|
|
463
|
+
unit: Re.Percent,
|
|
460
464
|
value: t * 100
|
|
461
465
|
} : typeof t == "string" ? /^(\d*(\.\d+)?)px$/.exec(t) ? {
|
|
462
|
-
unit:
|
|
466
|
+
unit: Re.Pixel,
|
|
463
467
|
value: parseFloat(t)
|
|
464
468
|
} : /^(\d*(\.\d+)?)%$/.exec(t) ? {
|
|
465
|
-
unit:
|
|
469
|
+
unit: Re.Percent,
|
|
466
470
|
value: parseFloat(t)
|
|
467
471
|
} : et : et;
|
|
468
472
|
}
|
|
469
473
|
function jt(t, e) {
|
|
470
474
|
const o = Rt(t);
|
|
471
475
|
let a;
|
|
472
|
-
return o.unit ===
|
|
476
|
+
return o.unit === Re.Pixel ? a = `${o.value}px` : a = `${100 - o.value}%`, e ? `${a} 0px 0px 0px` : `0px 0px ${a} 0px`;
|
|
473
477
|
}
|
|
474
|
-
function tt({ next: t, hasMore: e, children: o, loader: a, scrollThreshold: i = .8, endMessage: l, style:
|
|
475
|
-
const [ee,
|
|
478
|
+
function tt({ next: t, hasMore: e, children: o, loader: a, scrollThreshold: i = .8, endMessage: l, style: b, height: g, scrollableTarget: d, hasChildren: R, inverse: x = !1, pullDownToRefresh: p = !1, pullDownToRefreshContent: w, releaseToRefreshContent: j, pullDownToRefreshThreshold: C = 100, refreshFunction: U, onScroll: y, dataLength: D, initialScrollY: O, className: T = "", role: Q, tabIndex: N, id: M, ...z }) {
|
|
479
|
+
const [ee, K] = (0, n.useState)(!1), [k, P] = (0, n.useState)(!1), [E, I] = (0, n.useState)(0), A = (0, n.useRef)(null), L = (0, n.useRef)(null), J = (0, n.useRef)(null), q = (0, n.useRef)(t);
|
|
476
480
|
q.current = t;
|
|
477
|
-
const s = (0, n.useRef)(
|
|
478
|
-
s.current =
|
|
479
|
-
const
|
|
480
|
-
|
|
481
|
-
const
|
|
481
|
+
const s = (0, n.useRef)(U);
|
|
482
|
+
s.current = U;
|
|
483
|
+
const h = (0, n.useRef)(C);
|
|
484
|
+
h.current = C;
|
|
485
|
+
const W = (0, n.useRef)(!1), ce = (0, n.useRef)(!1), Z = (0, n.useRef)(0), $ = (0, n.useRef)(0), X = (0, n.useRef)(0), H = (0, n.useCallback)(() => d instanceof HTMLElement ? d : typeof d == "string" ? document.getElementById(d) : null, [d]);
|
|
482
486
|
(0, n.useEffect)(() => {
|
|
483
487
|
if (typeof D > "u") throw new Error("mandatory prop \"dataLength\" is missing. The prop is needed when loading more content. Check README.md for usage");
|
|
484
|
-
if (p && typeof
|
|
488
|
+
if (p && typeof U != "function") throw new Error(`Mandatory prop "refreshFunction" missing.
|
|
485
489
|
Pull Down To Refresh functionality will not work
|
|
486
490
|
as expected. Check README.md for usage'`);
|
|
487
|
-
if (typeof
|
|
488
|
-
const
|
|
489
|
-
|
|
491
|
+
if (typeof O == "number") {
|
|
492
|
+
const Y = g ? A.current : H();
|
|
493
|
+
Y && Y.scrollHeight > O && Y.scrollTo(0, O);
|
|
490
494
|
}
|
|
491
495
|
}, []), (0, n.useEffect)(() => {
|
|
492
|
-
|
|
496
|
+
W.current = !1, K(!1);
|
|
493
497
|
}, [D]), (0, n.useEffect)(() => {
|
|
494
498
|
if (!e || typeof IntersectionObserver > "u") return;
|
|
495
|
-
const
|
|
496
|
-
if (!
|
|
497
|
-
const se = g ? A.current :
|
|
498
|
-
!ae.isIntersecting ||
|
|
499
|
+
const Y = L.current;
|
|
500
|
+
if (!Y) return;
|
|
501
|
+
const se = g ? A.current : H(), B = new IntersectionObserver(([ae]) => {
|
|
502
|
+
!ae.isIntersecting || W.current || (W.current = !0, K(!0), q.current());
|
|
499
503
|
}, {
|
|
500
504
|
root: se,
|
|
501
|
-
rootMargin: jt(i,
|
|
505
|
+
rootMargin: jt(i, x),
|
|
502
506
|
threshold: 0
|
|
503
507
|
});
|
|
504
|
-
return B.observe(
|
|
508
|
+
return B.observe(Y), () => B.disconnect();
|
|
505
509
|
}, [
|
|
506
510
|
e,
|
|
507
511
|
i,
|
|
508
|
-
|
|
512
|
+
x,
|
|
509
513
|
g,
|
|
510
|
-
|
|
514
|
+
H
|
|
511
515
|
]), (0, n.useEffect)(() => {
|
|
512
|
-
var
|
|
513
|
-
if (!
|
|
514
|
-
const se = (
|
|
516
|
+
var Y;
|
|
517
|
+
if (!y) return;
|
|
518
|
+
const se = (Y = g ? A.current : H()) !== null && Y !== void 0 ? Y : typeof window < "u" ? window : null;
|
|
515
519
|
if (!se) return;
|
|
516
520
|
const B = (ae) => {
|
|
517
|
-
setTimeout(() =>
|
|
521
|
+
setTimeout(() => y(ae), 0);
|
|
518
522
|
};
|
|
519
523
|
return se.addEventListener("scroll", B), () => se.removeEventListener("scroll", B);
|
|
520
524
|
}, [
|
|
521
|
-
|
|
525
|
+
y,
|
|
522
526
|
g,
|
|
523
|
-
|
|
527
|
+
H
|
|
524
528
|
]), (0, n.useEffect)(() => {
|
|
525
|
-
var
|
|
529
|
+
var Y, se;
|
|
526
530
|
if (!p) return;
|
|
527
|
-
const B = (
|
|
531
|
+
const B = (Y = g ? A.current : H()) !== null && Y !== void 0 ? Y : typeof window < "u" ? window : null;
|
|
528
532
|
if (!B) return;
|
|
529
533
|
if (!((se = J.current) === null || se === void 0) && se.firstChild) {
|
|
530
|
-
const
|
|
531
|
-
X.current =
|
|
534
|
+
const G = J.current.firstChild.getBoundingClientRect().height;
|
|
535
|
+
X.current = G, I(G);
|
|
532
536
|
}
|
|
533
|
-
const ae = (
|
|
534
|
-
(B instanceof HTMLElement ? B.scrollTop : document.documentElement.scrollTop) > 0 || (ce.current = !0,
|
|
535
|
-
}, v = (
|
|
536
|
-
if (!ce.current || (
|
|
537
|
+
const ae = (G) => {
|
|
538
|
+
(B instanceof HTMLElement ? B.scrollTop : document.documentElement.scrollTop) > 0 || (ce.current = !0, G instanceof MouseEvent ? Z.current = G.pageY : G instanceof TouchEvent && (Z.current = G.touches[0].pageY), $.current = Z.current, A.current && (A.current.style.willChange = "transform", A.current.style.transition = "transform 0.2s cubic-bezier(0,0,0.31,1)"));
|
|
539
|
+
}, v = (G) => {
|
|
540
|
+
if (!ce.current || (G instanceof MouseEvent ? $.current = G.pageY : G instanceof TouchEvent && ($.current = G.touches[0].pageY), $.current < Z.current)) return;
|
|
537
541
|
const fe = $.current - Z.current;
|
|
538
|
-
fe >=
|
|
542
|
+
fe >= h.current && P(!0), !(fe > X.current * 1.5) && A.current && (A.current.style.overflow = "visible", A.current.style.transform = `translate3d(0px, ${fe}px, 0px)`);
|
|
539
543
|
}, te = () => {
|
|
540
|
-
Z.current = 0, $.current = 0, ce.current = !1,
|
|
544
|
+
Z.current = 0, $.current = 0, ce.current = !1, P((G) => {
|
|
541
545
|
var fe;
|
|
542
|
-
return
|
|
546
|
+
return G && ((fe = s.current) === null || fe === void 0 || fe.call(s)), !1;
|
|
543
547
|
}), requestAnimationFrame(() => {
|
|
544
548
|
A.current && (A.current.style.overflow = "auto", A.current.style.transform = "none", A.current.style.willChange = "unset");
|
|
545
549
|
});
|
|
@@ -550,26 +554,26 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
550
554
|
}, [
|
|
551
555
|
p,
|
|
552
556
|
g,
|
|
553
|
-
|
|
557
|
+
H
|
|
554
558
|
]);
|
|
555
559
|
const ie = {
|
|
556
560
|
height: g ?? "auto",
|
|
557
561
|
overflow: "auto",
|
|
558
562
|
WebkitOverflowScrolling: "touch",
|
|
559
|
-
...
|
|
560
|
-
}, he =
|
|
561
|
-
ref:
|
|
563
|
+
...b
|
|
564
|
+
}, he = R || !!(o && o instanceof Array && o.length), ye = p && g ? { overflow: "auto" } : {}, ue = e ? (0, r.jsx)("div", {
|
|
565
|
+
ref: L,
|
|
562
566
|
style: { height: 1 }
|
|
563
567
|
}) : null;
|
|
564
568
|
return (0, r.jsx)("div", {
|
|
565
569
|
style: ye,
|
|
566
570
|
className: "infinite-scroll-component__outerdiv",
|
|
567
571
|
children: (0, r.jsxs)("div", {
|
|
568
|
-
...
|
|
569
|
-
role:
|
|
570
|
-
tabIndex:
|
|
572
|
+
...z,
|
|
573
|
+
role: Q,
|
|
574
|
+
tabIndex: N,
|
|
571
575
|
id: M,
|
|
572
|
-
className: ["infinite-scroll-component",
|
|
576
|
+
className: ["infinite-scroll-component", T].filter(Boolean).join(" "),
|
|
573
577
|
ref: A,
|
|
574
578
|
style: ie,
|
|
575
579
|
children: [
|
|
@@ -581,9 +585,9 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
581
585
|
position: "absolute",
|
|
582
586
|
left: 0,
|
|
583
587
|
right: 0,
|
|
584
|
-
top: -1 *
|
|
588
|
+
top: -1 * E
|
|
585
589
|
},
|
|
586
|
-
children:
|
|
590
|
+
children: k ? j : w
|
|
587
591
|
})
|
|
588
592
|
}),
|
|
589
593
|
o,
|
|
@@ -629,7 +633,7 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
629
633
|
}
|
|
630
634
|
return o;
|
|
631
635
|
}
|
|
632
|
-
function
|
|
636
|
+
function je(t) {
|
|
633
637
|
for (var e = 1; e < arguments.length; e++) {
|
|
634
638
|
var o = arguments[e] != null ? arguments[e] : {};
|
|
635
639
|
e % 2 ? nt(Object(o), !0).forEach(function(a) {
|
|
@@ -702,15 +706,15 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
702
706
|
const { column: t, columnAttrs: e = {}, columnClassName: o } = this.props, a = this.itemsInColumns(), i = `${100 / a.length}%`;
|
|
703
707
|
let l = o;
|
|
704
708
|
l && typeof l != "string" && (this.logDeprecated("The property \"columnClassName\" requires a string"), typeof l > "u" && (l = "my-masonry-grid_column"));
|
|
705
|
-
const
|
|
706
|
-
style:
|
|
709
|
+
const b = je(je(je({}, t), e), {}, {
|
|
710
|
+
style: je(je({}, e.style), {}, { width: i }),
|
|
707
711
|
className: l
|
|
708
712
|
});
|
|
709
|
-
return a.map((g,
|
|
713
|
+
return a.map((g, d) => n.default.createElement("div", De({}, b, { key: d }), g));
|
|
710
714
|
}
|
|
711
715
|
logDeprecated(t) {}
|
|
712
716
|
render() {
|
|
713
|
-
const t = this.props, { children: e, breakpointCols: o, columnClassName: a, columnAttrs: i, column: l, className:
|
|
717
|
+
const t = this.props, { children: e, breakpointCols: o, columnClassName: a, columnAttrs: i, column: l, className: b } = t, g = kt(t, [
|
|
714
718
|
"children",
|
|
715
719
|
"breakpointCols",
|
|
716
720
|
"columnClassName",
|
|
@@ -718,8 +722,8 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
718
722
|
"column",
|
|
719
723
|
"className"
|
|
720
724
|
]);
|
|
721
|
-
let
|
|
722
|
-
return typeof
|
|
725
|
+
let d = b;
|
|
726
|
+
return typeof b != "string" && (this.logDeprecated("The property \"className\" requires a string"), typeof b > "u" && (d = "my-masonry-grid")), n.default.createElement("div", De({}, g, { className: d }), this.renderColumns());
|
|
723
727
|
}
|
|
724
728
|
};
|
|
725
729
|
Ge.defaultProps = Lt;
|
|
@@ -733,20 +737,20 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
733
737
|
} : null;
|
|
734
738
|
}
|
|
735
739
|
function rt({ items: t, getItemId: e, getRequestUrl: o, createController: a }) {
|
|
736
|
-
const [i, l] = (0, n.useState)({}),
|
|
737
|
-
const
|
|
738
|
-
if (
|
|
739
|
-
itemId:
|
|
740
|
-
requestUrl:
|
|
740
|
+
const [i, l] = (0, n.useState)({}), b = (0, n.useRef)(new Map()), g = (0, n.useCallback)((d) => {
|
|
741
|
+
const R = e(d), x = o(d), p = `${R}:${x}`;
|
|
742
|
+
if (b.current.has(p)) return {
|
|
743
|
+
itemId: R,
|
|
744
|
+
requestUrl: x,
|
|
741
745
|
cacheKey: p,
|
|
742
|
-
controller:
|
|
746
|
+
controller: b.current.get(p)
|
|
743
747
|
};
|
|
744
|
-
const
|
|
745
|
-
return
|
|
746
|
-
itemId:
|
|
747
|
-
requestUrl:
|
|
748
|
+
const w = a(x);
|
|
749
|
+
return b.current.set(p, w), {
|
|
750
|
+
itemId: R,
|
|
751
|
+
requestUrl: x,
|
|
748
752
|
cacheKey: p,
|
|
749
|
-
controller:
|
|
753
|
+
controller: w
|
|
750
754
|
};
|
|
751
755
|
}, [
|
|
752
756
|
a,
|
|
@@ -754,118 +758,118 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
754
758
|
o
|
|
755
759
|
]);
|
|
756
760
|
return (0, n.useEffect)(() => {
|
|
757
|
-
const
|
|
758
|
-
const { itemId:
|
|
759
|
-
|
|
760
|
-
const
|
|
761
|
-
return
|
|
762
|
-
const D = ze(
|
|
763
|
-
!D?.changed || !D.src || l((
|
|
764
|
-
...
|
|
765
|
-
[
|
|
761
|
+
const d = new Set(), R = {}, x = t.map((p) => {
|
|
762
|
+
const { itemId: w, cacheKey: j, controller: C } = g(p);
|
|
763
|
+
d.add(j), R[w] = C.src;
|
|
764
|
+
const U = ze(C.handleChangeSrc?.(), C.src);
|
|
765
|
+
return U?.changed && U.src && (R[w] = U.src), C.subscribeToSrcChange?.((y) => {
|
|
766
|
+
const D = ze(y, C.src);
|
|
767
|
+
!D?.changed || !D.src || l((O) => O[w] === D.src ? O : {
|
|
768
|
+
...O,
|
|
769
|
+
[w]: D.src
|
|
766
770
|
});
|
|
767
771
|
});
|
|
768
772
|
}).filter(Boolean);
|
|
769
|
-
return
|
|
770
|
-
|
|
771
|
-
}), l(
|
|
772
|
-
|
|
773
|
+
return b.current.forEach((p, w) => {
|
|
774
|
+
d.has(w) || b.current.delete(w);
|
|
775
|
+
}), l(R), () => {
|
|
776
|
+
x.forEach((p) => p?.());
|
|
773
777
|
};
|
|
774
778
|
}, [g, t]), {
|
|
775
|
-
getDisplaySrc: (0, n.useCallback)((
|
|
776
|
-
const { itemId:
|
|
777
|
-
return i[
|
|
779
|
+
getDisplaySrc: (0, n.useCallback)((d) => {
|
|
780
|
+
const { itemId: R, requestUrl: x, controller: p } = g(d);
|
|
781
|
+
return i[R] || p.src || x;
|
|
778
782
|
}, [i, g]),
|
|
779
|
-
handleLoad: (0, n.useCallback)((
|
|
780
|
-
g(
|
|
783
|
+
handleLoad: (0, n.useCallback)((d) => {
|
|
784
|
+
g(d).controller.handleSuccess();
|
|
781
785
|
}, [g]),
|
|
782
|
-
handleError: (0, n.useCallback)((
|
|
783
|
-
const { itemId:
|
|
784
|
-
p?.changed && p.src && l((
|
|
785
|
-
...
|
|
786
|
-
[
|
|
786
|
+
handleError: (0, n.useCallback)((d) => {
|
|
787
|
+
const { itemId: R, controller: x } = g(d), p = ze(x.handleError(), x.src);
|
|
788
|
+
p?.changed && p.src && l((w) => ({
|
|
789
|
+
...w,
|
|
790
|
+
[R]: p.src
|
|
787
791
|
}));
|
|
788
792
|
}, [g])
|
|
789
793
|
};
|
|
790
794
|
}
|
|
791
|
-
var st = "blocks", Dt = ({ setCurrentImageLink: t, setModalHeight: e, setModalWidth: o, setImageStockList: a, imageStockList: i, currentReq: l, setCurrentReq:
|
|
792
|
-
const
|
|
795
|
+
var st = "blocks", Dt = ({ setCurrentImageLink: t, setModalHeight: e, setModalWidth: o, setImageStockList: a, imageStockList: i, currentReq: l, setCurrentReq: b, inputRef: g, setStockLink: d, customRequest: R }) => {
|
|
796
|
+
const x = u.useAppConfig(), p = u.useIsStandalone(), [w, j] = (0, n.useState)(!1), [C, U] = (0, n.useState)(2), { __: y } = m.useI18n(), D = m.useNotification(), [O] = _.useLazyGetUnsplashImageQuery(), [T] = _.useLazyGetSearchImageQuery(), Q = (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 : y("Failed to load stock images through the configured proxy chain."), [y]), N = (0, n.useCallback)((s) => {
|
|
793
797
|
D.error({
|
|
794
798
|
id: "STOCK_IMAGES_SEARCH_FAILED",
|
|
795
|
-
title:
|
|
796
|
-
description:
|
|
799
|
+
title: y("Failed to load stock images"),
|
|
800
|
+
description: Q(s)
|
|
797
801
|
});
|
|
798
802
|
}, [
|
|
799
|
-
|
|
800
|
-
|
|
803
|
+
y,
|
|
804
|
+
Q,
|
|
801
805
|
D
|
|
802
806
|
]), M = async () => {
|
|
803
|
-
|
|
807
|
+
w || (j(!0), T({
|
|
804
808
|
query: l,
|
|
805
|
-
page:
|
|
809
|
+
page: C
|
|
806
810
|
}).then((s) => {
|
|
807
811
|
if (s?.error) {
|
|
808
|
-
|
|
812
|
+
N(s.error), j(!1);
|
|
809
813
|
return;
|
|
810
814
|
}
|
|
811
|
-
const
|
|
812
|
-
a((
|
|
815
|
+
const h = s?.data?.results || [];
|
|
816
|
+
a((W) => [...W, ...h]), j(!1), U((W) => W + 1);
|
|
813
817
|
}).catch(() => {
|
|
814
818
|
j(!1);
|
|
815
819
|
}));
|
|
816
820
|
};
|
|
817
821
|
(0, n.useEffect)(() => {
|
|
818
|
-
l.keywords !== "" &&
|
|
822
|
+
l.keywords !== "" && z();
|
|
819
823
|
}, [l.color, l.orientation]);
|
|
820
|
-
const
|
|
821
|
-
const s = await
|
|
824
|
+
const z = async () => {
|
|
825
|
+
const s = await T({
|
|
822
826
|
query: l,
|
|
823
827
|
page: 1
|
|
824
828
|
});
|
|
825
829
|
if (s?.error) {
|
|
826
|
-
|
|
830
|
+
N(s.error), a([]);
|
|
827
831
|
return;
|
|
828
832
|
}
|
|
829
|
-
const
|
|
830
|
-
|
|
833
|
+
const h = s?.data?.results || [];
|
|
834
|
+
h.length > 0 ? (a(h), setTimeout(() => {
|
|
831
835
|
o(1060), e("84vh");
|
|
832
836
|
}, 0)) : a([]);
|
|
833
|
-
}, [ee,
|
|
834
|
-
config:
|
|
837
|
+
}, [ee, K] = (0, n.useState)(null), k = (0, n.useCallback)((s, h, W) => `${s}${s.includes("?") ? "&" : "?"}w=${h}&q=${W}`, []), P = (0, n.useCallback)((s) => u.getProxiedUrl(s, {
|
|
838
|
+
config: x,
|
|
835
839
|
standalone: p,
|
|
836
840
|
resourceType: "stockImages",
|
|
837
841
|
intent: "display"
|
|
838
|
-
}), [
|
|
842
|
+
}), [x, p]), { getDisplaySrc: E, handleLoad: I, handleError: A } = rt({
|
|
839
843
|
items: i,
|
|
840
844
|
getItemId: (0, n.useCallback)((s) => s.id, []),
|
|
841
|
-
getRequestUrl: (0, n.useCallback)((s) =>
|
|
842
|
-
createController:
|
|
843
|
-
}),
|
|
844
|
-
|
|
845
|
+
getRequestUrl: (0, n.useCallback)((s) => k(s.urls.raw, 644, 96), [k]),
|
|
846
|
+
createController: P
|
|
847
|
+
}), L = (s) => (h) => {
|
|
848
|
+
I(s), h.target.parentNode.classList.add("loaded");
|
|
845
849
|
}, J = (s) => () => {
|
|
846
850
|
A(s);
|
|
847
|
-
}, q = (s,
|
|
848
|
-
|
|
851
|
+
}, q = (s, h, W) => {
|
|
852
|
+
O(h.download_location), K(W), setTimeout(() => K(null), 2e3), d(`${s.raw}&w=1200&q=96`), t(`${s.raw}&w=1200&q=96`), R(`${s.raw}&w=1200&q=96`);
|
|
849
853
|
};
|
|
850
854
|
return (0, r.jsxs)("div", {
|
|
851
855
|
className: "stock-tab",
|
|
852
|
-
children: [(0, r.jsxs)(
|
|
853
|
-
onValuesChange:
|
|
856
|
+
children: [(0, r.jsxs)(m.Form, {
|
|
857
|
+
onValuesChange: z,
|
|
854
858
|
className: i.length > 0 ? "serach-results" : "",
|
|
855
|
-
children: [(0, r.jsxs)(
|
|
859
|
+
children: [(0, r.jsxs)(m.Row, {
|
|
856
860
|
gutter: 24,
|
|
857
|
-
children: [(0, r.jsx)(
|
|
861
|
+
children: [(0, r.jsx)(m.Col, {
|
|
858
862
|
span: i.length > 0 ? "" : 24,
|
|
859
|
-
children: (0, r.jsx)(
|
|
863
|
+
children: (0, r.jsx)(m.Form.Item, {
|
|
860
864
|
className: "stock-search-input",
|
|
861
|
-
children: (0, r.jsx)(
|
|
862
|
-
onSearch:
|
|
865
|
+
children: (0, r.jsx)(m.SearchInput, {
|
|
866
|
+
onSearch: z,
|
|
863
867
|
allowClear: !0,
|
|
864
868
|
size: i.length > 0 ? "medium" : "large",
|
|
865
|
-
placeholder:
|
|
869
|
+
placeholder: y("Search image"),
|
|
866
870
|
value: l.keywords,
|
|
867
|
-
onChange: (s) =>
|
|
868
|
-
...
|
|
871
|
+
onChange: (s) => b((h) => ({
|
|
872
|
+
...h,
|
|
869
873
|
keywords: s.target.value
|
|
870
874
|
})),
|
|
871
875
|
ref: g,
|
|
@@ -873,107 +877,107 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
873
877
|
enterButton: !1
|
|
874
878
|
})
|
|
875
879
|
})
|
|
876
|
-
}), i.length > 0 && (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(
|
|
880
|
+
}), i.length > 0 && (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(m.Col, { children: (0, r.jsxs)(m.Radio.Group, {
|
|
877
881
|
defaultValue: "",
|
|
878
|
-
onChange: (s) =>
|
|
879
|
-
...
|
|
882
|
+
onChange: (s) => b((h) => ({
|
|
883
|
+
...h,
|
|
880
884
|
orientation: s.target.value
|
|
881
885
|
})),
|
|
882
886
|
children: [
|
|
883
|
-
(0, r.jsx)(
|
|
884
|
-
title:
|
|
887
|
+
(0, r.jsx)(m.Tooltip, {
|
|
888
|
+
title: y("All"),
|
|
885
889
|
placement: "top",
|
|
886
|
-
children: (0, r.jsx)(
|
|
890
|
+
children: (0, r.jsx)(m.Radio.Button, {
|
|
887
891
|
value: "",
|
|
888
|
-
children: (0, r.jsx)(
|
|
892
|
+
children: (0, r.jsx)(F.EmIcons, { icon: "MixedView" })
|
|
889
893
|
})
|
|
890
894
|
}),
|
|
891
|
-
(0, r.jsx)(
|
|
892
|
-
title:
|
|
895
|
+
(0, r.jsx)(m.Tooltip, {
|
|
896
|
+
title: y("Landscape"),
|
|
893
897
|
placement: "top",
|
|
894
|
-
children: (0, r.jsx)(
|
|
898
|
+
children: (0, r.jsx)(m.Radio.Button, {
|
|
895
899
|
value: "landscape",
|
|
896
|
-
children: (0, r.jsx)(
|
|
900
|
+
children: (0, r.jsx)(F.EmIcons, { icon: "LandscapeView" })
|
|
897
901
|
})
|
|
898
902
|
}),
|
|
899
|
-
(0, r.jsx)(
|
|
900
|
-
title:
|
|
903
|
+
(0, r.jsx)(m.Tooltip, {
|
|
904
|
+
title: y("Portrait"),
|
|
901
905
|
placement: "top",
|
|
902
|
-
children: (0, r.jsx)(
|
|
906
|
+
children: (0, r.jsx)(m.Radio.Button, {
|
|
903
907
|
value: "portrait",
|
|
904
|
-
children: (0, r.jsx)(
|
|
908
|
+
children: (0, r.jsx)(F.EmIcons, { icon: "PortraitView" })
|
|
905
909
|
})
|
|
906
910
|
}),
|
|
907
|
-
(0, r.jsx)(
|
|
908
|
-
title:
|
|
911
|
+
(0, r.jsx)(m.Tooltip, {
|
|
912
|
+
title: y("Squarish"),
|
|
909
913
|
placement: "top",
|
|
910
|
-
children: (0, r.jsx)(
|
|
914
|
+
children: (0, r.jsx)(m.Radio.Button, {
|
|
911
915
|
value: "squarish",
|
|
912
|
-
children: (0, r.jsx)(
|
|
916
|
+
children: (0, r.jsx)(F.EmIcons, { icon: "SquareView" })
|
|
913
917
|
})
|
|
914
918
|
})
|
|
915
919
|
]
|
|
916
|
-
}) }), (0, r.jsx)(
|
|
920
|
+
}) }), (0, r.jsx)(m.Col, { children: (0, r.jsx)(m.RadioColorFilter, {
|
|
917
921
|
defaultValue: "",
|
|
918
|
-
onChange: (s) =>
|
|
919
|
-
...
|
|
922
|
+
onChange: (s) => b((h) => ({
|
|
923
|
+
...h,
|
|
920
924
|
color: s.target.value
|
|
921
925
|
})),
|
|
922
926
|
options: [
|
|
923
927
|
{
|
|
924
928
|
value: "",
|
|
925
929
|
colorClass: "all-colors",
|
|
926
|
-
label:
|
|
930
|
+
label: y("All")
|
|
927
931
|
},
|
|
928
932
|
{
|
|
929
933
|
value: "black",
|
|
930
934
|
colorClass: "black-color",
|
|
931
|
-
label:
|
|
935
|
+
label: y("Black")
|
|
932
936
|
},
|
|
933
937
|
{
|
|
934
938
|
value: "black_and_white",
|
|
935
939
|
colorClass: "bw-color",
|
|
936
|
-
label:
|
|
940
|
+
label: y("Black and White")
|
|
937
941
|
},
|
|
938
942
|
{
|
|
939
943
|
value: "white",
|
|
940
944
|
colorClass: "white-color",
|
|
941
|
-
label:
|
|
945
|
+
label: y("White")
|
|
942
946
|
},
|
|
943
947
|
{
|
|
944
948
|
value: "orange",
|
|
945
949
|
colorClass: "orange-color",
|
|
946
|
-
label:
|
|
950
|
+
label: y("Orange")
|
|
947
951
|
},
|
|
948
952
|
{
|
|
949
953
|
value: "red",
|
|
950
954
|
colorClass: "red-color",
|
|
951
|
-
label:
|
|
955
|
+
label: y("Red")
|
|
952
956
|
},
|
|
953
957
|
{
|
|
954
958
|
value: "purple",
|
|
955
959
|
colorClass: "purple-color",
|
|
956
|
-
label:
|
|
960
|
+
label: y("Purple")
|
|
957
961
|
},
|
|
958
962
|
{
|
|
959
963
|
value: "magenta",
|
|
960
964
|
colorClass: "magenta-color",
|
|
961
|
-
label:
|
|
965
|
+
label: y("Magenta")
|
|
962
966
|
},
|
|
963
967
|
{
|
|
964
968
|
value: "green",
|
|
965
969
|
colorClass: "green-color",
|
|
966
|
-
label:
|
|
970
|
+
label: y("Green")
|
|
967
971
|
},
|
|
968
972
|
{
|
|
969
973
|
value: "teal",
|
|
970
974
|
colorClass: "teal-color",
|
|
971
|
-
label:
|
|
975
|
+
label: y("Teal")
|
|
972
976
|
},
|
|
973
977
|
{
|
|
974
978
|
value: "blue",
|
|
975
979
|
colorClass: "blue-color",
|
|
976
|
-
label:
|
|
980
|
+
label: y("Blue")
|
|
977
981
|
}
|
|
978
982
|
],
|
|
979
983
|
tooltipPlacement: "top"
|
|
@@ -1005,9 +1009,9 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
1005
1009
|
dataLength: i && i.length,
|
|
1006
1010
|
next: M,
|
|
1007
1011
|
hasMore: i,
|
|
1008
|
-
endMessage: (0, r.jsxs)(
|
|
1012
|
+
endMessage: (0, r.jsxs)(m.Divider, {
|
|
1009
1013
|
plain: !0,
|
|
1010
|
-
children: [
|
|
1014
|
+
children: [y("That`s all we could find."), " 🤐"]
|
|
1011
1015
|
}),
|
|
1012
1016
|
scrollableTarget: "scrollableDiv",
|
|
1013
1017
|
style: { overflow: "visible" },
|
|
@@ -1023,14 +1027,14 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
1023
1027
|
(0, r.jsx)("img", {
|
|
1024
1028
|
className: ee === s.id ? "loaded-image" : "",
|
|
1025
1029
|
width: "322px",
|
|
1026
|
-
src:
|
|
1030
|
+
src: E(s),
|
|
1027
1031
|
alt: s.description,
|
|
1028
|
-
onLoad:
|
|
1032
|
+
onLoad: L(s),
|
|
1029
1033
|
onError: J(s)
|
|
1030
1034
|
}),
|
|
1031
1035
|
(0, r.jsxs)("p", {
|
|
1032
1036
|
className: "creator-info",
|
|
1033
|
-
onClick: (
|
|
1037
|
+
onClick: (h) => h.stopPropagation(),
|
|
1034
1038
|
children: [
|
|
1035
1039
|
"Photo by",
|
|
1036
1040
|
" ",
|
|
@@ -1051,7 +1055,7 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
1051
1055
|
})
|
|
1052
1056
|
]
|
|
1053
1057
|
}),
|
|
1054
|
-
ee === s.id && (0, r.jsx)(
|
|
1058
|
+
ee === s.id && (0, r.jsx)(m.Spin, {
|
|
1055
1059
|
className: "ant-spin",
|
|
1056
1060
|
size: "small"
|
|
1057
1061
|
})
|
|
@@ -1079,10 +1083,10 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
1079
1083
|
src: i,
|
|
1080
1084
|
opacity: 0
|
|
1081
1085
|
}]), setTimeout(() => {
|
|
1082
|
-
a((l) => l.map((
|
|
1083
|
-
...
|
|
1086
|
+
a((l) => l.map((b, g) => g === l.length - 1 ? {
|
|
1087
|
+
...b,
|
|
1084
1088
|
opacity: 1
|
|
1085
|
-
} :
|
|
1089
|
+
} : b));
|
|
1086
1090
|
}, 1e3);
|
|
1087
1091
|
}
|
|
1088
1092
|
}, [t]), (0, r.jsx)("div", {
|
|
@@ -1098,28 +1102,28 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
1098
1102
|
}, l))
|
|
1099
1103
|
});
|
|
1100
1104
|
};
|
|
1101
|
-
function Mt({ setModalHeight: t, customRequest: e, aiTabRef: o, isImageUploaded: a, setIsImageUploaded: i, aiImageRequest: l, imageAiList:
|
|
1102
|
-
const { __:
|
|
1105
|
+
function Mt({ setModalHeight: t, customRequest: e, aiTabRef: o, isImageUploaded: a, setIsImageUploaded: i, aiImageRequest: l, imageAiList: b, setImageAiList: g, isLoadingAi: d, setIsLoadingAi: R, onPluginAiImageLimitExceeded: x, onImageGenerateLimitExceeded: p }) {
|
|
1106
|
+
const { __: w } = m.useI18n(), j = u.useAppConfig(), C = m.useNotification(), U = u.usePushToDataLayer(), { emailId: y, blockId: D, projectId: O } = (0, Ne.useParams)(), [T] = _.useLazySendAiImageRequestQuery(), [Q, { data: N = [] }] = _.useLazyGetAiImageSSEQuery(), [M] = _.useLazyGetLimitsStatsByTypeQuery(), z = j?.sendAIImageRequest || T, ee = j?.trigger || Q, K = j?.handleLimitUsageEmitter || u.useEventEmitter(u.events.ON_LIMIT_ID), [k, P] = (0, n.useState)(0), [E, I] = (0, n.useState)(null), [A, L] = (0, n.useState)(!1), [J, q] = (0, n.useState)(w("Evaluating the task")), [s, h] = (0, n.useState)(!1), W = y || D, { limits: ce } = j?.limits ? j : { limits: { ai_img_limit: 0 } }, { ai_img_limit: Z } = ce, $ = !!(j.limits && j.counters) && u.PLUGIN.isPlugin, X = u.useEventEmitter(u.events.AI_IMAGE_REQUEST_ID).hasListeners(), H = ne.shouldCountAiUsage({
|
|
1103
1107
|
limitsInPlugin: $,
|
|
1104
1108
|
hostedAiActive: X
|
|
1105
|
-
}), ie = !X && Z > 0 &&
|
|
1106
|
-
|
|
1109
|
+
}), ie = !X && Z > 0 && k >= Z, he = (0, n.useCallback)(() => {
|
|
1110
|
+
K.fire({
|
|
1107
1111
|
name: "AiImgCount",
|
|
1108
|
-
count:
|
|
1112
|
+
count: k + 1
|
|
1109
1113
|
});
|
|
1110
|
-
}, [
|
|
1114
|
+
}, [K, k]), ye = (0, n.useMemo)(() => !ie && (!H || Z === 0 || k < Z), [
|
|
1111
1115
|
ie,
|
|
1112
|
-
|
|
1113
|
-
|
|
1116
|
+
H,
|
|
1117
|
+
k,
|
|
1114
1118
|
Z
|
|
1115
1119
|
]), ue = (0, n.useCallback)(async () => {
|
|
1116
|
-
q(
|
|
1120
|
+
q(w("Evaluating the task")), l !== "" && !d && (R(!0), h(!0), g([]), U({
|
|
1117
1121
|
event: "submit_form",
|
|
1118
1122
|
action: "ai_image_generation",
|
|
1119
|
-
entity_id:
|
|
1120
|
-
project_id:
|
|
1121
|
-
}),
|
|
1122
|
-
project_id:
|
|
1123
|
+
entity_id: y,
|
|
1124
|
+
project_id: O
|
|
1125
|
+
}), z({ body: {
|
|
1126
|
+
project_id: O,
|
|
1123
1127
|
request: "create-image",
|
|
1124
1128
|
connection: "midjourney",
|
|
1125
1129
|
message: l
|
|
@@ -1127,54 +1131,54 @@ __useblocks__.define("static/core/59023866.js", [
|
|
|
1127
1131
|
if (te) throw te;
|
|
1128
1132
|
if (v.data.status === 401) throw new Error(u.ERROR);
|
|
1129
1133
|
if (v?.data?._eventResult) {
|
|
1130
|
-
g(v.data.task.images),
|
|
1134
|
+
g(v.data.task.images), R(!1), h(!1), q(w("Evaluating the task"));
|
|
1131
1135
|
return;
|
|
1132
1136
|
}
|
|
1133
|
-
v?.data.status === 200 ? (v?.data.task.id && (q(v.data.task.message),
|
|
1137
|
+
v?.data.status === 200 ? (v?.data.task.id && (q(v.data.task.message), I(v.data.task.id)), v.message && C.success({
|
|
1134
1138
|
id: "AI_IMAGE_SEND_SUCCESS",
|
|
1135
1139
|
title: v.message,
|
|
1136
1140
|
placement: "bottomRight",
|
|
1137
1141
|
data: l
|
|
1138
1142
|
}), ee({
|
|
1139
1143
|
task_id: v?.data.task.id,
|
|
1140
|
-
entity_id:
|
|
1141
|
-
})) : (
|
|
1144
|
+
entity_id: W
|
|
1145
|
+
})) : (R(!1), h(!1), C.error({
|
|
1142
1146
|
id: "AI_IMAGE_SEND_ERROR",
|
|
1143
|
-
title: v?.message ||
|
|
1147
|
+
title: v?.message || w("Something went wrong, please try again"),
|
|
1144
1148
|
placement: "bottomRight",
|
|
1145
1149
|
data: l,
|
|
1146
1150
|
innerException: v
|
|
1147
1151
|
}));
|
|
1148
1152
|
}).catch((v) => {
|
|
1149
|
-
|
|
1153
|
+
R(!1), h(!1), (v?.error || v?.data) && C.fromError("AI_IMAGE_SEND_ERROR", l, v.error || v);
|
|
1150
1154
|
}));
|
|
1151
1155
|
}, [
|
|
1152
1156
|
l,
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
y,
|
|
1156
|
-
g,
|
|
1157
|
-
L,
|
|
1157
|
+
d,
|
|
1158
|
+
R,
|
|
1158
1159
|
h,
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1160
|
+
g,
|
|
1161
|
+
U,
|
|
1162
|
+
y,
|
|
1163
|
+
O,
|
|
1164
|
+
z,
|
|
1165
|
+
C,
|
|
1162
1166
|
ee,
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
]),
|
|
1167
|
+
W,
|
|
1168
|
+
w
|
|
1169
|
+
]), Y = (0, n.useCallback)(async () => {
|
|
1166
1170
|
if (ye) {
|
|
1167
1171
|
if (!u.PLUGIN.isPlugin && !X) {
|
|
1168
|
-
const v =
|
|
1172
|
+
const v = F.resolveLimitActionPreflightExceededForType("image_generate", (await M("image_generate")).data?.stats);
|
|
1169
1173
|
if (v) {
|
|
1170
1174
|
p?.(v);
|
|
1171
1175
|
return;
|
|
1172
1176
|
}
|
|
1173
1177
|
}
|
|
1174
|
-
|
|
1175
|
-
} else $ && (
|
|
1176
|
-
title:
|
|
1177
|
-
description:
|
|
1178
|
+
H && (P((v) => v + 1), he()), ue();
|
|
1179
|
+
} else $ && (x ? x() : C.error({
|
|
1180
|
+
title: w("The usage limit has been exceeded"),
|
|
1181
|
+
description: w(`The maximum number of requests for the current subscription period has been reached.
|
|
1178
1182
|
Select the appropriate plan to fulfil more requests`),
|
|
1179
1183
|
placement: "bottomRight"
|
|
1180
1184
|
}));
|
|
@@ -1182,23 +1186,23 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1182
1186
|
ye,
|
|
1183
1187
|
$,
|
|
1184
1188
|
X,
|
|
1185
|
-
|
|
1189
|
+
H,
|
|
1186
1190
|
M,
|
|
1187
1191
|
p,
|
|
1188
|
-
|
|
1192
|
+
P,
|
|
1189
1193
|
he,
|
|
1190
1194
|
ue,
|
|
1195
|
+
C,
|
|
1191
1196
|
w,
|
|
1192
|
-
|
|
1193
|
-
R
|
|
1197
|
+
x
|
|
1194
1198
|
]);
|
|
1195
1199
|
(0, n.useEffect)(() => {
|
|
1196
|
-
$ &&
|
|
1200
|
+
$ && P(j?.counters?.ai_img_counter || 0);
|
|
1197
1201
|
}, [j, $]);
|
|
1198
1202
|
const se = u.useEventEmitter(u.events.AI_IMAGE_PROGRESS_ID);
|
|
1199
1203
|
(0, n.useEffect)(() => {
|
|
1200
|
-
const v = se.event(({ progress: te, status:
|
|
1201
|
-
q(
|
|
1204
|
+
const v = se.event(({ progress: te, status: G }) => {
|
|
1205
|
+
q(G || `${Math.round(te)}%`);
|
|
1202
1206
|
});
|
|
1203
1207
|
return () => v.dispose();
|
|
1204
1208
|
}, [se]);
|
|
@@ -1217,168 +1221,168 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1217
1221
|
i,
|
|
1218
1222
|
e
|
|
1219
1223
|
]), ae = (0, n.useCallback)((v) => {
|
|
1220
|
-
v.status !== "error" && v.status !== "Canceled" ? v.images ? (q(v.status), v.progress === 100 && (g(v.images), q(
|
|
1224
|
+
v.status !== "error" && v.status !== "Canceled" ? v.images ? (q(v.status), v.progress === 100 && (g(v.images), q(w("Evaluating the task")), I(null), h(!1))) : (g([v.data]), R(!1)) : (R(!1), h(!1), C.error({
|
|
1221
1225
|
id: "AI_IMAGE_GET_ERROR",
|
|
1222
|
-
title:
|
|
1226
|
+
title: w("Something went wrong, please try again"),
|
|
1223
1227
|
placement: "bottomRight",
|
|
1224
|
-
data:
|
|
1228
|
+
data: E
|
|
1225
1229
|
}));
|
|
1226
1230
|
}, [
|
|
1227
1231
|
g,
|
|
1228
1232
|
q,
|
|
1229
|
-
b,
|
|
1230
|
-
x,
|
|
1231
|
-
t,
|
|
1232
|
-
I,
|
|
1233
1233
|
w,
|
|
1234
|
-
|
|
1234
|
+
R,
|
|
1235
|
+
t,
|
|
1236
|
+
E,
|
|
1237
|
+
C,
|
|
1238
|
+
h
|
|
1235
1239
|
]);
|
|
1236
1240
|
return (0, n.useEffect)(() => {
|
|
1237
|
-
|
|
1238
|
-
}, [
|
|
1239
|
-
(
|
|
1241
|
+
N.length > 1 && ae(N[N.length - 1]);
|
|
1242
|
+
}, [N, ae]), (0, n.useEffect)(() => {
|
|
1243
|
+
(d || b.length > 0) && setTimeout(() => {
|
|
1240
1244
|
let v = 550;
|
|
1241
1245
|
o.current && (v = o.current.offsetHeight + 68), t(v);
|
|
1242
1246
|
}, 0);
|
|
1243
1247
|
}, [
|
|
1244
1248
|
o,
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1249
|
+
N,
|
|
1250
|
+
b.length,
|
|
1251
|
+
d,
|
|
1248
1252
|
t
|
|
1249
1253
|
]), {
|
|
1250
|
-
aiImageCounter:
|
|
1251
|
-
setAiImageCounter:
|
|
1254
|
+
aiImageCounter: k,
|
|
1255
|
+
setAiImageCounter: P,
|
|
1252
1256
|
currentAiImgLimits: Z,
|
|
1253
1257
|
isFieldsDisabled: ie,
|
|
1254
1258
|
canGenerateImage: ye,
|
|
1255
1259
|
aiImageRequest: l,
|
|
1256
|
-
imageAiList:
|
|
1260
|
+
imageAiList: b,
|
|
1257
1261
|
setImageAiList: g,
|
|
1258
|
-
isLoadingAi:
|
|
1259
|
-
setIsLoadingAi:
|
|
1262
|
+
isLoadingAi: d,
|
|
1263
|
+
setIsLoadingAi: R,
|
|
1260
1264
|
loadingDuringGeneration: s,
|
|
1261
|
-
setLoadingDuringGeneration:
|
|
1265
|
+
setLoadingDuringGeneration: h,
|
|
1262
1266
|
requestStatus: J,
|
|
1263
1267
|
setRequestStatus: q,
|
|
1264
|
-
handleGenerate:
|
|
1268
|
+
handleGenerate: Y,
|
|
1265
1269
|
handleLimitAiImgCount: he,
|
|
1266
1270
|
convertBase64ToFile: B,
|
|
1267
1271
|
isShiftPressed: A,
|
|
1268
|
-
setIsShiftPressed:
|
|
1269
|
-
currentReqId:
|
|
1270
|
-
setCurrentReqId:
|
|
1272
|
+
setIsShiftPressed: L,
|
|
1273
|
+
currentReqId: E,
|
|
1274
|
+
setCurrentReqId: I,
|
|
1271
1275
|
limitsInPlugin: $
|
|
1272
1276
|
};
|
|
1273
1277
|
}
|
|
1274
|
-
var Pt = ({ setModalHeight: t, customRequest: e, aiTabRef: o, inputAiRef: a, isImageUploaded: i, setIsImageUploaded: l, aiImageRequest:
|
|
1275
|
-
const
|
|
1278
|
+
var Pt = ({ setModalHeight: t, customRequest: e, aiTabRef: o, inputAiRef: a, isImageUploaded: i, setIsImageUploaded: l, aiImageRequest: b, setAiImageRequest: g, imageAiList: d, setImageAiList: R, isLoadingAi: x, setIsLoadingAi: p }) => {
|
|
1279
|
+
const w = (0, Ne.useNavigate)(), j = u.useDispatch(), { __: C, _n: U } = m.useI18n(), y = u.useAppConfig(), [D, O] = (0, n.useState)(!1), [T, Q] = (0, n.useState)(null), { aiImageCounter: N, currentAiImgLimits: M, loadingDuringGeneration: z, requestStatus: ee, handleGenerate: K, convertBase64ToFile: k, isShiftPressed: P, setIsShiftPressed: E, limitsInPlugin: I } = Mt({
|
|
1276
1280
|
setModalHeight: t,
|
|
1277
1281
|
customRequest: e,
|
|
1278
1282
|
aiTabRef: o,
|
|
1279
1283
|
isImageUploaded: i,
|
|
1280
1284
|
setIsImageUploaded: l,
|
|
1281
|
-
aiImageRequest:
|
|
1282
|
-
imageAiList:
|
|
1283
|
-
setImageAiList:
|
|
1284
|
-
isLoadingAi:
|
|
1285
|
+
aiImageRequest: b,
|
|
1286
|
+
imageAiList: d,
|
|
1287
|
+
setImageAiList: R,
|
|
1288
|
+
isLoadingAi: x,
|
|
1285
1289
|
setIsLoadingAi: p,
|
|
1286
|
-
onPluginAiImageLimitExceeded: () =>
|
|
1287
|
-
onImageGenerateLimitExceeded:
|
|
1288
|
-
}), A = D && M > 0 ?
|
|
1289
|
-
|
|
1290
|
+
onPluginAiImageLimitExceeded: () => O(!0),
|
|
1291
|
+
onImageGenerateLimitExceeded: Q
|
|
1292
|
+
}), A = D && M > 0 ? ne.getAiTariffUpgradeStep(M) : null, L = A ? F.getLimitUpgradePresetDefinition(A.presetId) : null, J = T ? F.getLimitUpgradePresetDefinition(T.presetId) : null, [q, s] = (0, n.useState)(!1), h = (0, n.useCallback)(() => s(!0), []), W = (0, n.useCallback)(() => s(!1), []), ce = (0, n.useCallback)((H) => g(H.target.value), [g]), Z = (0, n.useCallback)((H) => {
|
|
1293
|
+
H.key === "Shift" ? E(!0) : H.key === "Enter" && !P && (H.preventDefault(), K());
|
|
1290
1294
|
}, [
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
]), $ = (0, n.useCallback)((
|
|
1295
|
-
|
|
1296
|
-
}, [
|
|
1295
|
+
P,
|
|
1296
|
+
K,
|
|
1297
|
+
E
|
|
1298
|
+
]), $ = (0, n.useCallback)((H) => {
|
|
1299
|
+
H.key === "Shift" && E(!1);
|
|
1300
|
+
}, [E]), X = d[d.length - 1];
|
|
1297
1301
|
return (0, r.jsxs)("div", {
|
|
1298
1302
|
className: "image-ai",
|
|
1299
1303
|
children: [
|
|
1300
|
-
|
|
1304
|
+
L && A ? (0, r.jsx)(F.LimitUpgradeModal, {
|
|
1301
1305
|
open: !0,
|
|
1302
|
-
onClose: () =>
|
|
1303
|
-
title:
|
|
1304
|
-
subtitle:
|
|
1305
|
-
usageResource:
|
|
1306
|
-
previousDisplay:
|
|
1307
|
-
nextDisplay:
|
|
1306
|
+
onClose: () => O(!1),
|
|
1307
|
+
title: C(L.titleKey),
|
|
1308
|
+
subtitle: C(L.subtitleKey),
|
|
1309
|
+
usageResource: L.usageResource,
|
|
1310
|
+
previousDisplay: F.presetLimitDisplay(A.previousLimit),
|
|
1311
|
+
nextDisplay: F.presetLimitDisplay(A.nextLimit),
|
|
1308
1312
|
onChangePlan: () => {
|
|
1309
|
-
|
|
1313
|
+
O(!1), document.body.classList.remove("editor"), w("/billing"), j(_.openModal(u.MODALS.SWITCH_TO_PLAN_MODAL));
|
|
1310
1314
|
}
|
|
1311
1315
|
}) : null,
|
|
1312
|
-
J &&
|
|
1316
|
+
J && T ? (0, r.jsx)(F.LimitUpgradeModal, {
|
|
1313
1317
|
open: !0,
|
|
1314
|
-
onClose: () =>
|
|
1315
|
-
title:
|
|
1316
|
-
subtitle:
|
|
1318
|
+
onClose: () => Q(null),
|
|
1319
|
+
title: C(J.titleKey),
|
|
1320
|
+
subtitle: C(J.subtitleKey),
|
|
1317
1321
|
usageResource: J.usageResource,
|
|
1318
|
-
previousDisplay:
|
|
1319
|
-
nextDisplay:
|
|
1322
|
+
previousDisplay: F.presetLimitDisplay(T.previousLimit),
|
|
1323
|
+
nextDisplay: F.presetLimitDisplay(T.nextLimit),
|
|
1320
1324
|
onChangePlan: () => {
|
|
1321
|
-
|
|
1325
|
+
Q(null), document.body.classList.remove("editor"), w("/billing"), j(_.openModal(u.MODALS.SWITCH_TO_PLAN_MODAL));
|
|
1322
1326
|
}
|
|
1323
1327
|
}) : null,
|
|
1324
|
-
|
|
1325
|
-
text: `${
|
|
1326
|
-
exceeded: M > 0 &&
|
|
1328
|
+
I && (0, r.jsx)(m.LimitsCounter, {
|
|
1329
|
+
text: `${N} ${C("of")} ${M > 0 ? M : "∞"} images ${U("was used", "were used", N)}`,
|
|
1330
|
+
exceeded: M > 0 && N >= M,
|
|
1327
1331
|
style: { marginTop: -25 },
|
|
1328
1332
|
extra: (0, r.jsx)("span", {
|
|
1329
1333
|
style: {
|
|
1330
1334
|
textDecoration: "underline",
|
|
1331
1335
|
cursor: "pointer"
|
|
1332
1336
|
},
|
|
1333
|
-
onClick: () =>
|
|
1334
|
-
children:
|
|
1337
|
+
onClick: () => w(y.billingPageUrl || u.APP_ROUTES.billing),
|
|
1338
|
+
children: C("Need more?")
|
|
1335
1339
|
})
|
|
1336
1340
|
}),
|
|
1337
|
-
(0, r.jsx)(
|
|
1341
|
+
(0, r.jsx)(m.Row, {
|
|
1338
1342
|
gutter: 24,
|
|
1339
1343
|
className: "image-ai__row",
|
|
1340
|
-
children: (0, r.jsx)(
|
|
1344
|
+
children: (0, r.jsx)(m.Col, {
|
|
1341
1345
|
span: 24,
|
|
1342
|
-
children: (0, r.jsx)(
|
|
1346
|
+
children: (0, r.jsx)(m.Form.Item, {
|
|
1343
1347
|
style: { margin: 0 },
|
|
1344
1348
|
children: (0, r.jsxs)("span", {
|
|
1345
1349
|
className: `ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${q ? " ant-input-affix-wrapper-focused" : ""}`,
|
|
1346
|
-
children: [(0, r.jsx)(
|
|
1350
|
+
children: [(0, r.jsx)(m.TextArea, {
|
|
1347
1351
|
ref: a,
|
|
1348
1352
|
onKeyDown: Z,
|
|
1349
1353
|
onKeyUp: $,
|
|
1350
|
-
onFocus:
|
|
1351
|
-
onBlur:
|
|
1354
|
+
onFocus: h,
|
|
1355
|
+
onBlur: W,
|
|
1352
1356
|
autoSize: !0,
|
|
1353
1357
|
allowClear: !0,
|
|
1354
1358
|
className: "text-area-input-hybrid image-ai__textarea",
|
|
1355
|
-
placeholder:
|
|
1356
|
-
value:
|
|
1359
|
+
placeholder: C("Generate image"),
|
|
1360
|
+
value: b,
|
|
1357
1361
|
onChange: ce,
|
|
1358
1362
|
spellCheck: "false"
|
|
1359
1363
|
}), (0, r.jsx)("span", {
|
|
1360
1364
|
className: "ant-input-suffix image-ai__input-suffix",
|
|
1361
|
-
children:
|
|
1365
|
+
children: x || z ? (0, r.jsx)(F.EmIcons, {
|
|
1362
1366
|
icon: "LoadingOutlined",
|
|
1363
1367
|
className: "input-icon image-ai__input-icon",
|
|
1364
1368
|
spin: !0
|
|
1365
|
-
}) : (0, r.jsx)(
|
|
1369
|
+
}) : (0, r.jsx)(F.EmIcons, {
|
|
1366
1370
|
icon: "AI",
|
|
1367
1371
|
className: "input-icon image-ai__input-icon",
|
|
1368
|
-
onClick:
|
|
1372
|
+
onClick: K
|
|
1369
1373
|
})
|
|
1370
1374
|
})]
|
|
1371
1375
|
})
|
|
1372
1376
|
})
|
|
1373
1377
|
})
|
|
1374
1378
|
}),
|
|
1375
|
-
(
|
|
1379
|
+
(x || d.length > 0) && (0, r.jsxs)("div", {
|
|
1376
1380
|
className: "image-ai__preview",
|
|
1377
|
-
children: [
|
|
1381
|
+
children: [x && d.length === 0 && (0, r.jsx)("div", {
|
|
1378
1382
|
className: "image-ai__loading",
|
|
1379
1383
|
children: (0, r.jsxs)("div", {
|
|
1380
1384
|
className: "spin",
|
|
1381
|
-
children: [(0, r.jsx)(
|
|
1385
|
+
children: [(0, r.jsx)(F.EmIcons, {
|
|
1382
1386
|
icon: "LoadingOutlined",
|
|
1383
1387
|
style: { fontSize: 48 },
|
|
1384
1388
|
spin: !0
|
|
@@ -1387,23 +1391,23 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1387
1391
|
children: ee
|
|
1388
1392
|
})]
|
|
1389
1393
|
})
|
|
1390
|
-
}),
|
|
1394
|
+
}), d.length > 0 && (0, r.jsxs)("div", {
|
|
1391
1395
|
className: "image-ai__image-item",
|
|
1392
|
-
children: [(0, r.jsx)(Ut, { images:
|
|
1396
|
+
children: [(0, r.jsx)(Ut, { images: d }), (0, r.jsx)("div", {
|
|
1393
1397
|
className: "buttons",
|
|
1394
|
-
children: (0, r.jsx)(
|
|
1395
|
-
onClick: () =>
|
|
1396
|
-
icon: (0, r.jsx)(
|
|
1397
|
-
children:
|
|
1398
|
+
children: (0, r.jsx)(m.Button, {
|
|
1399
|
+
onClick: () => k(X),
|
|
1400
|
+
icon: (0, r.jsx)(F.EmIcons, { icon: "CheckOutlined" }),
|
|
1401
|
+
children: C("Use this one")
|
|
1398
1402
|
})
|
|
1399
1403
|
})]
|
|
1400
1404
|
})]
|
|
1401
1405
|
})
|
|
1402
1406
|
]
|
|
1403
1407
|
});
|
|
1404
|
-
}, Tt = ({ setNewLink: t, setCurrentImageLink: e, setModalHeight: o, setModalWidth: a, setImageGifList: i, imageGifList: l, currentReqGif:
|
|
1405
|
-
const { __: p } =
|
|
1406
|
-
|
|
1408
|
+
}, Tt = ({ setNewLink: t, setCurrentImageLink: e, setModalHeight: o, setModalWidth: a, setImageGifList: i, imageGifList: l, currentReqGif: b, setCurrentReqGif: g, inputRef: d, setStockLink: R, customRequest: x }) => {
|
|
1409
|
+
const { __: p } = m.useI18n(), w = u.useAppConfig(), j = u.useIsStandalone(), C = m.useNotification(), [U, y] = (0, n.useState)(null), [D, O] = (0, n.useState)(!1), [T, Q] = (0, n.useState)(25), [N] = _.useLazyGetSearchGifQuery(), M = (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 : p("Failed to load GIFs through the configured proxy chain."), [p]), z = (0, n.useCallback)((s) => {
|
|
1410
|
+
C.error({
|
|
1407
1411
|
id: "STOCK_GIFS_SEARCH_FAILED",
|
|
1408
1412
|
title: p("Failed to load GIFs"),
|
|
1409
1413
|
description: M(s)
|
|
@@ -1411,73 +1415,73 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1411
1415
|
}, [
|
|
1412
1416
|
p,
|
|
1413
1417
|
M,
|
|
1414
|
-
|
|
1418
|
+
C
|
|
1415
1419
|
]), ee = async () => {
|
|
1416
|
-
D || (
|
|
1417
|
-
query:
|
|
1418
|
-
page:
|
|
1420
|
+
D || (O(!0), N({
|
|
1421
|
+
query: b,
|
|
1422
|
+
page: T
|
|
1419
1423
|
}).then((s) => {
|
|
1420
1424
|
if (s?.error) {
|
|
1421
|
-
|
|
1425
|
+
z(s.error), O(!1);
|
|
1422
1426
|
return;
|
|
1423
1427
|
}
|
|
1424
|
-
i((
|
|
1428
|
+
i((h) => [...h, ...s.data.data]), O(!1), Q((h) => h + 25);
|
|
1425
1429
|
}).catch(() => {
|
|
1426
|
-
|
|
1430
|
+
O(!1);
|
|
1427
1431
|
}));
|
|
1428
|
-
},
|
|
1429
|
-
const s = await
|
|
1430
|
-
query:
|
|
1432
|
+
}, K = async () => {
|
|
1433
|
+
const s = await N({
|
|
1434
|
+
query: b,
|
|
1431
1435
|
page: 0
|
|
1432
1436
|
});
|
|
1433
1437
|
if (s?.error) {
|
|
1434
|
-
|
|
1438
|
+
z(s.error), i([]);
|
|
1435
1439
|
return;
|
|
1436
1440
|
}
|
|
1437
1441
|
s?.data?.data?.length > 0 && (i(s.data.data), setTimeout(() => {
|
|
1438
1442
|
o("84vh"), a(1060);
|
|
1439
1443
|
}, 0));
|
|
1440
|
-
},
|
|
1441
|
-
h
|
|
1442
|
-
|
|
1443
|
-
}, 2e3),
|
|
1444
|
-
},
|
|
1445
|
-
config:
|
|
1444
|
+
}, k = (s, h) => {
|
|
1445
|
+
y(h), setTimeout(() => {
|
|
1446
|
+
y(null);
|
|
1447
|
+
}, 2e3), R(`${s}`), e(`${s}`), x(`${s}`);
|
|
1448
|
+
}, P = { default: 3 }, E = (0, n.useCallback)((s) => u.getProxiedUrl(s, {
|
|
1449
|
+
config: w,
|
|
1446
1450
|
standalone: j,
|
|
1447
1451
|
resourceType: "generic",
|
|
1448
1452
|
intent: "display"
|
|
1449
|
-
}), [
|
|
1453
|
+
}), [w, j]), { getDisplaySrc: I, handleLoad: A, handleError: L } = rt({
|
|
1450
1454
|
items: l,
|
|
1451
1455
|
getItemId: (0, n.useCallback)((s) => s.id, []),
|
|
1452
1456
|
getRequestUrl: (0, n.useCallback)((s) => s.images.downsized.url, []),
|
|
1453
|
-
createController:
|
|
1454
|
-
}), J = (s) => (
|
|
1455
|
-
A(s),
|
|
1457
|
+
createController: E
|
|
1458
|
+
}), J = (s) => (h) => {
|
|
1459
|
+
A(s), h.target.parentNode.classList.add("loaded");
|
|
1456
1460
|
}, q = (s) => () => {
|
|
1457
|
-
|
|
1461
|
+
L(s);
|
|
1458
1462
|
};
|
|
1459
1463
|
return (0, r.jsxs)("div", {
|
|
1460
1464
|
className: "stock-tab",
|
|
1461
|
-
children: [(0, r.jsxs)(
|
|
1462
|
-
onValuesChange:
|
|
1465
|
+
children: [(0, r.jsxs)(m.Form, {
|
|
1466
|
+
onValuesChange: K,
|
|
1463
1467
|
className: l.length > 0 ? "serach-results" : "",
|
|
1464
|
-
children: [(0, r.jsx)(
|
|
1468
|
+
children: [(0, r.jsx)(m.Row, {
|
|
1465
1469
|
gutter: 24,
|
|
1466
|
-
children: (0, r.jsx)(
|
|
1470
|
+
children: (0, r.jsx)(m.Col, {
|
|
1467
1471
|
span: l.length > 0 ? "" : 24,
|
|
1468
|
-
children: (0, r.jsx)(
|
|
1472
|
+
children: (0, r.jsx)(m.Form.Item, {
|
|
1469
1473
|
className: "stock-search-input",
|
|
1470
|
-
children: (0, r.jsx)(
|
|
1471
|
-
onSearch:
|
|
1474
|
+
children: (0, r.jsx)(m.SearchInput, {
|
|
1475
|
+
onSearch: K,
|
|
1472
1476
|
allowClear: !0,
|
|
1473
1477
|
size: l.length > 0 ? "medium" : "large",
|
|
1474
1478
|
placeholder: p("Search GIFs"),
|
|
1475
|
-
value:
|
|
1476
|
-
onChange: (s) => g((
|
|
1477
|
-
...
|
|
1479
|
+
value: b.keywords,
|
|
1480
|
+
onChange: (s) => g((h) => ({
|
|
1481
|
+
...h,
|
|
1478
1482
|
keywords: s.target.value
|
|
1479
1483
|
})),
|
|
1480
|
-
ref:
|
|
1484
|
+
ref: d,
|
|
1481
1485
|
spellCheck: "false",
|
|
1482
1486
|
enterButton: !1
|
|
1483
1487
|
})
|
|
@@ -1510,25 +1514,25 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1510
1514
|
dataLength: l && l.length,
|
|
1511
1515
|
next: ee,
|
|
1512
1516
|
hasMore: l,
|
|
1513
|
-
endMessage: (0, r.jsxs)(
|
|
1517
|
+
endMessage: (0, r.jsxs)(m.Divider, {
|
|
1514
1518
|
plain: !0,
|
|
1515
1519
|
children: [p("That`s all we could find."), " 🤐"]
|
|
1516
1520
|
}),
|
|
1517
1521
|
scrollableTarget: "scrollableDiv",
|
|
1518
1522
|
style: { overflow: "visible" },
|
|
1519
|
-
loader: (0, r.jsx)(
|
|
1523
|
+
loader: (0, r.jsx)(m.Spin, { size: "small" }),
|
|
1520
1524
|
children: (0, r.jsx)(Ge, {
|
|
1521
|
-
breakpointCols:
|
|
1525
|
+
breakpointCols: P,
|
|
1522
1526
|
className: "my-masonry-grid",
|
|
1523
1527
|
columnClassName: "my-masonry-grid_column",
|
|
1524
|
-
children: l.map((s,
|
|
1528
|
+
children: l.map((s, h) => (0, r.jsxs)("div", {
|
|
1525
1529
|
className: "list-item",
|
|
1526
|
-
onClick: () =>
|
|
1530
|
+
onClick: () => k(s.images.downsized.url, s.id),
|
|
1527
1531
|
children: [
|
|
1528
1532
|
(0, r.jsx)("img", {
|
|
1529
|
-
className:
|
|
1533
|
+
className: U === s.id ? "loaded-image" : "",
|
|
1530
1534
|
width: "322px",
|
|
1531
|
-
src:
|
|
1535
|
+
src: I(s),
|
|
1532
1536
|
alt: s.title,
|
|
1533
1537
|
onLoad: J(s),
|
|
1534
1538
|
onError: q(s)
|
|
@@ -1537,18 +1541,18 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1537
1541
|
rel: "noreferrer",
|
|
1538
1542
|
href: "https://giphy.com/",
|
|
1539
1543
|
target: "_blank",
|
|
1540
|
-
onClick: (
|
|
1544
|
+
onClick: (W) => W.stopPropagation(),
|
|
1541
1545
|
children: (0, r.jsx)("div", {
|
|
1542
1546
|
className: "overlay-image",
|
|
1543
1547
|
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=)" }
|
|
1544
1548
|
})
|
|
1545
1549
|
}),
|
|
1546
|
-
|
|
1550
|
+
U === s.id && (0, r.jsx)(m.Spin, {
|
|
1547
1551
|
className: "ant-spin",
|
|
1548
1552
|
size: "small"
|
|
1549
1553
|
})
|
|
1550
1554
|
]
|
|
1551
|
-
}, s.id +
|
|
1555
|
+
}, s.id + h))
|
|
1552
1556
|
})
|
|
1553
1557
|
})
|
|
1554
1558
|
})
|
|
@@ -1627,79 +1631,79 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1627
1631
|
url: l
|
|
1628
1632
|
} : void 0;
|
|
1629
1633
|
}
|
|
1630
|
-
var ot = "IMG", it = "BACKGROUND", Wt = "GALLERY",
|
|
1631
|
-
const o =
|
|
1634
|
+
var ot = "IMG", it = "BACKGROUND", Wt = "GALLERY", Ae = "EDITOR", pe = "UPLOAD", Ke = "STOCK", We = "GIF", He = "AI", Ht = { mode: "select" }, Vt = { mode: "save" }, { Dragger: Qt } = m.Upload, qt = (t, e = "image") => _.decodeFileNameFromUrl(t) ?? e, ke = ne.normalizeImageFormatForDisplay, Yt = (t, e) => {
|
|
1635
|
+
const o = ke(e);
|
|
1632
1636
|
return !o || t.includes(".") ? t : `${t}.${o}`;
|
|
1633
|
-
},
|
|
1634
|
-
const e = u.useAppConfig(), o = u.useIsStandalone(), { __: a } =
|
|
1637
|
+
}, _t = (t, e) => new File([t], Yt(qt(e), t.type), { type: t.type || "application/octet-stream" }), lt = ({ dataProvider: t }) => {
|
|
1638
|
+
const e = u.useAppConfig(), o = u.useIsStandalone(), { __: a } = m.useI18n(), i = u.useDispatch(), { projectId: l } = (0, Ne.useParams)(), [b] = _.useLazyGetImageInfoQuery(), { modal: g } = m.App.useApp(), d = m.useNotification(), R = u.useSelector(u.selectedIsUserPaySmth), x = u.useSelector(u.selectedCurrentUser), p = u.useSelector(_.selectActiveModal), { request: w, resolveImagePicker: j } = F.useImagePicker(), [C, U] = (0, n.useState)(""), [y, D] = (0, n.useState)(""), [O, T] = (0, n.useState)(""), [Q, N] = (0, n.useState)(""), [M, z] = (0, n.useState)(pe), [ee, K] = (0, n.useState)({
|
|
1635
1639
|
width: "",
|
|
1636
1640
|
height: "",
|
|
1637
1641
|
size: "",
|
|
1638
1642
|
format: ""
|
|
1639
|
-
}), [
|
|
1643
|
+
}), [k, P] = (0, n.useState)("success"), [E, I] = (0, n.useState)(!1), A = n.default.useRef(null), L = n.default.useRef(null), J = n.default.useRef(null), q = n.default.useRef(null), s = n.default.useRef(null), h = n.default.useRef(null), W = n.default.useRef(null), ce = n.default.useRef(null), Z = n.default.useRef(null), [$, X] = (0, n.useState)("auto"), [H, ie] = (0, n.useState)(572), [he, ye] = (0, n.useState)(!1), [ue, Y] = (0, n.useState)({
|
|
1640
1644
|
keywords: "",
|
|
1641
1645
|
color: "",
|
|
1642
1646
|
orientation: ""
|
|
1643
|
-
}), [se, B] = (0, n.useState)({ keywords: "" }), [ae, v] = (0, n.useState)([]), [te,
|
|
1647
|
+
}), [se, B] = (0, n.useState)({ keywords: "" }), [ae, v] = (0, n.useState)([]), [te, G] = (0, n.useState)([]), [fe, Zt] = (0, n.useState)([]), [ct, ut] = (0, n.useState)(!1), [dt, Ve] = (0, n.useState)(""), [Xt, Ee] = (0, n.useState)(!1), [Jt, Be] = (0, n.useState)(0), Qe = u.useSelector(u.selectProject), ft = Qe?.id !== void 0 ? String(Qe.id) : l || "", mt = u.useEventEmitter(u.events.UPLOAD_EVENT_ID), Ie = n.default.useRef(ne.createImageUrlBlobResolver()), qe = n.default.useRef(""), be = n.default.useRef(0), xe = n.default.useRef(""), [$t, pt] = (0, n.useState)(""), [en, gt] = (0, n.useState)(null), [tn, Ye] = (0, n.useState)(""), Ue = (0, n.useCallback)((c) => {
|
|
1644
1648
|
if (!(c instanceof Blob)) return;
|
|
1645
|
-
|
|
1646
|
-
const
|
|
1647
|
-
|
|
1649
|
+
xe.current && URL.revokeObjectURL(xe.current);
|
|
1650
|
+
const f = URL.createObjectURL(c);
|
|
1651
|
+
xe.current = f, pt(f), gt(c);
|
|
1648
1652
|
}, []), ge = (0, n.useCallback)(() => {
|
|
1649
|
-
|
|
1653
|
+
xe.current && (URL.revokeObjectURL(xe.current), xe.current = ""), pt(""), gt(null);
|
|
1650
1654
|
}, []), de = (0, n.useCallback)(() => {
|
|
1651
|
-
|
|
1655
|
+
Ye("");
|
|
1652
1656
|
}, []);
|
|
1653
|
-
let ve = !(
|
|
1657
|
+
let ve = !(R || !F.isProjectOwner(Qe, x));
|
|
1654
1658
|
const nn = (c) => {
|
|
1655
1659
|
D(c.target.value);
|
|
1656
|
-
}, Me = (0, n.useCallback)((c,
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1660
|
+
}, Me = (0, n.useCallback)((c, f, S = a("The image could not be uploaded.")) => {
|
|
1661
|
+
const V = f instanceof Error ? f.message : S;
|
|
1662
|
+
d.error({
|
|
1659
1663
|
id: "IMAGE_UPLOAD_ERROR",
|
|
1660
1664
|
data: c,
|
|
1661
1665
|
title: a("Upload failed"),
|
|
1662
|
-
description:
|
|
1666
|
+
description: V
|
|
1663
1667
|
});
|
|
1664
|
-
}, [a,
|
|
1668
|
+
}, [a, d]), rn = (0, n.useCallback)(async (c) => F.pickUploadImageUrlFromFireResults(await mt.fire({
|
|
1665
1669
|
file: c,
|
|
1666
1670
|
project: ft
|
|
1667
|
-
})), [ft, mt]),
|
|
1671
|
+
})), [ft, mt]), we = ne.useImageBlobFetch(), sn = (0, n.useCallback)((c) => Ie.current.resolve(ne.canonicalImageUrlKey(c), void 0, we), [we]), Pe = async (c) => {
|
|
1668
1672
|
if (c) try {
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
} catch (
|
|
1672
|
-
Me({ url: c },
|
|
1673
|
+
const f = await an(c);
|
|
1674
|
+
f && Ze(f) ? await Oe({ file: f }) : f || Me({ url: c }, null, a("Failed to download image from URL."));
|
|
1675
|
+
} catch (f) {
|
|
1676
|
+
Me({ url: c }, f, a("Failed to process image URL."));
|
|
1673
1677
|
}
|
|
1674
1678
|
}, ht = n.default.useRef(Pe);
|
|
1675
1679
|
ht.current = Pe, n.default.useEffect(() => {
|
|
1676
|
-
if (M !== pe || !
|
|
1677
|
-
const c =
|
|
1680
|
+
if (M !== pe || !Q) return;
|
|
1681
|
+
const c = y.trim();
|
|
1678
1682
|
if (!c || !c.toLowerCase().startsWith("http")) return;
|
|
1679
|
-
const
|
|
1683
|
+
const f = setTimeout(() => {
|
|
1680
1684
|
ht.current(c);
|
|
1681
1685
|
}, 1e3);
|
|
1682
1686
|
return () => {
|
|
1683
|
-
clearTimeout(
|
|
1687
|
+
clearTimeout(f);
|
|
1684
1688
|
};
|
|
1685
1689
|
}, [
|
|
1686
|
-
|
|
1690
|
+
y,
|
|
1687
1691
|
M,
|
|
1688
|
-
|
|
1692
|
+
Q
|
|
1689
1693
|
]);
|
|
1690
|
-
const
|
|
1694
|
+
const an = async (c) => {
|
|
1691
1695
|
try {
|
|
1692
|
-
const
|
|
1693
|
-
return
|
|
1696
|
+
const f = ne.canonicalImageUrlKey(c);
|
|
1697
|
+
return _t(await Ie.current.resolve(f, void 0, we), f);
|
|
1694
1698
|
} catch {}
|
|
1695
1699
|
};
|
|
1696
1700
|
document.onpaste = function(c) {
|
|
1697
|
-
const
|
|
1698
|
-
if (M === pe &&
|
|
1699
|
-
if (
|
|
1700
|
-
const
|
|
1701
|
-
Ze(
|
|
1702
|
-
const oe = { file:
|
|
1701
|
+
const f = c.clipboardData?.items?.[0];
|
|
1702
|
+
if (M === pe && Q) {
|
|
1703
|
+
if (f?.type?.indexOf("image") === 0 && e.imageCenterLocalUploadEnabled !== !1) {
|
|
1704
|
+
const V = f.getAsFile();
|
|
1705
|
+
Ze(V);
|
|
1706
|
+
const oe = { file: V };
|
|
1703
1707
|
D(""), Oe(oe);
|
|
1704
1708
|
return;
|
|
1705
1709
|
}
|
|
@@ -1708,181 +1712,181 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1708
1712
|
c.preventDefault(), c.stopPropagation(), D(S.trim());
|
|
1709
1713
|
return;
|
|
1710
1714
|
}
|
|
1711
|
-
|
|
1712
|
-
if (
|
|
1713
|
-
else if (
|
|
1714
|
-
const oe =
|
|
1715
|
+
f?.type?.indexOf("text") === 0 && f.getAsString((V) => {
|
|
1716
|
+
if (V.trim().toLowerCase().startsWith("http")) D(V.trim());
|
|
1717
|
+
else if (V.toString().slice(1, 5) === "meta") {
|
|
1718
|
+
const oe = V.toString().split("\"")[1];
|
|
1715
1719
|
oe && D(oe);
|
|
1716
1720
|
}
|
|
1717
1721
|
});
|
|
1718
1722
|
}
|
|
1719
1723
|
}, (0, n.useEffect)(() => {
|
|
1720
|
-
const c = (
|
|
1724
|
+
const c = (f) => {
|
|
1721
1725
|
let S = null;
|
|
1722
|
-
|
|
1726
|
+
w?.kind === "background" ? (S = it, N(it)) : w?.kind === "img" && (N(ot), S = ot), w?.currentUrl && S && (U(w.currentUrl), z(f));
|
|
1723
1727
|
};
|
|
1724
|
-
p === u.MODALS.UPLOAD_IMAGE_MODAL || p === u.MODALS.UPLOAD_BACKGROUND_MODAL ? c(
|
|
1728
|
+
p === u.MODALS.UPLOAD_IMAGE_MODAL || p === u.MODALS.UPLOAD_BACKGROUND_MODAL ? c(Ae) : p === u.MODALS.UPLOAD_IMAGE_MODAL_AI || p === u.MODALS.UPLOAD_BACKGROUND_MODAL_AI ? (ve ? (Ee(!0), Be(2)) : c(He), setTimeout(() => Z.current?.focus({ cursor: "start" }), 100)) : p === u.MODALS.UPLOAD_IMAGE_MODAL_UPLOAD || p === u.MODALS.UPLOAD_BACKGROUND_MODAL_UPLOAD ? (c(pe), setTimeout(() => h.current?.focus({ cursor: "start" }), 100)) : p === u.MODALS.UPLOAD_IMAGE_MODAL_STOCK || p === u.MODALS.UPLOAD_BACKGROUND_MODAL_STOCK ? (ve ? (Ee(!0), Be(3)) : c(Ke), setTimeout(() => ce.current?.focus({ cursor: "start" }), 100)) : p === u.MODALS.UPLOAD_IMAGE_MODAL_GIF || p === u.MODALS.UPLOAD_BACKGROUND_MODAL_GIF ? (ve ? (Ee(!0), Be(3)) : c(We), setTimeout(() => W.current?.focus({ cursor: "start" }), 100)) : p === u.MODALS.UPLOAD_IMAGE_MODAL_EDIT || p === u.MODALS.UPLOAD_BACKGROUND_MODAL_EDIT ? (ve ? (Ee(!0), Be(5)) : c(Ae), i(_.openSecondModal(u.MODALS.IMAGE_EDITOR_MODAL))) : N("");
|
|
1725
1729
|
}, [
|
|
1726
1730
|
p,
|
|
1727
1731
|
i,
|
|
1728
1732
|
ve,
|
|
1729
|
-
|
|
1733
|
+
w
|
|
1730
1734
|
]);
|
|
1731
|
-
const
|
|
1732
|
-
|
|
1735
|
+
const _e = (0, n.useCallback)(({ url: c = C || "", meta: f = Ht }) => {
|
|
1736
|
+
U(c), j({
|
|
1733
1737
|
url: c,
|
|
1734
|
-
meta:
|
|
1738
|
+
meta: f
|
|
1735
1739
|
}), setTimeout(() => {
|
|
1736
|
-
de(), ge(),
|
|
1740
|
+
de(), ge(), Y({
|
|
1737
1741
|
keywords: "",
|
|
1738
1742
|
color: "",
|
|
1739
1743
|
orientation: ""
|
|
1740
|
-
}), B({ keywords: "" }),
|
|
1741
|
-
}, 200), i(
|
|
1744
|
+
}), B({ keywords: "" }), G([]), v([]), N(""), Ve(""), ut(!1), T(""), D(""), z(pe);
|
|
1745
|
+
}, 200), i(_.closeModal()), i(_.closeSecondModal());
|
|
1742
1746
|
}, [
|
|
1743
|
-
|
|
1747
|
+
C,
|
|
1744
1748
|
de,
|
|
1745
1749
|
i,
|
|
1746
1750
|
j,
|
|
1747
1751
|
ge
|
|
1748
|
-
]), yt = (0, n.useCallback)((c,
|
|
1752
|
+
]), yt = (0, n.useCallback)((c, f) => (X("auto"), I(!1), _e({
|
|
1749
1753
|
url: c,
|
|
1750
1754
|
meta: Vt
|
|
1751
|
-
}),
|
|
1755
|
+
}), d.success({
|
|
1752
1756
|
id: "IMAGE_UPLOAD_SUCCESS",
|
|
1753
|
-
data:
|
|
1757
|
+
data: f,
|
|
1754
1758
|
title: a("The image was successfully uploaded.")
|
|
1755
1759
|
}), c), [
|
|
1756
1760
|
a,
|
|
1757
|
-
|
|
1758
|
-
|
|
1761
|
+
_e,
|
|
1762
|
+
d
|
|
1759
1763
|
]);
|
|
1760
1764
|
(0, n.useEffect)(() => {
|
|
1761
|
-
const c =
|
|
1762
|
-
if (!c || !
|
|
1763
|
-
|
|
1765
|
+
const c = y || O, f = ne.canonicalImageUrlKey(c);
|
|
1766
|
+
if (!c || !f) {
|
|
1767
|
+
P(""), qe.current = "", de(), ge(), Ie.current.invalidateAll();
|
|
1764
1768
|
return;
|
|
1765
1769
|
}
|
|
1766
1770
|
const S = qe.current;
|
|
1767
|
-
S && S !==
|
|
1768
|
-
const
|
|
1771
|
+
S && S !== f && (Ie.current.abandonKey(S), de(), ge()), qe.current = f;
|
|
1772
|
+
const V = new AbortController(), oe = y ? 800 : 0, re = ++be.current, Xe = setTimeout(async () => {
|
|
1769
1773
|
try {
|
|
1770
|
-
const
|
|
1771
|
-
const me = await
|
|
1772
|
-
if (
|
|
1773
|
-
const { width: Ce, height:
|
|
1774
|
-
|
|
1774
|
+
const Se = async () => {
|
|
1775
|
+
const me = await Ie.current.resolve(f, V.signal, we);
|
|
1776
|
+
if (re !== be.current) return;
|
|
1777
|
+
const { width: Ce, height: un } = await ne.getImageDimensionsFromBlob(me);
|
|
1778
|
+
re === be.current && (K({
|
|
1775
1779
|
width: Ce,
|
|
1776
|
-
height:
|
|
1780
|
+
height: un,
|
|
1777
1781
|
size: (me.size / 1024).toFixed(2),
|
|
1778
|
-
format:
|
|
1782
|
+
format: ke(me.type)
|
|
1779
1783
|
}), de(), Ue(me));
|
|
1780
1784
|
};
|
|
1781
|
-
if (o) await
|
|
1785
|
+
if (o) await Se();
|
|
1782
1786
|
else {
|
|
1783
|
-
const me = await
|
|
1784
|
-
if (me?.previewUrl &&
|
|
1785
|
-
|
|
1787
|
+
const me = await ne.resolveDataProviderPreview(t, f);
|
|
1788
|
+
if (me?.previewUrl && re === be.current) {
|
|
1789
|
+
Ye(me.previewUrl), ge();
|
|
1786
1790
|
try {
|
|
1787
|
-
const { data: Ce } = await
|
|
1788
|
-
if (
|
|
1789
|
-
Ce ?
|
|
1791
|
+
const { data: Ce } = await b(f);
|
|
1792
|
+
if (re !== be.current) return;
|
|
1793
|
+
Ce ? K({
|
|
1790
1794
|
width: Ce?.width,
|
|
1791
1795
|
height: Ce?.height,
|
|
1792
1796
|
size: Ce?.fileSize != null ? (Ce.fileSize / 1024).toFixed(2) : "",
|
|
1793
|
-
format:
|
|
1794
|
-
}) : await
|
|
1797
|
+
format: ke(Ce?.format)
|
|
1798
|
+
}) : await Se();
|
|
1795
1799
|
} catch {
|
|
1796
|
-
await
|
|
1800
|
+
await Se();
|
|
1797
1801
|
}
|
|
1798
|
-
} else await
|
|
1802
|
+
} else await Se();
|
|
1799
1803
|
}
|
|
1800
|
-
if (
|
|
1801
|
-
|
|
1804
|
+
if (re !== be.current) return;
|
|
1805
|
+
P("success"), U(c), ie(572), setTimeout(() => {
|
|
1802
1806
|
let me = 0;
|
|
1803
|
-
|
|
1807
|
+
L.current && (me = L.current.offsetHeight + 62), X(me);
|
|
1804
1808
|
}, 0);
|
|
1805
|
-
} catch (
|
|
1806
|
-
if (
|
|
1807
|
-
de(), ge(),
|
|
1809
|
+
} catch (Se) {
|
|
1810
|
+
if (Se?.name === "AbortError" || V.signal.aborted || re !== be.current) return;
|
|
1811
|
+
de(), ge(), P("error");
|
|
1808
1812
|
}
|
|
1809
1813
|
}, oe);
|
|
1810
1814
|
return () => {
|
|
1811
|
-
clearTimeout(Xe),
|
|
1815
|
+
clearTimeout(Xe), V.abort();
|
|
1812
1816
|
};
|
|
1813
1817
|
}, [
|
|
1814
|
-
|
|
1815
|
-
|
|
1818
|
+
y,
|
|
1819
|
+
O,
|
|
1816
1820
|
o,
|
|
1817
1821
|
de,
|
|
1818
|
-
|
|
1819
|
-
|
|
1822
|
+
we,
|
|
1823
|
+
b,
|
|
1820
1824
|
ge,
|
|
1821
1825
|
t,
|
|
1822
1826
|
Ue
|
|
1823
1827
|
]), (0, n.useEffect)(() => {
|
|
1824
|
-
if (!
|
|
1825
|
-
const c =
|
|
1828
|
+
if (!C || y || O) return;
|
|
1829
|
+
const c = ne.canonicalImageUrlKey(C), f = new AbortController();
|
|
1826
1830
|
let S = !1;
|
|
1827
|
-
const
|
|
1828
|
-
const oe = await
|
|
1831
|
+
const V = async () => {
|
|
1832
|
+
const oe = await Ie.current.resolve(c, f.signal, we);
|
|
1829
1833
|
if (S) return;
|
|
1830
|
-
const { width:
|
|
1831
|
-
S || (de(), Ue(oe),
|
|
1832
|
-
width:
|
|
1834
|
+
const { width: re, height: Xe } = await ne.getImageDimensionsFromBlob(oe);
|
|
1835
|
+
S || (de(), Ue(oe), K({
|
|
1836
|
+
width: re,
|
|
1833
1837
|
height: Xe,
|
|
1834
1838
|
size: (oe.size / 1024).toFixed(2),
|
|
1835
|
-
format:
|
|
1839
|
+
format: ke(oe.type)
|
|
1836
1840
|
}));
|
|
1837
1841
|
};
|
|
1838
1842
|
return (async () => {
|
|
1839
1843
|
try {
|
|
1840
1844
|
if (!o) {
|
|
1841
|
-
const oe = await
|
|
1845
|
+
const oe = await ne.resolveDataProviderPreview(t, c);
|
|
1842
1846
|
if (oe?.previewUrl && !S) {
|
|
1843
|
-
|
|
1847
|
+
Ye(oe.previewUrl), ge();
|
|
1844
1848
|
try {
|
|
1845
|
-
const { data:
|
|
1849
|
+
const { data: re } = await b(c);
|
|
1846
1850
|
if (S) return;
|
|
1847
|
-
|
|
1848
|
-
width:
|
|
1849
|
-
height:
|
|
1850
|
-
size:
|
|
1851
|
-
format:
|
|
1852
|
-
}) : await
|
|
1851
|
+
re ? K({
|
|
1852
|
+
width: re?.width,
|
|
1853
|
+
height: re?.height,
|
|
1854
|
+
size: re?.fileSize != null ? (re.fileSize / 1024).toFixed(2) : "",
|
|
1855
|
+
format: ke(re?.format)
|
|
1856
|
+
}) : await V();
|
|
1853
1857
|
return;
|
|
1854
1858
|
} catch {
|
|
1855
|
-
await
|
|
1859
|
+
await V();
|
|
1856
1860
|
}
|
|
1857
1861
|
}
|
|
1858
1862
|
}
|
|
1859
|
-
await
|
|
1863
|
+
await V();
|
|
1860
1864
|
} catch {
|
|
1861
1865
|
S || de();
|
|
1862
1866
|
}
|
|
1863
1867
|
})(), () => {
|
|
1864
|
-
S = !0,
|
|
1868
|
+
S = !0, f.abort();
|
|
1865
1869
|
};
|
|
1866
1870
|
}, [
|
|
1867
1871
|
o,
|
|
1868
1872
|
de,
|
|
1869
|
-
w,
|
|
1870
|
-
Ee,
|
|
1871
1873
|
C,
|
|
1874
|
+
we,
|
|
1875
|
+
b,
|
|
1872
1876
|
t,
|
|
1873
|
-
|
|
1874
|
-
|
|
1877
|
+
y,
|
|
1878
|
+
O,
|
|
1875
1879
|
Ue
|
|
1876
1880
|
]);
|
|
1877
|
-
const
|
|
1878
|
-
i(
|
|
1879
|
-
de(), ge(),
|
|
1881
|
+
const on = () => {
|
|
1882
|
+
i(_.closeModal()), setTimeout(() => {
|
|
1883
|
+
de(), ge(), U(""), D(""), G([]), G([]), Y({
|
|
1880
1884
|
keywords: "",
|
|
1881
1885
|
color: "",
|
|
1882
1886
|
orientation: ""
|
|
1883
|
-
}), B({ keywords: "" }), X("auto"), !ct && Ve(""), ie(572),
|
|
1887
|
+
}), B({ keywords: "" }), X("auto"), !ct && Ve(""), ie(572), z(pe);
|
|
1884
1888
|
}, 200);
|
|
1885
|
-
},
|
|
1889
|
+
}, ln = (c) => {
|
|
1886
1890
|
c === Wt ? g.success({
|
|
1887
1891
|
mask: { closable: !0 },
|
|
1888
1892
|
centered: !0,
|
|
@@ -1890,54 +1894,54 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1890
1894
|
content: a("The feature is under development."),
|
|
1891
1895
|
okText: a("Ok. I'll be waiting"),
|
|
1892
1896
|
onOk: () => {}
|
|
1893
|
-
}) : c ===
|
|
1897
|
+
}) : c === Ae && C === "" ? g.warning({
|
|
1894
1898
|
mask: { closable: !0 },
|
|
1895
1899
|
centered: !0,
|
|
1896
1900
|
title: a(""),
|
|
1897
1901
|
content: a("To preview and edit the uploaded image"),
|
|
1898
1902
|
okText: a("Upload Image"),
|
|
1899
1903
|
onOk: () => {
|
|
1900
|
-
|
|
1904
|
+
z(pe);
|
|
1901
1905
|
}
|
|
1902
1906
|
}) : (setTimeout(() => {
|
|
1903
|
-
let
|
|
1904
|
-
c === pe && A.current ? (ue.keywords === "" &&
|
|
1905
|
-
}, 0),
|
|
1907
|
+
let f = 0, S = 0;
|
|
1908
|
+
c === pe && A.current ? (ue.keywords === "" && h.current?.focus({ cursor: "start" }), f = 300, S = 572) : c === Ae && L.current ? (f = L.current.offsetHeight + 62, S = 572) : c === Ke && J.current ? (ue.keywords === "" && ce.current?.focus({ cursor: "start" }), f = 130, S = 572, te.length > 0 && (S = 1060, f = "84vh")) : c === We && q.current ? (ue.keywords === "" && W.current?.focus({ cursor: "start" }), f = 130, S = 572, ae.length > 0 && (S = 1060, f = "84vh")) : c === He && s.current && (dt === "" && fe.length === 0 ? (Z.current?.focus({ cursor: "start" }), f = 130) : f = s.current.offsetHeight + 82, S = 572), X(f), ie(S);
|
|
1909
|
+
}, 0), z(c));
|
|
1906
1910
|
};
|
|
1907
1911
|
(0, n.useEffect)(() => {
|
|
1908
|
-
ue.keywords === "" && (
|
|
1912
|
+
ue.keywords === "" && (h?.current?.focus({ cursor: "start" }), G([]), setTimeout(() => {
|
|
1909
1913
|
X("auto"), ie(572);
|
|
1910
1914
|
}, 0));
|
|
1911
1915
|
}, [
|
|
1912
1916
|
ue,
|
|
1913
|
-
|
|
1917
|
+
G,
|
|
1914
1918
|
X,
|
|
1915
1919
|
ie
|
|
1916
1920
|
]);
|
|
1917
1921
|
const Ze = (c) => {
|
|
1918
|
-
const
|
|
1919
|
-
return
|
|
1922
|
+
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";
|
|
1923
|
+
return f || d.error({
|
|
1920
1924
|
id: "IMAGE_UPLOAD_WRONG_FORMAT",
|
|
1921
1925
|
data: c,
|
|
1922
1926
|
title: "Upload",
|
|
1923
1927
|
description: "You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!"
|
|
1924
|
-
}),
|
|
1928
|
+
}), f;
|
|
1925
1929
|
}, Oe = async ({ file: c }) => {
|
|
1926
1930
|
try {
|
|
1927
1931
|
ye(!0);
|
|
1928
|
-
const
|
|
1929
|
-
if (S) return yt(S,
|
|
1930
|
-
const
|
|
1931
|
-
if (
|
|
1932
|
-
Me(
|
|
1932
|
+
const f = await ne.prepareImageForEditorUpload(c, e), S = await rn(f);
|
|
1933
|
+
if (S) return yt(S, f), S;
|
|
1934
|
+
const V = await Kt(f, t);
|
|
1935
|
+
if (V?.url) return yt(V.url, f), V.url;
|
|
1936
|
+
Me(f, null);
|
|
1933
1937
|
return;
|
|
1934
|
-
} catch (
|
|
1935
|
-
Me(c,
|
|
1938
|
+
} catch (f) {
|
|
1939
|
+
Me(c, f);
|
|
1936
1940
|
return;
|
|
1937
1941
|
} finally {
|
|
1938
1942
|
ye(!1);
|
|
1939
1943
|
}
|
|
1940
|
-
},
|
|
1944
|
+
}, cn = (c) => Oe({ file: c });
|
|
1941
1945
|
let Le = [{
|
|
1942
1946
|
label: a("Upload"),
|
|
1943
1947
|
key: pe,
|
|
@@ -1955,7 +1959,7 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1955
1959
|
children: [
|
|
1956
1960
|
(0, r.jsx)("p", {
|
|
1957
1961
|
className: "ant-upload-drag-icon",
|
|
1958
|
-
children: (0, r.jsx)(
|
|
1962
|
+
children: (0, r.jsx)(F.EmIcons, { icon: "InboxOutlined" })
|
|
1959
1963
|
}),
|
|
1960
1964
|
(0, r.jsx)("p", {
|
|
1961
1965
|
className: "ant-upload-text",
|
|
@@ -1966,16 +1970,16 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1966
1970
|
children: a("Accepted formats: PNG, JPG, WEBP, SVG or GIF.")
|
|
1967
1971
|
})
|
|
1968
1972
|
]
|
|
1969
|
-
}), (0, r.jsx)(
|
|
1973
|
+
}), (0, r.jsx)(m.Form, {
|
|
1970
1974
|
style: { padding: "0 2px 0 2px" },
|
|
1971
|
-
children: (0, r.jsx)(
|
|
1972
|
-
validateStatus:
|
|
1973
|
-
children: (0, r.jsx)(
|
|
1974
|
-
ref:
|
|
1975
|
+
children: (0, r.jsx)(m.Form.Item, {
|
|
1976
|
+
validateStatus: k,
|
|
1977
|
+
children: (0, r.jsx)(m.Input, {
|
|
1978
|
+
ref: h,
|
|
1975
1979
|
allowClear: !0,
|
|
1976
1980
|
size: "large",
|
|
1977
1981
|
placeholder: a("Paste image URL here"),
|
|
1978
|
-
value:
|
|
1982
|
+
value: y,
|
|
1979
1983
|
onChange: nn,
|
|
1980
1984
|
spellCheck: "false"
|
|
1981
1985
|
})
|
|
@@ -1991,13 +1995,13 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
1991
1995
|
style: { paddingBottom: 24 },
|
|
1992
1996
|
children: (0, r.jsx)(Dt, {
|
|
1993
1997
|
currentReq: ue,
|
|
1994
|
-
setCurrentReq:
|
|
1998
|
+
setCurrentReq: Y,
|
|
1995
1999
|
imageStockList: te,
|
|
1996
|
-
setImageStockList:
|
|
2000
|
+
setImageStockList: G,
|
|
1997
2001
|
setModalWidth: ie,
|
|
1998
2002
|
setModalHeight: X,
|
|
1999
|
-
setStockLink:
|
|
2000
|
-
setCurrentImageLink:
|
|
2003
|
+
setStockLink: T,
|
|
2004
|
+
setCurrentImageLink: U,
|
|
2001
2005
|
inputRef: ce,
|
|
2002
2006
|
customRequest: Pe
|
|
2003
2007
|
})
|
|
@@ -2015,9 +2019,9 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
2015
2019
|
setImageGifList: v,
|
|
2016
2020
|
setModalWidth: ie,
|
|
2017
2021
|
setModalHeight: X,
|
|
2018
|
-
setStockLink:
|
|
2019
|
-
setCurrentImageLink:
|
|
2020
|
-
inputRef:
|
|
2022
|
+
setStockLink: T,
|
|
2023
|
+
setCurrentImageLink: U,
|
|
2024
|
+
inputRef: W,
|
|
2021
2025
|
customRequest: Pe
|
|
2022
2026
|
})
|
|
2023
2027
|
})
|
|
@@ -2038,40 +2042,41 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
2038
2042
|
setIsLoadingAi: ut,
|
|
2039
2043
|
aiTabRef: s,
|
|
2040
2044
|
inputAiRef: Z,
|
|
2041
|
-
isImageUploaded:
|
|
2042
|
-
setIsImageUploaded:
|
|
2045
|
+
isImageUploaded: E,
|
|
2046
|
+
setIsImageUploaded: I
|
|
2043
2047
|
})
|
|
2044
2048
|
})
|
|
2045
2049
|
}), e.imageCenterEditorEnabled && Le.push({
|
|
2046
2050
|
label: "",
|
|
2047
|
-
key:
|
|
2051
|
+
key: Ae,
|
|
2048
2052
|
children: (0, r.jsx)("div", {
|
|
2049
|
-
ref:
|
|
2053
|
+
ref: L,
|
|
2050
2054
|
children: (0, r.jsx)(St, {
|
|
2051
|
-
currentImageLink:
|
|
2052
|
-
newLink:
|
|
2055
|
+
currentImageLink: C,
|
|
2056
|
+
newLink: y,
|
|
2053
2057
|
previewDisplayUrl: tn,
|
|
2054
2058
|
resolvedPreviewObjectUrl: $t,
|
|
2055
2059
|
resolvedPreviewBlob: en,
|
|
2060
|
+
resolveImageBlob: sn,
|
|
2056
2061
|
imageSize: ee,
|
|
2057
|
-
onSave:
|
|
2062
|
+
onSave: cn,
|
|
2058
2063
|
uploadImageResultIsLoading: he || !1
|
|
2059
2064
|
})
|
|
2060
2065
|
})
|
|
2061
|
-
}), (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(
|
|
2062
|
-
width:
|
|
2066
|
+
}), (0, r.jsxs)(r.Fragment, { children: [(0, r.jsx)(m.Modal, {
|
|
2067
|
+
width: H,
|
|
2063
2068
|
className: "image-center",
|
|
2064
2069
|
title: a("Image Center"),
|
|
2065
2070
|
style: { minHeight: 390 },
|
|
2066
|
-
open: !!
|
|
2067
|
-
onOk:
|
|
2068
|
-
onCancel:
|
|
2069
|
-
footer: M ===
|
|
2070
|
-
children: (0, r.jsx)(
|
|
2071
|
+
open: !!Q,
|
|
2072
|
+
onOk: _e,
|
|
2073
|
+
onCancel: on,
|
|
2074
|
+
footer: M === Ae ? (0, r.jsx)(r.Fragment, {}) : null,
|
|
2075
|
+
children: (0, r.jsx)(m.Spin, {
|
|
2071
2076
|
spinning: he,
|
|
2072
|
-
children: (0, r.jsx)(
|
|
2077
|
+
children: (0, r.jsx)(m.Tabs, {
|
|
2073
2078
|
activeKey: M,
|
|
2074
|
-
onChange:
|
|
2079
|
+
onChange: ln,
|
|
2075
2080
|
items: Le,
|
|
2076
2081
|
className: "modal-tabs",
|
|
2077
2082
|
style: {
|
|
@@ -2080,11 +2085,11 @@ Select the appropriate plan to fulfil more requests`),
|
|
|
2080
2085
|
}
|
|
2081
2086
|
})
|
|
2082
2087
|
})
|
|
2083
|
-
}), (0, r.jsx)(
|
|
2088
|
+
}), (0, r.jsx)(F.ModalToChangeConfigOnFree, {
|
|
2084
2089
|
open: Xt,
|
|
2085
|
-
onCancel: () =>
|
|
2090
|
+
onCancel: () => Ee(!1),
|
|
2086
2091
|
initialSlide: Jt
|
|
2087
2092
|
})] });
|
|
2088
2093
|
};
|
|
2089
|
-
lt.propTypes = { dataProvider:
|
|
2094
|
+
lt.propTypes = { dataProvider: Te.default.object }, vt.default = lt;
|
|
2090
2095
|
});
|